Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
O
opencv
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
opencv
Commits
53098323
Commit
53098323
authored
Apr 16, 2018
by
Maksim Shabunin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
VideoIO: prettier test console output, gstreamer capture backend changed to C++ interface
parent
9615f8c9
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
28 additions
and
21 deletions
+28
-21
cap.cpp
modules/videoio/src/cap.cpp
+20
-18
cap_gstreamer.cpp
modules/videoio/src/cap_gstreamer.cpp
+0
-0
precomp.hpp
modules/videoio/src/precomp.hpp
+4
-1
test_gstreamer.cpp
modules/videoio/test/test_gstreamer.cpp
+4
-2
test_video_io.cpp
modules/videoio/test/test_video_io.cpp
+0
-0
No files found.
modules/videoio/src/cap.cpp
View file @
53098323
...
...
@@ -40,6 +40,8 @@
//M*/
#include "precomp.hpp"
#include <iostream>
using
namespace
std
;
#include "cap_intelperc.hpp"
#include "cap_dshow.hpp"
...
...
@@ -200,12 +202,6 @@ CV_IMPL CvCapture * cvCreateCameraCapture (int index)
TRY_OPEN
(
capture
,
cvCreateCameraCapture_V4L
(
index
))
#endif
#ifdef HAVE_GSTREAMER
TRY_OPEN
(
capture
,
cvCreateCapture_GStreamer
(
CV_CAP_GSTREAMER_V4L2
,
reinterpret_cast
<
char
*>
(
index
)))
TRY_OPEN
(
capture
,
cvCreateCapture_GStreamer
(
CV_CAP_GSTREAMER_V4L
,
reinterpret_cast
<
char
*>
(
index
)))
#endif
if
(
pref
)
break
;
// CAP_VFW or CAP_V4L or CAP_V4L2
case
CAP_FIREWIRE
:
...
...
@@ -221,11 +217,6 @@ CV_IMPL CvCapture * cvCreateCameraCapture (int index)
TRY_OPEN
(
capture
,
cvCreateCameraCapture_CMU
(
index
))
#endif
#if defined(HAVE_GSTREAMER) && 0
// Re-enable again when gstreamer 1394 support will land in the backend code
TRY_OPEN
(
capture
,
cvCreateCapture_GStreamer
(
CV_CAP_GSTREAMER_1394
,
0
))
#endif
if
(
pref
)
break
;
// CAP_FIREWIRE
#ifdef HAVE_MIL
...
...
@@ -330,12 +321,6 @@ CV_IMPL CvCapture * cvCreateFileCaptureWithPreference (const char * filename, in
if
(
apiPreference
)
break
;
#endif
#ifdef HAVE_GSTREAMER
case
CAP_GSTREAMER
:
TRY_OPEN
(
result
,
cvCreateCapture_GStreamer
(
CV_CAP_GSTREAMER_FILE
,
filename
))
if
(
apiPreference
)
break
;
#endif
#if defined(HAVE_QUICKTIME) || defined(HAVE_QTKIT)
case
CAP_QT
:
TRY_OPEN
(
result
,
cvCreateFileCapture_QT
(
filename
))
...
...
@@ -463,6 +448,9 @@ static Ptr<IVideoCapture> IVideoCapture_create(int index)
{
int
domains
[]
=
{
#ifdef HAVE_GSTREAMER
CAP_GSTREAMER
,
#endif
#ifdef HAVE_DSHOW
CAP_DSHOW
,
#endif
...
...
@@ -490,7 +478,8 @@ static Ptr<IVideoCapture> IVideoCapture_create(int index)
// try every possibly installed camera API
for
(
int
i
=
0
;
domains
[
i
]
>=
0
;
i
++
)
{
#if defined(HAVE_DSHOW) || \
#if defined(HAVE_GSTREAMER) || \
defined(HAVE_DSHOW) || \
defined(HAVE_INTELPERC) || \
defined(WINRT_VIDEO) || \
defined(HAVE_GPHOTO2) || \
...
...
@@ -499,6 +488,11 @@ static Ptr<IVideoCapture> IVideoCapture_create(int index)
switch
(
domains
[
i
])
{
#ifdef HAVE_GSTREAMER
case
CAP_GSTREAMER
:
capture
=
createGStreamerCapture
(
index
);
break
;
#endif
#ifdef HAVE_DSHOW
case
CAP_DSHOW
:
capture
=
makePtr
<
VideoCapture_DShow
>
(
index
);
...
...
@@ -536,6 +530,14 @@ static Ptr<IVideoCapture> IVideoCapture_create(const String& filename, int apiPr
{
bool
useAny
=
(
apiPreference
==
CAP_ANY
);
Ptr
<
IVideoCapture
>
capture
;
#ifdef HAVE_GSTREAMER
if
(
useAny
||
apiPreference
==
CAP_GSTREAMER
)
{
capture
=
createGStreamerCapture
(
filename
);
if
(
capture
&&
capture
->
isOpened
())
return
capture
;
}
#endif
#ifdef HAVE_XINE
if
(
useAny
||
apiPreference
==
CAP_XINE
)
{
...
...
modules/videoio/src/cap_gstreamer.cpp
View file @
53098323
This diff is collapsed.
Click to expand it.
modules/videoio/src/precomp.hpp
View file @
53098323
...
...
@@ -139,7 +139,6 @@ CvVideoWriter* cvCreateVideoWriter_Images(const char* filename);
#define CV_CAP_GSTREAMER_V4L2 2
#define CV_CAP_GSTREAMER_FILE 3
CvCapture
*
cvCreateCapture_GStreamer
(
int
type
,
const
char
*
filename
);
CvCapture
*
cvCreateFileCapture_FFMPEG_proxy
(
const
char
*
filename
);
...
...
@@ -194,7 +193,11 @@ namespace cv
Ptr
<
IVideoCapture
>
createGPhoto2Capture
(
int
index
);
Ptr
<
IVideoCapture
>
createGPhoto2Capture
(
const
String
&
deviceName
);
Ptr
<
IVideoCapture
>
createXINECapture
(
const
char
*
filename
);
Ptr
<
IVideoCapture
>
createGStreamerCapture
(
const
String
&
filename
);
Ptr
<
IVideoCapture
>
createGStreamerCapture
(
int
index
);
}
#endif
/* __VIDEOIO_H_ */
modules/videoio/test/test_gstreamer.cpp
View file @
53098323
...
...
@@ -7,6 +7,7 @@
namespace
opencv_test
{
typedef
tuple
<
string
,
Size
,
Size
,
int
>
Param
;
typedef
testing
::
TestWithParam
<
Param
>
Videoio_Gstreamer_Test
;
...
...
@@ -19,8 +20,9 @@ TEST_P(Videoio_Gstreamer_Test, test_object_structure)
int
count_frames
=
10
;
std
::
ostringstream
pipeline
;
pipeline
<<
"videotestsrc pattern=ball num-buffers="
<<
count_frames
<<
" ! "
<<
format
;
pipeline
<<
", framerate=1/1, width="
<<
frame_size
.
width
<<
", height="
<<
frame_size
.
height
<<
" ! appsink"
;
VideoCapture
cap
(
pipeline
.
str
(),
CAP_GSTREAMER
);
pipeline
<<
", width="
<<
frame_size
.
width
<<
", height="
<<
frame_size
.
height
<<
" ! appsink"
;
VideoCapture
cap
;
ASSERT_NO_THROW
(
cap
.
open
(
pipeline
.
str
(),
CAP_GSTREAMER
));
ASSERT_TRUE
(
cap
.
isOpened
());
Mat
buffer
,
decode_frame
,
gray_frame
,
rgb_frame
;
...
...
modules/videoio/test/test_video_io.cpp
View file @
53098323
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment