Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
NotesChapter
ijkplayer
提交
74368717
I
ijkplayer
项目概览
NotesChapter
/
ijkplayer
与 Fork 源项目一致
从无法访问的项目Fork
通知
5
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,发现更多精彩内容 >>
提交
74368717
编写于
6月 15, 2013
作者:
Z
Zhang Rui
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
ijksdl: introduce SDL_Vout
上级
3af69371
变更
7
显示空白变更内容
内联
并排
Showing
7 changed file
with
463 addition
and
0 deletion
+463
-0
ijkmediaplayer/jni/ijksdl/Android.mk
ijkmediaplayer/jni/ijksdl/Android.mk
+2
-0
ijkmediaplayer/jni/ijksdl/ijksdl.h
ijkmediaplayer/jni/ijksdl/ijksdl.h
+1
-0
ijkmediaplayer/jni/ijksdl/ijksdl_vout.c
ijkmediaplayer/jni/ijksdl/ijksdl_vout.c
+64
-0
ijkmediaplayer/jni/ijksdl/ijksdl_vout.h
ijkmediaplayer/jni/ijksdl/ijksdl_vout.h
+61
-0
ijkmediaplayer/jni/ijksdl/ijksdl_vout_android.c
ijkmediaplayer/jni/ijksdl/ijksdl_vout_android.c
+220
-0
ijkmediaplayer/jni/ijksdl/ijksdl_vout_android.h
ijkmediaplayer/jni/ijksdl/ijksdl_vout_android.h
+38
-0
ijkmediaplayer/jni/ijksdl/ijksdl_vout_internal.h
ijkmediaplayer/jni/ijksdl/ijksdl_vout_internal.h
+77
-0
未找到文件。
ijkmediaplayer/jni/ijksdl/Android.mk
浏览文件 @
74368717
...
@@ -20,6 +20,7 @@ LOCAL_PATH := $(call my-dir)
...
@@ -20,6 +20,7 @@ LOCAL_PATH := $(call my-dir)
include
$(CLEAR_VARS)
include
$(CLEAR_VARS)
LOCAL_C_CFLAGS
+=
-std
=
c99
LOCAL_C_CFLAGS
+=
-std
=
c99
LOCAL_LDLIBS
+=
-llog
LOCAL_SRC_FILES
+=
ijksdl_audio.c
LOCAL_SRC_FILES
+=
ijksdl_audio.c
LOCAL_SRC_FILES
+=
ijksdl_error.c
LOCAL_SRC_FILES
+=
ijksdl_error.c
...
@@ -29,6 +30,7 @@ LOCAL_SRC_FILES += ijksdl_stdinc.c
...
@@ -29,6 +30,7 @@ LOCAL_SRC_FILES += ijksdl_stdinc.c
LOCAL_SRC_FILES
+=
ijksdl_thread.c
LOCAL_SRC_FILES
+=
ijksdl_thread.c
LOCAL_SRC_FILES
+=
ijksdl_timer.c
LOCAL_SRC_FILES
+=
ijksdl_timer.c
LOCAL_SRC_FILES
+=
ijksdl_video.c
LOCAL_SRC_FILES
+=
ijksdl_video.c
LOCAL_SRC_FILES
+=
ijksdl_vout.c
LOCAL_MODULE
:=
ijksdl
LOCAL_MODULE
:=
ijksdl
include
$(BUILD_STATIC_LIBRARY)
include
$(BUILD_STATIC_LIBRARY)
ijkmediaplayer/jni/ijksdl/ijksdl.h
浏览文件 @
74368717
...
@@ -31,5 +31,6 @@
...
@@ -31,5 +31,6 @@
#include "ijksdl_thread.h"
#include "ijksdl_thread.h"
#include "ijksdl_timer.h"
#include "ijksdl_timer.h"
#include "ijksdl_video.h"
#include "ijksdl_video.h"
#include "ijksdl_vout.h"
#endif
#endif
ijkmediaplayer/jni/ijksdl/ijksdl_vout.c
0 → 100644
浏览文件 @
74368717
/*****************************************************************************
* ijksdl_vout.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_vout.h"
#include <assert.h>
#include <android/native_window_jni.h>
void
SDL_VoutFree
(
SDL_Vout
*
vout
)
{
if
(
!
vout
)
return
;
if
(
vout
->
free_l
)
{
vout
->
free_l
(
vout
);
}
else
{
free
(
vout
);
}
}
int
SDL_VoutGetSurface
(
SDL_Vout
*
vout
,
SDL_VoutSurface
**
ppsurface
,
int
w
,
int
h
,
int
format
)
{
assert
(
ppsurface
);
if
(
!
ppsurface
||
!
vout
||
!
vout
->
get_surface
)
return
-
1
;
SDL_LockMutex
(
vout
->
mutex
);
int
retval
=
vout
->
get_surface
(
vout
,
ppsurface
,
w
,
h
,
format
);
SDL_UnlockMutex
(
vout
->
mutex
);
return
retval
;
}
void
SDL_VoutSurface_Free
(
SDL_VoutSurface
*
surface
)
{
if
(
!
surface
)
return
;
if
(
surface
->
free_l
)
surface
->
free_l
(
surface
);
else
free
(
surface
);
}
ijkmediaplayer/jni/ijksdl/ijksdl_vout.h
0 → 100644
浏览文件 @
74368717
/*****************************************************************************
* ijksdl_vout.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_VOUT_H
#define IJKSDL__IJKSDL_VOUT_H
#include "ijksdl_stdinc.h"
#include "ijksdl_mutex.h"
typedef
struct
SDL_VoutOverlay
{
void
*
opaque
;
int
w
;
int
h
;
}
SDL_VoutOverlay
;
typedef
struct
SDL_VoutSurface
SDL_VoutSurface
;
typedef
struct
SDL_VoutSurface
{
int
w
;
int
h
;
int
format
;
void
*
opaque
;
void
(
*
free_l
)(
SDL_VoutSurface
*
surface
);
}
SDL_VoutSurface
;
typedef
struct
SDL_Vout
SDL_Vout
;
typedef
struct
SDL_Vout
{
SDL_mutex
*
mutex
;
void
*
opaque
;
void
(
*
free_l
)(
SDL_Vout
*
vout
);
int
(
*
get_surface
)(
SDL_Vout
*
vout
,
SDL_VoutSurface
**
ppsurface
,
int
w
,
int
h
,
int
format
);
}
SDL_Vout
;
void
SDL_Vout_Free
(
SDL_Vout
*
vout
);
int
SDL_Vout_GetSurface
(
SDL_Vout
*
vout
,
SDL_VoutSurface
**
ppsurface
,
int
w
,
int
h
,
int
format
);
void
SDL_VoutSurface_Free
(
SDL_VoutSurface
*
surface
);
#endif
ijkmediaplayer/jni/ijksdl/ijksdl_vout_android.c
0 → 100644
浏览文件 @
74368717
/*****************************************************************************
* ijksdl_vout_android.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_vout_android.h"
#include <android/native_window_jni.h>
#include "ijksdl_vout.h"
#include "ijksdl_vout_internal.h"
typedef
struct
SDL_Vout_Opaque
{
ANativeWindow
*
native_window
;
}
SDL_Vout_Opaque
;
typedef
struct
SDL_VoutSurface_Opaque
{
ANativeWindow
*
native_window
;
}
SDL_VoutSurface_Opaque
;
static
void
surface_opaque_free
(
SDL_VoutSurface
*
surface
)
{
if
(
!
surface
)
return
;
SDL_VoutSurface_Opaque
*
opaque
=
surface
->
opaque
;
if
(
opaque
)
{
if
(
opaque
->
native_window
)
{
ANativeWindow_release
(
opaque
->
native_window
);
}
free
(
opaque
);
surface
->
opaque
=
NULL
;
}
SDL_VoutSurface_FreeInternal
(
surface
);
}
static
SDL_VoutSurface
*
surface_create_l
(
ANativeWindow
*
native_window
)
{
SDL_VoutSurface
*
surface
=
SDL_VoutSurface_CreateInternal
();
if
(
!
surface
)
return
-
1
;
SDL_VoutSurface_Opaque
*
opaque
=
(
SDL_VoutSurface_Opaque
*
)
malloc
(
sizeof
(
SDL_VoutSurface_Opaque
));
if
(
!
opaque
)
{
free
(
surface
);
return
-
1
;
}
memset
(
opaque
,
0
,
sizeof
(
opaque
));
ANativeWindow_acquire
(
native_window
);
opaque
->
native_window
=
native_window
;
surface
->
opaque
=
opaque
;
surface
->
free_l
=
surface_opaque_free
;
return
surface
;
}
static
void
vout_opaque_free
(
SDL_Vout
*
vout
)
{
if
(
!
vout
)
return
;
SDL_Vout_Opaque
*
opaque
=
vout
->
opaque
;
if
(
opaque
)
{
if
(
opaque
->
native_window
)
{
ANativeWindow_release
(
opaque
->
native_window
);
}
free
(
vout
->
opaque
);
vout
->
opaque
=
NULL
;
}
SDL_Vout_FreeInternal
(
vout
);
}
static
int
vout_get_surface
(
SDL_Vout
*
vout
,
SDL_VoutSurface
**
ppsurface
,
int
w
,
int
h
,
int
format
)
{
SDL_Vout_Opaque
*
vout_opaque
=
vout
->
opaque
;
SDL_VoutSurface
*
surface
=
*
ppsurface
;
SDL_VoutSurface_Opaque
*
surface_opaque
=
NULL
;
ANativeWindow
*
new_native_window
=
NULL
;
SDL_LockMutex
(
vout
->
mutex
);
if
(
surface
!=
NULL
)
{
surface_opaque
=
surface
->
opaque
;
if
(
surface_opaque
->
native_window
==
vout_opaque
->
native_window
&&
w
==
surface
->
w
&&
h
==
surface
->
h
&&
format
==
surface
->
format
)
{
}
else
{
SDL_VoutSurfaceFree
(
surface
);
*
ppsurface
=
NULL
;
surface
=
NULL
;
}
}
// aquire new native_window from vout */
if
(
surface
==
NULL
)
{
new_native_window
=
vout_opaque
->
native_window
;
ANativeWindow_aquire
(
new_native_window
);
}
SDL_UnlockMutex
(
vout
->
mutex
);
// setup surface without lock
if
(
surface
==
NULL
)
{
if
(
ANativeWindow_setBuffersGeometry
(
new_native_window
,
w
,
h
,
format
)
<
0
)
{
ANativeWindow_release
(
new_native_window
);
new_native_window
=
NULL
;
}
if
(
new_native_window
)
{
assert
(
surface
);
surface
=
surface_create_l
(
new_native_window
);
if
(
surface
)
new_native_window
=
NULL
;
ANativeWindow_release
(
vout_opaque
->
native_window
);
}
if
(
new_native_window
)
{
ANativeWindow_release
(
new_native_window
);
new_native_window
=
NULL
;
}
}
return
surface
?
0
:
-
1
;
}
SDL_Vout
*
SDL_VoutAndroid_CreateFromANativeWindow
(
ANativeWindow
*
native_window
)
{
SDL_Vout
*
vout
=
SDL_Vout_CreateInternal
();
if
(
!
vout
)
return
NULL
;
SDL_Vout_Opaque
*
opaque
=
malloc
(
sizeof
(
SDL_Vout_Opaque
));
if
(
!
opaque
)
{
SDL_Vout_Free
(
opaque
);
return
NULL
;
}
memset
(
opaque
,
0
,
sizeof
(
SDL_Vout_Opaque
));
if
(
native_window
)
{
ANativeWindow_acquire
(
native_window
);
}
opaque
->
native_window
=
native_window
;
vout
->
opaque
=
opaque
;
vout
->
free_l
=
vout_opaque_free
;
vout
->
get_surface
=
vout_get_surface
;
return
vout
;
}
SDL_Vout
*
SDL_VoutAndroid_CreateFromAndroidSurface
(
jobject
android_surface
)
{
if
(
!
android_surface
)
return
NULL
;
ANativeWindow
*
native_window
=
ANativeWindow_fromSurface
(
android_surface
);
if
(
!
native_window
)
return
NULL
;
SDL_Vout
*
vout
=
SDL_Vout_Create_FromANativeWindow
(
native_window
);
ANativeWindow_release
(
native_window
);
return
vout
;
}
static
void
SDL_VoutAndroid_SetNativeWindow_l
(
SDL_Vout
vout
,
ANativeWindow
*
native_window
)
{
SDL_Vout_Opaque
*
opaque
=
vout
->
opaque
;
if
(
opaque
->
native_window
==
native_window
)
return
;
if
(
opaque
->
native_window
)
ANativeWindow_release
(
opaque
->
native_window
);
ANativeWindow_acquire
(
native_window
);
opaque
->
native_window
=
native_window
;
}
void
SDL_VoutAndroid_SetNativeWindow
(
SDL_Vout
vout
,
ANativeWindow
*
native_window
)
{
SDL_LockMutex
(
vout
->
mutex
);
SDL_VoutAndroid_SetNativeWindow_l
(
vout
,
native_window
);
SDL_UnlockMutex
(
vout
->
mutex
);
}
void
SDL_VoutAndroid_SetAndroidSurface
(
SDL_Vout
vout
,
jobject
android_surface
)
{
if
(
!
android_surface
)
return
;
ANativeWindow
*
native_window
=
ANativeWindow_fromSurface
(
android_surface
);
if
(
!
native_window
)
return
;
SDL_VoutNativeWindow_SetNativeWindow
(
native_window
);
ANativeWindow_release
(
native_window
);
}
ijkmediaplayer/jni/ijksdl/ijksdl_vout_android.h
0 → 100644
浏览文件 @
74368717
/*****************************************************************************
* ijksdl_vout_android.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_VOUT_ANDROID_H
#define IJKSDL__IJKSDL_VOUT_ANDROID_H
#include <jni.h>
#include <android/native_window.h>
#include "ijksdl_stdinc.h"
#include "ijksdl_mutex.h"
typedef
struct
ANativeWindow
ANativeWindow
;
SDL_Vout
*
SDL_VoutAndroid_Create_FromANativeWindow
(
ANativeWindow
*
native_window
);
SDL_Vout
*
SDL_VoutAndroid_Create_FromAndroidSurface
(
jobject
android_surface
);
void
SDL_VoutAndroid_SetNativeWindow
(
SDL_Vout
vout
,
ANativeWindow
*
native_window
);
void
SDL_VoutAndroid_SetAndroidSurface
(
SDL_Vout
vout
,
jobject
android_surface
);
ijkmediaplayer/jni/ijksdl/ijksdl_vout_internal.h
0 → 100644
浏览文件 @
74368717
/*****************************************************************************
* ijksdl_vout_internal.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_VOUT_INTERNAL_H
#define IJKSDL__IJKSDL_VOUT_INTERNAL_H
#include "ijksdl_vout.h"
inline
static
SDL_Vout
*
SDL_Vout_CreateInternal
()
{
SDL_Vout
*
vout
=
(
SDL_Vout
*
)
malloc
(
sizeof
(
SDL_Vout
));
if
(
!
vout
)
return
NULL
;
memset
(
vout
,
0
,
sizeof
(
SDL_Vout
));
vout
->
mutex
=
SDL_CreateMutex
();
if
(
vout
->
mutex
==
NULL
)
{
free
(
vout
);
return
NULL
;
}
return
vout
;
}
inline
static
void
SDL_Vout_FreeInternal
(
SDL_Vout
*
vout
)
{
if
(
!
vout
)
return
;
if
(
vout
->
mutex
)
{
SDL_DestroyMutex
(
vout
->
mutex
);
}
memset
(
vout
,
0
,
sizeof
(
SDL_VoutSurface
));
free
(
vout
);
}
inline
static
SDL_VoutSurface
*
SDL_VoutSurface_CreateInternal
()
{
SDL_VoutSurface
*
surface
=
(
SDL_VoutSurface
*
)
malloc
(
sizeof
(
SDL_VoutSurface
));
if
(
!
surface
)
return
NULL
;
memset
(
surface
,
0
,
sizeof
(
SDL_VoutSurface
));
return
surface
;
}
inline
static
void
SDL_VoutSurface_FreeInternal
(
SDL_Vout
*
vout
)
{
if
(
!
vout
)
return
;
memset
(
vout
,
0
,
sizeof
(
SDL_VoutSurface
));
free
(
vout
);
}
#endif
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录