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