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
make_media_addon(image_id image)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
~MediaDemultiplexerAddOn()32 MediaDemultiplexerAddOn::~MediaDemultiplexerAddOn()
33 {
34 }
35
MediaDemultiplexerAddOn(image_id image)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
InitCheck(const char ** out_failure_text)47 status_t MediaDemultiplexerAddOn::InitCheck(
48 const char ** out_failure_text)
49 {
50 fprintf(stderr,"MediaDemultiplexerAddOn::InitCheck\n");
51 return B_OK;
52 }
53
CountFlavors()54 int32 MediaDemultiplexerAddOn::CountFlavors()
55 {
56 fprintf(stderr,"MediaDemultiplexerAddOn::CountFlavors\n");
57 return 1;
58 }
59
GetFlavorAt(int32 n,const flavor_info ** out_info)60 status_t MediaDemultiplexerAddOn::GetFlavorAt(
61 int32 n,
62 const flavor_info ** out_info)
63 {
64 fprintf(stderr,"MediaDemultiplexerAddOn::GetFlavorAt\n");
65 if (n != 0) {
66 fprintf(stderr,"<- B_BAD_INDEX\n");
67 return B_BAD_INDEX;
68 }
69 flavor_info * infos = new flavor_info[1];
70 MediaDemultiplexerNode::GetFlavor(&infos[0],n);
71 (*out_info) = infos;
72 return B_OK;
73 }
74
InstantiateNodeFor(const flavor_info * info,BMessage * config,status_t * out_error)75 BMediaNode * MediaDemultiplexerAddOn::InstantiateNodeFor(
76 const flavor_info * info,
77 BMessage * config,
78 status_t * out_error)
79 {
80 fprintf(stderr,"MediaDemultiplexerAddOn::InstantiateNodeFor\n");
81 MediaDemultiplexerNode * node
82 = new MediaDemultiplexerNode(info,config,this);
83 if (node == 0) {
84 *out_error = B_NO_MEMORY;
85 fprintf(stderr,"<- B_NO_MEMORY\n");
86 } else {
87 *out_error = node->InitCheck();
88 }
89 return node;
90 }
91
GetConfigurationFor(BMediaNode * your_node,BMessage * into_message)92 status_t MediaDemultiplexerAddOn::GetConfigurationFor(
93 BMediaNode * your_node,
94 BMessage * into_message)
95 {
96 fprintf(stderr,"MediaDemultiplexerAddOn::GetConfigurationFor\n");
97 MediaDemultiplexerNode * node
98 = dynamic_cast<MediaDemultiplexerNode*>(your_node);
99 if (node == 0) {
100 fprintf(stderr,"<- B_BAD_TYPE\n");
101 return B_BAD_TYPE;
102 }
103 return node->GetConfigurationFor(into_message);
104 }
105
WantsAutoStart()106 bool MediaDemultiplexerAddOn::WantsAutoStart()
107 {
108 fprintf(stderr,"MediaDemultiplexerAddOn::WantsAutoStart\n");
109 return false;
110 }
111
AutoStart(int in_count,BMediaNode ** out_node,int32 * out_internal_id,bool * out_has_more)112 status_t MediaDemultiplexerAddOn::AutoStart(
113 int in_count,
114 BMediaNode ** out_node,
115 int32 * out_internal_id,
116 bool * out_has_more)
117 {
118 fprintf(stderr,"MediaDemultiplexerAddOn::AutoStart\n");
119 return B_OK;
120 }
121
122 // -------------------------------------------------------- //
123 // main
124 // -------------------------------------------------------- //
125
main(int argc,char * argv[])126 int main(int argc, char *argv[])
127 {
128 fprintf(stderr,"main called for MediaDemultiplexerAddOn\n");
129 }
130
131 // -------------------------------------------------------- //
132 // stuffing
133 // -------------------------------------------------------- //
134
_Reserved_MediaDemultiplexerAddOn_0(void *)135 status_t MediaDemultiplexerAddOn::_Reserved_MediaDemultiplexerAddOn_0(void *) {};
_Reserved_MediaDemultiplexerAddOn_1(void *)136 status_t MediaDemultiplexerAddOn::_Reserved_MediaDemultiplexerAddOn_1(void *) {};
_Reserved_MediaDemultiplexerAddOn_2(void *)137 status_t MediaDemultiplexerAddOn::_Reserved_MediaDemultiplexerAddOn_2(void *) {};
_Reserved_MediaDemultiplexerAddOn_3(void *)138 status_t MediaDemultiplexerAddOn::_Reserved_MediaDemultiplexerAddOn_3(void *) {};
_Reserved_MediaDemultiplexerAddOn_4(void *)139 status_t MediaDemultiplexerAddOn::_Reserved_MediaDemultiplexerAddOn_4(void *) {};
_Reserved_MediaDemultiplexerAddOn_5(void *)140 status_t MediaDemultiplexerAddOn::_Reserved_MediaDemultiplexerAddOn_5(void *) {};
_Reserved_MediaDemultiplexerAddOn_6(void *)141 status_t MediaDemultiplexerAddOn::_Reserved_MediaDemultiplexerAddOn_6(void *) {};
_Reserved_MediaDemultiplexerAddOn_7(void *)142 status_t MediaDemultiplexerAddOn::_Reserved_MediaDemultiplexerAddOn_7(void *) {};
_Reserved_MediaDemultiplexerAddOn_8(void *)143 status_t MediaDemultiplexerAddOn::_Reserved_MediaDemultiplexerAddOn_8(void *) {};
_Reserved_MediaDemultiplexerAddOn_9(void *)144 status_t MediaDemultiplexerAddOn::_Reserved_MediaDemultiplexerAddOn_9(void *) {};
_Reserved_MediaDemultiplexerAddOn_10(void *)145 status_t MediaDemultiplexerAddOn::_Reserved_MediaDemultiplexerAddOn_10(void *) {};
_Reserved_MediaDemultiplexerAddOn_11(void *)146 status_t MediaDemultiplexerAddOn::_Reserved_MediaDemultiplexerAddOn_11(void *) {};
_Reserved_MediaDemultiplexerAddOn_12(void *)147 status_t MediaDemultiplexerAddOn::_Reserved_MediaDemultiplexerAddOn_12(void *) {};
_Reserved_MediaDemultiplexerAddOn_13(void *)148 status_t MediaDemultiplexerAddOn::_Reserved_MediaDemultiplexerAddOn_13(void *) {};
_Reserved_MediaDemultiplexerAddOn_14(void *)149 status_t MediaDemultiplexerAddOn::_Reserved_MediaDemultiplexerAddOn_14(void *) {};
_Reserved_MediaDemultiplexerAddOn_15(void *)150 status_t MediaDemultiplexerAddOn::_Reserved_MediaDemultiplexerAddOn_15(void *) {};
151