| 3 | #include "modules/vorbis/audio_stream_ogg_vorbis.h" |
| 4 | |
| 5 | Ref<Resource> OggStreamConverterCompat::convert(const Ref<MissingResource> &res, ResourceInfo::LoadType p_type, int ver_major, Error *r_error) { |
| 6 | String name = get_resource_name(res, ver_major); |
| 7 | Vector<uint8_t> data = res->get("data"); |
| 8 | bool loop = res->get("loop"); |
| 9 | double loop_offset = res->get("loop_offset"); |
| 10 | Ref<AudioStreamOggVorbis> sample = AudioStreamOggVorbis::load_from_buffer(data); |
| 11 | ERR_FAIL_COND_V_MSG(sample.is_null(), res, "Failed to load Ogg Vorbis stream from buffer."); |
| 12 | if (!name.is_empty()) { |
| 13 | sample->set_name(name); |
| 14 | } |
| 15 | sample->set_loop(loop); |
| 16 | sample->set_loop_offset(loop_offset); |
| 17 | auto info = ResourceInfo::get_info_from_resource(res); |
| 18 | ERR_FAIL_COND_V_MSG(!info.is_valid(), res, "Missing resource has no compat metadata??????????? This should have been set by the missing resource instance function(s)!!!!!!!!"); |
| 19 | if (info.is_valid()) { |
| 20 | info->set_on_resource(sample); |
| 21 | } |
| 22 | return sample; |
| 23 | } |
| 24 | |
| 25 | bool OggStreamConverterCompat::handles_type(const String &p_type, int ver_major) const { |
| 26 | return ((p_type == "AudioStreamOGGVorbis" || p_type == "AudioStreamOggVorbis") && ver_major <= 3); |
nothing calls this directly
no test coverage detected