ChapterForge
Loading...
Searching...
No Matches
aac_extractor.hpp
Go to the documentation of this file.
1
//
2
// aac_extractor.hpp
3
// ChapterForge
4
//
5
// Created by Till Toenshoff on 12/9/25.
6
// Copyright © 2025 Till Toenshoff. All rights reserved.
7
//
8
9
#pragma once
10
#include <cstdint>
11
#include <optional>
12
#include <string>
13
#include <vector>
14
15
struct
AacExtractResult
{
16
std::vector<std::vector<uint8_t>>
frames
;
// raw AAC frames (ADTS header stripped)
17
std::vector<uint32_t>
sizes
;
// raw frame sizes
18
19
uint32_t
sample_rate
= 0;
20
uint8_t
sampling_index
= 0;
21
uint8_t
channel_config
= 0;
22
uint8_t
audio_object_type
= 0;
// e.g. 2 = AAC LC
23
24
// Optional: original stsd payload (for mp4 inputs) so we can reuse esds.
25
std::vector<uint8_t>
stsd_payload
;
26
std::vector<uint8_t>
stts_payload
;
27
std::vector<uint8_t>
stsc_payload
;
28
std::vector<uint8_t>
stsz_payload
;
29
std::vector<uint8_t>
stco_payload
;
30
31
// Optional: original meta/ilst payloads (when source is MP4/M4A)
32
std::vector<uint8_t>
meta_payload
;
33
std::vector<uint8_t>
ilst_payload
;
34
};
35
39
AacExtractResult
extract_adts_frames
(
const
std::vector<uint8_t> &data);
40
47
std::optional<AacExtractResult>
extract_from_mp4
(
const
std::string &path);
AacExtractResult::meta_payload
std::vector< uint8_t > meta_payload
Definition
aac_extractor.hpp:32
AacExtractResult::stts_payload
std::vector< uint8_t > stts_payload
Definition
aac_extractor.hpp:26
extract_from_mp4
std::optional< AacExtractResult > extract_from_mp4(const std::string &path)
Extract AAC frames and related tables from an MP4/M4A source.
AacExtractResult::ilst_payload
std::vector< uint8_t > ilst_payload
Definition
aac_extractor.hpp:33
AacExtractResult::stco_payload
std::vector< uint8_t > stco_payload
Definition
aac_extractor.hpp:29
AacExtractResult::stsz_payload
std::vector< uint8_t > stsz_payload
Definition
aac_extractor.hpp:28
AacExtractResult::stsd_payload
std::vector< uint8_t > stsd_payload
Definition
aac_extractor.hpp:25
AacExtractResult::sample_rate
uint32_t sample_rate
Definition
aac_extractor.hpp:19
AacExtractResult::channel_config
uint8_t channel_config
Definition
aac_extractor.hpp:21
AacExtractResult::frames
std::vector< std::vector< uint8_t > > frames
Definition
aac_extractor.hpp:16
AacExtractResult::sampling_index
uint8_t sampling_index
Definition
aac_extractor.hpp:20
extract_adts_frames
AacExtractResult extract_adts_frames(const std::vector< uint8_t > &data)
Extract AAC frames from a raw ADTS buffer.
AacExtractResult::sizes
std::vector< uint32_t > sizes
Definition
aac_extractor.hpp:17
AacExtractResult::audio_object_type
uint8_t audio_object_type
Definition
aac_extractor.hpp:22
AacExtractResult::stsc_payload
std::vector< uint8_t > stsc_payload
Definition
aac_extractor.hpp:27
AacExtractResult
Definition
aac_extractor.hpp:15
include
aac_extractor.hpp
Generated by
1.9.8