11efb85deSBarrett17 /*
21efb85deSBarrett17 * Copyright 2019, Dario Casalinuovo. All rights reserved.
31efb85deSBarrett17 * Distributed under the terms of the MIT License.
41efb85deSBarrett17 */
51efb85deSBarrett17
61efb85deSBarrett17
7cb19342bSBarrett17 #include "DVDStreamerPlugin.h"
81efb85deSBarrett17
91efb85deSBarrett17
101efb85deSBarrett17 B_DECLARE_CODEC_KIT_PLUGIN(
111efb85deSBarrett17 DVDStreamerPlugin,
121efb85deSBarrett17 "dvd_streamer",
131efb85deSBarrett17 B_CODEC_KIT_PLUGIN_VERSION
141efb85deSBarrett17 );
151efb85deSBarrett17
161efb85deSBarrett17
DVDStreamer()171efb85deSBarrett17 DVDStreamer::DVDStreamer()
181efb85deSBarrett17 :
19cb19342bSBarrett17 BStreamer(),
20cb19342bSBarrett17 fAdapter(NULL)
211efb85deSBarrett17 {
221efb85deSBarrett17 }
231efb85deSBarrett17
241efb85deSBarrett17
~DVDStreamer()251efb85deSBarrett17 DVDStreamer::~DVDStreamer()
261efb85deSBarrett17 {
271efb85deSBarrett17 }
281efb85deSBarrett17
291efb85deSBarrett17
301efb85deSBarrett17 status_t
Sniff(const BUrl & url,BDataIO ** source)31*218a8c03SAugustin Cavalier DVDStreamer::Sniff(const BUrl& url, BDataIO** source)
321efb85deSBarrett17 {
331efb85deSBarrett17 BString path = url.UrlString();
341efb85deSBarrett17 BString protocol = url.Protocol();
351efb85deSBarrett17 if (protocol == "dvd") {
361efb85deSBarrett17 path = path.RemoveFirst("dvd://");
371efb85deSBarrett17 } else if (protocol == "file") {
381efb85deSBarrett17 path = path.RemoveFirst("file://");
391efb85deSBarrett17 } else
401efb85deSBarrett17 return B_UNSUPPORTED;
411efb85deSBarrett17
42cb19342bSBarrett17 DVDMediaIO* adapter = new DVDMediaIO(path);
43cb19342bSBarrett17 status_t ret = adapter->Open();
441efb85deSBarrett17 if (ret == B_OK) {
45*218a8c03SAugustin Cavalier *source = adapter;
461efb85deSBarrett17 return B_OK;
471efb85deSBarrett17 }
48cb19342bSBarrett17 delete adapter;
491efb85deSBarrett17 return ret;
501efb85deSBarrett17 }
511efb85deSBarrett17
521efb85deSBarrett17
53*218a8c03SAugustin Cavalier #if 0
54cb19342bSBarrett17 void
55cb19342bSBarrett17 DVDStreamer::MouseMoved(uint32 x, uint32 y)
56cb19342bSBarrett17 {
57cb19342bSBarrett17 fAdapter->MouseMoved(x, y);
58cb19342bSBarrett17 }
59cb19342bSBarrett17
60cb19342bSBarrett17
61cb19342bSBarrett17 void
62cb19342bSBarrett17 DVDStreamer::MouseDown(uint32 x, uint32 y)
63cb19342bSBarrett17 {
64cb19342bSBarrett17 fAdapter->MouseDown(x, y);
65cb19342bSBarrett17 }
66*218a8c03SAugustin Cavalier #endif
67cb19342bSBarrett17
68cb19342bSBarrett17
69*218a8c03SAugustin Cavalier Streamer*
NewStreamer()701efb85deSBarrett17 DVDStreamerPlugin::NewStreamer()
711efb85deSBarrett17 {
721efb85deSBarrett17 return new DVDStreamer();
731efb85deSBarrett17 }
74*218a8c03SAugustin Cavalier
75*218a8c03SAugustin Cavalier
76*218a8c03SAugustin Cavalier MediaPlugin*
instantiate_plugin()77*218a8c03SAugustin Cavalier instantiate_plugin()
78*218a8c03SAugustin Cavalier {
79*218a8c03SAugustin Cavalier return new DVDStreamerPlugin();
80*218a8c03SAugustin Cavalier }
81