Resolved TODOs in PluginManager about leaking plugins when they are no longer

needed. I've added MediaPlugin* fields to Reader and Decoder plugin classes
which are set when the PluginManager hands out new instances. This way the
manager knows what plugin created the Decoder or Reader instance in the
Destroy*() methods and can decrease the reference count accordingly. Also added
some FBC stuffing to Decoder and Reader. All media plugins need to be recompiled,
in case anyone has some outside the Haiku tree.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30984 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stephan Aßmus
2009-06-07 18:11:05 +00:00
parent 5fa2230d99
commit bb56a763a6
6 changed files with 157 additions and 50 deletions
+49 -27
View File
@@ -9,53 +9,75 @@ class AddOnManager;
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;
virtual ~ChunkProvider() {};
virtual status_t GetNextChunk(const void** chunkBuffer,
size_t* chunkSize,
media_header* mediaHeader) = 0;
};
class Decoder
{
class Decoder {
public:
Decoder();
virtual ~Decoder();
Decoder();
virtual ~Decoder();
virtual void GetCodecInfo(media_codec_info *codecInfo) = 0;
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;
// 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 NegotiateOutputFormat(
media_format* ioDecodedFormat) = 0;
virtual status_t Seek(uint32 seekTo,
int64 seekFrame, int64 *frame,
bigtime_t seekTime, bigtime_t *time) = 0;
virtual status_t Seek(uint32 seekTo, int64 seekFrame,
int64* frame, bigtime_t seekTime,
bigtime_t* time) = 0;
virtual status_t Decode(void *buffer, int64 *frameCount,
media_header *mediaHeader, media_decode_info *info = 0) = 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);
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);
void SetChunkProvider(ChunkProvider *provider);
private:
ChunkProvider * fChunkProvider;
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();
class DecoderPlugin : public virtual MediaPlugin {
public:
DecoderPlugin();
virtual Decoder *NewDecoder(uint index) = 0;
virtual status_t GetSupportedFormats(media_format ** formats, size_t * count) = 0;
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
#endif // _DECODER_PLUGIN_H