diff options
author | Michael Sevakis <jethead71@rockbox.org> | 2008-12-10 08:57:10 +0000 |
---|---|---|
committer | Michael Sevakis <jethead71@rockbox.org> | 2008-12-10 08:57:10 +0000 |
commit | 8cfbd3604fac14f629244e521ad24ffa9938c790 (patch) | |
tree | 16dc096519b8b537bb7d4b73e0c97f5f33ee752b /apps/plugins/mpegplayer/stream_mgr.c | |
parent | 40ff47c7eea41ac893d7af5c5b97ace52a5ffade (diff) | |
download | rockbox-8cfbd3604fac14f629244e521ad24ffa9938c790.tar.gz rockbox-8cfbd3604fac14f629244e521ad24ffa9938c790.zip |
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/stream_mgr.c')
-rw-r--r-- | apps/plugins/mpegplayer/stream_mgr.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/apps/plugins/mpegplayer/stream_mgr.c b/apps/plugins/mpegplayer/stream_mgr.c index 424d2fe503..222ffb7d6b 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) | |||
908 | /* Opens a new file */ | 908 | /* Opens a new file */ |
909 | int stream_open(const char *filename) | 909 | int stream_open(const char *filename) |
910 | { | 910 | { |
911 | if (stream_mgr.thread != NULL) | 911 | if (stream_mgr.thread != 0) |
912 | return stream_mgr_send_msg(STREAM_OPEN, (intptr_t)filename); | 912 | return stream_mgr_send_msg(STREAM_OPEN, (intptr_t)filename); |
913 | return STREAM_ERROR; | 913 | return STREAM_ERROR; |
914 | } | 914 | } |
@@ -916,7 +916,7 @@ int stream_open(const char *filename) | |||
916 | /* Plays the current file starting at time 'start' */ | 916 | /* Plays the current file starting at time 'start' */ |
917 | int stream_play(void) | 917 | int stream_play(void) |
918 | { | 918 | { |
919 | if (stream_mgr.thread != NULL) | 919 | if (stream_mgr.thread != 0) |
920 | return stream_mgr_send_msg(STREAM_PLAY, 0); | 920 | return stream_mgr_send_msg(STREAM_PLAY, 0); |
921 | return STREAM_ERROR; | 921 | return STREAM_ERROR; |
922 | } | 922 | } |
@@ -924,7 +924,7 @@ int stream_play(void) | |||
924 | /* Pauses playback if playing */ | 924 | /* Pauses playback if playing */ |
925 | int stream_pause(void) | 925 | int stream_pause(void) |
926 | { | 926 | { |
927 | if (stream_mgr.thread != NULL) | 927 | if (stream_mgr.thread != 0) |
928 | return stream_mgr_send_msg(STREAM_PAUSE, false); | 928 | return stream_mgr_send_msg(STREAM_PAUSE, false); |
929 | return STREAM_ERROR; | 929 | return STREAM_ERROR; |
930 | } | 930 | } |
@@ -932,7 +932,7 @@ int stream_pause(void) | |||
932 | /* Resumes playback if paused */ | 932 | /* Resumes playback if paused */ |
933 | int stream_resume(void) | 933 | int stream_resume(void) |
934 | { | 934 | { |
935 | if (stream_mgr.thread != NULL) | 935 | if (stream_mgr.thread != 0) |
936 | return stream_mgr_send_msg(STREAM_PAUSE, true); | 936 | return stream_mgr_send_msg(STREAM_PAUSE, true); |
937 | return STREAM_ERROR; | 937 | return STREAM_ERROR; |
938 | } | 938 | } |
@@ -940,7 +940,7 @@ int stream_resume(void) | |||
940 | /* Stops playback if not stopped */ | 940 | /* Stops playback if not stopped */ |
941 | int stream_stop(void) | 941 | int stream_stop(void) |
942 | { | 942 | { |
943 | if (stream_mgr.thread != NULL) | 943 | if (stream_mgr.thread != 0) |
944 | return stream_mgr_send_msg(STREAM_STOP, 0); | 944 | return stream_mgr_send_msg(STREAM_STOP, 0); |
945 | return STREAM_ERROR; | 945 | return STREAM_ERROR; |
946 | } | 946 | } |
@@ -950,7 +950,7 @@ int stream_seek(uint32_t time, int whence) | |||
950 | { | 950 | { |
951 | int ret; | 951 | int ret; |
952 | 952 | ||
953 | if (stream_mgr.thread == NULL) | 953 | if (stream_mgr.thread == 0) |
954 | return STREAM_ERROR; | 954 | return STREAM_ERROR; |
955 | 955 | ||
956 | stream_mgr_lock(); | 956 | stream_mgr_lock(); |
@@ -968,7 +968,7 @@ int stream_seek(uint32_t time, int whence) | |||
968 | /* Closes the current file */ | 968 | /* Closes the current file */ |
969 | int stream_close(void) | 969 | int stream_close(void) |
970 | { | 970 | { |
971 | if (stream_mgr.thread != NULL) | 971 | if (stream_mgr.thread != 0) |
972 | return stream_mgr_send_msg(STREAM_CLOSE, 0); | 972 | return stream_mgr_send_msg(STREAM_CLOSE, 0); |
973 | return STREAM_ERROR; | 973 | return STREAM_ERROR; |
974 | } | 974 | } |
@@ -1018,7 +1018,7 @@ int stream_init(void) | |||
1018 | rb->queue_enable_queue_send(stream_mgr.q, &stream_mgr_queue_send, | 1018 | rb->queue_enable_queue_send(stream_mgr.q, &stream_mgr_queue_send, |
1019 | stream_mgr.thread); | 1019 | stream_mgr.thread); |
1020 | 1020 | ||
1021 | if (stream_mgr.thread == NULL) | 1021 | if (stream_mgr.thread == 0) |
1022 | { | 1022 | { |
1023 | rb->splash(HZ, "Could not create stream manager thread!"); | 1023 | rb->splash(HZ, "Could not create stream manager thread!"); |
1024 | return STREAM_ERROR; | 1024 | return STREAM_ERROR; |
@@ -1073,11 +1073,11 @@ void stream_exit(void) | |||
1073 | disk_buf_exit(); | 1073 | disk_buf_exit(); |
1074 | pcm_output_exit(); | 1074 | pcm_output_exit(); |
1075 | 1075 | ||
1076 | if (stream_mgr.thread != NULL) | 1076 | if (stream_mgr.thread != 0) |
1077 | { | 1077 | { |
1078 | stream_mgr_post_msg(STREAM_QUIT, 0); | 1078 | stream_mgr_post_msg(STREAM_QUIT, 0); |
1079 | rb->thread_wait(stream_mgr.thread); | 1079 | rb->thread_wait(stream_mgr.thread); |
1080 | stream_mgr.thread = NULL; | 1080 | stream_mgr.thread = 0; |
1081 | } | 1081 | } |
1082 | 1082 | ||
1083 | #ifndef HAVE_LCD_COLOR | 1083 | #ifndef HAVE_LCD_COLOR |