]> git.sesse.net Git - vlc/blob - include/vlc/mediacontrol.h
mediacontrol API: (mostly) use the new libvlc API
[vlc] / include / vlc / mediacontrol.h
1 /*****************************************************************************
2  * control.h: global header for mediacontrol
3  *****************************************************************************
4  * Copyright (C) 2005 the VideoLAN team
5  * $Id$
6  *
7  * Authors: Olivier Aubert <olivier.aubert@liris.univ-lyon1.fr>
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 #ifndef _VLC_CONTROL_H
25 #define _VLC_CONTROL_H 1
26
27 # ifdef __cplusplus
28 extern "C" {
29 # endif
30
31 #if defined( WIN32 )
32 #define WINDOWHANDLE HWND
33 #else
34 #define WINDOWHANDLE int
35 #endif
36
37 #include <vlc/mediacontrol_structures.h>
38
39 /************************************************************************
40  * Position Object Manipulation
41  *************************************************************************/
42
43 typedef struct {
44     int  width;
45     int  height;
46     long type;
47     vlc_int64_t date;
48     int  size;
49     char *data;
50 } mediacontrol_RGBPicture;
51
52 typedef struct {
53     int size;
54     char **data;
55 } mediacontrol_PlaylistSeq;
56
57 typedef struct {
58     int code;
59     char *message;
60 } mediacontrol_Exception;
61
62 /* Exception codes */
63 #define mediacontrol_PositionKeyNotSupported    1
64 #define mediacontrol_PositionOriginNotSupported 2
65 #define mediacontrol_InvalidPosition            3
66 #define mediacontrol_PlaylistException          4
67 #define mediacontrol_InternalException          5
68
69 /* mediacontrol_Instance is an opaque structure, defined in
70    mediacontrol_internal.h. API users do not have to mess with it. */
71 typedef struct mediacontrol_Instance mediacontrol_Instance;
72
73 /* Cf stream_control.h */
74 enum mediacontrol_PlayerStatusList
75 {
76     mediacontrol_PlayingStatus, mediacontrol_PauseStatus,
77     mediacontrol_ForwardStatus, mediacontrol_BackwardStatus,
78     mediacontrol_InitStatus,    mediacontrol_EndStatus,
79     mediacontrol_UndefinedStatus
80 };
81 typedef enum mediacontrol_PlayerStatusList mediacontrol_PlayerStatus;
82
83 typedef struct {
84     mediacontrol_PlayerStatus streamstatus;
85     char *url;         /* The URL of the current media stream */
86     vlc_int64_t position;     /* actual location in the stream (in ms) */
87     vlc_int64_t length;         /* total length of the stream (in ms) */
88 } mediacontrol_StreamInformation;
89
90 /**************************************************************************
91  *  Helper functions
92  ***************************************************************************/
93
94 mediacontrol_RGBPicture *mediacontrol_RGBPicture__alloc( int datasize );
95
96 void mediacontrol_RGBPicture__free( mediacontrol_RGBPicture *pic );
97
98 mediacontrol_RGBPicture *
99   _mediacontrol_createRGBPicture( int, int, long, vlc_int64_t l_date,
100                                   char *, int);
101
102 mediacontrol_PlaylistSeq *mediacontrol_PlaylistSeq__alloc( int size );
103
104 void mediacontrol_PlaylistSeq__free( mediacontrol_PlaylistSeq *ps );
105
106 mediacontrol_Exception *
107   mediacontrol_exception_init( mediacontrol_Exception *exception );
108
109 void mediacontrol_exception_free(mediacontrol_Exception *exception);
110
111 /*****************************************************************************
112  * Core functions
113  *****************************************************************************/
114 mediacontrol_Instance *
115   mediacontrol_new( char **args, mediacontrol_Exception *exception );
116
117 /* Bridge with the libvlc API */
118 mediacontrol_Instance *
119 mediacontrol_new_from_instance( libvlc_instance_t* p_instance,
120                                 mediacontrol_Exception *exception );
121
122 libvlc_instance_t*
123 mediacontrol_get_libvlc_instance( mediacontrol_Instance* self );
124
125 mediacontrol_Position * mediacontrol_get_media_position(
126                          mediacontrol_Instance *self,
127                          const mediacontrol_PositionOrigin an_origin,
128                          const mediacontrol_PositionKey a_key,
129                          mediacontrol_Exception *exception );
130
131 void mediacontrol_set_media_position( mediacontrol_Instance *self,
132                                       const mediacontrol_Position *a_position,
133                                       mediacontrol_Exception *exception );
134
135 void mediacontrol_start( mediacontrol_Instance *self,
136                          const mediacontrol_Position *a_position,
137                          mediacontrol_Exception *exception );
138
139 void mediacontrol_pause( mediacontrol_Instance *self,
140                          const mediacontrol_Position *a_position,
141                          mediacontrol_Exception *exception );
142
143 void mediacontrol_resume( mediacontrol_Instance *self,
144                           const mediacontrol_Position *a_position,
145                           mediacontrol_Exception *exception );
146
147 void mediacontrol_stop( mediacontrol_Instance *self,
148                         const mediacontrol_Position *a_position,
149                         mediacontrol_Exception *exception );
150
151 void mediacontrol_exit( mediacontrol_Instance *self );
152
153 void mediacontrol_playlist_add_item( mediacontrol_Instance *self,
154                                      const char* psz_file,
155                                      mediacontrol_Exception *exception );
156 void mediacontrol_playlist_clear( mediacontrol_Instance *self,
157                                   mediacontrol_Exception *exception );
158 mediacontrol_PlaylistSeq *
159   mediacontrol_playlist_get_list( mediacontrol_Instance *self,
160                                   mediacontrol_Exception *exception );
161
162
163 /*****************************************************************************
164  * A/V functions
165  *****************************************************************************/
166 mediacontrol_RGBPicture *
167   mediacontrol_snapshot( mediacontrol_Instance *self,
168                          const mediacontrol_Position *a_position,
169                          mediacontrol_Exception *exception );
170
171 /* Return a NULL terminated list */
172 mediacontrol_RGBPicture **
173   mediacontrol_all_snapshots( mediacontrol_Instance *self,
174                               mediacontrol_Exception *exception );
175
176 /* Displays the message string, between "begin" and "end" positions */
177 void mediacontrol_display_text( mediacontrol_Instance *self,
178                                 const char *message,
179                                 const mediacontrol_Position *begin,
180                                 const mediacontrol_Position *end,
181                                 mediacontrol_Exception *exception );
182
183 mediacontrol_StreamInformation *
184   mediacontrol_get_stream_information( mediacontrol_Instance *self,
185                                        mediacontrol_PositionKey a_key,
186                                        mediacontrol_Exception *exception );
187
188 unsigned short
189   mediacontrol_sound_get_volume( mediacontrol_Instance *self,
190                                  mediacontrol_Exception *exception );
191 void mediacontrol_sound_set_volume( mediacontrol_Instance *self,
192                                     const unsigned short volume,
193                                     mediacontrol_Exception *exception );
194
195 vlc_bool_t mediacontrol_set_visual( mediacontrol_Instance *self,
196                                     WINDOWHANDLE visual_id,
197                                     mediacontrol_Exception *exception );
198
199 /* Rate in percent. 100 is normal rate. */
200 int mediacontrol_get_rate( mediacontrol_Instance *self,
201                            mediacontrol_Exception *exception );
202
203 void mediacontrol_set_rate( mediacontrol_Instance *self,
204                             const int rate,
205                             mediacontrol_Exception *exception );
206
207 int mediacontrol_get_fullscreen( mediacontrol_Instance *self,
208                                  mediacontrol_Exception *exception );
209
210 void mediacontrol_set_fullscreen( mediacontrol_Instance *self,
211                                   const int b_fullscreen,
212                                   mediacontrol_Exception *exception );
213
214 # ifdef __cplusplus
215 }
216 # endif
217
218 #endif