1 /* 2 * Copyright (C) 2009-2010 David McPaul 3 * 4 * All rights reserved. Distributed under the terms of the MIT License. 5 * VideoMixerAddOn.cpp 6 * 7 * The VideoMixerAddOn class 8 * makes instances of VideoMixerNode 9 */ 10 11 12 #include <Debug.h> 13 #include <MediaDefs.h> 14 #include <MediaAddOn.h> 15 #include <Errors.h> 16 17 #include "VideoMixerNode.h" 18 #include "VideoMixerAddOn.h" 19 20 #include <limits.h> 21 #include <stdio.h> 22 #include <string.h> 23 24 #define DEBUG 1 25 26 // instantiation function 27 extern "C" _EXPORT BMediaAddOn *make_media_addon(image_id image) 28 { 29 return new VideoMixerAddOn(image); 30 } 31 32 // -------------------------------------------------------- // 33 // ctor/dtor 34 // -------------------------------------------------------- // 35 36 VideoMixerAddOn::~VideoMixerAddOn() 37 { 38 } 39 40 VideoMixerAddOn::VideoMixerAddOn(image_id image) : 41 BMediaAddOn(image) 42 { 43 PRINT("VideoMixerAddOn::VideoMixerAddOn\n"); 44 refCount = 0; 45 } 46 47 // -------------------------------------------------------- // 48 // BMediaAddOn impl 49 // -------------------------------------------------------- // 50 51 status_t VideoMixerAddOn::InitCheck( 52 const char **out_failure_text) 53 { 54 PRINT("VideoMixerAddOn::InitCheck\n"); 55 return B_OK; 56 } 57 58 int32 VideoMixerAddOn::CountFlavors() 59 { 60 PRINT("VideoMixerAddOn::CountFlavors\n"); 61 return 1; 62 } 63 64 status_t VideoMixerAddOn::GetFlavorAt( 65 int32 n, 66 const flavor_info **out_info) 67 { 68 PRINT("VideoMixerAddOn::GetFlavorAt\n"); 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 VideoMixerNode::GetFlavor(&infos[0], n); 75 (*out_info) = infos; 76 return B_OK; 77 } 78 79 BMediaNode * VideoMixerAddOn::InstantiateNodeFor( 80 const flavor_info * info, 81 BMessage * config, 82 status_t * out_error) 83 { 84 PRINT("VideoMixerAddOn::InstantiateNodeFor\n"); 85 VideoMixerNode *node = new VideoMixerNode(info, config, this); 86 if (node == NULL) { 87 *out_error = B_NO_MEMORY; 88 fprintf(stderr,"<- B_NO_MEMORY\n"); 89 } else { 90 *out_error = node->InitCheck(); 91 } 92 return node; 93 } 94 95 status_t VideoMixerAddOn::GetConfigurationFor( 96 BMediaNode * your_node, 97 BMessage * into_message) 98 { 99 PRINT("VideoMixerAddOn::GetConfigurationFor\n"); 100 VideoMixerNode *node = dynamic_cast<VideoMixerNode *>(your_node); 101 if (node == NULL) { 102 fprintf(stderr,"<- B_BAD_TYPE\n"); 103 return B_BAD_TYPE; 104 } 105 return node->GetConfigurationFor(into_message); 106 } 107 108 bool VideoMixerAddOn::WantsAutoStart() 109 { 110 PRINT("VideoMixerAddOn::WantsAutoStart\n"); 111 return false; 112 } 113 114 status_t VideoMixerAddOn::AutoStart( 115 int in_count, 116 BMediaNode **out_node, 117 int32 *out_internal_id, 118 bool *out_has_more) 119 { 120 PRINT("VideoMixerAddOn::AutoStart\n"); 121 return B_OK; 122 } 123 124 // -------------------------------------------------------- // 125 // main 126 // -------------------------------------------------------- // 127 128 int main(int argc, char *argv[]) 129 { 130 fprintf(stderr,"VideoMixerAddOn cannot be run\n"); 131 } 132