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:
Stephan Aßmus
2010-08-24 17:43:13 +00:00
parent 9e7738992b
commit 424faefd92
2 changed files with 26 additions and 0 deletions
+25
View File
@@ -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();
}
+1
View File
@@ -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;