From 1fcf92b730c84d133d30119c6cd10841fd769296 Mon Sep 17 00:00:00 2001 From: "Arwed v. Merkatz" Date: Wed, 1 Sep 2004 13:41:37 +0000 Subject: [PATCH] Create cue entries for audio only files. Original commit message from CVS: Create cue entries for audio only files. Fix writing of CUETIME, wrongly used gst_ebml_write_date. --- ChangeLog | 5 ++++- gst/matroska/matroska-mux.c | 21 +++++++++++++++++---- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index a26465748a..b20b6a207c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,7 +3,9 @@ * gst/matroska/ebml-ids.h: * gst/matroska/ebml-read.c: (gst_ebml_read_date): * gst/matroska/ebml-write.c: (gst_ebml_write_date): - automatically convert unix time <-> ebml time when reading/writing a date + * gst/matroska/matroska-mux.c: (gst_matroska_mux_finish): + automatically convert unix time <-> ebml time when reading/writing a date, + use gst_ebml_write_uint to write CUETIME, not gst_ebml_write_date. * gst/matroska/matroska-ids.h: * gst/matroska/matroska-mux.c: (gst_matroska_mux_create_uid), (gst_matroska_mux_reset), (gst_matroska_mux_audio_pad_link), @@ -11,6 +13,7 @@ (gst_matroska_mux_write_data): Write track and segment UIDs, write muxing date, write TRACKDEFAULTDURATION for TTA audio, write BLOCKDURATION if known. + Create cues for audio only files. 2004-08-31 Ronald S. Bultje diff --git a/gst/matroska/matroska-mux.c b/gst/matroska/matroska-mux.c index a37e008e78..93d9dfe068 100644 --- a/gst/matroska/matroska-mux.c +++ b/gst/matroska/matroska-mux.c @@ -845,7 +845,7 @@ gst_matroska_mux_finish (GstMatroskaMux * mux) pointentry_master = gst_ebml_write_master_start (ebml, GST_MATROSKA_ID_POINTENTRY); - gst_ebml_write_date (ebml, GST_MATROSKA_ID_CUETIME, + gst_ebml_write_uint (ebml, GST_MATROSKA_ID_CUETIME, idx->time / mux->time_scale); trackpos_master = gst_ebml_write_master_start (ebml, GST_MATROSKA_ID_CUETRACKPOSITION); @@ -969,10 +969,10 @@ gst_matroska_mux_write_data (GstMatroskaMux * mux) mux->sink[i].duration += GST_BUFFER_DURATION (buf); /* We currently write an index entry for each keyframe in a - * video track. This can be largely improved, such as doing + * video track or one entry for each cluster in an audio track + * for audio only files. This can be largely improved, such as doing * one for each keyframe or each second (for all-keyframe - * streams), only the *first* video track or the audio track - * if we have no video tracks. But that'll come later... */ + * streams), only the *first* video track. But that'll come later... */ if (mux->sink[i].track->type == GST_MATROSKA_TRACK_TYPE_VIDEO && GST_BUFFER_FLAG_IS_SET (buf, GST_BUFFER_KEY_UNIT)) { GstMatroskaIndex *idx; @@ -983,6 +983,19 @@ gst_matroska_mux_write_data (GstMatroskaMux * mux) } idx = &mux->index[mux->num_indexes++]; + idx->pos = ebml->pos; + idx->time = GST_BUFFER_TIMESTAMP (buf); + idx->track = mux->sink[i].track->num; + } else if ((mux->sink[i].track->type == GST_MATROSKA_TRACK_TYPE_AUDIO) && + (mux->num_streams == 1)) { + GstMatroskaIndex *idx; + + if (mux->num_indexes % 32 == 0) { + mux->index = g_renew (GstMatroskaIndex, mux->index, + mux->num_indexes + 32); + } + idx = &mux->index[mux->num_indexes++]; + idx->pos = ebml->pos; idx->time = GST_BUFFER_TIMESTAMP (buf); idx->track = mux->sink[i].track->num;