Thread: [Hdrflow-svn] SF.net SVN: hdrflow: [106] lib/openlibraries/src/openmedialib/plugins/ofx/ ofx_plugin
Status: Pre-Alpha
Brought to you by:
glslang
|
From: <gl...@us...> - 2007-04-27 23:47:48
|
Revision: 106
http://hdrflow.svn.sourceforge.net/hdrflow/?rev=106&view=rev
Author: glslang
Date: 2007-04-27 16:47:47 -0700 (Fri, 27 Apr 2007)
Log Message:
-----------
+ more ofx bindings
Modified Paths:
--------------
lib/openlibraries/src/openmedialib/plugins/ofx/ofx_plugin.cpp
Modified: lib/openlibraries/src/openmedialib/plugins/ofx/ofx_plugin.cpp
===================================================================
--- lib/openlibraries/src/openmedialib/plugins/ofx/ofx_plugin.cpp 2007-04-27 22:05:41 UTC (rev 105)
+++ lib/openlibraries/src/openmedialib/plugins/ofx/ofx_plugin.cpp 2007-04-27 23:47:47 UTC (rev 106)
@@ -1001,15 +1001,15 @@
, image_effect_prop_components_( pcos::key::from_string( kOfxImageEffectPropComponents ) )
, image_effect_prop_pre_multiplication_( pcos::key::from_string( kOfxImageEffectPropPreMultiplication ) )
, image_effect_prop_render_scale_( pcos::key::from_string( kOfxImageEffectPropRenderScale ) )
- , image_effect_prop_pixel_aspect_ratio_( pcos::key::from_string( kOfxImagePropPixelAspectRatio ) )
- , image_effect_prop_data_( pcos::key::from_string( kOfxImagePropData ) )
- , image_effect_prop_bounds_( pcos::key::from_string( kOfxImagePropBounds ) )
- , image_effect_prop_region_of_definition_( pcos::key::from_string( kOfxImagePropRegionOfDefinition ) )
- , image_effect_prop_row_bytes_( pcos::key::from_string( kOfxImagePropRowBytes ) )
- , image_effect_prop_field_( pcos::key::from_string( kOfxImagePropField ) )
- , image_effect_prop_unique_identifier_( pcos::key::from_string( kOfxImagePropUniqueIdentifier ) )
+ , image_prop_pixel_aspect_ratio_( pcos::key::from_string( kOfxImagePropPixelAspectRatio ) )
+ , image_prop_data_( pcos::key::from_string( kOfxImagePropData ) )
+ , image_prop_bounds_( pcos::key::from_string( kOfxImagePropBounds ) )
+ , image_prop_region_of_definition_( pcos::key::from_string( kOfxImagePropRegionOfDefinition ) )
+ , image_prop_row_bytes_( pcos::key::from_string( kOfxImagePropRowBytes ) )
+ , image_prop_field_( pcos::key::from_string( kOfxImagePropField ) )
+ , image_prop_unique_identifier_( pcos::key::from_string( kOfxImagePropUniqueIdentifier ) )
{
- image_props_.append( image_prop_type_ = kOfxTypeImage );
+ set_image_properties( );
}
virtual property_container_ptr get_property_set( )
@@ -1017,15 +1017,47 @@
bool set_image( il::image_type_ptr im )
{
+ if( !im )
+ return false;
+
+ // TODO: handle bit depths properly.
il::image_type_ptr dst_img = il::convert( im, L"r8g8b8a8" );
- if( dst_img )
- {
-
-
- return true;
- }
+ if( !dst_img )
+ return false;
+
+ image_prop_data_ = ( void* ) dst_img->data( );
+
+ int_vec i_vec( 4 );
+ i_vec[ 0 ] = 0; i_vec[ 1 ] = 0; i_vec[ 2 ] = dst_img->width( ); i_vec[ 3 ] = dst_img->height( );
+ image_prop_bounds_ = i_vec;
+ image_prop_region_of_definition_ = i_vec;
+
+ image_prop_row_bytes_ = dst_img->pitch( );
+
+ return true;
+ }
+
+ private:
+ void set_image_properties( )
+ {
+ double_vec d_vec( 2 );
+ d_vec[ 0 ] = 1.0; d_vec[ 1 ] = 1.0;
- return false;
+ int_vec i_vec( 4 );
+ i_vec[ 0 ] = 0; i_vec[ 1 ] = 0; i_vec[ 2 ] = 0; i_vec[ 3 ] = 0;
+
+ image_props_.append( image_prop_type_ = kOfxTypeImage );
+ image_props_.append( image_effect_prop_pixel_depth_ = kOfxBitDepthNone );
+ image_props_.append( image_effect_prop_components_ = kOfxImageComponentNone );
+ image_props_.append( image_effect_prop_pre_multiplication_ = kOfxImageUnPreMultiplied );
+ image_props_.append( image_effect_prop_render_scale_ = d_vec );
+ image_props_.append( image_prop_pixel_aspect_ratio_ = 1.0 );
+ image_props_.append( image_prop_data_ = ( void* ) 0 );
+ image_props_.append( image_prop_bounds_ = i_vec );
+ image_props_.append( image_prop_region_of_definition_ = i_vec );
+ image_props_.append( image_prop_row_bytes_ = 0 );
+ image_props_.append( image_prop_field_ = kOfxImageFieldNone );
+ image_props_.append( image_prop_unique_identifier_ = "No Unique Identifier" );
}
private:
@@ -1035,13 +1067,13 @@
pcos::property image_effect_prop_components_;
pcos::property image_effect_prop_pre_multiplication_;
pcos::property image_effect_prop_render_scale_;
- pcos::property image_effect_prop_pixel_aspect_ratio_;
- pcos::property image_effect_prop_data_;
- pcos::property image_effect_prop_bounds_;
- pcos::property image_effect_prop_region_of_definition_;
- pcos::property image_effect_prop_row_bytes_;
- pcos::property image_effect_prop_field_;
- pcos::property image_effect_prop_unique_identifier_;
+ pcos::property image_prop_pixel_aspect_ratio_;
+ pcos::property image_prop_data_;
+ pcos::property image_prop_bounds_;
+ pcos::property image_prop_region_of_definition_;
+ pcos::property image_prop_row_bytes_;
+ pcos::property image_prop_field_;
+ pcos::property image_prop_unique_identifier_;
};
class clip_descriptor : public Ofx_base
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gl...@us...> - 2007-05-01 00:51:01
|
Revision: 108
http://hdrflow.svn.sourceforge.net/hdrflow/?rev=108&view=rev
Author: glslang
Date: 2007-04-30 17:50:58 -0700 (Mon, 30 Apr 2007)
Log Message:
-----------
+ explicit initialisation of OFX string to pl::strings
Modified Paths:
--------------
lib/openlibraries/src/openmedialib/plugins/ofx/ofx_plugin.cpp
Modified: lib/openlibraries/src/openmedialib/plugins/ofx/ofx_plugin.cpp
===================================================================
--- lib/openlibraries/src/openmedialib/plugins/ofx/ofx_plugin.cpp 2007-04-30 23:56:54 UTC (rev 107)
+++ lib/openlibraries/src/openmedialib/plugins/ofx/ofx_plugin.cpp 2007-05-01 00:50:58 UTC (rev 108)
@@ -1050,18 +1050,18 @@
render_scale[ 0 ] = 1.0;
render_scale[ 1 ] = 1.0;
- image_props_.append( image_prop_type_ = kOfxTypeImage );
- image_props_.append( image_effect_prop_pixel_depth_ = kOfxBitDepthNone );
- image_props_.append( image_effect_prop_components_ = kOfxImageComponentNone );
- image_props_.append( image_effect_prop_pre_multiplication_ = kOfxImageUnPreMultiplied );
+ image_props_.append( image_prop_type_ = pl::string( kOfxTypeImage ) );
+ image_props_.append( image_effect_prop_pixel_depth_ = pl::string( kOfxBitDepthNone ) );
+ image_props_.append( image_effect_prop_components_ = pl::string( kOfxImageComponentNone ) );
+ image_props_.append( image_effect_prop_pre_multiplication_ = pl::string( kOfxImageUnPreMultiplied ) );
image_props_.append( image_effect_prop_render_scale_ = render_scale );
image_props_.append( image_prop_pixel_aspect_ratio_ = 1.0 );
image_props_.append( image_prop_data_ = ( void* ) 0 );
image_props_.append( image_prop_bounds_ = int_vec( 4 ) );
image_props_.append( image_prop_region_of_definition_ = int_vec( 4 ) );
image_props_.append( image_prop_row_bytes_ = 0 );
- image_props_.append( image_prop_field_ = kOfxImageFieldNone );
- image_props_.append( image_prop_unique_identifier_ = "No Unique Identifier" );
+ image_props_.append( image_prop_field_ = pl::string( kOfxImageFieldNone ) );
+ image_props_.append( image_prop_unique_identifier_ = pl::string( "No Unique Identifier" ) );
}
private:
@@ -1105,15 +1105,15 @@
private:
void set_clip_descriptor_properties( )
{
- clip_descriptor_props_.append( clip_descriptor_prop_type_ = kOfxTypeClip );
- clip_descriptor_props_.append( clip_descriptor_prop_name_ = "" );
- clip_descriptor_props_.append( clip_descriptor_prop_label_ = "" );
- clip_descriptor_props_.append( clip_descriptor_prop_short_label_ = "" );
- clip_descriptor_props_.append( clip_descriptor_prop_long_label_ = "" );
+ clip_descriptor_props_.append( clip_descriptor_prop_type_ = pl::string( kOfxTypeClip ) );
+ clip_descriptor_props_.append( clip_descriptor_prop_name_ = pl::string( "" ) );
+ clip_descriptor_props_.append( clip_descriptor_prop_label_ = pl::string( "" ) );
+ clip_descriptor_props_.append( clip_descriptor_prop_short_label_ = pl::string( "" ) );
+ clip_descriptor_props_.append( clip_descriptor_prop_long_label_ = pl::string( "" ) );
clip_descriptor_props_.append( clip_descriptor_prop_supported_components_ = string_vec( ) );
clip_descriptor_props_.append( clip_descriptor_prop_temporal_clip_access_ = 0 );
clip_descriptor_props_.append( clip_descriptor_prop_optional_ = 0 );
- clip_descriptor_props_.append( clip_descriptor_prop_field_extraction_ = kOfxImageFieldDoubled );
+ clip_descriptor_props_.append( clip_descriptor_prop_field_extraction_ = pl::string( kOfxImageFieldDoubled ) );
clip_descriptor_props_.append( clip_descriptor_prop_is_mask_ = 0 );
clip_descriptor_props_.append( clip_descriptor_prop_supports_tiles_ = 1 );
}
@@ -1198,14 +1198,14 @@
string_vec pixel_depths;
pixel_depths.push_back( kOfxBitDepthNone );
- effect_descriptor_props_.append( image_effect_prop_type_ = kOfxTypeImageEffect );
- effect_descriptor_props_.append( image_effect_prop_label_ = kOfxTypeImageEffect );
- effect_descriptor_props_.append( image_effect_prop_short_label_ = kOfxTypeImageEffect );
- effect_descriptor_props_.append( image_effect_prop_long_label_ = kOfxTypeImageEffect );
+ effect_descriptor_props_.append( image_effect_prop_type_ = pl::string( kOfxTypeImageEffect ) );
+ effect_descriptor_props_.append( image_effect_prop_label_ = pl::string( kOfxTypeImageEffect ) );
+ effect_descriptor_props_.append( image_effect_prop_short_label_ = pl::string( kOfxTypeImageEffect ) );
+ effect_descriptor_props_.append( image_effect_prop_long_label_ = pl::string( kOfxTypeImageEffect ) );
effect_descriptor_props_.append( image_effect_prop_supported_contexts_ = string_vec( ) );
- effect_descriptor_props_.append( image_effect_prop_grouping_ = "" );
+ effect_descriptor_props_.append( image_effect_prop_grouping_ = pl::string( "" ) );
effect_descriptor_props_.append( image_effect_prop_single_instance_ = 0 );
- effect_descriptor_props_.append( image_effect_render_thread_safety_ = kOfxImageEffectRenderUnsafe );
+ effect_descriptor_props_.append( image_effect_render_thread_safety_ = pl::string( kOfxImageEffectRenderUnsafe ) );
effect_descriptor_props_.append( image_effect_prop_host_frame_threading_ = 0 );
effect_descriptor_props_.append( image_effect_prop_overlay_interactV1_ = 0 );
effect_descriptor_props_.append( image_effect_prop_supports_multiresolution_ = 1 );
@@ -1215,8 +1215,8 @@
effect_descriptor_props_.append( image_effect_prop_field_render_twice_always_ = 0 );
effect_descriptor_props_.append( image_effect_prop_supports_multiple_clip_depths_ = 1 );
effect_descriptor_props_.append( image_effect_prop_supports_multiple_clip_pars_ = 1 );
- effect_descriptor_props_.append( image_effect_prop_clip_preferences_slave_param_ = "" );
- effect_descriptor_props_.append( image_effect_prop_file_path_ = "" );
+ effect_descriptor_props_.append( image_effect_prop_clip_preferences_slave_param_ = pl::string( "" ) );
+ effect_descriptor_props_.append( image_effect_prop_file_path_ = pl::string( "" ) );
}
// Effect descriptor properties.
@@ -1302,26 +1302,26 @@
private:
void set_clip_instance_properties( )
{
- clip_instance_props_.append( clip_instance_prop_type_ = kOfxTypeClip );
- clip_instance_props_.append( clip_instance_prop_name_ = "" );
- clip_instance_props_.append( clip_instance_prop_label_ = "" );
- clip_instance_props_.append( clip_instance_prop_short_label_ = "" );
- clip_instance_props_.append( clip_instance_prop_long_label_ = "" );
+ clip_instance_props_.append( clip_instance_prop_type_ = pl::string( kOfxTypeClip ) );
+ clip_instance_props_.append( clip_instance_prop_name_ = pl::string( "" ) );
+ clip_instance_props_.append( clip_instance_prop_label_ = pl::string( "" ) );
+ clip_instance_props_.append( clip_instance_prop_short_label_ = pl::string( "" ) );
+ clip_instance_props_.append( clip_instance_prop_long_label_ = pl::string( "" ) );
clip_instance_props_.append( clip_instance_prop_supported_components_ = string_vec( ) );
clip_instance_props_.append( clip_instance_prop_temporal_clip_access_ = 0 );
clip_instance_props_.append( clip_instance_prop_optional_ = 0 );
- clip_instance_props_.append( clip_instance_prop_field_extraction_ = kOfxImageFieldDoubled );
+ clip_instance_props_.append( clip_instance_prop_field_extraction_ = pl::string( kOfxImageFieldDoubled ) );
clip_instance_props_.append( clip_instance_prop_is_mask_ = 0 );
clip_instance_props_.append( clip_instance_prop_supports_tiles_ = 1 );
- clip_instance_props_.append( clip_instance_prop_pixel_depth_ = kOfxBitDepthNone );
- clip_instance_props_.append( clip_instance_prop_components_ = kOfxImageComponentNone );
- clip_instance_props_.append( clip_instance_prop_unmapped_pixel_depth_ = kOfxBitDepthNone );
- clip_instance_props_.append( clip_instance_prop_unmapped_components_ = kOfxImageComponentNone );
- clip_instance_props_.append( clip_instance_prop_premultiplication_ = kOfxImageOpaque );
+ clip_instance_props_.append( clip_instance_prop_pixel_depth_ = pl::string( kOfxBitDepthNone ) );
+ clip_instance_props_.append( clip_instance_prop_components_ = pl::string( kOfxImageComponentNone ) );
+ clip_instance_props_.append( clip_instance_prop_unmapped_pixel_depth_ = pl::string( kOfxBitDepthNone ) );
+ clip_instance_props_.append( clip_instance_prop_unmapped_components_ = pl::string( kOfxImageComponentNone ) );
+ clip_instance_props_.append( clip_instance_prop_premultiplication_ = pl::string( kOfxImageOpaque ) );
clip_instance_props_.append( clip_instance_prop_pixel_aspect_ratio_ = 0.0 );
clip_instance_props_.append( clip_instance_prop_frame_rate_ = 0.0 );
clip_instance_props_.append( clip_instance_prop_frame_range_ = double_vec( 2 ) );
- clip_instance_props_.append( clip_instance_prop_field_order_ = kOfxImageFieldNone );
+ clip_instance_props_.append( clip_instance_prop_field_order_ = pl::string( kOfxImageFieldNone ) );
clip_instance_props_.append( clip_instance_prop_connected_ = 0 );
clip_instance_props_.append( clip_instance_prop_unmapped_frame_range_ = double_vec( 2 ) );
clip_instance_props_.append( clip_instance_prop_unmapped_frame_rate_ = 0.0 );
@@ -1428,8 +1428,8 @@
private:
void set_image_effect_instance_properties( )
{
- effect_instance_props_.append( image_effect_instance_prop_type_ = kOfxTypeImageEffectInstance );
- effect_instance_props_.append( image_effect_instance_prop_context_ = kOfxImageEffectContextFilter );
+ effect_instance_props_.append( image_effect_instance_prop_type_ = pl::string( kOfxTypeImageEffectInstance ) );
+ effect_instance_props_.append( image_effect_instance_prop_context_ = pl::string( kOfxImageEffectContextFilter ) );
effect_instance_props_.append( image_effect_instance_prop_instance_data_ = static_cast<void*>( 0 ) );
effect_instance_props_.append( image_effect_instance_prop_project_size_ = double_vec( 2 ) );
effect_instance_props_.append( image_effect_instance_prop_project_offset_ = double_vec( 2 ) );
@@ -1564,7 +1564,7 @@
pcos::property_container render_in_args;
render_in_args.append( render_prop_time_ = 0.0 );
- render_in_args.append( render_prop_field_to_render_ = kOfxImageFieldNone );
+ render_in_args.append( render_prop_field_to_render_ = pl::string( kOfxImageFieldNone ) );
render_in_args.append( render_prop_render_window_ = render_win );
render_in_args.append( render_prop_render_scale_ = render_scale );
@@ -1616,16 +1616,16 @@
void set_host_parameters( )
{
- host_props_.append( host_prop_type_ = kOfxTypeImageEffectHost );
- host_props_.append( host_prop_name_ = "org.openlibraries.ofx_host" );
- host_props_.append( host_prop_label_ = "OpenLibraries OFX host" );
+ host_props_.append( host_prop_type_ = pl::string( kOfxTypeImageEffectHost ) );
+ host_props_.append( host_prop_name_ = pl::string( "org.openlibraries.ofx_host" ) );
+ host_props_.append( host_prop_label_ = pl::string( "OpenLibraries OFX host" ) );
host_props_.append( host_prop_is_background_ = 0 );
host_props_.append( host_prop_supports_overlays_ = 1 );
host_props_.append( host_prop_supports_multiresolution_ = 1 );
host_props_.append( host_prop_supports_tiles_ = 0 );
host_props_.append( host_prop_temporal_clip_access_ = 0 );
- host_props_.append( host_prop_supported_components_ = kOfxImageComponentRGBA );
- host_props_.append( host_prop_supported_contexts_ = kOfxImageEffectContextFilter );
+ host_props_.append( host_prop_supported_components_ = pl::string( kOfxImageComponentRGBA ) );
+ host_props_.append( host_prop_supported_contexts_ = pl::string( kOfxImageEffectContextFilter ) );
host_props_.append( host_prop_supports_multiple_clip_depths_ = 1 );
host_props_.append( host_prop_supports_multiple_clip_pars_ = 1 );
host_props_.append( host_prop_setable_frame_rate_ = 1 );
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gl...@us...> - 2007-05-01 22:40:11
|
Revision: 111
http://hdrflow.svn.sourceforge.net/hdrflow/?rev=111&view=rev
Author: glslang
Date: 2007-05-01 15:40:09 -0700 (Tue, 01 May 2007)
Log Message:
-----------
+ build and warning fix
Modified Paths:
--------------
lib/openlibraries/src/openmedialib/plugins/ofx/ofx_plugin.cpp
Modified: lib/openlibraries/src/openmedialib/plugins/ofx/ofx_plugin.cpp
===================================================================
--- lib/openlibraries/src/openmedialib/plugins/ofx/ofx_plugin.cpp 2007-05-01 22:26:13 UTC (rev 110)
+++ lib/openlibraries/src/openmedialib/plugins/ofx/ofx_plugin.cpp 2007-05-01 22:40:09 UTC (rev 111)
@@ -304,7 +304,7 @@
param_props_->append( base_double_param_descriptor_param_prop_default_ = 0.0 );
param_props_->append( base_double_param_descriptor_param_prop_increment_ = 1.0 );
param_props_->append( base_double_param_descriptor_param_prop_digits_ = 2 );
- param_props_->append( base_double_param_descriptor_param_prop_double_type_ = kOfxParamDoubleTypePlain );
+ param_props_->append( base_double_param_descriptor_param_prop_double_type_ = pl::string( kOfxParamDoubleTypePlain ) );
}
private:
@@ -910,7 +910,7 @@
param_props_->append( base_double_param_prop_default_ = 0.0 );
param_props_->append( base_double_param_prop_increment_ = 1.0 );
param_props_->append( base_double_param_prop_digits_ = 2 );
- param_props_->append( base_double_param_prop_double_type_ = kOfxParamDoubleTypePlain );
+ param_props_->append( base_double_param_prop_double_type_ = pl::string( kOfxParamDoubleTypePlain ) );
}
private:
@@ -2302,7 +2302,7 @@
OfxStatus memory_free( void* allocated_data )
{
- delete[ ] allocated_data;
+ delete[ ] ( char* ) allocated_data;
return kOfxStatOK;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gl...@us...> - 2007-05-04 17:24:50
|
Revision: 113
http://hdrflow.svn.sourceforge.net/hdrflow/?rev=113&view=rev
Author: glslang
Date: 2007-05-04 10:24:48 -0700 (Fri, 04 May 2007)
Log Message:
-----------
+ OFX bindings M2
Modified Paths:
--------------
lib/openlibraries/src/openmedialib/plugins/ofx/ofx_plugin.cpp
Modified: lib/openlibraries/src/openmedialib/plugins/ofx/ofx_plugin.cpp
===================================================================
--- lib/openlibraries/src/openmedialib/plugins/ofx/ofx_plugin.cpp 2007-05-03 23:00:00 UTC (rev 112)
+++ lib/openlibraries/src/openmedialib/plugins/ofx/ofx_plugin.cpp 2007-05-04 17:24:48 UTC (rev 113)
@@ -1338,24 +1338,16 @@
bool set_image( il::image_type_ptr im )
{
- if( !im )
- return false;
-
- // TODO: handle bit depths properly.
- il::image_type_ptr dst_img = il::convert( im, L"r8g8b8a8" );
- if( !dst_img )
- return false;
-
pcos::int_vec bounds_and_rod( 4 );
bounds_and_rod[ 0 ] = 0;
bounds_and_rod[ 1 ] = 0;
- bounds_and_rod[ 2 ] = dst_img->width( );
- bounds_and_rod[ 3 ] = dst_img->height( );
+ bounds_and_rod[ 2 ] = im->width( );
+ bounds_and_rod[ 3 ] = im->height( );
image_prop_bounds_ = bounds_and_rod;
image_prop_region_of_definition_ = bounds_and_rod;
- image_prop_data_ = ( void* ) dst_img->data( );
- image_prop_row_bytes_ = dst_img->pitch( );
+ image_prop_data_ = ( void* ) im->data( );
+ image_prop_row_bytes_ = im->pitch( );
return true;
}
@@ -1563,12 +1555,6 @@
container clip_desc_;
};
- struct image_effect_instance_base
- {
- virtual il::image_type_ptr get_source( ) = 0;
- virtual il::image_type_ptr get_output( ) = 0;
- };
-
class clip_instance : public Ofx_base
{
public:
@@ -1667,7 +1653,7 @@
image im_;
};
- class image_effect_instance : public image_effect_instance_base
+ class image_effect_instance : public param_set_base
{
public:
typedef pl::string key_type;
@@ -1679,7 +1665,8 @@
#else
typedef std::map<key_type, clip_instance_ptr> container;
#endif
- typedef container::const_iterator const_iterator;
+ typedef container::iterator iterator;
+ typedef container::const_iterator const_iterator;
public:
explicit image_effect_instance( )
@@ -1700,7 +1687,10 @@
void init( image_effect_descriptor& id )
{
+ param_set_.reset( id.create_instance( ) );
+ for( image_effect_descriptor::const_iterator I = id.clip_begin( ); I != id.clip_end( ); ++I )
+ clip_instance_.insert( container::value_type( I->first, clip_instance_ptr( I->second->create_instance( ) ) ) );
}
virtual property_container_ptr get_property_set( ) { return &effect_instance_props_; }
@@ -1713,16 +1703,22 @@
return I->second.get( );
return 0;
}
-
- il::image_type_ptr get_source( )
- { return source_; }
- il::image_type_ptr get_output( )
- { return output_; }
- void set_source( il::image_type_ptr im )
- { source_ = im; }
- void set_output( il::image_type_ptr im )
- { output_ = im; }
+ bool set_source( il::image_type_ptr im ) { return set_clip_image( "Source", im ); }
+ bool set_output( il::image_type_ptr im ) { return set_clip_image( "Output", im ); }
+
+ private:
+ bool set_clip_image( const pl::string& name, il::image_type_ptr im )
+ {
+ iterator I = clip_instance_.find( name );
+ if( I != clip_instance_.end( ) )
+ {
+ I->second->set_image( im );
+ return true;
+ }
+
+ return false;
+ }
private:
void set_image_effect_instance_properties( )
@@ -1757,13 +1753,7 @@
private:
container clip_instance_;
-
- private:
param_set_ptr param_set_;
-
- private:
- il::image_type_ptr source_;
- il::image_type_ptr output_;
};
OfxStatus param_set_descriptor::define( const pl::string& param_type, const pl::string& name )
@@ -1917,7 +1907,9 @@
plug_->mainEntry( kOfxActionDescribe, &image_effect_descriptor_, 0, 0 );
describe_in_context( );
-
+
+ // create instance from descriptor
+ image_effect_instance_.init( image_effect_descriptor_ );
plug_->mainEntry( kOfxActionCreateInstance, &image_effect_instance_, 0, 0 );
}
@@ -1928,9 +1920,7 @@
}
virtual const opl::wstring get_uri( ) const
- {
- return pl::to_wstring( plug_->pluginIdentifier );
- }
+ { return pl::to_wstring( plug_->pluginIdentifier ); }
virtual frame_type_ptr fetch( )
{
@@ -1939,9 +1929,11 @@
frame_type_ptr result = fetch_from_slot( );
if( result && result->get_image( ) )
{
- il::image_type_ptr src = result->get_image( );
+ il::image_type_ptr src = il::convert( result->get_image( ), L"r8g8b8a8" );
+ il::image_type_ptr dst = il::allocate( src->pf( ), src->width( ), src->height( ) );
+
image_effect_instance_.set_source( src );
- image_effect_instance_.set_output( il::allocate( src->pf( ), src->width( ), src->height( ) ) );
+ image_effect_instance_.set_output( dst );
pcos::property_container sequence_in_args;
sequence_in_args.append( sequence_prop_frame_range_ = pcos::double_vec( 2 ) );
@@ -1969,7 +1961,7 @@
plug_->mainEntry( kOfxImageEffectActionRender, &image_effect_instance_, ( OfxPropertySetHandle ) &render_in_args, 0 );
plug_->mainEntry( kOfxImageEffectActionEndSequenceRender, &image_effect_instance_, ( OfxPropertySetHandle ) &sequence_in_args, 0 );
- result->set_image( image_effect_instance_.get_output( ) );
+ result->set_image( dst );
}
return result;
@@ -2398,12 +2390,12 @@
}
// Interactive Suite.
- OfxStatus interact_swap_buffers( OfxInteractHandle interact_instance )
+ OfxStatus interact_swap_buffers( OfxInteractHandle )
{
return kOfxStatOK;
}
- OfxStatus interact_redraw( OfxInteractHandle interact_instance )
+ OfxStatus interact_redraw( OfxInteractHandle )
{
return kOfxStatOK;
}
@@ -2805,8 +2797,8 @@
image_effect_descriptor* desc = ( image_effect_descriptor* ) image_effect;
clip_descriptor* clip_desc = desc->clip_get_handle( name );
- if( clip_desc )
- desc->append_clip( name );
+ if( !clip_desc )
+ clip_desc = desc->append_clip( name );
if( property_set )
*property_set = ( OfxPropertySetHandle ) clip_desc->get_property_set( );
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gl...@us...> - 2007-05-09 22:07:08
|
Revision: 115
http://hdrflow.svn.sourceforge.net/hdrflow/?rev=115&view=rev
Author: glslang
Date: 2007-05-09 15:07:06 -0700 (Wed, 09 May 2007)
Log Message:
-----------
+ OFX bindings M3
Modified Paths:
--------------
lib/openlibraries/src/openmedialib/plugins/ofx/ofx_plugin.cpp
Modified: lib/openlibraries/src/openmedialib/plugins/ofx/ofx_plugin.cpp
===================================================================
--- lib/openlibraries/src/openmedialib/plugins/ofx/ofx_plugin.cpp 2007-05-09 00:29:07 UTC (rev 114)
+++ lib/openlibraries/src/openmedialib/plugins/ofx/ofx_plugin.cpp 2007-05-09 22:07:06 UTC (rev 115)
@@ -38,6 +38,8 @@
namespace
{
+ enum ofx_context { FILTER, TRANSITION, GENERATOR, GENERAL };
+
void set_property_suite( OfxPropertySuiteV1& );
void set_image_effect_suite( OfxImageEffectSuiteV1& );
void set_parameter_suite( OfxParameterSuiteV1& );
@@ -49,7 +51,7 @@
// typedefs
typedef pcos::property_container* property_container_ptr;
- // forward declaration
+ // forward declarations
class param;
class param_set;
class clip_instance;
@@ -372,7 +374,9 @@
, double2D_param_descriptor_param_prop_display_min_( pcos::key::from_string( kOfxParamPropDisplayMin ) )
, double2D_param_descriptor_param_prop_display_max_( pcos::key::from_string( kOfxParamPropDisplayMax ) )
, double2D_param_descriptor_param_prop_dimension_label_( pcos::key::from_string( kOfxParamPropDimensionLabel ) )
- { }
+ {
+ set_double2D_param_descriptor_properties( );
+ }
private:
void set_double2D_param_descriptor_properties( )
@@ -1053,7 +1057,7 @@
// they have shallow copy semantics and clone will cause a leak.
// therefore extract all the values and assign those. descriptors and instances are
// meant to be separate entities and values should not be shared.
- void set_double2D_param_properties( base_double_param_descriptor& vpd )
+ void set_double2D_param_properties( double2D_param_descriptor& vpd )
{
property_container_ptr param_props_ = get_property_set( );
@@ -1064,7 +1068,7 @@
pcos::double_vec max = vpd_set->get_property_with_key( pcos::key::from_string( kOfxParamPropMax ) ).value<pcos::double_vec>( );
pcos::double_vec display_min = vpd_set->get_property_with_key( pcos::key::from_string( kOfxParamPropDisplayMin ) ).value<pcos::double_vec>( );
pcos::double_vec display_max = vpd_set->get_property_with_key( pcos::key::from_string( kOfxParamPropDisplayMax ) ).value<pcos::double_vec>( );
- pl::string_vec dimension_label = vpd_set->get_property_with_key( pcos::key::from_string( kOfxParamPropDisplayMax ) ).value<pl::string_vec>( );
+ pl::string_vec dimension_label = vpd_set->get_property_with_key( pcos::key::from_string( kOfxParamPropDimensionLabel ) ).value<pl::string_vec>( );
param_props_->append( double2D_param_value_ = def );
param_props_->append( double2D_param_prop_default_ = def );
@@ -1120,7 +1124,7 @@
pcos::double_vec max = vpd_set->get_property_with_key( pcos::key::from_string( kOfxParamPropMax ) ).value<pcos::double_vec>( );
pcos::double_vec display_min = vpd_set->get_property_with_key( pcos::key::from_string( kOfxParamPropDisplayMin ) ).value<pcos::double_vec>( );
pcos::double_vec display_max = vpd_set->get_property_with_key( pcos::key::from_string( kOfxParamPropDisplayMax ) ).value<pcos::double_vec>( );
- pl::string_vec dimension_label = vpd_set->get_property_with_key( pcos::key::from_string( kOfxParamPropDisplayMax ) ).value<pl::string_vec>( );
+ pl::string_vec dimension_label = vpd_set->get_property_with_key( pcos::key::from_string( kOfxParamPropDimensionLabel ) ).value<pl::string_vec>( );
param_props_->append( double3D_param_value_ = def );
param_props_->append( double3D_param_prop_default_ = def );
@@ -1495,8 +1499,8 @@
set_interact_descriptor_properties( );
}
- virtual property_container_ptr get_property_set( ) { return &interact_descriptor_props_; }
-
+ virtual property_container_ptr get_property_set( ) { return &interact_descriptor_props_; }
+
private:
void set_interact_descriptor_properties( )
{
@@ -1567,6 +1571,14 @@
const_iterator clip_begin( ) const { return clip_desc_.begin( ); }
const_iterator clip_end( ) const { return clip_desc_.end( ); }
+
+ OfxPluginEntryPoint* overlay_interact( ) const
+ {
+ OfxPluginEntryPoint* interact_main =
+ ( OfxPluginEntryPoint* ) effect_descriptor_props_.get_property_with_key( pcos::key::from_string( kOfxImageEffectPluginPropOverlayInteractV1 ) ).value<void*>( );
+
+ return interact_main;
+ }
private:
void set_image_effect_descriptor_properties( )
@@ -1656,8 +1668,9 @@
virtual property_container_ptr get_property_set( ) { return &clip_instance_props_; }
- void set_image( il::image_type_ptr im ) { im_.set_image( im ); }
- property_container_ptr get_image( ) { return im_.get_property_set( ); }
+ void set_image( il::image_type_ptr im ) { im_.set_image( im ), img_ = im; }
+ property_container_ptr get_image_property_set( ) { return im_.get_property_set( ); }
+ il::image_type_ptr get_image( ) { return img_; }
private:
void set_clip_instance_properties( clip_descriptor& cd )
@@ -1672,13 +1685,13 @@
clip_instance_props_.append( clip_instance_prop_optional_ = 0 );
clip_instance_props_.append( clip_instance_prop_field_extraction_ = pl::string( kOfxImageFieldDoubled ) );
clip_instance_props_.append( clip_instance_prop_is_mask_ = 0 );
- clip_instance_props_.append( clip_instance_prop_supports_tiles_ = 1 );
+ clip_instance_props_.append( clip_instance_prop_supports_tiles_ = 0 );
clip_instance_props_.append( clip_instance_prop_pixel_depth_ = pl::string( kOfxBitDepthNone ) );
clip_instance_props_.append( clip_instance_prop_components_ = pl::string( kOfxImageComponentNone ) );
clip_instance_props_.append( clip_instance_prop_unmapped_pixel_depth_ = pl::string( kOfxBitDepthNone ) );
clip_instance_props_.append( clip_instance_prop_unmapped_components_ = pl::string( kOfxImageComponentNone ) );
clip_instance_props_.append( clip_instance_prop_premultiplication_ = pl::string( kOfxImageOpaque ) );
- clip_instance_props_.append( clip_instance_prop_pixel_aspect_ratio_ = 0.0 );
+ clip_instance_props_.append( clip_instance_prop_pixel_aspect_ratio_ = 1.0 );
clip_instance_props_.append( clip_instance_prop_frame_rate_ = 0.0 );
clip_instance_props_.append( clip_instance_prop_frame_range_ = pcos::double_vec( 2 ) );
clip_instance_props_.append( clip_instance_prop_field_order_ = pl::string( kOfxImageFieldNone ) );
@@ -1718,50 +1731,8 @@
private:
image im_;
+ il::image_type_ptr img_;
};
-
- class interact_instance : public Ofx_base
- {
- public:
- explicit interact_instance( )
- : interact_instance_prop_effect_instance_( pcos::key::from_string( kOfxPropEffectInstance ) )
- , interact_instance_prop_instance_data_( pcos::key::from_string( kOfxPropInstanceData ) )
- , interact_instance_prop_pixel_scale_( pcos::key::from_string( kOfxInteractPropPixelScale ) )
- , interact_instance_prop_background_colour_( pcos::key::from_string( kOfxInteractPropBackgroundColour ) )
- , interact_instance_prop_viewport_size_( pcos::key::from_string( kOfxInteractPropViewportSize ) )
- , interact_instance_prop_has_alpha_( pcos::key::from_string( kOfxInteractPropHasAlpha ) )
- , interact_instance_prop_bit_depth_( pcos::key::from_string( kOfxInteractPropBitDepth ) )
- , interact_instance_prop_slave_to_param_( pcos::key::from_string( kOfxInteractPropSlaveToParam ) )
- {
- set_interact_instance_properties( );
- }
-
- virtual property_container_ptr get_property_set( ) { return &interact_instance_props_; }
-
- private:
- void set_interact_instance_properties( )
- {
- interact_instance_props_.append( interact_instance_prop_effect_instance_ = ( void* ) 0 );
- interact_instance_props_.append( interact_instance_prop_instance_data_ = ( void* ) 0 );
- interact_instance_props_.append( interact_instance_prop_pixel_scale_ = pcos::double_vec( 2, 0.0 ) );
- interact_instance_props_.append( interact_instance_prop_background_colour_ = pcos::double_vec( 3, 0.0 ) );
- interact_instance_props_.append( interact_instance_prop_viewport_size_ = pcos::int_vec( 2, 0 ) ); // deprecated
- interact_instance_props_.append( interact_instance_prop_has_alpha_ = 1 );
- interact_instance_props_.append( interact_instance_prop_bit_depth_ = 8 );
- interact_instance_props_.append( interact_instance_prop_slave_to_param_ = pl::string_vec( ) );
- }
-
- private:
- pcos::property_container interact_instance_props_;
- pcos::property interact_instance_prop_effect_instance_;
- pcos::property interact_instance_prop_instance_data_;
- pcos::property interact_instance_prop_pixel_scale_;
- pcos::property interact_instance_prop_background_colour_;
- pcos::property interact_instance_prop_viewport_size_;
- pcos::property interact_instance_prop_has_alpha_;
- pcos::property interact_instance_prop_bit_depth_;
- pcos::property interact_instance_prop_slave_to_param_;
- };
class image_effect_instance : public param_set_base
{
@@ -1865,7 +1836,49 @@
container clip_instance_;
param_set_ptr param_set_;
};
+
+ class interact_instance : public Ofx_base
+ {
+ public:
+ explicit interact_instance( )
+ : interact_instance_prop_effect_instance_( pcos::key::from_string( kOfxPropEffectInstance ) )
+ , interact_instance_prop_instance_data_( pcos::key::from_string( kOfxPropInstanceData ) )
+ , interact_instance_prop_pixel_scale_( pcos::key::from_string( kOfxInteractPropPixelScale ) )
+ , interact_instance_prop_background_colour_( pcos::key::from_string( kOfxInteractPropBackgroundColour ) )
+ , interact_instance_prop_viewport_size_( pcos::key::from_string( kOfxInteractPropViewportSize ) )
+ , interact_instance_prop_has_alpha_( pcos::key::from_string( kOfxInteractPropHasAlpha ) )
+ , interact_instance_prop_bit_depth_( pcos::key::from_string( kOfxInteractPropBitDepth ) )
+ , interact_instance_prop_slave_to_param_( pcos::key::from_string( kOfxInteractPropSlaveToParam ) )
+ { }
+
+ void init( interact_descriptor& id, image_effect_instance& effect ) { set_interact_instance_properties( id, effect ); }
+ virtual property_container_ptr get_property_set( ) { return &interact_instance_props_; }
+ private:
+ void set_interact_instance_properties( interact_descriptor&, image_effect_instance& effect )
+ {
+ interact_instance_props_.append( interact_instance_prop_effect_instance_ = ( void* ) &effect );
+ interact_instance_props_.append( interact_instance_prop_instance_data_ = ( void* ) 0 );
+ interact_instance_props_.append( interact_instance_prop_pixel_scale_ = pcos::double_vec( 2, 0.0 ) );
+ interact_instance_props_.append( interact_instance_prop_background_colour_ = pcos::double_vec( 3, 0.0 ) );
+ interact_instance_props_.append( interact_instance_prop_viewport_size_ = pcos::int_vec( 2, 0 ) ); // deprecated
+ interact_instance_props_.append( interact_instance_prop_has_alpha_ = 1 );
+ interact_instance_props_.append( interact_instance_prop_bit_depth_ = 8 );
+ interact_instance_props_.append( interact_instance_prop_slave_to_param_ = pl::string_vec( ) );
+ }
+
+ private:
+ pcos::property_container interact_instance_props_;
+ pcos::property interact_instance_prop_effect_instance_;
+ pcos::property interact_instance_prop_instance_data_;
+ pcos::property interact_instance_prop_pixel_scale_;
+ pcos::property interact_instance_prop_background_colour_;
+ pcos::property interact_instance_prop_viewport_size_;
+ pcos::property interact_instance_prop_has_alpha_;
+ pcos::property interact_instance_prop_bit_depth_;
+ pcos::property interact_instance_prop_slave_to_param_;
+ };
+
OfxStatus param_set_descriptor::define( const pl::string& param_type, const pl::string& name )
{
typedef container::const_iterator const_iterator;
@@ -1942,30 +1955,31 @@
return kOfxStatOK;
}
- param* string_param_descriptor::create_instance( ) { return new string_param( *this ); }
- param* int_param_descriptor::create_instance( ) { return new int_param( *this ); }
- param* int2D_param_descriptor::create_instance( ) { return new int2D_param( *this ); }
- param* int3D_param_descriptor::create_instance( ) { return new int3D_param( *this ); }
- param* double_param_descriptor::create_instance( ) { return new double_param( *this ); }
- param* double2D_param_descriptor::create_instance( ) { return new double2D_param( *this ); }
- param* double3D_param_descriptor::create_instance( ) { return new double3D_param( *this ); }
- param* rgb_param_descriptor::create_instance( ) { return new rgb_param( *this ); }
- param* rgba_param_descriptor::create_instance( ) { return new rgba_param( *this ); }
- param* boolean_param_descriptor::create_instance( ) { return new boolean_param( *this ); }
- param* choice_param_descriptor::create_instance( ) { return new choice_param( *this ); }
- param* group_param_descriptor::create_instance( ) { return new group_param( *this ); }
- param* page_param_descriptor::create_instance( ) { return new page_param( *this ); }
- param* push_button_param_descriptor::create_instance( ) { return new push_button_param( *this ); }
- param* custom_param_descriptor::create_instance( ) { return new custom_param( *this ); }
- param_set* param_set_descriptor::create_instance( ) { return new param_set( *this ); }
- clip_instance* clip_descriptor::create_instance( ) { return new clip_instance( *this ); }
+ param* string_param_descriptor::create_instance( ) { return new string_param( *this ); }
+ param* int_param_descriptor::create_instance( ) { return new int_param( *this ); }
+ param* int2D_param_descriptor::create_instance( ) { return new int2D_param( *this ); }
+ param* int3D_param_descriptor::create_instance( ) { return new int3D_param( *this ); }
+ param* double_param_descriptor::create_instance( ) { return new double_param( *this ); }
+ param* double2D_param_descriptor::create_instance( ) { return new double2D_param( *this ); }
+ param* double3D_param_descriptor::create_instance( ) { return new double3D_param( *this ); }
+ param* rgb_param_descriptor::create_instance( ) { return new rgb_param( *this ); }
+ param* rgba_param_descriptor::create_instance( ) { return new rgba_param( *this ); }
+ param* boolean_param_descriptor::create_instance( ) { return new boolean_param( *this ); }
+ param* choice_param_descriptor::create_instance( ) { return new choice_param( *this ); }
+ param* group_param_descriptor::create_instance( ) { return new group_param( *this ); }
+ param* page_param_descriptor::create_instance( ) { return new page_param( *this ); }
+ param* push_button_param_descriptor::create_instance( ) { return new push_button_param( *this ); }
+ param* custom_param_descriptor::create_instance( ) { return new custom_param( *this ); }
+ param_set* param_set_descriptor::create_instance( ) { return new param_set( *this ); }
+ clip_instance* clip_descriptor::create_instance( ) { return new clip_instance( *this ); }
}
class ML_PLUGIN_DECLSPEC ofx_filter : public filter_type, public OfxHost
{
public:
- explicit ofx_filter( OfxPlugin* plug )
+ explicit ofx_filter( OfxPlugin* plug, ofx_context context )
: plug_( plug )
+ , context_( context )
, host_prop_type_( pcos::key::from_string( kOfxPropType ) )
, host_prop_name_( pcos::key::from_string( kOfxPropName ) )
, host_prop_label_( pcos::key::from_string( kOfxPropLabel ) )
@@ -1990,6 +2004,7 @@
, host_prop_max_pages_( pcos::key::from_string( kOfxParamHostPropMaxPages ) )
, host_prop_page_row_column_count_( pcos::key::from_string( kOfxParamHostPropPageRowColumnCount ) )
, host_prop_this_pointer_( pcos::key::from_string( "this_pointer" ) )
+ , interact_main_( 0 )
, render_prop_name_( pcos::key::from_string( kOfxPropName ) )
, render_prop_time_( pcos::key::from_string( kOfxPropTime ) )
, render_prop_field_to_render_( pcos::key::from_string( kOfxImageEffectPropFieldToRender ) )
@@ -2023,14 +2038,25 @@
// create instance from descriptor
image_effect_instance_.init( image_effect_descriptor_ );
+ if( ( interact_main_ = image_effect_descriptor_.overlay_interact( ) ) != 0 )
+ {
+ interact_main_( kOfxActionDescribe, &overlay_interact_descriptor_, 0, 0 );
+ overlay_interact_instance_.init( overlay_interact_descriptor_, image_effect_instance_ );
+ }
+
plug_->mainEntry( kOfxActionCreateInstance, &image_effect_instance_, 0, 0 );
+ if( interact_main_ )
+ interact_main_( kOfxActionCreateInstance, &overlay_interact_instance_, 0, 0 );
- set_clip_prefs_filter_ctx( );
+ set_clip_prefs_ctx( );
plug_->mainEntry( kOfxImageEffectActionGetClipPreferences, &image_effect_instance_, 0, ( OfxPropertySetHandle ) &clip_preferences_props_filter_ );
}
virtual ~ofx_filter( )
{
+ if( interact_main_ )
+ interact_main_( kOfxActionDestroyInstance, &overlay_interact_instance_, 0, 0 );
+
plug_->mainEntry( kOfxActionDestroyInstance, &image_effect_instance_, 0, 0 );
plug_->mainEntry( kOfxActionUnload, 0, 0, 0 );
}
@@ -2062,16 +2088,17 @@
render_in_args.append( render_prop_render_scale_ = render_scale );
render_out_args.append( render_prop_name_ );
- render_out_args.append( render_prop_time_ );
+ render_out_args.append( render_prop_time_ = 0.0 );
+ src = il::convert( result->get_image( ), L"r8g8b8a8" );
+ image_effect_instance_.set_source( src );
+
OfxStatus is_identity = plug_->mainEntry( kOfxImageEffectActionIsIdentity, &image_effect_instance_,
( OfxPropertySetHandle ) &render_in_args, ( OfxPropertySetHandle ) &render_out_args );
if( is_identity == kOfxStatReplyDefault )
{
- src = il::convert( result->get_image( ), L"r8g8b8a8" );
il::image_type_ptr dst = il::allocate( src->pf( ), src->width( ), src->height( ) );
-
- image_effect_instance_.set_source( src );
+
image_effect_instance_.set_output( dst );
pcos::property_container sequence_in_args;
@@ -2089,6 +2116,13 @@
else if( is_identity == kOfxStatOK )
{
// select the appropriate clip from the out_args.
+ pl::string out_clip = render_out_args.get_property_with_key( pcos::key::from_string( kOfxPropName ) ).value<pl::string>( );
+ if( !out_clip.empty( ) )
+ {
+ clip_instance* out_instance = image_effect_instance_.clip_get_handle( out_clip );
+ if( out_instance )
+ result->set_image( out_instance->get_image( ) );
+ }
}
}
@@ -2138,6 +2172,16 @@
pixel_depths[ 1 ] = pl::string( kOfxBitDepthShort );
pixel_depths[ 2 ] = pl::string( kOfxBitDepthFloat );
+ pl::string_vec supported_components( 2 );
+ supported_components[ 0 ] = kOfxImageComponentRGBA;
+ supported_components[ 1 ] = kOfxImageComponentAlpha;
+
+ pl::string_vec supported_contexts( 4 );
+ supported_contexts[ 0 ] = kOfxImageEffectContextFilter;
+ supported_contexts[ 1 ] = kOfxImageEffectContextTransition;
+ supported_contexts[ 2 ] = kOfxImageEffectContextGenerator;
+ supported_contexts[ 3 ] = kOfxImageEffectContextGeneral;
+
host_props_.append( host_prop_type_ = pl::string( kOfxTypeImageEffectHost ) );
host_props_.append( host_prop_name_ = pl::string( "org.openlibraries.ofx_host" ) );
host_props_.append( host_prop_label_ = pl::string( "OpenLibraries OFX host" ) );
@@ -2147,13 +2191,13 @@
host_props_.append( host_prop_supports_multiresolution_ = 1 );
host_props_.append( host_prop_supports_tiles_ = 0 );
host_props_.append( host_prop_temporal_clip_access_ = 0 );
- host_props_.append( host_prop_supported_components_ = pl::string( kOfxImageComponentRGBA ) );
- host_props_.append( host_prop_supported_contexts_ = pl::string( kOfxImageEffectContextFilter ) );
+ host_props_.append( host_prop_supported_components_ = supported_components );
+ host_props_.append( host_prop_supported_contexts_ = supported_contexts );
host_props_.append( host_prop_supports_multiple_clip_depths_ = 1 );
host_props_.append( host_prop_supports_multiple_clip_pars_ = 1 );
host_props_.append( host_prop_setable_frame_rate_ = 1 );
host_props_.append( host_prop_setable_fielding_ = 1 );
- host_props_.append( host_prop_supports_custom_interact_ = 0 );
+ host_props_.append( host_prop_supports_custom_interact_ = 1 );
host_props_.append( host_prop_supports_string_animation_ = 0 );
host_props_.append( host_prop_supports_choice_animation_ = 0 );
host_props_.append( host_prop_supports_boolean_animation_ = 0 );
@@ -2176,28 +2220,20 @@
}
// For each of the contexts create a description of the effect.
- void describe_in_context( )
+ bool describe_in_context( )
{
- // Introduce support for multiple contexts but
- // constrain the actual executed code to filters.
- typedef pl::string_vec::const_iterator const_iterator;
-
- property_container_ptr property_set = image_effect_descriptor_.get_property_set( );
- pl::string_vec contexts = property_set->get_property_with_key( pcos::key::from_string( kOfxImageEffectPropSupportedContexts ) ).value<pl::string_vec>( );
+ pl::string context_str;
+ if( context_ == FILTER )
+ context_str = kOfxImageEffectContextFilter;
- for( const_iterator I = contexts.begin( ); I != contexts.end( ); ++I )
- {
- if( *I != kOfxImageEffectContextFilter ) continue;
+ pcos::property_container in_args;
+ pcos::property context( pcos::key::from_string( kOfxImageEffectPropContext ) );
- pcos::property_container in_args;
- pcos::property context( pcos::key::from_string( kOfxImageEffectPropContext ) );
+ in_args.append( context = context_str );
- in_args.append( context = *I );
-
- plug_->mainEntry( kOfxImageEffectActionDescribeInContext, &image_effect_descriptor_, ( OfxPropertySetHandle ) &in_args, 0 );
- }
+ return plug_->mainEntry( kOfxImageEffectActionDescribeInContext, &image_effect_descriptor_, ( OfxPropertySetHandle ) &in_args, 0 ) == kOfxStatOK;
}
-
+
void set_clip_prefs_filter_ctx( )
{
clip_preferences_props_filter_.append( clip_preferences_prop_components_source_ );
@@ -2213,8 +2249,19 @@
clip_preferences_props_filter_.append( clip_preferences_prop_frame_varying_ );
}
+ void set_clip_prefs_generator_ctx( )
+ {
+ }
+
+ void set_clip_prefs_ctx( )
+ {
+ if( context_ == FILTER ) set_clip_prefs_filter_ctx( );
+ else if( context_ == GENERATOR ) set_clip_prefs_generator_ctx( );
+ }
+
private:
OfxPlugin* plug_;
+ ofx_context context_;
private:
OfxPropertySuiteV1 property_suite_;
@@ -2256,10 +2303,13 @@
// Effect descriptor.
private:
image_effect_descriptor image_effect_descriptor_;
+ interact_descriptor overlay_interact_descriptor_;
// Effect instance.
private:
image_effect_instance image_effect_instance_;
+ interact_instance overlay_interact_instance_;
+ OfxPluginEntryPoint* interact_main_;
// Render action properties.
private:
@@ -2306,12 +2356,12 @@
if( index >= static_cast<int>( val.size( ) ) )
val.resize( index + 1 );
- val[ index ] = T( value );
+ val[ index ] = value;
dst = val;
}
else
{
- dst = T( value );
+ dst = value;
}
return kOfxStatOK;
@@ -2579,8 +2629,12 @@
return kOfxStatOK;
}
- OfxStatus interact_get_property_set( OfxInteractHandle interact_instance, OfxPropertySetHandle* property )
+ OfxStatus interact_get_property_set( OfxInteractHandle interact_inst, OfxPropertySetHandle* property_set )
{
+ interact_instance* instance = ( interact_instance* ) interact_inst;
+
+ *property_set = ( OfxPropertySetHandle ) instance->get_property_set( );
+
return kOfxStatOK;
}
@@ -2985,7 +3039,7 @@
if( !instance )
return kOfxStatErrBadHandle;
- *image_handle = ( OfxPropertySetHandle ) instance->get_image( );
+ *image_handle = ( OfxPropertySetHandle ) instance->get_image_property_set( );
return kOfxStatOK;
}
@@ -3001,7 +3055,7 @@
if( !instance )
return kOfxStatErrBadHandle;
- property_container_ptr image = instance->get_image( );
+ property_container_ptr image = instance->get_image_property_set( );
pcos::int_vec b = image->get_property_with_string( kOfxImagePropBounds ).value<pcos::int_vec>( );
bounds->x1 = b[ 0 ];
@@ -3156,17 +3210,21 @@
class ML_PLUGIN_DECLSPEC ofx_plugin : public openmedialib_plugin
{
public:
- virtual filter_type_ptr filter( const opl::wstring& request )
+ virtual input_type_ptr input( const pl::wstring& request ) { return discover( request, GENERATOR ); }
+ virtual filter_type_ptr filter( const pl::wstring& request ) { return discover( request, FILTER ); }
+
+private:
+ filter_type_ptr discover( const pl::wstring& request, ofx_context context )
{
typedef pl::discovery<ofx_query_traits> discovery;
ofx_query_traits query( request );
discovery plugins( query );
if( plugins.size( ) == 0 ) return filter_type_ptr( );
-
+
discovery::const_iterator i = plugins.begin( );
-
- return filter_type_ptr( new ofx_filter( ( OfxPlugin* ) i->context( ) ) );
+
+ return filter_type_ptr( new ofx_filter( ( OfxPlugin* ) i->context( ), context ) );
}
};
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gl...@us...> - 2007-05-10 18:02:30
|
Revision: 116
http://hdrflow.svn.sourceforge.net/hdrflow/?rev=116&view=rev
Author: glslang
Date: 2007-05-10 11:02:27 -0700 (Thu, 10 May 2007)
Log Message:
-----------
+ OFX bindings wrap-ups
Modified Paths:
--------------
lib/openlibraries/src/openmedialib/plugins/ofx/ofx_plugin.cpp
Modified: lib/openlibraries/src/openmedialib/plugins/ofx/ofx_plugin.cpp
===================================================================
--- lib/openlibraries/src/openmedialib/plugins/ofx/ofx_plugin.cpp 2007-05-09 22:07:06 UTC (rev 115)
+++ lib/openlibraries/src/openmedialib/plugins/ofx/ofx_plugin.cpp 2007-05-10 18:02:27 UTC (rev 116)
@@ -439,18 +439,46 @@
{
public:
explicit rgb_param_descriptor( )
- { }
+ : rgb_param_descriptor_param_prop_default_( pcos::key::from_string( kOfxParamPropDefault ) )
+ {
+ set_rgb_param_descriptor_properties( );
+ }
virtual param* create_instance( );
+
+ private:
+ void set_rgb_param_descriptor_properties( )
+ {
+ property_container_ptr param_props_ = get_property_set( );
+
+ param_props_->append( rgb_param_descriptor_param_prop_default_ = pcos::double_vec( 3, 0.0 ) );
+ }
+
+ private:
+ pcos::property rgb_param_descriptor_param_prop_default_;
};
class rgba_param_descriptor : public value_param_descriptor
{
public:
explicit rgba_param_descriptor( )
- { }
+ : rgba_param_descriptor_param_prop_default_( pcos::key::from_string( kOfxParamPropDefault ) )
+ {
+ set_rgba_param_descriptor_properties( );
+ }
virtual param* create_instance( );
+
+ private:
+ void set_rgba_param_descriptor_properties( )
+ {
+ property_container_ptr param_props_ = get_property_set( );
+
+ param_props_->append( rgba_param_descriptor_param_prop_default_ = pcos::double_vec( 4, 0.0 ) );
+ }
+
+ private:
+ pcos::property rgba_param_descriptor_param_prop_default_;
};
class boolean_param_descriptor : public value_param_descriptor
@@ -1150,14 +1178,33 @@
public:
explicit rgb_param( rgb_param_descriptor& vpd )
: value_param( vpd )
- , rgb_param_value_( pcos::key::from_string( "value" ) )
- { }
+ , rgb_param_prop_value_( pcos::key::from_string( "value" ) )
+ , rgb_param_prop_default_( pcos::key::from_string( kOfxParamPropDefault ) )
+ {
+ set_rgb_param_properties( vpd );
+ }
- virtual pcos::property get_value( ) { return rgb_param_value_; }
+ virtual pcos::property get_value( ) { return rgb_param_prop_value_; }
virtual pl::string get_type( ) { return kOfxParamTypeRGB; }
private:
- pcos::property rgb_param_value_;
+ // assign the instance properties from the descriptor. do not assign properties since
+ // they have shallow copy semantics and clone will cause a leak.
+ // therefore extract all the values and assign those. descriptors and instances are
+ // meant to be separate entities and values should not be shared.
+ void set_rgb_param_properties( rgb_param_descriptor& vpd )
+ {
+ property_container_ptr param_props_ = get_property_set( );
+ property_container_ptr vpd_set = vpd.get_property_set( );
+
+ pcos::double_vec def = vpd_set->get_property_with_key( pcos::key::from_string( kOfxParamPropDefault ) ).value<pcos::double_vec>( );
+ param_props_->append( rgb_param_prop_value_ = def );
+ param_props_->append( rgb_param_prop_default_ = def );
+ }
+
+ private:
+ pcos::property rgb_param_prop_value_;
+ pcos::property rgb_param_prop_default_;
};
class rgba_param : public value_param
@@ -1165,14 +1212,33 @@
public:
explicit rgba_param( rgba_param_descriptor& vpd )
: value_param( vpd )
- , rgba_param_value_( pcos::key::from_string( "value" ) )
- { }
+ , rgba_param_prop_value_( pcos::key::from_string( "value" ) )
+ , rgba_param_prop_default_( pcos::key::from_string( kOfxParamPropDefault ) )
+ {
+ set_rgba_param_properties( vpd );
+ }
- virtual pcos::property get_value( ) { return rgba_param_value_; }
+ virtual pcos::property get_value( ) { return rgba_param_prop_value_; }
virtual pl::string get_type( ) { return kOfxParamTypeRGBA; }
+
+ private:
+ // assign the instance properties from the descriptor. do not assign properties since
+ // they have shallow copy semantics and clone will cause a leak.
+ // therefore extract all the values and assign those. descriptors and instances are
+ // meant to be separate entities and values should not be shared.
+ void set_rgba_param_properties( rgba_param_descriptor& vpd )
+ {
+ property_container_ptr param_props_ = get_property_set( );
+ property_container_ptr vpd_set = vpd.get_property_set( );
+
+ pcos::double_vec def = vpd_set->get_property_with_key( pcos::key::from_string( kOfxParamPropDefault ) ).value<pcos::double_vec>( );
+ param_props_->append( rgba_param_prop_value_ = def );
+ param_props_->append( rgba_param_prop_default_ = def );
+ }
private:
- pcos::property rgba_param_value_;
+ pcos::property rgba_param_prop_value_;
+ pcos::property rgba_param_prop_default_;
};
class boolean_param : public value_param
@@ -2024,20 +2090,24 @@
, clip_preferences_prop_field_order_( pcos::key::from_string( kOfxImageClipPropFieldOrder ) )
, clip_preferences_prop_premultiplication_( pcos::key::from_string( kOfxImageEffectPropPreMultiplication ) )
, clip_preferences_prop_continuous_samples_( pcos::key::from_string( kOfxImageClipPropContinuousSamples ) )
- , clip_preferences_prop_frame_varying_( pcos::key::from_string( kOfxImageEffectPropFrameRate ) )
+ , clip_preferences_prop_frame_varying_( pcos::key::from_string( kOfxImageEffectFrameVarying ) )
+ , apply_clip_prefs_( false )
{
+ // set host properties and suite functions.
set_host( );
set_suites( );
set_host_parameters( );
+ // load and describe the plugin.
plug_->mainEntry( kOfxActionLoad, 0, 0, 0 );
plug_->mainEntry( kOfxActionDescribe, &image_effect_descriptor_, 0, 0 );
describe_in_context( );
- // create instance from descriptor
+ // create instance from descriptor.
image_effect_instance_.init( image_effect_descriptor_ );
+ // create any overlay instances if exist.
if( ( interact_main_ = image_effect_descriptor_.overlay_interact( ) ) != 0 )
{
interact_main_( kOfxActionDescribe, &overlay_interact_descriptor_, 0, 0 );
@@ -2048,8 +2118,10 @@
if( interact_main_ )
interact_main_( kOfxActionCreateInstance, &overlay_interact_instance_, 0, 0 );
+ // get plugin preferences.
set_clip_prefs_ctx( );
- plug_->mainEntry( kOfxImageEffectActionGetClipPreferences, &image_effect_instance_, 0, ( OfxPropertySetHandle ) &clip_preferences_props_filter_ );
+ if( plug_->mainEntry( kOfxImageEffectActionGetClipPreferences, &image_effect_instance_, 0, ( OfxPropertySetHandle ) &clip_preferences_props_filter_ ) == kOfxStatOK )
+ apply_clip_prefs_ = true;
}
virtual ~ofx_filter( )
@@ -2071,8 +2143,14 @@
frame_type_ptr result = fetch_from_slot( );
if( result && result->get_image( ) )
{
- il::image_type_ptr src = il::convert( result->get_image( ), L"r8g8b8a8" );
+ il::image_type_ptr src = result->get_image( );
+ il::image_type_ptr dst;
+ if( apply_clip_prefs_ )
+ apply_clip_prefs_filter_ctx( src, dst );
+ else
+ dst = il::allocate( src->pf( ), src->width( ), src->height( ) );
+
pcos::property_container render_in_args;
pcos::property_container render_out_args;
@@ -2080,32 +2158,26 @@
render_win[ 2 ] = src->width( );
render_win[ 3 ] = src->height( );
- pcos::int_vec render_scale( 2, 1 );
-
render_in_args.append( render_prop_time_ = 0.0 );
render_in_args.append( render_prop_field_to_render_ = pl::string( kOfxImageFieldNone ) );
render_in_args.append( render_prop_render_window_ = render_win );
- render_in_args.append( render_prop_render_scale_ = render_scale );
+ render_in_args.append( render_prop_render_scale_ = pcos::int_vec( 2, 1 ) );
render_out_args.append( render_prop_name_ );
render_out_args.append( render_prop_time_ = 0.0 );
- src = il::convert( result->get_image( ), L"r8g8b8a8" );
image_effect_instance_.set_source( src );
+ image_effect_instance_.set_output( dst );
OfxStatus is_identity = plug_->mainEntry( kOfxImageEffectActionIsIdentity, &image_effect_instance_,
( OfxPropertySetHandle ) &render_in_args, ( OfxPropertySetHandle ) &render_out_args );
if( is_identity == kOfxStatReplyDefault )
{
- il::image_type_ptr dst = il::allocate( src->pf( ), src->width( ), src->height( ) );
-
- image_effect_instance_.set_output( dst );
-
pcos::property_container sequence_in_args;
- sequence_in_args.append( sequence_prop_frame_range_ = pcos::double_vec( 2 ) );
+ sequence_in_args.append( sequence_prop_frame_range_ = pcos::double_vec( 2, 1.0 ) );
sequence_in_args.append( sequence_prop_frame_step_ = 1.0 );
sequence_in_args.append( sequence_prop_is_interactive_ = 0 );
- sequence_in_args.append( sequence_prop_render_scale_ = pcos::double_vec( 2 ) );
+ sequence_in_args.append( sequence_prop_render_scale_ = pcos::double_vec( 2, 1.0 ) );
plug_->mainEntry( kOfxImageEffectActionBeginSequenceRender, &image_effect_instance_, ( OfxPropertySetHandle ) &sequence_in_args, 0 );
plug_->mainEntry( kOfxImageEffectActionRender, &image_effect_instance_, ( OfxPropertySetHandle ) &render_in_args, 0 );
@@ -2234,6 +2306,7 @@
return plug_->mainEntry( kOfxImageEffectActionDescribeInContext, &image_effect_descriptor_, ( OfxPropertySetHandle ) &in_args, 0 ) == kOfxStatOK;
}
+private:
void set_clip_prefs_filter_ctx( )
{
clip_preferences_props_filter_.append( clip_preferences_prop_components_source_ );
@@ -2242,11 +2315,6 @@
clip_preferences_props_filter_.append( clip_preferences_prop_depth_output_ );
clip_preferences_props_filter_.append( clip_preferences_prop_par_source_ );
clip_preferences_props_filter_.append( clip_preferences_prop_par_output_ );
- clip_preferences_props_filter_.append( clip_preferences_prop_frame_rate_ );
- clip_preferences_props_filter_.append( clip_preferences_prop_field_order_ );
- clip_preferences_props_filter_.append( clip_preferences_prop_premultiplication_ );
- clip_preferences_props_filter_.append( clip_preferences_prop_continuous_samples_ );
- clip_preferences_props_filter_.append( clip_preferences_prop_frame_varying_ );
}
void set_clip_prefs_generator_ctx( )
@@ -2255,11 +2323,38 @@
void set_clip_prefs_ctx( )
{
+ clip_preferences_props_filter_.append( clip_preferences_prop_frame_rate_ );
+ clip_preferences_props_filter_.append( clip_preferences_prop_field_order_ );
+ clip_preferences_props_filter_.append( clip_preferences_prop_premultiplication_ );
+ clip_preferences_props_filter_.append( clip_preferences_prop_continuous_samples_ );
+ clip_preferences_props_filter_.append( clip_preferences_prop_frame_varying_ );
+
if( context_ == FILTER ) set_clip_prefs_filter_ctx( );
else if( context_ == GENERATOR ) set_clip_prefs_generator_ctx( );
}
private:
+ void apply_clip_prefs_filter_ctx( il::image_type_ptr& src, il::image_type_ptr& dst )
+ {
+ int source_depth = clip_preferences_prop_depth_source_.value<int>( );
+ int output_depth = clip_preferences_prop_depth_output_.value<int>( );
+
+ if( source_depth == 8 )
+ src = il::convert( src, L"r8g8b8a8" );
+ else if( source_depth == 16 )
+ src = il::convert( src, L"r16g16b16a16" );
+ else if( source_depth == 32 )
+ src = il::convert( src, L"r32g32b32a32f" );
+
+ if( output_depth == 8 )
+ dst = il::allocate( L"r8g8b8a8", src->width( ), src->height( ) );
+ else if( output_depth == 16 )
+ dst = il::allocate( L"r16g16b16a16", src->width( ), src->height( ) );
+ else if( output_depth == 32 )
+ dst = il::allocate( L"r32g32b32a32f", src->width( ), src->height( ) );
+ }
+
+private:
OfxPlugin* plug_;
ofx_context context_;
@@ -2340,6 +2435,7 @@
pcos::property clip_preferences_prop_premultiplication_;
pcos::property clip_preferences_prop_continuous_samples_;
pcos::property clip_preferences_prop_frame_varying_;
+ bool apply_clip_prefs_;
};
namespace
@@ -2497,9 +2593,9 @@
pcos::property src = prop_set->get_property_with_string( property );
if( src.is_a<pl::string_vec>( ) )
{
- pl::string_vec val = src.value<pl::string_vec>( );
+ pl::string_vec* val = src.pointer<pl::string_vec>( );
for( int i = 0; i < count; ++i )
- value[ i ] = const_cast<char*>( src.value<opl::string>( ).c_str( ) );
+ value[ i ] = const_cast<char*>( ( *val )[ i ].c_str( ) );
}
return kOfxStatOK;
@@ -2544,6 +2640,11 @@
return kOfxStatOK;
}
+ OfxStatus prop_reset( OfxPropertySetHandle properties, const char* property )
+ {
+ return kOfxStatOK;
+ }
+
// Memory Suite.
OfxStatus memory_alloc( void* handle, size_t nbytes, void** allocated_data )
{
@@ -3113,7 +3214,7 @@
property_suite.propGetStringN = prop_get_stringN;
property_suite.propGetDoubleN = prop_get_doubleN;
property_suite.propGetIntN = prop_get_intN;
- //property_suite.propReset = prop_reset;
+ property_suite.propReset = prop_reset;
property_suite.propGetDimension = prop_get_dimension;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <gl...@us...> - 2007-05-10 20:38:20
|
Revision: 117
http://hdrflow.svn.sourceforge.net/hdrflow/?rev=117&view=rev
Author: glslang
Date: 2007-05-10 13:38:14 -0700 (Thu, 10 May 2007)
Log Message:
-----------
+ OFX bug fixes.
Modified Paths:
--------------
lib/openlibraries/src/openmedialib/plugins/ofx/ofx_plugin.cpp
Modified: lib/openlibraries/src/openmedialib/plugins/ofx/ofx_plugin.cpp
===================================================================
--- lib/openlibraries/src/openmedialib/plugins/ofx/ofx_plugin.cpp 2007-05-10 18:02:27 UTC (rev 116)
+++ lib/openlibraries/src/openmedialib/plugins/ofx/ofx_plugin.cpp 2007-05-10 20:38:14 UTC (rev 117)
@@ -2309,12 +2309,17 @@
private:
void set_clip_prefs_filter_ctx( )
{
- clip_preferences_props_filter_.append( clip_preferences_prop_components_source_ );
- clip_preferences_props_filter_.append( clip_preferences_prop_components_output_ );
- clip_preferences_props_filter_.append( clip_preferences_prop_depth_source_ );
- clip_preferences_props_filter_.append( clip_preferences_prop_depth_output_ );
+ clip_preferences_props_filter_.append( clip_preferences_prop_components_source_ = pl::string( ) );
+ clip_preferences_props_filter_.append( clip_preferences_prop_components_output_ = pl::string( ) );
+ clip_preferences_props_filter_.append( clip_preferences_prop_depth_source_ = pl::string( ) );
+ clip_preferences_props_filter_.append( clip_preferences_prop_depth_output_ = pl::string( ) );
clip_preferences_props_filter_.append( clip_preferences_prop_par_source_ );
clip_preferences_props_filter_.append( clip_preferences_prop_par_output_ );
+ clip_preferences_props_filter_.append( clip_preferences_prop_frame_rate_ );
+ clip_preferences_props_filter_.append( clip_preferences_prop_field_order_ );
+ clip_preferences_props_filter_.append( clip_preferences_prop_premultiplication_ );
+ clip_preferences_props_filter_.append( clip_preferences_prop_continuous_samples_ );
+ clip_preferences_props_filter_.append( clip_preferences_prop_frame_varying_ );
}
void set_clip_prefs_generator_ctx( )
@@ -2323,12 +2328,6 @@
void set_clip_prefs_ctx( )
{
- clip_preferences_props_filter_.append( clip_preferences_prop_frame_rate_ );
- clip_preferences_props_filter_.append( clip_preferences_prop_field_order_ );
- clip_preferences_props_filter_.append( clip_preferences_prop_premultiplication_ );
- clip_preferences_props_filter_.append( clip_preferences_prop_continuous_samples_ );
- clip_preferences_props_filter_.append( clip_preferences_prop_frame_varying_ );
-
if( context_ == FILTER ) set_clip_prefs_filter_ctx( );
else if( context_ == GENERATOR ) set_clip_prefs_generator_ctx( );
}
@@ -2336,24 +2335,28 @@
private:
void apply_clip_prefs_filter_ctx( il::image_type_ptr& src, il::image_type_ptr& dst )
{
- int source_depth = clip_preferences_prop_depth_source_.value<int>( );
- int output_depth = clip_preferences_prop_depth_output_.value<int>( );
+ pl::string source_depth = clip_preferences_prop_depth_source_.value<pl::string>( );
+ pl::string output_depth = clip_preferences_prop_depth_output_.value<pl::string>( );
- if( source_depth == 8 )
- src = il::convert( src, L"r8g8b8a8" );
- else if( source_depth == 16 )
- src = il::convert( src, L"r16g16b16a16" );
- else if( source_depth == 32 )
- src = il::convert( src, L"r32g32b32a32f" );
-
- if( output_depth == 8 )
- dst = il::allocate( L"r8g8b8a8", src->width( ), src->height( ) );
- else if( output_depth == 16 )
- dst = il::allocate( L"r16g16b16a16", src->width( ), src->height( ) );
- else if( output_depth == 32 )
- dst = il::allocate( L"r32g32b32a32f", src->width( ), src->height( ) );
+ if( !source_depth.empty( ) )
+ {
+ if( source_depth == kOfxBitDepthByte ) src = il::convert( src, L"r8g8b8a8" );
+ else if( source_depth == kOfxBitDepthShort ) src = il::convert( src, L"r16g16b16a16" );
+ else if( source_depth == kOfxBitDepthFloat ) src = il::convert( src, L"r32g32b32a32f" );
+ }
+
+ if( !output_depth.empty( ) )
+ {
+ if( output_depth == kOfxBitDepthByte ) dst = il::allocate( L"r8g8b8a8", src->width( ), src->height( ) );
+ else if( output_depth == kOfxBitDepthShort ) dst = il::allocate( L"r16g16b16a16", src->width( ), src->height( ) );
+ else if( output_depth == kOfxBitDepthFloat ) dst = il::allocate( L"r32g32b32a32f", src->width( ), src->height( ) );
+ }
+ else
+ {
+ dst = il::allocate( src->pf( ), src->width( ), src->height( ) );
+ }
}
-
+
private:
OfxPlugin* plug_;
ofx_context context_;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|