Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Open sidebar
VideoLAN
VLMC
Commits
9f0de1f0
Commit
9f0de1f0
authored
Jan 08, 2010
by
Hugo Beauzee-Luyssen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Applying HACKING in VideoClipWorkflow.cpp
parent
92d42fb2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
41 additions
and
25 deletions
+41
-25
src/Workflow/VideoClipWorkflow.cpp
src/Workflow/VideoClipWorkflow.cpp
+41
-25
No files found.
src/Workflow/VideoClipWorkflow.cpp
View file @
9f0de1f0
...
...
@@ -27,12 +27,12 @@
#include "LightVideoFrame.h"
#include "Clip.h"
VideoClipWorkflow
::
VideoClipWorkflow
(
Clip
*
clip
)
:
ClipWorkflow
(
clip
)
VideoClipWorkflow
::
VideoClipWorkflow
(
Clip
*
clip
)
:
ClipWorkflow
(
clip
)
{
for
(
unsigned
int
i
=
0
;
i
<
VideoClipWorkflow
::
nbBuffers
;
++
i
)
{
//Actually we don't release, we extend pool, but the release method do exactly what we want.
m_availableBuffers
.
push_back
(
new
LightVideoFrame
(
MainWorkflow
::
getInstance
()
->
getWidth
()
m_availableBuffers
.
enqueue
(
new
LightVideoFrame
(
MainWorkflow
::
getInstance
()
->
getWidth
()
*
MainWorkflow
::
getInstance
()
->
getHeight
()
*
Pixel
::
NbComposantes
)
);
}
...
...
@@ -47,7 +47,8 @@ VideoClipWorkflow::~VideoClipWorkflow()
delete
m_computedBuffers
.
dequeue
();
}
void
VideoClipWorkflow
::
initVlcOutput
()
void
VideoClipWorkflow
::
initVlcOutput
()
{
char
buffer
[
32
];
...
...
@@ -63,48 +64,54 @@ void VideoClipWorkflow::initVlcOutput()
m_vlcMedia
->
addOption
(
":no-sout-smem-time-sync"
);
sprintf
(
buffer
,
":sout-transcode-width=%i"
,
MainWorkflow
::
getInstance
()
->
getWidth
()
);
sprintf
(
buffer
,
":sout-transcode-width=%i"
,
MainWorkflow
::
getInstance
()
->
getWidth
()
);
m_vlcMedia
->
addOption
(
buffer
);
sprintf
(
buffer
,
":sout-transcode-height=%i"
,
MainWorkflow
::
getInstance
()
->
getHeight
()
);
sprintf
(
buffer
,
":sout-transcode-height=%i"
,
MainWorkflow
::
getInstance
()
->
getHeight
()
);
m_vlcMedia
->
addOption
(
buffer
);
//Forced output fps
sprintf
(
buffer
,
":sout-transcode-fps=%f"
,
(
float
)
Clip
::
DefaultFPS
);
m_vlcMedia
->
addOption
(
buffer
);
}
void
*
VideoClipWorkflow
::
getLockCallback
()
void
*
VideoClipWorkflow
::
getLockCallback
()
{
return
reinterpret_cast
<
void
*>
(
&
VideoClipWorkflow
::
lock
);
}
void
*
VideoClipWorkflow
::
getUnlockCallback
()
void
*
VideoClipWorkflow
::
getUnlockCallback
()
{
return
reinterpret_cast
<
void
*>
(
&
VideoClipWorkflow
::
unlock
);
}
void
*
VideoClipWorkflow
::
getOutput
(
ClipWorkflow
::
GetMode
mode
)
void
*
VideoClipWorkflow
::
getOutput
(
ClipWorkflow
::
GetMode
mode
)
{
QMutexLocker
lock
(
m_renderLock
);
QMutexLocker
lock2
(
m_computedBuffersMutex
);
preGetOutput
();
// qWarning() << "Video::getOutput(). Available:" << m_availableBuffers.count() << "Computed:" << m_computedBuffers.count();
/*qWarning() << "Video::getOutput(). Available:" << m_availableBuffers.count() <<
"Computed:" << m_computedBuffers.count();*/
if
(
isEndReached
()
==
true
)
return
NULL
;
StackedBuffer
<
LightVideoFrame
*
,
VideoClipWorkflow
>*
buff
;
if
(
mode
==
ClipWorkflow
::
Pop
)
{
buff
=
new
StackedBuffer
<
LightVideoFrame
*
,
VideoClipWorkflow
>
(
m_computedBuffers
.
dequeue
(),
this
,
true
);
buff
=
new
StackedBuffer
<
LightVideoFrame
*
,
VideoClipWorkflow
>
(
m_computedBuffers
.
dequeue
(),
this
,
true
);
}
else
if
(
mode
==
ClipWorkflow
::
Get
)
buff
=
new
StackedBuffer
<
LightVideoFrame
*
,
VideoClipWorkflow
>
(
m_computedBuffers
.
head
(),
NULL
,
false
);
buff
=
new
StackedBuffer
<
LightVideoFrame
*
,
VideoClipWorkflow
>
(
m_computedBuffers
.
head
(),
NULL
,
false
);
postGetOutput
();
return
buff
;
}
void
VideoClipWorkflow
::
lock
(
VideoClipWorkflow
*
cw
,
void
**
pp_ret
,
int
size
)
void
VideoClipWorkflow
::
lock
(
VideoClipWorkflow
*
cw
,
void
**
pp_ret
,
int
size
)
{
Q_UNUSED
(
size
);
QMutexLocker
lock
(
cw
->
m_availableBuffersMutex
);
...
...
@@ -122,12 +129,15 @@ void VideoClipWorkflow::lock( VideoClipWorkflow* cw, void** pp_ret, int size
else
lvf
=
cw
->
m_availableBuffers
.
dequeue
();
cw
->
m_computedBuffers
.
enqueue
(
lvf
);
// qWarning() << ">>>VideoGeneration. Available:" << cw->m_availableBuffers.count() << "Computed:" << cw->m_computedBuffers.count();
// qWarning() << ">>>VideoGeneration. Available:" <<
// cw->m_availableBuffers.count() << "Computed:" << cw->m_computedBuffers.count();
// qWarning() << "feeding video buffer";
*
pp_ret
=
(
*
(
lvf
))
->
frame
.
octets
;
}
void
VideoClipWorkflow
::
unlock
(
VideoClipWorkflow
*
cw
,
void
*
buffer
,
int
width
,
int
height
,
int
bpp
,
int
size
,
qint64
pts
)
void
VideoClipWorkflow
::
unlock
(
VideoClipWorkflow
*
cw
,
void
*
buffer
,
int
width
,
int
height
,
int
bpp
,
int
size
,
qint64
pts
)
{
Q_UNUSED
(
buffer
);
Q_UNUSED
(
width
);
...
...
@@ -136,37 +146,43 @@ void VideoClipWorkflow::unlock( VideoClipWorkflow* cw, void* buffer, int widt
Q_UNUSED
(
size
);
cw
->
computePtsDiff
(
pts
);
LightVideoFrame
*
lvf
=
cw
->
m_computedBuffers
.
last
();
LightVideoFrame
*
lvf
=
cw
->
m_computedBuffers
.
last
();
(
*
(
lvf
))
->
ptsDiff
=
cw
->
m_currentPts
-
cw
->
m_previousPts
;
// qWarning() << "Computed ptsDiff:" << (*(lvf))->ptsDiff;
// if ( (*(lvf))->ptsDiff > 100000 )
// {
// qWarning() << "Probably invalid pts diff. pts:" << pts << "m_currentPts:" << cw->m_currentPts << "m_previousPts:" << cw->m_previousPts
// qWarning() << "Probably invalid pts diff. pts:" << pts << "m_currentPts:" <<
// cw->m_currentPts << "m_previousPts:" << cw->m_previousPts
// << "state:" << cw->m_state;
// }
//If this is the first buffer that has been rendered, there may be a waiting TrackWorkflow.
// If this is the first buffer that has been rendered,
// there may be a waiting TrackWorkflow.
cw
->
commonUnlock
();
cw
->
m_renderLock
->
unlock
();
cw
->
m_computedBuffersMutex
->
unlock
();
}
uint32_t
VideoClipWorkflow
::
getNbComputedBuffers
()
const
uint32_t
VideoClipWorkflow
::
getNbComputedBuffers
()
const
{
return
m_computedBuffers
.
count
();
}
uint32_t
VideoClipWorkflow
::
getMaxComputedBuffers
()
const
uint32_t
VideoClipWorkflow
::
getMaxComputedBuffers
()
const
{
return
VideoClipWorkflow
::
nbBuffers
;
}
void
VideoClipWorkflow
::
releaseBuffer
(
LightVideoFrame
*
lvf
)
void
VideoClipWorkflow
::
releaseBuffer
(
LightVideoFrame
*
lvf
)
{
QMutexLocker
lock
(
m_availableBuffersMutex
);
m_availableBuffers
.
enqueue
(
lvf
);
}
void
VideoClipWorkflow
::
flushComputedBuffers
()
void
VideoClipWorkflow
::
flushComputedBuffers
()
{
QMutexLocker
lock
(
m_computedBuffersMutex
);
QMutexLocker
lock2
(
m_availableBuffersMutex
);
...
...
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