]> git.sesse.net Git - vlc/blob - bindings/libvlcpp/src/media_player.cpp
libvlcpp: fix compilation.
[vlc] / bindings / libvlcpp / src / media_player.cpp
1 /*****************************************************************************
2  * media_player.cpp: Represent a media player
3  *****************************************************************************
4  * Copyright (C) 2010 the VideoLAN team
5  * $Id$
6  *
7  * Authors: RĂ©mi Duraffort <ivoire@videolan.org>
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2 of the License, or
12  * (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, write to the Free Software
21  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
22  *****************************************************************************/
23
24 #include "media_player.hpp"
25
26 using namespace libvlc;
27
28 MediaPlayer::MediaPlayer( libVLC &libvlcInstance )
29 {
30     m_player = libvlc_media_player_new( libvlcInstance.m_instance );
31 }
32
33 MediaPlayer::MediaPlayer( Media &media )
34 {
35     m_player = libvlc_media_player_new_from_media( media.m_media );
36 }
37
38 MediaPlayer::~MediaPlayer()
39 {
40     libvlc_media_player_release( m_player );
41 }
42
43 void MediaPlayer::setMedia( Media &media )
44 {
45     libvlc_media_player_set_media( m_player, media.m_media );
46 }
47
48 int MediaPlayer::isPlaying()
49 {
50     return libvlc_media_player_is_playing( m_player );
51 }
52
53 void MediaPlayer::play()
54 {
55     libvlc_media_player_play( m_player );
56 }
57
58 void MediaPlayer::pause()
59 {
60     libvlc_media_player_pause( m_player );
61 }
62
63 void MediaPlayer::stop()
64 {
65     libvlc_media_player_stop( m_player );
66 }
67
68 void MediaPlayer::setNSObject( void *drawable )
69 {
70     libvlc_media_player_set_nsobject( m_player, drawable );
71 }
72
73 void* MediaPlayer::nsobject()
74 {
75     return libvlc_media_player_get_nsobject( m_player );
76 }
77
78 void MediaPlayer::setAgl( uint32_t drawable )
79 {
80     libvlc_media_player_set_agl( m_player, drawable );
81 }
82
83 uint32_t MediaPlayer::agl()
84 {
85     return libvlc_media_player_get_agl( m_player );
86 }
87
88 void MediaPlayer::setXWindow( uint32_t drawable )
89 {
90     libvlc_media_player_set_xwindow( m_player, drawable );
91 }
92
93 uint32_t MediaPlayer::xwindow()
94 {
95     return libvlc_media_player_get_xwindow( m_player );
96 }
97
98 void MediaPlayer::setHwnd( void *drawable )
99 {
100     libvlc_media_player_set_hwnd( m_player, drawable );
101 }
102
103 void *MediaPlayer::hwnd()
104 {
105     return libvlc_media_player_get_hwnd( m_player );
106 }
107
108 int64_t MediaPlayer::lenght()
109 {
110     return libvlc_media_player_get_length( m_player );
111 }
112
113 int64_t MediaPlayer::time()
114 {
115     return libvlc_media_player_get_time( m_player );
116 }
117
118 void MediaPlayer::setTime( int64_t new_time )
119 {
120     libvlc_media_player_set_time( m_player, new_time );
121 }
122
123 float MediaPlayer::position()
124 {
125     return libvlc_media_player_get_position( m_player );
126 }
127
128 void MediaPlayer::setPosition( float position )
129 {
130     libvlc_media_player_set_position( m_player, position );
131 }
132
133 int MediaPlayer::chapter()
134 {
135     return libvlc_media_player_get_chapter( m_player );
136 }
137
138 int MediaPlayer::chapterCount()
139 {
140     return libvlc_media_player_get_chapter_count( m_player );
141 }
142
143 int MediaPlayer::chapterCount( int title )
144 {
145     return libvlc_media_player_get_chapter_count_for_title( m_player, title );
146 }
147
148 void MediaPlayer::setChapter( int title )
149 {
150     libvlc_media_player_set_chapter( m_player, title );
151 }
152
153 int MediaPlayer::willPlay()
154 {
155     return libvlc_media_player_will_play( m_player );
156 }
157
158 int MediaPlayer::title()
159 {
160     return libvlc_media_player_get_title( m_player );
161 }
162
163 int MediaPlayer::titleCount()
164 {
165     return libvlc_media_player_get_title_count( m_player );
166 }
167
168 void MediaPlayer::setTitle( int title )
169 {
170     libvlc_media_player_set_title( m_player, title );
171 }
172
173 void MediaPlayer::previousChapter()
174 {
175     libvlc_media_player_previous_chapter( m_player );
176 }
177
178 void MediaPlayer::nextChapter()
179 {
180     libvlc_media_player_next_chapter( m_player );
181 }
182
183 float MediaPlayer::rate()
184 {
185     return libvlc_media_player_get_rate( m_player );
186 }
187
188 void MediaPlayer::setRate( float rate )
189 {
190     libvlc_media_player_set_rate( m_player, rate );
191 }
192
193 libvlc_state_t MediaPlayer::state()
194 {
195     return libvlc_media_player_get_state( m_player );
196 }
197
198 float MediaPlayer::fps()
199 {
200     return libvlc_media_player_get_fps( m_player );
201 }
202
203 int MediaPlayer::hasVout()
204 {
205     return libvlc_media_player_has_vout( m_player );
206 }
207
208 int MediaPlayer::isSeekable()
209 {
210     return libvlc_media_player_is_seekable( m_player );
211 }
212 int MediaPlayer::canPause()
213 {
214     return libvlc_media_player_can_pause( m_player );
215 }
216
217 void MediaPlayer::nextFrame()
218 {
219     libvlc_media_player_next_frame( m_player );
220 }
221
222 void MediaPlayer::toggleFullscreen()
223 {
224     libvlc_toggle_fullscreen( m_player );
225 }
226
227 void MediaPlayer::enableFullscreen()
228 {
229     libvlc_set_fullscreen( m_player, 1 );
230 }
231
232 void MediaPlayer::disableFullscreen()
233 {
234     libvlc_set_fullscreen( m_player, 0 );
235 }
236
237 int MediaPlayer::fullscreen()
238 {
239     return libvlc_get_fullscreen( m_player );
240 }