summaryrefslogtreecommitdiff
path: root/libavcodec/crystalhd.c
diff options
context:
space:
mode:
authorPhilip Langdale <philipl@overt.org>2011-06-12 20:13:18 -0700
committerPhilip Langdale <philipl@overt.org>2011-06-21 21:03:40 -0700
commitedf5fbd5b2e78f59d864332d0db1320b429e9dc0 (patch)
tree57239fd3d4801827e636c2d5d1d009d176c46c4a /libavcodec/crystalhd.c
parent043d2affbbc124c6d802fe2989d9b1ed73825368 (diff)
downloadffmpeg-edf5fbd5b2e78f59d864332d0db1320b429e9dc0.tar.gz
CrystalHD: Simplfy extradata handling for non-Annex B content.
Originally, we needed to restore the original extradata after initialising the mp4toannexb filter because mplayer would end up taking two passes through the init sequence for the same stream and end up miscategorising the stream. This doesn't seem to happen anymore, making the backup/restore process unnecessary. Signed-off-by: Philip Langdale <philipl@overt.org>
Diffstat (limited to 'libavcodec/crystalhd.c')
-rw-r--r--libavcodec/crystalhd.c21
1 files changed, 3 insertions, 18 deletions
diff --git a/libavcodec/crystalhd.c b/libavcodec/crystalhd.c
index ce1cd55228..4fd2cdf0c0 100644
--- a/libavcodec/crystalhd.c
+++ b/libavcodec/crystalhd.c
@@ -402,34 +402,19 @@ static av_cold int init(AVCodecContext *avctx)
uint8_t *dummy_p;
int dummy_int;
- uint32_t orig_data_size = avctx->extradata_size;
- uint8_t *orig_data = av_malloc(orig_data_size);
- if (!orig_data) {
- av_log(avctx, AV_LOG_ERROR,
- "Failed to allocate copy of extradata\n");
- return AVERROR(ENOMEM);
- }
- memcpy(orig_data, avctx->extradata, orig_data_size);
-
+ format.startCodeSz = (avctx->extradata[4] & 0x03) + 1;
priv->bsfc = av_bitstream_filter_init("h264_mp4toannexb");
if (!priv->bsfc) {
av_log(avctx, AV_LOG_ERROR,
"Cannot open the h264_mp4toannexb BSF!\n");
- av_free(orig_data);
return AVERROR_BSF_NOT_FOUND;
}
av_bitstream_filter_filter(priv->bsfc, avctx, NULL, &dummy_p,
&dummy_int, NULL, 0, 0);
- priv->sps_pps_buf = avctx->extradata;
- priv->sps_pps_size = avctx->extradata_size;
- avctx->extradata = orig_data;
- avctx->extradata_size = orig_data_size;
-
- format.pMetaData = priv->sps_pps_buf;
- format.metaDataSz = priv->sps_pps_size;
- format.startCodeSz = (avctx->extradata[4] & 0x03) + 1;
+ format.pMetaData = avctx->extradata;
+ format.metaDataSz = avctx->extradata_size;
}
break;
case BC_MSUBTYPE_H264: