foobar2000 SDK  2015-08-03
Data Structures | Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | Static Protected Member Functions
packet_decoderabstract

#include <packet_decoder.h>

+ Inheritance diagram for packet_decoder:

Data Structures

struct  matroska_setup
 

Public Member Functions

virtual void analyze_first_frame (const void *p_buffer, t_size p_bytes, abort_callback &p_abort)=0
 
virtual bool analyze_first_frame_supported ()=0
 
virtual void decode (const void *p_buffer, t_size p_bytes, audio_chunk &p_chunk, abort_callback &p_abort)=0
 
 FB2K_MAKE_SERVICE_INTERFACE (packet_decoder, service_base)
 
virtual void get_info (file_info &p_info)=0
 
virtual unsigned get_max_frame_dependency ()=0
 
virtual double get_max_frame_dependency_time ()=0
 
size_t initPadding ()
 
virtual void reset_after_seek ()=0
 
virtual t_size set_stream_property (const GUID &p_type, t_size p_param1, const void *p_param2, t_size p_param2size)=0
 
void setAllowDelayed (bool bAllow=true)
 
void setCheckingIntegrity (bool checkingIntegrity)
 
void setEventLogger (event_logger::ptr logger)
 
- Public Member Functions inherited from service_base
template<typename outPtr_t >
bool cast (outPtr_t &outPtr)
 
virtual int service_add_ref ()=0 throw ()
 
virtual bool service_query (service_ptr_t< service_base > &p_out, const GUID &p_guid)
 
template<class T >
bool service_query_t (service_ptr_t< T > &p_out)
 
virtual int service_release ()=0 throw ()
 

Static Public Member Functions

static void g_open (service_ptr_t< packet_decoder > &p_out, bool p_decode, const GUID &p_owner, t_size p_param1, const void *p_param2, t_size p_param2size, abort_callback &p_abort)
 

Static Public Attributes

static const GUID owner_ADIF
 
static const GUID owner_ADTS
 
static const GUID owner_matroska
 
static const GUID owner_MP1
 
static const GUID owner_MP2
 
static const GUID owner_MP3
 
static const GUID owner_MP4
 
static const GUID owner_MP4_AC3
 
static const GUID owner_MP4_ALAC
 
static const GUID owner_MP4_AMR
 
static const GUID owner_MP4_AMR_WB
 
static const GUID owner_Ogg = { 0x8fa27457, 0xa021, 0x43b9, { 0xad, 0x20, 0xa7, 0x96, 0xdb, 0x94, 0x7c, 0xd1 } }
 
static const GUID property_allow_delayed_output = { 0x985b25a5, 0x5e79, 0x4dda, { 0x8b, 0xdd, 0x53, 0xb4, 0x25, 0x76, 0xe2, 0x2d } }
 
static const GUID property_bitspersample
 
static const GUID property_bufferpadding
 
static const GUID property_byteorder
 
static const GUID property_channelmask
 
static const GUID property_channels
 
static const GUID property_checkingintegrity
 
static const GUID property_eventlogger
 
static const GUID property_mp4_esds = { 0xe8504271, 0xaec0, 0x4805, { 0xbb, 0x69, 0x71, 0xcc, 0xa3, 0xbc, 0x2, 0xdd } }
 
static const GUID property_ogg_header = { 0xbeb22c78, 0xeb49, 0x4f9e, { 0x9e, 0x37, 0x57, 0xd8, 0x87, 0x40, 0xfb, 0x4c } }
 
static const GUID property_ogg_packet = { 0xade740be, 0x8e2e, 0x4d0b, { 0xa4, 0x0, 0x3f, 0x6e, 0x8a, 0xf7, 0x71, 0xe4 } }
 
static const GUID property_ogg_query_preskip = { 0xfae837d4, 0xc396, 0x4ccd, { 0xa7, 0xa5, 0xeb, 0x1e, 0x7e, 0x86, 0x32, 0xfb } }
 
static const GUID property_ogg_query_sample_rate = { 0x6226bf73, 0x1c37, 0x4aa1, { 0xae, 0xb1, 0x18, 0x8b, 0x4a, 0xf3, 0xae, 0xf7 } }
 
static const GUID property_samplerate
 
static const GUID property_samples_per_frame
 
static const GUID property_signed
 

Protected Member Functions

void open (const GUID &p_owner, bool p_decode, t_size p_param1, const void *p_param2, t_size p_param2size, abort_callback &p_abort)
 
- Protected Member Functions inherited from service_base
 service_base ()
 
 ~service_base ()
 

Static Protected Member Functions

static bool g_is_our_setup (const GUID &p_owner, t_size p_param1, const void *p_param2, t_size p_param2size)
 

Additional Inherited Members

- Public Types inherited from service_base
typedef service_base t_interface
 

Detailed Description

Provides interface to decode various audio data types to PCM. Use packet_decoder_factory_t template to register.

Definition at line 3 of file packet_decoder.h.


Data Structure Documentation

struct packet_decoder::matroska_setup

Definition at line 48 of file packet_decoder.h.

Data Fields
uint32_t channels
const char * codec_id
const void * codec_private
size_t codec_private_size
uint32_t sample_rate
uint32_t sample_rate_output

Member Function Documentation

virtual void packet_decoder::analyze_first_frame ( const void *  p_buffer,
t_size  p_bytes,
abort_callback p_abort 
)
pure virtual

Optional. Some codecs need to analyze first frame of the stream to return additional info about the stream, such as encoding setup. This can be only called immediately after instantiation (and set_stream_property() if present), before any actual decoding or get_info(). Caller can determine whether this method is supported or not by calling analyze_first_frame_supported(), to avoid reading first frame when decoder won't utiilize the extra info for an example. If particular decoder can't utilize first frame info in any way (and analyze_first_frame_supported() returns false), this function should do nothing and succeed.

virtual bool packet_decoder::analyze_first_frame_supported ( )
pure virtual

Returns whether this packet decoder supports analyze_first_frame() function.

virtual void packet_decoder::decode ( const void *  p_buffer,
t_size  p_bytes,
audio_chunk p_chunk,
abort_callback p_abort 
)
pure virtual

Decodes a block of audio data.
It may return empty chunk even when successful (caused by encoder+decoder delay for an example), caller must check for it and handle it appropriately.

packet_decoder::FB2K_MAKE_SERVICE_INTERFACE ( packet_decoder  ,
service_base   
)
static bool packet_decoder::g_is_our_setup ( const GUID p_owner,
t_size  p_param1,
const void *  p_param2,
t_size  p_param2size 
)
inlinestaticprotected

Prototype of function that must be implemented by packet_decoder implementation but is not accessible through packet_decoder interface itself. Determines whether specific packet_decoder implementation supports specified decoder setup data.

Definition at line 7 of file packet_decoder.h.

7 {return false;}
void packet_decoder::g_open ( service_ptr_t< packet_decoder > &  p_out,
bool  p_decode,
const GUID p_owner,
t_size  p_param1,
const void *  p_param2,
t_size  p_param2size,
abort_callback p_abort 
)
static

Static helper, creates a packet_decoder instance and initializes it with specific decoder setup data.

Definition at line 3 of file packet_decoder.cpp.

4 {
7  while(e.next(ptr)) {
8  p_abort.check();
9  if (ptr->is_our_setup(p_owner,p_param1,p_param2,p_param2size)) {
10  ptr->open(p_out,p_decode,p_owner,p_param1,p_param2,p_param2size,p_abort);
11  return;
12  }
13  }
14  throw exception_io_data();
15 }
Autopointer class to be used with all services. Manages reference counter calls behind-the-scenes.
Definition: service.h:55
bool next(service_ptr_t< t_query > &p_out)
Definition: service.h:587
virtual void packet_decoder::get_info ( file_info p_info)
pure virtual

Retrieves additional user-readable tech infos that decoder can provide.

Parameters
p_infoInterface receiving information about the stream being decoded. Note that it already contains partial info about the file; existing info should not be erased, decoder-provided info should be merged with it.
virtual unsigned packet_decoder::get_max_frame_dependency ( )
pure virtual

Returns many frames back to start decoding when seeking.

virtual double packet_decoder::get_max_frame_dependency_time ( )
pure virtual

Returns much time back to start decoding when seeking (for containers where going back by specified number of frames is not trivial).

size_t packet_decoder::initPadding ( )

Definition at line 17 of file packet_decoder.cpp.

17  {
18  size_t v = this->set_stream_property(property_bufferpadding, 0, NULL, 0);
19  if (v > 0) {
21  }
22  return v;
23 }
static const GUID property_bufferpadding
virtual t_size set_stream_property(const GUID &p_type, t_size p_param1, const void *p_param2, t_size p_param2size)=0
Forwards additional information about stream being decoded. Calling: this must be called immediately...
void packet_decoder::open ( const GUID p_owner,
bool  p_decode,
t_size  p_param1,
const void *  p_param2,
t_size  p_param2size,
abort_callback p_abort 
)
inlineprotected

Prototype of function that must be implemented by packet_decoder implementation but is not accessible through packet_decoder interface itself. Initializes packet decoder instance with specified decoder setup data. This is called only once, before any other methods.

Parameters
p_decodeIf set to true, decode() and reset_after_seek() calls can be expected later. If set to false, those methods will not be called on this packet_decoder instance - for an example when caller is only retrieving information about the file rather than preparing to decode it.

Definition at line 12 of file packet_decoder.h.

12 {throw exception_io_data();}
virtual void packet_decoder::reset_after_seek ( )
pure virtual

Flushes decoder after seeking.

virtual t_size packet_decoder::set_stream_property ( const GUID p_type,
t_size  p_param1,
const void *  p_param2,
t_size  p_param2size 
)
pure virtual

Forwards additional information about stream being decoded.
Calling: this must be called immediately after packet_decoder object is created, before any other methods are called.
Implementation: this is called after open() (which is called by implementation framework immediately after creation), and before any other methods are called.

void packet_decoder::setAllowDelayed ( bool  bAllow = true)

Definition at line 33 of file packet_decoder.cpp.

33  {
34  this->set_stream_property( property_allow_delayed_output, bAllow ? 1 : 0, NULL, 0);
35 }
static const GUID property_allow_delayed_output
virtual t_size set_stream_property(const GUID &p_type, t_size p_param1, const void *p_param2, t_size p_param2size)=0
Forwards additional information about stream being decoded. Calling: this must be called immediately...
void packet_decoder::setCheckingIntegrity ( bool  checkingIntegrity)

Definition at line 29 of file packet_decoder.cpp.

29  {
30  this->set_stream_property(property_checkingintegrity, checkingIntegrity ? 1 : 0, NULL, 0);
31 }
static const GUID property_checkingintegrity
virtual t_size set_stream_property(const GUID &p_type, t_size p_param1, const void *p_param2, t_size p_param2size)=0
Forwards additional information about stream being decoded. Calling: this must be called immediately...
void packet_decoder::setEventLogger ( event_logger::ptr  logger)

Definition at line 25 of file packet_decoder.cpp.

25  {
26  this->set_stream_property(property_eventlogger, 0, logger.get_ptr(), 0);
27 }
static const GUID property_eventlogger
virtual t_size set_stream_property(const GUID &p_type, t_size p_param1, const void *p_param2, t_size p_param2size)=0
Forwards additional information about stream being decoded. Calling: this must be called immediately...

Field Documentation

FOOGUIDDECL const GUID packet_decoder::owner_ADIF
static
Initial value:
=
{ 0xf72d2eae, 0x835c, 0x4dfb, { 0x97, 0xc6, 0x62, 0x43, 0x43, 0xef, 0xaf, 0xb0 } }

Definition at line 46 of file packet_decoder.h.

FOOGUIDDECL const GUID packet_decoder::owner_ADTS
static
Initial value:
=
{ 0xaf5b7cb0, 0xa08e, 0x404a, { 0xa3, 0xc0, 0x5c, 0x5e, 0xa1, 0xa8, 0xa0, 0x5c } }

Definition at line 46 of file packet_decoder.h.

FOOGUIDDECL const GUID packet_decoder::owner_matroska
static
Initial value:
=
{ 0x5c2de804, 0xeaee, 0x4b8e, { 0x8c, 0x14, 0x92, 0x7, 0xa2, 0x54, 0x9b, 0xbe } }

Definition at line 46 of file packet_decoder.h.

FOOGUIDDECL const GUID packet_decoder::owner_MP1
static
Initial value:
=
{ 0x1c068e5e, 0xdd65, 0x4639, { 0xbf, 0x85, 0x78, 0xb2, 0x97, 0xc8, 0xff, 0xac } }

Definition at line 46 of file packet_decoder.h.

FOOGUIDDECL const GUID packet_decoder::owner_MP2
static
Initial value:
=
{ 0x17b300a0, 0x3110, 0x4400, { 0xa4, 0x34, 0xc1, 0x8f, 0xbe, 0xea, 0xba, 0x81 } }

Definition at line 46 of file packet_decoder.h.

FOOGUIDDECL const GUID packet_decoder::owner_MP3
static
Initial value:
=
{ 0x7b741a69, 0x1ac7, 0x440d, { 0xa0, 0x1d, 0x88, 0x53, 0x6d, 0xd4, 0xde, 0x1c } }

Definition at line 46 of file packet_decoder.h.

FOOGUIDDECL const GUID packet_decoder::owner_MP4
static
Initial value:
=
{ 0x30f95beb, 0xfdf4, 0x4a75, { 0xb5, 0x97, 0x60, 0xca, 0xf9, 0x3b, 0x39, 0xc4 } }

Definition at line 46 of file packet_decoder.h.

FOOGUIDDECL const GUID packet_decoder::owner_MP4_AC3
static
Initial value:
=
{ 0x62263199, 0x48c2, 0x4777, { 0xb3, 0x3a, 0x87, 0xed, 0x16, 0x1a, 0x16, 0x30 } }

Definition at line 46 of file packet_decoder.h.

FOOGUIDDECL const GUID packet_decoder::owner_MP4_ALAC
static
Initial value:
=
{ 0x8f450cb3, 0xa083, 0x4b83, { 0x8d, 0x85, 0xad, 0xce, 0x5e, 0xa6, 0xd5, 0x7f } }

Definition at line 46 of file packet_decoder.h.

FOOGUIDDECL const GUID packet_decoder::owner_MP4_AMR
static
Initial value:
=
{ 0x40017871, 0x50a9, 0x48b6, { 0xbf, 0x60, 0xbd, 0x18, 0x1a, 0x22, 0x7f, 0x9b } }

Definition at line 46 of file packet_decoder.h.

FOOGUIDDECL const GUID packet_decoder::owner_MP4_AMR_WB
static
Initial value:
=
{ 0x2e729ea0, 0x6beb, 0x4392, { 0xbf, 0x24, 0x75, 0xc6, 0x9b, 0x60, 0x16, 0x6d } }

Definition at line 46 of file packet_decoder.h.

FOOGUIDDECL const GUID packet_decoder::owner_Ogg = { 0x8fa27457, 0xa021, 0x43b9, { 0xad, 0x20, 0xa7, 0x96, 0xdb, 0x94, 0x7c, 0xd1 } }
static

Definition at line 46 of file packet_decoder.h.

FOOGUIDDECL const GUID packet_decoder::property_allow_delayed_output = { 0x985b25a5, 0x5e79, 0x4dda, { 0x8b, 0xdd, 0x53, 0xb4, 0x25, 0x76, 0xe2, 0x2d } }
static

Definition at line 85 of file packet_decoder.h.

FOOGUIDDECL const GUID packet_decoder::property_bitspersample
static
Initial value:
=
{ 0xe5d19aad, 0x931b, 0x48ac, { 0xaa, 0x6e, 0x95, 0xe2, 0xc2, 0x3b, 0xec, 0x37 } }

Definition at line 62 of file packet_decoder.h.

FOOGUIDDECL const GUID packet_decoder::property_bufferpadding
static
Initial value:
=
{ 0xe2c734fd, 0xd4c2, 0x467e, { 0xb5, 0xd3, 0x4c, 0x13, 0xd9, 0xbd, 0x30, 0xe } }

Definition at line 62 of file packet_decoder.h.

FOOGUIDDECL const GUID packet_decoder::property_byteorder
static
Initial value:
=
{ 0x29c556da, 0x65a, 0x4d24, { 0x8a, 0x11, 0xf, 0x9d, 0xbc, 0x5, 0xa8, 0x17 } }

Definition at line 62 of file packet_decoder.h.

FOOGUIDDECL const GUID packet_decoder::property_channelmask
static
Initial value:
=
{ 0xbb31669e, 0xc30, 0x4c5f, { 0xaa, 0xf0, 0x20, 0xcd, 0x49, 0xd4, 0x60, 0x58 } }

Definition at line 62 of file packet_decoder.h.

FOOGUIDDECL const GUID packet_decoder::property_channels
static
Initial value:
=
{ 0x1afa1145, 0xe774, 0x4c26, { 0x91, 0xd6, 0x3f, 0x5d, 0xd6, 0x1e, 0x26, 0xe } }

Definition at line 62 of file packet_decoder.h.

FOOGUIDDECL const GUID packet_decoder::property_checkingintegrity
static
Initial value:
=
{ 0x61fd52ad, 0x5146, 0x417e, { 0x86, 0x62, 0x36, 0x15, 0x2e, 0x60, 0xa7, 0xd0 } }

Definition at line 62 of file packet_decoder.h.

FOOGUIDDECL const GUID packet_decoder::property_eventlogger
static
Initial value:
=
{ 0x809a5b7f, 0x99d3, 0x4848, { 0xaf, 0xc9, 0x7e, 0x2, 0xb2, 0x87, 0xe3, 0x3f } }

Definition at line 62 of file packet_decoder.h.

FOOGUIDDECL const GUID packet_decoder::property_mp4_esds = { 0xe8504271, 0xaec0, 0x4805, { 0xbb, 0x69, 0x71, 0xcc, 0xa3, 0xbc, 0x2, 0xdd } }
static

Definition at line 82 of file packet_decoder.h.

FOOGUIDDECL const GUID packet_decoder::property_ogg_header = { 0xbeb22c78, 0xeb49, 0x4f9e, { 0x9e, 0x37, 0x57, 0xd8, 0x87, 0x40, 0xfb, 0x4c } }
static

Definition at line 79 of file packet_decoder.h.

FOOGUIDDECL const GUID packet_decoder::property_ogg_packet = { 0xade740be, 0x8e2e, 0x4d0b, { 0xa4, 0x0, 0x3f, 0x6e, 0x8a, 0xf7, 0x71, 0xe4 } }
static

Definition at line 79 of file packet_decoder.h.

FOOGUIDDECL const GUID packet_decoder::property_ogg_query_preskip = { 0xfae837d4, 0xc396, 0x4ccd, { 0xa7, 0xa5, 0xeb, 0x1e, 0x7e, 0x86, 0x32, 0xfb } }
static

Definition at line 79 of file packet_decoder.h.

FOOGUIDDECL const GUID packet_decoder::property_ogg_query_sample_rate = { 0x6226bf73, 0x1c37, 0x4aa1, { 0xae, 0xb1, 0x18, 0x8b, 0x4a, 0xf3, 0xae, 0xf7 } }
static

Definition at line 79 of file packet_decoder.h.

FOOGUIDDECL const GUID packet_decoder::property_samplerate
static
Initial value:
=
{ 0xbc73f9fc, 0x107, 0x480e, { 0xbf, 0xe, 0xbe, 0x58, 0xaf, 0x7a, 0xf3, 0x28 } }

Definition at line 62 of file packet_decoder.h.

const GUID packet_decoder::property_samples_per_frame
static

Definition at line 62 of file packet_decoder.h.

FOOGUIDDECL const GUID packet_decoder::property_signed
static
Initial value:
=
{ 0x759c32f, 0xe78e, 0x4479, { 0xb0, 0xc0, 0xb6, 0x53, 0xdf, 0xa0, 0x14, 0xd8 } }

Definition at line 62 of file packet_decoder.h.


The documentation for this class was generated from the following files: