diff options
author | Philip Langdale <philipl@overt.org> | 2011-06-18 11:00:37 -0700 |
---|---|---|
committer | Philip Langdale <philipl@overt.org> | 2011-06-21 21:03:43 -0700 |
commit | 63e0697294ce0040fba58daa0a1de4e45dc4c677 (patch) | |
tree | 13ecb7b22952a8e16fd3475dde1b1b592493cb39 /libavcodec/crystalhd.c | |
parent | edf5fbd5b2e78f59d864332d0db1320b429e9dc0 (diff) | |
download | ffmpeg-63e0697294ce0040fba58daa0a1de4e45dc4c677.tar.gz |
CrystalHD: Always send filtered H.264 stream to hardware.
As we're now always running mp4 format streams through the annex b
filter, it makes sense to pass the filtered stream down, as
libcrystalhd would be doing the conversion internally anyway.
Signed-off-by: Philip Langdale <philipl@overt.org>
Diffstat (limited to 'libavcodec/crystalhd.c')
-rw-r--r-- | libavcodec/crystalhd.c | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/libavcodec/crystalhd.c b/libavcodec/crystalhd.c index 4fd2cdf0c0..632d774dfa 100644 --- a/libavcodec/crystalhd.c +++ b/libavcodec/crystalhd.c @@ -794,7 +794,9 @@ static int decode(AVCodecContext *avctx, void *data, int *data_size, AVPacket *a CopyRet rec_ret; CHDContext *priv = avctx->priv_data; HANDLE dev = priv->dev; + uint8_t *in_data = avpkt->data; int len = avpkt->size; + int free_data = 0; uint8_t pic_type = 0; av_log(avctx, AV_LOG_VERBOSE, "CrystalHD: decode_frame\n"); @@ -819,15 +821,14 @@ static int decode(AVCodecContext *avctx, void *data, int *data_size, AVPacket *a int32_t tx_free = (int32_t)DtsTxFreeSize(dev); if (priv->parser) { - uint8_t *in_data = avpkt->data; - int in_len = len; int ret = 0; if (priv->bsfc) { ret = av_bitstream_filter_filter(priv->bsfc, avctx, NULL, - &in_data, &in_len, + &in_data, &len, avpkt->data, len, 0); } + free_data = ret > 0; if (ret >= 0) { uint8_t *pout; @@ -836,13 +837,13 @@ static int decode(AVCodecContext *avctx, void *data, int *data_size, AVPacket *a H264Context *h = priv->parser->priv_data; index = av_parser_parse2(priv->parser, avctx, &pout, &psize, - in_data, in_len, avctx->pkt->pts, + in_data, len, avctx->pkt->pts, avctx->pkt->dts, 0); if (index < 0) { av_log(avctx, AV_LOG_WARNING, "CrystalHD: Failed to parse h.264 packet to " "detect interlacing.\n"); - } else if (index != in_len) { + } else if (index != len) { av_log(avctx, AV_LOG_WARNING, "CrystalHD: Failed to parse h.264 packet " "completely. Interlaced frames may be " @@ -859,9 +860,6 @@ static int decode(AVCodecContext *avctx, void *data, int *data_size, AVPacket *a "packet. Interlaced frames may be incorrectly " "detected.\n"); } - if (ret > 0) { - av_freep(&in_data); - } } if (len < tx_free - 1024) { @@ -876,11 +874,17 @@ static int decode(AVCodecContext *avctx, void *data, int *data_size, AVPacket *a */ uint64_t pts = opaque_list_push(priv, avctx->pkt->pts, pic_type); if (!pts) { + if (free_data) { + av_freep(&in_data); + } return AVERROR(ENOMEM); } av_log(priv->avctx, AV_LOG_VERBOSE, "input \"pts\": %"PRIu64"\n", pts); - ret = DtsProcInput(dev, avpkt->data, len, pts, 0); + ret = DtsProcInput(dev, in_data, len, pts, 0); + if (free_data) { + av_freep(&in_data); + } if (ret == BC_STS_BUSY) { av_log(avctx, AV_LOG_WARNING, "CrystalHD: ProcInput returned busy\n"); |