Codec Kit: Introduce BMetaData in Reader/Extractor
* Remove superfluous Copyright method.
This commit is contained in:
@@ -35,12 +35,11 @@ public:
|
|||||||
|
|
||||||
void GetFileFormatInfo(
|
void GetFileFormatInfo(
|
||||||
media_file_format* fileFormat) const;
|
media_file_format* fileFormat) const;
|
||||||
status_t GetMetaData(BMessage* _data) const;
|
|
||||||
|
status_t GetMetaData(BMetaData* data) const;
|
||||||
|
|
||||||
int32 StreamCount();
|
int32 StreamCount();
|
||||||
|
|
||||||
const char* Copyright();
|
|
||||||
|
|
||||||
const media_format* EncodedFormat(int32 stream);
|
const media_format* EncodedFormat(int32 stream);
|
||||||
int64 CountFrames(int32 stream) const;
|
int64 CountFrames(int32 stream) const;
|
||||||
bigtime_t Duration(int32 stream) const;
|
bigtime_t Duration(int32 stream) const;
|
||||||
@@ -59,7 +58,7 @@ public:
|
|||||||
media_codec_info* codecInfo);
|
media_codec_info* codecInfo);
|
||||||
|
|
||||||
status_t GetStreamMetaData(int32 stream,
|
status_t GetStreamMetaData(int32 stream,
|
||||||
BMessage* _data) const;
|
BMetaData* data) const;
|
||||||
|
|
||||||
void StopProcessing();
|
void StopProcessing();
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
|
|
||||||
#include <MediaTrack.h>
|
#include <MediaTrack.h>
|
||||||
|
#include <MetaData.h>
|
||||||
|
|
||||||
#include "MediaPlugin.h"
|
#include "MediaPlugin.h"
|
||||||
|
|
||||||
@@ -22,12 +23,10 @@ public:
|
|||||||
Reader();
|
Reader();
|
||||||
virtual ~Reader();
|
virtual ~Reader();
|
||||||
|
|
||||||
virtual const char* Copyright() = 0;
|
|
||||||
|
|
||||||
virtual status_t Sniff(int32* streamCount) = 0;
|
virtual status_t Sniff(int32* streamCount) = 0;
|
||||||
|
|
||||||
virtual void GetFileFormatInfo(media_file_format* mff) = 0;
|
virtual void GetFileFormatInfo(media_file_format* mff) = 0;
|
||||||
virtual status_t GetMetaData(BMessage* _data);
|
virtual status_t GetMetaData(BMetaData* data);
|
||||||
|
|
||||||
virtual status_t AllocateCookie(int32 streamNumber,
|
virtual status_t AllocateCookie(int32 streamNumber,
|
||||||
void** cookie) = 0;
|
void** cookie) = 0;
|
||||||
@@ -48,7 +47,7 @@ public:
|
|||||||
media_header* mediaHeader) = 0;
|
media_header* mediaHeader) = 0;
|
||||||
|
|
||||||
virtual status_t GetStreamMetaData(void* cookie,
|
virtual status_t GetStreamMetaData(void* cookie,
|
||||||
BMessage* _data);
|
BMetaData* data);
|
||||||
|
|
||||||
BDataIO* Source() const;
|
BDataIO* Source() const;
|
||||||
|
|
||||||
|
|||||||
@@ -201,10 +201,10 @@ MediaExtractor::GetFileFormatInfo(media_file_format* fileFormat) const
|
|||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
MediaExtractor::GetMetaData(BMessage* _data) const
|
MediaExtractor::GetMetaData(BMetaData* data) const
|
||||||
{
|
{
|
||||||
CALLED();
|
CALLED();
|
||||||
return fReader->GetMetaData(_data);
|
return fReader->GetMetaData(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -216,13 +216,6 @@ MediaExtractor::StreamCount()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const char*
|
|
||||||
MediaExtractor::Copyright()
|
|
||||||
{
|
|
||||||
return fReader->Copyright();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
const media_format*
|
const media_format*
|
||||||
MediaExtractor::EncodedFormat(int32 stream)
|
MediaExtractor::EncodedFormat(int32 stream)
|
||||||
{
|
{
|
||||||
@@ -407,14 +400,14 @@ MediaExtractor::CreateDecoder(int32 stream, Decoder** _decoder,
|
|||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
MediaExtractor::GetStreamMetaData(int32 stream, BMessage* _data) const
|
MediaExtractor::GetStreamMetaData(int32 stream, BMetaData* data) const
|
||||||
{
|
{
|
||||||
const stream_info& info = fStreamInfo[stream];
|
const stream_info& info = fStreamInfo[stream];
|
||||||
|
|
||||||
if (info.status != B_OK)
|
if (info.status != B_OK)
|
||||||
return info.status;
|
return info.status;
|
||||||
|
|
||||||
return fReader->GetStreamMetaData(fStreamInfo[stream].cookie, _data);
|
return fReader->GetStreamMetaData(fStreamInfo[stream].cookie, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,146 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2018, Dario Casalinuovo. All rights reserved.
|
||||||
|
* Distributed under the terms of the MIT License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#include <MetaData.h>
|
||||||
|
#include <String.h>
|
||||||
|
|
||||||
|
#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";
|
||||||
|
|
||||||
|
|
||||||
|
BMetaData::BMetaData()
|
||||||
|
:
|
||||||
|
fMessage(NULL)
|
||||||
|
{
|
||||||
|
<<<<<<< HEAD
|
||||||
|
char buf[sizeof(char) * sizeof(uint32) * 4 + 1];
|
||||||
|
if (buf) {
|
||||||
|
sprintf(buf, "%" B_PRId32, key);
|
||||||
|
}
|
||||||
|
BString ret(buf);
|
||||||
|
ret.Prepend("codec:metadata:");
|
||||||
|
return ret.String();
|
||||||
|
=======
|
||||||
|
fMessage = new BMessage();
|
||||||
|
>>>>>>> BMetaData: Finalize implementation
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BMetaData::BMetaData(const BMessage& msg)
|
||||||
|
:
|
||||||
|
fMessage(NULL)
|
||||||
|
{
|
||||||
|
fMessage = new BMessage(msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BMetaData::~BMetaData()
|
||||||
|
{
|
||||||
|
delete fMessage;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool
|
||||||
|
BMetaData::SetString(const char* key, const BString& value)
|
||||||
|
{
|
||||||
|
return fMessage->SetString(key, value) == B_OK ? true : false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool
|
||||||
|
BMetaData::SetBool(const char* key, bool value)
|
||||||
|
{
|
||||||
|
return fMessage->SetBool(key, value) == B_OK ? true : false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool
|
||||||
|
BMetaData::SetUInt32(const char* key, uint32 value)
|
||||||
|
{
|
||||||
|
return fMessage->SetUInt32(key, value) == B_OK ? true : false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool
|
||||||
|
BMetaData::GetString(const char* key, BString* value) const
|
||||||
|
{
|
||||||
|
return fMessage->FindString(key, value) == B_OK ? true : false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool
|
||||||
|
BMetaData::GetBool(const char* key, bool* value) const
|
||||||
|
{
|
||||||
|
return fMessage->FindBool(key, value) == B_OK ? true : false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool
|
||||||
|
BMetaData::GetUInt32(const char* key, uint32* value) const
|
||||||
|
{
|
||||||
|
return fMessage->FindUInt32(key, value) == B_OK ? true : false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool
|
||||||
|
BMetaData::RemoveValue(const char* key)
|
||||||
|
{
|
||||||
|
return fMessage->RemoveName(key) == B_OK ? true : false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
BMetaData::MakeEmpty()
|
||||||
|
{
|
||||||
|
fMessage->MakeEmpty();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool
|
||||||
|
BMetaData::IsEmpty()
|
||||||
|
{
|
||||||
|
return fMessage->IsEmpty();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BMessage*
|
||||||
|
BMetaData::Message()
|
||||||
|
{
|
||||||
|
return fMessage;
|
||||||
|
}
|
||||||
@@ -26,7 +26,7 @@ Reader::~Reader()
|
|||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
Reader::GetMetaData(BMessage* _data)
|
Reader::GetMetaData(BMetaData* data)
|
||||||
{
|
{
|
||||||
return B_NOT_SUPPORTED;
|
return B_NOT_SUPPORTED;
|
||||||
}
|
}
|
||||||
@@ -47,7 +47,7 @@ Reader::FindKeyFrame(void* cookie, uint32 flags, int64* frame, bigtime_t* time)
|
|||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
Reader::GetStreamMetaData(void* cookie, BMessage* _data)
|
Reader::GetStreamMetaData(void* cookie, BMetaData* data)
|
||||||
{
|
{
|
||||||
return B_NOT_SUPPORTED;
|
return B_NOT_SUPPORTED;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user