Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
VideoLAN
VLMC
Commits
cb56d05e
Commit
cb56d05e
authored
Sep 25, 2009
by
Hugo Beauzee-Luyssen
Browse files
PreviewWidget should now handle both Clip and Media
parent
8484c3db
Changes
4
Hide whitespace changes
Inline
Side-by-side
src/Renderer/ClipRenderer.cpp
View file @
cb56d05e
...
...
@@ -29,7 +29,9 @@ ClipRenderer::ClipRenderer() :
GenericRenderer
(),
m_clipLoaded
(
false
),
m_vlcMedia
(
NULL
),
m_selectedClip
(
NULL
),
m_selectedMedia
(
NULL
),
m_begin
(
0
),
m_end
(
-
1
),
m_mediaChanged
(
false
)
{
connect
(
m_mediaPlayer
,
SIGNAL
(
stopped
()
),
this
,
SLOT
(
__videoStopped
()
)
);
...
...
@@ -44,9 +46,22 @@ ClipRenderer::~ClipRenderer()
stop
();
}
void
ClipRenderer
::
setMedia
(
Media
*
media
)
{
m_selectedMedia
=
media
;
m_begin
=
0
;
m_end
=
media
->
getNbFrames
();
if
(
m_isRendering
==
true
)
m_mediaChanged
=
true
;
else
m_clipLoaded
=
false
;
}
void
ClipRenderer
::
setClip
(
Clip
*
clip
)
{
m_selectedClip
=
clip
;
m_selectedMedia
=
clip
->
getParent
();
m_begin
=
clip
->
getBegin
();
m_end
=
clip
->
getEnd
();
if
(
m_isRendering
==
true
)
m_mediaChanged
=
true
;
else
...
...
@@ -55,17 +70,17 @@ void ClipRenderer::setClip( Clip* clip )
void
ClipRenderer
::
startPreview
()
{
if
(
m_selected
Clip
==
NULL
)
if
(
m_selected
Media
==
NULL
)
return
;
//If an old media is found, we delete it, and disconnect
if
(
m_vlcMedia
!=
NULL
)
delete
m_vlcMedia
;
m_vlcMedia
=
new
LibVLCpp
::
Media
(
m_selected
Clip
->
getParent
()
->
getFileInfo
()
->
absoluteFilePath
()
);
m_vlcMedia
=
new
LibVLCpp
::
Media
(
m_selected
Media
->
getFileInfo
()
->
absoluteFilePath
()
);
m_mediaPlayer
->
setMedia
(
m_vlcMedia
);
m_mediaPlayer
->
play
();
m_mediaPlayer
->
setPosition
(
m_
selectedClip
->
getB
egin
()
/
m_
selectedClip
->
getLength
()
);
m_mediaPlayer
->
setPosition
(
m_
b
egin
/
m_
end
);
m_clipLoaded
=
true
;
m_isRendering
=
true
;
m_paused
=
false
;
...
...
@@ -76,8 +91,8 @@ void ClipRenderer::setPosition( float newPos )
{
if
(
m_clipLoaded
==
false
||
m_isRendering
==
false
)
return
;
float
begin
=
m_
selectedClip
->
getBegin
()
/
m_selectedClip
->
getLength
(
);
float
end
=
m_
selectedClip
->
getEnd
()
/
m_selectedClip
->
getEnd
(
);
float
begin
=
m_
begin
/
(
m_end
-
m_begin
);
float
end
=
m_
end
/
(
m_end
-
m_begin
);
float
pos
=
newPos
*
(
end
-
begin
)
+
begin
;
m_mediaPlayer
->
setPosition
(
pos
);
}
...
...
@@ -116,7 +131,7 @@ void ClipRenderer::togglePlayPause( bool forcePause )
if
(
m_isRendering
==
false
)
{
m_mediaPlayer
->
play
();
m_mediaPlayer
->
setPosition
(
m_
selectedClip
->
getBegin
()
/
m_selectedClip
->
getLength
(
)
);
m_mediaPlayer
->
setPosition
(
m_
begin
/
(
m_end
-
m_begin
)
);
m_isRendering
=
true
;
}
else
...
...
@@ -142,13 +157,14 @@ void ClipRenderer::previousFrame()
}
}
//FIXME: this won't work with clips !
void
ClipRenderer
::
mediaUnloaded
(
const
QUuid
&
uuid
)
{
if
(
m_selected
Clip
!=
NULL
&&
m_selected
Clip
->
getUuid
()
==
uuid
)
if
(
m_selected
Media
!=
NULL
&&
m_selected
Media
->
getUuid
()
==
uuid
)
{
m_mediaPlayer
->
stop
();
m_clipLoaded
=
false
;
m_selected
Clip
=
NULL
;
m_selected
Media
=
NULL
;
m_isRendering
=
false
;
m_paused
=
false
;
}
...
...
@@ -177,8 +193,8 @@ void ClipRenderer::__positionChanged()
if
(
m_clipLoaded
==
false
)
return
;
float
begin
=
m_
selectedClip
->
getBegin
()
/
m_selectedClip
->
getLength
(
);
float
end
=
m_
selectedClip
->
getEnd
()
/
m_selectedClip
->
getEnd
(
);
float
begin
=
m_
begin
/
(
m_end
-
m_begin
);
float
end
=
m_
end
/
(
m_end
-
m_begin
);
float
pos
=
(
m_mediaPlayer
->
getPosition
()
-
begin
)
/
(
end
-
begin
);
emit
positionChanged
(
pos
);
...
...
src/Renderer/ClipRenderer.h
View file @
cb56d05e
...
...
@@ -51,7 +51,9 @@ private:
private:
bool
m_clipLoaded
;
LibVLCpp
::
Media
*
m_vlcMedia
;
Clip
*
m_selectedClip
;
Media
*
m_selectedMedia
;
qint64
m_begin
;
qint64
m_end
;
/**
* \brief This flags is used to know if a new media has been selected in the
* library. If so, we must relaunch the render if the play button is clicked again.
...
...
@@ -60,6 +62,7 @@ private:
public
slots
:
virtual
void
setClip
(
Clip
*
clip
);
virtual
void
setMedia
(
Media
*
media
);
virtual
void
mediaUnloaded
(
const
QUuid
&
);
void
__positionChanged
();
...
...
src/Renderer/GenericRenderer.h
View file @
cb56d05e
...
...
@@ -86,6 +86,7 @@ public slots:
virtual
void
__videoPlaying
()
=
0
;
virtual
void
__endReached
()
=
0
;
virtual
void
setClip
(
Clip
*
)
=
0
;
virtual
void
setMedia
(
Media
*
)
=
0
;
virtual
void
mediaUnloaded
(
const
QUuid
&
)
=
0
;
...
...
src/Renderer/WorkflowRenderer.h
View file @
cb56d05e
...
...
@@ -81,7 +81,8 @@ class WorkflowRenderer : public GenericRenderer
QWaitCondition
*
m_waitCond
;
public
slots
:
void
setClip
(
Clip
*
){}
virtual
void
setClip
(
Clip
*
){}
virtual
void
setMedia
(
Media
*
)
{}
void
mediaUnloaded
(
const
QUuid
&
)
{}
void
timelineCursorChanged
(
qint64
newFrame
);
...
...
Write
Preview
Supports
Markdown
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