History

Merge commit '4a0f6651434c6f213d830140f575b4ec7858519f'

* commit '4a0f6651434c6f213d830140f575b4ec7858519f': libavcodec: when decoding, copy replaygain side data to decoded frames Conflicts: libavcodec/internal.h libavcodec/rawdec.c libavcodec/utils.c

Michael Niedermayer committed 12 years ago

Commit c08e5232 parents 83e8978 4a0f6653 files · +45 −8Browse files

Unified · Split

3 files
  1. libavcodec/internal.h +6 −1
  2. libavcodec/rawdec.c +5 −2
  3. libavcodec/utils.c +34 −5
libavcodec/internal.h+6−1
@@ -129,6 +129,8 @@ struct AVCodecDefault { · 128 unmodified lines
129 const uint8_t *value;129 const uint8_t *value;
130};130};
131 131
132extern const uint8_t ff_log2_run[41];
133
132/**134/**
133 * Return the hardware accelerated codec for codec codec_id and135 * Return the hardware accelerated codec for codec codec_id and
134 * pixel format pix_fmt.136 * pixel format pix_fmt.
@@ -251,6 +253,9 @@ int ff_set_dimensions(AVCodecContext *s, int width, int height); · 116 unmodified lines
251int ff_side_data_update_matrix_encoding(AVFrame *frame,253int ff_side_data_update_matrix_encoding(AVFrame *frame,
252 enum AVMatrixEncoding matrix_encoding);254 enum AVMatrixEncoding matrix_encoding);
253 255
254extern const uint8_t ff_log2_run[41];256/**
257 * Set various frame properties from the codec context / packet data.
258 */
259int ff_decode_frame_props(AVCodecContext *avctx, AVFrame *frame);
255 260
256#endif /* AVCODEC_INTERNAL_H */261#endif /* AVCODEC_INTERNAL_H */
libavcodec/rawdec.c+5−2
@@ -209,8 +209,11 @@ static int raw_decode(AVCodecContext *avctx, void *data, int *got_frame, · 208 unmodified lines
209 209
210 frame->pict_type = AV_PICTURE_TYPE_I;210 frame->pict_type = AV_PICTURE_TYPE_I;
211 frame->key_frame = 1;211 frame->key_frame = 1;
212 frame->reordered_opaque = avctx->reordered_opaque;212
213 frame->pkt_pts = avctx->internal->pkt->pts;213 res = ff_decode_frame_props(avctx, frame);
214 if (res < 0)
215 return res;
216
214 av_frame_set_pkt_pos (frame, avctx->internal->pkt->pos);217 av_frame_set_pkt_pos (frame, avctx->internal->pkt->pos);
215 av_frame_set_pkt_duration(frame, avctx->internal->pkt->duration);218 av_frame_set_pkt_duration(frame, avctx->internal->pkt->duration);
216 219
libavcodec/utils.c+34−5
@@ -827,6 +827,35 @@ static void compat_release_buffer(void *opaque, uint8_t *data) · 826 unmodified lines
827FF_ENABLE_DEPRECATION_WARNINGS827FF_ENABLE_DEPRECATION_WARNINGS
828#endif828#endif
829 829
830int 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
830static int get_buffer_internal(AVCodecContext *avctx, AVFrame *frame, int flags)859static int get_buffer_internal(AVCodecContext *avctx, AVFrame *frame, int flags)
831{860{
832 int override_dimensions = 1;861 int override_dimensions = 1;
@@ -845,6 +874,9 @@ static int get_buffer_internal(AVCodecContext *avctx, AVFrame *frame, int flags) · 12 unmodified lines
845 override_dimensions = 0;874 override_dimensions = 0;
846 }875 }
847 }876 }
877 ret = ff_decode_frame_props(avctx, frame);
878 if (ret < 0)
879 return ret;
848 if ((ret = ff_init_buffer_info(avctx, frame)) < 0)880 if ((ret = ff_init_buffer_info(avctx, frame)) < 0)
849 return ret;881 return ret;
850 882
@@ -1001,11 +1033,8 @@ static int reget_buffer_internal(AVCodecContext *avctx, AVFrame *frame) · 150 unmodified lines
1001 if (!frame->data[0])1033 if (!frame->data[0])
1002 return ff_get_buffer(avctx, frame, AV_GET_BUFFER_FLAG_REF);1034 return ff_get_buffer(avctx, frame, AV_GET_BUFFER_FLAG_REF);
1003 1035
1004 if (av_frame_is_writable(frame)) {1036 if (av_frame_is_writable(frame))
1005 frame->pkt_pts = avctx->internal->pkt ? avctx->internal->pkt->pts : AV_NOPTS_VALUE;1037 return ff_decode_frame_props(avctx, frame);
1006 frame->reordered_opaque = avctx->reordered_opaque;
1007 return 0;
1008 }
1009 1038
1010 tmp = av_frame_alloc();1039 tmp = av_frame_alloc();
1011 if (!tmp)1040 if (!tmp)

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t