[讀書心得] ffmpeg tutorial (三) Playing sound
這集主要是介紹透過 SDL 播放 sound. Audio - (1) 由一連串 streams 所組成, 每個 stream 又稱為一個 sample, 表示 audio waveform. (2) 如何撥放 audio 是由 sampling rate 決定, 表示每秒播放 N samples. Ex. 22050 for radio, 44100 for CD. (3) multichannels for stereo or surround (4) 當我們得到 video 的部份 data 時, 會得到一個完整的 samples. 也就是說: 我們無法預期得到的 sample 數, 但 ffmpeg 也不會將 samples 分成數段. SDL 播放 audio 的做法為: 10 Audio information Setup, including sampling rate (named frequency in SDL), number of channels, callback function, userdata, etc. 20 Call callback function and fill audio data into SDL_AduioSpecs. 30 Call SDL_OpenAudio() 40 Back 20 until finished