xref: /haiku/src/add-ons/media/media-add-ons/demultiplexer/MediaOutputInfo.h (revision 4f00613311d0bd6b70fa82ce19931c41f071ea4e)
1 // MediaOutputInfo.h
2 //
3 // Andrew Bachmann, 2002
4 //
5 // A class to encapsulate and manipulate
6 // all the information for a particular
7 // output of a media node.
8 
9 #if !defined(_MEDIA_OUTPUT_INFO_H)
10 #define _MEDIA_OUTPUT_INFO_H
11 
12 #include <MediaDefs.h>
13 #include <MediaNode.h>
14 #include <BufferProducer.h>
15 #include <BufferGroup.h>
16 
17 class MediaOutputInfo
18 {
19 public:
20 	MediaOutputInfo(BBufferProducer * _node, char * name);
21 	~MediaOutputInfo();
22 
23 virtual status_t SetBufferGroup(BBufferGroup * group);
24 
25 virtual status_t FormatProposal(media_format * format);
26 
27 virtual status_t FormatChangeRequested(
28 					const media_destination & destination,
29 					media_format * io_format);
30 
31 virtual status_t PrepareToConnect(
32 					const media_destination & where,
33 					media_format * format,
34 					media_source * out_source,
35 					char * out_name);
36 
37 virtual status_t Connect(
38 					const media_destination & destination,
39 					const media_format & format,
40 					char * io_name,
41 				 	bigtime_t _downstreamLatency);
42 
43 virtual status_t Disconnect();
44 
45 virtual status_t EnableOutput(bool enabled);
46 
47 virtual status_t AdditionalBufferRequested(
48 					media_buffer_id prev_buffer,
49 					bigtime_t prev_time,
50 					const media_seek_tag * prev_tag);
51 
52 protected:
53 
54 virtual status_t CreateBufferGroup();
55 
56 public:
57 
58 virtual uint32 ComputeBufferSize();
59 virtual bigtime_t ComputeBufferPeriod();
60 static uint32 ComputeBufferSize(const media_format & format);
61 static bigtime_t ComputeBufferPeriod(const media_format & format);
62 
63 public:
64 	BBufferProducer * producer;
65 
66 	media_output output;
67 
68 	bool outputEnabled;
69 
70 	BBufferGroup * bufferGroup;
71 	size_t bufferSize;
72 
73 	bigtime_t downstreamLatency;
74 
75 	bigtime_t bufferPeriod;
76 
77 	// This format is the least restrictive we can
78 	// support in the general case.  (no restrictions
79 	// based on content)
80 	media_format generalFormat;
81 
82 	// This format is the next least restrictive.  It
83 	// takes into account the content that we are using.
84 	// It should be the same as above with a few wildcards
85 	// removed.  Wildcards for things we are flexible on
86 	// may still be present.
87 	media_format wildcardedFormat;
88 
89 	// This format provides default values for all fields.
90 	// These defaults are used to resolve all wildcards.
91 	media_format fullySpecifiedFormat;
92 
93 	// do we need media_seek_tag in here?
94 };
95 
96 #endif // _MEDIA_OUTPUT_INFO_H
97 
98