Initial implementation of BMediaEncoder

* People interested, please review!
* This is based on the patch from Fredrik Moden which was based on
the Oleg Krysenkov one.
* The original patch has been reworked by myself.
* Adapted the code to work with the new PluginManager API which
differently than before doesn't need to contact the media_server.
This commit is contained in:
Dario Casalinuovo
2015-12-02 16:08:06 +01:00
parent 0df4a177d7
commit 2b51499295
9 changed files with 339 additions and 61 deletions
+13 -2
View File
@@ -8,6 +8,15 @@
#include <MediaFormats.h>
namespace BPrivate {
namespace media {
class Encoder;
class EncoderPlugin;
}
}
using namespace BPrivate::media;
class BMediaEncoder {
public:
@@ -65,6 +74,8 @@ private:
BMediaEncoder& operator=(const BMediaEncoder& other);
private:
status_t _AttachToEncoder();
static status_t write_chunk(void* classPtr,
const void* buffer, size_t size,
media_encode_info* info);
@@ -73,7 +84,7 @@ private:
void ReleaseEncoder();
uint32 _reserved_was_fEncoderMgr;
uint32 _reserved_was_fEncoder;
Encoder* fEncoder;
int32 fEncoderID;
bool fFormatValid;
@@ -84,7 +95,7 @@ private:
};
class BMediaBufferEncoder: public BMediaEncoder {
class BMediaBufferEncoder : public BMediaEncoder {
public:
BMediaBufferEncoder();
BMediaBufferEncoder(
+4 -1
View File
@@ -1,5 +1,5 @@
/*
* Copyright 2009, Haiku Inc. All rights reserved.
* Copyright 2009-2015, Haiku Inc. All rights reserved.
* Distributed under the terms of the MIT license.
*/
#ifndef _ENCODER_PLUGIN_H
@@ -122,6 +122,9 @@ public:
virtual Encoder* NewEncoder(
const media_codec_info& codecInfo) = 0;
virtual Encoder* NewEncoder(
const media_format& format) = 0;
virtual status_t RegisterNextEncoder(int32* cookie,
media_codec_info* codecInfo,
media_format_family* formatFamily,
+8 -2
View File
@@ -1,6 +1,8 @@
/*
/*
* Copyright 2015, Dario Casalinuovo. All rights reserved.
* Copyright 2012, Fredrik Modéen. All rights reserved.
* Copyright 2004-2007, Marcus Overhagen. All rights reserved.
* Distributed under the terms of the OpenBeOS License.
* Distributed under the terms of the MIT License.
*/
#ifndef _PLUGIN_MANAGER_H
#define _PLUGIN_MANAGER_H
@@ -51,6 +53,10 @@ public:
status_t CreateEncoder(Encoder** encoder,
const media_codec_info* codecInfo,
uint32 flags);
status_t CreateEncoder(Encoder** encoder,
const media_format& format);
void DestroyEncoder(Encoder* encoder);
private: