Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
NotesChapter
ijkplayer
提交
0ce7757b
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,发现更多精彩内容 >>
提交
0ce7757b
编写于
6月 07, 2013
作者:
Z
Zhang Rui
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
jni: ffplay: introduce more code
上级
3c2b2988
变更
9
展开全部
隐藏空白更改
内联
并排
Showing
9 changed file
with
1273 addition
and
28 deletion
+1273
-28
ijkmediaplayer/jni/ijkplayer/Android.mk
ijkmediaplayer/jni/ijkplayer/Android.mk
+4
-1
ijkmediaplayer/jni/ijkplayer/ffplay_cmdutils.c
ijkmediaplayer/jni/ijkplayer/ffplay_cmdutils.c
+130
-0
ijkmediaplayer/jni/ijkplayer/ffplay_cmdutils.h
ijkmediaplayer/jni/ijkplayer/ffplay_cmdutils.h
+35
-0
ijkmediaplayer/jni/ijkplayer/ffplay_def.h
ijkmediaplayer/jni/ijkplayer/ffplay_def.h
+15
-13
ijkmediaplayer/jni/ijkplayer/ffplay_pkt_queue.h
ijkmediaplayer/jni/ijkplayer/ffplay_pkt_queue.h
+1
-1
ijkmediaplayer/jni/ijkplayer/ffplay_read_thread.c
ijkmediaplayer/jni/ijkplayer/ffplay_read_thread.c
+998
-0
ijkmediaplayer/jni/ijkplayer/ffplay_subtitle_thread.c
ijkmediaplayer/jni/ijkplayer/ffplay_subtitle_thread.c
+29
-0
ijkmediaplayer/jni/ijkplayer/ffplay_video_thread.c
ijkmediaplayer/jni/ijkplayer/ffplay_video_thread.c
+29
-0
ijkmediaplayer/jni/ijkplayer/ffplayer.h
ijkmediaplayer/jni/ijkplayer/ffplayer.h
+32
-13
未找到文件。
ijkmediaplayer/jni/ijkplayer/Android.mk
浏览文件 @
0ce7757b
...
...
@@ -26,9 +26,12 @@ LOCAL_C_INCLUDES += $(LOCAL_PATH)
LOCAL_C_INCLUDES
+=
$(MY_APP_FFMPEG_INCLUDE_PATH)
LOCAL_C_INCLUDES
+=
$(MY_APP_JNI_ROOT)
LOCAL_SRC_FILES
+=
ffplay_cmdutils.c
LOCAL_SRC_FILES
+=
ffplay_pkt_queue.c
LOCAL_SRC_FILES
+=
ffplay_read_thread.c
LOCAL_SRC_FILES
+=
ffplay_subtitle_thread.c
LOCAL_SRC_FILES
+=
ffplay_video_thread.c
LOCAL_SRC_FILES
+=
ffplayer.c
LOCAL_SRC_FILES
+=
thread_demux.c
LOCAL_SRC_FILES
+=
ijkplayer.c
LOCAL_SRC_FILES
+=
ijkplayer_jni.c
...
...
ijkmediaplayer/jni/ijkplayer/ffplay_cmdutils.c
0 → 100644
浏览文件 @
0ce7757b
/*****************************************************************************
* ffplay_cmdutils.c
*****************************************************************************
*
* copyright (c) 2001 Fabrice Bellard
* 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 "ffplay_cmdutils.h"
#include <libavutil/opt.h>
/* cmdutils.c 942 */
void
print_error
(
const
char
*
filename
,
int
err
)
{
char
errbuf
[
128
];
const
char
*
errbuf_ptr
=
errbuf
;
if
(
av_strerror
(
err
,
errbuf
,
sizeof
(
errbuf
))
<
0
)
errbuf_ptr
=
strerror
(
AVUNERROR
(
err
));
av_log
(
NULL
,
AV_LOG_ERROR
,
"%s: %s
\n
"
,
filename
,
errbuf_ptr
);
}
/* cmdutils.c 942 */
/* cmdutils.c 1731 */
static
int
check_stream_specifier
(
AVFormatContext
*
s
,
AVStream
*
st
,
const
char
*
spec
)
{
int
ret
=
avformat_match_stream_specifier
(
s
,
st
,
spec
);
if
(
ret
<
0
)
av_log
(
s
,
AV_LOG_ERROR
,
"Invalid stream specifier: %s.
\n
"
,
spec
);
return
ret
;
}
/* cmdutils.c 1731 */
/* cmdutils.c 1739 */
AVDictionary
*
filter_codec_opts
(
AVDictionary
*
opts
,
enum
AVCodecID
codec_id
,
AVFormatContext
*
s
,
AVStream
*
st
,
AVCodec
*
codec
)
{
AVDictionary
*
ret
=
NULL
;
AVDictionaryEntry
*
t
=
NULL
;
int
flags
=
s
->
oformat
?
AV_OPT_FLAG_ENCODING_PARAM
:
AV_OPT_FLAG_DECODING_PARAM
;
char
prefix
=
0
;
const
AVClass
*
cc
=
avcodec_get_class
();
if
(
!
codec
)
codec
=
s
->
oformat
?
avcodec_find_encoder
(
codec_id
)
:
avcodec_find_decoder
(
codec_id
);
switch
(
st
->
codec
->
codec_type
)
{
case
AVMEDIA_TYPE_VIDEO
:
prefix
=
'v'
;
flags
|=
AV_OPT_FLAG_VIDEO_PARAM
;
break
;
case
AVMEDIA_TYPE_AUDIO
:
prefix
=
'a'
;
flags
|=
AV_OPT_FLAG_AUDIO_PARAM
;
break
;
case
AVMEDIA_TYPE_SUBTITLE
:
prefix
=
's'
;
flags
|=
AV_OPT_FLAG_SUBTITLE_PARAM
;
break
;
default:
break
;
}
while
((
t
=
av_dict_get
(
opts
,
""
,
t
,
AV_DICT_IGNORE_SUFFIX
)))
{
char
*
p
=
strchr
(
t
->
key
,
':'
);
/* check stream specification in opt name */
if
(
p
)
switch
(
check_stream_specifier
(
s
,
st
,
p
+
1
))
{
case
1
:
*
p
=
0
;
break
;
case
0
:
continue
;
default:
return
NULL
;
}
if
(
av_opt_find
(
&
cc
,
t
->
key
,
NULL
,
flags
,
AV_OPT_SEARCH_FAKE_OBJ
)
||
(
codec
&&
codec
->
priv_class
&&
av_opt_find
(
&
codec
->
priv_class
,
t
->
key
,
NULL
,
flags
,
AV_OPT_SEARCH_FAKE_OBJ
)))
av_dict_set
(
&
ret
,
t
->
key
,
t
->
value
,
0
);
else
if
(
t
->
key
[
0
]
==
prefix
&&
av_opt_find
(
&
cc
,
t
->
key
+
1
,
NULL
,
flags
,
AV_OPT_SEARCH_FAKE_OBJ
))
av_dict_set
(
&
ret
,
t
->
key
+
1
,
t
->
value
,
0
);
if
(
p
)
*
p
=
':'
;
}
return
ret
;
}
/* cmdutils.c 1739 */
/* cmdutils.c 1795 */
AVDictionary
**
setup_find_stream_info_opts
(
AVFormatContext
*
s
,
AVDictionary
*
codec_opts
)
{
int
i
;
AVDictionary
**
opts
;
if
(
!
s
->
nb_streams
)
return
NULL
;
opts
=
av_mallocz
(
s
->
nb_streams
*
sizeof
(
*
opts
));
if
(
!
opts
)
{
av_log
(
NULL
,
AV_LOG_ERROR
,
"Could not alloc memory for stream options.
\n
"
);
return
NULL
;
}
for
(
i
=
0
;
i
<
s
->
nb_streams
;
i
++
)
opts
[
i
]
=
filter_codec_opts
(
codec_opts
,
s
->
streams
[
i
]
->
codec
->
codec_id
,
s
,
s
->
streams
[
i
],
NULL
);
return
opts
;
}
/* cmdutils.c 1795 */
ijkmediaplayer/jni/ijkplayer/ffplay_cmdutils.h
0 → 100644
浏览文件 @
0ce7757b
/*****************************************************************************
* ffplay_cmdutils.h
*****************************************************************************
*
* copyright (c) 2001 Fabrice Bellard
* 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 IJKPLAYER__FFPLAY_CMDUTILS_H
#define IJKPLAYER__FFPLAY_CMDUTILS_H
#include <libavformat/avformat.h>
void
print_error
(
const
char
*
filename
,
int
err
);
AVDictionary
**
setup_find_stream_info_opts
(
AVFormatContext
*
s
,
AVDictionary
*
codec_opts
);
AVDictionary
*
filter_codec_opts
(
AVDictionary
*
opts
,
enum
AVCodecID
codec_id
,
AVFormatContext
*
s
,
AVStream
*
st
,
AVCodec
*
codec
);
#endif
ijkmediaplayer/jni/ijkplayer/ffplay_def.h
浏览文件 @
0ce7757b
...
...
@@ -26,8 +26,12 @@
#define IJKPLAYER__FFPLAY_DEF_H
#include <inttypes.h>
#include "libavformat/avformat.h"
#include "libavcodec/avfft.h"
#include "libswresample/swresample.h"
#include "ijksdl/ijksdl.h"
#include "ffplay_pkt_queue.h"
#include "ffplay_cmdutils.h"
#ifdef CONFIG_AVFILTER
#undef CONFIG_AVFILTER
...
...
@@ -44,10 +48,10 @@
/* no AV sync correction is done if below the AV sync threshold */
// #define AV_SYNC_THRESHOLD 0.01
/* no AV correction is done if too big error */
//
#define AV_NOSYNC_THRESHOLD 10.0
#define AV_NOSYNC_THRESHOLD 10.0
/* maximum audio speed change to get correct sync */
//
#define SAMPLE_CORRECTION_PERCENT_MAX 10
#define SAMPLE_CORRECTION_PERCENT_MAX 10
/* external clock speed adjustment constants for realtime sources based on buffer fullness */
// #define EXTERNAL_CLOCK_SPEED_MIN 0.900
...
...
@@ -55,7 +59,7 @@
// #define EXTERNAL_CLOCK_SPEED_STEP 0.001
/* we use about AUDIO_DIFF_AVG_NB A-V differences to make the average */
//
#define AUDIO_DIFF_AVG_NB 20
#define AUDIO_DIFF_AVG_NB 20
/* polls for possible required screen refresh at least this often, should be less than 1/fps */
// #define REFRESH_RATE 0.01
...
...
@@ -167,9 +171,9 @@ typedef struct VideoState {
int16_t
sample_array
[
SAMPLE_ARRAY_SIZE
];
int
sample_array_index
;
int
last_i_start
;
//
RDFTContext *rdft;
RDFTContext
*
rdft
;
int
rdft_bits
;
//
FFTSample *rdft_data;
FFTSample
*
rdft_data
;
int
xpos
;
double
last_vis_time
;
...
...
@@ -223,13 +227,8 @@ typedef struct VideoState {
SDL_cond
*
continue_read_thread
;
}
VideoState
;
/* PLACEHOLD: options variables has been moved to ffplayer.h */
/* current context */
// static int is_full_screen;
// static int64_t audio_callback_time;
// static AVPacket flush_pkt;
/* PLACEHOLD: options has been moved to ffplayer.h */
/* PLACEHOLD: current context has been moved to ffplayer.h */
/* PLACEHOLD: flush_pkt has been moved to pkt_queue.c */
#define FF_ALLOC_EVENT (SDL_USEREVENT)
...
...
@@ -237,6 +236,9 @@ typedef struct VideoState {
// static SDL_Surface *screen;
void
print_error
(
const
char
*
filename
,
int
err
);
/* extra forward declaration */
int
ijkff_read_thread
(
void
*
arg
);
int
ijkff_video_thread
(
void
*
arg
);
int
ijkff_subtitle_thread
(
void
*
arg
);
#endif
ijkmediaplayer/jni/ijkplayer/ffplay_pkt_queue.h
浏览文件 @
0ce7757b
...
...
@@ -25,7 +25,7 @@
#ifndef IJKPLAYER__FFPLAY_PKT_QUEUE_H
#define IJKPLAYER__FFPLAY_PKT_QUEUE_H
#include <ijksdl/ijksdl_
thread
.h>
#include <ijksdl/ijksdl_
mutex
.h>
#include <libavformat/avformat.h>
typedef
struct
MyAVPacketList
{
...
...
ijkmediaplayer/jni/ijkplayer/
thread_demux
.c
→
ijkmediaplayer/jni/ijkplayer/
ffplay_read_thread
.c
浏览文件 @
0ce7757b
此差异已折叠。
点击以展开。
ijkmediaplayer/jni/ijkplayer/ffplay_subtitle_thread.c
0 → 100644
浏览文件 @
0ce7757b
/*****************************************************************************
* ffplay_subtitle_thread.c
*****************************************************************************
*
* copyright (c) 2001 Fabrice Bellard
* 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
*/
int
ijkff_subtitle_thread
(
void
*
arg
)
{
// FIXME: implement
return
0
;
}
ijkmediaplayer/jni/ijkplayer/ffplay_video_thread.c
0 → 100644
浏览文件 @
0ce7757b
/*****************************************************************************
* ffplay_video_thread.c
*****************************************************************************
*
* copyright (c) 2001 Fabrice Bellard
* 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
*/
int
ijkff_video_thread
(
void
*
arg
)
{
// FIXME: implement
return
0
;
}
ijkmediaplayer/jni/ijkplayer/ffplayer.h
浏览文件 @
0ce7757b
...
...
@@ -58,15 +58,15 @@ typedef struct FFPlayer {
// int av_sync_type = AV_SYNC_AUDIO_MASTER;
int64_t
start_time
;
int64_t
duration
;
// int workaround_bugs = 1
;
// int fast = 0
;
int
workaround_bugs
;
int
fast
;
int
genpts
;
// int lowres = 0
;
// int idct = FF_IDCT_AUTO
;
// enum AVDiscard skip_frame = AVDISCARD_DEFAULT
;
// enum AVDiscard skip_idct = AVDISCARD_DEFAULT
;
// enum AVDiscard skip_loop_filter = AVDISCARD_DEFAULT
;
// int error_concealment = 3
;
int
lowres
;
int
idct
;
enum
AVDiscard
skip_frame
;
enum
AVDiscard
skip_idct
;
enum
AVDiscard
skip_loop_filter
;
int
error_concealment
;
// int decoder_reorder_pts = -1;
int
autoexit
;
// int exit_on_keydown;
...
...
@@ -75,9 +75,9 @@ typedef struct FFPlayer {
// int framedrop = -1;
int
infinite_buffer
;
enum
ShowMode
show_mode
;
// const char
*audio_codec_name;
// const char
*subtitle_codec_name;
// const char
*video_codec_name;
char
*
audio_codec_name
;
char
*
subtitle_codec_name
;
char
*
video_codec_name
;
// double rdftspeed = 0.02;
// int64_t cursor_last_shown;
// int cursor_hidden = 0;
...
...
@@ -85,10 +85,16 @@ typedef struct FFPlayer {
// char *vfilters = NULL;
#endif
/* current context */
//static int is_full_screen;
int64_t
audio_callback_time
;
/* callback */
int
(
*
decode_interrupt_cb
)(
void
*
ctx
);
}
FFPlayer
;
#define IJKFF_SAFE_FREE(p) do {free(p); p = NULL;} while(0)
inline
static
void
ijkff_reset
(
FFPlayer
*
ffp
)
{
/* FIXME: ffplay context reset */
...
...
@@ -98,8 +104,7 @@ inline static void ijkff_reset(FFPlayer *ffp)
av_dict_free
(
&
ffp
->
codec_opts
);
/* ffplay options specified by the user */
free
(
ffp
->
input_filename
);
ffp
->
input_filename
=
NULL
;
IJKFF_SAFE_FREE
(
ffp
->
input_filename
);
ffp
->
audio_disable
=
0
;
ffp
->
video_disable
=
0
;
ffp
->
subtitle_disable
=
0
;
...
...
@@ -110,11 +115,25 @@ inline static void ijkff_reset(FFPlayer *ffp)
ffp
->
show_status
=
1
;
ffp
->
start_time
=
AV_NOPTS_VALUE
;
ffp
->
duration
=
AV_NOPTS_VALUE
;
ffp
->
workaround_bugs
=
1
;
ffp
->
fast
=
0
;
ffp
->
genpts
=
0
;
ffp
->
lowres
=
0
;
ffp
->
idct
=
FF_IDCT_AUTO
;
ffp
->
skip_frame
=
AVDISCARD_DEFAULT
;
ffp
->
skip_idct
=
AVDISCARD_DEFAULT
;
ffp
->
skip_loop_filter
=
AVDISCARD_DEFAULT
;
ffp
->
error_concealment
=
3
;
ffp
->
autoexit
=
0
;
ffp
->
loop
=
1
;
ffp
->
infinite_buffer
=
-
1
;
ffp
->
show_mode
=
SHOW_MODE_NONE
;
IJKFF_SAFE_FREE
(
ffp
->
audio_codec_name
);
IJKFF_SAFE_FREE
(
ffp
->
subtitle_codec_name
);
IJKFF_SAFE_FREE
(
ffp
->
video_codec_name
);
/* current context */
ffp
->
audio_callback_time
=
0
;
/* callback */
ffp
->
decode_interrupt_cb
=
NULL
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录