Skip to content

Commit

Permalink
3.0.009
Browse files Browse the repository at this point in the history
  • Loading branch information
yangrtc committed Feb 24, 2022
1 parent 38da75d commit 413467d
Show file tree
Hide file tree
Showing 505 changed files with 78,782 additions and 0 deletions.
33 changes: 33 additions & 0 deletions include/Yang_Config.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
//
// Copyright (c) 2019-2022 yanggaofeng
//

#ifndef INCLUDE_YANG_CONFIG_H_
#define INCLUDE_YANG_CONFIG_H_

#define Yang_HaveLibva 0
#define Yang_Have10bit 0

#define Yang_HaveVr 0
#define Yang_GPU_Encoding 0
#define Yang_H265_Encoding 1

#ifdef _WIN32
#define Yang_Using_H264Decoder 0
#define Yang_Using_H264Decoder_So 0
#define Yang_Ffmpeg_UsingSo 0
#else
#define Yang_Using_H264Decoder 1
#define Yang_Using_H264Decoder_So 1
#define Yang_Ffmpeg_UsingSo 1
#endif

//option lib
#define Yang_HavePicUtilFfmpeg 0
#define Yang_HaveWebsockets 1 //using libwebsockets
#define Yang_HaveCurl 0 //using libcurl
#define Yang_HaveJson 0 //using jsonlib

#define Yang_Using_TWCC 0

#endif /* INCLUDE_YANG_CONFIG_H_ */
44 changes: 44 additions & 0 deletions include/yangaudiodev/YangAudioCapture.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
//
// Copyright (c) 2019-2022 yanggaofeng
//
#ifndef YANGAUDIOCAPTURE_H
#define YANGAUDIOCAPTURE_H

#include <yangavutil/audio/YangRtcAec.h>
#include <yangavutil/audio/YangPreProcess.h>
#include <yangutil/yangavinfotype.h>
#include "yangutil/buffer/YangAudioPlayBuffer.h"
#include "yangutil/buffer/YangAudioBuffer.h"
#include <vector>
#include "yangutil/sys/YangThread.h"
#include "yangutil/sys/YangLog.h"
using namespace std;

class YangAudioCapture:public YangThread
{
public:
YangAudioCapture();
virtual ~YangAudioCapture();
public:

int32_t aIndex;
int32_t m_isStart;
virtual int32_t init()=0;
virtual void setCatureStart()=0;
virtual void setCatureStop()=0;
virtual void setOutAudioBuffer(YangAudioBuffer *pbuffer)=0;
virtual void setPlayAudoBuffer(YangAudioBuffer *pbuffer)=0;
virtual void setAec(YangRtcAec *paec)=0;
virtual void setInAudioBuffer(vector<YangAudioPlayBuffer*> *pbuffer)=0;
virtual void setPreProcess(YangPreProcess *pp)=0;

void stop();
protected:
void run();
YangContext *m_context;
virtual void startLoop()=0;
virtual void stopLoop()=0;

};

#endif // YANGAUDIOCAPTURE_H
35 changes: 35 additions & 0 deletions include/yangaudiodev/YangAudioCaptureData.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
//
// Copyright (c) 2019-2022 yanggaofeng
//
#ifndef YANGCAPTURE_WIN_API_YANGCAPTUREAUDIODATA_H_
#define YANGCAPTURE_WIN_API_YANGCAPTUREAUDIODATA_H_
#include <stdint.h>
#include <yangaudiodev/YangCaptureCallback.h>
#include <yangutil/yangavtype.h>
#include <yangavutil/audio/YangAudioUtil.h>
#include <yangavutil/audio/YangRtcAec.h>
#include <yangutil/buffer/YangAudioBuffer.h>
class YangAudioCaptureData {
public:
YangAudioCaptureData();
virtual ~YangAudioCaptureData();
void initIn(int psample,int pchannel);
void initOut(int psample,int pchannel);
void caputure(YangFrame* audioFrame);
int getOutLength();
YangCaptureCallback* m_cb;

private:
uint8_t* m_cache;
int m_cacheLen;
int m_size;
int m_pos;

private:
YangAudioResample m_res;
YangFrame m_audioFrame;

void captureData();
};

#endif /* YANGCAPTURE_WIN_API_YANGCAPTUREAUDIODATA_H_ */
31 changes: 31 additions & 0 deletions include/yangaudiodev/YangAudioDeviceQuery.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
//
// Copyright (c) 2019-2022 yanggaofeng
//
#ifndef INCLUDE_YANGAUDIODEV_YANGAUDIODEVICEQUERY_H_
#define INCLUDE_YANGAUDIODEV_YANGAUDIODEVICEQUERY_H_
#include <vector>
#include <string>

using namespace std;
struct YangAudioDeivce{
string name;
string deviceName;
string subName;
int32_t aIndex;
int32_t aSubIndex;
int32_t aIdx;
};
class YangAudioDeviceQuery {
public:
YangAudioDeviceQuery();
virtual ~YangAudioDeviceQuery();
vector<YangAudioDeivce>* getCaptureDeviceList();
vector<YangAudioDeivce>* getPlayDeviceList();
private:
vector<YangAudioDeivce> m_captureDeviceList;
vector<YangAudioDeivce> m_playDeviceList;
void getDeviceList(int32_t stream,vector<YangAudioDeivce>* plist);

};

#endif /* INCLUDE_YANGAUDIODEV_YANGAUDIODEVICEQUERY_H_ */
61 changes: 61 additions & 0 deletions include/yangaudiodev/YangAudioPlay.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
//
// Copyright (c) 2019-2022 yanggaofeng
//
#ifndef YangAudioPlay_H
#define YangAudioPlay_H

#include <yangaudiodev/YangAudioRenderData.h>
#include <yangavutil/audio/YangRtcAec.h>
#include <yangutil/yangavinfotype.h>
#include "yangutil/buffer/YangAudioPlayBuffer.h"
#include "yangutil/sys/YangIni.h"
#include "yangutil/sys/YangThread.h"
#define YangAudioBufferMaxNum 10

#include<algorithm>
#include <vector>

using namespace std;
//#define SIZE_AUDIO_FRAME 4096



class YangAudioPlay:public YangThread
{
public:
YangAudioPlay(YangContext* pcontext);
virtual ~YangAudioPlay();
public:

int32_t aIndex;
virtual int init()=0;
void setAudioBuffers(vector<YangAudioPlayBuffer*> *paudioList);
void setAudioBuffer(YangAudioPlayBuffer *paudioList);
void setAecBase(YangRtcAec* pace);
int32_t m_aecInit=0;
int32_t m_isStart;
void stop();
YangAudioRenderData m_audioData;
protected:
virtual void startLoop()=0;
virtual void stopLoop()=0;

void run();
YangContext *m_context;
YangRtcAec *m_ace;
//YangAudioMix mix;
int m_frames;
int m_channel;
int m_sample;




private:




};

#endif // YANGAUDIOCAPTURE_H
63 changes: 63 additions & 0 deletions include/yangaudiodev/YangAudioPlayerSdl.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
//
// Copyright (c) 2019-2022 yanggaofeng
//
#ifndef YANGPLAYER_INCLUDE_YANGAUDIOPLAYSDL1_H_
#define YANGPLAYER_INCLUDE_YANGAUDIOPLAYSDL1_H_

#include "yangutil/buffer/YangAudioPlayBuffer.h"
#include "yangutil/sys/YangIni.h"
#include "yangutil/sys/YangThread.h"
#include "yangutil/sys/YangLoadLib.h"
#include <SDL2/SDL.h>

class YangAudioPlayerSdl:public YangThread{
public:
YangAudioPlayerSdl(YangAudioInfo *pcontext);
~YangAudioPlayerSdl();
void init();
void* (*yang_SDL_memset)(SDL_OUT_BYTECAP(len) void *dst, int32_t c, size_t len);
void (*yang_SDL_MixAudio)(Uint8 * dst, const Uint8 * src, Uint32 len, int32_t volume);
void setAudioList(YangAudioPlayBuffer *pal);
int32_t m_isStart;
void stop();

int32_t m_frames;
int32_t m_channel;
int32_t m_sample;
static void fill_audio(void *udata, Uint8 *stream, int32_t len);
protected:
void startLoop();
void stopLoop();
void run();
// uint8_t *m_buffer[YangAudioBufferMaxNum];
private:
YangAudioInfo *m_context;
YangAudioPlayBuffer *m_in_audioBuffer;
static YangAudioPlayerSdl* m_instance;
int32_t isInit;

void closeAudio();
int32_t ret;
int32_t m_size;
int32_t m_loops;

SDL_AudioSpec wanted;
void playSDL(uint8_t *p_data);
void initSDL();
void startLoopSDL();
YangLoadLib m_lib,m_lib1;
void loadLib();
void unloadLib();
int32_t (*yang_SDL_Init)(Uint32 flags);
void (*yang_SDL_Delay)(Uint32 ms);

const char * (*yang_SDL_GetError)(void);

int32_t (*yang_SDL_OpenAudio)(SDL_AudioSpec * desired, SDL_AudioSpec * obtained);

void (*yang_SDL_PauseAudio)(int32_t pause_on);
void (*yang_SDL_CloseAudio)(void);

};

#endif /* YANGPLAYER_INCLUDE_YANGAUDIOPLAYSDL_H_ */
65 changes: 65 additions & 0 deletions include/yangaudiodev/YangAudioRenderData.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
//
// Copyright (c) 2019-2022 yanggaofeng
//

#ifndef INCLUDE_YANGCAPTURE_YANGRENDERAUDIODATA_H_
#define INCLUDE_YANGCAPTURE_YANGRENDERAUDIODATA_H_
#include <stdint.h>
#include <vector>
#include <yangutil/buffer/YangAudioPlayBuffer.h>
#include <yangavutil/audio/YangPreProcess.h>
#include <yangavutil/audio/YangAudioUtil.h>

#include <yangstream/YangSynBuffer.h>
using namespace std;

class YangAudioRenderData {
public:
YangAudioRenderData();
virtual ~YangAudioRenderData();

public:
vector<YangSynBuffer*> *m_in_audioBuffers;
YangSynBuffer* m_syn;
YangPreProcess* m_preProcess;
YangAudioResample m_res;
void setAec();
void setRenderLen(int plen);

void initRender(int psample,int pchannel);
void initPlay(int psample,int pchannel);
uint8_t* getAudioRef(YangFrame* pframe);
uint8_t* getRenderAudioData(int len);
uint8_t* getAecAudioData();
void setInAudioBuffer(YangSynBuffer *pal);
void setInAudioBuffers(vector<YangSynBuffer*> *pal);

private:
bool m_hasAec;
int m_aecBufLen;
int m_mixPos;
int m_renderLen;
uint8_t* m_aecBuf;


uint8_t* m_cache;
int m_cacheLen;
int m_size;
int m_pos;

uint8_t* m_mixBuf;

YangFrame m_audioFrame;

// YangAudioMix m_mix;

private:

uint8_t* getAudioData(YangFrame* frame);

void setAudioData(YangFrame* frame);
bool hasData();

};

#endif /* INCLUDE_YANGCAPTURE_YANGRENDERAUDIODATA_H_ */
22 changes: 22 additions & 0 deletions include/yangavutil/audio/YangAudioMix.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
//
// Copyright (c) 2019-2022 yanggaofeng
//

#ifndef YANGUTIL_AUDIO_YANGAUDIOMIX_H_
#define YANGUTIL_AUDIO_YANGAUDIOMIX_H_
#include <stdint.h>
#define SIZE_AUDIO_FRAME 4096
#ifdef __cplusplus
extern "C" {
#endif

void yang_mixaudio_mix1(short *dst, short *src, int32_t len1, int32_t volume);
void yang_mixaudio_mix2(uint8_t *dst, uint8_t *src,int32_t len,int32_t pvolume);
void yang_mixaudio_mix4(uint8_t *dst, uint8_t *src, int32_t len,int32_t pvolume) ;
void yang_mixaudio_mix3(uint8_t *dst, uint8_t *src, int32_t len,int32_t pvolume);
void yang_mixaudio_mix5(uint8_t *dst, uint8_t *src, int32_t len1,int32_t pvolume);

#ifdef __cplusplus
}
#endif
#endif /* YANGUTIL_AUDIO_YANGAUDIOMIX_H_ */
Loading

0 comments on commit 413467d

Please sign in to comment.