Commit 1d3e96a7 authored by Steve Lhomme's avatar Steve Lhomme

add Matroska v3 support (not tested yet)

git-svn-id: https://matroska.svn.sourceforge.net/svnroot/matroska/trunk/foundation_src@684 a6f86f6d-0131-4f8e-9e7b-e335508773d5
parent df378e94
......@@ -40,10 +40,9 @@
// if a profile is set in ebml_semantic.DisabledProfile that means the element is not available for that profile
#define PROFILE_MATROSKA_V1 1
#define PROFILE_MATROSKA_V2 2
#define PROFILE_WEBM_V1 4
#define PROFILE_WEBM_V2 8
#define PROFILE_DIVX_V1 16
#define PROFILE_DIVX_V2 32
#define PROFILE_MATROSKA_V3 4
#define PROFILE_WEBM 8
#define PROFILE_DIVX 16
#define MATROSKA_VERSION 2
......
This diff is collapsed.
2011-02-12
2011-02-xx
version 0.8.0:
- add support for Matroska v3
- fix some odd case where some file other than the bogus output file would be deleted after an error
- add more padding after the SeekHead to make room for links to chapters/tags/attachments/others and/or editing
- add a link to the first Cluster in the Seek Head
......
......@@ -130,14 +130,15 @@ typedef struct track_info
static const tchar_t *GetProfileName(size_t ProfileNum)
{
static const tchar_t *Profile[7] = {T("unknown"), T("matroska v1"), T("matroska v2"), T("unused webm"), T("webm"), T("matroska+DivX"), T("unused matroska+DivX") };
static const tchar_t *Profile[7] = {T("unknown"), T("matroska v1"), T("matroska v2"), T("matroska v3"), T("webm"), T("matroska+DivX")};
switch (ProfileNum)
{
default: return Profile[0];
case PROFILE_MATROSKA_V1: return Profile[1];
case PROFILE_MATROSKA_V2: return Profile[2];
case PROFILE_WEBM_V2: return Profile[4];
case PROFILE_DIVX_V1: return Profile[5];
default: return Profile[0];
case PROFILE_MATROSKA_V3: return Profile[3];
case PROFILE_WEBM: return Profile[4];
case PROFILE_DIVX: return Profile[5];
}
}
......@@ -145,11 +146,12 @@ static int GetProfileId(int Profile)
{
switch (Profile)
{
default: return 0;
case PROFILE_MATROSKA_V1: return 1;
case PROFILE_MATROSKA_V2: return 2;
case PROFILE_WEBM_V2: return 4;
case PROFILE_DIVX_V1: return 5;
default: return 0;
case PROFILE_MATROSKA_V3: return 3;
case PROFILE_WEBM: return 4;
case PROFILE_DIVX: return 5;
}
}
......@@ -464,7 +466,7 @@ static int LinkClusters(array *Clusters, ebml_master *RSegmentInfo, ebml_master
int BlockNum;
// find out if the Clusters use forbidden features for that DstProfile
if (DstProfile == PROFILE_MATROSKA_V1 || DstProfile == PROFILE_DIVX_V1)
if (DstProfile == PROFILE_MATROSKA_V1 || DstProfile == PROFILE_DIVX)
{
for (Cluster=ARRAYBEGIN(*Clusters,matroska_cluster*);Cluster!=ARRAYEND(*Clusters,matroska_cluster*);++Cluster)
{
......@@ -628,7 +630,7 @@ static ebml_element *CheckMatroskaHead(const ebml_element *Head, const ebml_pars
if (tcscmp(String,T("matroska"))==0)
SrcProfile = PROFILE_MATROSKA_V1;
else if (tcscmp(String,T("webm"))==0)
SrcProfile = PROFILE_WEBM_V2;
SrcProfile = PROFILE_WEBM;
else
{
TextPrintf(StdErr,T("EBML DocType '%s' not supported\r\n"),String);
......@@ -922,7 +924,7 @@ static int CleanTracks(ebml_master *Tracks, int Profile, ebml_master *Attachment
continue;
}
if (Profile==PROFILE_WEBM_V2)
if (Profile==PROFILE_WEBM)
{
// verify that we have only VP8 and Vorbis tracks
TrackType = (int)EBML_IntegerValue((ebml_integer*)Elt);
......@@ -1285,10 +1287,12 @@ int main(int argc, const char *argv[])
DstProfile = PROFILE_MATROSKA_V1;
else if (tcsisame_ascii(Path,T("2")))
DstProfile = PROFILE_MATROSKA_V2;
else if (tcsisame_ascii(Path,T("3")))
DstProfile = PROFILE_MATROSKA_V3;
else if (tcsisame_ascii(Path,T("4")))
DstProfile = PROFILE_WEBM_V2;
DstProfile = PROFILE_WEBM;
else if (tcsisame_ascii(Path,T("5")))
DstProfile = PROFILE_DIVX_V1;
DstProfile = PROFILE_DIVX;
else
{
TextPrintf(StdErr,T("Unknown doctype %s\r\n"),Path);
......@@ -1327,6 +1331,7 @@ int main(int argc, const char *argv[])
TextWrite(StdErr,T(" --doctype <v> force the doctype version\r\n"));
TextWrite(StdErr,T(" 1: 'matroska' v1\r\n"));
TextWrite(StdErr,T(" 2: 'matroska' v2\r\n"));
TextWrite(StdErr,T(" 3: 'matroska' v3\r\n"));
TextWrite(StdErr,T(" 4: 'webm'\r\n"));
TextWrite(StdErr,T(" 5: 'matroska' v1 with DivX extensions\r\n"));
TextWrite(StdErr,T(" --live the output file resembles a live stream\r\n"));
......@@ -1397,14 +1402,18 @@ int main(int argc, const char *argv[])
RSegment = (ebml_master*)CheckMatroskaHead((ebml_element*)EbmlHead,&RContext,Input);
if (SrcProfile==PROFILE_MATROSKA_V1 && DocVersion==2)
SrcProfile = PROFILE_MATROSKA_V2;
else if (SrcProfile==PROFILE_MATROSKA_V1 && DocVersion==3)
SrcProfile = PROFILE_MATROSKA_V3;
if (!DstProfile)
DstProfile = SrcProfile;
if (DstProfile==PROFILE_MATROSKA_V2 || DstProfile==PROFILE_WEBM_V2)
if (DstProfile==PROFILE_MATROSKA_V2 || DstProfile==PROFILE_WEBM)
DocVersion=2;
if (DstProfile==PROFILE_MATROSKA_V3)
DocVersion=3;
if (DstProfile==PROFILE_WEBM_V2)
if (DstProfile==PROFILE_WEBM)
{
UnOptimize = 1;
Optimize = 0;
......@@ -1597,7 +1606,7 @@ int main(int argc, const char *argv[])
if (!RLevel1)
goto exit;
assert(Node_IsPartOf(RLevel1,EBML_STRING_CLASS));
if (DstProfile == PROFILE_WEBM_V2)
if (DstProfile == PROFILE_WEBM)
{
if (EBML_StringSetValue((ebml_string*)RLevel1,"webm") != ERR_NONE)
goto exit;
......
2011-02-xx
version 0.3.3:
- add support for Matroska v3
2010-12-12
version 0.3.2:
- header/zlib compression is not allowed in WebM
......
......@@ -133,16 +133,15 @@ void DebugMessage(const tchar_t* Msg,...)
static const tchar_t *GetProfileName(size_t ProfileNum)
{
static const tchar_t *Profile[7] = {T("unknown"), T("matroska v1"), T("matroska v2"), T("webm v1"), T("webm v2"), T("divx v1"), T("divx v2") };
static const tchar_t *Profile[7] = {T("unknown"), T("matroska v1"), T("matroska v2"), T("matroska v3"), T("webm"), T("matroska+DivX") };
switch (ProfileNum)
{
default: return Profile[0];
case PROFILE_MATROSKA_V1: return Profile[1];
case PROFILE_MATROSKA_V2: return Profile[2];
case PROFILE_WEBM_V1: return Profile[3];
case PROFILE_WEBM_V2: return Profile[4];
case PROFILE_DIVX_V1: return Profile[5];
case PROFILE_DIVX_V2: return Profile[6];
default: return Profile[0];
case PROFILE_MATROSKA_V3: return Profile[3];
case PROFILE_WEBM: return Profile[4];
case PROFILE_DIVX: return Profile[5];
}
}
......@@ -262,7 +261,7 @@ static int CheckVideoTrack(ebml_master *Track, int TrackNum, int ProfileNum)
Serious++; // same aspect ratio as the source
if (8*DisplayW <= EL_Int(PixelW) && 8*DisplayH <= EL_Int(PixelH))
Serious+=2; // too much shrinking compared to the original pixels
if (ProfileNum!=PROFILE_WEBM_V2 && ProfileNum!=PROFILE_WEBM_V1)
if (ProfileNum!=PROFILE_WEBM)
--Serious; // in Matroska it's tolerated as it's been operating like that for a while
if (Serious>2)
......@@ -334,7 +333,7 @@ static int CheckTracks(ebml_master *Tracks, int ProfileNum)
if (tcslen(String)<3 || String[1]!='_' || (String[0]!='A' && String[0]!='V' && String[0]!='S' && String[0]!='B'))
Result |= OutputWarning(0x308,T("Track #%d codec '%s' doesn't appear to be valid"),(int)EL_Int(TrackNum),String);
if (ProfileNum==PROFILE_WEBM_V1 || ProfileNum==PROFILE_WEBM_V2)
if (ProfileNum==PROFILE_WEBM)
{
if (EL_Int(TrackType) != TRACK_TYPE_AUDIO && EL_Int(TrackType) != TRACK_TYPE_VIDEO)
Result |= OutputError(0x302,T("Track #%d type %d not supported for profile '%s'"),(int)EL_Int(TrackNum),(int)EL_Int(TrackType),GetProfileName(ProfileNum));
......@@ -937,27 +936,19 @@ int main(int argc, const char *argv[])
if (tcscmp(String,T("matroska"))==0)
{
if (EL_Int(EbmlReadDocVer)==2)
{
if (DivX)
MatroskaProfile = PROFILE_DIVX_V2;
else
MatroskaProfile = PROFILE_MATROSKA_V2;
}
if (DivX)
MatroskaProfile = PROFILE_DIVX;
else if (EL_Int(EbmlReadDocVer)==3)
MatroskaProfile = PROFILE_MATROSKA_V3;
else if (EL_Int(EbmlReadDocVer)==2)
MatroskaProfile = PROFILE_MATROSKA_V2;
else if (EL_Int(EbmlReadDocVer)==1)
{
if (DivX)
MatroskaProfile = PROFILE_DIVX_V1;
else
MatroskaProfile = PROFILE_MATROSKA_V1;
}
MatroskaProfile = PROFILE_MATROSKA_V1;
else
Result |= OutputError(10,T("Unknown Matroska profile %d/%d"),(int)EL_Int(EbmlDocVer),(int)EL_Int(EbmlReadDocVer));
}
else if (EL_Int(EbmlReadDocVer)==1)
MatroskaProfile = PROFILE_WEBM_V1;
else if (EL_Int(EbmlReadDocVer)==2)
MatroskaProfile = PROFILE_WEBM_V2;
else if (tcscmp(String,T("webm"))==0)
MatroskaProfile = PROFILE_WEBM;
if (MatroskaProfile==0)
Result |= OutputError(11,T("Matroska profile not supported"));
......
CON mkvalidator
{
PROJECT_NAME "mkvalidator"
PROJECT_VERSION 0.3.2
PROJECT_VERSION 0.3.3
PROJECT_VENDOR "Matroska"
USE matroska2
SOURCE mkvalidator.c
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment