2009-07-31 01:28:00 +04:00
|
|
|
/*
|
|
|
|
* Copyright 2004-2009, Haiku, Inc. All rights reserved.
|
|
|
|
* Distributed under the terms of the MIT license.
|
|
|
|
*
|
|
|
|
* Authors:
|
|
|
|
* Axel Dörfler
|
|
|
|
* Marcus Overhagen
|
|
|
|
*/
|
2003-12-14 22:23:16 +03:00
|
|
|
#ifndef _FORMAT_MANAGER_H
|
|
|
|
#define _FORMAT_MANAGER_H
|
|
|
|
|
2004-01-23 10:43:33 +03:00
|
|
|
|
|
|
|
#include <Locker.h>
|
2009-07-31 01:28:00 +04:00
|
|
|
#include <ObjectList.h>
|
2014-04-02 16:05:11 +04:00
|
|
|
#include <pthread.h>
|
2004-01-23 10:43:33 +03:00
|
|
|
|
|
|
|
#include "MetaFormat.h"
|
|
|
|
|
|
|
|
|
|
|
|
class FormatManager {
|
2009-07-31 01:28:00 +04:00
|
|
|
public:
|
|
|
|
~FormatManager();
|
2004-01-23 10:43:33 +03:00
|
|
|
|
2014-04-02 11:41:09 +04:00
|
|
|
void GetFormats(bigtime_t lastUpdate, BMessage& reply);
|
|
|
|
status_t MakeFormatFor(
|
|
|
|
const media_format_description* descriptions,
|
|
|
|
int32 descriptionCount,
|
|
|
|
media_format& format, uint32 flags,
|
|
|
|
void* _reserved);
|
2010-08-24 21:43:13 +04:00
|
|
|
void RemoveFormat(const media_format& format);
|
2004-01-23 10:43:33 +03:00
|
|
|
|
2014-04-02 16:05:11 +04:00
|
|
|
static FormatManager* GetInstance();
|
|
|
|
|
|
|
|
private:
|
|
|
|
FormatManager();
|
|
|
|
static void CreateInstance();
|
2009-07-31 01:28:00 +04:00
|
|
|
private:
|
|
|
|
typedef BPrivate::media::meta_format meta_format;
|
2004-01-23 10:43:33 +03:00
|
|
|
|
2009-07-31 01:28:00 +04:00
|
|
|
BObjectList<meta_format> fList;
|
|
|
|
BLocker fLock;
|
|
|
|
bigtime_t fLastUpdate;
|
|
|
|
int32 fNextCodecID;
|
2014-04-02 16:05:11 +04:00
|
|
|
|
|
|
|
static FormatManager* sInstance;
|
|
|
|
static pthread_once_t sInitOnce;
|
2003-12-14 22:23:16 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // _FORMAT_MANAGER_H
|