diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2012-01-08 04:29:15 +0400 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2012-01-08 06:34:22 +0400 |
commit | 757473831c3e1cc231fb985bcaed622d66fd6b2e (patch) | |
tree | d3c83c1e3726c24b91bf9970b06fd1a83921fff0 /libavformat | |
parent | a407baba85c2999707868e975c98b5a9de50f46d (diff) | |
parent | badb195d139f15dc189dd3f78930c9cbfce89c24 (diff) |
Merge remote-tracking branch 'qatar/master'
* qatar/master: (29 commits)
cabac: Move code only used within the CABAC test program into the test program.
vp56: Drop unnecessary cabac.h #include.
h264-test: Initialize AVCodecContext.av_class.
build: Skip compiling network.h and rtsp.h if networking is not enabled.
cosmetics: drop some pointless parentheses
Disable annoying warning without changing behavior
faq: Solutions for common problems with sample paths when running FATE.
avcodec: attempt to clarify the CODEC_CAP_DELAY documentation
avcodec: fix avcodec_encode_audio() documentation.
FATE: xmv-demux test; exercise the XMV demuxer without decoding the perceptual codecs inside.
vqf: recognize more metadata chunks
FATE test: BMV demuxer and associated video and audio decoders.
FATE: indeo4 video decoder test.
FATE: update xxan-wc4 test to a sample with more code coverage.
Change the recent h264_mp4toannexb bitstream filter test to output to an elementary stream rather than a program stream.
g722enc: validate AVCodecContext.trellis
g722enc: set frame_size, and also handle an odd number of input samples
g722enc: split encoding into separate functions for trellis vs. no trellis
mpegaudiodec: Use clearer pointer math
tta: Fix returned error code at EOF
...
Conflicts:
libavcodec/h264.c
libavcodec/indeo3.c
libavcodec/interplayvideo.c
libavcodec/ivi_common.c
libavcodec/libxvidff.c
libavcodec/mpegvideo.c
libavcodec/ppc/mpegvideo_altivec.c
libavcodec/tta.c
libavcodec/utils.c
libavfilter/vsrc_buffer.c
libavformat/Makefile
tests/fate/indeo.mak
tests/ref/acodec/g722
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat')
-rw-r--r-- | libavformat/Makefile | 2 | ||||
-rw-r--r-- | libavformat/aviobuf.c | 2 | ||||
-rw-r--r-- | libavformat/electronicarts.c | 9 | ||||
-rw-r--r-- | libavformat/ipmovie.c | 18 | ||||
-rw-r--r-- | libavformat/mtv.c | 2 | ||||
-rw-r--r-- | libavformat/rmdec.c | 2 | ||||
-rw-r--r-- | libavformat/vqf.c | 80 |
7 files changed, 70 insertions, 45 deletions
diff --git a/libavformat/Makefile b/libavformat/Makefile index 1afaddca1e..86518f6a58 100644 --- a/libavformat/Makefile +++ b/libavformat/Makefile @@ -371,6 +371,6 @@ OBJS-$(CONFIG_TCP_PROTOCOL) += tcp.o OBJS-$(CONFIG_TLS_PROTOCOL) += tls.o OBJS-$(CONFIG_UDP_PROTOCOL) += udp.o - +SKIPHEADERS-$(CONFIG_NETWORK) += network.h rtsp.h TESTPROGS = seek TOOLS = pktdumper probetest diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c index cac6b1f5eb..d8074780df 100644 --- a/libavformat/aviobuf.c +++ b/libavformat/aviobuf.c @@ -168,7 +168,7 @@ static void flush_buffer(AVIOContext *s) void avio_w8(AVIOContext *s, int b) { - *(s->buf_ptr)++ = b; + *s->buf_ptr++ = b; if (s->buf_ptr >= s->buf_end) flush_buffer(s); } diff --git a/libavformat/electronicarts.c b/libavformat/electronicarts.c index 43d1f26a8e..a0007d2982 100644 --- a/libavformat/electronicarts.c +++ b/libavformat/electronicarts.c @@ -221,10 +221,6 @@ static int process_audio_header_eacs(AVFormatContext *s) ea->sample_rate = ea->big_endian ? avio_rb32(pb) : avio_rl32(pb); ea->bytes = avio_r8(pb); /* 1=8-bit, 2=16-bit */ - if(ea->bytes == 0){ - av_log(s,AV_LOG_ERROR,"the file is corrupted, ea->bytes = 0\n"); - return AVERROR_INVALIDDATA; - } ea->num_channels = avio_r8(pb); compression_type = avio_r8(pb); avio_skip(pb, 13); @@ -440,6 +436,11 @@ static int ea_read_header(AVFormatContext *s, ea->audio_codec = 0; return 1; } + if (ea->bytes <= 0) { + av_log(s, AV_LOG_ERROR, "Invalid number of bytes per sample: %d\n", ea->bytes); + ea->audio_codec = CODEC_ID_NONE; + return 1; + } /* initialize the audio decoder stream */ st = avformat_new_stream(s, NULL); diff --git a/libavformat/ipmovie.c b/libavformat/ipmovie.c index 6ebafb6647..bf9e5c0dcf 100644 --- a/libavformat/ipmovie.c +++ b/libavformat/ipmovie.c @@ -89,6 +89,7 @@ typedef struct IPMVEContext { int64_t video_pts; uint32_t palette[256]; int has_palette; + int changed; unsigned int audio_bits; unsigned int audio_channels; @@ -168,6 +169,10 @@ static int load_ipmovie_packet(IPMVEContext *s, AVIOContext *pb, } } + if (s->changed) { + ff_add_param_change(pkt, 0, 0, 0, s->video_width, s->video_height); + s->changed = 0; + } pkt->pos= s->decode_map_chunk_offset; avio_seek(pb, s->decode_map_chunk_offset, SEEK_SET); s->decode_map_chunk_offset = 0; @@ -223,6 +228,7 @@ static int process_ipmovie_chunk(IPMVEContext *s, AVIOContext *pb, int first_color, last_color; int audio_flags; unsigned char r, g, b; + unsigned int width, height; /* see if there are any pending packets */ chunk_type = load_ipmovie_packet(s, pb, pkt); @@ -379,8 +385,16 @@ static int process_ipmovie_chunk(IPMVEContext *s, AVIOContext *pb, chunk_type = CHUNK_BAD; break; } - s->video_width = AV_RL16(&scratch[0]) * 8; - s->video_height = AV_RL16(&scratch[2]) * 8; + width = AV_RL16(&scratch[0]) * 8; + height = AV_RL16(&scratch[2]) * 8; + if (width != s->video_width) { + s->video_width = width; + s->changed++; + } + if (height != s->video_height) { + s->video_height = height; + s->changed++; + } if (opcode_version < 2 || !AV_RL16(&scratch[6])) { s->video_bpp = 8; } else { diff --git a/libavformat/mtv.c b/libavformat/mtv.c index b4b06d96cd..7237963ef3 100644 --- a/libavformat/mtv.c +++ b/libavformat/mtv.c @@ -53,7 +53,7 @@ typedef struct MTVDemuxContext { static int mtv_probe(AVProbeData *p) { /* Magic is 'AMV' */ - if(*(p->buf) != 'A' || *(p->buf+1) != 'M' || *(p->buf+2) != 'V') + if (*p->buf != 'A' || *(p->buf + 1) != 'M' || *(p->buf + 2) != 'V') return 0; /* Check for nonzero in bpp and (width|height) header fields */ diff --git a/libavformat/rmdec.c b/libavformat/rmdec.c index 5b9bfb869a..ae6cda3866 100644 --- a/libavformat/rmdec.c +++ b/libavformat/rmdec.c @@ -662,7 +662,7 @@ static int rm_assemble_video_frame(AVFormatContext *s, AVIOContext *pb, vst->videobufpos += len; rm->remaining_len-= len; - if(type == 2 || (vst->videobufpos) == vst->videobufsize){ + if (type == 2 || vst->videobufpos == vst->videobufsize) { vst->pkt.data[0] = vst->cur_slice-1; *pkt= vst->pkt; vst->pkt.data= NULL; diff --git a/libavformat/vqf.c b/libavformat/vqf.c index 69da4fd527..1014b41e68 100644 --- a/libavformat/vqf.c +++ b/libavformat/vqf.c @@ -24,6 +24,7 @@ #include "libavutil/intreadwrite.h" #include "libavutil/dict.h" #include "libavutil/mathematics.h" +#include "riff.h" typedef struct VqfContext { int frame_bit_len; @@ -45,11 +46,11 @@ static int vqf_probe(AVProbeData *probe_packet) return AVPROBE_SCORE_MAX/2; } -static void add_metadata(AVFormatContext *s, const char *tag, +static void add_metadata(AVFormatContext *s, uint32_t tag, unsigned int tag_len, unsigned int remaining) { int len = FFMIN(tag_len, remaining); - char *buf; + char *buf, key[5] = {0}; if (len == UINT_MAX) return; @@ -59,9 +60,32 @@ static void add_metadata(AVFormatContext *s, const char *tag, return; avio_read(s->pb, buf, len); buf[len] = 0; - av_dict_set(&s->metadata, tag, buf, AV_DICT_DONT_STRDUP_VAL); + AV_WL32(key, tag); + av_dict_set(&s->metadata, key, buf, AV_DICT_DONT_STRDUP_VAL); } +static const AVMetadataConv vqf_metadata_conv[] = { + { "(c) ", "copyright" }, + { "ARNG", "arranger" }, + { "AUTH", "author" }, + { "BAND", "band" }, + { "CDCT", "conductor" }, + { "COMT", "comment" }, + { "FILE", "filename" }, + { "GENR", "genre" }, + { "LABL", "publisher" }, + { "MUSC", "composer" }, + { "NAME", "title" }, + { "NOTE", "note" }, + { "PROD", "producer" }, + { "PRSN", "personnel" }, + { "REMX", "remixer" }, + { "SING", "singer" }, + { "TRCK", "track" }, + { "WORD", "words" }, + { 0 }, +}; + static int vqf_read_header(AVFormatContext *s, AVFormatParameters *ap) { VqfContext *c = s->priv_data; @@ -110,41 +134,25 @@ static int vqf_read_header(AVFormatContext *s, AVFormatParameters *ap) st->codec->bit_rate = read_bitrate*1000; break; - case MKTAG('N','A','M','E'): - add_metadata(s, "title" , len, header_size); - break; - case MKTAG('(','c',')',' '): - add_metadata(s, "copyright", len, header_size); - break; - case MKTAG('A','U','T','H'): - add_metadata(s, "author" , len, header_size); - break; - case MKTAG('A','L','B','M'): - add_metadata(s, "album" , len, header_size); - break; - case MKTAG('T','R','C','K'): - add_metadata(s, "track" , len, header_size); - break; - case MKTAG('C','O','M','T'): - add_metadata(s, "comment" , len, header_size); - break; - case MKTAG('F','I','L','E'): - add_metadata(s, "filename" , len, header_size); - break; - case MKTAG('D','S','I','Z'): - add_metadata(s, "size" , len, header_size); - break; - case MKTAG('D','A','T','E'): - add_metadata(s, "date" , len, header_size); + case MKTAG('D','S','I','Z'): // size of compressed data + { + char buf[8] = {0}; + int size = avio_rb32(s->pb); + + snprintf(buf, sizeof(buf), "%d", size); + av_dict_set(&s->metadata, "size", buf, 0); + } break; - case MKTAG('G','E','N','R'): - add_metadata(s, "genre" , len, header_size); + case MKTAG('Y','E','A','R'): // recording date + case MKTAG('E','N','C','D'): // compression date + case MKTAG('E','X','T','R'): // reserved + case MKTAG('_','Y','M','H'): // reserved + case MKTAG('_','N','T','T'): // reserved + case MKTAG('_','I','D','3'): // reserved for ID3 tags + avio_skip(s->pb, FFMIN(len, header_size)); break; default: - av_log(s, AV_LOG_ERROR, "Unknown chunk: %c%c%c%c\n", - ((char*)&chunk_tag)[0], ((char*)&chunk_tag)[1], - ((char*)&chunk_tag)[2], ((char*)&chunk_tag)[3]); - avio_skip(s->pb, FFMIN(len, header_size)); + add_metadata(s, chunk_tag, len, header_size); break; } @@ -201,6 +209,8 @@ static int vqf_read_header(AVFormatContext *s, AVFormatParameters *ap) st->codec->extradata_size = 12; memcpy(st->codec->extradata, comm_chunk, 12); + ff_metadata_conv_ctx(s, NULL, vqf_metadata_conv); + return 0; } |