public int AudioChannels { get; } public:property int AudioChannels {int get();}
A value representing the number of audio channels for the current stream.
Gets the number of audio channels for the current stream in the current source media file. This property is updated automatically when the CurrentStream property is set to the current stream, if the current stream is an audio stream. 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. The current stream is set using the CurrentStream property.
using Leadtools;using Leadtools.Multimedia;using LeadtoolsMultimediaExamples.Fixtures;public PlayCtrlForm _form = new PlayCtrlForm();public bool _result = false;public void ResetSourceExample(){// reference the play controlPlayCtrl playctrl = _form.PlayCtrl;// input filestring 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 objectMediaInfo mi = new MediaInfo();// get MP3 infomi.SourceFile = inWmvFile;// set the info string with general media informationConsole.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 sourcemi.ResetSource();// get AVI infomi.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 sourcemi.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
