]> git.sesse.net Git - mlt/blobdiff - src/framework/mlt_frame.c
Fix compile error on Windows.
[mlt] / src / framework / mlt_frame.c
index 7c8b5f83145a30a26cf429b223d955f9ea3c5905..baf9d8d5488f43e9641da7ad10eeb7cf5911e773 100644 (file)
@@ -3,8 +3,9 @@
  * \brief interface for all frame classes
  * \see mlt_frame_s
  *
- * Copyright (C) 2003-2009 Ushodaya Enterprises Limited
+ * Copyright (C) 2003-2013 Ushodaya Enterprises Limited
  * \author Charles Yates <charles.yates@pandora.be>
+ * \author Dan Dennedy <dan@dennedy.org>
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -183,7 +184,7 @@ int mlt_frame_set_position( mlt_frame self, mlt_position value )
  *
  * \public \memberof mlt_frame_s
  * \param self a frame
- * \param the get_image callback
+ * \param get_image the get_image callback
  * \return true if error
  */
 
@@ -436,6 +437,10 @@ int mlt_image_format_size( mlt_image_format format, int width, int height, int *
                case mlt_image_yuv420p:
                        if ( bpp ) *bpp = 3 / 2;
                        return width * height * 3 / 2;
+               case mlt_image_glsl:
+               case mlt_image_glsl_texture:
+                       if ( bpp ) *bpp = 0;
+                       return 4;
                default:
                        if ( bpp ) *bpp = 0;
                        return 0;
@@ -736,26 +741,11 @@ int mlt_frame_get_audio( mlt_frame self, void **buffer, mlt_audio_format *format
                mlt_properties_set_int( properties, "audio_samples", *samples );
                mlt_properties_set_int( properties, "audio_format", *format );
 
-               switch( *format )
-               {
-                       case mlt_image_none:
-                               size = 0;
-                               *buffer = NULL;
-                               break;
-                       case mlt_audio_s16:
-                               size = *samples * *channels * sizeof( int16_t );
-                               break;
-                       case mlt_audio_s32:
-                               size = *samples * *channels * sizeof( int32_t );
-                               break;
-                       case mlt_audio_float:
-                               size = *samples * *channels * sizeof( float );
-                               break;
-                       default:
-                               break;
-               }
+               size = mlt_audio_format_size( *format, *samples, *channels );
                if ( size )
                        *buffer = mlt_pool_alloc( size );
+               else
+                       *buffer = NULL;
                if ( *buffer )
                        memset( *buffer, 0, size );
                mlt_properties_set_data( properties, "audio", *buffer, size, ( mlt_destructor )mlt_pool_release, NULL );
@@ -1069,10 +1059,12 @@ mlt_frame mlt_frame_clone( mlt_frame self, int is_deep )
                data = mlt_properties_get_data( properties, "image", &size );
                if ( data )
                {
+                       int width = mlt_properties_get_int( properties, "width" );
+                       int height = mlt_properties_get_int( properties, "height" );
+
                        if ( ! size )
                                size = mlt_image_format_size( mlt_properties_get_int( properties, "format" ),
-                                       mlt_properties_get_int( properties, "width" ),
-                                       mlt_properties_get_int( properties, "height" ), NULL );
+                                       width, height, NULL );
                        copy = mlt_pool_alloc( size );
                        memcpy( copy, data, size );
                        mlt_properties_set_data( new_props, "image", copy, size, mlt_pool_release, NULL );
@@ -1081,8 +1073,7 @@ mlt_frame mlt_frame_clone( mlt_frame self, int is_deep )
                        if ( data )
                        {
                                if ( ! size )
-                                       size = mlt_properties_get_int( properties, "width" ) *
-                                               mlt_properties_get_int( properties, "height" );
+                                       size = width * height;
                                copy = mlt_pool_alloc( size );
                                memcpy( copy, data, size );
                                mlt_properties_set_data( new_props, "alpha", copy, size, mlt_pool_release, NULL );