Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Albert Gräf
Gem
Commits
fbb817bf
Commit
fbb817bf
authored
Feb 11, 2019
by
IOhannes m zmölnig
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
filmDS: properly detect if frame is new (if it has a different timestamp)
parent
4f345a4b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
3 deletions
+13
-3
plugins/filmDS/filmDS.cpp
plugins/filmDS/filmDS.cpp
+13
-3
No files found.
plugins/filmDS/filmDS.cpp
View file @
fbb817bf
...
...
@@ -402,6 +402,7 @@ public:
bNewPixels
=
false
;
bFrameNew
=
false
;
curMovieFrame
=
-
1
;
curMovieTime
=
-
1.
;
frameCount
=
-
1
;
movieRate
=
1.0
;
...
...
@@ -445,6 +446,9 @@ MARK();
bNewPixels
=
true
;
//this is just so we know if there is a new frame
if
(
Time
!=
curMovieTime
)
bFrameNew
=
true
;
curMovieTime
=
Time
;
frameCount
++
;
LeaveCriticalSection
(
&
critSection
);
...
...
@@ -1028,10 +1032,13 @@ MARK();
#ifdef USE_CALLBACKS
bool
getPixels
(
imageStruct
&
img
)
{
if
(
bVideoOpened
&&
bNewPixels
)
{
if
(
!
bVideoOpened
)
return
false
;
if
(
bFrameNew
)
{
EnterCriticalSection
(
&
critSection
);
std
::
swap
(
backSample
,
middleSample
);
bNewPixels
=
false
;
bFrameNew
=
false
;
LeaveCriticalSection
(
&
critSection
);
BYTE
*
ptrBuffer
=
NULL
;
HRESULT
hr
=
middleSample
->
GetPointer
(
&
ptrBuffer
);
...
...
@@ -1052,13 +1059,15 @@ MARK();
#else
//this is the non-callback approach
bool
getPixels
(
imageStruct
&
img
){
if
(
bVideoOpened
&&
isFrameNew
()){
if
(
!
bVideoOpened
)
return
false
;
if
(
isFrameNew
()){
long
bufferSize
=
img
.
xsize
*
img
.
ysize
*
img
.
csize
;
post
(
"fetching %d bytes into %p"
,
bufferSize
,
img
.
data
);
HRESULT
hr
=
m_pGrabber
->
GetCurrentBuffer
(
&
bufferSize
,
(
long
*
)
img
.
data
);
return
(
S_OK
==
hr
);
}
return
fals
e
;
return
tru
e
;
}
#endif
...
...
@@ -1099,6 +1108,7 @@ protected:
bool
bLoop
;
bool
bEndReached
;
double
movieRate
;
double
curMovieTime
;
int
curMovieFrame
;
int
frameCount
;
...
...
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