gst/playback/gstplaybin2.c: Add some debug info.

Original commit message from CVS:
* gst/playback/gstplaybin2.c: (no_more_pads_cb):
Add some debug info.
* gst/playback/gstplaysink.c: (gen_video_chain), (gen_audio_chain),
(gst_play_sink_reconfigure), (gst_play_sink_request_pad),
(gst_play_sink_release_pad):
Add some more debug info.
Reconfigure the audio chain when we switch between raw and encoded audio
in gapless playback.
This commit is contained in:
Wim Taymans 2008-12-20 12:48:43 +00:00
parent a579eba73d
commit dba6f1f28c
3 changed files with 75 additions and 14 deletions

View file

@ -1,3 +1,15 @@
2008-12-20 Wim Taymans <wim.taymans@collabora.co.uk>
* gst/playback/gstplaybin2.c: (no_more_pads_cb):
Add some debug info.
* gst/playback/gstplaysink.c: (gen_video_chain), (gen_audio_chain),
(gst_play_sink_reconfigure), (gst_play_sink_request_pad),
(gst_play_sink_release_pad):
Add some more debug info.
Reconfigure the audio chain when we switch between raw and encoded audio
in gapless playback.
2008-12-20 Wim Taymans <wim.taymans@collabora.co.uk> 2008-12-20 Wim Taymans <wim.taymans@collabora.co.uk>
* gst-libs/gst/audio/gstbaseaudiosink.c: * gst-libs/gst/audio/gstbaseaudiosink.c:

View file

@ -1876,6 +1876,7 @@ no_more_pads_cb (GstElement * decodebin, GstSourceGroup * group)
* and link it. We only do this if we have not yet requested the sinkpad * and link it. We only do this if we have not yet requested the sinkpad
* before. */ * before. */
if (select->selector && select->sinkpad == NULL) { if (select->selector && select->sinkpad == NULL) {
GST_DEBUG_OBJECT (playbin, "requesting new sink pad %d", select->type);
select->sinkpad = select->sinkpad =
gst_play_sink_request_pad (playbin->playsink, select->type); gst_play_sink_request_pad (playbin->playsink, select->type);
res = gst_pad_link (select->srcpad, select->sinkpad); res = gst_pad_link (select->srcpad, select->sinkpad);
@ -1892,8 +1893,10 @@ no_more_pads_cb (GstElement * decodebin, GstSourceGroup * group)
if (group->pending == 0) { if (group->pending == 0) {
/* we are the last group to complete, we will configure the output and then /* we are the last group to complete, we will configure the output and then
* signal the other waiters. */ * signal the other waiters. */
GST_LOG_OBJECT (playbin, "last group complete");
configure = TRUE; configure = TRUE;
} else { } else {
GST_LOG_OBJECT (playbin, "have more pending groups");
configure = FALSE; configure = FALSE;
/* check if there are more decodebins to wait for */ /* check if there are more decodebins to wait for */
while (group->pending) { while (group->pending) {
@ -1906,6 +1909,7 @@ no_more_pads_cb (GstElement * decodebin, GstSourceGroup * group)
GST_SOURCE_GROUP_UNLOCK (group); GST_SOURCE_GROUP_UNLOCK (group);
if (configure) { if (configure) {
GST_LOG_OBJECT (playbin, "reconfigure sink");
/* we configure the modes if we were the last decodebin to complete. */ /* we configure the modes if we were the last decodebin to complete. */
gst_play_sink_reconfigure (playbin->playsink); gst_play_sink_reconfigure (playbin->playsink);

View file

@ -44,6 +44,7 @@ typedef struct
GstElement *bin; GstElement *bin;
gboolean added; gboolean added;
gboolean activated; gboolean activated;
gboolean raw;
} GstPlayChain; } GstPlayChain;
typedef struct typedef struct
@ -651,6 +652,7 @@ gen_video_chain (GstPlaySink * playsink, gboolean raw, gboolean async)
chain = g_new0 (GstPlayVideoChain, 1); chain = g_new0 (GstPlayVideoChain, 1);
chain->chain.playsink = gst_object_ref (playsink); chain->chain.playsink = gst_object_ref (playsink);
chain->chain.raw = raw;
GST_DEBUG_OBJECT (playsink, "making video chain %p", chain); GST_DEBUG_OBJECT (playsink, "making video chain %p", chain);
@ -882,6 +884,7 @@ gen_audio_chain (GstPlaySink * playsink, gboolean raw, gboolean queue)
chain = g_new0 (GstPlayAudioChain, 1); chain = g_new0 (GstPlayAudioChain, 1);
chain->chain.playsink = gst_object_ref (playsink); chain->chain.playsink = gst_object_ref (playsink);
chain->chain.raw = raw;
GST_DEBUG_OBJECT (playsink, "making audio chain %p", chain); GST_DEBUG_OBJECT (playsink, "making audio chain %p", chain);
@ -1231,6 +1234,7 @@ gst_play_sink_reconfigure (GstPlaySink * playsink)
playsink->videochain = gen_video_chain (playsink, raw, async); playsink->videochain = gen_video_chain (playsink, raw, async);
} }
if (playsink->videochain) { if (playsink->videochain) {
GST_DEBUG_OBJECT (playsink, "adding video chain");
add_chain (GST_PLAY_CHAIN (playsink->videochain), TRUE); add_chain (GST_PLAY_CHAIN (playsink->videochain), TRUE);
activate_chain (GST_PLAY_CHAIN (playsink->videochain), TRUE); activate_chain (GST_PLAY_CHAIN (playsink->videochain), TRUE);
/* if we are not part of vis or subtitles, set the ghostpad target */ /* if we are not part of vis or subtitles, set the ghostpad target */
@ -1241,7 +1245,9 @@ gst_play_sink_reconfigure (GstPlaySink * playsink)
} }
} }
} else { } else {
GST_DEBUG_OBJECT (playsink, "no video needed");
if (playsink->videochain) { if (playsink->videochain) {
GST_DEBUG_OBJECT (playsink, "removing video chain");
add_chain (GST_PLAY_CHAIN (playsink->videochain), FALSE); add_chain (GST_PLAY_CHAIN (playsink->videochain), FALSE);
activate_chain (GST_PLAY_CHAIN (playsink->videochain), FALSE); activate_chain (GST_PLAY_CHAIN (playsink->videochain), FALSE);
} }
@ -1252,9 +1258,11 @@ gst_play_sink_reconfigure (GstPlaySink * playsink)
if (need_text) { if (need_text) {
GST_DEBUG_OBJECT (playsink, "adding text"); GST_DEBUG_OBJECT (playsink, "adding text");
if (!playsink->textchain) { if (!playsink->textchain) {
GST_DEBUG_OBJECT (playsink, "creating text chain");
playsink->textchain = gen_text_chain (playsink); playsink->textchain = gen_text_chain (playsink);
} }
if (playsink->textchain) { if (playsink->textchain) {
GST_DEBUG_OBJECT (playsink, "adding text chain");
add_chain (GST_PLAY_CHAIN (playsink->textchain), TRUE); add_chain (GST_PLAY_CHAIN (playsink->textchain), TRUE);
gst_ghost_pad_set_target (GST_GHOST_PAD_CAST (playsink->text_pad), gst_ghost_pad_set_target (GST_GHOST_PAD_CAST (playsink->text_pad),
playsink->textchain->textsinkpad); playsink->textchain->textsinkpad);
@ -1264,8 +1272,10 @@ gst_play_sink_reconfigure (GstPlaySink * playsink)
activate_chain (GST_PLAY_CHAIN (playsink->textchain), TRUE); activate_chain (GST_PLAY_CHAIN (playsink->textchain), TRUE);
} }
} else { } else {
GST_DEBUG_OBJECT (playsink, "no text needed");
/* we have no subtitles/text or we are requested to not show them */ /* we have no subtitles/text or we are requested to not show them */
if (playsink->textchain) { if (playsink->textchain) {
GST_DEBUG_OBJECT (playsink, "removing text chain");
add_chain (GST_PLAY_CHAIN (playsink->textchain), FALSE); add_chain (GST_PLAY_CHAIN (playsink->textchain), FALSE);
activate_chain (GST_PLAY_CHAIN (playsink->textchain), FALSE); activate_chain (GST_PLAY_CHAIN (playsink->textchain), FALSE);
} }
@ -1276,34 +1286,56 @@ gst_play_sink_reconfigure (GstPlaySink * playsink)
} }
if (need_audio) { if (need_audio) {
gboolean create_chain = FALSE;
gboolean raw, queue;
GST_DEBUG_OBJECT (playsink, "adding audio"); GST_DEBUG_OBJECT (playsink, "adding audio");
/* get a raw sink if we are asked for a raw pad */
raw = playsink->audio_pad_raw;
if (need_vis && playsink->videochain) {
/* If we are dealing with visualisations, we need to add a queue to
* decouple the audio from the video part. We only have to do this when
* the video part is async=true */
queue = ((GstPlayVideoChain *) playsink->videochain)->async;
GST_DEBUG_OBJECT (playsink, "need audio queue for vis: %d", queue);
} else {
/* no vis, we can avoid a queue */
GST_DEBUG_OBJECT (playsink, "don't need audio queue");
queue = FALSE;
}
if (!playsink->audiochain) { if (!playsink->audiochain) {
gboolean raw, queue; /* create chain if we don't already have one */
create_chain = TRUE;
/* get a raw sink if we are asked for a raw pad */ } else {
raw = playsink->audio_pad_raw; /* we have a chain, check if it's also raw */
if (need_vis) { if (playsink->audiochain->chain.raw != raw) {
/* If we are dealing with visualisations, we need to add a queue to GST_DEBUG_OBJECT (playsink, "removing current audio chain");
* decouple the audio from the video part. We only have to do this when gst_pad_unlink (playsink->audio_tee_asrc,
* the video part is async=true */ playsink->audiochain->sinkpad);
queue = ((GstPlayVideoChain *) playsink->videochain)->async; add_chain (GST_PLAY_CHAIN (playsink->audiochain), FALSE);
GST_DEBUG_OBJECT (playsink, "need audio queue for vis: %d", queue); activate_chain (GST_PLAY_CHAIN (playsink->audiochain), FALSE);
} else { create_chain = TRUE;
/* no vis, we can avoid a queue */
GST_DEBUG_OBJECT (playsink, "don't need audio queue");
queue = FALSE;
} }
}
if (create_chain) {
GST_DEBUG_OBJECT (playsink, "creating new audio chain");
playsink->audiochain = gen_audio_chain (playsink, raw, queue); playsink->audiochain = gen_audio_chain (playsink, raw, queue);
} }
if (playsink->audiochain) { if (playsink->audiochain) {
GST_DEBUG_OBJECT (playsink, "adding audio chain");
add_chain (GST_PLAY_CHAIN (playsink->audiochain), TRUE); add_chain (GST_PLAY_CHAIN (playsink->audiochain), TRUE);
gst_pad_link (playsink->audio_tee_asrc, playsink->audiochain->sinkpad); gst_pad_link (playsink->audio_tee_asrc, playsink->audiochain->sinkpad);
activate_chain (GST_PLAY_CHAIN (playsink->audiochain), TRUE); activate_chain (GST_PLAY_CHAIN (playsink->audiochain), TRUE);
} }
} else { } else {
GST_DEBUG_OBJECT (playsink, "no audio needed");
/* we have no audio or we are requested to not play audio */ /* we have no audio or we are requested to not play audio */
if (playsink->audiochain) { if (playsink->audiochain) {
GST_DEBUG_OBJECT (playsink, "removing audio chain");
gst_pad_unlink (playsink->audio_tee_asrc, playsink->audiochain->sinkpad); gst_pad_unlink (playsink->audio_tee_asrc, playsink->audiochain->sinkpad);
add_chain (GST_PLAY_CHAIN (playsink->audiochain), FALSE); add_chain (GST_PLAY_CHAIN (playsink->audiochain), FALSE);
activate_chain (GST_PLAY_CHAIN (playsink->audiochain), FALSE); activate_chain (GST_PLAY_CHAIN (playsink->audiochain), FALSE);
@ -1319,6 +1351,7 @@ gst_play_sink_reconfigure (GstPlaySink * playsink)
GST_DEBUG_OBJECT (playsink, "adding visualisation"); GST_DEBUG_OBJECT (playsink, "adding visualisation");
if (playsink->vischain) { if (playsink->vischain) {
GST_DEBUG_OBJECT (playsink, "setting up vis chain");
srcpad = srcpad =
gst_element_get_static_pad (GST_ELEMENT_CAST (playsink->vischain-> gst_element_get_static_pad (GST_ELEMENT_CAST (playsink->vischain->
chain.bin), "src"); chain.bin), "src");
@ -1329,7 +1362,9 @@ gst_play_sink_reconfigure (GstPlaySink * playsink)
activate_chain (GST_PLAY_CHAIN (playsink->vischain), TRUE); activate_chain (GST_PLAY_CHAIN (playsink->vischain), TRUE);
} }
} else { } else {
GST_DEBUG_OBJECT (playsink, "no vis needed");
if (playsink->vischain) { if (playsink->vischain) {
GST_DEBUG_OBJECT (playsink, "removing vis chain");
add_chain (GST_PLAY_CHAIN (playsink->vischain), FALSE); add_chain (GST_PLAY_CHAIN (playsink->vischain), FALSE);
activate_chain (GST_PLAY_CHAIN (playsink->vischain), FALSE); activate_chain (GST_PLAY_CHAIN (playsink->vischain), FALSE);
} }
@ -1487,12 +1522,15 @@ gst_play_sink_request_pad (GstPlaySink * playsink, GstPlaySinkType type)
gboolean created = FALSE; gboolean created = FALSE;
gboolean raw = FALSE; gboolean raw = FALSE;
GST_DEBUG_OBJECT (playsink, "request pad type %d", type);
GST_PLAY_SINK_LOCK (playsink); GST_PLAY_SINK_LOCK (playsink);
switch (type) { switch (type) {
case GST_PLAY_SINK_TYPE_AUDIO_RAW: case GST_PLAY_SINK_TYPE_AUDIO_RAW:
raw = TRUE; raw = TRUE;
case GST_PLAY_SINK_TYPE_AUDIO: case GST_PLAY_SINK_TYPE_AUDIO:
if (!playsink->audio_tee) { if (!playsink->audio_tee) {
GST_LOG_OBJECT (playsink, "creating tee");
/* create tee when needed. This element will feed the audio sink chain /* create tee when needed. This element will feed the audio sink chain
* and the vis chain. */ * and the vis chain. */
playsink->audio_tee = gst_element_factory_make ("tee", "audiotee"); playsink->audio_tee = gst_element_factory_make ("tee", "audiotee");
@ -1507,6 +1545,7 @@ gst_play_sink_request_pad (GstPlaySink * playsink, GstPlaySinkType type)
gst_element_set_state (playsink->audio_tee, GST_STATE_PAUSED); gst_element_set_state (playsink->audio_tee, GST_STATE_PAUSED);
} }
if (!playsink->audio_pad) { if (!playsink->audio_pad) {
GST_LOG_OBJECT (playsink, "ghosting tee sinkpad");
playsink->audio_pad = playsink->audio_pad =
gst_ghost_pad_new ("audio_sink", playsink->audio_tee_sink); gst_ghost_pad_new ("audio_sink", playsink->audio_tee_sink);
created = TRUE; created = TRUE;
@ -1518,6 +1557,7 @@ gst_play_sink_request_pad (GstPlaySink * playsink, GstPlaySinkType type)
raw = TRUE; raw = TRUE;
case GST_PLAY_SINK_TYPE_VIDEO: case GST_PLAY_SINK_TYPE_VIDEO:
if (!playsink->video_pad) { if (!playsink->video_pad) {
GST_LOG_OBJECT (playsink, "ghosting videosink");
playsink->video_pad = playsink->video_pad =
gst_ghost_pad_new_no_target ("video_sink", GST_PAD_SINK); gst_ghost_pad_new_no_target ("video_sink", GST_PAD_SINK);
created = TRUE; created = TRUE;
@ -1526,6 +1566,7 @@ gst_play_sink_request_pad (GstPlaySink * playsink, GstPlaySinkType type)
res = playsink->video_pad; res = playsink->video_pad;
break; break;
case GST_PLAY_SINK_TYPE_TEXT: case GST_PLAY_SINK_TYPE_TEXT:
GST_LOG_OBJECT (playsink, "ghosting text");
if (!playsink->text_pad) { if (!playsink->text_pad) {
playsink->text_pad = playsink->text_pad =
gst_ghost_pad_new_no_target ("text_sink", GST_PAD_SINK); gst_ghost_pad_new_no_target ("text_sink", GST_PAD_SINK);
@ -1552,6 +1593,8 @@ gst_play_sink_release_pad (GstPlaySink * playsink, GstPad * pad)
{ {
GstPad **res = NULL; GstPad **res = NULL;
GST_DEBUG_OBJECT (playsink, "release pad %" GST_PTR_FORMAT, pad);
GST_PLAY_SINK_LOCK (playsink); GST_PLAY_SINK_LOCK (playsink);
if (pad == playsink->video_pad) { if (pad == playsink->video_pad) {
res = &playsink->video_pad; res = &playsink->video_pad;
@ -1563,7 +1606,9 @@ gst_play_sink_release_pad (GstPlaySink * playsink, GstPad * pad)
GST_PLAY_SINK_UNLOCK (playsink); GST_PLAY_SINK_UNLOCK (playsink);
if (*res) { if (*res) {
GST_DEBUG_OBJECT (playsink, "deactivate pad %" GST_PTR_FORMAT, *res);
gst_pad_set_active (*res, FALSE); gst_pad_set_active (*res, FALSE);
GST_DEBUG_OBJECT (playsink, "remove pad %" GST_PTR_FORMAT, *res);
gst_element_remove_pad (GST_ELEMENT_CAST (playsink), *res); gst_element_remove_pad (GST_ELEMENT_CAST (playsink), *res);
*res = NULL; *res = NULL;
} }