[FFmpeg-cvslog] lavf: use conditional notation for default codec in muxer declarations.

Ronald S. Bultje git at videolan.org
Mon Jul 23 21:55:20 CEST 2012


ffmpeg | branch: master | Ronald S. Bultje <rsbultje at gmail.com> | Sat Jul 21 16:44:26 2012 -0700| [fd4872184945ff4275f04f7b95ee7aba49407f3c] | committer: Ronald S. Bultje

lavf: use conditional notation for default codec in muxer declarations.

This removes the use of macro nesting in these code constructs, which
makes it easier to parse in pre-processors.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=fd4872184945ff4275f04f7b95ee7aba49407f3c
---

 libavformat/asfenc.c      |   12 ++----------
 libavformat/avienc.c      |    6 +-----
 libavformat/flvenc.c      |    6 +-----
 libavformat/matroskaenc.c |   21 ++++++---------------
 libavformat/movenc.c      |   21 ++++++---------------
 libavformat/nutenc.c      |    9 ++-------
 6 files changed, 18 insertions(+), 57 deletions(-)

diff --git a/libavformat/asfenc.c b/libavformat/asfenc.c
index e45232d..a8814eb 100644
--- a/libavformat/asfenc.c
+++ b/libavformat/asfenc.c
@@ -884,11 +884,7 @@ AVOutputFormat ff_asf_muxer = {
     .mime_type      = "video/x-ms-asf",
     .extensions     = "asf,wmv,wma",
     .priv_data_size = sizeof(ASFContext),
-#if CONFIG_LIBMP3LAME
-    .audio_codec    = CODEC_ID_MP3,
-#else
-    .audio_codec    = CODEC_ID_MP2,
-#endif
+    .audio_codec    = CONFIG_LIBMP3LAME ? CODEC_ID_MP3 : CODEC_ID_MP2,
     .video_codec    = CODEC_ID_MSMPEG4V3,
     .write_header   = asf_write_header,
     .write_packet   = asf_write_packet,
@@ -907,11 +903,7 @@ AVOutputFormat ff_asf_stream_muxer = {
     .mime_type      = "video/x-ms-asf",
     .extensions     = "asf,wmv,wma",
     .priv_data_size = sizeof(ASFContext),
-#if CONFIG_LIBMP3LAME
-    .audio_codec    = CODEC_ID_MP3,
-#else
-    .audio_codec    = CODEC_ID_MP2,
-#endif
+    .audio_codec    = CONFIG_LIBMP3LAME ? CODEC_ID_MP3 : CODEC_ID_MP2,
     .video_codec    = CODEC_ID_MSMPEG4V3,
     .write_header   = asf_write_stream_header,
     .write_packet   = asf_write_packet,
diff --git a/libavformat/avienc.c b/libavformat/avienc.c
index 3689f57..e611dca 100644
--- a/libavformat/avienc.c
+++ b/libavformat/avienc.c
@@ -645,11 +645,7 @@ AVOutputFormat ff_avi_muxer = {
     .mime_type         = "video/x-msvideo",
     .extensions        = "avi",
     .priv_data_size    = sizeof(AVIContext),
-#if CONFIG_LIBMP3LAME_ENCODER
-    .audio_codec       = CODEC_ID_MP3,
-#else
-    .audio_codec       = CODEC_ID_AC3,
-#endif
+    .audio_codec       = CONFIG_LIBMP3LAME ? CODEC_ID_MP3 : CODEC_ID_AC3,
     .video_codec       = CODEC_ID_MPEG4,
     .write_header      = avi_write_header,
     .write_packet      = avi_write_packet,
diff --git a/libavformat/flvenc.c b/libavformat/flvenc.c
index d77507d..ce1a4e4 100644
--- a/libavformat/flvenc.c
+++ b/libavformat/flvenc.c
@@ -546,11 +546,7 @@ AVOutputFormat ff_flv_muxer = {
     .mime_type      = "video/x-flv",
     .extensions     = "flv",
     .priv_data_size = sizeof(FLVContext),
-#if CONFIG_LIBMP3LAME
-    .audio_codec    = CODEC_ID_MP3,
-#else // CONFIG_LIBMP3LAME
-    .audio_codec    = CODEC_ID_ADPCM_SWF,
-#endif // CONFIG_LIBMP3LAME
+    .audio_codec    = CONFIG_LIBMP3LAME ? CODEC_ID_MP3 : CODEC_ID_ADPCM_SWF,
     .video_codec    = CODEC_ID_FLV1,
     .write_header   = flv_write_header,
     .write_packet   = flv_write_packet,
diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
index 61a91d7..4504d29 100644
--- a/libavformat/matroskaenc.c
+++ b/libavformat/matroskaenc.c
@@ -1292,16 +1292,10 @@ AVOutputFormat ff_matroska_muxer = {
     .mime_type         = "video/x-matroska",
     .extensions        = "mkv",
     .priv_data_size    = sizeof(MatroskaMuxContext),
-#if CONFIG_LIBVORBIS_ENCODER
-    .audio_codec       = CODEC_ID_VORBIS,
-#else
-    .audio_codec       = CODEC_ID_AC3,
-#endif
-#if CONFIG_LIBX264_ENCODER
-    .video_codec       = CODEC_ID_H264,
-#else
-    .video_codec       = CODEC_ID_MPEG4,
-#endif
+    .audio_codec       = CONFIG_LIBVORBIS_ENCODER ?
+                         CODEC_ID_VORBIS : CODEC_ID_AC3,
+    .video_codec       = CONFIG_LIBX264_ENCODER ?
+                         CODEC_ID_H264 : CODEC_ID_MPEG4,
     .write_header      = mkv_write_header,
     .write_packet      = mkv_write_packet,
     .write_trailer     = mkv_write_trailer,
@@ -1339,11 +1333,8 @@ AVOutputFormat ff_matroska_audio_muxer = {
     .mime_type         = "audio/x-matroska",
     .extensions        = "mka",
     .priv_data_size    = sizeof(MatroskaMuxContext),
-#if CONFIG_LIBVORBIS_ENCODER
-    .audio_codec       = CODEC_ID_VORBIS,
-#else
-    .audio_codec       = CODEC_ID_AC3,
-#endif
+    .audio_codec       = CONFIG_LIBVORBIS_ENCODER ?
+                         CODEC_ID_VORBIS : CODEC_ID_AC3,
     .video_codec       = CODEC_ID_NONE,
     .write_header      = mkv_write_header,
     .write_packet      = mkv_write_packet,
diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index 2a5f1d7..a97045c 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -3252,11 +3252,8 @@ AVOutputFormat ff_mov_muxer = {
     .extensions        = "mov",
     .priv_data_size    = sizeof(MOVMuxContext),
     .audio_codec       = CODEC_ID_AAC,
-#if CONFIG_LIBX264_ENCODER
-    .video_codec       = CODEC_ID_H264,
-#else
-    .video_codec       = CODEC_ID_MPEG4,
-#endif
+    .video_codec       = CONFIG_LIBX264_ENCODER ?
+                         CODEC_ID_H264 : CODEC_ID_MPEG4,
     .write_header      = mov_write_header,
     .write_packet      = mov_write_packet,
     .write_trailer     = mov_write_trailer,
@@ -3293,11 +3290,8 @@ AVOutputFormat ff_mp4_muxer = {
     .extensions        = "mp4",
     .priv_data_size    = sizeof(MOVMuxContext),
     .audio_codec       = CODEC_ID_AAC,
-#if CONFIG_LIBX264_ENCODER
-    .video_codec       = CODEC_ID_H264,
-#else
-    .video_codec       = CODEC_ID_MPEG4,
-#endif
+    .video_codec       = CONFIG_LIBX264_ENCODER ?
+                         CODEC_ID_H264 : CODEC_ID_MPEG4,
     .write_header      = mov_write_header,
     .write_packet      = mov_write_packet,
     .write_trailer     = mov_write_trailer,
@@ -3314,11 +3308,8 @@ AVOutputFormat ff_psp_muxer = {
     .extensions        = "mp4,psp",
     .priv_data_size    = sizeof(MOVMuxContext),
     .audio_codec       = CODEC_ID_AAC,
-#if CONFIG_LIBX264_ENCODER
-    .video_codec       = CODEC_ID_H264,
-#else
-    .video_codec       = CODEC_ID_MPEG4,
-#endif
+    .video_codec       = CONFIG_LIBX264_ENCODER ?
+                         CODEC_ID_H264 : CODEC_ID_MPEG4,
     .write_header      = mov_write_header,
     .write_packet      = mov_write_packet,
     .write_trailer     = mov_write_trailer,
diff --git a/libavformat/nutenc.c b/libavformat/nutenc.c
index 21af7ca..76d5852 100644
--- a/libavformat/nutenc.c
+++ b/libavformat/nutenc.c
@@ -866,13 +866,8 @@ AVOutputFormat ff_nut_muxer = {
     .mime_type      = "video/x-nut",
     .extensions     = "nut",
     .priv_data_size = sizeof(NUTContext),
-#if   CONFIG_LIBVORBIS
-    .audio_codec    = CODEC_ID_VORBIS,
-#elif CONFIG_LIBMP3LAME
-    .audio_codec    = CODEC_ID_MP3,
-#else
-    .audio_codec    = CODEC_ID_MP2,
-#endif
+    .audio_codec    = CONFIG_LIBVORBIS ? CODEC_ID_VORBIS :
+                      CONFIG_LIBMP3LAME ? CODEC_ID_MP3 : CODEC_ID_MP2,
     .video_codec    = CODEC_ID_MPEG4,
     .write_header   = nut_write_header,
     .write_packet   = nut_write_packet,



More information about the ffmpeg-cvslog mailing list