add last backwards-compatible version
This commit is contained in:
@@ -13,10 +13,6 @@ protected:
|
||||
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) {throw exception_io_data();}
|
||||
public:
|
||||
|
||||
//! Prototype of function that must be implemented by packet_decoder implementation but is not accessible through packet_decoder interface itself.
|
||||
//! Returns true if this is not the preferred decoder for this format, another one should be used if found.
|
||||
static bool g_is_supported_partially(const GUID& p_owner, t_size p_param1, const void* p_param2, t_size p_param2size) { return false; }
|
||||
|
||||
|
||||
//! Forwards additional information about stream being decoded. \n
|
||||
//! Calling: this must be called immediately after packet_decoder object is created, before any other methods are called.\n
|
||||
@@ -38,7 +34,6 @@ public:
|
||||
|
||||
//! Decodes a block of audio data.\n
|
||||
//! 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.
|
||||
//! Called with 0 bytes at the end of stream - if the decoder introduces a delay between input/output, any buffered data should be passed back then.
|
||||
virtual void decode(const void * p_buffer,t_size p_bytes,audio_chunk & p_chunk,abort_callback & p_abort)=0;
|
||||
|
||||
//! Returns whether this packet decoder supports analyze_first_frame() function.
|
||||
@@ -49,7 +44,7 @@ public:
|
||||
//! Static helper, creates a packet_decoder instance and initializes it with specific decoder setup data.
|
||||
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 const GUID owner_MP4,owner_matroska,owner_MP3,owner_MP2,owner_MP1,owner_MP4_ALAC,owner_ADTS,owner_ADIF, owner_Ogg, owner_MP4_AMR, owner_MP4_AMR_WB, owner_MP4_AC3, owner_MP4_EAC3;
|
||||
static const GUID owner_MP4,owner_matroska,owner_MP3,owner_MP2,owner_MP1,owner_MP4_ALAC,owner_ADTS,owner_ADIF, owner_Ogg, owner_MP4_AMR, owner_MP4_AMR_WB, owner_MP4_AC3;
|
||||
|
||||
struct matroska_setup
|
||||
{
|
||||
@@ -87,21 +82,12 @@ public:
|
||||
//property_mp4_esds : p_param2 = MP4 ESDS chunk content as needed by some decoders
|
||||
static const GUID property_mp4_esds;
|
||||
|
||||
// DEPRECATED
|
||||
//property_allow_delayed_output : p_param1 = bool flag indicating whether the decoder than delay outputting audio data at will; essential for Apple AQ decoder
|
||||
static const GUID property_allow_delayed_output;
|
||||
|
||||
// property_mp3_delayless : return non-zero if this codec drops MP3 delay by itself
|
||||
static const GUID property_mp3_delayless;
|
||||
|
||||
// property_query_delay_samples :
|
||||
// Return non-zero if this codec has a decoder delay that the caller should deal with.
|
||||
// Param1 signals sample rate used by input - should always match decoder's sample rate - return zero if it does not match.
|
||||
static const GUID property_query_delay_samples;
|
||||
|
||||
// property_query_mp4_use_elst :
|
||||
// Return non-zero if MP4 elst should be used with this codec.
|
||||
static const GUID property_query_mp4_use_elst;
|
||||
|
||||
size_t initPadding();
|
||||
void setEventLogger(event_logger::ptr logger);
|
||||
void setCheckingIntegrity(bool checkingIntegrity);
|
||||
@@ -119,40 +105,29 @@ public:
|
||||
FB2K_MAKE_SERVICE_INTERFACE(packet_decoder_streamparse,packet_decoder);
|
||||
};
|
||||
|
||||
class NOVTABLE packet_decoder_entry : public service_base {
|
||||
FB2K_MAKE_SERVICE_INTERFACE_ENTRYPOINT(packet_decoder_entry);
|
||||
class NOVTABLE packet_decoder_entry : public service_base
|
||||
{
|
||||
public:
|
||||
virtual bool is_our_setup(const GUID & p_owner,t_size p_param1,const void * p_param2,t_size p_param2size) = 0;
|
||||
virtual void 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) = 0;
|
||||
|
||||
//! Returns true if this is not the preferred decoder for this format, another one should be used if found.
|
||||
bool is_supported_partially_(const GUID& p_owner, t_size p_param1, const void* p_param2, t_size p_param2size);
|
||||
};
|
||||
|
||||
class NOVTABLE packet_decoder_entry_v2 : public packet_decoder_entry {
|
||||
FB2K_MAKE_SERVICE_INTERFACE(packet_decoder_entry_v2, packet_decoder_entry);
|
||||
public:
|
||||
//! Returns true if this is not the preferred decoder for this format, another one should be used if found.
|
||||
virtual bool is_supported_partially(const GUID& p_owner, t_size p_param1, const void* p_param2, t_size p_param2size) = 0;
|
||||
FB2K_MAKE_SERVICE_INTERFACE_ENTRYPOINT(packet_decoder_entry);
|
||||
};
|
||||
|
||||
|
||||
template<class T>
|
||||
class packet_decoder_entry_impl_t : public packet_decoder_entry_v2
|
||||
class packet_decoder_entry_impl_t : public packet_decoder_entry
|
||||
{
|
||||
public:
|
||||
bool is_our_setup(const GUID & p_owner,t_size p_param1,const void * p_param2,t_size p_param2size) override {
|
||||
bool is_our_setup(const GUID & p_owner,t_size p_param1,const void * p_param2,t_size p_param2size) {
|
||||
return T::g_is_our_setup(p_owner,p_param1,p_param2,p_param2size);
|
||||
}
|
||||
void 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) override {
|
||||
void 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) {
|
||||
PFC_ASSERT(is_our_setup(p_owner,p_param1,p_param2,p_param2size));
|
||||
service_ptr_t<T> instance = new service_impl_t<T>();
|
||||
instance->open(p_owner,p_decode,p_param1,p_param2,p_param2size,p_abort);
|
||||
p_out = instance.get_ptr();
|
||||
}
|
||||
bool is_supported_partially(const GUID& p_owner, t_size p_param1, const void* p_param2, t_size p_param2size) override {
|
||||
return T::g_is_supported_partially(p_owner, p_param1, p_param2, p_param2size);
|
||||
}
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
|
||||
Reference in New Issue
Block a user