2 * MltPlaylist.cpp - MLT Wrapper
3 * Copyright (C) 2004-2005 Charles Yates
4 * Author: Charles Yates <charles.yates@pandora.be>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU Lesser General Public License as published
8 * by 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.
23 #include "MltPlaylist.h"
26 ClipInfo::ClipInfo( mlt_playlist_clip_info *info ) :
28 producer( new Producer( info->producer ) ),
29 service( new Service( info->service ) ),
31 resource( strdup( info->resource ) ),
32 frame_in( info->frame_in ),
33 frame_out( info->frame_out ),
34 frame_count( info->frame_count ),
35 length( info->length ),
40 ClipInfo::ClipInfo( Playlist &playlist, int index )
42 mlt_playlist_clip_info info;
43 mlt_playlist_get_clip_info( playlist.get_playlist( ), &info, index );
45 producer = new Producer( info.producer );
46 service = new Service( info.service );
48 resource = strdup( info.resource );
49 frame_in = info.frame_in;
50 frame_out = info.frame_out;
51 frame_count = info.frame_count;
56 ClipInfo::~ClipInfo( )
63 Playlist::Playlist( ) :
67 instance = mlt_playlist_init( );
70 Playlist::Playlist( Playlist &playlist ) :
72 instance( playlist.get_playlist( ) )
76 Playlist::Playlist( mlt_playlist playlist ) :
82 Playlist::~Playlist( )
85 mlt_playlist_close( instance );
88 mlt_playlist Playlist::get_playlist( )
93 mlt_producer Playlist::get_producer( )
95 return mlt_playlist_producer( get_playlist( ) );
98 int Playlist::count( )
100 return mlt_playlist_count( get_playlist( ) );
103 int Playlist::clear( )
105 return mlt_playlist_clear( get_playlist( ) );
108 int Playlist::append( Producer &producer, mlt_position in, mlt_position out )
110 return mlt_playlist_append_io( get_playlist( ), producer.get_producer( ), in, out );
113 int Playlist::blank( mlt_position length )
115 return mlt_playlist_blank( get_playlist( ), length );
118 mlt_position Playlist::clip( mlt_whence whence, int index )
120 return mlt_playlist_clip( get_playlist( ), whence, index );
123 int Playlist::current_clip( )
125 return mlt_playlist_current_clip( get_playlist( ) );
128 Producer *Playlist::current( )
130 return new Producer( mlt_playlist_current( get_playlist( ) ) );
133 ClipInfo *Playlist::clip_info( int index )
135 mlt_playlist_clip_info info;
136 mlt_playlist_get_clip_info( get_playlist( ), &info, index );
137 return new ClipInfo( &info );
140 int Playlist::insert( Producer &producer, int where, mlt_position in, mlt_position out )
142 return mlt_playlist_insert( get_playlist( ), producer.get_producer( ), where, in, out );
145 int Playlist::remove( int where )
147 return mlt_playlist_remove( get_playlist( ), where );
150 int Playlist::move( int from, int to )
152 return mlt_playlist_move( get_playlist( ), from, to );
155 int Playlist::resize_clip( int clip, mlt_position in, mlt_position out )
157 return mlt_playlist_resize_clip( get_playlist( ), clip, in, out );