MediaExtractor: Adapt to new BUrl functionality
This commit is contained in:
@@ -10,7 +10,10 @@
|
|||||||
#define _MEDIA_EXTRACTOR_H
|
#define _MEDIA_EXTRACTOR_H
|
||||||
|
|
||||||
|
|
||||||
|
#include <Url.h>
|
||||||
|
|
||||||
#include "ReaderPlugin.h"
|
#include "ReaderPlugin.h"
|
||||||
|
#include "StreamerPlugin.h"
|
||||||
#include "DecoderPlugin.h"
|
#include "DecoderPlugin.h"
|
||||||
|
|
||||||
|
|
||||||
@@ -37,10 +40,14 @@ struct stream_info {
|
|||||||
class MediaExtractor {
|
class MediaExtractor {
|
||||||
public:
|
public:
|
||||||
MediaExtractor(BDataIO* source, int32 flags);
|
MediaExtractor(BDataIO* source, int32 flags);
|
||||||
|
MediaExtractor(BUrl* url, int32 flags);
|
||||||
|
|
||||||
~MediaExtractor();
|
~MediaExtractor();
|
||||||
|
|
||||||
status_t InitCheck();
|
status_t InitCheck();
|
||||||
|
|
||||||
|
BDataIO* Source() const;
|
||||||
|
|
||||||
void GetFileFormatInfo(
|
void GetFileFormatInfo(
|
||||||
media_file_format* fileFormat) const;
|
media_file_format* fileFormat) const;
|
||||||
status_t GetMetaData(BMessage* _data) const;
|
status_t GetMetaData(BMessage* _data) const;
|
||||||
@@ -70,6 +77,8 @@ public:
|
|||||||
BMessage* _data) const;
|
BMessage* _data) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void _Init(BDataIO* source, int32 flags);
|
||||||
|
|
||||||
void _RecycleLastChunk(stream_info& info);
|
void _RecycleLastChunk(stream_info& info);
|
||||||
static int32 _ExtractorEntry(void* arg);
|
static int32 _ExtractorEntry(void* arg);
|
||||||
void _ExtractorThread();
|
void _ExtractorThread();
|
||||||
@@ -82,6 +91,7 @@ private:
|
|||||||
|
|
||||||
BDataIO* fSource;
|
BDataIO* fSource;
|
||||||
Reader* fReader;
|
Reader* fReader;
|
||||||
|
Streamer* fStreamer;
|
||||||
|
|
||||||
stream_info* fStreamInfo;
|
stream_info* fStreamInfo;
|
||||||
int32 fStreamCount;
|
int32 fStreamCount;
|
||||||
|
|||||||
@@ -55,13 +55,39 @@ private:
|
|||||||
MediaExtractor::MediaExtractor(BDataIO* source, int32 flags)
|
MediaExtractor::MediaExtractor(BDataIO* source, int32 flags)
|
||||||
:
|
:
|
||||||
fExtractorThread(-1),
|
fExtractorThread(-1),
|
||||||
fSource(source),
|
|
||||||
fReader(NULL),
|
fReader(NULL),
|
||||||
|
fStreamer(NULL),
|
||||||
fStreamInfo(NULL),
|
fStreamInfo(NULL),
|
||||||
fStreamCount(0)
|
fStreamCount(0)
|
||||||
|
{
|
||||||
|
_Init(source, flags);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
MediaExtractor::MediaExtractor(BUrl* url, int32 flags)
|
||||||
|
:
|
||||||
|
fExtractorThread(-1),
|
||||||
|
fReader(NULL),
|
||||||
|
fStreamer(NULL),
|
||||||
|
fStreamInfo(NULL),
|
||||||
|
fStreamCount(0)
|
||||||
|
{
|
||||||
|
BDataIO* source = NULL;
|
||||||
|
fInitStatus = gPluginManager.CreateStreamer(&fStreamer, url, &source);
|
||||||
|
if (fInitStatus != B_OK)
|
||||||
|
return;
|
||||||
|
|
||||||
|
_Init(source, flags);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
MediaExtractor::_Init(BDataIO* source, int32 flags)
|
||||||
{
|
{
|
||||||
CALLED();
|
CALLED();
|
||||||
|
|
||||||
|
fSource = source;
|
||||||
|
|
||||||
#if !DISABLE_CHUNK_CACHE
|
#if !DISABLE_CHUNK_CACHE
|
||||||
// start extractor thread
|
// start extractor thread
|
||||||
fExtractorWaitSem = create_sem(1, "media extractor thread sem");
|
fExtractorWaitSem = create_sem(1, "media extractor thread sem");
|
||||||
@@ -171,6 +197,13 @@ MediaExtractor::InitCheck()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BDataIO*
|
||||||
|
MediaExtractor::Source() const
|
||||||
|
{
|
||||||
|
return fSource;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
MediaExtractor::GetFileFormatInfo(media_file_format* fileFormat) const
|
MediaExtractor::GetFileFormatInfo(media_file_format* fileFormat) const
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user