1 /* 2 * Copyright 2004-2009, Haiku, Inc. All rights reserved. 3 * Distributed under the terms of the MIT license. 4 * 5 * Authors: 6 * Axel Dörfler 7 * Marcus Overhagen 8 */ 9 #ifndef _FORMAT_MANAGER_H 10 #define _FORMAT_MANAGER_H 11 12 13 #include <Locker.h> 14 #include <ObjectList.h> 15 #include <pthread.h> 16 17 #include "MetaFormat.h" 18 19 20 class FormatManager { 21 public: 22 ~FormatManager(); 23 24 void GetFormats(bigtime_t lastUpdate, BMessage& reply); 25 status_t MakeFormatFor( 26 const media_format_description* descriptions, 27 int32 descriptionCount, 28 media_format& format, uint32 flags, 29 void* _reserved); 30 void RemoveFormat(const media_format& format); 31 32 static FormatManager* GetInstance(); 33 34 private: 35 FormatManager(); 36 static void CreateInstance(); 37 private: 38 typedef BPrivate::media::meta_format meta_format; 39 40 BObjectList<meta_format> fList; 41 BLocker fLock; 42 bigtime_t fLastUpdate; 43 int32 fNextCodecID; 44 45 static FormatManager* sInstance; 46 static pthread_once_t sInitOnce; 47 }; 48 49 #endif // _FORMAT_MANAGER_H 50