[vlmc-devel] commit: Effects: Adding a MixerInstance class. ( Hugo Beauzée-Luyssen )
git at videolan.org
git at videolan.org
Sun Aug 15 23:29:33 CEST 2010
vlmc | branch: master | Hugo Beauzée-Luyssen <beauze.h at gmail.com> | Mon Aug 16 01:17:57 2010 +0200| [d4c628f70f989fa94b52c21772aad84f686909e8] | committer: Hugo Beauzée-Luyssen
Effects: Adding a MixerInstance class.
> http://git.videolan.org/gitweb.cgi/vlmc.git/?a=commit;h=d4c628f70f989fa94b52c21772aad84f686909e8
---
src/CMakeLists.txt | 1 +
src/EffectsEngine/Effect.cpp | 28 +++++++++++++++++++------
src/EffectsEngine/Effect.h | 3 ++
src/EffectsEngine/FilterInstance.cpp | 2 +-
src/EffectsEngine/FilterInstance.h | 2 +-
src/EffectsEngine/MixerInstance.cpp | 37 ++++++++++++++++++++++++++++++++++
src/EffectsEngine/MixerInstance.h | 36 +++++++++++++++++++++++++++++++++
7 files changed, 100 insertions(+), 9 deletions(-)
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index c99c7cf..151e5ee 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -10,6 +10,7 @@ SET(VLMC_SRCS
EffectsEngine/Effect.cpp
EffectsEngine/EffectInstance.cpp
EffectsEngine/FilterInstance.cpp
+ EffectsEngine/MixerInstance.cpp
Library/Library.cpp
Library/MediaContainer.cpp
LibVLCpp/VLCInstance.cpp
diff --git a/src/EffectsEngine/Effect.cpp b/src/EffectsEngine/Effect.cpp
index f9be544..0f7f975 100644
--- a/src/EffectsEngine/Effect.cpp
+++ b/src/EffectsEngine/Effect.cpp
@@ -41,7 +41,10 @@ Effect::~Effect()
}
#define LOAD_FREI0R_SYMBOL( dest, symbolName ) \
-if ( ( dest = reinterpret_cast<typeof( dest )>( resolve( symbolName ) ) ) == NULL ) \
+dest = reinterpret_cast<typeof( dest )>( resolve( symbolName ) )
+
+#define LOAD_FREI0R_SYMBOL_CHECKED( dest, symbolName ) \
+if ( ( LOAD_FREI0R_SYMBOL( dest, symbolName ) ) == NULL ) \
{ \
qCritical() << "Failed to load symbol:" << symbolName; \
return false; \
@@ -52,12 +55,13 @@ 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" )
- LOAD_FREI0R_SYMBOL( m_f0r_construct, "f0r_construct" )
- LOAD_FREI0R_SYMBOL( m_f0r_destruct, "f0r_destruct" )
- LOAD_FREI0R_SYMBOL( m_f0r_update, "f0r_update" )
+ LOAD_FREI0R_SYMBOL_CHECKED( m_f0r_init, "f0r_init" )
+ LOAD_FREI0R_SYMBOL_CHECKED( m_f0r_deinit, "f0r_deinit" )
+ LOAD_FREI0R_SYMBOL_CHECKED( m_f0r_info, "f0r_get_plugin_info" )
+ LOAD_FREI0R_SYMBOL_CHECKED( m_f0r_construct, "f0r_construct" )
+ LOAD_FREI0R_SYMBOL_CHECKED( m_f0r_destruct, "f0r_destruct" )
+ LOAD_FREI0R_SYMBOL( m_f0r_update, "f0r_update" );
+ LOAD_FREI0R_SYMBOL( m_f0r_update2, "f0r_update2" );
//Initializing structures
f0r_plugin_info_t infos;
@@ -70,6 +74,16 @@ Effect::load()
m_major = infos.major_version;
m_minor = infos.minor_version;
m_nbParams = infos.num_params;
+ if ( m_type == Filter && m_f0r_update == NULL )
+ {
+ qCritical() << "Failed to load symbol f0r_update. Dropping module" << fileName();
+ return false;
+ }
+ if ( ( m_type == Mixer2 || m_type == Mixer3 ) && m_f0r_update2 == NULL )
+ {
+ qCritical() << "Failed to load symbol f0r_update2. Dropping module" << fileName();
+ return false;
+ }
return true;
}
diff --git a/src/EffectsEngine/Effect.h b/src/EffectsEngine/Effect.h
index b05c2f5..d89ce16 100644
--- a/src/EffectsEngine/Effect.h
+++ b/src/EffectsEngine/Effect.h
@@ -47,6 +47,7 @@ class Effect : public QLibrary
typedef f0r_instance_t (*f0r_construct_t)( unsigned int, unsigned int );
typedef void (*f0r_destruct_t)( f0r_instance_t );
typedef void (*f0r_update_t)( f0r_instance_t, double, const unsigned int*, unsigned int * );
+ typedef void (*f0r_update2_t)( f0r_instance_t, double, const unsigned int*, const unsigned int*, const unsigned int*, unsigned int * );
Effect( const QString& fileName );
virtual ~Effect();
@@ -79,9 +80,11 @@ class Effect : public QLibrary
f0r_construct_t m_f0r_construct;
f0r_destruct_t m_f0r_destruct;
f0r_update_t m_f0r_update;
+ f0r_update2_t m_f0r_update2;
friend class EffectInstance;
friend class FilterInstance;
+ friend class MixerInstance;
};
#endif // EFFECT_H
diff --git a/src/EffectsEngine/FilterInstance.cpp b/src/EffectsEngine/FilterInstance.cpp
index e21ccbb..9083a87 100644
--- a/src/EffectsEngine/FilterInstance.cpp
+++ b/src/EffectsEngine/FilterInstance.cpp
@@ -1,5 +1,5 @@
/*****************************************************************************
- * EffectInstance.h: Handle a filter instance.
+ * FilterInstance.cpp: Handle a filter instance.
*****************************************************************************
* Copyright (C) 2008-2010 VideoLAN
*
diff --git a/src/EffectsEngine/FilterInstance.h b/src/EffectsEngine/FilterInstance.h
index 7311b8d..5b98f68 100644
--- a/src/EffectsEngine/FilterInstance.h
+++ b/src/EffectsEngine/FilterInstance.h
@@ -1,5 +1,5 @@
/*****************************************************************************
- * EffectInstance.h: Handle a filter instance.
+ * FilterInstance.h: Handle a filter instance.
*****************************************************************************
* Copyright (C) 2008-2010 VideoLAN
*
diff --git a/src/EffectsEngine/MixerInstance.cpp b/src/EffectsEngine/MixerInstance.cpp
new file mode 100644
index 0000000..3b6107a
--- /dev/null
+++ b/src/EffectsEngine/MixerInstance.cpp
@@ -0,0 +1,37 @@
+/*****************************************************************************
+ * MixerInstance.cpp: Handle a filter instance.
+ *****************************************************************************
+ * Copyright (C) 2008-2010 VideoLAN
+ *
+ * Authors: Hugo Beauzée-Luyssen <beauze.h at 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 "MixerInstance.h"
+
+#include "Effect.h"
+
+MixerInstance::MixerInstance( Effect *effect ) :
+ EffectInstance( effect )
+{
+}
+
+void
+MixerInstance::process( double time, const quint32 *frame1, const quint32 *frame2,
+ const quint32 *frame3, quint32 *output )
+{
+ m_effect->m_f0r_update2( m_instance, time, frame1, frame2, frame3, output );
+}
diff --git a/src/EffectsEngine/MixerInstance.h b/src/EffectsEngine/MixerInstance.h
new file mode 100644
index 0000000..9877fd6
--- /dev/null
+++ b/src/EffectsEngine/MixerInstance.h
@@ -0,0 +1,36 @@
+/*****************************************************************************
+ * MixerInstance.h: Handle a filter instance.
+ *****************************************************************************
+ * Copyright (C) 2008-2010 VideoLAN
+ *
+ * Authors: Hugo Beauzée-Luyssen <beauze.h at 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 MIXERINSTANCE_H
+#define MIXERINSTANCE_H
+
+#include "EffectInstance.h"
+
+class MixerInstance : public EffectInstance
+{
+ public:
+ MixerInstance( Effect *effect );
+ void process( double time, const quint32 *frame1, const quint32 *frame2,
+ const quint32 *frame3, quint32 *output );
+};
+
+#endif // MIXERINSTANCE_H
More information about the Vlmc-devel
mailing list