参考资料:
FFmpeg和SDL2播放mp4_sdl 播放mp4 声音-优快云博客
SimplePlayer/SimplePlayer.c at master · David1840/SimplePlayer · GitHub
在前面的学习中,通过获得的AVFrame进行了播放画面,
播放音频原理类似,也是获取AVFrame的信息,
extern "C" {
#include <libavutil/log.h>
#include <libavformat/avformat.h>
#include <libavcodec/avcodec.h>
#include <libavformat/avformat.h>
#include <libswresample/swresample.h>
}
// Simplest FFmpeg Sync Player.cpp : 定义控制台应用程序的入口点。
//
#include <stdio.h>
#include <SDL_types.h>
#include "SDL.h"
static Uint8* audio_chunk;
static Uint32 audio_len;
static Uint8* audio_pos;
#define MAX_AUDIO_FRAM