| @@ -827,6 +827,35 @@ static void compat_release_buffer(void *opaque, uint8_t *data) · 826 unmodified lines |
| 827 | 827 | FF_ENABLE_DEPRECATION_WARNINGS |
| 828 | 828 | #endif |
| 829 | 829 | |
| 830 | +int ff_decode_frame_props(AVCodecContext *avctx, AVFrame *frame) |
| 831 | +{ |
| 832 | + AVPacket *pkt = avctx->internal->pkt; |
| 833 | + uint8_t *packet_sd; |
| 834 | + int size; |
| 835 | + AVFrameSideData *frame_sd; |
| 836 | + |
| 837 | + |
| 838 | + frame->reordered_opaque = avctx->reordered_opaque; |
| 839 | + if (!pkt) { |
| 840 | + frame->pkt_pts = AV_NOPTS_VALUE; |
| 841 | + return 0; |
| 842 | + } |
| 843 | + |
| 844 | + frame->pkt_pts = pkt->pts; |
| 845 | + |
| 846 | + /* copy the replaygain data to the output frame */ |
| 847 | + packet_sd = av_packet_get_side_data(pkt, AV_PKT_DATA_REPLAYGAIN, &size); |
| 848 | + if (packet_sd) { |
| 849 | + frame_sd = av_frame_new_side_data(frame, AV_FRAME_DATA_REPLAYGAIN, size); |
| 850 | + if (!frame_sd) |
| 851 | + return AVERROR(ENOMEM); |
| 852 | + |
| 853 | + memcpy(frame_sd->data, packet_sd, size); |
| 854 | + } |
| 855 | + |
| 856 | + return 0; |
| 857 | +} |
| 858 | + |
| 830 | 859 | static int get_buffer_internal(AVCodecContext *avctx, AVFrame *frame, int flags) |
| 831 | 860 | { |
| 832 | 861 | int override_dimensions = 1; |
| @@ -845,6 +874,9 @@ static int get_buffer_internal(AVCodecContext *avctx, AVFrame *frame, int flags) · 12 unmodified lines |
| 845 | 874 | override_dimensions = 0; |
| 846 | 875 | } |
| 847 | 876 | } |
| 877 | + ret = ff_decode_frame_props(avctx, frame); |
| 878 | + if (ret < 0) |
| 879 | + return ret; |
| 848 | 880 | if ((ret = ff_init_buffer_info(avctx, frame)) < 0) |
| 849 | 881 | return ret; |
| 850 | 882 | |
| @@ -1001,11 +1033,8 @@ static int reget_buffer_internal(AVCodecContext *avctx, AVFrame *frame) · 150 unmodified lines |
| 1001 | 1033 | if (!frame->data[0]) |
| 1002 | 1034 | return ff_get_buffer(avctx, frame, AV_GET_BUFFER_FLAG_REF); |
| 1003 | 1035 | |
| 1004 | | − if (av_frame_is_writable(frame)) { |
| 1005 | | − frame->pkt_pts = avctx->internal->pkt ? avctx->internal->pkt->pts : AV_NOPTS_VALUE; |
| 1006 | | − frame->reordered_opaque = avctx->reordered_opaque; |
| 1007 | | − return 0; |
| 1008 | | − } |
| 1036 | + if (av_frame_is_writable(frame)) |
| 1037 | + return ff_decode_frame_props(avctx, frame); |
| 1009 | 1038 | |
| 1010 | 1039 | tmp = av_frame_alloc(); |
| 1011 | 1040 | if (!tmp) |