diff options
-rw-r--r-- | ChangeLog | 1 | ||||
-rw-r--r-- | softhddev.c | 36 | ||||
-rw-r--r-- | softhddev.h | 2 | ||||
-rw-r--r-- | softhddevice.cpp | 4 | ||||
-rw-r--r-- | video.c | 40 | ||||
-rw-r--r-- | video.h | 3 |
6 files changed, 84 insertions, 2 deletions
@@ -1,6 +1,7 @@ User johns Date: + Report correct video size in cSoftHdDevice::GetVideoSize. Add picture adjustment support for vdpau. Revert "mpeg_vdpau" back to "mpegvideo_vdpau". Fix bug: Can't use software decoder with VDPAU. diff --git a/softhddev.c b/softhddev.c index 81c80eb..d2eee03 100644 --- a/softhddev.c +++ b/softhddev.c @@ -2020,6 +2020,42 @@ int64_t GetSTC(void) } /** +** Get video stream size and aspect. +** +** @param width[OUT] width of video stream +** @param height[OUT] height of video stream +** @param aspect[OUT] aspect ratio (4/3, 16/9, ...) of video stream +*/ +void GetVideoSize(int *width, int *height, double *aspect) +{ +#ifdef DEBUG + static int done_width; + static int done_height; +#endif + int aspect_num; + int aspect_den; + + if (MyHwDecoder) { + VideoGetVideoSize(MyHwDecoder, width, height, &aspect_num, + &aspect_den); + *aspect = (double)aspect_num / (double)aspect_den; + } else { + *width = 0; + *height = 0; + *aspect = 1.0; // like default cDevice::GetVideoSize + } + +#ifdef DEBUG + if (done_width != *width || done_height != *height) { + Debug(3, "[softhddev]%s: %dx%d %g\n", __FUNCTION__, *width, *height, + *aspect); + done_width = *width; + done_height = *height; + } +#endif +} + +/** ** Set trick play speed. ** ** Every single frame shall then be displayed the given number of diff --git a/softhddev.h b/softhddev.h index 66b0b5a..60dfcbf 100644 --- a/softhddev.h +++ b/softhddev.h @@ -53,6 +53,8 @@ extern "C" extern int SetPlayMode(int); /// C plugin get current system time counter extern int64_t GetSTC(void); + /// C plugin get video stream size and aspect + extern void GetVideoSize(int *, int *, double *); /// C plugin set trick speed extern void TrickSpeed(int); /// C plugin clears all video and audio data from the device diff --git a/softhddevice.cpp b/softhddevice.cpp index ac717e2..100af10 100644 --- a/softhddevice.cpp +++ b/softhddevice.cpp @@ -1741,11 +1741,11 @@ void cSoftHdDevice::SetVideoFormat(bool video_format16_9) ** Returns the width, height and video_aspect ratio of the currently ** displayed video material. ** -** @note the size is used to scale the subtitle. +** @note the video_aspect is used to scale the subtitle. */ void cSoftHdDevice::GetVideoSize(int &width, int &height, double &video_aspect) { - ::GetOsdSize(&width, &height, &video_aspect); + ::GetVideoSize(&width, &height, &video_aspect); } /** @@ -9698,6 +9698,46 @@ void VideoGetStats(VideoHwDecoder * hw_decoder, int *missed, int *duped, #endif } +/// +/// Get decoder video stream size. +/// +/// @param hw_decoder video hardware decoder +/// @param[out] width video stream width +/// @param[out] height video stream height +/// @param[out] aspect_num video stream aspect numerator +/// @param[out] aspect_den video stream aspect denominator +/// +void VideoGetVideoSize(VideoHwDecoder * hw_decoder, int *width, int *height, + int *aspect_num, int *aspect_den) +{ + *width = 1920; + *height = 1080; + *aspect_num = 16; + *aspect_den = 9; + // FIXME: test to check if working, than make module function +#ifdef USE_VDPAU + if (VideoUsedModule == &VdpauModule) { + *width = hw_decoder->Vdpau.InputWidth; + *height = hw_decoder->Vdpau.InputHeight; + av_reduce(aspect_num, aspect_den, + hw_decoder->Vdpau.InputWidth * hw_decoder->Vdpau.InputAspect.num, + hw_decoder->Vdpau.InputHeight * hw_decoder->Vdpau.InputAspect.den, + 1024 * 1024); + } +#endif +#ifdef USE_VAAPI + if (VideoUsedModule == &VaapiModule) { + *width = hw_decoder->Vaapi.InputWidth; + *height = hw_decoder->Vaapi.InputHeight; + av_reduce(aspect_num, aspect_den, + hw_decoder->Vaapi.InputWidth * hw_decoder->Vaapi.InputAspect.num, + hw_decoder->Vaapi.InputHeight * hw_decoder->Vaapi.InputAspect.den, + 1024 * 1024); + } +#endif + +} + #ifdef USE_SCREENSAVER //---------------------------------------------------------------------------- @@ -193,6 +193,9 @@ extern uint8_t *VideoGrabService(int *, int *, int *); /// Get decoder statistics. extern void VideoGetStats(VideoHwDecoder *, int *, int *, int *, int *); + /// Get video stream size +extern void VideoGetVideoSize(VideoHwDecoder *, int *, int *, int *, int *); + extern void VideoOsdInit(void); ///< Setup osd. extern void VideoOsdExit(void); ///< Cleanup osd. |