You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-15 14:13:16 +02:00
CrystalHD: Keep mp4toannexb filter around for entire decoder lifetime.
In preparation for using the filter on the actual bitstream, we need to extend it's lifetime to match that of the decoder. Signed-off-by: Philip Langdale <philipl@overt.org>
This commit is contained in:
@@ -124,6 +124,7 @@ typedef struct {
|
|||||||
AVFrame pic;
|
AVFrame pic;
|
||||||
HANDLE dev;
|
HANDLE dev;
|
||||||
|
|
||||||
|
AVBitStreamFilterContext *bsfc;
|
||||||
AVCodecParserContext *parser;
|
AVCodecParserContext *parser;
|
||||||
|
|
||||||
uint8_t is_70012;
|
uint8_t is_70012;
|
||||||
@@ -338,6 +339,9 @@ static av_cold int uninit(AVCodecContext *avctx)
|
|||||||
DtsDeviceClose(device);
|
DtsDeviceClose(device);
|
||||||
|
|
||||||
av_parser_close(priv->parser);
|
av_parser_close(priv->parser);
|
||||||
|
if (priv->bsfc) {
|
||||||
|
av_bitstream_filter_close(priv->bsfc);
|
||||||
|
}
|
||||||
|
|
||||||
av_free(priv->sps_pps_buf);
|
av_free(priv->sps_pps_buf);
|
||||||
|
|
||||||
@@ -397,7 +401,6 @@ static av_cold int init(AVCodecContext *avctx)
|
|||||||
{
|
{
|
||||||
uint8_t *dummy_p;
|
uint8_t *dummy_p;
|
||||||
int dummy_int;
|
int dummy_int;
|
||||||
AVBitStreamFilterContext *bsfc;
|
|
||||||
|
|
||||||
uint32_t orig_data_size = avctx->extradata_size;
|
uint32_t orig_data_size = avctx->extradata_size;
|
||||||
uint8_t *orig_data = av_malloc(orig_data_size);
|
uint8_t *orig_data = av_malloc(orig_data_size);
|
||||||
@@ -409,16 +412,15 @@ static av_cold int init(AVCodecContext *avctx)
|
|||||||
memcpy(orig_data, avctx->extradata, orig_data_size);
|
memcpy(orig_data, avctx->extradata, orig_data_size);
|
||||||
|
|
||||||
|
|
||||||
bsfc = av_bitstream_filter_init("h264_mp4toannexb");
|
priv->bsfc = av_bitstream_filter_init("h264_mp4toannexb");
|
||||||
if (!bsfc) {
|
if (!priv->bsfc) {
|
||||||
av_log(avctx, AV_LOG_ERROR,
|
av_log(avctx, AV_LOG_ERROR,
|
||||||
"Cannot open the h264_mp4toannexb BSF!\n");
|
"Cannot open the h264_mp4toannexb BSF!\n");
|
||||||
av_free(orig_data);
|
av_free(orig_data);
|
||||||
return AVERROR_BSF_NOT_FOUND;
|
return AVERROR_BSF_NOT_FOUND;
|
||||||
}
|
}
|
||||||
av_bitstream_filter_filter(bsfc, avctx, NULL, &dummy_p,
|
av_bitstream_filter_filter(priv->bsfc, avctx, NULL, &dummy_p,
|
||||||
&dummy_int, NULL, 0, 0);
|
&dummy_int, NULL, 0, 0);
|
||||||
av_bitstream_filter_close(bsfc);
|
|
||||||
|
|
||||||
priv->sps_pps_buf = avctx->extradata;
|
priv->sps_pps_buf = avctx->extradata;
|
||||||
priv->sps_pps_size = avctx->extradata_size;
|
priv->sps_pps_size = avctx->extradata_size;
|
||||||
|
Reference in New Issue
Block a user