changed allocation scheme
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@1064 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -297,7 +297,7 @@ status_t AbstractFileInterfaceNode::GetNextFileFormat(
|
|||||||
// so next time they won't get the same format again
|
// so next time they won't get the same format again
|
||||||
*cookie = 1;
|
*cookie = 1;
|
||||||
}
|
}
|
||||||
*out_format = *GetFileFormat();
|
GetFileFormat(out_format);
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -822,6 +822,9 @@ status_t AbstractFileInterfaceNode::HandleParameter(
|
|||||||
void AbstractFileInterfaceNode::GetFlavor(flavor_info * info, int32 id)
|
void AbstractFileInterfaceNode::GetFlavor(flavor_info * info, int32 id)
|
||||||
{
|
{
|
||||||
fprintf(stderr,"AbstractFileInterfaceNode::GetFlavor\n");
|
fprintf(stderr,"AbstractFileInterfaceNode::GetFlavor\n");
|
||||||
|
if (info == 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
info->name = "AbstractFileInterfaceNode";
|
info->name = "AbstractFileInterfaceNode";
|
||||||
info->info = "A AbstractFileInterfaceNode node handles a file.";
|
info->info = "A AbstractFileInterfaceNode node handles a file.";
|
||||||
info->kinds = B_FILE_INTERFACE | B_CONTROLLABLE;
|
info->kinds = B_FILE_INTERFACE | B_CONTROLLABLE;
|
||||||
@@ -835,42 +838,41 @@ void AbstractFileInterfaceNode::GetFlavor(flavor_info * info, int32 id)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
media_format * AbstractFileInterfaceNode::GetFormat()
|
void AbstractFileInterfaceNode::GetFormat(media_format * outFormat)
|
||||||
{
|
{
|
||||||
fprintf(stderr,"AbstractFileInterfaceNode::GetFormat\n");
|
fprintf(stderr,"AbstractFileInterfaceNode::GetFormat\n");
|
||||||
static bool initialized = false;
|
if (outFormat == 0) {
|
||||||
static media_format format;
|
return;
|
||||||
if (initialized == false) {
|
|
||||||
format.type = B_MEDIA_MULTISTREAM;
|
|
||||||
format.require_flags = B_MEDIA_MAUI_UNDEFINED_FLAGS;
|
|
||||||
format.deny_flags = B_MEDIA_MAUI_UNDEFINED_FLAGS;
|
|
||||||
format.u.multistream = media_multistream_format::wildcard;
|
|
||||||
initialized = true;
|
|
||||||
}
|
}
|
||||||
return &format;
|
outFormat->type = B_MEDIA_MULTISTREAM;
|
||||||
|
outFormat->require_flags = B_MEDIA_MAUI_UNDEFINED_FLAGS;
|
||||||
|
outFormat->deny_flags = B_MEDIA_MAUI_UNDEFINED_FLAGS;
|
||||||
|
outFormat->u.multistream = media_multistream_format::wildcard;
|
||||||
}
|
}
|
||||||
|
|
||||||
media_file_format * AbstractFileInterfaceNode::GetFileFormat()
|
void AbstractFileInterfaceNode::GetFileFormat(media_file_format * outFileFormat)
|
||||||
{
|
{
|
||||||
fprintf(stderr,"AbstractFileInterfaceNode::GetFileFormat\n");
|
fprintf(stderr,"AbstractFileInterfaceNode::GetFileFormat\n");
|
||||||
static bool initialized = false;
|
if (outFileFormat == 0) {
|
||||||
static media_file_format file_format;
|
return;
|
||||||
if (initialized == false) {
|
|
||||||
file_format.capabilities =
|
|
||||||
media_file_format::B_PERFECTLY_SEEKABLE
|
|
||||||
| media_file_format::B_IMPERFECTLY_SEEKABLE
|
|
||||||
| media_file_format::B_KNOWS_ANYTHING;
|
|
||||||
/* I don't know what to initialize this to. (or if I should) */
|
|
||||||
// format.id =
|
|
||||||
file_format.family = B_ANY_FORMAT_FAMILY;
|
|
||||||
file_format.version = 100;
|
|
||||||
strcpy(file_format.mime_type,"");
|
|
||||||
strcpy(file_format.pretty_name,"any media file format");
|
|
||||||
strcpy(file_format.short_name,"any");
|
|
||||||
strcpy(file_format.file_extension,"");
|
|
||||||
initialized = true;
|
|
||||||
}
|
}
|
||||||
return &file_format;
|
outFileFormat->capabilities =
|
||||||
|
media_file_format::B_PERFECTLY_SEEKABLE
|
||||||
|
| media_file_format::B_IMPERFECTLY_SEEKABLE
|
||||||
|
| media_file_format::B_KNOWS_ANYTHING;
|
||||||
|
/* I don't know what to initialize this to. (or if I should) */
|
||||||
|
// format.id =
|
||||||
|
outFileFormat->family = B_ANY_FORMAT_FAMILY;
|
||||||
|
outFileFormat->version = 100;
|
||||||
|
// see media_file_format in <MediaDefs.h> for limits
|
||||||
|
strncpy(outFileFormat->mime_type,"",63);
|
||||||
|
outFileFormat->mime_type[63]='\0';
|
||||||
|
strncpy(outFileFormat->pretty_name,"any media file format",63);
|
||||||
|
outFileFormat->pretty_name[63]='\0';
|
||||||
|
strncpy(outFileFormat->short_name,"any",31);
|
||||||
|
outFileFormat->short_name[31]='\0';
|
||||||
|
strncpy(outFileFormat->file_extension,"",7);
|
||||||
|
outFileFormat->file_extension[7]='\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
// protected:
|
// protected:
|
||||||
|
|||||||
@@ -260,9 +260,9 @@ virtual status_t HandleParameter(
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
static void GetFlavor(flavor_info * info, int32 id);
|
static void GetFlavor(flavor_info * outInfo, int32 id);
|
||||||
static media_format * GetFormat();
|
static void GetFormat(media_format * outFormat);
|
||||||
static media_file_format * GetFileFormat();
|
static void GetFileFormat(media_file_format * outFileFormat);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ MediaReader::MediaReader(
|
|||||||
output.node = media_node::null; // until registration
|
output.node = media_node::null; // until registration
|
||||||
output.source = media_source::null; // until registration
|
output.source = media_source::null; // until registration
|
||||||
output.destination = media_destination::null;
|
output.destination = media_destination::null;
|
||||||
output.format = *GetFormat();
|
GetFormat(&output.format);
|
||||||
}
|
}
|
||||||
|
|
||||||
// -------------------------------------------------------- //
|
// -------------------------------------------------------- //
|
||||||
@@ -130,7 +130,7 @@ status_t MediaReader::SetRef(
|
|||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
// reset the format, and set the requirements imposed by this file
|
// reset the format, and set the requirements imposed by this file
|
||||||
output.format = *GetFormat();
|
GetFormat(&output.format);
|
||||||
AddRequirements(&output.format);
|
AddRequirements(&output.format);
|
||||||
// if we are connected we have to re-negotiate the connection
|
// if we are connected we have to re-negotiate the connection
|
||||||
if (output.destination != media_destination::null) {
|
if (output.destination != media_destination::null) {
|
||||||
@@ -161,7 +161,7 @@ status_t MediaReader::FormatSuggestionRequested(
|
|||||||
fprintf(stderr,"<- B_MEDIA_BAD_FORMAT\n");
|
fprintf(stderr,"<- B_MEDIA_BAD_FORMAT\n");
|
||||||
return B_MEDIA_BAD_FORMAT;
|
return B_MEDIA_BAD_FORMAT;
|
||||||
}
|
}
|
||||||
*format = *GetFormat();
|
GetFormat(format);
|
||||||
AddRequirements(format);
|
AddRequirements(format);
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
@@ -308,7 +308,9 @@ status_t MediaReader::FormatProposal(
|
|||||||
fprintf(stderr,"\n"); */
|
fprintf(stderr,"\n"); */
|
||||||
// Be's format_is_compatible doesn't work.
|
// Be's format_is_compatible doesn't work.
|
||||||
// if (!format_is_compatible(*format,*myFormat)) {
|
// if (!format_is_compatible(*format,*myFormat)) {
|
||||||
if (!format_is_acceptible(*format,*GetFormat())) {
|
media_format myFormat;
|
||||||
|
GetFormat(&myFormat);
|
||||||
|
if (!format_is_acceptible(*format,myFormat)) {
|
||||||
fprintf(stderr,"<- B_MEDIA_BAD_FORMAT\n");
|
fprintf(stderr,"<- B_MEDIA_BAD_FORMAT\n");
|
||||||
return B_MEDIA_BAD_FORMAT;
|
return B_MEDIA_BAD_FORMAT;
|
||||||
}
|
}
|
||||||
@@ -338,7 +340,7 @@ status_t MediaReader::FormatChangeRequested(
|
|||||||
status_t status = FormatProposal(source,io_format);
|
status_t status = FormatProposal(source,io_format);
|
||||||
if (status != B_OK) {
|
if (status != B_OK) {
|
||||||
fprintf(stderr," error returned by FormatProposal\n");
|
fprintf(stderr," error returned by FormatProposal\n");
|
||||||
*io_format = *GetFormat();
|
GetFormat(io_format);
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
return ResolveWildcards(io_format);
|
return ResolveWildcards(io_format);
|
||||||
@@ -503,13 +505,13 @@ void MediaReader::Connect(
|
|||||||
if (error != B_OK) {
|
if (error != B_OK) {
|
||||||
fprintf(stderr,"<- error already\n");
|
fprintf(stderr,"<- error already\n");
|
||||||
output.destination = media_destination::null;
|
output.destination = media_destination::null;
|
||||||
output.format = *GetFormat();
|
GetFormat(&output.format);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (output.source != source) {
|
if (output.source != source) {
|
||||||
fprintf(stderr,"<- B_MEDIA_BAD_SOURCE\n");
|
fprintf(stderr,"<- B_MEDIA_BAD_SOURCE\n");
|
||||||
output.destination = media_destination::null;
|
output.destination = media_destination::null;
|
||||||
output.format = *GetFormat();
|
GetFormat(&output.format);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -534,7 +536,7 @@ void MediaReader::Connect(
|
|||||||
if (status != B_OK) {
|
if (status != B_OK) {
|
||||||
fprintf(stderr,"<- SetBufferGroup failed\n");
|
fprintf(stderr,"<- SetBufferGroup failed\n");
|
||||||
output.destination = media_destination::null;
|
output.destination = media_destination::null;
|
||||||
output.format = *GetFormat();
|
GetFormat(&output.format);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -591,7 +593,7 @@ void MediaReader::Disconnect(
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
output.destination = media_destination::null;
|
output.destination = media_destination::null;
|
||||||
output.format = *GetFormat();
|
GetFormat(&output.format);
|
||||||
if (fBufferGroup != 0) {
|
if (fBufferGroup != 0) {
|
||||||
BBufferGroup * group = fBufferGroup;
|
BBufferGroup * group = fBufferGroup;
|
||||||
fBufferGroup = 0;
|
fBufferGroup = 0;
|
||||||
@@ -743,35 +745,42 @@ status_t MediaReader::HandleDataStatus(
|
|||||||
|
|
||||||
// static:
|
// static:
|
||||||
|
|
||||||
void MediaReader::GetFlavor(flavor_info * info, int32 id)
|
void MediaReader::GetFlavor(flavor_info * outInfo, int32 id)
|
||||||
{
|
{
|
||||||
fprintf(stderr,"MediaReader::GetFlavor\n");
|
fprintf(stderr,"MediaReader::GetFlavor\n");
|
||||||
AbstractFileInterfaceNode::GetFlavor(info,id);
|
if (outInfo == 0) {
|
||||||
info->name = "OpenBeOS Media Reader";
|
return;
|
||||||
info->info = "The OpenBeOS Media Reader reads a file and produces a multistream.";
|
}
|
||||||
info->kinds |= B_BUFFER_PRODUCER;
|
AbstractFileInterfaceNode::GetFlavor(outInfo,id);
|
||||||
info->out_format_count = 1; // 1 output
|
outInfo->name = "OpenBeOS Media Reader";
|
||||||
info->out_formats = GetFormat();
|
outInfo->info = "The OpenBeOS Media Reader reads a file and produces a multistream.";
|
||||||
|
outInfo->kinds |= B_BUFFER_PRODUCER;
|
||||||
|
outInfo->out_format_count = 1; // 1 output
|
||||||
|
media_format * formats = new media_format[outInfo->out_format_count];
|
||||||
|
GetFormat(&formats[0]);
|
||||||
|
outInfo->out_formats = formats;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
media_format * MediaReader::GetFormat()
|
void MediaReader::GetFormat(media_format * outFormat)
|
||||||
{
|
{
|
||||||
fprintf(stderr,"MediaReader::GetFormat\n");
|
fprintf(stderr,"MediaReader::GetFormat\n");
|
||||||
return AbstractFileInterfaceNode::GetFormat();
|
if (outFormat == 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
AbstractFileInterfaceNode::GetFormat(outFormat);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
media_file_format * MediaReader::GetFileFormat()
|
void MediaReader::GetFileFormat(media_file_format * outFileFormat)
|
||||||
{
|
{
|
||||||
fprintf(stderr,"MediaReader::GetFileFormat\n");
|
fprintf(stderr,"MediaReader::GetFileFormat\n");
|
||||||
static bool initialized = false;
|
if (outFileFormat == 0) {
|
||||||
static media_file_format * file_format;
|
return;
|
||||||
if (initialized == false) {
|
|
||||||
file_format = AbstractFileInterfaceNode::GetFileFormat();
|
|
||||||
file_format->capabilities |= media_file_format::B_READABLE;
|
|
||||||
initialized = true;
|
|
||||||
}
|
}
|
||||||
return file_format;
|
AbstractFileInterfaceNode::GetFileFormat(outFileFormat);
|
||||||
|
outFileFormat->capabilities |= media_file_format::B_READABLE;
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// protected:
|
// protected:
|
||||||
|
|||||||
@@ -201,9 +201,9 @@ virtual status_t HandleDataStatus(
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
static void GetFlavor(flavor_info * info, int32 id);
|
static void GetFlavor(flavor_info * outInfo, int32 id);
|
||||||
static media_format * GetFormat();
|
static void GetFormat(media_format * outFormat);
|
||||||
static media_file_format * GetFileFormat();
|
static void GetFileFormat(media_file_format * outFileFormat);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
|||||||
@@ -149,7 +149,7 @@ status_t MediaReaderAddOn::GetFileFormatList(
|
|||||||
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();
|
MediaReader::GetFileFormat(&out_readable_formats[0]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return B_OK;
|
return B_OK;
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ MediaWriter::MediaWriter(
|
|||||||
input.node = media_node::null; // until registration
|
input.node = media_node::null; // until registration
|
||||||
input.source = media_source::null;
|
input.source = media_source::null;
|
||||||
input.destination = media_destination::null; // until registration
|
input.destination = media_destination::null; // until registration
|
||||||
input.format = *GetFormat();
|
GetFormat(&input.format);
|
||||||
}
|
}
|
||||||
|
|
||||||
// -------------------------------------------------------- //
|
// -------------------------------------------------------- //
|
||||||
@@ -130,7 +130,7 @@ status_t MediaWriter::SetRef(
|
|||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
// reset the format, and set the requirements imposed by this file
|
// reset the format, and set the requirements imposed by this file
|
||||||
input.format = *GetFormat();
|
GetFormat(&input.format);
|
||||||
AddRequirements(&input.format);
|
AddRequirements(&input.format);
|
||||||
// if we are connected we have to re-negotiate the connection
|
// if we are connected we have to re-negotiate the connection
|
||||||
if (input.source != media_source::null) {
|
if (input.source != media_source::null) {
|
||||||
@@ -285,7 +285,9 @@ status_t MediaWriter::AcceptFormat(
|
|||||||
fprintf(stderr,"\n");*/
|
fprintf(stderr,"\n");*/
|
||||||
// Be's format_is_compatible doesn't work.
|
// Be's format_is_compatible doesn't work.
|
||||||
// if (!format_is_compatible(*format,*myFormat)) {
|
// if (!format_is_compatible(*format,*myFormat)) {
|
||||||
if (!format_is_acceptible(*format,*GetFormat())) {
|
media_format myFormat;
|
||||||
|
GetFormat(&myFormat);
|
||||||
|
if (!format_is_acceptible(*format,myFormat)) {
|
||||||
fprintf(stderr,"<- B_MEDIA_BAD_FORMAT\n");
|
fprintf(stderr,"<- B_MEDIA_BAD_FORMAT\n");
|
||||||
return B_MEDIA_BAD_FORMAT;
|
return B_MEDIA_BAD_FORMAT;
|
||||||
}
|
}
|
||||||
@@ -442,7 +444,7 @@ void MediaWriter::Disconnected(
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
input.source = media_source::null;
|
input.source = media_source::null;
|
||||||
input.format = *GetFormat();
|
GetFormat(&input.format);
|
||||||
if (fBufferGroup != 0) {
|
if (fBufferGroup != 0) {
|
||||||
BBufferGroup * group = fBufferGroup;
|
BBufferGroup * group = fBufferGroup;
|
||||||
fBufferGroup = 0;
|
fBufferGroup = 0;
|
||||||
@@ -526,35 +528,42 @@ status_t MediaWriter::HandleDataStatus(
|
|||||||
|
|
||||||
// static:
|
// static:
|
||||||
|
|
||||||
void MediaWriter::GetFlavor(flavor_info * info, int32 id)
|
void MediaWriter::GetFlavor(flavor_info * outInfo, int32 id)
|
||||||
{
|
{
|
||||||
fprintf(stderr,"MediaWriter::GetFlavor\n");
|
fprintf(stderr,"MediaWriter::GetFlavor\n");
|
||||||
AbstractFileInterfaceNode::GetFlavor(info,id);
|
if (outInfo == 0) {
|
||||||
info->name = "OpenBeOS Media Writer";
|
return;
|
||||||
info->info = "The OpenBeOS Media Writer consumes a multistream and writes a file.";
|
}
|
||||||
info->kinds |= B_BUFFER_CONSUMER;
|
AbstractFileInterfaceNode::GetFlavor(outInfo,id);
|
||||||
info->in_format_count = 1; // 1 input
|
outInfo->name = "OpenBeOS Media Writer";
|
||||||
info->in_formats = GetFormat();
|
outInfo->info = "The OpenBeOS Media Writer consumes a multistream and writes a file.";
|
||||||
|
outInfo->kinds |= B_BUFFER_CONSUMER;
|
||||||
|
outInfo->in_format_count = 1; // 1 input
|
||||||
|
media_format * formats = new media_format[outInfo->in_format_count];
|
||||||
|
GetFormat(&formats[0]);
|
||||||
|
outInfo->in_formats = formats;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
media_format * MediaWriter::GetFormat()
|
void MediaWriter::GetFormat(media_format * outFormat)
|
||||||
{
|
{
|
||||||
fprintf(stderr,"MediaWriter::GetFormat\n");
|
fprintf(stderr,"MediaWriter::GetFormat\n");
|
||||||
return AbstractFileInterfaceNode::GetFormat();
|
if (outFormat == 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
AbstractFileInterfaceNode::GetFormat(outFormat);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
media_file_format * MediaWriter::GetFileFormat()
|
void MediaWriter::GetFileFormat(media_file_format * outFileFormat)
|
||||||
{
|
{
|
||||||
fprintf(stderr,"MediaWriter::GetFileFormat\n");
|
fprintf(stderr,"MediaWriter::GetFileFormat\n");
|
||||||
static bool initialized = false;
|
if (outFileFormat == 0) {
|
||||||
static media_file_format * file_format;
|
return;
|
||||||
if (initialized == false) {
|
|
||||||
file_format = AbstractFileInterfaceNode::GetFileFormat();
|
|
||||||
file_format->capabilities |= media_file_format::B_WRITABLE;
|
|
||||||
initialized = true;
|
|
||||||
}
|
}
|
||||||
return file_format;
|
AbstractFileInterfaceNode::GetFileFormat(outFileFormat);
|
||||||
|
outFileFormat->capabilities |= media_file_format::B_WRITABLE;
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// protected:
|
// protected:
|
||||||
|
|||||||
@@ -164,9 +164,9 @@ virtual status_t HandleDataStatus(
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
static void GetFlavor(flavor_info * info, int32 id);
|
static void GetFlavor(flavor_info * outInfo, int32 id);
|
||||||
static media_format * GetFormat();
|
static void GetFormat(media_format * outFormat);
|
||||||
static media_file_format * GetFileFormat();
|
static void GetFileFormat(media_file_format * outFileFormat);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
|||||||
@@ -146,10 +146,10 @@ status_t MediaWriterAddOn::GetFileFormatList(
|
|||||||
if (out_read_items != 0) {
|
if (out_read_items != 0) {
|
||||||
*out_read_items = 1;
|
*out_read_items = 1;
|
||||||
}
|
}
|
||||||
if (out_readable_formats != 0) {
|
if (out_writable_formats != 0) {
|
||||||
// don't go off the end
|
// don't go off the end
|
||||||
if (in_write_items > 0) {
|
if (in_write_items > 0) {
|
||||||
out_writable_formats[0] = *MediaWriter::GetFileFormat();
|
MediaWriter::GetFileFormat(&out_writable_formats[0]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return B_OK;
|
return B_OK;
|
||||||
|
|||||||
Reference in New Issue
Block a user