Skip to content

Commit

Permalink
6.0.004
Browse files Browse the repository at this point in the history
  • Loading branch information
yangrtc committed Sep 4, 2022
1 parent c2d811c commit 3854696
Show file tree
Hide file tree
Showing 411 changed files with 43,680 additions and 0 deletions.
58 changes: 58 additions & 0 deletions include/yang_config.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
//
// Copyright (c) 2019-2022 yanggaofeng
//

#ifndef INCLUDE_YANG_CONFIG_H_
#define INCLUDE_YANG_CONFIG_H_

#define Yang_Enable_Datachannel 1
#define Yang_Enable_Openh264 1

#if _WIN32
#define Yang_Enable_Openssl 1
#else
#define Yang_Enable_Openssl 0
#endif

#define Yang_Enable_Embbed 1
#define Yang_Enable_10bit 0
#define Yang_Enable_GPU_Encoding 0
#define Yang_Enable_H265_Encoding 1

#ifdef _WIN32
#define Yang_Enable_H264Decoder 0
#define Yang_Enable_H264Decoder_So 1
#define Yang_Enable_FfmpegSo 0
#else
#define Yang_Enable_H264Decoder 1
#ifndef __ANDROID__
#define Yang_Enable_H264Decoder_So 1
#else
#define Yang_Enable_H264Decoder_So 0
#endif
#define Yang_Enable_FfmpegSo 1
#endif



#define Yang_Enable_Vr 0

#define Yang_Enable_Dtls 1 //default:using dtls


#define Yang_Enable_Timer_Phtread 0
#define Yang_Enable_Ffmpeg_Codec 1

//option lib
#define Yang_Enable_PicUtilFfmpeg 0
#define Yang_Enable_Websockets 1 //using libwebsockets
#define Yang_Enable_Curl 0 //using libcurl
#define Yang_Enable_Json 0 //using jsonlib


#define Yang_Enable_TWCC 0
#define Yang_Enable_RtcpXr 0
#define Yang_Rtp_I_Withmeta 0
#define Yang_CTimer_Epoll_Timeout 200

#endif /* INCLUDE_YANG_CONFIG_H_ */
38 changes: 38 additions & 0 deletions include/yangandroid/MetaPlayer.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
//
// Copyright (c) 2019-2022 yanggaofeng
//

#ifndef YUVPLAYER_YUVPLAYER_H
#define YUVPLAYER_YUVPLAYER_H


#include <pthread.h>
#include <unistd.h>
#include <yangutil/sys/YangYuvGl.h>
#include "YangPlayerAndroid.h"
class MetaPlayer {
public:
MetaPlayer(YangContext* pcontext);
~MetaPlayer();
void init(ANativeWindow* pwindows);
int32_t startPlayer(std::string url);
void stopPlayer();

void startPlayerTask();
YangYuvGl* m_gl;
private:
void adjustVideoScaleResolution();//调整缩放后的视频宽高
YangPlayerAndroid* m_player;
bool m_isloop;
pthread_t m_pid_player;
int32_t m_video_width;
int32_t m_video_height;

int32_t scale_video_width;//视频宽需要是8(2的3次幂)的倍数,否则视频错乱,绿条等等
int32_t scale_video_height;//视频高最好是2的倍数

bool m_isSoftdecoder;
};


#endif //YUVPLAYER_YUVPLAYER_H
37 changes: 37 additions & 0 deletions include/yangandroid/YangPlayerAndroid.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
//
// Copyright (c) 2019-2022 yanggaofeng
//


#ifndef SRC_YANGANDROID_YANGPLAYERANDROID_H_
#define SRC_YANGANDROID_YANGPLAYERANDROID_H_
#include <yangplayer/YangPlayerHandle.h>
#include <yangstream/YangStreamType.h>
#include <yangutil/yangavinfotype.h>
#include <yangutil/sys/YangSysMessageI.h>
#include <stdint.h>
#include <string>

class YangPlayerAndroid :public YangSysMessageI{
public:
YangPlayerAndroid(YangContext* pcontext);
virtual ~YangPlayerAndroid();
int32_t startPlay(std::string url);
int32_t stopPlay();
uint8_t* getVideoRef(int64_t* timestamp);
void success();
void failure(int32_t errcode);

int32_t getWidth();
int32_t getHeight();
bool m_isStartplay;
private:
YangPlayerHandle *m_player;
YangContext* m_context;

int32_t m_localPort;
YangFrame m_audioFrame,m_videoFrame;

};

#endif /* SRC_YANGANDROID_YANGPLAYERANDROID_H_ */
29 changes: 29 additions & 0 deletions include/yangandroid/YangPushAndroid.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
//
// Copyright (c) 2019-2022 yanggaofeng
//

#ifndef SRC_YANGPUSHANDROID_H_
#define SRC_YANGPUSHANDROID_H_
#include <yangstream/YangStreamType.h>
#include <yangutil/yangavinfotype.h>
#include <yangpush/YangPushHandle.h>
class YangPushAndroid:public YangSysMessageI {
public:
YangPushAndroid(YangContext* pcontext,void* pwindow);
virtual ~YangPushAndroid();
int32_t startPush(std::string url);
int32_t stopPush();
void startCamera();
YangContext* m_context;
void success();
void failure(int32_t errcode);
private:
YangPushHandle* m_push;

bool m_isStartplay;
int32_t m_localPort;
YangFrame m_audioFrame,m_videoFrame;

};

#endif /* SRC_YANGPUSHANDROID_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_ */
49 changes: 49 additions & 0 deletions include/yangaudiodev/YangAudioPlay.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
//
// 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;

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;
int m_frames;
int m_channel;
int m_sample;

};

#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();

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_ */
Loading

0 comments on commit 3854696

Please sign in to comment.