ChapterForge
Loading...
Searching...
No Matches
ChapterForge Public API

Classes

struct  ChapterImageSample
 
struct  ChapterTextSample
 
struct  chapterforge::Status
 Result object with success flag and optional error message. More...
 
struct  chapterforge::ReadResult
 Parse an existing M4A/MP4 file and return its chapter data. More...
 
struct  MetadataSet
 

Enumerations

enum class  chapterforge::LogVerbosity { chapterforge::LogVerbosity::Error = 0 , chapterforge::LogVerbosity::Warn = 1 , chapterforge::LogVerbosity::Info = 2 , chapterforge::LogVerbosity::Debug = 3 }
 

Functions

std::string chapterforge::version_string ()
 Return the ChapterForge library version string.
 
Status chapterforge::mux_file_to_m4a (const std::string &input_audio_path, const std::string &chapter_json_path, const std::string &output_path, bool fast_start=true)
 Mux AAC input + chapter/text/image metadata into an M4A file (JSON driven).
 
Status chapterforge::mux_file_to_m4a (const std::string &input_audio_path, const std::vector< ChapterTextSample > &text_chapters, const std::vector< ChapterImageSample > &image_chapters, const MetadataSet &metadata, const std::string &output_path, bool fast_start=true)
 Mux AAC input + in-memory chapter data (titles + images + metadata).
 
Status chapterforge::mux_file_to_m4a (const std::string &input_audio_path, const std::vector< ChapterTextSample > &text_chapters, const MetadataSet &metadata, const std::string &output_path, bool fast_start=true)
 
Status chapterforge::mux_file_to_m4a (const std::string &input_audio_path, const std::vector< ChapterTextSample > &text_chapters, const std::vector< ChapterImageSample > &image_chapters, const std::string &output_path, bool fast_start=true)
 
Status chapterforge::mux_file_to_m4a (const std::string &input_audio_path, const std::vector< ChapterTextSample > &text_chapters, const std::vector< ChapterTextSample > &url_chapters, const std::vector< ChapterImageSample > &image_chapters, const std::string &output_path, bool fast_start=true)
 Mux AAC input + in-memory chapter data (with optional URL track).
 
Status chapterforge::mux_file_to_m4a (const std::string &input_audio_path, const std::vector< ChapterTextSample > &text_chapters, const std::vector< ChapterTextSample > &url_chapters, const std::vector< ChapterImageSample > &image_chapters, const MetadataSet &metadata, const std::string &output_path, bool fast_start=true)
 Variant with explicit metadata; otherwise identical to the overload above.
 
ReadResult chapterforge::read_m4a (const std::string &path)
 

Detailed Description

Public, supported C++ interfaces for muxing chapters into M4A files.


Class Documentation

◆ ChapterImageSample

struct ChapterImageSample

Represents a chapter image sample (JPEG payload and start time).

Class Members
vector< uint8_t > data Raw JPEG bytes (must be YUVJ420)
uint32_t start_ms = 0 Absolute start time in ms.

◆ ChapterTextSample

struct ChapterTextSample

Represents a chapter title/URL sample.

Class Members
string href Optional hyperlink URL (tx3g modifier)
uint32_t start_ms = 0 Absolute start time in ms.
string text UTF-8 text.

◆ chapterforge::Status

struct chapterforge::Status

Result object with success flag and optional error message.

When ok == true, message is empty. On failure, message contains a short description of what went wrong (e.g., failure to parse input, open files, or validate images).

Class Members
string message
bool ok {false}

◆ MetadataSet

struct MetadataSet

Top-level metadata container for ilst.

Class Members
string album Album/collection.
string artist Artist/author.
string comment Comment/description.
vector< uint8_t > cover JPEG cover data.
string genre Genre tag.
string title Track title.
string year Year (free-form)

Enumeration Type Documentation

◆ LogVerbosity

enum class chapterforge::LogVerbosity
strong

Log verbosity levels for library and CLI output.

Enumerator
Error 
Warn 
Info 
Debug 

Function Documentation

◆ mux_file_to_m4a() [1/6]

Status chapterforge::mux_file_to_m4a ( const std::string &  input_audio_path,
const std::string &  chapter_json_path,
const std::string &  output_path,
bool  fast_start = true 
)

Mux AAC input + chapter/text/image metadata into an M4A file (JSON driven).

◆ mux_file_to_m4a() [2/6]

Status chapterforge::mux_file_to_m4a ( const std::string &  input_audio_path,
const std::vector< ChapterTextSample > &  text_chapters,
const MetadataSet metadata,
const std::string &  output_path,
bool  fast_start = true 
)

◆ mux_file_to_m4a() [3/6]

Status chapterforge::mux_file_to_m4a ( const std::string &  input_audio_path,
const std::vector< ChapterTextSample > &  text_chapters,
const std::vector< ChapterImageSample > &  image_chapters,
const MetadataSet metadata,
const std::string &  output_path,
bool  fast_start = true 
)

Mux AAC input + in-memory chapter data (titles + images + metadata).

◆ mux_file_to_m4a() [4/6]

Status chapterforge::mux_file_to_m4a ( const std::string &  input_audio_path,
const std::vector< ChapterTextSample > &  text_chapters,
const std::vector< ChapterImageSample > &  image_chapters,
const std::string &  output_path,
bool  fast_start = true 
)

◆ mux_file_to_m4a() [5/6]

Status chapterforge::mux_file_to_m4a ( const std::string &  input_audio_path,
const std::vector< ChapterTextSample > &  text_chapters,
const std::vector< ChapterTextSample > &  url_chapters,
const std::vector< ChapterImageSample > &  image_chapters,
const MetadataSet metadata,
const std::string &  output_path,
bool  fast_start = true 
)

Variant with explicit metadata; otherwise identical to the overload above.

Parameters
input_audio_pathPath to AAC (ADTS) or MP4/M4A containing AAC.
text_chaptersChapter titles (text/start_ms; href optional).
url_chaptersOptional URL track (href/text per sample); leave empty to omit.
image_chaptersOptional JPEG data per chapter; leave empty to omit.
metadataTop-level metadata; reused from input ilst if empty.
output_pathDestination .m4a file.
fast_startWhen true, places moov ahead of mdat.

◆ mux_file_to_m4a() [6/6]

Status chapterforge::mux_file_to_m4a ( const std::string &  input_audio_path,
const std::vector< ChapterTextSample > &  text_chapters,
const std::vector< ChapterTextSample > &  url_chapters,
const std::vector< ChapterImageSample > &  image_chapters,
const std::string &  output_path,
bool  fast_start = true 
)

Mux AAC input + in-memory chapter data (with optional URL track).

Parameters
input_audio_pathPath to AAC (ADTS) or MP4/M4A containing AAC.
text_chaptersChapter titles (text/start_ms; href unused here).
url_chaptersOptional URL track; set href per sample; text (or url_text in JSON) is optional and defaults to empty to match Apple-authored files. Leave empty to skip the URL track.
image_chaptersOptional JPEG data per chapter; leave empty to omit the image track.
output_pathDestination .m4a file.
fast_startWhen true, places moov ahead of mdat.

◆ read_m4a()

ReadResult chapterforge::read_m4a ( const std::string &  path)

◆ version_string()

std::string chapterforge::version_string ( )

Return the ChapterForge library version string.

Follows the same formatting as the CLI banner (e.g. v0.12 or v0.12+abcd123).