xref: /haiku/src/add-ons/media/plugins/http_streamer/HTTPStreamerPlugin.cpp (revision f290b766707b386d72e2eaadd35cc3d999405077)
1 /*
2  * Copyright 2016-2018, 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 B_DECLARE_CODEC_KIT_PLUGIN(
15 	HTTPStreamerPlugin,
16 	"http_streamer",
17 	B_CODEC_KIT_PLUGIN_VERSION
18 );
19 
20 
21 HTTPStreamer::HTTPStreamer()
22 {
23 	CALLED();
24 }
25 
26 
27 HTTPStreamer::~HTTPStreamer()
28 {
29 	CALLED();
30 }
31 
32 
33 status_t
34 HTTPStreamer::Sniff(const BUrl& url, BDataIO** source)
35 {
36 	CALLED();
37 
38 	HTTPMediaIO* outSource = new HTTPMediaIO(url);
39 
40 	status_t ret = outSource->Open();
41 	if (ret == B_OK) {
42 		*source = outSource;
43 		return B_OK;
44 	}
45 	delete outSource;
46 	return ret;
47 }
48 
49 
50 BStreamer*
51 HTTPStreamerPlugin::NewStreamer()
52 {
53 	return new HTTPStreamer();
54 }
55