OSDN Git Service

Merge commit 'ac0e54fda9305cc7d149007f5b512bb8619f7c78'
authorMichael Niedermayer <michaelni@gmx.at>
Tue, 24 Feb 2015 22:38:14 +0000 (23:38 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Tue, 24 Feb 2015 22:38:19 +0000 (23:38 +0100)
* commit 'ac0e54fda9305cc7d149007f5b512bb8619f7c78':
  rtpdec: Add const to string parameters in internal fmtp parsing functions

Merged-by: Michael Niedermayer <michaelni@gmx.at>
1  2 
libavformat/rtpdec_h264.c
libavformat/rtpdec_latm.c
libavformat/rtpdec_mpeg4.c

@@@ -2,20 -2,20 +2,20 @@@
   * RTP H264 Protocol (RFC3984)
   * Copyright (c) 2006 Ryan Martell
   *
 - * This file is part of Libav.
 + * This file is part of FFmpeg.
   *
 - * Libav is free software; you can redistribute it and/or
 + * FFmpeg 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.
   *
 - * Libav is distributed in the hope that it will be useful,
 + * FFmpeg 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 Libav; if not, write to the Free Software
 + * License along with FFmpeg; if not, write to the Free Software
   * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
   */
  
@@@ -66,7 -66,7 +66,7 @@@ static const uint8_t start_sequence[] 
  
  static void parse_profile_level_id(AVFormatContext *s,
                                     PayloadContext *h264_data,
-                                    char *value)
+                                    const char *value)
  {
      char buffer[3];
      // 6 characters=3 bytes, in hex.
@@@ -199,7 -199,7 +199,7 @@@ void ff_h264_parse_framesize(AVCodecCon
      codec->height  = atoi(p + 1); // skip the -
  }
  
 -int ff_h264_handle_aggregated_packet(AVFormatContext *ctx, AVPacket *pkt,
 +int ff_h264_handle_aggregated_packet(AVFormatContext *ctx, PayloadContext *data, AVPacket *pkt,
                                       const uint8_t *buf, int len,
                                       int skip_between, int *nal_counters,
                                       int nal_mask)
@@@ -278,7 -278,7 +278,7 @@@ int ff_h264_handle_frag_packet(AVPacke
      return 0;
  }
  
 -static int h264_handle_packet_fu_a(AVFormatContext *ctx, AVPacket *pkt,
 +static int h264_handle_packet_fu_a(AVFormatContext *ctx, PayloadContext *data, AVPacket *pkt,
                                     const uint8_t *buf, int len,
                                     int *nal_counters, int nal_mask)
  {
@@@ -339,7 -339,7 +339,7 @@@ static int h264_handle_packet(AVFormatC
          // consume the STAP-A NAL
          buf++;
          len--;
 -        result = ff_h264_handle_aggregated_packet(ctx, pkt, buf, len, 0,
 +        result = ff_h264_handle_aggregated_packet(ctx, data, pkt, buf, len, 0,
                                                    NAL_COUNTERS, NAL_MASK);
          break;
  
          break;
  
      case 28:                   // FU-A (fragmented nal)
 -        result = h264_handle_packet_fu_a(ctx, pkt, buf, len,
 +        result = h264_handle_packet_fu_a(ctx, data, pkt, buf, len,
                                           NAL_COUNTERS, NAL_MASK);
          break;
  
@@@ -2,20 -2,20 +2,20 @@@
   * RTP Depacketization of MP4A-LATM, RFC 3016
   * Copyright (c) 2010 Martin Storsjo
   *
 - * This file is part of Libav.
 + * This file is part of FFmpeg.
   *
 - * Libav is free software; you can redistribute it and/or
 + * FFmpeg 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.
   *
 - * Libav is distributed in the hope that it will be useful,
 + * FFmpeg 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 Libav; if not, write to the Free Software
 + * License along with FFmpeg; if not, write to the Free Software
   * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
   */
  
@@@ -38,7 -38,7 +38,7 @@@ static void latm_free_context(PayloadCo
          avio_close_dyn_buf(data->dyn_buf, &p);
          av_free(p);
      }
 -    av_free(data->buf);
 +    av_freep(&data->buf);
      av_free(data);
  }
  
@@@ -65,7 -65,7 +65,7 @@@ static int latm_parse_packet(AVFormatCo
  
          if (!(flags & RTP_FLAG_MARKER))
              return AVERROR(EAGAIN);
 -        av_free(data->buf);
 +        av_freep(&data->buf);
          data->len = avio_close_dyn_buf(data->dyn_buf, &data->buf);
          data->dyn_buf = NULL;
          data->pos = 0;
@@@ -96,7 -96,7 +96,7 @@@
      return data->pos < data->len;
  }
  
- static int parse_fmtp_config(AVStream *st, char *value)
+ static int parse_fmtp_config(AVStream *st, const char *value)
  {
      int len = ff_hex_to_data(NULL, value), i, ret = 0;
      GetBitContext gb;
          goto end;
      }
      av_freep(&st->codec->extradata);
 -    st->codec->extradata_size = (get_bits_left(&gb) + 7)/8;
 -    st->codec->extradata = av_mallocz(st->codec->extradata_size +
 -                                      FF_INPUT_BUFFER_PADDING_SIZE);
 -    if (!st->codec->extradata) {
 +    if (ff_alloc_extradata(st->codec, (get_bits_left(&gb) + 7)/8)) {
          ret = AVERROR(ENOMEM);
          goto end;
      }
@@@ -3,20 -3,20 +3,20 @@@
   * Copyright (c) 2010 Fabrice Bellard
   *                    Romain Degez
   *
 - * This file is part of Libav.
 + * This file is part of FFmpeg.
   *
 - * Libav is free software; you can redistribute it and/or
 + * FFmpeg 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.
   *
 - * Libav is distributed in the hope that it will be useful,
 + * FFmpeg 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 Libav; if not, write to the Free Software
 + * License along with FFmpeg; if not, write to the Free Software
   * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
   */
  
@@@ -93,18 -93,20 +93,18 @@@ static const AttrNameMap attr_names[] 
  
  static void free_context(PayloadContext *data)
  {
 -    av_free(data->au_headers);
 -    av_free(data->mode);
 -    av_free(data);
 +    av_freep(&data->au_headers);
 +    av_freep(&data->mode);
 +    av_freep(&data);
  }
  
- static int parse_fmtp_config(AVCodecContext *codec, char *value)
+ static int parse_fmtp_config(AVCodecContext *codec, const char *value)
  {
      /* decode the hexa encoded parameter */
      int len = ff_hex_to_data(NULL, value);
 -    av_free(codec->extradata);
 -    codec->extradata = av_mallocz(len + FF_INPUT_BUFFER_PADDING_SIZE);
 -    if (!codec->extradata)
 +    av_freep(&codec->extradata);
 +    if (ff_alloc_extradata(codec, len))
          return AVERROR(ENOMEM);
 -    codec->extradata_size = len;
      ff_hex_to_data(codec->extradata, value);
      return 0;
  }
@@@ -135,7 -137,7 +135,7 @@@ static int rtp_parse_mp4_au(PayloadCont
  
      init_get_bits(&getbitcontext, buf, data->au_headers_length_bytes * 8);
  
 -    /* XXX: Wrong if optionnal additional sections are present (cts, dts etc...) */
 +    /* XXX: Wrong if optional additional sections are present (cts, dts etc...) */
      au_header_size = data->sizelength + data->indexlength;
      if (au_header_size <= 0 || (au_headers_length % au_header_size != 0))
          return -1;
@@@ -166,7 -168,6 +166,7 @@@ static int aac_parse_packet(AVFormatCon
  {
      int ret;
  
 +
      if (!buf) {
          if (data->cur_au_index > data->nb_au_headers) {
              av_log(ctx, AV_LOG_ERROR, "Invalid parser state\n");