mirror of
https://github.com/vgmstream/vgmstream.git
synced 2024-11-23 22:41:05 +01:00
doc
This commit is contained in:
parent
25d2ecb59b
commit
439665b69f
@ -303,11 +303,13 @@ id_check = (value)
|
||||
```
|
||||
|
||||
#### NUMBER OF CHANNELS [REQUIRED]
|
||||
How many audio channels the file has, typically 2 (stereo).
|
||||
```
|
||||
channels = (value)
|
||||
```
|
||||
|
||||
#### MUSIC FREQUENCY [REQUIRED]
|
||||
#### AUDIO FREQUENCY [REQUIRED]
|
||||
Number of samples per second, typically 48000/44100/32000/24000/22050/11025.
|
||||
```
|
||||
sample_rate = (value)
|
||||
```
|
||||
|
@ -432,11 +432,16 @@ fail:
|
||||
|
||||
/* FFmpeg internals (roughly) for reference:
|
||||
*
|
||||
* // metadata info first extracted
|
||||
* AVFormatContext // base info extracted from input file
|
||||
* AVStream // substreams
|
||||
* AVCodecParameters // codec id, channels, format, ...
|
||||
*
|
||||
* AVCodecContext // sample rate and general info
|
||||
* // codec info passed to 'decode' functions
|
||||
* AVCodecContext // codec's sample rate, priv data and general info
|
||||
* AVPacket // encoded data (1 or N frames) passed to decoder
|
||||
* AVFrame // decoded data (audio samples + channels + etc) received from decoder
|
||||
* // (bufs are internally managed)
|
||||
*
|
||||
* - open avformat to get all possible format info (needs file or custom IO)
|
||||
* - open avcodec based on target stream + codec info from avformat
|
||||
@ -444,8 +449,13 @@ fail:
|
||||
* - read next frame into packet via avformat
|
||||
* - decode packet via avcodec
|
||||
* - handle samples
|
||||
*/
|
||||
|
||||
*
|
||||
* In FFmpeg, each "avformat" defines an struct with format info/config and read_probe (detection) + read_header
|
||||
* (setup format/codec params) + read_packet (demux single frame) functions. Meanwhile "avcodec" defines an struct
|
||||
* with config and decode_init/close (setup, may use first block's data to init itself or some extradata from
|
||||
* avformat) + decode_frame (loads AVFrame from AVPacket) + decode_flush (reset state).
|
||||
* Codec/demuxer contexts aren't alloc'd manually and instead they declare priv data size.
|
||||
*/
|
||||
static int init_ffmpeg_config(ffmpeg_codec_data* data, int target_subsong, int reset) {
|
||||
int errcode = 0;
|
||||
|
||||
|
@ -35,7 +35,7 @@ void render_vgmstream_layered(sbuf_t* sdst, VGMSTREAM* vgmstream) {
|
||||
samples_to_do = sdst->samples - sdst->filled;
|
||||
|
||||
if (samples_to_do <= 0) { /* when decoding more than num_samples */
|
||||
VGM_LOG_ONCE("LAYERED: wrong samples_to_do\n");
|
||||
VGM_LOG_ONCE("LAYERED: wrong %i samples_to_do (%i filled vs %i samples)\n", samples_to_do, sdst->filled, sdst->samples);
|
||||
goto decode_fail;
|
||||
}
|
||||
|
||||
|
@ -6,16 +6,13 @@ static bool bink_get_info(STREAMFILE* sf, int target_subsong, int* p_total_subso
|
||||
|
||||
/* BINK 1/2 - RAD Game Tools movies (audio/video format) */
|
||||
VGMSTREAM* init_vgmstream_bik(STREAMFILE* sf) {
|
||||
VGMSTREAM * vgmstream = NULL;
|
||||
int channels = 0, loop_flag = 0, sample_rate = 0, num_samples = 0;
|
||||
int total_subsongs = 0, target_subsong = sf->stream_index;
|
||||
size_t stream_size;
|
||||
VGMSTREAM* vgmstream = NULL;
|
||||
|
||||
/* checks */
|
||||
/* bink1/2 header, followed by version-char (audio is the same) */
|
||||
if ((read_u32be(0x00,sf) & 0xffffff00) != get_id32be("BIK\0") &&
|
||||
(read_u32be(0x00,sf) & 0xffffff00) != get_id32be("KB2\0"))
|
||||
goto fail;
|
||||
return NULL;
|
||||
|
||||
/* .bik/bk2: standard
|
||||
* .bik2: older?
|
||||
@ -25,7 +22,13 @@ VGMSTREAM* init_vgmstream_bik(STREAMFILE* sf) {
|
||||
* .vid: Etrange Libellules games [Alice in Wonderland (PC)]
|
||||
* .bika: fake extension for demuxed audio */
|
||||
if (!check_extensions(sf,"bik,bk2,bik2,ps3,xmv,xen,vid,bika"))
|
||||
goto fail;
|
||||
return NULL;
|
||||
|
||||
/* this typically handles regular or demuxed videos, but .bik with a 4x4 video made for audio do exist [Viva Piñata (DS)] */
|
||||
|
||||
int channels = 0, loop_flag = 0, sample_rate = 0, num_samples = 0;
|
||||
int total_subsongs = 0, target_subsong = sf->stream_index;
|
||||
size_t stream_size;
|
||||
|
||||
/* find target stream info and samples */
|
||||
if (!bink_get_info(sf, target_subsong, &total_subsongs, &stream_size, &channels, &sample_rate, &num_samples))
|
||||
|
Loading…
Reference in New Issue
Block a user