haiku/src/servers/media/AddOnManager.h

94 lines
2.1 KiB
C
Raw Normal View History

/*
* Copyright 2004-2009, Haiku. All rights reserved.
* Distributed under the terms of the MIT license.
*
* Authors:
* Marcus Overhagen
* Axel Dörfler
* Stephan Aßmus <superstippi@gmx.de>
*/
#ifndef _ADD_ON_MANAGER_H
#define _ADD_ON_MANAGER_H
/*! Manager for codec add-ons (reader, writer, encoder, decoder)
BMediaAddOn are handled in the NodeManager
*/
#include "DataExchange.h"
#include "TList.h"
#include "AddOnMonitor.h"
#include "AddOnMonitorHandler.h"
#include "DecoderPlugin.h"
#include "EncoderPlugin.h"
#include "ReaderPlugin.h"
#include "WriterPlugin.h"
class AddOnManager {
public:
AddOnManager();
~AddOnManager();
void LoadState();
void SaveState();
status_t GetDecoderForFormat(xfer_entry_ref* _ref,
const media_format& format);
status_t GetReaders(xfer_entry_ref* _ref,
int32* _count, int32 maxCount);
status_t GetEncoderForFormat(xfer_entry_ref* _ref,
const media_format& format);
status_t GetWriter(xfer_entry_ref* _ref,
const media_file_format& format);
private:
status_t _RegisterAddOn(BEntry& entry);
void _RegisterAddOns();
void _RegisterReader(ReaderPlugin* reader,
const entry_ref& ref);
void _RegisterDecoder(DecoderPlugin* decoder,
const entry_ref& ref);
void _RegisterWriter(WriterPlugin* writer,
const entry_ref& ref);
void _RegisterEncoder(EncoderPlugin* encoder,
const entry_ref& ref);
private:
struct reader_info {
entry_ref ref;
};
struct writer_info {
entry_ref ref;
List<media_file_format> fileFormats;
};
struct decoder_info {
entry_ref ref;
List<media_format> formats;
};
struct encoder_info {
entry_ref ref;
List<media_format> formats;
};
BLocker fLock;
List<reader_info> fReaderList;
List<writer_info> fWriterList;
List<decoder_info> fDecoderList;
List<encoder_info> fEncoderList;
uint32 fNextWriterFormatFamilyID;
AddOnMonitorHandler* fHandler;
AddOnMonitor* fAddOnMonitor;
};
#endif // _ADD_ON_MANAGER_H