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"
24 #include "MltTransition.h"
27 ClipInfo
::ClipInfo( mlt_playlist_clip_info
*info
) :
29 producer( new Producer( info
->producer
) ),
30 cut( new Producer( info
->cut
) ),
32 resource( strdup( info
->resource
) ),
33 frame_in( info
->frame_in
),
34 frame_out( info
->frame_out
),
35 frame_count( info
->frame_count
),
36 length( info
->length
),
38 repeat( info
->repeat
)
42 ClipInfo
::~ClipInfo( )
49 Playlist
::Playlist( ) :
52 instance
= mlt_playlist_init( );
55 Playlist
::Playlist( Service
&producer
) :
58 if ( producer
.type( ) == playlist_type
)
60 instance
= ( mlt_playlist
)producer
.get_service( );
65 Playlist
::Playlist( Playlist
&playlist
) :
66 instance( playlist
.get_playlist( ) )
71 Playlist
::Playlist( mlt_playlist playlist
) :
77 Playlist
::~Playlist( )
79 mlt_playlist_close( instance
);
82 mlt_playlist Playlist
::get_playlist( )
87 mlt_producer Playlist
::get_producer( )
89 return mlt_playlist_producer( get_playlist( ) );
92 int Playlist
::count( )
94 return mlt_playlist_count( get_playlist( ) );
97 int Playlist
::clear( )
99 return mlt_playlist_clear( get_playlist( ) );
102 int Playlist
::append( Producer
&producer
, int in
, int out
)
104 return mlt_playlist_append_io( get_playlist( ), producer
.get_producer( ), in
, out
);
107 int Playlist
::blank( int length
)
109 return mlt_playlist_blank( get_playlist( ), length
);
112 int Playlist
::clip( mlt_whence whence
, int index
)
114 return mlt_playlist_clip( get_playlist( ), whence
, index
);
117 int Playlist
::current_clip( )
119 return mlt_playlist_current_clip( get_playlist( ) );
122 Producer
*Playlist
::current( )
124 return new Producer( mlt_playlist_current( get_playlist( ) ) );
127 ClipInfo
*Playlist
::clip_info( int index
)
129 mlt_playlist_clip_info info
;
130 mlt_playlist_get_clip_info( get_playlist( ), &info
, index
);
131 return new ClipInfo( &info
);
134 int Playlist
::insert( Producer
&producer
, int where
, int in
, int out
)
136 return mlt_playlist_insert( get_playlist( ), producer
.get_producer( ), where
, in
, out
);
139 int Playlist
::remove( int where
)
141 return mlt_playlist_remove( get_playlist( ), where
);
144 int Playlist
::move( int from
, int to
)
146 return mlt_playlist_move( get_playlist( ), from
, to
);
149 int Playlist
::resize_clip( int clip
, int in
, int out
)
151 return mlt_playlist_resize_clip( get_playlist( ), clip
, in
, out
);
154 int Playlist
::split( int clip
, int position
)
156 return mlt_playlist_split( get_playlist( ), clip
, position
);
159 int Playlist
::join( int clip
, int count
, int merge
)
161 return mlt_playlist_join( get_playlist( ), clip
, count
, merge
);
164 int Playlist
::mix( int clip
, int length
, Transition
*transition
)
166 return mlt_playlist_mix( get_playlist( ), clip
, length
, transition
== NULL ? NULL
: transition
->get_transition( ) );
169 int Playlist
::mix_add( int clip
, Transition
*transition
)
171 return mlt_playlist_mix_add( get_playlist( ), clip
, transition
== NULL ? NULL
: transition
->get_transition( ) );
174 int Playlist
::repeat( int clip
, int count
)
176 return mlt_playlist_repeat_clip( get_playlist( ), clip
, count
);
179 Producer
*Playlist
::get_clip( int clip
)
181 return new Producer( mlt_playlist_get_clip( get_playlist( ), clip
) );
184 Producer
*Playlist
::get_clip_at( int position
)
186 return new Producer( mlt_playlist_get_clip_at( get_playlist( ), position
) );
189 int Playlist
::get_clip_index_at( int position
)
191 return mlt_playlist_get_clip_index_at( get_playlist( ), position
);
194 bool Playlist
::is_mix( int clip
)
196 return mlt_playlist_clip_is_mix( get_playlist( ), clip
) != 0;