Add function GetStats to the video output module.

This commit is contained in:
Johns 2013-08-07 10:29:44 +02:00
parent 5265e68aa9
commit a13c25d309
2 changed files with 51 additions and 17 deletions

View File

@ -1,6 +1,7 @@
User johns User johns
Date: Date:
Add function GetStats to the video output module.
Add function ResetStart to the video output module. Add function ResetStart to the video output module.
Add function SetClosing to the video output module. Add function SetClosing to the video output module.
Generalize GetVaapiContext to GetHwAccelContext. Generalize GetVaapiContext to GetHwAccelContext.

67
video.c
View File

@ -267,6 +267,7 @@ typedef struct _video_module_
void (*const ResetStart) (const VideoHwDecoder *); void (*const ResetStart) (const VideoHwDecoder *);
void (*const SetTrickSpeed) (const VideoHwDecoder *, int); void (*const SetTrickSpeed) (const VideoHwDecoder *, int);
uint8_t *(*const GrabOutput)(int *, int *, int *); uint8_t *(*const GrabOutput)(int *, int *, int *);
void (*const GetStats) (VideoHwDecoder *, int *, int *, int *, int *);
void (*const SetBackground) (uint32_t); void (*const SetBackground) (uint32_t);
void (*const SetVideoMode) (void); void (*const SetVideoMode) (void);
void (*const ResetAutoCrop) (void); void (*const ResetAutoCrop) (void);
@ -4843,6 +4844,24 @@ static void VaapiSetTrickSpeed(VaapiDecoder * decoder, int speed)
} }
} }
///
/// Get VA-API decoder statistics.
///
/// @param decoder VA-API decoder
/// @param[out] missed missed frames
/// @param[out] duped duped frames
/// @param[out] dropped dropped frames
/// @param[out] count number of decoded frames
///
void VaapiGetStats(VaapiDecoder * decoder, int *missed, int *duped,
int *dropped, int *counter)
{
*missed = decoder->FramesMissed;
*duped = decoder->FramesDuped;
*dropped = decoder->FramesDropped;
*counter = decoder->FrameCounter;
}
/// ///
/// Sync decoder output to audio. /// Sync decoder output to audio.
/// ///
@ -5405,6 +5424,8 @@ static const VideoModule VaapiModule = {
.SetTrickSpeed = .SetTrickSpeed =
(void (*const) (const VideoHwDecoder *, int))VaapiSetTrickSpeed, (void (*const) (const VideoHwDecoder *, int))VaapiSetTrickSpeed,
.GrabOutput = NULL, .GrabOutput = NULL,
.GetStats = (void (*const) (VideoHwDecoder *, int *, int *, int *,
int *))VaapiGetStats,
.SetBackground = VaapiSetBackground, .SetBackground = VaapiSetBackground,
.SetVideoMode = VaapiSetVideoMode, .SetVideoMode = VaapiSetVideoMode,
.ResetAutoCrop = VaapiResetAutoCrop, .ResetAutoCrop = VaapiResetAutoCrop,
@ -5445,6 +5466,8 @@ static const VideoModule VaapiGlxModule = {
.SetTrickSpeed = .SetTrickSpeed =
(void (*const) (const VideoHwDecoder *, int))VaapiSetTrickSpeed, (void (*const) (const VideoHwDecoder *, int))VaapiSetTrickSpeed,
.GrabOutput = NULL, .GrabOutput = NULL,
.GetStats = (void (*const) (VideoHwDecoder *, int *, int *, int *,
int *))VaapiGetStats,
.SetBackground = VaapiSetBackground, .SetBackground = VaapiSetBackground,
.SetVideoMode = VaapiSetVideoMode, .SetVideoMode = VaapiSetVideoMode,
.ResetAutoCrop = VaapiResetAutoCrop, .ResetAutoCrop = VaapiResetAutoCrop,
@ -8441,6 +8464,24 @@ static void VdpauSetTrickSpeed(VdpauDecoder * decoder, int speed)
} }
} }
///
/// Get VDPAU decoder statistics.
///
/// @param decoder VDPAU decoder
/// @param[out] missed missed frames
/// @param[out] duped duped frames
/// @param[out] dropped dropped frames
/// @param[out] count number of decoded frames
///
void VdpauGetStats(VdpauDecoder * decoder, int *missed, int *duped,
int *dropped, int *counter)
{
*missed = decoder->FramesMissed;
*duped = decoder->FramesDuped;
*dropped = decoder->FramesDropped;
*counter = decoder->FrameCounter;
}
/// ///
/// Sync decoder output to audio. /// Sync decoder output to audio.
/// ///
@ -9148,6 +9189,8 @@ static const VideoModule VdpauModule = {
.SetTrickSpeed = .SetTrickSpeed =
(void (*const) (const VideoHwDecoder *, int))VdpauSetTrickSpeed, (void (*const) (const VideoHwDecoder *, int))VdpauSetTrickSpeed,
.GrabOutput = VdpauGrabOutputSurface, .GrabOutput = VdpauGrabOutputSurface,
.GetStats = (void (*const) (VideoHwDecoder *, int *, int *, int *,
int *))VdpauGetStats,
.SetBackground = VdpauSetBackground, .SetBackground = VdpauSetBackground,
.SetVideoMode = VdpauSetVideoMode, .SetVideoMode = VdpauSetVideoMode,
.ResetAutoCrop = VdpauResetAutoCrop, .ResetAutoCrop = VdpauResetAutoCrop,
@ -9307,6 +9350,8 @@ static const VideoModule NoopModule = {
.SetTrickSpeed = .SetTrickSpeed =
(void (*const) (const VideoHwDecoder *, int))NoopSetTrickSpeed, (void (*const) (const VideoHwDecoder *, int))NoopSetTrickSpeed,
.GrabOutput = NoopGrabOutputSurface, .GrabOutput = NoopGrabOutputSurface,
.GetStats = (void (*const) (VideoHwDecoder *, int *, int *, int *,
int *))NoopGetStats,
#endif #endif
.SetBackground = NoopSetBackground, .SetBackground = NoopSetBackground,
.SetVideoMode = NoopVoid, .SetVideoMode = NoopVoid,
@ -10198,23 +10243,7 @@ uint8_t *VideoGrabService(int *size, int *width, int *height)
void VideoGetStats(VideoHwDecoder * hw_decoder, int *missed, int *duped, void VideoGetStats(VideoHwDecoder * hw_decoder, int *missed, int *duped,
int *dropped, int *counter) int *dropped, int *counter)
{ {
// FIXME: test to check if working, than make module function VideoUsedModule->GetStats(hw_decoder, missed, duped, dropped, counter);
#ifdef USE_VDPAU
if (VideoUsedModule == &VdpauModule) {
*missed = hw_decoder->Vdpau.FramesMissed;
*duped = hw_decoder->Vdpau.FramesDuped;
*dropped = hw_decoder->Vdpau.FramesDropped;
*counter = hw_decoder->Vdpau.FrameCounter;
}
#endif
#ifdef USE_VAAPI
if (VideoUsedModule == &VaapiModule) {
*missed = hw_decoder->Vaapi.FramesMissed;
*duped = hw_decoder->Vaapi.FramesDuped;
*dropped = hw_decoder->Vaapi.FramesDropped;
*counter = hw_decoder->Vaapi.FrameCounter;
}
#endif
} }
/// ///
@ -10582,6 +10611,7 @@ void VideoSetBlackPicture(int onoff)
/// ///
void VideoSetBrightness(int brightness) void VideoSetBrightness(int brightness)
{ {
// FIXME: test to check if working, than make module function
#ifdef USE_VDPAU #ifdef USE_VDPAU
if (VideoUsedModule == &VdpauModule) { if (VideoUsedModule == &VdpauModule) {
VdpauDecoders[0]->Procamp.brightness = brightness / 1000; VdpauDecoders[0]->Procamp.brightness = brightness / 1000;
@ -10599,6 +10629,7 @@ void VideoSetBrightness(int brightness)
/// ///
void VideoSetContrast(int contrast) void VideoSetContrast(int contrast)
{ {
// FIXME: test to check if working, than make module function
#ifdef USE_VDPAU #ifdef USE_VDPAU
if (VideoUsedModule == &VdpauModule) { if (VideoUsedModule == &VdpauModule) {
VdpauDecoders[0]->Procamp.contrast = contrast / 1000; VdpauDecoders[0]->Procamp.contrast = contrast / 1000;
@ -10616,6 +10647,7 @@ void VideoSetContrast(int contrast)
/// ///
void VideoSetSaturation(int saturation) void VideoSetSaturation(int saturation)
{ {
// FIXME: test to check if working, than make module function
#ifdef USE_VDPAU #ifdef USE_VDPAU
if (VideoUsedModule == &VdpauModule) { if (VideoUsedModule == &VdpauModule) {
VdpauDecoders[0]->Procamp.saturation = saturation / 1000; VdpauDecoders[0]->Procamp.saturation = saturation / 1000;
@ -10633,6 +10665,7 @@ void VideoSetSaturation(int saturation)
/// ///
void VideoSetHue(int hue) void VideoSetHue(int hue)
{ {
// FIXME: test to check if working, than make module function
#ifdef USE_VDPAU #ifdef USE_VDPAU
if (VideoUsedModule == &VdpauModule) { if (VideoUsedModule == &VdpauModule) {
VdpauDecoders[0]->Procamp.hue = hue / 1000; VdpauDecoders[0]->Procamp.hue = hue / 1000;