Showing the changes to libavcodec (1 of 1 file). Show all
Unified · Split
| @@ -660,6 +660,7 @@ static int decode_phys_chunk(AVCodecContext *avctx, PNGDecContext *s, · 659 unmodified lines | ||
| 660 | 660 | static int populate_avctx_color_fields(AVCodecContext *avctx, AVFrame *frame) |
| 661 | 661 | { |
| 662 | 662 | PNGDecContext *s = avctx->priv_data; |
| 663 | + int ret; | |
| 663 | 664 | |
| 664 | 665 | if (s->have_cicp) { |
| 665 | 666 | if (s->cicp_primaries >= AVCOL_PRI_NB) |
| @@ -678,11 +679,15 @@ static int populate_avctx_color_fields(AVCodecContext *avctx, AVFrame *frame) · 12 unmodified lines | ||
| 678 | 679 | avctx->color_range = frame->color_range = AVCOL_RANGE_UNSPECIFIED; |
| 679 | 680 | } |
| 680 | 681 | } else if (s->iccp_data) { |
| 681 | − AVFrameSideData *sd = av_frame_new_side_data(frame, AV_FRAME_DATA_ICC_PROFILE, s->iccp_data_len); | |
| 682 | − if (!sd) | |
| 683 | − return AVERROR(ENOMEM); | |
| 684 | − memcpy(sd->data, s->iccp_data, s->iccp_data_len); | |
| 685 | − av_dict_set(&sd->metadata, "name", s->iccp_name, 0); | |
| 682 | + AVFrameSideData *sd; | |
| 683 | + ret = ff_frame_new_side_data(avctx, frame, AV_FRAME_DATA_ICC_PROFILE, | |
| 684 | + s->iccp_data_len, &sd); | |
| 685 | + if (ret < 0) | |
| 686 | + return ret; | |
| 687 | + if (sd) { | |
| 688 | + memcpy(sd->data, s->iccp_data, s->iccp_data_len); | |
| 689 | + av_dict_set(&sd->metadata, "name", s->iccp_name, 0); | |
| 690 | + } | |
| 686 | 691 | } else if (s->have_srgb) { |
| 687 | 692 | avctx->color_primaries = frame->color_primaries = AVCOL_PRI_BT709; |
| 688 | 693 | avctx->color_trc = frame->color_trc = AVCOL_TRC_IEC61966_2_1; |