mirror of
git://source.winehq.org/git/wine.git
synced 2024-10-15 01:27:16 +00:00
winegstreamer: Introduce link_src_to_sink.
This commit is contained in:
parent
29b35f6bb7
commit
0c84f713f1
|
@ -37,6 +37,7 @@ extern GstStreamType stream_type_from_caps(GstCaps *caps) DECLSPEC_HIDDEN;
|
||||||
extern GstElement *create_element(const char *name, const char *plugin_set) DECLSPEC_HIDDEN;
|
extern GstElement *create_element(const char *name, const char *plugin_set) DECLSPEC_HIDDEN;
|
||||||
extern GstElement *find_element(GstElementFactoryListType type, GstCaps *src_caps, GstCaps *sink_caps) DECLSPEC_HIDDEN;
|
extern GstElement *find_element(GstElementFactoryListType type, GstCaps *src_caps, GstCaps *sink_caps) DECLSPEC_HIDDEN;
|
||||||
extern bool append_element(GstElement *container, GstElement *element, GstElement **first, GstElement **last) DECLSPEC_HIDDEN;
|
extern bool append_element(GstElement *container, GstElement *element, GstElement **first, GstElement **last) DECLSPEC_HIDDEN;
|
||||||
|
extern bool link_src_to_sink(GstPad *src_pad, GstPad *sink_pad) DECLSPEC_HIDDEN;
|
||||||
extern bool link_src_to_element(GstPad *src_pad, GstElement *element) DECLSPEC_HIDDEN;
|
extern bool link_src_to_element(GstPad *src_pad, GstElement *element) DECLSPEC_HIDDEN;
|
||||||
extern bool link_element_to_sink(GstElement *element, GstPad *sink_pad) DECLSPEC_HIDDEN;
|
extern bool link_element_to_sink(GstElement *element, GstPad *sink_pad) DECLSPEC_HIDDEN;
|
||||||
extern bool push_event(GstPad *pad, GstEvent *event) DECLSPEC_HIDDEN;
|
extern bool push_event(GstPad *pad, GstEvent *event) DECLSPEC_HIDDEN;
|
||||||
|
|
|
@ -162,6 +162,20 @@ bool append_element(GstElement *container, GstElement *element, GstElement **fir
|
||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool link_src_to_sink(GstPad *src_pad, GstPad *sink_pad)
|
||||||
|
{
|
||||||
|
GstPadLinkReturn ret;
|
||||||
|
|
||||||
|
if ((ret = gst_pad_link(src_pad, sink_pad)) != GST_PAD_LINK_OK)
|
||||||
|
{
|
||||||
|
GST_ERROR("Failed to link src pad %"GST_PTR_FORMAT" to sink pad %"GST_PTR_FORMAT", reason: %s",
|
||||||
|
src_pad, sink_pad, gst_pad_link_get_name(ret));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
bool link_src_to_element(GstPad *src_pad, GstElement *element)
|
bool link_src_to_element(GstPad *src_pad, GstElement *element)
|
||||||
{
|
{
|
||||||
GstPadLinkReturn ret;
|
GstPadLinkReturn ret;
|
||||||
|
@ -174,15 +188,9 @@ bool link_src_to_element(GstPad *src_pad, GstElement *element)
|
||||||
g_free(name);
|
g_free(name);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if ((ret = gst_pad_link(src_pad, sink_pad)))
|
ret = link_src_to_sink(src_pad, sink_pad);
|
||||||
{
|
|
||||||
gchar *src_name = gst_pad_get_name(src_pad), *sink_name = gst_pad_get_name(sink_pad);
|
|
||||||
GST_ERROR("Failed to link element pad %s with pad %s", src_name, sink_name);
|
|
||||||
g_free(sink_name);
|
|
||||||
g_free(src_name);
|
|
||||||
}
|
|
||||||
gst_object_unref(sink_pad);
|
gst_object_unref(sink_pad);
|
||||||
return !ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool link_element_to_sink(GstElement *element, GstPad *sink_pad)
|
bool link_element_to_sink(GstElement *element, GstPad *sink_pad)
|
||||||
|
@ -197,15 +205,9 @@ bool link_element_to_sink(GstElement *element, GstPad *sink_pad)
|
||||||
g_free(name);
|
g_free(name);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if ((ret = gst_pad_link(src_pad, sink_pad)))
|
ret = link_src_to_sink(src_pad, sink_pad);
|
||||||
{
|
|
||||||
gchar *src_name = gst_pad_get_name(src_pad), *sink_name = gst_pad_get_name(sink_pad);
|
|
||||||
GST_ERROR("Failed to link pad %s with element pad %s", src_name, sink_name);
|
|
||||||
g_free(sink_name);
|
|
||||||
g_free(src_name);
|
|
||||||
}
|
|
||||||
gst_object_unref(src_pad);
|
gst_object_unref(src_pad);
|
||||||
return !ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool push_event(GstPad *pad, GstEvent *event)
|
bool push_event(GstPad *pad, GstEvent *event)
|
||||||
|
|
|
@ -849,7 +849,6 @@ static bool stream_create_post_processing_elements(GstPad *pad, struct wg_parser
|
||||||
struct wg_parser *parser = stream->parser;
|
struct wg_parser *parser = stream->parser;
|
||||||
const char *name;
|
const char *name;
|
||||||
GstCaps *caps;
|
GstCaps *caps;
|
||||||
int ret;
|
|
||||||
|
|
||||||
caps = gst_pad_query_caps(pad, NULL);
|
caps = gst_pad_query_caps(pad, NULL);
|
||||||
name = gst_structure_get_name(gst_caps_get_structure(caps, 0));
|
name = gst_structure_get_name(gst_caps_get_structure(caps, 0));
|
||||||
|
@ -898,11 +897,9 @@ static bool stream_create_post_processing_elements(GstPad *pad, struct wg_parser
|
||||||
if (!link_src_to_element(pad, first) || !link_element_to_sink(last, stream->my_sink))
|
if (!link_src_to_element(pad, first) || !link_element_to_sink(last, stream->my_sink))
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else if ((ret = gst_pad_link(pad, stream->my_sink)) < 0)
|
else
|
||||||
{
|
{
|
||||||
GST_ERROR("Failed to link decodebin source pad to our sink pad, error %s.",
|
return link_src_to_sink(pad, stream->my_sink);
|
||||||
gst_pad_link_get_name(ret));
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
Loading…
Reference in a new issue