mirror of
https://github.com/hrydgard/ppsspp.git
synced 2024-11-23 13:30:02 +00:00
Cleanup SimpleAudioDec
and remove unused AudioCreate fonction, it can be down in the class constructor.
This commit is contained in:
parent
f5d4b7bcb4
commit
c03e591ecd
@ -286,7 +286,7 @@ bool MediaEngine::openContext() {
|
||||
return false;
|
||||
|
||||
setVideoDim();
|
||||
m_audioContext = AudioCreate(m_audioType);
|
||||
m_audioContext = new SimpleAudio(m_audioType);
|
||||
m_isVideoEnd = false;
|
||||
m_noAudioData = false;
|
||||
m_mpegheaderReadPos++;
|
||||
|
@ -60,12 +60,13 @@ bool SimpleAudio::GetAudioCodecID(int audioType){
|
||||
}
|
||||
|
||||
SimpleAudio::SimpleAudio(int audioType)
|
||||
: codec_(0),
|
||||
codecCtx_(0),
|
||||
swrCtx_(0) {
|
||||
SimpleAudio::audioType = audioType;
|
||||
: codec_(0), codecCtx_(0), swrCtx_(0), audioType(audioType){
|
||||
#ifdef USE_FFMPEG
|
||||
frame_ = av_frame_alloc();
|
||||
avcodec_register_all();
|
||||
av_register_all();
|
||||
InitFFmpeg();
|
||||
|
||||
frame_ = av_frame_alloc();
|
||||
|
||||
// Get Audio Codec ID
|
||||
if (!GetAudioCodecID(audioType)){
|
||||
@ -100,12 +101,12 @@ swrCtx_(0) {
|
||||
|
||||
|
||||
SimpleAudio::SimpleAudio(u32 ctxPtr, int audioType)
|
||||
: codec_(0),
|
||||
codecCtx_(0),
|
||||
swrCtx_(0) {
|
||||
SimpleAudio::ctxPtr = ctxPtr;
|
||||
SimpleAudio::audioType = audioType;
|
||||
: codec_(0), codecCtx_(0), swrCtx_(0), ctxPtr(ctxPtr), audioType(audioType){
|
||||
#ifdef USE_FFMPEG
|
||||
avcodec_register_all();
|
||||
av_register_all();
|
||||
InitFFmpeg();
|
||||
|
||||
frame_ = av_frame_alloc();
|
||||
|
||||
// Get Audio Codec ID
|
||||
@ -211,40 +212,6 @@ bool SimpleAudio::Decode(void* inbuf, int inbytes, uint8_t *outbuf, int *outbyte
|
||||
}
|
||||
|
||||
|
||||
SimpleAudio *AudioCreate(int audioType) {
|
||||
#ifdef USE_FFMPEG
|
||||
avcodec_register_all();
|
||||
av_register_all();
|
||||
InitFFmpeg();
|
||||
|
||||
SimpleAudio *Audio = new SimpleAudio(audioType);
|
||||
if (!Audio->IsOK()) {
|
||||
delete Audio;
|
||||
return 0;
|
||||
}
|
||||
return Audio;
|
||||
#else
|
||||
return 0;
|
||||
#endif // USE_FFMPEG
|
||||
}
|
||||
|
||||
SimpleAudio *AudioCreate(u32 ctxPtr, int audioType) {
|
||||
#ifdef USE_FFMPEG
|
||||
avcodec_register_all();
|
||||
av_register_all();
|
||||
InitFFmpeg();
|
||||
|
||||
SimpleAudio *Audio = new SimpleAudio(ctxPtr, audioType);
|
||||
if (!Audio->IsOK()) {
|
||||
delete Audio;
|
||||
return 0;
|
||||
}
|
||||
return Audio;
|
||||
#else
|
||||
return 0;
|
||||
#endif // USE_FFMPEG
|
||||
}
|
||||
|
||||
bool AudioDecode(SimpleAudio *ctx, void* inbuf, int inbytes, int *outbytes, uint8_t *outbuf) {
|
||||
#ifdef USE_FFMPEG
|
||||
return ctx->Decode(inbuf, inbytes, outbuf, outbytes);
|
||||
|
@ -79,8 +79,6 @@ static const char *const codecNames[4] = {
|
||||
"AT3+", "AT3", "MP3", "AAC",
|
||||
};
|
||||
|
||||
|
||||
SimpleAudio *AudioCreate(int audioType);
|
||||
bool AudioDecode(SimpleAudio *ctx, void* inbuf, int inbytes, int *outbytes, uint8_t* outbuf);
|
||||
void AudioClose(SimpleAudio **ctx);
|
||||
static const char *GetCodecName(int codec) {
|
||||
|
Loading…
Reference in New Issue
Block a user