Commit 2d1b7b42 authored by Felix Paul Kühne's avatar Felix Paul Kühne

VLCMedia: add individual getters for all stats

parent 99bee696
......@@ -398,4 +398,89 @@ extern NSString *VLCMediaTracksInformationTypeUnknown;
*/
- (NSDictionary*) stats;
#pragma mark - individual stats
/**
* returns the number of bytes read by the current input module
* \return a NSInteger with the raw number of bytes
*/
- (NSInteger)numberOfReadBytesOnInput;
/**
* returns the current input bitrate. may be 0 if the buffer is full
* \return a float of the current input bitrate
*/
- (float)inputBitrate;
/**
* returns the number of bytes read by the current demux module
* \return a NSInteger with the raw number of bytes
*/
- (NSInteger)numberOfReadBytesOnDemux;
/**
* returns the current demux bitrate. may be 0 if the buffer is empty
* \return a float of the current demux bitrate
*/
- (float)demuxBitrate;
/**
* returns the total number of decoded video blocks in the current media session
* \return a NSInteger with the total number of decoded blocks
*/
- (NSInteger)numberOfDecodedVideoBlocks;
/**
* returns the total number of decoded audio blocks in the current media session
* \return a NSInteger with the total number of decoded blocks
*/
- (NSInteger)numberOfDecodedAudioBlocks;
/**
* returns the total number of displayed pictures during the current media session
* \return a NSInteger with the total number of displayed pictures
*/
- (NSInteger)numberOfDisplayedPictures;
/**
* returns the total number of pictures lost during the current media session
* \return a NSInteger with the total number of lost pictures
*/
- (NSInteger)numberOfLostPictures;
/**
* returns the total number of played audio buffers during the current media session
* \return a NSInteger with the total number of played audio buffers
*/
- (NSInteger)numberOfPlayedAudioBuffers;
/**
* returns the total number of audio buffers lost during the current media session
* \return a NSInteger with the total number of displayed pictures
*/
- (NSInteger)numberOfLostAudioBuffers;
/**
* returns the total number of packets sent during the current media session
* \return a NSInteger with the total number of sent packets
*/
- (NSInteger)numberOfSentPackets;
/**
* returns the total number of raw bytes sent during the current media session
* \return a NSInteger with the total number of sent bytes
*/
- (NSInteger)numberOfSentBytes;
/**
* returns the current bitrate of sent bytes
* \return a float of the current bitrate of sent bits
*/
- (float)streamOutputBitrate;
/**
* returns the total number of corrupted data packets during current sout session
* \note value is 0 on non-stream-output operations
* \return a NSInteger with the total number of corrupted data packets
*/
- (NSInteger)numberOfCorruptedDataPackets;
/**
* returns the total number of discontinuties during current sout session
* \note value is 0 on non-stream-output operations
* \return a NSInteger with the total number of discontinuties
*/
- (NSInteger)numberOfDiscontinuties;
@end
......@@ -15,6 +15,9 @@ New APIs:
- added (BOOL)isMediaSizeSuitableForDevice to let VLCKit determine whether the
current media is considered to be suitable for the current device or
playback is discouraged. Will always return true on OS X devices.
- added individual getters for all statistic values, so client application can
fetch single values instead of having to process a NSDictionary with all the
available values. The old API is still available and will stay.
- VLCMediaPlayer:
- added support to enable, switch and disable video tracks
- added setter/getter for SPU and audio delays
......
......@@ -352,6 +352,171 @@ static void HandleMediaParsedChanged(const libvlc_event_t * event, void * self)
return d;
}
- (NSInteger)numberOfReadBytesOnInput
{
if (!p_md)
return 0;
libvlc_media_stats_t p_stats;
libvlc_media_get_stats(p_md, &p_stats);
return p_stats.i_read_bytes;
}
- (float)inputBitrate
{
if (!p_md)
return .0;
libvlc_media_stats_t p_stats;
libvlc_media_get_stats(p_md, &p_stats);
return p_stats.f_input_bitrate;
}
- (NSInteger)numberOfReadBytesOnDemux
{
if (!p_md)
return 0;
libvlc_media_stats_t p_stats;
libvlc_media_get_stats(p_md, &p_stats);
return p_stats.i_demux_read_bytes;
}
- (float)demuxBitrate
{
if (!p_md)
return .0;
libvlc_media_stats_t p_stats;
libvlc_media_get_stats(p_md, &p_stats);
return p_stats.f_demux_bitrate;
}
- (NSInteger)numberOfDecodedVideoBlocks
{
if (!p_md)
return 0;
libvlc_media_stats_t p_stats;
libvlc_media_get_stats(p_md, &p_stats);
return p_stats.i_decoded_video;
}
- (NSInteger)numberOfDecodedAudioBlocks
{
if (!p_md)
return 0;
libvlc_media_stats_t p_stats;
libvlc_media_get_stats(p_md, &p_stats);
return p_stats.i_decoded_audio;
}
- (NSInteger)numberOfDisplayedPictures
{
if (!p_md)
return 0;
libvlc_media_stats_t p_stats;
libvlc_media_get_stats(p_md, &p_stats);
return p_stats.i_displayed_pictures;
}
- (NSInteger)numberOfLostPictures
{
if (!p_md)
return 0;
libvlc_media_stats_t p_stats;
libvlc_media_get_stats(p_md, &p_stats);
return p_stats.i_lost_pictures;
}
- (NSInteger)numberOfPlayedAudioBuffers
{
if (!p_md)
return 0;
libvlc_media_stats_t p_stats;
libvlc_media_get_stats(p_md, &p_stats);
return p_stats.i_played_abuffers;
}
- (NSInteger)numberOfLostAudioBuffers
{
if (!p_md)
return 0;
libvlc_media_stats_t p_stats;
libvlc_media_get_stats(p_md, &p_stats);
return p_stats.i_lost_abuffers;
}
- (NSInteger)numberOfSentPackets
{
if (!p_md)
return 0;
libvlc_media_stats_t p_stats;
libvlc_media_get_stats(p_md, &p_stats);
return p_stats.i_sent_packets;
}
- (NSInteger)numberOfSentBytes
{
if (!p_md)
return 0;
libvlc_media_stats_t p_stats;
libvlc_media_get_stats(p_md, &p_stats);
return p_stats.i_sent_bytes;
}
- (float)streamOutputBitrate
{
if (!p_md)
return .0;
libvlc_media_stats_t p_stats;
libvlc_media_get_stats(p_md, &p_stats);
return p_stats.f_send_bitrate;
}
- (NSInteger)numberOfCorruptedDataPackets
{
if (!p_md)
return 0;
libvlc_media_stats_t p_stats;
libvlc_media_get_stats(p_md, &p_stats);
return p_stats.i_demux_corrupted;
}
- (NSInteger)numberOfDiscontinuties
{
if (!p_md)
return 0;
libvlc_media_stats_t p_stats;
libvlc_media_get_stats(p_md, &p_stats);
return p_stats.i_demux_discontinuity;
}
NSString *VLCMediaTracksInformationCodec = @"codec"; // NSNumber
NSString *VLCMediaTracksInformationId = @"id"; // NSNumber
NSString *VLCMediaTracksInformationType = @"type"; // NSString
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment