Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
qq_25606643
ijkplayer
提交
891a40fa
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,发现更多精彩内容 >>
提交
891a40fa
编写于
6月 27, 2013
作者:
Z
Zhang Rui
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
ijksdl: overlay defined based on fourcc
上级
b491ba2c
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
138 addition
and
47 deletion
+138
-47
ijkmediaplayer/jni/ijkplayer/ff_ffplay.c
ijkmediaplayer/jni/ijkplayer/ff_ffplay.c
+1
-1
ijkmediaplayer/jni/ijksdl/ffmpeg/ijksdl_inc_ffmpeg.h
ijkmediaplayer/jni/ijksdl/ffmpeg/ijksdl_inc_ffmpeg.h
+1
-0
ijkmediaplayer/jni/ijksdl/ffmpeg/ijksdl_vout_overlay_ffmpeg.c
...ediaplayer/jni/ijksdl/ffmpeg/ijksdl_vout_overlay_ffmpeg.c
+57
-31
ijkmediaplayer/jni/ijksdl/ffmpeg/ijksdl_vout_overlay_ffmpeg.h
...ediaplayer/jni/ijksdl/ffmpeg/ijksdl_vout_overlay_ffmpeg.h
+3
-2
ijkmediaplayer/jni/ijksdl/ijksdl_fourcc.h
ijkmediaplayer/jni/ijksdl/ijksdl_fourcc.h
+75
-0
ijkmediaplayer/jni/ijksdl/ijksdl_video.h
ijkmediaplayer/jni/ijksdl/ijksdl_video.h
+1
-13
未找到文件。
ijkmediaplayer/jni/ijkplayer/ff_ffplay.c
浏览文件 @
891a40fa
...
...
@@ -581,7 +581,7 @@ static void alloc_picture(FFPlayer *ffp)
#endif
vp
->
bmp
=
SDL_VoutCreateFFmpegYUVOverlay
(
vp
->
width
,
vp
->
height
,
SDL_
YV12_OVERLAY
,
SDL_
FCC_YV12
,
ffp
->
vout
);
if
(
!
vp
->
bmp
||
vp
->
bmp
->
pitches
[
0
]
<
vp
->
width
)
{
/* SDL allocates a buffer smaller than requested if the video
...
...
ijkmediaplayer/jni/ijksdl/ffmpeg/ijksdl_inc_ffmpeg.h
浏览文件 @
891a40fa
...
...
@@ -25,6 +25,7 @@
#define IJKPLAYER__IJKSDL_FFINC_H
#include "libavutil/imgutils.h"
#include "libavutil/pixfmt.h"
#include "libavcodec/avcodec.h"
#include "libswscale/swscale.h"
...
...
ijkmediaplayer/jni/ijksdl/ffmpeg/ijksdl_vout_overlay_ffmpeg.c
浏览文件 @
891a40fa
...
...
@@ -105,18 +105,16 @@ static int overlay_unlock(SDL_VoutOverlay *overlay)
return
SDL_UnlockMutex
(
opaque
->
mutex
);
}
SDL_VoutOverlay
*
SDL_VoutCreateFFmpeg
YUVOverlay
(
int
width
,
int
height
,
Uint32
format
,
SDL_Vout
*
display
)
SDL_VoutOverlay
*
SDL_VoutCreateFFmpeg
Overlay
(
int
width
,
int
height
,
enum
AVPixelFormat
format
,
SDL_Vout
*
display
)
{
SDLTRACE
(
"SDL_VoutCreateFFmpeg
YUVOverlay(w=%d, h=%d, fmt=%.4s(0x%x
, dp=%p)"
,
width
,
height
,
(
const
char
*
)
&
format
,
format
,
display
);
SDLTRACE
(
"SDL_VoutCreateFFmpeg
Overlay(w=%d, h=%d, fmt=%s(0x%x)
, dp=%p)"
,
width
,
height
,
av_get_pix_fmt_name
(
format
),
(
int
)
format
,
display
);
SDL_VoutOverlay
*
overlay
=
SDL_VoutOverlay_CreateInternal
(
sizeof
(
SDL_VoutOverlay_Opaque
));
if
(
!
overlay
)
{
ALOGE
(
"SDL_VoutCreateFFmpeg
YUV
Overlay(...)=NULL"
);
ALOGE
(
"SDL_VoutCreateFFmpegOverlay(...)=NULL"
);
return
NULL
;
}
overlay
->
format
=
format
;
SDL_VoutOverlay_Opaque
*
opaque
=
overlay
->
opaque
;
overlay
->
format
=
format
;
overlay
->
pitches
=
opaque
->
pitches
;
...
...
@@ -124,47 +122,75 @@ SDL_VoutOverlay *SDL_VoutCreateFFmpegYUVOverlay(int width, int height, Uint32 fo
overlay
->
w
=
width
;
overlay
->
h
=
height
;
AVFrame
*
frame
=
NULL
;
AVPicture
*
pic
=
NULL
;
switch
(
format
)
{
case
SDL_YV12_OVERLAY
:
SDLTRACE
(
"SDL_VoutCreateFFmpegYUVOverlay(...): SDL_YV12_OVERLAY (swap UV)"
);
frame
=
alloc_avframe
(
opaque
,
AV_PIX_FMT_YUV420P
,
width
,
height
);
if
(
frame
)
{
overlay_fill
(
overlay
,
frame
,
format
,
3
);
/* swap U,V */
pic
=
(
AVPicture
*
)
frame
;
overlay
->
pixels
[
2
]
=
pic
->
data
[
1
];
overlay
->
pixels
[
1
]
=
pic
->
data
[
2
];
overlay
->
pitches
[
2
]
=
pic
->
linesize
[
1
];
overlay
->
pitches
[
1
]
=
pic
->
linesize
[
2
];
case
AV_PIX_FMT_YUV420P
:
opaque
->
frame
=
alloc_avframe
(
opaque
,
AV_PIX_FMT_YUV420P
,
width
,
height
);
if
(
opaque
->
frame
)
{
overlay_fill
(
overlay
,
opaque
->
frame
,
format
,
3
);
}
SDLTRACE
(
"SDL_VoutCreateFFmpegYUVOverlay(...): overlay(w=%d, h=%d, fmt=0x%x, planes=%d, pitches=%d,%d,%d)"
,
overlay
->
format
=
SDL_FCC_I420
;
break
;
default:
ALOGE
(
"SDL_VoutCreateFFmpegOverlay(...): unknown format"
);
overlay
->
format
=
SDL_FCC_UNDF
;
break
;
}
if
(
overlay
)
{
SDLTRACE
(
"SDL_VoutCreateFFmpegOverlay(...): overlay(w=%d, h=%d, fmt=%.4s(0x%x), planes=%d, pitches=%d,%d,%d)"
,
overlay
->
w
,
overlay
->
h
,
(
char
*
)
&
overlay
->
format
,
overlay
->
format
,
overlay
->
planes
,
overlay
->
pitches
[
0
],
overlay
->
pitches
[
1
],
overlay
->
pitches
[
2
]);
if
(
opaque
->
frame
)
{
opaque
->
mutex
=
SDL_CreateMutex
();
overlay
->
free_l
=
overlay_free_l
;
overlay
->
lock
=
overlay_lock
;
overlay
->
unlock
=
overlay_unlock
;
}
else
{
overlay_free_l
(
overlay
);
overlay
=
NULL
;
}
}
SDLTRACE
(
"SDL_VoutCreateFFmpegOverlay(...)=%p"
,
overlay
);
return
overlay
;
}
SDL_VoutOverlay
*
SDL_VoutCreateFFmpegYUVOverlay
(
int
width
,
int
height
,
Uint32
format
,
SDL_Vout
*
display
)
{
SDLTRACE
(
"SDL_VoutCreateFFmpegYUVOverlay(w=%d, h=%d, fmt=%.4s(0x%x, dp=%p)"
,
width
,
height
,
(
const
char
*
)
&
format
,
format
,
display
);
SDL_VoutOverlay
*
overlay
=
NULL
;
switch
(
format
)
{
case
SDL_FCC_YV12
:
{
overlay
=
SDL_VoutCreateFFmpegOverlay
(
width
,
height
,
AV_PIX_FMT_YUV420P
,
display
);
if
(
overlay
)
{
/* swap U,V */
FFSWAP
(
Uint8
*
,
overlay
->
pixels
[
1
],
overlay
->
pixels
[
2
]);
FFSWAP
(
Uint16
,
overlay
->
pitches
[
1
],
overlay
->
pitches
[
2
]);
overlay
->
format
=
SDL_FCC_YV12
;
}
break
;
}
case
SDL_FCC_RGBP
:
{
break
;
}
default:
ALOGE
(
"SDL_VoutCreateFFmpegYUVOverlay(...): unknown format"
);
break
;
}
if
(
frame
)
{
opaque
->
mutex
=
SDL_CreateMutex
();
overlay
->
free_l
=
overlay_free_l
;
overlay
->
lock
=
overlay_lock
;
overlay
->
unlock
=
overlay_unlock
;
}
else
{
overlay_free_l
(
overlay
);
overlay
=
NULL
;
if
(
!
overlay
)
{
ALOGE
(
"SDL_VoutCreateFFmpegYUVOverlay(...)=NULL"
);
}
SDLTRACE
(
"SDL_VoutCreateFFmpegYUVOverlay(...)=%p"
,
overlay
);
return
overlay
;
}
ijkmediaplayer/jni/ijksdl/ffmpeg/ijksdl_vout_overlay_ffmpeg.h
浏览文件 @
891a40fa
...
...
@@ -26,10 +26,11 @@
#include "../ijksdl_stdinc.h"
#include "../ijksdl_vout.h"
#include "ijksdl_inc_ffmpeg.h"
SDL_VoutOverlay
*
SDL_VoutCreateFFmpegOverlay
(
int
width
,
int
height
,
enum
AVPixelFormat
format
,
SDL_Vout
*
display
);
// TODO: 9 setup overlay stride to speed up memcpy
SDL_VoutOverlay
*
SDL_VoutCreateFFmpegYUVOverlay
(
int
width
,
int
height
,
Uint32
format
,
SDL_Vout
*
display
);
SDL_VoutOverlay
*
SDL_VoutCreateBestFFmpegYUVOverlay
(
int
width
,
int
height
,
Uint32
format
,
SDL_Vout
*
display
);
#endif
ijkmediaplayer/jni/ijksdl/ijksdl_fourcc.h
0 → 100644
浏览文件 @
891a40fa
/*****************************************************************************
* ijksdl_fourcc.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_FOURCC_H
#define IJKSDL__IJKSDL_FOURCC_H
#include "ijksdl_stdinc.h"
#include "ijksdl_endian.h"
#if SDL_BYTEORDER == SDL_LIL_ENDIAN
# define SDL_FOURCC(a, b, c, d) \
(((uint32_t)a) | (((uint32_t)b) << 8) | (((uint32_t)c) << 16) | (((uint32_t)d) << 24))
# define SDL_TWOCC(a, b) \
((uint16_t)(a) | ((uint16_t)(b) << 8))
#else
# define SDL_FOURCC(a, b, c, d) \
(((uint32_t)d) | (((uint32_t)c) << 8) | (((uint32_t)b) << 16) | (((uint32_t)a) << 24))
# define SDL_TWOCC( a, b ) \
((uint16_t)(b) | ((uint16_t)(a) << 8))
#endif
#if SDL_BYTEORDER == SDL_LIL_ENDIAN
# define SDL_FOURCC(a, b, c, d) \
(((uint32_t)a) | (((uint32_t)b) << 8) | (((uint32_t)c) << 16) | (((uint32_t)d) << 24))
# define SDL_TWOCC(a, b) \
((uint16_t)(a) | ((uint16_t)(b) << 8))
#else
# define SDL_FOURCC(a, b, c, d) \
(((uint32_t)d) | (((uint32_t)c) << 8) | (((uint32_t)b) << 16) | (((uint32_t)a) << 24))
# define SDL_TWOCC( a, b ) \
((uint16_t)(b) | ((uint16_t)(a) << 8))
#endif
/*-
* http://www.webartz.com/fourcc/indexyuv.htm
* http://www.neuro.sfc.keio.ac.jp/~aly/polygon/info/color-space-faq.html
* http://www.fourcc.org/yuv.php
*/
// YUV formats
#define SDL_FCC_YV12 SDL_FOURCC('Y', 'V', '1', '2')
/**< bpp=12, Planar mode: Y + V + U (3 planes) */
#define SDL_FCC_IYUV SDL_FOURCC('I', 'Y', 'U', 'V')
/**< bpp=12, Planar mode: Y + U + V (3 planes) */
#define SDL_FCC_I420 SDL_FOURCC('I', '4', '2', '0')
/**< bpp=12, Planar mode: Y + U + V (3 planes) */
#define SDL_FCC_YUV2 SDL_FOURCC('Y', 'U', 'V', '2')
/**< bpp=16, Packed mode: Y0+U0+Y1+V0 (1 plane) */
#define SDL_FCC_UYVY SDL_FOURCC('U', 'Y', 'V', 'Y')
/**< bpp=16, Packed mode: U0+Y0+V0+Y1 (1 plane) */
#define SDL_FCC_YVYU SDL_FOURCC('Y', 'V', 'Y', 'U')
/**< bpp=16, Packed mode: Y0+V0+Y1+U0 (1 plane) */
// RGB formats
#define SDL_FCC_RGBP SDL_FOURCC('R', 'G', 'B', 'P')
/**< RGB565, AV_PIX_FMT_RGB565LE */
// undefine
#define SDL_FCC_UNDF SDL_FOURCC('U', 'N', 'D', 'F')
/**< undefined */
#endif
ijkmediaplayer/jni/ijksdl/ijksdl_video.h
浏览文件 @
891a40fa
...
...
@@ -25,18 +25,6 @@
#define IJKSDL__IJKSDL_VIDEO_H
#include "ijksdl_stdinc.h"
/*-
* http://www.webartz.com/fourcc/indexyuv.htm
* http://www.neuro.sfc.keio.ac.jp/~aly/polygon/info/color-space-faq.html
* http://www.fourcc.org/yuv.php
*/
// bpp=12
#define SDL_YV12_OVERLAY 0x32315659
/**< Planar mode: Y + V + U (3 planes) */
#define SDL_IYUV_OVERLAY 0x56555949
/**< Planar mode: Y + U + V (3 planes) */
// bpp=16
#define SDL_YUY2_OVERLAY 0x32595559
/**< Packed mode: Y0+U0+Y1+V0 (1 plane) */
#define SDL_UYVY_OVERLAY 0x59565955
/**< Packed mode: U0+Y0+V0+Y1 (1 plane) */
#define SDL_YVYU_OVERLAY 0x55595659
/**< Packed mode: Y0+V0+Y1+U0 (1 plane) */
#include "ijksdl_fourcc.h"
#endif
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录