mkvparser: read track language information

Track::GetLanguageAsUTF8 is implemented to allow the user to
choose between available audio and subtitle tracks.

Change-Id: I5ec9b1c1c00182da759681ba486cbace46e9b63f
This commit is contained in:
Patrik Carlsson 2013-02-27 15:38:21 +01:00 committed by Johan Redestig
parent 1274be1184
commit 3980cf4159
2 changed files with 25 additions and 0 deletions

View File

@ -5440,6 +5440,7 @@ long Track::Create(
Track::Info::Info():
nameAsUTF8(NULL),
language(NULL),
codecId(NULL),
codecNameAsUTF8(NULL),
codecPrivate(NULL),
@ -5457,6 +5458,9 @@ void Track::Info::Clear()
delete[] nameAsUTF8;
nameAsUTF8 = NULL;
delete[] language;
language = NULL;
delete[] codecId;
codecId = NULL;
@ -5516,6 +5520,9 @@ int Track::Info::Copy(Info& dst) const
if (int status = CopyStr(&Info::nameAsUTF8, dst))
return status;
if (int status = CopyStr(&Info::language, dst))
return status;
if (int status = CopyStr(&Info::codecId, dst))
return status;
@ -5570,6 +5577,11 @@ const char* Track::GetNameAsUTF8() const
return m_info.nameAsUTF8;
}
const char* Track::GetLanguage() const
{
return m_info.language;
}
const char* Track::GetCodecNameAsUTF8() const
{
return m_info.codecNameAsUTF8;
@ -6607,6 +6619,17 @@ long Tracks::ParseTrackEntry(
if (status)
return status;
}
else if (id == 0x02B59C) //Track Language
{
const long status = UnserializeString(
pReader,
pos,
size,
info.language);
if (status)
return status;
}
else if (id == 0x06) //CodecID
{
const long status = UnserializeString(

View File

@ -334,6 +334,7 @@ public:
long GetNumber() const;
unsigned long long GetUid() const;
const char* GetNameAsUTF8() const;
const char* GetLanguage() const;
const char* GetCodecNameAsUTF8() const;
const char* GetCodecId() const;
const unsigned char* GetCodecPrivate(size_t&) const;
@ -362,6 +363,7 @@ public:
long number;
unsigned long long uid;
char* nameAsUTF8;
char* language;
char* codecId;
char* codecNameAsUTF8;
unsigned char* codecPrivate;