1 /***************************************************************************
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
10 * AV stream manager implementation
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 ****************************************************************************/
24 #include "mpegplayer.h"
26 #include "mpeg_settings.h"
28 #ifndef HAVE_LCD_COLOR
32 static struct event_queue stream_mgr_queue SHAREDBSS_ATTR
;
33 static struct queue_sender_list stream_mgr_queue_send SHAREDBSS_ATTR
;
34 static uint32_t stream_mgr_thread_stack
[DEFAULT_STACK_SIZE
*2/sizeof(uint32_t)];
36 struct stream_mgr stream_mgr SHAREDBSS_ATTR
;
39 static int stream_on_close(void);
41 struct str_broadcast_data
43 long cmd
; /* Command to send to stream */
44 intptr_t data
; /* Data to send with command */
47 static inline void stream_mgr_lock(void)
49 rb
->mutex_lock(&stream_mgr
.str_mtx
);
52 static inline void stream_mgr_unlock(void)
54 rb
->mutex_unlock(&stream_mgr
.str_mtx
);
57 static inline void actl_lock(void)
59 rb
->mutex_lock(&stream_mgr
.actl_mtx
);
62 static inline void actl_unlock(void)
64 rb
->mutex_unlock(&stream_mgr
.actl_mtx
);
67 static inline void stream_mgr_post_msg(long id
, intptr_t data
)
69 rb
->queue_post(stream_mgr
.q
, id
, data
);
72 static inline intptr_t stream_mgr_send_msg(long id
, intptr_t data
)
74 return rb
->queue_send(stream_mgr
.q
, id
, data
);
77 static inline void stream_mgr_reply_msg(intptr_t retval
)
79 rb
->queue_reply(stream_mgr
.q
, retval
);
82 int str_next_data_not_ready(struct stream
*str
)
84 /* Save the current window since it actually might be ready by the time
85 * the registration is received by buffering. */
86 off_t win_right
= str
->hdr
.win_right
;
88 if (str
->hdr
.win_right
< disk_buf
.filesize
- MIN_BUFAHEAD
&&
89 disk_buf
.filesize
> MIN_BUFAHEAD
)
91 /* Set right edge to where probing left off + the minimum margin */
92 str
->hdr
.win_right
+= MIN_BUFAHEAD
;
96 /* Request would be passed the end of the file */
97 str
->hdr
.win_right
= disk_buf
.filesize
;
100 switch (disk_buf_send_msg(DISK_BUF_DATA_NOTIFY
, (intptr_t)str
))
102 case DISK_BUF_NOTIFY_OK
:
103 /* Was ready - restore window and process */
104 str
->hdr
.win_right
= win_right
;
107 case DISK_BUF_NOTIFY_ERROR
:
108 /* Error - quit parsing */
109 str_end_of_stream(str
);
110 return STREAM_DATA_END
;
113 /* Not ready - go wait for notification from buffering. */
115 return STREAM_DATA_NOT_READY
;
119 void str_data_notify_received(struct stream
*str
)
121 /* Normalize win_right back to the packet length */
122 if (str
->state
== SSTATE_END
)
125 if (str
->curr_packet
== NULL
)
127 /* Nothing was yet parsed since init */
128 str
->hdr
.win_right
= str
->hdr
.win_left
;
132 /* Restore window based upon current packet */
133 str
->hdr
.win_right
= str
->hdr
.win_left
+
134 (str
->curr_packet_end
- str
->curr_packet
);
138 /* Set stream manager to a "no-file" state */
139 static void stream_mgr_init_state(void)
141 stream_mgr
.filename
= NULL
;
142 stream_mgr
.resume_time
= INVALID_TIMESTAMP
;
143 stream_mgr
.seeked
= false;
146 /* Add a stream to the playback pool */
147 void stream_add_stream(struct stream
*str
)
151 list_remove_item(stream_mgr
.strl
, str
);
152 list_add_item(stream_mgr
.strl
, str
);
157 /* Callback for various list-moving operations */
158 static bool strl_enum_callback(struct stream
*str
, intptr_t data
)
162 list_remove_item(stream_mgr
.strl
, str
);
165 list_add_item(stream_mgr
.actl
, str
);
172 /* Clear all streams from active and playback pools */
173 void stream_remove_streams(void)
175 list_enum_items(stream_mgr
.strl
,
176 (list_enum_callback_t
)strl_enum_callback
, 0);
179 /* Move the playback pool to the active list */
180 void move_strl_to_actl(void)
182 list_enum_items(stream_mgr
.strl
,
183 (list_enum_callback_t
)strl_enum_callback
, 1);
186 /* Remove a stream from the active list and return it to the pool */
187 static bool actl_stream_remove(struct stream
*str
)
193 retval
= list_remove_item(stream_mgr
.actl
, str
);
196 list_add_item(stream_mgr
.strl
, str
);
203 /* Broadcast a message to all active streams */
204 static bool actl_stream_broadcast_callback(struct stream
*str
,
205 struct str_broadcast_data
*sbd
)
218 list_remove_item(stream_mgr
.actl
, str
);
219 list_add_item(stream_mgr
.strl
, str
);
230 str_send_msg(str
, sbd
->cmd
, sbd
->data
);
234 static void actl_stream_broadcast(int cmd
, intptr_t data
)
236 struct str_broadcast_data sbd
;
239 list_enum_items(stream_mgr
.actl
,
240 (list_enum_callback_t
)actl_stream_broadcast_callback
,
244 /* Set the current base clock */
245 static void set_stream_clock(uint32_t time
)
247 /* Fudge: Start clock 100ms early to allow for some filling time */
248 if (time
> 100*TS_SECOND
/1000)
249 time
-= 100*TS_SECOND
/1000;
253 pcm_output_set_clock(TS_TO_TICKS(time
));
256 static void stream_start_playback(uint32_t time
, bool fill_buffer
)
258 if (stream_mgr
.seeked
)
260 /* Clear any seeked status */
261 stream_mgr
.seeked
= false;
263 /* Flush old PCM data */
266 /* Set the master clock */
267 set_stream_clock(time
);
269 /* Make sure streams are back in active pool */
272 /* Prepare the parser and associated streams */
273 parser_prepare_streaming();
276 /* Start buffer which optional force fill */
277 disk_buf_send_msg(STREAM_PLAY
, fill_buffer
);
279 /* Tell each stream to start - may generate end of stream signals
280 * now - we'll handle this when finished */
281 actl_stream_broadcast(STREAM_PLAY
, 0);
283 /* Actually start the clock */
284 pcm_output_play_pause(true);
287 /* Return the play time relative to the specified play time */
288 static uint32_t time_from_whence(uint32_t time
, int whence
)
296 /* Set the current time (time = unsigned offset from 0) */
297 if (time
> str_parser
.duration
)
298 time
= str_parser
.duration
;
301 /* Seek forward or backward from the current time
302 * (time = signed offset from current) */
303 currtime
= stream_get_seek_time(&start
);
305 currtime
+= (int32_t)time
;
309 else if ((uint64_t)currtime
> str_parser
.duration
)
310 currtime
= str_parser
.duration
;
312 time
= (uint32_t)currtime
;
315 /* Seek from the end (time = unsigned offset from end) */
316 if (time
> str_parser
.duration
)
317 time
= str_parser
.duration
;
318 time
= str_parser
.duration
- time
;
325 /* Handle seeking details if playing or paused */
326 static uint32_t stream_seek_intl(uint32_t time
, int whence
,
327 int status
, bool *was_buffering
)
329 if (status
!= STREAM_STOPPED
)
333 /* Place streams in a non-running state - keep them on actl if
335 actl_stream_broadcast(STREAM_PAUSE
, 0);
337 /* Stop all buffering or else risk clobbering random-access data */
338 wb
= disk_buf_send_msg(STREAM_STOP
, 0);
340 if (was_buffering
!= NULL
)
344 time
= time_from_whence(time
, whence
);
346 stream_mgr
.seeked
= true;
348 return parser_seek_time(time
);
351 /* Store the resume time at the last seek/current clock point */
352 static void stream_remember_resume_time(void)
354 /* Assume invalidity */
355 stream_mgr
.resume_time
= 0;
357 if (stream_can_seek())
359 /* Read the current stream time or the last seeked position */
361 uint32_t time
= stream_get_seek_time(&start
);
363 if (time
>= str_parser
.start_pts
&& time
<= str_parser
.end_pts
)
365 /* Save the current stream time */
366 stream_mgr
.resume_time
= time
- start
;
371 /* Handle STREAM_OPEN */
372 void stream_on_open(const char *filename
)
374 int err
= STREAM_ERROR
;
380 /* Open the video file */
381 if (disk_buf_open(filename
) >= 0)
383 /* Initialize the parser */
384 err
= parser_init_stream();
386 if (err
>= STREAM_OK
)
388 /* File ok - save the opened filename */
389 stream_mgr
.filename
= filename
;
393 /* If error - cleanup */
401 stream_mgr_reply_msg(err
);
404 /* Handler STREAM_PLAY */
405 static void stream_on_play(void)
407 int status
= stream_mgr
.status
;
411 if (status
== STREAM_STOPPED
)
415 /* We just say we're playing now */
416 stream_mgr
.status
= STREAM_PLAYING
;
418 /* Reply with previous state */
419 stream_mgr_reply_msg(status
);
423 /* Seek to initial position and set clock to that time */
425 /* Save the resume time */
426 stream_remember_resume_time();
428 /* Prepare seek to start point */
429 start
= stream_seek_intl(stream_mgr
.resume_time
, SEEK_SET
,
430 STREAM_STOPPED
, NULL
);
432 /* Sync and start - force buffer fill */
433 stream_start_playback(start
, true);
437 /* Reply with previous state */
438 stream_mgr_reply_msg(status
);
444 /* Handle STREAM_PAUSE */
445 static void stream_on_pause(void)
447 int status
= stream_mgr
.status
;
451 /* Reply with previous state */
452 stream_mgr_reply_msg(status
);
454 if (status
== STREAM_PLAYING
)
456 /* Pause the clock */
457 pcm_output_play_pause(false);
459 /* Pause each active stream */
460 actl_stream_broadcast(STREAM_PAUSE
, 0);
462 /* Pause the disk buffer - buffer may continue filling */
463 disk_buf_send_msg(STREAM_PAUSE
, false);
465 /* Unboost the CPU */
468 /* Offically paused */
469 stream_mgr
.status
= STREAM_PAUSED
;
475 /* Handle STREAM_RESUME */
476 static void stream_on_resume(void)
478 int status
= stream_mgr
.status
;
482 /* Reply with previous state */
483 stream_mgr_reply_msg(status
);
485 if (status
== STREAM_PAUSED
)
490 /* Sync and start - no force buffering */
491 stream_start_playback(str_parser
.last_seek_time
, false);
493 /* Officially playing */
494 stream_mgr
.status
= STREAM_PLAYING
;
500 /* Handle STREAM_STOP */
501 static void stream_on_stop(bool reply
)
503 int status
= stream_mgr
.status
;
508 stream_mgr_reply_msg(status
);
510 if (status
!= STREAM_STOPPED
)
512 /* Pause the clock */
513 pcm_output_play_pause(false);
515 /* Update the resume time info */
516 stream_remember_resume_time();
518 /* Not stopped = paused or playing */
519 stream_mgr
.seeked
= false;
522 disk_buf_send_msg(STREAM_STOP
, 0);
524 /* Clear any still-active streams and remove from actl */
525 actl_stream_broadcast(STREAM_STOP
, 1);
527 /* Stop PCM output (and clock) */
530 /* Cancel our processor boost */
533 stream_mgr
.status
= STREAM_STOPPED
;
539 /* Handle STREAM_SEEK */
540 static void stream_on_seek(struct stream_seek_data
*skd
)
542 uint32_t time
= skd
->time
;
543 int whence
= skd
->whence
;
550 if (stream_mgr
.filename
== NULL
)
553 /* Keep things spinning if already doing so */
554 stream_keep_disk_active();
556 /* Have data - reply in order to acquire lock */
557 stream_mgr_reply_msg(STREAM_OK
);
561 /* Either seeking must be possible or a full rewind must be done */
562 if (stream_can_seek() || time_from_whence(time
, whence
) == 0)
566 if (stream_mgr
.status
== STREAM_PLAYING
)
568 /* Keep clock from advancing while seeking */
569 pcm_output_play_pause(false);
572 time
= stream_seek_intl(time
, whence
, stream_mgr
.status
, &buffer
);
573 stream_remember_resume_time();
575 if (stream_mgr
.status
== STREAM_PLAYING
)
577 /* Sync and restart - no force buffering */
578 stream_start_playback(time
, buffer
);
586 /* Invalid parameter or no file */
587 stream_mgr_reply_msg(STREAM_ERROR
);
590 /* Handle STREAM_CLOSE */
591 static int stream_on_close(void)
593 int status
= STREAM_STOPPED
;
597 /* Any open file that was accepted for playback? */
598 if (stream_mgr
.filename
!= NULL
)
600 /* Yes - hide video */
601 stream_show_vo(false);
602 /* Stop any playback */
603 status
= stream_mgr
.status
;
604 stream_on_stop(false);
605 /* Tell parser file is finished */
606 parser_close_stream();
607 /* Reinitialize manager */
608 stream_mgr_init_state();
611 /* Let disk buffer reset itself - file might be open even if no good */
619 /* Handle STREAM_EV_COMPLETE */
620 static void stream_on_ev_complete(struct stream
*str
)
624 /* Stream is active? */
625 if (actl_stream_remove(str
))
627 /* No - remove this stream from the active list */
628 DEBUGF(" finished: 0x%02x\n", str
->id
);
629 if (list_is_empty(stream_mgr
.actl
))
631 /* All streams have acked - stop playback */
632 stream_on_stop(false);
633 stream_mgr
.resume_time
= 0; /* Played to end - no resume */
637 /* Stream is done - stop it and place back in pool */
638 str_send_msg(str
, STREAM_STOP
, 1);
645 /* Callback for stream to notify about events internal to them */
646 void stream_generate_event(struct stream
*str
, long id
, intptr_t data
)
653 case STREAM_EV_COMPLETE
:
654 /* The last stream has ended */
655 stream_mgr_post_msg(STREAM_EV_COMPLETE
, (intptr_t)str
);
662 /* Clear any particular notification for which a stream registered */
663 void stream_clear_notify(struct stream
*str
, int for_msg
)
667 case DISK_BUF_DATA_NOTIFY
:
668 disk_buf_send_msg(DISK_BUF_CLEAR_DATA_NOTIFY
, (intptr_t)str
);
673 /* Special handling for certain messages since they involve multiple
674 * operations behind the scenes */
675 static intptr_t send_video_msg(long id
, intptr_t data
)
679 if (video_str
.thread
!= 0 && disk_buf
.in_file
>= 0)
684 case VIDEO_DISPLAY_SHOW
:
685 if (data
!= 0 && disk_buf_status() == STREAM_STOPPED
)
686 { /* Only prepare image if showing and not playing */
687 parser_prepare_image(str_parser
.last_seek_time
);
691 case VIDEO_PRINT_FRAME
:
694 case VIDEO_PRINT_THUMBNAIL
:
695 if (disk_buf_status() != STREAM_STOPPED
)
696 break; /* Prepare image if not playing */
698 /* Ignore return and try video thread anyway */
699 parser_prepare_image(str_parser
.last_seek_time
);
701 /* Image ready - pass message to video thread */
705 retval
= str_send_msg(&video_str
, id
, data
);
711 /* Show/hide the video output */
712 bool stream_show_vo(bool show
)
717 vis
= send_video_msg(VIDEO_DISPLAY_SHOW
, show
);
718 #ifndef HAVE_LCD_COLOR
726 /* Query the visibility of video output */
727 bool stream_vo_is_visible(void)
731 vis
= send_video_msg(VIDEO_DISPLAY_IS_VISIBLE
, 0);
736 /* Return the video dimensions */
737 bool stream_vo_get_size(struct vo_ext
*sz
)
743 if (str_parser
.dims
.w
> 0 && str_parser
.dims
.h
> 0)
745 *sz
= str_parser
.dims
;
754 void stream_vo_set_clip(const struct vo_rect
*rc
)
760 stream_mgr
.parms
.rc
= *rc
;
761 rc
= &stream_mgr
.parms
.rc
;
764 send_video_msg(VIDEO_SET_CLIP_RECT
, (intptr_t)rc
);
769 bool stream_vo_get_clip(struct vo_rect
*rc
)
778 retval
= send_video_msg(VIDEO_GET_CLIP_RECT
,
779 (intptr_t)&stream_mgr
.parms
.rc
);
781 *rc
= stream_mgr
.parms
.rc
;
788 #ifndef HAVE_LCD_COLOR
789 /* Show/hide the gray video overlay (independently of vo visibility). */
790 void stream_gray_show(bool show
)
799 #endif /* !HAVE_LCD_COLOR */
801 /* Display a thumbnail at the last seek point */
802 bool stream_display_thumb(const struct vo_rect
*rc
)
811 stream_mgr
.parms
.rc
= *rc
;
812 retval
= send_video_msg(VIDEO_PRINT_THUMBNAIL
,
813 (intptr_t)&stream_mgr
.parms
.rc
);
820 bool stream_draw_frame(bool no_prepare
)
825 retval
= send_video_msg(VIDEO_PRINT_FRAME
, no_prepare
);
832 bool stream_set_callback(long id
, void *fn
)
840 case VIDEO_SET_POST_FRAME_CALLBACK
:
841 retval
= send_video_msg(id
, (intptr_t)fn
);
849 /* Return the time playback should resume if interrupted */
850 uint32_t stream_get_resume_time(void)
852 uint32_t resume_time
;
854 /* A stop request is async and replies before setting this - must lock */
857 resume_time
= stream_mgr
.resume_time
;
864 uint32_t stream_get_seek_time(uint32_t *start
)
870 if (stream_mgr
.seeked
)
872 time
= str_parser
.last_seek_time
;
876 time
= TICKS_TO_TS(pcm_output_get_clock());
878 /* Clock can be start early so keep in range */
879 if (time
< str_parser
.start_pts
)
880 time
= str_parser
.start_pts
;
884 *start
= str_parser
.start_pts
;
891 /* Wait for a state transistion to complete */
892 void stream_wait_status(void)
898 /* Returns the smallest file window that includes all active streams'
900 static bool stream_get_window_callback(struct stream
*str
,
901 struct stream_window
*sw
)
903 off_t swl
= str
->hdr
.win_left
;
904 off_t swr
= str
->hdr
.win_right
;
915 bool stream_get_window(struct stream_window
*sw
)
921 sw
->right
= LONG_MIN
;
924 list_enum_items(stream_mgr
.actl
,
925 (list_enum_callback_t
)stream_get_window_callback
,
929 return sw
->left
<= sw
->right
;
932 /* Playback control thread */
933 static void stream_mgr_thread(void)
935 struct queue_event ev
;
939 rb
->queue_wait(stream_mgr
.q
, &ev
);
944 stream_on_open((const char *)ev
.data
);
963 stream_on_stop(true);
967 stream_on_seek((struct stream_seek_data
*)ev
.data
);
970 case STREAM_EV_COMPLETE
:
971 stream_on_ev_complete((struct stream
*)ev
.data
);
975 if (stream_mgr
.status
!= STREAM_STOPPED
)
976 stream_on_stop(false);
982 /* Stream command interface APIs */
984 /* Opens a new file */
985 int stream_open(const char *filename
)
987 if (stream_mgr
.thread
!= 0)
988 return stream_mgr_send_msg(STREAM_OPEN
, (intptr_t)filename
);
992 /* Plays the current file starting at time 'start' */
993 int stream_play(void)
995 if (stream_mgr
.thread
!= 0)
996 return stream_mgr_send_msg(STREAM_PLAY
, 0);
1000 /* Pauses playback if playing */
1001 int stream_pause(void)
1003 if (stream_mgr
.thread
!= 0)
1004 return stream_mgr_send_msg(STREAM_PAUSE
, false);
1005 return STREAM_ERROR
;
1008 /* Resumes playback if paused */
1009 int stream_resume(void)
1011 if (stream_mgr
.thread
!= 0)
1012 return stream_mgr_send_msg(STREAM_PAUSE
, true);
1013 return STREAM_ERROR
;
1016 /* Stops playback if not stopped */
1017 int stream_stop(void)
1019 if (stream_mgr
.thread
!= 0)
1020 return stream_mgr_send_msg(STREAM_STOP
, 0);
1021 return STREAM_ERROR
;
1024 /* Seeks playback time to/by the specified time */
1025 int stream_seek(uint32_t time
, int whence
)
1029 if (stream_mgr
.thread
== 0)
1030 return STREAM_ERROR
;
1034 stream_mgr
.parms
.skd
.time
= time
;
1035 stream_mgr
.parms
.skd
.whence
= whence
;
1037 ret
= stream_mgr_send_msg(STREAM_SEEK
, (intptr_t)&stream_mgr
.parms
.skd
);
1039 stream_mgr_unlock();
1044 /* Closes the current file */
1045 int stream_close(void)
1047 if (stream_mgr
.thread
!= 0)
1048 return stream_mgr_send_msg(STREAM_CLOSE
, 0);
1049 return STREAM_ERROR
;
1052 /* Initializes the playback engine */
1053 int stream_init(void)
1058 stream_mgr
.status
= STREAM_STOPPED
;
1059 stream_mgr_init_state();
1061 /* Initialize our window to the outside world first */
1062 rb
->mutex_init(&stream_mgr
.str_mtx
);
1063 rb
->mutex_init(&stream_mgr
.actl_mtx
);
1065 stream_mgr
.q
= &stream_mgr_queue
;
1066 rb
->queue_init(stream_mgr
.q
, false);
1068 /* sets audiosize and returns buffer pointer */
1069 mem
= rb
->plugin_get_audio_buffer(&memsize
);
1071 /* Initialize non-allocator blocks first */
1072 #ifndef HAVE_LCD_COLOR
1075 /* Greylib init handles all necessary cache alignment */
1076 if (!grey_init(mem
, memsize
, GREY_BUFFERED
|GREY_ON_COP
,
1077 LCD_WIDTH
, LCD_HEIGHT
, &greysize
))
1079 rb
->splash(HZ
, "greylib init failed!");
1080 return STREAM_ERROR
;
1084 memsize
-= greysize
;
1086 grey_clear_display();
1087 #endif /* !HAVE_LCD_COLOR */
1089 stream_mgr
.thread
= rb
->create_thread(stream_mgr_thread
,
1090 stream_mgr_thread_stack
, sizeof(stream_mgr_thread_stack
),
1091 0, "mpgstream_mgr" IF_PRIO(, PRIORITY_SYSTEM
) IF_COP(, CPU
));
1093 rb
->queue_enable_queue_send(stream_mgr
.q
, &stream_mgr_queue_send
,
1096 if (stream_mgr
.thread
== 0)
1098 rb
->splash(HZ
, "Could not create stream manager thread!");
1099 return STREAM_ERROR
;
1102 /* Wait for thread to initialize */
1103 stream_mgr_send_msg(STREAM_NULL
, 0);
1105 /* Initialise our malloc buffer */
1106 if (!mpeg_alloc_init(mem
, memsize
))
1108 rb
->splash(HZ
, "Out of memory in stream_init");
1110 /* These inits use the allocator */
1111 else if (!pcm_output_init())
1113 rb
->splash(HZ
, "Could not initialize PCM!");
1115 else if (!audio_thread_init())
1117 rb
->splash(HZ
, "Cannot create audio thread!");
1119 else if (!video_thread_init())
1121 rb
->splash(HZ
, "Cannot create video thread!");
1123 /* Disk buffer takes max allotment of what's left so it must be last */
1124 else if (!disk_buf_init())
1126 rb
->splash(HZ
, "Cannot create buffering thread!");
1128 else if (!parser_init())
1130 rb
->splash(HZ
, "Parser init failed!");
1137 return STREAM_ERROR
;
1140 /* Cleans everything up */
1141 void stream_exit(void)
1145 /* Stop the threads and wait for them to terminate */
1146 video_thread_exit();
1147 audio_thread_exit();
1151 if (stream_mgr
.thread
!= 0)
1153 stream_mgr_post_msg(STREAM_QUIT
, 0);
1154 rb
->thread_wait(stream_mgr
.thread
);
1155 stream_mgr
.thread
= 0;
1158 #ifndef HAVE_LCD_COLOR