Browse code

lavc: add sample rate and channel layout to AVFrame.

Rationale is the same as for video width/height etc.

Anton Khirnov authored on 2012/05/05 02:12:31
Showing 4 changed files
... ...
@@ -13,6 +13,9 @@ libavutil:     2011-04-18
13 13
 
14 14
 API changes, most recent first:
15 15
 
16
+2012-xx-xx - xxxxxxx - lavc 54.13.0 - avcodec.h
17
+  Add sample_rate and channel_layout fields to AVFrame.
18
+
16 19
 2012-xx-xx - xxxxxxx - lavr 0.0.1
17 20
   Change AV_MIX_COEFF_TYPE_Q6 to AV_MIX_COEFF_TYPE_Q8.
18 21
 
... ...
@@ -1207,6 +1207,22 @@ typedef struct AVFrame {
1207 1207
      * - decoding: Set by libavcodec.
1208 1208
      */
1209 1209
     uint8_t motion_subsample_log2;
1210
+
1211
+    /**
1212
+     * Sample rate of the audio data.
1213
+     *
1214
+     * - encoding: unused
1215
+     * - decoding: set by get_buffer()
1216
+     */
1217
+    int sample_rate;
1218
+
1219
+    /**
1220
+     * Channel layout of the audio data.
1221
+     *
1222
+     * - encoding: unused
1223
+     * - decoding: set by get_buffer()
1224
+     */
1225
+    uint64_t channel_layout;
1210 1226
 } AVFrame;
1211 1227
 
1212 1228
 struct AVCodecInternal;
... ...
@@ -356,6 +356,10 @@ static int audio_get_buffer(AVCodecContext *avctx, AVFrame *frame)
356 356
     else            frame->pkt_pts = AV_NOPTS_VALUE;
357 357
     frame->reordered_opaque = avctx->reordered_opaque;
358 358
 
359
+    frame->sample_rate    = avctx->sample_rate;
360
+    frame->format         = avctx->sample_fmt;
361
+    frame->channel_layout = avctx->channel_layout;
362
+
359 363
     if (avctx->debug & FF_DEBUG_BUFFERS)
360 364
         av_log(avctx, AV_LOG_DEBUG, "default_get_buffer called on frame %p, "
361 365
                "internal audio buffer used\n", frame);
... ...
@@ -27,7 +27,7 @@
27 27
  */
28 28
 
29 29
 #define LIBAVCODEC_VERSION_MAJOR 54
30
-#define LIBAVCODEC_VERSION_MINOR 12
30
+#define LIBAVCODEC_VERSION_MINOR 13
31 31
 #define LIBAVCODEC_VERSION_MICRO  0
32 32
 
33 33
 #define LIBAVCODEC_VERSION_INT  AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \