12 #ifndef hifi_HFMFormatRegistry_h
13 #define hifi_HFMFormatRegistry_h
15 #include "HFMSerializer.h"
16 #include <shared/MediaTypeLibrary.h>
17 #include <shared/ReadWriteLockable.h>
21 class FormatRegistry {
23 using MediaTypeID = MediaTypeLibrary::ID;
24 static const MediaTypeID INVALID_MEDIA_TYPE_ID { MediaTypeLibrary::INVALID_ID };
26 MediaTypeID registerMediaType(
const MediaType& mediaType, std::unique_ptr<Serializer::Factory> supportedFactory);
27 void unregisterMediaType(
const MediaTypeID&
id);
29 std::shared_ptr<Serializer> getSerializerForMediaType(
const hifi::ByteArray& data,
const hifi::URL& url,
const std::string& webMediaType)
const;
32 std::shared_ptr<Serializer> getSerializerForMediaTypeID(MediaTypeID
id)
const;
34 MediaTypeLibrary _mediaTypeLibrary;
35 std::mutex _libraryLock;
36 class SupportedFormat {
38 SupportedFormat(
const MediaTypeID& mediaTypeID, std::unique_ptr<Serializer::Factory>& factory) :
39 mediaTypeID(mediaTypeID),
40 factory(std::move(factory)) {
42 MediaTypeID mediaTypeID;
43 std::unique_ptr<Serializer::Factory> factory;
45 std::vector<SupportedFormat> _supportedFormats;