diff options
author | Michael Niedermayer | 2012-01-08 01:29:15 +0100 |
---|---|---|
committer | Michael Niedermayer | 2012-01-08 03:34:22 +0100 |
commit | 757473831c3e1cc231fb985bcaed622d66fd6b2e (patch) | |
tree | d3c83c1e3726c24b91bf9970b06fd1a83921fff0 /libavformat/vqf.c | |
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/vqf.c')
-rw-r--r-- | libavformat/vqf.c | 80 |
1 files changed, 45 insertions, 35 deletions
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; } |