Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
NotesChapter
ijkplayer
提交
cbafaf43
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,发现更多精彩内容 >>
提交
cbafaf43
编写于
6月 17, 2013
作者:
Z
Zhang Rui
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
ijkplayer: alloc ffp->is in stream_open()
上级
9d7bd3b4
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
50 addition
and
31 deletion
+50
-31
ijkmediaplayer/jni/ijkplayer/ff_ffinc.h
ijkmediaplayer/jni/ijkplayer/ff_ffinc.h
+1
-0
ijkmediaplayer/jni/ijkplayer/ff_ffplay.c
ijkmediaplayer/jni/ijkplayer/ff_ffplay.c
+44
-27
ijkmediaplayer/jni/ijkplayer/ff_ffplay_def.h
ijkmediaplayer/jni/ijkplayer/ff_ffplay_def.h
+2
-2
ijkmediaplayer/jni/ijkplayer/ijkerror.h
ijkmediaplayer/jni/ijkplayer/ijkerror.h
+1
-0
ijkmediaplayer/jni/ijkplayer/ijkplayer.c
ijkmediaplayer/jni/ijkplayer/ijkplayer.c
+2
-2
未找到文件。
ijkmediaplayer/jni/ijkplayer/ff_ffinc.h
浏览文件 @
cbafaf43
...
...
@@ -25,6 +25,7 @@
#define IJKPLAYER__FF_FFINC_H
#include <stdbool.h>
#include <assert.h>
#include "libavutil/avstring.h"
#include "libavutil/colorspace.h"
#include "libavformat/avformat.h"
...
...
ijkmediaplayer/jni/ijkplayer/ff_ffplay.c
浏览文件 @
cbafaf43
...
...
@@ -403,7 +403,7 @@ static void free_subpicture(SubPicture *sp)
static
void
video_image_display
(
FFPlayer
*
ffp
)
{
VideoState
*
is
=
&
ffp
->
is
;
VideoState
*
is
=
ffp
->
is
;
VideoPicture
*
vp
;
SubPicture
*
sp
;
AVPicture
pict
;
...
...
@@ -457,9 +457,8 @@ static void video_image_display(FFPlayer *ffp)
// MERGE: compute_mod
// MERGE: video_audio_display
static
void
stream_close
(
FFPlayer
*
ffp
)
static
void
stream_close
(
VideoState
*
is
)
{
VideoState
*
is
=
&
ffp
->
is
;
VideoPicture
*
vp
;
int
i
;
/* XXX: use a special url_shutdown call to abort parse cleanly */
...
...
@@ -496,7 +495,7 @@ static void stream_close(FFPlayer *ffp)
static
int
video_open
(
FFPlayer
*
ffp
,
int
force_set_video_mode
,
VideoPicture
*
vp
)
{
VideoState
*
is
=
&
ffp
->
is
;
VideoState
*
is
=
ffp
->
is
;
int
flags
=
SDL_HWSURFACE
|
SDL_ASYNCBLIT
|
SDL_HWACCEL
;
int
w
,
h
;
...
...
@@ -752,7 +751,7 @@ static void update_video_pts(VideoState *is, double pts, int64_t pos, int serial
static
void
video_refresh
(
FFPlayer
*
opaque
,
double
*
remaining_time
)
{
FFPlayer
*
ffp
=
opaque
;
VideoState
*
is
=
&
ffp
->
is
;
VideoState
*
is
=
ffp
->
is
;
VideoPicture
*
vp
;
double
time
;
...
...
@@ -925,7 +924,7 @@ display:
potential locking problems */
static
void
alloc_picture
(
FFPlayer
*
ffp
)
{
VideoState
*
is
=
&
ffp
->
is
;
VideoState
*
is
=
ffp
->
is
;
VideoPicture
*
vp
;
vp
=
&
is
->
pictq
[
is
->
pictq_windex
];
...
...
@@ -982,7 +981,7 @@ static void duplicate_right_border_pixels(SDL_VoutOverlay *bmp) {
static
int
queue_picture
(
FFPlayer
*
ffp
,
AVFrame
*
src_frame
,
double
pts
,
int64_t
pos
,
int
serial
)
{
VideoState
*
is
=
&
ffp
->
is
;
VideoState
*
is
=
ffp
->
is
;
VideoPicture
*
vp
;
#if defined(DEBUG_SYNC) && 0
...
...
@@ -1101,7 +1100,7 @@ static int queue_picture(FFPlayer *ffp, AVFrame *src_frame, double pts, int64_t
static
int
get_video_frame
(
FFPlayer
*
ffp
,
AVFrame
*
frame
,
int64_t
*
pts
,
AVPacket
*
pkt
,
int
*
serial
)
{
VideoState
*
is
=
&
ffp
->
is
;
VideoState
*
is
=
ffp
->
is
;
int
got_picture
;
if
(
packet_queue_get
(
&
is
->
videoq
,
pkt
,
1
,
serial
)
<
0
)
...
...
@@ -1267,7 +1266,7 @@ static int video_thread(void *arg)
{
AVPacket
pkt
=
{
0
};
FFPlayer
*
ffp
=
arg
;
VideoState
*
is
=
&
ffp
->
is
;
VideoState
*
is
=
ffp
->
is
;
AVFrame
*
frame
=
avcodec_alloc_frame
();
int64_t
pts_int
=
AV_NOPTS_VALUE
;
#if CONFIG_AVFILTER
...
...
@@ -1711,7 +1710,7 @@ static int audio_decode_frame(VideoState *is)
static
void
sdl_audio_callback
(
void
*
opaque
,
Uint8
*
stream
,
int
len
)
{
FFPlayer
*
ffp
=
opaque
;
VideoState
*
is
=
&
ffp
->
is
;
VideoState
*
is
=
ffp
->
is
;
int
audio_size
,
len1
;
int
bytes_per_sec
;
int
frame_size
=
av_samples_get_buffer_size
(
NULL
,
is
->
audio_tgt
.
channels
,
1
,
is
->
audio_tgt
.
fmt
,
1
);
...
...
@@ -1806,7 +1805,7 @@ static int audio_open(FFPlayer *opaque, int64_t wanted_channel_layout, int wante
/* open a given stream. Return 0 if OK */
static
int
stream_component_open
(
FFPlayer
*
ffp
,
int
stream_index
)
{
VideoState
*
is
=
&
ffp
->
is
;
VideoState
*
is
=
ffp
->
is
;
AVFormatContext
*
ic
=
is
->
ic
;
AVCodecContext
*
avctx
;
AVCodec
*
codec
;
...
...
@@ -2023,7 +2022,7 @@ static int is_realtime(AVFormatContext *s)
static
int
read_thread
(
void
*
arg
)
{
FFPlayer
*
ffp
=
arg
;
VideoState
*
is
=
&
ffp
->
is
;
VideoState
*
is
=
ffp
->
is
;
AVFormatContext
*
ic
=
NULL
;
int
err
,
i
,
ret
;
int
st_index
[
AVMEDIA_TYPE_NB
];
...
...
@@ -2305,8 +2304,10 @@ static int read_thread(void *arg)
static
VideoState
*
stream_open
(
FFPlayer
*
ffp
,
const
char
*
filename
,
AVInputFormat
*
iformat
)
{
VideoState
*
is
=
&
ffp
->
is
;
assert
(
!
ffp
->
is
);
VideoState
*
is
=
av_mallocz
(
sizeof
(
VideoState
));
if
(
!
is
)
return
NULL
;
av_strlcpy
(
is
->
filename
,
filename
,
sizeof
(
is
->
filename
));
is
->
iformat
=
iformat
;
is
->
ytop
=
0
;
...
...
@@ -2361,7 +2362,7 @@ static VideoState *stream_open(FFPlayer *ffp, const char *filename, AVInputForma
// MERGE: show_usage
// MERGE: show_help_default
static
void
video_refresh_thread
(
FFPlayer
*
ffp
)
{
VideoState
*
is
=
&
ffp
->
is
;
VideoState
*
is
=
ffp
->
is
;
double
remaining_time
=
0
.
0
;
while
(
is
->
abort_request
)
{
if
(
remaining_time
>
0
.
0
)
...
...
@@ -2440,7 +2441,6 @@ void ijkff_global_init()
/* test link begin */
FFPlayer
*
ffp
=
malloc
(
sizeof
(
FFPlayer
));
stream_open
(
ffp
,
NULL
,
NULL
);
stream_close
(
ffp
);
video_refresh_thread
(
ffp
);
alloc_picture
(
NULL
);
/* test link end */
...
...
@@ -2451,11 +2451,6 @@ void ijkff_global_uninit()
if
(
!
g_ffmpeg_global_inited
)
return
;
/* test link begin */
FFPlayer
*
ffp
=
NULL
;
stream_close
(
ffp
);
/* test link end */
av_lockmgr_register
(
NULL
);
#if CONFIG_AVFILTER
...
...
@@ -2474,6 +2469,12 @@ void ijkff_destroy_ffplayer(FFPlayer **pffp)
return
;
FFPlayer
*
ffp
=
*
pffp
;
if
(
ffp
&&
ffp
->
is
)
{
av_log
(
NULL
,
AV_LOG_WARNING
,
"ijkff_destroy_ffplayer: force stream_close()"
);
stream_close
(
ffp
->
is
);
ffp
->
is
=
NULL
;
}
ijkff_reset
(
ffp
);
free
(
ffp
);
*
pffp
=
NULL
;
...
...
@@ -2482,20 +2483,26 @@ void ijkff_destroy_ffplayer(FFPlayer **pffp)
int
ijkff_stream_open_l
(
FFPlayer
*
ffp
,
const
char
*
file_name
)
{
assert
(
ffp
);
assert
(
!
ffp
->
is
);
assert
(
file_name
);
assert
(
!
ffp
->
is
.
read_tid
);
VideoState
*
is
=
stream_open
(
ffp
,
file_name
,
NULL
);
if
(
!
is
)
if
(
!
is
)
{
av_log
(
NULL
,
AV_LOG_WARNING
,
"ijkff_stream_open_l: stream_open failed OOM"
);
return
EIJK_OUT_OF_MEMORY
;
}
ffp
->
is
=
is
;
return
0
;
}
int
ijkff_start_l
(
FFPlayer
*
ffp
)
{
assert
(
ffp
);
VideoState
*
is
=
&
ffp
->
is
;
VideoState
*
is
=
ffp
->
is
;
if
(
!
is
)
return
EIJK_NULL_IS_PTR
;
if
(
is
->
paused
)
{
is
->
frame_timer
+=
av_gettime
()
/
1000000
.
0
+
is
->
video_current_pts_drift
-
is
->
video_current_pts
;
if
(
is
->
read_pause_return
!=
AVERROR
(
ENOSYS
))
{
...
...
@@ -2511,7 +2518,10 @@ int ijkff_start_l(FFPlayer *ffp)
int
ijkff_pause_l
(
FFPlayer
*
ffp
)
{
assert
(
ffp
);
VideoState
*
is
=
&
ffp
->
is
;
VideoState
*
is
=
ffp
->
is
;
if
(
!
is
)
return
EIJK_NULL_IS_PTR
;
update_external_clock_pts
(
is
,
get_external_clock
(
is
));
is
->
paused
=
1
;
return
0
;
...
...
@@ -2520,7 +2530,10 @@ int ijkff_pause_l(FFPlayer *ffp)
int
ijkff_stop_l
(
FFPlayer
*
ffp
)
{
assert
(
ffp
);
VideoState
*
is
=
&
ffp
->
is
;
VideoState
*
is
=
ffp
->
is
;
if
(
!
is
)
return
EIJK_NULL_IS_PTR
;
is
->
abort_request
=
1
;
return
0
;
}
...
...
@@ -2528,7 +2541,11 @@ int ijkff_stop_l(FFPlayer *ffp)
int
ijkff_wait_stop
(
FFPlayer
*
ffp
)
{
assert
(
ffp
);
VideoState
*
is
=
&
ffp
->
is
;
VideoState
*
is
=
ffp
->
is
;
if
(
!
is
)
return
EIJK_NULL_IS_PTR
;
stream_close
(
is
);
ffp
->
is
=
NULL
;
return
0
;
}
ijkmediaplayer/jni/ijkplayer/ff_ffplay_def.h
浏览文件 @
cbafaf43
...
...
@@ -312,7 +312,7 @@ static SDL_Surface *screen;
/* ffplayer */
typedef
struct
FFPlayer
{
/* ffplay context */
VideoState
is
;
VideoState
*
is
;
/* format/codec options */
AVDictionary
*
format_opts
;
...
...
@@ -409,7 +409,7 @@ typedef struct FFPlayer {
inline
static
void
ijkff_reset
(
FFPlayer
*
ffp
)
{
/*
FIXME: reset ffp->is
*/
/*
ffp->is closed in stream_close()
*/
/* format/codec options */
av_dict_free
(
&
ffp
->
format_opts
);
...
...
ijkmediaplayer/jni/ijkplayer/ijkerror.h
浏览文件 @
cbafaf43
...
...
@@ -27,5 +27,6 @@
#define EIJK_FAILED -1
#define EIJK_OUT_OF_MEMORY -2
#define EIJK_INVALID_STATE -3
#define EIJK_NULL_IS_PTR -4
#endif
ijkmediaplayer/jni/ijkplayer/ijkplayer.c
浏览文件 @
cbafaf43
...
...
@@ -176,7 +176,7 @@ static int ijkmp_prepare_async_l(IjkMediaPlayer *mp)
assert
(
mp
->
data_source
);
mp
->
mp_state
=
MP_STATE_ASYNC_PREPARING
;
int
retval
=
ijkff_stream_open
(
mp
->
ffplayer
,
mp
->
data_source
);
int
retval
=
ijkff_stream_open
_l
(
mp
->
ffplayer
,
mp
->
data_source
);
if
(
retval
<
0
)
{
mp
->
mp_state
=
MP_STATE_ERROR
;
return
retval
;
...
...
@@ -299,7 +299,7 @@ int ijkmp_stop(IjkMediaPlayer *mp)
pthread_mutex_unlock
(
&
mp
->
mutex
);
if
(
retval
==
0
)
ijkff_wait_stop
(
mp
);
ijkff_wait_stop
(
mp
->
ffplayer
);
return
retval
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录