2016-11-24 02:14:00 +03:00
|
|
|
/*
|
2018-02-24 04:23:41 +03:00
|
|
|
* Copyright 2015-2018, Dario Casalinuovo. All rights reserved.
|
2016-11-24 02:14:00 +03:00
|
|
|
* Distributed under the terms of the MIT License.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _MEDIA_CLIENT_DEFS_H
|
|
|
|
#define _MEDIA_CLIENT_DEFS_H
|
|
|
|
|
|
|
|
#include <MediaDefs.h>
|
|
|
|
#include <MediaNode.h>
|
|
|
|
|
|
|
|
|
|
|
|
namespace BPrivate { namespace media {
|
|
|
|
|
|
|
|
|
2017-04-13 19:05:24 +03:00
|
|
|
typedef int64 media_client_id;
|
|
|
|
typedef int64 media_connection_id;
|
|
|
|
|
2016-12-06 23:05:15 +03:00
|
|
|
typedef uint64 media_client_kinds;
|
|
|
|
typedef uint64 media_connection_kinds;
|
2016-11-24 02:14:00 +03:00
|
|
|
|
|
|
|
|
2016-12-06 23:05:15 +03:00
|
|
|
enum media_client_kind {
|
2016-11-24 02:14:00 +03:00
|
|
|
// The client can receive media data.
|
|
|
|
B_MEDIA_RECORDER = 0x000000001,
|
|
|
|
// The client can send media data to another client.
|
|
|
|
B_MEDIA_PLAYER = 0x000000002,
|
|
|
|
// The client specify a control GUI which can be used to configure it.
|
|
|
|
B_MEDIA_CONTROLLABLE = 0x000000004
|
|
|
|
};
|
|
|
|
|
2016-12-06 23:05:15 +03:00
|
|
|
enum media_connection_kind {
|
2016-11-24 02:14:00 +03:00
|
|
|
B_MEDIA_INPUT = 0,
|
|
|
|
B_MEDIA_OUTPUT = 1
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
typedef struct media_client {
|
|
|
|
media_client_id Id() const;
|
2016-12-06 23:05:15 +03:00
|
|
|
media_client_kinds Kinds() const;
|
2016-11-24 02:14:00 +03:00
|
|
|
|
|
|
|
BMessage* ToMessage();
|
|
|
|
|
|
|
|
private:
|
2016-12-06 23:05:15 +03:00
|
|
|
media_client_kinds kinds;
|
2016-11-24 02:14:00 +03:00
|
|
|
|
|
|
|
media_node node;
|
|
|
|
uint32 padding[16];
|
|
|
|
|
|
|
|
friend class BMediaClient;
|
|
|
|
friend class BMediaConnection;
|
2020-03-22 05:22:06 +03:00
|
|
|
friend struct media_connection;
|
2016-11-24 02:14:00 +03:00
|
|
|
} media_client;
|
|
|
|
|
|
|
|
|
|
|
|
typedef struct media_connection {
|
|
|
|
media_connection_id Id() const;
|
2016-12-06 23:05:15 +03:00
|
|
|
media_connection_kinds Kinds() const;
|
2016-11-24 02:14:00 +03:00
|
|
|
|
2016-11-25 02:05:06 +03:00
|
|
|
const media_client& Client() const;
|
2016-11-24 02:14:00 +03:00
|
|
|
|
|
|
|
const char* Name() const;
|
|
|
|
|
|
|
|
bool IsInput() const;
|
|
|
|
bool IsOutput() const;
|
|
|
|
|
|
|
|
BMessage* ToMessage() const;
|
|
|
|
|
|
|
|
private:
|
2018-03-01 19:05:10 +03:00
|
|
|
// NOTE: We are doing this on purpose to avoid redundancy we
|
|
|
|
// want to build the input/output on the fly. In pratice, the
|
|
|
|
// only thing that can change is the format which is kept updated
|
|
|
|
// to reflect the current status of this connection.
|
|
|
|
media_input _BuildMediaInput() const;
|
|
|
|
media_output _BuildMediaOutput() const;
|
2016-11-24 02:14:00 +03:00
|
|
|
|
2017-01-18 22:16:53 +03:00
|
|
|
media_node _Node() const;
|
2016-11-24 02:14:00 +03:00
|
|
|
|
|
|
|
media_connection_id id;
|
|
|
|
|
|
|
|
media_client client;
|
2017-01-18 22:16:53 +03:00
|
|
|
|
|
|
|
media_node remote_node;
|
2016-11-24 02:14:00 +03:00
|
|
|
|
|
|
|
media_source source;
|
|
|
|
media_destination destination;
|
2018-03-01 19:05:10 +03:00
|
|
|
|
|
|
|
// This format always reflect the most updated format depending
|
|
|
|
// on the connection phase.
|
2016-11-24 02:14:00 +03:00
|
|
|
media_format format;
|
|
|
|
char name[B_MEDIA_NAME_LENGTH];
|
|
|
|
|
2016-12-06 23:05:15 +03:00
|
|
|
media_connection_kinds kinds;
|
2016-11-24 02:14:00 +03:00
|
|
|
uint32 padding[16];
|
|
|
|
|
|
|
|
friend class BMediaClient;
|
|
|
|
friend class BMediaClientNode;
|
2016-11-25 19:29:17 +03:00
|
|
|
friend class BMediaConnection;
|
|
|
|
friend class BMediaInput;
|
|
|
|
friend class BMediaOutput;
|
2016-11-24 02:14:00 +03:00
|
|
|
} media_connection;
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
using namespace BPrivate::media;
|
|
|
|
|
|
|
|
#endif
|