MediaClient: Just some interface review
This commit is contained in:
@@ -35,7 +35,7 @@ public:
|
|||||||
BMediaClient(const char* name,
|
BMediaClient(const char* name,
|
||||||
media_type type
|
media_type type
|
||||||
= B_MEDIA_UNKNOWN_TYPE,
|
= B_MEDIA_UNKNOWN_TYPE,
|
||||||
media_client_kind
|
media_client_kinds
|
||||||
kind = B_MEDIA_PLAYER
|
kind = B_MEDIA_PLAYER
|
||||||
& B_MEDIA_RECORDER);
|
& B_MEDIA_RECORDER);
|
||||||
|
|
||||||
@@ -43,8 +43,10 @@ public:
|
|||||||
|
|
||||||
const media_client& Client() const;
|
const media_client& Client() const;
|
||||||
|
|
||||||
|
media_client_id Id() const;
|
||||||
|
const char* Name() const;
|
||||||
// Return the capabilities of this BMediaClient instance.
|
// Return the capabilities of this BMediaClient instance.
|
||||||
media_client_kind Kind() const;
|
media_client_kinds Kinds() const;
|
||||||
media_type MediaType() const;
|
media_type MediaType() const;
|
||||||
|
|
||||||
status_t InitCheck() const;
|
status_t InitCheck() const;
|
||||||
@@ -55,7 +57,7 @@ public:
|
|||||||
|
|
||||||
// When those functions return, the BMediaConnection is added to the
|
// When those functions return, the BMediaConnection is added to the
|
||||||
// list and is visible to other nodes as not connected. Any input/output
|
// list and is visible to other nodes as not connected. Any input/output
|
||||||
// should be registered to a BMediaNode to become something useful.
|
// should be registered to a BMediaClient to become something useful.
|
||||||
virtual status_t RegisterInput(BMediaInput* input);
|
virtual status_t RegisterInput(BMediaInput* input);
|
||||||
virtual status_t RegisterOutput(BMediaOutput* output);
|
virtual status_t RegisterOutput(BMediaOutput* output);
|
||||||
|
|
||||||
|
|||||||
@@ -13,13 +13,13 @@
|
|||||||
namespace BPrivate { namespace media {
|
namespace BPrivate { namespace media {
|
||||||
|
|
||||||
|
|
||||||
typedef int32 media_client_id;
|
typedef uint64 media_client_id;
|
||||||
typedef int32 media_client_kind;
|
typedef uint64 media_client_kinds;
|
||||||
typedef int32 media_connection_kind;
|
typedef uint64 media_connection_kinds;
|
||||||
typedef int32 media_connection_id;
|
typedef uint64 media_connection_id;
|
||||||
|
|
||||||
|
|
||||||
enum media_client_kinds {
|
enum media_client_kind {
|
||||||
// The client can receive media data.
|
// The client can receive media data.
|
||||||
B_MEDIA_RECORDER = 0x000000001,
|
B_MEDIA_RECORDER = 0x000000001,
|
||||||
// The client can send media data to another client.
|
// The client can send media data to another client.
|
||||||
@@ -28,7 +28,7 @@ enum media_client_kinds {
|
|||||||
B_MEDIA_CONTROLLABLE = 0x000000004
|
B_MEDIA_CONTROLLABLE = 0x000000004
|
||||||
};
|
};
|
||||||
|
|
||||||
enum media_connection_kinds {
|
enum media_connection_kind {
|
||||||
B_MEDIA_INPUT = 0,
|
B_MEDIA_INPUT = 0,
|
||||||
B_MEDIA_OUTPUT = 1
|
B_MEDIA_OUTPUT = 1
|
||||||
};
|
};
|
||||||
@@ -36,12 +36,12 @@ enum media_connection_kinds {
|
|||||||
|
|
||||||
typedef struct media_client {
|
typedef struct media_client {
|
||||||
media_client_id Id() const;
|
media_client_id Id() const;
|
||||||
media_client_kind Kind() const;
|
media_client_kinds Kinds() const;
|
||||||
|
|
||||||
BMessage* ToMessage();
|
BMessage* ToMessage();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
media_client_kind kind;
|
media_client_kinds kinds;
|
||||||
|
|
||||||
media_node node;
|
media_node node;
|
||||||
uint32 padding[16];
|
uint32 padding[16];
|
||||||
@@ -54,7 +54,7 @@ private:
|
|||||||
|
|
||||||
typedef struct media_connection {
|
typedef struct media_connection {
|
||||||
media_connection_id Id() const;
|
media_connection_id Id() const;
|
||||||
media_connection_kind Kind() const;
|
media_connection_kinds Kinds() const;
|
||||||
|
|
||||||
const media_client& Client() const;
|
const media_client& Client() const;
|
||||||
|
|
||||||
@@ -86,7 +86,7 @@ private:
|
|||||||
media_format format;
|
media_format format;
|
||||||
char name[B_MEDIA_NAME_LENGTH];
|
char name[B_MEDIA_NAME_LENGTH];
|
||||||
|
|
||||||
media_connection_kind kind;
|
media_connection_kinds kinds;
|
||||||
uint32 padding[16];
|
uint32 padding[16];
|
||||||
|
|
||||||
friend class BMediaClient;
|
friend class BMediaClient;
|
||||||
|
|||||||
@@ -30,11 +30,11 @@ public:
|
|||||||
virtual ~BMediaConnection();
|
virtual ~BMediaConnection();
|
||||||
|
|
||||||
const media_connection& Connection() const;
|
const media_connection& Connection() const;
|
||||||
|
BMediaClient* Client() const;
|
||||||
|
|
||||||
media_connection_id Id() const;
|
media_connection_id Id() const;
|
||||||
const char* Name() const;
|
const char* Name() const;
|
||||||
|
|
||||||
BMediaClient* MediaClient() const;
|
|
||||||
|
|
||||||
bool IsInput() const;
|
bool IsInput() const;
|
||||||
bool IsOutput() const;
|
bool IsOutput() const;
|
||||||
|
|
||||||
@@ -68,7 +68,8 @@ public:
|
|||||||
status_t Release();
|
status_t Release();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
BMediaConnection(media_connection_kind kind);
|
BMediaConnection(
|
||||||
|
media_connection_kinds kinds);
|
||||||
|
|
||||||
// Those callbacks are shared between BMediaInput and BMediaOutput
|
// Those callbacks are shared between BMediaInput and BMediaOutput
|
||||||
virtual void Connected(const media_format& format);
|
virtual void Connected(const media_format& format);
|
||||||
|
|||||||
@@ -35,8 +35,8 @@ public:
|
|||||||
BSimpleMediaClient(const char* name,
|
BSimpleMediaClient(const char* name,
|
||||||
media_type type
|
media_type type
|
||||||
= B_MEDIA_UNKNOWN_TYPE,
|
= B_MEDIA_UNKNOWN_TYPE,
|
||||||
media_client_kind
|
media_client_kinds
|
||||||
kind = B_MEDIA_PLAYER
|
kinds = B_MEDIA_PLAYER
|
||||||
& B_MEDIA_RECORDER);
|
& B_MEDIA_RECORDER);
|
||||||
|
|
||||||
virtual ~BSimpleMediaClient();
|
virtual ~BSimpleMediaClient();
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
|
|
||||||
|
|
||||||
BMediaClient::BMediaClient(const char* name,
|
BMediaClient::BMediaClient(const char* name,
|
||||||
media_type type, media_client_kind kind)
|
media_type type, media_client_kinds kinds)
|
||||||
:
|
:
|
||||||
fLastID(0)
|
fLastID(0)
|
||||||
{
|
{
|
||||||
@@ -24,7 +24,7 @@ BMediaClient::BMediaClient(const char* name,
|
|||||||
_Init();
|
_Init();
|
||||||
|
|
||||||
fClient.node = fNode->Node();
|
fClient.node = fNode->Node();
|
||||||
fClient.kind = kind;
|
fClient.kinds = kinds;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -52,12 +52,12 @@ BMediaClient::InitCheck() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
media_client_kind
|
media_client_kinds
|
||||||
BMediaClient::Kind() const
|
BMediaClient::Kinds() const
|
||||||
{
|
{
|
||||||
CALLED();
|
CALLED();
|
||||||
|
|
||||||
return fClient.kind;
|
return fClient.Kinds();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -16,6 +16,13 @@ media_client::Id() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
media_client_kinds
|
||||||
|
media_client::Kinds() const
|
||||||
|
{
|
||||||
|
return kinds;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
media_connection_id
|
media_connection_id
|
||||||
media_connection::Id() const
|
media_connection::Id() const
|
||||||
{
|
{
|
||||||
@@ -23,24 +30,24 @@ media_connection::Id() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
media_connection_kind
|
media_connection_kinds
|
||||||
media_connection::Kind() const
|
media_connection::Kinds() const
|
||||||
{
|
{
|
||||||
return kind;
|
return kinds;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
media_connection::IsInput() const
|
media_connection::IsInput() const
|
||||||
{
|
{
|
||||||
return Kind() == B_MEDIA_INPUT;
|
return Kinds() == B_MEDIA_INPUT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
media_connection::IsOutput() const
|
media_connection::IsOutput() const
|
||||||
{
|
{
|
||||||
return Kind() == B_MEDIA_OUTPUT;
|
return Kinds() == B_MEDIA_OUTPUT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -29,11 +29,11 @@ BMediaClientNode::BMediaClientNode(const char* name,
|
|||||||
CALLED();
|
CALLED();
|
||||||
|
|
||||||
// Configure the node to do the requested jobs
|
// Configure the node to do the requested jobs
|
||||||
if (fOwner->Kind() & B_MEDIA_PLAYER)
|
if (fOwner->Kinds() & B_MEDIA_PLAYER)
|
||||||
AddNodeKind(B_BUFFER_PRODUCER);
|
AddNodeKind(B_BUFFER_PRODUCER);
|
||||||
if (fOwner->Kind() & B_MEDIA_RECORDER)
|
if (fOwner->Kinds() & B_MEDIA_RECORDER)
|
||||||
AddNodeKind(B_BUFFER_CONSUMER);
|
AddNodeKind(B_BUFFER_CONSUMER);
|
||||||
if (fOwner->Kind() & B_MEDIA_CONTROLLABLE)
|
if (fOwner->Kinds() & B_MEDIA_CONTROLLABLE)
|
||||||
AddNodeKind(B_CONTROLLABLE);
|
AddNodeKind(B_CONTROLLABLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
|
|
||||||
|
|
||||||
BMediaConnection::BMediaConnection(media_connection_kind kind)
|
BMediaConnection::BMediaConnection(media_connection_kinds kinds)
|
||||||
:
|
:
|
||||||
fOwner(NULL),
|
fOwner(NULL),
|
||||||
fBind(NULL),
|
fBind(NULL),
|
||||||
@@ -16,8 +16,8 @@ BMediaConnection::BMediaConnection(media_connection_kind kind)
|
|||||||
{
|
{
|
||||||
CALLED();
|
CALLED();
|
||||||
|
|
||||||
fConnection.kind = kind;
|
fConnection.kinds = kinds;
|
||||||
fConnection.id = -1;
|
fConnection.id = 0;
|
||||||
//fConnection.client = media_client::null;
|
//fConnection.client = media_client::null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,9 +9,9 @@
|
|||||||
|
|
||||||
|
|
||||||
BSimpleMediaClient::BSimpleMediaClient(const char* name,
|
BSimpleMediaClient::BSimpleMediaClient(const char* name,
|
||||||
media_type type, media_client_kind kind)
|
media_type type, media_client_kinds kinds)
|
||||||
:
|
:
|
||||||
BMediaClient(name, type, kind),
|
BMediaClient(name, type, kinds),
|
||||||
fNotifyHook(NULL),
|
fNotifyHook(NULL),
|
||||||
fNotifyCookie(NULL)
|
fNotifyCookie(NULL)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user