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
bba4f9e5
Commit
bba4f9e5
authored
Aug 02, 2011
by
Andrey Morozov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
removed property. added automatically define number of cpus for decoding video
parent
d87f513b
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
50 additions
and
19 deletions
+50
-19
highgui_c.h
modules/highgui/include/opencv2/highgui/highgui_c.h
+1
-3
cap_ffmpeg_api.hpp
modules/highgui/src/cap_ffmpeg_api.hpp
+1
-2
cap_ffmpeg_impl.hpp
modules/highgui/src/cap_ffmpeg_impl.hpp
+48
-14
No files found.
modules/highgui/include/opencv2/highgui/highgui_c.h
View file @
bba4f9e5
...
...
@@ -372,9 +372,7 @@ enum
// Properties of cameras available through GStreamer interface
CV_CAP_GSTREAMER_QUEUE_LENGTH
=
200
,
// default is 1
CV_CAP_PROP_PVAPI_MULTICASTIP
=
300
,
// ip for anable multicast master mode. 0 for disable multicast
CV_CAP_PROP_THREADS
=
400
CV_CAP_PROP_PVAPI_MULTICASTIP
=
300
// ip for anable multicast master mode. 0 for disable multicast
};
enum
...
...
modules/highgui/src/cap_ffmpeg_api.hpp
View file @
bba4f9e5
...
...
@@ -21,8 +21,7 @@ enum
CV_FFMPEG_CAP_PROP_FRAME_HEIGHT
=
4
,
CV_FFMPEG_CAP_PROP_FPS
=
5
,
CV_FFMPEG_CAP_PROP_FOURCC
=
6
,
CV_FFMPEG_CAP_PROP_FRAME_COUNT
=
7
,
CV_FFMPEG_CAP_PROP_THREADS
=
8
CV_FFMPEG_CAP_PROP_FRAME_COUNT
=
7
};
...
...
modules/highgui/src/cap_ffmpeg_impl.hpp
View file @
bba4f9e5
...
...
@@ -137,6 +137,52 @@ extern "C" {
#define CALC_FFMPEG_VERSION(a,b,c) ( a<<16 | b<<8 | c )
#if defined WIN32 || defined _WIN32
#include <windows.h>
#elif defined __linux__ || defined __APPLE__
#include <unistd.h>
#include <stdio.h>
#include <sys/types.h>
#include <sys/sysctl.h>
#endif
int
get_number_of_cpus
(
void
)
{
#if defined WIN32 || defined _WIN32
SYSTEM_INFO
sysinfo
;
GetSystemInfo
(
&
sysinfo
);
return
(
int
)
sysinfo
.
dwNumberOfProcessors
;
#elif defined __linux__
return
(
int
)
sysconf
(
_SC_NPROCESSORS_ONLN
);
#elif defined __APPLE__
int
numCPU
=
0
;
int
mib
[
4
];
size_t
len
=
sizeof
(
numCPU
);
/* set the mib for hw.ncpu */
mib
[
0
]
=
CTL_HW
;
mib
[
1
]
=
HW_AVAILCPU
;
// alternatively, try HW_NCPU;
/* get the number of CPUs from the system */
sysctl
(
mib
,
2
,
&
numCPU
,
&
len
,
NULL
,
0
);
if
(
numCPU
<
1
)
{
mib
[
1
]
=
HW_NCPU
;
sysctl
(
mib
,
2
,
&
numCPU
,
&
len
,
NULL
,
0
);
if
(
numCPU
<
1
)
numCPU
=
1
;
}
return
(
int
)
numCPU
;
#else
return
1
;
#endif
}
char
*
FOURCC2str
(
int
fourcc
)
{
char
*
mystr
=
(
char
*
)
malloc
(
5
);
...
...
@@ -365,7 +411,6 @@ struct CvCapture_FFMPEG
and so the filename is needed to reopen the file on backward seeking.
*/
char
*
filename
;
int
count_threads
;
};
...
...
@@ -380,7 +425,6 @@ void CvCapture_FFMPEG::init()
memset
(
&
frame
,
0
,
sizeof
(
frame
)
);
filename
=
0
;
packet
.
data
=
NULL
;
count_threads
=
1
;
#if defined(HAVE_FFMPEG_SWSCALE)
img_convert_ctx
=
0
;
#endif
...
...
@@ -447,7 +491,7 @@ bool CvCapture_FFMPEG::reopen()
AVCodecContext
*
enc
=
&
ic
->
streams
[
video_stream
]
->
codec
;
#endif
avcodec_thread_init
(
enc
,
count_threads
);
avcodec_thread_init
(
enc
,
get_number_of_cpus
()
);
AVCodec
*
codec
=
avcodec_find_decoder
(
enc
->
codec_id
);
avcodec_open
(
enc
,
codec
);
...
...
@@ -494,7 +538,7 @@ bool CvCapture_FFMPEG::open( const char* _filename )
AVCodecContext
*
enc
=
&
ic
->
streams
[
i
]
->
codec
;
#endif
avcodec_thread_init
(
enc
,
count_threads
);
avcodec_thread_init
(
enc
,
get_number_of_cpus
()
);
#if LIBAVFORMAT_BUILD < CALC_FFMPEG_VERSION(53, 4, 0)
#define AVMEDIA_TYPE_VIDEO CODEC_TYPE_VIDEO
...
...
@@ -717,9 +761,6 @@ double CvCapture_FFMPEG::getProperty( int property_id )
return
(
double
)
video_st
->
codec
.
codec_tag
;
#endif
break
;
case
CV_CAP_PROP_THREADS
:
return
count_threads
;
break
;
}
return
0
;
...
...
@@ -804,13 +845,6 @@ bool CvCapture_FFMPEG::setProperty( int property_id, double value )
picture_pts
=
(
int64_t
)
value
;
}
break
;
case
CV_CAP_PROP_THREADS
:
{
count_threads
=
(
int
)
value
;
}
break
;
default
:
return
false
;
}
...
...
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