xref: /haiku/headers/private/media/DataExchange.h (revision c28dd9fdc3579bef534f904454f9d780a12efee7)
1 /*
2  * Copyright 2002, Marcus Overhagen. All rights reserved.
3  * Copyright 2009, Axel Dörfler, axeld@pinc-software.de.
4  *
5  * Distributed under the terms of the MIT License.
6  */
7 #ifndef _DATA_EXCHANGE_H
8 #define _DATA_EXCHANGE_H
9 
10 
11 #include <string.h>
12 
13 #include <MediaFormats.h>
14 #include <MediaNode.h>
15 #include <MediaAddOn.h>
16 #include <Messenger.h>
17 #include <Buffer.h>
18 #include <Entry.h>
19 
20 
21 namespace BPrivate {
22 namespace media {
23 namespace dataexchange {
24 
25 struct reply_data;
26 struct request_data;
27 struct command_data;
28 
29 // BMessage based data exchange with the media_server
30 status_t SendToServer(BMessage *msg);
31 status_t QueryServer(BMessage &request, BMessage &reply);
32 
33 // Raw data based data exchange with the media_server
34 status_t SendToServer(int32 msgcode, command_data *msg, int size);
35 status_t QueryServer(int32 msgcode, request_data *request, int requestsize,
36 	reply_data *reply, int replysize);
37 
38 // Raw data based data exchange with the media_addon_server
39 status_t SendToAddonServer(int32 msgcode, command_data *msg, int size);
40 status_t QueryAddonServer(int32 msgcode, request_data *request, int requestSize,
41 	reply_data *reply, int replysize);
42 
43 // Raw data based data exchange with any (media node control-) port
44 status_t SendToPort(port_id sendport, int32 msgcode, command_data *msg,
45 	int size);
46 status_t QueryPort(port_id requestport, int32 msgcode, request_data *request,
47 	int requestsize, reply_data *reply, int replysize);
48 
49 // The base struct used for all raw requests
50 struct request_data {
51 	port_id					reply_port;
52 
53 	status_t SendReply(status_t result, reply_data* reply,
54 		size_t replySize) const;
55 };
56 
57 // The base struct used for all raw replys
58 struct reply_data {
59 	status_t				result;
60 };
61 
62 // The base struct used for all raw commands (asynchronous, no answer)
63 struct command_data {
64 	// yes, it's empty ;)
65 
66 #if __GNUC__ == 4
67 	int32 _padding;
68 		// GCC 2 and GCC 4 treat empty structures differently
69 #endif
70 };
71 
72 // The base struct used for all requests using an area
73 struct area_request_data : request_data {
74 	area_id					area;
75 };
76 
77 // The base struct used for all requests requesting an area
78 struct request_area_data : request_data {
79 	team_id					team;
80 };
81 
82 // The base struct used for all replies using an area
83 struct area_reply_data : reply_data {
84 	area_id					area;
85 	void*					address;
86 };
87 
88 } // namespace dataexchange
89 } // namespace media
90 } // namespace BPrivate
91 
92 using namespace BPrivate::media::dataexchange;
93 
94 // BMessage based server communication
95 enum {
96 	// BMediaRoster notification service
97 	MEDIA_SERVER_REQUEST_NOTIFICATIONS = 1000,
98 	MEDIA_SERVER_CANCEL_NOTIFICATIONS,
99 	MEDIA_SERVER_SEND_NOTIFICATIONS,
100 
101 	MEDIA_SERVER_GET_FORMATS,
102 	MEDIA_SERVER_MAKE_FORMAT_FOR,
103 
104 	// add_system_beep_event()
105 	MEDIA_SERVER_ADD_SYSTEM_BEEP_EVENT,
106 
107 	// media addon server
108 	MEDIA_ADDON_SERVER_PLAY_MEDIA = '_TRU'
109 };
110 
111 // Raw port based communication
112 enum {
113 	ADDONSERVER_RESCAN_MEDIAADDON_FLAVORS = 0x50,
114 	ADDONSERVER_RESCAN_FINISHED_NOTIFY,
115 
116 	SERVER_MESSAGE_START = 0x100,
117 	SERVER_REGISTER_APP,
118 	SERVER_UNREGISTER_APP,
119 	SERVER_GET_NODE,
120 	SERVER_SET_NODE,
121 	SERVER_PUBLISH_INPUTS,
122 	SERVER_PUBLISH_OUTPUTS,
123 	SERVER_NODE_ID_FOR,
124 	SERVER_GET_LIVE_NODE_INFO,
125 	SERVER_GET_LIVE_NODES,
126 	SERVER_GET_NODE_FOR,
127 	SERVER_RELEASE_NODE,
128 	SERVER_REGISTER_NODE,
129 	SERVER_UNREGISTER_NODE,
130 	SERVER_GET_DORMANT_NODE_FOR,
131 	SERVER_GET_INSTANCES_FOR,
132 	SERVER_GET_SHARED_BUFFER_AREA,
133 	SERVER_REGISTER_BUFFER,
134 	SERVER_UNREGISTER_BUFFER,
135 	SERVER_RESCAN_DEFAULTS,
136 	SERVER_SET_NODE_CREATOR,
137 	SERVER_CHANGE_ADDON_FLAVOR_INSTANCES_COUNT,
138 	SERVER_GET_MEDIA_FILE_TYPES,
139 	SERVER_GET_MEDIA_FILE_ITEMS,
140 	SERVER_GET_REF_FOR,
141 	SERVER_SET_REF_FOR,
142 	SERVER_INVALIDATE_MEDIA_ITEM,
143 	SERVER_REMOVE_MEDIA_ITEM,
144 	SERVER_GET_ITEM_AUDIO_GAIN,
145 	SERVER_SET_ITEM_AUDIO_GAIN,
146 	SERVER_GET_FORMAT_FOR_DESCRIPTION,
147 	SERVER_GET_DESCRIPTION_FOR_FORMAT,
148 	SERVER_GET_READERS,
149 	SERVER_GET_DECODER_FOR_FORMAT,
150 	SERVER_GET_WRITER_FOR_FORMAT_FAMILY,
151 	SERVER_GET_FILE_FORMAT_FOR_COOKIE,
152 	SERVER_GET_CODEC_INFO_FOR_COOKIE,
153 	SERVER_GET_ENCODER_FOR_CODEC_INFO,
154 	SERVER_MESSAGE_END,
155 	NODE_MESSAGE_START = 0x200,
156 
157 	NODE_START,
158 	NODE_STOP,
159 	NODE_SEEK,
160 	NODE_SET_RUN_MODE,
161 	NODE_TIME_WARP,
162 	NODE_PREROLL,
163 	NODE_SET_TIMESOURCE,
164 	NODE_GET_TIMESOURCE,
165 	NODE_REQUEST_COMPLETED,
166 	NODE_FINAL_RELEASE,
167 
168 	NODE_MESSAGE_END,
169 	CONSUMER_MESSAGE_START = 0x300,
170 	CONSUMER_GET_NEXT_INPUT,
171 	CONSUMER_DISPOSE_INPUT_COOKIE,
172 	CONSUMER_ACCEPT_FORMAT,
173 	CONSUMER_CONNECTED,
174 	CONSUMER_DISCONNECTED,
175 
176 	CONSUMER_BUFFER_RECEIVED,
177 	CONSUMER_PRODUCER_DATA_STATUS,
178 	CONSUMER_GET_LATENCY_FOR,
179 	CONSUMER_FORMAT_CHANGED,
180 	CONSUMER_SEEK_TAG_REQUESTED,
181 
182 	CONSUMER_MESSAGE_END,
183 	PRODUCER_MESSAGE_START = 0x400,
184 	PRODUCER_GET_NEXT_OUTPUT,
185 	PRODUCER_DISPOSE_OUTPUT_COOKIE,
186 	PRODUCER_FORMAT_PROPOSAL,
187 	PRODUCER_PREPARE_TO_CONNECT,
188 	PRODUCER_CONNECT,
189 	PRODUCER_DISCONNECT,
190 
191 	PRODUCER_LATE_NOTICE_RECEIVED,
192 	PRODUCER_LATENCY_CHANGED,
193 	PRODUCER_ADDITIONAL_BUFFER_REQUESTED,
194 	PRODUCER_VIDEO_CLIPPING_CHANGED,
195 	PRODUCER_FORMAT_CHANGE_REQUESTED,
196 	PRODUCER_SET_BUFFER_GROUP,
197 	PRODUCER_GET_LATENCY,
198 	PRODUCER_GET_INITIAL_LATENCY,
199 	PRODUCER_FORMAT_SUGGESTION_REQUESTED,
200 	PRODUCER_SET_PLAY_RATE,
201 	PRODUCER_ENABLE_OUTPUT,
202 	PRODUCER_SET_RUN_MODE_DELAY,
203 
204 	PRODUCER_MESSAGE_END,
205 	FILEINTERFACE_MESSAGE_START = 0x500,
206 	FILEINTERFACE_SET_REF,
207 	FILEINTERFACE_GET_REF,
208 	FILEINTERFACE_SNIFF_REF,
209 	FILEINTERFACE_MESSAGE_END,
210 	CONTROLLABLE_MESSAGE_START = 0x600,
211 	CONTROLLABLE_GET_PARAMETER_WEB,
212 	CONTROLLABLE_GET_PARAMETER_DATA,
213 	CONTROLLABLE_SET_PARAMETER_DATA,
214 	CONTROLLABLE_START_CONTROL_PANEL,
215 	CONTROLLABLE_MESSAGE_END,
216 	TIMESOURCE_MESSAGE_START = 0x700,
217 
218 	TIMESOURCE_OP, // datablock is a struct time_source_op_info
219 	TIMESOURCE_ADD_SLAVE_NODE,
220 	TIMESOURCE_REMOVE_SLAVE_NODE,
221 	TIMESOURCE_GET_START_LATENCY,
222 
223 	TIMESOURCE_MESSAGE_END,
224 };
225 
226 
227 /* We can't send an entry_ref through a port to another team,
228  * but we can assign it to an xfer_entry_ref and send this one,
229  * when we receive it we can assign it to a normal entry_ref
230  */
231 struct xfer_entry_ref {
232 public:
233 	xfer_entry_ref()
234 	{
235 		device = -1;
236 		directory = -1;
237 		name[0] = 0;
238 	}
239 
240 	operator entry_ref() const
241 	{
242 		entry_ref ref(device, directory, name);
243 		return ref;
244 	}
245 
246 	xfer_entry_ref& operator=(const entry_ref& ref)
247 	{
248 		device = ref.device;
249 		directory = ref.directory;
250 		if (ref.name)
251 			strcpy(name, ref.name);
252 		else
253 			name[0] = 0;
254 
255 		return *this;
256 	}
257 
258 private:
259 	dev_t	device;
260 	ino_t	directory;
261 	char	name[B_FILE_NAME_LENGTH];
262 };
263 
264 // used by SERVER_GET_NODE and SERVER_SET_NODE
265 enum node_type {
266 	VIDEO_INPUT,
267 	AUDIO_INPUT,
268 	VIDEO_OUTPUT,
269 	AUDIO_MIXER,
270 	AUDIO_OUTPUT,
271 	AUDIO_OUTPUT_EX,
272 	TIME_SOURCE,
273 	SYSTEM_TIME_SOURCE
274 };
275 
276 // used by SERVER_PUBLISH_INPUTS and SERVER_PUBLISH_OUTPUTS
277 enum {
278 	MAX_OUTPUTS = 8,
279 	MAX_INPUTS = 8,
280 };
281 
282 // used by SERVER_GET_LIVE_NODES
283 enum {
284 	MAX_LIVE_INFO = 16,
285 };
286 
287 // used by SERVER_GET_INSTANCES_FOR
288 enum {
289 	MAX_NODE_ID = 4000,
290 };
291 
292 // used by SERVER_GET_READERS
293 enum {
294 	MAX_READERS = 40,
295 };
296 
297 struct addonserver_instantiate_dormant_node_request : request_data {
298 	media_addon_id			addon_id;
299 	int32					flavor_id;
300 	team_id					creator_team;
301 };
302 
303 struct addonserver_instantiate_dormant_node_reply : reply_data {
304 	media_node				node;
305 };
306 
307 struct server_set_node_request : request_data {
308 	node_type				type;
309 	bool					use_node;
310 	media_node				node;
311 	bool					use_dni;
312 	dormant_node_info		dni;
313 	bool					use_input;
314 	media_input				input;
315 };
316 
317 struct server_set_node_reply : reply_data {
318 };
319 
320 struct server_get_node_request : request_data {
321 	node_type				type;
322 	team_id					team;
323 };
324 
325 struct server_get_node_reply : public reply_data {
326 	media_node				node;
327 
328 	// for AUDIO_OUTPUT_EX
329 	char					input_name[B_MEDIA_NAME_LENGTH];
330 	int32					input_id;
331 };
332 
333 struct producer_format_proposal_request : public request_data {
334 	media_source			output;
335 	media_format			format;
336 };
337 
338 struct producer_format_proposal_reply : reply_data {
339 	media_format			format;
340 };
341 
342 struct producer_prepare_to_connect_request : request_data {
343 	media_source			source;
344 	media_destination		destination;
345 	media_format			format;
346 	char					name[B_MEDIA_NAME_LENGTH];
347 };
348 
349 struct producer_prepare_to_connect_reply : reply_data {
350 	media_format			format;
351 	media_source			out_source;
352 	char					name[B_MEDIA_NAME_LENGTH];
353 };
354 
355 struct producer_connect_request : request_data {
356 	status_t				error;
357 	media_source			source;
358 	media_destination		destination;
359 	media_format			format;
360 	char					name[B_MEDIA_NAME_LENGTH];
361 };
362 
363 struct producer_connect_reply : reply_data {
364 	char					name[B_MEDIA_NAME_LENGTH];
365 };
366 
367 struct producer_disconnect_request : request_data {
368 	media_source			source;
369 	media_destination		destination;
370 };
371 
372 struct producer_disconnect_reply : reply_data {
373 };
374 
375 struct producer_format_suggestion_requested_request : request_data {
376 	media_type				type;
377 	int32					quality;
378 };
379 
380 struct producer_format_suggestion_requested_reply : reply_data {
381 	media_format			format;
382 };
383 
384 struct producer_set_play_rate_request : request_data {
385 	int32					numer;
386 	int32					denom;
387 };
388 
389 struct producer_set_play_rate_reply : reply_data {
390 };
391 
392 struct producer_get_initial_latency_request : request_data {
393 };
394 
395 struct producer_get_initial_latency_reply : reply_data {
396 	bigtime_t				initial_latency;
397 	uint32					flags;
398 };
399 
400 struct producer_get_latency_request : request_data {
401 };
402 
403 struct producer_get_latency_reply : reply_data {
404 	bigtime_t				latency;
405 };
406 
407 struct producer_set_buffer_group_command : command_data {
408 	media_source			source;
409 	media_destination		destination;
410 	void*					user_data;
411 	int32					change_tag;
412 	int32					buffer_count;
413 	media_buffer_id			buffers[1];
414 };
415 
416 struct producer_format_change_requested_command : command_data {
417 	media_source			source;
418 	media_destination		destination;
419 	media_format			format;
420 	void*					user_data;
421 	int32					change_tag;
422 };
423 
424 struct producer_video_clipping_changed_command : command_data {
425 	media_source			source;
426 	media_destination		destination;
427 	media_video_display_info display;
428 	void*					user_data;
429 	int32					change_tag;
430 	int32					short_count;
431 	int16					shorts[1];
432 };
433 
434 struct producer_additional_buffer_requested_command : command_data {
435 	media_source			source;
436 	media_buffer_id			prev_buffer;
437 	bigtime_t				prev_time;
438 	bool					has_seek_tag;
439 	media_seek_tag			prev_tag;
440 };
441 
442 struct producer_latency_changed_command : command_data {
443 	media_source			source;
444 	media_destination		destination;
445 	bigtime_t				latency;
446 	uint32					flags;
447 };
448 
449 struct producer_enable_output_command : command_data {
450 	media_source			source;
451 	media_destination		destination;
452 	bool					enabled;
453 	void*					user_data;
454 	int32					change_tag;
455 };
456 
457 struct producer_late_notice_received_command : command_data {
458 	media_source			source;
459 	bigtime_t				how_much;
460 	bigtime_t				performance_time;
461 };
462 
463 struct producer_set_run_mode_delay_command : command_data {
464 	BMediaNode::run_mode	mode;
465 	bigtime_t				delay;
466 };
467 
468 struct consumer_accept_format_request : request_data {
469 	media_destination		dest;
470 	media_format			format;
471 };
472 
473 struct consumer_accept_format_reply : reply_data {
474 	media_format			format;
475 };
476 
477 struct consumer_connected_request : request_data {
478 	media_input				input;
479 };
480 
481 struct consumer_connected_reply : reply_data {
482 	media_input				input;
483 };
484 
485 struct server_publish_inputs_request : request_data {
486 	media_node				node;
487 	int32					count;
488 	area_id area;	// if count > MAX_INPUTS, inputs are in the area
489 					// area is created in the library, and also deleted
490 					// in the library after the reply has been received
491 	media_input inputs[MAX_INPUTS];
492 };
493 
494 struct server_publish_inputs_reply : reply_data {
495 };
496 
497 struct server_publish_outputs_request : area_request_data {
498 	media_node				node;
499 	int32					count;
500 		// if count > MAX_OUTPUTS, outputs are in the area
501 		// area is created in the library, and also deleted
502 		// in the library after the reply has been received
503 	media_output outputs[MAX_OUTPUTS];
504 };
505 
506 struct server_publish_outputs_reply : reply_data {
507 };
508 
509 struct producer_get_next_output_request : request_data {
510 	int32					cookie;
511 };
512 
513 struct producer_get_next_output_reply : reply_data
514 {
515 	int32					cookie;
516 	media_output			output;
517 };
518 
519 struct producer_dispose_output_cookie_request : request_data
520 {
521 	int32					cookie;
522 };
523 
524 struct producer_dispose_output_cookie_reply : reply_data {
525 };
526 
527 struct consumer_get_next_input_request : request_data {
528 	int32					cookie;
529 };
530 
531 struct consumer_get_next_input_reply : reply_data {
532 	int32					cookie;
533 	media_input				input;
534 };
535 
536 struct consumer_dispose_input_cookie_request : request_data {
537 	int32					cookie;
538 };
539 
540 struct consumer_dispose_input_cookie_reply : reply_data {
541 };
542 
543 struct consumer_disconnected_request : request_data {
544 	media_source			source;
545 	media_destination		destination;
546 };
547 
548 struct consumer_disconnected_reply : reply_data {
549 };
550 
551 struct consumer_buffer_received_command : command_data {
552 	media_buffer_id			buffer;
553 	media_header			header;
554 };
555 
556 struct consumer_producer_data_status_command : command_data {
557 	media_destination		for_whom;
558 	int32					status;
559 	bigtime_t				at_performance_time;
560 };
561 
562 struct consumer_get_latency_for_request : request_data {
563 	media_destination		for_whom;
564 };
565 
566 struct consumer_get_latency_for_reply : reply_data {
567 	bigtime_t				latency;
568 	media_node_id			timesource;
569 };
570 
571 struct consumer_format_changed_request : request_data {
572 	media_source			producer;
573 	media_destination		consumer;
574 	int32					change_tag;
575 	media_format			format;
576 };
577 
578 struct consumer_format_changed_reply : reply_data {
579 };
580 
581 struct consumer_seek_tag_requested_request : request_data {
582 	media_destination		destination;
583 	bigtime_t				target_time;
584 	uint32					flags;
585 };
586 
587 struct consumer_seek_tag_requested_reply : reply_data {
588 	media_seek_tag			seek_tag;
589 	bigtime_t				tagged_time;
590 	uint32					flags;
591 };
592 
593 struct server_register_app_request : request_data {
594 	team_id					team;
595 	BMessenger				messenger;
596 };
597 
598 struct server_register_app_reply : reply_data {
599 };
600 
601 struct server_unregister_app_request : request_data {
602 	team_id					team;
603 };
604 
605 struct server_unregister_app_reply : reply_data {
606 };
607 
608 struct server_set_node_creator_request : request_data {
609 	media_node_id			node;
610 	team_id					creator;
611 };
612 
613 struct server_set_node_creator_reply : reply_data {
614 };
615 
616 struct server_change_addon_flavor_instances_count_request : request_data {
617 	media_addon_id			addon_id;
618 	int32					flavor_id;
619 	int32					delta; // must be +1 or -1
620 	team_id					team;
621 };
622 
623 struct server_change_addon_flavor_instances_count_reply : reply_data {
624 };
625 
626 struct server_register_node_request : request_data {
627 	media_addon_id			addon_id;
628 	int32					addon_flavor_id;
629 	char					name[B_MEDIA_NAME_LENGTH];
630 	uint64					kinds;
631 	port_id					port;
632 	team_id					team;
633 };
634 
635 struct server_register_node_reply : reply_data {
636 	media_node_id			node_id;
637 };
638 
639 struct server_unregister_node_request : request_data {
640 	media_node_id			node_id;
641 	team_id					team;
642 };
643 
644 struct server_unregister_node_reply : reply_data {
645 	media_addon_id			addon_id;
646 	int32					flavor_id;
647 };
648 
649 struct server_get_live_node_info_request : request_data {
650 	media_node				node;
651 };
652 
653 struct server_get_live_node_info_reply : reply_data {
654 	live_node_info			live_info;
655 };
656 
657 struct server_get_live_nodes_request : request_data {
658 	int32					maxcount;
659 	bool					has_input;
660 	bool					has_output;
661 	bool					has_name;
662 	media_format			inputformat;
663 	media_format			outputformat;
664 	char					name[B_MEDIA_NAME_LENGTH + 1];
665 								// +1 for a trailing "*"
666 	uint64					require_kinds;
667 };
668 
669 struct server_get_live_nodes_reply : area_reply_data {
670 	int32					count;
671 		// if count > MAX_LIVE_INFO, live_node_infos are in the area
672 		// area is created in the server, but deleted in the library
673 	live_node_info			live_info[MAX_LIVE_INFO];
674 };
675 
676 struct server_node_id_for_request : request_data {
677 	port_id					port;
678 };
679 
680 struct server_node_id_for_reply : reply_data {
681 	media_node_id			node_id;
682 };
683 
684 struct server_get_node_for_request : request_data {
685 	media_node_id			node_id;
686 	team_id					team;
687 };
688 
689 struct server_get_node_for_reply : reply_data {
690 	media_node				clone;
691 };
692 
693 struct server_release_node_request : request_data {
694 	media_node				node;
695 	team_id					team;
696 };
697 
698 struct server_release_node_reply : reply_data {
699 };
700 
701 struct server_get_dormant_node_for_request : request_data {
702 	media_node				node;
703 };
704 
705 struct server_get_dormant_node_for_reply : reply_data {
706 	dormant_node_info		node_info;
707 };
708 
709 struct server_get_instances_for_request : request_data {
710 	int32					maxcount;
711 	media_addon_id			addon_id;
712 	int32					addon_flavor_id;
713 };
714 
715 struct server_get_instances_for_reply : reply_data {
716 	int32					count;
717 	media_node_id			node_id[MAX_NODE_ID];
718 		// no area here, MAX_NODE_ID is really large
719 };
720 
721 struct server_rescan_defaults_command : command_data {
722 };
723 
724 struct addonserver_rescan_mediaaddon_flavors_command : command_data {
725 	media_addon_id			addon_id;
726 };
727 
728 struct addonserver_rescan_finished_notify_command : command_data {
729 };
730 
731 struct server_register_mediaaddon_request : request_data {
732 	xfer_entry_ref			ref;
733 };
734 
735 struct server_register_mediaaddon_reply : reply_data {
736 	media_addon_id			addon_id;
737 };
738 
739 struct server_unregister_mediaaddon_command : command_data {
740 	media_addon_id			addon_id;
741 };
742 
743 struct server_get_mediaaddon_ref_request : request_data {
744 	media_addon_id			addon_id;
745 };
746 
747 struct server_get_mediaaddon_ref_reply : reply_data {
748 	xfer_entry_ref			ref;
749 };
750 
751 struct server_get_shared_buffer_area_request : request_data {
752 };
753 
754 struct server_get_shared_buffer_area_reply : area_reply_data {
755 };
756 
757 struct server_register_buffer_request : request_data {
758 	team_id					team;
759 	buffer_clone_info		info;
760 		// either info.buffer is != 0, or the area, size, offset is used
761 };
762 
763 struct server_register_buffer_reply : reply_data {
764 	buffer_clone_info		info;
765 };
766 
767 struct server_unregister_buffer_command : command_data {
768 	team_id					team;
769 	media_buffer_id			buffer_id;
770 };
771 
772 struct server_get_media_types_request : request_area_data {
773 };
774 
775 struct server_get_media_types_reply : area_reply_data {
776 	int32					count;
777 };
778 
779 struct server_get_media_items_request : request_area_data {
780 	char					type[B_MEDIA_NAME_LENGTH];
781 };
782 
783 struct server_get_media_items_reply : area_reply_data {
784 	int32					count;
785 };
786 
787 struct server_get_ref_for_request : request_data {
788 	char					type[B_MEDIA_NAME_LENGTH];
789 	char					item[B_MEDIA_NAME_LENGTH];
790 };
791 
792 struct server_get_ref_for_reply : reply_data {
793 	xfer_entry_ref			ref;
794 };
795 
796 struct server_set_ref_for_request : request_data {
797 	char					type[B_MEDIA_NAME_LENGTH];
798 	char					item[B_MEDIA_NAME_LENGTH];
799 	xfer_entry_ref			ref;
800 };
801 
802 struct server_set_ref_for_reply : reply_data {
803 };
804 
805 struct server_invalidate_item_request : request_data {
806 	char					type[B_MEDIA_NAME_LENGTH];
807 	char					item[B_MEDIA_NAME_LENGTH];
808 };
809 
810 struct server_invalidate_item_reply : reply_data {
811 };
812 
813 struct server_remove_media_item_request : request_data {
814 	char					type[B_MEDIA_NAME_LENGTH];
815 	char					item[B_MEDIA_NAME_LENGTH];
816 };
817 
818 struct server_remove_media_item_reply : reply_data {
819 };
820 
821 struct server_get_item_audio_gain_request : request_data {
822 	char					type[B_MEDIA_NAME_LENGTH];
823 	char					item[B_MEDIA_NAME_LENGTH];
824 };
825 
826 struct server_get_item_audio_gain_reply : reply_data {
827 	float					gain;
828 };
829 
830 struct server_set_item_audio_gain_request : request_data {
831 	char					type[B_MEDIA_NAME_LENGTH];
832 	char					item[B_MEDIA_NAME_LENGTH];
833 	float					gain;
834 };
835 
836 struct server_set_item_audio_gain_reply : reply_data {
837 };
838 
839 struct server_get_decoder_for_format_request : request_data {
840 	media_format			format;
841 };
842 
843 struct server_get_decoder_for_format_reply : reply_data {
844 	xfer_entry_ref			ref;
845 		// a ref to the decoder
846 };
847 
848 struct server_get_encoder_for_codec_info_request : request_data {
849 	int32					id;
850 };
851 
852 struct server_get_encoder_for_codec_info_reply : reply_data {
853 	xfer_entry_ref			ref;
854 		// a ref to the encoder
855 };
856 
857 struct server_get_readers_request : request_data {
858 };
859 
860 struct server_get_readers_reply : reply_data {
861 	xfer_entry_ref			ref[MAX_READERS];
862 		// a list of refs to the reader
863 	int32					count;
864 };
865 
866 struct server_get_writer_request : request_data {
867 	uint32					internal_id;
868 };
869 
870 struct server_get_writer_reply : reply_data {
871 	xfer_entry_ref			ref;
872 		// a ref to the writer
873 };
874 
875 struct server_get_file_format_request : request_data {
876 	int32					cookie;
877 };
878 
879 struct server_get_file_format_reply : reply_data {
880 	media_file_format		file_format;
881 		// the file format matching the cookie
882 };
883 
884 struct server_get_codec_info_request : request_data {
885 	int32					cookie;
886 };
887 
888 struct server_get_codec_info_reply : reply_data {
889 	media_codec_info		codec_info;
890 	media_format_family		format_family;
891 	media_format			input_format;
892 	media_format			output_format;
893 		// the codec info matching the cookie
894 };
895 
896 struct node_request_completed_command : command_data {
897 	media_request_info		info;
898 };
899 
900 struct node_start_command : command_data {
901 	bigtime_t				performance_time;
902 };
903 
904 struct node_stop_command : command_data {
905 	bigtime_t				performance_time;
906 	bool					immediate;
907 };
908 
909 struct node_seek_command : command_data {
910 	bigtime_t				media_time;
911 	bigtime_t				performance_time;
912 };
913 
914 struct node_set_run_mode_command : command_data {
915 	BMediaNode::run_mode	mode;
916 };
917 
918 struct node_time_warp_command : command_data {
919 	bigtime_t				at_real_time;
920 	bigtime_t				to_performance_time;
921 };
922 
923 struct node_set_timesource_command : command_data {
924 	media_node_id			timesource_id;
925 };
926 
927 struct node_get_timesource_request : request_data {
928 };
929 
930 struct node_get_timesource_reply : reply_data {
931 	media_node_id			timesource_id;
932 };
933 
934 struct node_final_release_command : command_data {
935 };
936 
937 struct timesource_add_slave_node_command : command_data {
938 	media_node				node;
939 };
940 
941 struct timesource_remove_slave_node_command : command_data {
942 	media_node				node;
943 };
944 
945 struct timesource_get_start_latency_request : request_data {
946 };
947 
948 struct timesource_get_start_latency_reply : reply_data {
949 	bigtime_t				start_latency;
950 };
951 
952 struct fileinterface_set_ref_request : request_data {
953 	dev_t					device;
954 	ino_t					directory;
955 	char					name[B_FILE_NAME_LENGTH];
956 	bigtime_t				duration;
957 	bool					create;
958 };
959 
960 struct fileinterface_set_ref_reply : reply_data {
961 	bigtime_t				duration;
962 };
963 
964 struct fileinterface_get_ref_request : request_data {
965 };
966 
967 struct fileinterface_get_ref_reply : reply_data {
968 	dev_t					device;
969 	ino_t					directory;
970 	char					name[B_FILE_NAME_LENGTH];
971 	char					mimetype[B_MIME_TYPE_LENGTH];
972 };
973 
974 struct fileinterface_sniff_ref_request : request_data {
975 	dev_t					device;
976 	ino_t					directory;
977 	char					name[B_FILE_NAME_LENGTH];
978 };
979 
980 struct fileinterface_sniff_ref_reply : reply_data {
981 	char					mimetype[B_MIME_TYPE_LENGTH];
982 	float					capability;
983 };
984 
985 struct controllable_get_parameter_web_request : area_request_data {
986 	int32					max_size;
987 };
988 
989 struct controllable_get_parameter_web_reply : reply_data {
990 	type_code				code;
991 	int32					size;
992 		// = -1: parameter web data too large,
993 		// = 0: no p.w., > 0: flattened p.w. data
994 };
995 
996 #define MAX_PARAMETER_DATA (B_MEDIA_MESSAGE_SIZE - 100)
997 
998 struct controllable_get_parameter_data_request : area_request_data {
999 	int32					parameter_id;
1000 	size_t					request_size;
1001 };
1002 
1003 struct controllable_get_parameter_data_reply : reply_data {
1004 	bigtime_t				last_change;
1005 	char					raw_data[MAX_PARAMETER_DATA];
1006 	size_t					size;
1007 };
1008 
1009 struct controllable_set_parameter_data_request : area_request_data {
1010 	int32					parameter_id;
1011 	bigtime_t				when;
1012 	size_t					size;
1013 	char					raw_data[MAX_PARAMETER_DATA];
1014 };
1015 
1016 struct controllable_set_parameter_data_reply : reply_data {
1017 };
1018 
1019 struct controllable_start_control_panel_request : request_data {
1020 	media_node				node;
1021 };
1022 
1023 struct controllable_start_control_panel_reply : reply_data {
1024 	team_id					team;
1025 };
1026 
1027 #endif // _DATA_EXCHANGE_H
1028