1d5525d8cSshatty// MediaOutputInfo.h
2d5525d8cSshatty//
3d5525d8cSshatty// Andrew Bachmann, 2002
4d5525d8cSshatty//
5d5525d8cSshatty// A class to encapsulate and manipulate
6d5525d8cSshatty// all the information for a particular
7d5525d8cSshatty// output of a media node.
8d5525d8cSshatty
9d5525d8cSshatty#if !defined(_MEDIA_OUTPUT_INFO_H)
10d5525d8cSshatty#define _MEDIA_OUTPUT_INFO_H
11d5525d8cSshatty
12d5525d8cSshatty#include <MediaDefs.h>
13728a8c74Sshatty#include <MediaNode.h>
14728a8c74Sshatty#include <BufferProducer.h>
15d5525d8cSshatty#include <BufferGroup.h>
16d5525d8cSshatty
17d5525d8cSshattyclass MediaOutputInfo
18d5525d8cSshatty{
19d5525d8cSshattypublic:
20728a8c74Sshatty	MediaOutputInfo(BBufferProducer * _node, char * name);
21728a8c74Sshatty	~MediaOutputInfo();
22728a8c74Sshatty
23728a8c74Sshattyvirtual status_t SetBufferGroup(BBufferGroup * group);
24728a8c74Sshatty
25728a8c74Sshattyvirtual status_t FormatProposal(media_format * format);
26728a8c74Sshatty
27728a8c74Sshattyvirtual status_t FormatChangeRequested(
28728a8c74Sshatty					const media_destination & destination,
29728a8c74Sshatty					media_format * io_format);
30728a8c74Sshatty
31728a8c74Sshattyvirtual status_t PrepareToConnect(
32728a8c74Sshatty					const media_destination & where,
33728a8c74Sshatty					media_format * format,
34728a8c74Sshatty					media_source * out_source,
35728a8c74Sshatty					char * out_name);
36d5525d8cSshatty
37728a8c74Sshattyvirtual status_t Connect(
38728a8c74Sshatty					const media_destination & destination,
39728a8c74Sshatty					const media_format & format,
40728a8c74Sshatty					char * io_name,
41728a8c74Sshatty				 	bigtime_t _downstreamLatency);
42728a8c74Sshatty
43728a8c74Sshattyvirtual status_t Disconnect();
44d5525d8cSshatty
45728a8c74Sshattyvirtual status_t EnableOutput(bool enabled);
46728a8c74Sshatty
47728a8c74Sshattyvirtual status_t AdditionalBufferRequested(
48728a8c74Sshatty					media_buffer_id prev_buffer,
49728a8c74Sshatty					bigtime_t prev_time,
50728a8c74Sshatty					const media_seek_tag * prev_tag);
51d5525d8cSshatty
52728a8c74Sshattyprotected:
53728a8c74Sshatty
54728a8c74Sshattyvirtual status_t CreateBufferGroup();
55728a8c74Sshatty
56728a8c74Sshattypublic:
57d5525d8cSshatty
58728a8c74Sshattyvirtual uint32 ComputeBufferSize();
59728a8c74Sshattyvirtual bigtime_t ComputeBufferPeriod();
60728a8c74Sshattystatic uint32 ComputeBufferSize(const media_format & format);
61728a8c74Sshattystatic bigtime_t ComputeBufferPeriod(const media_format & format);
62d5525d8cSshatty
63d5525d8cSshattypublic:
64728a8c74Sshatty	BBufferProducer * producer;
65728a8c74Sshatty
66d5525d8cSshatty	media_output output;
67d5525d8cSshatty
68d5525d8cSshatty	bool outputEnabled;
69d5525d8cSshatty
70d5525d8cSshatty	BBufferGroup * bufferGroup;
71d5525d8cSshatty	size_t bufferSize;
72d5525d8cSshatty
73d5525d8cSshatty	bigtime_t downstreamLatency;
74d5525d8cSshatty
75d5525d8cSshatty	bigtime_t bufferPeriod;
76d5525d8cSshatty
77d5525d8cSshatty	// This format is the least restrictive we can
78d5525d8cSshatty	// support in the general case.  (no restrictions
79d5525d8cSshatty	// based on content)
80d5525d8cSshatty	media_format generalFormat;
81d5525d8cSshatty
82d5525d8cSshatty	// This format is the next least restrictive.  It
83d5525d8cSshatty	// takes into account the content that we are using.
84d5525d8cSshatty	// It should be the same as above with a few wildcards
85d5525d8cSshatty	// removed.  Wildcards for things we are flexible on
86d5525d8cSshatty	// may still be present.
87d5525d8cSshatty	media_format wildcardedFormat;
88d5525d8cSshatty
89d5525d8cSshatty	// This format provides default values for all fields.
90d5525d8cSshatty	// These defaults are used to resolve all wildcards.
91d5525d8cSshatty	media_format fullySpecifiedFormat;
92d5525d8cSshatty
93d5525d8cSshatty	// do we need media_seek_tag in here?
94728a8c74Sshatty};
95d5525d8cSshatty
96d5525d8cSshatty#endif // _MEDIA_OUTPUT_INFO_H
97d5525d8cSshatty
98