owntone-server/ffmpeg/ffmpeg-0.6.patch
2011-03-20 14:56:40 +01:00

82 lines
2.6 KiB
Diff

--- ffmpeg/libavformat/mov.c 2010-12-13 17:10:32.347224001 -0800
+++ ffmpeg/libavformat/mov.c 2010-12-13 17:03:05.078969987 -0800
@@ -78,19 +78,46 @@
static const MOVParseTableEntry mov_default_parse_table[];
-static int mov_metadata_trkn(MOVContext *c, ByteIOContext *pb, unsigned len)
+static int mov_metadata_trkn(MOVContext *c, ByteIOContext *pb, unsigned len, const char *key)
{
char buf[16];
get_be16(pb); // unknown
snprintf(buf, sizeof(buf), "%d", get_be16(pb));
- av_metadata_set2(&c->fc->metadata, "track", buf, 0);
+ av_metadata_set(&c->fc->metadata, key, buf);
get_be16(pb); // total tracks
return 0;
}
+static int mov_metadata_int8(MOVContext *c, ByteIOContext *pb, unsigned len, const char *key)
+{
+ char buf[16];
+
+ /* bypass padding bytes */
+ get_byte(pb);
+ get_byte(pb);
+ get_byte(pb);
+
+ snprintf(buf, sizeof(buf-1), "%hu", get_byte(pb));
+ buf[sizeof(buf)-1] = 0;
+ av_metadata_set(&c->fc->metadata, key, buf);
+
+ return 0;
+}
+
+static int mov_metadata_stik(MOVContext *c, ByteIOContext *pb, unsigned len, const char *key)
+{
+ char buf[16];
+
+ snprintf(buf, sizeof(buf-1), "%hu", get_byte(pb));
+ buf[sizeof(buf)-1] = 0;
+ av_metadata_set(&c->fc->metadata, key, buf);
+
+ return 0;
+}
+
static const uint32_t mac_to_unicode[128] = {
0x00C4,0x00C5,0x00C7,0x00C9,0x00D1,0x00D6,0x00DC,0x00E1,
0x00E0,0x00E2,0x00E4,0x00E3,0x00E5,0x00E7,0x00E9,0x00E8,
@@ -137,7 +164,7 @@
const char *key = NULL;
uint16_t str_size, langcode = 0;
uint32_t data_type = 0;
- int (*parse)(MOVContext*, ByteIOContext*, unsigned) = NULL;
+ int (*parse)(MOVContext*, ByteIOContext*, unsigned, const char *) = NULL;
switch (atom.type) {
case MKTAG(0xa9,'n','a','m'): key = "title"; break;
@@ -159,6 +186,11 @@
case MKTAG( 't','v','s','h'): key = "show"; break;
case MKTAG( 't','v','e','n'): key = "episode_id";break;
case MKTAG( 't','v','n','n'): key = "network"; break;
+ case MKTAG( 't','v','e','s'): key = "episode_sort";
+ case MKTAG( 't','v','s','n'): key = "season_number";
+ parse = mov_metadata_int8; break;
+ case MKTAG( 's','t','i','k'): key = "stik";
+ parse = mov_metadata_stik; break;
case MKTAG( 't','r','k','n'): key = "track";
parse = mov_metadata_trkn; break;
}
@@ -195,7 +227,7 @@
str_size = FFMIN3(sizeof(str)-1, str_size, atom.size);
if (parse)
- parse(c, pb, str_size);
+ parse(c, pb, str_size, key);
else {
if (data_type == 3 || (data_type == 0 && langcode < 0x800)) { // MAC Encoded
mov_read_mac_string(c, pb, str_size, str, sizeof(str));