本文整理汇总了C++中MLT_FRAME_PROPERTIES函数的典型用法代码示例。如果您正苦于以下问题:C++ MLT_FRAME_PROPERTIES函数的具体用法?C++ MLT_FRAME_PROPERTIES怎么用?C++ MLT_FRAME_PROPERTIES使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了MLT_FRAME_PROPERTIES函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: producer_get_frame
static int producer_get_frame( mlt_producer parent, mlt_frame_ptr frame, int index )
{
// Get the mutiltrack object
mlt_multitrack self = parent->child;
// Check if we have a track for this index
if ( index >= 0 && index < self->count && self->list[ index ] != NULL )
{
// Get the producer for this track
mlt_producer producer = self->list[ index ]->producer;
// Get the track hide property
int hide = mlt_properties_get_int( MLT_PRODUCER_PROPERTIES( mlt_producer_cut_parent( producer ) ), "hide" );
// Obtain the current position
mlt_position position = mlt_producer_frame( parent );
// Get the parent properties
mlt_properties producer_properties = MLT_PRODUCER_PROPERTIES( parent );
// Get the speed
double speed = mlt_properties_get_double( producer_properties, "_speed" );
// Make sure we're at the same point
mlt_producer_seek( producer, position );
// Get the frame from the producer
mlt_service_get_frame( MLT_PRODUCER_SERVICE( producer ), frame, 0 );
// Indicate speed of this producer
mlt_properties properties = MLT_FRAME_PROPERTIES( *frame );
mlt_properties_set_double( properties, "_speed", speed );
mlt_frame_set_position( *frame, position );
mlt_properties_set_int( properties, "hide", hide );
}
else
{
// Generate a test frame
*frame = mlt_frame_init( MLT_PRODUCER_SERVICE( parent ) );
// Update position on the frame we're creating
mlt_frame_set_position( *frame, mlt_producer_position( parent ) );
// Move on to the next frame
if ( index >= self->count )
{
// Let tractor know if we've reached the end
mlt_properties_set_int( MLT_FRAME_PROPERTIES( *frame ), "last_track", 1 );
// Move to the next frame
mlt_producer_prepare_next( parent );
}
}
return 0;
}
示例2: MLT_CONSUMER_PROPERTIES
static void *consumer_thread( void *arg )
{
mlt_consumer consumer = arg;
mlt_properties properties = MLT_CONSUMER_PROPERTIES( consumer );
mlt_frame frame = NULL;
// Determine whether to stop at end-of-media
int terminate_on_pause = mlt_properties_get_int( properties, "terminate_on_pause" );
int terminated = 0;
// Loop while running
while ( !terminated && !is_stopped( consumer ) )
{
// Get the next frame
frame = mlt_consumer_rt_frame( consumer );
// Check for termination
if ( terminate_on_pause && frame )
terminated = mlt_properties_get_double( MLT_FRAME_PROPERTIES( frame ), "_speed" ) == 0.0;
// Check that we have a frame to work with
if ( frame && !terminated && !is_stopped( consumer ) )
{
if ( mlt_properties_get_int( MLT_FRAME_PROPERTIES(frame), "rendered" ) )
{
if ( mlt_properties_get_int( MLT_FRAME_PROPERTIES(frame), "_speed" ) == 0 )
foreach_consumer_refresh( consumer );
foreach_consumer_put( consumer, frame );
}
else
{
int dropped = mlt_properties_get_int( properties, "_dropped" );
mlt_log_info( MLT_CONSUMER_SERVICE(consumer), "dropped frame %d\n", ++dropped );
mlt_properties_set_int( properties, "_dropped", dropped );
}
mlt_frame_close( frame );
}
else
{
if ( frame && terminated )
{
// Send this termination frame to nested consumers for their cancellation
foreach_consumer_put( consumer, frame );
}
if ( frame )
mlt_frame_close( frame );
terminated = 1;
}
}
// Indicate that the consumer is stopped
mlt_consumer_stopped( consumer );
return NULL;
}
示例3: mlt_frame_replace_image
void mlt_frame_replace_image( mlt_frame self, uint8_t *image, mlt_image_format format, int width, int height )
{
// Remove all items from the stack
while( mlt_deque_pop_back( self->stack_image ) ) ;
// Update the information
mlt_properties_set_data( MLT_FRAME_PROPERTIES( self ), "image", image, 0, NULL, NULL );
mlt_properties_set_int( MLT_FRAME_PROPERTIES( self ), "width", width );
mlt_properties_set_int( MLT_FRAME_PROPERTIES( self ), "height", height );
mlt_properties_set_int( MLT_FRAME_PROPERTIES( self ), "format", format );
self->get_alpha_mask = NULL;
}
示例4: producer_get_audio
static int producer_get_audio( mlt_frame self, void **buffer, mlt_audio_format *format, int *frequency, int *channels, int *samples )
{
mlt_properties properties = MLT_FRAME_PROPERTIES( self );
mlt_frame frame = mlt_frame_pop_audio( self );
mlt_properties frame_properties = MLT_FRAME_PROPERTIES( frame );
mlt_properties_set( frame_properties, "producer_consumer_fps", mlt_properties_get( properties, "producer_consumer_fps" ) );
mlt_frame_get_audio( frame, buffer, format, frequency, channels, samples );
mlt_frame_set_audio( self, *buffer, *format, mlt_audio_format_size( *format, *samples, *channels ), NULL );
mlt_properties_set_int( properties, "audio_frequency", *frequency );
mlt_properties_set_int( properties, "audio_channels", *channels );
mlt_properties_set_int( properties, "audio_samples", *samples );
return 0;
}
示例5: producer_get_frame
static int producer_get_frame( mlt_producer producer, mlt_frame_ptr frame, int index )
{
if ( frame )
{
// Construct a new frame
*frame = mlt_frame_init( MLT_PRODUCER_SERVICE( producer ) );
// Stack the producer and producer's get image
mlt_frame_push_service_int( *frame, index );
mlt_frame_push_service( *frame, producer );
mlt_frame_push_service( *frame, framebuffer_get_image );
mlt_properties properties = MLT_PRODUCER_PROPERTIES( producer );
mlt_properties frame_properties = MLT_FRAME_PROPERTIES(*frame);
// Get frame from the real producer
mlt_frame first_frame = mlt_properties_get_data( properties, "first_frame", NULL );
if ( first_frame == NULL )
{
// Get the frame to cache from the real producer
mlt_producer real_producer = mlt_properties_get_data( properties, "producer", NULL );
// Seek the producer to the correct place
mlt_producer_seek( real_producer, mlt_producer_position( producer ) );
// Get the frame
mlt_service_get_frame( MLT_PRODUCER_SERVICE( real_producer ), &first_frame, index );
// Cache the frame
mlt_properties_set_data( properties, "first_frame", first_frame, 0, ( mlt_destructor )mlt_frame_close, NULL );
}
mlt_properties_inherit( frame_properties, MLT_FRAME_PROPERTIES(first_frame) );
double force_aspect_ratio = mlt_properties_get_double( properties, "force_aspect_ratio" );
if ( force_aspect_ratio <= 0.0 ) force_aspect_ratio = mlt_properties_get_double( properties, "aspect_ratio" );
mlt_properties_set_double( frame_properties, "aspect_ratio", force_aspect_ratio );
// Give the returned frame temporal identity
mlt_frame_set_position( *frame, mlt_producer_position( producer ) );
mlt_properties_set_int( frame_properties, "meta.media.width", mlt_properties_get_int( properties, "width" ) );
mlt_properties_set_int( frame_properties, "meta.media.height", mlt_properties_get_int( properties, "height" ) );
mlt_properties_pass_list( frame_properties, properties, "width, height" );
}
return 0;
}
示例6: filter_get_image
/** Get the image.
*/
static int filter_get_image( mlt_frame frame, uint8_t **image, mlt_image_format *format, int *width, int *height, int writable )
{
int error = 0;
mlt_filter filter = mlt_frame_pop_service( frame );
mlt_properties properties = MLT_FILTER_PROPERTIES( filter );
mlt_producer producer = mlt_properties_get_data( properties, "_producer", NULL );
mlt_transition transition = mlt_properties_get_data( properties, "_transition", NULL );
mlt_frame text_frame = NULL;
mlt_position position = 0;
// Configure this filter
mlt_service_lock( MLT_FILTER_SERVICE( filter ) );
setup_producer( filter, producer, frame );
setup_transition( filter, transition );
mlt_service_unlock( MLT_FILTER_SERVICE( filter ) );
// Make sure the producer is in the correct position
position = mlt_filter_get_position( filter, frame );
mlt_producer_seek( producer, position );
// Get the b frame and process with transition if successful
if ( mlt_service_get_frame( MLT_PRODUCER_SERVICE( producer ), &text_frame, 0 ) == 0 )
{
// Get the a and b frame properties
mlt_properties a_props = MLT_FRAME_PROPERTIES( frame );
mlt_properties b_props = MLT_FRAME_PROPERTIES( text_frame );
// Set the frame and text_frame to be in the same position and have same consumer requirements
mlt_frame_set_position( text_frame, position );
mlt_frame_set_position( frame, position );
mlt_properties_set_int( b_props, "consumer_deinterlace", mlt_properties_get_int( a_props, "consumer_deinterlace" ) );
// Apply all filters that are attached to this filter to the b frame
mlt_service_apply_filters( MLT_FILTER_SERVICE( filter ), text_frame, 0 );
// Process the frame
mlt_transition_process( transition, frame, text_frame );
// Get the image
*format = mlt_image_yuv422;
error = mlt_frame_get_image( frame, image, format, width, height, 1 );
// Close the b frame
mlt_frame_close( text_frame );
}
return error;
}
示例7: transition_get_image
static int transition_get_image( mlt_frame a_frame, uint8_t **image, mlt_image_format *format, int *width, int *height, int writable ){
if (*format!=mlt_image_yuv422 ){
return -1;
}
mlt_frame b_frame = mlt_frame_pop_frame( a_frame );
mlt_transition transition = mlt_frame_pop_service( a_frame );
mlt_properties properties = MLT_TRANSITION_PROPERTIES( transition );
mlt_properties a_props = MLT_FRAME_PROPERTIES( a_frame );
mlt_properties b_props = MLT_FRAME_PROPERTIES( b_frame );
int invert = mlt_properties_get_int( properties, "invert" );
if ( mlt_properties_get( a_props, "rescale.interp" ) == NULL || !strcmp( mlt_properties_get( a_props, "rescale.interp" ), "none" ) )
mlt_properties_set( a_props, "rescale.interp", "nearest" );
// set consumer_aspect_ratio for a and b frame
if ( mlt_properties_get_double( a_props, "aspect_ratio" ) == 0.0 )
mlt_properties_set_double( a_props, "aspect_ratio", mlt_properties_get_double( a_props, "consumer_aspect_ratio" ) );
if ( mlt_properties_get_double( b_props, "aspect_ratio" ) == 0.0 )
mlt_properties_set_double( b_props, "aspect_ratio", mlt_properties_get_double( a_props, "consumer_aspect_ratio" ) );
mlt_properties_set_double( b_props, "consumer_aspect_ratio", mlt_properties_get_double( a_props, "consumer_aspect_ratio" ) );
if ( mlt_properties_get( b_props, "rescale.interp" ) == NULL || !strcmp( mlt_properties_get( b_props, "rescale.interp" ), "none" ) )
mlt_properties_set( b_props, "rescale.interp", "nearest" );
uint8_t *images[]={NULL,NULL,NULL};
mlt_frame_get_image( a_frame, &images[0], format, width, height, 1 );
mlt_frame_get_image( b_frame, &images[1], format, width, height, 1 );
mlt_position in = mlt_transition_get_in( transition );
mlt_position out = mlt_transition_get_out( transition );
// Get the position of the frame
char *name = mlt_properties_get( MLT_TRANSITION_PROPERTIES( transition ), "_unique_id" );
mlt_position position = mlt_properties_get_position( MLT_FRAME_PROPERTIES( a_frame ), name );
float pos=( float )( position - in ) / ( float )( out - in + 1 );
process_frei0r_item( transition_type , pos , properties, !invert ? a_frame : b_frame , images , format, width,height, writable );
*width = mlt_properties_get_int( !invert ? a_props : b_props, "width" );
*height = mlt_properties_get_int( !invert ? a_props : b_props, "height" );
*image = mlt_properties_get_data( !invert ? a_props : b_props , "image", NULL );
return 0;
}
示例8: get_audio
static int get_audio( mlt_frame frame, void **buffer, mlt_audio_format *format, int *frequency, int *channels, int *samples )
{
context cx = mlt_frame_pop_audio( frame );
mlt_frame nested_frame = mlt_frame_pop_audio( frame );
int result = 0;
// if not repeating last frame
if ( mlt_frame_get_position( nested_frame ) != cx->audio_position )
{
double fps = mlt_profile_fps( cx->profile );
if ( mlt_producer_get_fps( cx->self ) < fps ) {
fps = mlt_producer_get_fps( cx->self );
mlt_properties_set_double( MLT_FRAME_PROPERTIES(nested_frame), "producer_consumer_fps", fps );
}
*samples = mlt_sample_calculator( fps, *frequency, cx->audio_counter++ );
result = mlt_frame_get_audio( nested_frame, buffer, format, frequency, channels, samples );
int size = mlt_audio_format_size( *format, *samples, *channels );
int16_t *new_buffer = mlt_pool_alloc( size );
mlt_frame_set_audio( frame, new_buffer, *format, size, mlt_pool_release );
memcpy( new_buffer, *buffer, size );
*buffer = new_buffer;
cx->audio_position = mlt_frame_get_position( nested_frame );
}
else
{
// otherwise return no samples
*samples = 0;
*buffer = NULL;
}
return result;
}
示例9: mlt_service_apply_filters
void mlt_service_apply_filters( mlt_service self, mlt_frame frame, int index )
{
int i;
mlt_properties frame_properties = MLT_FRAME_PROPERTIES( frame );
mlt_properties service_properties = MLT_SERVICE_PROPERTIES( self );
mlt_service_base *base = self->local;
mlt_position position = mlt_frame_get_position( frame );
mlt_position self_in = mlt_properties_get_position( service_properties, "in" );
mlt_position self_out = mlt_properties_get_position( service_properties, "out" );
if ( index == 0 || mlt_properties_get_int( service_properties, "_filter_private" ) == 0 )
{
// Process the frame with the attached filters
for ( i = 0; i < base->filter_count; i ++ )
{
if ( base->filters[ i ] != NULL )
{
mlt_position in = mlt_filter_get_in( base->filters[ i ] );
mlt_position out = mlt_filter_get_out( base->filters[ i ] );
int disable = mlt_properties_get_int( MLT_FILTER_PROPERTIES( base->filters[ i ] ), "disable" );
if ( !disable && ( ( in == 0 && out == 0 ) || ( position >= in && ( position <= out || out == 0 ) ) ) )
{
mlt_properties_set_position( frame_properties, "in", in == 0 ? self_in : in );
mlt_properties_set_position( frame_properties, "out", out == 0 ? self_out : out );
mlt_filter_process( base->filters[ i ], frame );
mlt_service_apply_filters( MLT_FILTER_SERVICE( base->filters[ i ] ), frame, index + 1 );
}
}
}
}
}
示例10: get_transform_config
static void get_transform_config( VSTransformConfig* conf, mlt_filter filter, mlt_frame frame )
{
mlt_properties properties = MLT_FILTER_PROPERTIES( filter );
const char* filterName = mlt_properties_get( properties, "mlt_service" );
*conf = vsTransformGetDefaultConfig( filterName );
conf->smoothing = mlt_properties_get_int( properties, "smoothing" );
conf->maxShift = mlt_properties_get_int( properties, "maxshift" );
conf->maxAngle = mlt_properties_get_double( properties, "maxangle" );
conf->crop = (VSBorderType)mlt_properties_get_int( properties, "crop" );
conf->zoom = mlt_properties_get_int( properties, "zoom" );
conf->optZoom = mlt_properties_get_int( properties, "optzoom" );
conf->zoomSpeed = mlt_properties_get_double( properties, "zoomspeed" );
conf->relative = mlt_properties_get_int( properties, "relative" );
conf->invert = mlt_properties_get_int( properties, "invert" );
if ( mlt_properties_get_int( properties, "tripod" ) != 0 )
{
// Virtual tripod mode: relative=False, smoothing=0
conf->relative = 0;
conf->smoothing = 0;
}
// by default a bicubic interpolation is selected
const char *interps = mlt_properties_get( MLT_FRAME_PROPERTIES( frame ), "rescale.interp" );
conf->interpolType = VS_BiCubic;
if ( strcmp( interps, "nearest" ) == 0 || strcmp( interps, "neighbor" ) == 0 )
conf->interpolType = VS_Zero;
else if ( strcmp( interps, "tiles" ) == 0 || strcmp( interps, "fast_bilinear" ) == 0 )
conf->interpolType = VS_Linear;
else if ( strcmp( interps, "bilinear" ) == 0 )
conf->interpolType = VS_BiLinear;
}
示例11: get_image
static int get_image( mlt_frame frame, uint8_t **image, mlt_image_format *format, int *width, int *height, int writable )
{
int error = 0;
mlt_profile profile = (mlt_profile) mlt_frame_pop_get_image( frame );
mlt_properties properties = MLT_FRAME_PROPERTIES(frame);
mlt_image_format format_from = *format;
mlt_image_format format_to = mlt_image_rgb24;
error = mlt_frame_get_image( frame, image, format, width, height, writable );
int frame_colorspace = mlt_properties_get_int( properties, "colorspace" );
if ( !error && *format == mlt_image_yuv422 && profile->colorspace > 0 &&
frame_colorspace > 0 && frame_colorspace != profile->colorspace )
{
mlt_log_debug( NULL, "[filter avcolor_space] colorspace %d -> %d\n",
frame_colorspace, profile->colorspace );
// Convert to RGB using frame's colorspace
error = convert_image( frame, image, &format_from, format_to );
// Convert to YUV using profile's colorspace
if ( !error )
{
*image = mlt_properties_get_data( properties, "image", NULL );
format_from = mlt_image_rgb24;
format_to = *format;
mlt_properties_set_int( properties, "colorspace", profile->colorspace );
error = convert_image( frame, image, &format_from, format_to );
*image = mlt_properties_get_data( properties, "image", NULL );
}
}
return error;
}
示例12: producer_get_image
static int producer_get_image( mlt_frame frame, uint8_t **buffer, mlt_image_format *format, int *width, int *height, int writable )
{
// Obtain properties of frame
mlt_properties properties = MLT_FRAME_PROPERTIES( frame );
// Obtain the producer for this frame
mlt_producer producer = mlt_properties_get_data( properties, "producer_frei0r", NULL );
// Obtain properties of producer
mlt_properties producer_props = MLT_PRODUCER_PROPERTIES( producer );
// Allocate the image
int size = *width * ( *height + 1 ) * 2;
// Allocate the image
*buffer = mlt_pool_alloc( size );
// Update the frame
mlt_properties_set_data( properties, "image", *buffer, size, mlt_pool_release, NULL );
mlt_properties_set_int( properties, "width", *width );
mlt_properties_set_int( properties, "height", *height );
*format = mlt_image_yuv422;
if ( *buffer != NULL )
{
mlt_position in = mlt_producer_get_in( producer );
mlt_position out = mlt_producer_get_out( producer );
mlt_position time = mlt_frame_get_position( frame );
double position = ( double )( time - in ) / ( double )( out - in + 1 );
process_frei0r_item( producer_type , position, producer_props, frame , buffer, format , width , height , writable );
}
return 0;
}
示例13: producer_get_frame
static int producer_get_frame( mlt_producer producer, mlt_frame_ptr frame, int index )
{
// Generate a frame
*frame = mlt_frame_init( MLT_PRODUCER_SERVICE( producer ) );
mlt_profile profile = mlt_service_profile( MLT_PRODUCER_SERVICE( producer ) );
if ( *frame != NULL )
{
// Obtain properties of frame
mlt_properties frame_properties = MLT_FRAME_PROPERTIES( *frame );
// Update time code on the frame
mlt_frame_set_position( *frame, mlt_producer_frame( producer ) );
mlt_properties_set_int( frame_properties, "progressive", 1 );
mlt_properties_set_double( frame_properties, "aspect_ratio", mlt_profile_sar( profile ) );
mlt_properties_set_int( frame_properties, "meta.media.width", profile->width );
mlt_properties_set_int( frame_properties, "meta.media.height", profile->height );
// Configure callbacks
mlt_frame_push_service( *frame, producer );
mlt_frame_push_get_image( *frame, producer_get_image );
mlt_frame_push_audio( *frame, producer );
mlt_frame_push_audio( *frame, producer_get_audio );
}
// Calculate the next time code
mlt_producer_prepare_next( producer );
return 0;
}
示例14: mlt_frame_is_test_card
int mlt_frame_is_test_card( mlt_frame self )
{
mlt_properties properties = MLT_FRAME_PROPERTIES( self );
return ( mlt_deque_count( self->stack_image ) == 0
&& !mlt_properties_get_data( properties, "image", NULL ) )
|| mlt_properties_get_int( properties, "test_image" );
}
示例15: mlt_frame_is_test_audio
int mlt_frame_is_test_audio( mlt_frame self )
{
mlt_properties properties = MLT_FRAME_PROPERTIES( self );
return ( mlt_deque_count( self->stack_audio ) == 0
&& !mlt_properties_get_data( properties, "audio", NULL ) )
|| mlt_properties_get_int( properties, "test_audio" );
}