diff --git a/src/servers/media/FormatManager.cpp b/src/servers/media/FormatManager.cpp index cd61677de8..fd3e48e5c8 100644 --- a/src/servers/media/FormatManager.cpp +++ b/src/servers/media/FormatManager.cpp @@ -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(); +} diff --git a/src/servers/media/FormatManager.h b/src/servers/media/FormatManager.h index 0fc93f4e9f..6f844b9738 100644 --- a/src/servers/media/FormatManager.h +++ b/src/servers/media/FormatManager.h @@ -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;