summaryrefslogtreecommitdiff
path: root/apps/plugins/mpegplayer
diff options
context:
space:
mode:
authorMichael Sevakis <jethead71@rockbox.org>2008-12-10 08:57:10 +0000
committerMichael Sevakis <jethead71@rockbox.org>2008-12-10 08:57:10 +0000
commit8cfbd3604fac14f629244e521ad24ffa9938c790 (patch)
tree16dc096519b8b537bb7d4b73e0c97f5f33ee752b /apps/plugins/mpegplayer
parent40ff47c7eea41ac893d7af5c5b97ace52a5ffade (diff)
downloadrockbox-8cfbd3604fac14f629244e521ad24ffa9938c790.zip
rockbox-8cfbd3604fac14f629244e521ad24ffa9938c790.tar.gz
rockbox-8cfbd3604fac14f629244e521ad24ffa9938c790.tar.bz2
rockbox-8cfbd3604fac14f629244e521ad24ffa9938c790.tar.xz
Use cookies for thread identification instead of pointers directly which gives a buffer against wrongly identifying a thread when the slot is recycled (which has been nagging me for awhile). A slot gets 255 uses before it repeats. Everything gets incompatible so a full update is required.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19377 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins/mpegplayer')
-rw-r--r--apps/plugins/mpegplayer/audio_thread.c6
-rw-r--r--apps/plugins/mpegplayer/disk_buf.c8
-rw-r--r--apps/plugins/mpegplayer/disk_buf.h2
-rw-r--r--apps/plugins/mpegplayer/mpeg_parser.c2
-rw-r--r--apps/plugins/mpegplayer/stream_mgr.c20
-rw-r--r--apps/plugins/mpegplayer/stream_mgr.h2
-rw-r--r--apps/plugins/mpegplayer/stream_thread.h2
-rw-r--r--apps/plugins/mpegplayer/video_thread.c6
8 files changed, 24 insertions, 24 deletions
diff --git a/apps/plugins/mpegplayer/audio_thread.c b/apps/plugins/mpegplayer/audio_thread.c
index 4522657..2fb46ef 100644
--- a/apps/plugins/mpegplayer/audio_thread.c
+++ b/apps/plugins/mpegplayer/audio_thread.c
@@ -732,7 +732,7 @@ bool audio_thread_init(void)
rb->queue_enable_queue_send(audio_str.hdr.q, &audio_str_queue_send,
audio_str.thread);
- if (audio_str.thread == NULL)
+ if (audio_str.thread == 0)
return false;
/* Wait for thread to initialize */
@@ -744,11 +744,11 @@ bool audio_thread_init(void)
/* Stops the audio thread */
void audio_thread_exit(void)
{
- if (audio_str.thread != NULL)
+ if (audio_str.thread != 0)
{
str_post_msg(&audio_str, STREAM_QUIT, 0);
rb->thread_wait(audio_str.thread);
- audio_str.thread = NULL;
+ audio_str.thread = 0;
}
#ifndef SIMULATOR
diff --git a/apps/plugins/mpegplayer/disk_buf.c b/apps/plugins/mpegplayer/disk_buf.c
index df5e005..c008139 100644
--- a/apps/plugins/mpegplayer/disk_buf.c
+++ b/apps/plugins/mpegplayer/disk_buf.c
@@ -835,7 +835,7 @@ void disk_buf_reply_msg(intptr_t retval)
bool disk_buf_init(void)
{
- disk_buf.thread = NULL;
+ disk_buf.thread = 0;
list_initialize(&nf_list);
rb->mutex_init(&disk_buf_mtx);
@@ -893,7 +893,7 @@ bool disk_buf_init(void)
rb->queue_enable_queue_send(disk_buf.q, &disk_buf_queue_send,
disk_buf.thread);
- if (disk_buf.thread == NULL)
+ if (disk_buf.thread == 0)
return false;
/* Wait for thread to initialize */
@@ -904,10 +904,10 @@ bool disk_buf_init(void)
void disk_buf_exit(void)
{
- if (disk_buf.thread != NULL)
+ if (disk_buf.thread != 0)
{
rb->queue_post(disk_buf.q, STREAM_QUIT, 0);
rb->thread_wait(disk_buf.thread);
- disk_buf.thread = NULL;
+ disk_buf.thread = 0;
}
}
diff --git a/apps/plugins/mpegplayer/disk_buf.h b/apps/plugins/mpegplayer/disk_buf.h
index b6399c8..e16939a 100644
--- a/apps/plugins/mpegplayer/disk_buf.h
+++ b/apps/plugins/mpegplayer/disk_buf.h
@@ -62,7 +62,7 @@ struct dbuf_range
* playback events as well as buffering */
struct disk_buf
{
- struct thread_entry *thread;
+ unsigned int thread;
struct event_queue *q;
uint8_t *start; /* Start pointer */
uint8_t *end; /* End of buffer pointer less MPEG_GUARDBUF_SIZE. The
diff --git a/apps/plugins/mpegplayer/mpeg_parser.c b/apps/plugins/mpegplayer/mpeg_parser.c
index 54a6f23..42c388b 100644
--- a/apps/plugins/mpegplayer/mpeg_parser.c
+++ b/apps/plugins/mpegplayer/mpeg_parser.c
@@ -1027,7 +1027,7 @@ intptr_t parser_send_video_msg(long id, intptr_t data)
{
intptr_t retval = 0;
- if (video_str.thread != NULL && disk_buf.in_file >= 0)
+ if (video_str.thread != 0 && disk_buf.in_file >= 0)
{
/* Hook certain messages since they involve multiple operations
* behind the scenes */
diff --git a/apps/plugins/mpegplayer/stream_mgr.c b/apps/plugins/mpegplayer/stream_mgr.c
index 424d2fe..222ffb7 100644
--- a/apps/plugins/mpegplayer/stream_mgr.c
+++ b/apps/plugins/mpegplayer/stream_mgr.c
@@ -908,7 +908,7 @@ static void stream_mgr_thread(void)
/* Opens a new file */
int stream_open(const char *filename)
{
- if (stream_mgr.thread != NULL)
+ if (stream_mgr.thread != 0)
return stream_mgr_send_msg(STREAM_OPEN, (intptr_t)filename);
return STREAM_ERROR;
}
@@ -916,7 +916,7 @@ int stream_open(const char *filename)
/* Plays the current file starting at time 'start' */
int stream_play(void)
{
- if (stream_mgr.thread != NULL)
+ if (stream_mgr.thread != 0)
return stream_mgr_send_msg(STREAM_PLAY, 0);
return STREAM_ERROR;
}
@@ -924,7 +924,7 @@ int stream_play(void)
/* Pauses playback if playing */
int stream_pause(void)
{
- if (stream_mgr.thread != NULL)
+ if (stream_mgr.thread != 0)
return stream_mgr_send_msg(STREAM_PAUSE, false);
return STREAM_ERROR;
}
@@ -932,7 +932,7 @@ int stream_pause(void)
/* Resumes playback if paused */
int stream_resume(void)
{
- if (stream_mgr.thread != NULL)
+ if (stream_mgr.thread != 0)
return stream_mgr_send_msg(STREAM_PAUSE, true);
return STREAM_ERROR;
}
@@ -940,7 +940,7 @@ int stream_resume(void)
/* Stops playback if not stopped */
int stream_stop(void)
{
- if (stream_mgr.thread != NULL)
+ if (stream_mgr.thread != 0)
return stream_mgr_send_msg(STREAM_STOP, 0);
return STREAM_ERROR;
}
@@ -950,7 +950,7 @@ int stream_seek(uint32_t time, int whence)
{
int ret;
- if (stream_mgr.thread == NULL)
+ if (stream_mgr.thread == 0)
return STREAM_ERROR;
stream_mgr_lock();
@@ -968,7 +968,7 @@ int stream_seek(uint32_t time, int whence)
/* Closes the current file */
int stream_close(void)
{
- if (stream_mgr.thread != NULL)
+ if (stream_mgr.thread != 0)
return stream_mgr_send_msg(STREAM_CLOSE, 0);
return STREAM_ERROR;
}
@@ -1018,7 +1018,7 @@ int stream_init(void)
rb->queue_enable_queue_send(stream_mgr.q, &stream_mgr_queue_send,
stream_mgr.thread);
- if (stream_mgr.thread == NULL)
+ if (stream_mgr.thread == 0)
{
rb->splash(HZ, "Could not create stream manager thread!");
return STREAM_ERROR;
@@ -1073,11 +1073,11 @@ void stream_exit(void)
disk_buf_exit();
pcm_output_exit();
- if (stream_mgr.thread != NULL)
+ if (stream_mgr.thread != 0)
{
stream_mgr_post_msg(STREAM_QUIT, 0);
rb->thread_wait(stream_mgr.thread);
- stream_mgr.thread = NULL;
+ stream_mgr.thread = 0;
}
#ifndef HAVE_LCD_COLOR
diff --git a/apps/plugins/mpegplayer/stream_mgr.h b/apps/plugins/mpegplayer/stream_mgr.h
index e3ea920..a00b39f 100644
--- a/apps/plugins/mpegplayer/stream_mgr.h
+++ b/apps/plugins/mpegplayer/stream_mgr.h
@@ -27,7 +27,7 @@
* coordination with assistance from the parser */
struct stream_mgr
{
- struct thread_entry *thread; /* Playback control thread */
+ unsigned int thread; /* Playback control thread */
struct event_queue *q; /* event queue for control thread */
const char *filename; /* Current filename */
uint32_t resume_time; /* The stream tick where playback was
diff --git a/apps/plugins/mpegplayer/stream_thread.h b/apps/plugins/mpegplayer/stream_thread.h
index d6e42d2..30bf46e 100644
--- a/apps/plugins/mpegplayer/stream_thread.h
+++ b/apps/plugins/mpegplayer/stream_thread.h
@@ -45,7 +45,7 @@ struct stream_hdr
struct stream
{
struct stream_hdr hdr; /* Base stream data */
- struct thread_entry *thread; /* Stream's thread */
+ unsigned int thread; /* Stream's thread */
uint8_t* curr_packet; /* Current stream packet beginning */
uint8_t* curr_packet_end; /* Current stream packet end */
struct list_item l; /* List of streams - either reserve pool
diff --git a/apps/plugins/mpegplayer/video_thread.c b/apps/plugins/mpegplayer/video_thread.c
index 100904b..8b84686 100644
--- a/apps/plugins/mpegplayer/video_thread.c
+++ b/apps/plugins/mpegplayer/video_thread.c
@@ -1009,7 +1009,7 @@ bool video_thread_init(void)
rb->queue_enable_queue_send(video_str.hdr.q, &video_str_queue_send,
video_str.thread);
- if (video_str.thread == NULL)
+ if (video_str.thread == 0)
return false;
/* Wait for thread to initialize */
@@ -1022,11 +1022,11 @@ bool video_thread_init(void)
/* Terminates the video thread */
void video_thread_exit(void)
{
- if (video_str.thread != NULL)
+ if (video_str.thread != 0)
{
str_post_msg(&video_str, STREAM_QUIT, 0);
rb->thread_wait(video_str.thread);
IF_COP(invalidate_icache());
- video_str.thread = NULL;
+ video_str.thread = 0;
}
}