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
@@ -274,6 +274,7 @@ bool format_is_acceptible(
break; break;
default: default:
fprintf(stderr,"format_is_acceptible : unimplemented type.\n"); fprintf(stderr,"format_is_acceptible : unimplemented type.\n");
return format_is_compatible(producer_format,consumer_format);
break; break;
} }
} }
@@ -741,21 +742,16 @@ status_t MediaReader::HandleDataStatus(
// static: // static:
flavor_info * MediaReader::GetFlavor(int32 id) void MediaReader::GetFlavor(flavor_info * info, int32 id)
{ {
fprintf(stderr,"MediaReader::GetFlavor\n"); fprintf(stderr,"MediaReader::GetFlavor\n");
static bool initialized = false; AbstractFileInterfaceNode::GetFlavor(info,id);
static flavor_info * info; info->name = "OpenBeOS Media Reader";
if (initialized == false) { info->info = "The OpenBeOS Media Reader reads a file and produces a multistream.";
info = AbstractFileInterfaceNode::GetFlavor(id); info->kinds |= B_BUFFER_PRODUCER;
info->name = "OpenBeOS Media Reader"; info->out_format_count = 1; // 1 output
info->info = "The OpenBeOS Media Reader reads a file and produces a multistream."; info->out_formats = GetFormat();
info->kinds |= B_BUFFER_PRODUCER; return;
info->out_format_count = 1; // 1 output
info->out_formats = GetFormat();
initialized = true;
}
return info;
} }
media_format * MediaReader::GetFormat() media_format * MediaReader::GetFormat()
@@ -184,26 +184,6 @@ virtual void LatencyChanged( // used to be Reserved 1
/* BControllable */ /* 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 */ /* BMediaEventLooper */
/*********************/ /*********************/
@@ -221,7 +201,7 @@ virtual status_t HandleDataStatus(
public: public:
static flavor_info * GetFlavor(int32 id); static void GetFlavor(flavor_info * info, int32 id);
static media_format * GetFormat(); static media_format * GetFormat();
static media_file_format * GetFileFormat(); static media_file_format * GetFileFormat();
@@ -58,7 +58,9 @@ status_t MediaReaderAddOn::GetFlavorAt(
fprintf(stderr,"<- B_BAD_INDEX\n"); fprintf(stderr,"<- B_BAD_INDEX\n");
return B_BAD_INDEX; 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; return B_OK;
} }
@@ -52,7 +52,6 @@ virtual status_t SniffTypeKind( // Like SniffType, but for the specific kind(
int32 * out_internal_id, int32 * out_internal_id,
void * _reserved); void * _reserved);
/* end from BMediaAddOn */ /* end from BMediaAddOn */
/************************/ /************************/