Changed the way Encoders are published by EncoderPlugins. Encoder retrieval

in PluginManager is reenabled. We use the media_codec_info.id to reference
a specific plugin, while the sub_id will be used to reference individual
Encoders that the plugin supports. No idea if that's how it was intented, but
some comments hint in this direction. I failed to mention this before, but
comments are of course very welcome on any of these commits, as always.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31993 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stephan Aßmus
2009-07-30 20:05:11 +00:00
parent 0814569216
commit 7cd2513b82
7 changed files with 68 additions and 81 deletions
+21 -5
View File
@@ -1,10 +1,16 @@
/*
* Copyright 2009, Haiku Inc. All rights reserved.
* Distributed under the terms of the MIT license.
*/
#ifndef _ENCODER_PLUGIN_H
#define _ENCODER_PLUGIN_H
#include <MediaTrack.h>
#include <MediaFormats.h>
#include "MediaPlugin.h"
class AddOnManager;
namespace BPrivate { namespace media {
@@ -18,15 +24,14 @@ public:
size_t chunkSize, uint32 flags) = 0;
};
class Encoder {
public:
Encoder();
virtual ~Encoder();
virtual void GetCodecInfo(media_codec_info* codecInfo) = 0;
virtual status_t SetFormat(const media_file_format& fileFormat,
const media_format& encodedFormat) = 0;
media_format* _inOutEncodedFormat) = 0;
virtual status_t AddTrackInfo(uint32 code, const void* data,
size_t size, uint32 flags = 0) = 0;
@@ -67,8 +72,19 @@ class EncoderPlugin : public virtual MediaPlugin {
public:
EncoderPlugin();
virtual Encoder* NewEncoder(uint index) = 0;
virtual status_t GetSupportedFormats(media_format** formats,
virtual Encoder* NewEncoder(
const media_codec_info& codecInfo) = 0;
// TODO: Maybe this also needs to return a media_format with wild cards
// so that we can support the respective get_next_encoder() functions
// that take media_formats with wild cards and specialize them.
// Then this interface could be turned into an iterator like interface:
//
// status_t GetNextSupportedCodec(int32* cookie,
// const media_codec_info* codecInfo,
// const media_format* format) = 0;
virtual status_t GetSupportedCodecs(
const media_codec_info** codecInfos,
size_t* count) = 0;
};