More playback updates, attempt to fix things after the state change breakage.

Original commit message from CVS:
* examples/seeking/seek.c: (update_scale), (main):
* gst/playback/gstdecodebin.c: (gst_decode_bin_get_type),
(gst_decode_bin_class_init), (gst_decode_bin_is_dynamic),
(gst_decode_bin_factory_filter), (compare_ranks), (print_feature),
(gst_decode_bin_init), (gst_decode_bin_dispose),
(find_compatibles), (close_pad_link), (try_to_link_1), (new_pad),
(no_more_pads), (close_link), (type_found),
(gst_decode_bin_set_property), (gst_decode_bin_get_property),
(plugin_init):
* gst/playback/gstplaybasebin.c: (gst_play_base_bin_get_type),
(gst_play_base_bin_class_init), (gst_play_base_bin_init),
(gst_play_base_bin_dispose), (queue_overrun),
(gen_preroll_element), (remove_prerolls), (unknown_type),
(no_more_pads), (new_stream), (setup_source),
(gst_play_base_bin_set_property), (gst_play_base_bin_get_property),
(play_base_eos), (gst_play_base_bin_change_state),
(gst_play_base_bin_add_element),
(gst_play_base_bin_remove_element),
(gst_play_base_bin_mute_stream), (gst_play_base_bin_link_stream),
(gst_play_base_bin_unlink_stream),
(gst_play_base_bin_get_streaminfo):
* gst/playback/gstplaybin.c: (gen_video_element),
(gen_audio_element):
* gst/playback/gststreaminfo.h:
More playback updates, attempt to fix things after the state change
breakage.
This commit is contained in:
Wim Taymans 2004-07-22 16:44:58 +00:00
parent e9bc7e575b
commit 0edbb4a19d
7 changed files with 77 additions and 24 deletions

View file

@ -1,3 +1,32 @@
2004-07-22 Wim Taymans <wim@fluendo.com>
* examples/seeking/seek.c: (update_scale), (main):
* gst/playback/gstdecodebin.c: (gst_decode_bin_get_type),
(gst_decode_bin_class_init), (gst_decode_bin_is_dynamic),
(gst_decode_bin_factory_filter), (compare_ranks), (print_feature),
(gst_decode_bin_init), (gst_decode_bin_dispose),
(find_compatibles), (close_pad_link), (try_to_link_1), (new_pad),
(no_more_pads), (close_link), (type_found),
(gst_decode_bin_set_property), (gst_decode_bin_get_property),
(plugin_init):
* gst/playback/gstplaybasebin.c: (gst_play_base_bin_get_type),
(gst_play_base_bin_class_init), (gst_play_base_bin_init),
(gst_play_base_bin_dispose), (queue_overrun),
(gen_preroll_element), (remove_prerolls), (unknown_type),
(no_more_pads), (new_stream), (setup_source),
(gst_play_base_bin_set_property), (gst_play_base_bin_get_property),
(play_base_eos), (gst_play_base_bin_change_state),
(gst_play_base_bin_add_element),
(gst_play_base_bin_remove_element),
(gst_play_base_bin_mute_stream), (gst_play_base_bin_link_stream),
(gst_play_base_bin_unlink_stream),
(gst_play_base_bin_get_streaminfo):
* gst/playback/gstplaybin.c: (gen_video_element),
(gen_audio_element):
* gst/playback/gststreaminfo.h:
More playback updates, attempt to fix things after the state change
breakage.
2004-07-22 Thomas Vander Stichele <thomas at apestaart dot org>
* gst/videoscale/videoscale.c: (gst_videoscale_planar411),

View file

@ -755,6 +755,7 @@ update_scale (gpointer data)
GstClock *clock;
guint64 position;
GstFormat format = GST_FORMAT_TIME;
gboolean res;
duration = 0;
clock = gst_bin_get_clock (GST_BIN (pipeline));
@ -763,15 +764,23 @@ update_scale (gpointer data)
if (seekable_elements) {
GstElement *element = GST_ELEMENT (seekable_elements->data);
gst_element_query (element, GST_QUERY_TOTAL, &format, &duration);
gst_element_query (element, GST_QUERY_POSITION, &format, &position);
res = gst_element_query (element, GST_QUERY_TOTAL, &format, &duration);
if (!res)
duration = 0;
res = gst_element_query (element, GST_QUERY_POSITION, &format, &position);
if (!res)
position = 0;
}
} else {
if (seekable_pads) {
GstPad *pad = GST_PAD (seekable_pads->data);
gst_pad_query (pad, GST_QUERY_TOTAL, &format, &duration);
gst_pad_query (pad, GST_QUERY_POSITION, &format, &position);
res = gst_pad_query (pad, GST_QUERY_TOTAL, &format, &duration);
if (!res)
duration = 0;
res = gst_pad_query (pad, GST_QUERY_POSITION, &format, &position);
if (!res)
position = 0;
}
}

View file

@ -232,7 +232,7 @@ compare_ranks (GstPluginFeature * f1, GstPluginFeature * f2)
static void
print_feature (GstPluginFeature * feature)
{
GST_DEBUG ("%s\n", gst_plugin_feature_get_name (feature));
GST_DEBUG ("%s", gst_plugin_feature_get_name (feature));
}
static void
@ -383,14 +383,14 @@ try_to_link_1 (GstDecodeBin * decode_bin, GstPad * pad, GList * factories)
GstElement *element;
gboolean ret;
GST_DEBUG ("trying to link %s\n",
GST_DEBUG ("trying to link %s",
gst_plugin_feature_get_name (GST_PLUGIN_FEATURE (factory)));
element = gst_element_factory_create (factory, NULL);
if (element == NULL)
continue;
GST_DEBUG ("adding %s\n", gst_element_get_name (element));
GST_DEBUG ("adding %s", gst_element_get_name (element));
gst_bin_add (GST_BIN (decode_bin), element);
decode_bin->elements = g_list_prepend (decode_bin->elements, element);
@ -428,7 +428,7 @@ no_more_pads (GstElement * element, GstDynamic * dynamic)
{
GstDecodeBin *decode_bin = dynamic->decode_bin;
GST_DEBUG ("decodebin: no more pads\n");
GST_DEBUG ("decodebin: no more pads");
g_signal_handler_disconnect (G_OBJECT (dynamic->element), dynamic->np_sig_id);
g_signal_handler_disconnect (G_OBJECT (dynamic->element),

View file

@ -64,7 +64,10 @@ static void gst_play_base_bin_add_element (GstBin * bin, GstElement * element);
static void gst_play_base_bin_remove_element (GstBin * bin,
GstElement * element);
extern GstElementStateReturn gst_element_set_state_func (GstElement * element,
GstElementState state);
static GstElementClass *element_class;
static GstElementClass *parent_class;
static guint gst_play_base_bin_signals[LAST_SIGNAL] = { 0 };
@ -105,6 +108,7 @@ gst_play_base_bin_class_init (GstPlayBaseBinClass * klass)
gstelement_klass = (GstElementClass *) klass;
gstbin_klass = (GstBinClass *) klass;
element_class = g_type_class_ref (gst_element_get_type ());
parent_class = g_type_class_ref (gst_bin_get_type ());
gobject_klass->set_property = gst_play_base_bin_set_property;
@ -144,6 +148,8 @@ gst_play_base_bin_class_init (GstPlayBaseBinClass * klass)
gobject_klass->dispose = GST_DEBUG_FUNCPTR (gst_play_base_bin_dispose);
/* we handle state changes like an element */
gstelement_klass->set_state = GST_ELEMENT_CLASS (element_class)->set_state;
gstelement_klass->change_state =
GST_DEBUG_FUNCPTR (gst_play_base_bin_change_state);
@ -250,7 +256,7 @@ unknown_type (GstElement * element, GstCaps * caps,
static void
no_more_pads (GstElement * element, GstPlayBaseBin * play_base_bin)
{
GST_DEBUG ("no more pads\n");
GST_DEBUG ("no more pads");
g_mutex_lock (play_base_bin->preroll_lock);
g_cond_signal (play_base_bin->preroll_cond);
g_mutex_unlock (play_base_bin->preroll_lock);
@ -268,12 +274,12 @@ new_stream (GstElement * element, GstPad * pad, gboolean last,
GstStreamType type;
GstPad *srcpad;
GST_DEBUG ("play base: new stream\n");
GST_DEBUG ("play base: new stream");
caps = gst_pad_get_caps (pad);
if (gst_caps_is_empty (caps)) {
g_warning ("no type on pad %s:%s\n", GST_DEBUG_PAD_NAME (pad));
g_warning ("no type on pad %s:%s", GST_DEBUG_PAD_NAME (pad));
return;
}
@ -303,7 +309,7 @@ new_stream (GstElement * element, GstPad * pad, gboolean last,
g_list_prepend (play_base_bin->preroll_elems, new_element);
gst_pad_link (pad, gst_element_get_pad (new_element, "sink"));
gst_element_sync_state_with_parent (new_element);
gst_element_set_state (new_element, GST_STATE_PAUSED);
}
info = gst_stream_info_new (srcpad, type, NULL);
@ -481,8 +487,7 @@ gst_play_base_bin_change_state (GstElement * element)
if (sched) {
gst_element_set_scheduler (play_base_bin->thread, sched);
gst_object_set_parent (GST_OBJECT (play_base_bin->thread),
GST_OBJECT (play_base_bin));
//gst_object_set_parent (GST_OBJECT (play_base_bin->thread), GST_OBJECT (play_base_bin));
gst_element_set_state (play_base_bin->thread, GST_STATE_READY);
@ -599,7 +604,7 @@ void
gst_play_base_bin_mute_stream (GstPlayBaseBin * play_base_bin,
GstStreamInfo * info, gboolean mute)
{
GST_DEBUG ("mute\n");
GST_DEBUG ("mute");
}
void
@ -624,11 +629,11 @@ gst_play_base_bin_link_stream (GstPlayBaseBin * play_base_bin,
}
if (info) {
if (!gst_pad_link (info->pad, pad)) {
GST_DEBUG ("could not link\n");
GST_DEBUG ("could not link");
gst_play_base_bin_mute_stream (play_base_bin, info, TRUE);
}
} else {
GST_DEBUG ("could not find pad to link\n");
GST_DEBUG ("could not find pad to link");
}
}
@ -636,7 +641,7 @@ void
gst_play_base_bin_unlink_stream (GstPlayBaseBin * play_base_bin,
GstStreamInfo * info)
{
GST_DEBUG ("unlink\n");
GST_DEBUG ("unlink");
}
const GList *

View file

@ -261,7 +261,7 @@ gen_video_element (GstPlayBin * play_bin)
GstElement *sink;
element = gst_bin_new ("vbin");
conv = gst_element_factory_make ("ffmpegcolorspace", "conv");
conv = gst_element_factory_make ("ffmpegcolorspace", "vconv");
if (play_bin->video_sink) {
sink = play_bin->video_sink;
} else {
@ -288,7 +288,7 @@ gen_audio_element (GstPlayBin * play_bin)
GstElement *sink;
element = gst_bin_new ("abin");
conv = gst_element_factory_make ("audioconvert", "conv");
conv = gst_element_factory_make ("audioconvert", "aconv");
if (play_bin->audio_sink) {
sink = play_bin->audio_sink;
} else {

View file

@ -38,6 +38,7 @@ typedef enum {
GST_STREAM_TYPE_UNKNOWN = 0,
GST_STREAM_TYPE_AUDIO = 1,
GST_STREAM_TYPE_VIDEO = 2,
GST_STREAM_TYPE_TEXT = 3,
} GstStreamType;
struct _GstStreamInfo {

View file

@ -755,6 +755,7 @@ update_scale (gpointer data)
GstClock *clock;
guint64 position;
GstFormat format = GST_FORMAT_TIME;
gboolean res;
duration = 0;
clock = gst_bin_get_clock (GST_BIN (pipeline));
@ -763,15 +764,23 @@ update_scale (gpointer data)
if (seekable_elements) {
GstElement *element = GST_ELEMENT (seekable_elements->data);
gst_element_query (element, GST_QUERY_TOTAL, &format, &duration);
gst_element_query (element, GST_QUERY_POSITION, &format, &position);
res = gst_element_query (element, GST_QUERY_TOTAL, &format, &duration);
if (!res)
duration = 0;
res = gst_element_query (element, GST_QUERY_POSITION, &format, &position);
if (!res)
position = 0;
}
} else {
if (seekable_pads) {
GstPad *pad = GST_PAD (seekable_pads->data);
gst_pad_query (pad, GST_QUERY_TOTAL, &format, &duration);
gst_pad_query (pad, GST_QUERY_POSITION, &format, &position);
res = gst_pad_query (pad, GST_QUERY_TOTAL, &format, &duration);
if (!res)
duration = 0;
res = gst_pad_query (pad, GST_QUERY_POSITION, &format, &position);
if (!res)
position = 0;
}
}