hrev53138 adds 1 changeset to branch 'master'
old head: 086528f66af8e1f420be92d2af971605554e5264
new head: 218a8c03cbadd95d8888b218930f514fa0b4fac4
overview:
https://git.haiku-os.org/haiku/log/?qt=range&q=218a8c03cbad+%5E086528f66af8
----------------------------------------------------------------------------
218a8c03cbad: Revert the Codec Kit.
All of Barrett's individual reverts have been squashed into this
one commit, save a few actual bugfixes.
Change-Id: Ib0a7d0a841d3ac40b1fca7372c58b7f9229bd1f0
[ Augustin Cavalier <waddlesplash@xxxxxxxxx> ]
----------------------------------------------------------------------------
Revision: hrev53138
Commit: 218a8c03cbadd95d8888b218930f514fa0b4fac4
URL: https://git.haiku-os.org/haiku/commit/?id=218a8c03cbad
Author: Augustin Cavalier <waddlesplash@xxxxxxxxx>
Date: Fri May 17 18:43:32 2019 UTC
----------------------------------------------------------------------------
96 files changed, 1539 insertions(+), 2672 deletions(-)
build/jam/ArchitectureRules | 4 +-
build/jam/HeadersRules | 12 +-
build/jam/images/definitions/regular | 1 -
headers/os/codec/CodecRoster.h | 140 ----------
headers/os/codec/MediaPlugin.h | 71 -----
headers/os/codec/MediaStreamer.h | 61 -----
headers/os/codec/MetaData.h | 162 -----------
headers/os/codec/Streamer.h | 60 ----
headers/os/media/MediaDecoder.h | 18 +-
headers/os/media/MediaEncoder.h | 12 +-
headers/os/media/MediaFile.h | 17 +-
headers/os/media/MediaTrack.h | 26 +-
.../Decoder.h => private/media/DecoderPlugin.h} | 54 ++--
.../Encoder.h => private/media/EncoderPlugin.h} | 55 ++--
.../{os/codec => private/media}/MediaExtractor.h | 59 ++--
headers/private/media/MediaPlugin.h | 33 +++
headers/private/media/MediaStreamer.h | 36 +++
.../{os/codec => private/media}/MediaWriter.h | 40 +--
headers/private/{codec => media}/PluginManager.h | 61 ++---
headers/{os/codec => private/media}/RawFormats.h | 0
.../Reader.h => private/media/ReaderPlugin.h} | 57 ++--
headers/private/media/StreamerPlugin.h | 46 ++++
.../Writer.h => private/media/WriterPlugin.h} | 55 ++--
.../media/experimental}/AdapterIO.h | 11 +-
.../media/experimental}/MediaIO.h | 7 -
src/add-ons/media/plugins/Jamfile | 2 +-
.../media/plugins/ape_reader/APEReader.cpp | 16 +-
src/add-ons/media/plugins/ape_reader/APEReader.h | 15 +-
src/add-ons/media/plugins/ape_reader/Jamfile | 2 +-
.../media/plugins/dvd_streamer/DVDMediaIO.cpp | 4 +-
.../media/plugins/dvd_streamer/DVDMediaIO.h | 4 -
.../plugins/dvd_streamer/DVDStreamerPlugin.cpp | 26 +-
.../plugins/dvd_streamer/DVDStreamerPlugin.h | 24 +-
src/add-ons/media/plugins/dvd_streamer/Jamfile | 6 +-
.../media/plugins/ffmpeg/AVCodecDecoder.h | 10 +-
.../media/plugins/ffmpeg/AVCodecEncoder.cpp | 2 +-
.../media/plugins/ffmpeg/AVCodecEncoder.h | 7 +-
.../media/plugins/ffmpeg/AVFormatReader.cpp | 78 +++---
.../media/plugins/ffmpeg/AVFormatReader.h | 11 +-
.../media/plugins/ffmpeg/AVFormatWriter.cpp | 10 +-
.../media/plugins/ffmpeg/AVFormatWriter.h | 12 +-
.../media/plugins/ffmpeg/FFmpegPlugin.cpp | 29 +-
src/add-ons/media/plugins/ffmpeg/FFmpegPlugin.h | 24 +-
src/add-ons/media/plugins/ffmpeg/Jamfile | 4 +-
.../media/plugins/http_streamer/HTTPMediaIO.cpp | 4 +-
.../media/plugins/http_streamer/HTTPMediaIO.h | 3 -
.../plugins/http_streamer/HTTPStreamerPlugin.cpp | 32 +--
.../plugins/http_streamer/HTTPStreamerPlugin.h | 22 +-
src/add-ons/media/plugins/http_streamer/Jamfile | 5 +-
src/add-ons/media/plugins/raw_decoder/Jamfile | 2 +-
.../plugins/raw_decoder/RawDecoderPlugin.cpp | 17 +-
.../media/plugins/raw_decoder/RawDecoderPlugin.h | 13 +-
src/add-ons/media/plugins/rtsp_streamer/Jamfile | 5 +-
.../media/plugins/rtsp_streamer/RTSPMediaIO.cpp | 3 -
.../media/plugins/rtsp_streamer/RTSPMediaIO.h | 2 -
.../plugins/rtsp_streamer/RTSPStreamerPlugin.cpp | 21 +-
.../plugins/rtsp_streamer/RTSPStreamerPlugin.h | 16 +-
src/bin/media_client/MediaTest.cpp | 3 +-
src/kits/Jamfile | 1 -
src/kits/codec/CodecRoster.cpp | 271 -------------------
src/kits/codec/Decoder.cpp | 77 ------
src/kits/codec/Encoder.cpp | 154 -----------
src/kits/codec/Jamfile | 53 ----
src/kits/codec/MediaPlugin.cpp | 30 --
src/kits/codec/MediaStreamer.cpp | 102 -------
src/kits/codec/MetaData.cpp | 236 ----------------
src/kits/codec/Reader.cpp | 87 ------
src/kits/codec/Streamer.cpp | 49 ----
src/kits/codec/Writer.cpp | 57 ----
src/kits/{codec => media}/AddOnManager.cpp | 29 +-
.../codec => src/kits/media}/AddOnManager.h | 31 +--
src/kits/{codec => media}/ChunkCache.cpp | 12 +-
src/kits/{codec => media}/ChunkCache.h | 13 +-
src/kits/media/DecoderPlugin.cpp | 61 +++++
src/kits/media/EncoderPlugin.cpp | 137 ++++++++++
.../private => src/kits}/media/FormatManager.h | 0
src/kits/media/Jamfile | 21 +-
src/kits/media/MediaDecoder.cpp | 27 +-
src/kits/media/MediaDefs.cpp | 248 ++++++++++++++++-
src/kits/media/MediaDefsNotify.cpp | 250 -----------------
src/kits/media/MediaEncoder.cpp | 15 +-
src/kits/{codec => media}/MediaExtractor.cpp | 100 +++----
src/kits/media/MediaFile.cpp | 45 +--
src/kits/media/MediaFormats.cpp | 128 ++++++++-
src/kits/media/MediaPlugin.cpp | 20 ++
src/kits/media/MediaStreamer.cpp | 47 ++++
src/kits/media/MediaTrack.cpp | 50 ++--
src/kits/{codec => media}/MediaWriter.cpp | 54 ++--
src/kits/{codec => media}/PluginManager.cpp | 96 +++----
src/kits/media/ReaderPlugin.cpp | 81 ++++++
src/kits/media/StreamerPlugin.cpp | 25 ++
src/kits/media/WriterPlugin.cpp | 50 ++++
.../{codec => media/experimental}/AdapterIO.cpp | 10 +-
src/kits/media/experimental/MediaClient.cpp | 3 -
.../{codec => media/experimental}/MediaIO.cpp | 7 -
src/servers/media/media_server.h | 2 +
----------------------------------------------------------------------------
diff --git a/build/jam/ArchitectureRules b/build/jam/ArchitectureRules
index 501287a6ff..4e3100621b 100644
--- a/build/jam/ArchitectureRules
+++ b/build/jam/ArchitectureRules
@@ -201,8 +201,8 @@ rule ArchitectureSetup architecture
libraryGrist = $(architecture) ;
}
local i ;
- for i in be bnetapi codec debug device game locale mail media midi
- midi2 network package root screensaver textencoding
tracker
+ for i in be bnetapi debug device game locale mail media midi midi2
+ network package root screensaver textencoding tracker
translation z {
local library = lib$(i).so ;
HAIKU_LIBRARY_NAME_MAP_$(architecture)_$(i)
diff --git a/build/jam/HeadersRules b/build/jam/HeadersRules
index e04edac5c2..ac4d4cb6c1 100644
--- a/build/jam/HeadersRules
+++ b/build/jam/HeadersRules
@@ -436,9 +436,9 @@ rule FStandardOSHeaders
local osIncludes = add-ons add-ons/file_system add-ons/graphics
add-ons/input_server
add-ons/registrar
add-ons/screen_saver
- add-ons/tracker app codec device
drivers game
- interface kernel locale media mail
midi midi2
- net storage support translation ;
+ add-ons/tracker app device drivers
game interface
+ kernel locale media mail midi midi2
net storage
+ support translation ;
return [ FDirName $(HAIKU_TOP) headers os ]
[ PublicHeaders $(osIncludes) ] ;
@@ -450,9 +450,9 @@ rule FStandardHeaders architecture
local osIncludes = add-ons add-ons/file_system add-ons/graphics
add-ons/input_server
add-ons/registrar
add-ons/screen_saver
- add-ons/tracker app device drivers
game codec
- interface kernel locale media mail
midi midi2
- net storage support translation ;
+ add-ons/tracker app device drivers
game interface
+ kernel locale media mail midi midi2
net storage
+ support translation ;
local headers = ;
diff --git a/build/jam/images/definitions/regular
b/build/jam/images/definitions/regular
index fe5972b249..596ea37cec 100644
--- a/build/jam/images/definitions/regular
+++ b/build/jam/images/definitions/regular
@@ -73,7 +73,6 @@ rule HaikuImageGetSystemLibs
libalm.so
libbe.so libbsd.so libbnetapi.so
libbluetooth.so
- libcodec.so
libdebug.so
libdebugger.so@primary
libdevice.so
diff --git a/headers/os/codec/CodecRoster.h b/headers/os/codec/CodecRoster.h
deleted file mode 100644
index c7193d6909..0000000000
--- a/headers/os/codec/CodecRoster.h
+++ /dev/null
@@ -1,140 +0,0 @@
-/*
- * Copyright 2018, Dario Casalinuovo. All rights reserved.
- * Distributed under the terms of the MIT License.
- */
-#ifndef _CODEC_ROSTER_H
-#define _CODEC_ROSTER_H
-
-
-#include <Decoder.h>
-#include <Encoder.h>
-#include <MediaDefs.h>
-#include <Reader.h>
-#include <Streamer.h>
-#include <Writer.h>
-
-
-namespace BCodecKit {
-
-
-class BCodecRoster {
-public:
-
- static status_t InstantiateReader(BReader** reader,
- int32* streamCount,
media_file_format* mff,
- BDataIO* source);
- static void ReleaseReader(BReader* reader);
-
- static status_t InstantiateDecoder(BDecoder** decoder,
- const media_format&
format);
- static status_t InstantiateDecoder(BDecoder** decoder,
- const media_codec_info&
mci);
- static void ReleaseDecoder(BDecoder* decoder);
-
- static status_t InstantiateWriter(BWriter** writer,
- const
media_file_format& mff,
- BDataIO* target);
- static void ReleaseWriter(BWriter* writer);
-
- static status_t InstantiateEncoder(BEncoder** encoder,
- const media_format&
format);
- static status_t InstantiateEncoder(BEncoder** encoder,
- const media_codec_info*
codecInfo,
- uint32 flags);
- static void ReleaseEncoder(BEncoder* encoder);
-
- static status_t InstantiateStreamer(BStreamer** streamer,
- BUrl url);
- static void ReleaseStreamer(BStreamer* streamer);
-
- static status_t GetDecoderInfo(BDecoder* decoder,
- media_codec_info* info);
-
- // The following API is from MediaFormats. The idea is to put
- // there only the APIs really used in the BeOS/Haiku ecosystem
- // so that we can discard unuseful code, thus reducing complexity.
- // To choose the API I did a search among the Haiku codebase and
- // programs for which we have the source available.
-
- // TODO: media_format_family: really?
- static status_t GetCodecInfo(media_codec_info* _codecInfo,
- media_format_family*
_formatFamily,
- media_format*
_inputFormat,
- media_format*
_outputFormat, int32 cookie);
-
- //! Use this function to iterate through available file format writers.
- static status_t GetNextFileFormat(int32* cookie,
media_file_format* mff);
-
-/*! \brief Use this to iterate through the available encoders for a given
file
- format.
- \param cookie A pointer to a preallocated cookie, which you
need
- to initialize to \c 0 before
calling this function
- the first time.
- \param fileFormat A pointer to a valid media_file_format structure
- as can be obtained through
get_next_file_format().
- \param inputFormat This is the type of data given to the encoder.
- \param _outputFormat This is the type of data the encoder will output.
- \param _codecInfo Pointer to a preallocated media_codec_info
structure,
- information about the encoder
is placed there.
-
- \return
- - \c B_OK: Everything went fine.
- - \c B_BAD_INDEX: There are no more encoders.
- */
- static status_t GetNextEncoder(int32* cookie, const
media_file_format* fileFormat,
- const media_format*
inputFormat, media_format* _outputFormat,
- media_codec_info*
_codecInfo);
-
-/*! \brief Use this to iterate through the available encoders with
- restrictions to the input and output media_format while
the
- encoders can specialize wildcards in the media_formats.
-
- \param cookie A pointer to a preallocated cookie, which you
need
- to initialize to \c 0 before
calling this function
- the first time.
- \param fileFormat A pointer to a valid media_file_format structure
- as can be obtained through
get_next_file_format().
- You can pass \c NULL if you
don't care.
- \param inputFormat This is the type of data given to the encoder,
- wildcards are accepted.
- \param outputFormat This is the type of data you want the encoder to
- output. Wildcards are accepted.
- \param _codecInfo Pointer to a preallocated media_codec_info
structure,
- information about the encoder
is placed there.
- \param _acceptedInputFormat This is the type of data that the encoder
will
- accept as input. Wildcards in
\a inFormat will be
- specialized here.
- \param _acceptedOutputFormat This is the type of data that the encoder
will
- output. Wildcards in \a
_outFormat will be specialized
- here.
-
- \return
- - \c B_OK: Everything went fine.
- - \c B_BAD_INDEX: There are no more encoders.
-*/
- static status_t GetNextEncoder(int32* cookie, const
media_file_format* fileFormat,
- const media_format*
inputFormat, const media_format* outputFormat,
- media_codec_info*
_codecInfo, media_format* _acceptedInputFormat,
- media_format*
_acceptedOutputFormat);
-
-/*! \brief Iterate over the all the available encoders without media_format
- restrictions.
-
- \param cookie A pointer to a preallocated cookie, which you
need
- to initialize to \c 0 before
calling this function
- the first time.
- \param _codecInfo Pointer to a preallocated media_codec_info
structure,
- information about the encoder
is placed there.
-
- \return
- - \c B_OK: Everything went fine.
- - \c B_BAD_INDEX: There are no more encoders.
-*/
- static status_t GetNextEncoder(int32* cookie, media_codec_info*
_codecInfo);
-};
-
-
-} // namespace BCodecKit
-
-
-#endif // _CODEC_ROSTER_H
diff --git a/headers/os/codec/MediaPlugin.h b/headers/os/codec/MediaPlugin.h
deleted file mode 100644
index 9bc2c6ed4f..0000000000
--- a/headers/os/codec/MediaPlugin.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Copyright 2003, Marcus Overhagen. All rights reserved.
- * Copyright 2018, Dario Casalinuovo. All rights reserverd.
- * Distributed under the terms of the MIT license.
- */
-#ifndef _MEDIA_PLUGIN_H
-#define _MEDIA_PLUGIN_H
-
-
-#include <SupportDefs.h>
-
-
-namespace BCodecKit {
-
-namespace BPrivate {
- class PluginManager;
-}
-
-
-// TODO: Shouldn't this be a BReferenceable?
-// TODO: This will replace BMediaAddOn in media2,
-// see if we need some more accessor method and
-// add the needed padding.
-class BMediaPlugin {
-public:
- BMediaPlugin();
- virtual ~BMediaPlugin();
-
-private:
- int32 fRefCount;
-
- // needed for plug-in reference count management
- friend class BCodecKit::BPrivate::PluginManager;
-
- virtual void _ReservedMediaPlugin1();
- virtual void _ReservedMediaPlugin2();
-
- uint32 fReserved[5];
-};
-
-
-extern "C" BMediaPlugin* instantiate_plugin();
-extern "C" uint32 get_plugin_version();
-extern "C" const char* get_plugin_name();
-
-
-#define B_CODEC_KIT_PLUGIN_VERSION 100
-
-#define B_DECLARE_CODEC_KIT_PLUGIN(className, name, version) \
-extern "C" {
\
- BCodecKit::BMediaPlugin* instantiate_plugin()
\
- {
\
- return new(std::nothrow) className();
\
- }
\
-
\
- uint32 get_plugin_version()
\
- {
\
- return version;
\
- }
\
-
\
- const char* get_plugin_name()
\
- {
\
- return name;
\
- }
\
-}
-
-
-} // namespace BCodecKit
-
-
-#endif // _MEDIA_PLUGIN_H
diff --git a/headers/os/codec/MediaStreamer.h b/headers/os/codec/MediaStreamer.h
deleted file mode 100644
index cf1abdcc82..0000000000
--- a/headers/os/codec/MediaStreamer.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Copyright 2017, Dario Casalinuovo. All rights reserved.
- * Distributed under the terms of the MIT License.
- */
-#ifndef _MEDIA_STREAMER_H
-#define _MEDIA_STREAMER_H
-
-
-#include <MediaIO.h>
-#include <Streamer.h>
-#include <Url.h>
-
-
-namespace BCodecKit {
-
-
-class BMediaStreamer {
-public:
-
BMediaStreamer(BUrl url);
-
~BMediaStreamer();
-
- status_t InitCheck() const;
-
- // TODO: So, it seems since this API was not public,
- // the memory ownership is leaved to class users.
- // See if this fits our plans, and eventually, move
- // this memory management from BMediaFile to
BMediaExtractor,
- // BMediaWriter and BMediaStreamer.
- BMediaIO* Adapter() const;
-
- // TODO: Don't we need an open in the extractor and
writer?
- status_t Open();
- void Close();
- bool IsOpened() const;
-
- //uint32 Capabilities() const;
- //status_t GetMetaData(BMetaData*
data) const;
- //status_t SetHandler(BHandler*
handler);
- //BHandler* Handler() const;
-
- void MouseMoved(uint32 x,
uint32 y);
- void MouseDown(uint32 x,
uint32 y);
-
-private:
- BUrl fUrl;
- BStreamer* fStreamer;
- status_t fInitCheck;
-
- bool fOpened;
-
- // No virtual padding needed. Looks like a design
decision.
- // Let's respect that, for now.
- // Same apply to MediaWriter and MediaExtractor.
- uint32 fReserved[5];
-};
-
-
-} // namespace BCodecKit
-
-
-#endif
diff --git a/headers/os/codec/MetaData.h b/headers/os/codec/MetaData.h
deleted file mode 100644
index 9347610b2b..0000000000
--- a/headers/os/codec/MetaData.h
+++ /dev/null
@@ -1,162 +0,0 @@
-/*
- * Copyright 2018, Dario Casalinuovo. All rights reserved.
- * Distributed under the terms of the MIT License.
- */
-#ifndef _META_DATA_H
-#define _META_DATA_H
-
-
-#include <Message.h>
-
-
-namespace BCodecKit {
-
-
-// Playback capabilities
-extern const char* kCanPause; // bool
-extern const char* kCanSeekBackward; // bool
-extern const char* kCanSeekForward; // bool
-extern const char* kCanSeek; // bool
-
-// Bitrates
-extern const char* kAudioBitRate; // uint32 (bps)
-extern const char* kVideoBitRate; // uint32 (bps)
-extern const char* kAudioSampleRate; // float (hz)
-extern const char* kVideoFrameRate; // float (hz)
-
-// RFC2046 and RFC4281
-extern const char* kMimeType; // BString
-extern const char* kAudioCodec; // BString
-extern const char* kVideoCodec; // BString
-extern const char* kVideoHeight; // uint32
-extern const char* kVideoWidth; // uint32
-extern const char* kNumTracks; // uint32
-extern const char* kDrmCrippled; // bool
-
-// Stuff needed to fully describe the BMediaFormat
-// TODO: Shouldn't we just use MIME types for it?
-extern const char* kMediaType; // media_type
-// Audio stuff
-extern const char* kChannelCount; // uint32
-extern const char* kAudioFormat; // uint32
-extern const char* kByteOrder; // uint32
-extern const char* kBufferSize; // size_t
-// Multiaudio
-extern const char* kChannelMask; // size_t
-
-// This is also BMediaFormat stuff, but mostly video
-// NOTE: video width/height are defined as per RFC mentioned above
-extern const char* kBytesPerRow; // uint32
-extern const char* kPixelOffset; // uint32
-extern const char* kLineOffset; // uint32
-extern const char* kColorSpace; // color_space
-extern const char* kOrientation; // uint32
-extern const char* kVideoFrameSize; // uint32
-
-extern const char* kEncoding; // uint32
-
-// General use attributes
-extern const char* kTitle; // BString
-extern const char* kComment; // BString
-extern const char* kCopyright; // BString
-extern const char* kAlbum; // BString
-extern const char* kArtist; // BString
-extern const char* kAlbumArtist; // BString
-extern const char* kAuthor; // BString
-extern const char* kPerformer; // BString
-extern const char* kComposer; // BString
-extern const char* kGenre; // BString
-extern const char* kYear; // BString
-extern const char* kEncodedBy; // BString
-extern const char* kLanguage; // BString
-extern const char* kDisc; // BString
-extern const char* kPublisher; // BString
-extern const char* kEncoder; // BString
-extern const char* kTrack;
-extern const char* kDate; // BString
-extern const char* kDuration; // uint32 (ms)
-extern const char* kRating; // BString
-// TODO: BBitmap? uint8 array? url?
-//extern const char* kAlbumArt
-extern const char* kCDTrackNum; // uint32
-extern const char* kCDTrackMax; // uint32
-
-extern const char* kChapter; // BMetaData
-extern const char* kChapterStart; // uint64
-extern const char* kChapterEnd; // uint64
-
-// Others
-extern const char* kProgramData; // BMetaData
-
-// TODO: Fully honour this:
-// https://wiki.multimedia.cx/index.php?title=FFmpeg_Metadata
-
-
-/**
- * @brief BMetaData stores the media metadata.
- *
- * The metadata model is sparse and each key can occur at most once,
- * except for BMetaData itself.
- * The key is a const char and the value is the actual metadata.
- * The client of this class is required to know in advance the type
- * of a particular metadata key.
- */
-class BMetaData {
-public:
- BMetaData();
- BMetaData(const BMessage& msg);
- virtual ~BMetaData();
-
- // Woah. It seems we need BValue there.
- bool SetString(const char* key, const
BString& value);
- bool SetBool(const char* key, bool value);
- bool SetUInt32(const char* key, uint32
value);
- bool SetUInt64(const char* key, uint64
value);
- bool SetFloat(const char* key, float value);
-
- bool GetString(const char* key, BString*
value) const;
- bool GetBool(const char* key, bool* value)
const;
- bool GetUInt32(const char* key, uint32*
value) const;
- bool GetUInt64(const char* key, uint64*
value) const;
- bool GetFloat(const char* key, float* value)
const;
-
- bool HasString(const char* key) const;
- bool HasBool(const char* key) const;
- bool HasUInt32(const char* key) const;
- bool HasUInt64(const char* key) const;
- bool HasFloat(const char* key) const;
-
- // We allow embedding BMetaData into BMetaData. The BMetaData field
- // is the only one allowed to have more occurrences for a single key
- // so an index attribute is given for retrieving it.
- bool AddMetaData(const char* key, BMetaData*
data);
- bool GetMetaData(const char* key, BMetaData*
data,
- uint32 index = 0);
- bool HasMetaData(const char* key, uint32
index = 0);
- bool RemoveMetaData(const char* key, uint32
index = 0);
-
- bool RemoveValue(const char* key);
-
- // Clean up all keys
- void MakeEmpty();
- bool IsEmpty();
-
- // Retain ownership of the object, be careful with that
- // that's why we need to introduce smart pointers!
- const BMessage* Message();
-
- BMetaData& operator=(const BMetaData& other);
- BMetaData(const BMetaData&);
-
-private:
- // TODO: padding
- BMessage* fMessage;
-
-
-};
-
-
-} // namespace BCodecKit
-
-
-#endif // _META_DATA_H
diff --git a/headers/os/codec/Streamer.h b/headers/os/codec/Streamer.h
deleted file mode 100644
index 51819aa011..0000000000
--- a/headers/os/codec/Streamer.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Copyright 2017, Dario Casalinuovo. All rights reserved.
- * Distributed under the terms of the MIT License.
- */
-#ifndef _STREAMER_PLUGIN_H
-#define _STREAMER_PLUGIN_H
-
-
-#include <MediaIO.h>
-#include <MediaPlugin.h>
-#include <Url.h>
-
-
-namespace BCodecKit {
-
-namespace BPrivate {
- class PluginManager;
-}
-
-
-class BStreamer {
-public:
- virtual status_t Sniff(const BUrl& url) = 0;
- virtual BMediaIO* Adapter() const = 0;
-
- // Base impl does nothing
- virtual void MouseMoved(uint32 x, uint32 y);
- virtual void MouseDown(uint32 x, uint32 y);
-
-protected:
- BStreamer();
- virtual ~BStreamer();
-
-private:
- BMediaPlugin* fMediaPlugin;
-
- friend class BCodecKit::BPrivate::PluginManager;
-
- virtual void _ReservedStreamer1();
- virtual void _ReservedStreamer2();
- virtual void _ReservedStreamer3();
- virtual void _ReservedStreamer4();
- virtual void _ReservedStreamer5();
-
- uint32 fReserved[5];
-};
-
-
-class BStreamerPlugin : public virtual BMediaPlugin {
-public:
-
BStreamerPlugin();
-
- virtual BStreamer* NewStreamer() = 0;
-};
-
-
-} // namespace BCodecKit
-
-
-#endif // _STREAMER_PLUGIN_H
diff --git a/headers/os/media/MediaDecoder.h b/headers/os/media/MediaDecoder.h
index 8112d04810..339447b0bb 100644
--- a/headers/os/media/MediaDecoder.h
+++ b/headers/os/media/MediaDecoder.h
@@ -1,14 +1,18 @@
#ifndef MEDIADECODER_H
#define MEDIADECODER_H
-
+#include <MediaDefs.h>
#include <MediaFormats.h>
-
-namespace BCodecKit {
- class BDecoder;
+namespace BPrivate {
+ class Decoder;
+}
+namespace BPrivate {
+ namespace media {
+ class Decoder;
+ class DecoderPlugin;
+ }
}
-
class BMediaDecoder {
public:
@@ -43,8 +47,8 @@ class BMediaDecoder {
status_t AttachToDecoder();
- BCodecKit::BDecoder* fDecoder;
- status_t fInitStatus;
+ BPrivate::media::Decoder *fDecoder;
+ status_t fInitStatus;
/* fbc data and virtuals */
diff --git a/headers/os/media/MediaEncoder.h b/headers/os/media/MediaEncoder.h
index 091dc0f63d..047ec688b8 100644
--- a/headers/os/media/MediaEncoder.h
+++ b/headers/os/media/MediaEncoder.h
@@ -8,11 +8,15 @@
#include <MediaFormats.h>
-
-namespace BCodecKit {
- class BEncoder;
+namespace BPrivate {
+ namespace media {
+ class Encoder;
+ class EncoderPlugin;
+ }
}
+using namespace BPrivate::media;
+
class BMediaEncoder {
public:
@@ -80,7 +84,7 @@ private:
void ReleaseEncoder();
uint32
_reserved_was_fEncoderMgr;
- BCodecKit::BEncoder* fEncoder;
+ Encoder* fEncoder;
int32 fEncoderID;
bool fFormatValid;
diff --git a/headers/os/media/MediaFile.h b/headers/os/media/MediaFile.h
index f0c30eea64..9b105d8eb0 100644
--- a/headers/os/media/MediaFile.h
+++ b/headers/os/media/MediaFile.h
@@ -13,13 +13,12 @@
#include <StorageDefs.h>
-namespace BCodecKit {
- class BMediaExtractor;
- class BMediaStreamer;
- class BMediaWriter;
-}
-
namespace BPrivate {
+ namespace media {
+ class MediaExtractor;
+ class MediaStreamer;
+ class MediaWriter;
+ }
class _AddonManager;
}
@@ -163,18 +162,18 @@ private:
status_t ControlFile(int32
selector, void* ioData,
size_t
size);
- BCodecKit::BMediaExtractor* fExtractor;
+ BPrivate::media::MediaExtractor* fExtractor;
int32
_reserved_BMediaFile_was_fExtractorID;
int32 fTrackNum;
status_t fErr;
BPrivate::_AddonManager* fEncoderMgr;
BPrivate::_AddonManager* fWriterMgr;
- BCodecKit::BMediaWriter* fWriter;
+ BPrivate::media::MediaWriter* fWriter;
int32 fWriterID;
media_file_format fMFI;
- BCodecKit::BMediaStreamer* fStreamer;
+ BPrivate::media::MediaStreamer* fStreamer;
bool fFileClosed;
bool fDeleteSource;
diff --git a/headers/os/media/MediaTrack.h b/headers/os/media/MediaTrack.h
index 3541cc9531..d263fd77c2 100644
--- a/headers/os/media/MediaTrack.h
+++ b/headers/os/media/MediaTrack.h
@@ -9,12 +9,12 @@
#include <MediaFormats.h>
-namespace BCodecKit {
- class BDecoder;
- class BEncoder;
- class BMediaExtractor;
- class BMediaWriter;
-}
+namespace BPrivate { namespace media {
+ class Decoder;
+ class Encoder;
+ class MediaExtractor;
+ class MediaWriter;
+} }
class BMessage;
class BView;
@@ -219,12 +219,12 @@ private:
// For read-only access to a BMediaTrack
BMediaTrack(
-
BCodecKit::BMediaExtractor* extractor,
+
BPrivate::media::MediaExtractor* extractor,
int32
streamIndex);
// For write-only access to a BMediaTrack
BMediaTrack(
-
BCodecKit::BMediaWriter* writer,
+
BPrivate::media::MediaWriter* writer,
int32
streamIndex, media_format* format,
const
media_codec_info* codecInfo);
@@ -235,9 +235,9 @@ private:
private:
status_t fInitStatus;
- BCodecKit::BDecoder* fDecoder;
- BCodecKit::BDecoder* fRawDecoder;
- BCodecKit::BMediaExtractor* fExtractor;
+ BPrivate::media::Decoder* fDecoder;
+ BPrivate::media::Decoder* fRawDecoder;
+ BPrivate::media::MediaExtractor* fExtractor;
int32 fStream;
int64 fCurrentFrame;
@@ -245,9 +245,9 @@ private:
media_codec_info fCodecInfo;
- BCodecKit::BEncoder* fEncoder;
+ BPrivate::media::Encoder* fEncoder;
int32 fEncoderID;
- BCodecKit::BMediaWriter* fWriter;
+ BPrivate::media::MediaWriter* fWriter;
media_format fFormat;
uint32 fWorkaroundFlags;
diff --git a/headers/os/codec/Decoder.h b/headers/private/media/DecoderPlugin.h
similarity index 70%
rename from headers/os/codec/Decoder.h
rename to headers/private/media/DecoderPlugin.h
index 8dfcdda74a..5d1f83face 100644
--- a/headers/os/codec/Decoder.h
+++ b/headers/private/media/DecoderPlugin.h
@@ -1,36 +1,28 @@
#ifndef _DECODER_PLUGIN_H
#define _DECODER_PLUGIN_H
-
#include <MediaTrack.h>
#include <MediaFormats.h>
-
#include "MediaPlugin.h"
-namespace BCodecKit {
-
-namespace BPrivate {
- class PluginManager;
-}
+namespace BPrivate { namespace media {
+class PluginManager;
-class BChunkProvider {
+class ChunkProvider {
public:
-
BChunkProvider();
- virtual ~BChunkProvider();
-
-protected:
- friend class BDecoder;
-
+ virtual ~ChunkProvider() {};
virtual status_t GetNextChunk(const void**
chunkBuffer,
size_t*
chunkSize,
media_header* mediaHeader) = 0;
};
-
-class BDecoder {
+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
@@ -51,44 +43,38 @@ public:
size_t*
chunkSize,
media_header* mediaHeader);
- void
SetChunkProvider(BChunkProvider* provider);
+ void
SetChunkProvider(ChunkProvider* provider);
virtual status_t Perform(perform_code code,
void* data);
-protected:
- BDecoder();
- virtual ~BDecoder();
-
-
private:
- BChunkProvider* fChunkProvider;
-
- BMediaPlugin* fMediaPlugin;
-
- // needed for plug-in reference count management
- friend class BCodecKit::BPrivate::PluginManager;
-
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 BDecoderPlugin : public virtual BMediaPlugin {
+class DecoderPlugin : public virtual MediaPlugin {
public:
-
BDecoderPlugin();
+ DecoderPlugin();
- virtual BDecoder* NewDecoder(uint index) = 0;
+ virtual Decoder* NewDecoder(uint index) = 0;
virtual status_t
GetSupportedFormats(media_format** formats,
size_t*
count) = 0;
};
+} } // namespace BPrivate::media
-} // namespace BCodecKit
-
+using namespace BPrivate::media;
#endif // _DECODER_PLUGIN_H
diff --git a/headers/os/codec/Encoder.h b/headers/private/media/EncoderPlugin.h
similarity index 86%
rename from headers/os/codec/Encoder.h
rename to headers/private/media/EncoderPlugin.h
index c4a94a6ff5..8aa655a33d 100644
--- a/headers/os/codec/Encoder.h
+++ b/headers/private/media/EncoderPlugin.h
@@ -6,35 +6,30 @@
#define _ENCODER_PLUGIN_H
-#include <MediaPlugin.h>
#include <MediaTrack.h>
#include <MediaFormats.h>
#include <View.h>
+#include "MediaPlugin.h"
-namespace BCodecKit {
+namespace BPrivate { namespace media {
-namespace BPrivate {
- class PluginManager;
-}
+class PluginManager;
-
-class BChunkWriter {
+class ChunkWriter {
public:
- BChunkWriter();
- virtual ~BChunkWriter();
-
-protected:
- friend class BEncoder;
-
+ virtual ~ChunkWriter() {};
virtual status_t WriteChunk(const void*
chunkBuffer,
size_t
chunkSize,
media_encode_info* encodeInfo) = 0;
};
-class BEncoder {
+class Encoder {
public:
+ Encoder();
+ virtual ~Encoder();
+
// Some codecs may only support certain input color spaces, or output
// color spaces, or multiple of 16 width/height... This method is needed
// for get_next_encoder() functionality. If _acceptedInputFormat is
NULL,
@@ -82,21 +77,20 @@ public:
size_t
chunkSize,
media_encode_info* encodeInfo);
- void
SetChunkWriter(BChunkWriter* writer);
+ void
SetChunkWriter(ChunkWriter* writer);
virtual status_t Perform(perform_code code,
void* data);
-protected:
- BEncoder();
- virtual ~BEncoder();
-
private:
- BChunkWriter* fChunkWriter;
-
- BMediaPlugin* fMediaPlugin;
+ ChunkWriter* fChunkWriter;
// needed for plug-in reference count management
- friend class BCodecKit::BPrivate::PluginManager;
+ friend class PluginManager;
+ MediaPlugin* fMediaPlugin;
+
+private:
+ // FBC padding
+ uint32 fReserved[20];
virtual void _ReservedEncoder1();
virtual void _ReservedEncoder2();
@@ -118,20 +112,17 @@ private:
virtual void _ReservedEncoder18();
virtual void _ReservedEncoder19();
virtual void _ReservedEncoder20();
-
- // FBC padding
- uint32 fReserved[20];
};
-class BEncoderPlugin : public virtual BMediaPlugin {
+class EncoderPlugin : public virtual MediaPlugin {
public:
-
BEncoderPlugin();
+ EncoderPlugin();
- virtual BEncoder* NewEncoder(
+ virtual Encoder* NewEncoder(
const
media_codec_info& codecInfo) = 0;
- virtual BEncoder* NewEncoder(
+ virtual Encoder* NewEncoder(
const
media_format& format) = 0;
virtual status_t RegisterNextEncoder(int32*
cookie,
@@ -141,8 +132,8 @@ public:
media_format* outputFormat) = 0;
};
+} } // namespace BPrivate::media
-}
-
+using namespace BPrivate::media;
#endif // _ENCODER_PLUGIN_H
diff --git a/headers/os/codec/MediaExtractor.h
b/headers/private/media/MediaExtractor.h
similarity index 66%
rename from headers/os/codec/MediaExtractor.h
rename to headers/private/media/MediaExtractor.h
index b2fd0c23cd..eeefca70bb 100644
--- a/headers/os/codec/MediaExtractor.h
+++ b/headers/private/media/MediaExtractor.h
@@ -10,36 +10,47 @@
#define _MEDIA_EXTRACTOR_H
-#include <Decoder.h>
-#include <MediaStreamer.h>
-#include <Reader.h>
+#include "ReaderPlugin.h"
+#include "DecoderPlugin.h"
-namespace BCodecKit {
+namespace BPrivate {
+namespace media {
-struct stream_info;
+class ChunkCache;
+struct chunk_buffer;
-class BMediaExtractor {
+struct stream_info {
+ status_t status;
+ void* cookie;
+ bool hasCookie;
+ const void* infoBuffer;
+ size_t infoBufferSize;
+ ChunkCache* chunkCache;
+ chunk_buffer* lastChunk;
+ media_format encodedFormat;
+};
+
+
+class MediaExtractor {
public:
-
BMediaExtractor(BDataIO* source, int32 flags);
- // TODO
-
//BMediaExtractor(BMediaStreamer* streamer);
-
~BMediaExtractor();
+
MediaExtractor(BDataIO* source, int32 flags);
- status_t InitCheck() const;
+
~MediaExtractor();
+
+ status_t InitCheck();
BDataIO* Source() const;
void GetFileFormatInfo(
media_file_format* fileFormat) const;
+ status_t GetMetaData(BMessage*
_data) const;
- status_t GetMetaData(BMetaData*
data) const;
- status_t GetStreamMetaData(int32
stream,
-
BMetaData* data) const;
+ int32 StreamCount();
- int32 CountStreams() const;
+ const char* Copyright();
const media_format* EncodedFormat(int32 stream);
int64 CountFrames(int32
stream) const;
@@ -55,13 +66,15 @@ public:
size_t*
_chunkSize,
media_header* mediaHeader);
- status_t CreateDecoder(int32
stream, BDecoder** _decoder,
+ status_t CreateDecoder(int32
stream, Decoder** _decoder,
media_codec_info* codecInfo);
- // TODO: Explore if would be better to add a Start/Stop
- // methods pair to MediaExtractor.
+ status_t GetStreamMetaData(int32
stream,
+
BMessage* _data) const;
+
void StopProcessing();
+
private:
void _Init(BDataIO* source,
int32 flags);
@@ -69,24 +82,24 @@ private:
static int32 _ExtractorEntry(void* arg);
void _ExtractorThread();
+private:
status_t fInitStatus;
sem_id fExtractorWaitSem;
thread_id fExtractorThread;
BDataIO* fSource;
- BReader* fReader;
+ Reader* fReader;
stream_info* fStreamInfo;
int32 fStreamCount;
media_file_format fFileFormat;
-
- uint32 fReserved[5];
};
+} // namespace media
+} // namespace BPrivate
-} // namespace BCodecKit
-
+using namespace BPrivate::media;
#endif // _MEDIA_EXTRACTOR_H
diff --git a/headers/private/media/MediaPlugin.h
b/headers/private/media/MediaPlugin.h
new file mode 100644
index 0000000000..27b4071654
--- /dev/null
+++ b/headers/private/media/MediaPlugin.h
@@ -0,0 +1,33 @@
+/*
+ * Copyright 2003, Marcus Overhagen. All rights reserved.
+ * Distributed under the terms of the MIT license.
+ */
+#ifndef _MEDIA_PLUGIN_H
+#define _MEDIA_PLUGIN_H
+
+#include <SupportDefs.h>
+
+namespace BPrivate { namespace media {
+
+class MediaPlugin {
+public:
+ MediaPlugin();
+ virtual ~MediaPlugin();
+
+private:
+ // needed for plug-in reference count management
+ friend class PluginManager;
+
+ int32 fRefCount;
+};
+
+class Decoder;
+class Reader;
+
+} } // namespace BPrivate::media
+
+using namespace BPrivate::media;
+
+extern "C" MediaPlugin* instantiate_plugin();
+
+#endif // _MEDIA_PLUGIN_H
diff --git a/headers/private/media/MediaStreamer.h
b/headers/private/media/MediaStreamer.h
new file mode 100644
index 0000000000..71de9f673d
--- /dev/null
+++ b/headers/private/media/MediaStreamer.h
@@ -0,0 +1,36 @@
+/*
+ * Copyright 2017, Dario Casalinuovo. All rights reserved.
+ * Distributed under the terms of the MIT License.
+ */
+#ifndef _MEDIA_STREAMER_H
+#define _MEDIA_STREAMER_H
+
+
+#include <Url.h>
+
+#include "StreamerPlugin.h"
+
+
+namespace BPrivate {
+namespace media {
+
+
+class MediaStreamer {
+public:
+
MediaStreamer(BUrl url);
+
~MediaStreamer();
+
+ status_t CreateAdapter(BDataIO**
adapter);
+
+private:
+ BUrl fUrl;
+ Streamer* fStreamer;
+};
+
+
+}; // namespace media
+}; // namespace BPrivate
+
+using namespace BPrivate::media;
+
+#endif
diff --git a/headers/os/codec/MediaWriter.h
b/headers/private/media/MediaWriter.h
similarity index 65%
rename from headers/os/codec/MediaWriter.h
rename to headers/private/media/MediaWriter.h
index acef2f1071..ce5e05fd7c 100644
--- a/headers/os/codec/MediaWriter.h
+++ b/headers/private/media/MediaWriter.h
@@ -6,37 +6,34 @@
#define _MEDIA_WRITER_H
-#include <Encoder.h>
-#include <MetaData.h>
-#include <Writer.h>
-
+#include "EncoderPlugin.h"
#include "TList.h"
+#include "WriterPlugin.h"
-namespace BCodecKit {
+namespace BPrivate {
+namespace media {
-class BMediaWriter {
+class MediaWriter {
public:
-
BMediaWriter(BDataIO* target,
+
MediaWriter(BDataIO* target,
const
media_file_format& fileFormat);
- ~BMediaWriter();
+ ~MediaWriter();
- status_t InitCheck() const;
+ status_t InitCheck();
BDataIO* Target() const;
void
GetFileFormatInfo(media_file_format* mfi) const;
- status_t
CreateEncoder(BEncoder** _encoder,
+ status_t CreateEncoder(Encoder**
_encoder,
const
media_codec_info* codecInfo,
media_format* format, uint32 flags = 0);
- // TODO: Why pointers? Just copy it
- status_t SetMetaData(BMetaData*
data);
- status_t SetMetaData(int32
streamIndex,
-
BMetaData* data);
-
+ status_t SetCopyright(int32
streamIndex,
+ const
char* copyright);
+ status_t SetCopyright(const
char* copyright);
status_t CommitHeader();
status_t Flush();
status_t Close();
@@ -54,17 +51,20 @@ private:
void* cookie;
};
- status_t fInitCheck;
+private:
BDataIO* fTarget;
- BWriter* fWriter;
+ Writer* fWriter;
+
List<StreamInfo> fStreamInfos;
- media_file_format fFileFormat;
- uint32 fReserved[5];
+ media_file_format fFileFormat;
};
-} // namespace BCodecKit
+}; // namespace media
+}; // namespace BPrivate
+
+using namespace BPrivate::media;
#endif // _MEDIA_WRITER_H
diff --git a/headers/private/codec/PluginManager.h
b/headers/private/media/PluginManager.h
similarity index 54%
rename from headers/private/codec/PluginManager.h
rename to headers/private/media/PluginManager.h
index 3b21cfa97d..7b863b7928 100644
--- a/headers/private/codec/PluginManager.h
+++ b/headers/private/media/PluginManager.h
@@ -10,70 +10,68 @@
#include <string.h>
-#include <Decoder.h>
-#include <Encoder.h>
-#include <Locker.h>
-#include <Reader.h>
-#include <Streamer.h>
-#include <Writer.h>
-
-#include "TList.h"
+#include "DecoderPlugin.h"
+#include "EncoderPlugin.h"
+#include "ReaderPlugin.h"
+#include "StreamerPlugin.h"
+#include "WriterPlugin.h"
-namespace BCodecKit {
+#include <TList.h>
+#include <Locker.h>
-namespace BPrivate {
+namespace BPrivate { namespace media {
class PluginManager {
public:
PluginManager();
~PluginManager();
- BMediaPlugin* GetPlugin(const entry_ref& ref);
- void PutPlugin(BMediaPlugin*
plugin);
+ MediaPlugin* GetPlugin(const entry_ref& ref);
+ void PutPlugin(MediaPlugin*
plugin);
// Readers and Decoders
- status_t CreateReader(BReader**
reader,
+ status_t CreateReader(Reader**
reader,
int32*
streamCount, media_file_format* mff,
BDataIO* source);
- void DestroyReader(BReader*
reader);
+ void DestroyReader(Reader*
reader);
- status_t
CreateDecoder(BDecoder** decoder,
+ status_t CreateDecoder(Decoder**
decoder,
const
media_format& format);
- status_t
CreateDecoder(BDecoder** decoder,
+ status_t CreateDecoder(Decoder**
decoder,
const
media_codec_info& mci);
- status_t
GetDecoderInfo(BDecoder* decoder,
+ status_t GetDecoderInfo(Decoder*
decoder,
media_codec_info* _info) const;
- void
DestroyDecoder(BDecoder* decoder);
+ void DestroyDecoder(Decoder*
decoder);
// Writers and Encoders
- status_t CreateWriter(BWriter**
writer,
+ status_t CreateWriter(Writer**
writer,
const
media_file_format& mff,
BDataIO* target);
- void DestroyWriter(BWriter*
writer);
+ void DestroyWriter(Writer*
writer);
- status_t
CreateEncoder(BEncoder** encoder,
+ status_t CreateEncoder(Encoder**
encoder,
const
media_codec_info* codecInfo,
uint32
flags);
- status_t
CreateEncoder(BEncoder** encoder,
+ status_t CreateEncoder(Encoder**
encoder,
const
media_format& format);
- void
DestroyEncoder(BEncoder* encoder);
+ void DestroyEncoder(Encoder*
encoder);
- status_t
CreateStreamer(BStreamer** streamer,
- BUrl
url);
- void
DestroyStreamer(BStreamer* streamer);
+ status_t
CreateStreamer(Streamer** streamer,
+ BUrl
url, BDataIO** source);
+ void
DestroyStreamer(Streamer* streamer);
private:
status_t _LoadPlugin(const
entry_ref& ref,
-
BMediaPlugin** plugin, image_id* image);
+
MediaPlugin** plugin, image_id* image);
struct plugin_info {
char name[260];
int usecount;
- BMediaPlugin* plugin;
+ MediaPlugin* plugin;
image_id image;
plugin_info& operator=(const plugin_info& other)
@@ -90,11 +88,10 @@ private:
BLocker fLocker;
};
+} } // namespace BPrivate::media
-} } // namespace BCodecKit::BPrivate
-
-
-extern BCodecKit::BPrivate::PluginManager gPluginManager;
+using namespace BPrivate::media;
+extern PluginManager gPluginManager;
#endif // _PLUGIN_MANAGER_H
diff --git a/headers/os/codec/RawFormats.h b/headers/private/media/RawFormats.h
similarity index 100%
rename from headers/os/codec/RawFormats.h
rename to headers/private/media/RawFormats.h
diff --git a/headers/os/codec/Reader.h b/headers/private/media/ReaderPlugin.h
similarity index 73%
rename from headers/os/codec/Reader.h
rename to headers/private/media/ReaderPlugin.h
index fc9f4aeb75..708d5b76ba 100644
--- a/headers/os/codec/Reader.h
+++ b/headers/private/media/ReaderPlugin.h
@@ -1,35 +1,29 @@
#ifndef _READER_PLUGIN_H
#define _READER_PLUGIN_H
-
#include <MediaTrack.h>
-#include <MetaData.h>
-
#include "MediaPlugin.h"
+namespace BPrivate { namespace media {
-namespace BCodecKit {
-
-namespace BPrivate {
- class PluginManager;
-}
-
+class PluginManager;
enum {
B_MEDIA_SEEK_TO_TIME = 0x10000,
B_MEDIA_SEEK_TO_FRAME = 0x20000
};
-
-class BReader {
+class Reader {
public:
+ Reader();
+ virtual ~Reader();
+
+ virtual const char* Copyright() = 0;
+
virtual status_t Sniff(int32* streamCount) = 0;
virtual void
GetFileFormatInfo(media_file_format* mff) = 0;
-
- virtual status_t GetMetaData(BMetaData* data);
- virtual status_t GetStreamMetaData(void* cookie,
-
BMetaData* data);
+ virtual status_t GetMetaData(BMessage* _data);
virtual status_t AllocateCookie(int32
streamNumber,
void**
cookie) = 0;
@@ -49,41 +43,40 @@ public:
const
void** chunkBuffer, size_t* chunkSize,
media_header* mediaHeader) = 0;
+ virtual status_t GetStreamMetaData(void* cookie,
+
BMessage* _data);
+
BDataIO* Source() const;
virtual status_t Perform(perform_code code,
void* data);
-protected:
- BReader();
- virtual ~BReader();
-
private:
- void _Setup(BDataIO* source);
-
- BDataIO* fSource;
-
- BMediaPlugin* fMediaPlugin;
-
- // needed for plug-in reference count management
- friend class BCodecKit::BPrivate::PluginManager;
-
virtual void _ReservedReader1();
virtual void _ReservedReader2();
virtual void _ReservedReader3();
virtual void _ReservedReader4();
virtual void _ReservedReader5();
+public: // XXX for test programs only
+ void Setup(BDataIO* source);
+
+ BDataIO* fSource;
+
+ // needed for plug-in reference count management
+ friend class PluginManager;
+ MediaPlugin* fMediaPlugin;
+
uint32 fReserved[5];
};
-class BReaderPlugin : public virtual BMediaPlugin {
+class ReaderPlugin : public virtual MediaPlugin {
public:
- virtual BReader* NewReader() = 0;
+ virtual Reader* NewReader() = 0;
};
+} } // namespace BPrivate::media
-} // namespace BCodecKit
-
+using namespace BPrivate::media;
#endif // _READER_PLUGIN_H
diff --git a/headers/private/media/StreamerPlugin.h
b/headers/private/media/StreamerPlugin.h
new file mode 100644
index 0000000000..e16b3ee275
--- /dev/null
+++ b/headers/private/media/StreamerPlugin.h
@@ -0,0 +1,46 @@
+#ifndef _STREAMER_PLUGIN_H
+#define _STREAMER_PLUGIN_H
+
+
+#include <MediaIO.h>
+#include <MediaTrack.h>
+#include <Url.h>
+
+#include "MediaPlugin.h"
+
+
+namespace BPrivate { namespace media {
+
+class PluginManager;
+
+class Streamer {
+public:
+ Streamer();
+ virtual ~Streamer();
+
+ virtual status_t Sniff(const BUrl& url,
BDataIO** source) = 0;
+private:
+ virtual void _ReservedStreamer1();
+ virtual void _ReservedStreamer2();
+ virtual void _ReservedStreamer3();
+ virtual void _ReservedStreamer4();
+ virtual void _ReservedStreamer5();
+
+ MediaPlugin* fMediaPlugin;
+ uint32 fReserved[5];
+
+ friend class PluginManager;
+};
+
+
+class StreamerPlugin : public virtual MediaPlugin {
+public:
+ virtual Streamer* NewStreamer() = 0;
+};
+
+} } // namespace BPrivate::media
+
+using namespace BPrivate::media;
+
+
+#endif // _STREAMER_PLUGIN_H
diff --git a/headers/os/codec/Writer.h b/headers/private/media/WriterPlugin.h
similarity index 70%
rename from headers/os/codec/Writer.h
rename to headers/private/media/WriterPlugin.h
index d226c2de91..f906bc913d 100644
--- a/headers/os/codec/Writer.h
+++ b/headers/private/media/WriterPlugin.h
@@ -1,22 +1,21 @@
#ifndef _WRITER_PLUGIN_H
#define _WRITER_PLUGIN_H
-#include <MetaData.h>
#include <MediaTrack.h>
-
#include "MediaPlugin.h"
+namespace BPrivate { namespace media {
-namespace BCodecKit {
+class PluginManager;
-namespace BPrivate {
- class PluginManager;
-}
+class Writer {
+public:
+ Writer();
+ virtual ~Writer();
+ virtual status_t Init(const media_file_format*
fileFormat) = 0;
-class BWriter {
-public:
- virtual status_t SetMetaData(BMetaData* data) =
0;
+ virtual status_t SetCopyright(const char*
copyright) = 0;
virtual status_t CommitHeader() = 0;
virtual status_t Flush() = 0;
virtual status_t Close() = 0;
@@ -26,8 +25,8 @@ public:
const
media_codec_info* codecInfo) = 0;
virtual status_t FreeCookie(void* cookie) = 0;
- virtual status_t SetMetaData(void* cookie,
-
BMetaData* data) = 0;
+ virtual status_t SetCopyright(void* cookie,
+ const
char* copyright) = 0;
virtual status_t AddTrackInfo(void* cookie,
uint32 code,
const
void* data, size_t size,
@@ -41,43 +40,37 @@ public:
virtual status_t Perform(perform_code code,
void* data);
-protected:
- BWriter();
- virtual ~BWriter();
-
- virtual status_t Init(const media_file_format*
fileFormat) = 0;
-
private:
- void _Setup(BDataIO* target);
-
- BDataIO* fTarget;
-
- BMediaPlugin* fMediaPlugin;
-
- // needed for plug-in reference count management
- friend class BCodecKit::BPrivate::PluginManager;
- friend class BMediaWriter;
-
virtual void _ReservedWriter1();
virtual void _ReservedWriter2();
virtual void _ReservedWriter3();
virtual void _ReservedWriter4();
virtual void _ReservedWriter5();
+public: // XXX for test programs only
+ void Setup(BDataIO* target);
+
+ BDataIO* fTarget;
+
+ // needed for plug-in reference count management
+ friend class PluginManager;
+ MediaPlugin* fMediaPlugin;
+
uint32 fReserved[5];
};
-class BWriterPlugin : public virtual BMediaPlugin {
+class WriterPlugin : public virtual MediaPlugin {
public:
- virtual BWriter* NewWriter() = 0;
+ virtual Writer* NewWriter() = 0;
virtual status_t GetSupportedFileFormats(
const
media_file_format** _fileFormats,
size_t*
_count) = 0;
-};
+};
-} // namespace BCodecKit
+} } // namespace BPrivate::media
+using namespace BPrivate::media;
#endif // _WRITER_PLUGIN_H
diff --git a/headers/os/codec/AdapterIO.h
b/headers/private/media/experimental/AdapterIO.h
similarity index 96%
rename from headers/os/codec/AdapterIO.h
rename to headers/private/media/experimental/AdapterIO.h
index 9b35956dc3..81910065e3 100644
--- a/headers/os/codec/AdapterIO.h
+++ b/headers/private/media/experimental/AdapterIO.h
@@ -8,15 +8,10 @@
#include <MediaIO.h>
#include <OS.h>
+#include <RWLocker.h>
#include <SupportDefs.h>
-class RWLocker;
-
-
-namespace BCodecKit {
-
-
class BAdapterIO;
class RelativePositionIO;
@@ -100,8 +95,4 @@ private:
uint32 _reserved[5];
};
-
-} // namespace BCodecKit
-
-
#endif // _ADAPTER_IO_H
diff --git a/headers/os/codec/MediaIO.h
b/headers/private/media/experimental/MediaIO.h
similarity index 94%
rename from headers/os/codec/MediaIO.h
rename to headers/private/media/experimental/MediaIO.h
index 1a86862a99..260c4de131 100644
--- a/headers/os/codec/MediaIO.h
+++ b/headers/private/media/experimental/MediaIO.h
@@ -10,9 +10,6 @@
#include <SupportDefs.h>
-namespace BCodecKit {
-
-
enum media_io_flags {
B_MEDIA_STREAMING = 0x00000001,
@@ -44,8 +41,4 @@ private:
uint32 _reserved[5];
};
-
-} // namespace BCodecKit
-
-
#endif // _MEDIA_IO_H
diff --git a/src/add-ons/media/plugins/Jamfile
b/src/add-ons/media/plugins/Jamfile
index 00a32d7408..18fac0b190 100644
--- a/src/add-ons/media/plugins/Jamfile
+++ b/src/add-ons/media/plugins/Jamfile
@@ -2,8 +2,8 @@ SubDir HAIKU_TOP src add-ons media plugins ;
SubInclude HAIKU_TOP src add-ons media plugins ape_reader ;
SubInclude HAIKU_TOP src add-ons media plugins au_reader ;
-SubInclude HAIKU_TOP src add-ons media plugins dvd_streamer ;
SubInclude HAIKU_TOP src add-ons media plugins ffmpeg ;
+SubInclude HAIKU_TOP src add-ons media plugins dvd_streamer ;
SubInclude HAIKU_TOP src add-ons media plugins http_streamer ;
SubInclude HAIKU_TOP src add-ons media plugins raw_decoder ;
SubInclude HAIKU_TOP src add-ons media plugins rtsp_streamer ;
diff --git a/src/add-ons/media/plugins/ape_reader/APEReader.cpp
b/src/add-ons/media/plugins/ape_reader/APEReader.cpp
index 96475f6a17..09c1a21609 100644
--- a/src/add-ons/media/plugins/ape_reader/APEReader.cpp
+++ b/src/add-ons/media/plugins/ape_reader/APEReader.cpp
@@ -10,13 +10,6 @@
#include "MACLib.h"
-B_DECLARE_CODEC_KIT_PLUGIN(
- TAPEReaderPlugin,
- "ape_reader",
- B_CODEC_KIT_PLUGIN_VERSION
-);
-
-
static const char* kCopyrightString
= "Copyright " B_UTF8_COPYRIGHT " 2005-2009 by SHINTA";
@@ -280,8 +273,15 @@ TAPEReaderPlugin::~TAPEReaderPlugin()
}
-BReader*
+Reader*
TAPEReaderPlugin::NewReader()
{
return new TAPEReader();
}
+
+
+MediaPlugin*
+instantiate_plugin()
+{
+ return new TAPEReaderPlugin();
+}
diff --git a/src/add-ons/media/plugins/ape_reader/APEReader.h
b/src/add-ons/media/plugins/ape_reader/APEReader.h
index dc297bdcb6..8ca5333cbc 100644
--- a/src/add-ons/media/plugins/ape_reader/APEReader.h
+++ b/src/add-ons/media/plugins/ape_reader/APEReader.h
@@ -6,9 +6,7 @@
#include "MonkeysAudioMIMEType.h"
#include "PositionBridgeIO.h"
-#include "Reader.h" // Haiku private header
-
-using namespace BCodecKit;
+#include "ReaderPlugin.h" // Haiku private header
const int32 BLOCK_COUNT = 1024*4; // number of blocks, get from
MACLib at once
@@ -16,7 +14,7 @@ const int32 BUFFER_SIZE = 1024*4; // size of
audio data passing to Media Kit
const int32 MEDIA_FILE_FORMAT_VERSION = 100; //
media_file_format::version
-class TAPEReader : public BReader
+class TAPEReader : public Reader
{
public:
TAPEReader();
@@ -45,7 +43,7 @@ public:
size_t*
oChunkSize, media_header* oMediaHeader);
private:
- typedef BReader SUPER;
+ typedef Reader SUPER;
bigtime_t CurrentTime() const;
status_t LoadAPECheck() const;
@@ -64,14 +62,17 @@ private:
};
-class TAPEReaderPlugin : public BReaderPlugin
+class TAPEReaderPlugin : public ReaderPlugin
{
public:
TAPEReaderPlugin();
virtual ~TAPEReaderPlugin();
- virtual BReader* NewReader();
+ virtual Reader* NewReader();
};
+MediaPlugin* instantiate_plugin();
+
+
#endif // ___APEReader_H_
diff --git a/src/add-ons/media/plugins/ape_reader/Jamfile
b/src/add-ons/media/plugins/ape_reader/Jamfile
index 8b8a555e8b..af9b74cdff 100644
--- a/src/add-ons/media/plugins/ape_reader/Jamfile
+++ b/src/add-ons/media/plugins/ape_reader/Jamfile
@@ -14,7 +14,7 @@ for architectureObject in [ MultiArchSubDirSetup ] {
Addon [ MultiArchDefaultGristFiles ape_reader ] :
APEReader.cpp
: [ MultiArchDefaultGristFiles libMonkeysAudio.a
MAClib.a ]
- be codec media [ TargetLibsupc++ ]
+ be media [ TargetLibsupc++ ]
;
}
}
diff --git a/src/add-ons/media/plugins/dvd_streamer/DVDMediaIO.cpp
b/src/add-ons/media/plugins/dvd_streamer/DVDMediaIO.cpp
index 728108afb0..3a8ee8276f 100644
--- a/src/add-ons/media/plugins/dvd_streamer/DVDMediaIO.cpp
+++ b/src/add-ons/media/plugins/dvd_streamer/DVDMediaIO.cpp
@@ -15,8 +15,6 @@
#include "MediaDebug.h"
-using namespace BCodecKit;
-
#define DVD_READ_CACHE 1
@@ -194,7 +192,7 @@ DVDMediaIO::HandleDVDEvent(int event, int len)
dvdnav_highlight_event_t* highlight_event
= (dvdnav_highlight_event_t*) fBuffer;
TRACE("DVDMediaIO::HandleDVDEvent: Button: %d\n",
- highlight_event->buttonN);
+ highlight_event->buttonN);
break;
}
diff --git a/src/add-ons/media/plugins/dvd_streamer/DVDMediaIO.h
b/src/add-ons/media/plugins/dvd_streamer/DVDMediaIO.h
index 93ee1a80ad..71acd23e50 100644
--- a/src/add-ons/media/plugins/dvd_streamer/DVDMediaIO.h
+++ b/src/add-ons/media/plugins/dvd_streamer/DVDMediaIO.h
@@ -13,10 +13,6 @@
#include <dvdnav/dvdnav.h>
-using BCodecKit::BAdapterIO;
-using BCodecKit::BInputAdapter;
-
-
class DVDMediaIO : public BAdapterIO
{
public:
diff --git a/src/add-ons/media/plugins/dvd_streamer/DVDStreamerPlugin.cpp
b/src/add-ons/media/plugins/dvd_streamer/DVDStreamerPlugin.cpp
index 03bea33c3d..110ba94c3a 100644
--- a/src/add-ons/media/plugins/dvd_streamer/DVDStreamerPlugin.cpp
+++ b/src/add-ons/media/plugins/dvd_streamer/DVDStreamerPlugin.cpp
@@ -28,35 +28,29 @@ DVDStreamer::~DVDStreamer()
status_t
-DVDStreamer::Sniff(const BUrl& url)
+DVDStreamer::Sniff(const BUrl& url, BDataIO** source)
{
BString path = url.UrlString();
BString protocol = url.Protocol();
if (protocol == "dvd") {
path = path.RemoveFirst("dvd://");
} else if (protocol == "file") {
- path = path.RemoveFirst("file://");
+ path = path.RemoveFirst("file://");
} else
return B_UNSUPPORTED;
DVDMediaIO* adapter = new DVDMediaIO(path);
status_t ret = adapter->Open();
if (ret == B_OK) {
- fAdapter = adapter;
+ *source = adapter;
return B_OK;
}
delete adapter;
- return ret;
-}
-
-
-BMediaIO*
-DVDStreamer::Adapter() const
-{
- return fAdapter;
+ return ret;
}
+#if 0
void
DVDStreamer::MouseMoved(uint32 x, uint32 y)
{
@@ -69,10 +63,18 @@ DVDStreamer::MouseDown(uint32 x, uint32 y)
{
fAdapter->MouseDown(x, y);
}
+#endif
-BStreamer*
+Streamer*
DVDStreamerPlugin::NewStreamer()
{
return new DVDStreamer();
}
+
+
+MediaPlugin*
+instantiate_plugin()
+{
+ return new DVDStreamerPlugin();
+}
diff --git a/src/add-ons/media/plugins/dvd_streamer/DVDStreamerPlugin.h
b/src/add-ons/media/plugins/dvd_streamer/DVDStreamerPlugin.h
index 55f46742fe..1f89ec54da 100644
--- a/src/add-ons/media/plugins/dvd_streamer/DVDStreamerPlugin.h
+++ b/src/add-ons/media/plugins/dvd_streamer/DVDStreamerPlugin.h
@@ -6,35 +6,27 @@
#define _DVD_STREAMER_PLUGIN_H
-#include <Streamer.h>
+#include "StreamerPlugin.h"
-#include "DVDMediaIO.h"
-
-using BCodecKit::BMediaIO;
-using BCodecKit::BStreamer;
-using BCodecKit::BStreamerPlugin;
-
-
-class DVDStreamer : public BStreamer
+class DVDStreamer : public Streamer
{
public:
DVDStreamer();
virtual ~DVDStreamer();
- virtual status_t Sniff(const BUrl& url);
- virtual BMediaIO* Adapter() const;
+ virtual status_t Sniff(const BUrl& url,
BDataIO**);
+#if 0
virtual void MouseMoved(uint32 x, uint32 y);
virtual void MouseDown(uint32 x, uint32 y);
-
-private:
- DVDMediaIO* fAdapter;
+#endif
};
-class DVDStreamerPlugin : public BStreamerPlugin {
+class DVDStreamerPlugin : public StreamerPlugin
+{
public:
- virtual BStreamer* NewStreamer();
+ virtual Streamer* NewStreamer();
};
diff --git a/src/add-ons/media/plugins/dvd_streamer/Jamfile
b/src/add-ons/media/plugins/dvd_streamer/Jamfile
index a9e939a5be..3a179b1a0e 100644
--- a/src/add-ons/media/plugins/dvd_streamer/Jamfile
+++ b/src/add-ons/media/plugins/dvd_streamer/Jamfile
@@ -1,7 +1,7 @@
SubDir HAIKU_TOP src add-ons media plugins dvd_streamer ;
-# For MediaDebug.h
-UsePrivateHeaders media ;
+UsePrivateHeaders media shared ;
+UsePrivateHeaders [ FDirName media experimental ] ;
local architectureObject ;
for architectureObject in [ MultiArchSubDirSetup ] {
@@ -25,7 +25,7 @@ for architectureObject in [ MultiArchSubDirSetup ] {
DVDMediaIO.cpp
:
[ BuildFeatureAttribute libdvdnav : libraries ]
- be codec shared
+ be media shared
[ TargetLibstdc++ ] [ TargetLibsupc++ ]
;
}
diff --git a/src/add-ons/media/plugins/ffmpeg/AVCodecDecoder.h
b/src/add-ons/media/plugins/ffmpeg/AVCodecDecoder.h
index 3d89cb9dbc..322cda65f6 100644
--- a/src/add-ons/media/plugins/ffmpeg/AVCodecDecoder.h
+++ b/src/add-ons/media/plugins/ffmpeg/AVCodecDecoder.h
@@ -13,11 +13,9 @@
//! libavcodec based decoder for Haiku
-#include <Decoder.h>
+
#include <MediaFormats.h>
-#include <Reader.h>
-using namespace BCodecKit;
extern "C" {
#include "avcodec.h"
@@ -30,6 +28,10 @@ extern "C" {
#include "timestamp.h"
}
+
+#include "DecoderPlugin.h"
+#include "ReaderPlugin.h"
+
#include "CodecTable.h"
#include "gfx_util.h"
@@ -44,7 +46,7 @@ extern "C" {
#endif
-class AVCodecDecoder : public BDecoder {
+class AVCodecDecoder : public Decoder {
public:
AVCodecDecoder();
diff --git a/src/add-ons/media/plugins/ffmpeg/AVCodecEncoder.cpp
b/src/add-ons/media/plugins/ffmpeg/AVCodecEncoder.cpp
index 3e6615c233..1a5498f3cc 100644
--- a/src/add-ons/media/plugins/ffmpeg/AVCodecEncoder.cpp
+++ b/src/add-ons/media/plugins/ffmpeg/AVCodecEncoder.cpp
@@ -39,7 +39,7 @@ static const size_t kDefaultChunkBufferSize = 2 * 1024 * 1024;
AVCodecEncoder::AVCodecEncoder(uint32 codecID, int bitRateScale)
:
- BEncoder(),
+ Encoder(),
fBitRateScale(bitRateScale),
fCodecID((CodecID)codecID),
fCodec(NULL),
diff --git a/src/add-ons/media/plugins/ffmpeg/AVCodecEncoder.h
b/src/add-ons/media/plugins/ffmpeg/AVCodecEncoder.h
index 6bbbec41a0..f120c7c88e 100644
--- a/src/add-ons/media/plugins/ffmpeg/AVCodecEncoder.h
+++ b/src/add-ons/media/plugins/ffmpeg/AVCodecEncoder.h
@@ -6,22 +6,21 @@
#define AVCODEC_ENCODER_H
-#include <Encoder.h>
#include <MediaFormats.h>
-using namespace BCodecKit;
-
extern "C" {
#include "avcodec.h"
#include "swscale.h"
#include "libavutil/fifo.h"
}
+#include "EncoderPlugin.h"
+
typedef AVCodecID CodecID;
-class AVCodecEncoder : public BEncoder {
+class AVCodecEncoder : public Encoder {
public:
AVCodecEncoder(uint32 codecID,
int
bitRateScale);
diff --git a/src/add-ons/media/plugins/ffmpeg/AVFormatReader.cpp
b/src/add-ons/media/plugins/ffmpeg/AVFormatReader.cpp
index 7b3f2c037a..463272c2a3 100644
--- a/src/add-ons/media/plugins/ffmpeg/AVFormatReader.cpp
+++ b/src/add-ons/media/plugins/ffmpeg/AVFormatReader.cpp
@@ -58,7 +58,7 @@ avformat_to_beos_byte_order(AVSampleFormat format)
static void
-avdictionary_to_message(AVDictionary* dictionary, BMetaData* data)
+avdictionary_to_message(AVDictionary* dictionary, BMessage* message)
{
if (dictionary == NULL)
return;
@@ -69,45 +69,45 @@ avdictionary_to_message(AVDictionary* dictionary,
BMetaData* data)
// convert entry keys into something more meaningful using the
names from
// id3v2.c
if (strcmp(entry->key, "TALB") == 0 || strcmp(entry->key,
"TAL") == 0)
- data->SetString(kAlbum, entry->value);
+ message->AddString("album", entry->value);
else if (strcmp(entry->key, "TCOM") == 0)
- data->SetString(kComposer, entry->value);
+ message->AddString("composer", entry->value);
else if (strcmp(entry->key, "TCON") == 0 || strcmp(entry->key,
"TCO") == 0)
- data->SetString(kGenre, entry->value);
+ message->AddString("genre", entry->value);
else if (strcmp(entry->key, "TCOP") == 0)
- data->SetString(kCopyright, entry->value);
+ message->AddString("copyright", entry->value);
else if (strcmp(entry->key, "TDRL") == 0 || strcmp(entry->key,
"TDRC") == 0)
- data->SetString(kDate, entry->value);
+ message->AddString("date", entry->value);
else if (strcmp(entry->key, "TENC") == 0 || strcmp(entry->key,
"TEN") == 0)
- data->SetString(kEncodedBy, entry->value);
+ message->AddString("encoded_by", entry->value);
else if (strcmp(entry->key, "TIT2") == 0 || strcmp(entry->key,
"TT2") == 0)
- data->SetString(kTitle, entry->value);
+ message->AddString("title", entry->value);
else if (strcmp(entry->key, "TLAN") == 0)
- data->SetString(kLanguage, entry->value);
+ message->AddString("language", entry->value);
else if (strcmp(entry->key, "TPE1") == 0 || strcmp(entry->key,
"TP1") == 0)
- data->SetString(kArtist, entry->value);
+ message->AddString("artist", entry->value);
else if (strcmp(entry->key, "TPE2") == 0 || strcmp(entry->key,
"TP2") == 0)
- data->SetString(kAlbumArtist, entry->value);
+ message->AddString("album_artist", entry->value);
else if (strcmp(entry->key, "TPE3") == 0 || strcmp(entry->key,
"TP3") == 0)
- data->SetString(kPerformer, entry->value);
+ message->AddString("performer", entry->value);
else if (strcmp(entry->key, "TPOS") == 0)
- data->SetString(kDisc, entry->value);
+ message->AddString("disc", entry->value);
else if (strcmp(entry->key, "TPUB") == 0)
- data->SetString(kPublisher, entry->value);
+ message->AddString("publisher", entry->value);
else if (strcmp(entry->key, "TRCK") == 0 || strcmp(entry->key,
"TRK") == 0)
- data->SetString(kTrack, entry->value);
+ message->AddString("track", entry->value);
else if (strcmp(entry->key, "TSOA") == 0)
- data->SetString("album-sort", entry->value);
+ message->AddString("album-sort", entry->value);
else if (strcmp(entry->key, "TSOP") == 0)
- data->SetString("artist-sort", entry->value);
+ message->AddString("artist-sort", entry->value);
else if (strcmp(entry->key, "TSOT") == 0)
- data->SetString("title-sort", entry->value);
+ message->AddString("title-sort", entry->value);
else if (strcmp(entry->key, "TSSE") == 0)
- data->SetString(kEncoder, entry->value);
+ message->AddString("encoder", entry->value);
else if (strcmp(entry->key, "TYER") == 0)
- data->SetString(kYear, entry->value);
+ message->AddString("year", entry->value);
else
- data->SetString(entry->key, entry->value);
+ message->AddString(entry->key, entry->value);
}
}
@@ -900,7 +900,7 @@ public:
// This will also initialize the media_format.
virtual status_t Init(int32 streamIndex);
- status_t GetMetaData(BMetaData*
data);
+ status_t GetMetaData(BMessage*
data);
// Support for AVFormatReader
status_t GetStreamInfo(int64*
frameCount,
@@ -1181,7 +1181,7 @@ AVFormatReader::Stream::Init(int32 virtualIndex)
status_t
-AVFormatReader::Stream::GetMetaData(BMetaData* data)
+AVFormatReader::Stream::GetMetaData(BMessage* data)
{
BAutolock _(&fLock);
@@ -1441,6 +1441,18 @@ AVFormatReader::~AVFormatReader()
// #pragma mark -
+const char*
+AVFormatReader::Copyright()
+{
+ if (fCopyright.Length() <= 0) {
+ BMessage message;
+ if (GetMetaData(&message) == B_OK)
+ message.FindString("copyright", &fCopyright);
+ }
+ return fCopyright.String();
+}
+
+
status_t
AVFormatReader::Sniff(int32* _streamCount)
{
@@ -1563,7 +1575,7 @@ AVFormatReader::GetFileFormatInfo(media_file_format* mff)
status_t
-AVFormatReader::GetMetaData(BMetaData* data)
+AVFormatReader::GetMetaData(BMessage* _data)
{
// The first cookie is always there!
const AVFormatContext* context = fStreams[0]->Context();
@@ -1571,28 +1583,28 @@ AVFormatReader::GetMetaData(BMetaData* data)
if (context == NULL)
return B_NO_INIT;
- avdictionary_to_message(context->metadata, data);
+ avdictionary_to_message(context->metadata, _data);
// Add chapter info
for (unsigned i = 0; i < context->nb_chapters; i++) {
AVChapter* chapter = context->chapters[i];
- BMetaData chapterData;
- chapterData.SetUInt64(kChapterStart, bigtime_t(1000000.0
+ BMessage chapterData;
+ chapterData.AddInt64("start", bigtime_t(1000000.0
* chapter->start * chapter->time_base.num
/ chapter->time_base.den + 0.5));
- chapterData.SetUInt64(kChapterEnd, bigtime_t(1000000.0
+ chapterData.AddInt64("end", bigtime_t(1000000.0
* chapter->end * chapter->time_base.num
/ chapter->time_base.den + 0.5));
avdictionary_to_message(chapter->metadata, &chapterData);
- data->AddMetaData(kChapter, &chapterData);
+ _data->AddMessage("be:chapter", &chapterData);
}
// Add program info
for (unsigned i = 0; i < context->nb_programs; i++) {
- BMetaData programData;
+ BMessage programData;
avdictionary_to_message(context->programs[i]->metadata,
&programData);
- data->AddMetaData(kProgramData, &programData);
+ _data->AddMessage("be:program", &programData);
}
return B_OK;
@@ -1691,10 +1703,10 @@ AVFormatReader::GetStreamInfo(void* _cookie, int64*
frameCount,
status_t
-AVFormatReader::GetStreamMetaData(void* _cookie, BMetaData* data)
+AVFormatReader::GetStreamMetaData(void* _cookie, BMessage* _data)
{
Stream* cookie = reinterpret_cast<Stream*>(_cookie);
- return cookie->GetMetaData(data);
+ return cookie->GetMetaData(_data);
}
diff --git a/src/add-ons/media/plugins/ffmpeg/AVFormatReader.h
b/src/add-ons/media/plugins/ffmpeg/AVFormatReader.h
index f0ca4db463..9ffa4570dd 100644
--- a/src/add-ons/media/plugins/ffmpeg/AVFormatReader.h
+++ b/src/add-ons/media/plugins/ffmpeg/AVFormatReader.h
@@ -6,22 +6,23 @@
#define AV_FORMAT_READER_H
-#include <Reader.h>
#include <Locker.h>
#include <String.h>
-using namespace BCodecKit;
+#include "ReaderPlugin.h"
-class AVFormatReader : public BReader {
+class AVFormatReader : public Reader {
public:
AVFormatReader();
~AVFormatReader();
+ virtual const char* Copyright();
+
virtual status_t Sniff(int32* streamCount);
virtual void
GetFileFormatInfo(media_file_format* mff);
- virtual status_t GetMetaData(BMetaData* data);
+ virtual status_t GetMetaData(BMessage* _data);
virtual status_t AllocateCookie(int32
streamNumber,
void**
cookie);
@@ -33,7 +34,7 @@ public:
size_t*
infoSize);
virtual status_t GetStreamMetaData(void* cookie,
-
BMetaData* data);
+
BMessage* _data);
virtual status_t Seek(void* cookie, uint32
flags, int64* frame,
bigtime_t* time);
diff --git a/src/add-ons/media/plugins/ffmpeg/AVFormatWriter.cpp
b/src/add-ons/media/plugins/ffmpeg/AVFormatWriter.cpp
index 3a6f57c3c8..61e4c14a77 100644
--- a/src/add-ons/media/plugins/ffmpeg/AVFormatWriter.cpp
+++ b/src/add-ons/media/plugins/ffmpeg/AVFormatWriter.cpp
@@ -425,7 +425,7 @@ AVFormatWriter::Init(const media_file_format* fileFormat)
status_t
-AVFormatWriter::SetMetaData(BMetaData* data)
+AVFormatWriter::SetCopyright(const char* copyright)
{
TRACE("AVFormatWriter::SetCopyright(%s)\n", copyright);
@@ -541,9 +541,9 @@ AVFormatWriter::FreeCookie(void* _cookie)
status_t
-AVFormatWriter::SetMetaData(void* cookie, BMetaData* data)
+AVFormatWriter::SetCopyright(void* cookie, const char* copyright)
{
- TRACE("AVFormatWriter::SetMetaData(%p)\n", cookie);
+ TRACE("AVFormatWriter::SetCopyright(%p, %s)\n", cookie, copyright);
return B_NOT_SUPPORTED;
}
@@ -590,7 +590,7 @@ AVFormatWriter::_Write(void* cookie, uint8* buffer, int
bufferSize)
AVFormatWriter* writer = reinterpret_cast<AVFormatWriter*>(cookie);
- ssize_t written = writer->Target()->Write(buffer, bufferSize);
+ ssize_t written = writer->fTarget->Write(buffer, bufferSize);
TRACE_IO(" written: %ld\n", written);
return (int)written;
@@ -606,7 +606,7 @@ AVFormatWriter::_Seek(void* cookie, off_t offset, int
whence)
AVFormatWriter* writer = reinterpret_cast<AVFormatWriter*>(cookie);
- BMediaIO* mediaIO = dynamic_cast<BMediaIO*>(writer->Target());
+ BMediaIO* mediaIO = dynamic_cast<BMediaIO*>(writer->fTarget);
if (mediaIO == NULL)
return -1;
diff --git a/src/add-ons/media/plugins/ffmpeg/AVFormatWriter.h
b/src/add-ons/media/plugins/ffmpeg/AVFormatWriter.h
index 1c1c2770b2..06ef048661 100644
--- a/src/add-ons/media/plugins/ffmpeg/AVFormatWriter.h
+++ b/src/add-ons/media/plugins/ffmpeg/AVFormatWriter.h
@@ -6,25 +6,23 @@
#define AV_FORMAT_WRITER_H
-#include <Writer.h>
#include <Locker.h>
-using namespace BCodecKit;
-
+#include "WriterPlugin.h"
extern "C" {
#include "avformat.h"
}
-class AVFormatWriter : public BWriter {
+class AVFormatWriter : public Writer {
public:
AVFormatWriter();
~AVFormatWriter();
virtual status_t Init(const media_file_format*
fileFormat);
- virtual status_t SetMetaData(BMetaData* data);
+ virtual status_t SetCopyright(const char*
copyright);
virtual status_t CommitHeader();
virtual status_t Flush();
virtual status_t Close();
@@ -34,8 +32,8 @@ public:
const
media_codec_info* codecInfo);
virtual status_t FreeCookie(void* cookie);
- virtual status_t SetMetaData(void* cookie,
-
BMetaData* data);
+ virtual status_t SetCopyright(void* cookie,
+ const
char* copyright);
virtual status_t AddTrackInfo(void* cookie,
uint32 code,
const
void* data, size_t size,
diff --git a/src/add-ons/media/plugins/ffmpeg/FFmpegPlugin.cpp
b/src/add-ons/media/plugins/ffmpeg/FFmpegPlugin.cpp
index c83182c7a7..8e84c68b63 100644
--- a/src/add-ons/media/plugins/ffmpeg/FFmpegPlugin.cpp
+++ b/src/add-ons/media/plugins/ffmpeg/FFmpegPlugin.cpp
@@ -4,7 +4,6 @@
* Copyright (C) 2001 Axel Dörfler
* Copyright (C) 2004 Marcus Overhagen
* Copyright (C) 2009 Stephan Aßmus <superstippi@xxxxxx>
- * Copyright (C) 2018 Dario Casalinuovo
*
* All rights reserved. Distributed under the terms of the MIT License.
*/
@@ -41,17 +40,10 @@ extern "C" {
#define ERROR(a...) fprintf(stderr, a)
-B_DECLARE_CODEC_KIT_PLUGIN(
- FFmpegPlugin,
- "ffmpeg",
- B_CODEC_KIT_PLUGIN_VERSION
-);
-
-
// #pragma mark -
-BDecoder*
+Decoder*
FFmpegPlugin::NewDecoder(uint index)
{
// TODO: Confirm we can check index here.
@@ -61,7 +53,7 @@ FFmpegPlugin::NewDecoder(uint index)
}
-BReader*
+Reader*
FFmpegPlugin::NewReader()
{
return new(std::nothrow) AVFormatReader();
@@ -75,7 +67,7 @@ FFmpegPlugin::GetSupportedFormats(media_format** _formats,
size_t* _count)
}
-BWriter*
+Writer*
FFmpegPlugin::NewWriter()
{
return new(std::nothrow) AVFormatWriter();
@@ -92,7 +84,7 @@ FFmpegPlugin::GetSupportedFileFormats(const
media_file_format** _fileFormats,
}
-BEncoder*
+Encoder*
FFmpegPlugin::NewEncoder(const media_codec_info& codecInfo)
{
for (size_t i = 0; i < gEncoderCount; i++) {
@@ -105,7 +97,7 @@ FFmpegPlugin::NewEncoder(const media_codec_info& codecInfo)
}
-BEncoder*
+Encoder*
FFmpegPlugin::NewEncoder(const media_format& format)
{
for (size_t i = 0; i < gEncoderCount; i++) {
@@ -136,3 +128,14 @@ FFmpegPlugin::RegisterNextEncoder(int32* cookie,
media_codec_info* _codecInfo,
return B_OK;
}
+
+
+// #pragma mark -
+
+
+MediaPlugin*
+instantiate_plugin()
+{
+ return new(std::nothrow) FFmpegPlugin;
+}
+
diff --git a/src/add-ons/media/plugins/ffmpeg/FFmpegPlugin.h
b/src/add-ons/media/plugins/ffmpeg/FFmpegPlugin.h
index b7a4cb0fa2..66c0935750 100644
--- a/src/add-ons/media/plugins/ffmpeg/FFmpegPlugin.h
+++ b/src/add-ons/media/plugins/ffmpeg/FFmpegPlugin.h
@@ -12,32 +12,30 @@
#include <MediaFormats.h>
-#include <Decoder.h>
-#include <Encoder.h>
-#include <Reader.h>
-#include <Writer.h>
+#include "DecoderPlugin.h"
+#include "EncoderPlugin.h"
+#include "ReaderPlugin.h"
+#include "WriterPlugin.h"
-using namespace BCodecKit;
-
-class FFmpegPlugin : public BReaderPlugin, public BDecoderPlugin,
- public BWriterPlugin, public BEncoderPlugin {
+class FFmpegPlugin : public ReaderPlugin, public DecoderPlugin,
+ public WriterPlugin, public EncoderPlugin {
public:
- virtual BReader* NewReader();
+ virtual Reader* NewReader();
[ *** diff truncated: 4601 lines dropped *** ]