xref: /haiku/src/kits/media/request_data.cpp (revision 21258e2674226d6aa732321b6f8494841895af5f)
1 /*
2  * Copyright 2019, Ryan Leavengood
3  * Copyright 2009, Axel Dörfler, axeld@pinc-software.de.
4  * Distributed under the terms of the MIT License.
5  */
6 
7 
8 #include <ServerInterface.h>
9 
10 #include <set>
11 
12 #include <Autolock.h>
13 #include <Locker.h>
14 
15 #include <DataExchange.h>
16 #include <MediaDebug.h>
17 
18 #include "PortPool.h"
19 
20 
21 namespace BPrivate {
22 namespace media {
23 
24 
25 request_data::request_data()
26 {
27 	reply_port = gPortPool->GetPort();
28 }
29 
30 
31 request_data::~request_data()
32 {
33 	gPortPool->PutPort(reply_port);
34 }
35 
36 
37 status_t
38 request_data::SendReply(status_t result, reply_data *reply,
39 	size_t replySize) const
40 {
41 	reply->result = result;
42 	// we cheat and use the (command_data *) version of SendToPort
43 	return SendToPort(reply_port, 0, reinterpret_cast<command_data *>(reply),
44 		replySize);
45 }
46 
47 
48 }	// namespace media
49 }	// namespace BPrivate
50