1 /* 2 * Copyright 2002, Marcus Overhagen. All rights reserved. 3 * Distributed under the terms of the MIT License. 4 */ 5 6 #ifndef _DATA_EXCHANGE_H 7 #define _DATA_EXCHANGE_H 8 9 #include <MediaDefs.h> 10 #include <MediaNode.h> 11 #include <MediaAddOn.h> 12 #include <Entry.h> 13 14 namespace BPrivate { 15 namespace media { 16 namespace dataexchange { 17 18 struct reply_data; 19 struct request_data; 20 21 // BMessage based data exchange with the media_server 22 status_t SendToServer(BMessage *msg); 23 status_t QueryServer(BMessage *request, BMessage *reply); 24 25 // Raw data based data exchange with the media_server 26 status_t SendToServer(int32 msgcode, void *msg, int size); 27 status_t QueryServer(int32 msgcode, request_data *request, int requestsize, reply_data *reply, int replysize); 28 29 // Raw data based data exchange with the media_addon_server 30 status_t SendToAddonServer(int32 msgcode, void *msg, int size); 31 status_t QueryAddonServer(int32 msgcode, request_data *request, int requestsize, reply_data *reply, int replysize); 32 33 // Raw data based data exchange with the media_server 34 status_t SendToPort(port_id sendport, int32 msgcode, void *msg, int size); 35 status_t QueryPort(port_id requestport, int32 msgcode, request_data *request, int requestsize, reply_data *reply, int replysize); 36 37 // The base struct used for all raw requests 38 struct request_data 39 { 40 port_id reply_port; 41 42 status_t SendReply(status_t result, reply_data *reply, int replysize) const; 43 }; 44 45 // The base struct used for all raw replys 46 struct reply_data 47 { 48 status_t result; 49 }; 50 51 52 }; // dataexchange 53 }; // media 54 }; // BPrivate 55 56 using namespace BPrivate::media::dataexchange; 57 58 // BMessage based server communication 59 enum { 60 61 // BMediaRoster notification service 62 MEDIA_SERVER_REQUEST_NOTIFICATIONS = 1000, 63 MEDIA_SERVER_CANCEL_NOTIFICATIONS, 64 MEDIA_SERVER_SEND_NOTIFICATIONS 65 66 }; 67 68 // Raw port based communication 69 enum { 70 SERVER_MESSAGE_START = 0x100, 71 SERVER_GET_NODE, 72 SERVER_SET_NODE, 73 SERVER_PUBLISH_INPUTS, 74 SERVER_PUBLISH_OUTPUTS, 75 SERVER_NODE_ID_FOR, 76 SERVER_GET_LIVE_NODE_INFO, 77 SERVER_GET_LIVE_NODES, 78 SERVER_GET_NODE_FOR, 79 SERVER_RELEASE_NODE, 80 SERVER_REGISTER_NODE, 81 SERVER_UNREGISTER_NODE, 82 SERVER_GET_DORMANT_NODE_FOR, 83 SERVER_GET_INSTANCES_FOR, 84 SERVER_MESSAGE_END, 85 NODE_MESSAGE_START = 0x200, 86 87 NODE_START, 88 NODE_STOP, 89 NODE_SEEK, 90 NODE_SET_RUN_MODE, 91 NODE_TIME_WARP, 92 NODE_PREROLL, 93 NODE_SET_TIMESOURCE, 94 NODE_REQUEST_COMPLETED, 95 96 NODE_MESSAGE_END, 97 CONSUMER_MESSAGE_START = 0x300, 98 CONSUMER_GET_NEXT_INPUT, 99 CONSUMER_DISPOSE_INPUT_COOKIE, 100 CONSUMER_ACCEPT_FORMAT, 101 CONSUMER_CONNECTED, 102 CONSUMER_DISCONNECTED, 103 104 CONSUMER_BUFFER_RECEIVED, 105 CONSUMER_PRODUCER_DATA_STATUS, 106 CONSUMER_GET_LATENCY_FOR, 107 CONSUMER_FORMAT_CHANGED, 108 CONSUMER_SEEK_TAG_REQUESTED, 109 110 CONSUMER_MESSAGE_END, 111 PRODUCER_MESSAGE_START = 0x400, 112 PRODUCER_GET_NEXT_OUTPUT, 113 PRODUCER_DISPOSE_OUTPUT_COOKIE, 114 PRODUCER_FORMAT_PROPOSAL, 115 PRODUCER_PREPARE_TO_CONNECT, 116 PRODUCER_CONNECT, 117 PRODUCER_DISCONNECT, 118 119 PRODUCER_LATE_NOTICE_RECEIVED, 120 PRODUCER_LATENCY_CHANGED, 121 PRODUCER_ADDITIONAL_BUFFER_REQUESTED, 122 PRODUCER_VIDEO_CLIPPING_CHANGED, 123 PRODUCER_FORMAT_CHANGE_REQUESTED, 124 PRODUCER_SET_BUFFER_GROUP, 125 PRODUCER_GET_LATENCY, 126 PRODUCER_GET_INITIAL_LATENCY, 127 PRODUCER_FORMAT_SUGGESTION_REQUESTED, 128 PRODUCER_SET_PLAY_RATE, 129 PRODUCER_ENABLE_OUTPUT, 130 131 PRODUCER_MESSAGE_END, 132 FILEINTERFACE_MESSAGE_START = 0x500, 133 FILEINTERFACE_MESSAGE_END, 134 CONTROLLABLE_MESSAGE_START = 0x600, 135 CONTROLLABLE_MESSAGE_END, 136 TIMESOURECE_MESSAGE_START = 0x700, 137 138 TIMESOURCE_OP, // datablock is a struct time_source_op_info 139 140 TIMESOURECE_MESSAGE_END, 141 }; 142 143 // used by SERVER_GET_NODE and SERVER_SET_NODE 144 enum node_type 145 { 146 VIDEO_INPUT, 147 AUDIO_INPUT, 148 VIDEO_OUTPUT, 149 AUDIO_MIXER, 150 AUDIO_OUTPUT, 151 AUDIO_OUTPUT_EX, 152 TIME_SOURCE, 153 SYSTEM_TIME_SOURCE 154 }; 155 156 // used by SERVER_PUBLISH_INPUTS and SERVER_PUBLISH_OUTPUTS 157 enum 158 { 159 MAX_OUTPUTS = 48, 160 MAX_INPUTS = 48, 161 }; 162 163 // used by SERVER_GET_LIVE_NODES 164 enum 165 { 166 MAX_LIVE_INFO = 62, 167 }; 168 169 // used by SERVER_GET_INSTANCES_FOR 170 enum 171 { 172 MAX_NODE_ID = 4000, 173 }; 174 175 struct addonserver_instantiate_dormant_node_request : public request_data 176 { 177 dormant_node_info info; 178 }; 179 180 struct addonserver_instantiate_dormant_node_reply : public reply_data 181 { 182 media_node node; 183 }; 184 185 struct server_set_node_request : public request_data 186 { 187 node_type type; 188 bool use_node; 189 media_node node; 190 bool use_dni; 191 dormant_node_info dni; 192 bool use_input; 193 media_input input; 194 }; 195 196 struct server_set_node_reply : public reply_data 197 { 198 }; 199 200 struct server_get_node_request : public request_data 201 { 202 node_type type; 203 team_id team; 204 }; 205 206 struct server_get_node_reply : public reply_data 207 { 208 media_node node; 209 210 // for AUDIO_OUTPUT_EX 211 char input_name[B_MEDIA_NAME_LENGTH]; 212 int32 input_id; 213 }; 214 215 struct producer_format_proposal_request : public request_data 216 { 217 media_source output; 218 media_format format; 219 }; 220 221 struct producer_format_proposal_reply : public reply_data 222 { 223 media_format format; 224 }; 225 226 struct producer_prepare_to_connect_request : public request_data 227 { 228 media_source source; 229 media_destination destination; 230 media_format format; 231 char name[B_MEDIA_NAME_LENGTH]; 232 }; 233 234 struct producer_prepare_to_connect_reply : public reply_data 235 { 236 media_format format; 237 media_source out_source; 238 char name[B_MEDIA_NAME_LENGTH]; 239 }; 240 241 struct producer_connect_request : public request_data 242 { 243 status_t error; 244 media_source source; 245 media_destination destination; 246 media_format format; 247 char name[B_MEDIA_NAME_LENGTH]; 248 }; 249 250 struct producer_connect_reply : public reply_data 251 { 252 char name[B_MEDIA_NAME_LENGTH]; 253 }; 254 255 struct consumer_accept_format_request : public request_data 256 { 257 media_destination dest; 258 media_format format; 259 }; 260 261 struct consumer_accept_format_reply : public reply_data 262 { 263 media_format format; 264 }; 265 266 struct consumer_connected_request : public request_data 267 { 268 media_source producer; 269 media_destination where; 270 media_format with_format; 271 }; 272 273 struct consumer_connected_reply : public reply_data 274 { 275 media_input input; 276 }; 277 278 struct server_publish_inputs_request : public request_data 279 { 280 media_node node; 281 int32 count; 282 area_id area; // if count > MAX_INPUTS, inputs are in the area 283 // area is created in the library, and also deleted 284 // in the library after the reply has been received 285 media_input inputs[MAX_INPUTS]; 286 }; 287 288 struct server_publish_inputs_reply : public reply_data 289 { 290 }; 291 292 struct server_publish_outputs_request : public request_data 293 { 294 media_node node; 295 int32 count; 296 area_id area; // if count > MAX_OUTPUTS, outputs are in the area 297 // area is created in the library, and also deleted 298 // in the library after the reply has been received 299 media_output outputs[MAX_OUTPUTS]; 300 }; 301 302 struct server_publish_outputs_reply : public reply_data 303 { 304 }; 305 306 struct producer_get_next_output_request : public request_data 307 { 308 int32 cookie; 309 }; 310 311 struct producer_get_next_output_reply : public reply_data 312 { 313 int32 cookie; 314 media_output output; 315 }; 316 317 struct producer_dispose_output_cookie_request : public request_data 318 { 319 int32 cookie; 320 }; 321 322 struct producer_dispose_output_cookie_reply : public reply_data 323 { 324 }; 325 326 struct consumer_get_next_input_request : public request_data 327 { 328 int32 cookie; 329 }; 330 331 struct consumer_get_next_input_reply : public reply_data 332 { 333 int32 cookie; 334 media_input input; 335 }; 336 337 struct consumer_dispose_input_cookie_request : public request_data 338 { 339 int32 cookie; 340 }; 341 342 struct consumer_dispose_input_cookie_reply : public reply_data 343 { 344 }; 345 346 struct consumer_disconnected_request : public request_data 347 { 348 media_source source; 349 media_destination destination; 350 }; 351 352 struct consumer_disconnected_reply : public reply_data 353 { 354 }; 355 356 struct producer_disconnect_request : public request_data 357 { 358 media_source source; 359 media_destination destination; 360 }; 361 362 struct producer_disconnect_reply : public reply_data 363 { 364 }; 365 366 struct server_register_node_request : public request_data 367 { 368 media_addon_id addon_id; 369 int32 addon_flavor_id; 370 char name[B_MEDIA_NAME_LENGTH]; 371 uint64 kinds; 372 port_id port; 373 team_id team; 374 }; 375 376 struct server_register_node_reply : public reply_data 377 { 378 media_node_id nodeid; 379 }; 380 381 struct server_unregister_node_request : public request_data 382 { 383 media_node_id nodeid; 384 team_id team; 385 }; 386 387 struct server_unregister_node_reply : public reply_data 388 { 389 media_addon_id addon_id; 390 }; 391 392 struct server_get_live_node_info_request : public request_data 393 { 394 media_node node; 395 }; 396 397 struct server_get_live_node_info_reply : public reply_data 398 { 399 live_node_info live_info; 400 }; 401 402 struct server_get_live_nodes_request : public request_data 403 { 404 int32 maxcount; 405 bool has_input; 406 bool has_output; 407 bool has_name; 408 media_format inputformat; 409 media_format outputformat; 410 char name[B_MEDIA_NAME_LENGTH + 1]; // 1 for a trailing "*" 411 uint64 require_kinds; 412 }; 413 414 struct server_get_live_nodes_reply : public reply_data 415 { 416 int32 count; 417 area_id area; // if count > MAX_LIVE_INFO, live_node_infos are in the area 418 // area is created in the server, but deleted in the library 419 live_node_info live_info[MAX_LIVE_INFO]; 420 }; 421 422 struct server_node_id_for_request : public request_data 423 { 424 port_id port; 425 }; 426 427 struct server_node_id_for_reply : public reply_data 428 { 429 media_node_id nodeid; 430 }; 431 432 struct server_get_node_for_request : public request_data 433 { 434 media_node_id nodeid; 435 team_id team; 436 }; 437 438 struct server_get_node_for_reply : public reply_data 439 { 440 media_node clone; 441 }; 442 443 struct server_release_node_request : public request_data 444 { 445 media_node node; 446 team_id team; 447 }; 448 449 struct server_release_node_reply : public reply_data 450 { 451 }; 452 453 struct server_get_dormant_node_for_request : public request_data 454 { 455 media_node node; 456 }; 457 458 struct server_get_dormant_node_for_reply : public reply_data 459 { 460 dormant_node_info node_info; 461 }; 462 463 struct server_get_instances_for_request : public request_data 464 { 465 int32 maxcount; 466 media_addon_id addon_id; 467 int32 addon_flavor_id; 468 }; 469 470 struct server_get_instances_for_reply : public reply_data 471 { 472 int32 count; 473 media_node_id node_id[MAX_NODE_ID]; // no area here, MAX_NODE_ID is really large 474 }; 475 476 477 #endif // _DATA_EXCHANGE_H 478