mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2024-11-25 04:08:57 +08:00
头文件中隐藏不必要的宏,避免宏蔓延:#554
This commit is contained in:
parent
408a678ade
commit
f7433b0f90
@ -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){
|
||||
|
@ -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){
|
||||
|
@ -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];
|
||||
|
Loading…
Reference in New Issue
Block a user