From 392e15c26123c694697204997541d802b6255027 Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Sun, 8 Feb 2004 22:48:19 +0000 Subject: [PATCH] Also convert the TITLE comment. --- ChangeLog | 4 ++-- src/input/r_ogm.cpp | 11 ++++++++++- src/input/r_ogm.h | 5 +++-- 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index aa81f8107..0a11a9026 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,7 +1,7 @@ 2004-02-08 Moritz Bunkus - * mkvmerge: new feature: The language tags and comments are being - kept when reading OGM files. + * mkvmerge: new feature: The LANGUAGE, TITLE tags and chapters are + being kept when reading OGM files. * mkvmerge: Changed the meaning of '--global-tags'. They now apply to the complete file. diff --git a/src/input/r_ogm.cpp b/src/input/r_ogm.cpp index e5e81b16d..af9c337d8 100644 --- a/src/input/r_ogm.cpp +++ b/src/input/r_ogm.cpp @@ -441,7 +441,8 @@ ogm_reader_c::create_packetizer(int64_t tid) { ti->private_data = NULL; ti->private_size = 0; ti->id = dmx->serial; // ID for this track. - ti->language = safestrdup(dmx->language); + ti->language = dmx->language; // safestrdup(dmx->language); + ti->track_name = dmx->title; // safestrdup(dmx->title); switch (dmx->stype) { case OGM_STREAM_TYPE_VIDEO: @@ -661,6 +662,7 @@ ogm_reader_c::create_packetizer(int64_t tid) { } ti->language = NULL; + ti->track_name = NULL; } } @@ -1236,6 +1238,13 @@ ogm_reader_c::handle_stream_comments() { dmx->language = safestrdup(iso639_2); } + } else if (comment[0] == "TITLE") { + if (!segment_title_set && (segment_title.length() == 0) && + (dmx->stype == OGM_STREAM_TYPE_VIDEO)) + segment_title = comment[1]; + safefree(dmx->title); + dmx->title = safestrdup(comment[1].c_str()); + } else if (starts_with(comment[0], "CHAPTER")) chapters.push_back(comments[j]); } diff --git a/src/input/r_ogm.h b/src/input/r_ogm.h index 37438bd62..51cbaf3f7 100644 --- a/src/input/r_ogm.h +++ b/src/input/r_ogm.h @@ -74,7 +74,7 @@ struct ogm_demuxer_t { int sid, stype, serial, eos; int units_processed, vorbis_rate; bool headers_read; - char *language; + char *language, *title; vector packet_data, nh_packet_data; vector packet_sizes, nh_packet_sizes; #if defined(HAVE_FLAC_FORMAT_H) @@ -85,7 +85,7 @@ struct ogm_demuxer_t { ogm_demuxer_t(): packetizer(NULL), sid(0), stype(0), serial(0), eos(0), units_processed(0), - vorbis_rate(0), headers_read(false), language(NULL) { + vorbis_rate(0), headers_read(false), language(NULL), title(NULL) { memset(&os, 0, sizeof(ogg_stream_state)); } ~ogm_demuxer_t() { @@ -93,6 +93,7 @@ struct ogm_demuxer_t { for (i = 0; i < packet_data.size(); i++) safefree(packet_data[i]); safefree(language); + safefree(title); } };