Merge remote-tracking branch 'qatar/master'
authorMichael Niedermayer <michaelni@gmx.at>
Sat, 24 Sep 2011 20:37:24 +0000 (22:37 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Sat, 24 Sep 2011 20:39:52 +0000 (22:39 +0200)
* 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>
35 files changed:
configure
libavcodec/adpcm.c
libavcodec/adpcmenc.c
libavcodec/dpcm.c
libavcodec/jpeglsenc.c
libavcodec/libopenjpeg.c
libavcodec/libvorbis.c
libavcodec/ljpegenc.c
libavcodec/mpegaudiodec.c
libavcodec/mpegaudiodec_float.c
libavcodec/ra144dec.c
libavcodec/ra144enc.c
libavcodec/ra288.c
libavcodec/roqvideoenc.c
libavcodec/twinvq.c
libavcodec/utils.c
libavcodec/wmadec.c
libavcodec/wmaenc.c
libavcodec/x86/fft_3dn2.c
libavcodec/x86/fft_sse.c
libavdevice/alsa-audio-dec.c
libavdevice/alsa-audio-enc.c
libavdevice/bktr.c
libavdevice/jack_audio.c
libavdevice/oss_audio.c
libavdevice/v4l.c
libavdevice/v4l2.c
libavdevice/vfwcap.c
libavdevice/x11grab.c
libavformat/daud.c
libavformat/idroqenc.c
libavformat/mpeg.c
libavformat/pcmdec.c
libavformat/pcmenc.c
libavformat/txd.c

index e807209..7c1a54e 100755 (executable)
--- a/configure
+++ b/configure
@@ -2494,6 +2494,12 @@ case $target_os in
         enabled x86 && SHFLAGS="-mimpure-text $SHFLAGS"
         network_extralibs="-lsocket -lnsl"
         add_cppflags -D__EXTENSIONS__
+        # When using suncc to build, the Solaris linker will mark
+        # an executable with each instruction set encountered by
+        # the Solaris assembler.  As our libraries contain their own
+        # guards for processor-specific code, instead suppress
+        # generation of the HWCAPS ELF section on Solaris x86 only.
+        enabled_all suncc x86 && echo "hwcap_1 = OVERRIDE;" > mapfile && add_ldflags -Wl,-M,mapfile
         nm_opts='-P -g'
         ;;
     netbsd)
index 77e1ef6..3cb62e3 100644 (file)
@@ -666,11 +666,17 @@ static int adpcm_decode_frame(AVCodecContext *avctx,
         }
         break;
     case CODEC_ID_ADPCM_EA:
-        if (buf_size < 12 || AV_RL32(src) > (buf_size - 12)/30*28) {
-            src += buf_size;
-            break;
+        /* Each EA ADPCM frame has a 12-byte header followed by 30-byte pieces,
+           each coding 28 stereo samples. */
+        if (buf_size < 12) {
+            av_log(avctx, AV_LOG_ERROR, "frame too small\n");
+            return AVERROR(EINVAL);
         }
         samples_in_chunk = AV_RL32(src);
+        if (samples_in_chunk / 28 > (buf_size - 12) / 30) {
+            av_log(avctx, AV_LOG_ERROR, "invalid frame\n");
+            return AVERROR(EINVAL);
+        }
         src += 4;
         current_left_sample   = (int16_t)bytestream_get_le16(&src);
         previous_left_sample  = (int16_t)bytestream_get_le16(&src);
@@ -1080,17 +1086,15 @@ static int adpcm_decode_frame(AVCodecContext *avctx,
 }
 
 
-#define ADPCM_DECODER(id,name,long_name_)       \
-AVCodec ff_ ## name ## _decoder = {             \
-    #name,                                      \
-    AVMEDIA_TYPE_AUDIO,                         \
-    id,                                         \
-    sizeof(ADPCMDecodeContext),                 \
-    adpcm_decode_init,                          \
-    NULL,                                       \
-    NULL,                                       \
-    adpcm_decode_frame,                         \
-    .long_name = NULL_IF_CONFIG_SMALL(long_name_), \
+#define ADPCM_DECODER(id_, name_, long_name_)               \
+AVCodec ff_ ## name_ ## _decoder = {                        \
+    .name           = #name_,                               \
+    .type           = AVMEDIA_TYPE_AUDIO,                   \
+    .id             = id_,                                  \
+    .priv_data_size = sizeof(ADPCMDecodeContext),           \
+    .init           = adpcm_decode_init,                    \
+    .decode         = adpcm_decode_frame,                   \
+    .long_name      = NULL_IF_CONFIG_SMALL(long_name_),     \
 }
 
 /* Note: Do not forget to add new entries to the Makefile as well. */
index c39bab8..14978f0 100644 (file)
@@ -86,6 +86,8 @@ static av_cold int adpcm_encode_init(AVCodecContext *avctx)
         FF_ALLOC_OR_GOTO(avctx, s->trellis_hash, 65536 * sizeof(*s->trellis_hash), error);
     }
 
+    avctx->bits_per_coded_sample = av_get_bits_per_sample(avctx->codec->id);
+
     switch(avctx->codec->id) {
     case CODEC_ID_ADPCM_IMA_WAV:
         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,
 }
 
 
-#define ADPCM_ENCODER(id,name,long_name_)       \
-AVCodec ff_ ## name ## _encoder = {             \
-    #name,                                      \
-    AVMEDIA_TYPE_AUDIO,                         \
-    id,                                         \
-    sizeof(ADPCMEncodeContext),                 \
-    adpcm_encode_init,                          \
-    adpcm_encode_frame,                         \
-    adpcm_encode_close,                         \
-    NULL,                                       \
-    .sample_fmts = (const enum AVSampleFormat[]){AV_SAMPLE_FMT_S16,AV_SAMPLE_FMT_NONE}, \
-    .long_name = NULL_IF_CONFIG_SMALL(long_name_), \
+#define ADPCM_ENCODER(id_, name_, long_name_)               \
+AVCodec ff_ ## name_ ## _encoder = {                        \
+    .name           = #name_,                               \
+    .type           = AVMEDIA_TYPE_AUDIO,                   \
+    .id             = id_,                                  \
+    .priv_data_size = sizeof(ADPCMEncodeContext),           \
+    .init           = adpcm_encode_init,                    \
+    .encode         = adpcm_encode_frame,                   \
+    .close          = adpcm_encode_close,                   \
+    .sample_fmts    = (const enum AVSampleFormat[]){AV_SAMPLE_FMT_S16,AV_SAMPLE_FMT_NONE}, \
+    .long_name      = NULL_IF_CONFIG_SMALL(long_name_),     \
 }
 
 ADPCM_ENCODER(CODEC_ID_ADPCM_IMA_QT, adpcm_ima_qt, "ADPCM IMA QuickTime");
index ee8eb6a..d9c1524 100644 (file)
@@ -298,17 +298,15 @@ static int dpcm_decode_frame(AVCodecContext *avctx,
     return buf_size;
 }
 
-#define DPCM_DECODER(id, name, long_name_)      \
-AVCodec ff_ ## name ## _decoder = {             \
-    #name,                                      \
-    AVMEDIA_TYPE_AUDIO,                         \
-    id,                                         \
-    sizeof(DPCMContext),                        \
-    dpcm_decode_init,                           \
-    NULL,                                       \
-    NULL,                                       \
-    dpcm_decode_frame,                          \
-    .long_name = NULL_IF_CONFIG_SMALL(long_name_), \
+#define DPCM_DECODER(id_, name_, long_name_)                \
+AVCodec ff_ ## name_ ## _decoder = {                        \
+    .name           = #name_,                               \
+    .type           = AVMEDIA_TYPE_AUDIO,                   \
+    .id             = id_,                                  \
+    .priv_data_size = sizeof(DPCMContext),                  \
+    .init           = dpcm_decode_init,                     \
+    .decode         = dpcm_decode_frame,                    \
+    .long_name      = NULL_IF_CONFIG_SMALL(long_name_),     \
 }
 
 DPCM_DECODER(CODEC_ID_INTERPLAY_DPCM, interplay_dpcm, "DPCM Interplay");
index fef0681..06f365a 100644 (file)
@@ -383,13 +383,12 @@ static av_cold int encode_init_ls(AVCodecContext *ctx) {
 }
 
 AVCodec ff_jpegls_encoder = { //FIXME avoid MPV_* lossless JPEG should not need them
-    "jpegls",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_JPEGLS,
-    sizeof(JpeglsContext),
-    encode_init_ls,
-    encode_picture_ls,
-    NULL,
-    .pix_fmts= (const enum PixelFormat[]){PIX_FMT_BGR24, PIX_FMT_RGB24, PIX_FMT_GRAY8, PIX_FMT_GRAY16, PIX_FMT_NONE},
-    .long_name= NULL_IF_CONFIG_SMALL("JPEG-LS"),
+    .name           = "jpegls",
+    .type           = AVMEDIA_TYPE_VIDEO,
+    .id             = CODEC_ID_JPEGLS,
+    .priv_data_size = sizeof(JpeglsContext),
+    .init           = encode_init_ls,
+    .encode         = encode_picture_ls,
+    .pix_fmts       = (const enum PixelFormat[]){PIX_FMT_BGR24, PIX_FMT_RGB24, PIX_FMT_GRAY8, PIX_FMT_GRAY16, PIX_FMT_NONE},
+    .long_name      = NULL_IF_CONFIG_SMALL("JPEG-LS"),
 };
index 67201a2..b780303 100644 (file)
@@ -186,15 +186,14 @@ static av_cold int libopenjpeg_decode_close(AVCodecContext *avctx)
 
 
 AVCodec ff_libopenjpeg_decoder = {
-    "libopenjpeg",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_JPEG2000,
-    sizeof(LibOpenJPEGContext),
-    libopenjpeg_decode_init,
-    NULL,
-    libopenjpeg_decode_close,
-    libopenjpeg_decode_frame,
-    CODEC_CAP_DR1,
-    .max_lowres = 5,
-    .long_name = NULL_IF_CONFIG_SMALL("OpenJPEG based JPEG 2000 decoder"),
-} ;
+    .name           = "libopenjpeg",
+    .type           = AVMEDIA_TYPE_VIDEO,
+    .id             = CODEC_ID_JPEG2000,
+    .priv_data_size = sizeof(LibOpenJPEGContext),
+    .init           = libopenjpeg_decode_init,
+    .close          = libopenjpeg_decode_close,
+    .decode         = libopenjpeg_decode_frame,
+    .capabilities   = CODEC_CAP_DR1,
+    .max_lowres     = 5,
+    .long_name      = NULL_IF_CONFIG_SMALL("OpenJPEG based JPEG 2000 decoder"),
+};
index 4e05268..daa6ac9 100644 (file)
@@ -274,15 +274,15 @@ static av_cold int oggvorbis_encode_close(AVCodecContext *avccontext) {
 
 
 AVCodec ff_libvorbis_encoder = {
-    "libvorbis",
-    AVMEDIA_TYPE_AUDIO,
-    CODEC_ID_VORBIS,
-    sizeof(OggVorbisContext),
-    oggvorbis_encode_init,
-    oggvorbis_encode_frame,
-    oggvorbis_encode_close,
-    .capabilities= CODEC_CAP_DELAY,
-    .sample_fmts = (const enum AVSampleFormat[]){AV_SAMPLE_FMT_S16,AV_SAMPLE_FMT_NONE},
-    .long_name= NULL_IF_CONFIG_SMALL("libvorbis Vorbis"),
-    .priv_class= &class,
-} ;
+    .name           = "libvorbis",
+    .type           = AVMEDIA_TYPE_AUDIO,
+    .id             = CODEC_ID_VORBIS,
+    .priv_data_size = sizeof(OggVorbisContext),
+    .init           = oggvorbis_encode_init,
+    .encode         = oggvorbis_encode_frame,
+    .close          = oggvorbis_encode_close,
+    .capabilities   = CODEC_CAP_DELAY,
+    .sample_fmts    = (const enum AVSampleFormat[]){AV_SAMPLE_FMT_S16,AV_SAMPLE_FMT_NONE},
+    .long_name      = NULL_IF_CONFIG_SMALL("libvorbis Vorbis"),
+    .priv_class     = &class,
+};
index e5d19fc..f8178d5 100644 (file)
@@ -187,12 +187,12 @@ static int encode_picture_lossless(AVCodecContext *avctx, unsigned char *buf, in
 
 
 AVCodec ff_ljpeg_encoder = { //FIXME avoid MPV_* lossless JPEG should not need them
-    "ljpeg",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_LJPEG,
-    sizeof(MpegEncContext),
-    MPV_encode_init,
-    encode_picture_lossless,
-    MPV_encode_end,
-    .long_name = NULL_IF_CONFIG_SMALL("Lossless JPEG"),
+    .name           = "ljpeg",
+    .type           = AVMEDIA_TYPE_VIDEO,
+    .id             = CODEC_ID_LJPEG,
+    .priv_data_size = sizeof(MpegEncContext),
+    .init           = MPV_encode_init,
+    .encode         = encode_picture_lossless,
+    .close          = MPV_encode_end,
+    .long_name      = NULL_IF_CONFIG_SMALL("Lossless JPEG"),
 };
index 9fbae0c..7c98cde 100644 (file)
@@ -2050,82 +2050,68 @@ static int decode_frame_mp3on4(AVCodecContext * avctx,
 
 #if !CONFIG_FLOAT
 #if CONFIG_MP1_DECODER
-AVCodec ff_mp1_decoder =
-{
-    "mp1",
-    AVMEDIA_TYPE_AUDIO,
-    CODEC_ID_MP1,
-    sizeof(MPADecodeContext),
-    decode_init,
-    NULL,
-    NULL,
-    decode_frame,
-    CODEC_CAP_PARSE_ONLY,
-    .flush= flush,
-    .long_name= NULL_IF_CONFIG_SMALL("MP1 (MPEG audio layer 1)"),
+AVCodec ff_mp1_decoder = {
+    .name           = "mp1",
+    .type           = AVMEDIA_TYPE_AUDIO,
+    .id             = CODEC_ID_MP1,
+    .priv_data_size = sizeof(MPADecodeContext),
+    .init           = decode_init,
+    .decode         = decode_frame,
+    .capabilities   = CODEC_CAP_PARSE_ONLY,
+    .flush          = flush,
+    .long_name      = NULL_IF_CONFIG_SMALL("MP1 (MPEG audio layer 1)"),
 };
 #endif
 #if CONFIG_MP2_DECODER
-AVCodec ff_mp2_decoder =
-{
-    "mp2",
-    AVMEDIA_TYPE_AUDIO,
-    CODEC_ID_MP2,
-    sizeof(MPADecodeContext),
-    decode_init,
-    NULL,
-    NULL,
-    decode_frame,
-    CODEC_CAP_PARSE_ONLY,
-    .flush= flush,
-    .long_name= NULL_IF_CONFIG_SMALL("MP2 (MPEG audio layer 2)"),
+AVCodec ff_mp2_decoder = {
+    .name           = "mp2",
+    .type           = AVMEDIA_TYPE_AUDIO,
+    .id             = CODEC_ID_MP2,
+    .priv_data_size = sizeof(MPADecodeContext),
+    .init           = decode_init,
+    .decode         = decode_frame,
+    .capabilities   = CODEC_CAP_PARSE_ONLY,
+    .flush          = flush,
+    .long_name      = NULL_IF_CONFIG_SMALL("MP2 (MPEG audio layer 2)"),
 };
 #endif
 #if CONFIG_MP3_DECODER
-AVCodec ff_mp3_decoder =
-{
-    "mp3",
-    AVMEDIA_TYPE_AUDIO,
-    CODEC_ID_MP3,
-    sizeof(MPADecodeContext),
-    decode_init,
-    NULL,
-    NULL,
-    decode_frame,
-    CODEC_CAP_PARSE_ONLY,
-    .flush= flush,
-    .long_name= NULL_IF_CONFIG_SMALL("MP3 (MPEG audio layer 3)"),
+AVCodec ff_mp3_decoder = {
+    .name           = "mp3",
+    .type           = AVMEDIA_TYPE_AUDIO,
+    .id             = CODEC_ID_MP3,
+    .priv_data_size = sizeof(MPADecodeContext),
+    .init           = decode_init,
+    .decode         = decode_frame,
+    .capabilities   = CODEC_CAP_PARSE_ONLY,
+    .flush          = flush,
+    .long_name      = NULL_IF_CONFIG_SMALL("MP3 (MPEG audio layer 3)"),
 };
 #endif
 #if CONFIG_MP3ADU_DECODER
-AVCodec ff_mp3adu_decoder =
-{
-    "mp3adu",
-    AVMEDIA_TYPE_AUDIO,
-    CODEC_ID_MP3ADU,
-    sizeof(MPADecodeContext),
-    decode_init,
-    NULL,
-    NULL,
-    decode_frame_adu,
-    CODEC_CAP_PARSE_ONLY,
-    .flush= flush,
-    .long_name= NULL_IF_CONFIG_SMALL("ADU (Application Data Unit) MP3 (MPEG audio layer 3)"),
+AVCodec ff_mp3adu_decoder = {
+    .name           = "mp3adu",
+    .type           = AVMEDIA_TYPE_AUDIO,
+    .id             = CODEC_ID_MP3ADU,
+    .priv_data_size = sizeof(MPADecodeContext),
+    .init           = decode_init,
+    .decode         = decode_frame_adu,
+    .capabilities   = CODEC_CAP_PARSE_ONLY,
+    .flush          = flush,
+    .long_name      = NULL_IF_CONFIG_SMALL("ADU (Application Data Unit) MP3 (MPEG audio layer 3)"),
 };
 #endif
 #if CONFIG_MP3ON4_DECODER
-AVCodec ff_mp3on4_decoder =
-{
-    "mp3on4",
-    AVMEDIA_TYPE_AUDIO,
-    CODEC_ID_MP3ON4,
-    sizeof(MP3On4DecodeContext),
-    decode_init_mp3on4,
-    NULL,
-    decode_close_mp3on4,
-    decode_frame_mp3on4,
-    .flush= flush,
-    .long_name= NULL_IF_CONFIG_SMALL("MP3onMP4"),
+AVCodec ff_mp3on4_decoder = {
+    .name           = "mp3on4",
+    .type           = AVMEDIA_TYPE_AUDIO,
+    .id             = CODEC_ID_MP3ON4,
+    .priv_data_size = sizeof(MP3On4DecodeContext),
+    .init           = decode_init_mp3on4,
+    .close          = decode_close_mp3on4,
+    .decode         = decode_frame_mp3on4,
+    .flush          = flush,
+    .long_name      = NULL_IF_CONFIG_SMALL("MP3onMP4"),
 };
 #endif
 #endif
index 44b38b6..2fde46a 100644 (file)
 #include "mpegaudiodec.c"
 
 #if CONFIG_MP1FLOAT_DECODER
-AVCodec ff_mp1float_decoder =
-{
-    "mp1float",
-    AVMEDIA_TYPE_AUDIO,
-    CODEC_ID_MP1,
-    sizeof(MPADecodeContext),
-    decode_init,
-    NULL,
-    .close = NULL,
-    decode_frame,
-    CODEC_CAP_PARSE_ONLY,
-    .flush= flush,
-    .long_name= NULL_IF_CONFIG_SMALL("MP1 (MPEG audio layer 1)"),
+AVCodec ff_mp1float_decoder = {
+    .name           = "mp1float",
+    .type           = AVMEDIA_TYPE_AUDIO,
+    .id             = CODEC_ID_MP1,
+    .priv_data_size = sizeof(MPADecodeContext),
+    .init           = decode_init,
+    .decode         = decode_frame,
+    .capabilities   = CODEC_CAP_PARSE_ONLY,
+    .flush          = flush,
+    .long_name      = NULL_IF_CONFIG_SMALL("MP1 (MPEG audio layer 1)"),
 };
 #endif
 #if CONFIG_MP2FLOAT_DECODER
-AVCodec ff_mp2float_decoder =
-{
-    "mp2float",
-    AVMEDIA_TYPE_AUDIO,
-    CODEC_ID_MP2,
-    sizeof(MPADecodeContext),
-    decode_init,
-    NULL,
-    .close = NULL,
-    decode_frame,
-    CODEC_CAP_PARSE_ONLY,
-    .flush= flush,
-    .long_name= NULL_IF_CONFIG_SMALL("MP2 (MPEG audio layer 2)"),
+AVCodec ff_mp2float_decoder = {
+    .name           = "mp2float",
+    .type           = AVMEDIA_TYPE_AUDIO,
+    .id             = CODEC_ID_MP2,
+    .priv_data_size = sizeof(MPADecodeContext),
+    .init           = decode_init,
+    .decode         = decode_frame,
+    .capabilities   = CODEC_CAP_PARSE_ONLY,
+    .flush          = flush,
+    .long_name      = NULL_IF_CONFIG_SMALL("MP2 (MPEG audio layer 2)"),
 };
 #endif
 #if CONFIG_MP3FLOAT_DECODER
-AVCodec ff_mp3float_decoder =
-{
-    "mp3float",
-    AVMEDIA_TYPE_AUDIO,
-    CODEC_ID_MP3,
-    sizeof(MPADecodeContext),
-    decode_init,
-    NULL,
-    .close = NULL,
-    decode_frame,
-    CODEC_CAP_PARSE_ONLY,
-    .flush= flush,
-    .long_name= NULL_IF_CONFIG_SMALL("MP3 (MPEG audio layer 3)"),
+AVCodec ff_mp3float_decoder = {
+    .name           = "mp3float",
+    .type           = AVMEDIA_TYPE_AUDIO,
+    .id             = CODEC_ID_MP3,
+    .priv_data_size = sizeof(MPADecodeContext),
+    .init           = decode_init,
+    .decode         = decode_frame,
+    .capabilities   = CODEC_CAP_PARSE_ONLY,
+    .flush          = flush,
+    .long_name      = NULL_IF_CONFIG_SMALL("MP3 (MPEG audio layer 3)"),
 };
 #endif
 #if CONFIG_MP3ADUFLOAT_DECODER
-AVCodec ff_mp3adufloat_decoder =
-{
-    "mp3adufloat",
-    AVMEDIA_TYPE_AUDIO,
-    CODEC_ID_MP3ADU,
-    sizeof(MPADecodeContext),
-    decode_init,
-    NULL,
-    .close = NULL,
-    decode_frame_adu,
-    CODEC_CAP_PARSE_ONLY,
-    .flush= flush,
-    .long_name= NULL_IF_CONFIG_SMALL("ADU (Application Data Unit) MP3 (MPEG audio layer 3)"),
+AVCodec ff_mp3adufloat_decoder = {
+    .name           = "mp3adufloat",
+    .type           = AVMEDIA_TYPE_AUDIO,
+    .id             = CODEC_ID_MP3ADU,
+    .priv_data_size = sizeof(MPADecodeContext),
+    .init           = decode_init,
+    .decode         = decode_frame_adu,
+    .capabilities   = CODEC_CAP_PARSE_ONLY,
+    .flush          = flush,
+    .long_name      = NULL_IF_CONFIG_SMALL("ADU (Application Data Unit) MP3 (MPEG audio layer 3)"),
 };
 #endif
 #if CONFIG_MP3ON4FLOAT_DECODER
-AVCodec ff_mp3on4float_decoder =
-{
-    "mp3on4float",
-    AVMEDIA_TYPE_AUDIO,
-    CODEC_ID_MP3ON4,
-    sizeof(MP3On4DecodeContext),
-    decode_init_mp3on4,
-    NULL,
-    decode_close_mp3on4,
-    decode_frame_mp3on4,
-    .flush= flush,
-    .long_name= NULL_IF_CONFIG_SMALL("MP3onMP4"),
+AVCodec ff_mp3on4float_decoder = {
+    .name           = "mp3on4float",
+    .type           = AVMEDIA_TYPE_AUDIO,
+    .id             = CODEC_ID_MP3ON4,
+    .priv_data_size = sizeof(MP3On4DecodeContext),
+    .init           = decode_init_mp3on4,
+    .close          = decode_close_mp3on4,
+    .decode         = decode_frame_mp3on4,
+    .flush          = flush,
+    .long_name      = NULL_IF_CONFIG_SMALL("MP3onMP4"),
 };
 #endif
index 53f529d..fffcf02 100644 (file)
@@ -114,15 +114,12 @@ static int ra144_decode_frame(AVCodecContext * avctx, void *vdata,
     return 20;
 }
 
-AVCodec ff_ra_144_decoder =
-{
-    "real_144",
-    AVMEDIA_TYPE_AUDIO,
-    CODEC_ID_RA_144,
-    sizeof(RA144Context),
-    ra144_decode_init,
-    NULL,
-    NULL,
-    ra144_decode_frame,
-    .long_name = NULL_IF_CONFIG_SMALL("RealAudio 1.0 (14.4K)"),
+AVCodec ff_ra_144_decoder = {
+    .name           = "real_144",
+    .type           = AVMEDIA_TYPE_AUDIO,
+    .id             = CODEC_ID_RA_144,
+    .priv_data_size = sizeof(RA144Context),
+    .init           = ra144_decode_init,
+    .decode         = ra144_decode_frame,
+    .long_name      = NULL_IF_CONFIG_SMALL("RealAudio 1.0 (14.4K)"),
 };
index 351ba9e..5a64a5e 100644 (file)
@@ -508,14 +508,13 @@ static int ra144_encode_frame(AVCodecContext *avctx, uint8_t *frame,
 }
 
 
-AVCodec ff_ra_144_encoder =
-{
-    "real_144",
-    AVMEDIA_TYPE_AUDIO,
-    CODEC_ID_RA_144,
-    sizeof(RA144Context),
-    ra144_encode_init,
-    ra144_encode_frame,
-    ra144_encode_close,
-    .long_name = NULL_IF_CONFIG_SMALL("RealAudio 1.0 (14.4K) encoder"),
+AVCodec ff_ra_144_encoder = {
+    .name           = "real_144",
+    .type           = AVMEDIA_TYPE_AUDIO,
+    .id             = CODEC_ID_RA_144,
+    .priv_data_size = sizeof(RA144Context),
+    .init           = ra144_encode_init,
+    .encode         = ra144_encode_frame,
+    .close          = ra144_encode_close,
+    .long_name      = NULL_IF_CONFIG_SMALL("RealAudio 1.0 (14.4K) encoder"),
 };
index f2b97cc..c2fba5a 100644 (file)
@@ -203,15 +203,12 @@ static int ra288_decode_frame(AVCodecContext * avctx, void *data,
     return avctx->block_align;
 }
 
-AVCodec ff_ra_288_decoder =
-{
-    "real_288",
-    AVMEDIA_TYPE_AUDIO,
-    CODEC_ID_RA_288,
-    sizeof(RA288Context),
-    ra288_decode_init,
-    NULL,
-    NULL,
-    ra288_decode_frame,
-    .long_name = NULL_IF_CONFIG_SMALL("RealAudio 2.0 (28.8K)"),
+AVCodec ff_ra_288_decoder = {
+    .name           = "real_288",
+    .type           = AVMEDIA_TYPE_AUDIO,
+    .id             = CODEC_ID_RA_288,
+    .priv_data_size = sizeof(RA288Context),
+    .init           = ra288_decode_init,
+    .decode         = ra288_decode_frame,
+    .long_name      = NULL_IF_CONFIG_SMALL("RealAudio 2.0 (28.8K)"),
 };
index 9030aff..88d6224 100644 (file)
@@ -1065,16 +1065,15 @@ static int roq_encode_end(AVCodecContext *avctx)
     return 0;
 }
 
-AVCodec ff_roq_encoder =
-{
-    "roqvideo",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_ROQ,
-    sizeof(RoqContext),
-    roq_encode_init,
-    roq_encode_frame,
-    roq_encode_end,
+AVCodec ff_roq_encoder = {
+    .name                 = "roqvideo",
+    .type                 = AVMEDIA_TYPE_VIDEO,
+    .id                   = CODEC_ID_ROQ,
+    .priv_data_size       = sizeof(RoqContext),
+    .init                 = roq_encode_init,
+    .encode               = roq_encode_frame,
+    .close                = roq_encode_end,
     .supported_framerates = (const AVRational[]){{30,1}, {0,0}},
-    .pix_fmts = (const enum PixelFormat[]){PIX_FMT_YUV444P, PIX_FMT_NONE},
-    .long_name = NULL_IF_CONFIG_SMALL("id RoQ video"),
+    .pix_fmts             = (const enum PixelFormat[]){PIX_FMT_YUV444P, PIX_FMT_NONE},
+    .long_name            = NULL_IF_CONFIG_SMALL("id RoQ video"),
 };
index e7aceeb..17c268d 100644 (file)
@@ -1120,15 +1120,13 @@ static av_cold int twin_decode_close(AVCodecContext *avctx)
     return 0;
 }
 
-AVCodec ff_twinvq_decoder =
-{
-    "twinvq",
-    AVMEDIA_TYPE_AUDIO,
-    CODEC_ID_TWINVQ,
-    sizeof(TwinContext),
-    twin_decode_init,
-    NULL,
-    twin_decode_close,
-    twin_decode_frame,
-    .long_name = NULL_IF_CONFIG_SMALL("VQF TwinVQ"),
+AVCodec ff_twinvq_decoder = {
+    .name           = "twinvq",
+    .type           = AVMEDIA_TYPE_AUDIO,
+    .id             = CODEC_ID_TWINVQ,
+    .priv_data_size = sizeof(TwinContext),
+    .init           = twin_decode_init,
+    .close          = twin_decode_close,
+    .decode         = twin_decode_frame,
+    .long_name      = NULL_IF_CONFIG_SMALL("VQF TwinVQ"),
 };
index a7bf93d..95fb65a 100644 (file)
@@ -1200,6 +1200,8 @@ int av_get_bits_per_sample(enum CodecID codec_id){
     case CODEC_ID_ADPCM_SBPRO_4:
     case CODEC_ID_ADPCM_CT:
     case CODEC_ID_ADPCM_IMA_WAV:
+    case CODEC_ID_ADPCM_IMA_QT:
+    case CODEC_ID_ADPCM_SWF:
     case CODEC_ID_ADPCM_MS:
     case CODEC_ID_ADPCM_YAMAHA:
         return 4;
index 9eaf230..b4a4c80 100644 (file)
@@ -928,30 +928,26 @@ static av_cold void flush(AVCodecContext *avctx)
     s->last_superframe_len= 0;
 }
 
-AVCodec ff_wmav1_decoder =
-{
-    "wmav1",
-    AVMEDIA_TYPE_AUDIO,
-    CODEC_ID_WMAV1,
-    sizeof(WMACodecContext),
-    wma_decode_init,
-    NULL,
-    ff_wma_end,
-    wma_decode_superframe,
-    .flush=flush,
-    .long_name = NULL_IF_CONFIG_SMALL("Windows Media Audio 1"),
+AVCodec ff_wmav1_decoder = {
+    .name           = "wmav1",
+    .type           = AVMEDIA_TYPE_AUDIO,
+    .id             = CODEC_ID_WMAV1,
+    .priv_data_size = sizeof(WMACodecContext),
+    .init           = wma_decode_init,
+    .close          = ff_wma_end,
+    .decode         = wma_decode_superframe,
+    .flush          = flush,
+    .long_name      = NULL_IF_CONFIG_SMALL("Windows Media Audio 1"),
 };
 
-AVCodec ff_wmav2_decoder =
-{
-    "wmav2",
-    AVMEDIA_TYPE_AUDIO,
-    CODEC_ID_WMAV2,
-    sizeof(WMACodecContext),
-    wma_decode_init,
-    NULL,
-    ff_wma_end,
-    wma_decode_superframe,
-    .flush=flush,
-    .long_name = NULL_IF_CONFIG_SMALL("Windows Media Audio 2"),
+AVCodec ff_wmav2_decoder = {
+    .name           = "wmav2",
+    .type           = AVMEDIA_TYPE_AUDIO,
+    .id             = CODEC_ID_WMAV2,
+    .priv_data_size = sizeof(WMACodecContext),
+    .init           = wma_decode_init,
+    .close          = ff_wma_end,
+    .decode         = wma_decode_superframe,
+    .flush          = flush,
+    .long_name      = NULL_IF_CONFIG_SMALL("Windows Media Audio 2"),
 };
index 0bafe1a..ae41054 100644 (file)
@@ -390,28 +390,26 @@ static int encode_superframe(AVCodecContext *avctx,
     return put_bits_ptr(&s->pb) - s->pb.buf;
 }
 
-AVCodec ff_wmav1_encoder =
-{
-    "wmav1",
-    AVMEDIA_TYPE_AUDIO,
-    CODEC_ID_WMAV1,
-    sizeof(WMACodecContext),
-    encode_init,
-    encode_superframe,
-    ff_wma_end,
-    .sample_fmts = (const enum AVSampleFormat[]){AV_SAMPLE_FMT_S16,AV_SAMPLE_FMT_NONE},
-    .long_name = NULL_IF_CONFIG_SMALL("Windows Media Audio 1"),
+AVCodec ff_wmav1_encoder = {
+    .name           = "wmav1",
+    .type           = AVMEDIA_TYPE_AUDIO,
+    .id             = CODEC_ID_WMAV1,
+    .priv_data_size = sizeof(WMACodecContext),
+    .init           = encode_init,
+    .encode         = encode_superframe,
+    .close          = ff_wma_end,
+    .sample_fmts    = (const enum AVSampleFormat[]){AV_SAMPLE_FMT_S16,AV_SAMPLE_FMT_NONE},
+    .long_name      = NULL_IF_CONFIG_SMALL("Windows Media Audio 1"),
 };
 
-AVCodec ff_wmav2_encoder =
-{
-    "wmav2",
-    AVMEDIA_TYPE_AUDIO,
-    CODEC_ID_WMAV2,
-    sizeof(WMACodecContext),
-    encode_init,
-    encode_superframe,
-    ff_wma_end,
-    .sample_fmts = (const enum AVSampleFormat[]){AV_SAMPLE_FMT_S16,AV_SAMPLE_FMT_NONE},
-    .long_name = NULL_IF_CONFIG_SMALL("Windows Media Audio 2"),
+AVCodec ff_wmav2_encoder = {
+    .name           = "wmav2",
+    .type           = AVMEDIA_TYPE_AUDIO,
+    .id             = CODEC_ID_WMAV2,
+    .priv_data_size = sizeof(WMACodecContext),
+    .init           = encode_init,
+    .encode         = encode_superframe,
+    .close          = ff_wma_end,
+    .sample_fmts    = (const enum AVSampleFormat[]){AV_SAMPLE_FMT_S16,AV_SAMPLE_FMT_NONE},
+    .long_name      = NULL_IF_CONFIG_SMALL("Windows Media Audio 2"),
 };
index 2abb8cf..7a6cac1 100644 (file)
@@ -23,7 +23,7 @@
 #include "libavcodec/dsputil.h"
 #include "fft.h"
 
-DECLARE_ALIGNED(8, static const int, m1m1)[2] = { 1<<31, 1<<31 };
+DECLARE_ALIGNED(8, static const unsigned int, m1m1)[2] = { 1U<<31, 1U<<31 };
 
 #ifdef EMULATE_3DNOWEXT
 #define PSWAPD(s,d)\
@@ -70,7 +70,7 @@ void ff_imdct_half_3dn2(FFTContext *s, FFTSample *output, const FFTSample *input
     in1 = input;
     in2 = input + n2 - 1;
 #ifdef EMULATE_3DNOWEXT
-    __asm__ volatile("movd %0, %%mm7" ::"r"(1<<31));
+    __asm__ volatile("movd %0, %%mm7" ::"r"(1U<<31));
 #endif
     for(k = 0; k < n4; k++) {
         // FIXME a single block is faster, but gcc 2.95 and 3.4.x on 32bit can't compile it
index 26b933c..43f19ff 100644 (file)
@@ -24,8 +24,8 @@
 #include "fft.h"
 #include "config.h"
 
-DECLARE_ASM_CONST(16, int, ff_m1m1m1m1)[4] =
-    { 1 << 31, 1 << 31, 1 << 31, 1 << 31 };
+DECLARE_ASM_CONST(16, unsigned int, ff_m1m1m1m1)[4] =
+    { 1U << 31, 1U << 31, 1U << 31, 1U << 31 };
 
 void ff_fft_dispatch_sse(FFTComplex *z, int nbits);
 void ff_fft_dispatch_interleave_sse(FFTComplex *z, int nbits);
index 11c6e92..ac3840a 100644 (file)
@@ -145,13 +145,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,
 };
index 0da22bb..446d7a2 100644 (file)
@@ -114,16 +114,14 @@ audio_get_output_timestamp(AVFormatContext *s1, int stream,
 }
 
 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,
+    .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,
     .get_output_timestamp = audio_get_output_timestamp,
-    .flags = AVFMT_NOFILE,
+    .flags          = AVFMT_NOFILE,
 };
index 2792fcf..3de3c8b 100644 (file)
@@ -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,
 };
index bdf5eb8..9a6b486 100644 (file)
@@ -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,
 };
index 73cb575..ab666e8 100644 (file)
@@ -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
index 3950474..f110f44 100644 (file)
@@ -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 */
index 9682d21..fef02b3 100644 (file)
@@ -705,13 +705,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,
 };
index e5ecf84..53e11f3 100644 (file)
@@ -471,13 +471,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,
 };
index 7debe9d..75d3075 100644 (file)
@@ -599,15 +599,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,
 };
index 66a20c3..34262e0 100644 (file)
@@ -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
index 3e8f179..b830526 100644 (file)
@@ -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,
 };
index c58e072..ad23581 100644 (file)
@@ -423,7 +423,7 @@ static int mpegps_read_packet(AVFormatContext *s,
 {
     MpegDemuxContext *m = s->priv_data;
     AVStream *st;
-    int len, startcode, i, es_type;
+    int len, startcode, i, es_type, ret;
     int request_probe= 0;
     enum CodecID codec_id = CODEC_ID_NONE;
     enum AVMediaType type;
@@ -569,7 +569,13 @@ static int mpegps_read_packet(AVFormatContext *s,
             return AVERROR(EINVAL);
     }
     av_new_packet(pkt, len);
-    avio_read(s->pb, pkt->data, pkt->size);
+    ret = avio_read(s->pb, pkt->data, pkt->size);
+    if (ret < 0) {
+        pkt->size = 0;
+    } else if (ret < pkt->size) {
+        pkt->size = ret;
+        memset(pkt->data + ret, 0, FF_INPUT_BUFFER_PADDING_SIZE);
+    }
     pkt->pts = pts;
     pkt->dts = dts;
     pkt->pos = dummy_pos;
@@ -578,7 +584,7 @@ static int mpegps_read_packet(AVFormatContext *s,
             pkt->stream_index, pkt->pts / 90000.0, pkt->dts / 90000.0,
             pkt->size);
 
-    return 0;
+    return (ret < 0) ? ret : 0;
 }
 
 static int64_t mpegps_read_dts(AVFormatContext *s, int stream_index,
index 676e3a1..3e6132b 100644 (file)
@@ -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",
index 385425c..12e64b0 100644 (file)
 #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",
index 05eb0ce..6928216 100644 (file)
@@ -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,
 };