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