Update the discussion of themeing in the manual, and put a note in the wps tags appen...
[kugel-rb.git] / apps / plugins / mpegplayer / stream_mgr.h
bloba00b39f1892ef6fcce3eb8e4076a26478445b5f1
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 struct list_item strl; /* List of available streams */
39 struct list_item actl; /* 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 #ifndef HAVE_LCD_COLOR
110 void stream_gray_show(bool show);
111 #endif
113 /* Display thumbnail of the current seekpoint */
114 bool stream_display_thumb(const struct vo_rect *rc);
116 /* Draw the frame at the current position */
117 bool stream_draw_frame(bool no_prepare);
119 /* Return video dimensions */
120 bool stream_vo_get_size(struct vo_ext *sz);
122 /* Returns the resume time in timestamp ticks */
123 uint32_t stream_get_resume_time(void);
125 /* Returns stream_get_time if no seek is pending or else the
126 last time give to seek */
127 uint32_t stream_get_seek_time(uint32_t *start);
129 /* Return the absolute stream time in clock ticks - adjusted by
130 * master clock stream via audio timestamps */
131 static inline uint32_t stream_get_time(void)
132 { return pcm_output_get_clock(); }
134 /* Return the absolute clock time in clock ticks - unadjusted */
135 static inline uint32_t stream_get_ticks(uint32_t *start)
136 { return pcm_output_get_ticks(start); }
138 /* Returns the current playback status */
139 static inline int stream_status(void)
140 { return stream_mgr.status; }
142 /* Wait for a state transistion to complete */
143 void stream_wait_status(void);
145 /* Returns the playback length of the stream */
146 static inline uint32_t stream_get_duration(void)
147 { return str_parser.duration; }
149 static inline bool stream_can_seek(void)
150 { return parser_can_seek(); }
152 /* Keep the disk spinning (for seeking and browsing) */
153 static inline void stream_keep_disk_active(void)
155 #ifdef HAVE_DISK_STORAGE
156 rb->storage_spin();
157 #endif
160 #endif /* STREAM_MGR_H */