Added writer to jamfile.

Made some robustness improvements to mediareader based on things
that I noticed while doing mediawriter.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@1037 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
shatty
2002-09-14 13:32:18 +00:00
parent 6836f3623e
commit 912d7a22e2
2 changed files with 17 additions and 9 deletions
+1
View File
@@ -1,5 +1,6 @@
SubDir OBOS_TOP src add-ons media media-add-ons ; SubDir OBOS_TOP src add-ons media media-add-ons ;
SubInclude OBOS_TOP src add-ons media media-add-ons reader ; SubInclude OBOS_TOP src add-ons media media-add-ons reader ;
SubInclude OBOS_TOP src add-ons media media-add-ons writer ;
SubInclude OBOS_TOP src add-ons media media-add-ons legacy ; SubInclude OBOS_TOP src add-ons media media-add-ons legacy ;
SubInclude OBOS_TOP src add-ons media media-add-ons mixer ; SubInclude OBOS_TOP src add-ons media media-add-ons mixer ;
@@ -42,6 +42,11 @@ MediaReader::~MediaReader(void)
if (inputFile != 0) { if (inputFile != 0) {
delete inputFile; delete inputFile;
} }
if (bufferGroup != 0) {
BBufferGroup * group = bufferGroup;
bufferGroup = 0;
delete group;
}
} }
MediaReader::MediaReader( MediaReader::MediaReader(
@@ -305,6 +310,11 @@ status_t MediaReader::GetNextFileFormat(
{ {
fprintf(stderr,"MediaReader::GetNextFileFormat\n"); fprintf(stderr,"MediaReader::GetNextFileFormat\n");
// let's not crash even if they are stupid // let's not crash even if they are stupid
if (out_format == 0) {
// no place to write!
fprintf(stderr,"<- B_BAD_VALUE\n");
return B_BAD_VALUE;
}
if (cookie != 0) { if (cookie != 0) {
// it's valid but they already got our 1 file format // it's valid but they already got our 1 file format
if (*cookie != 0) { if (*cookie != 0) {
@@ -314,11 +324,6 @@ status_t MediaReader::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;
} }
if (out_format == 0) {
// no place to write!
fprintf(stderr,"<- B_BAD_VALUE\n");
return B_BAD_VALUE;
}
*out_format = GetFileFormat(); *out_format = GetFileFormat();
return B_OK; return B_OK;
} }
@@ -721,9 +726,11 @@ void MediaReader::Disconnect(
if ((where == output.destination) && (what == output.source)) { if ((where == output.destination) && (what == output.source)) {
output.destination = media_destination::null; output.destination = media_destination::null;
ResetFormat(&output.format); ResetFormat(&output.format);
BBufferGroup * group = bufferGroup; if (bufferGroup != 0) {
bufferGroup = 0; BBufferGroup * group = bufferGroup;
delete group; bufferGroup = 0;
delete group;
}
} }
} }
@@ -1184,7 +1191,7 @@ status_t MediaReader::GetFlavor(
static flavor_info flavorInfo; static flavor_info flavorInfo;
flavorInfo.name = "MediaReader"; flavorInfo.name = "MediaReader";
flavorInfo.info = flavorInfo.info =
"A MediaReader node reads a file and produces a multistream.\n"; "A MediaReader node reads a file and produces a multistream.";
flavorInfo.kinds = B_FILE_INTERFACE | B_BUFFER_PRODUCER | B_CONTROLLABLE; flavorInfo.kinds = B_FILE_INTERFACE | B_BUFFER_PRODUCER | B_CONTROLLABLE;
flavorInfo.flavor_flags = B_FLAVOR_IS_LOCAL; flavorInfo.flavor_flags = B_FLAVOR_IS_LOCAL;
flavorInfo.possible_count = INT_MAX; flavorInfo.possible_count = INT_MAX;