summaryrefslogtreecommitdiffstats
path: root/libavformat/rtpdec_mpeg4.c
diff options
context:
space:
mode:
Diffstat (limited to 'libavformat/rtpdec_mpeg4.c')
-rw-r--r--libavformat/rtpdec_mpeg4.c37
1 files changed, 17 insertions, 20 deletions
diff --git a/libavformat/rtpdec_mpeg4.c b/libavformat/rtpdec_mpeg4.c
index 2a7e54a..994ab49 100644
--- a/libavformat/rtpdec_mpeg4.c
+++ b/libavformat/rtpdec_mpeg4.c
@@ -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
*/
@@ -27,13 +27,11 @@
* @author Romain Degez
*/
-#include "libavutil/attributes.h"
-#include "libavutil/avstring.h"
-
-#include "libavcodec/bitstream.h"
-
#include "rtpdec_formats.h"
#include "internal.h"
+#include "libavutil/attributes.h"
+#include "libavutil/avstring.h"
+#include "libavcodec/get_bits.h"
#define MAX_AAC_HBR_FRAME_SIZE 8191
@@ -95,19 +93,17 @@ static const AttrNameMap attr_names[] = {
static void close_context(PayloadContext *data)
{
- av_free(data->au_headers);
- av_free(data->mode);
+ av_freep(&data->au_headers);
+ av_freep(&data->mode);
}
static int parse_fmtp_config(AVCodecParameters *par, const char *value)
{
/* decode the hexa encoded parameter */
int len = ff_hex_to_data(NULL, value);
- av_free(par->extradata);
- par->extradata = av_mallocz(len + AV_INPUT_BUFFER_PADDING_SIZE);
- if (!par->extradata)
+ av_freep(&par->extradata);
+ if (ff_alloc_extradata(par, len))
return AVERROR(ENOMEM);
- par->extradata_size = len;
ff_hex_to_data(par->extradata, value);
return 0;
}
@@ -115,7 +111,7 @@ static int parse_fmtp_config(AVCodecParameters *par, const char *value)
static int rtp_parse_mp4_au(PayloadContext *data, const uint8_t *buf, int len)
{
int au_headers_length, au_header_size, i;
- BitstreamContext bctx;
+ GetBitContext getbitcontext;
if (len < 2)
return AVERROR_INVALIDDATA;
@@ -136,7 +132,7 @@ static int rtp_parse_mp4_au(PayloadContext *data, const uint8_t *buf, int len)
if (len < data->au_headers_length_bytes)
return AVERROR_INVALIDDATA;
- bitstream_init8(&bctx, buf, data->au_headers_length_bytes);
+ init_get_bits(&getbitcontext, buf, data->au_headers_length_bytes * 8);
/* XXX: Wrong if optional additional sections are present (cts, dts etc...) */
au_header_size = data->sizelength + data->indexlength;
@@ -153,8 +149,8 @@ static int rtp_parse_mp4_au(PayloadContext *data, const uint8_t *buf, int len)
}
for (i = 0; i < data->nb_au_headers; ++i) {
- data->au_headers[i].size = bitstream_read(&bctx, data->sizelength);
- data->au_headers[i].index = bitstream_read(&bctx, data->indexlength);
+ data->au_headers[i].size = get_bits_long(&getbitcontext, data->sizelength);
+ data->au_headers[i].index = get_bits_long(&getbitcontext, data->indexlength);
}
return 0;
@@ -169,6 +165,7 @@ static int aac_parse_packet(AVFormatContext *ctx, PayloadContext *data,
{
int ret;
+
if (!buf) {
if (data->cur_au_index > data->nb_au_headers) {
av_log(ctx, AV_LOG_ERROR, "Invalid parser state\n");
@@ -295,7 +292,7 @@ static int parse_fmtp(AVFormatContext *s,
int val = atoi(value);
if (val > 32) {
av_log(s, AV_LOG_ERROR,
- "The %s field size is invalid (%d).",
+ "The %s field size is invalid (%d)\n",
attr, val);
return AVERROR_INVALIDDATA;
}
OpenPOWER on IntegriCloud