MediaWriter: Add new BUrl functionality

This commit is contained in:
Dario Casalinuovo 2016-03-25 22:19:03 +01:00
parent a2b3f12698
commit 20ae088fa5
2 changed files with 33 additions and 0 deletions

View File

@ -6,7 +6,10 @@
#define _MEDIA_WRITER_H #define _MEDIA_WRITER_H
#include <Url.h>
#include "EncoderPlugin.h" #include "EncoderPlugin.h"
#include "StreamerPlugin.h"
#include "TList.h" #include "TList.h"
#include "WriterPlugin.h" #include "WriterPlugin.h"
@ -19,10 +22,14 @@ class MediaWriter {
public: public:
MediaWriter(BDataIO* target, MediaWriter(BDataIO* target,
const media_file_format& fileFormat); const media_file_format& fileFormat);
MediaWriter(BUrl* url,
const media_file_format& fileFormat);
~MediaWriter(); ~MediaWriter();
status_t InitCheck(); status_t InitCheck();
BDataIO* Target() const;
void GetFileFormatInfo(media_file_format* mfi) const; void GetFileFormatInfo(media_file_format* mfi) const;
status_t CreateEncoder(Encoder** _encoder, status_t CreateEncoder(Encoder** _encoder,
@ -52,6 +59,7 @@ private:
private: private:
BDataIO* fTarget; BDataIO* fTarget;
Writer* fWriter; Writer* fWriter;
Streamer* fStreamer;
List<StreamInfo> fStreamInfos; List<StreamInfo> fStreamInfos;

View File

@ -48,6 +48,7 @@ MediaWriter::MediaWriter(BDataIO* target, const media_file_format& fileFormat)
: :
fTarget(target), fTarget(target),
fWriter(NULL), fWriter(NULL),
fStreamer(NULL),
fStreamInfos(), fStreamInfos(),
fFileFormat(fileFormat) fFileFormat(fileFormat)
{ {
@ -57,6 +58,23 @@ MediaWriter::MediaWriter(BDataIO* target, const media_file_format& fileFormat)
} }
MediaWriter::MediaWriter(BUrl* url, const media_file_format& fileFormat)
:
fTarget(NULL),
fWriter(NULL),
fStreamer(NULL),
fStreamInfos(),
fFileFormat(fileFormat)
{
CALLED();
if (gPluginManager.CreateStreamer(&fStreamer, url, &fTarget) != B_OK)
return;
gPluginManager.CreateWriter(&fWriter, fFileFormat, fTarget);
}
MediaWriter::~MediaWriter() MediaWriter::~MediaWriter()
{ {
CALLED(); CALLED();
@ -84,6 +102,13 @@ MediaWriter::InitCheck()
} }
BDataIO*
MediaWriter::Target() const
{
return fTarget;
}
void void
MediaWriter::GetFileFormatInfo(media_file_format* _fileFormat) const MediaWriter::GetFileFormatInfo(media_file_format* _fileFormat) const
{ {