1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103
|
/***************************************************************************
copyright : (C) 2005 by Brian Nickel
email : brian.nickel@gmail.com
***************************************************************************/
/***************************************************************************
* This library is free software; you can redistribute it and/or modify *
* it under the terms of the GNU Lesser General Public License version *
* 2.1 as published by the Free Software Foundation. *
* *
* This library is distributed in the hope that it will be useful, but *
* WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
* Lesser General Public License for more details. *
* *
* You should have received a copy of the GNU Lesser General Public *
* License along with this library; if not, write to the Free Software *
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
* USA *
***************************************************************************/
using System;
namespace TagLib.Asf
{
public class FilePropertiesObject : Object
{
//////////////////////////////////////////////////////////////////////////
// private properties
//////////////////////////////////////////////////////////////////////////
private Guid file_id;
private long file_size;
private long creation_date;
private long data_packets_count;
private long play_duration;
private long send_duration;
private long preroll;
private uint flags;
private uint minimum_data_packet_size;
private uint maximum_data_packet_size;
private uint maximum_bitrate;
//////////////////////////////////////////////////////////////////////////
// public methods
//////////////////////////////////////////////////////////////////////////
public FilePropertiesObject (Asf.File file, long position) : base (file, position)
{
if (!Guid.Equals (Asf.Guid.AsfFilePropertiesObject))
throw new System.Exception ("Object GUID incorrect.");
if (OriginalSize < 104)
throw new System.Exception ("Object size too small.");
file_id = file.ReadGuid ();
file_size = file.ReadQWord ();
creation_date = file.ReadQWord ();
data_packets_count = file.ReadQWord ();
play_duration = file.ReadQWord ();
send_duration = file.ReadQWord ();
preroll = file.ReadQWord ();
flags = file.ReadDWord ();
minimum_data_packet_size = file.ReadDWord ();
maximum_data_packet_size = file.ReadDWord ();
maximum_bitrate = file.ReadDWord ();
}
public override ByteVector Render ()
{
ByteVector output = new ByteVector ();
output += file_id.Render ();
output += RenderQWord (file_size);
output += RenderQWord (creation_date);
output += RenderQWord (data_packets_count);
output += RenderQWord (play_duration);
output += RenderQWord (send_duration);
output += RenderQWord (preroll);
output += RenderDWord (flags);
output += RenderDWord (minimum_data_packet_size);
output += RenderDWord (maximum_data_packet_size);
output += RenderDWord (maximum_bitrate);
return Render (output);
}
//////////////////////////////////////////////////////////////////////////
// public properties
//////////////////////////////////////////////////////////////////////////
public Guid FileId {get {return file_id;}}
public long FileSize {get {return file_size;}}
public DateTime CreationDate {get {return new DateTime (creation_date);}}
public long DataPacketsCount {get {return data_packets_count;}}
public TimeSpan PlayDuration {get {return new TimeSpan (play_duration);}}
public TimeSpan SendDuration {get {return new TimeSpan (send_duration);}}
public long Preroll {get {return preroll;}}
public uint Flags {get {return flags;}}
public uint MinimumDataPacketSize {get {return minimum_data_packet_size;}}
public uint MaximumDataPacketSize {get {return maximum_data_packet_size;}}
public uint MaximumBitrate {get {return maximum_bitrate;}}
}
}
|