2018-11-18 18:57:12 +03:00
|
|
|
/*
|
|
|
|
* Copyright 2018, Dario Casalinuovo. All rights reserved.
|
|
|
|
* Distributed under the terms of the MIT License.
|
|
|
|
*/
|
|
|
|
#ifndef _META_DATA_H
|
|
|
|
#define _META_DATA_H
|
|
|
|
|
2018-11-21 18:51:19 +03:00
|
|
|
|
2018-11-18 18:57:12 +03:00
|
|
|
#include <Message.h>
|
|
|
|
|
|
|
|
|
2018-11-26 15:18:35 +03:00
|
|
|
namespace BCodecKit {
|
2018-11-18 18:57:12 +03:00
|
|
|
|
|
|
|
|
2018-11-21 14:45:09 +03:00
|
|
|
// Playback capabilities
|
|
|
|
extern const char* kCanPause; // bool
|
|
|
|
extern const char* kCanSeekBackward; // bool
|
|
|
|
extern const char* kCanSeekForward; // bool
|
|
|
|
extern const char* kCanSeek; // bool
|
|
|
|
|
|
|
|
// Bitrates
|
2018-12-01 14:23:04 +03:00
|
|
|
extern const char* kAudioBitRate; // int32 (bps)
|
|
|
|
extern const char* kVideoBitRate; // int32 (bps)
|
|
|
|
extern const char* kAudioSampleRate; // int32 (hz)
|
|
|
|
extern const char* kVideoFrameRate; // int32 (hz)
|
2018-11-21 14:45:09 +03:00
|
|
|
|
|
|
|
// RFC2046 and RFC4281
|
|
|
|
extern const char* kMimeType; // BString
|
|
|
|
extern const char* kAudioCodec; // BString
|
|
|
|
extern const char* kVideoCodec; // BString
|
2018-12-01 14:23:04 +03:00
|
|
|
extern const char* kVideoHeight; // int32
|
|
|
|
extern const char* kVideoWidth; // int32
|
|
|
|
extern const char* kNumTracks; // int32
|
2018-11-21 14:45:09 +03:00
|
|
|
extern const char* kDrmCrippled; // bool
|
|
|
|
|
|
|
|
// General use attributes
|
|
|
|
extern const char* kTitle; // BString
|
|
|
|
extern const char* kComment; // BString
|
|
|
|
extern const char* kCopyright; // BString
|
|
|
|
extern const char* kAlbum; // BString
|
|
|
|
extern const char* kArtist; // BString
|
2018-11-21 18:51:19 +03:00
|
|
|
extern const char* kAlbumArtist; // BString
|
2018-11-21 14:45:09 +03:00
|
|
|
extern const char* kAuthor; // BString
|
2018-11-21 18:51:19 +03:00
|
|
|
extern const char* kPerformer; // BString
|
2018-11-21 14:45:09 +03:00
|
|
|
extern const char* kComposer; // BString
|
|
|
|
extern const char* kGenre; // BString
|
2018-11-21 18:51:19 +03:00
|
|
|
extern const char* kYear; // BString
|
|
|
|
extern const char* kEncodedBy; // BString
|
|
|
|
extern const char* kLanguage; // BString
|
|
|
|
extern const char* kDisc; // BString
|
|
|
|
extern const char* kPublisher; // BString
|
|
|
|
extern const char* kEncoder; // BString
|
|
|
|
extern const char* kTrack;
|
|
|
|
extern const char* kDate; // BString
|
2018-12-01 14:23:04 +03:00
|
|
|
extern const char* kDuration; // int32 (ms)
|
2018-11-21 14:45:09 +03:00
|
|
|
extern const char* kRating; // BString
|
2018-11-21 18:51:19 +03:00
|
|
|
// TODO: BBitmap? uint8 array? url?
|
|
|
|
//extern const char* kAlbumArt
|
2018-12-01 14:23:04 +03:00
|
|
|
extern const char* kCDTrackNum; // int32
|
|
|
|
extern const char* kCDTrackMax; // int32
|
2018-11-18 18:57:12 +03:00
|
|
|
|
2018-11-21 18:51:19 +03:00
|
|
|
extern const char* kChapter; // BMetaData
|
|
|
|
extern const char* kChapterStart; // int64
|
|
|
|
extern const char* kChapterEnd; // int64
|
|
|
|
|
|
|
|
// Others
|
|
|
|
extern const char* kProgramData; // BMetaData
|
|
|
|
|
2018-12-01 14:23:04 +03:00
|
|
|
// TODO: Fully honour this:
|
|
|
|
// https://wiki.multimedia.cx/index.php?title=FFmpeg_Metadata
|
|
|
|
|
2018-11-18 18:57:12 +03:00
|
|
|
|
|
|
|
class BMetaData {
|
|
|
|
public:
|
|
|
|
BMetaData();
|
2018-11-21 14:45:09 +03:00
|
|
|
BMetaData(const BMessage& msg);
|
2018-11-21 18:51:19 +03:00
|
|
|
virtual ~BMetaData();
|
2018-11-21 14:45:09 +03:00
|
|
|
|
2018-11-18 18:57:12 +03:00
|
|
|
// Woah. It seems we need BValue there.
|
2018-11-21 14:45:09 +03:00
|
|
|
bool SetString(const char* key, const BString& value);
|
|
|
|
bool SetBool(const char* key, bool value);
|
2018-11-21 18:51:19 +03:00
|
|
|
bool SetInt32(const char* key, int32 value);
|
|
|
|
bool SetInt64(const char* key, int64 value);
|
2018-11-18 18:57:12 +03:00
|
|
|
|
2018-11-21 14:45:09 +03:00
|
|
|
bool GetString(const char* key, BString* value) const;
|
|
|
|
bool GetBool(const char* key, bool* value) const;
|
2018-12-01 14:23:04 +03:00
|
|
|
bool GetInt32(const char* key, int32* value) const;
|
2018-11-21 18:51:19 +03:00
|
|
|
bool GetInt64(const char* key, int64* value) const;
|
|
|
|
|
|
|
|
// We allow embedding BMetaData into BMetaData. The BMetaData field
|
|
|
|
// is the only one allowed to have more occurrences for a single key
|
|
|
|
// so an index attribute is given for retrieving it.
|
|
|
|
bool AddMetaData(const char* key, BMetaData* data);
|
|
|
|
bool GetMetaData(const char* key, BMetaData* data,
|
|
|
|
uint32 index = 0);
|
2018-11-18 18:57:12 +03:00
|
|
|
|
2018-11-21 14:45:09 +03:00
|
|
|
bool RemoveValue(const char* key);
|
2018-11-18 18:57:12 +03:00
|
|
|
|
|
|
|
// Clean up all keys
|
2018-11-21 14:45:09 +03:00
|
|
|
void MakeEmpty();
|
|
|
|
bool IsEmpty();
|
2018-11-18 18:57:12 +03:00
|
|
|
|
2018-11-21 14:45:09 +03:00
|
|
|
// Retain ownership of the object, be careful with that
|
|
|
|
// that's why we need to introduce smart pointers!
|
2018-11-21 18:51:19 +03:00
|
|
|
const BMessage* Message();
|
2018-11-18 18:57:12 +03:00
|
|
|
|
2018-11-22 11:19:15 +03:00
|
|
|
BMetaData& operator=(const BMetaData& other);
|
|
|
|
|
2018-11-18 18:57:12 +03:00
|
|
|
private:
|
|
|
|
// TODO: padding
|
|
|
|
BMessage* fMessage;
|
|
|
|
|
|
|
|
BMetaData(const BMetaData&);
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2018-11-26 15:18:35 +03:00
|
|
|
} // namespace BCodecKit
|
|
|
|
|
2018-11-18 18:57:12 +03:00
|
|
|
|
|
|
|
#endif // _META_DATA_H
|