mirror of https://git.ffmpeg.org/ffmpeg.git
fftools/ffmpeg_dec: pass AVCodecParameters through DecoderOpts
Do not retrieve it from InputStream directly. This is a step towards decoupling Decoder and InputStream.
This commit is contained in:
parent
b3d1916ba0
commit
1b2c539a0f
|
@ -298,6 +298,7 @@ typedef struct DecoderOpts {
|
|||
char *name;
|
||||
|
||||
const AVCodec *codec;
|
||||
const AVCodecParameters *par;
|
||||
|
||||
/* hwaccel options */
|
||||
enum HWAccelID hwaccel_id;
|
||||
|
|
|
@ -990,13 +990,13 @@ int dec_open(InputStream *ist, Scheduler *sch, unsigned sch_idx,
|
|||
return AVERROR(ENOMEM);
|
||||
}
|
||||
|
||||
dp->sar_override = ist->par->sample_aspect_ratio;
|
||||
dp->sar_override = o->par->sample_aspect_ratio;
|
||||
|
||||
dp->dec_ctx = avcodec_alloc_context3(codec);
|
||||
if (!dp->dec_ctx)
|
||||
return AVERROR(ENOMEM);
|
||||
|
||||
ret = avcodec_parameters_to_context(dp->dec_ctx, ist->par);
|
||||
ret = avcodec_parameters_to_context(dp->dec_ctx, o->par);
|
||||
if (ret < 0) {
|
||||
av_log(dp, AV_LOG_ERROR, "Error initializing the decoder context.\n");
|
||||
return ret;
|
||||
|
|
|
@ -931,6 +931,7 @@ static int ist_use(InputStream *ist, int decoding_needed)
|
|||
ds->dec_opts.name = ds->dec_name;
|
||||
|
||||
ds->dec_opts.codec = ist->dec;
|
||||
ds->dec_opts.par = ist->par;
|
||||
|
||||
ret = dec_open(ist, d->sch, ds->sch_idx_dec,
|
||||
&ist->decoder_opts, &ds->dec_opts);
|
||||
|
|
Loading…
Reference in New Issue