1*ffec4cb1Sshadow303 /****************************************************************************** 2*ffec4cb1Sshadow303 / 3*ffec4cb1Sshadow303 / File: RadeonAddOn.h 4*ffec4cb1Sshadow303 / 5*ffec4cb1Sshadow303 / Description: ATI Radeon Video Capture Media AddOn for BeOS. 6*ffec4cb1Sshadow303 / 7*ffec4cb1Sshadow303 / Copyright 2001, Carlos Hasan 8*ffec4cb1Sshadow303 / 9*ffec4cb1Sshadow303 *******************************************************************************/ 10*ffec4cb1Sshadow303 11*ffec4cb1Sshadow303 #ifndef __RADEON_ADDON_H__ 12*ffec4cb1Sshadow303 #define __RADEON_ADDON_H__ 13*ffec4cb1Sshadow303 14*ffec4cb1Sshadow303 #include <media/MediaAddOn.h> 15*ffec4cb1Sshadow303 #include <Path.h> 16*ffec4cb1Sshadow303 #include "benaphore.h" 17*ffec4cb1Sshadow303 18*ffec4cb1Sshadow303 #define TOUCH(x) ((void)(x)) 19*ffec4cb1Sshadow303 20*ffec4cb1Sshadow303 extern "C" _EXPORT BMediaAddOn *make_media_addon(image_id you); 21*ffec4cb1Sshadow303 22*ffec4cb1Sshadow303 class CRadeonAddOn; 23*ffec4cb1Sshadow303 24*ffec4cb1Sshadow303 // descriptor of a possible Radeon node 25*ffec4cb1Sshadow303 class CRadeonPlug { 26*ffec4cb1Sshadow303 public: 27*ffec4cb1Sshadow303 CRadeonPlug( CRadeonAddOn *addon, const BPath &dev_path, int id ); ~CRadeonPlug()28*ffec4cb1Sshadow303 ~CRadeonPlug() {} 29*ffec4cb1Sshadow303 getName()30*ffec4cb1Sshadow303 const char *getName() { return fFlavorInfo.name; } getDeviceName()31*ffec4cb1Sshadow303 const char *getDeviceName() { return dev_path.Path(); } getDeviceShortName()32*ffec4cb1Sshadow303 const char *getDeviceShortName() { return dev_path.Leaf(); } getFlavorInfo()33*ffec4cb1Sshadow303 flavor_info *getFlavorInfo() { return &fFlavorInfo; } getNode()34*ffec4cb1Sshadow303 BMediaNode *getNode() { return node; } setNode(BMediaNode * anode)35*ffec4cb1Sshadow303 void setNode( BMediaNode *anode ) { node = anode; } getSettings()36*ffec4cb1Sshadow303 BMessage *getSettings() { return &settings; } 37*ffec4cb1Sshadow303 38*ffec4cb1Sshadow303 void writeSettings( BMessage *new_settings ); 39*ffec4cb1Sshadow303 40*ffec4cb1Sshadow303 private: 41*ffec4cb1Sshadow303 CRadeonAddOn *addon; // (global) addon (only needed for GetConfiguration()) 42*ffec4cb1Sshadow303 BPath dev_path; // path of device driver 43*ffec4cb1Sshadow303 int id; // id of plug 44*ffec4cb1Sshadow303 flavor_info fFlavorInfo; // flavor of plug (contains unique id) 45*ffec4cb1Sshadow303 BMediaNode *node; // active node (or NULL) 46*ffec4cb1Sshadow303 BMessage settings; // settings for this node 47*ffec4cb1Sshadow303 media_format fMediaFormat[4]; 48*ffec4cb1Sshadow303 49*ffec4cb1Sshadow303 void readSettings(); 50*ffec4cb1Sshadow303 BPath getSettingsPath(); 51*ffec4cb1Sshadow303 }; 52*ffec4cb1Sshadow303 53*ffec4cb1Sshadow303 class CRadeonAddOn : public BMediaAddOn 54*ffec4cb1Sshadow303 { 55*ffec4cb1Sshadow303 public: 56*ffec4cb1Sshadow303 CRadeonAddOn(image_id imid); 57*ffec4cb1Sshadow303 virtual ~CRadeonAddOn(); 58*ffec4cb1Sshadow303 59*ffec4cb1Sshadow303 virtual status_t InitCheck(const char **out_failure_text); 60*ffec4cb1Sshadow303 61*ffec4cb1Sshadow303 virtual int32 CountFlavors(); 62*ffec4cb1Sshadow303 virtual status_t GetFlavorAt(int32 n, const flavor_info ** out_info); 63*ffec4cb1Sshadow303 virtual BMediaNode *InstantiateNodeFor( 64*ffec4cb1Sshadow303 const flavor_info * info, 65*ffec4cb1Sshadow303 BMessage * config, 66*ffec4cb1Sshadow303 status_t * out_error); 67*ffec4cb1Sshadow303 SaveConfigInfo(BMediaNode * node,BMessage * message)68*ffec4cb1Sshadow303 virtual status_t SaveConfigInfo(BMediaNode *node, BMessage *message) 69*ffec4cb1Sshadow303 { TOUCH(node); TOUCH(message); return B_OK; } 70*ffec4cb1Sshadow303 WantsAutoStart()71*ffec4cb1Sshadow303 virtual bool WantsAutoStart() { return false; } AutoStart(int in_count,BMediaNode ** out_node,int32 * out_internal_id,bool * out_has_more)72*ffec4cb1Sshadow303 virtual status_t AutoStart(int in_count, BMediaNode **out_node, 73*ffec4cb1Sshadow303 int32 *out_internal_id, bool *out_has_more) 74*ffec4cb1Sshadow303 { TOUCH(in_count); TOUCH(out_node); 75*ffec4cb1Sshadow303 TOUCH(out_internal_id); TOUCH(out_has_more); 76*ffec4cb1Sshadow303 return B_ERROR; } 77*ffec4cb1Sshadow303 78*ffec4cb1Sshadow303 virtual status_t GetConfigurationFor( 79*ffec4cb1Sshadow303 BMediaNode *your_node, 80*ffec4cb1Sshadow303 BMessage *into_message ); 81*ffec4cb1Sshadow303 82*ffec4cb1Sshadow303 // private methods 83*ffec4cb1Sshadow303 void UnregisterNode( BMediaNode *node, BMessage *settings ); 84*ffec4cb1Sshadow303 85*ffec4cb1Sshadow303 private: 86*ffec4cb1Sshadow303 status_t fInitStatus; 87*ffec4cb1Sshadow303 BList fDevices; // list of BPath of found devices 88*ffec4cb1Sshadow303 thread_id settings_thread; 89*ffec4cb1Sshadow303 sem_id settings_thread_sem; 90*ffec4cb1Sshadow303 benaphore plug_lock; 91*ffec4cb1Sshadow303 BMessage settings; 92*ffec4cb1Sshadow303 93*ffec4cb1Sshadow303 status_t RecursiveScan( const char* rootPath, BEntry *rootEntry = NULL ); 94*ffec4cb1Sshadow303 static int32 settings_writer( void *param ); 95*ffec4cb1Sshadow303 void settingsWriter(); 96*ffec4cb1Sshadow303 void writeSettings(); 97*ffec4cb1Sshadow303 }; 98*ffec4cb1Sshadow303 99*ffec4cb1Sshadow303 #endif 100