changeset 3546:45c3d2b2b2fb libavformat

Alphabetically order AVInputFormat/AVOutputFormat declarations.
author diego
date Mon, 07 Jul 2008 11:11:08 +0000
parents 2949f7da8931
children 771cf9f79fd6
files raw.c
diffstat 1 files changed, 206 insertions(+), 205 deletions(-) [+]
line wrap: on
line diff
--- a/raw.c	Mon Jul 07 10:45:36 2008 +0000
+++ b/raw.c	Mon Jul 07 11:11:08 2008 +0000
@@ -56,6 +56,11 @@
     return 0;
 }
 
+static int null_write_packet(struct AVFormatContext *s, AVPacket *pkt)
+{
+    return 0;
+}
+
 static int raw_write_packet(struct AVFormatContext *s, AVPacket *pkt)
 {
     put_buffer(s->pb, pkt->data, pkt->size);
@@ -152,6 +157,30 @@
     return ret;
 }
 
+static int rawvideo_read_packet(AVFormatContext *s, AVPacket *pkt)
+{
+    int packet_size, ret, width, height;
+    AVStream *st = s->streams[0];
+
+    width = st->codec->width;
+    height = st->codec->height;
+
+    packet_size = avpicture_get_size(st->codec->pix_fmt, width, height);
+    if (packet_size < 0)
+        return -1;
+
+    ret= av_get_packet(s->pb, pkt, packet_size);
+    pkt->pts=
+    pkt->dts= pkt->pos / packet_size;
+
+    pkt->stream_index = 0;
+    if (ret != packet_size) {
+        return AVERROR(EIO);
+    } else {
+        return 0;
+    }
+}
+
 // http://www.artificis.hu/files/texts/ingenient.txt
 static int ingenient_read_packet(AVFormatContext *s, AVPacket *pkt)
 {
@@ -427,57 +456,18 @@
 
 /* Note: Do not forget to add new entries to the Makefile as well. */
 
-AVInputFormat shorten_demuxer = {
-    "shn",
-    NULL_IF_CONFIG_SMALL("raw Shorten"),
-    0,
-    NULL,
-    audio_read_header,
-    raw_read_partial_packet,
-    .flags= AVFMT_GENERIC_INDEX,
-    .extensions = "shn",
-    .value = CODEC_ID_SHORTEN,
-};
-
-AVInputFormat mlp_demuxer = {
-    "mlp",
-    NULL_IF_CONFIG_SMALL("raw MLP"),
+AVInputFormat aac_demuxer = {
+    "aac",
+    NULL_IF_CONFIG_SMALL("ADTS AAC"),
     0,
     NULL,
     audio_read_header,
     raw_read_partial_packet,
     .flags= AVFMT_GENERIC_INDEX,
-    .extensions = "mlp",
-    .value = CODEC_ID_MLP,
-};
-
-AVInputFormat flac_demuxer = {
-    "flac",
-    NULL_IF_CONFIG_SMALL("raw FLAC"),
-    0,
-    flac_probe,
-    audio_read_header,
-    raw_read_partial_packet,
-    .flags= AVFMT_GENERIC_INDEX,
-    .extensions = "flac",
-    .value = CODEC_ID_FLAC,
+    .extensions = "aac",
+    .value = CODEC_ID_AAC,
 };
 
-#ifdef CONFIG_MUXERS
-AVOutputFormat flac_muxer = {
-    "flac",
-    NULL_IF_CONFIG_SMALL("raw FLAC"),
-    "audio/x-flac",
-    "flac",
-    0,
-    CODEC_ID_FLAC,
-    CODEC_ID_NONE,
-    flac_write_header,
-    raw_write_packet,
-    .flags= AVFMT_NOTIMESTAMPS,
-};
-#endif //CONFIG_MUXERS
-
 #ifdef CONFIG_AC3_DEMUXER
 AVInputFormat ac3_demuxer = {
     "ac3",
@@ -505,20 +495,6 @@
     raw_write_packet,
     .flags= AVFMT_NOTIMESTAMPS,
 };
-
-AVOutputFormat dts_muxer = {
-    "dts",
-    NULL_IF_CONFIG_SMALL("raw DTS"),
-    "audio/x-dca",
-    "dts",
-    0,
-    CODEC_ID_DTS,
-    CODEC_ID_NONE,
-    NULL,
-    raw_write_packet,
-    .flags= AVFMT_NOTIMESTAMPS,
-};
-
 #endif //CONFIG_MUXERS
 
 AVInputFormat dirac_demuxer = {
@@ -559,18 +535,48 @@
     .value = CODEC_ID_DTS,
 };
 
-AVInputFormat aac_demuxer = {
-    "aac",
-    NULL_IF_CONFIG_SMALL("ADTS AAC"),
+#ifdef CONFIG_MUXERS
+AVOutputFormat dts_muxer = {
+    "dts",
+    NULL_IF_CONFIG_SMALL("raw DTS"),
+    "audio/x-dca",
+    "dts",
     0,
+    CODEC_ID_DTS,
+    CODEC_ID_NONE,
     NULL,
+    raw_write_packet,
+    .flags= AVFMT_NOTIMESTAMPS,
+};
+#endif
+
+AVInputFormat flac_demuxer = {
+    "flac",
+    NULL_IF_CONFIG_SMALL("raw FLAC"),
+    0,
+    flac_probe,
     audio_read_header,
     raw_read_partial_packet,
     .flags= AVFMT_GENERIC_INDEX,
-    .extensions = "aac",
-    .value = CODEC_ID_AAC,
+    .extensions = "flac",
+    .value = CODEC_ID_FLAC,
 };
 
+#ifdef CONFIG_MUXERS
+AVOutputFormat flac_muxer = {
+    "flac",
+    NULL_IF_CONFIG_SMALL("raw FLAC"),
+    "audio/x-flac",
+    "flac",
+    0,
+    CODEC_ID_FLAC,
+    CODEC_ID_NONE,
+    flac_write_header,
+    raw_write_packet,
+    .flags= AVFMT_NOTIMESTAMPS,
+};
+#endif //CONFIG_MUXERS
+
 AVInputFormat gsm_demuxer = {
     "gsm",
     NULL_IF_CONFIG_SMALL("GSM"),
@@ -583,21 +589,6 @@
     .value = CODEC_ID_GSM,
 };
 
-#ifdef CONFIG_ROQ_MUXER
-AVOutputFormat roq_muxer =
-{
-    "RoQ",
-    NULL_IF_CONFIG_SMALL("id RoQ format"),
-    NULL,
-    "roq",
-    0,
-    CODEC_ID_ROQ_DPCM,
-    CODEC_ID_ROQ,
-    roq_write_header,
-    raw_write_packet,
-};
-#endif //CONFIG_ROQ_MUXER
-
 AVInputFormat h261_demuxer = {
     "h261",
     NULL_IF_CONFIG_SMALL("raw H.261"),
@@ -652,6 +643,45 @@
 };
 #endif //CONFIG_MUXERS
 
+AVInputFormat h264_demuxer = {
+    "h264",
+    NULL_IF_CONFIG_SMALL("raw H.264 video format"),
+    0,
+    NULL /*mpegvideo_probe*/,
+    video_read_header,
+    raw_read_partial_packet,
+    .flags= AVFMT_GENERIC_INDEX,
+    .extensions = "h26l,h264,264", //FIXME remove after writing mpeg4_probe
+    .value = CODEC_ID_H264,
+};
+
+#ifdef CONFIG_MUXERS
+AVOutputFormat h264_muxer = {
+    "h264",
+    NULL_IF_CONFIG_SMALL("raw H.264 video format"),
+    NULL,
+    "h264",
+    0,
+    CODEC_ID_NONE,
+    CODEC_ID_H264,
+    NULL,
+    raw_write_packet,
+    .flags= AVFMT_NOTIMESTAMPS,
+};
+#endif //CONFIG_MUXERS
+
+AVInputFormat ingenient_demuxer = {
+    "ingenient",
+    NULL_IF_CONFIG_SMALL("Ingenient MJPEG"),
+    0,
+    NULL,
+    video_read_header,
+    ingenient_read_packet,
+    .flags= AVFMT_GENERIC_INDEX,
+    .extensions = "cgi", // FIXME
+    .value = CODEC_ID_MJPEG,
+};
+
 AVInputFormat m4v_demuxer = {
     "m4v",
     NULL_IF_CONFIG_SMALL("raw MPEG-4 video format"),
@@ -679,42 +709,43 @@
 };
 #endif //CONFIG_MUXERS
 
-AVInputFormat h264_demuxer = {
-    "h264",
-    NULL_IF_CONFIG_SMALL("raw H.264 video format"),
+AVInputFormat mjpeg_demuxer = {
+    "mjpeg",
+    NULL_IF_CONFIG_SMALL("MJPEG video"),
     0,
-    NULL /*mpegvideo_probe*/,
+    NULL,
     video_read_header,
     raw_read_partial_packet,
     .flags= AVFMT_GENERIC_INDEX,
-    .extensions = "h26l,h264,264", //FIXME remove after writing mpeg4_probe
-    .value = CODEC_ID_H264,
+    .extensions = "mjpg,mjpeg",
+    .value = CODEC_ID_MJPEG,
 };
 
 #ifdef CONFIG_MUXERS
-AVOutputFormat h264_muxer = {
-    "h264",
-    NULL_IF_CONFIG_SMALL("raw H.264 video format"),
-    NULL,
-    "h264",
+AVOutputFormat mjpeg_muxer = {
+    "mjpeg",
+    NULL_IF_CONFIG_SMALL("MJPEG video"),
+    "video/x-mjpeg",
+    "mjpg,mjpeg",
     0,
     CODEC_ID_NONE,
-    CODEC_ID_H264,
+    CODEC_ID_MJPEG,
     NULL,
     raw_write_packet,
     .flags= AVFMT_NOTIMESTAMPS,
 };
 #endif //CONFIG_MUXERS
 
-AVInputFormat mpegvideo_demuxer = {
-    "mpegvideo",
-    NULL_IF_CONFIG_SMALL("MPEG video"),
+AVInputFormat mlp_demuxer = {
+    "mlp",
+    NULL_IF_CONFIG_SMALL("raw MLP"),
     0,
-    mpegvideo_probe,
-    video_read_header,
+    NULL,
+    audio_read_header,
     raw_read_partial_packet,
     .flags= AVFMT_GENERIC_INDEX,
-    .value = CODEC_ID_MPEG1VIDEO,
+    .extensions = "mlp",
+    .value = CODEC_ID_MLP,
 };
 
 #ifdef CONFIG_MUXERS
@@ -747,45 +778,90 @@
 };
 #endif //CONFIG_MUXERS
 
-AVInputFormat mjpeg_demuxer = {
-    "mjpeg",
-    NULL_IF_CONFIG_SMALL("MJPEG video"),
+AVInputFormat mpegvideo_demuxer = {
+    "mpegvideo",
+    NULL_IF_CONFIG_SMALL("MPEG video"),
     0,
-    NULL,
+    mpegvideo_probe,
     video_read_header,
     raw_read_partial_packet,
     .flags= AVFMT_GENERIC_INDEX,
-    .extensions = "mjpg,mjpeg",
-    .value = CODEC_ID_MJPEG,
-};
-
-AVInputFormat ingenient_demuxer = {
-    "ingenient",
-    NULL_IF_CONFIG_SMALL("Ingenient MJPEG"),
-    0,
-    NULL,
-    video_read_header,
-    ingenient_read_packet,
-    .flags= AVFMT_GENERIC_INDEX,
-    .extensions = "cgi", // FIXME
-    .value = CODEC_ID_MJPEG,
+    .value = CODEC_ID_MPEG1VIDEO,
 };
 
 #ifdef CONFIG_MUXERS
-AVOutputFormat mjpeg_muxer = {
-    "mjpeg",
-    NULL_IF_CONFIG_SMALL("MJPEG video"),
-    "video/x-mjpeg",
-    "mjpg,mjpeg",
+AVOutputFormat null_muxer = {
+    "null",
+    NULL_IF_CONFIG_SMALL("null video format"),
+    NULL,
+    NULL,
+    0,
+#ifdef WORDS_BIGENDIAN
+    CODEC_ID_PCM_S16BE,
+#else
+    CODEC_ID_PCM_S16LE,
+#endif
+    CODEC_ID_RAWVIDEO,
+    NULL,
+    null_write_packet,
+    .flags = AVFMT_NOFILE | AVFMT_RAWPICTURE | AVFMT_NOTIMESTAMPS,
+};
+#endif //CONFIG_MUXERS
+
+AVInputFormat rawvideo_demuxer = {
+    "rawvideo",
+    NULL_IF_CONFIG_SMALL("raw video format"),
+    0,
+    NULL,
+    raw_read_header,
+    rawvideo_read_packet,
+    .flags= AVFMT_GENERIC_INDEX,
+    .extensions = "yuv,cif,qcif,rgb",
+    .value = CODEC_ID_RAWVIDEO,
+};
+
+#ifdef CONFIG_MUXERS
+AVOutputFormat rawvideo_muxer = {
+    "rawvideo",
+    NULL_IF_CONFIG_SMALL("raw video format"),
+    NULL,
+    "yuv,rgb",
     0,
     CODEC_ID_NONE,
-    CODEC_ID_MJPEG,
+    CODEC_ID_RAWVIDEO,
     NULL,
     raw_write_packet,
     .flags= AVFMT_NOTIMESTAMPS,
 };
 #endif //CONFIG_MUXERS
 
+#ifdef CONFIG_ROQ_MUXER
+AVOutputFormat roq_muxer =
+{
+    "RoQ",
+    NULL_IF_CONFIG_SMALL("id RoQ format"),
+    NULL,
+    "roq",
+    0,
+    CODEC_ID_ROQ_DPCM,
+    CODEC_ID_ROQ,
+    roq_write_header,
+    raw_write_packet,
+};
+#endif //CONFIG_ROQ_MUXER
+
+AVInputFormat shorten_demuxer = {
+    "shn",
+    NULL_IF_CONFIG_SMALL("raw Shorten"),
+    0,
+    NULL,
+    audio_read_header,
+    raw_read_partial_packet,
+    .flags= AVFMT_GENERIC_INDEX,
+    .extensions = "shn",
+    .value = CODEC_ID_SHORTEN,
+};
+
 AVInputFormat vc1_demuxer = {
     "vc1",
     NULL_IF_CONFIG_SMALL("raw VC-1"),
@@ -852,101 +928,26 @@
 #endif
 
 
+PCMDEF(s16be, "PCM signed 16 bit big-endian format",
+       BE_DEF("sw"), CODEC_ID_PCM_S16BE)
+
 PCMDEF(s16le, "PCM signed 16 bit little-endian format",
        LE_DEF("sw"), CODEC_ID_PCM_S16LE)
 
-PCMDEF(s16be, "PCM signed 16 bit big-endian format",
-       BE_DEF("sw"), CODEC_ID_PCM_S16BE)
+PCMDEF(s8, "PCM signed 8 bit format",
+       "sb", CODEC_ID_PCM_S8)
+
+PCMDEF(u16be, "PCM unsigned 16 bit big-endian format",
+       BE_DEF("uw"), CODEC_ID_PCM_U16BE)
 
 PCMDEF(u16le, "PCM unsigned 16 bit little-endian format",
        LE_DEF("uw"), CODEC_ID_PCM_U16LE)
 
-PCMDEF(u16be, "PCM unsigned 16 bit big-endian format",
-       BE_DEF("uw"), CODEC_ID_PCM_U16BE)
-
-PCMDEF(s8, "PCM signed 8 bit format",
-       "sb", CODEC_ID_PCM_S8)
-
 PCMDEF(u8, "PCM unsigned 8 bit format",
        "ub", CODEC_ID_PCM_U8)
 
-PCMDEF(mulaw, "PCM mu-law format",
-       "ul", CODEC_ID_PCM_MULAW)
-
 PCMDEF(alaw, "PCM A-law format",
        "al", CODEC_ID_PCM_ALAW)
 
-static int rawvideo_read_packet(AVFormatContext *s, AVPacket *pkt)
-{
-    int packet_size, ret, width, height;
-    AVStream *st = s->streams[0];
-
-    width = st->codec->width;
-    height = st->codec->height;
-
-    packet_size = avpicture_get_size(st->codec->pix_fmt, width, height);
-    if (packet_size < 0)
-        return -1;
-
-    ret= av_get_packet(s->pb, pkt, packet_size);
-    pkt->pts=
-    pkt->dts= pkt->pos / packet_size;
-
-    pkt->stream_index = 0;
-    if (ret != packet_size) {
-        return AVERROR(EIO);
-    } else {
-        return 0;
-    }
-}
-
-AVInputFormat rawvideo_demuxer = {
-    "rawvideo",
-    NULL_IF_CONFIG_SMALL("raw video format"),
-    0,
-    NULL,
-    raw_read_header,
-    rawvideo_read_packet,
-    .flags= AVFMT_GENERIC_INDEX,
-    .extensions = "yuv,cif,qcif,rgb",
-    .value = CODEC_ID_RAWVIDEO,
-};
-
-#ifdef CONFIG_MUXERS
-AVOutputFormat rawvideo_muxer = {
-    "rawvideo",
-    NULL_IF_CONFIG_SMALL("raw video format"),
-    NULL,
-    "yuv,rgb",
-    0,
-    CODEC_ID_NONE,
-    CODEC_ID_RAWVIDEO,
-    NULL,
-    raw_write_packet,
-    .flags= AVFMT_NOTIMESTAMPS,
-};
-#endif //CONFIG_MUXERS
-
-#ifdef CONFIG_MUXERS
-static int null_write_packet(struct AVFormatContext *s, AVPacket *pkt)
-{
-    return 0;
-}
-
-AVOutputFormat null_muxer = {
-    "null",
-    NULL_IF_CONFIG_SMALL("null video format"),
-    NULL,
-    NULL,
-    0,
-#ifdef WORDS_BIGENDIAN
-    CODEC_ID_PCM_S16BE,
-#else
-    CODEC_ID_PCM_S16LE,
-#endif
-    CODEC_ID_RAWVIDEO,
-    NULL,
-    null_write_packet,
-    .flags = AVFMT_NOFILE | AVFMT_RAWPICTURE | AVFMT_NOTIMESTAMPS,
-};
-#endif //CONFIG_MUXERS
+PCMDEF(mulaw, "PCM mu-law format",
+       "ul", CODEC_ID_PCM_MULAW)