| 1041 | } |
| 1042 | |
| 1043 | static int export_metadata(AVCodecContext *avctx, AVFrame *frame) |
| 1044 | { |
| 1045 | AV1DecContext *s = avctx->priv_data; |
| 1046 | AV1RawMetadataITUTT35 itut_t35; |
| 1047 | int ret = 0; |
| 1048 | |
| 1049 | if (s->mdcv) { |
| 1050 | AVMasteringDisplayMetadata *mastering; |
| 1051 | |
| 1052 | ret = ff_decode_mastering_display_new(avctx, frame, &mastering); |
| 1053 | if (ret < 0) |
| 1054 | return ret; |
| 1055 | |
| 1056 | if (mastering) { |
| 1057 | for (int i = 0; i < 3; i++) { |
| 1058 | mastering->display_primaries[i][0] = av_make_q(s->mdcv->primary_chromaticity_x[i], 1 << 16); |
| 1059 | mastering->display_primaries[i][1] = av_make_q(s->mdcv->primary_chromaticity_y[i], 1 << 16); |
| 1060 | } |
| 1061 | mastering->white_point[0] = av_make_q(s->mdcv->white_point_chromaticity_x, 1 << 16); |
| 1062 | mastering->white_point[1] = av_make_q(s->mdcv->white_point_chromaticity_y, 1 << 16); |
| 1063 | |
| 1064 | mastering->max_luminance = av_make_q(s->mdcv->luminance_max, 1 << 8); |
| 1065 | mastering->min_luminance = av_make_q(s->mdcv->luminance_min, 1 << 14); |
| 1066 | |
| 1067 | mastering->has_primaries = 1; |
| 1068 | mastering->has_luminance = 1; |
| 1069 | } |
| 1070 | } |
| 1071 | |
| 1072 | if (s->cll) { |
| 1073 | AVContentLightMetadata *light; |
| 1074 | |
| 1075 | ret = ff_decode_content_light_new(avctx, frame, &light); |
| 1076 | if (ret < 0) |
| 1077 | return ret; |
| 1078 | |
| 1079 | if (light) { |
| 1080 | light->MaxCLL = s->cll->max_cll; |
| 1081 | light->MaxFALL = s->cll->max_fall; |
| 1082 | } |
| 1083 | } |
| 1084 | |
| 1085 | while (av_fifo_read(s->itut_t35_fifo, &itut_t35, 1) >= 0) { |
| 1086 | if (ret >= 0) |
| 1087 | ret = export_itut_t35(avctx, frame, &itut_t35); |
| 1088 | av_buffer_unref(&itut_t35.payload_ref); |
| 1089 | } |
| 1090 | |
| 1091 | return ret; |
| 1092 | } |
| 1093 | |
| 1094 | static int export_film_grain(AVCodecContext *avctx, AVFrame *frame) |
| 1095 | { |
no test coverage detected