mirror of
https://github.com/WiVRn/WiVRn.git
synced 2026-11-20 00:51:32 -08:00
Use inheritance for decoder implementations
This commit is contained in:
1 parent
cc5990a513
commit
6b99cf4cc3
9 files changed
+249
-130
No files matched your search
@@ -0,0 +1,67 @@
|
||||
/*
|
||||
* WiVRn VR streaming
|
||||
* Copyright (C) 2025 Patrick Nicolas <[email protected]>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "decoder.h"
|
||||
|
||||
#ifdef __ANDROID__
|
||||
#include "decoder/android/android_decoder.h"
|
||||
#else
|
||||
#include "decoder/ffmpeg/ffmpeg_decoder.h"
|
||||
#endif
|
||||
|
||||
wivrn::decoder::~decoder() = default;
|
||||
|
||||
std::shared_ptr<wivrn::decoder> wivrn::decoder::make(
|
||||
vk::raii::Device & device,
|
||||
vk::raii::PhysicalDevice & phys_dev,
|
||||
const wivrn::to_headset::video_stream_description::item & description,
|
||||
float fps,
|
||||
uint8_t stream_index,
|
||||
std::weak_ptr<scenes::stream> scene,
|
||||
shard_accumulator * acc)
|
||||
{
|
||||
#ifdef __ANDROID__
|
||||
return std::make_shared<wivrn::android::decoder>(
|
||||
device,
|
||||
phys_dev,
|
||||
description,
|
||||
fps,
|
||||
stream_index,
|
||||
scene,
|
||||
acc);
|
||||
#else
|
||||
return std::make_shared<wivrn::ffmpeg::decoder>(
|
||||
device,
|
||||
phys_dev,
|
||||
description,
|
||||
stream_index,
|
||||
scene,
|
||||
acc);
|
||||
#endif
|
||||
}
|
||||
|
||||
std::vector<wivrn::video_codec> wivrn::decoder::supported_codecs()
|
||||
{
|
||||
std::vector<wivrn::video_codec> res;
|
||||
#ifdef __ANDROID__
|
||||
android::decoder::supported_codecs(res);
|
||||
#else
|
||||
ffmpeg::decoder::supported_codecs(res);
|
||||
#endif
|
||||
return res;
|
||||
}
|
||||
Reference in new issue
Block a user