2004-01-23 07:40:35 +00:00
|
|
|
/*
|
2009-07-29 17:58:46 +00:00
|
|
|
* Copyright 2004-2009, Haiku. All rights reserved.
|
|
|
|
* Distributed under the terms of the MIT license.
|
|
|
|
*
|
|
|
|
* Authors:
|
|
|
|
* Marcus Overhagen
|
|
|
|
* Axel Dörfler
|
2009-07-29 19:14:04 +00:00
|
|
|
* Stephan Aßmus <superstippi@gmx.de>
|
2009-07-29 17:58:46 +00:00
|
|
|
*/
|
2003-12-14 19:23:16 +00:00
|
|
|
#ifndef _ADD_ON_MANAGER_H
|
|
|
|
#define _ADD_ON_MANAGER_H
|
|
|
|
|
2009-07-29 17:58:46 +00:00
|
|
|
|
|
|
|
/*! Manager for codec add-ons (reader, writer, encoder, decoder)
|
|
|
|
BMediaAddOn are handled in the NodeManager
|
|
|
|
*/
|
|
|
|
|
2003-12-14 19:23:16 +00:00
|
|
|
|
|
|
|
#include "DataExchange.h"
|
2004-01-23 07:40:35 +00:00
|
|
|
#include "TList.h"
|
2003-12-14 19:23:16 +00:00
|
|
|
|
2004-02-02 05:26:40 +00:00
|
|
|
#include "AddOnMonitor.h"
|
|
|
|
#include "AddOnMonitorHandler.h"
|
2009-07-29 19:14:04 +00:00
|
|
|
#include "DecoderPlugin.h"
|
|
|
|
#include "EncoderPlugin.h"
|
|
|
|
#include "ReaderPlugin.h"
|
|
|
|
#include "WriterPlugin.h"
|
2003-12-14 19:23:16 +00:00
|
|
|
|
2009-07-29 17:58:46 +00:00
|
|
|
|
2004-01-23 07:40:35 +00:00
|
|
|
class AddOnManager {
|
2009-07-29 17:58:46 +00:00
|
|
|
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);
|
|
|
|
|
2009-07-30 20:05:11 +00:00
|
|
|
status_t GetEncoder(xfer_entry_ref* _ref, int32 id);
|
2009-07-29 19:14:04 +00:00
|
|
|
|
|
|
|
status_t GetWriter(xfer_entry_ref* _ref,
|
2009-07-29 22:49:23 +00:00
|
|
|
uint32 internalID);
|
|
|
|
|
|
|
|
status_t GetFileFormat(media_file_format* _fileFormat,
|
|
|
|
int32 cookie);
|
2009-07-31 00:46:36 +00:00
|
|
|
status_t GetCodecInfo(media_codec_info* _codecInfo,
|
|
|
|
media_format_family* _formatFamily,
|
|
|
|
media_format* _inputFormat,
|
|
|
|
media_format* _outputFormat, int32 cookie);
|
2009-07-29 19:14:04 +00:00
|
|
|
|
2009-07-29 17:58:46 +00:00
|
|
|
private:
|
2009-07-29 19:14:04 +00:00
|
|
|
void _RegisterAddOns();
|
2009-07-29 17:58:46 +00:00
|
|
|
|
2010-08-24 09:46:55 +00:00
|
|
|
status_t _RegisterAddOn(const entry_ref& ref);
|
|
|
|
status_t _UnregisterAddOn(const entry_ref& ref);
|
2010-08-19 19:59:37 +00:00
|
|
|
|
2009-07-29 19:14:04 +00:00
|
|
|
void _RegisterReader(ReaderPlugin* reader,
|
2009-07-29 17:58:46 +00:00
|
|
|
const entry_ref& ref);
|
2009-07-29 19:14:04 +00:00
|
|
|
void _RegisterDecoder(DecoderPlugin* decoder,
|
|
|
|
const entry_ref& ref);
|
|
|
|
|
|
|
|
void _RegisterWriter(WriterPlugin* writer,
|
|
|
|
const entry_ref& ref);
|
|
|
|
void _RegisterEncoder(EncoderPlugin* encoder,
|
2009-07-29 17:58:46 +00:00
|
|
|
const entry_ref& ref);
|
|
|
|
|
2010-08-24 17:46:11 +00:00
|
|
|
bool _FindDecoder(const media_format& format,
|
|
|
|
const BPath& path,
|
|
|
|
xfer_entry_ref* _decoderRef);
|
2010-08-25 22:27:12 +00:00
|
|
|
void _GetReaders(const BPath& path,
|
|
|
|
xfer_entry_ref* outRefs, int32* outCount,
|
|
|
|
int32 maxCount);
|
2010-08-24 17:46:11 +00:00
|
|
|
|
2009-07-29 17:58:46 +00:00
|
|
|
private:
|
|
|
|
struct reader_info {
|
2009-07-29 22:49:23 +00:00
|
|
|
entry_ref ref;
|
2009-07-29 17:58:46 +00:00
|
|
|
};
|
|
|
|
struct writer_info {
|
2009-07-29 22:49:23 +00:00
|
|
|
entry_ref ref;
|
|
|
|
uint32 internalID;
|
2009-07-29 17:58:46 +00:00
|
|
|
};
|
|
|
|
struct decoder_info {
|
2009-07-29 22:49:23 +00:00
|
|
|
entry_ref ref;
|
|
|
|
List<media_format> formats;
|
2009-07-29 17:58:46 +00:00
|
|
|
};
|
|
|
|
struct encoder_info {
|
2009-07-29 22:49:23 +00:00
|
|
|
entry_ref ref;
|
2009-07-30 20:05:11 +00:00
|
|
|
uint32 internalID;
|
2009-07-31 00:46:36 +00:00
|
|
|
media_codec_info codecInfo;
|
|
|
|
media_format_family formatFamily;
|
|
|
|
media_format intputFormat;
|
|
|
|
media_format outputFormat;
|
2009-07-29 17:58:46 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
BLocker fLock;
|
|
|
|
List<reader_info> fReaderList;
|
|
|
|
List<writer_info> fWriterList;
|
|
|
|
List<decoder_info> fDecoderList;
|
|
|
|
List<encoder_info> fEncoderList;
|
|
|
|
|
2009-07-30 20:05:11 +00:00
|
|
|
List<media_file_format> fWriterFileFormats;
|
2009-07-29 22:49:23 +00:00
|
|
|
|
2009-07-29 19:14:04 +00:00
|
|
|
uint32 fNextWriterFormatFamilyID;
|
2009-07-30 20:05:11 +00:00
|
|
|
uint32 fNextEncoderCodecInfoID;
|
2009-07-29 17:58:46 +00:00
|
|
|
|
2010-08-19 19:59:37 +00:00
|
|
|
AddOnMonitorHandler* fAddOnMonitorHandler;
|
2009-07-29 17:58:46 +00:00
|
|
|
AddOnMonitor* fAddOnMonitor;
|
2004-01-23 07:40:35 +00:00
|
|
|
};
|
2003-12-14 19:23:16 +00:00
|
|
|
|
|
|
|
#endif // _ADD_ON_MANAGER_H
|