1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-31 08:13:04 +04:00

Gstreamer 1.0 on windows.

This commit is contained in:
Dan
2015-12-09 09:08:19 -05:00
parent 8e67f0ba84
commit 46ec9c386b
5 changed files with 188 additions and 11 deletions
+4
View File
@@ -92,6 +92,10 @@ if(HAVE_DC1394)
endif(HAVE_DC1394)
if(HAVE_GSTREAMER)
IF(WIN32)
INCLUDE_DIRECTORIES(${GSTREAMER_INCLUDE_DIR})
list(APPEND VIDEOIO_LIBRARIES ${GSTREAMER_LIBRARIES})
ENDIF(WIN32)
list(APPEND videoio_srcs ${CMAKE_CURRENT_LIST_DIR}/src/cap_gstreamer.cpp)
endif(HAVE_GSTREAMER)
+22 -1
View File
@@ -48,7 +48,9 @@
* \brief Use GStreamer to read/write video
*/
#include "precomp.hpp"
#ifndef _MSC_VER
#include <unistd.h>
#endif
#include <string.h>
#include <gst/gst.h>
#include <gst/gstbuffer.h>
@@ -84,6 +86,14 @@
#define COLOR_ELEM_NAME COLOR_ELEM
#endif
#if defined(_WIN32) || defined(_WIN64)
#define snprintf _snprintf
#define vsnprintf _vsnprintf
#define strcasecmp _stricmp
#define strncasecmp _strnicmp
#include <sys/stat.h>
#endif
void toFraction(double decimal, double &numerator, double &denominator);
void handleMessage(GstElement * pipeline);
@@ -590,9 +600,20 @@ bool CvCapture_GStreamer::open( int type, const char* filename )
// else, we might have a file or a manual pipeline.
// if gstreamer cannot parse the manual pipeline, we assume we were given and
// ordinary file path.
if(!gst_uri_is_valid(filename))
if (!gst_uri_is_valid(filename))
{
#ifdef _MSC_VER
uri = new char[2048];
DWORD pathSize = GetFullPathName(filename, 2048, uri, NULL);
struct stat buf;
if (pathSize == 0 || stat(uri, &buf) != 0)
{
delete uri;
uri = NULL;
}
#else
uri = realpath(filename, NULL);
#endif
stream = false;
if(uri)
{