aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat/mov.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2011-10-22 01:03:27 +0200
committerMichael Niedermayer <michaelni@gmx.at>2011-10-22 01:16:41 +0200
commitaedc908601de7396751a9a4504e064782d9f6a0b (patch)
tree8f04b899142439893bac426ac83d05c4068b099c /libavformat/mov.c
parent1a7090bfafe986d4470ba8059c815939171ddb74 (diff)
parentf4b51d061f0f34e36be876b562b8abe47f4b9c1c (diff)
downloadffmpeg-aedc908601de7396751a9a4504e064782d9f6a0b.tar.gz
Merge remote-tracking branch 'qatar/master'
* qatar/master: (35 commits) flvdec: Do not call parse_keyframes_index with a NULL stream libspeexdec: include system headers before local headers libspeexdec: return meaningful error codes libspeexdec: cosmetics: reindent libspeexdec: decode one frame at a time. swscale: fix signed shift overflows in ff_yuv2rgb_c_init_tables() Move timefilter code from lavf to lavd. mov: add support for hdvd and pgapmetadata atoms mov: rename function _stik, some indentation cosmetics mov: rename function _int8 to remove ambiguity, some indentation cosmetics mov: parse the gnre atom mp3on4: check for allocation failures in decode_init_mp3on4() mp3on4: create a separate flush function for MP3onMP4. mp3on4: ensure that the frame channel count does not exceed the codec channel count. mp3on4: set channel layout mp3on4: fix the output channel order mp3on4: allocate temp buffer with av_malloc() instead of on the stack. mp3on4: copy MPADSPContext from first context to all contexts. fmtconvert: port float_to_int16_interleave() 2-channel x86 inline asm to yasm fmtconvert: port int32_to_float_fmul_scalar() x86 inline asm to yasm ... Conflicts: libavcodec/arm/h264dsp_init_arm.c libavcodec/h264.c libavcodec/h264.h libavcodec/h264_cabac.c libavcodec/h264_cavlc.c libavcodec/h264_ps.c libavcodec/h264dsp_template.c libavcodec/h264idct_template.c libavcodec/h264pred.c libavcodec/h264pred_template.c libavcodec/x86/h264dsp_mmx.c libavdevice/Makefile libavdevice/jack_audio.c libavformat/Makefile libavformat/flvdec.c libavformat/flvenc.c libavutil/pixfmt.h libswscale/utils.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/mov.c')
-rw-r--r--libavformat/mov.c60
1 files changed, 42 insertions, 18 deletions
diff --git a/libavformat/mov.c b/libavformat/mov.c
index 3c8bbc9ca1..198f3cd938 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -35,6 +35,7 @@
#include "riff.h"
#include "isom.h"
#include "libavcodec/get_bits.h"
+#include "id3v1.h"
#if CONFIG_ZLIB
#include <zlib.h>
@@ -99,31 +100,48 @@ static int mov_metadata_track_or_disc_number(MOVContext *c, AVIOContext *pb,
return 0;
}
-static int mov_metadata_int8(MOVContext *c, AVIOContext *pb,
- unsigned len, const char *key)
+static int mov_metadata_int8_bypass_padding(MOVContext *c, AVIOContext *pb,
+ unsigned len, const char *key)
{
- char buf[16];
+ char buf[16];
+
+ /* bypass padding bytes */
+ avio_r8(pb);
+ avio_r8(pb);
+ avio_r8(pb);
+
+ snprintf(buf, sizeof(buf), "%hu", avio_r8(pb));
+ av_dict_set(&c->fc->metadata, key, buf, 0);
+
+ return 0;
+}
- /* bypass padding bytes */
- avio_r8(pb);
- avio_r8(pb);
- avio_r8(pb);
+static int mov_metadata_int8_no_padding(MOVContext *c, AVIOContext *pb,
+ unsigned len, const char *key)
+{
+ char buf[16];
- snprintf(buf, sizeof(buf), "%hu", avio_r8(pb));
- av_dict_set(&c->fc->metadata, key, buf, 0);
+ snprintf(buf, sizeof(buf), "%hu", avio_r8(pb));
+ av_dict_set(&c->fc->metadata, key, buf, 0);
- return 0;
+ return 0;
}
-static int mov_metadata_stik(MOVContext *c, AVIOContext *pb,
+static int mov_metadata_gnre(MOVContext *c, AVIOContext *pb,
unsigned len, const char *key)
{
- char buf[16];
+ short genre;
+ char buf[20];
- snprintf(buf, sizeof(buf), "%hu", avio_r8(pb));
- av_dict_set(&c->fc->metadata, key, buf, 0);
+ avio_r8(pb); // unknown
- return 0;
+ genre = avio_r8(pb);
+ if (genre < 1 || genre > ID3v1_GENRE_MAX)
+ return 0;
+ snprintf(buf, sizeof(buf), "%s", ff_id3v1_genre_str[genre-1]);
+ av_dict_set(&c->fc->metadata, key, buf, 0);
+
+ return 0;
}
static const uint32_t mac_to_unicode[128] = {
@@ -189,6 +207,8 @@ static int mov_read_udta_string(MOVContext *c, AVIOContext *pb, MOVAtom atom)
case MKTAG(0xa9,'a','l','b'): key = "album"; break;
case MKTAG(0xa9,'d','a','y'): key = "date"; break;
case MKTAG(0xa9,'g','e','n'): key = "genre"; break;
+ case MKTAG( 'g','n','r','e'): key = "genre";
+ parse = mov_metadata_gnre; break;
case MKTAG(0xa9,'t','o','o'):
case MKTAG(0xa9,'s','w','r'): key = "encoder"; break;
case MKTAG(0xa9,'e','n','c'): key = "encoder"; break;
@@ -202,11 +222,15 @@ static int mov_read_udta_string(MOVContext *c, AVIOContext *pb, MOVAtom atom)
case MKTAG( 'd','i','s','k'): key = "disc";
parse = mov_metadata_track_or_disc_number; break;
case MKTAG( 't','v','e','s'): key = "episode_sort";
- parse = mov_metadata_int8; break;
+ parse = mov_metadata_int8_bypass_padding; break;
case MKTAG( 't','v','s','n'): key = "season_number";
- parse = mov_metadata_int8; break;
+ parse = mov_metadata_int8_bypass_padding; break;
case MKTAG( 's','t','i','k'): key = "media_type";
- parse = mov_metadata_stik; break;
+ parse = mov_metadata_int8_no_padding; break;
+ case MKTAG( 'h','d','v','d'): key = "hd_video";
+ parse = mov_metadata_int8_no_padding; break;
+ case MKTAG( 'p','g','a','p'): key = "gapless_playback";
+ parse = mov_metadata_int8_no_padding; break;
}
if (c->itunes_metadata && atom.size > 8) {