packet_decoder Class Reference

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

#include <packet_decoder.h>

Inheritance diagram for packet_decoder:

service_base packet_decoder_streamparse

List of all members.

Public Types

typedef packet_decoder t_interface
typedef service_base t_interface_parent

Public Member Functions

virtual t_size set_stream_property (const GUID &p_type, t_size p_param1, const void *p_param2, t_size p_param2size)=0
virtual void get_info (file_info &p_info)=0
virtual unsigned get_max_frame_dependency ()=0
 Returns many frames back to start decoding when seeking.
virtual double get_max_frame_dependency_time ()=0
 Returns much time back to start decoding when seeking (for containers where going back by specified number of frames is not trivial).
virtual void reset_after_seek ()=0
 Flushes decoder after seeking.
virtual void decode (const void *p_buffer, t_size p_bytes, audio_chunk &p_chunk, abort_callback &p_abort)=0
virtual bool analyze_first_frame_supported ()=0
 Returns whether this packet decoder supports analyze_first_frame() function.
virtual void analyze_first_frame (const void *p_buffer, t_size p_bytes, abort_callback &p_abort)=0
 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.

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 helper, creates a packet_decoder instance and initializes it with specific decoder setup data.

Static Public Attributes

static const GUID owner_MP4
static const GUID owner_matroska
static const GUID owner_MP3
static const GUID owner_MP2
static const GUID owner_MP1
static const GUID owner_MP4_ALAC
static const GUID owner_ADTS
static const GUID owner_ADIF
static const GUID owner_Ogg = { 0x8fa27457, 0xa021, 0x43b9, { 0xad, 0x20, 0xa7, 0x96, 0xdb, 0x94, 0x7c, 0xd1 } }
static const GUID owner_MP4_AMR
static const GUID owner_MP4_AMR_WB
static const GUID property_samplerate
static const GUID property_bitspersample
static const GUID property_channels
static const GUID property_byteorder
static const GUID property_signed
static const GUID property_channelmask
static const GUID property_ogg_header = { 0xbeb22c78, 0xeb49, 0x4f9e, { 0x9e, 0x37, 0x57, 0xd8, 0x87, 0x40, 0xfb, 0x4c } }
static const GUID property_ogg_query_sample_rate = { 0x6226bf73, 0x1c37, 0x4aa1, { 0xae, 0xb1, 0x18, 0x8b, 0x4a, 0xf3, 0xae, 0xf7 } }
static const GUID property_ogg_packet = { 0xade740be, 0x8e2e, 0x4d0b, { 0xa4, 0x0, 0x3f, 0x6e, 0x8a, 0xf7, 0x71, 0xe4 } }
static const GUID class_guid

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)

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)

Classes

struct  matroska_setup


Detailed Description

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

Member Typedef Documentation

Reimplemented from service_base.

Reimplemented in packet_decoder_streamparse.

Reimplemented in packet_decoder_streamparse.


Member Function Documentation

static bool packet_decoder::g_is_our_setup ( const GUID &  p_owner,
t_size  p_param1,
const void *  p_param2,
t_size  p_param2size 
) [inline, static, protected]

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.

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 
) [inline, protected]

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_decode If 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.

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.

virtual void packet_decoder::get_info ( file_info p_info  )  [pure virtual]

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

Parameters:
p_info Interface 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).

virtual void packet_decoder::reset_after_seek (  )  [pure virtual]

Flushes decoder after seeking.

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.

virtual bool packet_decoder::analyze_first_frame_supported (  )  [pure virtual]

Returns whether this packet decoder supports analyze_first_frame() function.

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.

static 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.


Member Data Documentation

const GUID packet_decoder::owner_MP4 [static]

Initial value:

 
{ 0x30f95beb, 0xfdf4, 0x4a75, { 0xb5, 0x97, 0x60, 0xca, 0xf9, 0x3b, 0x39, 0xc4 } }

const GUID packet_decoder::owner_matroska [static]

Initial value:

{ 0x5c2de804, 0xeaee, 0x4b8e, { 0x8c, 0x14, 0x92, 0x7, 0xa2, 0x54, 0x9b, 0xbe } }

const GUID packet_decoder::owner_MP3 [static]

Initial value:

 
{ 0x7b741a69, 0x1ac7, 0x440d, { 0xa0, 0x1d, 0x88, 0x53, 0x6d, 0xd4, 0xde, 0x1c } }

const GUID packet_decoder::owner_MP2 [static]

Initial value:

 
{ 0x17b300a0, 0x3110, 0x4400, { 0xa4, 0x34, 0xc1, 0x8f, 0xbe, 0xea, 0xba, 0x81 } }

const GUID packet_decoder::owner_MP1 [static]

Initial value:

 
{ 0x1c068e5e, 0xdd65, 0x4639, { 0xbf, 0x85, 0x78, 0xb2, 0x97, 0xc8, 0xff, 0xac } }

const GUID packet_decoder::owner_MP4_ALAC [static]

Initial value:

{ 0x8f450cb3, 0xa083, 0x4b83, { 0x8d, 0x85, 0xad, 0xce, 0x5e, 0xa6, 0xd5, 0x7f } }

const GUID packet_decoder::owner_ADTS [static]

Initial value:

{ 0xaf5b7cb0, 0xa08e, 0x404a, { 0xa3, 0xc0, 0x5c, 0x5e, 0xa1, 0xa8, 0xa0, 0x5c } }

const GUID packet_decoder::owner_ADIF [static]

Initial value:

{ 0xf72d2eae, 0x835c, 0x4dfb, { 0x97, 0xc6, 0x62, 0x43, 0x43, 0xef, 0xaf, 0xb0 } }

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

const GUID packet_decoder::owner_MP4_AMR [static]

Initial value:

{ 0x40017871, 0x50a9, 0x48b6, { 0xbf, 0x60, 0xbd, 0x18, 0x1a, 0x22, 0x7f, 0x9b } }

const GUID packet_decoder::owner_MP4_AMR_WB [static]

Initial value:

{ 0x2e729ea0, 0x6beb, 0x4392, { 0xbf, 0x24, 0x75, 0xc6, 0x9b, 0x60, 0x16, 0x6d } }

Initial value:

 
{ 0xbc73f9fc, 0x107, 0x480e, { 0xbf, 0xe, 0xbe, 0x58, 0xaf, 0x7a, 0xf3, 0x28 } }

Initial value:

 
{ 0xe5d19aad, 0x931b, 0x48ac, { 0xaa, 0x6e, 0x95, 0xe2, 0xc2, 0x3b, 0xec, 0x37 } }

const GUID packet_decoder::property_channels [static]

Initial value:

 
{ 0x1afa1145, 0xe774, 0x4c26, { 0x91, 0xd6, 0x3f, 0x5d, 0xd6, 0x1e, 0x26, 0xe } }

Initial value:

 
{ 0x29c556da, 0x65a, 0x4d24, { 0x8a, 0x11, 0xf, 0x9d, 0xbc, 0x5, 0xa8, 0x17 } }

const GUID packet_decoder::property_signed [static]

Initial value:

 
{ 0x759c32f, 0xe78e, 0x4479, { 0xb0, 0xc0, 0xb6, 0x53, 0xdf, 0xa0, 0x14, 0xd8 } }

Initial value:

 
{ 0xbb31669e, 0xc30, 0x4c5f, { 0xaa, 0xf0, 0x20, 0xcd, 0x49, 0xd4, 0x60, 0x58 } }

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

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

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

const GUID packet_decoder::class_guid [static]

Initial value:

 
{ 0x15a6c0e, 0x1571, 0x49bd, { 0xa3, 0x67, 0x30, 0xb4, 0xbd, 0x88, 0x9c, 0x34 } }

Reimplemented in packet_decoder_streamparse.


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

Generated on Fri Apr 25 18:49:47 2008 for foobar2000 SDK by  doxygen 1.5.5