Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
VideoLAN
VLMC
Commits
6f9f60da
Commit
6f9f60da
authored
Apr 03, 2009
by
Hugo Beauzee-Luyssen
Browse files
Refactored Media. Preview now uses an OutputMedia
parent
fa0b3013
Changes
8
Hide whitespace changes
Inline
Side-by-side
src/InputMedia.cpp
View file @
6f9f60da
...
...
@@ -107,31 +107,11 @@ bool InputMedia::isSeekable()
return
m_vlcMediaPlayer
->
isSeekable
();
}
qint64
InputMedia
::
getLength
()
{
return
m_vlcMediaPlayer
->
getLength
();
}
qint64
InputMedia
::
getTime
()
{
return
m_vlcMediaPlayer
->
getTime
();
}
void
InputMedia
::
setTime
(
qint64
time
)
{
m_vlcMediaPlayer
->
setTime
(
time
);
}
QImage
&
InputMedia
::
getImage
()
{
return
*
m_image
;
}
void
InputMedia
::
setDrawable
(
WId
handle
)
{
m_vlcMediaPlayer
->
setDrawable
(
handle
);
}
void
InputMedia
::
play
()
{
Media
::
play
();
...
...
src/InputMedia.h
View file @
6f9f60da
...
...
@@ -26,7 +26,6 @@
#include
<QString>
#include
<QImage>
#include
<QThread>
#include
"Media.h"
#include
"VLCMediaPlayer.h"
...
...
@@ -56,18 +55,6 @@ public:
* Can be used to know if the Media is fully usable (IE. can be seeked, vmem can be used, etc...)
*/
bool
isReady
();
/**
* Return the length (duration) of a Media
*/
qint64
getLength
();
/**
* Return the current time of the media
*/
qint64
getTime
();
/**
* Change the current time of the media
*/
void
setTime
(
qint64
time
);
/**
* Returns the last rendered frame
...
...
@@ -77,8 +64,6 @@ public:
virtual
void
play
();
virtual
void
pause
();
virtual
void
stop
();
void
setDrawable
(
WId
handle
);
LibVLCpp
::
MediaPlayer
*
mediaPlayer
()
{
return
m_vlcMediaPlayer
;
}
private:
QImage
*
m_snapshot
;
...
...
src/Media.cpp
View file @
6f9f60da
...
...
@@ -73,7 +73,7 @@ void Media::loadMedia( const QString& mrl )
delete
m_vlcMedia
;
m_mrl
=
mrl
;
setupMedia
(
);
m_vlcMedia
=
new
LibVLCpp
::
Media
(
m_instance
,
mrl
);
}
void
Media
::
setupMedia
()
...
...
@@ -87,7 +87,6 @@ void Media::setupMedia()
m_vlcMedia
->
addOption
(
param
.
toStdString
().
c_str
()
);
m_vlcMediaPlayer
=
new
LibVLCpp
::
MediaPlayer
(
m_vlcMedia
);
qDebug
()
<<
"MediaPlayer is not build on top of"
<<
(
void
*
)
m_vlcMedia
;
}
void
Media
::
play
()
...
...
@@ -115,3 +114,23 @@ void Media::addParam( const QString& param )
{
m_parameters
.
append
(
param
);
}
void
Media
::
setDrawable
(
WId
handle
)
{
m_vlcMediaPlayer
->
setDrawable
(
handle
);
}
qint64
Media
::
getLength
()
{
return
m_vlcMediaPlayer
->
getLength
();
}
qint64
Media
::
getTime
()
{
return
m_vlcMediaPlayer
->
getTime
();
}
void
Media
::
setTime
(
qint64
time
)
{
m_vlcMediaPlayer
->
setTime
(
time
);
}
src/Media.h
View file @
6f9f60da
...
...
@@ -25,6 +25,7 @@
#include
<QList>
#include
<QString>
#include
<QWidget>
#include
"VLCMedia.h"
#include
"VLCInstance.h"
...
...
@@ -44,6 +45,20 @@ public:
virtual
void
stop
();
void
addParam
(
const
QString
&
param
);
void
setupMedia
();
void
setDrawable
(
WId
handle
);
LibVLCpp
::
MediaPlayer
*
mediaPlayer
()
{
return
m_vlcMediaPlayer
;
}
/**
* Return the length (duration) of a Media
*/
qint64
getLength
();
/**
* Return the current time of the media
*/
qint64
getTime
();
/**
* Change the current time of the media
*/
void
setTime
(
qint64
time
);
protected:
//Protected constructor so we can't use a Media without its sub-implementation
...
...
src/OutputMedia.cpp
View file @
6f9f60da
...
...
@@ -23,11 +23,11 @@
#include
<QtDebug>
#include
"OutputMedia.h"
OutputMedia
::
OutputMedia
(
LibVLCpp
::
Instance
*
instance
)
:
Media
(
instance
,
"fake://"
),
m_pixelBuffer
(
NULL
)
OutputMedia
::
OutputMedia
(
LibVLCpp
::
Instance
*
instance
)
:
Media
(
instance
,
"fake://"
),
m_dataCtx
(
NULL
),
m_pixelBuffer
(
NULL
)
{
m_dataCtx
=
new
OutputMedia
::
DataCtx
;
m_dataCtx
->
mutex
=
new
QMutex
;
m_dataCtx
->
outputMedia
=
this
;
//
m_dataCtx = new OutputMedia::DataCtx;
//
m_dataCtx->mutex = new QMutex;
//
m_dataCtx->outputMedia = this;
char
width
[
64
],
height
[
64
],
lock
[
64
],
unlock
[
64
],
data
[
64
];
sprintf
(
width
,
":invmem-width=%i"
,
VIDEOWIDTH
);
...
...
@@ -36,12 +36,25 @@ OutputMedia::OutputMedia( LibVLCpp::Instance* instance ) : Media( instance,"fake
sprintf
(
unlock
,
":invmem-unlock=%lld"
,
(
qint64
)(
intptr_t
)
&
OutputMedia
::
unlock
);
sprintf
(
data
,
":invmem-data=%lld"
,
(
qint64
)(
intptr_t
)
m_dataCtx
);
addParam
(
width
);
addParam
(
height
);
addParam
(
lock
);
addParam
(
unlock
);
addParam
(
data
);
addParam
(
":vout=sdl"
);
// addParam( width );
// addParam( height );
// addParam( lock );
// addParam( unlock );
// addParam( data );
// addParam( ":vout=sdl" );
}
OutputMedia
::~
OutputMedia
()
{
if
(
m_dataCtx
!=
NULL
)
delete
m_dataCtx
;
if
(
m_pixelBuffer
!=
NULL
)
delete
m_pixelBuffer
;
}
OutputMedia
::
DataCtx
::~
DataCtx
()
{
delete
mutex
;
}
uchar
*
OutputMedia
::
lock
(
OutputMedia
::
DataCtx
*
dataCtx
)
...
...
src/OutputMedia.h
View file @
6f9f60da
...
...
@@ -35,6 +35,7 @@ public:
OutputMedia
*
outputMedia
;
};
OutputMedia
(
LibVLCpp
::
Instance
*
instance
);
virtual
~
OutputMedia
();
//FIXME: destructor ?
static
uchar
*
lock
(
OutputMedia
::
DataCtx
*
dataCtx
);
static
void
unlock
(
OutputMedia
::
DataCtx
*
dataCtx
);
...
...
src/gui/PreviewWidget.cpp
View file @
6f9f60da
...
...
@@ -75,7 +75,8 @@ void PreviewWidget::dropEvent( QDropEvent* event )
m_currentMedia
->
stop
();
delete
m_currentMedia
;
}
m_currentMedia
=
new
InputMedia
(
"file://"
+
item
->
fileInfo
()
->
absoluteFilePath
(),
m_currentInstance
);
m_currentMedia
=
new
OutputMedia
(
m_currentInstance
);
m_currentMedia
->
loadMedia
(
"file://"
+
item
->
fileInfo
()
->
absoluteFilePath
()
);
m_currentMedia
->
setupMedia
();
m_currentMedia
->
setDrawable
(
m_ui
->
clipRenderWidget
->
winId
()
);
m_currentMedia
->
play
();
...
...
src/gui/PreviewWidget.h
View file @
6f9f60da
...
...
@@ -26,7 +26,7 @@
#include
<QtGui/QDialog>
#include
<QDragEnterEvent>
#include
"
In
putMedia.h"
#include
"
Out
putMedia.h"
namespace
Ui
{
class
PreviewWidget
;
...
...
@@ -50,7 +50,7 @@ private slots:
private:
Ui
::
PreviewWidget
*
m_ui
;
In
putMedia
*
m_currentMedia
;
Out
putMedia
*
m_currentMedia
;
LibVLCpp
::
Instance
*
m_currentInstance
;
};
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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