On 5/24/2019 4:11 AM, Steve Lhomme wrote: > It's better to do it before the buffers are actually created. At least in VLC > we currently don't support changing some parameters dynamically easily so we > don't use the information if it comes after the buffer are created.
Glad to know my solution worked :D > > Co-authored-by: James Almer <jamr...@gmail.com> > --- > The same problem may exist with H264 alternative_transfer but I don't have a > sample to test with and the code seems a bit different. Should be a matter of moving the relevant chunk to h264_init_ps(), i think. > --- > libavcodec/hevcdec.c | 18 +++++++++++------- > 1 file changed, 11 insertions(+), 7 deletions(-) > > diff --git a/libavcodec/hevcdec.c b/libavcodec/hevcdec.c > index 515b346535..f54f46aa5d 100644 > --- a/libavcodec/hevcdec.c > +++ b/libavcodec/hevcdec.c > @@ -313,6 +313,7 @@ static int decode_lt_rps(HEVCContext *s, LongTermRPS > *rps, GetBitContext *gb) > static void export_stream_params(AVCodecContext *avctx, const HEVCParamSets > *ps, > const HEVCSPS *sps) > { > + const HEVCContext *s = avctx->priv_data; Maybe instead change the export_stream_params() prototype to have the callers directly pass HEVCContext *s and HEVSPS *sps, then declare HEVCParamSets *ps = &s->ps here. Could also do HEVCSEI *sei = &s->sei, so it's consistent. > const HEVCVPS *vps = (const HEVCVPS*)ps->vps_list[sps->vps_id]->data; > const HEVCWindow *ow = &sps->output_window; > unsigned int num = 0, den = 0; > @@ -355,6 +356,16 @@ static void export_stream_params(AVCodecContext *avctx, > const HEVCParamSets *ps, > if (num != 0 && den != 0) > av_reduce(&avctx->framerate.den, &avctx->framerate.num, > num, den, 1 << 30); > + > + if (s->sei.a53_caption.a53_caption) { I don't think these are available at this point. It's a per frame SEI, and this function is called before slice data is parsed. Notice how a53_caption is freed as soon as it's exported as frame side data in set_side_data(). > + avctx->properties |= FF_CODEC_PROPERTY_CLOSED_CAPTIONS; > + } > + > + if (s->sei.alternative_transfer.present && > + > av_color_transfer_name(s->sei.alternative_transfer.preferred_transfer_characteristics) > && > + s->sei.alternative_transfer.preferred_transfer_characteristics != > AVCOL_TRC_UNSPECIFIED) { > + avctx->color_trc = > s->sei.alternative_transfer.preferred_transfer_characteristics; > + } > } > > static enum AVPixelFormat get_format(HEVCContext *s, const HEVCSPS *sps) > @@ -2775,13 +2786,6 @@ static int set_side_data(HEVCContext *s) > memcpy(sd->data, s->sei.a53_caption.a53_caption, > s->sei.a53_caption.a53_caption_size); > av_freep(&s->sei.a53_caption.a53_caption); > s->sei.a53_caption.a53_caption_size = 0; > - s->avctx->properties |= FF_CODEC_PROPERTY_CLOSED_CAPTIONS; > - } > - > - if (s->sei.alternative_transfer.present && > - > av_color_transfer_name(s->sei.alternative_transfer.preferred_transfer_characteristics) > && > - s->sei.alternative_transfer.preferred_transfer_characteristics != > AVCOL_TRC_UNSPECIFIED) { > - s->avctx->color_trc = out->color_trc = > s->sei.alternative_transfer.preferred_transfer_characteristics; > } > > return 0; > _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".