From df70b2d2ceecadabbf8c7cad514b899b7f0210cb Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tim-Philipp=20M=C3=BCller?= Date: Thu, 28 Jun 2012 23:41:16 +0100 Subject: [PATCH] audiocdsrc: send TOC event downstream if we're in continuous mode If we're in continuous mode where we'll play the entire CD from start to finish, send a TOC event downstream so any downstream muxers can write a TOC to indicate where the various tracks start and end. --- gst-libs/gst/audio/gstaudiocdsrc.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/gst-libs/gst/audio/gstaudiocdsrc.c b/gst-libs/gst/audio/gstaudiocdsrc.c index 2b3ab5b..8ab0563 100644 --- a/gst-libs/gst/audio/gstaudiocdsrc.c +++ b/gst-libs/gst/audio/gstaudiocdsrc.c @@ -146,6 +146,7 @@ struct _GstAudioCdSrcPrivate gint toc_offset; gboolean toc_bias; + GstEvent *toc_event; /* pending TOC event */ GstToc *toc; }; @@ -1438,10 +1439,11 @@ gst_audio_cd_src_add_toc (GstAudioCdSrc * src) gst_element_post_message (GST_ELEMENT_CAST (src), gst_message_new_toc (GST_OBJECT (src), toc, FALSE)); - /* should we also push a TOC event downstream? Might only make sense if - * we're in continuous mode. e.g. matroska-mux will just write the TOC to - * file, but we might only be outputting a single track, so that doesn't - * make sense. */ + /* If we're in continuous mode (stream = whole disc), send a TOC event + * downstream, so matroskamux etc. can write a TOC to indicate where the + * various tracks are */ + if (src->priv->mode == GST_AUDIO_CD_SRC_MODE_CONTINUOUS) + src->priv->toc_event = gst_event_new_toc (toc, FALSE); src->priv->toc = toc; } @@ -1671,6 +1673,8 @@ gst_audio_cd_src_stop (GstBaseSrc * basesrc) src->tags = NULL; } + gst_event_replace (&src->priv->toc_event, NULL); + if (src->priv->toc) { gst_toc_unref (src->priv->toc); src->priv->toc = NULL; @@ -1721,6 +1725,11 @@ gst_audio_cd_src_create (GstPushSrc * pushsrc, GstBuffer ** buffer) return GST_FLOW_EOS; } + if (src->priv->toc_event != NULL) { + gst_pad_push_event (GST_BASE_SRC_PAD (src), src->priv->toc_event); + src->priv->toc_event = NULL; + } + if (src->priv->prev_track != src->priv->cur_track) { GstTagList *tags; -- 2.7.4