Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
qq_25606643
ijkplayer
提交
6800079e
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,发现更多精彩内容 >>
提交
6800079e
编写于
7月 01, 2013
作者:
Z
Zhang Rui
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
SDL_VoutFFmpeg refactor
上级
71c33fb5
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
49 addition
and
113 deletion
+49
-113
ijkmediaplayer/jni/ijksdl/ffmpeg/ijksdl_vout_overlay_ffmpeg.c
...ediaplayer/jni/ijksdl/ffmpeg/ijksdl_vout_overlay_ffmpeg.c
+49
-110
ijkmediaplayer/jni/ijksdl/ffmpeg/ijksdl_vout_overlay_ffmpeg.h
...ediaplayer/jni/ijksdl/ffmpeg/ijksdl_vout_overlay_ffmpeg.h
+0
-3
未找到文件。
ijkmediaplayer/jni/ijksdl/ffmpeg/ijksdl_vout_overlay_ffmpeg.c
浏览文件 @
6800079e
...
@@ -113,7 +113,7 @@ SDL_VoutOverlay *SDL_VoutFFmpeg_CreateOverlay(int width, int height, Uint32 form
...
@@ -113,7 +113,7 @@ SDL_VoutOverlay *SDL_VoutFFmpeg_CreateOverlay(int width, int height, Uint32 form
width
,
height
,
(
const
char
*
)
&
format
,
format
,
display
);
width
,
height
,
(
const
char
*
)
&
format
,
format
,
display
);
SDL_VoutOverlay
*
overlay
=
SDL_VoutOverlay_CreateInternal
(
sizeof
(
SDL_VoutOverlay_Opaque
));
SDL_VoutOverlay
*
overlay
=
SDL_VoutOverlay_CreateInternal
(
sizeof
(
SDL_VoutOverlay_Opaque
));
if
(
!
overlay
)
{
if
(
!
overlay
)
{
ALOGE
(
"
SDL_VoutFFmpeg_CreateOverlay(...)=NULL
"
);
ALOGE
(
"
overlay allocation failed
"
);
return
NULL
;
return
NULL
;
}
}
...
@@ -124,130 +124,48 @@ SDL_VoutOverlay *SDL_VoutFFmpeg_CreateOverlay(int width, int height, Uint32 form
...
@@ -124,130 +124,48 @@ SDL_VoutOverlay *SDL_VoutFFmpeg_CreateOverlay(int width, int height, Uint32 form
overlay
->
w
=
width
;
overlay
->
w
=
width
;
overlay
->
h
=
height
;
overlay
->
h
=
height
;
enum
AVPixelFormat
ff_format
=
AV_PIX_FMT_NONE
;
int
planes
=
0
;
int
buf_width
=
width
;
int
buf_height
=
height
;
switch
(
format
)
{
switch
(
format
)
{
case
SDL_FCC_YV12
:
{
case
SDL_FCC_YV12
:
{
opaque
->
frame
=
alloc_avframe
(
opaque
,
AV_PIX_FMT_YUV420P
,
width
,
height
);
ff_format
=
AV_PIX_FMT_YUV420P
;
if
(
opaque
->
frame
)
{
planes
=
3
;
overlay_fill
(
overlay
,
opaque
->
frame
,
format
,
3
);
FFSWAP
(
Uint8
*
,
overlay
->
pixels
[
1
],
overlay
->
pixels
[
2
]);
FFSWAP
(
Uint16
,
overlay
->
pitches
[
1
],
overlay
->
pitches
[
2
]);
}
break
;
break
;
}
}
case
SDL_FCC_RV16
:
{
case
SDL_FCC_RV16
:
{
opaque
->
frame
=
alloc_avframe
(
opaque
,
AV_PIX_FMT_RGB565
,
width
,
height
);
ff_format
=
AV_PIX_FMT_RGB565
;
if
(
opaque
->
frame
)
{
planes
=
1
;
overlay_fill
(
overlay
,
opaque
->
frame
,
format
,
1
);
}
break
;
break
;
}
}
case
SDL_FCC_RV32
:
{
case
SDL_FCC_RV32
:
{
opaque
->
frame
=
alloc_avframe
(
opaque
,
AV_PIX_FMT_RGB32
,
width
,
height
);
ff_format
=
AV_PIX_FMT_RGB32
;
if
(
opaque
->
frame
)
{
planes
=
1
;
overlay_fill
(
overlay
,
opaque
->
frame
,
format
,
1
);
}
break
;
break
;
}
}
default:
default:
ALOGE
(
"SDL_VoutFFmpeg_CreateOverlay(...): unknown format %.4s(0x%x)"
,
(
char
*
)
&
format
,
format
);
ALOGE
(
"SDL_VoutFFmpeg_CreateOverlay(...): unknown format %.4s(0x%x)"
,
(
char
*
)
&
format
,
format
);
overlay
->
format
=
SDL_FCC_UNDF
;
goto
fail
;
break
;
}
}
if
(
opaque
->
frame
)
{
opaque
->
frame
=
alloc_avframe
(
opaque
,
ff_format
,
buf_width
,
buf_height
);
opaque
->
mutex
=
SDL_CreateMutex
();
if
(
!
opaque
->
frame
)
{
ALOGE
(
"overlay->opaque->frame allocation failed"
);
overlay
->
free_l
=
overlay_free_l
;
goto
fail
;
overlay
->
lock
=
overlay_lock
;
overlay
->
unlock
=
overlay_unlock
;
}
else
{
overlay_free_l
(
overlay
);
overlay
=
NULL
;
ALOGE
(
"SDL_VoutFFmpeg_CreateOverlay(...)=NULL"
);
}
}
opaque
->
mutex
=
SDL_CreateMutex
();
overlay_fill
(
overlay
,
opaque
->
frame
,
format
,
planes
);
return
overlay
;
overlay
->
free_l
=
overlay_free_l
;
}
overlay
->
lock
=
overlay_lock
;
overlay
->
unlock
=
overlay_unlock
;
enum
AVPixelFormat
SDL_VoutFFmpeg_GetBestAVPixelFormat
(
Uint32
format
)
return
overlay
;
{
switch
(
format
)
{
case
SDL_FCC_YV12
:
return
AV_PIX_FMT_YUV420P
;
case
SDL_FCC_RV32
:
// FIXME: android only
return
AV_PIX_FMT_0BGR32
;
case
SDL_FCC_RV16
:
// FIXME: android only
return
AV_PIX_FMT_RGB565
;
default:
return
AV_PIX_FMT_NONE
;
}
}
int
SDL_VoutFFmpeg_SetupPicture
(
const
SDL_VoutOverlay
*
overlay
,
AVPicture
*
pic
,
enum
AVPixelFormat
ff_format
)
{
assert
(
overlay
);
assert
(
pic
);
int
retval
=
-
1
;
switch
(
ff_format
)
{
case
AV_PIX_FMT_YUV420P
:
{
switch
(
overlay
->
format
)
{
case
SDL_FCC_YV12
:
{
for
(
int
i
=
0
;
i
<
overlay
->
planes
;
++
i
)
{
pic
->
data
[
i
]
=
overlay
->
pixels
[
i
];
pic
->
linesize
[
i
]
=
overlay
->
pitches
[
i
];
}
retval
=
0
;
break
;
}
}
break
;
}
case
AV_PIX_FMT_RGB32
:
case
AV_PIX_FMT_BGR32
:
case
AV_PIX_FMT_0BGR32
:
case
AV_PIX_FMT_0RGB32
:
{
switch
(
overlay
->
format
)
{
case
SDL_FCC_RV32
:
{
for
(
int
i
=
0
;
i
<
overlay
->
planes
;
++
i
)
{
pic
->
data
[
i
]
=
overlay
->
pixels
[
i
];
pic
->
linesize
[
i
]
=
overlay
->
pitches
[
i
];
}
retval
=
0
;
break
;
}
}
break
;
}
case
AV_PIX_FMT_BGR565
:
case
AV_PIX_FMT_RGB565
:
{
switch
(
overlay
->
format
)
{
case
SDL_FCC_RV16
:
{
for
(
int
i
=
0
;
i
<
overlay
->
planes
;
++
i
)
{
pic
->
data
[
i
]
=
overlay
->
pixels
[
i
];
pic
->
linesize
[
i
]
=
overlay
->
pitches
[
i
];
}
retval
=
0
;
break
;
}
}
break
;
}
default:
{
break
;
}
}
if
(
retval
)
{
ALOGE
(
"SDL_VoutFFmpeg_SetupPicture: unexpected %s(%d), %.4s(0x%x)"
,
av_get_pix_fmt_name
(
ff_format
),
ff_format
,
(
char
*
)
&
overlay
->
format
,
overlay
->
format
);
}
return
retval
;
fail:
overlay_free_l
(
overlay
);
return
NULL
;
}
}
int
SDL_VoutFFmpeg_ConvertPicture
(
int
SDL_VoutFFmpeg_ConvertPicture
(
...
@@ -259,12 +177,33 @@ int SDL_VoutFFmpeg_ConvertPicture(
...
@@ -259,12 +177,33 @@ int SDL_VoutFFmpeg_ConvertPicture(
assert
(
p_sws_ctx
);
assert
(
p_sws_ctx
);
AVPicture
dest_pic
=
{
{
0
}
};
AVPicture
dest_pic
=
{
{
0
}
};
enum
AVPixelFormat
pixformat
=
SDL_VoutFFmpeg_GetBestAVPixelFormat
(
overlay
->
format
);
enum
AVPixelFormat
dst_format
=
AV_PIX_FMT_NONE
;
SDL_VoutFFmpeg_SetupPicture
(
overlay
,
&
dest_pic
,
pixformat
);
switch
(
overlay
->
format
)
{
case
SDL_FCC_YV12
:
dst_format
=
AV_PIX_FMT_YUV420P
;
break
;
case
SDL_FCC_RV32
:
// FIXME: android only
dst_format
=
AV_PIX_FMT_0BGR32
;
break
;
case
SDL_FCC_RV16
:
// FIXME: android only
dst_format
=
AV_PIX_FMT_RGB565
;
break
;
default:
ALOGE
(
"SDL_VoutFFmpeg_ConvertPicture: unexpected overlay format %s(%d)"
,
(
char
*
)
&
overlay
->
format
,
overlay
->
format
);
return
-
1
;
}
for
(
int
i
=
0
;
i
<
overlay
->
planes
;
++
i
)
{
dest_pic
.
data
[
i
]
=
overlay
->
pixels
[
i
];
dest_pic
.
linesize
[
i
]
=
overlay
->
pitches
[
i
];
}
*
p_sws_ctx
=
sws_getCachedContext
(
*
p_sws_ctx
,
*
p_sws_ctx
=
sws_getCachedContext
(
*
p_sws_ctx
,
width
,
height
,
src_format
,
width
,
height
,
width
,
height
,
src_format
,
width
,
height
,
pix
format
,
sws_flags
,
NULL
,
NULL
,
NULL
);
dst_
format
,
sws_flags
,
NULL
,
NULL
,
NULL
);
if
(
*
p_sws_ctx
==
NULL
)
{
if
(
*
p_sws_ctx
==
NULL
)
{
ALOGE
(
"sws_getCachedContext failed"
);
ALOGE
(
"sws_getCachedContext failed"
);
return
-
1
;
return
-
1
;
...
...
ijkmediaplayer/jni/ijksdl/ffmpeg/ijksdl_vout_overlay_ffmpeg.h
浏览文件 @
6800079e
...
@@ -31,9 +31,6 @@
...
@@ -31,9 +31,6 @@
// TODO: 9 setup overlay stride to speed up memcpy
// TODO: 9 setup overlay stride to speed up memcpy
SDL_VoutOverlay
*
SDL_VoutFFmpeg_CreateOverlay
(
int
width
,
int
height
,
Uint32
format
,
SDL_Vout
*
display
);
SDL_VoutOverlay
*
SDL_VoutFFmpeg_CreateOverlay
(
int
width
,
int
height
,
Uint32
format
,
SDL_Vout
*
display
);
enum
AVPixelFormat
SDL_VoutFFmpeg_GetBestAVPixelFormat
(
Uint32
format
);
int
SDL_VoutFFmpeg_SetupPicture
(
const
SDL_VoutOverlay
*
overlay
,
AVPicture
*
pic
,
enum
AVPixelFormat
ff_format
);
int
SDL_VoutFFmpeg_ConvertPicture
(
int
SDL_VoutFFmpeg_ConvertPicture
(
const
SDL_VoutOverlay
*
overlay
,
const
SDL_VoutOverlay
*
overlay
,
int
width
,
int
height
,
enum
AVPixelFormat
src_format
,
uint8_t
**
src_data
,
int
*
src_linesize
,
int
width
,
int
height
,
enum
AVPixelFormat
src_format
,
uint8_t
**
src_data
,
int
*
src_linesize
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录