Added RemoveFormat(), the FormatManager was previously
missing any way to remove previously registered formats. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38337 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -277,3 +277,28 @@ FormatManager::MakeFormatFor(BMessage& message)
|
||||
message.SendReply(&reply, (BHandler*)NULL, TIMEOUT);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
FormatManager::RemoveFormat(const media_format& format)
|
||||
{
|
||||
BAutolock locker(fLock);
|
||||
|
||||
int32 foundIndex = -1;
|
||||
for (int32 i = fList.CountItems() - 1; i >= 0; i--) {
|
||||
meta_format* metaFormat = fList.ItemAt(i);
|
||||
if (metaFormat->format == format) {
|
||||
if (foundIndex != -1) {
|
||||
printf("FormatManager::RemoveFormat() - format already "
|
||||
"present at previous index: %ld\n", foundIndex);
|
||||
}
|
||||
foundIndex = i;
|
||||
}
|
||||
}
|
||||
|
||||
if (foundIndex >= 0)
|
||||
delete fList.RemoveItemAt(foundIndex);
|
||||
else
|
||||
printf("FormatManager::RemoveFormat() - format not found!\n");
|
||||
|
||||
fLastUpdate = system_time();
|
||||
}
|
||||
|
||||
@@ -26,6 +26,7 @@ public:
|
||||
|
||||
void GetFormats(BMessage& message);
|
||||
void MakeFormatFor(BMessage& message);
|
||||
void RemoveFormat(const media_format& format);
|
||||
|
||||
private:
|
||||
typedef BPrivate::media::meta_format meta_format;
|
||||
|
||||
Reference in New Issue
Block a user