Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
qq_25606643
ijkplayer
提交
45a8c771
I
ijkplayer
项目概览
qq_25606643
/
ijkplayer
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
I
ijkplayer
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
45a8c771
编写于
6月 07, 2013
作者:
Z
Zhang Rui
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
jni: ijksdl: introduce SDL_Audio
上级
493ab986
变更
12
隐藏空白更改
内联
并排
Showing
12 changed file
with
610 addition
and
291 deletion
+610
-291
ijkmediaplayer/jni/ijksdl/Android.mk
ijkmediaplayer/jni/ijksdl/Android.mk
+1
-0
ijkmediaplayer/jni/ijksdl/ijksdl.h
ijkmediaplayer/jni/ijksdl/ijksdl.h
+5
-140
ijkmediaplayer/jni/ijksdl/ijksdl_audio.h
ijkmediaplayer/jni/ijksdl/ijksdl_audio.h
+77
-0
ijkmediaplayer/jni/ijksdl/ijksdl_endian.h
ijkmediaplayer/jni/ijksdl/ijksdl_endian.h
+47
-0
ijkmediaplayer/jni/ijksdl/ijksdl_event.h
ijkmediaplayer/jni/ijksdl/ijksdl_event.h
+165
-0
ijkmediaplayer/jni/ijksdl/ijksdl_mutex.c
ijkmediaplayer/jni/ijksdl/ijksdl_mutex.c
+152
-0
ijkmediaplayer/jni/ijksdl/ijksdl_mutex.h
ijkmediaplayer/jni/ijksdl/ijksdl_mutex.h
+54
-0
ijkmediaplayer/jni/ijksdl/ijksdl_overlay.h
ijkmediaplayer/jni/ijksdl/ijksdl_overlay.h
+38
-0
ijkmediaplayer/jni/ijksdl/ijksdl_rect.h
ijkmediaplayer/jni/ijksdl/ijksdl_rect.h
+33
-0
ijkmediaplayer/jni/ijksdl/ijksdl_stdinc.h
ijkmediaplayer/jni/ijksdl/ijksdl_stdinc.h
+38
-0
ijkmediaplayer/jni/ijksdl/ijksdl_thread.c
ijkmediaplayer/jni/ijksdl/ijksdl_thread.c
+0
-126
ijkmediaplayer/jni/ijksdl/ijksdl_thread.h
ijkmediaplayer/jni/ijksdl/ijksdl_thread.h
+0
-25
未找到文件。
ijkmediaplayer/jni/ijksdl/Android.mk
浏览文件 @
45a8c771
...
...
@@ -21,6 +21,7 @@ LOCAL_PATH := $(call my-dir)
include
$(CLEAR_VARS)
LOCAL_C_CFLAGS
+=
-std
=
c99
LOCAL_SRC_FILES
+=
ijksdl_mutex.c
LOCAL_SRC_FILES
+=
ijksdl_thread.c
LOCAL_MODULE
:=
ijksdl
...
...
ijkmediaplayer/jni/ijksdl/ijksdl.h
浏览文件 @
45a8c771
...
...
@@ -25,148 +25,13 @@
#ifndef IJKSDL__IJKSDL_H
#define IJKSDL__IJKSDL_H
#include "ijksdl_mutex.h"
#include "ijksdl_thread.h"
#include "ijksdl_event.h"
typedef
struct
SDL_Overlay
{
}
SDL_Overlay
;
#include "ijksdl_rect.h"
#include "ijksdl_overlay.h"
typedef
struct
SDL_Rect
{
}
SDL_Rect
;
typedef
enum
{
SDL_FIRSTEVENT
=
0
,
/**< Unused (do not remove) */
/* Application events */
SDL_QUIT
=
0x100
,
/**< User-requested quit */
/* These application events have special meaning on iOS, see README.iOS for details */
SDL_APP_TERMINATING
,
/**< The application is being terminated by the OS
Called on iOS in applicationWillTerminate()
Called on Android in onDestroy()
*/
SDL_APP_LOWMEMORY
,
/**< The application is low on memory, free memory if possible.
Called on iOS in applicationDidReceiveMemoryWarning()
Called on Android in onLowMemory()
*/
SDL_APP_WILLENTERBACKGROUND
,
/**< The application is about to enter the background
Called on iOS in applicationWillResignActive()
Called on Android in onPause()
*/
SDL_APP_DIDENTERBACKGROUND
,
/**< The application did enter the background and may not get CPU for some time
Called on iOS in applicationDidEnterBackground()
Called on Android in onPause()
*/
SDL_APP_WILLENTERFOREGROUND
,
/**< The application is about to enter the foreground
Called on iOS in applicationWillEnterForeground()
Called on Android in onResume()
*/
SDL_APP_DIDENTERFOREGROUND
,
/**< The application is now interactive
Called on iOS in applicationDidBecomeActive()
Called on Android in onResume()
*/
/* Window events */
SDL_WINDOWEVENT
=
0x200
,
/**< Window state change */
SDL_SYSWMEVENT
,
/**< System specific event */
/* Keyboard events */
SDL_KEYDOWN
=
0x300
,
/**< Key pressed */
SDL_KEYUP
,
/**< Key released */
SDL_TEXTEDITING
,
/**< Keyboard text editing (composition) */
SDL_TEXTINPUT
,
/**< Keyboard text input */
/* Mouse events */
SDL_MOUSEMOTION
=
0x400
,
/**< Mouse moved */
SDL_MOUSEBUTTONDOWN
,
/**< Mouse button pressed */
SDL_MOUSEBUTTONUP
,
/**< Mouse button released */
SDL_MOUSEWHEEL
,
/**< Mouse wheel motion */
/* Joystick events */
SDL_JOYAXISMOTION
=
0x600
,
/**< Joystick axis motion */
SDL_JOYBALLMOTION
,
/**< Joystick trackball motion */
SDL_JOYHATMOTION
,
/**< Joystick hat position change */
SDL_JOYBUTTONDOWN
,
/**< Joystick button pressed */
SDL_JOYBUTTONUP
,
/**< Joystick button released */
SDL_JOYDEVICEADDED
,
/**< A new joystick has been inserted into the system */
SDL_JOYDEVICEREMOVED
,
/**< An opened joystick has been removed */
/* Game controller events */
SDL_CONTROLLERAXISMOTION
=
0x650
,
/**< Game controller axis motion */
SDL_CONTROLLERBUTTONDOWN
,
/**< Game controller button pressed */
SDL_CONTROLLERBUTTONUP
,
/**< Game controller button released */
SDL_CONTROLLERDEVICEADDED
,
/**< A new Game controller has been inserted into the system */
SDL_CONTROLLERDEVICEREMOVED
,
/**< An opened Game controller has been removed */
SDL_CONTROLLERDEVICEREMAPPED
,
/**< The controller mapping was updated */
/* Touch events */
SDL_FINGERDOWN
=
0x700
,
SDL_FINGERUP
,
SDL_FINGERMOTION
,
/* Gesture events */
SDL_DOLLARGESTURE
=
0x800
,
SDL_DOLLARRECORD
,
SDL_MULTIGESTURE
,
/* Clipboard events */
SDL_CLIPBOARDUPDATE
=
0x900
,
/**< The clipboard changed */
/* Drag and drop events */
SDL_DROPFILE
=
0x1000
,
/**< The system requests a file open */
/** Events ::SDL_USEREVENT through ::SDL_LASTEVENT are for your use,
* and should be allocated with SDL_RegisterEvents()
*/
SDL_USEREVENT
=
0x8000
,
/**
* This last event is only for bounding internal arrays
*/
SDL_LASTEVENT
=
0xFFFF
}
SDL_EventType
;
/* event.user.* */
typedef
struct
SDL_UserEvent
{
uint32_t
type
;
/**< ::SDL_USEREVENT through ::SDL_NUMEVENTS-1 */
uint32_t
timestamp
;
uint32_t
windowID
;
/**< The associated window if any */
uint32_t
code
;
/**< User defined event code */
void
*
data1
;
/**< User defined data pointer */
void
*
data2
;
/**< User defined data pointer */
}
SDL_UserEvent
;
typedef
union
SDL_Event
{
uint32_t
type
;
/**< Event type, shared with all events */
#if 0
SDL_CommonEvent common; /**< Common event data */
SDL_WindowEvent window; /**< Window event data */
SDL_KeyboardEvent key; /**< Keyboard event data */
SDL_TextEditingEvent edit; /**< Text editing event data */
SDL_TextInputEvent text; /**< Text input event data */
SDL_MouseMotionEvent motion; /**< Mouse motion event data */
SDL_MouseButtonEvent button; /**< Mouse button event data */
SDL_MouseWheelEvent wheel; /**< Mouse wheel event data */
SDL_JoyAxisEvent jaxis; /**< Joystick axis event data */
SDL_JoyBallEvent jball; /**< Joystick ball event data */
SDL_JoyHatEvent jhat; /**< Joystick hat event data */
SDL_JoyButtonEvent jbutton; /**< Joystick button event data */
SDL_JoyDeviceEvent jdevice; /**< Joystick device change event data */
SDL_ControllerAxisEvent caxis; /**< Game Controller axis event data */
SDL_ControllerButtonEvent cbutton; /**< Game Controller button event data */
SDL_ControllerDeviceEvent cdevice; /**< Game Controller device event data */
SDL_QuitEvent quit; /**< Quit request event data */
#endif
SDL_UserEvent
user
;
/**< Custom event data */
#if 0
SDL_SysWMEvent syswm; /**< System dependent window event data */
SDL_TouchFingerEvent tfinger; /**< Touch finger event data */
SDL_MultiGestureEvent mgesture; /**< Gesture event data */
SDL_DollarGestureEvent dgesture; /**< Gesture event data */
SDL_DropEvent drop; /**< Drag and drop event data */
#endif
}
SDL_Event
;
#include "ijksdl_audio.h"
#endif
ijkmediaplayer/jni/ijksdl/ijksdl_audio.h
0 → 100644
浏览文件 @
45a8c771
/*****************************************************************************
* ijksdl_audio.h
*****************************************************************************
*
* copyright (c) 2013 Zhang Rui <bbcallen@gmail.com>
*
* This file is part of ijkPlayer.
*
* ijkPlayer is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* ijkPlayer is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with ijkPlayer; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef IJKSDL__IJKSDL_AUDIO_H
#define IJKSDL__IJKSDL_AUDIO_H
#include "ijksdl_stdinc.h"
#include "ijksdl_endian.h"
typedef
uint16_t
SDL_AudioFormat
;
#define AUDIO_U8 0x0008
/**< Unsigned 8-bit samples */
#define AUDIO_S8 0x8008
/**< Signed 8-bit samples */
#define AUDIO_U16LSB 0x0010
/**< Unsigned 16-bit samples */
#define AUDIO_S16LSB 0x8010
/**< Signed 16-bit samples */
#define AUDIO_U16MSB 0x1010
/**< As above, but big-endian byte order */
#define AUDIO_S16MSB 0x9010
/**< As above, but big-endian byte order */
#define AUDIO_U16 AUDIO_U16LSB
#define AUDIO_S16 AUDIO_S16LSB
#define AUDIO_S32LSB 0x8020
/**< 32-bit integer samples */
#define AUDIO_S32MSB 0x9020
/**< As above, but big-endian byte order */
#define AUDIO_S32 AUDIO_S32LSB
#define AUDIO_F32LSB 0x8120
/**< 32-bit floating point samples */
#define AUDIO_F32MSB 0x9120
/**< As above, but big-endian byte order */
#define AUDIO_F32 AUDIO_F32LSB
#if SDL_BYTEORDER == SDL_LIL_ENDIAN
#define AUDIO_U16SYS AUDIO_U16LSB
#define AUDIO_S16SYS AUDIO_S16LSB
#define AUDIO_S32SYS AUDIO_S32LSB
#define AUDIO_F32SYS AUDIO_F32LSB
#else
#define AUDIO_U16SYS AUDIO_U16MSB
#define AUDIO_S16SYS AUDIO_S16MSB
#define AUDIO_S32SYS AUDIO_S32MSB
#define AUDIO_F32SYS AUDIO_F32MSB
#endif
typedef
void
(
*
SDL_AudioCallback
)
(
void
*
userdata
,
Uint8
*
stream
,
int
len
);
typedef
struct
SDL_AudioSpec
{
int
freq
;
/**< DSP frequency -- samples per second */
SDL_AudioFormat
format
;
/**< Audio data format */
Uint8
channels
;
/**< Number of channels: 1 mono, 2 stereo */
Uint8
silence
;
/**< Audio buffer silence value (calculated) */
Uint16
samples
;
/**< Audio buffer size in samples (power of 2) */
Uint16
padding
;
/**< Necessary for some compile environments */
Uint32
size
;
/**< Audio buffer size in bytes (calculated) */
SDL_AudioCallback
callback
;
void
*
userdata
;
}
SDL_AudioSpec
;
#endif
ijkmediaplayer/jni/ijksdl/ijksdl_endian.h
0 → 100644
浏览文件 @
45a8c771
/*****************************************************************************
* ijksdl_endian.h
*****************************************************************************
*
* copyright (c) 2013 Zhang Rui <bbcallen@gmail.com>
*
* This file is part of ijkPlayer.
*
* ijkPlayer is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* ijkPlayer is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with ijkPlayer; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef IJKSDL__IJKSDL_ENDIAN_H
#define IJKSDL__IJKSDL_ENDIAN_H
#define SDL_LIL_ENDIAN 1234
#define SDL_BIG_ENDIAN 4321
#ifndef SDL_BYTEORDER
/* Not defined in SDL_config.h? */
#ifdef __linux__
#include <endian.h>
#define SDL_BYTEORDER __BYTE_ORDER
#else
/* __linux __ */
#if defined(__hppa__) || \
defined(__m68k__) || defined(mc68000) || defined(_M_M68K) || \
(defined(__MIPS__) && defined(__MISPEB__)) || \
defined(__ppc__) || defined(__POWERPC__) || defined(_M_PPC) || \
defined(__sparc__)
#define SDL_BYTEORDER SDL_BIG_ENDIAN
#else
#define SDL_BYTEORDER SDL_LIL_ENDIAN
#endif
#endif
/* __linux __ */
#endif
/* !SDL_BYTEORDER */
#endif
ijkmediaplayer/jni/ijksdl/ijksdl_event.h
0 → 100644
浏览文件 @
45a8c771
/*****************************************************************************
* ijksdl_event.h
*****************************************************************************
*
* copyright (c) 2013 Zhang Rui <bbcallen@gmail.com>
*
* This file is part of ijkPlayer.
*
* ijkPlayer is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* ijkPlayer is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with ijkPlayer; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef IJKSDL__IJKSDL_EVENT_H
#define IJKSDL__IJKSDL_EVENT_H
#include "ijksdl_stdinc.h"
typedef
enum
{
SDL_FIRSTEVENT
=
0
,
/**< Unused (do not remove) */
/* Application events */
SDL_QUIT
=
0x100
,
/**< User-requested quit */
/* These application events have special meaning on iOS, see README.iOS for details */
SDL_APP_TERMINATING
,
/**< The application is being terminated by the OS
Called on iOS in applicationWillTerminate()
Called on Android in onDestroy()
*/
SDL_APP_LOWMEMORY
,
/**< The application is low on memory, free memory if possible.
Called on iOS in applicationDidReceiveMemoryWarning()
Called on Android in onLowMemory()
*/
SDL_APP_WILLENTERBACKGROUND
,
/**< The application is about to enter the background
Called on iOS in applicationWillResignActive()
Called on Android in onPause()
*/
SDL_APP_DIDENTERBACKGROUND
,
/**< The application did enter the background and may not get CPU for some time
Called on iOS in applicationDidEnterBackground()
Called on Android in onPause()
*/
SDL_APP_WILLENTERFOREGROUND
,
/**< The application is about to enter the foreground
Called on iOS in applicationWillEnterForeground()
Called on Android in onResume()
*/
SDL_APP_DIDENTERFOREGROUND
,
/**< The application is now interactive
Called on iOS in applicationDidBecomeActive()
Called on Android in onResume()
*/
/* Window events */
SDL_WINDOWEVENT
=
0x200
,
/**< Window state change */
SDL_SYSWMEVENT
,
/**< System specific event */
/* Keyboard events */
SDL_KEYDOWN
=
0x300
,
/**< Key pressed */
SDL_KEYUP
,
/**< Key released */
SDL_TEXTEDITING
,
/**< Keyboard text editing (composition) */
SDL_TEXTINPUT
,
/**< Keyboard text input */
/* Mouse events */
SDL_MOUSEMOTION
=
0x400
,
/**< Mouse moved */
SDL_MOUSEBUTTONDOWN
,
/**< Mouse button pressed */
SDL_MOUSEBUTTONUP
,
/**< Mouse button released */
SDL_MOUSEWHEEL
,
/**< Mouse wheel motion */
/* Joystick events */
SDL_JOYAXISMOTION
=
0x600
,
/**< Joystick axis motion */
SDL_JOYBALLMOTION
,
/**< Joystick trackball motion */
SDL_JOYHATMOTION
,
/**< Joystick hat position change */
SDL_JOYBUTTONDOWN
,
/**< Joystick button pressed */
SDL_JOYBUTTONUP
,
/**< Joystick button released */
SDL_JOYDEVICEADDED
,
/**< A new joystick has been inserted into the system */
SDL_JOYDEVICEREMOVED
,
/**< An opened joystick has been removed */
/* Game controller events */
SDL_CONTROLLERAXISMOTION
=
0x650
,
/**< Game controller axis motion */
SDL_CONTROLLERBUTTONDOWN
,
/**< Game controller button pressed */
SDL_CONTROLLERBUTTONUP
,
/**< Game controller button released */
SDL_CONTROLLERDEVICEADDED
,
/**< A new Game controller has been inserted into the system */
SDL_CONTROLLERDEVICEREMOVED
,
/**< An opened Game controller has been removed */
SDL_CONTROLLERDEVICEREMAPPED
,
/**< The controller mapping was updated */
/* Touch events */
SDL_FINGERDOWN
=
0x700
,
SDL_FINGERUP
,
SDL_FINGERMOTION
,
/* Gesture events */
SDL_DOLLARGESTURE
=
0x800
,
SDL_DOLLARRECORD
,
SDL_MULTIGESTURE
,
/* Clipboard events */
SDL_CLIPBOARDUPDATE
=
0x900
,
/**< The clipboard changed */
/* Drag and drop events */
SDL_DROPFILE
=
0x1000
,
/**< The system requests a file open */
/** Events ::SDL_USEREVENT through ::SDL_LASTEVENT are for your use,
* and should be allocated with SDL_RegisterEvents()
*/
SDL_USEREVENT
=
0x8000
,
/**
* This last event is only for bounding internal arrays
*/
SDL_LASTEVENT
=
0xFFFF
}
SDL_EventType
;
/* event.user.* */
typedef
struct
SDL_UserEvent
{
Uint32
type
;
/**< ::SDL_USEREVENT through ::SDL_NUMEVENTS-1 */
Uint32
timestamp
;
Uint32
windowID
;
/**< The associated window if any */
Uint32
code
;
/**< User defined event code */
void
*
data1
;
/**< User defined data pointer */
void
*
data2
;
/**< User defined data pointer */
}
SDL_UserEvent
;
typedef
union
SDL_Event
{
Uint32
type
;
/**< Event type, shared with all events */
#if 0
SDL_CommonEvent common; /**< Common event data */
SDL_WindowEvent window; /**< Window event data */
SDL_KeyboardEvent key; /**< Keyboard event data */
SDL_TextEditingEvent edit; /**< Text editing event data */
SDL_TextInputEvent text; /**< Text input event data */
SDL_MouseMotionEvent motion; /**< Mouse motion event data */
SDL_MouseButtonEvent button; /**< Mouse button event data */
SDL_MouseWheelEvent wheel; /**< Mouse wheel event data */
SDL_JoyAxisEvent jaxis; /**< Joystick axis event data */
SDL_JoyBallEvent jball; /**< Joystick ball event data */
SDL_JoyHatEvent jhat; /**< Joystick hat event data */
SDL_JoyButtonEvent jbutton; /**< Joystick button event data */
SDL_JoyDeviceEvent jdevice; /**< Joystick device change event data */
SDL_ControllerAxisEvent caxis; /**< Game Controller axis event data */
SDL_ControllerButtonEvent cbutton; /**< Game Controller button event data */
SDL_ControllerDeviceEvent cdevice; /**< Game Controller device event data */
SDL_QuitEvent quit; /**< Quit request event data */
#endif
SDL_UserEvent
user
;
/**< Custom event data */
#if 0
SDL_SysWMEvent syswm; /**< System dependent window event data */
SDL_TouchFingerEvent tfinger; /**< Touch finger event data */
SDL_MultiGestureEvent mgesture; /**< Gesture event data */
SDL_DollarGestureEvent dgesture; /**< Gesture event data */
SDL_DropEvent drop; /**< Drag and drop event data */
#endif
}
SDL_Event
;
#endif
ijkmediaplayer/jni/ijksdl/ijksdl_mutex.c
0 → 100644
浏览文件 @
45a8c771
/*****************************************************************************
* ijksdl_mutex.c
*****************************************************************************
*
* copyright (c) 2013 Zhang Rui <bbcallen@gmail.com>
*
* This file is part of ijkPlayer.
*
* ijkPlayer is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* ijkPlayer is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with ijkPlayer; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "ijksdl_mutex.h"
#include <errno.h>
#include <assert.h>
SDL_mutex
*
SDL_CreateMutex
(
void
)
{
SDL_mutex
*
mutex
;
mutex
=
(
SDL_mutex
*
)
malloc
(
sizeof
(
SDL_mutex
));
if
(
!
mutex
)
return
NULL
;
if
(
pthread_mutex_init
(
&
mutex
->
id
,
NULL
)
!=
0
)
{
free
(
mutex
);
}
return
mutex
;
}
void
SDL_DestroyMutex
(
SDL_mutex
*
mutex
)
{
if
(
mutex
)
{
pthread_mutex_destroy
(
&
mutex
->
id
);
free
(
mutex
);
}
}
int
SDL_LockMutex
(
SDL_mutex
*
mutex
)
{
assert
(
mutex
);
if
(
!
mutex
)
return
-
1
;
return
pthread_mutex_lock
(
&
mutex
->
id
);
}
int
SDL_UnlockMutex
(
SDL_mutex
*
mutex
)
{
assert
(
mutex
);
if
(
!
mutex
)
return
-
1
;
return
pthread_mutex_unlock
(
&
mutex
->
id
);
}
SDL_cond
*
SDL_CreateCond
(
void
)
{
SDL_cond
*
cond
;
cond
=
(
SDL_cond
*
)
malloc
(
sizeof
(
SDL_cond
));
if
(
!
cond
)
return
NULL
;
if
(
pthread_cond_init
(
&
cond
->
id
,
NULL
)
!=
0
)
{
free
(
cond
);
}
return
cond
;
}
void
SDL_DestroyCond
(
SDL_cond
*
cond
)
{
if
(
cond
)
{
pthread_cond_destroy
(
&
cond
->
id
);
free
(
cond
);
}
}
int
SDL_CondSignal
(
SDL_cond
*
cond
)
{
assert
(
cond
);
if
(
!
cond
)
return
-
1
;
return
pthread_cond_signal
(
&
cond
->
id
);
}
int
SDL_CondBroadcast
(
SDL_cond
*
cond
)
{
assert
(
cond
);
if
(
!
cond
)
return
-
1
;
return
pthread_cond_broadcast
(
&
cond
->
id
);
}
int
SDL_CondWaitTimeout
(
SDL_cond
*
cond
,
SDL_mutex
*
mutex
,
uint32_t
ms
)
{
int
retval
;
struct
timeval
delta
;
struct
timespec
abstime
;
assert
(
cond
);
assert
(
mutex
);
if
(
!
cond
||
!
mutex
)
{
return
-
1
;
}
gettimeofday
(
&
delta
,
NULL
);
abstime
.
tv_sec
=
delta
.
tv_sec
+
(
ms
/
1000
);
abstime
.
tv_nsec
=
(
delta
.
tv_usec
+
(
ms
%
1000
)
*
1000
)
*
1000
;
if
(
abstime
.
tv_nsec
>
1000000000
)
{
abstime
.
tv_sec
+=
1
;
abstime
.
tv_nsec
-=
1000000000
;
}
while
(
1
)
{
retval
=
pthread_cond_timedwait
(
&
cond
->
id
,
&
mutex
->
id
,
&
abstime
);
if
(
retval
==
0
)
return
0
;
else
if
(
retval
==
EINTR
)
continue
;
else
if
(
retval
==
ETIMEDOUT
)
return
SDL_MUTEX_TIMEDOUT
;
else
break
;
}
return
-
1
;
}
int
SDL_CondWait
(
SDL_cond
*
cond
,
SDL_mutex
*
mutex
)
{
assert
(
cond
);
assert
(
mutex
);
if
(
!
cond
||
!
mutex
)
return
-
1
;
return
pthread_cond_wait
(
&
cond
->
id
,
&
mutex
->
id
);
}
ijkmediaplayer/jni/ijksdl/ijksdl_mutex.h
0 → 100644
浏览文件 @
45a8c771
/*****************************************************************************
* ijksdl_mutex.h
*****************************************************************************
*
* copyright (c) 2013 Zhang Rui <bbcallen@gmail.com>
*
* This file is part of ijkPlayer.
*
* ijkPlayer is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* ijkPlayer is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with ijkPlayer; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef IJKSDL__IJKSDL_MUTEX_H
#define IJKSDL__IJKSDL_MUTEX_H
#include <stdint.h>
#include <pthread.h>
#define SDL_MUTEX_TIMEDOUT 1
#define SDL_MUTEX_MAXWAIT (~(uint32_t)0)
typedef
struct
SDL_mutex
{
pthread_mutex_t
id
;
}
SDL_mutex
;
SDL_mutex
*
SDL_CreateMutex
(
void
);
void
SDL_DestroyMutex
(
SDL_mutex
*
mutex
);
int
SDL_LockMutex
(
SDL_mutex
*
mutex
);
int
SDL_UnlockMutex
(
SDL_mutex
*
mutex
);
typedef
struct
SDL_cond
{
pthread_cond_t
id
;
}
SDL_cond
;
SDL_cond
*
SDL_CreateCond
(
void
);
void
SDL_DestroyCond
(
SDL_cond
*
cond
);
int
SDL_CondSignal
(
SDL_cond
*
cond
);
int
SDL_CondBroadcast
(
SDL_cond
*
cond
);
int
SDL_CondWaitTimeout
(
SDL_cond
*
cond
,
SDL_mutex
*
mutex
,
uint32_t
ms
);
int
SDL_CondWait
(
SDL_cond
*
cond
,
SDL_mutex
*
mutex
);
#endif
ijkmediaplayer/jni/ijksdl/ijksdl_overlay.h
0 → 100644
浏览文件 @
45a8c771
/*****************************************************************************
* ijksdl_overlay.h
*****************************************************************************
*
* copyright (c) 2013 Zhang Rui <bbcallen@gmail.com>
*
* This file is part of ijkPlayer.
*
* ijkPlayer is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* ijkPlayer is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with ijkPlayer; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef IJKSDL__IJKSDL_OVERLAY_H
#define IJKSDL__IJKSDL_OVERLAY_H
#include "ijksdl_stdinc.h"
typedef
struct
SDL_Overlay
{
Uint32
format
;
int
w
,
h
;
int
planes
;
Uint16
*
pitches
;
Uint8
**
pixels
;
Uint32
hw_overlay
:
1
;
}
SDL_Overlay
;
#endif
ijkmediaplayer/jni/ijksdl/ijksdl_rect.h
0 → 100644
浏览文件 @
45a8c771
/*****************************************************************************
* ijksdl_rect.h
*****************************************************************************
*
* copyright (c) 2013 Zhang Rui <bbcallen@gmail.com>
*
* This file is part of ijkPlayer.
*
* ijkPlayer is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* ijkPlayer is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with ijkPlayer; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef IJKSDL__IJKSDL_RECT_H
#define IJKSDL__IJKSDL_RECT_H
typedef
struct
SDL_Rect
{
int
x
,
y
;
int
w
,
h
;
}
SDL_Rect
;
#endif
ijkmediaplayer/jni/ijksdl/ijksdl_stdinc.h
0 → 100644
浏览文件 @
45a8c771
/*****************************************************************************
* ijksdl_stdinc.h
*****************************************************************************
*
* copyright (c) 2013 Zhang Rui <bbcallen@gmail.com>
*
* This file is part of ijkPlayer.
*
* ijkPlayer is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* ijkPlayer is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with ijkPlayer; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef IJKSDL__IJKSDL_STDINC_H
#define IJKSDL__IJKSDL_STDINC_H
#include <stdint.h>
typedef
int8_t
Sint8
;
typedef
uint8_t
Uint8
;
typedef
int16_t
Sint16
;
typedef
uint16_t
Uint16
;
typedef
int32_t
Sint32
;
typedef
uint32_t
Uint32
;
typedef
int64_t
Sint64
;
typedef
uint64_t
Uint64
;
#endif
ijkmediaplayer/jni/ijksdl/ijksdl_thread.c
浏览文件 @
45a8c771
...
...
@@ -25,132 +25,6 @@
#include <assert.h>
#include "ijksdl_thread.h"
SDL_mutex
*
SDL_CreateMutex
(
void
)
{
SDL_mutex
*
mutex
;
mutex
=
(
SDL_mutex
*
)
malloc
(
sizeof
(
SDL_mutex
));
if
(
!
mutex
)
return
NULL
;
if
(
pthread_mutex_init
(
&
mutex
->
id
,
NULL
)
!=
0
)
{
free
(
mutex
);
}
return
mutex
;
}
void
SDL_DestroyMutex
(
SDL_mutex
*
mutex
)
{
if
(
mutex
)
{
pthread_mutex_destroy
(
&
mutex
->
id
);
free
(
mutex
);
}
}
int
SDL_LockMutex
(
SDL_mutex
*
mutex
)
{
assert
(
mutex
);
if
(
!
mutex
)
return
-
1
;
return
pthread_mutex_lock
(
&
mutex
->
id
);
}
int
SDL_UnlockMutex
(
SDL_mutex
*
mutex
)
{
assert
(
mutex
);
if
(
!
mutex
)
return
-
1
;
return
pthread_mutex_unlock
(
&
mutex
->
id
);
}
SDL_cond
*
SDL_CreateCond
(
void
)
{
SDL_cond
*
cond
;
cond
=
(
SDL_cond
*
)
malloc
(
sizeof
(
SDL_cond
));
if
(
!
cond
)
return
NULL
;
if
(
pthread_cond_init
(
&
cond
->
id
,
NULL
)
!=
0
)
{
free
(
cond
);
}
return
cond
;
}
void
SDL_DestroyCond
(
SDL_cond
*
cond
)
{
if
(
cond
)
{
pthread_cond_destroy
(
&
cond
->
id
);
free
(
cond
);
}
}
int
SDL_CondSignal
(
SDL_cond
*
cond
)
{
assert
(
cond
);
if
(
!
cond
)
return
-
1
;
return
pthread_cond_signal
(
&
cond
->
id
);
}
int
SDL_CondBroadcast
(
SDL_cond
*
cond
)
{
assert
(
cond
);
if
(
!
cond
)
return
-
1
;
return
pthread_cond_broadcast
(
&
cond
->
id
);
}
int
SDL_CondWaitTimeout
(
SDL_cond
*
cond
,
SDL_mutex
*
mutex
,
uint32_t
ms
)
{
int
retval
;
struct
timeval
delta
;
struct
timespec
abstime
;
assert
(
cond
);
assert
(
mutex
);
if
(
!
cond
||
!
mutex
)
{
return
-
1
;
}
gettimeofday
(
&
delta
,
NULL
);
abstime
.
tv_sec
=
delta
.
tv_sec
+
(
ms
/
1000
);
abstime
.
tv_nsec
=
(
delta
.
tv_usec
+
(
ms
%
1000
)
*
1000
)
*
1000
;
if
(
abstime
.
tv_nsec
>
1000000000
)
{
abstime
.
tv_sec
+=
1
;
abstime
.
tv_nsec
-=
1000000000
;
}
while
(
1
)
{
retval
=
pthread_cond_timedwait
(
&
cond
->
id
,
&
mutex
->
id
,
&
abstime
);
if
(
retval
==
0
)
return
0
;
else
if
(
retval
==
EINTR
)
continue
;
else
if
(
retval
==
ETIMEDOUT
)
return
SDL_MUTEX_TIMEDOUT
;
else
break
;
}
return
-
1
;
}
int
SDL_CondWait
(
SDL_cond
*
cond
,
SDL_mutex
*
mutex
)
{
assert
(
cond
);
assert
(
mutex
);
if
(
!
cond
||
!
mutex
)
return
-
1
;
return
pthread_cond_wait
(
&
cond
->
id
,
&
mutex
->
id
);
}
static
void
*
SDL_RunThread
(
void
*
data
)
{
SDL_Thread
*
thread
=
data
;
...
...
ijkmediaplayer/jni/ijksdl/ijksdl_thread.h
浏览文件 @
45a8c771
...
...
@@ -2,7 +2,6 @@
* ijksdl_thread.h
*****************************************************************************
*
* copyright (c) 2001 Fabrice Bellard
* copyright (c) 2013 Zhang Rui <bbcallen@gmail.com>
*
* This file is part of ijkPlayer.
...
...
@@ -28,30 +27,6 @@
#include <stdint.h>
#include <pthread.h>
#define SDL_MUTEX_TIMEDOUT 1
#define SDL_MUTEX_MAXWAIT (~(uint32_t)0)
typedef
struct
SDL_mutex
{
pthread_mutex_t
id
;
}
SDL_mutex
;
SDL_mutex
*
SDL_CreateMutex
(
void
);
void
SDL_DestroyMutex
(
SDL_mutex
*
mutex
);
int
SDL_LockMutex
(
SDL_mutex
*
mutex
);
int
SDL_UnlockMutex
(
SDL_mutex
*
mutex
);
//int SDL_TryLockMutex(SDL_mutex *mutex);
typedef
struct
SDL_cond
{
pthread_cond_t
id
;
}
SDL_cond
;
SDL_cond
*
SDL_CreateCond
(
void
);
void
SDL_DestroyCond
(
SDL_cond
*
cond
);
int
SDL_CondSignal
(
SDL_cond
*
cond
);
int
SDL_CondBroadcast
(
SDL_cond
*
cond
);
int
SDL_CondWaitTimeout
(
SDL_cond
*
cond
,
SDL_mutex
*
mutex
,
uint32_t
ms
);
int
SDL_CondWait
(
SDL_cond
*
cond
,
SDL_mutex
*
mutex
);
typedef
struct
SDL_Thread
{
pthread_t
id
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录