Improve SDL port 'configure --prefix' error message
[kugel-rb.git] / apps / plugins / mpegplayer / stream_mgr.h
blob7dba9acc09f5685b9311614afc3c1ce70109d45e
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
10 * AV stream manager decalarations
12 * Copyright (c) 2007 Michael Sevakis
14 * This program is free software; you can redistribute it and/or
15 * modify it under the terms of the GNU General Public License
16 * as published by the Free Software Foundation; either version 2
17 * of the License, or (at your option) any later version.
19 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
20 * KIND, either express or implied.
22 ****************************************************************************/
23 #ifndef STREAM_MGR_H
24 #define STREAM_MGR_H
26 /* Basic media control interface - this handles state changes and stream
27 * coordination with assistance from the parser */
28 struct stream_mgr
30 unsigned int thread; /* Playback control thread */
31 struct event_queue *q; /* event queue for control thread */
32 const char *filename; /* Current filename */
33 uint32_t resume_time; /* The stream tick where playback was
34 stopped (or started) */
35 bool seeked; /* A seek happened and things must be
36 resynced */
37 int status; /* Current playback status */
38 void *strl[MPEGPLAYER_MAX_STREAMS+1]; /* List of available streams */
39 void *actl[MPEGPLAYER_MAX_STREAMS+1]; /* List of active streams */
40 struct mutex str_mtx; /* Main stream manager mutex */
41 struct mutex actl_mtx; /* Lock for current-streams list */
42 union /* A place for reusable non-cacheable parameters */
44 struct vo_rect rc;
45 struct stream_seek_data skd;
46 } parms;
49 extern struct stream_mgr stream_mgr SHAREDBSS_ATTR;
51 struct stream_window
53 off_t left, right;
56 /** Interface for use by streams and other internal objects **/
57 bool stream_get_window(struct stream_window *sw);
58 void stream_clear_notify(struct stream *str, int for_msg);
59 int str_next_data_not_ready(struct stream *str);
60 /* Called by a stream to say it got its buffering notification */
61 void str_data_notify_received(struct stream *str);
62 void stream_add_stream(struct stream *str);
63 void stream_remove_streams(void);
65 enum stream_events
67 __STREAM_EV_FIRST = STREAM_MESSAGE_LAST-1,
68 STREAM_EV_COMPLETE,
71 void stream_generate_event(struct stream *str, long id, intptr_t data);
73 /** Main control functions **/
75 /* Initialize the playback engine */
76 int stream_init(void);
78 /* Close the playback engine */
79 void stream_exit(void);
81 /* Open a new file */
82 int stream_open(const char *filename);
84 /* Close the current file */
85 int stream_close(void);
87 /* Plays from the current seekpoint if stopped */
88 int stream_play(void);
90 /* Pauses playback if playing */
91 int stream_pause(void);
93 /* Resumes playback if paused */
94 int stream_resume(void);
96 /* Stops all streaming activity if playing or paused */
97 int stream_stop(void);
99 /* Point stream at a particular time.
100 * whence = one of SEEK_SET, SEEK_CUR, SEEK_END */
101 int stream_seek(uint32_t time, int whence);
103 /* Show/Hide the video image at the current seekpoint */
104 bool stream_show_vo(bool show);
106 /* Set the visible section of video */
107 void stream_vo_set_clip(const struct vo_rect *rc);
109 /* Return current visible section of video */
110 bool stream_vo_get_clip(struct vo_rect *rc);
112 #ifndef HAVE_LCD_COLOR
113 void stream_gray_show(bool show);
114 #endif
116 /* Display thumbnail of the current seekpoint */
117 bool stream_display_thumb(const struct vo_rect *rc);
119 /* Draw the frame at the current position */
120 bool stream_draw_frame(bool no_prepare);
122 /* Return video dimensions */
123 bool stream_vo_get_size(struct vo_ext *sz);
125 /* Returns the resume time in timestamp ticks */
126 uint32_t stream_get_resume_time(void);
128 /* Returns stream_get_time if no seek is pending or else the
129 last time give to seek */
130 uint32_t stream_get_seek_time(uint32_t *start);
132 /* Return the absolute stream time in clock ticks - adjusted by
133 * master clock stream via audio timestamps */
134 static inline uint32_t stream_get_time(void)
135 { return pcm_output_get_clock(); }
137 /* Return the absolute clock time in clock ticks - unadjusted */
138 static inline uint32_t stream_get_ticks(uint32_t *start)
139 { return pcm_output_get_ticks(start); }
141 /* Returns the current playback status */
142 static inline int stream_status(void)
143 { return stream_mgr.status; }
145 /* Wait for a state transistion to complete */
146 void stream_wait_status(void);
148 /* Returns the playback length of the stream */
149 static inline uint32_t stream_get_duration(void)
150 { return str_parser.duration; }
152 static inline bool stream_can_seek(void)
153 { return parser_can_seek(); }
155 static inline void stream_video_stats(struct video_output_stats *s)
156 { video_thread_get_stats(s); }
158 bool stream_set_callback(long id, void * fn);
160 /* Keep the disk spinning (for seeking and browsing) */
161 static inline void stream_keep_disk_active(void)
163 #ifdef HAVE_DISK_STORAGE
164 rb->storage_spin();
165 #endif
168 #endif /* STREAM_MGR_H */