1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-01-24 13:56:33 +02:00

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>
This commit is contained in:
Michael Niedermayer 2011-09-24 22:37:24 +02:00
commit eae3cf06a5
35 changed files with 417 additions and 472 deletions

6
configure vendored
View File

@ -2494,6 +2494,12 @@ case $target_os in
enabled x86 && SHFLAGS="-mimpure-text $SHFLAGS" enabled x86 && SHFLAGS="-mimpure-text $SHFLAGS"
network_extralibs="-lsocket -lnsl" network_extralibs="-lsocket -lnsl"
add_cppflags -D__EXTENSIONS__ 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' nm_opts='-P -g'
;; ;;
netbsd) netbsd)

View File

@ -666,11 +666,17 @@ static int adpcm_decode_frame(AVCodecContext *avctx,
} }
break; break;
case CODEC_ID_ADPCM_EA: case CODEC_ID_ADPCM_EA:
if (buf_size < 12 || AV_RL32(src) > (buf_size - 12)/30*28) { /* Each EA ADPCM frame has a 12-byte header followed by 30-byte pieces,
src += buf_size; each coding 28 stereo samples. */
break; if (buf_size < 12) {
av_log(avctx, AV_LOG_ERROR, "frame too small\n");
return AVERROR(EINVAL);
} }
samples_in_chunk = AV_RL32(src); 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; src += 4;
current_left_sample = (int16_t)bytestream_get_le16(&src); current_left_sample = (int16_t)bytestream_get_le16(&src);
previous_left_sample = (int16_t)bytestream_get_le16(&src); previous_left_sample = (int16_t)bytestream_get_le16(&src);
@ -1080,16 +1086,14 @@ static int adpcm_decode_frame(AVCodecContext *avctx,
} }
#define ADPCM_DECODER(id,name,long_name_) \ #define ADPCM_DECODER(id_, name_, long_name_) \
AVCodec ff_ ## name ## _decoder = { \ AVCodec ff_ ## name_ ## _decoder = { \
#name, \ .name = #name_, \
AVMEDIA_TYPE_AUDIO, \ .type = AVMEDIA_TYPE_AUDIO, \
id, \ .id = id_, \
sizeof(ADPCMDecodeContext), \ .priv_data_size = sizeof(ADPCMDecodeContext), \
adpcm_decode_init, \ .init = adpcm_decode_init, \
NULL, \ .decode = adpcm_decode_frame, \
NULL, \
adpcm_decode_frame, \
.long_name = NULL_IF_CONFIG_SMALL(long_name_), \ .long_name = NULL_IF_CONFIG_SMALL(long_name_), \
} }

View 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); 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) { switch(avctx->codec->id) {
case CODEC_ID_ADPCM_IMA_WAV: 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 */ avctx->frame_size = (BLKSIZE - 4 * avctx->channels) * 8 / (4 * avctx->channels) + 1; /* each 16 bits sample gives one nibble */
@ -670,16 +672,15 @@ static int adpcm_encode_frame(AVCodecContext *avctx,
} }
#define ADPCM_ENCODER(id,name,long_name_) \ #define ADPCM_ENCODER(id_, name_, long_name_) \
AVCodec ff_ ## name ## _encoder = { \ AVCodec ff_ ## name_ ## _encoder = { \
#name, \ .name = #name_, \
AVMEDIA_TYPE_AUDIO, \ .type = AVMEDIA_TYPE_AUDIO, \
id, \ .id = id_, \
sizeof(ADPCMEncodeContext), \ .priv_data_size = sizeof(ADPCMEncodeContext), \
adpcm_encode_init, \ .init = adpcm_encode_init, \
adpcm_encode_frame, \ .encode = adpcm_encode_frame, \
adpcm_encode_close, \ .close = adpcm_encode_close, \
NULL, \
.sample_fmts = (const enum AVSampleFormat[]){AV_SAMPLE_FMT_S16,AV_SAMPLE_FMT_NONE}, \ .sample_fmts = (const enum AVSampleFormat[]){AV_SAMPLE_FMT_S16,AV_SAMPLE_FMT_NONE}, \
.long_name = NULL_IF_CONFIG_SMALL(long_name_), \ .long_name = NULL_IF_CONFIG_SMALL(long_name_), \
} }

View File

@ -298,16 +298,14 @@ static int dpcm_decode_frame(AVCodecContext *avctx,
return buf_size; return buf_size;
} }
#define DPCM_DECODER(id, name, long_name_) \ #define DPCM_DECODER(id_, name_, long_name_) \
AVCodec ff_ ## name ## _decoder = { \ AVCodec ff_ ## name_ ## _decoder = { \
#name, \ .name = #name_, \
AVMEDIA_TYPE_AUDIO, \ .type = AVMEDIA_TYPE_AUDIO, \
id, \ .id = id_, \
sizeof(DPCMContext), \ .priv_data_size = sizeof(DPCMContext), \
dpcm_decode_init, \ .init = dpcm_decode_init, \
NULL, \ .decode = dpcm_decode_frame, \
NULL, \
dpcm_decode_frame, \
.long_name = NULL_IF_CONFIG_SMALL(long_name_), \ .long_name = NULL_IF_CONFIG_SMALL(long_name_), \
} }

View 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 AVCodec ff_jpegls_encoder = { //FIXME avoid MPV_* lossless JPEG should not need them
"jpegls", .name = "jpegls",
AVMEDIA_TYPE_VIDEO, .type = AVMEDIA_TYPE_VIDEO,
CODEC_ID_JPEGLS, .id = CODEC_ID_JPEGLS,
sizeof(JpeglsContext), .priv_data_size = sizeof(JpeglsContext),
encode_init_ls, .init = encode_init_ls,
encode_picture_ls, .encode = encode_picture_ls,
NULL,
.pix_fmts = (const enum PixelFormat[]){PIX_FMT_BGR24, PIX_FMT_RGB24, PIX_FMT_GRAY8, PIX_FMT_GRAY16, PIX_FMT_NONE}, .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"), .long_name = NULL_IF_CONFIG_SMALL("JPEG-LS"),
}; };

View File

@ -186,15 +186,14 @@ static av_cold int libopenjpeg_decode_close(AVCodecContext *avctx)
AVCodec ff_libopenjpeg_decoder = { AVCodec ff_libopenjpeg_decoder = {
"libopenjpeg", .name = "libopenjpeg",
AVMEDIA_TYPE_VIDEO, .type = AVMEDIA_TYPE_VIDEO,
CODEC_ID_JPEG2000, .id = CODEC_ID_JPEG2000,
sizeof(LibOpenJPEGContext), .priv_data_size = sizeof(LibOpenJPEGContext),
libopenjpeg_decode_init, .init = libopenjpeg_decode_init,
NULL, .close = libopenjpeg_decode_close,
libopenjpeg_decode_close, .decode = libopenjpeg_decode_frame,
libopenjpeg_decode_frame, .capabilities = CODEC_CAP_DR1,
CODEC_CAP_DR1,
.max_lowres = 5, .max_lowres = 5,
.long_name = NULL_IF_CONFIG_SMALL("OpenJPEG based JPEG 2000 decoder"), .long_name = NULL_IF_CONFIG_SMALL("OpenJPEG based JPEG 2000 decoder"),
}; };

View File

@ -274,13 +274,13 @@ static av_cold int oggvorbis_encode_close(AVCodecContext *avccontext) {
AVCodec ff_libvorbis_encoder = { AVCodec ff_libvorbis_encoder = {
"libvorbis", .name = "libvorbis",
AVMEDIA_TYPE_AUDIO, .type = AVMEDIA_TYPE_AUDIO,
CODEC_ID_VORBIS, .id = CODEC_ID_VORBIS,
sizeof(OggVorbisContext), .priv_data_size = sizeof(OggVorbisContext),
oggvorbis_encode_init, .init = oggvorbis_encode_init,
oggvorbis_encode_frame, .encode = oggvorbis_encode_frame,
oggvorbis_encode_close, .close = oggvorbis_encode_close,
.capabilities = CODEC_CAP_DELAY, .capabilities = CODEC_CAP_DELAY,
.sample_fmts = (const enum AVSampleFormat[]){AV_SAMPLE_FMT_S16,AV_SAMPLE_FMT_NONE}, .sample_fmts = (const enum AVSampleFormat[]){AV_SAMPLE_FMT_S16,AV_SAMPLE_FMT_NONE},
.long_name = NULL_IF_CONFIG_SMALL("libvorbis Vorbis"), .long_name = NULL_IF_CONFIG_SMALL("libvorbis Vorbis"),

View 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 AVCodec ff_ljpeg_encoder = { //FIXME avoid MPV_* lossless JPEG should not need them
"ljpeg", .name = "ljpeg",
AVMEDIA_TYPE_VIDEO, .type = AVMEDIA_TYPE_VIDEO,
CODEC_ID_LJPEG, .id = CODEC_ID_LJPEG,
sizeof(MpegEncContext), .priv_data_size = sizeof(MpegEncContext),
MPV_encode_init, .init = MPV_encode_init,
encode_picture_lossless, .encode = encode_picture_lossless,
MPV_encode_end, .close = MPV_encode_end,
.long_name = NULL_IF_CONFIG_SMALL("Lossless JPEG"), .long_name = NULL_IF_CONFIG_SMALL("Lossless JPEG"),
}; };

View File

@ -2050,80 +2050,66 @@ static int decode_frame_mp3on4(AVCodecContext * avctx,
#if !CONFIG_FLOAT #if !CONFIG_FLOAT
#if CONFIG_MP1_DECODER #if CONFIG_MP1_DECODER
AVCodec ff_mp1_decoder = AVCodec ff_mp1_decoder = {
{ .name = "mp1",
"mp1", .type = AVMEDIA_TYPE_AUDIO,
AVMEDIA_TYPE_AUDIO, .id = CODEC_ID_MP1,
CODEC_ID_MP1, .priv_data_size = sizeof(MPADecodeContext),
sizeof(MPADecodeContext), .init = decode_init,
decode_init, .decode = decode_frame,
NULL, .capabilities = CODEC_CAP_PARSE_ONLY,
NULL,
decode_frame,
CODEC_CAP_PARSE_ONLY,
.flush = flush, .flush = flush,
.long_name = NULL_IF_CONFIG_SMALL("MP1 (MPEG audio layer 1)"), .long_name = NULL_IF_CONFIG_SMALL("MP1 (MPEG audio layer 1)"),
}; };
#endif #endif
#if CONFIG_MP2_DECODER #if CONFIG_MP2_DECODER
AVCodec ff_mp2_decoder = AVCodec ff_mp2_decoder = {
{ .name = "mp2",
"mp2", .type = AVMEDIA_TYPE_AUDIO,
AVMEDIA_TYPE_AUDIO, .id = CODEC_ID_MP2,
CODEC_ID_MP2, .priv_data_size = sizeof(MPADecodeContext),
sizeof(MPADecodeContext), .init = decode_init,
decode_init, .decode = decode_frame,
NULL, .capabilities = CODEC_CAP_PARSE_ONLY,
NULL,
decode_frame,
CODEC_CAP_PARSE_ONLY,
.flush = flush, .flush = flush,
.long_name = NULL_IF_CONFIG_SMALL("MP2 (MPEG audio layer 2)"), .long_name = NULL_IF_CONFIG_SMALL("MP2 (MPEG audio layer 2)"),
}; };
#endif #endif
#if CONFIG_MP3_DECODER #if CONFIG_MP3_DECODER
AVCodec ff_mp3_decoder = AVCodec ff_mp3_decoder = {
{ .name = "mp3",
"mp3", .type = AVMEDIA_TYPE_AUDIO,
AVMEDIA_TYPE_AUDIO, .id = CODEC_ID_MP3,
CODEC_ID_MP3, .priv_data_size = sizeof(MPADecodeContext),
sizeof(MPADecodeContext), .init = decode_init,
decode_init, .decode = decode_frame,
NULL, .capabilities = CODEC_CAP_PARSE_ONLY,
NULL,
decode_frame,
CODEC_CAP_PARSE_ONLY,
.flush = flush, .flush = flush,
.long_name = NULL_IF_CONFIG_SMALL("MP3 (MPEG audio layer 3)"), .long_name = NULL_IF_CONFIG_SMALL("MP3 (MPEG audio layer 3)"),
}; };
#endif #endif
#if CONFIG_MP3ADU_DECODER #if CONFIG_MP3ADU_DECODER
AVCodec ff_mp3adu_decoder = AVCodec ff_mp3adu_decoder = {
{ .name = "mp3adu",
"mp3adu", .type = AVMEDIA_TYPE_AUDIO,
AVMEDIA_TYPE_AUDIO, .id = CODEC_ID_MP3ADU,
CODEC_ID_MP3ADU, .priv_data_size = sizeof(MPADecodeContext),
sizeof(MPADecodeContext), .init = decode_init,
decode_init, .decode = decode_frame_adu,
NULL, .capabilities = CODEC_CAP_PARSE_ONLY,
NULL,
decode_frame_adu,
CODEC_CAP_PARSE_ONLY,
.flush = flush, .flush = flush,
.long_name = NULL_IF_CONFIG_SMALL("ADU (Application Data Unit) MP3 (MPEG audio layer 3)"), .long_name = NULL_IF_CONFIG_SMALL("ADU (Application Data Unit) MP3 (MPEG audio layer 3)"),
}; };
#endif #endif
#if CONFIG_MP3ON4_DECODER #if CONFIG_MP3ON4_DECODER
AVCodec ff_mp3on4_decoder = AVCodec ff_mp3on4_decoder = {
{ .name = "mp3on4",
"mp3on4", .type = AVMEDIA_TYPE_AUDIO,
AVMEDIA_TYPE_AUDIO, .id = CODEC_ID_MP3ON4,
CODEC_ID_MP3ON4, .priv_data_size = sizeof(MP3On4DecodeContext),
sizeof(MP3On4DecodeContext), .init = decode_init_mp3on4,
decode_init_mp3on4, .close = decode_close_mp3on4,
NULL, .decode = decode_frame_mp3on4,
decode_close_mp3on4,
decode_frame_mp3on4,
.flush = flush, .flush = flush,
.long_name = NULL_IF_CONFIG_SMALL("MP3onMP4"), .long_name = NULL_IF_CONFIG_SMALL("MP3onMP4"),
}; };

View File

@ -23,80 +23,66 @@
#include "mpegaudiodec.c" #include "mpegaudiodec.c"
#if CONFIG_MP1FLOAT_DECODER #if CONFIG_MP1FLOAT_DECODER
AVCodec ff_mp1float_decoder = AVCodec ff_mp1float_decoder = {
{ .name = "mp1float",
"mp1float", .type = AVMEDIA_TYPE_AUDIO,
AVMEDIA_TYPE_AUDIO, .id = CODEC_ID_MP1,
CODEC_ID_MP1, .priv_data_size = sizeof(MPADecodeContext),
sizeof(MPADecodeContext), .init = decode_init,
decode_init, .decode = decode_frame,
NULL, .capabilities = CODEC_CAP_PARSE_ONLY,
.close = NULL,
decode_frame,
CODEC_CAP_PARSE_ONLY,
.flush = flush, .flush = flush,
.long_name = NULL_IF_CONFIG_SMALL("MP1 (MPEG audio layer 1)"), .long_name = NULL_IF_CONFIG_SMALL("MP1 (MPEG audio layer 1)"),
}; };
#endif #endif
#if CONFIG_MP2FLOAT_DECODER #if CONFIG_MP2FLOAT_DECODER
AVCodec ff_mp2float_decoder = AVCodec ff_mp2float_decoder = {
{ .name = "mp2float",
"mp2float", .type = AVMEDIA_TYPE_AUDIO,
AVMEDIA_TYPE_AUDIO, .id = CODEC_ID_MP2,
CODEC_ID_MP2, .priv_data_size = sizeof(MPADecodeContext),
sizeof(MPADecodeContext), .init = decode_init,
decode_init, .decode = decode_frame,
NULL, .capabilities = CODEC_CAP_PARSE_ONLY,
.close = NULL,
decode_frame,
CODEC_CAP_PARSE_ONLY,
.flush = flush, .flush = flush,
.long_name = NULL_IF_CONFIG_SMALL("MP2 (MPEG audio layer 2)"), .long_name = NULL_IF_CONFIG_SMALL("MP2 (MPEG audio layer 2)"),
}; };
#endif #endif
#if CONFIG_MP3FLOAT_DECODER #if CONFIG_MP3FLOAT_DECODER
AVCodec ff_mp3float_decoder = AVCodec ff_mp3float_decoder = {
{ .name = "mp3float",
"mp3float", .type = AVMEDIA_TYPE_AUDIO,
AVMEDIA_TYPE_AUDIO, .id = CODEC_ID_MP3,
CODEC_ID_MP3, .priv_data_size = sizeof(MPADecodeContext),
sizeof(MPADecodeContext), .init = decode_init,
decode_init, .decode = decode_frame,
NULL, .capabilities = CODEC_CAP_PARSE_ONLY,
.close = NULL,
decode_frame,
CODEC_CAP_PARSE_ONLY,
.flush = flush, .flush = flush,
.long_name = NULL_IF_CONFIG_SMALL("MP3 (MPEG audio layer 3)"), .long_name = NULL_IF_CONFIG_SMALL("MP3 (MPEG audio layer 3)"),
}; };
#endif #endif
#if CONFIG_MP3ADUFLOAT_DECODER #if CONFIG_MP3ADUFLOAT_DECODER
AVCodec ff_mp3adufloat_decoder = AVCodec ff_mp3adufloat_decoder = {
{ .name = "mp3adufloat",
"mp3adufloat", .type = AVMEDIA_TYPE_AUDIO,
AVMEDIA_TYPE_AUDIO, .id = CODEC_ID_MP3ADU,
CODEC_ID_MP3ADU, .priv_data_size = sizeof(MPADecodeContext),
sizeof(MPADecodeContext), .init = decode_init,
decode_init, .decode = decode_frame_adu,
NULL, .capabilities = CODEC_CAP_PARSE_ONLY,
.close = NULL,
decode_frame_adu,
CODEC_CAP_PARSE_ONLY,
.flush = flush, .flush = flush,
.long_name = NULL_IF_CONFIG_SMALL("ADU (Application Data Unit) MP3 (MPEG audio layer 3)"), .long_name = NULL_IF_CONFIG_SMALL("ADU (Application Data Unit) MP3 (MPEG audio layer 3)"),
}; };
#endif #endif
#if CONFIG_MP3ON4FLOAT_DECODER #if CONFIG_MP3ON4FLOAT_DECODER
AVCodec ff_mp3on4float_decoder = AVCodec ff_mp3on4float_decoder = {
{ .name = "mp3on4float",
"mp3on4float", .type = AVMEDIA_TYPE_AUDIO,
AVMEDIA_TYPE_AUDIO, .id = CODEC_ID_MP3ON4,
CODEC_ID_MP3ON4, .priv_data_size = sizeof(MP3On4DecodeContext),
sizeof(MP3On4DecodeContext), .init = decode_init_mp3on4,
decode_init_mp3on4, .close = decode_close_mp3on4,
NULL, .decode = decode_frame_mp3on4,
decode_close_mp3on4,
decode_frame_mp3on4,
.flush = flush, .flush = flush,
.long_name = NULL_IF_CONFIG_SMALL("MP3onMP4"), .long_name = NULL_IF_CONFIG_SMALL("MP3onMP4"),
}; };

View File

@ -114,15 +114,12 @@ static int ra144_decode_frame(AVCodecContext * avctx, void *vdata,
return 20; return 20;
} }
AVCodec ff_ra_144_decoder = AVCodec ff_ra_144_decoder = {
{ .name = "real_144",
"real_144", .type = AVMEDIA_TYPE_AUDIO,
AVMEDIA_TYPE_AUDIO, .id = CODEC_ID_RA_144,
CODEC_ID_RA_144, .priv_data_size = sizeof(RA144Context),
sizeof(RA144Context), .init = ra144_decode_init,
ra144_decode_init, .decode = ra144_decode_frame,
NULL,
NULL,
ra144_decode_frame,
.long_name = NULL_IF_CONFIG_SMALL("RealAudio 1.0 (14.4K)"), .long_name = NULL_IF_CONFIG_SMALL("RealAudio 1.0 (14.4K)"),
}; };

View File

@ -508,14 +508,13 @@ static int ra144_encode_frame(AVCodecContext *avctx, uint8_t *frame,
} }
AVCodec ff_ra_144_encoder = AVCodec ff_ra_144_encoder = {
{ .name = "real_144",
"real_144", .type = AVMEDIA_TYPE_AUDIO,
AVMEDIA_TYPE_AUDIO, .id = CODEC_ID_RA_144,
CODEC_ID_RA_144, .priv_data_size = sizeof(RA144Context),
sizeof(RA144Context), .init = ra144_encode_init,
ra144_encode_init, .encode = ra144_encode_frame,
ra144_encode_frame, .close = ra144_encode_close,
ra144_encode_close,
.long_name = NULL_IF_CONFIG_SMALL("RealAudio 1.0 (14.4K) encoder"), .long_name = NULL_IF_CONFIG_SMALL("RealAudio 1.0 (14.4K) encoder"),
}; };

View File

@ -203,15 +203,12 @@ static int ra288_decode_frame(AVCodecContext * avctx, void *data,
return avctx->block_align; return avctx->block_align;
} }
AVCodec ff_ra_288_decoder = AVCodec ff_ra_288_decoder = {
{ .name = "real_288",
"real_288", .type = AVMEDIA_TYPE_AUDIO,
AVMEDIA_TYPE_AUDIO, .id = CODEC_ID_RA_288,
CODEC_ID_RA_288, .priv_data_size = sizeof(RA288Context),
sizeof(RA288Context), .init = ra288_decode_init,
ra288_decode_init, .decode = ra288_decode_frame,
NULL,
NULL,
ra288_decode_frame,
.long_name = NULL_IF_CONFIG_SMALL("RealAudio 2.0 (28.8K)"), .long_name = NULL_IF_CONFIG_SMALL("RealAudio 2.0 (28.8K)"),
}; };

View File

@ -1065,15 +1065,14 @@ static int roq_encode_end(AVCodecContext *avctx)
return 0; return 0;
} }
AVCodec ff_roq_encoder = AVCodec ff_roq_encoder = {
{ .name = "roqvideo",
"roqvideo", .type = AVMEDIA_TYPE_VIDEO,
AVMEDIA_TYPE_VIDEO, .id = CODEC_ID_ROQ,
CODEC_ID_ROQ, .priv_data_size = sizeof(RoqContext),
sizeof(RoqContext), .init = roq_encode_init,
roq_encode_init, .encode = roq_encode_frame,
roq_encode_frame, .close = roq_encode_end,
roq_encode_end,
.supported_framerates = (const AVRational[]){{30,1}, {0,0}}, .supported_framerates = (const AVRational[]){{30,1}, {0,0}},
.pix_fmts = (const enum PixelFormat[]){PIX_FMT_YUV444P, PIX_FMT_NONE}, .pix_fmts = (const enum PixelFormat[]){PIX_FMT_YUV444P, PIX_FMT_NONE},
.long_name = NULL_IF_CONFIG_SMALL("id RoQ video"), .long_name = NULL_IF_CONFIG_SMALL("id RoQ video"),

View File

@ -1120,15 +1120,13 @@ static av_cold int twin_decode_close(AVCodecContext *avctx)
return 0; return 0;
} }
AVCodec ff_twinvq_decoder = AVCodec ff_twinvq_decoder = {
{ .name = "twinvq",
"twinvq", .type = AVMEDIA_TYPE_AUDIO,
AVMEDIA_TYPE_AUDIO, .id = CODEC_ID_TWINVQ,
CODEC_ID_TWINVQ, .priv_data_size = sizeof(TwinContext),
sizeof(TwinContext), .init = twin_decode_init,
twin_decode_init, .close = twin_decode_close,
NULL, .decode = twin_decode_frame,
twin_decode_close,
twin_decode_frame,
.long_name = NULL_IF_CONFIG_SMALL("VQF TwinVQ"), .long_name = NULL_IF_CONFIG_SMALL("VQF TwinVQ"),
}; };

View 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_SBPRO_4:
case CODEC_ID_ADPCM_CT: case CODEC_ID_ADPCM_CT:
case CODEC_ID_ADPCM_IMA_WAV: 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_MS:
case CODEC_ID_ADPCM_YAMAHA: case CODEC_ID_ADPCM_YAMAHA:
return 4; return 4;

View File

@ -928,30 +928,26 @@ static av_cold void flush(AVCodecContext *avctx)
s->last_superframe_len= 0; s->last_superframe_len= 0;
} }
AVCodec ff_wmav1_decoder = AVCodec ff_wmav1_decoder = {
{ .name = "wmav1",
"wmav1", .type = AVMEDIA_TYPE_AUDIO,
AVMEDIA_TYPE_AUDIO, .id = CODEC_ID_WMAV1,
CODEC_ID_WMAV1, .priv_data_size = sizeof(WMACodecContext),
sizeof(WMACodecContext), .init = wma_decode_init,
wma_decode_init, .close = ff_wma_end,
NULL, .decode = wma_decode_superframe,
ff_wma_end,
wma_decode_superframe,
.flush = flush, .flush = flush,
.long_name = NULL_IF_CONFIG_SMALL("Windows Media Audio 1"), .long_name = NULL_IF_CONFIG_SMALL("Windows Media Audio 1"),
}; };
AVCodec ff_wmav2_decoder = AVCodec ff_wmav2_decoder = {
{ .name = "wmav2",
"wmav2", .type = AVMEDIA_TYPE_AUDIO,
AVMEDIA_TYPE_AUDIO, .id = CODEC_ID_WMAV2,
CODEC_ID_WMAV2, .priv_data_size = sizeof(WMACodecContext),
sizeof(WMACodecContext), .init = wma_decode_init,
wma_decode_init, .close = ff_wma_end,
NULL, .decode = wma_decode_superframe,
ff_wma_end,
wma_decode_superframe,
.flush = flush, .flush = flush,
.long_name = NULL_IF_CONFIG_SMALL("Windows Media Audio 2"), .long_name = NULL_IF_CONFIG_SMALL("Windows Media Audio 2"),
}; };

View File

@ -390,28 +390,26 @@ static int encode_superframe(AVCodecContext *avctx,
return put_bits_ptr(&s->pb) - s->pb.buf; return put_bits_ptr(&s->pb) - s->pb.buf;
} }
AVCodec ff_wmav1_encoder = AVCodec ff_wmav1_encoder = {
{ .name = "wmav1",
"wmav1", .type = AVMEDIA_TYPE_AUDIO,
AVMEDIA_TYPE_AUDIO, .id = CODEC_ID_WMAV1,
CODEC_ID_WMAV1, .priv_data_size = sizeof(WMACodecContext),
sizeof(WMACodecContext), .init = encode_init,
encode_init, .encode = encode_superframe,
encode_superframe, .close = ff_wma_end,
ff_wma_end,
.sample_fmts = (const enum AVSampleFormat[]){AV_SAMPLE_FMT_S16,AV_SAMPLE_FMT_NONE}, .sample_fmts = (const enum AVSampleFormat[]){AV_SAMPLE_FMT_S16,AV_SAMPLE_FMT_NONE},
.long_name = NULL_IF_CONFIG_SMALL("Windows Media Audio 1"), .long_name = NULL_IF_CONFIG_SMALL("Windows Media Audio 1"),
}; };
AVCodec ff_wmav2_encoder = AVCodec ff_wmav2_encoder = {
{ .name = "wmav2",
"wmav2", .type = AVMEDIA_TYPE_AUDIO,
AVMEDIA_TYPE_AUDIO, .id = CODEC_ID_WMAV2,
CODEC_ID_WMAV2, .priv_data_size = sizeof(WMACodecContext),
sizeof(WMACodecContext), .init = encode_init,
encode_init, .encode = encode_superframe,
encode_superframe, .close = ff_wma_end,
ff_wma_end,
.sample_fmts = (const enum AVSampleFormat[]){AV_SAMPLE_FMT_S16,AV_SAMPLE_FMT_NONE}, .sample_fmts = (const enum AVSampleFormat[]){AV_SAMPLE_FMT_S16,AV_SAMPLE_FMT_NONE},
.long_name = NULL_IF_CONFIG_SMALL("Windows Media Audio 2"), .long_name = NULL_IF_CONFIG_SMALL("Windows Media Audio 2"),
}; };

View File

@ -23,7 +23,7 @@
#include "libavcodec/dsputil.h" #include "libavcodec/dsputil.h"
#include "fft.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 #ifdef EMULATE_3DNOWEXT
#define PSWAPD(s,d)\ #define PSWAPD(s,d)\
@ -70,7 +70,7 @@ void ff_imdct_half_3dn2(FFTContext *s, FFTSample *output, const FFTSample *input
in1 = input; in1 = input;
in2 = input + n2 - 1; in2 = input + n2 - 1;
#ifdef EMULATE_3DNOWEXT #ifdef EMULATE_3DNOWEXT
__asm__ volatile("movd %0, %%mm7" ::"r"(1<<31)); __asm__ volatile("movd %0, %%mm7" ::"r"(1U<<31));
#endif #endif
for(k = 0; k < n4; k++) { 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 // FIXME a single block is faster, but gcc 2.95 and 3.4.x on 32bit can't compile it

View File

@ -24,8 +24,8 @@
#include "fft.h" #include "fft.h"
#include "config.h" #include "config.h"
DECLARE_ASM_CONST(16, int, ff_m1m1m1m1)[4] = DECLARE_ASM_CONST(16, unsigned int, ff_m1m1m1m1)[4] =
{ 1 << 31, 1 << 31, 1 << 31, 1 << 31 }; { 1U << 31, 1U << 31, 1U << 31, 1U << 31 };
void ff_fft_dispatch_sse(FFTComplex *z, int nbits); void ff_fft_dispatch_sse(FFTComplex *z, int nbits);
void ff_fft_dispatch_interleave_sse(FFTComplex *z, int nbits); void ff_fft_dispatch_interleave_sse(FFTComplex *z, int nbits);

View File

@ -145,13 +145,12 @@ static const AVClass alsa_demuxer_class = {
}; };
AVInputFormat ff_alsa_demuxer = { AVInputFormat ff_alsa_demuxer = {
"alsa", .name = "alsa",
NULL_IF_CONFIG_SMALL("ALSA audio input"), .long_name = NULL_IF_CONFIG_SMALL("ALSA audio input"),
sizeof(AlsaData), .priv_data_size = sizeof(AlsaData),
NULL, .read_header = audio_read_header,
audio_read_header, .read_packet = audio_read_packet,
audio_read_packet, .read_close = ff_alsa_close,
ff_alsa_close,
.flags = AVFMT_NOFILE, .flags = AVFMT_NOFILE,
.priv_class = &alsa_demuxer_class, .priv_class = &alsa_demuxer_class,
}; };

View File

@ -114,16 +114,14 @@ audio_get_output_timestamp(AVFormatContext *s1, int stream,
} }
AVOutputFormat ff_alsa_muxer = { AVOutputFormat ff_alsa_muxer = {
"alsa", .name = "alsa",
NULL_IF_CONFIG_SMALL("ALSA audio output"), .long_name = NULL_IF_CONFIG_SMALL("ALSA audio output"),
"", .priv_data_size = sizeof(AlsaData),
"", .audio_codec = DEFAULT_CODEC_ID,
sizeof(AlsaData), .video_codec = CODEC_ID_NONE,
DEFAULT_CODEC_ID, .write_header = audio_write_header,
CODEC_ID_NONE, .write_packet = audio_write_packet,
audio_write_header, .write_trailer = ff_alsa_close,
audio_write_packet,
ff_alsa_close,
.get_output_timestamp = audio_get_output_timestamp, .get_output_timestamp = audio_get_output_timestamp,
.flags = AVFMT_NOFILE, .flags = AVFMT_NOFILE,
}; };

View File

@ -345,13 +345,12 @@ static const AVClass bktr_class = {
}; };
AVInputFormat ff_bktr_demuxer = { AVInputFormat ff_bktr_demuxer = {
"bktr", .name = "bktr",
NULL_IF_CONFIG_SMALL("video grab"), .long_name = NULL_IF_CONFIG_SMALL("video grab"),
sizeof(VideoData), .priv_data_size = sizeof(VideoData),
NULL, .read_header = grab_read_header,
grab_read_header, .read_packet = grab_read_packet,
grab_read_packet, .read_close = grab_read_close,
grab_read_close,
.flags = AVFMT_NOFILE, .flags = AVFMT_NOFILE,
.priv_class = &bktr_class, .priv_class = &bktr_class,
}; };

View File

@ -326,13 +326,12 @@ static const AVClass jack_indev_class = {
}; };
AVInputFormat ff_jack_demuxer = { AVInputFormat ff_jack_demuxer = {
"jack", .name = "jack",
NULL_IF_CONFIG_SMALL("JACK Audio Connection Kit"), .long_name = NULL_IF_CONFIG_SMALL("JACK Audio Connection Kit"),
sizeof(JackData), .priv_data_size = sizeof(JackData),
NULL, .read_header = audio_read_header,
audio_read_header, .read_packet = audio_read_packet,
audio_read_packet, .read_close = audio_read_close,
audio_read_close,
.flags = AVFMT_NOFILE, .flags = AVFMT_NOFILE,
.priv_class = &jack_indev_class, .priv_class = &jack_indev_class,
}; };

View File

@ -295,13 +295,12 @@ static const AVClass oss_demuxer_class = {
}; };
AVInputFormat ff_oss_demuxer = { AVInputFormat ff_oss_demuxer = {
"oss", .name = "oss",
NULL_IF_CONFIG_SMALL("Open Sound System capture"), .long_name = NULL_IF_CONFIG_SMALL("Open Sound System capture"),
sizeof(AudioData), .priv_data_size = sizeof(AudioData),
NULL, .read_header = audio_read_header,
audio_read_header, .read_packet = audio_read_packet,
audio_read_packet, .read_close = audio_read_close,
audio_read_close,
.flags = AVFMT_NOFILE, .flags = AVFMT_NOFILE,
.priv_class = &oss_demuxer_class, .priv_class = &oss_demuxer_class,
}; };
@ -309,19 +308,17 @@ AVInputFormat ff_oss_demuxer = {
#if CONFIG_OSS_OUTDEV #if CONFIG_OSS_OUTDEV
AVOutputFormat ff_oss_muxer = { AVOutputFormat ff_oss_muxer = {
"oss", .name = "oss",
NULL_IF_CONFIG_SMALL("Open Sound System playback"), .long_name = NULL_IF_CONFIG_SMALL("Open Sound System playback"),
"", .priv_data_size = sizeof(AudioData),
"",
sizeof(AudioData),
/* XXX: we make the assumption that the soundcard accepts this format */ /* XXX: we make the assumption that the soundcard accepts this format */
/* XXX: find better solution with "preinit" method, needed also in /* XXX: find better solution with "preinit" method, needed also in
other formats */ other formats */
AV_NE(CODEC_ID_PCM_S16BE, CODEC_ID_PCM_S16LE), .audio_codec = AV_NE(CODEC_ID_PCM_S16BE, CODEC_ID_PCM_S16LE),
CODEC_ID_NONE, .video_codec = CODEC_ID_NONE,
audio_write_header, .write_header = audio_write_header,
audio_write_packet, .write_packet = audio_write_packet,
audio_write_trailer, .write_trailer = audio_write_trailer,
.flags = AVFMT_NOFILE, .flags = AVFMT_NOFILE,
}; };
#endif #endif

View File

@ -354,13 +354,12 @@ static const AVClass v4l_class = {
}; };
AVInputFormat ff_v4l_demuxer = { AVInputFormat ff_v4l_demuxer = {
"video4linux", .name = "video4linux",
NULL_IF_CONFIG_SMALL("Video4Linux device grab"), .long_name = NULL_IF_CONFIG_SMALL("Video4Linux device grab"),
sizeof(VideoData), .priv_data_size = sizeof(VideoData),
NULL, .read_header = grab_read_header,
grab_read_header, .read_packet = grab_read_packet,
grab_read_packet, .read_close = grab_read_close,
grab_read_close,
.flags = AVFMT_NOFILE, .flags = AVFMT_NOFILE,
.priv_class = &v4l_class, .priv_class = &v4l_class,
}; };

View File

@ -705,13 +705,12 @@ static const AVClass v4l2_class = {
}; };
AVInputFormat ff_v4l2_demuxer = { AVInputFormat ff_v4l2_demuxer = {
"video4linux2", .name = "video4linux2",
NULL_IF_CONFIG_SMALL("Video4Linux2 device grab"), .long_name = NULL_IF_CONFIG_SMALL("Video4Linux2 device grab"),
sizeof(struct video_data), .priv_data_size = sizeof(struct video_data),
NULL, .read_header = v4l2_read_header,
v4l2_read_header, .read_packet = v4l2_read_packet,
v4l2_read_packet, .read_close = v4l2_read_close,
v4l2_read_close,
.flags = AVFMT_NOFILE, .flags = AVFMT_NOFILE,
.priv_class = &v4l2_class, .priv_class = &v4l2_class,
}; };

View File

@ -471,13 +471,12 @@ static const AVClass vfw_class = {
}; };
AVInputFormat ff_vfwcap_demuxer = { AVInputFormat ff_vfwcap_demuxer = {
"vfwcap", .name = "vfwcap",
NULL_IF_CONFIG_SMALL("VFW video capture"), .long_name = NULL_IF_CONFIG_SMALL("VfW video capture"),
sizeof(struct vfw_ctx), .priv_data_size = sizeof(struct vfw_ctx),
NULL, .read_header = vfw_read_header,
vfw_read_header, .read_packet = vfw_read_packet,
vfw_read_packet, .read_close = vfw_read_close,
vfw_read_close,
.flags = AVFMT_NOFILE, .flags = AVFMT_NOFILE,
.priv_class = &vfw_class, .priv_class = &vfw_class,
}; };

View File

@ -599,15 +599,13 @@ static const AVClass x11_class = {
}; };
/** x11 grabber device demuxer declaration */ /** x11 grabber device demuxer declaration */
AVInputFormat ff_x11_grab_device_demuxer = AVInputFormat ff_x11_grab_device_demuxer = {
{ .name = "x11grab",
"x11grab", .long_name = NULL_IF_CONFIG_SMALL("X11grab"),
NULL_IF_CONFIG_SMALL("X11grab"), .priv_data_size = sizeof(struct x11_grab),
sizeof(struct x11_grab), .read_header = x11grab_read_header,
NULL, .read_packet = x11grab_read_packet,
x11grab_read_header, .read_close = x11grab_read_close,
x11grab_read_packet,
x11grab_read_close,
.flags = AVFMT_NOFILE, .flags = AVFMT_NOFILE,
.priv_class = &x11_class, .priv_class = &x11_class,
}; };

View File

@ -80,17 +80,14 @@ AVInputFormat ff_daud_demuxer = {
#endif #endif
#if CONFIG_DAUD_MUXER #if CONFIG_DAUD_MUXER
AVOutputFormat ff_daud_muxer = AVOutputFormat ff_daud_muxer = {
{ .name = "daud",
"daud", .long_name = NULL_IF_CONFIG_SMALL("D-Cinema audio format"),
NULL_IF_CONFIG_SMALL("D-Cinema audio format"), .extensions = "302",
NULL, .audio_codec = CODEC_ID_PCM_S24DAUD,
"302", .video_codec = CODEC_ID_NONE,
0, .write_header = daud_write_header,
CODEC_ID_PCM_S24DAUD, .write_packet = daud_write_packet,
CODEC_ID_NONE,
daud_write_header,
daud_write_packet,
.flags = AVFMT_NOTIMESTAMPS, .flags = AVFMT_NOTIMESTAMPS,
}; };
#endif #endif

View File

@ -35,15 +35,12 @@ static int roq_write_header(struct AVFormatContext *s)
return 0; return 0;
} }
AVOutputFormat ff_roq_muxer = AVOutputFormat ff_roq_muxer = {
{ .name = "RoQ",
"RoQ", .long_name = NULL_IF_CONFIG_SMALL("raw id RoQ format"),
NULL_IF_CONFIG_SMALL("raw id RoQ format"), .extensions = "roq",
NULL, .audio_codec = CODEC_ID_ROQ_DPCM,
"roq", .video_codec = CODEC_ID_ROQ,
0, .write_header = roq_write_header,
CODEC_ID_ROQ_DPCM, .write_packet = ff_raw_write_packet,
CODEC_ID_ROQ,
roq_write_header,
ff_raw_write_packet,
}; };

View File

@ -423,7 +423,7 @@ static int mpegps_read_packet(AVFormatContext *s,
{ {
MpegDemuxContext *m = s->priv_data; MpegDemuxContext *m = s->priv_data;
AVStream *st; AVStream *st;
int len, startcode, i, es_type; int len, startcode, i, es_type, ret;
int request_probe= 0; int request_probe= 0;
enum CodecID codec_id = CODEC_ID_NONE; enum CodecID codec_id = CODEC_ID_NONE;
enum AVMediaType type; enum AVMediaType type;
@ -569,7 +569,13 @@ static int mpegps_read_packet(AVFormatContext *s,
return AVERROR(EINVAL); return AVERROR(EINVAL);
} }
av_new_packet(pkt, len); 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->pts = pts;
pkt->dts = dts; pkt->dts = dts;
pkt->pos = dummy_pos; 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->stream_index, pkt->pts / 90000.0, pkt->dts / 90000.0,
pkt->size); pkt->size);
return 0; return (ret < 0) ? ret : 0;
} }
static int64_t mpegps_read_dts(AVFormatContext *s, int stream_index, static int64_t mpegps_read_dts(AVFormatContext *s, int stream_index,

View File

@ -54,26 +54,24 @@ static const AVOption pcm_options[] = {
{ NULL }, { NULL },
}; };
#define PCMDEF(name, long_name, ext, codec) \ #define PCMDEF(name_, long_name_, ext, codec) \
static const AVClass name ## _demuxer_class = {\ static const AVClass name_ ## _demuxer_class = { \
.class_name = #name " demuxer",\ .class_name = #name_ " demuxer", \
.item_name = av_default_item_name, \ .item_name = av_default_item_name, \
.option = pcm_options, \ .option = pcm_options, \
.version = LIBAVUTIL_VERSION_INT, \ .version = LIBAVUTIL_VERSION_INT, \
}; \ }; \
AVInputFormat ff_pcm_ ## name ## _demuxer = {\ AVInputFormat ff_pcm_ ## name_ ## _demuxer = { \
#name,\ .name = #name_, \
NULL_IF_CONFIG_SMALL(long_name),\ .long_name = NULL_IF_CONFIG_SMALL(long_name_), \
sizeof(RawAudioDemuxerContext),\ .priv_data_size = sizeof(RawAudioDemuxerContext), \
NULL,\ .read_header = ff_raw_read_header, \
ff_raw_read_header,\ .read_packet = raw_read_packet, \
raw_read_packet,\ .read_seek = pcm_read_seek, \
NULL,\
pcm_read_seek,\
.flags = AVFMT_GENERIC_INDEX, \ .flags = AVFMT_GENERIC_INDEX, \
.extensions = ext, \ .extensions = ext, \
.value = codec, \ .value = codec, \
.priv_class = &name ## _demuxer_class,\ .priv_class = &name_ ## _demuxer_class, \
}; };
PCMDEF(f64be, "PCM 64 bit floating-point big-endian format", PCMDEF(f64be, "PCM 64 bit floating-point big-endian format",

View File

@ -22,17 +22,14 @@
#include "avformat.h" #include "avformat.h"
#include "rawenc.h" #include "rawenc.h"
#define PCMDEF(name, long_name, ext, codec) \ #define PCMDEF(name_, long_name_, ext, codec) \
AVOutputFormat ff_pcm_ ## name ## _muxer = {\ AVOutputFormat ff_pcm_ ## name_ ## _muxer = { \
#name,\ .name = #name_, \
NULL_IF_CONFIG_SMALL(long_name),\ .long_name = NULL_IF_CONFIG_SMALL(long_name_), \
NULL,\ .extensions = ext, \
ext,\ .audio_codec = codec, \
0,\ .video_codec = CODEC_ID_NONE, \
codec,\ .write_packet = ff_raw_write_packet, \
CODEC_ID_NONE,\
NULL,\
ff_raw_write_packet,\
.flags = AVFMT_NOTIMESTAMPS, \ .flags = AVFMT_NOTIMESTAMPS, \
}; };

View File

@ -90,12 +90,10 @@ next_chunk:
return 0; return 0;
} }
AVInputFormat ff_txd_demuxer = AVInputFormat ff_txd_demuxer = {
{ .name = "txd",
"txd", .long_name = NULL_IF_CONFIG_SMALL("Renderware TeXture Dictionary"),
NULL_IF_CONFIG_SMALL("Renderware TeXture Dictionary"), .read_probe = txd_probe,
0, .read_header = txd_read_header,
txd_probe, .read_packet = txd_read_packet,
txd_read_header,
txd_read_packet,
}; };