add last backwards-compatible version

This commit is contained in:
2021-12-14 00:33:46 -07:00
parent 68b10d413b
commit b0dd3f07f3
335 changed files with 4746 additions and 19627 deletions

View File

@@ -1,35 +1,16 @@
#include "foobar2000.h"
#include <exception>
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)
{
std::exception_ptr rethrow;
bool havePartial = false, tryingPartial = false;
for ( ;; ) {
service_enum_t<packet_decoder_entry> e;
service_ptr_t<packet_decoder_entry> ptr;
while (e.next(ptr)) {
p_abort.check();
if (ptr->is_our_setup(p_owner, p_param1, p_param2, p_param2size)) {
if (!tryingPartial && ptr->is_supported_partially_(p_owner, p_param1, p_param2, p_param2size)) {
havePartial = true;
} else {
try {
ptr->open(p_out, p_decode, p_owner, p_param1, p_param2, p_param2size, p_abort);
return;
} catch (exception_io_data) {
rethrow = std::current_exception();
}
}
}
service_enum_t<packet_decoder_entry> e;
service_ptr_t<packet_decoder_entry> ptr;
while(e.next(ptr)) {
p_abort.check();
if (ptr->is_our_setup(p_owner,p_param1,p_param2,p_param2size)) {
ptr->open(p_out,p_decode,p_owner,p_param1,p_param2,p_param2size,p_abort);
return;
}
if (!havePartial || tryingPartial) break;
tryingPartial = true;
}
if (rethrow) std::rethrow_exception(rethrow);
throw exception_io_data();
}
@@ -53,11 +34,3 @@ void packet_decoder::setAllowDelayed( bool bAllow ) {
this->set_stream_property( property_allow_delayed_output, bAllow ? 1 : 0, NULL, 0);
}
bool packet_decoder_entry::is_supported_partially_(const GUID& p_owner, t_size p_param1, const void* p_param2, t_size p_param2size) {
bool ret = false;
packet_decoder_entry_v2::ptr v2;
if (v2 &= this) {
ret = v2->is_supported_partially(p_owner, p_param1, p_param2, p_param2size);
}
return ret;
}