From 159308057beef05a28c14ede4afb49cf2c404b45 Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Mon, 21 Jul 2003 12:54:46 +0000 Subject: [PATCH] More steps in the Right Direction regarding tag support. --- src/pr_generic.cpp | 38 ++++++++++++++++++++++++++++++++++++++ src/pr_generic.h | 6 +++++- 2 files changed, 43 insertions(+), 1 deletion(-) diff --git a/src/pr_generic.cpp b/src/pr_generic.cpp index 6b1354106..516d9b7c3 100644 --- a/src/pr_generic.cpp +++ b/src/pr_generic.cpp @@ -143,6 +143,40 @@ generic_packetizer_c::~generic_packetizer_c() { safefree(hcodec_private); } +void generic_packetizer_c::set_tag_track_uid() { + int is, it; + bool skip; + KaxTag *tag; + KaxTagTargets *targets; + + if (ti->tags == NULL) + return; + + for (is = 0; is < ti->tags->ListSize(); is++) { + tag = (KaxTag *)(*ti->tags)[is]; + skip = false; + + for (it = 0; it < tag->ListSize(); it++) + if ((*tag)[it]->Generic().GlobalId == + KaxTagTargets::ClassInfos.GlobalId) { + skip = true; + break; + } + + if (!skip) { + targets = &GetChild(*tag); + *(static_cast(&GetChild(*targets))) = + huid; + } + + if (!tag->CheckMandatory()) { + mxprint(stderr, "Error parsing the tags in '%s': some mandatory " + "elements are missing.\n", ti->tags_ptr->file_name); + exit(1); + } + } +} + int generic_packetizer_c::read() { return reader->read(); } @@ -552,6 +586,8 @@ track_info_t *duplicate_track_info(track_info_t *src) { (*dst->sub_charsets)[i].language = safestrdup((*src->sub_charsets)[i].language); dst->all_tags = new vector(*src->all_tags); + for (i = 0; i < src->all_tags->size(); i++) + (*dst->all_tags)[i].file_name = safestrdup((*src->all_tags)[i].file_name); dst->private_data = (unsigned char *)safememdup(src->private_data, src->private_size); dst->sub_charset = safestrdup(src->sub_charset); @@ -578,6 +614,8 @@ void free_track_info(track_info_t *ti) { for (i = 0; i < ti->sub_charsets->size(); i++) safefree((*ti->sub_charsets)[i].language); delete ti->sub_charsets; + for (i = 0; i < ti->all_tags->size(); i++) + safefree((*ti->all_tags)[i].file_name); delete ti->all_tags; safefree(ti->language); safefree(ti->private_data); diff --git a/src/pr_generic.h b/src/pr_generic.h index 997607370..d148bfc45 100644 --- a/src/pr_generic.h +++ b/src/pr_generic.h @@ -69,7 +69,7 @@ typedef struct { } language_t; typedef struct { - const char *file_name; + char *file_name; int64_t id; } tags_t; @@ -194,6 +194,8 @@ public: virtual void set_as_default_track(int type); virtual void force_default_track(int type); + + virtual void set_tag_track_uid(); }; class generic_reader_c { @@ -209,6 +211,8 @@ public: virtual void set_headers() = 0; virtual void identify() = 0; +// virtual void set_tag_track_uids() = 0; + protected: virtual bool demuxing_requested(char type, int64_t id); };