]> git.sesse.net Git - vlc/blob - include/vlc/mediacontrol.h
mediacontrol API: proper fix for mediacontrol_Instance forward declaration
[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 mediacontrol_Instance *
118   mediacontrol_new_from_object( int vlc_object_id,
119                                 mediacontrol_Exception *exception );
120
121 mediacontrol_Position * mediacontrol_get_media_position(
122                          mediacontrol_Instance *self,
123                          const mediacontrol_PositionOrigin an_origin,
124                          const mediacontrol_PositionKey a_key,
125                          mediacontrol_Exception *exception );
126
127 void mediacontrol_set_media_position( mediacontrol_Instance *self,
128                                       const mediacontrol_Position *a_position,
129                                       mediacontrol_Exception *exception );
130
131 void mediacontrol_start( mediacontrol_Instance *self,
132                          const mediacontrol_Position *a_position,
133                          mediacontrol_Exception *exception );
134
135 void mediacontrol_pause( mediacontrol_Instance *self,
136                          const mediacontrol_Position *a_position,
137                          mediacontrol_Exception *exception );
138
139 void mediacontrol_resume( mediacontrol_Instance *self,
140                           const mediacontrol_Position *a_position,
141                           mediacontrol_Exception *exception );
142
143 void mediacontrol_stop( mediacontrol_Instance *self,
144                         const mediacontrol_Position *a_position,
145                         mediacontrol_Exception *exception );
146
147 void mediacontrol_exit( mediacontrol_Instance *self );
148
149 void mediacontrol_playlist_add_item( mediacontrol_Instance *self,
150                                      const char* psz_file,
151                                      mediacontrol_Exception *exception );
152 void mediacontrol_playlist_clear( mediacontrol_Instance *self,
153                                   mediacontrol_Exception *exception );
154 mediacontrol_PlaylistSeq *
155   mediacontrol_playlist_get_list( mediacontrol_Instance *self,
156                                   mediacontrol_Exception *exception );
157
158
159 /*****************************************************************************
160  * A/V functions
161  *****************************************************************************/
162 mediacontrol_RGBPicture *
163   mediacontrol_snapshot( mediacontrol_Instance *self,
164                          const mediacontrol_Position *a_position,
165                          mediacontrol_Exception *exception );
166
167 /* Return a NULL terminated list */
168 mediacontrol_RGBPicture **
169   mediacontrol_all_snapshots( mediacontrol_Instance *self,
170                               mediacontrol_Exception *exception );
171
172 /* Displays the message string, between "begin" and "end" positions */
173 void mediacontrol_display_text( mediacontrol_Instance *self,
174                                 const char *message,
175                                 const mediacontrol_Position *begin,
176                                 const mediacontrol_Position *end,
177                                 mediacontrol_Exception *exception );
178
179 mediacontrol_StreamInformation *
180   mediacontrol_get_stream_information( mediacontrol_Instance *self,
181                                        mediacontrol_PositionKey a_key,
182                                        mediacontrol_Exception *exception );
183
184 unsigned short
185   mediacontrol_sound_get_volume( mediacontrol_Instance *self,
186                                  mediacontrol_Exception *exception );
187 void mediacontrol_sound_set_volume( mediacontrol_Instance *self,
188                                     const unsigned short volume,
189                                     mediacontrol_Exception *exception );
190
191 vlc_bool_t mediacontrol_set_visual( mediacontrol_Instance *self,
192                                     WINDOWHANDLE visual_id,
193                                     mediacontrol_Exception *exception );
194
195 # ifdef __cplusplus
196 }
197 # endif
198
199 #endif