xref: /haiku/src/add-ons/media/plugins/http_streamer/HTTPStreamerPlugin.cpp (revision 21258e2674226d6aa732321b6f8494841895af5f)
1 /*
2  * Copyright 2016, Dario Casalinuovo
3  * Distributed under the terms of the MIT License.
4  */
5 
6 
7 #include "HTTPStreamerPlugin.h"
8 
9 #include "HTTPMediaIO.h"
10 
11 #include "MediaDebug.h"
12 
13 
14 HTTPStreamer::HTTPStreamer()
15 {
16 	CALLED();
17 }
18 
19 
20 HTTPStreamer::~HTTPStreamer()
21 {
22 	CALLED();
23 }
24 
25 
26 status_t
27 HTTPStreamer::Sniff(const BUrl& url, BDataIO** source)
28 {
29 	CALLED();
30 
31 	HTTPMediaIO* outSource = new HTTPMediaIO(url);
32 
33 	status_t ret = outSource->Open();
34 	if (ret == B_OK) {
35 		*source = outSource;
36 		return B_OK;
37 	}
38 	delete outSource;
39 	return ret;
40 }
41 
42 
43 Streamer*
44 HTTPStreamerPlugin::NewStreamer()
45 {
46 	return new HTTPStreamer();
47 }
48 
49 
50 MediaPlugin *instantiate_plugin()
51 {
52 	return new HTTPStreamerPlugin();
53 }
54