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
26795455
Commit
26795455
authored
May 19, 2009
by
Hugo Beauzee-Luyssen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Started Clip Workflow
Removed useless stuff from VLCMedia
parent
cfa0f3fd
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
181 additions
and
41 deletions
+181
-41
src/LibVLCpp/VLCMedia.cpp
src/LibVLCpp/VLCMedia.cpp
+6
-23
src/LibVLCpp/VLCMedia.h
src/LibVLCpp/VLCMedia.h
+3
-14
src/MetaDataManager.cpp
src/MetaDataManager.cpp
+1
-1
src/Workflow/ClipWorkflow.cpp
src/Workflow/ClipWorkflow.cpp
+100
-0
src/Workflow/ClipWorkflow.h
src/Workflow/ClipWorkflow.h
+66
-0
vlmc.pro
vlmc.pro
+5
-3
No files found.
src/LibVLCpp/VLCMedia.cpp
View file @
26795455
...
...
@@ -27,7 +27,7 @@
using
namespace
LibVLCpp
;
Media
::
Media
(
const
QString
&
filename
)
:
m_dataCtx
(
NULL
),
m_pixelBuffer
(
NULL
)
:
m_pixelBuffer
(
NULL
)
{
m_internalPtr
=
libvlc_media_new
(
*
(
LibVLCpp
::
Instance
::
getInstance
()),
filename
.
toLocal8Bit
(),
m_ex
);
CheckVlcppException
(
m_ex
);
...
...
@@ -36,18 +36,6 @@ Media::Media( const QString& filename )
Media
::~
Media
()
{
libvlc_media_release
(
m_internalPtr
);
if
(
m_pixelBuffer
!=
NULL
)
delete
[]
m_pixelBuffer
;
if
(
m_dataCtx
!=
NULL
)
delete
m_dataCtx
;
}
Media
::
DataCtx
*
Media
::
buildDataCtx
()
{
Media
::
DataCtx
*
dataCtx
=
new
Media
::
DataCtx
;
dataCtx
->
mutex
=
new
QMutex
();
dataCtx
->
media
=
this
;
return
dataCtx
;
}
void
Media
::
addOption
(
const
char
*
opt
)
...
...
@@ -57,11 +45,6 @@ void Media::addOption( const char* opt )
qDebug
()
<<
"Added media option: "
<<
opt
;
}
Media
::
DataCtx
::~
DataCtx
()
{
delete
mutex
;
}
void
Media
::
setLockCallback
(
Media
::
lockCallback
callback
)
{
char
param
[
64
];
...
...
@@ -76,15 +59,15 @@ void Media::setUnlockCallback( Media::unlockCallback callback
addOption
(
param
);
}
void
Media
::
setDataCtx
()
void
Media
::
setDataCtx
(
void
*
dataCtx
)
{
char
param
[
64
];
m_dataCtx
=
new
Media
::
DataCtx
;
m_dataCtx
->
mutex
=
new
QMutex
();
m_dataCtx
->
media
=
this
;
//
m_dataCtx = new Media::DataCtx;
//
m_dataCtx->mutex = new QMutex();
//
m_dataCtx->media = this;
sprintf
(
param
,
":vmem-data=%lld"
,
(
qint64
)(
intptr_t
)
m_
dataCtx
);
sprintf
(
param
,
":vmem-data=%lld"
,
(
qint64
)(
intptr_t
)
dataCtx
);
addOption
(
param
);
}
...
...
src/LibVLCpp/VLCMedia.h
View file @
26795455
...
...
@@ -32,39 +32,28 @@
#include "VLCException.h"
#include "VLCInstance.h"
#define VIDEOWIDTH 854
#define VIDEOHEIGHT 480
namespace
LibVLCpp
{
class
Media
:
public
Internal
<
libvlc_media_t
>
{
public:
struct
DataCtx
{
~
DataCtx
();
QMutex
*
mutex
;
Media
*
media
;
};
typedef
void
(
*
lockCallback
)(
Media
::
DataCtx
*
dataCtx
,
void
**
pp_ret
);
typedef
void
(
*
unlockCallback
)(
Media
::
DataCtx
*
dataCtx
);
typedef
void
(
*
lockCallback
)(
void
*
dataCtx
,
void
**
pp_ret
);
typedef
void
(
*
unlockCallback
)(
void
*
dataCtx
);
Media
(
const
QString
&
filename
);
~
Media
();
void
addOption
(
const
char
*
opt
);
void
setLockCallback
(
Media
::
lockCallback
);
void
setUnlockCallback
(
Media
::
unlockCallback
);
void
setDataCtx
();
void
setDataCtx
(
void
*
dataCtx
);
void
outputInVmem
();
void
outputInWindow
();
void
setPixelBuffer
(
uchar
*
buffer
);
uchar
*
getPixelBuffer
();
private:
DataCtx
*
buildDataCtx
();
Exception
m_ex
;
DataCtx
*
m_dataCtx
;
uchar
*
m_pixelBuffer
;
};
}
...
...
src/MetaDataManager.cpp
View file @
26795455
...
...
@@ -130,7 +130,7 @@ void MetaDataManager::setSnapshot()
//This is synchrone, but it may become asynchrone in the future...
m_mediaPlayer
->
stop
();
//
startAudioDataParsing();
startAudioDataParsing
();
}
void
MetaDataManager
::
startAudioDataParsing
()
...
...
src/Workflow/ClipWorkflow.cpp
0 → 100644
View file @
26795455
/*****************************************************************************
* ClipWorkflow.cpp : Clip workflow. Will extract a single frame from a VLCMedia
*****************************************************************************
* Copyright (C) 2008-2009 the VLMC team
*
* Authors: Hugo Beauzee-Luyssen <hugo@vlmc.org>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#include "ClipWorkflow.h"
ClipWorkflow
::
ClipWorkflow
(
Clip
::
Clip
*
clip
,
QMutex
*
condMutex
,
QWaitCondition
*
waitCond
)
:
m_clip
(
clip
),
m_renderComplete
(
true
),
m_buffer
(
NULL
),
m_condMutex
(
condMutex
),
m_waitCond
(
waitCond
),
m_mediaPlayer
(
NULL
)
{
m_mutex
=
new
QReadWriteLock
();
}
ClipWorkflow
::~
ClipWorkflow
()
{
delete
m_mutex
;
}
bool
ClipWorkflow
::
renderComplete
()
const
{
QReadLocker
lock
(
m_mutex
);
return
m_renderComplete
;
}
const
unsigned
char
*
ClipWorkflow
::
getOutput
()
const
{
return
m_buffer
;
}
void
ClipWorkflow
::
lock
(
ClipWorkflow
*
clipWorkflow
,
void
**
pp_ret
)
{
//It doesn't seems necessary to lock anything here, since the scheduler
//will wait until the frame is ready to use it, and doesn't use it after
//it has asked for a new one.
*
pp_ret
=
clipWorkflow
->
m_buffer
;
}
void
ClipWorkflow
::
unlock
(
ClipWorkflow
*
clipWorkflow
)
{
QMutexLocker
lock
(
clipWorkflow
->
m_condMutex
);
{
QWriteLocker
lock2
(
clipWorkflow
->
m_mutex
);
clipWorkflow
->
m_renderComplete
=
true
;
}
clipWorkflow
->
m_waitCond
->
wait
(
clipWorkflow
->
m_condMutex
);
}
void
ClipWorkflow
::
initialize
()
{
char
buffer
[
32
];
//TODO: it would be good if we somehow backup the old media parameters to restore it later.
m_clip
->
getParent
()
->
getVLCMedia
()
->
addOption
(
":vout=vmem"
);
m_clip
->
getParent
()
->
getVLCMedia
()
->
setDataCtx
(
this
);
m_clip
->
getParent
()
->
getVLCMedia
()
->
setLockCallback
(
reinterpret_cast
<
LibVLCpp
::
Media
::
lockCallback
>
(
&
ClipWorkflow
::
lock
)
);
m_clip
->
getParent
()
->
getVLCMedia
()
->
setUnlockCallback
(
reinterpret_cast
<
LibVLCpp
::
Media
::
unlockCallback
>
(
&
ClipWorkflow
::
unlock
)
);
m_clip
->
getParent
()
->
getVLCMedia
()
->
addOption
(
":vmem-chroma=RV32"
);
sprintf
(
buffer
,
":vmem-width=%i"
,
VIDEOWIDTH
);
m_clip
->
getParent
()
->
getVLCMedia
()
->
addOption
(
buffer
);
sprintf
(
buffer
,
":vmem-height=%i"
,
VIDEOHEIGHT
);
m_clip
->
getParent
()
->
getVLCMedia
()
->
addOption
(
buffer
);
}
void
ClipWorkflow
::
startRender
(
LibVLCpp
::
MediaPlayer
*
mediaPlayer
)
{
initialize
();
m_mediaPlayer
=
mediaPlayer
;
m_mediaPlayer
->
setMedia
(
m_clip
->
getParent
()
->
getVLCMedia
()
);
//If Clip starts at 0, we can play it directly.
m_mediaPlayer
->
play
();
//else, we should set it position before.
//TODO...
}
src/Workflow/ClipWorkflow.h
0 → 100644
View file @
26795455
/*****************************************************************************
* ClipWorkflow.h : Clip workflow. Will extract a single frame from a VLCMedia
*****************************************************************************
* Copyright (C) 2008-2009 the VLMC team
*
* Authors: Hugo Beauzee-Luyssen <hugo@vlmc.org>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#ifndef CLIPWORKFLOW_H
#define CLIPWORKFLOW_H
//TODO: THIS HAS TO GO REALLY REALLY REALLY SOON !!!!
//FIXME:
//UGLY:
#define VIDEOWIDTH 640
#define VIDEOHEIGHT 480
#include <QReadWriteLock>
#include <QMutex>
#include <QWaitCondition>
#include <QObject>
#include "Clip.h"
#include "VLCMediaPlayer.h"
class
ClipWorkflow
:
public
QObject
{
Q_OBJECT
public:
ClipWorkflow
(
Clip
*
clip
,
QMutex
*
condMutex
,
QWaitCondition
*
waitCond
);
virtual
~
ClipWorkflow
();
bool
renderComplete
()
const
;
const
unsigned
char
*
getOutput
()
const
;
void
startRender
(
LibVLCpp
::
MediaPlayer
*
mediaPlayer
);
private:
static
void
lock
(
ClipWorkflow
*
clipWorkflow
,
void
**
pp_ret
);
static
void
unlock
(
ClipWorkflow
*
clipWorkflow
);
void
initialize
();
private:
Clip
*
m_clip
;
QReadWriteLock
*
m_mutex
;
bool
m_renderComplete
;
unsigned
char
*
m_buffer
;
QMutex
*
m_condMutex
;
QWaitCondition
*
m_waitCond
;
LibVLCpp
::
MediaPlayer
*
m_mediaPlayer
;
};
#endif // CLIPWORKFLOW_H
vlmc.pro
View file @
26795455
...
...
@@ -39,7 +39,8 @@ SOURCES += src/main.cpp \
src
/
gui
/
FileBrowser
.
cpp
\
src
/
gui
/
GraphicsCursorItem
.
cpp
\
src
/
TimelineBackend
.
cpp
\
src
/
Track
.
cpp
src
/
Track
.
cpp
\
src
/
Workflow
/
ClipWorkflow
.
cpp
HEADERS
+=
src
/
gui
/
MainWindow
.
h
\
src
/
gui
/
DockWidgetManager
.
h
\
src
/
gui
/
LibraryWidget
.
h
\
...
...
@@ -71,7 +72,8 @@ HEADERS += src/gui/MainWindow.h \
src
/
gui
/
FileBrowser
.
h
\
src
/
gui
/
GraphicsCursorItem
.
h
\
src
/
TimelineBackend
.
h
\
src
/
Track
.
h
src
/
Track
.
h
\
src
/
Workflow
/
ClipWorkflow
.
h
FORMS
+=
src
/
gui
/
ui
/
MainWindow
.
ui
\
src
/
gui
/
ui
/
PreviewWidget
.
ui
\
src
/
gui
/
ui
/
Preferences
.
ui
\
...
...
@@ -80,7 +82,7 @@ FORMS += src/gui/ui/MainWindow.ui \
src
/
gui
/
ui
/
About
.
ui
\
src
/
gui
/
ui
/
Transcode
.
ui
\
src
/
gui
/
ui
/
FileBrowser
.
ui
FORMS
+=
FORMS
+=
TRANSLATIONS
=
ts
/
vlmc_es
.
ts
\
ts
/
vlmc_fr
.
ts
\
ts
/
vlmc_sv
.
ts
...
...
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