Implemented an API to get arbitrary meta-data about
BMediaFiles and about BMediaTracks in BMessages. As an example, one can get chapter meta-data or the language name of an audio-track. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38685 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
cefc9ef227
commit
7cd3a2490b
@ -24,6 +24,7 @@ namespace BPrivate {
|
||||
|
||||
// forward declarations
|
||||
class BMediaTrack;
|
||||
class BMessage;
|
||||
class BParameterWeb;
|
||||
class BView;
|
||||
|
||||
@ -79,6 +80,12 @@ public:
|
||||
status_t GetFileFormatInfo(
|
||||
media_file_format* mfi) const;
|
||||
|
||||
// Returns in _data hierarchical meta-data about the stream.
|
||||
// The fields in the message shall follow a defined naming-scheme,
|
||||
// such that applications can find the same information in different
|
||||
// types of files.
|
||||
status_t GetMetaData(BMessage* _data) const;
|
||||
|
||||
//
|
||||
// These functions are for read-only access to a media file.
|
||||
// The data is read using the BMediaTrack object.
|
||||
|
@ -16,6 +16,7 @@ namespace BPrivate { namespace media {
|
||||
class MediaWriter;
|
||||
} }
|
||||
|
||||
class BMessage;
|
||||
class BView;
|
||||
class BParameterWeb;
|
||||
|
||||
@ -90,6 +91,12 @@ public:
|
||||
int64 CountFrames() const;
|
||||
bigtime_t Duration() const;
|
||||
|
||||
// Returns in _data hierarchical meta-data about the track.
|
||||
// The fields in the message shall follow a defined naming-scheme,
|
||||
// such that applications can find the same information in different
|
||||
// types of tracks.
|
||||
status_t GetMetaData(BMessage* _data) const;
|
||||
|
||||
// CurrentFrame and CurrentTime return the current position (expressed in
|
||||
// microseconds) within the track, expressed in frame index and time.
|
||||
|
||||
|
@ -43,6 +43,7 @@ public:
|
||||
|
||||
void GetFileFormatInfo(
|
||||
media_file_format* fileFormat) const;
|
||||
status_t GetMetaData(BMessage* _data) const;
|
||||
|
||||
int32 StreamCount();
|
||||
|
||||
@ -65,6 +66,9 @@ public:
|
||||
status_t CreateDecoder(int32 stream, Decoder** _decoder,
|
||||
media_codec_info* codecInfo);
|
||||
|
||||
status_t GetStreamMetaData(int32 stream,
|
||||
BMessage* _data) const;
|
||||
|
||||
private:
|
||||
void _RecycleLastChunk(stream_info& info);
|
||||
static int32 _ExtractorEntry(void* arg);
|
||||
|
@ -23,6 +23,7 @@ public:
|
||||
virtual status_t Sniff(int32* streamCount) = 0;
|
||||
|
||||
virtual void GetFileFormatInfo(media_file_format* mff) = 0;
|
||||
virtual status_t GetMetaData(BMessage* _data);
|
||||
|
||||
virtual status_t AllocateCookie(int32 streamNumber,
|
||||
void** cookie) = 0;
|
||||
@ -42,6 +43,9 @@ public:
|
||||
const void** chunkBuffer, size_t* chunkSize,
|
||||
media_header* mediaHeader) = 0;
|
||||
|
||||
virtual status_t GetStreamMetaData(void* cookie,
|
||||
BMessage* _data);
|
||||
|
||||
BDataIO* Source() const;
|
||||
|
||||
virtual status_t Perform(perform_code code, void* data);
|
||||
|
@ -178,6 +178,14 @@ MediaExtractor::GetFileFormatInfo(media_file_format* fileFormat) const
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
MediaExtractor::GetMetaData(BMessage* _data) const
|
||||
{
|
||||
CALLED();
|
||||
return fReader->GetMetaData(_data);
|
||||
}
|
||||
|
||||
|
||||
int32
|
||||
MediaExtractor::StreamCount()
|
||||
{
|
||||
@ -376,6 +384,18 @@ MediaExtractor::CreateDecoder(int32 stream, Decoder** _decoder,
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
MediaExtractor::GetStreamMetaData(int32 stream, BMessage* _data) const
|
||||
{
|
||||
const stream_info& info = fStreamInfo[stream];
|
||||
|
||||
if (info.status != B_OK)
|
||||
return info.status;
|
||||
|
||||
return fReader->GetStreamMetaData(fStreamInfo[stream].cookie, _data);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
MediaExtractor::_RecycleLastChunk(stream_info& info)
|
||||
{
|
||||
|
@ -129,7 +129,6 @@ BMediaFile::InitCheck() const
|
||||
}
|
||||
|
||||
|
||||
// Get info about the underlying file format.
|
||||
status_t
|
||||
BMediaFile::GetFileFormatInfo(media_file_format* mfi) const
|
||||
{
|
||||
@ -143,6 +142,20 @@ BMediaFile::GetFileFormatInfo(media_file_format* mfi) const
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
BMediaFile::GetMetaData(BMessage* _data) const
|
||||
{
|
||||
if (fExtractor == NULL)
|
||||
return B_NO_INIT;
|
||||
if (_data == NULL)
|
||||
return B_BAD_VALUE;
|
||||
|
||||
_data->MakeEmpty();
|
||||
|
||||
return fExtractor->GetMetaData(_data);
|
||||
}
|
||||
|
||||
|
||||
const char*
|
||||
BMediaFile::Copyright() const
|
||||
{
|
||||
|
@ -233,6 +233,21 @@ BMediaTrack::DecodedFormat(media_format *inout_format, uint32 flags)
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
BMediaTrack::GetMetaData(BMessage* _data) const
|
||||
{
|
||||
CALLED();
|
||||
if (fExtractor == NULL)
|
||||
return B_NO_INIT;
|
||||
if (_data == NULL)
|
||||
return B_BAD_VALUE;
|
||||
|
||||
_data->MakeEmpty();
|
||||
|
||||
return fExtractor->GetStreamMetaData(fStream, _data);
|
||||
}
|
||||
|
||||
|
||||
int64
|
||||
BMediaTrack::CountFrames() const
|
||||
{
|
||||
|
@ -1,4 +1,7 @@
|
||||
/*
|
||||
* Copyright 2009-2010, Stephan Aßmus <superstippi@gmx.de>.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Copyright 2004, Marcus Overhagen. All rights reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
@ -21,6 +24,13 @@ Reader::~Reader()
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
Reader::GetMetaData(BMessage* _data)
|
||||
{
|
||||
return B_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
Reader::Seek(void* cookie, uint32 flags, int64* frame, bigtime_t* time)
|
||||
{
|
||||
@ -35,6 +45,13 @@ Reader::FindKeyFrame(void* cookie, uint32 flags, int64* frame, bigtime_t* time)
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
Reader::GetStreamMetaData(void* cookie, BMessage* _data)
|
||||
{
|
||||
return B_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
|
||||
BDataIO*
|
||||
Reader::Source() const
|
||||
{
|
||||
@ -55,6 +72,7 @@ Reader::Perform(perform_code code, void* _data)
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
|
||||
void Reader::_ReservedReader1() {}
|
||||
void Reader::_ReservedReader2() {}
|
||||
void Reader::_ReservedReader3() {}
|
||||
|
Loading…
Reference in New Issue
Block a user