integration of codec API into BMediaFile and BMediaTrack
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@5468 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -10,7 +10,9 @@
|
||||
|
||||
|
||||
namespace BPrivate {
|
||||
class MediaExtractor;
|
||||
namespace media {
|
||||
class MediaExtractor;
|
||||
}
|
||||
class _IMPEXP_MEDIA MediaWriter;
|
||||
class _AddonManager;
|
||||
}
|
||||
@@ -60,13 +62,7 @@ public:
|
||||
BMediaFile(BDataIO *destination, // BFile is a BDataIO
|
||||
const media_file_format * mfi,
|
||||
int32 flags=0);
|
||||
|
||||
/* modified by Marcus Overhagen */
|
||||
BMediaFile(const media_file_format * mfi,
|
||||
int32 flags);
|
||||
/* modified by Marcus Overhagen */
|
||||
|
||||
|
||||
|
||||
virtual ~BMediaFile();
|
||||
|
||||
status_t InitCheck() const;
|
||||
@@ -123,7 +119,7 @@ BMediaFile(const media_file_format * mfi,
|
||||
virtual status_t Perform(int32 selector, void * data);
|
||||
|
||||
private:
|
||||
BPrivate::MediaExtractor *fExtractor;
|
||||
BPrivate::media::MediaExtractor *fExtractor;
|
||||
int32 _reserved_BMediaFile_was_fExtractorID;
|
||||
int32 fTrackNum;
|
||||
status_t fErr;
|
||||
@@ -136,7 +132,7 @@ private:
|
||||
|
||||
bool fFileClosed;
|
||||
bool _reserved_was_fUnused[3];
|
||||
BList *fTrackList;
|
||||
BMediaTrack **fTrackList;
|
||||
|
||||
void Init();
|
||||
void InitReader(BDataIO *source, int32 flags = 0);
|
||||
@@ -147,12 +143,12 @@ private:
|
||||
BMediaFile(const BMediaFile&);
|
||||
BMediaFile& operator=(const BMediaFile&);
|
||||
|
||||
BFile *fFile;
|
||||
BDataIO *fSource;
|
||||
|
||||
|
||||
/* fbc data and virtuals */
|
||||
|
||||
uint32 _reserved_BMediaFile_[32];
|
||||
uint32 _reserved_BMediaFile_[32];
|
||||
|
||||
virtual status_t _Reserved_BMediaFile_0(int32 arg, ...);
|
||||
virtual status_t _Reserved_BMediaFile_1(int32 arg, ...);
|
||||
|
||||
@@ -6,10 +6,12 @@
|
||||
#include <MediaFormats.h>
|
||||
|
||||
namespace BPrivate {
|
||||
class MediaExtractor;
|
||||
class Decoder;
|
||||
class MediaWriter;
|
||||
class Encoder;
|
||||
namespace media {
|
||||
class MediaExtractor;
|
||||
class Decoder;
|
||||
class Encoder;
|
||||
}
|
||||
}
|
||||
|
||||
class BView;
|
||||
@@ -192,23 +194,22 @@ public:
|
||||
virtual status_t Perform(int32 selector, void * data);
|
||||
|
||||
private:
|
||||
friend class BMediaFile;
|
||||
|
||||
// for read-only access to a track
|
||||
BMediaTrack(BPrivate::MediaExtractor *extractor, int32 stream);
|
||||
BMediaTrack(BPrivate::media::MediaExtractor *extractor, int32 stream);
|
||||
|
||||
// for write-only access to a BMediaTrack
|
||||
BMediaTrack(BPrivate::MediaWriter *writer,
|
||||
int32 stream_num,
|
||||
media_format *in_format,
|
||||
BPrivate::Encoder *encoder,
|
||||
BPrivate::media::Encoder *encoder,
|
||||
media_codec_info *mci);
|
||||
|
||||
status_t TrackInfo(media_format *out_format, void **out_info,
|
||||
int32 *out_infoSize);
|
||||
|
||||
status_t fErr;
|
||||
BPrivate::Decoder *fDecoder;
|
||||
int32 fDecoderID;
|
||||
BPrivate::MediaExtractor *fExtractor;
|
||||
BPrivate::media::Decoder *fDecoder;
|
||||
int32 __unused__fDecoderID;
|
||||
BPrivate::media::MediaExtractor *fExtractor;
|
||||
|
||||
int32 fStream;
|
||||
int64 fCurFrame;
|
||||
@@ -216,26 +217,21 @@ private:
|
||||
|
||||
media_codec_info fMCI;
|
||||
|
||||
BPrivate::Encoder *fEncoder;
|
||||
BPrivate::media::Encoder *fEncoder;
|
||||
int32 fEncoderID;
|
||||
BPrivate::MediaWriter *fWriter;
|
||||
media_format fWriterFormat;
|
||||
void *fExtractorCookie;
|
||||
void *__unused__fExtractorCookie;
|
||||
|
||||
protected:
|
||||
int32 EncoderID() { return fEncoderID; };
|
||||
|
||||
private:
|
||||
|
||||
friend class BMediaFile;
|
||||
friend class BPrivate::Decoder;
|
||||
|
||||
BMediaTrack();
|
||||
BMediaTrack(const BMediaTrack&);
|
||||
BMediaTrack& operator=(const BMediaTrack&);
|
||||
|
||||
static BPrivate::Decoder * find_decoder(BMediaTrack *track, int32 *id);
|
||||
|
||||
/* fbc data and virtuals */
|
||||
|
||||
uint32 _reserved_BMediaTrack_[31];
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#include <MediaTrack.h>
|
||||
#include <MediaFormats.h>
|
||||
#include "MediaPlugin.h"
|
||||
#include "ReaderPlugin.h"
|
||||
|
||||
namespace BPrivate { namespace media {
|
||||
|
||||
@@ -14,19 +15,20 @@ public:
|
||||
virtual status_t Setup(media_format *ioEncodedFormat, media_format *ioDecodedFormat,
|
||||
const void *infoBuffer, int32 infoSize) = 0;
|
||||
|
||||
virtual status_t Seek(media_seek_type seekTo,
|
||||
virtual status_t Seek(uint32 seekTo,
|
||||
int64 seekFrame, int64 *frame,
|
||||
bigtime_t seekTime, bigtime_t *time) = 0;
|
||||
|
||||
virtual status_t Decode(void *buffer, int64 *frameCount,
|
||||
media_header *mediaHeader, media_decode_info *info) = 0;
|
||||
media_header *mediaHeader, media_decode_info *info = 0) = 0;
|
||||
|
||||
status_t GetNextChunk(void **chunkBuffer, int32 *chunkSize,
|
||||
media_header *mediaHeader);
|
||||
|
||||
private:
|
||||
void Setup(BMediaTrack *reader);
|
||||
BMediaTrack * fReader;
|
||||
void Setup(Reader *reader, void *readerCookie);
|
||||
Reader * fReader;
|
||||
void * fReaderCookie;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
#ifndef _MEDIA_EXTRACTOR_H
|
||||
#define _MEDIA_EXTRACTOR_H
|
||||
|
||||
#include "ReaderPlugin.h"
|
||||
#include "DecoderPlugin.h"
|
||||
|
||||
namespace BPrivate {
|
||||
namespace media {
|
||||
|
||||
class MediaExtractor
|
||||
{
|
||||
public:
|
||||
MediaExtractor(BDataIO * source, int32 flags);
|
||||
~MediaExtractor();
|
||||
|
||||
status_t InitCheck();
|
||||
|
||||
void GetFileFormatInfo(media_file_format *mfi) const;
|
||||
|
||||
int32 StreamCount();
|
||||
|
||||
media_format * EncodedFormat(int32 stream);
|
||||
int64 CountFrames(int32 stream) const;
|
||||
bigtime_t Duration(int32 stream) const;
|
||||
void * InfoBuffer(int32 stream) const;
|
||||
int32 InfoBufferSize(int32 stream) const;
|
||||
|
||||
status_t Seek(int32 stream, uint32 seekTo,
|
||||
int64 *frame, bigtime_t *time);
|
||||
|
||||
status_t GetNextChunk(int32 stream,
|
||||
void **chunkBuffer, int32 *chunkSize,
|
||||
media_header *mediaHeader);
|
||||
|
||||
status_t CreateDecoder(int32 stream, Decoder **decoder, media_codec_info *mci);
|
||||
|
||||
};
|
||||
|
||||
}; // namespace media
|
||||
}; // namespace BPrivate
|
||||
|
||||
using namespace BPrivate::media;
|
||||
|
||||
#endif
|
||||
@@ -40,7 +40,7 @@ mp3Decoder::Setup(media_format *ioEncodedFormat, media_format *ioDecodedFormat,
|
||||
}
|
||||
|
||||
status_t
|
||||
mp3Decoder::Seek(media_seek_type seekTo,
|
||||
mp3Decoder::Seek(uint32 seekTo,
|
||||
int64 seekFrame, int64 *frame,
|
||||
bigtime_t seekTime, bigtime_t *time)
|
||||
{
|
||||
@@ -52,7 +52,7 @@ mp3Decoder::Seek(media_seek_type seekTo,
|
||||
|
||||
status_t
|
||||
mp3Decoder::Decode(void *buffer, int64 *frameCount,
|
||||
media_header *mediaHeader, media_decode_info *info)
|
||||
media_header *mediaHeader, media_decode_info *info /* = 0 */)
|
||||
{
|
||||
void *chunkBuffer;
|
||||
int32 chunkSize;
|
||||
|
||||
@@ -11,7 +11,7 @@ public:
|
||||
status_t Setup(media_format *ioEncodedFormat, media_format *ioDecodedFormat,
|
||||
const void *infoBuffer, int32 infoSize);
|
||||
|
||||
status_t Seek(media_seek_type seekTo,
|
||||
status_t Seek(uint32 seekTo,
|
||||
int64 seekFrame, int64 *frame,
|
||||
bigtime_t seekTime, bigtime_t *time);
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ RawDecoder::Setup(media_format *ioEncodedFormat, media_format *ioDecodedFormat,
|
||||
|
||||
|
||||
status_t
|
||||
RawDecoder::Seek(media_seek_type seekTo,
|
||||
RawDecoder::Seek(uint32 seekTo,
|
||||
int64 seekFrame, int64 *frame,
|
||||
bigtime_t seekTime, bigtime_t *time)
|
||||
{
|
||||
@@ -40,7 +40,7 @@ RawDecoder::Seek(media_seek_type seekTo,
|
||||
|
||||
status_t
|
||||
RawDecoder::Decode(void *buffer, int64 *frameCount,
|
||||
media_header *mediaHeader, media_decode_info *info)
|
||||
media_header *mediaHeader, media_decode_info *info /* = 0 */)
|
||||
{
|
||||
void *chunkBuffer;
|
||||
int32 chunkSize;
|
||||
|
||||
@@ -6,7 +6,7 @@ public:
|
||||
status_t Setup(media_format *ioEncodedFormat, media_format *ioDecodedFormat,
|
||||
const void *infoBuffer, int32 infoSize);
|
||||
|
||||
status_t Seek(media_seek_type seekTo,
|
||||
status_t Seek(uint32 seekTo,
|
||||
int64 seekFrame, int64 *frame,
|
||||
bigtime_t seekTime, bigtime_t *time);
|
||||
|
||||
|
||||
@@ -15,16 +15,16 @@ status_t
|
||||
Decoder::GetNextChunk(void **chunkBuffer, int32 *chunkSize,
|
||||
media_header *mediaHeader)
|
||||
{
|
||||
return fReader->ReadChunk((char **)chunkBuffer, chunkSize, mediaHeader);
|
||||
return fReader->GetNextChunk(fReaderCookie, chunkBuffer, chunkSize, mediaHeader);
|
||||
}
|
||||
|
||||
void
|
||||
Decoder::Setup(BMediaTrack *reader)
|
||||
Decoder::Setup(Reader *reader, void *readerCookie)
|
||||
{
|
||||
fReader = reader;
|
||||
fReaderCookie = readerCookie;
|
||||
}
|
||||
|
||||
|
||||
DecoderPlugin::DecoderPlugin()
|
||||
{
|
||||
}
|
||||
|
||||
@@ -73,6 +73,7 @@ SharedLibrary media :
|
||||
MediaPlugin.cpp
|
||||
ReaderPlugin.cpp
|
||||
DecoderPlugin.cpp
|
||||
MediaExtractor.cpp
|
||||
;
|
||||
|
||||
LinkSharedOSLibs libmedia.so :
|
||||
|
||||
@@ -0,0 +1,78 @@
|
||||
#include "MediaExtractor.h"
|
||||
|
||||
MediaExtractor::MediaExtractor(BDataIO * source, int32 flags)
|
||||
{
|
||||
}
|
||||
|
||||
MediaExtractor::~MediaExtractor()
|
||||
{
|
||||
}
|
||||
|
||||
status_t
|
||||
MediaExtractor::InitCheck()
|
||||
{
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
void
|
||||
MediaExtractor::GetFileFormatInfo(media_file_format *mfi) const
|
||||
{
|
||||
}
|
||||
|
||||
int32
|
||||
MediaExtractor::StreamCount()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
media_format *
|
||||
MediaExtractor::EncodedFormat(int32 stream)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int64
|
||||
MediaExtractor::CountFrames(int32 stream) const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
bigtime_t
|
||||
MediaExtractor::Duration(int32 stream) const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void *
|
||||
MediaExtractor::InfoBuffer(int32 stream) const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32
|
||||
MediaExtractor::InfoBufferSize(int32 stream) const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
status_t
|
||||
MediaExtractor::Seek(int32 stream, uint32 seekTo,
|
||||
int64 *frame, bigtime_t *time)
|
||||
{
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
status_t
|
||||
MediaExtractor::GetNextChunk(int32 stream,
|
||||
void **chunkBuffer, int32 *chunkSize,
|
||||
media_header *mediaHeader)
|
||||
{
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
status_t
|
||||
MediaExtractor::CreateDecoder(int32 stream, Decoder **decoder, media_codec_info *mci)
|
||||
{
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
@@ -5,6 +5,9 @@
|
||||
***********************************************************************/
|
||||
#include <MediaFile.h>
|
||||
#include <MediaTrack.h>
|
||||
#include <File.h>
|
||||
#include <string.h>
|
||||
#include "MediaExtractor.h"
|
||||
#include "debug.h"
|
||||
|
||||
|
||||
@@ -14,66 +17,78 @@
|
||||
|
||||
BMediaFile::BMediaFile(const entry_ref *ref)
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
CALLED();
|
||||
Init();
|
||||
InitReader(new BFile(ref, O_RDONLY));
|
||||
}
|
||||
|
||||
BMediaFile::BMediaFile(BDataIO * source)
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
CALLED();
|
||||
Init();
|
||||
InitReader(source);
|
||||
}
|
||||
|
||||
BMediaFile::BMediaFile(const entry_ref * ref,
|
||||
int32 flags)
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
CALLED();
|
||||
Init();
|
||||
InitReader(new BFile(ref, O_RDONLY), flags);
|
||||
}
|
||||
|
||||
BMediaFile::BMediaFile(BDataIO * source,
|
||||
int32 flags)
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
CALLED();
|
||||
Init();
|
||||
InitReader(source, flags);
|
||||
}
|
||||
|
||||
BMediaFile::BMediaFile(const entry_ref *ref,
|
||||
const media_file_format * mfi,
|
||||
int32 flags)
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
CALLED();
|
||||
Init();
|
||||
InitWriter(new BFile(ref, O_WRONLY), mfi, flags);
|
||||
}
|
||||
|
||||
BMediaFile::BMediaFile(BDataIO *destination,
|
||||
const media_file_format * mfi,
|
||||
int32 flags)
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
}
|
||||
|
||||
|
||||
BMediaFile::BMediaFile(const media_file_format * mfi,
|
||||
int32 flags)
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
CALLED();
|
||||
Init();
|
||||
InitWriter(destination, mfi, flags);
|
||||
}
|
||||
|
||||
/* virtual */
|
||||
BMediaFile::~BMediaFile()
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
CALLED();
|
||||
|
||||
ReleaseAllTracks();
|
||||
delete fTrackList;
|
||||
delete fExtractor;
|
||||
delete fSource;
|
||||
}
|
||||
|
||||
status_t
|
||||
BMediaFile::InitCheck() const
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
|
||||
return B_OK;
|
||||
CALLED();
|
||||
return fErr;
|
||||
}
|
||||
|
||||
// Get info about the underlying file format.
|
||||
status_t
|
||||
BMediaFile::GetFileFormatInfo(media_file_format *mfi) const
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
CALLED();
|
||||
if (fErr)
|
||||
return B_ERROR;
|
||||
*mfi = fMFI;
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
@@ -81,14 +96,13 @@ const char *
|
||||
BMediaFile::Copyright(void) const
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
return "";
|
||||
return "BMediaFile::Copyright";
|
||||
}
|
||||
|
||||
int32
|
||||
BMediaFile::CountTracks() const
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
return 1;
|
||||
return fTrackNum;
|
||||
}
|
||||
|
||||
|
||||
@@ -97,8 +111,12 @@ BMediaFile::CountTracks() const
|
||||
BMediaTrack *
|
||||
BMediaFile::TrackAt(int32 index)
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
return new BMediaTrack(0, 0);
|
||||
CALLED();
|
||||
if (!fTrackList || !fExtractor || index < 0 || index >= fTrackNum)
|
||||
return 0;
|
||||
if (!fTrackList[index])
|
||||
fTrackList[index] = new BMediaTrack(fExtractor, index);
|
||||
return fTrackList[index];
|
||||
}
|
||||
|
||||
|
||||
@@ -109,14 +127,31 @@ BMediaFile::TrackAt(int32 index)
|
||||
status_t
|
||||
BMediaFile::ReleaseTrack(BMediaTrack *track)
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
return B_OK;
|
||||
CALLED();
|
||||
if (!fTrackList || !track)
|
||||
return B_ERROR;
|
||||
for (int32 i = 0; i < fTrackNum; i++) {
|
||||
if (fTrackList[i] == track) {
|
||||
delete track;
|
||||
fTrackList[i] = 0;
|
||||
return B_OK;
|
||||
}
|
||||
}
|
||||
return B_ERROR;
|
||||
}
|
||||
|
||||
status_t
|
||||
BMediaFile::ReleaseAllTracks(void)
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
CALLED();
|
||||
if (!fTrackList)
|
||||
return B_ERROR;
|
||||
for (int32 i = 0; i < fTrackNum; i++) {
|
||||
if (fTrackList[i]) {
|
||||
delete fTrackList[i];
|
||||
fTrackList[i] = 0;
|
||||
}
|
||||
}
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
@@ -219,19 +254,44 @@ BMediaFile::Perform(int32 selector, void * data)
|
||||
void
|
||||
BMediaFile::Init()
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
CALLED();
|
||||
fSource = 0;
|
||||
fTrackNum = 0;
|
||||
fTrackList = 0;
|
||||
fExtractor = 0;
|
||||
fErr = B_OK;
|
||||
|
||||
// not used so far:
|
||||
fEncoderMgr = 0;
|
||||
fWriterMgr = 0;
|
||||
fWriter = 0;
|
||||
fWriterID = 0;
|
||||
fFileClosed = 0;
|
||||
}
|
||||
|
||||
void
|
||||
BMediaFile::InitReader(BDataIO *source, int32 flags /* = 0 */)
|
||||
BMediaFile::InitReader(BDataIO *source, int32 flags)
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
CALLED();
|
||||
|
||||
fSource = source;
|
||||
fExtractor = new MediaExtractor(source, flags);
|
||||
fErr = fExtractor->InitCheck();
|
||||
if (fErr)
|
||||
return;
|
||||
|
||||
fExtractor->GetFileFormatInfo(&fMFI);
|
||||
fTrackNum = fExtractor->StreamCount();
|
||||
fTrackList = new BMediaTrack *[fTrackNum];
|
||||
memset(fTrackList, 0, fTrackNum * sizeof(BMediaTrack *));
|
||||
}
|
||||
|
||||
void
|
||||
BMediaFile::InitWriter(BDataIO *source, const media_file_format * mfi, int32 flags)
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
fSource = source;
|
||||
fErr = B_NOT_ALLOWED;
|
||||
}
|
||||
|
||||
|
||||
|
||||
+142
-57
@@ -4,6 +4,8 @@
|
||||
* DESCR:
|
||||
***********************************************************************/
|
||||
#include <MediaTrack.h>
|
||||
#include "MediaExtractor.h"
|
||||
#include "ReaderPlugin.h"
|
||||
#include "debug.h"
|
||||
|
||||
/*************************************************************
|
||||
@@ -12,7 +14,8 @@
|
||||
|
||||
BMediaTrack::~BMediaTrack()
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
CALLED();
|
||||
delete fDecoder;
|
||||
}
|
||||
|
||||
/*************************************************************
|
||||
@@ -22,25 +25,33 @@ BMediaTrack::~BMediaTrack()
|
||||
status_t
|
||||
BMediaTrack::InitCheck() const
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
|
||||
return B_OK;
|
||||
CALLED();
|
||||
return fErr;
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
BMediaTrack::GetCodecInfo(media_codec_info *mci) const
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
CALLED();
|
||||
if (!fDecoder)
|
||||
return B_NO_INIT;
|
||||
|
||||
return B_ERROR;
|
||||
*mci = fMCI;
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
BMediaTrack::EncodedFormat(media_format *out_format) const
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
CALLED();
|
||||
if (!out_format)
|
||||
return B_BAD_VALUE;
|
||||
if (!fExtractor)
|
||||
return B_NO_INIT;
|
||||
|
||||
out_format = fExtractor->EncodedFormat(fStream);
|
||||
|
||||
return B_OK;
|
||||
}
|
||||
@@ -49,45 +60,44 @@ BMediaTrack::EncodedFormat(media_format *out_format) const
|
||||
status_t
|
||||
BMediaTrack::DecodedFormat(media_format *inout_format)
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
|
||||
return B_OK;
|
||||
CALLED();
|
||||
if (!inout_format)
|
||||
return B_BAD_VALUE;
|
||||
if (!fExtractor || !fDecoder)
|
||||
return B_NO_INIT;
|
||||
|
||||
return fDecoder->Setup(fExtractor->EncodedFormat(fStream), inout_format,
|
||||
fExtractor->InfoBuffer(fStream), fExtractor->InfoBufferSize(fStream));
|
||||
}
|
||||
|
||||
|
||||
int64
|
||||
BMediaTrack::CountFrames() const
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
|
||||
return 100000;
|
||||
CALLED();
|
||||
return fExtractor ? fExtractor->CountFrames(fStream) : 0;
|
||||
}
|
||||
|
||||
|
||||
bigtime_t
|
||||
BMediaTrack::Duration() const
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
|
||||
return 1000000;
|
||||
CALLED();
|
||||
return fExtractor ? fExtractor->Duration(fStream) : 0;
|
||||
}
|
||||
|
||||
|
||||
int64
|
||||
BMediaTrack::CurrentFrame() const
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
|
||||
return 0;
|
||||
return fCurFrame;
|
||||
}
|
||||
|
||||
|
||||
bigtime_t
|
||||
BMediaTrack::CurrentTime() const
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
|
||||
return 0;
|
||||
return fCurTime;
|
||||
}
|
||||
|
||||
|
||||
@@ -96,21 +106,35 @@ BMediaTrack::ReadFrames(void *out_buffer,
|
||||
int64 *out_frameCount,
|
||||
media_header *mh)
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
|
||||
return B_OK;
|
||||
return ReadFrames(out_buffer, out_frameCount, mh, 0);
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
BMediaTrack::ReadFrames(void *out_buffer,
|
||||
int64 *out_frameCount,
|
||||
media_header *mh,
|
||||
media_decode_info *info)
|
||||
media_header *mh /* = 0 */,
|
||||
media_decode_info *info /* = 0 */)
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
CALLED();
|
||||
if (!fDecoder)
|
||||
return B_NO_INIT;
|
||||
if (!out_buffer || !out_frameCount)
|
||||
return B_BAD_VALUE;
|
||||
|
||||
status_t result;
|
||||
|
||||
return B_OK;
|
||||
media_header temp_header;
|
||||
if (!mh)
|
||||
mh = &temp_header;
|
||||
|
||||
*out_frameCount = 0;
|
||||
result = fDecoder->Decode(out_buffer, out_frameCount, mh, info);
|
||||
|
||||
fCurFrame += *out_frameCount;
|
||||
fCurTime = mh->start_time;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@@ -129,7 +153,34 @@ status_t
|
||||
BMediaTrack::SeekToTime(bigtime_t *inout_time,
|
||||
int32 flags)
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
CALLED();
|
||||
if (!fDecoder || !fExtractor)
|
||||
return B_NO_INIT;
|
||||
if (!inout_time || !(flags & B_MEDIA_SEEK_DIRECTION_MASK))
|
||||
return B_BAD_VALUE;
|
||||
|
||||
status_t result;
|
||||
uint32 seekTo;
|
||||
bigtime_t seekTime;
|
||||
|
||||
int64 frame;
|
||||
bigtime_t time;
|
||||
|
||||
seekTo = (flags & B_MEDIA_SEEK_DIRECTION_MASK) | B_MEDIA_SEEK_TO_TIME;
|
||||
seekTime = *inout_time;
|
||||
|
||||
time = seekTime;
|
||||
result = fExtractor->Seek(fStream, seekTo, &frame, &time);
|
||||
if (result != B_OK)
|
||||
return result;
|
||||
|
||||
result = fDecoder->Seek(seekTo, 0, &frame, seekTime, &time);
|
||||
if (result != B_OK)
|
||||
return result;
|
||||
|
||||
*inout_time = time;
|
||||
fCurFrame = frame;
|
||||
fCurTime = time;
|
||||
|
||||
return B_OK;
|
||||
}
|
||||
@@ -139,7 +190,34 @@ status_t
|
||||
BMediaTrack::SeekToFrame(int64 *inout_frame,
|
||||
int32 flags)
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
CALLED();
|
||||
if (!fDecoder || !fExtractor)
|
||||
return B_NO_INIT;
|
||||
if (!inout_frame || !(flags & B_MEDIA_SEEK_DIRECTION_MASK))
|
||||
return B_BAD_VALUE;
|
||||
|
||||
status_t result;
|
||||
uint32 seekTo;
|
||||
int64 seekFrame;
|
||||
|
||||
int64 frame;
|
||||
bigtime_t time;
|
||||
|
||||
seekTo = (flags & B_MEDIA_SEEK_DIRECTION_MASK) | B_MEDIA_SEEK_TO_FRAME;
|
||||
seekFrame = *inout_frame;
|
||||
|
||||
frame = seekFrame;
|
||||
result = fExtractor->Seek(fStream, seekTo, &frame, &time);
|
||||
if (result != B_OK)
|
||||
return result;
|
||||
|
||||
result = fDecoder->Seek(seekTo, seekFrame, &frame, 0, &time);
|
||||
if (result != B_OK)
|
||||
return result;
|
||||
|
||||
*inout_frame = frame;
|
||||
fCurFrame = frame;
|
||||
fCurTime = time;
|
||||
|
||||
return B_OK;
|
||||
}
|
||||
@@ -168,11 +246,24 @@ BMediaTrack::FindKeyFrameForFrame(int64 *inout_frame,
|
||||
status_t
|
||||
BMediaTrack::ReadChunk(char **out_buffer,
|
||||
int32 *out_size,
|
||||
media_header *mh)
|
||||
media_header *mh /* = 0 */)
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
CALLED();
|
||||
if (!fExtractor)
|
||||
return B_NO_INIT;
|
||||
if (!out_buffer || !out_size)
|
||||
return B_BAD_VALUE;
|
||||
|
||||
return B_OK;
|
||||
status_t result;
|
||||
media_header temp_header;
|
||||
if (!mh)
|
||||
mh = &temp_header;
|
||||
|
||||
result = fExtractor->GetNextChunk(fStream, (void **)out_buffer, out_size, mh);
|
||||
|
||||
fCurTime = mh->start_time;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@@ -337,33 +428,36 @@ BMediaTrack::Perform(int32 selector,
|
||||
* private BMediaTrack
|
||||
*************************************************************/
|
||||
|
||||
BMediaTrack::BMediaTrack(BPrivate::MediaExtractor *extractor,
|
||||
BMediaTrack::BMediaTrack(BPrivate::media::MediaExtractor *extractor,
|
||||
int32 stream)
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
CALLED();
|
||||
fExtractor = extractor;
|
||||
fStream = stream;
|
||||
|
||||
if (B_OK != fExtractor->CreateDecoder(fStream, &fDecoder, &fMCI))
|
||||
fDecoder = 0;
|
||||
|
||||
fCurFrame = 0;
|
||||
fCurTime = 0;
|
||||
fErr = B_OK;
|
||||
|
||||
// not used:
|
||||
fEncoder = 0;
|
||||
fEncoderID = 0;
|
||||
fWriter = 0;
|
||||
}
|
||||
|
||||
|
||||
BMediaTrack::BMediaTrack(BPrivate::MediaWriter *writer,
|
||||
int32 stream_num,
|
||||
media_format *in_format,
|
||||
BPrivate::Encoder *encoder,
|
||||
BPrivate::media::Encoder *encoder,
|
||||
media_codec_info *mci)
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
BMediaTrack::TrackInfo(media_format *out_format,
|
||||
void **out_info,
|
||||
int32 *out_infoSize)
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
|
||||
return B_ERROR;
|
||||
}
|
||||
|
||||
/*
|
||||
// unimplemented
|
||||
BMediaTrack::BMediaTrack()
|
||||
@@ -371,15 +465,6 @@ BMediaTrack::BMediaTrack(const BMediaTrack &)
|
||||
BMediaTrack &BMediaTrack::operator=(const BMediaTrack &)
|
||||
*/
|
||||
|
||||
BPrivate::Decoder *
|
||||
BMediaTrack::find_decoder(BMediaTrack *track,
|
||||
int32 *id)
|
||||
{
|
||||
UNIMPLEMENTED();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
status_t BMediaTrack::_Reserved_BMediaTrack_0(int32 arg, ...) { return B_ERROR; }
|
||||
status_t BMediaTrack::_Reserved_BMediaTrack_1(int32 arg, ...) { return B_ERROR; }
|
||||
status_t BMediaTrack::_Reserved_BMediaTrack_2(int32 arg, ...) { return B_ERROR; }
|
||||
|
||||
Reference in New Issue
Block a user