1 /***************************************************************** 2 * gmerlin - a general purpose multimedia framework and applications 3 * 4 * Copyright (c) 2001 - 2011 Members of the Gmerlin project 5 * gmerlin-general@lists.sourceforge.net 6 * http://gmerlin.sourceforge.net 7 * 8 * This program is free software: you can redistribute it and/or modify 9 * it under the terms of the GNU General Public License as published by 10 * the Free Software Foundation, either version 2 of the License, or 11 * (at your option) any later version. 12 * 13 * This program is distributed in the hope that it will be useful, 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 * GNU General Public License for more details. 17 * 18 * You should have received a copy of the GNU General Public License 19 * along with this program. If not, see <http://www.gnu.org/licenses/>. 20 * *****************************************************************/ 21 22 #ifndef __BG_PLAYERMSG_H_ 23 #define __BG_PLAYERMSG_H_ 24 25 /** \defgroup player_states Player states 26 * \ingroup player_msg 27 * \brief State definitions for the player 28 * 29 * @{ 30 */ 31 32 #define BG_PLAYER_STATE_INIT -1 //!< Initializing 33 #define BG_PLAYER_STATE_STOPPED 0 //!< Stopped, waiting for play command 34 #define BG_PLAYER_STATE_PLAYING 1 //!< Playing 35 #define BG_PLAYER_STATE_SEEKING 2 //!< Seeking 36 #define BG_PLAYER_STATE_CHANGING 3 //!< Changing the track 37 #define BG_PLAYER_STATE_BUFFERING 4 //!< Buffering data 38 #define BG_PLAYER_STATE_PAUSED 5 //!< Paused 39 #define BG_PLAYER_STATE_EOF 6 //!< Finished playback 40 #define BG_PLAYER_STATE_STARTING 8 //!< Starting playback 41 #define BG_PLAYER_STATE_ERROR 9 //!< Error 42 43 /** 44 * @} 45 */ 46 47 /* Message definition for the player */ 48 49 /**************************** 50 * Commands for the player 51 ****************************/ 52 53 /* Start playing */ 54 /* arg1: Input plugin handle */ 55 /* arg2: Track index for plugins with multiple tracks */ 56 /* arg3: Play flags, see defines below */ 57 58 #define BG_PLAYER_CMD_PLAY 0 59 60 /* Stop playing */ 61 62 #define BG_PLAYER_CMD_STOP 1 63 64 /* Seek to a specific point */ 65 /* arg1: seek Perfenctage */ 66 /* (between 0.0 and 1.0, float) */ 67 68 #define BG_PLAYER_CMD_SEEK 2 69 70 /* Set the state of the player */ 71 /* arg1: New state */ 72 73 /* 74 * if(state == BG_PLAYER_STATE_BUFFERING) 75 * arg2: Buffering percentage (float) 76 * else if(state == BG_PLAYER_STATE_ERROR) 77 * arg2: String describing the error 78 * else if(state == BG_PLAYER_STATE_PLAYING) 79 * arg2: Integer (1 if player can pause playback without messing up the data source) 80 */ 81 82 #define BG_PLAYER_CMD_SETSTATE 3 83 84 /* Quit playback thread (used by bg_player_quit()) */ 85 86 #define BG_PLAYER_CMD_QUIT 4 87 88 /* Change output plugins, arg1 is plugin handle of the opened plugin */ 89 90 #define BG_PLAYER_CMD_SET_OV_PLUGIN 5 91 92 #define BG_PLAYER_CMD_SET_OA_PLUGIN 6 93 94 /* Set track name */ 95 96 #define BG_PLAYER_CMD_SET_NAME 7 97 98 /* Act like a pause button */ 99 100 #define BG_PLAYER_CMD_PAUSE 8 101 102 /* 103 * Seek relative (gavl_time_t) 104 */ 105 106 #define BG_PLAYER_CMD_SEEK_REL 10 107 108 /* Set volume (float dB value) */ 109 110 #define BG_PLAYER_CMD_SET_VOLUME 11 111 112 /* Set volume (float dB value) */ 113 114 #define BG_PLAYER_CMD_SET_VOLUME_REL 12 115 116 /* Like BG_PLAYER_CMD_PLAY but go into the pause state right after the 117 playback is set up */ 118 119 #define BG_PLAYER_CMD_PLAY_PAUSE 13 120 121 #define BG_PLAYER_CMD_SET_AUDIO_STREAM 14 122 #define BG_PLAYER_CMD_SET_VIDEO_STREAM 15 123 #define BG_PLAYER_CMD_SET_SUBTITLE_STREAM 16 124 125 /* Argument 1: keycode (see keycodes.h) 126 Argument 2: mask (see keycodes.h) 127 */ 128 129 #define BG_PLAYER_CMD_KEY 17 /* A key was pressed */ 130 131 #define BG_PLAYER_CMD_CHANGE 18 /* Player should prepare for changing the 132 track */ 133 134 #define BG_PLAYER_CMD_TOGGLE_MUTE 19 /* Toggle mute state */ 135 136 #define BG_PLAYER_CMD_SET_CHAPTER 20 /* Goto chapter */ 137 138 #define BG_PLAYER_CMD_NEXT_CHAPTER 21 /* Next chapter */ 139 140 #define BG_PLAYER_CMD_PREV_CHAPTER 22 /* Previous chapter */ 141 142 #define BG_PLAYER_CMD_INTERRUPT 23 /* Interrupt playback */ 143 #define BG_PLAYER_CMD_INTERRUPT_RESUME 24 /* Resume interrupted playback */ 144 145 /******************************** 146 * Messages from the player 147 ********************************/ 148 149 /** \defgroup player_msg Messages from the player 150 * \ingroup player 151 * 152 * @{ 153 */ 154 155 /** \brief Display time changed 156 * 157 * arg0: New time (gavl_time_t) 158 * 159 * This is called periodically during playback if the time changed. 160 */ 161 162 #define BG_PLAYER_MSG_TIME_CHANGED 0 163 164 /** \brief Track changed 165 * 166 * arg0: Track index (int) 167 * 168 * This message is only emitted for input plugins, 169 * which do playback themselves. 170 */ 171 172 #define BG_PLAYER_MSG_TRACK_CHANGED 1 173 174 /** \brief State changed 175 * 176 * arg0: New state (\ref player_states) 177 * 178 * arg1 depends on the state: 179 * 180 * - BG_PLAYER_STATE_BUFFERING: Buffering percentage (float, 0.0..1.0) 181 * - BG_PLAYER_STATE_ERROR: String describing the error (char*) 182 * - BG_PLAYER_STATE_PLAYING: 1 if player can seek within the current track, 0 else (int) 183 * - BG_PLAYER_STATE_CHANGING: 1 if player needs the next track, 0 else 184 */ 185 186 #define BG_PLAYER_MSG_STATE_CHANGED 2 187 188 /** \brief Track name 189 * 190 * arg0: Track name (char*) 191 * 192 * This is set whenever the track name changes. For internet radio stations, it can be 193 * sent multiple times for one URL. 194 */ 195 196 #define BG_PLAYER_MSG_TRACK_NAME 3 197 198 /** \brief Duration changed 199 * 200 * arg0: Total duration in seconds (gavl_time_t) 201 */ 202 203 #define BG_PLAYER_MSG_TRACK_DURATION 5 204 205 /** \brief Get info about the streams 206 * 207 * arg0: Number of audio streams (int) 208 * 209 * arg1: Number of video streams (int) 210 * 211 * arg2: Number of subtitle streams (int) 212 */ 213 214 #define BG_PLAYER_MSG_TRACK_NUM_STREAMS 4 215 216 /** \brief Get information about the current audio stream 217 * 218 * arg0: Stream index (int) 219 * 220 * arg1: Input Format (gavl_audio_format_t) 221 * 222 * arg2: Output Format (gavl_audio_format_t) 223 */ 224 225 #define BG_PLAYER_MSG_AUDIO_STREAM 6 226 227 /** \brief Get information about the current video stream 228 * 229 * arg0: Stream index (int) 230 * 231 * arg1: Input Format (gavl_video_format_t) 232 * 233 * arg2: Output Format (gavl_video_format_t) 234 */ 235 236 #define BG_PLAYER_MSG_VIDEO_STREAM 7 237 238 239 /** \brief Get information about the current subtitle stream 240 * 241 * arg0: Stream index (int) 242 * 243 * arg1: 1 if the subtitle is a text subtitle, 0 else 244 * 245 * arg2: Format (gavl_video_format_t) 246 */ 247 248 #define BG_PLAYER_MSG_SUBTITLE_STREAM 9 249 250 /* Metadata (is only sent, if information is available) */ 251 252 /** \brief Metadata changed 253 * 254 * arg0: Metadata (bg_metadata_t) 255 */ 256 257 #define BG_PLAYER_MSG_METADATA 10 258 259 /** \brief Volume changed 260 * 261 * arg0: New volume in dB (float) 262 */ 263 #define BG_PLAYER_MSG_VOLUME_CHANGED 16 264 265 /** \brief Audio stream info 266 * 267 * arg0: stream index (int) 268 * 269 * arg1: stream name (char*) 270 * 271 * arg2: stream language (char*) 272 * 273 * This message is sent for all available audio streams 274 * regardless of what you selected 275 */ 276 277 #define BG_PLAYER_MSG_AUDIO_STREAM_INFO 17 278 279 /** \brief Video stream info 280 * 281 * arg0: stream index (int) 282 * 283 * arg1: stream name (char*) 284 * 285 * arg2: stream language (char*) 286 * 287 * This message is sent for all available video streams 288 * regardless of what you selected 289 */ 290 291 #define BG_PLAYER_MSG_VIDEO_STREAM_INFO 18 292 293 /** \brief Subtitle stream info 294 * 295 * arg0: stream index (int) 296 * 297 * arg1: stream name (char*) 298 * 299 * arg2: stream language (char*) 300 * 301 * This message is sent for all available video streams 302 * regardless of what you selected 303 */ 304 #define BG_PLAYER_MSG_SUBTITLE_STREAM_INFO 19 305 306 /** \brief A key was pressed in the video window 307 * 308 * arg0: keycode (see \ref keycodes) 309 * 310 * arg1: mask (see \ref keycodes) 311 * 312 * This message is only emitted if key+mask were not handled 313 * by the video plugin or by the player. 314 */ 315 316 #define BG_PLAYER_MSG_ACCEL 20 /* A key shortcut 317 was pressed */ 318 319 /** \brief Player just cleaned up 320 * 321 * A previously triggerend cleanup operation is finished. 322 */ 323 324 #define BG_PLAYER_MSG_CLEANUP 21 325 326 /** \brief Player changed the mute state 327 * 328 * arg0: 1 when player is muted now, 0 else 329 * 330 */ 331 332 #define BG_PLAYER_MSG_MUTE 22 333 334 /** \brief Number of chapters 335 * 336 * arg0: Number 337 */ 338 339 #define BG_PLAYER_MSG_NUM_CHAPTERS 23 340 341 /** \brief Chapter info 342 * 343 * arg0: Chapter index 344 * arg1: Name (string) 345 * arg2: Start time (time) 346 */ 347 348 #define BG_PLAYER_MSG_CHAPTER_INFO 24 349 350 /** \brief Chapter changed 351 * 352 * arg0: Chapter index 353 */ 354 355 #define BG_PLAYER_MSG_CHAPTER_CHANGED 25 356 357 /** \brief Playback interrupted 358 */ 359 360 #define BG_PLAYER_MSG_INTERRUPT 26 361 362 /** \brief Interrupted playback resumed 363 */ 364 365 #define BG_PLAYER_MSG_INTERRUPT_RESUME 27 366 367 /** \brief Input info 368 * arg0: Plugin name (string) 369 * arg1: Location (string) 370 * arg2: Track (int) 371 */ 372 373 #define BG_PLAYER_MSG_INPUT 28 374 375 /** \brief Audio peaks 376 * arg0: Number of samples processed 377 * arg1: Left peak 378 * arg2: Right peak 379 */ 380 381 #define BG_PLAYER_MSG_AUDIO_PEAK 29 382 383 /** @} 384 */ 385 386 #endif // __BG_PLAYERMSG_H_ 387