mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2024-11-25 20:27:34 +08:00
修改接口
This commit is contained in:
parent
013109796d
commit
11e993d870
@ -122,7 +122,7 @@ int AudioPlayer::getPCMData(char *buf, int size) {
|
||||
return size;
|
||||
}
|
||||
|
||||
void AudioPlayer::inputFrame(const char *data, size_t size) {
|
||||
void AudioPlayer::playPCM(const char *data, size_t size) {
|
||||
lock_guard<mutex> lck(_mtx);
|
||||
_buffer.append(data, size);
|
||||
}
|
||||
|
@ -68,7 +68,7 @@ public:
|
||||
~AudioPlayer() override;
|
||||
|
||||
void setup(int sample_rate, int channel, SDL_AudioFormat format);
|
||||
void inputFrame(const char *data, size_t size);
|
||||
void playPCM(const char *data, size_t size);
|
||||
|
||||
private:
|
||||
SDL_AudioFormat getPCMFormat() override;
|
||||
|
@ -98,7 +98,7 @@ int main(int argc, char *argv[]) {
|
||||
//FFmpeg解码时已经统一转换为16位整型pcm
|
||||
audio_player->setup(audioTrack->getAudioSampleRate(), audioTrack->getAudioChannel(), AUDIO_S16);
|
||||
decoder->setOnDecode([audio_player](const FFmpegFrame::Ptr &pcm) {
|
||||
audio_player->inputFrame((const char *) (pcm->get()->data[0]), pcm->get()->linesize[0]);
|
||||
audio_player->playPCM((const char *) (pcm->get()->data[0]), pcm->get()->linesize[0]);
|
||||
});
|
||||
auto audio_delegate = std::make_shared<FrameWriterInterfaceHelper>( [decoder](const Frame::Ptr &frame) {
|
||||
decoder->inputFrame(frame);
|
||||
|
Loading…
Reference in New Issue
Block a user