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
129129 const uint8_t *value;
130130 };
131131
132+extern const uint8_t ff_log2_run[41];
133+
132134 /**
133135 * Return the hardware accelerated codec for codec codec_id and
134136 * pixel format pix_fmt.
@@ -251,6 +253,9 @@ int ff_set_dimensions(AVCodecContext *s, int width, int height); · 116 unmodified lines
251253 int ff_side_data_update_matrix_encoding(AVFrame *frame,
252254 enum AVMatrixEncoding matrix_encoding);
253255
254−extern const uint8_t ff_log2_run[41];
256+/**
257+ * Set various frame properties from the codec context / packet data.
258+ */
259+int ff_decode_frame_props(AVCodecContext *avctx, AVFrame *frame);
255260
256261 #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
209209
210210 frame->pict_type = AV_PICTURE_TYPE_I;
211211 frame->key_frame = 1;
212− frame->reordered_opaque = avctx->reordered_opaque;
213− frame->pkt_pts = avctx->internal->pkt->pts;
212+
213+ res = ff_decode_frame_props(avctx, frame);
214+ if (res < 0)
215+ return res;
216+
214217 av_frame_set_pkt_pos (frame, avctx->internal->pkt->pos);
215218 av_frame_set_pkt_duration(frame, avctx->internal->pkt->duration);
216219
libavcodec/utils.c+34−5
@@ -827,6 +827,35 @@ static void compat_release_buffer(void *opaque, uint8_t *data) · 826 unmodified lines
827827 FF_ENABLE_DEPRECATION_WARNINGS
828828 #endif
829829
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+
830859 static int get_buffer_internal(AVCodecContext *avctx, AVFrame *frame, int flags)
831860 {
832861 int override_dimensions = 1;
@@ -845,6 +874,9 @@ static int get_buffer_internal(AVCodecContext *avctx, AVFrame *frame, int flags) · 12 unmodified lines
845874 override_dimensions = 0;
846875 }
847876 }
877+ ret = ff_decode_frame_props(avctx, frame);
878+ if (ret < 0)
879+ return ret;
848880 if ((ret = ff_init_buffer_info(avctx, frame)) < 0)
849881 return ret;
850882
@@ -1001,11 +1033,8 @@ static int reget_buffer_internal(AVCodecContext *avctx, AVFrame *frame) · 150 unmodified lines
10011033 if (!frame->data[0])
10021034 return ff_get_buffer(avctx, frame, AV_GET_BUFFER_FLAG_REF);
10031035
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);
10091038
10101039 tmp = av_frame_alloc();
10111040 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