Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
e8fed1a4
提交
e8fed1a4
authored
5月 21, 2015
作者:
Anthony Minessale
提交者:
Michael Jerris
5月 28, 2015
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
FS-7519: merge mod_avcodec and mod_avformat into mod_av
上级
3a8c6c38
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
9 个修改的文件
包含
60 行增加
和
2197 行删除
+60
-2197
configure.ac
configure.ac
+0
-2
Makefile.am
src/mod/applications/mod_av/Makefile.am
+13
-4
avcodec.c
src/mod/applications/mod_av/avcodec.c
+9
-401
avformat.c
src/mod/applications/mod_av/avformat.c
+7
-156
mod_av.c
src/mod/applications/mod_av/mod_av.c
+31
-1585
Makefile.am
src/mod/codecs/mod_avcodec/Makefile.am
+0
-18
Makefile.sample
src/mod/codecs/mod_avcodec/Makefile.sample
+0
-7
Makefile.am
src/mod/formats/mod_avformat/Makefile.am
+0
-18
Makefile.sample
src/mod/formats/mod_avformat/Makefile.sample
+0
-6
没有找到文件。
configure.ac
浏览文件 @
e8fed1a4
...
...
@@ -1701,7 +1701,6 @@ AC_CONFIG_FILES([Makefile
src/mod/asr_tts/mod_unimrcp/Makefile
src/mod/codecs/mod_amr/Makefile
src/mod/codecs/mod_amrwb/Makefile
src/mod/codecs/mod_avcodec/Makefile
src/mod/codecs/mod_b64/Makefile
src/mod/codecs/mod_bv/Makefile
src/mod/codecs/mod_codec2/Makefile
...
...
@@ -1757,7 +1756,6 @@ AC_CONFIG_FILES([Makefile
src/mod/event_handlers/mod_rayo/Makefile
src/mod/event_handlers/mod_snmp/Makefile
src/mod/event_handlers/mod_event_zmq/Makefile
src/mod/formats/mod_avformat/Makefile
src/mod/formats/mod_imagick/Makefile
src/mod/formats/mod_local_stream/Makefile
src/mod/formats/mod_native_file/Makefile
...
...
src/mod/applications/mod_av/Makefile.am
浏览文件 @
e8fed1a4
include
$(top_srcdir)/build/modmake.rulesam
MODNAME
=
mod_av
if
HAVE_AVFORMAT
mod_LTLIBRARIES
=
mod_av.la
mod_av_la_SOURCES
=
mod_av.c
mod_av_la_CFLAGS
=
$(AM_CFLAGS)
mod_av_la_LIBADD
=
$(switch_builddir)
/libfreeswitch.la
mod_av_la_LDFLAGS
=
-avoid-version
-module
-no-undefined
-shared
-lavformat
-lavcodec
-lavutil
-lswresample
-lx264
mod_av_la_SOURCES
=
mod_av.c avformat.c avcodec.c
mod_av_la_CFLAGS
=
$(AM_CFLAGS)
$(AVFORMAT_CFLAGS)
$(AVCODEC_CFLAGS)
$(SWSCALE_CFLAGS)
$(AVUTIL_CFLAGS)
$(AVRESAMPLE_CFALGS)
mod_av_la_LIBADD
=
$(switch_builddir)
/libfreeswitch.la
$(AVFORMAT_LIBS)
$(AVCODEC_LIBS)
$(SWSCALE_LIBS)
$(AVUTIL_LIBS)
$(AVRESAMPLE_LIBS)
mod_av_la_LDFLAGS
=
-avoid-version
-module
-no-undefined
-shared
-lm
-lz
else
install
:
error
all
:
error
error
:
$
(
error You must
install
libavformat-dev to build mod_av
)
endif
src/mod/
codecs/mod_avcodec/mod_
avcodec.c
→
src/mod/
applications/mod_av/
avcodec.c
浏览文件 @
e8fed1a4
差异被折叠。
点击展开。
src/mod/
formats/mod_avformat/mod_
avformat.c
→
src/mod/
applications/mod_av/
avformat.c
浏览文件 @
e8fed1a4
...
...
@@ -24,8 +24,9 @@
* Contributor(s):
*
* Seven Du <dujinfang@gmail.com>
* Anthony Minessale <anthm@freeswitch.org>
*
* mod_avformat -- F
S Video File Format using
libav.org
* mod_avformat -- F
ile Formats with
libav.org
*
*/
...
...
@@ -36,7 +37,6 @@
#include <libavutil/imgutils.h>
#include <libavutil/avstring.h>
#include <libavutil/channel_layout.h>
// #include <libavutil/timestamp.h>
#include <libavresample/avresample.h>
#include <libswscale/swscale.h>
...
...
@@ -44,7 +44,6 @@
#define DFT_RECORD_OFFSET 350
SWITCH_MODULE_LOAD_FUNCTION
(
mod_avformat_load
);
SWITCH_MODULE_DEFINITION
(
mod_avformat
,
mod_avformat_load
,
NULL
,
NULL
);
static
char
*
const
get_error_text
(
const
int
error
)
{
...
...
@@ -906,74 +905,9 @@ SWITCH_STANDARD_APP(record_av_function)
/* API interface */
static
char
get_media_type_char
(
enum
AVMediaType
type
)
{
switch
(
type
)
{
case
AVMEDIA_TYPE_VIDEO
:
return
'V'
;
case
AVMEDIA_TYPE_AUDIO
:
return
'A'
;
case
AVMEDIA_TYPE_DATA
:
return
'D'
;
case
AVMEDIA_TYPE_SUBTITLE
:
return
'S'
;
case
AVMEDIA_TYPE_ATTACHMENT
:
return
'T'
;
default
:
return
'?'
;
}
}
static
const
AVCodec
*
next_codec_for_id
(
enum
AVCodecID
id
,
const
AVCodec
*
prev
,
int
encoder
)
{
while
((
prev
=
av_codec_next
(
prev
)))
{
if
(
prev
->
id
==
id
&&
(
encoder
?
av_codec_is_encoder
(
prev
)
:
av_codec_is_decoder
(
prev
)))
return
prev
;
}
return
NULL
;
}
static
int
compare_codec_desc
(
const
void
*
a
,
const
void
*
b
)
{
const
AVCodecDescriptor
*
const
*
da
=
a
;
const
AVCodecDescriptor
*
const
*
db
=
b
;
return
(
*
da
)
->
type
!=
(
*
db
)
->
type
?
(
*
da
)
->
type
-
(
*
db
)
->
type
:
strcmp
((
*
da
)
->
name
,
(
*
db
)
->
name
);
}
static
unsigned
get_codecs_sorted
(
const
AVCodecDescriptor
***
rcodecs
)
{
const
AVCodecDescriptor
*
desc
=
NULL
;
const
AVCodecDescriptor
**
codecs
;
unsigned
nb_codecs
=
0
,
i
=
0
;
while
((
desc
=
avcodec_descriptor_next
(
desc
)))
nb_codecs
++
;
if
(
!
(
codecs
=
av_malloc
(
nb_codecs
*
sizeof
(
*
codecs
))))
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"MEM Error!
\n
"
);
return
0
;
}
desc
=
NULL
;
while
((
desc
=
avcodec_descriptor_next
(
desc
)))
codecs
[
i
++
]
=
desc
;
switch_assert
(
i
==
nb_codecs
);
qsort
(
codecs
,
nb_codecs
,
sizeof
(
*
codecs
),
compare_codec_desc
);
*
rcodecs
=
codecs
;
return
nb_codecs
;
}
static
void
print_codecs_for_id
(
switch_stream_handle_t
*
stream
,
enum
AVCodecID
id
,
int
encoder
)
{
const
AVCodec
*
codec
=
NULL
;
stream
->
write_function
(
stream
,
" (%s: "
,
encoder
?
"encoders"
:
"decoders"
);
while
((
codec
=
next_codec_for_id
(
id
,
codec
,
encoder
)))
stream
->
write_function
(
stream
,
"%s "
,
codec
->
name
);
stream
->
write_function
(
stream
,
")"
);
}
static
int
is_device
(
const
AVClass
*
avclass
)
{
#if
0
#if
defined (AV_CLASS_CATEGORY_DEVICE_VIDEO_OUTPUT)
if
(
!
avclass
)
return
0
;
...
...
@@ -1046,59 +980,7 @@ void show_formats(switch_stream_handle_t *stream) {
}
void
show_codecs
(
switch_stream_handle_t
*
stream
)
{
const
AVCodecDescriptor
**
codecs
=
NULL
;
unsigned
i
,
nb_codecs
=
get_codecs_sorted
(
&
codecs
);
stream
->
write_function
(
stream
,
"================ Codecs ===============================:
\n
"
" V..... = Video
\n
"
" A..... = Audio
\n
"
" S..... = Subtitle
\n
"
" .F.... = Frame-level multithreading
\n
"
" ..S... = Slice-level multithreading
\n
"
" ...X.. = Codec is experimental
\n
"
" ....B. = Supports draw_horiz_band
\n
"
" .....D = Supports direct rendering method 1
\n
"
" ----------------------------------------------
\n\n
"
);
for
(
i
=
0
;
i
<
nb_codecs
;
i
++
)
{
const
AVCodecDescriptor
*
desc
=
codecs
[
i
];
const
AVCodec
*
codec
=
NULL
;
stream
->
write_function
(
stream
,
" "
);
stream
->
write_function
(
stream
,
avcodec_find_decoder
(
desc
->
id
)
?
"D"
:
"."
);
stream
->
write_function
(
stream
,
avcodec_find_encoder
(
desc
->
id
)
?
"E"
:
"."
);
stream
->
write_function
(
stream
,
"%c"
,
get_media_type_char
(
desc
->
type
));
stream
->
write_function
(
stream
,
(
desc
->
props
&
AV_CODEC_PROP_INTRA_ONLY
)
?
"I"
:
"."
);
stream
->
write_function
(
stream
,
(
desc
->
props
&
AV_CODEC_PROP_LOSSY
)
?
"L"
:
"."
);
stream
->
write_function
(
stream
,
(
desc
->
props
&
AV_CODEC_PROP_LOSSLESS
)
?
"S"
:
"."
);
stream
->
write_function
(
stream
,
" %-20s %s"
,
desc
->
name
,
desc
->
long_name
?
desc
->
long_name
:
""
);
/* print decoders/encoders when there's more than one or their
* names are different from codec name */
while
((
codec
=
next_codec_for_id
(
desc
->
id
,
codec
,
0
)))
{
if
(
strcmp
(
codec
->
name
,
desc
->
name
))
{
print_codecs_for_id
(
stream
,
desc
->
id
,
0
);
break
;
}
}
codec
=
NULL
;
while
((
codec
=
next_codec_for_id
(
desc
->
id
,
codec
,
1
)))
{
if
(
strcmp
(
codec
->
name
,
desc
->
name
))
{
print_codecs_for_id
(
stream
,
desc
->
id
,
1
);
break
;
}
}
stream
->
write_function
(
stream
,
"
\n
"
);
}
av_free
(
codecs
);
}
void
show_codecs
(
switch_stream_handle_t
*
stream
);
SWITCH_STANDARD_API
(
av_format_api_function
)
{
...
...
@@ -1119,29 +1001,6 @@ SWITCH_STANDARD_API(av_format_api_function)
return
SWITCH_STATUS_SUCCESS
;
}
static
void
log_callback
(
void
*
ptr
,
int
level
,
const
char
*
fmt
,
va_list
vl
)
{
switch_log_level_t
switch_level
=
SWITCH_LOG_DEBUG
;
/* naggy messages */
if
(
level
==
AV_LOG_DEBUG
||
level
==
AV_LOG_WARNING
)
return
;
switch
(
level
)
{
case
AV_LOG_QUIET
:
switch_level
=
SWITCH_LOG_CONSOLE
;
break
;
case
AV_LOG_PANIC
:
switch_level
=
SWITCH_LOG_DEBUG2
;
break
;
case
AV_LOG_FATAL
:
switch_level
=
SWITCH_LOG_DEBUG2
;
break
;
case
AV_LOG_ERROR
:
switch_level
=
SWITCH_LOG_DEBUG2
;
break
;
case
AV_LOG_WARNING
:
switch_level
=
SWITCH_LOG_WARNING
;
break
;
case
AV_LOG_INFO
:
switch_level
=
SWITCH_LOG_INFO
;
break
;
case
AV_LOG_VERBOSE
:
switch_level
=
SWITCH_LOG_INFO
;
break
;
case
AV_LOG_DEBUG
:
switch_level
=
SWITCH_LOG_DEBUG
;
break
;
default
:
break
;
}
// switch_level = SWITCH_LOG_ERROR; // hardcoded for debug
switch_log_vprintf
(
SWITCH_CHANNEL_LOG_CLEAN
,
switch_level
,
fmt
,
vl
);
}
/* file interface */
struct
av_file_context
{
...
...
@@ -1438,7 +1297,7 @@ static void *SWITCH_THREAD_FUNC file_read_thread_run(switch_thread_t *thread, vo
// }
}
else
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_WARNING
,
"this block is not tested samples: %d
\n
"
,
in_frame
.
nb_samples
);
//
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "this block is not tested samples: %d\n", in_frame.nb_samples);
switch_mutex_lock
(
context
->
mutex
);
switch_buffer_write
(
context
->
audio_buffer
,
in_frame
.
data
[
0
],
in_frame
.
nb_samples
*
2
*
context
->
audio_st
.
channels
);
switch_mutex_unlock
(
context
->
mutex
);
...
...
@@ -2031,9 +1890,10 @@ static switch_status_t av_file_get_string(switch_file_handle_t *handle, switch_a
return
SWITCH_STATUS_FALSE
;
}
static
char
*
supported_formats
[
SWITCH_MAX_CODECS
]
=
{
0
};
static
const
char
modname
[]
=
"mod_av"
;
SWITCH_MODULE_LOAD_FUNCTION
(
mod_avformat_load
)
{
switch_api_interface_t
*
api_interface
;
...
...
@@ -2046,8 +1906,6 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_avformat_load)
supported_formats
[
i
++
]
=
"mp4"
;
supported_formats
[
i
++
]
=
"mov"
;
/* connect my internal structure to the blank pointer passed to me */
*
module_interface
=
switch_loadable_module_create_module_interface
(
pool
,
modname
);
file_interface
=
(
switch_file_interface_t
*
)
switch_loadable_module_create_interface
(
*
module_interface
,
SWITCH_FILE_INTERFACE
);
file_interface
->
interface_name
=
modname
;
...
...
@@ -2067,13 +1925,6 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_avformat_load)
SWITCH_ADD_APP
(
app_interface
,
"record_av"
,
"record video using libavformat"
,
"record video using libavformat"
,
record_av_function
,
"<file>"
,
SAF_NONE
);
av_log_set_callback
(
log_callback
);
av_log_set_level
(
AV_LOG_INFO
);
avformat_network_init
();
av_register_all
();
av_log
(
NULL
,
AV_LOG_INFO
,
"%s %d
\n
"
,
"av_log callback installed, level="
,
av_log_get_level
());
/* indicate that the module should continue to be loaded */
return
SWITCH_STATUS_SUCCESS
;
}
...
...
src/mod/applications/mod_av/mod_av.c
浏览文件 @
e8fed1a4
差异被折叠。
点击展开。
src/mod/codecs/mod_avcodec/Makefile.am
deleted
100644 → 0
浏览文件 @
3a8c6c38
include
$(top_srcdir)/build/modmake.rulesam
MODNAME
=
mod_avcodec
if
HAVE_AVCODEC
mod_LTLIBRARIES
=
mod_avcodec.la
mod_avcodec_la_SOURCES
=
mod_avcodec.c
mod_avcodec_la_CFLAGS
=
$(AM_CFLAGS)
$(AVCODEC_CFLAGS)
$(AVUTIL_CFLAGS)
$(X264_CFLAGS)
mod_avcodec_la_LIBADD
=
$(switch_builddir)
/libfreeswitch.la
$(AVCODEC_LIBS)
$(AVFORMAT_LIBS)
$(AVUTIL_LIBS)
$(X264_LIBS)
mod_avcodec_la_LDFLAGS
=
-avoid-version
-module
-no-undefined
-shared
-lm
-lz
else
install
:
error
all
:
error
error
:
$
(
error You must
install
libavcodec-dev to build mod_avcodec
)
endif
src/mod/codecs/mod_avcodec/Makefile.sample
deleted
100644 → 0
浏览文件 @
3a8c6c38
LOCAL_LDFLAGS
=
-L
/opt/av/lib
-lavformat
-lavcodec
-lavutil
-lavresample
-lx264
LOCAL_CFLAGS
=
-I
/opt/av/include
LOCAL_LIBADD
=
BASE
=
../../../..
include
$(BASE)/build/modmake.rules
src/mod/formats/mod_avformat/Makefile.am
deleted
100644 → 0
浏览文件 @
3a8c6c38
include
$(top_srcdir)/build/modmake.rulesam
MODNAME
=
mod_avformat
if
HAVE_AVFORMAT
mod_LTLIBRARIES
=
mod_avformat.la
mod_avformat_la_SOURCES
=
mod_avformat.c
mod_avformat_la_CFLAGS
=
$(AM_CFLAGS)
$(AVFORMAT_CFLAGS)
$(AVCODEC_CFLAGS)
$(SWSCALE_CFLAGS)
$(AVUTIL_CFLAGS)
$(AVRESAMPLE_CFALGS)
mod_avformat_la_LIBADD
=
$(switch_builddir)
/libfreeswitch.la
$(AVFORMAT_LIBS)
$(AVCODEC_LIBS)
$(SWSCALE_LIBS)
$(AVUTIL_LIBS)
$(AVRESAMPLE_LIBS)
mod_avformat_la_LDFLAGS
=
-avoid-version
-module
-no-undefined
-shared
-lm
-lz
else
install
:
error
all
:
error
error
:
$
(
error You must
install
libavformat-dev to build mod_avformat
)
endif
src/mod/formats/mod_avformat/Makefile.sample
deleted
100644 → 0
浏览文件 @
3a8c6c38
LOCAL_LDFLAGS
=
-L
/opt/av/lib
-lavformat
-lavcodec
-lavutil
-lavresample
-lswscale
LOCAL_CFLAGS
=
-I
/opt/av/include
LOCAL_LIBADD
=
BASE
=
../../../..
include
$(BASE)/build/modmake.rules
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论