Fixed allocation problem and removed out-of-date parameter lines.

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@1053 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
shatty 2002-09-16 05:16:24 +00:00
parent a34a6d9c9f
commit ca6f35b121
4 changed files with 13 additions and 36 deletions

View File

@ -274,6 +274,7 @@ bool format_is_acceptible(
break;
default:
fprintf(stderr,"format_is_acceptible : unimplemented type.\n");
return format_is_compatible(producer_format,consumer_format);
break;
}
}
@ -741,21 +742,16 @@ status_t MediaReader::HandleDataStatus(
// static:
flavor_info * MediaReader::GetFlavor(int32 id)
void MediaReader::GetFlavor(flavor_info * info, int32 id)
{
fprintf(stderr,"MediaReader::GetFlavor\n");
static bool initialized = false;
static flavor_info * info;
if (initialized == false) {
info = AbstractFileInterfaceNode::GetFlavor(id);
info->name = "OpenBeOS Media Reader";
info->info = "The OpenBeOS Media Reader reads a file and produces a multistream.";
info->kinds |= B_BUFFER_PRODUCER;
info->out_format_count = 1; // 1 output
info->out_formats = GetFormat();
initialized = true;
}
return info;
AbstractFileInterfaceNode::GetFlavor(info,id);
info->name = "OpenBeOS Media Reader";
info->info = "The OpenBeOS Media Reader reads a file and produces a multistream.";
info->kinds |= B_BUFFER_PRODUCER;
info->out_format_count = 1; // 1 output
info->out_formats = GetFormat();
return;
}
media_format * MediaReader::GetFormat()

View File

@ -184,26 +184,6 @@ virtual void LatencyChanged( // used to be Reserved 1
/* BControllable */
/*****************/
public:
// these three are related:
// DEFAULT_CHUNK_SIZE = (DEFAULT_BIT_RATE * 1024) * (DEFAULT_BUFFER_PERIOD / 8000000)
static const int32 DEFAULT_CHUNK_SIZE_PARAM; // in bytes
static const int32 DEFAULT_BIT_RATE_PARAM; // in 1000*kilobits/sec
static const int32 DEFAULT_BUFFER_PERIOD_PARAM; // milliseconds
private:
size_t defaultChunkSizeParam;
bigtime_t defaultChunkSizeParamChangeTime;
float defaultBitRateParam;
bigtime_t defaultBitRateParamChangeTime;
int32 defaultBufferPeriodParam;
bigtime_t defaultBufferPeriodParamChangeTime;
// This is used to figure out which parameter to compute
// when enforcing the above constraint relating the three params
int32 lastUpdatedParameter;
int32 leastRecentlyUpdatedParameter;
/*********************/
/* BMediaEventLooper */
/*********************/
@ -221,7 +201,7 @@ virtual status_t HandleDataStatus(
public:
static flavor_info * GetFlavor(int32 id);
static void GetFlavor(flavor_info * info, int32 id);
static media_format * GetFormat();
static media_file_format * GetFileFormat();

View File

@ -58,7 +58,9 @@ status_t MediaReaderAddOn::GetFlavorAt(
fprintf(stderr,"<- B_BAD_INDEX\n");
return B_BAD_INDEX;
}
(*out_info) = MediaReader::GetFlavor(n);
flavor_info * infos = new flavor_info[1];
MediaReader::GetFlavor(&infos[0],n);
(*out_info) = infos;
return B_OK;
}

View File

@ -52,7 +52,6 @@ virtual status_t SniffTypeKind( // Like SniffType, but for the specific kind(
int32 * out_internal_id,
void * _reserved);
/* end from BMediaAddOn */
/************************/