aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2011-12-16 01:23:15 +0100
committerMichael Niedermayer <michaelni@gmx.at>2011-12-16 01:23:15 +0100
commit175cc378b3bd970caf1641e5df3361d6233747e1 (patch)
treed237cb08b1b6909154a007d3c06f0dab61b9700f /libavformat
parent56669837ce18d15d757a144712a082b9cb535c94 (diff)
parentd3b8bde2f14f78109a892e57f544bf840cf6d4fc (diff)
downloadffmpeg-175cc378b3bd970caf1641e5df3361d6233747e1.tar.gz
Merge remote-tracking branch 'qatar/master'
* qatar/master: movenc: Rudimentary IODs support. v410enc: fix output buffer size check v410enc: include correct headers fate: add -pix_fmt rgb48le to r210 test flvenc: Support muxing 16 kHz nellymoser configure: refactor list of programs into a variable fate: add r210 decoder test fate: split off Indeo FATE tests into their own file fate: split off ATRAC FATE tests into their own file fate: Add FATE tests for v410 encoder and decoder ARM: fix external symbol refs in rv40 asm westwood: Make sure audio header info is present when parsing audio packets libgsm: Reset the MS mode of GSM in the flush function libgsm: Set options on the right object ARM: dca: disable optimised decode_blockcodes() for old gcc Conflicts: configure libavformat/movenc.c libavformat/movenc.h tests/fate2.mak tests/ref/acodec/alac tests/ref/vsynth1/mpeg4 tests/ref/vsynth2/mpeg4 Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat')
-rw-r--r--libavformat/flvenc.c3
-rw-r--r--libavformat/movenc.c39
-rw-r--r--libavformat/movenc.h4
-rw-r--r--libavformat/westwood.c5
4 files changed, 40 insertions, 11 deletions
diff --git a/libavformat/flvenc.c b/libavformat/flvenc.c
index 2384e81276..3f034bc31a 100644
--- a/libavformat/flvenc.c
+++ b/libavformat/flvenc.c
@@ -93,6 +93,7 @@ static int get_audio_flags(AVCodecContext *enc){
case 11025:
flags |= FLV_SAMPLERATE_11025HZ;
break;
+ case 16000: //nellymoser only
case 8000: //nellymoser only
case 5512: //not mp3
if(enc->codec_id != CODEC_ID_MP3){
@@ -128,6 +129,8 @@ static int get_audio_flags(AVCodecContext *enc){
case CODEC_ID_NELLYMOSER:
if (enc->sample_rate == 8000) {
flags |= FLV_CODECID_NELLYMOSER_8KHZ_MONO | FLV_SAMPLESSIZE_16BIT;
+ } else if (enc->sample_rate == 16000) {
+ flags |= FLV_CODECID_NELLYMOSER_16KHZ_MONO | FLV_SAMPLESSIZE_16BIT;
} else {
flags |= FLV_CODECID_NELLYMOSER | FLV_SAMPLESSIZE_16BIT;
}
diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index 442a2717cf..0b5097b567 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -49,6 +49,9 @@ static const AVOption options[] = {
{ "frag_size", "maximum fragment size", offsetof(MOVMuxContext, max_fragment_size), AV_OPT_TYPE_INT, {.dbl = 0}, 0, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, 0 },
{ "frag_duration", "maximum fragment duration", offsetof(MOVMuxContext, max_fragment_duration), AV_OPT_TYPE_INT, {.dbl = 0}, 0, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, 0 },
FF_RTP_FLAG_OPTS(MOVMuxContext, rtp_flags),
+ { "skip_iods", "Skip writing iods atom.", offsetof(MOVMuxContext, iods_skip), AV_OPT_TYPE_INT, {.dbl = 0}, 0, 1, AV_OPT_FLAG_ENCODING_PARAM},
+ { "iods_audio_profile", "iods audio profile atom.", offsetof(MOVMuxContext, iods_audio_profile), AV_OPT_TYPE_INT, {.dbl = -1}, -1, 255, AV_OPT_FLAG_ENCODING_PARAM},
+ { "iods_video_profile", "iods video profile atom.", offsetof(MOVMuxContext, iods_video_profile), AV_OPT_TYPE_INT, {.dbl = -1}, -1, 255, AV_OPT_FLAG_ENCODING_PARAM},
{ NULL },
};
@@ -1489,21 +1492,34 @@ static int mov_write_traf_tag(AVIOContext *pb, MOVTrack *track, AVStream *st)
return updateSize(pb, pos);
}
-#if 0
-/* TODO: Not sorted out, but not necessary either */
static int mov_write_iods_tag(AVIOContext *pb, MOVMuxContext *mov)
{
- avio_wb32(pb, 0x15); /* size */
+ int i, has_audio = 0, has_video = 0;
+ int64_t pos = avio_tell(pb);
+ int audio_profile = mov->iods_audio_profile;
+ int video_profile = mov->iods_video_profile;
+ for (i = 0; i < mov->nb_streams; i++) {
+ if(mov->tracks[i].entry > 0) {
+ has_audio |= mov->tracks[i].enc->codec_type == AVMEDIA_TYPE_AUDIO;
+ has_video |= mov->tracks[i].enc->codec_type == AVMEDIA_TYPE_VIDEO;
+ }
+ }
+ if (audio_profile < 0)
+ audio_profile = 0xFF - has_audio;
+ if (video_profile < 0)
+ video_profile = 0xFF - has_video;
+ avio_wb32(pb, 0x0); /* size */
ffio_wfourcc(pb, "iods");
avio_wb32(pb, 0); /* version & flags */
- avio_wb16(pb, 0x1007);
- avio_w8(pb, 0);
- avio_wb16(pb, 0x4fff);
- avio_wb16(pb, 0xfffe);
- avio_wb16(pb, 0x01ff);
- return 0x15;
+ putDescr(pb, 0x10, 7);
+ avio_wb16(pb, 0x004f);
+ avio_w8(pb, 0xff);
+ avio_w8(pb, 0xff);
+ avio_w8(pb, audio_profile);
+ avio_w8(pb, video_profile);
+ avio_w8(pb, 0xff);
+ return updateSize(pb, pos);
}
-#endif
static int mov_write_mvhd_tag(AVIOContext *pb, MOVMuxContext *mov)
{
@@ -1968,7 +1984,8 @@ static int mov_write_moov_tag(AVIOContext *pb, MOVMuxContext *mov,
}
mov_write_mvhd_tag(pb, mov);
- //mov_write_iods_tag(pb, mov);
+ if (mov->mode != MODE_MOV && !mov->iods_skip)
+ mov_write_iods_tag(pb, mov);
for (i=0; i<mov->nb_streams; i++) {
if(mov->tracks[i].entry > 0) {
mov_write_trak_tag(pb, mov, &(mov->tracks[i]), i < s->nb_streams ? s->streams[i] : NULL);
diff --git a/libavformat/movenc.h b/libavformat/movenc.h
index a3701bba0a..f6c95adea3 100644
--- a/libavformat/movenc.h
+++ b/libavformat/movenc.h
@@ -125,6 +125,10 @@ typedef struct MOVMuxContext {
int64_t reserved_moov_pos;
int max_fragment_duration;
int max_fragment_size;
+
+ int iods_skip;
+ int iods_video_profile;
+ int iods_audio_profile;
} MOVMuxContext;
#define FF_MOV_FLAG_RTP_HINT 1
diff --git a/libavformat/westwood.c b/libavformat/westwood.c
index c232d5c829..c46c3ba10e 100644
--- a/libavformat/westwood.c
+++ b/libavformat/westwood.c
@@ -331,6 +331,11 @@ static int wsvqa_read_packet(AVFormatContext *s,
skip_byte = chunk_size & 0x01;
+ if ((chunk_type == SND2_TAG || chunk_type == SND1_TAG) && wsvqa->audio_channels == 0) {
+ av_log(s, AV_LOG_ERROR, "audio chunk without any audio header information found\n");
+ return AVERROR_INVALIDDATA;
+ }
+
if ((chunk_type == SND1_TAG) || (chunk_type == SND2_TAG) || (chunk_type == VQFR_TAG)) {
ret= av_get_packet(pb, pkt, chunk_size);