]> git.sesse.net Git - vlc/blob - include/vlc/mediacontrol.h
Define mediacontrol_Instance in the right place
[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 typedef struct {
70     vlc_object_t  *p_vlc;
71     playlist_t    *p_playlist;
72     intf_thread_t *p_intf;
73     int           vlc_object_id;
74 } mediacontrol_Instance;
75
76 /* Cf stream_control.h */
77 enum mediacontrol_PlayerStatusList
78 {
79     mediacontrol_PlayingStatus, mediacontrol_PauseStatus,
80     mediacontrol_ForwardStatus, mediacontrol_BackwardStatus,
81     mediacontrol_InitStatus,    mediacontrol_EndStatus,
82     mediacontrol_UndefinedStatus
83 };
84 typedef enum mediacontrol_PlayerStatusList mediacontrol_PlayerStatus;
85
86 typedef struct {
87     mediacontrol_PlayerStatus streamstatus;
88     char *url;         /* The URL of the current media stream */
89     vlc_int64_t position;     /* actual location in the stream (in ms) */
90     vlc_int64_t length;         /* total length of the stream (in ms) */
91 } mediacontrol_StreamInformation;
92
93 /**************************************************************************
94  *  Helper functions
95  ***************************************************************************/
96
97 mediacontrol_RGBPicture *mediacontrol_RGBPicture__alloc( int datasize );
98
99 void mediacontrol_RGBPicture__free( mediacontrol_RGBPicture *pic );
100
101 mediacontrol_RGBPicture *
102   _mediacontrol_createRGBPicture( int, int, long, vlc_int64_t l_date,
103                                   char *, int);
104
105 mediacontrol_PlaylistSeq *mediacontrol_PlaylistSeq__alloc( int size );
106
107 void mediacontrol_PlaylistSeq__free( mediacontrol_PlaylistSeq *ps );
108
109 mediacontrol_Exception *
110   mediacontrol_exception_init( mediacontrol_Exception *exception );
111
112 void mediacontrol_exception_free(mediacontrol_Exception *exception);
113
114 /*****************************************************************************
115  * Core functions
116  *****************************************************************************/
117 mediacontrol_Instance *
118   mediacontrol_new( char **args, mediacontrol_Exception *exception );
119
120 mediacontrol_Instance *
121   mediacontrol_new_from_object( int vlc_object_id,
122                                 mediacontrol_Exception *exception );
123
124 mediacontrol_Position * mediacontrol_get_media_position(
125                          mediacontrol_Instance *self,
126                          const mediacontrol_PositionOrigin an_origin,
127                          const mediacontrol_PositionKey a_key,
128                          mediacontrol_Exception *exception );
129
130 void mediacontrol_set_media_position( mediacontrol_Instance *self,
131                                       const mediacontrol_Position *a_position,
132                                       mediacontrol_Exception *exception );
133
134 void mediacontrol_start( mediacontrol_Instance *self,
135                          const mediacontrol_Position *a_position,
136                          mediacontrol_Exception *exception );
137
138 void mediacontrol_pause( mediacontrol_Instance *self,
139                          const mediacontrol_Position *a_position,
140                          mediacontrol_Exception *exception );
141
142 void mediacontrol_resume( mediacontrol_Instance *self,
143                           const mediacontrol_Position *a_position,
144                           mediacontrol_Exception *exception );
145
146 void mediacontrol_stop( mediacontrol_Instance *self,
147                         const mediacontrol_Position *a_position,
148                         mediacontrol_Exception *exception );
149
150 void mediacontrol_exit( mediacontrol_Instance *self );
151
152 void mediacontrol_playlist_add_item( mediacontrol_Instance *self,
153                                      const char* psz_file,
154                                      mediacontrol_Exception *exception );
155 void mediacontrol_playlist_clear( mediacontrol_Instance *self,
156                                   mediacontrol_Exception *exception );
157 mediacontrol_PlaylistSeq *
158   mediacontrol_playlist_get_list( mediacontrol_Instance *self,
159                                   mediacontrol_Exception *exception );
160
161
162 /*****************************************************************************
163  * A/V functions
164  *****************************************************************************/
165 mediacontrol_RGBPicture *
166   mediacontrol_snapshot( mediacontrol_Instance *self,
167                          const mediacontrol_Position *a_position,
168                          mediacontrol_Exception *exception );
169
170 /* Return a NULL terminated list */
171 mediacontrol_RGBPicture **
172   mediacontrol_all_snapshots( mediacontrol_Instance *self,
173                               mediacontrol_Exception *exception );
174
175 /* Displays the message string, between "begin" and "end" positions */
176 void mediacontrol_display_text( mediacontrol_Instance *self,
177                                 const char *message,
178                                 const mediacontrol_Position *begin,
179                                 const mediacontrol_Position *end,
180                                 mediacontrol_Exception *exception );
181
182 mediacontrol_StreamInformation *
183   mediacontrol_get_stream_information( mediacontrol_Instance *self,
184                                        mediacontrol_PositionKey a_key,
185                                        mediacontrol_Exception *exception );
186
187 unsigned short
188   mediacontrol_sound_get_volume( mediacontrol_Instance *self,
189                                  mediacontrol_Exception *exception );
190 void mediacontrol_sound_set_volume( mediacontrol_Instance *self,
191                                     const unsigned short volume,
192                                     mediacontrol_Exception *exception );
193
194 vlc_bool_t mediacontrol_set_visual( mediacontrol_Instance *self,
195                                     WINDOWHANDLE visual_id,
196                                     mediacontrol_Exception *exception );
197
198 # ifdef __cplusplus
199 }
200 # endif
201
202 #endif