uses abstract file interface node now
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@1050 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -3,6 +3,8 @@ SubDir OBOS_TOP src add-ons media media-add-ons reader ;
|
|||||||
UsePrivateHeaders media ;
|
UsePrivateHeaders media ;
|
||||||
|
|
||||||
Addon reader.media_addon : media :
|
Addon reader.media_addon : media :
|
||||||
|
../AbstractFileInterfaceNode.cpp
|
||||||
|
../AbstractFileInterfaceAddOn.cpp
|
||||||
MediaReader.cpp
|
MediaReader.cpp
|
||||||
MediaReaderAddOn.cpp
|
MediaReaderAddOn.cpp
|
||||||
;
|
;
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -23,11 +23,11 @@
|
|||||||
#include <Entry.h>
|
#include <Entry.h>
|
||||||
#include <BufferGroup.h>
|
#include <BufferGroup.h>
|
||||||
|
|
||||||
|
#include "../AbstractFileInterfaceNode.h"
|
||||||
|
|
||||||
class MediaReader :
|
class MediaReader :
|
||||||
public BFileInterface,
|
|
||||||
public BBufferProducer,
|
public BBufferProducer,
|
||||||
public BControllable,
|
public AbstractFileInterfaceNode
|
||||||
public BMediaEventLooper
|
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
virtual ~MediaReader(void);
|
virtual ~MediaReader(void);
|
||||||
@@ -41,43 +41,15 @@ explicit MediaReader(
|
|||||||
BMessage * config = 0,
|
BMessage * config = 0,
|
||||||
BMediaAddOn * addOn = 0);
|
BMediaAddOn * addOn = 0);
|
||||||
|
|
||||||
virtual status_t InitCheck(void) const;
|
|
||||||
|
|
||||||
// see BMediaAddOn::GetConfigurationFor
|
|
||||||
virtual status_t GetConfigurationFor(
|
|
||||||
BMessage * into_message);
|
|
||||||
|
|
||||||
/*************************/
|
/*************************/
|
||||||
/* begin from BMediaNode */
|
/* begin from BMediaNode */
|
||||||
public:
|
|
||||||
// /* this port is what a media node listens to for commands */
|
|
||||||
// virtual port_id ControlPort(void) const;
|
|
||||||
|
|
||||||
virtual BMediaAddOn* AddOn(
|
|
||||||
int32 * internal_id) const; /* Who instantiated you -- or NULL for app class */
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/* These don't return errors; instead, they use the global error condition reporter. */
|
/* These don't return errors; instead, they use the global error condition reporter. */
|
||||||
/* A node is required to have a queue of at least one pending command (plus TimeWarp) */
|
/* A node is required to have a queue of at least one pending command (plus TimeWarp) */
|
||||||
/* and is recommended to allow for at least one pending command of each type. */
|
/* and is recommended to allow for at least one pending command of each type. */
|
||||||
/* Allowing an arbitrary number of outstanding commands might be nice, but apps */
|
/* Allowing an arbitrary number of outstanding commands might be nice, but apps */
|
||||||
/* cannot depend on that happening. */
|
/* cannot depend on that happening. */
|
||||||
virtual void Start(
|
|
||||||
bigtime_t performance_time);
|
|
||||||
virtual void Stop(
|
|
||||||
bigtime_t performance_time,
|
|
||||||
bool immediate);
|
|
||||||
virtual void Seek(
|
|
||||||
bigtime_t media_time,
|
|
||||||
bigtime_t performance_time);
|
|
||||||
virtual void SetRunMode(
|
|
||||||
run_mode mode);
|
|
||||||
virtual void TimeWarp(
|
|
||||||
bigtime_t at_real_time,
|
|
||||||
bigtime_t to_performance_time);
|
|
||||||
virtual void Preroll(void);
|
virtual void Preroll(void);
|
||||||
virtual void SetTimeSource(
|
|
||||||
BTimeSource * time_source);
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
virtual status_t HandleMessage(
|
virtual status_t HandleMessage(
|
||||||
@@ -86,62 +58,18 @@ virtual status_t HandleMessage(
|
|||||||
size_t size);
|
size_t size);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/* Called when requests have completed, or failed. */
|
|
||||||
virtual status_t RequestCompleted( /* reserved 0 */
|
|
||||||
const media_request_info & info);
|
|
||||||
|
|
||||||
protected:
|
|
||||||
virtual status_t DeleteHook(BMediaNode * node); /* reserved 1 */
|
|
||||||
|
|
||||||
virtual void NodeRegistered(void); /* reserved 2 */
|
virtual void NodeRegistered(void); /* reserved 2 */
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
/* fill out your attributes in the provided array, returning however many you have. */
|
|
||||||
virtual status_t GetNodeAttributes( /* reserved 3 */
|
|
||||||
media_node_attribute * outAttributes,
|
|
||||||
size_t inMaxCount);
|
|
||||||
|
|
||||||
virtual status_t AddTimer(
|
|
||||||
bigtime_t at_performance_time,
|
|
||||||
int32 cookie);
|
|
||||||
|
|
||||||
/* end from BMediaNode */
|
/* end from BMediaNode */
|
||||||
/***********************/
|
/***********************/
|
||||||
|
|
||||||
protected:
|
|
||||||
virtual BParameterWeb * MakeParameterWeb(void);
|
|
||||||
|
|
||||||
/*****************************/
|
/*****************************/
|
||||||
/* begin from BFileInterface */
|
/* begin from BFileInterface */
|
||||||
protected:
|
protected:
|
||||||
//included from BMediaNode
|
|
||||||
//virtual status_t HandleMessage(
|
|
||||||
// int32 message,
|
|
||||||
// const void * data,
|
|
||||||
// size_t size);
|
|
||||||
|
|
||||||
virtual status_t GetNextFileFormat(
|
|
||||||
int32 * cookie,
|
|
||||||
media_file_format * out_format);
|
|
||||||
virtual void DisposeFileFormatCookie(
|
|
||||||
int32 cookie);
|
|
||||||
|
|
||||||
virtual status_t GetDuration(
|
|
||||||
bigtime_t * out_time);
|
|
||||||
|
|
||||||
virtual status_t SniffRef(
|
|
||||||
const entry_ref & file,
|
|
||||||
char * out_mime_type, /* 256 bytes */
|
|
||||||
float * out_quality);
|
|
||||||
|
|
||||||
virtual status_t SetRef(
|
virtual status_t SetRef(
|
||||||
const entry_ref & file,
|
const entry_ref & file,
|
||||||
bool create,
|
bool create,
|
||||||
bigtime_t * out_time);
|
bigtime_t * out_time);
|
||||||
virtual status_t GetRef(
|
|
||||||
entry_ref * out_ref,
|
|
||||||
char * out_mime_type);
|
|
||||||
|
|
||||||
/* end from BFileInterface */
|
/* end from BFileInterface */
|
||||||
/***************************/
|
/***************************/
|
||||||
@@ -252,32 +180,9 @@ virtual void LatencyChanged( // used to be Reserved 1
|
|||||||
/* end from BBufferProducer */
|
/* end from BBufferProducer */
|
||||||
/****************************/
|
/****************************/
|
||||||
|
|
||||||
/****************************/
|
/*****************/
|
||||||
/* begin from BControllable */
|
/* BControllable */
|
||||||
|
/*****************/
|
||||||
//included from BMediaNode
|
|
||||||
//virtual status_t HandleMessage(
|
|
||||||
// int32 message,
|
|
||||||
// const void * data,
|
|
||||||
// size_t size);
|
|
||||||
public:
|
|
||||||
/* These are alternate methods of accomplishing the same thing as */
|
|
||||||
/* connecting to control information source/destinations would. */
|
|
||||||
virtual status_t GetParameterValue(
|
|
||||||
int32 id,
|
|
||||||
bigtime_t * last_change,
|
|
||||||
void * value,
|
|
||||||
size_t * ioSize);
|
|
||||||
virtual void SetParameterValue(
|
|
||||||
int32 id,
|
|
||||||
bigtime_t when,
|
|
||||||
const void * value,
|
|
||||||
size_t size);
|
|
||||||
virtual status_t StartControlPanel(
|
|
||||||
BMessenger * out_messenger);
|
|
||||||
|
|
||||||
/* end from BControllable */
|
|
||||||
/**************************/
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// these three are related:
|
// these three are related:
|
||||||
@@ -291,7 +196,7 @@ private:
|
|||||||
bigtime_t defaultChunkSizeParamChangeTime;
|
bigtime_t defaultChunkSizeParamChangeTime;
|
||||||
float defaultBitRateParam;
|
float defaultBitRateParam;
|
||||||
bigtime_t defaultBitRateParamChangeTime;
|
bigtime_t defaultBitRateParamChangeTime;
|
||||||
bigtime_t defaultBufferPeriodParam;
|
int32 defaultBufferPeriodParam;
|
||||||
bigtime_t defaultBufferPeriodParamChangeTime;
|
bigtime_t defaultBufferPeriodParamChangeTime;
|
||||||
|
|
||||||
// This is used to figure out which parameter to compute
|
// This is used to figure out which parameter to compute
|
||||||
@@ -299,31 +204,9 @@ private:
|
|||||||
int32 lastUpdatedParameter;
|
int32 lastUpdatedParameter;
|
||||||
int32 leastRecentlyUpdatedParameter;
|
int32 leastRecentlyUpdatedParameter;
|
||||||
|
|
||||||
/********************************/
|
/*********************/
|
||||||
/* start from BMediaEventLooper */
|
/* BMediaEventLooper */
|
||||||
|
/*********************/
|
||||||
protected:
|
|
||||||
/* you must override to handle your events! */
|
|
||||||
/* you should not call HandleEvent directly */
|
|
||||||
virtual void HandleEvent( const media_timed_event *event,
|
|
||||||
bigtime_t lateness,
|
|
||||||
bool realTimeEvent = false);
|
|
||||||
|
|
||||||
/* override to clean up custom events you have added to your queue */
|
|
||||||
virtual void CleanUpEvent(const media_timed_event *event);
|
|
||||||
|
|
||||||
/* called from Offline mode to determine the current time of the node */
|
|
||||||
/* update your internal information whenever it changes */
|
|
||||||
virtual bigtime_t OfflineTime();
|
|
||||||
|
|
||||||
/* override only if you know what you are doing! */
|
|
||||||
/* otherwise much badness could occur */
|
|
||||||
/* the actual control loop function: */
|
|
||||||
/* waits for messages, Pops events off the queue and calls DispatchEvent */
|
|
||||||
virtual void ControlLoop();
|
|
||||||
|
|
||||||
/* end from BMediaEventLooper */
|
|
||||||
/******************************/
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
@@ -331,22 +214,19 @@ virtual status_t HandleBuffer(
|
|||||||
const media_timed_event *event,
|
const media_timed_event *event,
|
||||||
bigtime_t lateness,
|
bigtime_t lateness,
|
||||||
bool realTimeEvent = false);
|
bool realTimeEvent = false);
|
||||||
|
virtual status_t HandleDataStatus(
|
||||||
virtual status_t HandleParameter(
|
|
||||||
const media_timed_event *event,
|
const media_timed_event *event,
|
||||||
bigtime_t lateness,
|
bigtime_t lateness,
|
||||||
bool realTimeEvent = false);
|
bool realTimeEvent = false);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
static status_t GetFlavor(int32 id, const flavor_info ** out_info);
|
static flavor_info * GetFlavor(int32 id);
|
||||||
static media_format & GetFormat();
|
static media_format * GetFormat();
|
||||||
static media_file_format & GetFileFormat();
|
static media_file_format * GetFileFormat();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
virtual status_t ResetFormat(media_format * format);
|
|
||||||
virtual status_t ResolveWildcards(media_multistream_format * multistream_format);
|
|
||||||
virtual status_t GetFilledBuffer(BBuffer ** outBuffer);
|
virtual status_t GetFilledBuffer(BBuffer ** outBuffer);
|
||||||
virtual status_t FillFileBuffer(BBuffer * buffer);
|
virtual status_t FillFileBuffer(BBuffer * buffer);
|
||||||
|
|
||||||
@@ -357,25 +237,16 @@ private:
|
|||||||
MediaReader & operator=(
|
MediaReader & operator=(
|
||||||
const MediaReader & clone);
|
const MediaReader & clone);
|
||||||
|
|
||||||
status_t initCheckStatus;
|
|
||||||
|
|
||||||
BMediaAddOn * mediaReaderAddOn;
|
|
||||||
media_output output;
|
media_output output;
|
||||||
|
|
||||||
BFile * inputFile;
|
bool fOutputEnabled;
|
||||||
entry_ref input_ref;
|
|
||||||
char input_mime_type[B_MIME_TYPE_LENGTH+1];
|
BBufferGroup * fBufferGroup;
|
||||||
|
bigtime_t fDownstreamLatency;
|
||||||
BBufferGroup * bufferGroup;
|
bigtime_t fInternalLatency;
|
||||||
|
|
||||||
bigtime_t downstreamLatency;
|
|
||||||
bigtime_t internalLatency;
|
|
||||||
|
|
||||||
bool outputEnabled;
|
|
||||||
|
|
||||||
// this is computed from the real (negotiated) chunk size and bit rate,
|
// this is computed from the real (negotiated) chunk size and bit rate,
|
||||||
// not the defaults that are in the parameters
|
// not the defaults that are in the parameters
|
||||||
bigtime_t bufferPeriod;
|
bigtime_t fBufferPeriod;
|
||||||
|
|
||||||
/* Mmmh, stuffing! */
|
/* Mmmh, stuffing! */
|
||||||
virtual status_t _Reserved_MediaReader_0(void *);
|
virtual status_t _Reserved_MediaReader_0(void *);
|
||||||
|
|||||||
@@ -36,29 +36,15 @@ MediaReaderAddOn::~MediaReaderAddOn()
|
|||||||
}
|
}
|
||||||
|
|
||||||
MediaReaderAddOn::MediaReaderAddOn(image_id image) :
|
MediaReaderAddOn::MediaReaderAddOn(image_id image) :
|
||||||
BMediaAddOn(image)
|
AbstractFileInterfaceAddOn(image)
|
||||||
{
|
{
|
||||||
fprintf(stderr,"MediaReaderAddOn::MediaReaderAddOn\n");
|
fprintf(stderr,"MediaReaderAddOn::MediaReaderAddOn\n");
|
||||||
refCount = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// -------------------------------------------------------- //
|
// -------------------------------------------------------- //
|
||||||
// BMediaAddOn impl
|
// BMediaAddOn impl
|
||||||
// -------------------------------------------------------- //
|
// -------------------------------------------------------- //
|
||||||
|
|
||||||
status_t MediaReaderAddOn::InitCheck(
|
|
||||||
const char ** out_failure_text)
|
|
||||||
{
|
|
||||||
fprintf(stderr,"MediaReaderAddOn::InitCheck\n");
|
|
||||||
return B_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
int32 MediaReaderAddOn::CountFlavors()
|
|
||||||
{
|
|
||||||
fprintf(stderr,"MediaReaderAddOn::CountFlavors\n");
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
status_t MediaReaderAddOn::GetFlavorAt(
|
status_t MediaReaderAddOn::GetFlavorAt(
|
||||||
int32 n,
|
int32 n,
|
||||||
const flavor_info ** out_info)
|
const flavor_info ** out_info)
|
||||||
@@ -72,7 +58,8 @@ status_t MediaReaderAddOn::GetFlavorAt(
|
|||||||
fprintf(stderr,"<- B_BAD_INDEX\n");
|
fprintf(stderr,"<- B_BAD_INDEX\n");
|
||||||
return B_BAD_INDEX;
|
return B_BAD_INDEX;
|
||||||
}
|
}
|
||||||
return MediaReader::GetFlavor(n,out_info);
|
(*out_info) = MediaReader::GetFlavor(n);
|
||||||
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
BMediaNode * MediaReaderAddOn::InstantiateNodeFor(
|
BMediaNode * MediaReaderAddOn::InstantiateNodeFor(
|
||||||
@@ -87,9 +74,10 @@ BMediaNode * MediaReaderAddOn::InstantiateNodeFor(
|
|||||||
}
|
}
|
||||||
size_t defaultChunkSize = size_t(8192); // XXX: read from add-on's attributes
|
size_t defaultChunkSize = size_t(8192); // XXX: read from add-on's attributes
|
||||||
float defaultBitRate = 800000;
|
float defaultBitRate = 800000;
|
||||||
MediaReader * node = new MediaReader(defaultChunkSize,
|
MediaReader * node
|
||||||
defaultBitRate,
|
= new MediaReader(defaultChunkSize,
|
||||||
info,config,this);
|
defaultBitRate,
|
||||||
|
info,config,this);
|
||||||
if (node == 0) {
|
if (node == 0) {
|
||||||
*out_error = B_NO_MEMORY;
|
*out_error = B_NO_MEMORY;
|
||||||
fprintf(stderr,"<- B_NO_MEMORY\n");
|
fprintf(stderr,"<- B_NO_MEMORY\n");
|
||||||
@@ -108,7 +96,8 @@ status_t MediaReaderAddOn::GetConfigurationFor(
|
|||||||
fprintf(stderr,"<- B_BAD_VALUE\n");
|
fprintf(stderr,"<- B_BAD_VALUE\n");
|
||||||
return B_BAD_VALUE; // we refuse to crash because you were stupid
|
return B_BAD_VALUE; // we refuse to crash because you were stupid
|
||||||
}
|
}
|
||||||
MediaReader * node = dynamic_cast<MediaReader*>(your_node);
|
MediaReader * node
|
||||||
|
= dynamic_cast<MediaReader*>(your_node);
|
||||||
if (node == 0) {
|
if (node == 0) {
|
||||||
fprintf(stderr,"<- B_BAD_TYPE\n");
|
fprintf(stderr,"<- B_BAD_TYPE\n");
|
||||||
return B_BAD_TYPE;
|
return B_BAD_TYPE;
|
||||||
@@ -116,66 +105,18 @@ status_t MediaReaderAddOn::GetConfigurationFor(
|
|||||||
return node->GetConfigurationFor(into_message);
|
return node->GetConfigurationFor(into_message);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MediaReaderAddOn::WantsAutoStart()
|
|
||||||
{
|
|
||||||
fprintf(stderr,"MediaReaderAddOn::WantsAutoStart\n");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
status_t MediaReaderAddOn::AutoStart(
|
|
||||||
int in_count,
|
|
||||||
BMediaNode ** out_node,
|
|
||||||
int32 * out_internal_id,
|
|
||||||
bool * out_has_more)
|
|
||||||
{
|
|
||||||
fprintf(stderr,"MediaReaderAddOn::AutoStart\n");
|
|
||||||
return B_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
// -------------------------------------------------------- //
|
// -------------------------------------------------------- //
|
||||||
// BMediaAddOn impl for B_FILE_INTERFACE nodes
|
// BMediaAddOn impl for B_FILE_INTERFACE nodes
|
||||||
// -------------------------------------------------------- //
|
// -------------------------------------------------------- //
|
||||||
|
|
||||||
status_t MediaReaderAddOn::SniffRef(
|
|
||||||
const entry_ref & file,
|
|
||||||
BMimeType * io_mime_type,
|
|
||||||
float * out_quality,
|
|
||||||
int32 * out_internal_id)
|
|
||||||
{
|
|
||||||
fprintf(stderr,"MediaReaderAddOn::SniffRef\n");
|
|
||||||
if ((io_mime_type == 0) || (out_quality == 0) || (out_internal_id == 0)) {
|
|
||||||
fprintf(stderr,"<- B_BAD_VALUE\n");
|
|
||||||
return B_BAD_VALUE; // we refuse to crash because you were stupid
|
|
||||||
}
|
|
||||||
*out_internal_id = 0; // only one flavor
|
|
||||||
char mime_string[B_MIME_TYPE_LENGTH+1];
|
|
||||||
status_t status = MediaReader::StaticSniffRef(file,mime_string,out_quality);
|
|
||||||
io_mime_type->SetTo(mime_string);
|
|
||||||
return status;
|
|
||||||
}
|
|
||||||
|
|
||||||
// even though I implemented SniffTypeKind below and this shouldn't get called,
|
|
||||||
// I am going to implement it anyway. I'll use it later anyhow.
|
|
||||||
status_t MediaReaderAddOn::SniffType(
|
|
||||||
const BMimeType & type,
|
|
||||||
float * out_quality,
|
|
||||||
int32 * out_internal_id)
|
|
||||||
{
|
|
||||||
fprintf(stderr,"MediaReaderAddOn::SniffType\n");
|
|
||||||
if ((out_quality == 0) || (out_internal_id == 0)) {
|
|
||||||
fprintf(stderr,"<- B_BAD_VALUE\n");
|
|
||||||
return B_BAD_VALUE; // we refuse to crash because you were stupid
|
|
||||||
}
|
|
||||||
*out_quality = 1.0;
|
|
||||||
*out_internal_id = 0;
|
|
||||||
return B_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
// This function treats null pointers slightly differently than the others.
|
// This function treats null pointers slightly differently than the others.
|
||||||
// This is because a program could reasonably call this function with just
|
// This is because a program could reasonably call this function with just
|
||||||
// about any junk, get the out_read_items and then use that to create an
|
// about any junk, get the out_read_items or out_write_items and then use
|
||||||
// array of sufficient size to hold the result, and then recall. Also, a
|
// that to create an array of sufficient size to hold the result, and then
|
||||||
// stupid program could not supply an out_read_items, but actually supply
|
// call us again. So we won't punish them if they supply us with null
|
||||||
|
// pointers the first time around.
|
||||||
|
//
|
||||||
|
// A stupid program might not supply an out_read_items, but actually supply
|
||||||
// an out_readable_formats and then try to do something useful with it. As
|
// an out_readable_formats and then try to do something useful with it. As
|
||||||
// an extreme gesture of nicety we will fill the out_readable_formats with
|
// an extreme gesture of nicety we will fill the out_readable_formats with
|
||||||
// a valid entry, although they could easily read into garbage after that...
|
// a valid entry, although they could easily read into garbage after that...
|
||||||
@@ -198,16 +139,15 @@ status_t MediaReaderAddOn::GetFileFormatList(
|
|||||||
// see null check comment above
|
// see null check comment above
|
||||||
if (out_write_items != 0) {
|
if (out_write_items != 0) {
|
||||||
*out_write_items = 0;
|
*out_write_items = 0;
|
||||||
}
|
}
|
||||||
// see null check comment above
|
// see null check comment above
|
||||||
if (out_read_items != 0) {
|
if (out_read_items != 0) {
|
||||||
*out_read_items = 1;
|
*out_read_items = 1;
|
||||||
}
|
}
|
||||||
// see null check comment above
|
|
||||||
if (out_readable_formats != 0) {
|
if (out_readable_formats != 0) {
|
||||||
// don't go off the end
|
// don't go off the end
|
||||||
if (in_read_items > 0) {
|
if (in_read_items > 0) {
|
||||||
out_readable_formats[0] = MediaReader::GetFileFormat();
|
out_readable_formats[0] = *MediaReader::GetFileFormat();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return B_OK;
|
return B_OK;
|
||||||
@@ -221,20 +161,10 @@ status_t MediaReaderAddOn::SniffTypeKind(
|
|||||||
void * _reserved)
|
void * _reserved)
|
||||||
{
|
{
|
||||||
fprintf(stderr,"MediaReaderAddOn::SniffTypeKind\n");
|
fprintf(stderr,"MediaReaderAddOn::SniffTypeKind\n");
|
||||||
if ((out_quality == 0) || (out_internal_id == 0)) {
|
return AbstractFileInterfaceAddOn::SniffTypeKind(type,in_kinds,
|
||||||
fprintf(stderr,"<- B_BAD_VALUE\n");
|
B_BUFFER_PRODUCER,
|
||||||
return B_BAD_VALUE; // we refuse to crash because you were stupid
|
out_quality,out_internal_id,
|
||||||
}
|
_reserved);
|
||||||
if (in_kinds & (B_BUFFER_PRODUCER | B_FILE_INTERFACE | B_CONTROLLABLE)) {
|
|
||||||
return SniffType(type,out_quality,out_internal_id);
|
|
||||||
} else {
|
|
||||||
// They asked for some kind we don't supply. We set the output
|
|
||||||
// just in case they try to do something with it anyway (!)
|
|
||||||
*out_quality = 0;
|
|
||||||
*out_internal_id = -1;
|
|
||||||
fprintf(stderr,"<- B_BAD_TYPE\n");
|
|
||||||
return B_BAD_TYPE;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// -------------------------------------------------------- //
|
// -------------------------------------------------------- //
|
||||||
|
|||||||
@@ -12,9 +12,10 @@
|
|||||||
|
|
||||||
#include <MediaDefs.h>
|
#include <MediaDefs.h>
|
||||||
#include <MediaAddOn.h>
|
#include <MediaAddOn.h>
|
||||||
|
#include "../AbstractFileInterfaceAddOn.h"
|
||||||
|
|
||||||
class MediaReaderAddOn :
|
class MediaReaderAddOn :
|
||||||
public BMediaAddOn
|
public AbstractFileInterfaceAddOn
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual ~MediaReaderAddOn(void);
|
virtual ~MediaReaderAddOn(void);
|
||||||
@@ -23,9 +24,6 @@ public:
|
|||||||
/**************************/
|
/**************************/
|
||||||
/* begin from BMediaAddOn */
|
/* begin from BMediaAddOn */
|
||||||
public:
|
public:
|
||||||
virtual status_t InitCheck(
|
|
||||||
const char ** out_failure_text);
|
|
||||||
virtual int32 CountFlavors(void);
|
|
||||||
virtual status_t GetFlavorAt(
|
virtual status_t GetFlavorAt(
|
||||||
int32 n,
|
int32 n,
|
||||||
const flavor_info ** out_info);
|
const flavor_info ** out_info);
|
||||||
@@ -36,23 +34,8 @@ virtual BMediaNode * InstantiateNodeFor(
|
|||||||
virtual status_t GetConfigurationFor(
|
virtual status_t GetConfigurationFor(
|
||||||
BMediaNode * your_node,
|
BMediaNode * your_node,
|
||||||
BMessage * into_message);
|
BMessage * into_message);
|
||||||
virtual bool WantsAutoStart(void);
|
|
||||||
virtual status_t AutoStart(
|
|
||||||
int in_count,
|
|
||||||
BMediaNode ** out_node,
|
|
||||||
int32 * out_internal_id,
|
|
||||||
bool * out_has_more);
|
|
||||||
|
|
||||||
/* only implement if you have a B_FILE_INTERFACE node */
|
/* only implement if you have a B_FILE_INTERFACE node */
|
||||||
virtual status_t SniffRef(
|
|
||||||
const entry_ref & file,
|
|
||||||
BMimeType * io_mime_type,
|
|
||||||
float * out_quality,
|
|
||||||
int32 * out_internal_id);
|
|
||||||
virtual status_t SniffType( // This is broken if you deal with producers
|
|
||||||
const BMimeType & type, // and consumers both. Use SniffTypeKind instead.
|
|
||||||
float * out_quality, // If you implement SniffTypeKind, this doesn't
|
|
||||||
int32 * out_internal_id); // get called.
|
|
||||||
virtual status_t GetFileFormatList(
|
virtual status_t GetFileFormatList(
|
||||||
int32 flavor_id, // for this node flavor (if it matters)
|
int32 flavor_id, // for this node flavor (if it matters)
|
||||||
media_file_format * out_writable_formats, // don't write here if NULL
|
media_file_format * out_writable_formats, // don't write here if NULL
|
||||||
@@ -80,8 +63,6 @@ private:
|
|||||||
MediaReaderAddOn & operator=(
|
MediaReaderAddOn & operator=(
|
||||||
const MediaReaderAddOn & clone);
|
const MediaReaderAddOn & clone);
|
||||||
|
|
||||||
int32 refCount;
|
|
||||||
|
|
||||||
/* Mmmh, stuffing! */
|
/* Mmmh, stuffing! */
|
||||||
virtual status_t _Reserved_MediaReaderAddOn_0(void *);
|
virtual status_t _Reserved_MediaReaderAddOn_0(void *);
|
||||||
virtual status_t _Reserved_MediaReaderAddOn_1(void *);
|
virtual status_t _Reserved_MediaReaderAddOn_1(void *);
|
||||||
|
|||||||
Reference in New Issue
Block a user