LEADTOOLS Multimedia (Leadtools.Multimedia assembly)
LEAD Technologies, Inc

SourceFileSize Property

Example 





Gets the actual size of the current source media file in bytes.
Syntax
public double SourceFileSize {get;}
'Declaration
 
Public ReadOnly Property SourceFileSize As Double
'Usage
 
Dim instance As MediaInfo
Dim value As Double
 
value = instance.SourceFileSize
public double SourceFileSize {get;}
 get_SourceFileSize(); 
public:
property double SourceFileSize {
   double get();
}

Property Value

A value representing the size of the current source media file in bytes.
Remarks
Gets the actual size of the current source media file in bytes. This property is updated automatically when the SourceFile property is set to the current source media file. The current source media file can be found in the SourceFile property. This is the file that the MediaInfo object gets information for. The SourceFile property must be set before retrieving information from any of the other MediaInfo properties. Call the ResetSource method to release the source file when it is no longer needed.
Example
Copy CodeCopy Code  
Public _form As PlayCtrlForm = New PlayCtrlForm()
    Public _result As Boolean = False
    Public Sub ResetSourceExample()
      ' reference the play control
      Dim playctrl As PlayCtrl = _form.PlayCtrl

      ' input file
                Dim inFile As String = Path.Combine(LEAD_VARS.MediaDir, "MediaInfo_Source.avi")
      Dim info As String = String.Empty

      Try
         ' create a new media info object
         Dim mi As MediaInfo = New MediaInfo()

         ' set the input and output files
         mi.SourceFile = inFile

         ' set the info string
                 info = String.Format("Source File={0}" _
                                      & Microsoft.VisualBasic.Constants.vbLf _
                                      & "Source File Size={1}" & Microsoft.VisualBasic.Constants.vbLf _
                                      & "Duration={2}" & Microsoft.VisualBasic.Constants.vbLf _
                                      & "VideoBitRate={3}" _
                                      & Microsoft.VisualBasic.Constants.vbLf _
                                      & "VideoBitCount={4}" _
                                      & Microsoft.VisualBasic.Constants.vbLf + Microsoft.VisualBasic.Constants.vbLf _
                                      & "Are these values correct?", _
                                      mi.SourceFile, _
                                      mi.SourceFileSize, _
                                      mi.SourceDuration, _
                                      mi.VideoBitRate, _
                                      mi.VideoBitCount) ', mi.AudioBitsPerSample, mi.AudioChannels);

         ' verify the values
         _result = (MessageBox.Show(_form, info, "Media Info", MessageBoxButtons.YesNo) = DialogResult.Yes)

         ' reset the source
         mi.ResetSource()

         ' set the result to what we expect
         _result = _result And (mi.SourceFile Is Nothing)
      Catch e1 As Exception
         _result = False
      End Try
    End Sub

Public NotInheritable Class LEAD_VARS
   Public Const MediaDir As String = "C:\Program Files (x86)\LEAD Technologies\LEADTOOLS 175\Media";
End Class
public PlayCtrlForm _form = new PlayCtrlForm();
      public bool _result = false;
      public void ResetSourceExample()
      {
         // reference the play control
         PlayCtrl playctrl = _form.PlayCtrl;

         // input file
         string inFile =Path.Combine(LEAD_VARS.MediaDir,"MediaInfo_Source.avi");
         string info = string.Empty;

         try
         {
            // create a new media info object
            MediaInfo mi = new MediaInfo();

            // set the input and output files
            mi.SourceFile = inFile;

            // set the info string
            info = string.Format("Source File={0}\nSource File Size={1}\nDuration={2}\nVideoBitRate={3}\nVideoBitCount={4}\n\nAre these values correct?",
                // AudioBitsPerSample={5}\nAudioChannels={6}\n 
               mi.SourceFile, mi.SourceFileSize, mi.SourceDuration, mi.VideoBitRate, mi.VideoBitCount); //, mi.AudioBitsPerSample, mi.AudioChannels);

            // verify the values
            _result = (MessageBox.Show(_form, info, "Media Info", MessageBoxButtons.YesNo) == DialogResult.Yes);

            // reset the source
            mi.ResetSource();

            // set the result to what we expect
            _result &= (mi.SourceFile == null);
         }
         catch (Exception)
         {
            _result = false;
         }
      }

static class LEAD_VARS
{
   public const string MediaDir = @"C:\Program Files (x86)\LEAD Technologies\LEADTOOLS 175\Media";
}
Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

Reference

MediaInfo Class
MediaInfo Members

 

 


Products | Support | Contact Us | Copyright Notices

© 2006-2012 All Rights Reserved. LEAD Technologies, Inc.

Leadtools.Multimedia requires a Multimedia or Multimedia Suite license and unlock key. For more information, refer to: LEADTOOLS Toolkit Features