fftools/ffmpeg_dec: override video SAR with AVCodecParameters value
Rather than access the AVStream one. This is a step towards decoupling Decoder and InputStream.
This commit is contained in:
@@ -42,6 +42,9 @@ typedef struct DecoderPriv {
|
|||||||
AVFrame *frame;
|
AVFrame *frame;
|
||||||
AVPacket *pkt;
|
AVPacket *pkt;
|
||||||
|
|
||||||
|
// override output video sample aspect ratio with this value
|
||||||
|
AVRational sar_override;
|
||||||
|
|
||||||
enum AVPixelFormat hwaccel_pix_fmt;
|
enum AVPixelFormat hwaccel_pix_fmt;
|
||||||
|
|
||||||
// pts/estimated duration of the last decoded frame
|
// pts/estimated duration of the last decoded frame
|
||||||
@@ -311,8 +314,8 @@ static int video_frame_process(InputStream *ist, AVFrame *frame)
|
|||||||
frame->time_base.num, frame->time_base.den);
|
frame->time_base.num, frame->time_base.den);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ist->st->sample_aspect_ratio.num)
|
if (dp->sar_override.num)
|
||||||
frame->sample_aspect_ratio = ist->st->sample_aspect_ratio;
|
frame->sample_aspect_ratio = dp->sar_override;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -922,6 +925,8 @@ int dec_open(InputStream *ist, Scheduler *sch, unsigned sch_idx,
|
|||||||
return AVERROR(ENOMEM);
|
return AVERROR(ENOMEM);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dp->sar_override = ist->par->sample_aspect_ratio;
|
||||||
|
|
||||||
dp->dec_ctx = avcodec_alloc_context3(codec);
|
dp->dec_ctx = avcodec_alloc_context3(codec);
|
||||||
if (!dp->dec_ctx)
|
if (!dp->dec_ctx)
|
||||||
return AVERROR(ENOMEM);
|
return AVERROR(ENOMEM);
|
||||||
|
|||||||
@@ -1336,6 +1336,9 @@ static int ist_add(const OptionsContext *o, Demuxer *d, AVStream *st)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (ist->st->sample_aspect_ratio.num)
|
||||||
|
ist->par->sample_aspect_ratio = ist->st->sample_aspect_ratio;
|
||||||
|
|
||||||
MATCH_PER_STREAM_OPT(bitstream_filters, str, bsfs, ic, st);
|
MATCH_PER_STREAM_OPT(bitstream_filters, str, bsfs, ic, st);
|
||||||
if (bsfs) {
|
if (bsfs) {
|
||||||
ret = av_bsf_list_parse_str(bsfs, &ds->bsf);
|
ret = av_bsf_list_parse_str(bsfs, &ds->bsf);
|
||||||
|
|||||||
Reference in New Issue
Block a user