]> git.sesse.net Git - ffmpeg/blobdiff - libavformat/rtpdec_h264.c
avio: deprecate url_fgets
[ffmpeg] / libavformat / rtpdec_h264.c
index a6e0de859046b1ddfd8939211d6183a1043648c4..75db14c1f8f239fa55b3729a81af2fa7c58d9cde 100644 (file)
@@ -47,7 +47,7 @@
 #include <assert.h>
 
 #include "rtpdec.h"
-#include "rtpdec_h264.h"
+#include "rtpdec_formats.h"
 
 /**
     RTP/H264 specific private data.
@@ -70,8 +70,8 @@ struct PayloadContext {
 
 /* ---------------- private code */
 static int sdp_parse_fmtp_config_h264(AVStream * stream,
-                                       PayloadContext * h264_data,
-                                       char *attr, char *value)
+                                      PayloadContext * h264_data,
+                                      char *attr, char *value)
 {
     AVCodecContext *codec = stream->codec;
     assert(codec->codec_id == CODEC_ID_H264);
@@ -120,7 +120,7 @@ static int sdp_parse_fmtp_config_h264(AVStream * stream,
         while (*value) {
             char base64packet[1024];
             uint8_t decoded_packet[1024];
-            uint32_t packet_size;
+            int packet_size;
             char *dst = base64packet;
 
             while (*value && *value != ','
@@ -133,7 +133,7 @@ static int sdp_parse_fmtp_config_h264(AVStream * stream,
                 value++;
 
             packet_size= av_base64_decode(decoded_packet, base64packet, sizeof(decoded_packet));
-            if (packet_size) {
+            if (packet_size > 0) {
                 uint8_t *dest = av_malloc(packet_size + sizeof(start_sequence) +
                                          codec->extradata_size +
                                          FF_INPUT_BUFFER_PADDING_SIZE);
@@ -187,10 +187,7 @@ static int h264_handle_packet(AVFormatContext *ctx,
     if (type >= 1 && type <= 23)
         type = 1;              // simplify the case. (these are all the nal types used internally by the h264 codec)
     switch (type) {
-    case 0:                    // undefined;
-        result= -1;
-        break;
-
+    case 0:                    // undefined, but pass them through
     case 1:
         av_new_packet(pkt, len+sizeof(start_sequence));
         memcpy(pkt->data, start_sequence, sizeof(start_sequence));
@@ -385,20 +382,7 @@ static int parse_h264_sdp_line(AVFormatContext *s, int st_index,
         codec->height = atoi(p + 1); // skip the -
         codec->pix_fmt = PIX_FMT_YUV420P;
     } else if (av_strstart(p, "fmtp:", &p)) {
-        char attr[256];
-        char value[4096];
-
-        // remove the protocol identifier..
-        while (*p && *p == ' ') p++; // strip spaces.
-        while (*p && *p != ' ') p++; // eat protocol identifier
-        while (*p && *p == ' ') p++; // strip trailing spaces.
-
-        /* loop on each attribute */
-        while (ff_rtsp_next_attr_and_value
-               (&p, attr, sizeof(attr), value, sizeof(value))) {
-            /* grab the codec extra_data from the config parameter of the fmtp line */
-            sdp_parse_fmtp_config_h264(stream, h264_data, attr, value);
-        }
+        return ff_parse_fmtp(stream, h264_data, p, sdp_parse_fmtp_config_h264);
     } else if (av_strstart(p, "cliprect:", &p)) {
         // could use this if we wanted.
     }