Added video res to mp4 properties

git-svn-id: https://subtitleedit.googlecode.com/svn/trunk@679 99eadd0c-20b8-1223-b5c4-2a2b2df33de2
This commit is contained in:
niksedk 2011-09-30 20:22:20 +00:00
parent a0e3220ada
commit 07c180a3b0
2 changed files with 26 additions and 13 deletions

View File

@ -7,29 +7,39 @@ namespace Nikse.SubtitleEdit.Logic.Mp4.Boxes
{
public class Tkhd : Box
{
public readonly uint TrackId;
public readonly ulong Duration;
public readonly uint Width;
public readonly uint Height;
public Tkhd(FileStream fs, ulong maximumLength)
{
buffer = new byte[38];
buffer = new byte[84];
int bytesRead = fs.Read(buffer, 0, buffer.Length);
if (bytesRead < buffer.Length)
return;
//System.Windows.Forms.MessageBox.Show(Helper.GetUInt(buffer, 04).ToString());
//System.Windows.Forms.MessageBox.Show(Helper.GetUInt(buffer, 06).ToString());
//System.Windows.Forms.MessageBox.Show(Helper.GetUInt(buffer, 08).ToString());
//System.Windows.Forms.MessageBox.Show(Helper.GetUInt(buffer, 10).ToString());
//System.Windows.Forms.MessageBox.Show(Helper.GetUInt(buffer, 12).ToString());
//System.Windows.Forms.MessageBox.Show(Helper.GetUInt(buffer, 14).ToString());
//System.Windows.Forms.MessageBox.Show(Helper.GetUInt(buffer, 16).ToString());
//System.Windows.Forms.MessageBox.Show(Helper.GetUInt(buffer, 19).ToString());
//System.Windows.Forms.MessageBox.Show(Helper.GetUInt(buffer, 20).ToString());
//System.Windows.Forms.MessageBox.Show(Helper.GetUInt(buffer, 22).ToString());
//System.Windows.Forms.MessageBox.Show(Helper.GetUInt(buffer, 24).ToString());
int version = buffer[0];
int addToIndex64Bit = 0;
if (version == 1)
addToIndex64Bit = 8;
TrackId = GetUInt(12 + addToIndex64Bit);
if (version == 1)
{
Duration = GetUInt64(20 + addToIndex64Bit);
addToIndex64Bit += 4;
}
else
{
Duration = GetUInt(20 + addToIndex64Bit);
}
Width = (uint)GetWord(76 + addToIndex64Bit); // skip decimals
Height = (uint)GetWord(80 + addToIndex64Bit); // skip decimals
//System.Windows.Forms.MessageBox.Show("Width: " + GetWord(76 + addToIndex64Bit).ToString() + "." + GetWord(78 + addToIndex64Bit).ToString());
//System.Windows.Forms.MessageBox.Show("Height: " + GetWord(80 + addToIndex64Bit).ToString() + "." + GetWord(82 + addToIndex64Bit).ToString());
}
}
}

View File

@ -39,6 +39,9 @@ namespace Nikse.SubtitleEdit.Logic.Mp4
}
}
/// <summary>
/// Resolution of first video track. If not present returns 0.0
/// </summary>
public System.Drawing.Point VideoResolution
{
get