haiku/headers/private/media/DecoderPlugin.h
Michael Lotz 62d30d9e49 libmedia: Put AddOnManager into BPrivate::media namespace.
The AddOnManager was in the global namespace, clashing with application
classes with the same name.

The input_server has an AddOnManager of its own. When the
shortcut_catcher filter was loaded by said AddOnManager, it in turn
loaded libgame.so, which in turn loaded libmedia.so, where an
AddOnManager was created for the global AddOnManager instance in
libmedia.so. Unfortunately the wrong AddOnManager, the one from the
input_server, was created. This lead to two AddOnManagers being active
in the input_server which very well could be responsible for #11049
and #11280.

This was a regression since the move of the AddOnManager from the
media_server to libmedia.so in hrev47086. This also fits with the two
tickets.

I actually noticed the problem when debugging the shutdown process of
the input_server, where the destruction of the wrong AddOnManager
caused a deadlock with itself.
2015-04-19 23:47:05 +02:00

81 lines
1.9 KiB
C++

#ifndef _DECODER_PLUGIN_H
#define _DECODER_PLUGIN_H
#include <MediaTrack.h>
#include <MediaFormats.h>
#include "MediaPlugin.h"
namespace BPrivate { namespace media {
class PluginManager;
class ChunkProvider {
public:
virtual ~ChunkProvider() {};
virtual status_t GetNextChunk(const void** chunkBuffer,
size_t* chunkSize,
media_header* mediaHeader) = 0;
};
class Decoder {
public:
Decoder();
virtual ~Decoder();
virtual void GetCodecInfo(media_codec_info* codecInfo) = 0;
// Setup get's called with the info data from Reader::GetStreamInfo
virtual status_t Setup(media_format* ioEncodedFormat,
const void* infoBuffer,
size_t infoSize) = 0;
virtual status_t NegotiateOutputFormat(
media_format* ioDecodedFormat) = 0;
virtual status_t SeekedTo(int64 frame, bigtime_t time) = 0;
virtual status_t Decode(void* buffer, int64* frameCount,
media_header* mediaHeader,
media_decode_info* info = 0) = 0;
status_t GetNextChunk(const void** chunkBuffer,
size_t* chunkSize,
media_header* mediaHeader);
void SetChunkProvider(ChunkProvider* provider);
virtual status_t Perform(perform_code code, void* data);
private:
virtual void _ReservedDecoder1();
virtual void _ReservedDecoder2();
virtual void _ReservedDecoder3();
virtual void _ReservedDecoder4();
virtual void _ReservedDecoder5();
ChunkProvider* fChunkProvider;
// needed for plug-in reference count management
friend class PluginManager;
MediaPlugin* fMediaPlugin;
uint32 fReserved[5];
};
class DecoderPlugin : public virtual MediaPlugin {
public:
DecoderPlugin();
virtual Decoder* NewDecoder(uint index) = 0;
virtual status_t GetSupportedFormats(media_format** formats,
size_t* count) = 0;
};
} } // namespace BPrivate::media
using namespace BPrivate::media;
#endif // _DECODER_PLUGIN_H