]> git.sesse.net Git - ffmpeg/blobdiff - libavformat/rtpdec_mpeg4.c
avidec: return 0, not packet size from read_packet().
[ffmpeg] / libavformat / rtpdec_mpeg4.c
index 137dbd2613e48255b22ab42fc6486e5a70e08e13..d3e0754253462c2d5d1293eb154a257414880b8a 100644 (file)
@@ -1,22 +1,22 @@
-/**
+/*
  * Common code for the RTP depacketization of MPEG-4 formats.
  * Copyright (c) 2010 Fabrice Bellard
  *                    Romain Degez
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -31,7 +31,6 @@
 #include "internal.h"
 #include "libavutil/avstring.h"
 #include "libavcodec/get_bits.h"
-#include <strings.h>
 
 /** Structure listing useful vars to parse RTP packet payload*/
 struct PayloadContext
@@ -111,8 +110,7 @@ static int parse_fmtp_config(AVCodecContext * codec, char *value)
 {
     /* decode the hexa encoded parameter */
     int len = ff_hex_to_data(NULL, value);
-    if (codec->extradata)
-        av_free(codec->extradata);
+    av_free(codec->extradata);
     codec->extradata = av_mallocz(len + FF_INPUT_BUFFER_PADDING_SIZE);
     if (!codec->extradata)
         return AVERROR(ENOMEM);
@@ -204,10 +202,10 @@ static int parse_fmtp(AVStream *stream, PayloadContext *data,
             return res;
     }
 
-    if (codec->codec_id == CODEC_ID_AAC) {
+    if (codec->codec_id == AV_CODEC_ID_AAC) {
         /* Looking for a known attribute */
         for (i = 0; attr_names[i].str; ++i) {
-            if (!strcasecmp(attr, attr_names[i].str)) {
+            if (!av_strcasecmp(attr, attr_names[i].str)) {
                 if (attr_names[i].type == ATTR_NAME_TYPE_INT) {
                     *(int *)((char *)data+
                         attr_names[i].offset) = atoi(value);
@@ -225,6 +223,9 @@ static int parse_sdp_line(AVFormatContext *s, int st_index,
 {
     const char *p;
 
+    if (st_index < 0)
+        return 0;
+
     if (av_strstart(line, "fmtp:", &p))
         return ff_parse_fmtp(s->streams[st_index], data, p, parse_fmtp);
 
@@ -234,19 +235,16 @@ static int parse_sdp_line(AVFormatContext *s, int st_index,
 RTPDynamicProtocolHandler ff_mp4v_es_dynamic_handler = {
     .enc_name           = "MP4V-ES",
     .codec_type         = AVMEDIA_TYPE_VIDEO,
-    .codec_id           = CODEC_ID_MPEG4,
+    .codec_id           = AV_CODEC_ID_MPEG4,
     .parse_sdp_a_line   = parse_sdp_line,
-    .open               = NULL,
-    .close              = NULL,
-    .parse_packet       = NULL
 };
 
 RTPDynamicProtocolHandler ff_mpeg4_generic_dynamic_handler = {
     .enc_name           = "mpeg4-generic",
     .codec_type         = AVMEDIA_TYPE_AUDIO,
-    .codec_id           = CODEC_ID_AAC,
+    .codec_id           = AV_CODEC_ID_AAC,
     .parse_sdp_a_line   = parse_sdp_line,
-    .open               = new_context,
-    .close              = free_context,
+    .alloc              = new_context,
+    .free               = free_context,
     .parse_packet       = aac_parse_packet
 };