public int AudioFormatTag { get; }
public:
property int AudioFormatTag {
int get();
}
A value (FOURCC Code) representing the audio format type of the current audio stream.
Gets the audio format type for the current stream in the current source media file. This property is updated automatically when the CurrentStream property is set to an audio stream. For a list of FOURCC values, refer to the Microsoft documentation on FOURCC Codes. This property will not be updated if the current stream is not an audio stream. The current source media file, found in the SourceFile property, 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.
using Leadtools;
using Leadtools.Multimedia;
using LeadtoolsMultimediaExamples.Fixtures;
public PlayCtrlForm _form = new PlayCtrlForm();
public bool _result = false;
public void ResetSourceExample()
{
// reference the play control
PlayCtrl playctrl = _form.PlayCtrl;
// input file
string inWmvFile = Path.Combine(LEAD_VARS.MediaDir, "MediaInfo_Source.wmv");
string inAviFile = Path.Combine(LEAD_VARS.MediaDir, "MediaInfo_Source.avi");
try
{
// create a new media info object
MediaInfo mi = new MediaInfo();
// get MP3 info
mi.SourceFile = inWmvFile;
// set the info string with general media information
Console.WriteLine("General Info");
Console.WriteLine("Title: " + mi.Title);
Console.WriteLine("Author: " + mi.Author);
Console.WriteLine("Description: " + mi.Description);
Console.WriteLine("Rating: " + mi.Rating);
Console.WriteLine("Copyright: " + mi.Copyright);
Console.WriteLine();
// reset the source
mi.ResetSource();
// get AVI info
mi.SourceFile = inAviFile;
Console.WriteLine("General Info");
Console.WriteLine("File: " + mi.SourceFile);
Console.WriteLine("File Size: " + mi.SourceFileSize);
Console.WriteLine("Format: " + mi.SourceFormat + "(" + mi.SourceFormatName + ")");
Console.WriteLine("Duration: " + mi.SourceDuration);
Console.WriteLine("Real Bit-rate: " + mi.SourceBitRate);
Console.WriteLine("Format Type: " + mi.SourceMediaType.FormatType);
Console.WriteLine();
Console.WriteLine("Source Filter Info");
var s = mi.SourceFilter;
IntPtr ptr = Marshal.GetIUnknownForObject(s);
Console.WriteLine(string.Format("Address of Object Pointer: 0x{0:X}", ptr.ToInt64()));
Console.WriteLine("ClassID: " + mi.SourceFilterClassID);
Console.WriteLine("Name: " + mi.SourceFilterName);
Console.WriteLine("Streams Info");
for ( int streamIndex = 0; streamIndex < mi.OutputStreams; streamIndex++ )
{
mi.CurrentStream = streamIndex;
Console.WriteLine("Stream Index: " + streamIndex);
Console.WriteLine("Type: " + mi.StreamType + "(" + mi.StreamTypeName);
Console.WriteLine("Subtype: " + mi.StreamSubtype + "(" + mi.StreamSubtypeName);
Console.WriteLine("Format Type: " + mi.StreamMediaType.FormatType);
if (mi.StreamTypeName == "Video")
{
Console.WriteLine("Width: " + mi.VideoWidth + " pixels");
Console.WriteLine("Height: " + mi.VideoHeight + " pixels");
Console.WriteLine("Bit Count: " + mi.VideoBitCount + " bits per pixel");
Console.WriteLine("Frame Count: " + mi.VideoFrames);
Console.WriteLine("Frame Rate: " + mi.VideoFrameRate + "frames per second");
Console.WriteLine("Compression: " + mi.VideoCompression);
Console.WriteLine("Bit-rate: " + mi.VideoBitRate + "kbps");
Console.WriteLine("Duration: " + mi.StreamDuration + "seconds");
Console.WriteLine();
}
else if (mi.StreamTypeName == "Audio")
{
Console.WriteLine("Format Tag: " + mi.AudioFormatTag);
Console.WriteLine("Channels: " + mi.AudioChannels);
Console.WriteLine("Frequency: " + mi.AudioSamplesPerSec + " samples per second");
Console.WriteLine("Sample Size: " + mi.AudioBitsPerSample + " bits per sample");
Console.WriteLine("Average Rate: " + mi.AudioAvgBytesPerSec + "bytes per second");
Console.WriteLine("Duration: " + mi.StreamDuration + "seconds");
Console.WriteLine();
}
}
// media info outputted to console, set result to true
_result = true;
// 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:\LEADTOOLS23\Media";
}
Help Collections
Raster .NET | C API | C++ Class Library | HTML5 JavaScript
Document .NET | C API | C++ Class Library | HTML5 JavaScript
Medical .NET | C API | C++ Class Library | HTML5 JavaScript
Medical Web Viewer .NET
Multimedia
Direct Show .NET | C API | Filters
Media Foundation .NET | C API | Transforms
Supported Platforms
.NET, Java, Android, and iOS/macOS Assemblies
Imaging, Medical, and Document
C API/C++ Class Libraries
Imaging, Medical, and Document
HTML5 JavaScript Libraries
Imaging, Medical, and Document