mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-11 09:55:36 +00:00
playback: When going from NULL->READY check if the registry has new features
This makes it possible to use newly installed plugins after going back to NULL instead of requiring a new instance. Fixes bug #599266.
This commit is contained in:
parent
8c76ae5fa9
commit
ab96265c57
3 changed files with 38 additions and 0 deletions
|
@ -149,6 +149,7 @@ struct _GstDecodeBin
|
||||||
GstDecodeChain *decode_chain; /* Top level decode chain */
|
GstDecodeChain *decode_chain; /* Top level decode chain */
|
||||||
gint nbpads; /* unique identifier for source pads */
|
gint nbpads; /* unique identifier for source pads */
|
||||||
|
|
||||||
|
guint32 factories_cookie; /* Cookie from last time when factories was updated */
|
||||||
GValueArray *factories; /* factories we can use for selecting elements */
|
GValueArray *factories; /* factories we can use for selecting elements */
|
||||||
|
|
||||||
GMutex *subtitle_lock; /* Protects changes to subtitles and encoding */
|
GMutex *subtitle_lock; /* Protects changes to subtitles and encoding */
|
||||||
|
@ -845,6 +846,8 @@ gst_decode_bin_init (GstDecodeBin * decode_bin)
|
||||||
/* first filter out the interesting element factories */
|
/* first filter out the interesting element factories */
|
||||||
decode_bin->factories =
|
decode_bin->factories =
|
||||||
gst_factory_list_get_elements (GST_FACTORY_LIST_DECODER);
|
gst_factory_list_get_elements (GST_FACTORY_LIST_DECODER);
|
||||||
|
decode_bin->factories_cookie =
|
||||||
|
gst_default_registry_get_feature_list_cookie ();
|
||||||
|
|
||||||
/* we create the typefind element only once */
|
/* we create the typefind element only once */
|
||||||
decode_bin->typefind = gst_element_factory_make ("typefind", "typefind");
|
decode_bin->typefind = gst_element_factory_make ("typefind", "typefind");
|
||||||
|
@ -3229,6 +3232,15 @@ gst_decode_bin_change_state (GstElement * element, GstStateChange transition)
|
||||||
case GST_STATE_CHANGE_NULL_TO_READY:
|
case GST_STATE_CHANGE_NULL_TO_READY:
|
||||||
if (dbin->typefind == NULL)
|
if (dbin->typefind == NULL)
|
||||||
goto missing_typefind;
|
goto missing_typefind;
|
||||||
|
if (dbin->factories_cookie !=
|
||||||
|
gst_default_registry_get_feature_list_cookie ()) {
|
||||||
|
if (dbin->factories)
|
||||||
|
g_value_array_free (dbin->factories);
|
||||||
|
dbin->factories =
|
||||||
|
gst_factory_list_get_elements (GST_FACTORY_LIST_DECODER);
|
||||||
|
dbin->factories_cookie =
|
||||||
|
gst_default_registry_get_feature_list_cookie ();
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case GST_STATE_CHANGE_READY_TO_PAUSED:
|
case GST_STATE_CHANGE_READY_TO_PAUSED:
|
||||||
DYN_LOCK (dbin);
|
DYN_LOCK (dbin);
|
||||||
|
|
|
@ -373,6 +373,7 @@ struct _GstPlayBin
|
||||||
/* if we are shutting down or not */
|
/* if we are shutting down or not */
|
||||||
gint shutdown;
|
gint shutdown;
|
||||||
|
|
||||||
|
guint32 elements_cookie;
|
||||||
GValueArray *elements; /* factories we can use for selecting elements */
|
GValueArray *elements; /* factories we can use for selecting elements */
|
||||||
|
|
||||||
gboolean have_selector; /* set to FALSE when we fail to create an
|
gboolean have_selector; /* set to FALSE when we fail to create an
|
||||||
|
@ -1122,6 +1123,7 @@ gst_play_bin_init (GstPlayBin * playbin)
|
||||||
/* first filter out the interesting element factories */
|
/* first filter out the interesting element factories */
|
||||||
type = GST_FACTORY_LIST_DECODER | GST_FACTORY_LIST_SINK;
|
type = GST_FACTORY_LIST_DECODER | GST_FACTORY_LIST_SINK;
|
||||||
playbin->elements = gst_factory_list_get_elements (type);
|
playbin->elements = gst_factory_list_get_elements (type);
|
||||||
|
playbin->elements_cookie = gst_default_registry_get_feature_list_cookie ();
|
||||||
gst_factory_list_debug (playbin->elements);
|
gst_factory_list_debug (playbin->elements);
|
||||||
|
|
||||||
/* add sink */
|
/* add sink */
|
||||||
|
@ -2962,6 +2964,17 @@ gst_play_bin_change_state (GstElement * element, GstStateChange transition)
|
||||||
playbin = GST_PLAY_BIN (element);
|
playbin = GST_PLAY_BIN (element);
|
||||||
|
|
||||||
switch (transition) {
|
switch (transition) {
|
||||||
|
case GST_STATE_CHANGE_NULL_TO_READY:
|
||||||
|
if (playbin->elements_cookie !=
|
||||||
|
gst_default_registry_get_feature_list_cookie ()) {
|
||||||
|
if (playbin->elements)
|
||||||
|
g_value_array_free (playbin->elements);
|
||||||
|
playbin->elements =
|
||||||
|
gst_factory_list_get_elements (GST_FACTORY_LIST_DECODER);
|
||||||
|
playbin->elements_cookie =
|
||||||
|
gst_default_registry_get_feature_list_cookie ();
|
||||||
|
}
|
||||||
|
break;
|
||||||
case GST_STATE_CHANGE_READY_TO_PAUSED:
|
case GST_STATE_CHANGE_READY_TO_PAUSED:
|
||||||
GST_LOG_OBJECT (playbin, "clearing shutdown flag");
|
GST_LOG_OBJECT (playbin, "clearing shutdown flag");
|
||||||
g_atomic_int_set (&playbin->shutdown, 0);
|
g_atomic_int_set (&playbin->shutdown, 0);
|
||||||
|
|
|
@ -68,6 +68,7 @@ struct _GstURIDecodeBin
|
||||||
|
|
||||||
GMutex *lock; /* lock for constructing */
|
GMutex *lock; /* lock for constructing */
|
||||||
|
|
||||||
|
guint32 factories_cookie;
|
||||||
GValueArray *factories; /* factories we can use for selecting elements */
|
GValueArray *factories; /* factories we can use for selecting elements */
|
||||||
|
|
||||||
gchar *uri;
|
gchar *uri;
|
||||||
|
@ -471,6 +472,7 @@ gst_uri_decode_bin_init (GstURIDecodeBin * dec, GstURIDecodeBinClass * klass)
|
||||||
{
|
{
|
||||||
/* first filter out the interesting element factories */
|
/* first filter out the interesting element factories */
|
||||||
dec->factories = gst_factory_list_get_elements (GST_FACTORY_LIST_DECODER);
|
dec->factories = gst_factory_list_get_elements (GST_FACTORY_LIST_DECODER);
|
||||||
|
dec->factories_cookie = gst_default_registry_get_feature_list_cookie ();
|
||||||
|
|
||||||
dec->lock = g_mutex_new ();
|
dec->lock = g_mutex_new ();
|
||||||
|
|
||||||
|
@ -2040,6 +2042,17 @@ gst_uri_decode_bin_change_state (GstElement * element,
|
||||||
decoder = GST_URI_DECODE_BIN (element);
|
decoder = GST_URI_DECODE_BIN (element);
|
||||||
|
|
||||||
switch (transition) {
|
switch (transition) {
|
||||||
|
case GST_STATE_CHANGE_NULL_TO_READY:
|
||||||
|
if (decoder->factories_cookie !=
|
||||||
|
gst_default_registry_get_feature_list_cookie ()) {
|
||||||
|
if (decoder->factories)
|
||||||
|
g_value_array_free (decoder->factories);
|
||||||
|
decoder->factories =
|
||||||
|
gst_factory_list_get_elements (GST_FACTORY_LIST_DECODER);
|
||||||
|
decoder->factories_cookie =
|
||||||
|
gst_default_registry_get_feature_list_cookie ();
|
||||||
|
}
|
||||||
|
break;
|
||||||
case GST_STATE_CHANGE_READY_TO_PAUSED:
|
case GST_STATE_CHANGE_READY_TO_PAUSED:
|
||||||
if (!setup_source (decoder))
|
if (!setup_source (decoder))
|
||||||
goto source_failed;
|
goto source_failed;
|
||||||
|
|
Loading…
Reference in a new issue