mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-13 12:51:16 +00:00
uri-sources: Make sure to set decodebin 'caps' property
Fixes a regression where we decode streams twice, this was introduced when we started creating NLE object at GESTrackElement construct time. Fixes https://bugzilla.gnome.org/show_bug.cgi?id=769193
This commit is contained in:
parent
6762b05c19
commit
577938c9be
2 changed files with 52 additions and 4 deletions
|
@ -32,7 +32,7 @@
|
|||
|
||||
struct _GESAudioUriSourcePrivate
|
||||
{
|
||||
void *nothing;
|
||||
GstElement *decodebin; /* Reference owned by parent class */
|
||||
};
|
||||
|
||||
enum
|
||||
|
@ -41,6 +41,26 @@ enum
|
|||
PROP_URI
|
||||
};
|
||||
|
||||
static void
|
||||
ges_audio_uri_source_track_set_cb (GESAudioUriSource * self,
|
||||
GParamSpec * arg G_GNUC_UNUSED, gpointer nothing)
|
||||
{
|
||||
GESTrack *track;
|
||||
const GstCaps *caps = NULL;
|
||||
|
||||
if (!self->priv->decodebin)
|
||||
return;
|
||||
|
||||
track = ges_track_element_get_track (GES_TRACK_ELEMENT (self));
|
||||
if (!track)
|
||||
return;
|
||||
|
||||
caps = ges_track_get_caps (track);
|
||||
|
||||
GST_INFO_OBJECT (self, "Setting caps to: %" GST_PTR_FORMAT, caps);
|
||||
g_object_set (self->priv->decodebin, "caps", caps, NULL);
|
||||
}
|
||||
|
||||
/* GESSource VMethod */
|
||||
static GstElement *
|
||||
ges_audio_uri_source_create_source (GESTrackElement * trksrc)
|
||||
|
@ -54,7 +74,8 @@ ges_audio_uri_source_create_source (GESTrackElement * trksrc)
|
|||
|
||||
track = ges_track_element_get_track (trksrc);
|
||||
|
||||
decodebin = gst_element_factory_make ("uridecodebin", NULL);
|
||||
self->priv->decodebin = decodebin =
|
||||
gst_element_factory_make ("uridecodebin", NULL);
|
||||
|
||||
if (track)
|
||||
caps = ges_track_get_caps (track);
|
||||
|
@ -177,6 +198,9 @@ ges_audio_uri_source_init (GESAudioUriSource * self)
|
|||
{
|
||||
self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self,
|
||||
GES_TYPE_AUDIO_URI_SOURCE, GESAudioUriSourcePrivate);
|
||||
|
||||
g_signal_connect (self, "notify::track",
|
||||
G_CALLBACK (ges_audio_uri_source_track_set_cb), NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
|
||||
struct _GESVideoUriSourcePrivate
|
||||
{
|
||||
void *nothing;
|
||||
GstElement *decodebin; /* Reference owned by parent class */
|
||||
};
|
||||
|
||||
enum
|
||||
|
@ -43,6 +43,26 @@ enum
|
|||
PROP_URI
|
||||
};
|
||||
|
||||
static void
|
||||
ges_video_uri_source_track_set_cb (GESVideoUriSource * self,
|
||||
GParamSpec * arg G_GNUC_UNUSED, gpointer nothing)
|
||||
{
|
||||
GESTrack *track;
|
||||
const GstCaps *caps = NULL;
|
||||
|
||||
if (!self->priv->decodebin)
|
||||
return;
|
||||
|
||||
track = ges_track_element_get_track (GES_TRACK_ELEMENT (self));
|
||||
if (!track)
|
||||
return;
|
||||
|
||||
caps = ges_track_get_caps (track);
|
||||
|
||||
GST_INFO_OBJECT (self, "Setting caps to: %" GST_PTR_FORMAT, caps);
|
||||
g_object_set (self->priv->decodebin, "caps", caps, NULL);
|
||||
}
|
||||
|
||||
/* GESSource VMethod */
|
||||
static GstElement *
|
||||
ges_video_uri_source_create_source (GESTrackElement * trksrc)
|
||||
|
@ -58,7 +78,8 @@ ges_video_uri_source_create_source (GESTrackElement * trksrc)
|
|||
if (track)
|
||||
caps = ges_track_get_caps (track);
|
||||
|
||||
decodebin = gst_element_factory_make ("uridecodebin", NULL);
|
||||
decodebin = self->priv->decodebin = gst_element_factory_make ("uridecodebin",
|
||||
NULL);
|
||||
|
||||
g_object_set (decodebin, "caps", caps,
|
||||
"expose-all-streams", FALSE, "uri", self->uri, NULL);
|
||||
|
@ -178,6 +199,9 @@ ges_video_uri_source_init (GESVideoUriSource * self)
|
|||
{
|
||||
self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self,
|
||||
GES_TYPE_VIDEO_URI_SOURCE, GESVideoUriSourcePrivate);
|
||||
|
||||
g_signal_connect (self, "notify::track",
|
||||
G_CALLBACK (ges_video_uri_source_track_set_cb), NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue