From 1112090589c68c6ac46118db6dff8928bc784f13 Mon Sep 17 00:00:00 2001 From: Jonathan Conder Date: Mon, 21 Dec 2009 12:01:53 -0300 Subject: [PATCH] qtdemux: Adds new tags Adds some new tags mapping to qtdemux. Fixes #599759 --- gst/qtdemux/qtdemux.c | 52 +++++++++++++++++++++++++++++++++--- gst/qtdemux/qtdemux_fourcc.h | 15 +++++++++++ gst/qtdemux/qtdemux_types.c | 21 ++++++++++++--- 3 files changed, 82 insertions(+), 6 deletions(-) diff --git a/gst/qtdemux/qtdemux.c b/gst/qtdemux/qtdemux.c index 925ea0771..76e53e35c 100644 --- a/gst/qtdemux/qtdemux.c +++ b/gst/qtdemux/qtdemux.c @@ -5879,6 +5879,33 @@ qtdemux_tag_add_tmpo (GstQTDemux * qtdemux, const char *tag1, const char *dummy, } } +static void +qtdemux_tag_add_uint32 (GstQTDemux * qtdemux, const char *tag1, + const char *dummy, GNode * node) +{ + GNode *data; + int len; + int type; + guint32 num; + + data = qtdemux_tree_get_child_by_type (node, FOURCC_data); + if (data) { + len = QT_UINT32 (data->data); + type = QT_UINT32 ((guint8 *) data->data + 8); + GST_DEBUG_OBJECT (qtdemux, "have %s tag, type=%d,len=%d", tag1, type, len); + /* some files wrongly have a type 0x0f=15, but it should be 0x15 */ + if ((type == 0x00000015 || type == 0x0000000f) && len >= 20) { + num = QT_UINT32 ((guint8 *) data->data + 16); + if (num) { + /* do not add num=0 */ + GST_DEBUG_OBJECT (qtdemux, "adding tag %d", num); + gst_tag_list_add (qtdemux->tag_list, GST_TAG_MERGE_REPLACE, + tag1, num, NULL); + } + } + } +} + static void qtdemux_tag_add_covr (GstQTDemux * qtdemux, const char *tag1, const char *dummy, GNode * node) @@ -5980,6 +6007,13 @@ qtdemux_tag_add_gnre (GstQTDemux * qtdemux, const char *tag, const char *dummy, typedef void (*GstQTDemuxAddTagFunc) (GstQTDemux * demux, const char *tag, const char *tag_bis, GNode * node); +/* unmapped tags +FOURCC_pcst -> if media is a podcast -> bool +FOURCC_cpil -> if media is part of a compilation -> bool +FOURCC_pgap -> if media is part of a gapless context -> bool +FOURCC_tven -> the tv episode id e.g. S01E23 -> str +*/ + static const struct { guint32 fourcc; @@ -5990,10 +6024,11 @@ static const struct { FOURCC__nam, GST_TAG_TITLE, NULL, qtdemux_tag_add_str}, { FOURCC_titl, GST_TAG_TITLE, NULL, qtdemux_tag_add_str}, { - FOURCC__grp, GST_TAG_ARTIST, NULL, qtdemux_tag_add_str}, { + FOURCC__grp, GST_TAG_GROUPING, NULL, qtdemux_tag_add_str}, { FOURCC__wrt, GST_TAG_COMPOSER, NULL, qtdemux_tag_add_str}, { FOURCC__ART, GST_TAG_ARTIST, NULL, qtdemux_tag_add_str}, { - FOURCC_perf, GST_TAG_ARTIST, NULL, qtdemux_tag_add_str}, { + FOURCC_aART, GST_TAG_ALBUM_ARTIST, NULL, qtdemux_tag_add_str}, { + FOURCC_perf, GST_TAG_PERFORMER, NULL, qtdemux_tag_add_str}, { FOURCC_auth, GST_TAG_COMPOSER, NULL, qtdemux_tag_add_str}, { FOURCC__alb, GST_TAG_ALBUM, NULL, qtdemux_tag_add_str}, { FOURCC_albm, GST_TAG_ALBUM, NULL, qtdemux_tag_add_str}, { @@ -6001,10 +6036,12 @@ static const struct FOURCC__cpy, GST_TAG_COPYRIGHT, NULL, qtdemux_tag_add_str}, { FOURCC__cmt, GST_TAG_COMMENT, NULL, qtdemux_tag_add_str}, { FOURCC__des, GST_TAG_DESCRIPTION, NULL, qtdemux_tag_add_str}, { + FOURCC_desc, GST_TAG_DESCRIPTION, NULL, qtdemux_tag_add_str}, { FOURCC_dscp, GST_TAG_DESCRIPTION, NULL, qtdemux_tag_add_str}, { + FOURCC__lyr, GST_TAG_LYRICS, NULL, qtdemux_tag_add_str}, { FOURCC__day, GST_TAG_DATE, NULL, qtdemux_tag_add_date}, { FOURCC_yrrc, GST_TAG_DATE, NULL, qtdemux_tag_add_year}, { - FOURCC__too, GST_TAG_COMMENT, NULL, qtdemux_tag_add_str}, { + FOURCC__too, GST_TAG_ENCODER, NULL, qtdemux_tag_add_str}, { FOURCC__inf, GST_TAG_COMMENT, NULL, qtdemux_tag_add_str}, { FOURCC_trkn, GST_TAG_TRACK_NUMBER, GST_TAG_TRACK_COUNT, qtdemux_tag_add_num}, { FOURCC_disk, GST_TAG_ALBUM_VOLUME_NUMBER, GST_TAG_ALBUM_VOLUME_COUNT, @@ -6015,6 +6052,15 @@ static const struct FOURCC_gnre, GST_TAG_GENRE, NULL, qtdemux_tag_add_gnre}, { FOURCC_tmpo, GST_TAG_BEATS_PER_MINUTE, NULL, qtdemux_tag_add_tmpo}, { FOURCC_covr, GST_TAG_PREVIEW_IMAGE, NULL, qtdemux_tag_add_covr}, { + FOURCC_sonm, GST_TAG_TITLE_SORTNAME, NULL, qtdemux_tag_add_str}, { + FOURCC_soal, GST_TAG_ALBUM_SORTNAME, NULL, qtdemux_tag_add_str}, { + FOURCC_soar, GST_TAG_ARTIST_SORTNAME, NULL, qtdemux_tag_add_str}, { + FOURCC_soaa, GST_TAG_ALBUM_ARTIST_SORTNAME, NULL, qtdemux_tag_add_str}, { + FOURCC_soco, GST_TAG_COMPOSER_SORTNAME, NULL, qtdemux_tag_add_str}, { + FOURCC_sosn, GST_TAG_SHOW_SORTNAME, NULL, qtdemux_tag_add_str}, { + FOURCC_tvsh, GST_TAG_SHOW_NAME, NULL, qtdemux_tag_add_str}, { + FOURCC_tvsn, GST_TAG_SHOW_SEASON_NUMBER, NULL, qtdemux_tag_add_uint32}, { + FOURCC_tves, GST_TAG_SHOW_EPISODE_NUMBER, NULL, qtdemux_tag_add_uint32}, { FOURCC_kywd, GST_TAG_KEYWORDS, NULL, qtdemux_tag_add_keywords}, { FOURCC_keyw, GST_TAG_KEYWORDS, NULL, qtdemux_tag_add_str}, { FOURCC__enc, GST_TAG_ENCODER, NULL, qtdemux_tag_add_str}, { diff --git a/gst/qtdemux/qtdemux_fourcc.h b/gst/qtdemux/qtdemux_fourcc.h index 053341740..3528383ea 100644 --- a/gst/qtdemux/qtdemux_fourcc.h +++ b/gst/qtdemux/qtdemux_fourcc.h @@ -85,8 +85,11 @@ G_BEGIN_DECLS #define FOURCC__nam GST_MAKE_FOURCC(0xa9,'n','a','m') #define FOURCC__cmt GST_MAKE_FOURCC(0xa9,'c','m','t') #define FOURCC__des GST_MAKE_FOURCC(0xa9,'d','e','s') +#define FOURCC_desc GST_MAKE_FOURCC('d','e','s','c') +#define FOURCC__lyr GST_MAKE_FOURCC(0xa9,'l','y','r') #define FOURCC__cpy GST_MAKE_FOURCC(0xa9,'c','p','y') #define FOURCC__ART GST_MAKE_FOURCC(0xa9,'A','R','T') +#define FOURCC_aART GST_MAKE_FOURCC('a','A','R','T') #define FOURCC__wrt GST_MAKE_FOURCC(0xa9,'w','r','t') #define FOURCC__grp GST_MAKE_FOURCC(0xa9,'g','r','p') #define FOURCC__alb GST_MAKE_FOURCC(0xa9,'a','l','b') @@ -100,9 +103,21 @@ G_BEGIN_DECLS #define FOURCC_disk GST_MAKE_FOURCC('d','i','s','k') #define FOURCC_trkn GST_MAKE_FOURCC('t','r','k','n') #define FOURCC_cpil GST_MAKE_FOURCC('c','p','i','l') +#define FOURCC_pgap GST_MAKE_FOURCC('p','g','a','p') +#define FOURCC_pcst GST_MAKE_FOURCC('p','c','s','t') #define FOURCC_tmpo GST_MAKE_FOURCC('t','m','p','o') #define FOURCC_covr GST_MAKE_FOURCC('c','o','v','r') #define FOURCC__too GST_MAKE_FOURCC(0xa9,'t','o','o') +#define FOURCC_tvsh GST_MAKE_FOURCC('t','v','s','h') +#define FOURCC_tven GST_MAKE_FOURCC('t','v','e','n') +#define FOURCC_tvsn GST_MAKE_FOURCC('t','v','s','n') +#define FOURCC_tves GST_MAKE_FOURCC('t','v','e','s') +#define FOURCC_sonm GST_MAKE_FOURCC('s','o','n','m') +#define FOURCC_soal GST_MAKE_FOURCC('s','o','a','l') +#define FOURCC_soar GST_MAKE_FOURCC('s','o','a','r') +#define FOURCC_soaa GST_MAKE_FOURCC('s','o','a','a') +#define FOURCC_soco GST_MAKE_FOURCC('s','o','c','o') +#define FOURCC_sosn GST_MAKE_FOURCC('s','o','s','n') #define FOURCC_____ GST_MAKE_FOURCC('-','-','-','-') #define FOURCC_free GST_MAKE_FOURCC('f','r','e','e') #define FOURCC_data GST_MAKE_FOURCC('d','a','t','a') diff --git a/gst/qtdemux/qtdemux_types.c b/gst/qtdemux/qtdemux_types.c index f74021817..6afc2d101 100644 --- a/gst/qtdemux/qtdemux_types.c +++ b/gst/qtdemux/qtdemux_types.c @@ -98,17 +98,20 @@ static const QtNodeType qt_node_types[] = { {FOURCC__nam, "Name", QT_FLAG_CONTAINER,}, {FOURCC_titl, "Title", QT_FLAG_CONTAINER,}, {FOURCC__ART, "Artist", QT_FLAG_CONTAINER,}, + {FOURCC_aART, "Album Artist", QT_FLAG_CONTAINER,}, {FOURCC_auth, "Author", QT_FLAG_CONTAINER,}, {FOURCC_perf, "Performer", QT_FLAG_CONTAINER,}, {FOURCC__wrt, "Writer", QT_FLAG_CONTAINER,}, - {FOURCC__grp, "Group", QT_FLAG_CONTAINER,}, + {FOURCC__grp, "Grouping", QT_FLAG_CONTAINER,}, {FOURCC__alb, "Album", QT_FLAG_CONTAINER,}, {FOURCC_albm, "Album", QT_FLAG_CONTAINER,}, {FOURCC__day, "Date", QT_FLAG_CONTAINER,}, {FOURCC__cpy, "Copyright", QT_FLAG_CONTAINER,}, {FOURCC__cmt, "Comment", QT_FLAG_CONTAINER,}, {FOURCC__des, "Description", QT_FLAG_CONTAINER,}, + {FOURCC_desc, "Description", QT_FLAG_CONTAINER,}, {FOURCC_dscp, "Description", QT_FLAG_CONTAINER,}, + {FOURCC__lyr, "Lyrics", QT_FLAG_CONTAINER,}, {FOURCC__req, "Requirement", QT_FLAG_CONTAINER,}, {FOURCC__enc, "Encoder", QT_FLAG_CONTAINER,}, {FOURCC_gnre, "Genre", QT_FLAG_CONTAINER,}, @@ -116,12 +119,24 @@ static const QtNodeType qt_node_types[] = { {FOURCC_disc, "Disc Number", QT_FLAG_CONTAINER,}, {FOURCC_disk, "Disc Number", QT_FLAG_CONTAINER,}, {FOURCC_cprt, "Copyright", QT_FLAG_CONTAINER,}, - {FOURCC_cpil, "cpil", QT_FLAG_CONTAINER,}, + {FOURCC_cpil, "Compilation", QT_FLAG_CONTAINER,}, + {FOURCC_pgap, "Gapless", QT_FLAG_CONTAINER,}, + {FOURCC_pcst, "Podcast", QT_FLAG_CONTAINER,}, {FOURCC_tmpo, "Tempo", QT_FLAG_CONTAINER,}, {FOURCC_covr, "Cover", QT_FLAG_CONTAINER,}, + {FOURCC_sonm, "Sort Title", QT_FLAG_CONTAINER,}, + {FOURCC_soal, "Sort Album", QT_FLAG_CONTAINER,}, + {FOURCC_soar, "Sort Artist", QT_FLAG_CONTAINER,}, + {FOURCC_soaa, "Sort Album Artist", QT_FLAG_CONTAINER,}, + {FOURCC_soco, "Sort Composer", QT_FLAG_CONTAINER,}, + {FOURCC_sosn, "Sort TV Show", QT_FLAG_CONTAINER,}, + {FOURCC_tvsh, "TV Show", QT_FLAG_CONTAINER,}, + {FOURCC_tven, "TV Episode ID", QT_FLAG_CONTAINER,}, + {FOURCC_tvsn, "TV Season Number", QT_FLAG_CONTAINER,}, + {FOURCC_tves, "TV Episode Number", QT_FLAG_CONTAINER,}, {FOURCC_keyw, "Keywords", QT_FLAG_CONTAINER,}, {FOURCC_kywd, "Keywords", QT_FLAG_CONTAINER,}, - {FOURCC__too, "too", QT_FLAG_CONTAINER,}, + {FOURCC__too, "Encoder", QT_FLAG_CONTAINER,}, {FOURCC_____, "----", QT_FLAG_CONTAINER,}, {FOURCC_data, "data", 0, qtdemux_dump_unknown}, {FOURCC_free, "free", 0,}, -- 2.34.1