Browse code

Merge remote-tracking branch 'qatar/master'

* qatar/master:
flvdec: Fix invalid pointer deferences when parsing index
configure: disable hardware capabilities ELF section with suncc on Solaris x86
Use explicit struct initializers for AVCodec declarations.
Use explicit struct initializers for AVOutputFormat/AVInputFormat declarations.
adpcmenc: Set bits_per_coded_sample
adpcmenc: fix QT IMA ADPCM encoder
adpcmdec: Fix QT IMA ADPCM decoder
permit decoding of multichannel ADPCM_EA_XAS
Fix input buffer size check in adpcm_ea decoder.
fft: avoid a signed overflow
mpegps: Handle buffer exhaustion when reading packets.

Conflicts:
libavcodec/adpcm.c
libavcodec/adpcmenc.c
libavdevice/alsa-audio-enc.c
libavformat/flvdec.c
libavformat/mpeg.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>

Michael Niedermayer authored on 2011/09/25 05:37:24
Showing 35 changed files
... ...
@@ -2494,6 +2494,12 @@ case $target_os in
2494 2494
         enabled x86 && SHFLAGS="-mimpure-text $SHFLAGS"
2495 2495
         network_extralibs="-lsocket -lnsl"
2496 2496
         add_cppflags -D__EXTENSIONS__
2497
+        # When using suncc to build, the Solaris linker will mark
2498
+        # an executable with each instruction set encountered by
2499
+        # the Solaris assembler.  As our libraries contain their own
2500
+        # guards for processor-specific code, instead suppress
2501
+        # generation of the HWCAPS ELF section on Solaris x86 only.
2502
+        enabled_all suncc x86 && echo "hwcap_1 = OVERRIDE;" > mapfile && add_ldflags -Wl,-M,mapfile
2497 2503
         nm_opts='-P -g'
2498 2504
         ;;
2499 2505
     netbsd)
... ...
@@ -666,11 +666,17 @@ static int adpcm_decode_frame(AVCodecContext *avctx,
666 666
         }
667 667
         break;
668 668
     case CODEC_ID_ADPCM_EA:
669
-        if (buf_size < 12 || AV_RL32(src) > (buf_size - 12)/30*28) {
670
-            src += buf_size;
671
-            break;
669
+        /* Each EA ADPCM frame has a 12-byte header followed by 30-byte pieces,
670
+           each coding 28 stereo samples. */
671
+        if (buf_size < 12) {
672
+            av_log(avctx, AV_LOG_ERROR, "frame too small\n");
673
+            return AVERROR(EINVAL);
672 674
         }
673 675
         samples_in_chunk = AV_RL32(src);
676
+        if (samples_in_chunk / 28 > (buf_size - 12) / 30) {
677
+            av_log(avctx, AV_LOG_ERROR, "invalid frame\n");
678
+            return AVERROR(EINVAL);
679
+        }
674 680
         src += 4;
675 681
         current_left_sample   = (int16_t)bytestream_get_le16(&src);
676 682
         previous_left_sample  = (int16_t)bytestream_get_le16(&src);
... ...
@@ -1080,17 +1086,15 @@ static int adpcm_decode_frame(AVCodecContext *avctx,
1080 1080
 }
1081 1081
 
1082 1082
 
1083
-#define ADPCM_DECODER(id,name,long_name_)       \
1084
-AVCodec ff_ ## name ## _decoder = {             \
1085
-    #name,                                      \
1086
-    AVMEDIA_TYPE_AUDIO,                         \
1087
-    id,                                         \
1088
-    sizeof(ADPCMDecodeContext),                 \
1089
-    adpcm_decode_init,                          \
1090
-    NULL,                                       \
1091
-    NULL,                                       \
1092
-    adpcm_decode_frame,                         \
1093
-    .long_name = NULL_IF_CONFIG_SMALL(long_name_), \
1083
+#define ADPCM_DECODER(id_, name_, long_name_)               \
1084
+AVCodec ff_ ## name_ ## _decoder = {                        \
1085
+    .name           = #name_,                               \
1086
+    .type           = AVMEDIA_TYPE_AUDIO,                   \
1087
+    .id             = id_,                                  \
1088
+    .priv_data_size = sizeof(ADPCMDecodeContext),           \
1089
+    .init           = adpcm_decode_init,                    \
1090
+    .decode         = adpcm_decode_frame,                   \
1091
+    .long_name      = NULL_IF_CONFIG_SMALL(long_name_),     \
1094 1092
 }
1095 1093
 
1096 1094
 /* Note: Do not forget to add new entries to the Makefile as well. */
... ...
@@ -86,6 +86,8 @@ static av_cold int adpcm_encode_init(AVCodecContext *avctx)
86 86
         FF_ALLOC_OR_GOTO(avctx, s->trellis_hash, 65536 * sizeof(*s->trellis_hash), error);
87 87
     }
88 88
 
89
+    avctx->bits_per_coded_sample = av_get_bits_per_sample(avctx->codec->id);
90
+
89 91
     switch(avctx->codec->id) {
90 92
     case CODEC_ID_ADPCM_IMA_WAV:
91 93
         avctx->frame_size = (BLKSIZE - 4 * avctx->channels) * 8 / (4 * avctx->channels) + 1; /* each 16 bits sample gives one nibble */
... ...
@@ -670,18 +672,17 @@ static int adpcm_encode_frame(AVCodecContext *avctx,
670 670
 }
671 671
 
672 672
 
673
-#define ADPCM_ENCODER(id,name,long_name_)       \
674
-AVCodec ff_ ## name ## _encoder = {             \
675
-    #name,                                      \
676
-    AVMEDIA_TYPE_AUDIO,                         \
677
-    id,                                         \
678
-    sizeof(ADPCMEncodeContext),                 \
679
-    adpcm_encode_init,                          \
680
-    adpcm_encode_frame,                         \
681
-    adpcm_encode_close,                         \
682
-    NULL,                                       \
683
-    .sample_fmts = (const enum AVSampleFormat[]){AV_SAMPLE_FMT_S16,AV_SAMPLE_FMT_NONE}, \
684
-    .long_name = NULL_IF_CONFIG_SMALL(long_name_), \
673
+#define ADPCM_ENCODER(id_, name_, long_name_)               \
674
+AVCodec ff_ ## name_ ## _encoder = {                        \
675
+    .name           = #name_,                               \
676
+    .type           = AVMEDIA_TYPE_AUDIO,                   \
677
+    .id             = id_,                                  \
678
+    .priv_data_size = sizeof(ADPCMEncodeContext),           \
679
+    .init           = adpcm_encode_init,                    \
680
+    .encode         = adpcm_encode_frame,                   \
681
+    .close          = adpcm_encode_close,                   \
682
+    .sample_fmts    = (const enum AVSampleFormat[]){AV_SAMPLE_FMT_S16,AV_SAMPLE_FMT_NONE}, \
683
+    .long_name      = NULL_IF_CONFIG_SMALL(long_name_),     \
685 684
 }
686 685
 
687 686
 ADPCM_ENCODER(CODEC_ID_ADPCM_IMA_QT, adpcm_ima_qt, "ADPCM IMA QuickTime");
... ...
@@ -298,17 +298,15 @@ static int dpcm_decode_frame(AVCodecContext *avctx,
298 298
     return buf_size;
299 299
 }
300 300
 
301
-#define DPCM_DECODER(id, name, long_name_)      \
302
-AVCodec ff_ ## name ## _decoder = {             \
303
-    #name,                                      \
304
-    AVMEDIA_TYPE_AUDIO,                         \
305
-    id,                                         \
306
-    sizeof(DPCMContext),                        \
307
-    dpcm_decode_init,                           \
308
-    NULL,                                       \
309
-    NULL,                                       \
310
-    dpcm_decode_frame,                          \
311
-    .long_name = NULL_IF_CONFIG_SMALL(long_name_), \
301
+#define DPCM_DECODER(id_, name_, long_name_)                \
302
+AVCodec ff_ ## name_ ## _decoder = {                        \
303
+    .name           = #name_,                               \
304
+    .type           = AVMEDIA_TYPE_AUDIO,                   \
305
+    .id             = id_,                                  \
306
+    .priv_data_size = sizeof(DPCMContext),                  \
307
+    .init           = dpcm_decode_init,                     \
308
+    .decode         = dpcm_decode_frame,                    \
309
+    .long_name      = NULL_IF_CONFIG_SMALL(long_name_),     \
312 310
 }
313 311
 
314 312
 DPCM_DECODER(CODEC_ID_INTERPLAY_DPCM, interplay_dpcm, "DPCM Interplay");
... ...
@@ -383,13 +383,12 @@ static av_cold int encode_init_ls(AVCodecContext *ctx) {
383 383
 }
384 384
 
385 385
 AVCodec ff_jpegls_encoder = { //FIXME avoid MPV_* lossless JPEG should not need them
386
-    "jpegls",
387
-    AVMEDIA_TYPE_VIDEO,
388
-    CODEC_ID_JPEGLS,
389
-    sizeof(JpeglsContext),
390
-    encode_init_ls,
391
-    encode_picture_ls,
392
-    NULL,
393
-    .pix_fmts= (const enum PixelFormat[]){PIX_FMT_BGR24, PIX_FMT_RGB24, PIX_FMT_GRAY8, PIX_FMT_GRAY16, PIX_FMT_NONE},
394
-    .long_name= NULL_IF_CONFIG_SMALL("JPEG-LS"),
386
+    .name           = "jpegls",
387
+    .type           = AVMEDIA_TYPE_VIDEO,
388
+    .id             = CODEC_ID_JPEGLS,
389
+    .priv_data_size = sizeof(JpeglsContext),
390
+    .init           = encode_init_ls,
391
+    .encode         = encode_picture_ls,
392
+    .pix_fmts       = (const enum PixelFormat[]){PIX_FMT_BGR24, PIX_FMT_RGB24, PIX_FMT_GRAY8, PIX_FMT_GRAY16, PIX_FMT_NONE},
393
+    .long_name      = NULL_IF_CONFIG_SMALL("JPEG-LS"),
395 394
 };
... ...
@@ -186,15 +186,14 @@ static av_cold int libopenjpeg_decode_close(AVCodecContext *avctx)
186 186
 
187 187
 
188 188
 AVCodec ff_libopenjpeg_decoder = {
189
-    "libopenjpeg",
190
-    AVMEDIA_TYPE_VIDEO,
191
-    CODEC_ID_JPEG2000,
192
-    sizeof(LibOpenJPEGContext),
193
-    libopenjpeg_decode_init,
194
-    NULL,
195
-    libopenjpeg_decode_close,
196
-    libopenjpeg_decode_frame,
197
-    CODEC_CAP_DR1,
198
-    .max_lowres = 5,
199
-    .long_name = NULL_IF_CONFIG_SMALL("OpenJPEG based JPEG 2000 decoder"),
200
-} ;
189
+    .name           = "libopenjpeg",
190
+    .type           = AVMEDIA_TYPE_VIDEO,
191
+    .id             = CODEC_ID_JPEG2000,
192
+    .priv_data_size = sizeof(LibOpenJPEGContext),
193
+    .init           = libopenjpeg_decode_init,
194
+    .close          = libopenjpeg_decode_close,
195
+    .decode         = libopenjpeg_decode_frame,
196
+    .capabilities   = CODEC_CAP_DR1,
197
+    .max_lowres     = 5,
198
+    .long_name      = NULL_IF_CONFIG_SMALL("OpenJPEG based JPEG 2000 decoder"),
199
+};
... ...
@@ -274,15 +274,15 @@ static av_cold int oggvorbis_encode_close(AVCodecContext *avccontext) {
274 274
 
275 275
 
276 276
 AVCodec ff_libvorbis_encoder = {
277
-    "libvorbis",
278
-    AVMEDIA_TYPE_AUDIO,
279
-    CODEC_ID_VORBIS,
280
-    sizeof(OggVorbisContext),
281
-    oggvorbis_encode_init,
282
-    oggvorbis_encode_frame,
283
-    oggvorbis_encode_close,
284
-    .capabilities= CODEC_CAP_DELAY,
285
-    .sample_fmts = (const enum AVSampleFormat[]){AV_SAMPLE_FMT_S16,AV_SAMPLE_FMT_NONE},
286
-    .long_name= NULL_IF_CONFIG_SMALL("libvorbis Vorbis"),
287
-    .priv_class= &class,
288
-} ;
277
+    .name           = "libvorbis",
278
+    .type           = AVMEDIA_TYPE_AUDIO,
279
+    .id             = CODEC_ID_VORBIS,
280
+    .priv_data_size = sizeof(OggVorbisContext),
281
+    .init           = oggvorbis_encode_init,
282
+    .encode         = oggvorbis_encode_frame,
283
+    .close          = oggvorbis_encode_close,
284
+    .capabilities   = CODEC_CAP_DELAY,
285
+    .sample_fmts    = (const enum AVSampleFormat[]){AV_SAMPLE_FMT_S16,AV_SAMPLE_FMT_NONE},
286
+    .long_name      = NULL_IF_CONFIG_SMALL("libvorbis Vorbis"),
287
+    .priv_class     = &class,
288
+};
... ...
@@ -187,12 +187,12 @@ static int encode_picture_lossless(AVCodecContext *avctx, unsigned char *buf, in
187 187
 
188 188
 
189 189
 AVCodec ff_ljpeg_encoder = { //FIXME avoid MPV_* lossless JPEG should not need them
190
-    "ljpeg",
191
-    AVMEDIA_TYPE_VIDEO,
192
-    CODEC_ID_LJPEG,
193
-    sizeof(MpegEncContext),
194
-    MPV_encode_init,
195
-    encode_picture_lossless,
196
-    MPV_encode_end,
197
-    .long_name = NULL_IF_CONFIG_SMALL("Lossless JPEG"),
190
+    .name           = "ljpeg",
191
+    .type           = AVMEDIA_TYPE_VIDEO,
192
+    .id             = CODEC_ID_LJPEG,
193
+    .priv_data_size = sizeof(MpegEncContext),
194
+    .init           = MPV_encode_init,
195
+    .encode         = encode_picture_lossless,
196
+    .close          = MPV_encode_end,
197
+    .long_name      = NULL_IF_CONFIG_SMALL("Lossless JPEG"),
198 198
 };
... ...
@@ -2050,82 +2050,68 @@ static int decode_frame_mp3on4(AVCodecContext * avctx,
2050 2050
 
2051 2051
 #if !CONFIG_FLOAT
2052 2052
 #if CONFIG_MP1_DECODER
2053
-AVCodec ff_mp1_decoder =
2054
-{
2055
-    "mp1",
2056
-    AVMEDIA_TYPE_AUDIO,
2057
-    CODEC_ID_MP1,
2058
-    sizeof(MPADecodeContext),
2059
-    decode_init,
2060
-    NULL,
2061
-    NULL,
2062
-    decode_frame,
2063
-    CODEC_CAP_PARSE_ONLY,
2064
-    .flush= flush,
2065
-    .long_name= NULL_IF_CONFIG_SMALL("MP1 (MPEG audio layer 1)"),
2053
+AVCodec ff_mp1_decoder = {
2054
+    .name           = "mp1",
2055
+    .type           = AVMEDIA_TYPE_AUDIO,
2056
+    .id             = CODEC_ID_MP1,
2057
+    .priv_data_size = sizeof(MPADecodeContext),
2058
+    .init           = decode_init,
2059
+    .decode         = decode_frame,
2060
+    .capabilities   = CODEC_CAP_PARSE_ONLY,
2061
+    .flush          = flush,
2062
+    .long_name      = NULL_IF_CONFIG_SMALL("MP1 (MPEG audio layer 1)"),
2066 2063
 };
2067 2064
 #endif
2068 2065
 #if CONFIG_MP2_DECODER
2069
-AVCodec ff_mp2_decoder =
2070
-{
2071
-    "mp2",
2072
-    AVMEDIA_TYPE_AUDIO,
2073
-    CODEC_ID_MP2,
2074
-    sizeof(MPADecodeContext),
2075
-    decode_init,
2076
-    NULL,
2077
-    NULL,
2078
-    decode_frame,
2079
-    CODEC_CAP_PARSE_ONLY,
2080
-    .flush= flush,
2081
-    .long_name= NULL_IF_CONFIG_SMALL("MP2 (MPEG audio layer 2)"),
2066
+AVCodec ff_mp2_decoder = {
2067
+    .name           = "mp2",
2068
+    .type           = AVMEDIA_TYPE_AUDIO,
2069
+    .id             = CODEC_ID_MP2,
2070
+    .priv_data_size = sizeof(MPADecodeContext),
2071
+    .init           = decode_init,
2072
+    .decode         = decode_frame,
2073
+    .capabilities   = CODEC_CAP_PARSE_ONLY,
2074
+    .flush          = flush,
2075
+    .long_name      = NULL_IF_CONFIG_SMALL("MP2 (MPEG audio layer 2)"),
2082 2076
 };
2083 2077
 #endif
2084 2078
 #if CONFIG_MP3_DECODER
2085
-AVCodec ff_mp3_decoder =
2086
-{
2087
-    "mp3",
2088
-    AVMEDIA_TYPE_AUDIO,
2089
-    CODEC_ID_MP3,
2090
-    sizeof(MPADecodeContext),
2091
-    decode_init,
2092
-    NULL,
2093
-    NULL,
2094
-    decode_frame,
2095
-    CODEC_CAP_PARSE_ONLY,
2096
-    .flush= flush,
2097
-    .long_name= NULL_IF_CONFIG_SMALL("MP3 (MPEG audio layer 3)"),
2079
+AVCodec ff_mp3_decoder = {
2080
+    .name           = "mp3",
2081
+    .type           = AVMEDIA_TYPE_AUDIO,
2082
+    .id             = CODEC_ID_MP3,
2083
+    .priv_data_size = sizeof(MPADecodeContext),
2084
+    .init           = decode_init,
2085
+    .decode         = decode_frame,
2086
+    .capabilities   = CODEC_CAP_PARSE_ONLY,
2087
+    .flush          = flush,
2088
+    .long_name      = NULL_IF_CONFIG_SMALL("MP3 (MPEG audio layer 3)"),
2098 2089
 };
2099 2090
 #endif
2100 2091
 #if CONFIG_MP3ADU_DECODER
2101
-AVCodec ff_mp3adu_decoder =
2102
-{
2103
-    "mp3adu",
2104
-    AVMEDIA_TYPE_AUDIO,
2105
-    CODEC_ID_MP3ADU,
2106
-    sizeof(MPADecodeContext),
2107
-    decode_init,
2108
-    NULL,
2109
-    NULL,
2110
-    decode_frame_adu,
2111
-    CODEC_CAP_PARSE_ONLY,
2112
-    .flush= flush,
2113
-    .long_name= NULL_IF_CONFIG_SMALL("ADU (Application Data Unit) MP3 (MPEG audio layer 3)"),
2092
+AVCodec ff_mp3adu_decoder = {
2093
+    .name           = "mp3adu",
2094
+    .type           = AVMEDIA_TYPE_AUDIO,
2095
+    .id             = CODEC_ID_MP3ADU,
2096
+    .priv_data_size = sizeof(MPADecodeContext),
2097
+    .init           = decode_init,
2098
+    .decode         = decode_frame_adu,
2099
+    .capabilities   = CODEC_CAP_PARSE_ONLY,
2100
+    .flush          = flush,
2101
+    .long_name      = NULL_IF_CONFIG_SMALL("ADU (Application Data Unit) MP3 (MPEG audio layer 3)"),
2114 2102
 };
2115 2103
 #endif
2116 2104
 #if CONFIG_MP3ON4_DECODER
2117
-AVCodec ff_mp3on4_decoder =
2118
-{
2119
-    "mp3on4",
2120
-    AVMEDIA_TYPE_AUDIO,
2121
-    CODEC_ID_MP3ON4,
2122
-    sizeof(MP3On4DecodeContext),
2123
-    decode_init_mp3on4,
2124
-    NULL,
2125
-    decode_close_mp3on4,
2126
-    decode_frame_mp3on4,
2127
-    .flush= flush,
2128
-    .long_name= NULL_IF_CONFIG_SMALL("MP3onMP4"),
2105
+AVCodec ff_mp3on4_decoder = {
2106
+    .name           = "mp3on4",
2107
+    .type           = AVMEDIA_TYPE_AUDIO,
2108
+    .id             = CODEC_ID_MP3ON4,
2109
+    .priv_data_size = sizeof(MP3On4DecodeContext),
2110
+    .init           = decode_init_mp3on4,
2111
+    .close          = decode_close_mp3on4,
2112
+    .decode         = decode_frame_mp3on4,
2113
+    .flush          = flush,
2114
+    .long_name      = NULL_IF_CONFIG_SMALL("MP3onMP4"),
2129 2115
 };
2130 2116
 #endif
2131 2117
 #endif
... ...
@@ -23,81 +23,67 @@
23 23
 #include "mpegaudiodec.c"
24 24
 
25 25
 #if CONFIG_MP1FLOAT_DECODER
26
-AVCodec ff_mp1float_decoder =
27
-{
28
-    "mp1float",
29
-    AVMEDIA_TYPE_AUDIO,
30
-    CODEC_ID_MP1,
31
-    sizeof(MPADecodeContext),
32
-    decode_init,
33
-    NULL,
34
-    .close = NULL,
35
-    decode_frame,
36
-    CODEC_CAP_PARSE_ONLY,
37
-    .flush= flush,
38
-    .long_name= NULL_IF_CONFIG_SMALL("MP1 (MPEG audio layer 1)"),
26
+AVCodec ff_mp1float_decoder = {
27
+    .name           = "mp1float",
28
+    .type           = AVMEDIA_TYPE_AUDIO,
29
+    .id             = CODEC_ID_MP1,
30
+    .priv_data_size = sizeof(MPADecodeContext),
31
+    .init           = decode_init,
32
+    .decode         = decode_frame,
33
+    .capabilities   = CODEC_CAP_PARSE_ONLY,
34
+    .flush          = flush,
35
+    .long_name      = NULL_IF_CONFIG_SMALL("MP1 (MPEG audio layer 1)"),
39 36
 };
40 37
 #endif
41 38
 #if CONFIG_MP2FLOAT_DECODER
42
-AVCodec ff_mp2float_decoder =
43
-{
44
-    "mp2float",
45
-    AVMEDIA_TYPE_AUDIO,
46
-    CODEC_ID_MP2,
47
-    sizeof(MPADecodeContext),
48
-    decode_init,
49
-    NULL,
50
-    .close = NULL,
51
-    decode_frame,
52
-    CODEC_CAP_PARSE_ONLY,
53
-    .flush= flush,
54
-    .long_name= NULL_IF_CONFIG_SMALL("MP2 (MPEG audio layer 2)"),
39
+AVCodec ff_mp2float_decoder = {
40
+    .name           = "mp2float",
41
+    .type           = AVMEDIA_TYPE_AUDIO,
42
+    .id             = CODEC_ID_MP2,
43
+    .priv_data_size = sizeof(MPADecodeContext),
44
+    .init           = decode_init,
45
+    .decode         = decode_frame,
46
+    .capabilities   = CODEC_CAP_PARSE_ONLY,
47
+    .flush          = flush,
48
+    .long_name      = NULL_IF_CONFIG_SMALL("MP2 (MPEG audio layer 2)"),
55 49
 };
56 50
 #endif
57 51
 #if CONFIG_MP3FLOAT_DECODER
58
-AVCodec ff_mp3float_decoder =
59
-{
60
-    "mp3float",
61
-    AVMEDIA_TYPE_AUDIO,
62
-    CODEC_ID_MP3,
63
-    sizeof(MPADecodeContext),
64
-    decode_init,
65
-    NULL,
66
-    .close = NULL,
67
-    decode_frame,
68
-    CODEC_CAP_PARSE_ONLY,
69
-    .flush= flush,
70
-    .long_name= NULL_IF_CONFIG_SMALL("MP3 (MPEG audio layer 3)"),
52
+AVCodec ff_mp3float_decoder = {
53
+    .name           = "mp3float",
54
+    .type           = AVMEDIA_TYPE_AUDIO,
55
+    .id             = CODEC_ID_MP3,
56
+    .priv_data_size = sizeof(MPADecodeContext),
57
+    .init           = decode_init,
58
+    .decode         = decode_frame,
59
+    .capabilities   = CODEC_CAP_PARSE_ONLY,
60
+    .flush          = flush,
61
+    .long_name      = NULL_IF_CONFIG_SMALL("MP3 (MPEG audio layer 3)"),
71 62
 };
72 63
 #endif
73 64
 #if CONFIG_MP3ADUFLOAT_DECODER
74
-AVCodec ff_mp3adufloat_decoder =
75
-{
76
-    "mp3adufloat",
77
-    AVMEDIA_TYPE_AUDIO,
78
-    CODEC_ID_MP3ADU,
79
-    sizeof(MPADecodeContext),
80
-    decode_init,
81
-    NULL,
82
-    .close = NULL,
83
-    decode_frame_adu,
84
-    CODEC_CAP_PARSE_ONLY,
85
-    .flush= flush,
86
-    .long_name= NULL_IF_CONFIG_SMALL("ADU (Application Data Unit) MP3 (MPEG audio layer 3)"),
65
+AVCodec ff_mp3adufloat_decoder = {
66
+    .name           = "mp3adufloat",
67
+    .type           = AVMEDIA_TYPE_AUDIO,
68
+    .id             = CODEC_ID_MP3ADU,
69
+    .priv_data_size = sizeof(MPADecodeContext),
70
+    .init           = decode_init,
71
+    .decode         = decode_frame_adu,
72
+    .capabilities   = CODEC_CAP_PARSE_ONLY,
73
+    .flush          = flush,
74
+    .long_name      = NULL_IF_CONFIG_SMALL("ADU (Application Data Unit) MP3 (MPEG audio layer 3)"),
87 75
 };
88 76
 #endif
89 77
 #if CONFIG_MP3ON4FLOAT_DECODER
90
-AVCodec ff_mp3on4float_decoder =
91
-{
92
-    "mp3on4float",
93
-    AVMEDIA_TYPE_AUDIO,
94
-    CODEC_ID_MP3ON4,
95
-    sizeof(MP3On4DecodeContext),
96
-    decode_init_mp3on4,
97
-    NULL,
98
-    decode_close_mp3on4,
99
-    decode_frame_mp3on4,
100
-    .flush= flush,
101
-    .long_name= NULL_IF_CONFIG_SMALL("MP3onMP4"),
78
+AVCodec ff_mp3on4float_decoder = {
79
+    .name           = "mp3on4float",
80
+    .type           = AVMEDIA_TYPE_AUDIO,
81
+    .id             = CODEC_ID_MP3ON4,
82
+    .priv_data_size = sizeof(MP3On4DecodeContext),
83
+    .init           = decode_init_mp3on4,
84
+    .close          = decode_close_mp3on4,
85
+    .decode         = decode_frame_mp3on4,
86
+    .flush          = flush,
87
+    .long_name      = NULL_IF_CONFIG_SMALL("MP3onMP4"),
102 88
 };
103 89
 #endif
... ...
@@ -114,15 +114,12 @@ static int ra144_decode_frame(AVCodecContext * avctx, void *vdata,
114 114
     return 20;
115 115
 }
116 116
 
117
-AVCodec ff_ra_144_decoder =
118
-{
119
-    "real_144",
120
-    AVMEDIA_TYPE_AUDIO,
121
-    CODEC_ID_RA_144,
122
-    sizeof(RA144Context),
123
-    ra144_decode_init,
124
-    NULL,
125
-    NULL,
126
-    ra144_decode_frame,
127
-    .long_name = NULL_IF_CONFIG_SMALL("RealAudio 1.0 (14.4K)"),
117
+AVCodec ff_ra_144_decoder = {
118
+    .name           = "real_144",
119
+    .type           = AVMEDIA_TYPE_AUDIO,
120
+    .id             = CODEC_ID_RA_144,
121
+    .priv_data_size = sizeof(RA144Context),
122
+    .init           = ra144_decode_init,
123
+    .decode         = ra144_decode_frame,
124
+    .long_name      = NULL_IF_CONFIG_SMALL("RealAudio 1.0 (14.4K)"),
128 125
 };
... ...
@@ -508,14 +508,13 @@ static int ra144_encode_frame(AVCodecContext *avctx, uint8_t *frame,
508 508
 }
509 509
 
510 510
 
511
-AVCodec ff_ra_144_encoder =
512
-{
513
-    "real_144",
514
-    AVMEDIA_TYPE_AUDIO,
515
-    CODEC_ID_RA_144,
516
-    sizeof(RA144Context),
517
-    ra144_encode_init,
518
-    ra144_encode_frame,
519
-    ra144_encode_close,
520
-    .long_name = NULL_IF_CONFIG_SMALL("RealAudio 1.0 (14.4K) encoder"),
511
+AVCodec ff_ra_144_encoder = {
512
+    .name           = "real_144",
513
+    .type           = AVMEDIA_TYPE_AUDIO,
514
+    .id             = CODEC_ID_RA_144,
515
+    .priv_data_size = sizeof(RA144Context),
516
+    .init           = ra144_encode_init,
517
+    .encode         = ra144_encode_frame,
518
+    .close          = ra144_encode_close,
519
+    .long_name      = NULL_IF_CONFIG_SMALL("RealAudio 1.0 (14.4K) encoder"),
521 520
 };
... ...
@@ -203,15 +203,12 @@ static int ra288_decode_frame(AVCodecContext * avctx, void *data,
203 203
     return avctx->block_align;
204 204
 }
205 205
 
206
-AVCodec ff_ra_288_decoder =
207
-{
208
-    "real_288",
209
-    AVMEDIA_TYPE_AUDIO,
210
-    CODEC_ID_RA_288,
211
-    sizeof(RA288Context),
212
-    ra288_decode_init,
213
-    NULL,
214
-    NULL,
215
-    ra288_decode_frame,
216
-    .long_name = NULL_IF_CONFIG_SMALL("RealAudio 2.0 (28.8K)"),
206
+AVCodec ff_ra_288_decoder = {
207
+    .name           = "real_288",
208
+    .type           = AVMEDIA_TYPE_AUDIO,
209
+    .id             = CODEC_ID_RA_288,
210
+    .priv_data_size = sizeof(RA288Context),
211
+    .init           = ra288_decode_init,
212
+    .decode         = ra288_decode_frame,
213
+    .long_name      = NULL_IF_CONFIG_SMALL("RealAudio 2.0 (28.8K)"),
217 214
 };
... ...
@@ -1065,16 +1065,15 @@ static int roq_encode_end(AVCodecContext *avctx)
1065 1065
     return 0;
1066 1066
 }
1067 1067
 
1068
-AVCodec ff_roq_encoder =
1069
-{
1070
-    "roqvideo",
1071
-    AVMEDIA_TYPE_VIDEO,
1072
-    CODEC_ID_ROQ,
1073
-    sizeof(RoqContext),
1074
-    roq_encode_init,
1075
-    roq_encode_frame,
1076
-    roq_encode_end,
1068
+AVCodec ff_roq_encoder = {
1069
+    .name                 = "roqvideo",
1070
+    .type                 = AVMEDIA_TYPE_VIDEO,
1071
+    .id                   = CODEC_ID_ROQ,
1072
+    .priv_data_size       = sizeof(RoqContext),
1073
+    .init                 = roq_encode_init,
1074
+    .encode               = roq_encode_frame,
1075
+    .close                = roq_encode_end,
1077 1076
     .supported_framerates = (const AVRational[]){{30,1}, {0,0}},
1078
-    .pix_fmts = (const enum PixelFormat[]){PIX_FMT_YUV444P, PIX_FMT_NONE},
1079
-    .long_name = NULL_IF_CONFIG_SMALL("id RoQ video"),
1077
+    .pix_fmts             = (const enum PixelFormat[]){PIX_FMT_YUV444P, PIX_FMT_NONE},
1078
+    .long_name            = NULL_IF_CONFIG_SMALL("id RoQ video"),
1080 1079
 };
... ...
@@ -1120,15 +1120,13 @@ static av_cold int twin_decode_close(AVCodecContext *avctx)
1120 1120
     return 0;
1121 1121
 }
1122 1122
 
1123
-AVCodec ff_twinvq_decoder =
1124
-{
1125
-    "twinvq",
1126
-    AVMEDIA_TYPE_AUDIO,
1127
-    CODEC_ID_TWINVQ,
1128
-    sizeof(TwinContext),
1129
-    twin_decode_init,
1130
-    NULL,
1131
-    twin_decode_close,
1132
-    twin_decode_frame,
1133
-    .long_name = NULL_IF_CONFIG_SMALL("VQF TwinVQ"),
1123
+AVCodec ff_twinvq_decoder = {
1124
+    .name           = "twinvq",
1125
+    .type           = AVMEDIA_TYPE_AUDIO,
1126
+    .id             = CODEC_ID_TWINVQ,
1127
+    .priv_data_size = sizeof(TwinContext),
1128
+    .init           = twin_decode_init,
1129
+    .close          = twin_decode_close,
1130
+    .decode         = twin_decode_frame,
1131
+    .long_name      = NULL_IF_CONFIG_SMALL("VQF TwinVQ"),
1134 1132
 };
... ...
@@ -1200,6 +1200,8 @@ int av_get_bits_per_sample(enum CodecID codec_id){
1200 1200
     case CODEC_ID_ADPCM_SBPRO_4:
1201 1201
     case CODEC_ID_ADPCM_CT:
1202 1202
     case CODEC_ID_ADPCM_IMA_WAV:
1203
+    case CODEC_ID_ADPCM_IMA_QT:
1204
+    case CODEC_ID_ADPCM_SWF:
1203 1205
     case CODEC_ID_ADPCM_MS:
1204 1206
     case CODEC_ID_ADPCM_YAMAHA:
1205 1207
         return 4;
... ...
@@ -928,30 +928,26 @@ static av_cold void flush(AVCodecContext *avctx)
928 928
     s->last_superframe_len= 0;
929 929
 }
930 930
 
931
-AVCodec ff_wmav1_decoder =
932
-{
933
-    "wmav1",
934
-    AVMEDIA_TYPE_AUDIO,
935
-    CODEC_ID_WMAV1,
936
-    sizeof(WMACodecContext),
937
-    wma_decode_init,
938
-    NULL,
939
-    ff_wma_end,
940
-    wma_decode_superframe,
941
-    .flush=flush,
942
-    .long_name = NULL_IF_CONFIG_SMALL("Windows Media Audio 1"),
931
+AVCodec ff_wmav1_decoder = {
932
+    .name           = "wmav1",
933
+    .type           = AVMEDIA_TYPE_AUDIO,
934
+    .id             = CODEC_ID_WMAV1,
935
+    .priv_data_size = sizeof(WMACodecContext),
936
+    .init           = wma_decode_init,
937
+    .close          = ff_wma_end,
938
+    .decode         = wma_decode_superframe,
939
+    .flush          = flush,
940
+    .long_name      = NULL_IF_CONFIG_SMALL("Windows Media Audio 1"),
943 941
 };
944 942
 
945
-AVCodec ff_wmav2_decoder =
946
-{
947
-    "wmav2",
948
-    AVMEDIA_TYPE_AUDIO,
949
-    CODEC_ID_WMAV2,
950
-    sizeof(WMACodecContext),
951
-    wma_decode_init,
952
-    NULL,
953
-    ff_wma_end,
954
-    wma_decode_superframe,
955
-    .flush=flush,
956
-    .long_name = NULL_IF_CONFIG_SMALL("Windows Media Audio 2"),
943
+AVCodec ff_wmav2_decoder = {
944
+    .name           = "wmav2",
945
+    .type           = AVMEDIA_TYPE_AUDIO,
946
+    .id             = CODEC_ID_WMAV2,
947
+    .priv_data_size = sizeof(WMACodecContext),
948
+    .init           = wma_decode_init,
949
+    .close          = ff_wma_end,
950
+    .decode         = wma_decode_superframe,
951
+    .flush          = flush,
952
+    .long_name      = NULL_IF_CONFIG_SMALL("Windows Media Audio 2"),
957 953
 };
... ...
@@ -390,28 +390,26 @@ static int encode_superframe(AVCodecContext *avctx,
390 390
     return put_bits_ptr(&s->pb) - s->pb.buf;
391 391
 }
392 392
 
393
-AVCodec ff_wmav1_encoder =
394
-{
395
-    "wmav1",
396
-    AVMEDIA_TYPE_AUDIO,
397
-    CODEC_ID_WMAV1,
398
-    sizeof(WMACodecContext),
399
-    encode_init,
400
-    encode_superframe,
401
-    ff_wma_end,
402
-    .sample_fmts = (const enum AVSampleFormat[]){AV_SAMPLE_FMT_S16,AV_SAMPLE_FMT_NONE},
403
-    .long_name = NULL_IF_CONFIG_SMALL("Windows Media Audio 1"),
393
+AVCodec ff_wmav1_encoder = {
394
+    .name           = "wmav1",
395
+    .type           = AVMEDIA_TYPE_AUDIO,
396
+    .id             = CODEC_ID_WMAV1,
397
+    .priv_data_size = sizeof(WMACodecContext),
398
+    .init           = encode_init,
399
+    .encode         = encode_superframe,
400
+    .close          = ff_wma_end,
401
+    .sample_fmts    = (const enum AVSampleFormat[]){AV_SAMPLE_FMT_S16,AV_SAMPLE_FMT_NONE},
402
+    .long_name      = NULL_IF_CONFIG_SMALL("Windows Media Audio 1"),
404 403
 };
405 404
 
406
-AVCodec ff_wmav2_encoder =
407
-{
408
-    "wmav2",
409
-    AVMEDIA_TYPE_AUDIO,
410
-    CODEC_ID_WMAV2,
411
-    sizeof(WMACodecContext),
412
-    encode_init,
413
-    encode_superframe,
414
-    ff_wma_end,
415
-    .sample_fmts = (const enum AVSampleFormat[]){AV_SAMPLE_FMT_S16,AV_SAMPLE_FMT_NONE},
416
-    .long_name = NULL_IF_CONFIG_SMALL("Windows Media Audio 2"),
405
+AVCodec ff_wmav2_encoder = {
406
+    .name           = "wmav2",
407
+    .type           = AVMEDIA_TYPE_AUDIO,
408
+    .id             = CODEC_ID_WMAV2,
409
+    .priv_data_size = sizeof(WMACodecContext),
410
+    .init           = encode_init,
411
+    .encode         = encode_superframe,
412
+    .close          = ff_wma_end,
413
+    .sample_fmts    = (const enum AVSampleFormat[]){AV_SAMPLE_FMT_S16,AV_SAMPLE_FMT_NONE},
414
+    .long_name      = NULL_IF_CONFIG_SMALL("Windows Media Audio 2"),
417 415
 };
... ...
@@ -23,7 +23,7 @@
23 23
 #include "libavcodec/dsputil.h"
24 24
 #include "fft.h"
25 25
 
26
-DECLARE_ALIGNED(8, static const int, m1m1)[2] = { 1<<31, 1<<31 };
26
+DECLARE_ALIGNED(8, static const unsigned int, m1m1)[2] = { 1U<<31, 1U<<31 };
27 27
 
28 28
 #ifdef EMULATE_3DNOWEXT
29 29
 #define PSWAPD(s,d)\
... ...
@@ -70,7 +70,7 @@ void ff_imdct_half_3dn2(FFTContext *s, FFTSample *output, const FFTSample *input
70 70
     in1 = input;
71 71
     in2 = input + n2 - 1;
72 72
 #ifdef EMULATE_3DNOWEXT
73
-    __asm__ volatile("movd %0, %%mm7" ::"r"(1<<31));
73
+    __asm__ volatile("movd %0, %%mm7" ::"r"(1U<<31));
74 74
 #endif
75 75
     for(k = 0; k < n4; k++) {
76 76
         // FIXME a single block is faster, but gcc 2.95 and 3.4.x on 32bit can't compile it
... ...
@@ -24,8 +24,8 @@
24 24
 #include "fft.h"
25 25
 #include "config.h"
26 26
 
27
-DECLARE_ASM_CONST(16, int, ff_m1m1m1m1)[4] =
28
-    { 1 << 31, 1 << 31, 1 << 31, 1 << 31 };
27
+DECLARE_ASM_CONST(16, unsigned int, ff_m1m1m1m1)[4] =
28
+    { 1U << 31, 1U << 31, 1U << 31, 1U << 31 };
29 29
 
30 30
 void ff_fft_dispatch_sse(FFTComplex *z, int nbits);
31 31
 void ff_fft_dispatch_interleave_sse(FFTComplex *z, int nbits);
... ...
@@ -145,13 +145,12 @@ static const AVClass alsa_demuxer_class = {
145 145
 };
146 146
 
147 147
 AVInputFormat ff_alsa_demuxer = {
148
-    "alsa",
149
-    NULL_IF_CONFIG_SMALL("ALSA audio input"),
150
-    sizeof(AlsaData),
151
-    NULL,
152
-    audio_read_header,
153
-    audio_read_packet,
154
-    ff_alsa_close,
155
-    .flags = AVFMT_NOFILE,
156
-    .priv_class = &alsa_demuxer_class,
148
+    .name           = "alsa",
149
+    .long_name      = NULL_IF_CONFIG_SMALL("ALSA audio input"),
150
+    .priv_data_size = sizeof(AlsaData),
151
+    .read_header    = audio_read_header,
152
+    .read_packet    = audio_read_packet,
153
+    .read_close     = ff_alsa_close,
154
+    .flags          = AVFMT_NOFILE,
155
+    .priv_class     = &alsa_demuxer_class,
157 156
 };
... ...
@@ -114,16 +114,14 @@ audio_get_output_timestamp(AVFormatContext *s1, int stream,
114 114
 }
115 115
 
116 116
 AVOutputFormat ff_alsa_muxer = {
117
-    "alsa",
118
-    NULL_IF_CONFIG_SMALL("ALSA audio output"),
119
-    "",
120
-    "",
121
-    sizeof(AlsaData),
122
-    DEFAULT_CODEC_ID,
123
-    CODEC_ID_NONE,
124
-    audio_write_header,
125
-    audio_write_packet,
126
-    ff_alsa_close,
117
+    .name           = "alsa",
118
+    .long_name      = NULL_IF_CONFIG_SMALL("ALSA audio output"),
119
+    .priv_data_size = sizeof(AlsaData),
120
+    .audio_codec    = DEFAULT_CODEC_ID,
121
+    .video_codec    = CODEC_ID_NONE,
122
+    .write_header   = audio_write_header,
123
+    .write_packet   = audio_write_packet,
124
+    .write_trailer  = ff_alsa_close,
127 125
     .get_output_timestamp = audio_get_output_timestamp,
128
-    .flags = AVFMT_NOFILE,
126
+    .flags          = AVFMT_NOFILE,
129 127
 };
... ...
@@ -345,13 +345,12 @@ static const AVClass bktr_class = {
345 345
 };
346 346
 
347 347
 AVInputFormat ff_bktr_demuxer = {
348
-    "bktr",
349
-    NULL_IF_CONFIG_SMALL("video grab"),
350
-    sizeof(VideoData),
351
-    NULL,
352
-    grab_read_header,
353
-    grab_read_packet,
354
-    grab_read_close,
355
-    .flags = AVFMT_NOFILE,
356
-    .priv_class = &bktr_class,
348
+    .name           = "bktr",
349
+    .long_name      = NULL_IF_CONFIG_SMALL("video grab"),
350
+    .priv_data_size = sizeof(VideoData),
351
+    .read_header    = grab_read_header,
352
+    .read_packet    = grab_read_packet,
353
+    .read_close     = grab_read_close,
354
+    .flags          = AVFMT_NOFILE,
355
+    .priv_class     = &bktr_class,
357 356
 };
... ...
@@ -326,13 +326,12 @@ static const AVClass jack_indev_class = {
326 326
 };
327 327
 
328 328
 AVInputFormat ff_jack_demuxer = {
329
-    "jack",
330
-    NULL_IF_CONFIG_SMALL("JACK Audio Connection Kit"),
331
-    sizeof(JackData),
332
-    NULL,
333
-    audio_read_header,
334
-    audio_read_packet,
335
-    audio_read_close,
336
-    .flags = AVFMT_NOFILE,
337
-    .priv_class = &jack_indev_class,
329
+    .name           = "jack",
330
+    .long_name      = NULL_IF_CONFIG_SMALL("JACK Audio Connection Kit"),
331
+    .priv_data_size = sizeof(JackData),
332
+    .read_header    = audio_read_header,
333
+    .read_packet    = audio_read_packet,
334
+    .read_close     = audio_read_close,
335
+    .flags          = AVFMT_NOFILE,
336
+    .priv_class     = &jack_indev_class,
338 337
 };
... ...
@@ -295,33 +295,30 @@ static const AVClass oss_demuxer_class = {
295 295
 };
296 296
 
297 297
 AVInputFormat ff_oss_demuxer = {
298
-    "oss",
299
-    NULL_IF_CONFIG_SMALL("Open Sound System capture"),
300
-    sizeof(AudioData),
301
-    NULL,
302
-    audio_read_header,
303
-    audio_read_packet,
304
-    audio_read_close,
305
-    .flags = AVFMT_NOFILE,
306
-    .priv_class = &oss_demuxer_class,
298
+    .name           = "oss",
299
+    .long_name      = NULL_IF_CONFIG_SMALL("Open Sound System capture"),
300
+    .priv_data_size = sizeof(AudioData),
301
+    .read_header    = audio_read_header,
302
+    .read_packet    = audio_read_packet,
303
+    .read_close     = audio_read_close,
304
+    .flags          = AVFMT_NOFILE,
305
+    .priv_class     = &oss_demuxer_class,
307 306
 };
308 307
 #endif
309 308
 
310 309
 #if CONFIG_OSS_OUTDEV
311 310
 AVOutputFormat ff_oss_muxer = {
312
-    "oss",
313
-    NULL_IF_CONFIG_SMALL("Open Sound System playback"),
314
-    "",
315
-    "",
316
-    sizeof(AudioData),
311
+    .name           = "oss",
312
+    .long_name      = NULL_IF_CONFIG_SMALL("Open Sound System playback"),
313
+    .priv_data_size = sizeof(AudioData),
317 314
     /* XXX: we make the assumption that the soundcard accepts this format */
318 315
     /* XXX: find better solution with "preinit" method, needed also in
319 316
        other formats */
320
-    AV_NE(CODEC_ID_PCM_S16BE, CODEC_ID_PCM_S16LE),
321
-    CODEC_ID_NONE,
322
-    audio_write_header,
323
-    audio_write_packet,
324
-    audio_write_trailer,
325
-    .flags = AVFMT_NOFILE,
317
+    .audio_codec    = AV_NE(CODEC_ID_PCM_S16BE, CODEC_ID_PCM_S16LE),
318
+    .video_codec    = CODEC_ID_NONE,
319
+    .write_header   = audio_write_header,
320
+    .write_packet   = audio_write_packet,
321
+    .write_trailer  = audio_write_trailer,
322
+    .flags          = AVFMT_NOFILE,
326 323
 };
327 324
 #endif
... ...
@@ -354,14 +354,13 @@ static const AVClass v4l_class = {
354 354
 };
355 355
 
356 356
 AVInputFormat ff_v4l_demuxer = {
357
-    "video4linux",
358
-    NULL_IF_CONFIG_SMALL("Video4Linux device grab"),
359
-    sizeof(VideoData),
360
-    NULL,
361
-    grab_read_header,
362
-    grab_read_packet,
363
-    grab_read_close,
364
-    .flags = AVFMT_NOFILE,
365
-    .priv_class = &v4l_class,
357
+    .name           = "video4linux",
358
+    .long_name      = NULL_IF_CONFIG_SMALL("Video4Linux device grab"),
359
+    .priv_data_size = sizeof(VideoData),
360
+    .read_header    = grab_read_header,
361
+    .read_packet    = grab_read_packet,
362
+    .read_close     = grab_read_close,
363
+    .flags          = AVFMT_NOFILE,
364
+    .priv_class     = &v4l_class,
366 365
 };
367 366
 #endif  /* FF_API_V4L */
... ...
@@ -705,13 +705,12 @@ static const AVClass v4l2_class = {
705 705
 };
706 706
 
707 707
 AVInputFormat ff_v4l2_demuxer = {
708
-    "video4linux2",
709
-    NULL_IF_CONFIG_SMALL("Video4Linux2 device grab"),
710
-    sizeof(struct video_data),
711
-    NULL,
712
-    v4l2_read_header,
713
-    v4l2_read_packet,
714
-    v4l2_read_close,
715
-    .flags = AVFMT_NOFILE,
716
-    .priv_class = &v4l2_class,
708
+    .name           = "video4linux2",
709
+    .long_name      = NULL_IF_CONFIG_SMALL("Video4Linux2 device grab"),
710
+    .priv_data_size = sizeof(struct video_data),
711
+    .read_header    = v4l2_read_header,
712
+    .read_packet    = v4l2_read_packet,
713
+    .read_close     = v4l2_read_close,
714
+    .flags          = AVFMT_NOFILE,
715
+    .priv_class     = &v4l2_class,
717 716
 };
... ...
@@ -471,13 +471,12 @@ static const AVClass vfw_class = {
471 471
 };
472 472
 
473 473
 AVInputFormat ff_vfwcap_demuxer = {
474
-    "vfwcap",
475
-    NULL_IF_CONFIG_SMALL("VFW video capture"),
476
-    sizeof(struct vfw_ctx),
477
-    NULL,
478
-    vfw_read_header,
479
-    vfw_read_packet,
480
-    vfw_read_close,
481
-    .flags = AVFMT_NOFILE,
482
-    .priv_class = &vfw_class,
474
+    .name           = "vfwcap",
475
+    .long_name      = NULL_IF_CONFIG_SMALL("VfW video capture"),
476
+    .priv_data_size = sizeof(struct vfw_ctx),
477
+    .read_header    = vfw_read_header,
478
+    .read_packet    = vfw_read_packet,
479
+    .read_close     = vfw_read_close,
480
+    .flags          = AVFMT_NOFILE,
481
+    .priv_class     = &vfw_class,
483 482
 };
... ...
@@ -599,15 +599,13 @@ static const AVClass x11_class = {
599 599
 };
600 600
 
601 601
 /** x11 grabber device demuxer declaration */
602
-AVInputFormat ff_x11_grab_device_demuxer =
603
-{
604
-    "x11grab",
605
-    NULL_IF_CONFIG_SMALL("X11grab"),
606
-    sizeof(struct x11_grab),
607
-    NULL,
608
-    x11grab_read_header,
609
-    x11grab_read_packet,
610
-    x11grab_read_close,
611
-    .flags = AVFMT_NOFILE,
612
-    .priv_class = &x11_class,
602
+AVInputFormat ff_x11_grab_device_demuxer = {
603
+    .name           = "x11grab",
604
+    .long_name      = NULL_IF_CONFIG_SMALL("X11grab"),
605
+    .priv_data_size = sizeof(struct x11_grab),
606
+    .read_header    = x11grab_read_header,
607
+    .read_packet    = x11grab_read_packet,
608
+    .read_close     = x11grab_read_close,
609
+    .flags          = AVFMT_NOFILE,
610
+    .priv_class     = &x11_class,
613 611
 };
... ...
@@ -80,17 +80,14 @@ AVInputFormat ff_daud_demuxer = {
80 80
 #endif
81 81
 
82 82
 #if CONFIG_DAUD_MUXER
83
-AVOutputFormat ff_daud_muxer =
84
-{
85
-    "daud",
86
-    NULL_IF_CONFIG_SMALL("D-Cinema audio format"),
87
-    NULL,
88
-    "302",
89
-    0,
90
-    CODEC_ID_PCM_S24DAUD,
91
-    CODEC_ID_NONE,
92
-    daud_write_header,
93
-    daud_write_packet,
94
-    .flags= AVFMT_NOTIMESTAMPS,
83
+AVOutputFormat ff_daud_muxer = {
84
+    .name         = "daud",
85
+    .long_name    = NULL_IF_CONFIG_SMALL("D-Cinema audio format"),
86
+    .extensions   = "302",
87
+    .audio_codec  = CODEC_ID_PCM_S24DAUD,
88
+    .video_codec  = CODEC_ID_NONE,
89
+    .write_header = daud_write_header,
90
+    .write_packet = daud_write_packet,
91
+    .flags        = AVFMT_NOTIMESTAMPS,
95 92
 };
96 93
 #endif
... ...
@@ -35,15 +35,12 @@ static int roq_write_header(struct AVFormatContext *s)
35 35
     return 0;
36 36
 }
37 37
 
38
-AVOutputFormat ff_roq_muxer =
39
-{
40
-    "RoQ",
41
-    NULL_IF_CONFIG_SMALL("raw id RoQ format"),
42
-    NULL,
43
-    "roq",
44
-    0,
45
-    CODEC_ID_ROQ_DPCM,
46
-    CODEC_ID_ROQ,
47
-    roq_write_header,
48
-    ff_raw_write_packet,
38
+AVOutputFormat ff_roq_muxer = {
39
+    .name         = "RoQ",
40
+    .long_name    = NULL_IF_CONFIG_SMALL("raw id RoQ format"),
41
+    .extensions   = "roq",
42
+    .audio_codec  = CODEC_ID_ROQ_DPCM,
43
+    .video_codec  = CODEC_ID_ROQ,
44
+    .write_header = roq_write_header,
45
+    .write_packet = ff_raw_write_packet,
49 46
 };
... ...
@@ -423,7 +423,7 @@ static int mpegps_read_packet(AVFormatContext *s,
423 423
 {
424 424
     MpegDemuxContext *m = s->priv_data;
425 425
     AVStream *st;
426
-    int len, startcode, i, es_type;
426
+    int len, startcode, i, es_type, ret;
427 427
     int request_probe= 0;
428 428
     enum CodecID codec_id = CODEC_ID_NONE;
429 429
     enum AVMediaType type;
... ...
@@ -569,7 +569,13 @@ static int mpegps_read_packet(AVFormatContext *s,
569 569
             return AVERROR(EINVAL);
570 570
     }
571 571
     av_new_packet(pkt, len);
572
-    avio_read(s->pb, pkt->data, pkt->size);
572
+    ret = avio_read(s->pb, pkt->data, pkt->size);
573
+    if (ret < 0) {
574
+        pkt->size = 0;
575
+    } else if (ret < pkt->size) {
576
+        pkt->size = ret;
577
+        memset(pkt->data + ret, 0, FF_INPUT_BUFFER_PADDING_SIZE);
578
+    }
573 579
     pkt->pts = pts;
574 580
     pkt->dts = dts;
575 581
     pkt->pos = dummy_pos;
... ...
@@ -578,7 +584,7 @@ static int mpegps_read_packet(AVFormatContext *s,
578 578
             pkt->stream_index, pkt->pts / 90000.0, pkt->dts / 90000.0,
579 579
             pkt->size);
580 580
 
581
-    return 0;
581
+    return (ret < 0) ? ret : 0;
582 582
 }
583 583
 
584 584
 static int64_t mpegps_read_dts(AVFormatContext *s, int stream_index,
... ...
@@ -54,26 +54,24 @@ static const AVOption pcm_options[] = {
54 54
     { NULL },
55 55
 };
56 56
 
57
-#define PCMDEF(name, long_name, ext, codec) \
58
-static const AVClass name ## _demuxer_class = {\
59
-    .class_name = #name " demuxer",\
60
-    .item_name  = av_default_item_name,\
61
-    .option     = pcm_options,\
62
-    .version    = LIBAVUTIL_VERSION_INT,\
63
-};\
64
-AVInputFormat ff_pcm_ ## name ## _demuxer = {\
65
-    #name,\
66
-    NULL_IF_CONFIG_SMALL(long_name),\
67
-    sizeof(RawAudioDemuxerContext),\
68
-    NULL,\
69
-    ff_raw_read_header,\
70
-    raw_read_packet,\
71
-    NULL,\
72
-    pcm_read_seek,\
73
-    .flags= AVFMT_GENERIC_INDEX,\
74
-    .extensions = ext,\
75
-    .value = codec,\
76
-    .priv_class = &name ## _demuxer_class,\
57
+#define PCMDEF(name_, long_name_, ext, codec)               \
58
+static const AVClass name_ ## _demuxer_class = {            \
59
+    .class_name = #name_ " demuxer",                        \
60
+    .item_name  = av_default_item_name,                     \
61
+    .option     = pcm_options,                              \
62
+    .version    = LIBAVUTIL_VERSION_INT,                    \
63
+};                                                          \
64
+AVInputFormat ff_pcm_ ## name_ ## _demuxer = {              \
65
+    .name           = #name_,                               \
66
+    .long_name      = NULL_IF_CONFIG_SMALL(long_name_),     \
67
+    .priv_data_size = sizeof(RawAudioDemuxerContext),       \
68
+    .read_header    = ff_raw_read_header,                   \
69
+    .read_packet    = raw_read_packet,                      \
70
+    .read_seek      = pcm_read_seek,                        \
71
+    .flags          = AVFMT_GENERIC_INDEX,                  \
72
+    .extensions     = ext,                                  \
73
+    .value          = codec,                                \
74
+    .priv_class     = &name_ ## _demuxer_class,             \
77 75
 };
78 76
 
79 77
 PCMDEF(f64be, "PCM 64 bit floating-point big-endian format",
... ...
@@ -22,18 +22,15 @@
22 22
 #include "avformat.h"
23 23
 #include "rawenc.h"
24 24
 
25
-#define PCMDEF(name, long_name, ext, codec) \
26
-AVOutputFormat ff_pcm_ ## name ## _muxer = {\
27
-    #name,\
28
-    NULL_IF_CONFIG_SMALL(long_name),\
29
-    NULL,\
30
-    ext,\
31
-    0,\
32
-    codec,\
33
-    CODEC_ID_NONE,\
34
-    NULL,\
35
-    ff_raw_write_packet,\
36
-    .flags= AVFMT_NOTIMESTAMPS,\
25
+#define PCMDEF(name_, long_name_, ext, codec)               \
26
+AVOutputFormat ff_pcm_ ## name_ ## _muxer = {               \
27
+    .name         = #name_,                                 \
28
+    .long_name    = NULL_IF_CONFIG_SMALL(long_name_),       \
29
+    .extensions   = ext,                                    \
30
+    .audio_codec  = codec,                                  \
31
+    .video_codec  = CODEC_ID_NONE,                          \
32
+    .write_packet = ff_raw_write_packet,                    \
33
+    .flags        = AVFMT_NOTIMESTAMPS,                     \
37 34
 };
38 35
 
39 36
 PCMDEF(f64be, "PCM 64 bit floating-point big-endian format",
... ...
@@ -90,12 +90,10 @@ next_chunk:
90 90
     return 0;
91 91
 }
92 92
 
93
-AVInputFormat ff_txd_demuxer =
94
-{
95
-    "txd",
96
-    NULL_IF_CONFIG_SMALL("Renderware TeXture Dictionary"),
97
-    0,
98
-    txd_probe,
99
-    txd_read_header,
100
-    txd_read_packet,
93
+AVInputFormat ff_txd_demuxer = {
94
+    .name        = "txd",
95
+    .long_name   = NULL_IF_CONFIG_SMALL("Renderware TeXture Dictionary"),
96
+    .read_probe  = txd_probe,
97
+    .read_header = txd_read_header,
98
+    .read_packet = txd_read_packet,
101 99
 };