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.
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
#ifndef MEDIADECODER_H
|
#ifndef MEDIADECODER_H
|
||||||
#define MEDIADECODER_H
|
#define MEDIADECODER_H
|
||||||
|
|
||||||
#include <MediaDefs.h>
|
|
||||||
#include <MediaFormats.h>
|
#include <MediaFormats.h>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -8,14 +8,10 @@
|
|||||||
|
|
||||||
#include <MediaFormats.h>
|
#include <MediaFormats.h>
|
||||||
|
|
||||||
namespace BPrivate {
|
|
||||||
namespace media {
|
|
||||||
class BEncoder;
|
|
||||||
class BEncoderPlugin;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
using namespace BPrivate::media;
|
namespace BCodecKit {
|
||||||
|
class BEncoder;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
class BMediaEncoder {
|
class BMediaEncoder {
|
||||||
@@ -84,7 +80,7 @@ private:
|
|||||||
void ReleaseEncoder();
|
void ReleaseEncoder();
|
||||||
|
|
||||||
uint32 _reserved_was_fEncoderMgr;
|
uint32 _reserved_was_fEncoderMgr;
|
||||||
BEncoder* fEncoder;
|
BCodecKit::BEncoder* fEncoder;
|
||||||
|
|
||||||
int32 fEncoderID;
|
int32 fEncoderID;
|
||||||
bool fFormatValid;
|
bool fFormatValid;
|
||||||
|
|||||||
@@ -13,12 +13,13 @@
|
|||||||
#include <StorageDefs.h>
|
#include <StorageDefs.h>
|
||||||
|
|
||||||
|
|
||||||
|
namespace BCodecKit {
|
||||||
|
class BMediaExtractor;
|
||||||
|
class BMediaStreamer;
|
||||||
|
class BMediaWriter;
|
||||||
|
}
|
||||||
|
|
||||||
namespace BPrivate {
|
namespace BPrivate {
|
||||||
namespace media {
|
|
||||||
class BMediaExtractor;
|
|
||||||
class BMediaStreamer;
|
|
||||||
class BMediaWriter;
|
|
||||||
}
|
|
||||||
class _AddonManager;
|
class _AddonManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -162,18 +163,18 @@ private:
|
|||||||
status_t ControlFile(int32 selector, void* ioData,
|
status_t ControlFile(int32 selector, void* ioData,
|
||||||
size_t size);
|
size_t size);
|
||||||
|
|
||||||
BPrivate::media::BMediaExtractor* fExtractor;
|
BCodecKit::BMediaExtractor* fExtractor;
|
||||||
int32 _reserved_BMediaFile_was_fExtractorID;
|
int32 _reserved_BMediaFile_was_fExtractorID;
|
||||||
int32 fTrackNum;
|
int32 fTrackNum;
|
||||||
status_t fErr;
|
status_t fErr;
|
||||||
|
|
||||||
BPrivate::_AddonManager* fEncoderMgr;
|
BPrivate::_AddonManager* fEncoderMgr;
|
||||||
BPrivate::_AddonManager* fWriterMgr;
|
BPrivate::_AddonManager* fWriterMgr;
|
||||||
BPrivate::media::BMediaWriter* fWriter;
|
BCodecKit::BMediaWriter* fWriter;
|
||||||
int32 fWriterID;
|
int32 fWriterID;
|
||||||
media_file_format fMFI;
|
media_file_format fMFI;
|
||||||
|
|
||||||
BPrivate::media::BMediaStreamer* fStreamer;
|
BCodecKit::BMediaStreamer* fStreamer;
|
||||||
|
|
||||||
bool fFileClosed;
|
bool fFileClosed;
|
||||||
bool fDeleteSource;
|
bool fDeleteSource;
|
||||||
|
|||||||
@@ -9,12 +9,12 @@
|
|||||||
#include <MediaFormats.h>
|
#include <MediaFormats.h>
|
||||||
|
|
||||||
|
|
||||||
namespace BPrivate { namespace media {
|
namespace BCodecKit {
|
||||||
class BDecoder;
|
class BDecoder;
|
||||||
class BEncoder;
|
class BEncoder;
|
||||||
class BMediaExtractor;
|
class BMediaExtractor;
|
||||||
class BMediaWriter;
|
class BMediaWriter;
|
||||||
} }
|
}
|
||||||
|
|
||||||
class BMessage;
|
class BMessage;
|
||||||
class BView;
|
class BView;
|
||||||
@@ -219,12 +219,12 @@ private:
|
|||||||
|
|
||||||
// For read-only access to a BMediaTrack
|
// For read-only access to a BMediaTrack
|
||||||
BMediaTrack(
|
BMediaTrack(
|
||||||
BPrivate::media::BMediaExtractor* extractor,
|
BCodecKit::BMediaExtractor* extractor,
|
||||||
int32 streamIndex);
|
int32 streamIndex);
|
||||||
|
|
||||||
// For write-only access to a BMediaTrack
|
// For write-only access to a BMediaTrack
|
||||||
BMediaTrack(
|
BMediaTrack(
|
||||||
BPrivate::media::BMediaWriter* writer,
|
BCodecKit::BMediaWriter* writer,
|
||||||
int32 streamIndex, media_format* format,
|
int32 streamIndex, media_format* format,
|
||||||
const media_codec_info* codecInfo);
|
const media_codec_info* codecInfo);
|
||||||
|
|
||||||
@@ -235,9 +235,9 @@ private:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
status_t fInitStatus;
|
status_t fInitStatus;
|
||||||
BPrivate::media::BDecoder* fDecoder;
|
BCodecKit::BDecoder* fDecoder;
|
||||||
BPrivate::media::BDecoder* fRawDecoder;
|
BCodecKit::BDecoder* fRawDecoder;
|
||||||
BPrivate::media::BMediaExtractor* fExtractor;
|
BCodecKit::BMediaExtractor* fExtractor;
|
||||||
|
|
||||||
int32 fStream;
|
int32 fStream;
|
||||||
int64 fCurrentFrame;
|
int64 fCurrentFrame;
|
||||||
@@ -245,9 +245,9 @@ private:
|
|||||||
|
|
||||||
media_codec_info fCodecInfo;
|
media_codec_info fCodecInfo;
|
||||||
|
|
||||||
BPrivate::media::BEncoder* fEncoder;
|
BCodecKit::BEncoder* fEncoder;
|
||||||
int32 fEncoderID;
|
int32 fEncoderID;
|
||||||
BPrivate::media::BMediaWriter* fWriter;
|
BCodecKit::BMediaWriter* fWriter;
|
||||||
media_format fFormat;
|
media_format fFormat;
|
||||||
|
|
||||||
uint32 fWorkaroundFlags;
|
uint32 fWorkaroundFlags;
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ BMediaDecoder::BMediaDecoder(const media_codec_info *mci)
|
|||||||
/* virtual */
|
/* virtual */
|
||||||
BMediaDecoder::~BMediaDecoder()
|
BMediaDecoder::~BMediaDecoder()
|
||||||
{
|
{
|
||||||
gPluginManager.DestroyDecoder(fDecoder);
|
BCodecRoster::ReleaseDecoder(fDecoder);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -62,10 +62,10 @@ BMediaDecoder::SetTo(const media_format *in_format,
|
|||||||
const void *info,
|
const void *info,
|
||||||
size_t info_size)
|
size_t info_size)
|
||||||
{
|
{
|
||||||
gPluginManager.DestroyDecoder(fDecoder);
|
BCodecRoster::ReleaseDecoder(fDecoder);
|
||||||
fDecoder = NULL;
|
fDecoder = NULL;
|
||||||
|
|
||||||
status_t err = gPluginManager.CreateDecoder(&fDecoder, *in_format);
|
status_t err = BCodecRoster::InstantiateDecoder(&fDecoder, *in_format);
|
||||||
if (err < B_OK)
|
if (err < B_OK)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
@@ -81,7 +81,7 @@ BMediaDecoder::SetTo(const media_format *in_format,
|
|||||||
return B_OK;
|
return B_OK;
|
||||||
|
|
||||||
fail:
|
fail:
|
||||||
gPluginManager.DestroyDecoder(fDecoder);
|
BCodecRoster::ReleaseDecoder(fDecoder);
|
||||||
fDecoder = NULL;
|
fDecoder = NULL;
|
||||||
fInitStatus = B_NO_INIT;
|
fInitStatus = B_NO_INIT;
|
||||||
return err;
|
return err;
|
||||||
@@ -91,10 +91,10 @@ fail:
|
|||||||
status_t
|
status_t
|
||||||
BMediaDecoder::SetTo(const media_codec_info *mci)
|
BMediaDecoder::SetTo(const media_codec_info *mci)
|
||||||
{
|
{
|
||||||
gPluginManager.DestroyDecoder(fDecoder);
|
BCodecRoster::ReleaseDecoder(fDecoder);
|
||||||
fDecoder = NULL;
|
fDecoder = NULL;
|
||||||
|
|
||||||
status_t err = gPluginManager.CreateDecoder(&fDecoder, *mci);
|
status_t err = BCodecRoster::InstantiateDecoder(&fDecoder, *mci);
|
||||||
if (err < B_OK)
|
if (err < B_OK)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
@@ -106,7 +106,7 @@ BMediaDecoder::SetTo(const media_codec_info *mci)
|
|||||||
return B_OK;
|
return B_OK;
|
||||||
|
|
||||||
fail:
|
fail:
|
||||||
gPluginManager.DestroyDecoder(fDecoder);
|
BCodecRoster::ReleaseDecoder(fDecoder);
|
||||||
fDecoder = NULL;
|
fDecoder = NULL;
|
||||||
fInitStatus = B_NO_INIT;
|
fInitStatus = B_NO_INIT;
|
||||||
return err;
|
return err;
|
||||||
@@ -182,7 +182,7 @@ BMediaDecoder::GetDecoderInfo(media_codec_info *out_info) const
|
|||||||
if (!fDecoder)
|
if (!fDecoder)
|
||||||
return B_NO_INIT;
|
return B_NO_INIT;
|
||||||
|
|
||||||
return gPluginManager.GetDecoderInfo(fDecoder, out_info);
|
return BCodecRoster::GetDecoderInfo(fDecoder, out_info);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -13,6 +13,7 @@
|
|||||||
#include <Application.h>
|
#include <Application.h>
|
||||||
#include <Bitmap.h>
|
#include <Bitmap.h>
|
||||||
#include <Catalog.h>
|
#include <Catalog.h>
|
||||||
|
#include <CodecRoster.h>
|
||||||
#include <LaunchRoster.h>
|
#include <LaunchRoster.h>
|
||||||
#include <Locale.h>
|
#include <Locale.h>
|
||||||
#include <MediaNode.h>
|
#include <MediaNode.h>
|
||||||
@@ -24,7 +25,6 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "AddOnManager.h"
|
|
||||||
#include "DataExchange.h"
|
#include "DataExchange.h"
|
||||||
#include "MediaDebug.h"
|
#include "MediaDebug.h"
|
||||||
#include "MediaMisc.h"
|
#include "MediaMisc.h"
|
||||||
@@ -1218,16 +1218,7 @@ operator<(const media_file_format_id& a, const media_file_format_id& b)
|
|||||||
status_t
|
status_t
|
||||||
get_next_file_format(int32* cookie, media_file_format* mff)
|
get_next_file_format(int32* cookie, media_file_format* mff)
|
||||||
{
|
{
|
||||||
if (cookie == NULL || mff == NULL)
|
return BCodecKit::BCodecRoster::GetNextFileFormat(cookie, mff);
|
||||||
return B_BAD_VALUE;
|
|
||||||
|
|
||||||
status_t ret = AddOnManager::GetInstance()->GetFileFormat(mff, *cookie);
|
|
||||||
if (ret != B_OK)
|
|
||||||
return ret;
|
|
||||||
|
|
||||||
*cookie = *cookie + 1;
|
|
||||||
|
|
||||||
return B_OK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1255,5 +1246,3 @@ media_decode_info::media_decode_info()
|
|||||||
codec_data = NULL;
|
codec_data = NULL;
|
||||||
codec_data_size = 0;
|
codec_data_size = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -9,13 +9,16 @@
|
|||||||
|
|
||||||
#include <MediaEncoder.h>
|
#include <MediaEncoder.h>
|
||||||
|
|
||||||
|
#include <CodecRoster.h>
|
||||||
#include <Encoder.h>
|
#include <Encoder.h>
|
||||||
#include <PluginManager.h>
|
|
||||||
|
|
||||||
#include <new>
|
#include <new>
|
||||||
|
|
||||||
#include "MediaDebug.h"
|
#include "MediaDebug.h"
|
||||||
|
|
||||||
|
using namespace BCodecKit;
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************
|
/*************************************************************
|
||||||
* public BMediaEncoder
|
* public BMediaEncoder
|
||||||
*************************************************************/
|
*************************************************************/
|
||||||
@@ -76,7 +79,7 @@ BMediaEncoder::SetTo(const media_format* outputFormat)
|
|||||||
return fInitStatus;
|
return fInitStatus;
|
||||||
|
|
||||||
media_format format = *outputFormat;
|
media_format format = *outputFormat;
|
||||||
err = gPluginManager.CreateEncoder(&fEncoder, format);
|
err = BCodecRoster::InstantiateEncoder(&fEncoder, format);
|
||||||
if (fEncoder != NULL && err == B_OK) {
|
if (fEncoder != NULL && err == B_OK) {
|
||||||
err = _AttachToEncoder();
|
err = _AttachToEncoder();
|
||||||
if (err == B_OK)
|
if (err == B_OK)
|
||||||
@@ -94,7 +97,7 @@ BMediaEncoder::SetTo(const media_codec_info* mci)
|
|||||||
CALLED();
|
CALLED();
|
||||||
|
|
||||||
ReleaseEncoder();
|
ReleaseEncoder();
|
||||||
status_t err = gPluginManager.CreateEncoder(&fEncoder, mci, 0);
|
status_t err = BCodecRoster::InstantiateEncoder(&fEncoder, mci, 0);
|
||||||
if (fEncoder != NULL && err == B_OK) {
|
if (fEncoder != NULL && err == B_OK) {
|
||||||
err = _AttachToEncoder();
|
err = _AttachToEncoder();
|
||||||
if (err == B_OK) {
|
if (err == B_OK) {
|
||||||
@@ -216,7 +219,7 @@ BMediaEncoder::ReleaseEncoder()
|
|||||||
{
|
{
|
||||||
CALLED();
|
CALLED();
|
||||||
if (fEncoder != NULL) {
|
if (fEncoder != NULL) {
|
||||||
gPluginManager.DestroyEncoder(fEncoder);
|
BCodecRoster::ReleaseEncoder(fEncoder);
|
||||||
fEncoder = NULL;
|
fEncoder = NULL;
|
||||||
}
|
}
|
||||||
fInitStatus = B_NO_INIT;
|
fInitStatus = B_NO_INIT;
|
||||||
|
|||||||
@@ -6,20 +6,21 @@
|
|||||||
|
|
||||||
#include <MediaFile.h>
|
#include <MediaFile.h>
|
||||||
|
|
||||||
|
#include <File.h>
|
||||||
|
#include <MediaExtractor.h>
|
||||||
|
#include <MediaStreamer.h>
|
||||||
|
#include <MediaTrack.h>
|
||||||
|
#include <MediaWriter.h>
|
||||||
|
#include <Url.h>
|
||||||
|
|
||||||
#include <new>
|
#include <new>
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include <File.h>
|
|
||||||
#include <MediaTrack.h>
|
|
||||||
#include <Url.h>
|
|
||||||
|
|
||||||
#include "MediaDebug.h"
|
#include "MediaDebug.h"
|
||||||
|
|
||||||
#include "MediaExtractor.h"
|
using namespace BCodecKit;
|
||||||
#include "MediaStreamer.h"
|
|
||||||
#include "MediaWriter.h"
|
|
||||||
|
|
||||||
|
|
||||||
BMediaFile::BMediaFile(const entry_ref* ref)
|
BMediaFile::BMediaFile(const entry_ref* ref)
|
||||||
|
|||||||
@@ -7,6 +7,12 @@
|
|||||||
* Marcus Overhagen
|
* Marcus Overhagen
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <MediaFormats.h>
|
||||||
|
|
||||||
|
#include <CodecRoster.h>
|
||||||
|
#include <ObjectList.h>
|
||||||
|
#include <Message.h>
|
||||||
|
#include <Autolock.h>
|
||||||
|
|
||||||
#include "AddOnManager.h"
|
#include "AddOnManager.h"
|
||||||
#include "DataExchange.h"
|
#include "DataExchange.h"
|
||||||
@@ -14,11 +20,6 @@
|
|||||||
#include "MetaFormat.h"
|
#include "MetaFormat.h"
|
||||||
#include "MediaDebug.h"
|
#include "MediaDebug.h"
|
||||||
|
|
||||||
#include <MediaFormats.h>
|
|
||||||
#include <ObjectList.h>
|
|
||||||
#include <Message.h>
|
|
||||||
#include <Autolock.h>
|
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
using namespace BPrivate::media;
|
using namespace BPrivate::media;
|
||||||
@@ -47,7 +48,7 @@ get_next_encoder(int32* cookie, const media_file_format* fileFormat,
|
|||||||
media_format candidateInputFormat;
|
media_format candidateInputFormat;
|
||||||
media_format candidateOutputFormat;
|
media_format candidateOutputFormat;
|
||||||
|
|
||||||
status_t ret = AddOnManager::GetInstance()->GetCodecInfo(
|
status_t ret = BCodecKit::BCodecRoster::GetCodecInfo(
|
||||||
&candidateCodecInfo, &candidateFormatFamily,
|
&candidateCodecInfo, &candidateFormatFamily,
|
||||||
&candidateInputFormat, &candidateOutputFormat, *cookie);
|
&candidateInputFormat, &candidateOutputFormat, *cookie);
|
||||||
|
|
||||||
@@ -97,7 +98,7 @@ get_next_encoder(int32* cookie, const media_file_format* fileFormat,
|
|||||||
media_format candidateInputFormat;
|
media_format candidateInputFormat;
|
||||||
media_format candidateOutputFormat;
|
media_format candidateOutputFormat;
|
||||||
|
|
||||||
status_t ret = AddOnManager::GetInstance()->GetCodecInfo(
|
status_t ret = BCodecKit::BCodecRoster::GetCodecInfo(
|
||||||
&candidateCodecInfo, &candidateFormatFamily, &candidateInputFormat,
|
&candidateCodecInfo, &candidateFormatFamily, &candidateInputFormat,
|
||||||
&candidateOutputFormat, *cookie);
|
&candidateOutputFormat, *cookie);
|
||||||
|
|
||||||
@@ -145,7 +146,7 @@ get_next_encoder(int32* cookie, media_codec_info* _codecInfo)
|
|||||||
media_format inputFormat;
|
media_format inputFormat;
|
||||||
media_format outputFormat;
|
media_format outputFormat;
|
||||||
|
|
||||||
status_t ret = AddOnManager::GetInstance()->GetCodecInfo(_codecInfo,
|
status_t ret = BCodecKit::BCodecRoster::GetCodecInfo(_codecInfo,
|
||||||
&formatFamily, &inputFormat, &outputFormat, *cookie);
|
&formatFamily, &inputFormat, &outputFormat, *cookie);
|
||||||
if (ret != B_OK)
|
if (ret != B_OK)
|
||||||
return ret;
|
return ret;
|
||||||
@@ -366,7 +367,7 @@ update_media_formats()
|
|||||||
|
|
||||||
// We want the add-ons to register themselves with the format manager, so
|
// We want the add-ons to register themselves with the format manager, so
|
||||||
// the list is up to date.
|
// the list is up to date.
|
||||||
AddOnManager::GetInstance()->RegisterAddOns();
|
BCodecKit::BPrivate::AddOnManager::GetInstance()->RegisterAddOns();
|
||||||
|
|
||||||
BMessage reply;
|
BMessage reply;
|
||||||
FormatManager::GetInstance()->GetFormats(sLastFormatsUpdate, reply);
|
FormatManager::GetInstance()->GetFormats(sLastFormatsUpdate, reply);
|
||||||
@@ -621,10 +622,8 @@ BMediaFormats::MakeFormatFor(const media_format_description* descriptions,
|
|||||||
int32 descriptionCount, media_format* format, uint32 flags,
|
int32 descriptionCount, media_format* format, uint32 flags,
|
||||||
void* _reserved)
|
void* _reserved)
|
||||||
{
|
{
|
||||||
status_t status = FormatManager::GetInstance()->MakeFormatFor(descriptions,
|
return BCodecKit::BCodecRoster::MakeFormatFor(descriptions,
|
||||||
descriptionCount, *format, flags, _reserved);
|
descriptionCount, *format, flags, _reserved);
|
||||||
|
|
||||||
return status;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -638,4 +637,3 @@ BMediaFormats::MakeFormatFor(const media_format_description& description,
|
|||||||
*_outFormat = inFormat;
|
*_outFormat = inFormat;
|
||||||
return MakeFormatFor(&description, 1, _outFormat);
|
return MakeFormatFor(&description, 1, _outFormat);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -12,17 +12,18 @@
|
|||||||
|
|
||||||
#include <MediaTrack.h>
|
#include <MediaTrack.h>
|
||||||
|
|
||||||
|
#include <CodecRoster.h>
|
||||||
|
#include <MediaExtractor.h>
|
||||||
|
#include <MediaWriter.h>
|
||||||
|
#include <Roster.h>
|
||||||
|
|
||||||
#include <new>
|
#include <new>
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include <Roster.h>
|
using namespace BCodecKit;
|
||||||
|
|
||||||
#include "MediaExtractor.h"
|
|
||||||
#include "MediaWriter.h"
|
|
||||||
#include "PluginManager.h"
|
|
||||||
|
|
||||||
|
|
||||||
//#define TRACE_MEDIA_TRACK
|
//#define TRACE_MEDIA_TRACK
|
||||||
@@ -84,9 +85,9 @@ BMediaTrack::~BMediaTrack()
|
|||||||
{
|
{
|
||||||
CALLED();
|
CALLED();
|
||||||
|
|
||||||
gPluginManager.DestroyDecoder(fRawDecoder);
|
BCodecRoster::ReleaseDecoder(fRawDecoder);
|
||||||
gPluginManager.DestroyDecoder(fDecoder);
|
BCodecRoster::ReleaseDecoder(fDecoder);
|
||||||
gPluginManager.DestroyEncoder(fEncoder);
|
BCodecRoster::ReleaseEncoder(fEncoder);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*************************************************************
|
/*************************************************************
|
||||||
@@ -163,7 +164,7 @@ BMediaTrack::DecodedFormat(media_format* _format, uint32 flags)
|
|||||||
if (fExtractor == NULL || fDecoder == NULL)
|
if (fExtractor == NULL || fDecoder == NULL)
|
||||||
return B_NO_INIT;
|
return B_NO_INIT;
|
||||||
|
|
||||||
gPluginManager.DestroyDecoder(fRawDecoder);
|
BCodecRoster::ReleaseDecoder(fRawDecoder);
|
||||||
fRawDecoder = NULL;
|
fRawDecoder = NULL;
|
||||||
|
|
||||||
#ifdef TRACE_MEDIA_TRACK
|
#ifdef TRACE_MEDIA_TRACK
|
||||||
@@ -839,7 +840,7 @@ BMediaTrack::Perform(int32 selector, void* data)
|
|||||||
// #pragma mark - private
|
// #pragma mark - private
|
||||||
|
|
||||||
|
|
||||||
BMediaTrack::BMediaTrack(BPrivate::media::BMediaExtractor* extractor,
|
BMediaTrack::BMediaTrack(BCodecKit::BMediaExtractor* extractor,
|
||||||
int32 stream)
|
int32 stream)
|
||||||
{
|
{
|
||||||
CALLED();
|
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,
|
int32 streamIndex, media_format* format,
|
||||||
const media_codec_info* codecInfo)
|
const media_codec_info* codecInfo)
|
||||||
{
|
{
|
||||||
@@ -950,7 +951,7 @@ BMediaTrack::SetupWorkaround()
|
|||||||
bool
|
bool
|
||||||
BMediaTrack::SetupFormatTranslation(const media_format &from, media_format* to)
|
BMediaTrack::SetupFormatTranslation(const media_format &from, media_format* to)
|
||||||
{
|
{
|
||||||
gPluginManager.DestroyDecoder(fRawDecoder);
|
BCodecRoster::ReleaseDecoder(fRawDecoder);
|
||||||
fRawDecoder = NULL;
|
fRawDecoder = NULL;
|
||||||
|
|
||||||
#ifdef TRACE_MEDIA_TRACK
|
#ifdef TRACE_MEDIA_TRACK
|
||||||
@@ -959,7 +960,7 @@ BMediaTrack::SetupFormatTranslation(const media_format &from, media_format* to)
|
|||||||
printf("BMediaTrack::SetupFormatTranslation: from: %s\n", s);
|
printf("BMediaTrack::SetupFormatTranslation: from: %s\n", s);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
status_t result = gPluginManager.CreateDecoder(&fRawDecoder, from);
|
status_t result = BCodecRoster::InstantiateDecoder(&fRawDecoder, from);
|
||||||
if (result != B_OK) {
|
if (result != B_OK) {
|
||||||
ERROR("BMediaTrack::SetupFormatTranslation: CreateDecoder failed\n");
|
ERROR("BMediaTrack::SetupFormatTranslation: CreateDecoder failed\n");
|
||||||
return false;
|
return false;
|
||||||
@@ -1007,7 +1008,7 @@ BMediaTrack::SetupFormatTranslation(const media_format &from, media_format* to)
|
|||||||
return true;
|
return true;
|
||||||
|
|
||||||
error:
|
error:
|
||||||
gPluginManager.DestroyDecoder(fRawDecoder);
|
BCodecRoster::ReleaseDecoder(fRawDecoder);
|
||||||
fRawDecoder = NULL;
|
fRawDecoder = NULL;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user