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.
Showing the changes to libavcodec (1 of 1 file). Show all
Unified · Split
| @@ -1092,6 +1092,12 @@ static int h264_init_ps(H264Context *h, const H264SliceContext *sl, int first_sl · 1091 unmodified lines | ||
| 1092 | 1092 | h->avctx->colorspace = sps->colorspace; |
| 1093 | 1093 | } |
| 1094 | 1094 | } |
| 1095 | + | |
| 1096 | + if (h->sei.alternative_transfer.present && | |
| 1097 | + av_color_transfer_name(h->sei.alternative_transfer.preferred_transfer_characteristics) && | |
| 1098 | + h->sei.alternative_transfer.preferred_transfer_characteristics != AVCOL_TRC_UNSPECIFIED) { | |
| 1099 | + h->avctx->color_trc = h->sei.alternative_transfer.preferred_transfer_characteristics; | |
| 1100 | + } | |
| 1095 | 1101 | } |
| 1096 | 1102 | |
| 1097 | 1103 | if (!h->context_initialized || must_reinit || needs_reinit) { |
| @@ -1332,12 +1338,6 @@ static int h264_export_frame_props(H264Context *h) · 234 unmodified lines | ||
| 1332 | 1338 | h->sei.picture_timing.timecode_cnt = 0; |
| 1333 | 1339 | } |
| 1334 | 1340 | |
| 1335 | − if (h->sei.alternative_transfer.present && | |
| 1336 | − av_color_transfer_name(h->sei.alternative_transfer.preferred_transfer_characteristics) && | |
| 1337 | − h->sei.alternative_transfer.preferred_transfer_characteristics != AVCOL_TRC_UNSPECIFIED) { | |
| 1338 | − h->avctx->color_trc = cur->f->color_trc = h->sei.alternative_transfer.preferred_transfer_characteristics; | |
| 1339 | − } | |
| 1340 | − | |
| 1341 | 1341 | return 0; |
| 1342 | 1342 | } |
| 1343 | 1343 | |