diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2011-09-17 22:25:13 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2011-09-17 22:36:43 +0200 |
commit | 9a9ceb8776264c799ff9669ed7e287a5daaab564 (patch) | |
tree | 25748ff74acaa620aa627ed7797a87e986959f19 /libavformat | |
parent | 979bea13003ef489d95d2538ac2fb1c26c6f103b (diff) | |
parent | d763fb7d47fdbd107ea65cdf511f2f21558f6610 (diff) | |
download | ffmpeg-9a9ceb8776264c799ff9669ed7e287a5daaab564.tar.gz |
Merge remote-tracking branch 'qatar/master'
* qatar/master:
lavfi: add select filter
oggdec: fix out of bound write in the ogg demuxer
movenc: create an alternate group for each media type
lavd: add libcdio-paranoia input device for audio CD grabbing
rawdec: refactor private option for raw video demuxers
pcmdec: use unique classes for all pcm demuxers.
rawdec: g722 is always 1 channel/16kHz
Conflicts:
Changelog
configure
doc/filters.texi
libavdevice/avdevice.h
libavfilter/avfilter.h
libavfilter/vf_select.c
tests/ref/lavf/mov
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat')
-rw-r--r-- | libavformat/ingenientdec.c | 4 | ||||
-rw-r--r-- | libavformat/movenc.c | 3 | ||||
-rw-r--r-- | libavformat/pcmdec.c | 16 | ||||
-rw-r--r-- | libavformat/rawdec.c | 37 | ||||
-rw-r--r-- | libavformat/rawdec.h | 15 | ||||
-rw-r--r-- | libavformat/rawvideodec.c | 18 |
6 files changed, 56 insertions, 37 deletions
diff --git a/libavformat/ingenientdec.c b/libavformat/ingenientdec.c index 791e935433..97774abbcd 100644 --- a/libavformat/ingenientdec.c +++ b/libavformat/ingenientdec.c @@ -58,6 +58,8 @@ static int ingenient_read_packet(AVFormatContext *s, AVPacket *pkt) return ret; } +FF_RAWVIDEO_DEMUXER_CLASS(ingenient) + AVInputFormat ff_ingenient_demuxer = { .name = "ingenient", .long_name = NULL_IF_CONFIG_SMALL("raw Ingenient MJPEG"), @@ -67,5 +69,5 @@ AVInputFormat ff_ingenient_demuxer = { .flags= AVFMT_GENERIC_INDEX, .extensions = "cgi", // FIXME .value = CODEC_ID_MJPEG, - .priv_class = &ff_rawvideo_demuxer_class, + .priv_class = &ingenient_demuxer_class, }; diff --git a/libavformat/movenc.c b/libavformat/movenc.c index b1dafdb7fa..29de5b0ae8 100644 --- a/libavformat/movenc.c +++ b/libavformat/movenc.c @@ -1225,7 +1225,8 @@ static int mov_write_tkhd_tag(AVIOContext *pb, MOVTrack *track, AVStream *st) avio_wb32(pb, 0); /* reserved */ avio_wb32(pb, 0); /* reserved */ - avio_wb32(pb, 0x0); /* reserved (Layer & Alternate group) */ + avio_wb16(pb, 0); /* layer */ + avio_wb16(pb, st->codec->codec_type); /* alternate group) */ /* Volume, only for audio */ if(track->enc->codec_type == AVMEDIA_TYPE_AUDIO) avio_wb16(pb, 0x0100); diff --git a/libavformat/pcmdec.c b/libavformat/pcmdec.c index ab3b739ccb..676e3a19d1 100644 --- a/libavformat/pcmdec.c +++ b/libavformat/pcmdec.c @@ -22,6 +22,8 @@ #include "avformat.h" #include "rawdec.h" #include "pcm.h" +#include "libavutil/log.h" +#include "libavutil/opt.h" #define RAW_SAMPLES 1024 @@ -46,7 +48,19 @@ static int raw_read_packet(AVFormatContext *s, AVPacket *pkt) return ret; } +static const AVOption pcm_options[] = { + { "sample_rate", "", offsetof(RawAudioDemuxerContext, sample_rate), FF_OPT_TYPE_INT, {.dbl = 0}, 0, INT_MAX, AV_OPT_FLAG_DECODING_PARAM }, + { "channels", "", offsetof(RawAudioDemuxerContext, channels), FF_OPT_TYPE_INT, {.dbl = 0}, 0, INT_MAX, AV_OPT_FLAG_DECODING_PARAM }, + { 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),\ @@ -59,7 +73,7 @@ AVInputFormat ff_pcm_ ## name ## _demuxer = {\ .flags= AVFMT_GENERIC_INDEX,\ .extensions = ext,\ .value = codec,\ - .priv_class = &ff_rawaudio_demuxer_class,\ + .priv_class = &name ## _demuxer_class,\ }; PCMDEF(f64be, "PCM 64 bit floating-point big-endian format", diff --git a/libavformat/rawdec.c b/libavformat/rawdec.c index 2c455cac93..c02ad90aee 100644 --- a/libavformat/rawdec.c +++ b/libavformat/rawdec.c @@ -51,9 +51,12 @@ int ff_raw_read_header(AVFormatContext *s, AVFormatParameters *ap) st->codec->channels = 1; - if (s1->sample_rate) + if (id == CODEC_ID_ADPCM_G722) + st->codec->sample_rate = 16000; + + if (s1 && s1->sample_rate) st->codec->sample_rate = s1->sample_rate; - if (s1->channels) + if (s1 && s1->channels) st->codec->channels = s1->channels; st->codec->bits_per_coded_sample = av_get_bits_per_sample(st->codec->codec_id); @@ -165,48 +168,22 @@ fail: /* Note: Do not forget to add new entries to the Makefile as well. */ -static const AVOption audio_options[] = { - { "sample_rate", "", offsetof(RawAudioDemuxerContext, sample_rate), FF_OPT_TYPE_INT, {.dbl = 0}, 0, INT_MAX, AV_OPT_FLAG_DECODING_PARAM }, - { "channels", "", offsetof(RawAudioDemuxerContext, channels), FF_OPT_TYPE_INT, {.dbl = 0}, 0, INT_MAX, AV_OPT_FLAG_DECODING_PARAM }, - { NULL }, -}; - -const AVClass ff_rawaudio_demuxer_class = { - .class_name = "rawaudio demuxer", - .item_name = av_default_item_name, - .option = audio_options, - .version = LIBAVUTIL_VERSION_INT, -}; - #define OFFSET(x) offsetof(FFRawVideoDemuxerContext, x) #define DEC AV_OPT_FLAG_DECODING_PARAM -static const AVOption video_options[] = { - { "video_size", "A string describing frame size, such as 640x480 or hd720.", OFFSET(video_size), FF_OPT_TYPE_STRING, {.str = NULL}, 0, 0, DEC }, - { "pixel_format", "", OFFSET(pixel_format), FF_OPT_TYPE_STRING, {.str = "yuv420p"}, 0, 0, DEC }, - { "framerate", "", OFFSET(framerate), FF_OPT_TYPE_STRING, {.str = "25"}, 0, 0, DEC }, +const AVOption ff_rawvideo_options[] = { + { "framerate", "", OFFSET(framerate), FF_OPT_TYPE_STRING, {.str = "25"}, 0, 0, DEC}, { NULL }, }; -#undef OFFSET -#undef DEC - -const AVClass ff_rawvideo_demuxer_class = { - .class_name = "rawvideo demuxer", - .item_name = av_default_item_name, - .option = video_options, - .version = LIBAVUTIL_VERSION_INT, -}; #if CONFIG_G722_DEMUXER AVInputFormat ff_g722_demuxer = { .name = "g722", .long_name = NULL_IF_CONFIG_SMALL("raw G.722"), - .priv_data_size = sizeof(RawAudioDemuxerContext), .read_header = ff_raw_read_header, .read_packet = ff_raw_read_partial_packet, .flags= AVFMT_GENERIC_INDEX, .extensions = "g722,722", .value = CODEC_ID_ADPCM_G722, - .priv_class = &ff_rawaudio_demuxer_class, }; #endif diff --git a/libavformat/rawdec.h b/libavformat/rawdec.h index 6cb5af2b0a..a2011ebcba 100644 --- a/libavformat/rawdec.h +++ b/libavformat/rawdec.h @@ -24,6 +24,7 @@ #include "avformat.h" #include "libavutil/log.h" +#include "libavutil/opt.h" typedef struct RawAudioDemuxerContext { AVClass *class; @@ -38,8 +39,7 @@ typedef struct FFRawVideoDemuxerContext { char *framerate; /**< String describing framerate, set by a private option. */ } FFRawVideoDemuxerContext; -extern const AVClass ff_rawaudio_demuxer_class; -extern const AVClass ff_rawvideo_demuxer_class; +extern const AVOption ff_rawvideo_options[]; int ff_raw_read_header(AVFormatContext *s, AVFormatParameters *ap); @@ -49,7 +49,16 @@ int ff_raw_audio_read_header(AVFormatContext *s, AVFormatParameters *ap); int ff_raw_video_read_header(AVFormatContext *s, AVFormatParameters *ap); +#define FF_RAWVIDEO_DEMUXER_CLASS(name)\ +static const AVClass name ## _demuxer_class = {\ + .class_name = #name " demuxer",\ + .item_name = av_default_item_name,\ + .option = ff_rawvideo_options,\ + .version = LIBAVUTIL_VERSION_INT,\ +}; + #define FF_DEF_RAWVIDEO_DEMUXER(shortname, longname, probe, ext, id)\ +FF_RAWVIDEO_DEMUXER_CLASS(shortname)\ AVInputFormat ff_ ## shortname ## _demuxer = {\ .name = #shortname,\ .long_name = NULL_IF_CONFIG_SMALL(longname),\ @@ -60,7 +69,7 @@ AVInputFormat ff_ ## shortname ## _demuxer = {\ .flags = AVFMT_GENERIC_INDEX,\ .value = id,\ .priv_data_size = sizeof(FFRawVideoDemuxerContext),\ - .priv_class = &ff_rawvideo_demuxer_class,\ + .priv_class = &shortname ## _demuxer_class,\ }; #endif /* AVFORMAT_RAWDEC_H */ diff --git a/libavformat/rawvideodec.c b/libavformat/rawvideodec.c index 5609575401..f5329a7b9e 100644 --- a/libavformat/rawvideodec.c +++ b/libavformat/rawvideodec.c @@ -44,6 +44,22 @@ static int rawvideo_read_packet(AVFormatContext *s, AVPacket *pkt) return 0; } +#define OFFSET(x) offsetof(FFRawVideoDemuxerContext, x) +#define DEC AV_OPT_FLAG_DECODING_PARAM +static const AVOption rawvideo_options[] = { + { "video_size", "A string describing frame size, such as 640x480 or hd720.", OFFSET(video_size), FF_OPT_TYPE_STRING, {.str = NULL}, 0, 0, DEC }, + { "pixel_format", "", OFFSET(pixel_format), FF_OPT_TYPE_STRING, {.str = "yuv420p"}, 0, 0, DEC }, + { "framerate", "", OFFSET(framerate), FF_OPT_TYPE_STRING, {.str = "25"}, 0, 0, DEC }, + { NULL }, +}; + +static const AVClass rawvideo_demuxer_class = { + .class_name = "rawvideo demuxer", + .item_name = av_default_item_name, + .option = rawvideo_options, + .version = LIBAVUTIL_VERSION_INT, +}; + AVInputFormat ff_rawvideo_demuxer = { .name = "rawvideo", .long_name = NULL_IF_CONFIG_SMALL("raw video format"), @@ -53,5 +69,5 @@ AVInputFormat ff_rawvideo_demuxer = { .flags= AVFMT_GENERIC_INDEX, .extensions = "yuv,cif,qcif,rgb", .value = CODEC_ID_RAWVIDEO, - .priv_class = &ff_rawvideo_demuxer_class, + .priv_class = &rawvideo_demuxer_class, }; |