From c38d73ee4c8f4d1d6228b506bc93e66ec865d4e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Fri, 23 Jan 2004 07:24:51 +0000 Subject: [PATCH] New meta_format structure that is used internally by BMediaFormats and the FormatManager in the server. Update the plugin API. git-svn-id: file:///srv/svn/repos/haiku/trunk/current@6241 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- headers/private/media/DecoderPlugin.h | 21 +++++--------- headers/private/media/MediaPlugin.h | 2 -- headers/private/media/MetaFormat.h | 42 +++++++++++++++++++++++++++ headers/private/media/PluginManager.h | 5 ---- 4 files changed, 49 insertions(+), 21 deletions(-) create mode 100644 headers/private/media/MetaFormat.h diff --git a/headers/private/media/DecoderPlugin.h b/headers/private/media/DecoderPlugin.h index 3082b9cab3..fa913fc83a 100644 --- a/headers/private/media/DecoderPlugin.h +++ b/headers/private/media/DecoderPlugin.h @@ -20,7 +20,9 @@ class Decoder public: Decoder(); virtual ~Decoder(); - + + virtual void GetCodecInfo(media_codec_info &codecInfo) = 0; + // Setup get's called with the info data from Reader::GetStreamInfo virtual status_t Setup(media_format *ioEncodedFormat, const void *infoBuffer, int32 infoSize) = 0; @@ -44,20 +46,11 @@ private: class DecoderPlugin : public virtual MediaPlugin { -public: - DecoderPlugin(); + public: + DecoderPlugin(); - virtual Decoder * NewDecoder() = 0; - - status_t PublishDecoder(const char *meta_description, - const char *short_name, - const char *pretty_name, - const char *default_mapping = 0); - -private: - friend class AddOnManager; - void Setup(void *publish_hook); - void * fPublishHook; + virtual Decoder *NewDecoder() = 0; + virtual status_t RegisterDecoder() = 0; }; } } // namespace BPrivate::media diff --git a/headers/private/media/MediaPlugin.h b/headers/private/media/MediaPlugin.h index 54bf3f6050..dc54a2a878 100644 --- a/headers/private/media/MediaPlugin.h +++ b/headers/private/media/MediaPlugin.h @@ -11,8 +11,6 @@ class MediaPlugin public: MediaPlugin(); virtual ~MediaPlugin(); - - virtual status_t RegisterPlugin(); }; class Decoder; diff --git a/headers/private/media/MetaFormat.h b/headers/private/media/MetaFormat.h new file mode 100644 index 0000000000..04df17c710 --- /dev/null +++ b/headers/private/media/MetaFormat.h @@ -0,0 +1,42 @@ +/* +** Copyright 2004, Axel Dörfler, axeld@pinc-software.de. All rights reserved. +** Distributed under the terms of the OpenBeOS License. +*/ +#ifndef META_FORMAT_H +#define META_FORMAT_H + + +#include + + +namespace BPrivate { +namespace media { + +// Implementation can be found in MediaFormats.cpp + +#define MEDIA_META_FORMAT_TYPE 'MeFo' + // to be used in the MEDIA_SERVER_GET_FORMATS message reply + +struct meta_format { + meta_format(); + meta_format(const media_format_description &description, const media_format &format, int32 id); + meta_format(const media_format_description &description); + meta_format(const meta_format &other); + + bool Matches(const media_format &format, media_format_family family); + static int CompareDescriptions(const meta_format *a, const meta_format *b); + static int Compare(const meta_format *a, const meta_format *b); + + media_format_description description; + media_format format; + int32 id; +}; + +typedef status_t (*_MakeFormatHookFunc)(const media_format_description *descriptions, + int32 descriptionsCount, media_format *format, uint32 flags); +extern _MakeFormatHookFunc _gMakeFormatHook; + +} // namespace media +} // namespace BPrivate + +#endif /* META_FORMAT_H */ diff --git a/headers/private/media/PluginManager.h b/headers/private/media/PluginManager.h index c8b730062c..f7c998b110 100644 --- a/headers/private/media/PluginManager.h +++ b/headers/private/media/PluginManager.h @@ -12,11 +12,6 @@ status_t _CreateDecoder(Decoder **decoder, media_codec_info *mci, const media_fo void _DestroyReader(Reader *reader); void _DestroyDecoder(Decoder *decoder); -status_t _PublishDecoder(DecoderPlugin *decoderplugin, - const char *meta_description, - const char *short_name, - const char *pretty_name, - const char *default_mapping /* = 0 */); class PluginManager {