Introduce new experimental class MediaStreamer
This commit is contained in:
parent
e62e979e60
commit
dfecb37aee
36
headers/private/media/MediaStreamer.h
Normal file
36
headers/private/media/MediaStreamer.h
Normal file
@ -0,0 +1,36 @@
|
||||
/*
|
||||
* Copyright 2017, Dario Casalinuovo. All rights reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
#ifndef _MEDIA_STREAMER_H
|
||||
#define _MEDIA_STREAMER_H
|
||||
|
||||
|
||||
#include <Url.h>
|
||||
|
||||
#include "StreamerPlugin.h"
|
||||
|
||||
|
||||
namespace BPrivate {
|
||||
namespace media {
|
||||
|
||||
|
||||
class MediaStreamer {
|
||||
public:
|
||||
MediaStreamer(BUrl url);
|
||||
~MediaStreamer();
|
||||
|
||||
status_t CreateAdapter(BDataIO** adapter);
|
||||
|
||||
private:
|
||||
BUrl fUrl;
|
||||
Streamer* fStreamer;
|
||||
};
|
||||
|
||||
|
||||
}; // namespace media
|
||||
}; // namespace BPrivate
|
||||
|
||||
using namespace BPrivate::media;
|
||||
|
||||
#endif
|
47
src/kits/media/MediaStreamer.cpp
Normal file
47
src/kits/media/MediaStreamer.cpp
Normal file
@ -0,0 +1,47 @@
|
||||
/*
|
||||
* Copyright 2017, Dario Casalinuovo
|
||||
* All rights reserved. Distributed under the terms of the MIT license.
|
||||
*/
|
||||
|
||||
|
||||
#include "MediaStreamer.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "debug.h"
|
||||
|
||||
#include "PluginManager.h"
|
||||
|
||||
|
||||
MediaStreamer::MediaStreamer(BUrl url)
|
||||
:
|
||||
fStreamer(NULL)
|
||||
{
|
||||
CALLED();
|
||||
|
||||
fUrl = url;
|
||||
}
|
||||
|
||||
|
||||
MediaStreamer::~MediaStreamer()
|
||||
{
|
||||
CALLED();
|
||||
|
||||
if (fStreamer != NULL)
|
||||
gPluginManager.DestroyStreamer(fStreamer);
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
MediaStreamer::CreateAdapter(BDataIO** adapter)
|
||||
{
|
||||
CALLED();
|
||||
|
||||
// NOTE: Consider splitting the streamer creation and
|
||||
// sniff in PluginManager.
|
||||
if (fStreamer != NULL)
|
||||
gPluginManager.DestroyStreamer(fStreamer);
|
||||
|
||||
return gPluginManager.CreateStreamer(&fStreamer, fUrl, adapter);
|
||||
}
|
Loading…
Reference in New Issue
Block a user