Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
VLMC
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
21
Issues
21
List
Boards
Labels
Service Desk
Milestones
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
VideoLAN
VLMC
Commits
1abba296
Commit
1abba296
authored
Jul 27, 2010
by
Hugo Beauzée-Luyssen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Effect: Adding an EffectInstance class.
Only load the effects when required.
parent
075622d2
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
143 additions
and
44 deletions
+143
-44
src/CMakeLists.txt
src/CMakeLists.txt
+2
-0
src/EffectsEngine/Effect.cpp
src/EffectsEngine/Effect.cpp
+3
-24
src/EffectsEngine/Effect.h
src/EffectsEngine/Effect.h
+10
-8
src/EffectsEngine/EffectInstance.cpp
src/EffectsEngine/EffectInstance.cpp
+62
-0
src/EffectsEngine/EffectInstance.h
src/EffectsEngine/EffectInstance.h
+49
-0
src/EffectsEngine/EffectsEngine.cpp
src/EffectsEngine/EffectsEngine.cpp
+3
-2
src/EffectsEngine/EffectsEngine.h
src/EffectsEngine/EffectsEngine.h
+6
-6
src/Renderer/WorkflowRenderer.cpp
src/Renderer/WorkflowRenderer.cpp
+4
-2
src/Workflow/VideoClipWorkflow.cpp
src/Workflow/VideoClipWorkflow.cpp
+4
-2
No files found.
src/CMakeLists.txt
View file @
1abba296
...
...
@@ -8,6 +8,7 @@ SET(VLMC_SRCS
Commands/Commands.cpp
EffectsEngine/EffectsEngine.cpp
EffectsEngine/Effect.cpp
EffectsEngine/EffectInstance.cpp
Library/Library.cpp
Library/MediaContainer.cpp
LibVLCpp/VLCInstance.cpp
...
...
@@ -55,6 +56,7 @@ ENDIF(WIN32)
SET
(
VLMC_HDRS
EffectsEngine/EffectsEngine.h
EffectsEngine/Effect.h
EffectsEngine/EffectInstance.h
Library/Library.h
Library/MediaContainer.h
LibVLCpp/VLCInstance.h
...
...
src/EffectsEngine/Effect.cpp
View file @
1abba296
...
...
@@ -28,19 +28,13 @@
Effect
::
Effect
(
const
QString
&
fileName
)
:
QLibrary
(
fileName
),
m_instance
(
NULL
),
m_width
(
0
),
m_height
(
0
)
m_type
(
Unknown
)
{
}
Effect
::~
Effect
()
{
m_f0r_deinit
();
if
(
m_instance
!=
NULL
)
{
m_f0r_destruct
(
m_instance
);
}
}
#define LOAD_FREI0R_SYMBOL( dest, symbolName ) \
...
...
@@ -53,6 +47,8 @@ if ( ( dest = reinterpret_cast<typeof( dest )>( resolve( symbolName ) ) ) == NUL
bool
Effect
::
load
()
{
if
(
isLoaded
()
==
true
)
return
true
;
LOAD_FREI0R_SYMBOL
(
m_f0r_init
,
"f0r_init"
);
LOAD_FREI0R_SYMBOL
(
m_f0r_deinit
,
"f0r_deinit"
)
LOAD_FREI0R_SYMBOL
(
m_f0r_info
,
"f0r_get_plugin_info"
)
...
...
@@ -90,20 +86,3 @@ Effect::type() const
{
return
m_type
;
}
void
Effect
::
init
(
quint32
width
,
quint32
height
)
{
if
(
width
!=
m_width
||
height
!=
m_height
)
{
m_instance
=
m_f0r_construct
(
width
,
height
);
m_width
=
width
;
m_height
=
height
;
}
}
void
Effect
::
process
(
double
time
,
const
quint32
*
input
,
quint32
*
output
)
const
{
m_f0r_update
(
m_instance
,
time
,
input
,
output
);
}
src/EffectsEngine/Effect.h
View file @
1abba296
...
...
@@ -27,11 +27,14 @@
#include "frei0r/frei0r.h"
class
EffectInstance
;
class
Effect
:
public
QLibrary
{
public:
enum
Type
{
Unknown
=
-
1
,
Filter
=
F0R_PLUGIN_TYPE_FILTER
,
Source
=
F0R_PLUGIN_TYPE_SOURCE
,
Mixer2
=
F0R_PLUGIN_TYPE_MIXER2
,
...
...
@@ -52,9 +55,13 @@ class Effect : public QLibrary
const
QString
&
name
()
const
;
const
QString
&
description
()
const
;
Type
type
()
const
;
void
init
(
quint32
width
,
quint32
height
);
void
process
(
double
time
,
const
quint32
*
input
,
quint32
*
output
)
const
;
private:
QString
m_name
;
QString
m_desc
;
Type
m_type
;
//Symbols:
f0r_init_t
m_f0r_init
;
f0r_deinit_t
m_f0r_deinit
;
f0r_get_info_t
m_f0r_info
;
...
...
@@ -62,12 +69,7 @@ class Effect : public QLibrary
f0r_destruct_t
m_f0r_destruct
;
f0r_update_t
m_f0r_update
;
f0r_instance_t
m_instance
;
QString
m_name
;
QString
m_desc
;
quint32
m_width
;
quint32
m_height
;
Type
m_type
;
friend
class
EffectInstance
;
};
#endif // EFFECT_H
src/EffectsEngine/EffectInstance.cpp
0 → 100644
View file @
1abba296
/*****************************************************************************
* EffectInstance.cpp: Handle an effect instance.
*****************************************************************************
* Copyright (C) 2008-2010 VideoLAN
*
* Authors: Hugo Beauzée-Luyssen <beauze.h@gmail.com>
*
* 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 "EffectInstance.h"
#include "Effect.h"
EffectInstance
::
EffectInstance
(
Effect
*
effect
)
:
m_effect
(
effect
),
m_width
(
0
),
m_height
(
0
),
m_instance
(
NULL
)
{
}
EffectInstance
::~
EffectInstance
()
{
m_effect
->
m_f0r_destruct
(
m_instance
);
}
void
EffectInstance
::
init
(
quint32
width
,
quint32
height
)
{
if
(
width
!=
m_width
||
height
!=
m_height
)
{
m_effect
->
load
();
m_instance
=
m_effect
->
m_f0r_construct
(
width
,
height
);
m_width
=
width
;
m_height
=
height
;
}
}
void
EffectInstance
::
process
(
double
time
,
const
quint32
*
input
,
quint32
*
output
)
const
{
m_effect
->
m_f0r_update
(
m_instance
,
time
,
input
,
output
);
}
const
Effect
*
EffectInstance
::
effect
()
const
{
return
m_effect
;
}
src/EffectsEngine/EffectInstance.h
0 → 100644
View file @
1abba296
/*****************************************************************************
* EffectInstance.h: Handle an effect instance.
*****************************************************************************
* Copyright (C) 2008-2010 VideoLAN
*
* Authors: Hugo Beauzée-Luyssen <beauze.h@gmail.com>
*
* 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 EFFECTINSTANCE_H
#define EFFECTINSTANCE_H
class
Effect
;
#include <QtGlobal>
#include "frei0r/frei0r.h"
class
EffectInstance
{
public:
EffectInstance
(
Effect
*
effect
);
~
EffectInstance
();
void
init
(
quint32
width
,
quint32
height
);
void
process
(
double
time
,
const
quint32
*
input
,
quint32
*
output
)
const
;
const
Effect
*
effect
()
const
;
private:
Effect
*
m_effect
;
quint32
m_width
;
quint32
m_height
;
f0r_instance_t
m_instance
;
};
#endif // EFFECTINSTANCE_H
src/EffectsEngine/EffectsEngine.cpp
View file @
1abba296
...
...
@@ -23,6 +23,7 @@
#include "EffectsEngine.h"
#include "Effect.h"
#include "EffectInstance.h"
#include "Types.h"
#include <QDir>
...
...
@@ -36,7 +37,7 @@ EffectsEngine::~EffectsEngine()
{
}
EffectsEngine
::
EffectHelper
::
EffectHelper
(
Effect
*
_effect
,
qint64
_start
,
qint64
_end
,
EffectsEngine
::
EffectHelper
::
EffectHelper
(
Effect
Instance
*
_effect
,
qint64
_start
,
qint64
_end
,
const
QString
&
_uuid
)
:
effect
(
_effect
),
start
(
_start
),
...
...
@@ -109,7 +110,7 @@ EffectsEngine::applyEffects( const EffectList &effects, Workflow::Frame* frame,
buff
=
&
buff2
;
if
(
*
buff
==
NULL
)
*
buff
=
new
quint8
[
frame
->
size
()];
Effect
*
effect
=
(
*
it
)
->
effect
;
Effect
Instance
*
effect
=
(
*
it
)
->
effect
;
effect
->
process
(
0.0
,
(
quint32
*
)
input
,
(
quint32
*
)
*
buff
);
input
=
*
buff
;
firstBuff
=
!
firstBuff
;
...
...
src/EffectsEngine/EffectsEngine.h
View file @
1abba296
...
...
@@ -38,12 +38,12 @@ class EffectsEngine : public QObject, public Singleton<EffectsEngine>
public:
struct
EffectHelper
{
EffectHelper
(
Effect
*
effect
,
qint64
start
=
0
,
qint64
end
=
-
1
,
EffectHelper
(
Effect
Instance
*
effect
,
qint64
start
=
0
,
qint64
end
=
-
1
,
const
QString
&
uuid
=
QString
()
);
Effect
*
effect
;
qint64
start
;
qint64
end
;
QUuid
uuid
;
Effect
Instance
*
effect
;
qint64
start
;
qint64
end
;
QUuid
uuid
;
};
typedef
QList
<
EffectHelper
*>
EffectList
;
...
...
@@ -57,7 +57,7 @@ class EffectsEngine : public QObject, public Singleton<EffectsEngine>
EffectsEngine
();
~
EffectsEngine
();
QHash
<
QString
,
Effect
*>
m_effects
;
QHash
<
QString
,
Effect
*>
m_effects
;
signals:
void
effectAdded
(
Effect
*
,
Effect
::
Type
);
...
...
src/Renderer/WorkflowRenderer.cpp
View file @
1abba296
...
...
@@ -28,6 +28,7 @@
#include <inttypes.h>
#include "Clip.h"
#include "EffectInstance.h"
#include "GenericRenderer.h"
#include "MainWorkflow.h"
#include "SettingsManager.h"
...
...
@@ -386,9 +387,10 @@ WorkflowRenderer::paramsHasChanged( quint32 width, quint32 height, double fps )
void
WorkflowRenderer
::
appendEffect
(
Effect
*
effect
,
qint64
start
,
qint64
end
)
{
effect
->
init
(
m_width
,
m_height
);
EffectInstance
*
effectInstance
=
new
EffectInstance
(
effect
);
effectInstance
->
init
(
m_width
,
m_height
);
QWriteLocker
lock
(
m_effectsLock
);
m_effects
.
push_back
(
new
EffectsEngine
::
EffectHelper
(
effect
,
start
,
end
)
);
m_effects
.
push_back
(
new
EffectsEngine
::
EffectHelper
(
effect
Instance
,
start
,
end
)
);
}
/////////////////////////////////////////////////////////////////////
...
...
src/Workflow/VideoClipWorkflow.cpp
View file @
1abba296
...
...
@@ -21,6 +21,7 @@
*****************************************************************************/
#include "Clip.h"
#include "EffectInstance.h"
#include "MainWorkflow.h"
#include "StackedBuffer.hpp"
#include "VideoClipWorkflow.h"
...
...
@@ -213,9 +214,10 @@ VideoClipWorkflow::appendEffect( Effect *effect, qint64 start, qint64 end )
qWarning
()
<<
"VideoClipWorkflow does not handle non filter effects."
;
return
false
;
}
effect
->
init
(
m_width
,
m_height
);
EffectInstance
*
effectInstance
=
new
EffectInstance
(
effect
);
effectInstance
->
init
(
m_width
,
m_height
);
QWriteLocker
lock
(
m_effectsLock
);
m_effects
.
push_back
(
new
EffectsEngine
::
EffectHelper
(
effect
,
start
,
end
)
);
m_effects
.
push_back
(
new
EffectsEngine
::
EffectHelper
(
effect
Instance
,
start
,
end
)
);
return
true
;
}
...
...
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