gst/playback/: Don't try to preroll or decode more than one audio/video track.

Original commit message from CVS:
* gst/playback/gstplaybasebin.c: (remove_prerolls),
(new_decoded_pad):
* gst/playback/gstplaybasebin.h:
* gst/playback/gstplaybin.c: (setup_sinks):
Don't try to preroll or decode more than one audio/video
track.
This commit is contained in:
Wim Taymans 2004-09-24 16:38:28 +00:00
parent 05090d3025
commit 26f9ce012c
4 changed files with 49 additions and 4 deletions

View file

@ -1,3 +1,12 @@
2004-09-24 Wim Taymans <wim@fluendo.com>
* gst/playback/gstplaybasebin.c: (remove_prerolls),
(new_decoded_pad):
* gst/playback/gstplaybasebin.h:
* gst/playback/gstplaybin.c: (setup_sinks):
Don't try to preroll or decode more than one audio/video
track.
2004-09-24 Ronald S. Bultje <rbultje@ronald.bitfreak.net>
* gst/playback/gstplaybasebin.c: (gst_play_base_bin_change_state):

View file

@ -250,6 +250,9 @@ remove_prerolls (GstPlayBaseBin * play_base_bin)
g_list_free (play_base_bin->streaminfo);
play_base_bin->streaminfo = NULL;
play_base_bin->nstreams = 0;
play_base_bin->naudiopads = 0;
play_base_bin->nvideopads = 0;
play_base_bin->nunknownpads = 0;
}
static void
@ -285,6 +288,7 @@ new_decoded_pad (GstElement * element, GstPad * pad, gboolean last,
GstStreamInfo *info;
GstStreamType type;
GstPad *srcpad;
gboolean need_preroll;
GST_DEBUG ("play base: new decoded pad");
@ -300,17 +304,31 @@ new_decoded_pad (GstElement * element, GstPad * pad, gboolean last,
play_base_bin->nstreams++;
need_preroll = FALSE;
if (g_str_has_prefix (mimetype, "audio/")) {
type = GST_STREAM_TYPE_AUDIO;
play_base_bin->naudiopads++;
/* first audio pad gets a preroll element */
if (play_base_bin->naudiopads == 1) {
need_preroll = TRUE;
}
} else if (g_str_has_prefix (mimetype, "video/")) {
type = GST_STREAM_TYPE_VIDEO;
play_base_bin->nvideopads++;
/* first video pad gets a preroll element */
if (play_base_bin->nvideopads == 1) {
need_preroll = TRUE;
}
} else {
type = GST_STREAM_TYPE_UNKNOWN;
play_base_bin->nunknownpads++;
}
if (last) {
if (last || !need_preroll) {
srcpad = pad;
no_more_pads (NULL, play_base_bin);
if (last)
no_more_pads (NULL, play_base_bin);
} else {
new_element = gen_preroll_element (play_base_bin, pad);
srcpad = gst_element_get_pad (new_element, "src");

View file

@ -55,6 +55,10 @@ struct _GstPlayBaseBin {
gint nstreams;
GList *streaminfo;
gint naudiopads;
gint nvideopads;
gint nunknownpads;
/* list of usable factories */
GList *factories;
};

View file

@ -368,6 +368,8 @@ setup_sinks (GstPlayBin * play_bin)
{
GList *streaminfo;
GList *s;
gboolean have_audio = FALSE;
gboolean have_video = FALSE;
/* get info about the stream */
g_object_get (G_OBJECT (play_bin), "stream-info", &streaminfo, NULL);
@ -386,9 +388,21 @@ setup_sinks (GstPlayBin * play_bin)
continue;
if (type == 1) {
sink = gen_audio_element (play_bin);
if (have_audio) {
g_warning ("two audio streams found, playing first one");
continue;
} else {
sink = gen_audio_element (play_bin);
have_audio = TRUE;
}
} else if (type == 2) {
sink = gen_video_element (play_bin);
if (have_video) {
g_warning ("two video streams found, playing first one");
continue;
} else {
sink = gen_video_element (play_bin);
have_video = TRUE;
}
} else {
g_warning ("unknown stream found");
continue;