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.
This commit is contained in:
Arwed v. Merkatz 2004-09-01 13:41:37 +00:00
parent e83fb2a3c2
commit 1fcf92b730
2 changed files with 21 additions and 5 deletions

View file

@ -3,7 +3,9 @@
* gst/matroska/ebml-ids.h: * gst/matroska/ebml-ids.h:
* gst/matroska/ebml-read.c: (gst_ebml_read_date): * gst/matroska/ebml-read.c: (gst_ebml_read_date):
* gst/matroska/ebml-write.c: (gst_ebml_write_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-ids.h:
* gst/matroska/matroska-mux.c: (gst_matroska_mux_create_uid), * gst/matroska/matroska-mux.c: (gst_matroska_mux_create_uid),
(gst_matroska_mux_reset), (gst_matroska_mux_audio_pad_link), (gst_matroska_mux_reset), (gst_matroska_mux_audio_pad_link),
@ -11,6 +13,7 @@
(gst_matroska_mux_write_data): (gst_matroska_mux_write_data):
Write track and segment UIDs, write muxing date, write Write track and segment UIDs, write muxing date, write
TRACKDEFAULTDURATION for TTA audio, write BLOCKDURATION if known. TRACKDEFAULTDURATION for TTA audio, write BLOCKDURATION if known.
Create cues for audio only files.
2004-08-31 Ronald S. Bultje <rbultje@ronald.bitfreak.net> 2004-08-31 Ronald S. Bultje <rbultje@ronald.bitfreak.net>

View file

@ -845,7 +845,7 @@ gst_matroska_mux_finish (GstMatroskaMux * mux)
pointentry_master = gst_ebml_write_master_start (ebml, pointentry_master = gst_ebml_write_master_start (ebml,
GST_MATROSKA_ID_POINTENTRY); 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); idx->time / mux->time_scale);
trackpos_master = gst_ebml_write_master_start (ebml, trackpos_master = gst_ebml_write_master_start (ebml,
GST_MATROSKA_ID_CUETRACKPOSITION); GST_MATROSKA_ID_CUETRACKPOSITION);
@ -969,10 +969,10 @@ gst_matroska_mux_write_data (GstMatroskaMux * mux)
mux->sink[i].duration += GST_BUFFER_DURATION (buf); mux->sink[i].duration += GST_BUFFER_DURATION (buf);
/* We currently write an index entry for each keyframe in a /* 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 * one for each keyframe or each second (for all-keyframe
* streams), only the *first* video track or the audio track * streams), only the *first* video track. But that'll come later... */
* if we have no video tracks. But that'll come later... */
if (mux->sink[i].track->type == GST_MATROSKA_TRACK_TYPE_VIDEO && if (mux->sink[i].track->type == GST_MATROSKA_TRACK_TYPE_VIDEO &&
GST_BUFFER_FLAG_IS_SET (buf, GST_BUFFER_KEY_UNIT)) { GST_BUFFER_FLAG_IS_SET (buf, GST_BUFFER_KEY_UNIT)) {
GstMatroskaIndex *idx; GstMatroskaIndex *idx;
@ -983,6 +983,19 @@ gst_matroska_mux_write_data (GstMatroskaMux * mux)
} }
idx = &mux->index[mux->num_indexes++]; 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->pos = ebml->pos;
idx->time = GST_BUFFER_TIMESTAMP (buf); idx->time = GST_BUFFER_TIMESTAMP (buf);
idx->track = mux->sink[i].track->num; idx->track = mux->sink[i].track->num;