[libav-devel] [PATCH 7/7] ac3: wrap usage of AVCodecContext.request_channels in FF_API_REQUEST_CHANNELS.

Tim Walker tdskywalker at gmail.com
Mon Nov 18 12:41:49 CET 2013


---
 libavcodec/aac_ac3_parser.c | 4 ++++
 libavcodec/ac3dec.c         | 4 ++++
 2 files changed, 8 insertions(+)

diff --git a/libavcodec/aac_ac3_parser.c b/libavcodec/aac_ac3_parser.c
index 2256a10..d3da9b7 100644
--- a/libavcodec/aac_ac3_parser.c
+++ b/libavcodec/aac_ac3_parser.c
@@ -84,10 +84,14 @@ get_next:
         avctx->sample_rate = s->sample_rate;
 
         /* (E-)AC-3: allow downmixing to stereo or mono */
+#if FF_API_REQUEST_CHANNELS
+FF_DISABLE_DEPRECATION_WARNINGS
         if (avctx->request_channels == 1)
             avctx->request_channel_layout = AV_CH_LAYOUT_MONO;
         else if (avctx->request_channels == 2)
             avctx->request_channel_layout = AV_CH_LAYOUT_STEREO;
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif
         if (s->channels > 1 &&
             avctx->request_channel_layout == AV_CH_LAYOUT_MONO) {
             avctx->channels       = 1;
diff --git a/libavcodec/ac3dec.c b/libavcodec/ac3dec.c
index 25d481e..b1e305e 100644
--- a/libavcodec/ac3dec.c
+++ b/libavcodec/ac3dec.c
@@ -179,10 +179,14 @@ static av_cold int ac3_decode_init(AVCodecContext *avctx)
     avctx->sample_fmt = AV_SAMPLE_FMT_FLTP;
 
     /* allow downmixing to stereo or mono */
+#if FF_API_REQUEST_CHANNELS
+FF_DISABLE_DEPRECATION_WARNINGS
     if (avctx->request_channels == 1)
         avctx->request_channel_layout = AV_CH_LAYOUT_MONO;
     else if (avctx->request_channels == 2)
         avctx->request_channel_layout = AV_CH_LAYOUT_STEREO;
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif
     if (avctx->channels > 1 &&
         avctx->request_channel_layout == AV_CH_LAYOUT_MONO)
         avctx->channels = 1;
-- 
1.8.3.4 (Apple Git-47)



More information about the libav-devel mailing list