Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
Z
ZLMediaKit
概览
Overview
Details
Activity
Cycle Analytics
版本库
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
问题
0
Issues
0
列表
Board
标记
里程碑
合并请求
0
Merge Requests
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
Snippets
成员
Collapse sidebar
Close sidebar
活动
图像
聊天
创建新问题
作业
提交
Issue Boards
Open sidebar
张翔宇
ZLMediaKit
Commits
f7433b0f
Commit
f7433b0f
authored
Nov 21, 2020
by
xiongziliang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
头文件中隐藏不必要的宏,避免宏蔓延:#554
parent
408a678a
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
18 行增加
和
26 行删除
+18
-26
api/source/mk_media.cpp
+0
-4
src/Common/Device.cpp
+15
-4
src/Common/Device.h
+3
-18
没有找到文件。
api/source/mk_media.cpp
查看文件 @
f7433b0f
...
...
@@ -178,13 +178,9 @@ API_EXPORT void API_CALL mk_media_input_aac(mk_media ctx, void *data, int len, u
}
API_EXPORT
void
API_CALL
mk_media_input_pcm
(
mk_media
ctx
,
void
*
data
,
int
len
,
uint32_t
pts
){
#ifdef ENABLE_FAAC
assert
(
ctx
&&
data
&&
len
>
0
);
MediaHelper
::
Ptr
*
obj
=
(
MediaHelper
::
Ptr
*
)
ctx
;
(
*
obj
)
->
getChannel
()
->
inputPCM
((
char
*
)
data
,
len
,
pts
);
#else
WarnL
<<
"aac编码未启用,该方法无效,编译时请打开ENABLE_FAAC选项"
;
#endif //ENABLE_FAAC
}
API_EXPORT
void
API_CALL
mk_media_input_audio
(
mk_media
ctx
,
void
*
data
,
int
len
,
uint32_t
dts
){
...
...
src/Common/Device.cpp
查看文件 @
f7433b0f
...
...
@@ -16,6 +16,13 @@
#include "Extension/G711.h"
#include "Extension/H264.h"
#include "Extension/H265.h"
#ifdef ENABLE_FAAC
#include "Codec/AACEncoder.h"
#endif //ENABLE_FAAC
#ifdef ENABLE_X264
#include "Codec/H264Encoder.h"
#endif //ENABLE_X264
using
namespace
toolkit
;
namespace
mediakit
{
...
...
@@ -26,8 +33,8 @@ DevChannel::DevChannel(const string &vhost, const string &app, const string &str
DevChannel
::~
DevChannel
()
{}
#ifdef ENABLE_X264
void
DevChannel
::
inputYUV
(
char
*
apcYuv
[
3
],
int
aiYuvLen
[
3
],
uint32_t
uiStamp
)
{
#ifdef ENABLE_X264
//TimeTicker1(50);
if
(
!
_pH264Enc
)
{
_pH264Enc
.
reset
(
new
H264Encoder
());
...
...
@@ -43,11 +50,13 @@ void DevChannel::inputYUV(char* apcYuv[3], int aiYuvLen[3], uint32_t uiStamp) {
inputH264
((
char
*
)
pOut
[
i
].
pucData
,
pOut
[
i
].
iLength
,
uiStamp
);
}
}
}
#else
WarnL
<<
"h264编码未启用,该方法无效,编译时请打开ENABLE_X264选项"
;
#endif //ENABLE_X264
}
#ifdef ENABLE_FAAC
void
DevChannel
::
inputPCM
(
char
*
pcData
,
int
iDataLen
,
uint32_t
uiStamp
)
{
#ifdef ENABLE_FAAC
if
(
!
_pAacEnc
)
{
_pAacEnc
.
reset
(
new
AACEncoder
());
if
(
!
_pAacEnc
->
init
(
_audio
->
iSampleRate
,
_audio
->
iChannel
,
_audio
->
iSampleBit
))
{
...
...
@@ -62,8 +71,10 @@ void DevChannel::inputPCM(char* pcData, int iDataLen, uint32_t uiStamp) {
inputAAC
((
char
*
)
pucOut
+
7
,
iRet
-
7
,
uiStamp
,
(
char
*
)
pucOut
);
}
}
}
#else
WarnL
<<
"aac编码未启用,该方法无效,编译时请打开ENABLE_FAAC选项"
;
#endif //ENABLE_FAAC
}
void
DevChannel
::
inputH264
(
const
char
*
data
,
int
len
,
uint32_t
dts
,
uint32_t
pts
)
{
if
(
dts
==
0
){
...
...
src/Common/Device.h
查看文件 @
f7433b0f
...
...
@@ -20,16 +20,11 @@
using
namespace
std
;
using
namespace
toolkit
;
#ifdef ENABLE_FAAC
#include "Codec/AACEncoder.h"
#endif //ENABLE_FAAC
#ifdef ENABLE_X264
#include "Codec/H264Encoder.h"
#endif //ENABLE_X264
namespace
mediakit
{
class
H264Encoder
;
class
AACEncoder
;
class
VideoInfo
{
public
:
CodecId
codecId
=
CodecH264
;
...
...
@@ -107,7 +102,6 @@ public:
*/
void
inputAudio
(
const
char
*
data
,
int
len
,
uint32_t
dts
);
#ifdef ENABLE_X264
/**
* 输入yuv420p视频帧,内部会完成编码并调用inputH264方法
* @param apcYuv
...
...
@@ -115,9 +109,7 @@ public:
* @param uiStamp
*/
void
inputYUV
(
char
*
apcYuv
[
3
],
int
aiYuvLen
[
3
],
uint32_t
uiStamp
);
#endif //ENABLE_X264
#ifdef ENABLE_FAAC
/**
* 输入pcm数据,内部会完成编码并调用inputAAC方法
...
...
@@ -126,20 +118,13 @@ public:
* @param uiStamp
*/
void
inputPCM
(
char
*
pcData
,
int
iDataLen
,
uint32_t
uiStamp
);
#endif //ENABLE_FAAC
private
:
MediaOriginType
getOriginType
(
MediaSource
&
sender
)
const
override
;
private
:
#ifdef ENABLE_X264
std
::
shared_ptr
<
H264Encoder
>
_pH264Enc
;
#endif //ENABLE_X264
#ifdef ENABLE_FAAC
std
::
shared_ptr
<
AACEncoder
>
_pAacEnc
;
#endif //ENABLE_FAAC
std
::
shared_ptr
<
VideoInfo
>
_video
;
std
::
shared_ptr
<
AudioInfo
>
_audio
;
SmoothTicker
_aTicker
[
2
];
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论