1 Star 0 Fork 0

Xin/weplayer_xin

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
CAudioDevs.h 1.56 KB
一键复制 编辑 原始数据 按行查看 历史
zhangxin 提交于 2022-03-29 17:46 . 初次提交
#ifndef __AUDIO_DEVS_H__
#define __AUDIO_DEVS_H__
#include <stdio.h>
#include <time.h>
#ifdef AV_OS_WIN32
#include <Windows.h>
#else
#include <pthread.h>
#include <unistd.h>
#endif
#include <inttypes.h>
#include "portaudio.h"
extern "C"
{
#include "libavcodec/avcodec.h"
#include "libavformat/avformat.h"
#include <libavutil/channel_layout.h>
#include <libswresample/swresample.h>
}
class PlaybackDev
{
public:
PlaybackDev();
~PlaybackDev();
int IsDeviceSupportFmt(int device, int channel, int samplerate);
#ifdef AV_OS_WIN32
static DWORD WINAPI Thread_Playback(LPVOID p);
#else
static void* Thread_Playback(void* p);
#endif
void SetOutputFormat(int channels, int samplerate);
void SetMaxDelayMs (int value);
int PlayStart(int DiviceIdx, int channels, int samplerate);
int PlayStop();
int PushData(unsigned char * pData, int FrameCnt);
int Pause();
int Resume();
int Flush();
private:
int openAudioDev(PaStream **stream);
int closeAudioDev(PaStream *stream);
int pushPlayData(unsigned char * pData, int size);
private:
int m_DevIdx;
int m_channels;
int m_samplerate;
struct SwrContext *m_AudConvertCtx;
unsigned char* m_TmpBuf;
unsigned char* m_AudioBuf;
int m_AudioBufMax;
int m_AudioBufAvail;
#ifdef AV_OS_WIN32
CRITICAL_SECTION m_lock;
HANDLE m_Task;
#else
pthread_mutex_t m_lock;
pthread_t m_Task;
#endif
int TaskLoop;
int m_IsPaused;
int m_outChannel;
int m_outSampleRate;
//最大缓存音频先关参数, 1000/m_maxCacheFactor = x (ms)
int m_maxCacheInMs;
};
#endif
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/xindev/weplayer_xin.git
git@gitee.com:xindev/weplayer_xin.git
xindev
weplayer_xin
weplayer_xin
main

搜索帮助