From 305466196c99277459bb864d1b8396296170da21 Mon Sep 17 00:00:00 2001 From: bnnm Date: Sat, 6 Jul 2024 01:26:08 +0200 Subject: [PATCH] doc --- doc/BUILD-LIB.md | 8 +++++--- src/coding/ffmpeg_decoder.c | 16 ++++++++++++++++ src/meta/hca_keys.h | 4 ++-- 3 files changed, 23 insertions(+), 5 deletions(-) diff --git a/doc/BUILD-LIB.md b/doc/BUILD-LIB.md index 0b555851..9c09baa0 100644 --- a/doc/BUILD-LIB.md +++ b/doc/BUILD-LIB.md @@ -1,6 +1,8 @@ # vgmstream lib build help This document explains how to build various external dependencies used in vgmstream. Like *vgmstream*, most external libs use C and need to be compiled as such. +The main purpose this doc is to have a reference of what each lib is doing, and to rebuild Windows DLLs. Linux libs are handled automatically using CMake, though you can use these steps too. + See [BUILD](BUILD.md#external-libraries) for a description of each lib first. ## Intro @@ -60,7 +62,7 @@ On Linux `install` is used to actually *install* libs on system dirs (so `--pref You can call multiple *targets* in a single line `make clean install-strip` is the same as `make clean` and `make install` (which in turn calls plain `make` / default). That's the theory, but at some libs don't properly handle this. ### autotools config -*autotools* are **very** fragile and picky, beware when changing stuff.Check other flags by calling `sh ./configure --help`, but changing some of the steps will likely cause odd issues, *autotools are not consistent between libs*. +*autotools* are **very** fragile and picky, beware when changing stuff. Check other flags by calling `sh ./configure --help`, but changing some of the steps will likely cause odd issues. *autotools are not consistent between libs*. Common *configure*/Makefile params: - `--build=...`: current compilation environment (autodetected, but may fail in outdated libs) @@ -90,7 +92,7 @@ However, *those flags aren't consistent between libs*, meaning in one using *con ### Xiph's releases and exports Sometimes we use "official releases" sources rather than using Git's sources. Both should be the same, but releases have pre-generated *./configure*, while Git needs to call `autogen.sh` that calls `autoreconf` that generates a base `configure` script. Since getting `autoreconf` working on **Windows** without MSYS2 requires extra steps (not described), Xiph's releases are recommended. -When building a DLL/lib compiler sets *exported symbols* (functions). Xiph's *autoconf* may generate DLLs correctly, butdon't detect Mingw/Win config properly and export all symbols by default. This is fixed manually, but there may be better ways to handle it (to be researched). +When building a DLL/lib compiler sets *exported symbols* (functions). Xiph's *autoconf* may generate DLLs correctly, but don't detect Mingw/Win config properly and export all symbols by default. This is fixed manually, but there may be better ways to handle it (to be researched). ### Shared libs details Roughly, a `.dll` is a Windows "shared library"; Linux equivalent would be a `.so` file. First, `.c` files are compiled into objects (`.o` in GCC, `.obj` in MSCV), then can be made into a `.dll`. Later, when a program needs that DLL (or rather, it's functions), a compiler can use it as long as some conditions are met. @@ -98,7 +100,7 @@ Roughly, a `.dll` is a Windows "shared library"; Linux equivalent would be a `.s DLL must *export symbols* (functions), which on a Windows's DLL is done with: - adding `__declspec(dllexport)` to a function (usually done with `#define EXPORT ...` and similar ways) - using a `.def` module definition file -- if neither of the above is used, GCC exports every function by default (not great= +- if neither of the above is used, GCC exports every function by default (not great) Then, to *link* (refer to) a DLL compiler usually needs helper files (`.dll.a` in GCC, `.lib` in MSVC). DLL's are copied to vgmstream's source, while helper files are created on compile time from `.dll`+`.def` (see *ext_libs/Makefile* for GCC and `ext_libs.vcxproj` for MSVC). diff --git a/src/coding/ffmpeg_decoder.c b/src/coding/ffmpeg_decoder.c index cd7cae7d..e0ebeca3 100644 --- a/src/coding/ffmpeg_decoder.c +++ b/src/coding/ffmpeg_decoder.c @@ -430,6 +430,22 @@ fail: return NULL; } +/* FFmpeg internals (roughly) for reference: + * + * AVFormatContext // base info extracted from input file + * AVStream // substreams + * AVCodecParameters // codec id, channels, format, ... + * + * AVCodecContext // sample rate and general info + * + * - open avformat to get all possible info (needs file or IO) + * - open avcodec to decode based on target stream + * - decode chunks of data (feed style) + * - read next frame into packet via avformat + * - decode packet via avcodec + * - handle samples +*/ + static int init_ffmpeg_config(ffmpeg_codec_data* data, int target_subsong, int reset) { int errcode = 0; diff --git a/src/meta/hca_keys.h b/src/meta/hca_keys.h index 423c0dba..b0c18cbb 100644 --- a/src/meta/hca_keys.h +++ b/src/meta/hca_keys.h @@ -1314,9 +1314,9 @@ static const hcakey_info hcakey_list[] = { // Sonic Rumble (Android) {6834182874188563}, // 001847A7328BCB13 - // P A Certain Magical Index 2 (Android) + // P A Certain Magical Index 1/2 (Android) {5963}, // 000000000000174B - + // Reynatis (Switch) {5963496778882477625}, // 52C298B97479EE39