X-Git-Url: http://research.m1stereo.tv/gitweb?a=blobdiff_plain;f=src%2Fframework%2Fmlt_frame.c;h=3f583d935ddca6b8e8a98cfd080dc0037c655de5;hb=19d5d8f23b0930d8d10b0c9075830415cd5fec4d;hp=f2fad14caaca6f9cde5849f2e7a0949e962a3579;hpb=89b7e06e362f01284cd1166a019ae3fa3093a6e4;p=melted diff --git a/src/framework/mlt_frame.c b/src/framework/mlt_frame.c index f2fad14..3f583d9 100644 --- a/src/framework/mlt_frame.c +++ b/src/framework/mlt_frame.c @@ -77,7 +77,15 @@ mlt_properties mlt_frame_properties( mlt_frame this ) int mlt_frame_is_test_card( mlt_frame this ) { - return this->stack_get_image_size == 0; + return ( this->stack_get_image_size == 0 && mlt_properties_get_data( mlt_frame_properties( this ), "image", NULL ) == NULL ); +} + +/** Check if we have a way to derive something than test audio. +*/ + +int mlt_frame_is_test_audio( mlt_frame this ) +{ + return this->get_audio == NULL; } /** Get the aspect ratio of the frame. @@ -85,8 +93,7 @@ int mlt_frame_is_test_card( mlt_frame this ) double mlt_frame_get_aspect_ratio( mlt_frame this ) { - mlt_properties properties = mlt_frame_properties( this ); - return mlt_properties_get_double( properties, "aspect_ratio" ); + return mlt_properties_get_double( mlt_frame_properties( this ), "aspect_ratio" ); } /** Set the aspect ratio of the frame. @@ -94,8 +101,7 @@ double mlt_frame_get_aspect_ratio( mlt_frame this ) int mlt_frame_set_aspect_ratio( mlt_frame this, double value ) { - mlt_properties properties = mlt_frame_properties( this ); - return mlt_properties_set_double( properties, "aspect_ratio", value ); + return mlt_properties_set_double( mlt_frame_properties( this ), "aspect_ratio", value ); } /** Get the position of this frame. @@ -103,8 +109,7 @@ int mlt_frame_set_aspect_ratio( mlt_frame this, double value ) mlt_position mlt_frame_get_position( mlt_frame this ) { - mlt_properties properties = mlt_frame_properties( this ); - return mlt_properties_get_position( properties, "position" ); + return mlt_properties_get_position( mlt_frame_properties( this ), "position" ); } /** Set the position of this frame. @@ -112,8 +117,7 @@ mlt_position mlt_frame_get_position( mlt_frame this ) int mlt_frame_set_position( mlt_frame this, mlt_position value ) { - mlt_properties properties = mlt_frame_properties( this ); - return mlt_properties_set_position( properties, "position", value ); + return mlt_properties_set_position( mlt_frame_properties( this ), "position", value ); } /** Stack a get_image callback. @@ -259,16 +263,7 @@ int mlt_frame_get_audio( mlt_frame this, int16_t **buffer, mlt_audio_format *for void mlt_frame_close( mlt_frame this ) { - mlt_frame frame = mlt_frame_pop_frame( this ); - - while ( frame != NULL ) - { - mlt_frame_close( frame); - frame = mlt_frame_pop_frame( this ); - } - mlt_properties_close( &this->parent ); - free( this ); } @@ -461,22 +456,32 @@ int mlt_frame_composite_yuv( mlt_frame this, mlt_frame that, int x, int y, float if ( p_alpha ) p_alpha += x_src + y_src * stride_src / 2; + uint8_t *p = p_src; + uint8_t *q = p_dest; + uint8_t *o = p_dest; + uint8_t *z = p_alpha; + + uint8_t Y; + uint8_t UV; + uint8_t a; + float value; + // now do the compositing only to cropped extents for ( i = 0; i < height_src; i++ ) { - uint8_t *p = p_src; - uint8_t *q = p_dest; - uint8_t *o = p_dest; - uint8_t *z = p_alpha; + p = p_src; + q = p_dest; + o = p_dest; + z = p_alpha; for ( j = 0; j < width_src; j ++ ) { - uint8_t y = *p ++; - uint8_t uv = *p ++; - uint8_t a = ( z == NULL ) ? 255 : *z ++; - float value = ( weight * ( float ) a / 255.0 ); - *o ++ = (uint8_t)( y * value + *q++ * ( 1 - value ) ); - *o ++ = (uint8_t)( uv * value + *q++ * ( 1 - value ) ); + Y = *p ++; + UV = *p ++; + a = ( z == NULL ) ? 255 : *z ++; + value = ( weight * ( float ) a / 255.0 ); + *o ++ = (uint8_t)( Y * value + *q++ * ( 1 - value ) ); + *o ++ = (uint8_t)( UV * value + *q++ * ( 1 - value ) ); } p_src += stride_src;