2 * melted_unit.c -- Playout Implementation
3 * Copyright (C) 2002-2009 Ushodaya Enterprises Limited
4 * Author: Dan Dennedy <dan@dennedy.org>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software Foundation,
18 * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
27 #include <sys/ioctl.h>
30 #include <sys/types.h>
40 #include "melted_unit.h"
41 #include "melted_log.h"
42 #include "melted_local.h"
44 #include <framework/mlt.h>
46 /* Forward references */
47 static void melted_unit_status_communicate( melted_unit
);
49 /** Allocate a new playout unit.
51 \return A new melted_unit handle.
54 melted_unit
melted_unit_init( int index
, char *constructor
)
56 melted_unit
this = NULL
;
57 mlt_consumer consumer
= NULL
;
59 char *id
= strdup( constructor
);
60 char *arg
= strchr( id
, ':' );
65 consumer
= mlt_factory_consumer( NULL
, id
, arg
);
67 if ( consumer
!= NULL
)
69 mlt_playlist playlist
= mlt_playlist_init( );
70 this = calloc( sizeof( melted_unit_t
), 1 );
71 this->properties
= mlt_properties_new( );
72 mlt_properties_init( this->properties
, this );
73 mlt_properties_set_int( this->properties
, "unit", index
);
74 mlt_properties_set_int( this->properties
, "generation", 0 );
75 mlt_properties_set( this->properties
, "constructor", constructor
);
76 mlt_properties_set( this->properties
, "id", id
);
77 mlt_properties_set( this->properties
, "arg", arg
);
78 mlt_properties_set_data( this->properties
, "consumer", consumer
, 0, ( mlt_destructor
)mlt_consumer_close
, NULL
);
79 mlt_properties_set_data( this->properties
, "playlist", playlist
, 0, ( mlt_destructor
)mlt_playlist_close
, NULL
);
80 mlt_consumer_connect( consumer
, MLT_PLAYLIST_SERVICE( playlist
) );
86 static char *strip_root( melted_unit unit
, char *file
)
88 mlt_properties properties
= unit
->properties
;
89 char *root
= mlt_properties_get( properties
, "root" );
90 if ( file
!= NULL
&& root
!= NULL
)
92 int length
= strlen( root
);
93 if ( root
[ length
- 1 ] == '/' )
95 if ( !strncmp( file
, root
, length
) )
101 /** Communicate the current status to all threads waiting on the notifier.
104 static void melted_unit_status_communicate( melted_unit unit
)
108 mlt_properties properties
= unit
->properties
;
109 char *root_dir
= mlt_properties_get( properties
, "root" );
110 mvcp_notifier notifier
= mlt_properties_get_data( properties
, "notifier", NULL
);
111 mvcp_status_t status
;
113 if ( root_dir
!= NULL
&& notifier
!= NULL
)
115 if ( melted_unit_get_status( unit
, &status
) == 0 )
116 /* if ( !( ( status.status == unit_playing || status.status == unit_paused ) &&
117 strcmp( status.clip, "" ) &&
118 !strcmp( status.tail_clip, "" ) &&
119 status.position == 0 &&
121 status.out == 0 ) ) */
122 mvcp_notifier_put( notifier
, &status
);
127 /** Set the notifier info
130 void melted_unit_set_notifier( melted_unit
this, mvcp_notifier notifier
, char *root_dir
)
132 mlt_properties properties
= this->properties
;
133 mlt_playlist playlist
= mlt_properties_get_data( properties
, "playlist", NULL
);
134 mlt_properties playlist_properties
= MLT_PLAYLIST_PROPERTIES( playlist
);
136 mlt_properties_set( properties
, "root", root_dir
);
137 mlt_properties_set_data( properties
, "notifier", notifier
, 0, NULL
, NULL
);
138 mlt_properties_set_data( playlist_properties
, "notifier_arg", this, 0, NULL
, NULL
);
139 mlt_properties_set_data( playlist_properties
, "notifier", melted_unit_status_communicate
, 0, NULL
, NULL
);
141 melted_unit_status_communicate( this );
144 /** Create or locate a producer for the file specified.
147 static mlt_producer
locate_producer( melted_unit unit
, char *file
)
149 // Try to get the profile from the consumer
150 mlt_consumer consumer
= mlt_properties_get_data( unit
->properties
, "consumer", NULL
);
151 mlt_profile profile
= NULL
;
153 if ( consumer
!= NULL
)
155 profile
= mlt_service_profile( MLT_CONSUMER_SERVICE( consumer
) );
157 return mlt_factory_producer( profile
, NULL
, file
);
160 /** Update the generation count.
163 static void update_generation( melted_unit unit
)
165 mlt_properties properties
= unit
->properties
;
166 int generation
= mlt_properties_get_int( properties
, "generation" );
167 mlt_properties_set_int( properties
, "generation", ++ generation
);
170 /** Wipe all clips on the playlist for this unit.
173 static void clear_unit( melted_unit unit
)
175 mlt_properties properties
= unit
->properties
;
176 mlt_playlist playlist
= mlt_properties_get_data( properties
, "playlist", NULL
);
177 mlt_producer producer
= MLT_PLAYLIST_PRODUCER( playlist
);
179 mlt_service_lock( MLT_PLAYLIST_SERVICE( playlist
) );
180 mlt_playlist_clear( playlist
);
181 mlt_producer_seek( producer
, 0 );
182 mlt_service_unlock( MLT_PLAYLIST_SERVICE( playlist
) );
184 update_generation( unit
);
187 /** Wipe all but the playing clip from the unit.
190 static void clean_unit( melted_unit unit
)
192 mlt_properties properties
= unit
->properties
;
193 mlt_playlist playlist
= mlt_properties_get_data( properties
, "playlist", NULL
);
194 mlt_playlist_clip_info info
;
195 int current
= mlt_playlist_current_clip( playlist
);
196 mlt_producer producer
= MLT_PLAYLIST_PRODUCER( playlist
);
197 mlt_position position
= mlt_producer_frame( producer
);
198 double speed
= mlt_producer_get_speed( producer
);
199 mlt_playlist_get_clip_info( playlist
, &info
, current
);
201 if ( info
.producer
!= NULL
)
203 mlt_properties_inc_ref( MLT_PRODUCER_PROPERTIES( info
.producer
) );
204 position
-= info
.start
;
206 mlt_service_lock( MLT_PLAYLIST_SERVICE( playlist
) );
207 mlt_playlist_append_io( playlist
, info
.producer
, info
.frame_in
, info
.frame_out
);
208 mlt_producer_seek( producer
, position
);
209 mlt_producer_set_speed( producer
, speed
);
210 mlt_service_unlock( MLT_PLAYLIST_SERVICE( playlist
) );
211 mlt_producer_close( info
.producer
);
214 update_generation( unit
);
217 /** Remove everything up to the current clip from the unit.
220 static void wipe_unit( melted_unit unit
)
222 mlt_properties properties
= unit
->properties
;
223 mlt_playlist playlist
= mlt_properties_get_data( properties
, "playlist", NULL
);
224 mlt_playlist_clip_info info
;
225 int current
= mlt_playlist_current_clip( playlist
);
226 mlt_playlist_get_clip_info( playlist
, &info
, current
);
228 if ( info
.producer
!= NULL
&& info
.start
> 0 )
230 mlt_service_lock( MLT_PLAYLIST_SERVICE( playlist
) );
231 mlt_playlist_remove_region( playlist
, 0, info
.start
- 1 );
232 mlt_service_unlock( MLT_PLAYLIST_SERVICE( playlist
) );
235 update_generation( unit
);
238 /** Generate a report on all loaded clips.
241 void melted_unit_report_list( melted_unit unit
, mvcp_response response
)
244 mlt_properties properties
= unit
->properties
;
245 int generation
= mlt_properties_get_int( properties
, "generation" );
246 mlt_playlist playlist
= mlt_properties_get_data( properties
, "playlist", NULL
);
248 mvcp_response_printf( response
, 1024, "%d\n", generation
);
250 for ( i
= 0; i
< mlt_playlist_count( playlist
); i
++ )
252 mlt_playlist_clip_info info
;
254 mlt_playlist_get_clip_info( playlist
, &info
, i
);
255 title
= mlt_properties_get( MLT_PRODUCER_PROPERTIES( info
.producer
), "title" );
257 title
= strip_root( unit
, info
.resource
);
258 mvcp_response_printf( response
, 10240, "%d \"%s\" %d %d %d %d %.2f\n",
267 mvcp_response_printf( response
, 1024, "\n" );
270 /** Load a clip into the unit clearing existing play list.
273 \param unit A melted_unit handle.
274 \param clip The absolute file name of the clip to load.
275 \param in The starting frame (-1 for 0)
276 \param out The ending frame (-1 for maximum)
279 mvcp_error_code
melted_unit_load( melted_unit unit
, char *clip
, int32_t in
, int32_t out
, int flush
)
281 // Now try to create a producer
282 mlt_producer instance
= locate_producer( unit
, clip
);
284 if ( instance
!= NULL
)
286 mlt_properties properties
= unit
->properties
;
287 mlt_playlist playlist
= mlt_properties_get_data( properties
, "playlist", NULL
);
288 int original
= mlt_producer_get_playtime( MLT_PLAYLIST_PRODUCER( playlist
) );
289 mlt_service_lock( MLT_PLAYLIST_SERVICE( playlist
) );
290 mlt_playlist_append_io( playlist
, instance
, in
, out
);
291 mlt_playlist_remove_region( playlist
, 0, original
);
292 mlt_service_unlock( MLT_PLAYLIST_SERVICE( playlist
) );
293 melted_log( LOG_DEBUG
, "loaded clip %s", clip
);
294 update_generation( unit
);
295 melted_unit_status_communicate( unit
);
296 mlt_producer_close( instance
);
300 return mvcp_invalid_file
;
303 mvcp_error_code
melted_unit_insert( melted_unit unit
, char *clip
, int index
, int32_t in
, int32_t out
)
305 mlt_producer instance
= locate_producer( unit
, clip
);
307 if ( instance
!= NULL
)
309 mlt_properties properties
= unit
->properties
;
310 mlt_playlist playlist
= mlt_properties_get_data( properties
, "playlist", NULL
);
311 fprintf( stderr
, "inserting clip %s before %d\n", clip
, index
);
312 mlt_service_lock( MLT_PLAYLIST_SERVICE( playlist
) );
313 mlt_playlist_insert( playlist
, instance
, index
, in
, out
);
314 mlt_service_unlock( MLT_PLAYLIST_SERVICE( playlist
) );
315 melted_log( LOG_DEBUG
, "inserted clip %s at %d", clip
, index
);
316 update_generation( unit
);
317 melted_unit_status_communicate( unit
);
318 mlt_producer_close( instance
);
322 return mvcp_invalid_file
;
325 mvcp_error_code
melted_unit_remove( melted_unit unit
, int index
)
327 mlt_properties properties
= unit
->properties
;
328 mlt_playlist playlist
= mlt_properties_get_data( properties
, "playlist", NULL
);
329 mlt_service_lock( MLT_PLAYLIST_SERVICE( playlist
) );
330 mlt_playlist_remove( playlist
, index
);
331 mlt_service_unlock( MLT_PLAYLIST_SERVICE( playlist
) );
332 melted_log( LOG_DEBUG
, "removed clip at %d", index
);
333 update_generation( unit
);
334 melted_unit_status_communicate( unit
);
338 mvcp_error_code
melted_unit_clean( melted_unit unit
)
341 melted_log( LOG_DEBUG
, "Cleaned playlist" );
342 melted_unit_status_communicate( unit
);
346 mvcp_error_code
melted_unit_wipe( melted_unit unit
)
349 melted_log( LOG_DEBUG
, "Wiped playlist" );
350 melted_unit_status_communicate( unit
);
354 mvcp_error_code
melted_unit_clear( melted_unit unit
)
356 mlt_consumer consumer
= mlt_properties_get_data( unit
->properties
, "consumer", NULL
);
358 mlt_consumer_purge( consumer
);
359 melted_log( LOG_DEBUG
, "Cleared playlist" );
360 melted_unit_status_communicate( unit
);
364 mvcp_error_code
melted_unit_move( melted_unit unit
, int src
, int dest
)
366 mlt_properties properties
= unit
->properties
;
367 mlt_playlist playlist
= mlt_properties_get_data( properties
, "playlist", NULL
);
368 mlt_service_lock( MLT_PLAYLIST_SERVICE( playlist
) );
369 mlt_playlist_move( playlist
, src
, dest
);
370 mlt_service_unlock( MLT_PLAYLIST_SERVICE( playlist
) );
371 melted_log( LOG_DEBUG
, "moved clip %d to %d", src
, dest
);
372 update_generation( unit
);
373 melted_unit_status_communicate( unit
);
377 /** Add a clip to the unit play list.
380 \param unit A melted_unit handle.
381 \param clip The absolute file name of the clip to load.
382 \param in The starting frame (-1 for 0)
383 \param out The ending frame (-1 for maximum)
386 mvcp_error_code
melted_unit_append( melted_unit unit
, char *clip
, int32_t in
, int32_t out
)
388 mlt_producer instance
= locate_producer( unit
, clip
);
390 if ( instance
!= NULL
)
392 mlt_properties properties
= unit
->properties
;
393 mlt_playlist playlist
= mlt_properties_get_data( properties
, "playlist", NULL
);
394 mlt_service_lock( MLT_PLAYLIST_SERVICE( playlist
) );
395 mlt_playlist_append_io( playlist
, instance
, in
, out
);
396 melted_log( LOG_DEBUG
, "appended clip %s", clip
);
397 mlt_service_unlock( MLT_PLAYLIST_SERVICE( playlist
) );
398 update_generation( unit
);
399 melted_unit_status_communicate( unit
);
400 mlt_producer_close( instance
);
404 return mvcp_invalid_file
;
407 /** Add an mlt_service to the playlist
409 \param unit A melted_unit handle.
410 \param service the service to add
413 mvcp_error_code
melted_unit_append_service( melted_unit unit
, mlt_service service
)
415 mlt_properties properties
= unit
->properties
;
416 mlt_playlist playlist
= mlt_properties_get_data( properties
, "playlist", NULL
);
417 mlt_service_lock( MLT_PLAYLIST_SERVICE( playlist
) );
418 mlt_playlist_append( playlist
, ( mlt_producer
)service
);
419 mlt_service_unlock( MLT_PLAYLIST_SERVICE( playlist
) );
420 melted_log( LOG_DEBUG
, "appended clip" );
421 update_generation( unit
);
422 melted_unit_status_communicate( unit
);
426 /** Start playing the unit.
429 \param unit A melted_unit handle.
430 \param speed An integer that specifies the playback rate as a
431 percentage multiplied by 100.
434 void melted_unit_play( melted_unit_t
*unit
, int speed
)
436 mlt_properties properties
= unit
->properties
;
437 mlt_playlist playlist
= mlt_properties_get_data( properties
, "playlist", NULL
);
438 mlt_producer producer
= MLT_PLAYLIST_PRODUCER( playlist
);
439 mlt_consumer consumer
= mlt_properties_get_data( unit
->properties
, "consumer", NULL
);
440 mlt_producer_set_speed( producer
, ( double )speed
/ 1000 );
441 mlt_consumer_start( consumer
);
442 melted_unit_status_communicate( unit
);
447 Terminates the consumer and halts playout.
449 \param unit A melted_unit handle.
452 void melted_unit_terminate( melted_unit unit
)
454 mlt_consumer consumer
= mlt_properties_get_data( unit
->properties
, "consumer", NULL
);
455 mlt_playlist playlist
= mlt_properties_get_data( unit
->properties
, "playlist", NULL
);
456 mlt_producer producer
= MLT_PLAYLIST_PRODUCER( playlist
);
457 mlt_producer_set_speed( producer
, 0 );
458 mlt_consumer_stop( consumer
);
459 melted_unit_status_communicate( unit
);
462 /** Query the status of unit playback.
464 \param unit A melted_unit handle.
465 \return 1 if the unit is not playing, 0 if playing.
468 int melted_unit_has_terminated( melted_unit unit
)
470 mlt_consumer consumer
= mlt_properties_get_data( unit
->properties
, "consumer", NULL
);
471 return mlt_consumer_is_stopped( consumer
);
474 /** Transfer the currently loaded clip to another unit
477 int melted_unit_transfer( melted_unit dest_unit
, melted_unit src_unit
)
480 mlt_properties dest_properties
= dest_unit
->properties
;
481 mlt_playlist dest_playlist
= mlt_properties_get_data( dest_properties
, "playlist", NULL
);
482 mlt_properties src_properties
= src_unit
->properties
;
483 mlt_playlist src_playlist
= mlt_properties_get_data( src_properties
, "playlist", NULL
);
484 mlt_playlist tmp_playlist
= mlt_playlist_init( );
486 for ( i
= 0; i
< mlt_playlist_count( src_playlist
); i
++ )
488 mlt_playlist_clip_info info
;
489 mlt_playlist_get_clip_info( src_playlist
, &info
, i
);
490 if ( info
.producer
!= NULL
)
491 mlt_playlist_append_io( tmp_playlist
, info
.producer
, info
.frame_in
, info
.frame_out
);
494 clear_unit( src_unit
);
496 mlt_service_lock( MLT_PLAYLIST_SERVICE( dest_playlist
) );
498 for ( i
= 0; i
< mlt_playlist_count( tmp_playlist
); i
++ )
500 mlt_playlist_clip_info info
;
501 mlt_playlist_get_clip_info( tmp_playlist
, &info
, i
);
502 if ( info
.producer
!= NULL
)
503 mlt_playlist_append_io( dest_playlist
, info
.producer
, info
.frame_in
, info
.frame_out
);
506 mlt_service_unlock( MLT_PLAYLIST_SERVICE( dest_playlist
) );
508 update_generation( dest_unit
);
509 melted_unit_status_communicate( dest_unit
);
511 mlt_playlist_close( tmp_playlist
);
516 /** Determine if unit is offline.
519 int melted_unit_is_offline( melted_unit unit
)
524 /** Obtain the status for a given unit
527 int melted_unit_get_status( melted_unit unit
, mvcp_status status
)
529 int error
= unit
== NULL
;
531 memset( status
, 0, sizeof( mvcp_status_t
) );
535 mlt_properties properties
= unit
->properties
;
536 mlt_playlist playlist
= mlt_properties_get_data( properties
, "playlist", NULL
);
537 mlt_producer producer
= MLT_PLAYLIST_PRODUCER( playlist
);
538 mlt_producer clip
= mlt_playlist_current( playlist
);
540 mlt_playlist_clip_info info
;
541 int clip_index
= mlt_playlist_current_clip( playlist
);
542 mlt_playlist_get_clip_info( playlist
, &info
, clip_index
);
544 if ( info
.resource
!= NULL
&& strcmp( info
.resource
, "" ) )
546 char *title
= mlt_properties_get( MLT_PRODUCER_PROPERTIES( info
.producer
), "title" );
548 title
= strip_root( unit
, info
.resource
);
549 strncpy( status
->clip
, title
, sizeof( status
->clip
) );
550 status
->speed
= (int)( mlt_producer_get_speed( producer
) * 1000.0 );
551 status
->fps
= mlt_producer_get_fps( producer
);
552 status
->in
= info
.frame_in
;
553 status
->out
= info
.frame_out
;
554 status
->position
= mlt_producer_frame( clip
);
555 status
->length
= mlt_producer_get_length( clip
);
556 strncpy( status
->tail_clip
, title
, sizeof( status
->tail_clip
) );
557 status
->tail_in
= info
.frame_in
;
558 status
->tail_out
= info
.frame_out
;
559 status
->tail_position
= mlt_producer_frame( clip
);
560 status
->tail_length
= mlt_producer_get_length( clip
);
561 status
->clip_index
= mlt_playlist_current_clip( playlist
);
562 status
->seek_flag
= 1;
565 status
->generation
= mlt_properties_get_int( properties
, "generation" );
567 if ( melted_unit_has_terminated( unit
) )
568 status
->status
= unit_stopped
;
569 else if ( !strcmp( status
->clip
, "" ) )
570 status
->status
= unit_not_loaded
;
571 else if ( status
->speed
== 0 )
572 status
->status
= unit_paused
;
574 status
->status
= unit_playing
;
578 status
->status
= unit_undefined
;
581 status
->unit
= mlt_properties_get_int( unit
->properties
, "unit" );
586 /** Change position in the playlist.
589 void melted_unit_change_position( melted_unit unit
, int clip
, int32_t position
)
591 mlt_properties properties
= unit
->properties
;
592 mlt_playlist playlist
= mlt_properties_get_data( properties
, "playlist", NULL
);
593 mlt_producer producer
= MLT_PLAYLIST_PRODUCER( playlist
);
594 mlt_playlist_clip_info info
;
601 else if ( clip
>= mlt_playlist_count( playlist
) )
603 clip
= mlt_playlist_count( playlist
) - 1;
607 if ( mlt_playlist_get_clip_info( playlist
, &info
, clip
) == 0 )
609 int32_t frame_start
= info
.start
;
610 int32_t frame_offset
= position
;
612 if ( frame_offset
< 0 )
613 frame_offset
= info
.frame_out
;
614 if ( frame_offset
< info
.frame_in
)
615 frame_offset
= info
.frame_in
;
616 if ( frame_offset
>= info
.frame_out
)
617 frame_offset
= info
.frame_out
;
619 mlt_producer_seek( producer
, frame_start
+ frame_offset
- info
.frame_in
);
622 melted_unit_status_communicate( unit
);
625 /** Get the index of the current clip.
628 int melted_unit_get_current_clip( melted_unit unit
)
630 mlt_properties properties
= unit
->properties
;
631 mlt_playlist playlist
= mlt_properties_get_data( properties
, "playlist", NULL
);
632 int clip_index
= mlt_playlist_current_clip( playlist
);
636 /** Set a clip's in point
639 int melted_unit_set_clip_in( melted_unit unit
, int index
, int32_t position
)
641 mlt_properties properties
= unit
->properties
;
642 mlt_playlist playlist
= mlt_properties_get_data( properties
, "playlist", NULL
);
643 mlt_playlist_clip_info info
;
644 int error
= mlt_playlist_get_clip_info( playlist
, &info
, index
);
648 melted_unit_play( unit
, 0 );
649 mlt_service_lock( MLT_PLAYLIST_SERVICE( playlist
) );
650 error
= mlt_playlist_resize_clip( playlist
, index
, position
, info
.frame_out
);
651 mlt_service_unlock( MLT_PLAYLIST_SERVICE( playlist
) );
652 update_generation( unit
);
653 melted_unit_change_position( unit
, index
, 0 );
659 /** Set a clip's out point.
662 int melted_unit_set_clip_out( melted_unit unit
, int index
, int32_t position
)
664 mlt_properties properties
= unit
->properties
;
665 mlt_playlist playlist
= mlt_properties_get_data( properties
, "playlist", NULL
);
666 mlt_playlist_clip_info info
;
667 int error
= mlt_playlist_get_clip_info( playlist
, &info
, index
);
671 melted_unit_play( unit
, 0 );
672 mlt_service_lock( MLT_PLAYLIST_SERVICE( playlist
) );
673 error
= mlt_playlist_resize_clip( playlist
, index
, info
.frame_in
, position
);
674 mlt_service_unlock( MLT_PLAYLIST_SERVICE( playlist
) );
675 update_generation( unit
);
676 melted_unit_status_communicate( unit
);
677 melted_unit_change_position( unit
, index
, -1 );
683 /** Step by specified position.
686 void melted_unit_step( melted_unit unit
, int32_t offset
)
688 mlt_properties properties
= unit
->properties
;
689 mlt_playlist playlist
= mlt_properties_get_data( properties
, "playlist", NULL
);
690 mlt_producer producer
= MLT_PLAYLIST_PRODUCER( playlist
);
691 mlt_position position
= mlt_producer_frame( producer
);
692 mlt_producer_seek( producer
, position
+ offset
);
695 /** Set the unit's clip mode regarding in and out points.
698 //void melted_unit_set_mode( melted_unit unit, dv_player_clip_mode mode )
700 //dv_player player = melted_unit_get_dv_player( unit );
701 //if ( player != NULL )
702 //dv_player_set_clip_mode( player, mode );
703 //melted_unit_status_communicate( unit );
706 /** Get the unit's clip mode regarding in and out points.
709 //dv_player_clip_mode melted_unit_get_mode( melted_unit unit )
711 //dv_player player = melted_unit_get_dv_player( unit );
712 //return dv_player_get_clip_mode( player );
715 /** Set the unit's clip mode regarding eof handling.
718 //void melted_unit_set_eof_action( melted_unit unit, dv_player_eof_action action )
720 //dv_player player = melted_unit_get_dv_player( unit );
721 //dv_player_set_eof_action( player, action );
722 //melted_unit_status_communicate( unit );
725 /** Get the unit's clip mode regarding eof handling.
728 //dv_player_eof_action melted_unit_get_eof_action( melted_unit unit )
730 //dv_player player = melted_unit_get_dv_player( unit );
731 //return dv_player_get_eof_action( player );
734 int melted_unit_set( melted_unit unit
, char *name_value
)
736 mlt_properties properties
= NULL
;
738 if ( strncmp( name_value
, "consumer.", 9 ) )
740 mlt_playlist playlist
= mlt_properties_get_data( unit
->properties
, "playlist", NULL
);
741 properties
= MLT_PLAYLIST_PROPERTIES( playlist
);
745 mlt_consumer consumer
= mlt_properties_get_data( unit
->properties
, "consumer", NULL
);
746 properties
= MLT_CONSUMER_PROPERTIES( consumer
);
750 return mlt_properties_parse( properties
, name_value
);
753 char *melted_unit_get( melted_unit unit
, char *name
)
755 mlt_playlist playlist
= mlt_properties_get_data( unit
->properties
, "playlist", NULL
);
756 mlt_properties properties
= MLT_PLAYLIST_PROPERTIES( playlist
);
757 return mlt_properties_get( properties
, name
);
763 \param unit A melted_unit handle.
766 void melted_unit_close( melted_unit unit
)
770 melted_log( LOG_DEBUG
, "closing unit..." );
771 melted_unit_terminate( unit
);
772 mlt_properties_close( unit
->properties
);
774 melted_log( LOG_DEBUG
, "... unit closed." );