Also convert the TITLE comment.

This commit is contained in:
Moritz Bunkus 2004-02-08 22:48:19 +00:00
parent 55d2d3d92d
commit 392e15c261
3 changed files with 15 additions and 5 deletions

View File

@ -1,7 +1,7 @@
2004-02-08 Moritz Bunkus <moritz@bunkus.org> 2004-02-08 Moritz Bunkus <moritz@bunkus.org>
* mkvmerge: new feature: The language tags and comments are being * mkvmerge: new feature: The LANGUAGE, TITLE tags and chapters are
kept when reading OGM files. being kept when reading OGM files.
* mkvmerge: Changed the meaning of '--global-tags'. They now apply * mkvmerge: Changed the meaning of '--global-tags'. They now apply
to the complete file. to the complete file.

View File

@ -441,7 +441,8 @@ ogm_reader_c::create_packetizer(int64_t tid) {
ti->private_data = NULL; ti->private_data = NULL;
ti->private_size = 0; ti->private_size = 0;
ti->id = dmx->serial; // ID for this track. 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) { switch (dmx->stype) {
case OGM_STREAM_TYPE_VIDEO: case OGM_STREAM_TYPE_VIDEO:
@ -661,6 +662,7 @@ ogm_reader_c::create_packetizer(int64_t tid) {
} }
ti->language = NULL; ti->language = NULL;
ti->track_name = NULL;
} }
} }
@ -1236,6 +1238,13 @@ ogm_reader_c::handle_stream_comments() {
dmx->language = safestrdup(iso639_2); 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")) } else if (starts_with(comment[0], "CHAPTER"))
chapters.push_back(comments[j]); chapters.push_back(comments[j]);
} }

View File

@ -74,7 +74,7 @@ struct ogm_demuxer_t {
int sid, stype, serial, eos; int sid, stype, serial, eos;
int units_processed, vorbis_rate; int units_processed, vorbis_rate;
bool headers_read; bool headers_read;
char *language; char *language, *title;
vector<unsigned char *> packet_data, nh_packet_data; vector<unsigned char *> packet_data, nh_packet_data;
vector<int> packet_sizes, nh_packet_sizes; vector<int> packet_sizes, nh_packet_sizes;
#if defined(HAVE_FLAC_FORMAT_H) #if defined(HAVE_FLAC_FORMAT_H)
@ -85,7 +85,7 @@ struct ogm_demuxer_t {
ogm_demuxer_t(): ogm_demuxer_t():
packetizer(NULL), sid(0), stype(0), serial(0), eos(0), units_processed(0), 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)); memset(&os, 0, sizeof(ogg_stream_state));
} }
~ogm_demuxer_t() { ~ogm_demuxer_t() {
@ -93,6 +93,7 @@ struct ogm_demuxer_t {
for (i = 0; i < packet_data.size(); i++) for (i = 0; i < packet_data.size(); i++)
safefree(packet_data[i]); safefree(packet_data[i]);
safefree(language); safefree(language);
safefree(title);
} }
}; };