comparison foosdk/sdk/foobar2000/helpers/packet_decoder_aac_common.h @ 1:20d02a178406 default tip

*: check in everything else yay
author Paper <paper@tflc.us>
date Mon, 05 Jan 2026 02:15:46 -0500
parents
children
comparison
equal deleted inserted replaced
0:e9bb126753e7 1:20d02a178406
1 #pragma once
2 #include "../SDK/packet_decoder.h"
3
4 /*
5 Helper code with common AAC packet_decoder functionality. Primarily meant for foo_input_std-internal use.
6 */
7
8 class packet_decoder_aac_common : public packet_decoder {
9 public:
10 static pfc::array_t<uint8_t> parseDecoderSetup( const GUID & p_owner,t_size p_param1,const void * p_param2,t_size p_param2size);
11 static bool testDecoderSetup( const GUID & p_owner, t_size p_param1, const void * p_param2, t_size p_param2size );
12 static size_t skipADTSHeader( const uint8_t * data,size_t size );
13
14 static unsigned get_max_frame_dependency_()
15 {
16 return 2;
17 }
18 static double get_max_frame_dependency_time_()
19 {
20 return 1024.0 / 8000.0;
21 }
22
23 static void make_ESDS( pfc::array_t<uint8_t> & outESDS, const void * inCodecPrivate, size_t inCodecPrivateSize );
24 static const char * objectTypeStr( unsigned ot );
25 struct audioSpecificConfig_t {
26 unsigned m_objectType;
27 unsigned m_sampleRate;
28 unsigned m_channels;
29 unsigned m_sbrRate;
30 bool m_shortWindow;
31 bool m_explicitSBR, m_explicitPS;
32
33 bool isUSAC() const { return m_objectType == 42 || m_objectType == 45; }
34 const char * objectTypeStr() const;
35 };
36
37 static audioSpecificConfig_t parseASC(const void *, size_t);
38
39 static unsigned get_ASC_object_type(const void *, size_t);
40
41 static pfc::array_t<uint8_t> buildASC(audioSpecificConfig_t const&);
42
43 // If no sane ASC was provided by container, make something up to initialize decoder and attempt decoding.
44 static pfc::array_t<uint8_t> buildSafeASC(unsigned rate = 0);
45
46 };