[FFmpeg-cvslog] Use explicit struct initializers for AVOutputFormat/ AVInputFormat declarations.

Diego Biurrun git at videolan.org
Sat Sep 24 22:46:40 CEST 2011


ffmpeg | branch: master | Diego Biurrun <diego at biurrun.de> | Fri Sep 23 20:50:11 2011 +0200| [30b4ee7901ec5dbe24f1c75c0c0b43ba551c858b] | committer: Diego Biurrun

Use explicit struct initializers for AVOutputFormat/AVInputFormat declarations.

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

 libavdevice/alsa-audio-dec.c |   17 ++++++++---------
 libavdevice/alsa-audio-enc.c |   20 +++++++++-----------
 libavdevice/bktr.c           |   17 ++++++++---------
 libavdevice/jack_audio.c     |   17 ++++++++---------
 libavdevice/oss_audio.c      |   37 +++++++++++++++++--------------------
 libavdevice/v4l.c            |   17 ++++++++---------
 libavdevice/v4l2.c           |   17 ++++++++---------
 libavdevice/vfwcap.c         |   17 ++++++++---------
 libavdevice/x11grab.c        |   20 +++++++++-----------
 libavformat/daud.c           |   21 +++++++++------------
 libavformat/idroqenc.c       |   19 ++++++++-----------
 libavformat/pcmdec.c         |   38 ++++++++++++++++++--------------------
 libavformat/pcmenc.c         |   21 +++++++++------------
 libavformat/txd.c            |   14 ++++++--------
 14 files changed, 133 insertions(+), 159 deletions(-)

diff --git a/libavdevice/alsa-audio-dec.c b/libavdevice/alsa-audio-dec.c
index 05f68d3..8eae021 100644
--- a/libavdevice/alsa-audio-dec.c
+++ b/libavdevice/alsa-audio-dec.c
@@ -164,13 +164,12 @@ static const AVClass alsa_demuxer_class = {
 };
 
 AVInputFormat ff_alsa_demuxer = {
-    "alsa",
-    NULL_IF_CONFIG_SMALL("ALSA audio input"),
-    sizeof(AlsaData),
-    NULL,
-    audio_read_header,
-    audio_read_packet,
-    ff_alsa_close,
-    .flags = AVFMT_NOFILE,
-    .priv_class = &alsa_demuxer_class,
+    .name           = "alsa",
+    .long_name      = NULL_IF_CONFIG_SMALL("ALSA audio input"),
+    .priv_data_size = sizeof(AlsaData),
+    .read_header    = audio_read_header,
+    .read_packet    = audio_read_packet,
+    .read_close     = ff_alsa_close,
+    .flags          = AVFMT_NOFILE,
+    .priv_class     = &alsa_demuxer_class,
 };
diff --git a/libavdevice/alsa-audio-enc.c b/libavdevice/alsa-audio-enc.c
index f3782c5..95887c1 100644
--- a/libavdevice/alsa-audio-enc.c
+++ b/libavdevice/alsa-audio-enc.c
@@ -102,15 +102,13 @@ static int audio_write_packet(AVFormatContext *s1, AVPacket *pkt)
 }
 
 AVOutputFormat ff_alsa_muxer = {
-    "alsa",
-    NULL_IF_CONFIG_SMALL("ALSA audio output"),
-    "",
-    "",
-    sizeof(AlsaData),
-    DEFAULT_CODEC_ID,
-    CODEC_ID_NONE,
-    audio_write_header,
-    audio_write_packet,
-    ff_alsa_close,
-    .flags = AVFMT_NOFILE,
+    .name           = "alsa",
+    .long_name      = NULL_IF_CONFIG_SMALL("ALSA audio output"),
+    .priv_data_size = sizeof(AlsaData),
+    .audio_codec    = DEFAULT_CODEC_ID,
+    .video_codec    = CODEC_ID_NONE,
+    .write_header   = audio_write_header,
+    .write_packet   = audio_write_packet,
+    .write_trailer  = ff_alsa_close,
+    .flags          = AVFMT_NOFILE,
 };
diff --git a/libavdevice/bktr.c b/libavdevice/bktr.c
index 7ff46cf..f03cf2f 100644
--- a/libavdevice/bktr.c
+++ b/libavdevice/bktr.c
@@ -345,13 +345,12 @@ static const AVClass bktr_class = {
 };
 
 AVInputFormat ff_bktr_demuxer = {
-    "bktr",
-    NULL_IF_CONFIG_SMALL("video grab"),
-    sizeof(VideoData),
-    NULL,
-    grab_read_header,
-    grab_read_packet,
-    grab_read_close,
-    .flags = AVFMT_NOFILE,
-    .priv_class = &bktr_class,
+    .name           = "bktr",
+    .long_name      = NULL_IF_CONFIG_SMALL("video grab"),
+    .priv_data_size = sizeof(VideoData),
+    .read_header    = grab_read_header,
+    .read_packet    = grab_read_packet,
+    .read_close     = grab_read_close,
+    .flags          = AVFMT_NOFILE,
+    .priv_class     = &bktr_class,
 };
diff --git a/libavdevice/jack_audio.c b/libavdevice/jack_audio.c
index 029ace6..c59a22d 100644
--- a/libavdevice/jack_audio.c
+++ b/libavdevice/jack_audio.c
@@ -326,13 +326,12 @@ static const AVClass jack_indev_class = {
 };
 
 AVInputFormat ff_jack_demuxer = {
-    "jack",
-    NULL_IF_CONFIG_SMALL("JACK Audio Connection Kit"),
-    sizeof(JackData),
-    NULL,
-    audio_read_header,
-    audio_read_packet,
-    audio_read_close,
-    .flags = AVFMT_NOFILE,
-    .priv_class = &jack_indev_class,
+    .name           = "jack",
+    .long_name      = NULL_IF_CONFIG_SMALL("JACK Audio Connection Kit"),
+    .priv_data_size = sizeof(JackData),
+    .read_header    = audio_read_header,
+    .read_packet    = audio_read_packet,
+    .read_close     = audio_read_close,
+    .flags          = AVFMT_NOFILE,
+    .priv_class     = &jack_indev_class,
 };
diff --git a/libavdevice/oss_audio.c b/libavdevice/oss_audio.c
index 6df7f34..c19c677 100644
--- a/libavdevice/oss_audio.c
+++ b/libavdevice/oss_audio.c
@@ -295,33 +295,30 @@ static const AVClass oss_demuxer_class = {
 };
 
 AVInputFormat ff_oss_demuxer = {
-    "oss",
-    NULL_IF_CONFIG_SMALL("Open Sound System capture"),
-    sizeof(AudioData),
-    NULL,
-    audio_read_header,
-    audio_read_packet,
-    audio_read_close,
-    .flags = AVFMT_NOFILE,
-    .priv_class = &oss_demuxer_class,
+    .name           = "oss",
+    .long_name      = NULL_IF_CONFIG_SMALL("Open Sound System capture"),
+    .priv_data_size = sizeof(AudioData),
+    .read_header    = audio_read_header,
+    .read_packet    = audio_read_packet,
+    .read_close     = audio_read_close,
+    .flags          = AVFMT_NOFILE,
+    .priv_class     = &oss_demuxer_class,
 };
 #endif
 
 #if CONFIG_OSS_OUTDEV
 AVOutputFormat ff_oss_muxer = {
-    "oss",
-    NULL_IF_CONFIG_SMALL("Open Sound System playback"),
-    "",
-    "",
-    sizeof(AudioData),
+    .name           = "oss",
+    .long_name      = NULL_IF_CONFIG_SMALL("Open Sound System playback"),
+    .priv_data_size = sizeof(AudioData),
     /* XXX: we make the assumption that the soundcard accepts this format */
     /* XXX: find better solution with "preinit" method, needed also in
        other formats */
-    AV_NE(CODEC_ID_PCM_S16BE, CODEC_ID_PCM_S16LE),
-    CODEC_ID_NONE,
-    audio_write_header,
-    audio_write_packet,
-    audio_write_trailer,
-    .flags = AVFMT_NOFILE,
+    .audio_codec    = AV_NE(CODEC_ID_PCM_S16BE, CODEC_ID_PCM_S16LE),
+    .video_codec    = CODEC_ID_NONE,
+    .write_header   = audio_write_header,
+    .write_packet   = audio_write_packet,
+    .write_trailer  = audio_write_trailer,
+    .flags          = AVFMT_NOFILE,
 };
 #endif
diff --git a/libavdevice/v4l.c b/libavdevice/v4l.c
index b0f0452..5c1caf8 100644
--- a/libavdevice/v4l.c
+++ b/libavdevice/v4l.c
@@ -354,14 +354,13 @@ static const AVClass v4l_class = {
 };
 
 AVInputFormat ff_v4l_demuxer = {
-    "video4linux",
-    NULL_IF_CONFIG_SMALL("Video4Linux device grab"),
-    sizeof(VideoData),
-    NULL,
-    grab_read_header,
-    grab_read_packet,
-    grab_read_close,
-    .flags = AVFMT_NOFILE,
-    .priv_class = &v4l_class,
+    .name           = "video4linux",
+    .long_name      = NULL_IF_CONFIG_SMALL("Video4Linux device grab"),
+    .priv_data_size = sizeof(VideoData),
+    .read_header    = grab_read_header,
+    .read_packet    = grab_read_packet,
+    .read_close     = grab_read_close,
+    .flags          = AVFMT_NOFILE,
+    .priv_class     = &v4l_class,
 };
 #endif  /* FF_API_V4L */
diff --git a/libavdevice/v4l2.c b/libavdevice/v4l2.c
index 7a501a9..2ae5a3f 100644
--- a/libavdevice/v4l2.c
+++ b/libavdevice/v4l2.c
@@ -725,13 +725,12 @@ static const AVClass v4l2_class = {
 };
 
 AVInputFormat ff_v4l2_demuxer = {
-    "video4linux2",
-    NULL_IF_CONFIG_SMALL("Video4Linux2 device grab"),
-    sizeof(struct video_data),
-    NULL,
-    v4l2_read_header,
-    v4l2_read_packet,
-    v4l2_read_close,
-    .flags = AVFMT_NOFILE,
-    .priv_class = &v4l2_class,
+    .name           = "video4linux2",
+    .long_name      = NULL_IF_CONFIG_SMALL("Video4Linux2 device grab"),
+    .priv_data_size = sizeof(struct video_data),
+    .read_header    = v4l2_read_header,
+    .read_packet    = v4l2_read_packet,
+    .read_close     = v4l2_read_close,
+    .flags          = AVFMT_NOFILE,
+    .priv_class     = &v4l2_class,
 };
diff --git a/libavdevice/vfwcap.c b/libavdevice/vfwcap.c
index 47a9ebe..4faf2d9 100644
--- a/libavdevice/vfwcap.c
+++ b/libavdevice/vfwcap.c
@@ -470,13 +470,12 @@ static const AVClass vfw_class = {
 };
 
 AVInputFormat ff_vfwcap_demuxer = {
-    "vfwcap",
-    NULL_IF_CONFIG_SMALL("VFW video capture"),
-    sizeof(struct vfw_ctx),
-    NULL,
-    vfw_read_header,
-    vfw_read_packet,
-    vfw_read_close,
-    .flags = AVFMT_NOFILE,
-    .priv_class = &vfw_class,
+    .name           = "vfwcap",
+    .long_name      = NULL_IF_CONFIG_SMALL("VfW video capture"),
+    .priv_data_size = sizeof(struct vfw_ctx),
+    .read_header    = vfw_read_header,
+    .read_packet    = vfw_read_packet,
+    .read_close     = vfw_read_close,
+    .flags          = AVFMT_NOFILE,
+    .priv_class     = &vfw_class,
 };
diff --git a/libavdevice/x11grab.c b/libavdevice/x11grab.c
index 5cc32dc..1a8a996 100644
--- a/libavdevice/x11grab.c
+++ b/libavdevice/x11grab.c
@@ -598,15 +598,13 @@ static const AVClass x11_class = {
 };
 
 /** x11 grabber device demuxer declaration */
-AVInputFormat ff_x11_grab_device_demuxer =
-{
-    "x11grab",
-    NULL_IF_CONFIG_SMALL("X11grab"),
-    sizeof(struct x11_grab),
-    NULL,
-    x11grab_read_header,
-    x11grab_read_packet,
-    x11grab_read_close,
-    .flags = AVFMT_NOFILE,
-    .priv_class = &x11_class,
+AVInputFormat ff_x11_grab_device_demuxer = {
+    .name           = "x11grab",
+    .long_name      = NULL_IF_CONFIG_SMALL("X11grab"),
+    .priv_data_size = sizeof(struct x11_grab),
+    .read_header    = x11grab_read_header,
+    .read_packet    = x11grab_read_packet,
+    .read_close     = x11grab_read_close,
+    .flags          = AVFMT_NOFILE,
+    .priv_class     = &x11_class,
 };
diff --git a/libavformat/daud.c b/libavformat/daud.c
index 9421d18..6a48818 100644
--- a/libavformat/daud.c
+++ b/libavformat/daud.c
@@ -80,17 +80,14 @@ AVInputFormat ff_daud_demuxer = {
 #endif
 
 #if CONFIG_DAUD_MUXER
-AVOutputFormat ff_daud_muxer =
-{
-    "daud",
-    NULL_IF_CONFIG_SMALL("D-Cinema audio format"),
-    NULL,
-    "302",
-    0,
-    CODEC_ID_PCM_S24DAUD,
-    CODEC_ID_NONE,
-    daud_write_header,
-    daud_write_packet,
-    .flags= AVFMT_NOTIMESTAMPS,
+AVOutputFormat ff_daud_muxer = {
+    .name         = "daud",
+    .long_name    = NULL_IF_CONFIG_SMALL("D-Cinema audio format"),
+    .extensions   = "302",
+    .audio_codec  = CODEC_ID_PCM_S24DAUD,
+    .video_codec  = CODEC_ID_NONE,
+    .write_header = daud_write_header,
+    .write_packet = daud_write_packet,
+    .flags        = AVFMT_NOTIMESTAMPS,
 };
 #endif
diff --git a/libavformat/idroqenc.c b/libavformat/idroqenc.c
index 688d58d..266a731 100644
--- a/libavformat/idroqenc.c
+++ b/libavformat/idroqenc.c
@@ -35,15 +35,12 @@ static int roq_write_header(struct AVFormatContext *s)
     return 0;
 }
 
-AVOutputFormat ff_roq_muxer =
-{
-    "RoQ",
-    NULL_IF_CONFIG_SMALL("raw id RoQ format"),
-    NULL,
-    "roq",
-    0,
-    CODEC_ID_ROQ_DPCM,
-    CODEC_ID_ROQ,
-    roq_write_header,
-    ff_raw_write_packet,
+AVOutputFormat ff_roq_muxer = {
+    .name         = "RoQ",
+    .long_name    = NULL_IF_CONFIG_SMALL("raw id RoQ format"),
+    .extensions   = "roq",
+    .audio_codec  = CODEC_ID_ROQ_DPCM,
+    .video_codec  = CODEC_ID_ROQ,
+    .write_header = roq_write_header,
+    .write_packet = ff_raw_write_packet,
 };
diff --git a/libavformat/pcmdec.c b/libavformat/pcmdec.c
index 90799dd..2202332 100644
--- a/libavformat/pcmdec.c
+++ b/libavformat/pcmdec.c
@@ -54,26 +54,24 @@ static const AVOption pcm_options[] = {
     { NULL },
 };
 
-#define PCMDEF(name, long_name, ext, codec) \
-static const AVClass name ## _demuxer_class = {\
-    .class_name = #name " demuxer",\
-    .item_name  = av_default_item_name,\
-    .option     = pcm_options,\
-    .version    = LIBAVUTIL_VERSION_INT,\
-};\
-AVInputFormat ff_pcm_ ## name ## _demuxer = {\
-    #name,\
-    NULL_IF_CONFIG_SMALL(long_name),\
-    sizeof(RawAudioDemuxerContext),\
-    NULL,\
-    ff_raw_read_header,\
-    raw_read_packet,\
-    NULL,\
-    pcm_read_seek,\
-    .flags= AVFMT_GENERIC_INDEX,\
-    .extensions = ext,\
-    .value = codec,\
-    .priv_class = &name ## _demuxer_class,\
+#define PCMDEF(name_, long_name_, ext, codec)               \
+static const AVClass name_ ## _demuxer_class = {            \
+    .class_name = #name_ " demuxer",                        \
+    .item_name  = av_default_item_name,                     \
+    .option     = pcm_options,                              \
+    .version    = LIBAVUTIL_VERSION_INT,                    \
+};                                                          \
+AVInputFormat ff_pcm_ ## name_ ## _demuxer = {              \
+    .name           = #name_,                               \
+    .long_name      = NULL_IF_CONFIG_SMALL(long_name_),     \
+    .priv_data_size = sizeof(RawAudioDemuxerContext),       \
+    .read_header    = ff_raw_read_header,                   \
+    .read_packet    = raw_read_packet,                      \
+    .read_seek      = pcm_read_seek,                        \
+    .flags          = AVFMT_GENERIC_INDEX,                  \
+    .extensions     = ext,                                  \
+    .value          = codec,                                \
+    .priv_class     = &name_ ## _demuxer_class,             \
 };
 
 PCMDEF(f64be, "PCM 64 bit floating-point big-endian format",
diff --git a/libavformat/pcmenc.c b/libavformat/pcmenc.c
index 928124e..553df1f 100644
--- a/libavformat/pcmenc.c
+++ b/libavformat/pcmenc.c
@@ -22,18 +22,15 @@
 #include "avformat.h"
 #include "rawenc.h"
 
-#define PCMDEF(name, long_name, ext, codec) \
-AVOutputFormat ff_pcm_ ## name ## _muxer = {\
-    #name,\
-    NULL_IF_CONFIG_SMALL(long_name),\
-    NULL,\
-    ext,\
-    0,\
-    codec,\
-    CODEC_ID_NONE,\
-    NULL,\
-    ff_raw_write_packet,\
-    .flags= AVFMT_NOTIMESTAMPS,\
+#define PCMDEF(name_, long_name_, ext, codec)               \
+AVOutputFormat ff_pcm_ ## name_ ## _muxer = {               \
+    .name         = #name_,                                 \
+    .long_name    = NULL_IF_CONFIG_SMALL(long_name_),       \
+    .extensions   = ext,                                    \
+    .audio_codec  = codec,                                  \
+    .video_codec  = CODEC_ID_NONE,                          \
+    .write_packet = ff_raw_write_packet,                    \
+    .flags        = AVFMT_NOTIMESTAMPS,                     \
 };
 
 PCMDEF(f64be, "PCM 64 bit floating-point big-endian format",
diff --git a/libavformat/txd.c b/libavformat/txd.c
index 0a93b7c..e6fae08 100644
--- a/libavformat/txd.c
+++ b/libavformat/txd.c
@@ -90,12 +90,10 @@ next_chunk:
     return 0;
 }
 
-AVInputFormat ff_txd_demuxer =
-{
-    "txd",
-    NULL_IF_CONFIG_SMALL("Renderware TeXture Dictionary"),
-    0,
-    txd_probe,
-    txd_read_header,
-    txd_read_packet,
+AVInputFormat ff_txd_demuxer = {
+    .name        = "txd",
+    .long_name   = NULL_IF_CONFIG_SMALL("Renderware TeXture Dictionary"),
+    .read_probe  = txd_probe,
+    .read_header = txd_read_header,
+    .read_packet = txd_read_packet,
 };



More information about the ffmpeg-cvslog mailing list