diff --git a/headers/os/media/BufferProducer.h b/headers/os/media/BufferProducer.h index 4d00c89975..6334aefc95 100644 --- a/headers/os/media/BufferProducer.h +++ b/headers/os/media/BufferProducer.h @@ -178,6 +178,8 @@ protected: void SetInitialLatency(bigtime_t inInitialLatency, uint32 flags = 0); + // TODO: Needs a Perform() virtual method! + private: // FBC padding and forbidden methods BBufferProducer(); @@ -223,5 +225,5 @@ private: uint32 _reserved_buffer_producer_[12]; }; -#endif /* _BUFFER_PRODUCER_H */ +#endif // _BUFFER_PRODUCER_H diff --git a/headers/os/media/Controllable.h b/headers/os/media/Controllable.h index c8f1decf1c..35588a51e2 100644 --- a/headers/os/media/Controllable.h +++ b/headers/os/media/Controllable.h @@ -1,139 +1,124 @@ -/******************************************************************************* -/ -/ File: Controllable.h -/ -/ Description: A BControllable is a BMediaNode with "tweakable" parameters/settings. -/ -/ Copyright 1997-98, Be Incorporated, All Rights Reserved -/ -*******************************************************************************/ - -#if !defined(_CONTROLLABLE_H) +/* + * Copyright 2009, Haiku, Inc. All rights reserved. + * Distributed under the terms of the MIT License. + */ +#ifndef _CONTROLLABLE_H #define _CONTROLLABLE_H -#include + #include + class BParameterWeb; -class BControllable : - public virtual BMediaNode -{ +class BControllable : public virtual BMediaNode { protected: - /* Need this to force vtable */ -virtual ~BControllable(); + virtual ~BControllable(); public: - /* BControllable might seem somewhat spartan. */ + // Control change requests and notifications typically come in/go out in + // B_MEDIA_PARAMETERS type buffers (and a BControllable thus also needs + // to be a BBufferConsumer and/or a BBufferProducer). + // The format of these buffers is: + // media_node(node), + // int32(count) + // repeat(count) { + // int64(when), + // int32(control_id), + // int32(value_size), + // + // } - /* That is because control change requests and notifications */ - /* typically come in/go out in B_MEDIA_PARAMETERS type buffers */ - /* (and a BControllable thus also needs to be a BBufferConsumer */ - /* and/or a BBufferProducer) */ - /* The format of these buffers is: */ - /* media_node(node), int32(count) */ - /* repeat(count) { int64(when), int32(control_id), int32(value_size), } */ - - BParameterWeb * Web(); - bool LockParameterWeb(); - void UnlockParameterWeb(); + BParameterWeb* Web(); + bool LockParameterWeb(); + void UnlockParameterWeb(); protected: - BControllable(); /* call SetParameterWeb() from your constructor */ - status_t SetParameterWeb( - BParameterWeb * web); + BControllable(); -virtual status_t HandleMessage( - int32 message, - const void * data, - size_t size); + // NOTE: Call SetParameterWeb() from your constructor! + status_t SetParameterWeb(BParameterWeb* web); - /* Call when the actual control changes, NOT when the value changes. */ - /* A typical case would be a CD with a Selector for Track when a new CD is inserted */ - status_t BroadcastChangedParameter( - int32 id); + virtual status_t HandleMessage(int32 message, const void* data, + size_t size); - /* Call this function when a value change takes effect, and */ - /* you want people who are interested to stay in sync with you. */ - /* Don't call this too densely, though, or you will flood the system */ - /* with messages. */ - status_t BroadcastNewParameterValue( - bigtime_t when, // performance time - int32 id, // parameter ID - void * newValue, - size_t valueSize); + // Call when the actual control changes, NOT when the value changes. + // A typical case would be a CD with a Selector for Track when a new + // CD is inserted. + status_t BroadcastChangedParameter(int32 id); - /* These are alternate methods of accomplishing the same thing as */ - /* connecting to control information source/destinations would. */ -virtual status_t GetParameterValue( - int32 id, - bigtime_t * last_change, - void * value, - size_t * ioSize) = 0; -virtual void SetParameterValue( - int32 id, - bigtime_t when, - const void * value, - size_t size) = 0; + // Call this function when a value change takes effect, and + // you want people who are interested to stay in sync with you. + // Don't call this too densely, though, or you will flood the system + // with messages. + status_t BroadcastNewParameterValue( + bigtime_t performanceTime, + int32 parameterID, void* newValue, + size_t valueSize); - /* The default implementation of StartControlPanel launches the add-on */ - /* as an application (if the Node lives in an add-on). Thus, you can write your */ - /* control panel as a "main()" in your add-on, and it'll automagically work! */ - /* Your add-on needs to have multi-launch app flags for this to work right. */ - /* The first argv argument to main() will be a string of the format "node=%d" */ - /* with the node ID in question as "%d". */ -virtual status_t StartControlPanel( - BMessenger * out_messenger); + // These are alternate methods of accomplishing the same thing as + // connecting to control information source/destinations would. + virtual status_t GetParameterValue(int32 id, + bigtime_t* lastChange, + void* value, size_t* ioSize) = 0; - /* Call this from your BufferReceived() for control information buffers */ - /* if you implement BBufferConsumer for that format (recommended!) */ - status_t ApplyParameterData( - const void * value, - size_t size); - /* If you want to generate control information for a set of controls, you */ - /* can use this utility function. */ - status_t MakeParameterData( - const int32 * controls, - int32 count, - void * buf, - size_t * ioSize); + virtual void SetParameterValue(int32 id, bigtime_t when, + const void* value, size_t size) = 0; + + // The default implementation of StartControlPanel launches the add-on + // as an application (if the Node lives in an add-on). Thus, you can + // write your control panel as a "main()" in your add-on, and it'll + // automagically work! Your add-on needs to have multi-launch app flags + // for this to work right. The first argv argument to main() will be a + // string of the format "node=%d" with the node ID in question as "%d". + virtual status_t StartControlPanel(BMessenger* _messenger); + + // Call this from your BufferReceived() for control information buffers + // if you implement BBufferConsumer for that format (recommended!) + status_t ApplyParameterData(const void* value, + size_t size); + // If you want to generate control information for a set of controls, you + // can use this utility function. + status_t MakeParameterData(const int32* controls, + int32 count, void* buffer, size_t* ioSize); + + // TODO: Needs a Perform() virtual method! private: + // FBC padding and forbidden methods + BControllable(const BControllable& other); + BControllable& operator=(const BControllable& other); - friend class BMediaNode; + virtual status_t _Reserved_Controllable_0(void*); + virtual status_t _Reserved_Controllable_1(void*); + virtual status_t _Reserved_Controllable_2(void*); + virtual status_t _Reserved_Controllable_3(void*); + virtual status_t _Reserved_Controllable_4(void*); + virtual status_t _Reserved_Controllable_5(void*); + virtual status_t _Reserved_Controllable_6(void*); + virtual status_t _Reserved_Controllable_7(void*); + virtual status_t _Reserved_Controllable_8(void*); + virtual status_t _Reserved_Controllable_9(void*); + virtual status_t _Reserved_Controllable_10(void*); + virtual status_t _Reserved_Controllable_11(void*); + virtual status_t _Reserved_Controllable_12(void*); + virtual status_t _Reserved_Controllable_13(void*); + virtual status_t _Reserved_Controllable_14(void*); + virtual status_t _Reserved_Controllable_15(void*); - BControllable( /* private unimplemented */ - const BControllable & clone); - BControllable & operator=( - const BControllable & clone); +private: + friend class BMediaNode; - /* Mmmh, stuffing! */ -virtual status_t _Reserved_Controllable_0(void *); -virtual status_t _Reserved_Controllable_1(void *); -virtual status_t _Reserved_Controllable_2(void *); -virtual status_t _Reserved_Controllable_3(void *); -virtual status_t _Reserved_Controllable_4(void *); -virtual status_t _Reserved_Controllable_5(void *); -virtual status_t _Reserved_Controllable_6(void *); -virtual status_t _Reserved_Controllable_7(void *); -virtual status_t _Reserved_Controllable_8(void *); -virtual status_t _Reserved_Controllable_9(void *); -virtual status_t _Reserved_Controllable_10(void *); -virtual status_t _Reserved_Controllable_11(void *); -virtual status_t _Reserved_Controllable_12(void *); -virtual status_t _Reserved_Controllable_13(void *); -virtual status_t _Reserved_Controllable_14(void *); -virtual status_t _Reserved_Controllable_15(void *); + BParameterWeb* fWeb; + sem_id fSem; + int32 fBen; - BParameterWeb * fWeb; - sem_id fSem; - int32 fBen; - uint32 _reserved_controllable_[14]; + uint32 _reserved_controllable_[14]; }; -#endif /* _CONTROLLABLE_H */ +#endif // _CONTROLLABLE_H diff --git a/headers/os/media/FileInterface.h b/headers/os/media/FileInterface.h index 6a6bfe2db4..67d75a565c 100644 --- a/headers/os/media/FileInterface.h +++ b/headers/os/media/FileInterface.h @@ -1,93 +1,67 @@ -/******************************************************************************* -/ -/ File: FileInterface.h -/ -/ Description: A BFileInterface is something which can read and/or write files for the -/ use of other Media Kit participants. -/ -/ Copyright 1997-98, Be Incorporated, All Rights Reserved -/ -*******************************************************************************/ - -#if !defined(_FILE_INTERFACE_H) +/* + * Copyright 2009, Haiku, Inc. All rights reserved. + * Distributed under the terms of the MIT License. + */ +#ifndef _FILE_INTERFACE_H #define _FILE_INTERFACE_H -#include + #include + struct entry_ref; -class BFileInterface : - public virtual BMediaNode -{ +class BFileInterface : public virtual BMediaNode { protected: - -virtual ~BFileInterface(); /* force vtable */ - -public: - - /* look, no hands! */ + virtual ~BFileInterface(); protected: + BFileInterface(); - BFileInterface(); -virtual status_t HandleMessage( - int32 message, - const void * data, - size_t size); + virtual status_t HandleMessage(int32 message, const void* data, + size_t size); -virtual status_t GetNextFileFormat( - int32 * cookie, - media_file_format * out_format) = 0; -virtual void DisposeFileFormatCookie( - int32 cookie) = 0; + virtual status_t GetNextFileFormat(int32* cookie, + media_file_format* _format) = 0; + virtual void DisposeFileFormatCookie(int32 cookie) = 0; -virtual status_t GetDuration( - bigtime_t * out_time) = 0; -virtual status_t SniffRef( - const entry_ref & file, - char * out_mime_type, /* 256 bytes */ - float * out_quality) = 0; -virtual status_t SetRef( - const entry_ref & file, - bool create, - bigtime_t * out_time) = 0; -virtual status_t GetRef( - entry_ref * out_ref, - char * out_mime_type) = 0; + virtual status_t GetDuration(bigtime_t* _time) = 0; + virtual status_t SniffRef(const entry_ref& file, + char* _mimeType, // 256 bytes + float* _quality) = 0; + virtual status_t SetRef(const entry_ref& file, + bool create, bigtime_t* _time) = 0; + virtual status_t GetRef(entry_ref* _ref, char* _mimeType) = 0; + + // TODO: Needs a Perform() virtual method! private: - + // FBC padding and forbidden methods friend class BMediaNode; - BFileInterface( /* private unimplemented */ - const BFileInterface & clone); - BFileInterface & operator=( - const BFileInterface & clone); + BFileInterface(const BFileInterface& other); + BFileInterface& operator=(const BFileInterface& other); - /* Mmmh, stuffing! */ -virtual status_t _Reserved_FileInterface_0(void *); -virtual status_t _Reserved_FileInterface_1(void *); -virtual status_t _Reserved_FileInterface_2(void *); -virtual status_t _Reserved_FileInterface_3(void *); -virtual status_t _Reserved_FileInterface_4(void *); -virtual status_t _Reserved_FileInterface_5(void *); -virtual status_t _Reserved_FileInterface_6(void *); -virtual status_t _Reserved_FileInterface_7(void *); -virtual status_t _Reserved_FileInterface_8(void *); -virtual status_t _Reserved_FileInterface_9(void *); -virtual status_t _Reserved_FileInterface_10(void *); -virtual status_t _Reserved_FileInterface_11(void *); -virtual status_t _Reserved_FileInterface_12(void *); -virtual status_t _Reserved_FileInterface_13(void *); -virtual status_t _Reserved_FileInterface_14(void *); -virtual status_t _Reserved_FileInterface_15(void *); - - uint32 _reserved_file_interface_[16]; + virtual status_t _Reserved_FileInterface_0(void*); + virtual status_t _Reserved_FileInterface_1(void*); + virtual status_t _Reserved_FileInterface_2(void*); + virtual status_t _Reserved_FileInterface_3(void*); + virtual status_t _Reserved_FileInterface_4(void*); + virtual status_t _Reserved_FileInterface_5(void*); + virtual status_t _Reserved_FileInterface_6(void*); + virtual status_t _Reserved_FileInterface_7(void*); + virtual status_t _Reserved_FileInterface_8(void*); + virtual status_t _Reserved_FileInterface_9(void*); + virtual status_t _Reserved_FileInterface_10(void*); + virtual status_t _Reserved_FileInterface_11(void*); + virtual status_t _Reserved_FileInterface_12(void*); + virtual status_t _Reserved_FileInterface_13(void*); + virtual status_t _Reserved_FileInterface_14(void*); + virtual status_t _Reserved_FileInterface_15(void*); + uint32 _reserved_file_interface_[16]; }; - -#endif /* _FILE_INTERFACE_H */ +#endif // _FILE_INTERFACE_H diff --git a/headers/os/media/MediaAddOn.h b/headers/os/media/MediaAddOn.h index 6d14a0c624..270102a92f 100644 --- a/headers/os/media/MediaAddOn.h +++ b/headers/os/media/MediaAddOn.h @@ -1,181 +1,174 @@ -/******************************************************************************* -/ -/ File: MediaAddOn.h -/ -/ Description: A BMediaAddOn is created by Media Kit add-ons to instantiate and -/ handle "latent" Nodes. -/ -/ Copyright 1997-98, Be Incorporated, All Rights Reserved -/ -*******************************************************************************/ - -#if !defined(_MEDIA_ADD_ON_H) +/* + * Copyright 2009, Haiku, Inc. All rights reserved. + * Distributed under the terms of the MIT License. + */ +#ifndef _MEDIA_ADD_ON_H #define _MEDIA_ADD_ON_H + #include #include #include + class BMediaNode; class BMimeType; struct entry_ref; struct dormant_node_info { - dormant_node_info(); - ~dormant_node_info(); + dormant_node_info(); + ~dormant_node_info(); + + media_addon_id addon; + int32 flavor_id; + char name[B_MEDIA_NAME_LENGTH]; - media_addon_id addon; - int32 flavor_id; - char name[B_MEDIA_NAME_LENGTH]; private: - char reserved[128]; + char reserved[128]; }; -enum -{ // flavor_flags - B_FLAVOR_IS_GLOBAL = 0x100000L, // force in media_addon_server, only one instance - B_FLAVOR_IS_LOCAL = 0x200000L // force in loading app, many instances - // if none is set, could go either way +// flavor_flags +enum { + B_FLAVOR_IS_GLOBAL = 0x100000L, // force in media_addon_server, + // only one instance + B_FLAVOR_IS_LOCAL = 0x200000L // force in loading app, many + // instances if none is set, could + // go either way }; struct flavor_info { - char * name; - char * info; - uint64 kinds; /* node_kind */ + char* name; + char* info; + uint64 kinds; // node kind uint32 flavor_flags; - int32 internal_id; /* For BMediaAddOn internal use */ - int32 possible_count; /* 0 for "any number" */ + int32 internal_id; // For BMediaAddOn internal use + int32 possible_count; // 0 for "any number" - int32 in_format_count; /* for BufferConsumer kinds */ - uint32 in_format_flags; /* set to 0 */ - const media_format * in_formats; + int32 in_format_count; // for BufferConsumer kinds + uint32 in_format_flags; // set to 0 + const media_format* in_formats; - int32 out_format_count; /* for BufferProducer kinds */ - uint32 out_format_flags; /* set to 0 */ - const media_format * out_formats; + int32 out_format_count; // for BufferProducer kinds + uint32 out_format_flags; // set to 0 + const media_format* out_formats; uint32 _reserved_[16]; private: - flavor_info & operator=(const flavor_info & other); + flavor_info& operator=(const flavor_info& other); }; struct dormant_flavor_info : public flavor_info, public BFlattenable { + dormant_flavor_info(); + virtual ~dormant_flavor_info(); - dormant_flavor_info(); -virtual ~dormant_flavor_info(); - dormant_flavor_info(const dormant_flavor_info &); - dormant_flavor_info& operator=(const dormant_flavor_info &); - dormant_flavor_info& operator=(const flavor_info &); + dormant_flavor_info( + const dormant_flavor_info& other); + dormant_flavor_info& operator=(const dormant_flavor_info& other); + dormant_flavor_info& operator=(const flavor_info& other); - dormant_node_info node_info; + dormant_node_info node_info; - void set_name(const char * in_name); - void set_info(const char * in_info); - void add_in_format(const media_format & in_format); - void add_out_format(const media_format & out_format); + void set_name(const char* name); + void set_info(const char* info); + void add_in_format(const media_format& format); + void add_out_format(const media_format& format); -virtual bool IsFixedSize() const; -virtual type_code TypeCode() const; -virtual ssize_t FlattenedSize() const; -virtual status_t Flatten(void *buffer, ssize_t size) const; -virtual status_t Unflatten(type_code c, const void *buf, ssize_t size); + virtual bool IsFixedSize() const; + virtual type_code TypeCode() const; + virtual ssize_t FlattenedSize() const; + virtual status_t Flatten(void* buffer, ssize_t size) const; + virtual status_t Unflatten(type_code type, const void* buffer, + ssize_t size); }; + namespace BPrivate { -namespace media { - class DormantNodeManager; -}; + namespace media { + class DormantNodeManager; + }; }; -/* a MediaAddOn is something which can manufacture MediaNodes */ -class BMediaAddOn -{ + +//! a MediaAddOn is something which can manufacture MediaNodes +class BMediaAddOn { public: -explicit BMediaAddOn( - image_id image); -virtual ~BMediaAddOn(); + explicit BMediaAddOn(image_id image); + virtual ~BMediaAddOn(); -virtual status_t InitCheck( - const char ** out_failure_text); -virtual int32 CountFlavors(); -virtual status_t GetFlavorAt( - int32 n, - const flavor_info ** out_info); -virtual BMediaNode * InstantiateNodeFor( - const flavor_info * info, - BMessage * config, - status_t * out_error); -virtual status_t GetConfigurationFor( - BMediaNode * your_node, - BMessage * into_message); -virtual bool WantsAutoStart(); -virtual status_t AutoStart( - int in_index, - BMediaNode ** out_node, - int32 * out_internal_id, - bool * out_has_more); -/* only implement if you have a B_FILE_INTERFACE node */ -virtual status_t SniffRef( - const entry_ref & file, - BMimeType * io_mime_type, - float * out_quality, - int32 * out_internal_id); -virtual status_t SniffType( // This is broken if you deal with producers - const BMimeType & type, // and consumers both. Use SniffTypeKind instead. - float * out_quality, // If you implement SniffTypeKind, this doesn't - int32 * out_internal_id); // get called. -virtual status_t GetFileFormatList( - int32 flavor_id, // for this node flavor (if it matters) - media_file_format * out_writable_formats, // don't write here if NULL - int32 in_write_items, // this many slots in out_writable_formats - int32 * out_write_items, // set this to actual # available, even if bigger than in count - media_file_format * out_readable_formats, // don't write here if NULL - int32 in_read_items, // this many slots in out_readable_formats - int32 * out_read_items, // set this to actual # available, even if bigger than in count - void * _reserved); // ignore until further notice -virtual status_t SniffTypeKind( // Like SniffType, but for the specific kind(s) - const BMimeType & type, - uint64 in_kinds, - float * out_quality, - int32 * out_internal_id, - void * _reserved); + virtual status_t InitCheck(const char** _failureText); + virtual int32 CountFlavors(); + virtual status_t GetFlavorAt(int32 index, + const flavor_info** _info); + virtual BMediaNode* InstantiateNodeFor(const flavor_info* info, + BMessage* config, status_t* _error); + virtual status_t GetConfigurationFor(BMediaNode* yourNode, + BMessage* intoMessage); + virtual bool WantsAutoStart(); + virtual status_t AutoStart(int index, BMediaNode** _node, + int32* _internalID, bool* _hasMore); - image_id ImageID(); - media_addon_id AddonID(); + // NOTE: Only implement if you have a B_FILE_INTERFACE node + virtual status_t SniffRef(const entry_ref& file, + BMimeType* ioMimeType, float* _quality, + int32* _internalID); + // NOTE: This is broken if you deal with producers and consumers both. + // Implement SniffTypeKind instead. If you implement SniffTypeKind, this + // doesn't get called. + virtual status_t SniffType(const BMimeType& type, + float* _quality, int32* _internalID); + + virtual status_t GetFileFormatList(int32 forNodeFlavorID, + media_file_format* _writableFormats, + int32 writableFormatsCount, + int32* _writableFormatsTotalCount, + media_file_format* _readableFormats, + int32 readableFormatsCount, + int32* _readableFormatsTotalCount, + void* _reserved); + + // NOTE: Like SniffType, but for the specific kind(s) + virtual status_t SniffTypeKind(const BMimeType& type, + uint64 kinds, float* _quality, + int32* _internalID, void* _reserved); + + image_id ImageID(); + media_addon_id AddonID(); protected: + // Calling this will cause everyone to get notified, and also + // cause the server to re-scan your flavor info. It is thread safe. + status_t NotifyFlavorChange(); - // Calling this will cause everyone to get notified, and also - // cause the server to re-scan your flavor info. It is thread safe. - status_t NotifyFlavorChange(); + // TODO: Needs a Perform() virtual method! private: - BMediaAddOn(); /* private unimplemented */ - BMediaAddOn(const BMediaAddOn & clone); - BMediaAddOn & operator=(const BMediaAddOn & clone); + // FBC padding and forbidden methods + BMediaAddOn(); + BMediaAddOn(const BMediaAddOn& other); + BMediaAddOn& operator=(const BMediaAddOn& other); - friend class BPrivate::media::DormantNodeManager; + friend class BPrivate::media::DormantNodeManager; - /* Mmmh, stuffing! */ -virtual status_t _Reserved_MediaAddOn_2(void *); -virtual status_t _Reserved_MediaAddOn_3(void *); -virtual status_t _Reserved_MediaAddOn_4(void *); -virtual status_t _Reserved_MediaAddOn_5(void *); -virtual status_t _Reserved_MediaAddOn_6(void *); -virtual status_t _Reserved_MediaAddOn_7(void *); + virtual status_t _Reserved_MediaAddOn_2(void*); + virtual status_t _Reserved_MediaAddOn_3(void*); + virtual status_t _Reserved_MediaAddOn_4(void*); + virtual status_t _Reserved_MediaAddOn_5(void*); + virtual status_t _Reserved_MediaAddOn_6(void*); + virtual status_t _Reserved_MediaAddOn_7(void*); - image_id fImage; - media_addon_id fAddon; - uint32 _reserved_media_add_on_[7]; + image_id fImage; + media_addon_id fAddon; + + uint32 _reserved_media_add_on_[7]; }; #if BUILDING_MEDIA_ADDON -extern "C" _EXPORT BMediaAddOn * make_media_addon(image_id you); + extern "C" _EXPORT BMediaAddOn* make_media_addon(image_id yourImage); #endif -#endif /* _MEDIA_ADD_ON_H */ +#endif // _MEDIA_ADD_ON_H