代码拉取完成,页面将自动刷新
#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
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。