hrev52600 adds 4 changesets to branch 'master'
old head: 247414814e197a9c25ef75142c112e0a389d53e9
new head: 278d03da22e10187dbcd7f9109e0b28a85c67557
overview:
https://git.haiku-os.org/haiku/log/?qt=range&q=278d03da22e1+%5E247414814e19
----------------------------------------------------------------------------
d33bd9ec7b1e: Codec Kit: Introduce BCodecKit namespace
fe9542fdb54c: BCodecRoster: Add useful functionality from MediaFormats
5232a9113610: media_plugins: Rework to use the BCodecKit namespace
278d03da22e1: media_kit: Remove most private dependencies from codec_kit
* Move to BCodecKit namespace and make extensive use
of BCodecRoster.
* This is a first step in the right direction of
decreasing private dependencies. Some APIs are being
translated to the CodecKit. I am doing an investigation
on which APIs are really used among apps, so that the new
kit can be more slim and oriented toward easy development
and can be extended in the right direction instead to
continue maintaning unuseful code.
* BMediaFormats needs still a bit of love.
* General improvements in style and code maintainability.
[ Barrett17 <b.vitruvio@xxxxxxxxx> ]
----------------------------------------------------------------------------
51 files changed, 420 insertions(+), 233 deletions(-)
headers/os/codec/AdapterIO.h | 7 ++
headers/os/codec/CodecRoster.h | 38 +++++--
headers/os/codec/Decoder.h | 13 ++-
headers/os/codec/Encoder.h | 14 +--
headers/os/codec/MediaExtractor.h | 10 +-
headers/os/codec/MediaIO.h | 7 ++
headers/os/codec/MediaPlugin.h | 18 ++--
headers/os/codec/MediaStreamer.h | 10 +-
headers/os/codec/MediaWriter.h | 9 +-
headers/os/codec/MetaData.h | 9 +-
headers/os/codec/Reader.h | 14 +--
headers/os/codec/Streamer.h | 15 ++-
headers/os/codec/Writer.h | 15 +--
headers/os/media/MediaDecoder.h | 16 ++-
headers/os/media/MediaEncoder.h | 12 +--
headers/os/media/MediaFile.h | 17 +--
headers/os/media/MediaTrack.h | 18 ++--
headers/private/codec/AddOnManager.h | 7 +-
headers/private/codec/PluginManager.h | 12 ++-
.../media/plugins/ffmpeg/AVCodecDecoder.h | 1 +
.../media/plugins/ffmpeg/AVCodecEncoder.h | 1 +
.../media/plugins/ffmpeg/AVFormatReader.h | 2 +
.../media/plugins/ffmpeg/AVFormatWriter.h | 2 +
src/add-ons/media/plugins/ffmpeg/FFmpegPlugin.h | 2 +
.../media/plugins/http_streamer/HTTPMediaIO.cpp | 2 +
.../media/plugins/http_streamer/HTTPMediaIO.h | 3 +
.../plugins/http_streamer/HTTPStreamerPlugin.h | 4 +
.../media/plugins/raw_decoder/RawDecoderPlugin.h | 4 +
src/kits/codec/AdapterIO.cpp | 8 +-
src/kits/codec/AddOnManager.cpp | 5 +-
src/kits/codec/ChunkCache.cpp | 8 ++
src/kits/codec/ChunkCache.h | 6 +-
src/kits/codec/CodecRoster.cpp | 45 ++++++++
src/kits/codec/Decoder.cpp | 6 ++
src/kits/codec/Encoder.cpp | 6 ++
src/kits/codec/MediaExtractor.cpp | 11 +-
src/kits/codec/MediaIO.cpp | 6 ++
src/kits/codec/MediaPlugin.cpp | 6 ++
src/kits/codec/MediaStreamer.cpp | 6 ++
src/kits/codec/MediaWriter.cpp | 6 ++
src/kits/codec/MetaData.cpp | 103 ++++++++++---------
src/kits/codec/PluginManager.cpp | 12 ++-
src/kits/codec/Reader.cpp | 6 ++
src/kits/codec/Streamer.cpp | 6 ++
src/kits/codec/Writer.cpp | 6 ++
src/kits/media/MediaDecoder.cpp | 25 +++--
src/kits/media/MediaDefs.cpp | 15 +--
src/kits/media/MediaEncoder.cpp | 11 +-
src/kits/media/MediaFile.cpp | 15 +--
src/kits/media/MediaFormats.cpp | 24 ++---
src/kits/media/MediaTrack.cpp | 29 +++---
############################################################################
Commit: d33bd9ec7b1eeb693eb9971bb24aacee02e60170
URL: https://git.haiku-os.org/haiku/commit/?id=d33bd9ec7b1e
Author: Barrett17 <b.vitruvio@xxxxxxxxx>
Date: Mon Nov 26 12:18:35 2018 UTC
Codec Kit: Introduce BCodecKit namespace
----------------------------------------------------------------------------
diff --git a/headers/os/codec/AdapterIO.h b/headers/os/codec/AdapterIO.h
index 81910065e3..82ef19b4a2 100644
--- a/headers/os/codec/AdapterIO.h
+++ b/headers/os/codec/AdapterIO.h
@@ -12,6 +12,9 @@
#include <SupportDefs.h>
+namespace BCodecKit {
+
+
class BAdapterIO;
class RelativePositionIO;
@@ -95,4 +98,8 @@ private:
uint32 _reserved[5];
};
+
+} // namespace BCodecKit
+
+
#endif // _ADAPTER_IO_H
diff --git a/headers/os/codec/CodecRoster.h b/headers/os/codec/CodecRoster.h
index 1d8bd2a746..b7be6c4657 100644
--- a/headers/os/codec/CodecRoster.h
+++ b/headers/os/codec/CodecRoster.h
@@ -5,6 +5,7 @@
#ifndef _CODEC_ROSTER_H
#define _CODEC_ROSTER_H
+
#include <Decoder.h>
#include <Encoder.h>
#include <MediaDefs.h>
@@ -13,8 +14,7 @@
#include <Writer.h>
-namespace BPrivate {
-namespace media {
+namespace BCodecKit {
class BCodecRoster {
@@ -118,9 +118,8 @@ public:
static status_t GetNextEncoder(int32* cookie, media_codec_info*
_codecInfo);
};
-} // namespace media
-} // namespace BPrivate
-using namespace BPrivate::media;
+} // namespace BCodecKit
+
#endif // _CODEC_ROSTER_H
diff --git a/headers/os/codec/Decoder.h b/headers/os/codec/Decoder.h
index a2f65dc53b..8dfcdda74a 100644
--- a/headers/os/codec/Decoder.h
+++ b/headers/os/codec/Decoder.h
@@ -8,9 +8,12 @@
#include "MediaPlugin.h"
-namespace BPrivate { namespace media {
+namespace BCodecKit {
+
+namespace BPrivate {
+ class PluginManager;
+}
-class PluginManager;
class BChunkProvider {
public:
@@ -63,7 +66,7 @@ private:
BMediaPlugin* fMediaPlugin;
// needed for plug-in reference count management
- friend class PluginManager;
+ friend class BCodecKit::BPrivate::PluginManager;
virtual void _ReservedDecoder1();
virtual void _ReservedDecoder2();
@@ -84,8 +87,8 @@ public:
size_t*
count) = 0;
};
-} } // namespace BPrivate::media
-using namespace BPrivate::media;
+} // namespace BCodecKit
+
#endif // _DECODER_PLUGIN_H
diff --git a/headers/os/codec/Encoder.h b/headers/os/codec/Encoder.h
index 8ce5034320..c4a94a6ff5 100644
--- a/headers/os/codec/Encoder.h
+++ b/headers/os/codec/Encoder.h
@@ -6,16 +6,18 @@
#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 {
public:
@@ -94,7 +96,7 @@ private:
BMediaPlugin* fMediaPlugin;
// needed for plug-in reference count management
- friend class PluginManager;
+ friend class BCodecKit::BPrivate::PluginManager;
virtual void _ReservedEncoder1();
virtual void _ReservedEncoder2();
@@ -139,8 +141,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/os/codec/MediaExtractor.h
index 978fcf42d1..df79b12334 100644
--- a/headers/os/codec/MediaExtractor.h
+++ b/headers/os/codec/MediaExtractor.h
@@ -14,12 +14,9 @@
#include <Reader.h>
-namespace BPrivate {
-namespace media {
+namespace BCodecKit {
-class ChunkCache;
-struct chunk_buffer;
struct stream_info;
@@ -85,9 +82,8 @@ private:
uint32 fReserved[5];
};
-} // namespace media
-} // namespace BPrivate
-using namespace BPrivate::media;
+} // namespace BCodecKit
+
#endif // _MEDIA_EXTRACTOR_H
diff --git a/headers/os/codec/MediaIO.h b/headers/os/codec/MediaIO.h
index 260c4de131..1a86862a99 100644
--- a/headers/os/codec/MediaIO.h
+++ b/headers/os/codec/MediaIO.h
@@ -10,6 +10,9 @@
#include <SupportDefs.h>
+namespace BCodecKit {
+
+
enum media_io_flags {
B_MEDIA_STREAMING = 0x00000001,
@@ -41,4 +44,8 @@ private:
uint32 _reserved[5];
};
+
+} // namespace BCodecKit
+
+
#endif // _MEDIA_IO_H
diff --git a/headers/os/codec/MediaPlugin.h b/headers/os/codec/MediaPlugin.h
index da62cb0386..d3809b40a7 100644
--- a/headers/os/codec/MediaPlugin.h
+++ b/headers/os/codec/MediaPlugin.h
@@ -5,9 +5,15 @@
#ifndef _MEDIA_PLUGIN_H
#define _MEDIA_PLUGIN_H
+
#include <SupportDefs.h>
-namespace BPrivate { namespace media {
+
+namespace BCodecKit {
+
+namespace BPrivate {
+ class PluginManager;
+}
// TODO: Shouldn't this be a BReferenceable?
@@ -23,7 +29,7 @@ private:
int32 fRefCount;
// needed for plug-in reference count management
- friend class PluginManager;
+ friend class BCodecKit::BPrivate::PluginManager;
virtual void _ReservedMediaPlugin1();
virtual void _ReservedMediaPlugin2();
@@ -31,13 +37,11 @@ private:
uint32 fReserved[5];
};
-class BDecoder;
-class BReader;
-} } // namespace BPrivate::media
+extern "C" BMediaPlugin* instantiate_plugin();
-using namespace BPrivate::media;
-extern "C" BMediaPlugin* instantiate_plugin();
+} // namespace BCodecKit
+
#endif // _MEDIA_PLUGIN_H
diff --git a/headers/os/codec/MediaStreamer.h b/headers/os/codec/MediaStreamer.h
index 7daa4e738a..5c6e4fe11d 100644
--- a/headers/os/codec/MediaStreamer.h
+++ b/headers/os/codec/MediaStreamer.h
@@ -6,13 +6,11 @@
#define _MEDIA_STREAMER_H
+#include <Streamer.h>
#include <Url.h>
-#include "Streamer.h"
-
-namespace BPrivate {
-namespace media {
+namespace BCodecKit {
class BMediaStreamer {
@@ -33,9 +31,7 @@ private:
};
-}; // namespace media
-}; // namespace BPrivate
+} // namespace BCodecKit
-using namespace BPrivate::media;
#endif
diff --git a/headers/os/codec/MediaWriter.h b/headers/os/codec/MediaWriter.h
index cce6e74540..3b6fda0db1 100644
--- a/headers/os/codec/MediaWriter.h
+++ b/headers/os/codec/MediaWriter.h
@@ -5,6 +5,7 @@
#ifndef _MEDIA_WRITER_H
#define _MEDIA_WRITER_H
+
#include <Encoder.h>
#include <MetaData.h>
#include <Writer.h>
@@ -12,8 +13,7 @@
#include "TList.h"
-namespace BPrivate {
-namespace media {
+namespace BCodecKit {
class BMediaWriter {
@@ -63,10 +63,7 @@ private:
};
-}; // namespace media
-}; // namespace BPrivate
-
-using namespace BPrivate::media;
+} // namespace BCodecKit
#endif // _MEDIA_WRITER_H
diff --git a/headers/os/codec/MetaData.h b/headers/os/codec/MetaData.h
index 836dc012cc..d9881d786f 100644
--- a/headers/os/codec/MetaData.h
+++ b/headers/os/codec/MetaData.h
@@ -2,7 +2,6 @@
* Copyright 2018, Dario Casalinuovo. All rights reserved.
* Distributed under the terms of the MIT License.
*/
-
#ifndef _META_DATA_H
#define _META_DATA_H
@@ -10,8 +9,7 @@
#include <Message.h>
-namespace BPrivate {
-namespace media {
+namespace BCodecKit {
// Playback capabilities
@@ -114,9 +112,8 @@ private:
BMetaData(const BMetaData&);
};
-} // namespace media
-} // namespace BPrivate
-using namespace BPrivate::media;
+} // namespace BCodecKit
+
#endif // _META_DATA_H
diff --git a/headers/os/codec/Reader.h b/headers/os/codec/Reader.h
index d9efde83f9..fc9f4aeb75 100644
--- a/headers/os/codec/Reader.h
+++ b/headers/os/codec/Reader.h
@@ -8,9 +8,12 @@
#include "MediaPlugin.h"
-namespace BPrivate { namespace media {
+namespace BCodecKit {
+
+namespace BPrivate {
+ class PluginManager;
+}
-class PluginManager;
enum {
B_MEDIA_SEEK_TO_TIME = 0x10000,
@@ -62,8 +65,7 @@ private:
BMediaPlugin* fMediaPlugin;
// needed for plug-in reference count management
- friend class PluginManager;
- friend class MediaExtractor;
+ friend class BCodecKit::BPrivate::PluginManager;
virtual void _ReservedReader1();
virtual void _ReservedReader2();
@@ -80,8 +82,8 @@ public:
virtual BReader* NewReader() = 0;
};
-} } // namespace BPrivate::media
-using namespace BPrivate::media;
+} // namespace BCodecKit
+
#endif // _READER_PLUGIN_H
diff --git a/headers/os/codec/Streamer.h b/headers/os/codec/Streamer.h
index 5519e295af..1391b6bf13 100644
--- a/headers/os/codec/Streamer.h
+++ b/headers/os/codec/Streamer.h
@@ -12,9 +12,11 @@
#include "MediaPlugin.h"
-namespace BPrivate { namespace media {
+namespace BCodecKit {
-class PluginManager;
+namespace BPrivate {
+ class PluginManager;
+}
class BStreamer {
@@ -28,8 +30,7 @@ protected:
private:
BMediaPlugin* fMediaPlugin;
- friend class PluginManager;
- friend class MediaStreamer;
+ friend class BCodecKit::BPrivate::PluginManager;
virtual void _ReservedStreamer1();
virtual void _ReservedStreamer2();
@@ -48,9 +49,8 @@ public:
virtual BStreamer* NewStreamer() = 0;
};
-} } // namespace BPrivate::media
-using namespace BPrivate::media;
+} // namespace BCodecKit
#endif // _STREAMER_PLUGIN_H
diff --git a/headers/os/codec/Writer.h b/headers/os/codec/Writer.h
index c7498b2b95..d226c2de91 100644
--- a/headers/os/codec/Writer.h
+++ b/headers/os/codec/Writer.h
@@ -6,9 +6,13 @@
#include "MediaPlugin.h"
-namespace BPrivate { namespace media {
-class PluginManager;
+namespace BCodecKit {
+
+namespace BPrivate {
+ class PluginManager;
+}
+
class BWriter {
public:
@@ -51,7 +55,7 @@ private:
BMediaPlugin* fMediaPlugin;
// needed for plug-in reference count management
- friend class PluginManager;
+ friend class BCodecKit::BPrivate::PluginManager;
friend class BMediaWriter;
virtual void _ReservedWriter1();
@@ -70,11 +74,10 @@ public:
virtual status_t GetSupportedFileFormats(
const
media_file_format** _fileFormats,
size_t*
_count) = 0;
-
};
-} } // namespace BPrivate::media
-using namespace BPrivate::media;
+} // namespace BCodecKit
+
#endif // _WRITER_PLUGIN_H
diff --git a/headers/os/media/MediaDecoder.h b/headers/os/media/MediaDecoder.h
index 0177fa2ae9..b4bda5b621 100644
--- a/headers/os/media/MediaDecoder.h
+++ b/headers/os/media/MediaDecoder.h
@@ -4,15 +4,11 @@
#include <MediaDefs.h>
#include <MediaFormats.h>
-namespace BPrivate {
+
+namespace BCodecKit {
class BDecoder;
}
-namespace BPrivate {
- namespace media {
- class BDecoder;
- class BDecoderPlugin;
- }
-}
+
class BMediaDecoder {
public:
@@ -47,8 +43,8 @@ class BMediaDecoder {
status_t AttachToDecoder();
- BPrivate::media::BDecoder* fDecoder;
- status_t fInitStatus;
+ BCodecKit::BDecoder* fDecoder;
+ status_t fInitStatus;
/* fbc data and virtuals */
diff --git a/headers/private/codec/AddOnManager.h
b/headers/private/codec/AddOnManager.h
index 858b39b414..9f3c2beded 100644
--- a/headers/private/codec/AddOnManager.h
+++ b/headers/private/codec/AddOnManager.h
@@ -26,8 +26,9 @@
#include "TList.h"
+namespace BCodecKit {
namespace BPrivate {
-namespace media {
+
class AddOnManager {
public:
@@ -131,7 +132,9 @@ private:
static AddOnManager sInstance;
};
-} // namespace media
+
} // namespace BPrivate
+} // namespace BCodecKit
+
#endif // _ADD_ON_MANAGER_H
diff --git a/headers/private/codec/PluginManager.h
b/headers/private/codec/PluginManager.h
index baac9a5cd2..b3204eca4e 100644
--- a/headers/private/codec/PluginManager.h
+++ b/headers/private/codec/PluginManager.h
@@ -20,7 +20,10 @@
#include "TList.h"
-namespace BPrivate { namespace media {
+namespace BCodecKit {
+
+namespace BPrivate {
+
class PluginManager {
public:
@@ -87,10 +90,11 @@ private:
BLocker fLocker;
};
-} } // namespace BPrivate::media
-using namespace BPrivate::media;
+} } // namespace BCodecKit::BPrivate
+
+
+extern BCodecKit::BPrivate::PluginManager gPluginManager;
-extern PluginManager gPluginManager;
#endif // _PLUGIN_MANAGER_H
diff --git a/src/add-ons/media/plugins/ffmpeg/AVCodecDecoder.h
b/src/add-ons/media/plugins/ffmpeg/AVCodecDecoder.h
index 5d9d11dca8..3d89cb9dbc 100644
--- a/src/add-ons/media/plugins/ffmpeg/AVCodecDecoder.h
+++ b/src/add-ons/media/plugins/ffmpeg/AVCodecDecoder.h
@@ -17,6 +17,7 @@
#include <MediaFormats.h>
#include <Reader.h>
+using namespace BCodecKit;
extern "C" {
#include "avcodec.h"
diff --git a/src/add-ons/media/plugins/ffmpeg/AVCodecEncoder.h
b/src/add-ons/media/plugins/ffmpeg/AVCodecEncoder.h
index baedbee30d..6bbbec41a0 100644
--- a/src/add-ons/media/plugins/ffmpeg/AVCodecEncoder.h
+++ b/src/add-ons/media/plugins/ffmpeg/AVCodecEncoder.h
@@ -9,6 +9,7 @@
#include <Encoder.h>
#include <MediaFormats.h>
+using namespace BCodecKit;
extern "C" {
#include "avcodec.h"
diff --git a/src/add-ons/media/plugins/ffmpeg/AVFormatReader.h
b/src/add-ons/media/plugins/ffmpeg/AVFormatReader.h
index 5276beba47..f0ca4db463 100644
--- a/src/add-ons/media/plugins/ffmpeg/AVFormatReader.h
+++ b/src/add-ons/media/plugins/ffmpeg/AVFormatReader.h
@@ -10,6 +10,8 @@
#include <Locker.h>
#include <String.h>
+using namespace BCodecKit;
+
class AVFormatReader : public BReader {
public:
diff --git a/src/add-ons/media/plugins/ffmpeg/AVFormatWriter.h
b/src/add-ons/media/plugins/ffmpeg/AVFormatWriter.h
index fd25730ad7..1c1c2770b2 100644
--- a/src/add-ons/media/plugins/ffmpeg/AVFormatWriter.h
+++ b/src/add-ons/media/plugins/ffmpeg/AVFormatWriter.h
@@ -9,6 +9,8 @@
#include <Writer.h>
#include <Locker.h>
+using namespace BCodecKit;
+
extern "C" {
#include "avformat.h"
diff --git a/src/add-ons/media/plugins/ffmpeg/FFmpegPlugin.h
b/src/add-ons/media/plugins/ffmpeg/FFmpegPlugin.h
index 3cbdabd906..b7a4cb0fa2 100644
--- a/src/add-ons/media/plugins/ffmpeg/FFmpegPlugin.h
+++ b/src/add-ons/media/plugins/ffmpeg/FFmpegPlugin.h
@@ -17,6 +17,8 @@
#include <Reader.h>
#include <Writer.h>
+using namespace BCodecKit;
+
class FFmpegPlugin : public BReaderPlugin, public BDecoderPlugin,
public BWriterPlugin, public BEncoderPlugin {
diff --git a/src/kits/codec/AdapterIO.cpp b/src/kits/codec/AdapterIO.cpp
index 19b0c55b1c..cc419c6faa 100644
--- a/src/kits/codec/AdapterIO.cpp
+++ b/src/kits/codec/AdapterIO.cpp
@@ -5,7 +5,7 @@
*/
-#include "AdapterIO.h"
+#include <AdapterIO.h>
#include <MediaIO.h>
@@ -14,6 +14,9 @@
#include "MediaDebug.h"
+namespace BCodecKit {
+
+
#define TIMEOUT_QUANTA 100000
@@ -461,3 +464,6 @@ void BAdapterIO::_ReservedAdapterIO5() {}
void BInputAdapter::_ReservedInputAdapter1() {}
void BInputAdapter::_ReservedInputAdapter2() {}
+
+
+} // namespace BCodecKit
diff --git a/src/kits/codec/AddOnManager.cpp b/src/kits/codec/AddOnManager.cpp
index 5f01e4cbbe..c8a506e220 100644
--- a/src/kits/codec/AddOnManager.cpp
+++ b/src/kits/codec/AddOnManager.cpp
@@ -29,9 +29,8 @@
#include "MetaFormat.h"
+namespace BCodecKit {
namespace BPrivate {
-namespace media {
-
// #pragma mark - ImageLoader
@@ -675,5 +674,5 @@ AddOnManager::_GetReaders(const BPath& path, entry_ref*
outRefs,
}
-} // namespace media
} // namespace BPrivate
+} // namespace BCodecKit
diff --git a/src/kits/codec/ChunkCache.cpp b/src/kits/codec/ChunkCache.cpp
index a52651c297..2d083a62a2 100644
--- a/src/kits/codec/ChunkCache.cpp
+++ b/src/kits/codec/ChunkCache.cpp
@@ -15,6 +15,10 @@
// #pragma mark -
+namespace BCodecKit {
+namespace BPrivate {
+
+
ChunkCache::ChunkCache(sem_id waitSem, size_t maxBytes)
:
BLocker("media chunk cache"),
@@ -156,3 +160,7 @@ ChunkCache::ReadNextChunk(BReader* reader, void* cookie)
fChunkCache.push(chunk);
return chunk->status == B_OK;
}
+
+
+} // namespace BPrivate
+} // namespace BCodecKit
diff --git a/src/kits/codec/ChunkCache.h b/src/kits/codec/ChunkCache.h
index f29a8d1166..64e04fcb34 100644
--- a/src/kits/codec/ChunkCache.h
+++ b/src/kits/codec/ChunkCache.h
@@ -14,8 +14,8 @@
#include <deque>
+namespace BCodecKit {
namespace BPrivate {
-namespace media {
// Limit to 10 entries, we might want to instead limit to a length of time
#define CACHE_MAX_ENTRIES 10
@@ -54,9 +54,9 @@ private:
};
-} // namespace media
} // namespace BPrivate
+} // namespace BCodecKit
-using namespace BPrivate::media;
+//using namespace BPrivate::media;
#endif // _CHUNK_CACHE_H
diff --git a/src/kits/codec/CodecRoster.cpp b/src/kits/codec/CodecRoster.cpp
index 59d213752c..d56790e60b 100644
--- a/src/kits/codec/CodecRoster.cpp
+++ b/src/kits/codec/CodecRoster.cpp
@@ -10,6 +10,9 @@
#include "PluginManager.h"
+namespace BCodecKit {
+
+
status_t
BCodecRoster::InstantiateReader(BReader** reader, int32* streamCount,
media_file_format* mff, BDataIO* source)
@@ -131,3 +134,6 @@ BCodecRoster::GetNextEncoder(int32* cookie,
media_codec_info* _codecInfo)
{
return get_next_encoder(cookie, _codecInfo);
}
+
+
+} // namespace BCodecKit
diff --git a/src/kits/codec/Decoder.cpp b/src/kits/codec/Decoder.cpp
index 515c59fb41..644a2a1d86 100644
--- a/src/kits/codec/Decoder.cpp
+++ b/src/kits/codec/Decoder.cpp
@@ -12,6 +12,9 @@
#include <string.h>
+namespace BCodecKit {
+
+
BDecoder::BDecoder()
:
fChunkProvider(NULL),
@@ -69,3 +72,6 @@ BChunkProvider::BChunkProvider()
BChunkProvider::~BChunkProvider()
{
}
+
+
+} // namespace BCodecKit
diff --git a/src/kits/codec/Encoder.cpp b/src/kits/codec/Encoder.cpp
index fa102f8607..4c700abf7c 100644
--- a/src/kits/codec/Encoder.cpp
+++ b/src/kits/codec/Encoder.cpp
@@ -13,6 +13,9 @@
#include <string.h>
+namespace BCodecKit {
+
+
BEncoder::BEncoder()
:
fChunkWriter(NULL),
@@ -146,3 +149,6 @@ BChunkWriter::BChunkWriter()
BChunkWriter::~BChunkWriter()
{
}
+
+
+} // namespace BCodecKit
diff --git a/src/kits/codec/MediaExtractor.cpp
b/src/kits/codec/MediaExtractor.cpp
index fb3c157318..e26998b97e 100644
--- a/src/kits/codec/MediaExtractor.cpp
+++ b/src/kits/codec/MediaExtractor.cpp
@@ -20,6 +20,12 @@
#include "PluginManager.h"
+namespace BCodecKit {
+
+using BCodecKit::BPrivate::ChunkCache;
+using BCodecKit::BPrivate::chunk_buffer;
+
+
// should be 0, to disable the chunk cache set it to 1
#define DISABLE_CHUNK_CACHE 0
@@ -27,7 +33,7 @@
static const size_t kMaxCacheBytes = 3 * 1024 * 1024;
-struct BPrivate::media::stream_info {
+struct stream_info {
status_t status;
void* cookie;
bool hasCookie;
@@ -481,3 +487,6 @@ BMediaExtractor::_ExtractorThread()
} while (streamsFilled < fStreamCount);
}
}
+
+
+} // namespace BCodecKit
diff --git a/src/kits/codec/MediaIO.cpp b/src/kits/codec/MediaIO.cpp
index 48e07d5f5f..e120895e51 100644
--- a/src/kits/codec/MediaIO.cpp
+++ b/src/kits/codec/MediaIO.cpp
@@ -8,6 +8,9 @@
#include <MediaIO.h>
+namespace BCodecKit {
+
+
BMediaIO::BMediaIO()
{
}
@@ -30,3 +33,6 @@ void BMediaIO::_ReservedMediaIO2() {}
void BMediaIO::_ReservedMediaIO3() {}
void BMediaIO::_ReservedMediaIO4() {}
void BMediaIO::_ReservedMediaIO5() {}
+
+
+} // namespace BCodecKit
diff --git a/src/kits/codec/MediaPlugin.cpp b/src/kits/codec/MediaPlugin.cpp
index e2fb6c4751..8c3c5ffaf2 100644
--- a/src/kits/codec/MediaPlugin.cpp
+++ b/src/kits/codec/MediaPlugin.cpp
@@ -7,6 +7,9 @@
#include "MediaPlugin.h"
+namespace BCodecKit {
+
+
BMediaPlugin::BMediaPlugin()
:
fRefCount(0)
@@ -22,3 +25,6 @@ BMediaPlugin::~BMediaPlugin()
// FBC
void BMediaPlugin::_ReservedMediaPlugin1() {}
void BMediaPlugin::_ReservedMediaPlugin2() {}
+
+
+} // namespace BCodecKit
diff --git a/src/kits/codec/MediaStreamer.cpp b/src/kits/codec/MediaStreamer.cpp
index 2050b22a44..28c8a205d5 100644
--- a/src/kits/codec/MediaStreamer.cpp
+++ b/src/kits/codec/MediaStreamer.cpp
@@ -14,6 +14,9 @@
#include "PluginManager.h"
+namespace BCodecKit {
+
+
BMediaStreamer::BMediaStreamer(BUrl url)
:
fStreamer(NULL)
@@ -45,3 +48,6 @@ BMediaStreamer::CreateAdapter(BDataIO** adapter)
return gPluginManager.CreateStreamer(&fStreamer, fUrl, adapter);
}
+
+
+} // namespace BCodecKit
diff --git a/src/kits/codec/MediaWriter.cpp b/src/kits/codec/MediaWriter.cpp
index 03b5c29b42..234e7fe664 100644
--- a/src/kits/codec/MediaWriter.cpp
+++ b/src/kits/codec/MediaWriter.cpp
@@ -18,6 +18,9 @@
#include "PluginManager.h"
+namespace BCodecKit {
+
+
class BMediaExtractorChunkWriter : public BChunkWriter {
public:
BMediaExtractorChunkWriter(BMediaWriter* writer, int32 streamIndex)
@@ -234,3 +237,6 @@ BMediaWriter::WriteChunk(int32 streamIndex, const void*
chunkBuffer,
return fWriter->WriteChunk(info->cookie, chunkBuffer, chunkSize,
encodeInfo);
}
+
+
+} // namespace BCodecKit
diff --git a/src/kits/codec/MetaData.cpp b/src/kits/codec/MetaData.cpp
index 9126b15c75..fb59d16dac 100644
--- a/src/kits/codec/MetaData.cpp
+++ b/src/kits/codec/MetaData.cpp
@@ -10,56 +10,56 @@
#include <stdio.h>
#include <stdlib.h>
-#define P BPrivate::media
-
-const char* P::kCanPause = "canpause";
-const char* P::kCanSeekBackward = "canseekbackward";
-const char* P::kCanSeekForward = "canseekforward";
-const char* P::kCanSeek = "canseek";
-
-const char* P::kAudioBitRate = "audiobitrate";
-const char* P::kVideoBitRate = "videobitrate";
-const char* P::kAudioSampleRate = "audiosamplerate";
-const char* P::kVideoFrameRate = "videoframerate";
-
-const char* P::kMimeType = "mime";
-const char* P::kAudioCodec = "audiocodec";
-const char* P::kVideoCodec = "videocodec";
-const char* P::kVideoHeight = "videoheight";
-const char* P::kVideoWidth = "videowidth";
-const char* P::kNumTracks = "numtracks";
-const char* P::kDrmCrippled = "drmcrippled";
-
-const char* P::kTitle = "title";
-const char* P::kComment = "comment";
-const char* P::kCopyright = "copyright";
-const char* P::kAlbum = "album";
-const char* P::kArtist = "artist";
-const char* P::kAuthor = "author";
-const char* P::kComposer = "composer";
-const char* P::kGenre = "genre";
-const char* P::kDuration = "duration";
-const char* P::kRating = "rating";
-const char* P::kCDTrackNum = "cdtracknumber";
-const char* P::kCDTrackMax = "cdtrackmax";
-const char* P::kDate = "date";
-const char* P::kEncodedBy = "encoded_by";
-const char* P::kLanguage = "language";
-const char* P::kAlbumArtist = "album_artist";
-const char* P::kPerformer = "performer";
-const char* P::kDisc = "disc";
-const char* P::kPublisher = "publisher";
-const char* P::kTrack = "track";
-const char* P::kEncoder = "encoder";
-const char* P::kYear = "year";
-
-const char* P::kChapter = "be:chapter";
-const char* P::kChapterStart = "be:chapter:start";
-const char* P::kChapterEnd = "be:chapter:end";
-
-const char* P::kProgramData = "be:program";
-
-#undef P
+
+namespace BCodecKit {
+
+
+const char* kCanPause = "canpause";
+const char* kCanSeekBackward = "canseekbackward";
+const char* kCanSeekForward = "canseekforward";
+const char* kCanSeek = "canseek";
+
+const char* kAudioBitRate = "audiobitrate";
+const char* kVideoBitRate = "videobitrate";
+const char* kAudioSampleRate = "audiosamplerate";
+const char* kVideoFrameRate = "videoframerate";
+
+const char* kMimeType = "mime";
+const char* kAudioCodec = "audiocodec";
+const char* kVideoCodec = "videocodec";
+const char* kVideoHeight = "videoheight";
+const char* kVideoWidth = "videowidth";
+const char* kNumTracks = "numtracks";
+const char* kDrmCrippled = "drmcrippled";
+
+const char* kTitle = "title";
+const char* kComment = "comment";
+const char* kCopyright = "copyright";
+const char* kAlbum = "album";
+const char* kArtist = "artist";
+const char* kAuthor = "author";
+const char* kComposer = "composer";
+const char* kGenre = "genre";
+const char* kDuration = "duration";
+const char* kRating = "rating";
+const char* kCDTrackNum = "cdtracknumber";
+const char* kCDTrackMax = "cdtrackmax";
+const char* kDate = "date";
+const char* kEncodedBy = "encoded_by";
+const char* kLanguage = "language";
+const char* kAlbumArtist = "album_artist";
+const char* kPerformer = "performer";
+const char* kDisc = "disc";
+const char* kPublisher = "publisher";
+const char* kTrack = "track";
+const char* kEncoder = "encoder";
+const char* kYear = "year";
+
+const char* kChapter = "be:chapter";
+const char* kChapterStart = "be:chapter:start";
+const char* kChapterEnd = "be:chapter:end";
+
+const char* kProgramData = "be:program";
BMetaData::BMetaData()
@@ -189,3 +189,6 @@ BMetaData::operator=(const BMetaData& other)
fMessage = new BMessage(*other.fMessage);
return *this;
}
+
+
+} // namespace BCodecKit
diff --git a/src/kits/codec/PluginManager.cpp b/src/kits/codec/PluginManager.cpp
index d785abfa87..0ab69d76e9 100644
--- a/src/kits/codec/PluginManager.cpp
+++ b/src/kits/codec/PluginManager.cpp
@@ -21,6 +21,10 @@
#include "MediaDebug.h"
+namespace BCodecKit {
+namespace BPrivate {
+
+
PluginManager gPluginManager;
#define BLOCK_SIZE 4096
@@ -814,3 +818,7 @@ PluginManager::_LoadPlugin(const entry_ref& ref,
BMediaPlugin** plugin,
*image = id;
return B_OK;
}
+
+
+} // namespace BPrivate
+} // namespace BCodecKit
diff --git a/src/kits/codec/Reader.cpp b/src/kits/codec/Reader.cpp
index d1a4c6e5a7..4e5c84a96f 100644
--- a/src/kits/codec/Reader.cpp
+++ b/src/kits/codec/Reader.cpp
@@ -12,6 +12,9 @@
#include <stdio.h>
+namespace BCodecKit {
+
+
BReader::BReader()
:
fSource(NULL),
@@ -79,3 +82,6 @@ void BReader::_ReservedReader2() {}
void BReader::_ReservedReader3() {}
void BReader::_ReservedReader4() {}
void BReader::_ReservedReader5() {}
+
+
+} // namespace BCodecKit
diff --git a/src/kits/codec/Streamer.cpp b/src/kits/codec/Streamer.cpp
index 9459f12cbe..5d36b5d072 100644
--- a/src/kits/codec/Streamer.cpp
+++ b/src/kits/codec/Streamer.cpp
@@ -7,6 +7,9 @@
#include <Streamer.h>
+namespace BCodecKit {
+
+
BStreamer::BStreamer()
:
fMediaPlugin(NULL)
@@ -29,3 +32,6 @@ void BStreamer::_ReservedStreamer5() {}
BStreamerPlugin::BStreamerPlugin()
{
}
+
+
+}
diff --git a/src/kits/codec/Writer.cpp b/src/kits/codec/Writer.cpp
index 797fa7b620..5206b1286f 100644
--- a/src/kits/codec/Writer.cpp
+++ b/src/kits/codec/Writer.cpp
@@ -10,6 +10,9 @@
#include <stdio.h>
+namespace BCodecKit {
+
+
BWriter::BWriter()
:
fTarget(NULL),
@@ -49,3 +52,6 @@ void BWriter::_ReservedWriter2() {}
void BWriter::_ReservedWriter3() {}
void BWriter::_ReservedWriter4() {}
void BWriter::_ReservedWriter5() {}
+
+
+}
diff --git a/src/kits/media/MediaDecoder.cpp b/src/kits/media/MediaDecoder.cpp
index aefc2424fa..651fdcf5c2 100644
--- a/src/kits/media/MediaDecoder.cpp
+++ b/src/kits/media/MediaDecoder.cpp
@@ -3,12 +3,17 @@
* FILE: MediaDecoder.cpp
* DESCR:
***********************************************************************/
-#include <MediaDecoder.h>
+#include <CodecRoster.h>
#include <Decoder.h>
+#include <MediaDecoder.h>
+
#include <new>
-#include "PluginManager.h"
+
#include "MediaDebug.h"
+using namespace BCodecKit;
+
+
/*************************************************************
* public BMediaDecoder
*************************************************************/
############################################################################
Commit: fe9542fdb54c313ab7959f704897850c3d25de02
URL: https://git.haiku-os.org/haiku/commit/?id=fe9542fdb54c
Author: Barrett17 <b.vitruvio@xxxxxxxxx>
Date: Tue Nov 27 10:33:11 2018 UTC
BCodecRoster: Add useful functionality from MediaFormats
----------------------------------------------------------------------------
diff --git a/headers/os/codec/CodecRoster.h b/headers/os/codec/CodecRoster.h
index b7be6c4657..47ea7c175d 100644
--- a/headers/os/codec/CodecRoster.h
+++ b/headers/os/codec/CodecRoster.h
@@ -30,9 +30,6 @@ public:
static status_t InstantiateDecoder(BDecoder** decoder,
const media_codec_info&
mci);
static void ReleaseDecoder(BDecoder* decoder);
-
- static status_t GetDecoderInfo(BDecoder* decoder,
- media_codec_info* info);
static status_t InstantiateWriter(BWriter** writer,
const
media_file_format& mff,
@@ -50,6 +47,32 @@ public:
BUrl url, BDataIO**
source);
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: At some point move all implementations here
+
+ static status_t MakeFormatFor(
+ const
media_format_description* descriptions,
+ int32 descriptionCount,
+ media_format& format,
uint32 flags,
+ void* _reserved);
+
+ // 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
diff --git a/headers/os/codec/Streamer.h b/headers/os/codec/Streamer.h
index 1391b6bf13..4344cd9517 100644
--- a/headers/os/codec/Streamer.h
+++ b/headers/os/codec/Streamer.h
@@ -7,10 +7,9 @@
#include <MediaIO.h>
+#include <MediaPlugin.h>
#include <Url.h>
-#include "MediaPlugin.h"
-
namespace BCodecKit {
diff --git a/src/kits/codec/CodecRoster.cpp b/src/kits/codec/CodecRoster.cpp
index d56790e60b..db272e8dc0 100644
--- a/src/kits/codec/CodecRoster.cpp
+++ b/src/kits/codec/CodecRoster.cpp
@@ -7,6 +7,8 @@
#include <MediaFormats.h>
+#include "AddOnManager.h"
+#include "FormatManager.h"
#include "PluginManager.h"
@@ -136,4 +138,41 @@ BCodecRoster::GetNextEncoder(int32* cookie,
media_codec_info* _codecInfo)
}
+status_t
+BCodecRoster::GetNextFileFormat(int32* cookie, media_file_format* mff)
+{
+ if (cookie == NULL || mff == NULL)
+ return B_BAD_VALUE;
+
+ status_t ret = BPrivate::AddOnManager::GetInstance()->GetFileFormat(mff,
+ *cookie);
+
+ if (ret != B_OK)
+ return ret;
+
+ *cookie = *cookie + 1;
+ return B_OK;
+}
+
+
+status_t
+BCodecRoster::GetCodecInfo(media_codec_info* codecInfo,
+ media_format_family* formatFamily, media_format* inputFormat,
+ media_format* outputFormat, int32 cookie)
+{
+ return BPrivate::AddOnManager::GetInstance()->GetCodecInfo(codecInfo,
+ formatFamily, inputFormat, outputFormat, cookie);
+}
+
+
+status_t
+BCodecRoster::MakeFormatFor(const media_format_description* descriptions,
+ int32 descriptionCount, media_format& format, uint32 flags,
+ void* _reserved)
+{
+ return FormatManager::GetInstance()->MakeFormatFor(descriptions,
+ descriptionCount, format, flags, _reserved);
+}
+
+
} // namespace BCodecKit
diff --git a/src/kits/codec/PluginManager.cpp b/src/kits/codec/PluginManager.cpp
index 0ab69d76e9..4414513c53 100644
--- a/src/kits/codec/PluginManager.cpp
+++ b/src/kits/codec/PluginManager.cpp
@@ -21,12 +21,14 @@
#include "MediaDebug.h"
+// Need to stay outside namespace
+BCodecKit::BPrivate::PluginManager gPluginManager;
+
+
namespace BCodecKit {
namespace BPrivate {
-PluginManager gPluginManager;
-
#define BLOCK_SIZE 4096
#define MAX_STREAMERS 40
############################################################################
Commit: 5232a91136103f5f0e7e9b92a788d89d97bfdfaf
URL: https://git.haiku-os.org/haiku/commit/?id=5232a9113610
Author: Barrett17 <b.vitruvio@xxxxxxxxx>
Date: Tue Nov 27 10:34:20 2018 UTC
media_plugins: Rework to use the BCodecKit namespace
----------------------------------------------------------------------------
diff --git a/src/add-ons/media/plugins/http_streamer/HTTPMediaIO.cpp
b/src/add-ons/media/plugins/http_streamer/HTTPMediaIO.cpp
index 1cabcd2211..82afc17178 100644
--- a/src/add-ons/media/plugins/http_streamer/HTTPMediaIO.cpp
+++ b/src/add-ons/media/plugins/http_streamer/HTTPMediaIO.cpp
@@ -12,6 +12,8 @@
#include "MediaDebug.h"
+using namespace BCodecKit;
+
// 10 seconds timeout
#define HTTP_TIMEOUT 10000000
diff --git a/src/add-ons/media/plugins/http_streamer/HTTPMediaIO.h
b/src/add-ons/media/plugins/http_streamer/HTTPMediaIO.h
index e917391d24..4ea2f3cbf3 100644
--- a/src/add-ons/media/plugins/http_streamer/HTTPMediaIO.h
+++ b/src/add-ons/media/plugins/http_streamer/HTTPMediaIO.h
@@ -12,6 +12,9 @@
#include <UrlContext.h>
#include <UrlProtocolAsynchronousListener.h>
+using BCodecKit::BAdapterIO;
+using BCodecKit::BInputAdapter;
+
class FileListener;
diff --git a/src/add-ons/media/plugins/http_streamer/HTTPStreamerPlugin.h
b/src/add-ons/media/plugins/http_streamer/HTTPStreamerPlugin.h
index 63f4ba919e..cd33260e27 100644
--- a/src/add-ons/media/plugins/http_streamer/HTTPStreamerPlugin.h
+++ b/src/add-ons/media/plugins/http_streamer/HTTPStreamerPlugin.h
@@ -8,6 +8,10 @@
#include <Streamer.h>
+using BCodecKit::BMediaPlugin;
+using BCodecKit::BStreamer;
+using BCodecKit::BStreamerPlugin;
+
class HTTPStreamer : public BStreamer
{
diff --git a/src/add-ons/media/plugins/raw_decoder/RawDecoderPlugin.h
b/src/add-ons/media/plugins/raw_decoder/RawDecoderPlugin.h
index c82c54b832..7ce7a9625d 100644
--- a/src/add-ons/media/plugins/raw_decoder/RawDecoderPlugin.h
+++ b/src/add-ons/media/plugins/raw_decoder/RawDecoderPlugin.h
@@ -27,6 +27,10 @@
#include <Decoder.h>
+using BCodecKit::BMediaPlugin;
+using BCodecKit::BDecoder;
+using BCodecKit::BDecoderPlugin;
+
class RawDecoder : public BDecoder
{
############################################################################
Revision: hrev52600
Commit: 278d03da22e10187dbcd7f9109e0b28a85c67557
URL: https://git.haiku-os.org/haiku/commit/?id=278d03da22e1
Author: Barrett17 <b.vitruvio@xxxxxxxxx>
Date: Tue Nov 27 10:35:01 2018 UTC
media_kit: Remove most private dependencies from codec_kit
* Move to BCodecKit namespace and make extensive use
of BCodecRoster.
* This is a first step in the right direction of
decreasing private dependencies. Some APIs are being
translated to the CodecKit. I am doing an investigation
on which APIs are really used among apps, so that the new
kit can be more slim and oriented toward easy development
and can be extended in the right direction instead to
continue maintaning unuseful code.
* BMediaFormats needs still a bit of love.
* General improvements in style and code maintainability.
----------------------------------------------------------------------------
diff --git a/headers/os/media/MediaDecoder.h b/headers/os/media/MediaDecoder.h
index b4bda5b621..8112d04810 100644
--- a/headers/os/media/MediaDecoder.h
+++ b/headers/os/media/MediaDecoder.h
@@ -1,7 +1,7 @@
#ifndef MEDIADECODER_H
#define MEDIADECODER_H
-#include <MediaDefs.h>
+
#include <MediaFormats.h>
diff --git a/headers/os/media/MediaEncoder.h b/headers/os/media/MediaEncoder.h
index 2248d4131c..091dc0f63d 100644
--- a/headers/os/media/MediaEncoder.h
+++ b/headers/os/media/MediaEncoder.h
@@ -8,14 +8,10 @@
#include <MediaFormats.h>
-namespace BPrivate {
- namespace media {
- class BEncoder;
- class BEncoderPlugin;
- }
-}
-using namespace BPrivate::media;
+namespace BCodecKit {
+ class BEncoder;
+}
class BMediaEncoder {
@@ -84,7 +80,7 @@ private:
void ReleaseEncoder();
uint32
_reserved_was_fEncoderMgr;
- BEncoder* fEncoder;
+ BCodecKit::BEncoder* fEncoder;
int32 fEncoderID;
bool fFormatValid;
diff --git a/headers/os/media/MediaFile.h b/headers/os/media/MediaFile.h
index 76d76df641..f0c30eea64 100644
--- a/headers/os/media/MediaFile.h
+++ b/headers/os/media/MediaFile.h
@@ -13,12 +13,13 @@
#include <StorageDefs.h>
+namespace BCodecKit {
+ class BMediaExtractor;
+ class BMediaStreamer;
+ class BMediaWriter;
+}
+
namespace BPrivate {
- namespace media {
- class BMediaExtractor;
- class BMediaStreamer;
- class BMediaWriter;
- }
class _AddonManager;
}
@@ -162,18 +163,18 @@ private:
status_t ControlFile(int32
selector, void* ioData,
size_t
size);
- BPrivate::media::BMediaExtractor* fExtractor;
+ BCodecKit::BMediaExtractor* fExtractor;
int32
_reserved_BMediaFile_was_fExtractorID;
int32 fTrackNum;
status_t fErr;
BPrivate::_AddonManager* fEncoderMgr;
BPrivate::_AddonManager* fWriterMgr;
- BPrivate::media::BMediaWriter* fWriter;
+ BCodecKit::BMediaWriter* fWriter;
int32 fWriterID;
media_file_format fMFI;
- BPrivate::media::BMediaStreamer* fStreamer;
+ BCodecKit::BMediaStreamer* fStreamer;
bool fFileClosed;
bool fDeleteSource;
diff --git a/headers/os/media/MediaTrack.h b/headers/os/media/MediaTrack.h
index e7ed4c945e..3541cc9531 100644
--- a/headers/os/media/MediaTrack.h
+++ b/headers/os/media/MediaTrack.h
@@ -9,12 +9,12 @@
#include <MediaFormats.h>
-namespace BPrivate { namespace media {
+namespace BCodecKit {
class BDecoder;
class BEncoder;
class BMediaExtractor;
class BMediaWriter;
-} }
+}
class BMessage;
class BView;
@@ -219,12 +219,12 @@ private:
// For read-only access to a BMediaTrack
BMediaTrack(
-
BPrivate::media::BMediaExtractor* extractor,
+
BCodecKit::BMediaExtractor* extractor,
int32
streamIndex);
// For write-only access to a BMediaTrack
BMediaTrack(
-
BPrivate::media::BMediaWriter* writer,
+
BCodecKit::BMediaWriter* writer,
int32
streamIndex, media_format* format,
const
media_codec_info* codecInfo);
@@ -235,9 +235,9 @@ private:
private:
status_t fInitStatus;
- BPrivate::media::BDecoder* fDecoder;
- BPrivate::media::BDecoder* fRawDecoder;
- BPrivate::media::BMediaExtractor* fExtractor;
+ BCodecKit::BDecoder* fDecoder;
+ BCodecKit::BDecoder* fRawDecoder;
+ BCodecKit::BMediaExtractor* fExtractor;
int32 fStream;
int64 fCurrentFrame;
@@ -245,9 +245,9 @@ private:
media_codec_info fCodecInfo;
- BPrivate::media::BEncoder* fEncoder;
+ BCodecKit::BEncoder* fEncoder;
int32 fEncoderID;
- BPrivate::media::BMediaWriter* fWriter;
+ BCodecKit::BMediaWriter* fWriter;
media_format fFormat;
uint32 fWorkaroundFlags;
diff --git a/src/kits/media/MediaDecoder.cpp b/src/kits/media/MediaDecoder.cpp
index 651fdcf5c2..f8a679233b 100644
--- a/src/kits/media/MediaDecoder.cpp
+++ b/src/kits/media/MediaDecoder.cpp
@@ -46,7 +46,7 @@ BMediaDecoder::BMediaDecoder(const media_codec_info *mci)
/* virtual */
BMediaDecoder::~BMediaDecoder()
{
- gPluginManager.DestroyDecoder(fDecoder);
+ BCodecRoster::ReleaseDecoder(fDecoder);
}
@@ -62,10 +62,10 @@ BMediaDecoder::SetTo(const media_format *in_format,
const void *info,
size_t info_size)
{
- gPluginManager.DestroyDecoder(fDecoder);
+ BCodecRoster::ReleaseDecoder(fDecoder);
fDecoder = NULL;
- status_t err = gPluginManager.CreateDecoder(&fDecoder, *in_format);
+ status_t err = BCodecRoster::InstantiateDecoder(&fDecoder, *in_format);
if (err < B_OK)
goto fail;
@@ -81,7 +81,7 @@ BMediaDecoder::SetTo(const media_format *in_format,
return B_OK;
fail:
- gPluginManager.DestroyDecoder(fDecoder);
+ BCodecRoster::ReleaseDecoder(fDecoder);
fDecoder = NULL;
fInitStatus = B_NO_INIT;
return err;
@@ -91,10 +91,10 @@ fail:
status_t
BMediaDecoder::SetTo(const media_codec_info *mci)
{
- gPluginManager.DestroyDecoder(fDecoder);
+ BCodecRoster::ReleaseDecoder(fDecoder);
fDecoder = NULL;
- status_t err = gPluginManager.CreateDecoder(&fDecoder, *mci);
+ status_t err = BCodecRoster::InstantiateDecoder(&fDecoder, *mci);
if (err < B_OK)
goto fail;
@@ -106,7 +106,7 @@ BMediaDecoder::SetTo(const media_codec_info *mci)
return B_OK;
fail:
- gPluginManager.DestroyDecoder(fDecoder);
+ BCodecRoster::ReleaseDecoder(fDecoder);
fDecoder = NULL;
fInitStatus = B_NO_INIT;
return err;
@@ -182,7 +182,7 @@ BMediaDecoder::GetDecoderInfo(media_codec_info *out_info)
const
if (!fDecoder)
return B_NO_INIT;
- return gPluginManager.GetDecoderInfo(fDecoder, out_info);
+ return BCodecRoster::GetDecoderInfo(fDecoder, out_info);
}
diff --git a/src/kits/media/MediaDefs.cpp b/src/kits/media/MediaDefs.cpp
index d6106ebd4e..3745229e1c 100644
--- a/src/kits/media/MediaDefs.cpp
+++ b/src/kits/media/MediaDefs.cpp
@@ -13,6 +13,7 @@
#include <Application.h>
#include <Bitmap.h>
#include <Catalog.h>
+#include <CodecRoster.h>
#include <LaunchRoster.h>
#include <Locale.h>
#include <MediaNode.h>
@@ -24,7 +25,6 @@
#include <stdio.h>
#include <string.h>
-#include "AddOnManager.h"
#include "DataExchange.h"
#include "MediaDebug.h"
#include "MediaMisc.h"
@@ -1218,16 +1218,7 @@ operator<(const media_file_format_id& a, const
media_file_format_id& b)
status_t
get_next_file_format(int32* cookie, media_file_format* mff)
{
- if (cookie == NULL || mff == NULL)
- return B_BAD_VALUE;
-
- status_t ret = AddOnManager::GetInstance()->GetFileFormat(mff, *cookie);
- if (ret != B_OK)
- return ret;
-
- *cookie = *cookie + 1;
-
- return B_OK;
+ return BCodecKit::BCodecRoster::GetNextFileFormat(cookie, mff);
}
@@ -1255,5 +1246,3 @@ media_decode_info::media_decode_info()
codec_data = NULL;
codec_data_size = 0;
}
-
-
diff --git a/src/kits/media/MediaEncoder.cpp b/src/kits/media/MediaEncoder.cpp
index 1e94f906b9..1b6ca51fc6 100644
--- a/src/kits/media/MediaEncoder.cpp
+++ b/src/kits/media/MediaEncoder.cpp
@@ -9,13 +9,16 @@
#include <MediaEncoder.h>
+#include <CodecRoster.h>
#include <Encoder.h>
-#include <PluginManager.h>
#include <new>
#include "MediaDebug.h"
+using namespace BCodecKit;
+
+
/*************************************************************
* public BMediaEncoder
*************************************************************/
@@ -76,7 +79,7 @@ BMediaEncoder::SetTo(const media_format* outputFormat)
return fInitStatus;
media_format format = *outputFormat;
- err = gPluginManager.CreateEncoder(&fEncoder, format);
+ err = BCodecRoster::InstantiateEncoder(&fEncoder, format);
if (fEncoder != NULL && err == B_OK) {
err = _AttachToEncoder();
if (err == B_OK)
@@ -94,7 +97,7 @@ BMediaEncoder::SetTo(const media_codec_info* mci)
CALLED();
ReleaseEncoder();
- status_t err = gPluginManager.CreateEncoder(&fEncoder, mci, 0);
+ status_t err = BCodecRoster::InstantiateEncoder(&fEncoder, mci, 0);
if (fEncoder != NULL && err == B_OK) {
err = _AttachToEncoder();
if (err == B_OK) {
@@ -216,7 +219,7 @@ BMediaEncoder::ReleaseEncoder()
{
CALLED();
if (fEncoder != NULL) {
- gPluginManager.DestroyEncoder(fEncoder);
+ BCodecRoster::ReleaseEncoder(fEncoder);
fEncoder = NULL;
}
fInitStatus = B_NO_INIT;
diff --git a/src/kits/media/MediaFile.cpp b/src/kits/media/MediaFile.cpp
index f4ae4f16d0..ea6f984be2 100644
--- a/src/kits/media/MediaFile.cpp
+++ b/src/kits/media/MediaFile.cpp
@@ -6,20 +6,21 @@
#include <MediaFile.h>
+#include <File.h>
+#include <MediaExtractor.h>
+#include <MediaStreamer.h>
+#include <MediaTrack.h>
+#include <MediaWriter.h>
+#include <Url.h>
+
#include <new>
#include <stdlib.h>
#include <string.h>
-#include <File.h>
-#include <MediaTrack.h>
-#include <Url.h>
-
#include "MediaDebug.h"
-#include "MediaExtractor.h"
-#include "MediaStreamer.h"
-#include "MediaWriter.h"
+using namespace BCodecKit;
BMediaFile::BMediaFile(const entry_ref* ref)
diff --git a/src/kits/media/MediaFormats.cpp b/src/kits/media/MediaFormats.cpp
index bc2afa76a1..d0162e0cc2 100644
--- a/src/kits/media/MediaFormats.cpp
+++ b/src/kits/media/MediaFormats.cpp
@@ -7,6 +7,12 @@
* Marcus Overhagen
*/
+#include <MediaFormats.h>
+
+#include <CodecRoster.h>
+#include <ObjectList.h>
+#include <Message.h>
+#include <Autolock.h>
#include "AddOnManager.h"
#include "DataExchange.h"
@@ -14,11 +20,6 @@
#include "MetaFormat.h"
#include "MediaDebug.h"
-#include <MediaFormats.h>
-#include <ObjectList.h>
-#include <Message.h>
-#include <Autolock.h>
-
#include <string.h>
using namespace BPrivate::media;
@@ -47,7 +48,7 @@ get_next_encoder(int32* cookie, const media_file_format*
fileFormat,
media_format candidateInputFormat;
media_format candidateOutputFormat;
- status_t ret = AddOnManager::GetInstance()->GetCodecInfo(
+ status_t ret = BCodecKit::BCodecRoster::GetCodecInfo(
&candidateCodecInfo, &candidateFormatFamily,
&candidateInputFormat, &candidateOutputFormat, *cookie);
@@ -97,7 +98,7 @@ get_next_encoder(int32* cookie, const media_file_format*
fileFormat,
media_format candidateInputFormat;
media_format candidateOutputFormat;
- status_t ret = AddOnManager::GetInstance()->GetCodecInfo(
+ status_t ret = BCodecKit::BCodecRoster::GetCodecInfo(
&candidateCodecInfo, &candidateFormatFamily,
&candidateInputFormat,
&candidateOutputFormat, *cookie);
@@ -145,7 +146,7 @@ get_next_encoder(int32* cookie, media_codec_info*
_codecInfo)
media_format inputFormat;
media_format outputFormat;
- status_t ret = AddOnManager::GetInstance()->GetCodecInfo(_codecInfo,
+ status_t ret = BCodecKit::BCodecRoster::GetCodecInfo(_codecInfo,
&formatFamily, &inputFormat, &outputFormat, *cookie);
if (ret != B_OK)
return ret;
@@ -366,7 +367,7 @@ update_media_formats()
// We want the add-ons to register themselves with the format manager,
so
// the list is up to date.
- AddOnManager::GetInstance()->RegisterAddOns();
+ BCodecKit::BPrivate::AddOnManager::GetInstance()->RegisterAddOns();
BMessage reply;
FormatManager::GetInstance()->GetFormats(sLastFormatsUpdate, reply);
@@ -621,10 +622,8 @@ BMediaFormats::MakeFormatFor(const
media_format_description* descriptions,
int32 descriptionCount, media_format* format, uint32 flags,
void* _reserved)
{
- status_t status =
FormatManager::GetInstance()->MakeFormatFor(descriptions,
+ return BCodecKit::BCodecRoster::MakeFormatFor(descriptions,
descriptionCount, *format, flags, _reserved);
-
- return status;
}
@@ -638,4 +637,3 @@ BMediaFormats::MakeFormatFor(const
media_format_description& description,
*_outFormat = inFormat;
return MakeFormatFor(&description, 1, _outFormat);
}
-
diff --git a/src/kits/media/MediaTrack.cpp b/src/kits/media/MediaTrack.cpp
index 4af314a526..0cbe3002b0 100644
--- a/src/kits/media/MediaTrack.cpp
+++ b/src/kits/media/MediaTrack.cpp
@@ -12,17 +12,18 @@
#include <MediaTrack.h>
+#include <CodecRoster.h>
+#include <MediaExtractor.h>
+#include <MediaWriter.h>
+#include <Roster.h>
+
#include <new>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <Roster.h>
-
-#include "MediaExtractor.h"
-#include "MediaWriter.h"
-#include "PluginManager.h"
+using namespace BCodecKit;
//#define TRACE_MEDIA_TRACK
@@ -84,9 +85,9 @@ BMediaTrack::~BMediaTrack()
{
CALLED();
- gPluginManager.DestroyDecoder(fRawDecoder);
- gPluginManager.DestroyDecoder(fDecoder);
- gPluginManager.DestroyEncoder(fEncoder);
+ BCodecRoster::ReleaseDecoder(fRawDecoder);
+ BCodecRoster::ReleaseDecoder(fDecoder);
+ BCodecRoster::ReleaseEncoder(fEncoder);
}
/*************************************************************
@@ -163,7 +164,7 @@ BMediaTrack::DecodedFormat(media_format* _format, uint32
flags)
if (fExtractor == NULL || fDecoder == NULL)
return B_NO_INIT;
- gPluginManager.DestroyDecoder(fRawDecoder);
+ BCodecRoster::ReleaseDecoder(fRawDecoder);
fRawDecoder = NULL;
#ifdef TRACE_MEDIA_TRACK
@@ -839,7 +840,7 @@ BMediaTrack::Perform(int32 selector, void* data)
// #pragma mark - private
-BMediaTrack::BMediaTrack(BPrivate::media::BMediaExtractor* extractor,
+BMediaTrack::BMediaTrack(BCodecKit::BMediaExtractor* extractor,
int32 stream)
{
CALLED();
@@ -871,7 +872,7 @@ BMediaTrack::BMediaTrack(BPrivate::media::BMediaExtractor*
extractor,
}
-BMediaTrack::BMediaTrack(BPrivate::media::BMediaWriter* writer,
+BMediaTrack::BMediaTrack(BCodecKit::BMediaWriter* writer,
int32 streamIndex, media_format* format,
const media_codec_info* codecInfo)
{
@@ -950,7 +951,7 @@ BMediaTrack::SetupWorkaround()
bool
BMediaTrack::SetupFormatTranslation(const media_format &from, media_format* to)
{
- gPluginManager.DestroyDecoder(fRawDecoder);
+ BCodecRoster::ReleaseDecoder(fRawDecoder);
fRawDecoder = NULL;
#ifdef TRACE_MEDIA_TRACK
@@ -959,7 +960,7 @@ BMediaTrack::SetupFormatTranslation(const media_format
&from, media_format* to)
printf("BMediaTrack::SetupFormatTranslation: from: %s\n", s);
#endif
- status_t result = gPluginManager.CreateDecoder(&fRawDecoder, from);
+ status_t result = BCodecRoster::InstantiateDecoder(&fRawDecoder, from);
if (result != B_OK) {
ERROR("BMediaTrack::SetupFormatTranslation: CreateDecoder
failed\n");
return false;
@@ -1007,7 +1008,7 @@ BMediaTrack::SetupFormatTranslation(const media_format
&from, media_format* to)
return true;
error:
- gPluginManager.DestroyDecoder(fRawDecoder);
+ BCodecRoster::ReleaseDecoder(fRawDecoder);
fRawDecoder = NULL;
return false;
}