mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-04-24 17:12:34 +02:00
avformat/utils: Make find_stream_info get side data from codec context
This will allow probing input coded side data, and also forwarding them to the output. Signed-off-by: Anton Khirnov <anton@khirnov.net>
This commit is contained in:
parent
eb88ccb92e
commit
2d6baff0c0
@ -3599,6 +3599,21 @@ static int extract_extradata(AVStream *st, const AVPacket *pkt)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int add_coded_side_data(AVStream *st, AVCodecContext *avctx)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for (i = 0; i < avctx->nb_coded_side_data; i++) {
|
||||||
|
const AVPacketSideData *sd_src = &avctx->coded_side_data[i];
|
||||||
|
uint8_t *dst_data;
|
||||||
|
dst_data = av_stream_new_side_data(st, sd_src->type, sd_src->size);
|
||||||
|
if (!dst_data)
|
||||||
|
return AVERROR(ENOMEM);
|
||||||
|
memcpy(dst_data, sd_src->data, sd_src->size);
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options)
|
int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options)
|
||||||
{
|
{
|
||||||
int i, count = 0, ret = 0, j;
|
int i, count = 0, ret = 0, j;
|
||||||
@ -4138,6 +4153,9 @@ FF_ENABLE_DEPRECATION_WARNINGS
|
|||||||
ret = avcodec_parameters_from_context(st->codecpar, st->internal->avctx);
|
ret = avcodec_parameters_from_context(st->codecpar, st->internal->avctx);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
goto find_stream_info_err;
|
goto find_stream_info_err;
|
||||||
|
ret = add_coded_side_data(st, st->internal->avctx);
|
||||||
|
if (ret < 0)
|
||||||
|
goto find_stream_info_err;
|
||||||
#if FF_API_LOWRES
|
#if FF_API_LOWRES
|
||||||
// The decoder might reduce the video size by the lowres factor.
|
// The decoder might reduce the video size by the lowres factor.
|
||||||
if (st->internal->avctx->lowres && orig_w) {
|
if (st->internal->avctx->lowres && orig_w) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user