|
|
@ -146,6 +146,9 @@ int FFAudioPlayer::getSampleRate() const { |
|
|
|
|
|
|
|
|
|
|
|
int FFAudioPlayer::decodeAudio() { |
|
|
|
int FFAudioPlayer::decodeAudio() { |
|
|
|
int ret; |
|
|
|
int ret; |
|
|
|
|
|
|
|
if (exitPlaying.load()) { |
|
|
|
|
|
|
|
return -1; |
|
|
|
|
|
|
|
} |
|
|
|
// demux: read a frame(should be demux thread)
|
|
|
|
// demux: read a frame(should be demux thread)
|
|
|
|
ret = av_read_frame(formatContext, packet); |
|
|
|
ret = av_read_frame(formatContext, packet); |
|
|
|
if (ret < 0) { |
|
|
|
if (ret < 0) { |
|
|
@ -209,7 +212,6 @@ int FFAudioPlayer::decodeAudio() { |
|
|
|
return buffer_size; |
|
|
|
return buffer_size; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
uint8_t *FFAudioPlayer::getDecodeFrame() const { |
|
|
|
uint8_t *FFAudioPlayer::getDecodeFrame() const { |
|
|
|
return out_buffer; |
|
|
|
return out_buffer; |
|
|
|
} |
|
|
|
} |
|
|
@ -222,6 +224,10 @@ void FFAudioPlayer::setFilterDesc(const char *filterDescription) { |
|
|
|
filterDesc = filterDescription; |
|
|
|
filterDesc = filterDescription; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void FFAudioPlayer::setExit(bool exit) { |
|
|
|
|
|
|
|
exitPlaying = exit; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void FFAudioPlayer::close() { |
|
|
|
void FFAudioPlayer::close() { |
|
|
|
if (formatContext) { |
|
|
|
if (formatContext) { |
|
|
|
avformat_close_input(&formatContext); |
|
|
|
avformat_close_input(&formatContext); |
|
|
|