mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-10-02 16:52:42 +00:00
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:
parent
05090d3025
commit
26f9ce012c
4 changed files with 49 additions and 4 deletions
|
@ -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>
|
2004-09-24 Ronald S. Bultje <rbultje@ronald.bitfreak.net>
|
||||||
|
|
||||||
* gst/playback/gstplaybasebin.c: (gst_play_base_bin_change_state):
|
* gst/playback/gstplaybasebin.c: (gst_play_base_bin_change_state):
|
||||||
|
|
|
@ -250,6 +250,9 @@ remove_prerolls (GstPlayBaseBin * play_base_bin)
|
||||||
g_list_free (play_base_bin->streaminfo);
|
g_list_free (play_base_bin->streaminfo);
|
||||||
play_base_bin->streaminfo = NULL;
|
play_base_bin->streaminfo = NULL;
|
||||||
play_base_bin->nstreams = 0;
|
play_base_bin->nstreams = 0;
|
||||||
|
play_base_bin->naudiopads = 0;
|
||||||
|
play_base_bin->nvideopads = 0;
|
||||||
|
play_base_bin->nunknownpads = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -285,6 +288,7 @@ new_decoded_pad (GstElement * element, GstPad * pad, gboolean last,
|
||||||
GstStreamInfo *info;
|
GstStreamInfo *info;
|
||||||
GstStreamType type;
|
GstStreamType type;
|
||||||
GstPad *srcpad;
|
GstPad *srcpad;
|
||||||
|
gboolean need_preroll;
|
||||||
|
|
||||||
GST_DEBUG ("play base: new decoded pad");
|
GST_DEBUG ("play base: new decoded pad");
|
||||||
|
|
||||||
|
@ -300,17 +304,31 @@ new_decoded_pad (GstElement * element, GstPad * pad, gboolean last,
|
||||||
|
|
||||||
play_base_bin->nstreams++;
|
play_base_bin->nstreams++;
|
||||||
|
|
||||||
|
need_preroll = FALSE;
|
||||||
|
|
||||||
if (g_str_has_prefix (mimetype, "audio/")) {
|
if (g_str_has_prefix (mimetype, "audio/")) {
|
||||||
type = GST_STREAM_TYPE_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/")) {
|
} else if (g_str_has_prefix (mimetype, "video/")) {
|
||||||
type = GST_STREAM_TYPE_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 {
|
} else {
|
||||||
type = GST_STREAM_TYPE_UNKNOWN;
|
type = GST_STREAM_TYPE_UNKNOWN;
|
||||||
|
play_base_bin->nunknownpads++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (last) {
|
if (last || !need_preroll) {
|
||||||
srcpad = pad;
|
srcpad = pad;
|
||||||
no_more_pads (NULL, play_base_bin);
|
if (last)
|
||||||
|
no_more_pads (NULL, play_base_bin);
|
||||||
} else {
|
} else {
|
||||||
new_element = gen_preroll_element (play_base_bin, pad);
|
new_element = gen_preroll_element (play_base_bin, pad);
|
||||||
srcpad = gst_element_get_pad (new_element, "src");
|
srcpad = gst_element_get_pad (new_element, "src");
|
||||||
|
|
|
@ -55,6 +55,10 @@ struct _GstPlayBaseBin {
|
||||||
gint nstreams;
|
gint nstreams;
|
||||||
GList *streaminfo;
|
GList *streaminfo;
|
||||||
|
|
||||||
|
gint naudiopads;
|
||||||
|
gint nvideopads;
|
||||||
|
gint nunknownpads;
|
||||||
|
|
||||||
/* list of usable factories */
|
/* list of usable factories */
|
||||||
GList *factories;
|
GList *factories;
|
||||||
};
|
};
|
||||||
|
|
|
@ -368,6 +368,8 @@ setup_sinks (GstPlayBin * play_bin)
|
||||||
{
|
{
|
||||||
GList *streaminfo;
|
GList *streaminfo;
|
||||||
GList *s;
|
GList *s;
|
||||||
|
gboolean have_audio = FALSE;
|
||||||
|
gboolean have_video = FALSE;
|
||||||
|
|
||||||
/* get info about the stream */
|
/* get info about the stream */
|
||||||
g_object_get (G_OBJECT (play_bin), "stream-info", &streaminfo, NULL);
|
g_object_get (G_OBJECT (play_bin), "stream-info", &streaminfo, NULL);
|
||||||
|
@ -386,9 +388,21 @@ setup_sinks (GstPlayBin * play_bin)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (type == 1) {
|
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) {
|
} 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 {
|
} else {
|
||||||
g_warning ("unknown stream found");
|
g_warning ("unknown stream found");
|
||||||
continue;
|
continue;
|
||||||
|
|
Loading…
Reference in a new issue