Commit d4c628f7 authored by Hugo Beauzée-Luyssen's avatar Hugo Beauzée-Luyssen

Effects: Adding a MixerInstance class.

parent 8fffafa2
......@@ -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
......
......@@ -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;
}
......
......@@ -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
/*****************************************************************************
* EffectInstance.h: Handle a filter instance.
* FilterInstance.cpp: Handle a filter instance.
*****************************************************************************
* Copyright (C) 2008-2010 VideoLAN
*
......
/*****************************************************************************
* EffectInstance.h: Handle a filter instance.
* FilterInstance.h: Handle a filter instance.
*****************************************************************************
* Copyright (C) 2008-2010 VideoLAN
*
......
/*****************************************************************************
* MixerInstance.cpp: Handle a filter 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 "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 );
}
/*****************************************************************************
* MixerInstance.h: Handle a filter 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 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
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment