Header indentation updated, changed "* " style.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31930 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2004-2008, Haiku. All rights reserved.
|
* Copyright 2004-2009, Haiku. All rights reserved.
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT license.
|
||||||
*
|
*
|
||||||
* Authors:
|
* Authors:
|
||||||
* Marcus Overhagen
|
* Marcus Overhagen
|
||||||
@@ -29,14 +29,14 @@
|
|||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
|
|
||||||
|
|
||||||
// #pragma mark ImageLoader
|
// #pragma mark - ImageLoader
|
||||||
|
|
||||||
/*! The ImageLoader class is a convenience class to temporarily load
|
/*! The ImageLoader class is a convenience class to temporarily load
|
||||||
an image file, and unload it on deconstruction automatically.
|
an image file, and unload it on deconstruction automatically.
|
||||||
*/
|
*/
|
||||||
class ImageLoader {
|
class ImageLoader {
|
||||||
public:
|
public:
|
||||||
ImageLoader(BPath &path)
|
ImageLoader(BPath& path)
|
||||||
{
|
{
|
||||||
fImage = load_add_on(path.Path());
|
fImage = load_add_on(path.Path());
|
||||||
}
|
}
|
||||||
@@ -50,7 +50,7 @@ class ImageLoader {
|
|||||||
status_t InitCheck() const { return fImage; }
|
status_t InitCheck() const { return fImage; }
|
||||||
image_id Image() const { return fImage; }
|
image_id Image() const { return fImage; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
image_id fImage;
|
image_id fImage;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -84,8 +84,8 @@ AddOnManager::SaveState()
|
|||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
AddOnManager::GetDecoderForFormat(xfer_entry_ref *_decoderRef,
|
AddOnManager::GetDecoderForFormat(xfer_entry_ref* _decoderRef,
|
||||||
const media_format &format)
|
const media_format& format)
|
||||||
{
|
{
|
||||||
if ((format.type == B_MEDIA_ENCODED_VIDEO
|
if ((format.type == B_MEDIA_ENCODED_VIDEO
|
||||||
|| format.type == B_MEDIA_ENCODED_AUDIO
|
|| format.type == B_MEDIA_ENCODED_AUDIO
|
||||||
@@ -100,9 +100,9 @@ AddOnManager::GetDecoderForFormat(xfer_entry_ref *_decoderRef,
|
|||||||
printf("AddOnManager::GetDecoderForFormat: searching decoder for encoding "
|
printf("AddOnManager::GetDecoderForFormat: searching decoder for encoding "
|
||||||
"%ld\n", format.Encoding());
|
"%ld\n", format.Encoding());
|
||||||
|
|
||||||
decoder_info *info;
|
decoder_info* info;
|
||||||
for (fDecoderList.Rewind(); fDecoderList.GetNext(&info);) {
|
for (fDecoderList.Rewind(); fDecoderList.GetNext(&info);) {
|
||||||
media_format *decoderFormat;
|
media_format* decoderFormat;
|
||||||
for (info->formats.Rewind(); info->formats.GetNext(&decoderFormat);) {
|
for (info->formats.Rewind(); info->formats.GetNext(&decoderFormat);) {
|
||||||
// check if the decoder matches the supplied format
|
// check if the decoder matches the supplied format
|
||||||
if (!decoderFormat->Matches(&format))
|
if (!decoderFormat->Matches(&format))
|
||||||
@@ -120,13 +120,13 @@ AddOnManager::GetDecoderForFormat(xfer_entry_ref *_decoderRef,
|
|||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
AddOnManager::GetReaders(xfer_entry_ref *outRefs, int32 *outCount,
|
AddOnManager::GetReaders(xfer_entry_ref* outRefs, int32* outCount,
|
||||||
int32 maxCount)
|
int32 maxCount)
|
||||||
{
|
{
|
||||||
BAutolock locker(fLock);
|
BAutolock locker(fLock);
|
||||||
|
|
||||||
fReaderList.Rewind();
|
fReaderList.Rewind();
|
||||||
reader_info *info;
|
reader_info* info;
|
||||||
for (*outCount = 0; fReaderList.GetNext(&info) && *outCount < maxCount;
|
for (*outCount = 0; fReaderList.GetNext(&info) && *outCount < maxCount;
|
||||||
(*outCount)++) {
|
(*outCount)++) {
|
||||||
outRefs[*outCount] = info->ref;
|
outRefs[*outCount] = info->ref;
|
||||||
@@ -137,7 +137,7 @@ AddOnManager::GetReaders(xfer_entry_ref *outRefs, int32 *outCount,
|
|||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
AddOnManager::RegisterAddOn(BEntry &entry)
|
AddOnManager::RegisterAddOn(BEntry& entry)
|
||||||
{
|
{
|
||||||
BPath path(&entry);
|
BPath path(&entry);
|
||||||
|
|
||||||
@@ -153,16 +153,16 @@ AddOnManager::RegisterAddOn(BEntry &entry)
|
|||||||
if ((status = loader.InitCheck()) < B_OK)
|
if ((status = loader.InitCheck()) < B_OK)
|
||||||
return status;
|
return status;
|
||||||
|
|
||||||
MediaPlugin *(*instantiate_plugin_func)();
|
MediaPlugin* (*instantiate_plugin_func)();
|
||||||
|
|
||||||
if (get_image_symbol(loader.Image(), "instantiate_plugin",
|
if (get_image_symbol(loader.Image(), "instantiate_plugin",
|
||||||
B_SYMBOL_TYPE_TEXT, (void **)&instantiate_plugin_func) < B_OK) {
|
B_SYMBOL_TYPE_TEXT, (void**)&instantiate_plugin_func) < B_OK) {
|
||||||
printf("AddOnManager::RegisterAddOn(): can't find instantiate_plugin "
|
printf("AddOnManager::RegisterAddOn(): can't find instantiate_plugin "
|
||||||
"in \"%s\"\n", path.Path());
|
"in \"%s\"\n", path.Path());
|
||||||
return B_BAD_TYPE;
|
return B_BAD_TYPE;
|
||||||
}
|
}
|
||||||
|
|
||||||
MediaPlugin *plugin = (*instantiate_plugin_func)();
|
MediaPlugin* plugin = (*instantiate_plugin_func)();
|
||||||
if (plugin == NULL) {
|
if (plugin == NULL) {
|
||||||
printf("AddOnManager::RegisterAddOn(): instantiate_plugin in \"%s\" "
|
printf("AddOnManager::RegisterAddOn(): instantiate_plugin in \"%s\" "
|
||||||
"returned NULL\n", path.Path());
|
"returned NULL\n", path.Path());
|
||||||
@@ -171,11 +171,11 @@ AddOnManager::RegisterAddOn(BEntry &entry)
|
|||||||
|
|
||||||
// ToDo: remove any old formats describing this add-on!!
|
// ToDo: remove any old formats describing this add-on!!
|
||||||
|
|
||||||
ReaderPlugin *reader = dynamic_cast<ReaderPlugin *>(plugin);
|
ReaderPlugin* reader = dynamic_cast<ReaderPlugin*>(plugin);
|
||||||
if (reader != NULL)
|
if (reader != NULL)
|
||||||
RegisterReader(reader, ref);
|
RegisterReader(reader, ref);
|
||||||
|
|
||||||
DecoderPlugin *decoder = dynamic_cast<DecoderPlugin *>(plugin);
|
DecoderPlugin* decoder = dynamic_cast<DecoderPlugin*>(plugin);
|
||||||
if (decoder != NULL)
|
if (decoder != NULL)
|
||||||
RegisterDecoder(decoder, ref);
|
RegisterDecoder(decoder, ref);
|
||||||
|
|
||||||
@@ -190,19 +190,19 @@ AddOnManager::RegisterAddOns()
|
|||||||
{
|
{
|
||||||
class CodecHandler : public AddOnMonitorHandler {
|
class CodecHandler : public AddOnMonitorHandler {
|
||||||
private:
|
private:
|
||||||
AddOnManager * fManager;
|
AddOnManager* fManager;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CodecHandler(AddOnManager *manager)
|
CodecHandler(AddOnManager* manager)
|
||||||
{
|
{
|
||||||
fManager = manager;
|
fManager = manager;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void AddOnCreated(const add_on_entry_info *entryInfo)
|
virtual void AddOnCreated(const add_on_entry_info* entryInfo)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void AddOnEnabled(const add_on_entry_info *entryInfo)
|
virtual void AddOnEnabled(const add_on_entry_info* entryInfo)
|
||||||
{
|
{
|
||||||
entry_ref ref;
|
entry_ref ref;
|
||||||
make_entry_ref(entryInfo->dir_nref.device,
|
make_entry_ref(entryInfo->dir_nref.device,
|
||||||
@@ -212,11 +212,11 @@ AddOnManager::RegisterAddOns()
|
|||||||
fManager->RegisterAddOn(entry);
|
fManager->RegisterAddOn(entry);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void AddOnDisabled(const add_on_entry_info *entryInfo)
|
virtual void AddOnDisabled(const add_on_entry_info* entryInfo)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void AddOnRemoved(const add_on_entry_info *entryInfo)
|
virtual void AddOnRemoved(const add_on_entry_info* entryInfo)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -261,11 +261,11 @@ AddOnManager::RegisterAddOns()
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
AddOnManager::RegisterReader(ReaderPlugin *reader, const entry_ref &ref)
|
AddOnManager::RegisterReader(ReaderPlugin* reader, const entry_ref& ref)
|
||||||
{
|
{
|
||||||
BAutolock locker(fLock);
|
BAutolock locker(fLock);
|
||||||
|
|
||||||
reader_info *pinfo;
|
reader_info* pinfo;
|
||||||
for (fReaderList.Rewind(); fReaderList.GetNext(&pinfo);) {
|
for (fReaderList.Rewind(); fReaderList.GetNext(&pinfo);) {
|
||||||
if (!strcmp(pinfo->ref.name, ref.name)) {
|
if (!strcmp(pinfo->ref.name, ref.name)) {
|
||||||
// we already know this reader
|
// we already know this reader
|
||||||
@@ -283,11 +283,11 @@ AddOnManager::RegisterReader(ReaderPlugin *reader, const entry_ref &ref)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
AddOnManager::RegisterDecoder(DecoderPlugin *plugin, const entry_ref &ref)
|
AddOnManager::RegisterDecoder(DecoderPlugin* plugin, const entry_ref& ref)
|
||||||
{
|
{
|
||||||
BAutolock locker(fLock);
|
BAutolock locker(fLock);
|
||||||
|
|
||||||
decoder_info *pinfo;
|
decoder_info* pinfo;
|
||||||
for (fDecoderList.Rewind(); fDecoderList.GetNext(&pinfo);) {
|
for (fDecoderList.Rewind(); fDecoderList.GetNext(&pinfo);) {
|
||||||
if (!strcmp(pinfo->ref.name, ref.name)) {
|
if (!strcmp(pinfo->ref.name, ref.name)) {
|
||||||
// we already know this decoder
|
// we already know this decoder
|
||||||
@@ -300,7 +300,7 @@ AddOnManager::RegisterDecoder(DecoderPlugin *plugin, const entry_ref &ref)
|
|||||||
decoder_info info;
|
decoder_info info;
|
||||||
info.ref = ref;
|
info.ref = ref;
|
||||||
|
|
||||||
media_format * formats = 0;
|
media_format* formats = 0;
|
||||||
size_t count = 0;
|
size_t count = 0;
|
||||||
if (plugin->GetSupportedFormats(&formats,&count) != B_OK) {
|
if (plugin->GetSupportedFormats(&formats,&count) != B_OK) {
|
||||||
printf("AddOnManager::RegisterDecoder(): plugin->GetSupportedFormats"
|
printf("AddOnManager::RegisterDecoder(): plugin->GetSupportedFormats"
|
||||||
|
|||||||
@@ -1,14 +1,19 @@
|
|||||||
/*
|
/*
|
||||||
** Copyright 2004, the OpenBeOS project. All rights reserved.
|
* Copyright 2004-2009, Haiku. All rights reserved.
|
||||||
** Distributed under the terms of the OpenBeOS License.
|
* Distributed under the terms of the MIT license.
|
||||||
**
|
*
|
||||||
** Authors: Marcus Overhagen, Axel Dörfler
|
* Authors:
|
||||||
*/
|
* Marcus Overhagen
|
||||||
|
* Axel Dörfler
|
||||||
|
*/
|
||||||
#ifndef _ADD_ON_MANAGER_H
|
#ifndef _ADD_ON_MANAGER_H
|
||||||
#define _ADD_ON_MANAGER_H
|
#define _ADD_ON_MANAGER_H
|
||||||
|
|
||||||
// Manager for codec add-ons (reader, writer, encoder, decoder)
|
|
||||||
// BMediaAddOn are handled in the NodeManager
|
/*! Manager for codec add-ons (reader, writer, encoder, decoder)
|
||||||
|
BMediaAddOn are handled in the NodeManager
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include "ReaderPlugin.h"
|
#include "ReaderPlugin.h"
|
||||||
#include "DecoderPlugin.h"
|
#include "DecoderPlugin.h"
|
||||||
@@ -18,28 +23,31 @@
|
|||||||
#include "AddOnMonitor.h"
|
#include "AddOnMonitor.h"
|
||||||
#include "AddOnMonitorHandler.h"
|
#include "AddOnMonitorHandler.h"
|
||||||
|
|
||||||
|
|
||||||
class AddOnManager {
|
class AddOnManager {
|
||||||
public:
|
public:
|
||||||
AddOnManager();
|
AddOnManager();
|
||||||
~AddOnManager();
|
~AddOnManager();
|
||||||
|
|
||||||
void LoadState();
|
void LoadState();
|
||||||
void SaveState();
|
void SaveState();
|
||||||
|
|
||||||
status_t GetDecoderForFormat(xfer_entry_ref *out_ref,
|
status_t GetDecoderForFormat(xfer_entry_ref* _ref,
|
||||||
const media_format &in_format);
|
const media_format& format);
|
||||||
|
|
||||||
status_t GetReaders(xfer_entry_ref *out_res, int32 *out_count,
|
status_t GetReaders(xfer_entry_ref* _ref,
|
||||||
int32 max_count);
|
int32* _count, int32 maxCount);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
status_t RegisterAddOn(BEntry &entry);
|
status_t RegisterAddOn(BEntry& entry);
|
||||||
void RegisterAddOns();
|
void RegisterAddOns();
|
||||||
|
|
||||||
void RegisterReader(ReaderPlugin *reader, const entry_ref &ref);
|
void RegisterReader(ReaderPlugin* reader,
|
||||||
void RegisterDecoder(DecoderPlugin *decoder, const entry_ref &ref);
|
const entry_ref& ref);
|
||||||
|
void RegisterDecoder(DecoderPlugin* decoder,
|
||||||
|
const entry_ref& ref);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
struct reader_info {
|
struct reader_info {
|
||||||
entry_ref ref;
|
entry_ref ref;
|
||||||
};
|
};
|
||||||
@@ -60,10 +68,10 @@ class AddOnManager {
|
|||||||
List<decoder_info> fDecoderList;
|
List<decoder_info> fDecoderList;
|
||||||
List<encoder_info> fEncoderList;
|
List<encoder_info> fEncoderList;
|
||||||
|
|
||||||
decoder_info *fCurrentDecoder;
|
decoder_info* fCurrentDecoder;
|
||||||
|
|
||||||
AddOnMonitorHandler *fHandler;
|
AddOnMonitorHandler* fHandler;
|
||||||
AddOnMonitor *fAddOnMonitor;
|
AddOnMonitor* fAddOnMonitor;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // _ADD_ON_MANAGER_H
|
#endif // _ADD_ON_MANAGER_H
|
||||||
|
|||||||
Reference in New Issue
Block a user