Rewrote headers.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32753 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stephan Aßmus
2009-08-27 13:49:18 +00:00
parent 8780d2073d
commit d95656d79e
4 changed files with 258 additions and 304 deletions
+3 -1
View File
@@ -178,6 +178,8 @@ protected:
void SetInitialLatency(bigtime_t inInitialLatency, void SetInitialLatency(bigtime_t inInitialLatency,
uint32 flags = 0); uint32 flags = 0);
// TODO: Needs a Perform() virtual method!
private: private:
// FBC padding and forbidden methods // FBC padding and forbidden methods
BBufferProducer(); BBufferProducer();
@@ -223,5 +225,5 @@ private:
uint32 _reserved_buffer_producer_[12]; uint32 _reserved_buffer_producer_[12];
}; };
#endif /* _BUFFER_PRODUCER_H */ #endif // _BUFFER_PRODUCER_H
+67 -82
View File
@@ -1,40 +1,35 @@
/******************************************************************************* /*
/ * Copyright 2009, Haiku, Inc. All rights reserved.
/ File: Controllable.h * Distributed under the terms of the MIT License.
/ */
/ Description: A BControllable is a BMediaNode with "tweakable" parameters/settings. #ifndef _CONTROLLABLE_H
/
/ Copyright 1997-98, Be Incorporated, All Rights Reserved
/
*******************************************************************************/
#if !defined(_CONTROLLABLE_H)
#define _CONTROLLABLE_H #define _CONTROLLABLE_H
#include <MediaDefs.h>
#include <MediaNode.h> #include <MediaNode.h>
class BParameterWeb; class BParameterWeb;
class BControllable : class BControllable : public virtual BMediaNode {
public virtual BMediaNode
{
protected: protected:
/* Need this to force vtable */
virtual ~BControllable(); virtual ~BControllable();
public: 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
/* That is because control change requests and notifications */ // to be a BBufferConsumer and/or a BBufferProducer).
/* typically come in/go out in B_MEDIA_PARAMETERS type buffers */ // The format of these buffers is:
/* (and a BControllable thus also needs to be a BBufferConsumer */ // media_node(node),
/* and/or a BBufferProducer) */ // int32(count)
/* The format of these buffers is: */ // repeat(count) {
/* media_node(node), int32(count) */ // int64(when),
/* repeat(count) { int64(when), int32(control_id), int32(value_size), <value> } */ // int32(control_id),
// int32(value_size),
// <value>
// }
BParameterWeb* Web(); BParameterWeb* Web();
bool LockParameterWeb(); bool LockParameterWeb();
@@ -42,75 +37,61 @@ public:
protected: protected:
BControllable(); /* call SetParameterWeb() from your constructor */ BControllable();
status_t SetParameterWeb(
BParameterWeb * web);
virtual status_t HandleMessage( // NOTE: Call SetParameterWeb() from your constructor!
int32 message, status_t SetParameterWeb(BParameterWeb* web);
const void * data,
virtual status_t HandleMessage(int32 message, const void* data,
size_t size); size_t size);
/* Call when the actual control changes, NOT when the value changes. */ // 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 */ // A typical case would be a CD with a Selector for Track when a new
status_t BroadcastChangedParameter( // CD is inserted.
int32 id); status_t BroadcastChangedParameter(int32 id);
/* Call this function when a value change takes effect, and */ // Call this function when a value change takes effect, and
/* you want people who are interested to stay in sync with you. */ // 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 */ // Don't call this too densely, though, or you will flood the system
/* with messages. */ // with messages.
status_t BroadcastNewParameterValue( status_t BroadcastNewParameterValue(
bigtime_t when, // performance time bigtime_t performanceTime,
int32 id, // parameter ID int32 parameterID, void* newValue,
void * newValue,
size_t valueSize); size_t valueSize);
/* These are alternate methods of accomplishing the same thing as */ // These are alternate methods of accomplishing the same thing as
/* connecting to control information source/destinations would. */ // connecting to control information source/destinations would.
virtual status_t GetParameterValue( virtual status_t GetParameterValue(int32 id,
int32 id, bigtime_t* lastChange,
bigtime_t * last_change, void* value, size_t* ioSize) = 0;
void * value,
size_t * ioSize) = 0;
virtual void SetParameterValue(
int32 id,
bigtime_t when,
const void * value,
size_t size) = 0;
/* The default implementation of StartControlPanel launches the add-on */ virtual void SetParameterValue(int32 id, bigtime_t when,
/* as an application (if the Node lives in an add-on). Thus, you can write your */ const void* value, size_t size) = 0;
/* 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);
/* Call this from your BufferReceived() for control information buffers */ // The default implementation of StartControlPanel launches the add-on
/* if you implement BBufferConsumer for that format (recommended!) */ // as an application (if the Node lives in an add-on). Thus, you can
status_t ApplyParameterData( // write your control panel as a "main()" in your add-on, and it'll
const void * value, // 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); size_t size);
/* If you want to generate control information for a set of controls, you */ // If you want to generate control information for a set of controls, you
/* can use this utility function. */ // can use this utility function.
status_t MakeParameterData( status_t MakeParameterData(const int32* controls,
const int32 * controls, int32 count, void* buffer, size_t* ioSize);
int32 count,
void * buf, // TODO: Needs a Perform() virtual method!
size_t * ioSize);
private: private:
// FBC padding and forbidden methods
BControllable(const BControllable& other);
BControllable& operator=(const BControllable& other);
friend class BMediaNode;
BControllable( /* private unimplemented */
const BControllable & clone);
BControllable & operator=(
const BControllable & clone);
/* Mmmh, stuffing! */
virtual status_t _Reserved_Controllable_0(void*); virtual status_t _Reserved_Controllable_0(void*);
virtual status_t _Reserved_Controllable_1(void*); virtual status_t _Reserved_Controllable_1(void*);
virtual status_t _Reserved_Controllable_2(void*); virtual status_t _Reserved_Controllable_2(void*);
@@ -128,12 +109,16 @@ virtual status_t _Reserved_Controllable_13(void *);
virtual status_t _Reserved_Controllable_14(void*); virtual status_t _Reserved_Controllable_14(void*);
virtual status_t _Reserved_Controllable_15(void*); virtual status_t _Reserved_Controllable_15(void*);
private:
friend class BMediaNode;
BParameterWeb* fWeb; BParameterWeb* fWeb;
sem_id fSem; sem_id fSem;
int32 fBen; int32 fBen;
uint32 _reserved_controllable_[14]; uint32 _reserved_controllable_[14];
}; };
#endif /* _CONTROLLABLE_H */ #endif // _CONTROLLABLE_H
+27 -53
View File
@@ -1,72 +1,48 @@
/******************************************************************************* /*
/ * Copyright 2009, Haiku, Inc. All rights reserved.
/ File: FileInterface.h * Distributed under the terms of the MIT License.
/ */
/ Description: A BFileInterface is something which can read and/or write files for the #ifndef _FILE_INTERFACE_H
/ use of other Media Kit participants.
/
/ Copyright 1997-98, Be Incorporated, All Rights Reserved
/
*******************************************************************************/
#if !defined(_FILE_INTERFACE_H)
#define _FILE_INTERFACE_H #define _FILE_INTERFACE_H
#include <MediaDefs.h>
#include <MediaNode.h> #include <MediaNode.h>
struct entry_ref; struct entry_ref;
class BFileInterface : class BFileInterface : public virtual BMediaNode {
public virtual BMediaNode
{
protected: protected:
virtual ~BFileInterface();
virtual ~BFileInterface(); /* force vtable */
public:
/* look, no hands! */
protected: protected:
BFileInterface(); BFileInterface();
virtual status_t HandleMessage(
int32 message, virtual status_t HandleMessage(int32 message, const void* data,
const void * data,
size_t size); size_t size);
virtual status_t GetNextFileFormat( virtual status_t GetNextFileFormat(int32* cookie,
int32 * cookie, media_file_format* _format) = 0;
media_file_format * out_format) = 0; virtual void DisposeFileFormatCookie(int32 cookie) = 0;
virtual void DisposeFileFormatCookie(
int32 cookie) = 0;
virtual status_t GetDuration( virtual status_t GetDuration(bigtime_t* _time) = 0;
bigtime_t * out_time) = 0; virtual status_t SniffRef(const entry_ref& file,
virtual status_t SniffRef( char* _mimeType, // 256 bytes
const entry_ref & file, float* _quality) = 0;
char * out_mime_type, /* 256 bytes */ virtual status_t SetRef(const entry_ref& file,
float * out_quality) = 0; bool create, bigtime_t* _time) = 0;
virtual status_t SetRef( virtual status_t GetRef(entry_ref* _ref, char* _mimeType) = 0;
const entry_ref & file,
bool create, // TODO: Needs a Perform() virtual method!
bigtime_t * out_time) = 0;
virtual status_t GetRef(
entry_ref * out_ref,
char * out_mime_type) = 0;
private: private:
// FBC padding and forbidden methods
friend class BMediaNode; friend class BMediaNode;
BFileInterface( /* private unimplemented */ BFileInterface(const BFileInterface& other);
const BFileInterface & clone); BFileInterface& operator=(const BFileInterface& other);
BFileInterface & operator=(
const BFileInterface & clone);
/* Mmmh, stuffing! */
virtual status_t _Reserved_FileInterface_0(void*); virtual status_t _Reserved_FileInterface_0(void*);
virtual status_t _Reserved_FileInterface_1(void*); virtual status_t _Reserved_FileInterface_1(void*);
virtual status_t _Reserved_FileInterface_2(void*); virtual status_t _Reserved_FileInterface_2(void*);
@@ -85,9 +61,7 @@ virtual status_t _Reserved_FileInterface_14(void *);
virtual status_t _Reserved_FileInterface_15(void*); virtual status_t _Reserved_FileInterface_15(void*);
uint32 _reserved_file_interface_[16]; uint32 _reserved_file_interface_[16];
}; };
#endif // _FILE_INTERFACE_H
#endif /* _FILE_INTERFACE_H */
+79 -86
View File
@@ -1,22 +1,17 @@
/******************************************************************************* /*
/ * Copyright 2009, Haiku, Inc. All rights reserved.
/ File: MediaAddOn.h * Distributed under the terms of the MIT License.
/ */
/ Description: A BMediaAddOn is created by Media Kit add-ons to instantiate and #ifndef _MEDIA_ADD_ON_H
/ handle "latent" Nodes.
/
/ Copyright 1997-98, Be Incorporated, All Rights Reserved
/
*******************************************************************************/
#if !defined(_MEDIA_ADD_ON_H)
#define _MEDIA_ADD_ON_H #define _MEDIA_ADD_ON_H
#include <image.h> #include <image.h>
#include <MediaDefs.h> #include <MediaDefs.h>
#include <Flattenable.h> #include <Flattenable.h>
class BMediaNode; class BMediaNode;
class BMimeType; class BMimeType;
struct entry_ref; struct entry_ref;
@@ -28,31 +23,34 @@ struct dormant_node_info {
media_addon_id addon; media_addon_id addon;
int32 flavor_id; int32 flavor_id;
char name[B_MEDIA_NAME_LENGTH]; char name[B_MEDIA_NAME_LENGTH];
private: private:
char reserved[128]; char reserved[128];
}; };
enum // flavor_flags
{ // flavor_flags enum {
B_FLAVOR_IS_GLOBAL = 0x100000L, // force in media_addon_server, only one instance B_FLAVOR_IS_GLOBAL = 0x100000L, // force in media_addon_server,
B_FLAVOR_IS_LOCAL = 0x200000L // force in loading app, many instances // only one instance
// if none is set, could go either way B_FLAVOR_IS_LOCAL = 0x200000L // force in loading app, many
// instances if none is set, could
// go either way
}; };
struct flavor_info { struct flavor_info {
char* name; char* name;
char* info; char* info;
uint64 kinds; /* node_kind */ uint64 kinds; // node kind
uint32 flavor_flags; uint32 flavor_flags;
int32 internal_id; /* For BMediaAddOn internal use */ int32 internal_id; // For BMediaAddOn internal use
int32 possible_count; /* 0 for "any number" */ int32 possible_count; // 0 for "any number"
int32 in_format_count; /* for BufferConsumer kinds */ int32 in_format_count; // for BufferConsumer kinds
uint32 in_format_flags; /* set to 0 */ uint32 in_format_flags; // set to 0
const media_format* in_formats; const media_format* in_formats;
int32 out_format_count; /* for BufferProducer kinds */ int32 out_format_count; // for BufferProducer kinds
uint32 out_format_flags; /* set to 0 */ uint32 out_format_flags; // set to 0
const media_format* out_formats; const media_format* out_formats;
uint32 _reserved_[16]; uint32 _reserved_[16];
@@ -62,103 +60,97 @@ private:
}; };
struct dormant_flavor_info : public flavor_info, public BFlattenable { struct dormant_flavor_info : public flavor_info, public BFlattenable {
dormant_flavor_info(); dormant_flavor_info();
virtual ~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(
dormant_flavor_info& operator=(const 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_name(const char* name);
void set_info(const char * in_info); void set_info(const char* info);
void add_in_format(const media_format & in_format); void add_in_format(const media_format& format);
void add_out_format(const media_format & out_format); void add_out_format(const media_format& format);
virtual bool IsFixedSize() const; virtual bool IsFixedSize() const;
virtual type_code TypeCode() const; virtual type_code TypeCode() const;
virtual ssize_t FlattenedSize() const; virtual ssize_t FlattenedSize() const;
virtual status_t Flatten(void* buffer, ssize_t size) 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 status_t Unflatten(type_code type, const void* buffer,
ssize_t size);
}; };
namespace BPrivate { namespace BPrivate {
namespace media { namespace media {
class DormantNodeManager; class DormantNodeManager;
}; };
}; };
/* a MediaAddOn is something which can manufacture MediaNodes */
class BMediaAddOn //! a MediaAddOn is something which can manufacture MediaNodes
{ class BMediaAddOn {
public: public:
explicit BMediaAddOn( explicit BMediaAddOn(image_id image);
image_id image);
virtual ~BMediaAddOn(); virtual ~BMediaAddOn();
virtual status_t InitCheck( virtual status_t InitCheck(const char** _failureText);
const char ** out_failure_text);
virtual int32 CountFlavors(); virtual int32 CountFlavors();
virtual status_t GetFlavorAt( virtual status_t GetFlavorAt(int32 index,
int32 n, const flavor_info** _info);
const flavor_info ** out_info); virtual BMediaNode* InstantiateNodeFor(const flavor_info* info,
virtual BMediaNode * InstantiateNodeFor( BMessage* config, status_t* _error);
const flavor_info * info, virtual status_t GetConfigurationFor(BMediaNode* yourNode,
BMessage * config, BMessage* intoMessage);
status_t * out_error);
virtual status_t GetConfigurationFor(
BMediaNode * your_node,
BMessage * into_message);
virtual bool WantsAutoStart(); virtual bool WantsAutoStart();
virtual status_t AutoStart( virtual status_t AutoStart(int index, BMediaNode** _node,
int in_index, int32* _internalID, bool* _hasMore);
BMediaNode ** out_node,
int32 * out_internal_id, // NOTE: Only implement if you have a B_FILE_INTERFACE node
bool * out_has_more); virtual status_t SniffRef(const entry_ref& file,
/* only implement if you have a B_FILE_INTERFACE node */ BMimeType* ioMimeType, float* _quality,
virtual status_t SniffRef( int32* _internalID);
const entry_ref & file, // NOTE: This is broken if you deal with producers and consumers both.
BMimeType * io_mime_type, // Implement SniffTypeKind instead. If you implement SniffTypeKind, this
float * out_quality, // doesn't get called.
int32 * out_internal_id); virtual status_t SniffType(const BMimeType& type,
virtual status_t SniffType( // This is broken if you deal with producers float* _quality, int32* _internalID);
const BMimeType & type, // and consumers both. Use SniffTypeKind instead.
float * out_quality, // If you implement SniffTypeKind, this doesn't virtual status_t GetFileFormatList(int32 forNodeFlavorID,
int32 * out_internal_id); // get called. media_file_format* _writableFormats,
virtual status_t GetFileFormatList( int32 writableFormatsCount,
int32 flavor_id, // for this node flavor (if it matters) int32* _writableFormatsTotalCount,
media_file_format * out_writable_formats, // don't write here if NULL media_file_format* _readableFormats,
int32 in_write_items, // this many slots in out_writable_formats int32 readableFormatsCount,
int32 * out_write_items, // set this to actual # available, even if bigger than in count int32* _readableFormatsTotalCount,
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); 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(); image_id ImageID();
media_addon_id AddonID(); media_addon_id AddonID();
protected: protected:
// Calling this will cause everyone to get notified, and also // Calling this will cause everyone to get notified, and also
// cause the server to re-scan your flavor info. It is thread safe. // cause the server to re-scan your flavor info. It is thread safe.
status_t NotifyFlavorChange(); status_t NotifyFlavorChange();
// TODO: Needs a Perform() virtual method!
private: private:
BMediaAddOn(); /* private unimplemented */ // FBC padding and forbidden methods
BMediaAddOn(const BMediaAddOn & clone); BMediaAddOn();
BMediaAddOn & operator=(const BMediaAddOn & clone); 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_2(void*);
virtual status_t _Reserved_MediaAddOn_3(void*); virtual status_t _Reserved_MediaAddOn_3(void*);
virtual status_t _Reserved_MediaAddOn_4(void*); virtual status_t _Reserved_MediaAddOn_4(void*);
@@ -168,14 +160,15 @@ virtual status_t _Reserved_MediaAddOn_7(void *);
image_id fImage; image_id fImage;
media_addon_id fAddon; media_addon_id fAddon;
uint32 _reserved_media_add_on_[7]; uint32 _reserved_media_add_on_[7];
}; };
#if BUILDING_MEDIA_ADDON #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
#endif /* _MEDIA_ADD_ON_H */ #endif // _MEDIA_ADD_ON_H