IWMEncStatistics.get_StreamOutputStats
The get_StreamOutputStats method retrieves the encoding and broadcasting statistics for a specific output stream.
Syntax
object IWMEncStatistics.get_StreamOutputStats(
WMENC_SOURCE_TYPE enumType,
short iMediaIndex,
short iStreamIndex
);
Parameters
enumType
[in] Member of a WMENC_SOURCE_TYPE enumeration type indicating the type of the specific stream.
iMediaIndex
[in] Int16 containing the source group index number for a specific input media stream of the type identified by enumType. Because a source group can only contain one audio, one video and one text stream, iMediaIndex must be zero.
iStreamIndex
[in] Int16 containing the index of a specific output stream for the input stream identified by iMediaIndex. A profile identifies the number of multiple output streams for a given input stream.
Return Values
An IWMEncOutputStats object containing status information about the output stream.
If this property fails, it returns an error number.
Number | Description |
0xC00D1B7D | No statistics are currently available. |
Remarks
This property is read-only. The IWMEncOutputStats interface contains information about the number of media samples received and dropped; the current, average and expected bit rate of the broadcast; and the current, average and expected rates at which media samples are encoded. You can use the get_StreamOutputStats method in a timer control.
Example Code
using WMEncoderLib;
try
{
// Create a WMEncoder object.
WMEncoder Encoder;
Encoder = new WMEncoder();
// Retrieve an IWMEncStatistics object.
IWMEncStatistics Stats;
Stats = Encoder.Statistics;
// Configure the encoding session.
// Retrieve the number of multiple bit rate output streams.
int iStreamCount;
iStreamCount = Stats.get_StreamOutputCount(WMENC_SOURCE_TYPE.WMENC_VIDEO,0);
// Retrieve an IWMEncOutputStats object from the
// IWMEncStatistics object.
IWMEncOutputStats OutputStats;
OutputStats = (IWMEncOutputStats)Stats.get_StreamOutputStats(WMENC_SOURCE_TYPE.WMENC_VIDEO, 0, 0);
// You can create a timer control to retrieve the statistics
// (as follows) after you start encoding.
int lAvgBitrate;
int lAvgSampleRate;
decimal lByteCount;
int lCurrentBitRate;
int lCurrentSampleRate;
decimal lDroppedByteCount;
decimal lDroppedSampleCount;
int lExpectedBitRate;
int lExpectedSampleRate;
decimal lSampleCount;
lAvgBitrate = OutputStats.AverageBitrate;
lAvgSampleRate = OutputStats.AverageSampleRate;
lByteCount = OutputStats.ByteCount;
lCurrentBitRate = OutputStats.CurrentBitrate;
lCurrentSampleRate = OutputStats.CurrentSampleRate;
lDroppedByteCount = OutputStats.DroppedByteCount;
lDroppedSampleCount = OutputStats.DroppedSampleCount;
lExpectedBitRate = OutputStats.ExpectedBitrate;
lExpectedSampleRate = OutputStats.ExpectedSampleRate;
lSampleCount = OutputStats.SampleCount;
}
catch (Exception e)
{
// TODO: Handle exceptions.
}
Requirements
Reference: Windows Media Encoder
Namespace: WMEncoderLib
Assembly: Interop.WMEncoderLib.dll
Library: WMEncoderLib.dll
See Also