repaired GStreamer 0.10 version
This commit is contained in:
parent
dbd7912b88
commit
c19ed39a78
@ -12,8 +12,8 @@ endif(WITH_VFW)
|
|||||||
|
|
||||||
# --- GStreamer ---
|
# --- GStreamer ---
|
||||||
ocv_clear_vars(HAVE_GSTREAMER)
|
ocv_clear_vars(HAVE_GSTREAMER)
|
||||||
# try to find gstreamer 1.x first
|
# try to find gstreamer 1.x first if 0.10 was not requested
|
||||||
if(WITH_GSTREAMER)
|
if(WITH_GSTREAMER AND NOT WITH_GSTREAMER_0_10)
|
||||||
CHECK_MODULE(gstreamer-base-1.0 HAVE_GSTREAMER_BASE)
|
CHECK_MODULE(gstreamer-base-1.0 HAVE_GSTREAMER_BASE)
|
||||||
CHECK_MODULE(gstreamer-video-1.0 HAVE_GSTREAMER_VIDEO)
|
CHECK_MODULE(gstreamer-video-1.0 HAVE_GSTREAMER_VIDEO)
|
||||||
CHECK_MODULE(gstreamer-app-1.0 HAVE_GSTREAMER_APP)
|
CHECK_MODULE(gstreamer-app-1.0 HAVE_GSTREAMER_APP)
|
||||||
@ -29,7 +29,7 @@ if(WITH_GSTREAMER)
|
|||||||
set(GSTREAMER_PBUTILS_VERSION ${ALIASOF_gstreamer-pbutils-1.0_VERSION})
|
set(GSTREAMER_PBUTILS_VERSION ${ALIASOF_gstreamer-pbutils-1.0_VERSION})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
endif(WITH_GSTREAMER)
|
endif()
|
||||||
|
|
||||||
# gstreamer support was requested but could not find gstreamer 1.x,
|
# gstreamer support was requested but could not find gstreamer 1.x,
|
||||||
# so fallback/try to find gstreamer 0.10
|
# so fallback/try to find gstreamer 0.10
|
||||||
|
@ -75,10 +75,13 @@
|
|||||||
|
|
||||||
#if GST_VERSION_MAJOR == 0
|
#if GST_VERSION_MAJOR == 0
|
||||||
#define COLOR_ELEM "ffmpegcolorspace"
|
#define COLOR_ELEM "ffmpegcolorspace"
|
||||||
|
#define COLOR_ELEM_NAME "ffmpegcsp"
|
||||||
#elif FULL_GST_VERSION < VERSION_NUM(1,5,0)
|
#elif FULL_GST_VERSION < VERSION_NUM(1,5,0)
|
||||||
#define COLOR_ELEM "videoconvert"
|
#define COLOR_ELEM "videoconvert"
|
||||||
|
#define COLOR_ELEM_NAME COLOR_ELEM
|
||||||
#else
|
#else
|
||||||
#define COLOR_ELEM "autovideoconvert"
|
#define COLOR_ELEM "autovideoconvert"
|
||||||
|
#define COLOR_ELEM_NAME COLOR_ELEM
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void toFraction(double decimal, double &numerator, double &denominator);
|
void toFraction(double decimal, double &numerator, double &denominator);
|
||||||
@ -677,28 +680,27 @@ bool CvCapture_GStreamer::open( int type, const char* filename )
|
|||||||
|
|
||||||
if (manualpipeline)
|
if (manualpipeline)
|
||||||
{
|
{
|
||||||
GstIterator *it = NULL;
|
GstIterator *it = gst_bin_iterate_elements(GST_BIN(uridecodebin));
|
||||||
#if GST_VERSION_MAJOR == 0
|
|
||||||
it = gst_bin_iterate_sinks(GST_BIN(uridecodebin));
|
|
||||||
if (gst_iterator_next(it, (gpointer *)&sink) != GST_ITERATOR_OK)
|
|
||||||
{
|
|
||||||
CV_ERROR(CV_StsError, "GStreamer: cannot find appsink in manual pipeline\n");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
it = gst_bin_iterate_elements(GST_BIN(uridecodebin));
|
|
||||||
|
|
||||||
gboolean done = false;
|
|
||||||
GstElement *element = NULL;
|
GstElement *element = NULL;
|
||||||
|
gboolean done = false;
|
||||||
gchar* name = NULL;
|
gchar* name = NULL;
|
||||||
|
#if GST_VERSION_MAJOR > 0
|
||||||
GValue value = G_VALUE_INIT;
|
GValue value = G_VALUE_INIT;
|
||||||
|
#endif
|
||||||
|
|
||||||
while (!done)
|
while (!done)
|
||||||
{
|
{
|
||||||
|
#if GST_VERSION_MAJOR > 0
|
||||||
switch (gst_iterator_next (it, &value))
|
switch (gst_iterator_next (it, &value))
|
||||||
{
|
{
|
||||||
case GST_ITERATOR_OK:
|
case GST_ITERATOR_OK:
|
||||||
element = GST_ELEMENT (g_value_get_object (&value));
|
element = GST_ELEMENT (g_value_get_object (&value));
|
||||||
|
#else
|
||||||
|
switch (gst_iterator_next (it, (gpointer *)&element))
|
||||||
|
{
|
||||||
|
case GST_ITERATOR_OK:
|
||||||
|
#endif
|
||||||
name = gst_element_get_name(element);
|
name = gst_element_get_name(element);
|
||||||
if (name)
|
if (name)
|
||||||
{
|
{
|
||||||
@ -707,14 +709,16 @@ bool CvCapture_GStreamer::open( int type, const char* filename )
|
|||||||
sink = GST_ELEMENT ( gst_object_ref (element) );
|
sink = GST_ELEMENT ( gst_object_ref (element) );
|
||||||
done = sink && color;
|
done = sink && color;
|
||||||
}
|
}
|
||||||
else if (strstr(name, COLOR_ELEM) != NULL)
|
else if (strstr(name, COLOR_ELEM_NAME) != NULL)
|
||||||
{
|
{
|
||||||
color = GST_ELEMENT ( gst_object_ref (element) );
|
color = GST_ELEMENT ( gst_object_ref (element) );
|
||||||
done = sink && color;
|
done = sink && color;
|
||||||
}
|
}
|
||||||
g_free(name);
|
g_free(name);
|
||||||
}
|
}
|
||||||
|
#if GST_VERSION_MAJOR > 0
|
||||||
g_value_unset (&value);
|
g_value_unset (&value);
|
||||||
|
#endif
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case GST_ITERATOR_RESYNC:
|
case GST_ITERATOR_RESYNC:
|
||||||
@ -733,7 +737,7 @@ bool CvCapture_GStreamer::open( int type, const char* filename )
|
|||||||
CV_ERROR(CV_StsError, "GStreamer: cannot find appsink in manual pipeline\n");
|
CV_ERROR(CV_StsError, "GStreamer: cannot find appsink in manual pipeline\n");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
pipeline = uridecodebin;
|
pipeline = uridecodebin;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
Loading…
x
Reference in New Issue
Block a user