提交 6e0a693d 编写于 作者: Z Zhang Rui

jni: ijkplayer: introduce SDL_CreateThreadEx

上级 4a1aff85
......@@ -115,7 +115,9 @@ enum {
typedef struct VideoState {
SDL_Thread *read_tid;
SDL_Thread _read_tid;
SDL_Thread *video_tid;
SDL_Thread _video_tid;
AVInputFormat *iformat;
int no_background;
int abort_request;
......@@ -180,6 +182,7 @@ typedef struct VideoState {
double last_vis_time;
SDL_Thread *subtitle_tid;
SDL_Thread _subtitle_tid;
int subtitle_stream;
int subtitle_stream_changed;
AVStream *subtitle_st;
......
......@@ -591,14 +591,14 @@ static int stream_component_open(FFPlayer *ffp, int stream_index)
is->video_st = ic->streams[stream_index];
packet_queue_start(&is->videoq);
is->video_tid = SDL_CreateThread(ijkff_video_thread, ffp);
is->video_tid = SDL_CreateThreadEx(&is->_video_tid, ijkff_video_thread, ffp);
break;
case AVMEDIA_TYPE_SUBTITLE:
is->subtitle_stream = stream_index;
is->subtitle_st = ic->streams[stream_index];
packet_queue_start(&is->subtitleq);
is->subtitle_tid = SDL_CreateThread(ijkff_subtitle_thread, ffp);
is->subtitle_tid = SDL_CreateThreadEx(&is->_subtitle_tid, ijkff_subtitle_thread, ffp);
break;
default:
break;
......
......@@ -32,20 +32,13 @@ static void *SDL_RunThread(void *data)
return NULL;
}
SDL_Thread *SDL_CreateThread(int (*fn)(void *), void *data)
{
// FIXME: imeplement
return NULL;
}
SDL_Thread *SDL_CreateThreadEx(SDL_Thread *thread, int (*fn)(void *), void *data)
{
thread->func = fn;
thread->data = data;
thread->retval = 0;
if (pthread_create(&thread->id, NULL, SDL_RunThread, thread) != 0) {
int retval = pthread_create(&thread->id, NULL, SDL_RunThread, data);
if (retval)
return NULL;
}
return thread;
}
......
......@@ -35,7 +35,6 @@ typedef struct SDL_Thread
int retval;
} SDL_Thread;
SDL_Thread *SDL_CreateThread(int (*fn)(void *), void *data);
SDL_Thread *SDL_CreateThreadEx(SDL_Thread *thread, int (*fn)(void *), void *data);
void SDL_WaitThread(SDL_Thread *thread, int *status);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册