xref: /haiku/src/add-ons/media/media-add-ons/demultiplexer/MediaDemultiplexerAddOn.cpp (revision 51978af14a173e7fae0563b562be5603bc652aeb)
1 // MediaDemultiplexerAddOn.cpp
2 //
3 // Andrew Bachmann, 2002
4 //
5 // MediaDemultiplexerAddOn is an add-on
6 // that can make instances of MediaDemultiplexerNode
7 //
8 // MediaDemultiplexerNode handles a file and a multistream
9 
10 
11 #include <MediaDefs.h>
12 #include <MediaAddOn.h>
13 #include <Errors.h>
14 
15 #include "MediaDemultiplexerNode.h"
16 #include "MediaDemultiplexerAddOn.h"
17 
18 #include <limits.h>
19 #include <stdio.h>
20 #include <string.h>
21 
22 // instantiation function
23 extern "C" _EXPORT BMediaAddOn * make_media_addon(image_id image)
24 {
25 	return new MediaDemultiplexerAddOn(image);
26 }
27 
28 // -------------------------------------------------------- //
29 // ctor/dtor
30 // -------------------------------------------------------- //
31 
32 MediaDemultiplexerAddOn::~MediaDemultiplexerAddOn()
33 {
34 }
35 
36 MediaDemultiplexerAddOn::MediaDemultiplexerAddOn(image_id image) :
37 	BMediaAddOn(image)
38 {
39 	fprintf(stderr,"MediaDemultiplexerAddOn::MediaDemultiplexerAddOn\n");
40 	refCount = 0;
41 }
42 
43 // -------------------------------------------------------- //
44 // BMediaAddOn impl
45 // -------------------------------------------------------- //
46 
47 status_t MediaDemultiplexerAddOn::InitCheck(
48 	const char ** out_failure_text)
49 {
50 	fprintf(stderr,"MediaDemultiplexerAddOn::InitCheck\n");
51 	return B_OK;
52 }
53 
54 int32 MediaDemultiplexerAddOn::CountFlavors()
55 {
56 	fprintf(stderr,"MediaDemultiplexerAddOn::CountFlavors\n");
57 	return 1;
58 }
59 
60 status_t MediaDemultiplexerAddOn::GetFlavorAt(
61 	int32 n,
62 	const flavor_info ** out_info)
63 {
64 	fprintf(stderr,"MediaDemultiplexerAddOn::GetFlavorAt\n");
65 	if (out_info == 0) {
66 		fprintf(stderr,"<- B_BAD_VALUE\n");
67 		return B_BAD_VALUE; // we refuse to crash because you were stupid
68 	}
69 	if (n != 0) {
70 		fprintf(stderr,"<- B_BAD_INDEX\n");
71 		return B_BAD_INDEX;
72 	}
73 	flavor_info * infos = new flavor_info[1];
74 	MediaDemultiplexerNode::GetFlavor(&infos[0],n);
75 	(*out_info) = infos;
76 	return B_OK;
77 }
78 
79 BMediaNode * MediaDemultiplexerAddOn::InstantiateNodeFor(
80 				const flavor_info * info,
81 				BMessage * config,
82 				status_t * out_error)
83 {
84 	fprintf(stderr,"MediaDemultiplexerAddOn::InstantiateNodeFor\n");
85 	if (out_error == 0) {
86 		fprintf(stderr,"<- NULL\n");
87 		return 0; // we refuse to crash because you were stupid
88 	}
89 	MediaDemultiplexerNode * node
90 		= new MediaDemultiplexerNode(info,config,this);
91 	if (node == 0) {
92 		*out_error = B_NO_MEMORY;
93 		fprintf(stderr,"<- B_NO_MEMORY\n");
94 	} else {
95 		*out_error = node->InitCheck();
96 	}
97 	return node;
98 }
99 
100 status_t MediaDemultiplexerAddOn::GetConfigurationFor(
101 				BMediaNode * your_node,
102 				BMessage * into_message)
103 {
104 	fprintf(stderr,"MediaDemultiplexerAddOn::GetConfigurationFor\n");
105 	if (into_message == 0) {
106 		fprintf(stderr,"<- B_BAD_VALUE\n");
107 		return B_BAD_VALUE; // we refuse to crash because you were stupid
108 	}
109 	MediaDemultiplexerNode * node
110 		= dynamic_cast<MediaDemultiplexerNode*>(your_node);
111 	if (node == 0) {
112 		fprintf(stderr,"<- B_BAD_TYPE\n");
113 		return B_BAD_TYPE;
114 	}
115 	return node->GetConfigurationFor(into_message);
116 }
117 
118 bool MediaDemultiplexerAddOn::WantsAutoStart()
119 {
120 	fprintf(stderr,"MediaDemultiplexerAddOn::WantsAutoStart\n");
121 	return false;
122 }
123 
124 status_t MediaDemultiplexerAddOn::AutoStart(
125 				int in_count,
126 				BMediaNode ** out_node,
127 				int32 * out_internal_id,
128 				bool * out_has_more)
129 {
130 	fprintf(stderr,"MediaDemultiplexerAddOn::AutoStart\n");
131 	return B_OK;
132 }
133 
134 // -------------------------------------------------------- //
135 // main
136 // -------------------------------------------------------- //
137 
138 int main(int argc, char *argv[])
139 {
140 	fprintf(stderr,"main called for MediaDemultiplexerAddOn\n");
141 }
142 
143 // -------------------------------------------------------- //
144 // stuffing
145 // -------------------------------------------------------- //
146 
147 status_t MediaDemultiplexerAddOn::_Reserved_MediaDemultiplexerAddOn_0(void *) {};
148 status_t MediaDemultiplexerAddOn::_Reserved_MediaDemultiplexerAddOn_1(void *) {};
149 status_t MediaDemultiplexerAddOn::_Reserved_MediaDemultiplexerAddOn_2(void *) {};
150 status_t MediaDemultiplexerAddOn::_Reserved_MediaDemultiplexerAddOn_3(void *) {};
151 status_t MediaDemultiplexerAddOn::_Reserved_MediaDemultiplexerAddOn_4(void *) {};
152 status_t MediaDemultiplexerAddOn::_Reserved_MediaDemultiplexerAddOn_5(void *) {};
153 status_t MediaDemultiplexerAddOn::_Reserved_MediaDemultiplexerAddOn_6(void *) {};
154 status_t MediaDemultiplexerAddOn::_Reserved_MediaDemultiplexerAddOn_7(void *) {};
155 status_t MediaDemultiplexerAddOn::_Reserved_MediaDemultiplexerAddOn_8(void *) {};
156 status_t MediaDemultiplexerAddOn::_Reserved_MediaDemultiplexerAddOn_9(void *) {};
157 status_t MediaDemultiplexerAddOn::_Reserved_MediaDemultiplexerAddOn_10(void *) {};
158 status_t MediaDemultiplexerAddOn::_Reserved_MediaDemultiplexerAddOn_11(void *) {};
159 status_t MediaDemultiplexerAddOn::_Reserved_MediaDemultiplexerAddOn_12(void *) {};
160 status_t MediaDemultiplexerAddOn::_Reserved_MediaDemultiplexerAddOn_13(void *) {};
161 status_t MediaDemultiplexerAddOn::_Reserved_MediaDemultiplexerAddOn_14(void *) {};
162 status_t MediaDemultiplexerAddOn::_Reserved_MediaDemultiplexerAddOn_15(void *) {};
163