Commit cd8d5ab0 authored by Steve Lhomme's avatar Steve Lhomme

mkclean: turn the old "both eyes" stereo mode into v3 "side by side (left eye first)"

git-svn-id: https://matroska.svn.sourceforge.net/svnroot/matroska/trunk/foundation_src@697 a6f86f6d-0131-4f8e-9e7b-e335508773d5
parent ebfd8bba
......@@ -3,7 +3,7 @@
PROJECT matroska2
{
PROJECT_NAME "libmatroska2"
PROJECT_VERSION 0.21.0
PROJECT_VERSION 0.21.1
PROJECT_VENDOR "Matroska"
}
......
......@@ -74,6 +74,25 @@ typedef int64_t timecode_t; // in nanoseconds
#define TRACK_TYPE_BUTTONS 18
#define TRACK_TYPE_CONTROL 32
#define TRACK_STEREO_MODE_MONO 0
#define TRACK_STEREO_MODE_SIDEBYSIDE_L 1
#define TRACK_STEREO_MODE_TOPBOTTOM_R 2
#define TRACK_STEREO_MODE_TOPBOTTOM_L 3
#define TRACK_STEREO_MODE_CHECKBOARD_R 4
#define TRACK_STEREO_MODE_CHECKBOARD_L 5
#define TRACK_STEREO_MODE_INTERLEAVED_R 6
#define TRACK_STEREO_MODE_INTERLEAVED_L 7
#define TRACK_STEREO_MODE_COL_INTERLEAVED_L 8
#define TRACK_STEREO_MODE_COL_INTERLEAVED_R 9
#define TRACK_STEREO_MODE_ANAGLYPH_CYAN_RED 10
#define TRACK_STEREO_MODE_SIDEBYSIDE_R 11
#define TRACK_STEREO_MODE_ANAGLYPH_GREEN_MAG 12
#define TRACK_OLD_STEREOMODE_MONO 0
#define TRACK_OLD_STEREOMODE_RIGHT 1
#define TRACK_OLD_STEREOMODE_LEFT 2
#define TRACK_OLD_STEREOMODE_BOTH 3
typedef struct matroska_block matroska_block;
typedef struct matroska_cuepoint matroska_cuepoint;
typedef struct matroska_cluster matroska_cluster;
......
2011-03-13
version 0.8.1:
- turn old StereoMode values into the Matroska v3 ones
2011-03-06
version 0.8.0:
- add support for Matroska v3
......
......@@ -889,7 +889,7 @@ static void CleanCropValues(ebml_master *Track, int64_t Width, int64_t Height)
}
}
static int CleanTracks(ebml_master *Tracks, int Profile, ebml_master *Attachments)
static int CleanTracks(ebml_master *Tracks, int SrcProfile, int *DstProfile, ebml_master *Attachments)
{
ebml_master *Track, *CurTrack;
ebml_element *Elt, *Elt2, *DisplayW, *DisplayH;
......@@ -925,24 +925,37 @@ static int CleanTracks(ebml_master *Tracks, int Profile, ebml_master *Attachment
continue;
}
if (Profile==PROFILE_WEBM)
{
// verify that we have only VP8 and Vorbis tracks
TrackType = (int)EBML_IntegerValue((ebml_integer*)Elt);
Elt = EBML_MasterFindChild(CurTrack,&MATROSKA_ContextCodecID);
EBML_StringGet((ebml_string*)Elt,CodecID,TSIZEOF(CodecID));
if (!(TrackType==TRACK_TYPE_VIDEO && tcsisame_ascii(CodecID,T("V_VP8")) || (TrackType==TRACK_TYPE_AUDIO && tcsisame_ascii(CodecID,T("A_VORBIS")))))
{
TextPrintf(StdErr,T("Wrong codec '%s' for profile '%s' removing track %d\r\n"),CodecID,GetProfileName(Profile),TrackNum);
NodeDelete((node*)CurTrack);
continue;
}
}
// clean the aspect ratio
Elt = EBML_MasterFindChild(CurTrack,&MATROSKA_ContextVideo);
if (Elt)
{
if (SrcProfile==PROFILE_MATROSKA_V1 || SrcProfile==PROFILE_MATROSKA_V2 || SrcProfile==PROFILE_DIVX)
{
// clean the older StereoMode values
Elt2 = EBML_MasterFindChild(Elt,&MATROSKA_ContextStereoMode);
if (!Elt2)
Elt2 = EBML_MasterFindChild(Elt,&MATROSKA_ContextOldStereoMode);
if (Elt2)
{
Width = (int)EBML_IntegerValue((ebml_integer*)Elt2);
if (Width!=TRACK_OLD_STEREOMODE_MONO && Width <= 3) // upper values are probably the new ones
{
*DstProfile = PROFILE_MATROSKA_V3;
TextPrintf(StdErr,T("The track %d at %") TPRId64 T(" is using an old StereoMode value, converting to profile '%s'\r\n"), TrackNum,EBML_ElementPosition((ebml_element*)CurTrack),GetProfileName(*DstProfile));
if (EBML_ElementIsType(Elt2, &MATROSKA_ContextOldStereoMode))
// replace the old by a new
Elt2->Context = &MATROSKA_ContextOldStereoMode;
// TODO: replace the old values with the new ones
if (Width==TRACK_OLD_STEREOMODE_BOTH)
{
TextPrintf(StdErr,T(" turning 'Both Eyes' into 'side by side (left first)\r\n"), TrackNum,EBML_ElementPosition((ebml_element*)CurTrack),GetProfileName(*DstProfile));
EBML_IntegerSetValue(Elt2,TRACK_STEREO_MODE_SIDEBYSIDE_L);
}
}
}
}
Width = (int)EBML_IntegerValue((ebml_integer*)EBML_MasterFindChild((ebml_master*)Elt,&MATROSKA_ContextPixelWidth));
Height = (int)EBML_IntegerValue((ebml_integer*)EBML_MasterFindChild((ebml_master*)Elt,&MATROSKA_ContextPixelHeight));
if (Width==0 || Height==0)
......@@ -1056,6 +1069,20 @@ static int CleanTracks(ebml_master *Tracks, int Profile, ebml_master *Attachment
}
}
if (*DstProfile==PROFILE_WEBM)
{
// verify that we have only VP8 and Vorbis tracks
TrackType = (int)EBML_IntegerValue((ebml_integer*)Elt);
Elt = EBML_MasterFindChild(CurTrack,&MATROSKA_ContextCodecID);
EBML_StringGet((ebml_string*)Elt,CodecID,TSIZEOF(CodecID));
if (!(TrackType==TRACK_TYPE_VIDEO && tcsisame_ascii(CodecID,T("V_VP8")) || (TrackType==TRACK_TYPE_AUDIO && tcsisame_ascii(CodecID,T("A_VORBIS")))))
{
TextPrintf(StdErr,T("Wrong codec '%s' for profile '%s' removing track %d\r\n"),CodecID,GetProfileName(*DstProfile),TrackNum);
NodeDelete((node*)CurTrack);
continue;
}
}
// clean the output sampling freq
Elt = EBML_MasterFindChild(CurTrack,&MATROSKA_ContextAudio);
if (Elt)
......@@ -1409,11 +1436,6 @@ int main(int argc, const char *argv[])
if (!DstProfile)
DstProfile = SrcProfile;
if (DstProfile==PROFILE_MATROSKA_V2 || DstProfile==PROFILE_WEBM)
DocVersion=2;
if (DstProfile==PROFILE_MATROSKA_V3)
DocVersion=3;
if (DstProfile==PROFILE_WEBM)
{
UnOptimize = 1;
......@@ -1558,7 +1580,7 @@ int main(int argc, const char *argv[])
if (RTrackInfo)
{
Result = CleanTracks(RTrackInfo, DstProfile, RAttachments);
Result = CleanTracks(RTrackInfo, SrcProfile, &DstProfile, RAttachments);
if (Result!=0)
{
TextWrite(StdErr,T("No Tracks left to use!\r\n"));
......@@ -1619,6 +1641,11 @@ int main(int argc, const char *argv[])
}
// Doctype version
if (DstProfile==PROFILE_MATROSKA_V2 || DstProfile==PROFILE_WEBM)
DocVersion=2;
if (DstProfile==PROFILE_MATROSKA_V3)
DocVersion=3;
RLevel1 = (ebml_master*)EBML_MasterGetChild(EbmlHead,&EBML_ContextDocTypeVersion);
if (!RLevel1)
goto exit;
......
......@@ -3,7 +3,7 @@
GROUP mkclean_base
{
PROJECT_NAME "mkclean"
PROJECT_VERSION 0.8.0
PROJECT_VERSION 0.8.1
PROJECT_VENDOR "Matroska"
USE matroska2
IF !CONFIG_EBML_UNICODE
......
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