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
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
f8db26d6
Commit
f8db26d6
authored
Jul 27, 2010
by
Hugo Beauzée-Luyssen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Effects: Refcount the instances, and unload the module when it become unused
parent
3cc5ace1
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
29 additions
and
5 deletions
+29
-5
src/EffectsEngine/Effect.cpp
src/EffectsEngine/Effect.cpp
+17
-0
src/EffectsEngine/Effect.h
src/EffectsEngine/Effect.h
+5
-0
src/EffectsEngine/EffectInstance.h
src/EffectsEngine/EffectInstance.h
+5
-3
src/Renderer/WorkflowRenderer.cpp
src/Renderer/WorkflowRenderer.cpp
+1
-1
src/Workflow/VideoClipWorkflow.cpp
src/Workflow/VideoClipWorkflow.cpp
+1
-1
No files found.
src/EffectsEngine/Effect.cpp
View file @
f8db26d6
...
...
@@ -21,6 +21,7 @@
*****************************************************************************/
#include "Effect.h"
#include "EffectInstance.h"
#include "frei0r/frei0r.h"
...
...
@@ -92,3 +93,19 @@ Effect::type()
load
();
return
m_type
;
}
EffectInstance
*
Effect
::
createInstance
()
{
m_instCount
.
fetchAndAddAcquire
(
1
);
return
new
EffectInstance
(
this
);
}
void
Effect
::
destroyInstance
(
EffectInstance
*
instance
)
{
delete
instance
;
//fetchAndAddAcquire returns the old value.
if
(
m_instCount
.
fetchAndAddAcquire
(
-
1
)
==
1
)
unload
();
}
src/EffectsEngine/Effect.h
View file @
f8db26d6
...
...
@@ -55,11 +55,16 @@ class Effect : public QLibrary
const
QString
&
name
();
const
QString
&
description
();
Type
type
();
EffectInstance
*
createInstance
();
private:
void
destroyInstance
(
EffectInstance
*
instance
);
private:
QString
m_name
;
QString
m_desc
;
Type
m_type
;
QAtomicInt
m_instCount
;
//Symbols:
f0r_init_t
m_f0r_init
;
...
...
src/EffectsEngine/EffectInstance.h
View file @
f8db26d6
...
...
@@ -31,19 +31,21 @@ class Effect;
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:
EffectInstance
(
Effect
*
effect
);
~
EffectInstance
();
Effect
*
m_effect
;
quint32
m_width
;
quint32
m_height
;
f0r_instance_t
m_instance
;
friend
class
Effect
;
};
#endif // EFFECTINSTANCE_H
src/Renderer/WorkflowRenderer.cpp
View file @
f8db26d6
...
...
@@ -387,7 +387,7 @@ WorkflowRenderer::paramsHasChanged( quint32 width, quint32 height, double fps )
void
WorkflowRenderer
::
appendEffect
(
Effect
*
effect
,
qint64
start
,
qint64
end
)
{
EffectInstance
*
effectInstance
=
new
EffectInstance
(
effect
);
EffectInstance
*
effectInstance
=
effect
->
createInstance
(
);
effectInstance
->
init
(
m_width
,
m_height
);
QWriteLocker
lock
(
m_effectsLock
);
m_effects
.
push_back
(
new
EffectsEngine
::
EffectHelper
(
effectInstance
,
start
,
end
)
);
...
...
src/Workflow/VideoClipWorkflow.cpp
View file @
f8db26d6
...
...
@@ -214,7 +214,7 @@ VideoClipWorkflow::appendEffect( Effect *effect, qint64 start, qint64 end )
qWarning
()
<<
"VideoClipWorkflow does not handle non filter effects."
;
return
false
;
}
EffectInstance
*
effectInstance
=
new
EffectInstance
(
effect
);
EffectInstance
*
effectInstance
=
effect
->
createInstance
(
);
effectInstance
->
init
(
m_width
,
m_height
);
QWriteLocker
lock
(
m_effectsLock
);
m_effects
.
push_back
(
new
EffectsEngine
::
EffectHelper
(
effectInstance
,
start
,
end
)
);
...
...
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