1/* 2 * Copyright 2019, Dario Casalinuovo. All rights reserved. 3 * Distributed under the terms of the MIT License. 4 */ 5 6 7#include "DVDStreamerPlugin.h" 8 9 10B_DECLARE_CODEC_KIT_PLUGIN( 11 DVDStreamerPlugin, 12 "dvd_streamer", 13 B_CODEC_KIT_PLUGIN_VERSION 14); 15 16 17DVDStreamer::DVDStreamer() 18 : 19 BStreamer(), 20 fAdapter(NULL) 21{ 22} 23 24 25DVDStreamer::~DVDStreamer() 26{ 27} 28 29 30status_t 31DVDStreamer::Sniff(const BUrl& url, BDataIO** source) 32{ 33 BString path = url.UrlString(); 34 BString protocol = url.Protocol(); 35 if (protocol == "dvd") { 36 path = path.RemoveFirst("dvd://"); 37 } else if (protocol == "file") { 38 path = path.RemoveFirst("file://"); 39 } else 40 return B_UNSUPPORTED; 41 42 DVDMediaIO* adapter = new DVDMediaIO(path); 43 status_t ret = adapter->Open(); 44 if (ret == B_OK) { 45 *source = adapter; 46 return B_OK; 47 } 48 delete adapter; 49 return ret; 50} 51 52 53#if 0 54void 55DVDStreamer::MouseMoved(uint32 x, uint32 y) 56{ 57 fAdapter->MouseMoved(x, y); 58} 59 60 61void 62DVDStreamer::MouseDown(uint32 x, uint32 y) 63{ 64 fAdapter->MouseDown(x, y); 65} 66#endif 67 68 69Streamer* 70DVDStreamerPlugin::NewStreamer() 71{ 72 return new DVDStreamer(); 73} 74 75 76MediaPlugin* 77instantiate_plugin() 78{ 79 return new DVDStreamerPlugin(); 80} 81