own displayed video metadata on render thread
This commit is contained in:
@@ -1 +1,2 @@
|
|||||||
build
|
build
|
||||||
|
imgui.ini
|
||||||
|
|||||||
+18
-15
@@ -614,6 +614,10 @@ func main() {
|
|||||||
sdl.SetWindowFullscreen(windowHandler, true)
|
sdl.SetWindowFullscreen(windowHandler, true)
|
||||||
}
|
}
|
||||||
var (
|
var (
|
||||||
|
displayedVideoWidth uint32
|
||||||
|
displayedVideoHeight uint32
|
||||||
|
displayedVideoStride uint32
|
||||||
|
|
||||||
fps float64
|
fps float64
|
||||||
lastIndex uint64
|
lastIndex uint64
|
||||||
dropped uint64
|
dropped uint64
|
||||||
@@ -692,6 +696,9 @@ func main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
shownIndex = pendingFrame.Frame.Index
|
shownIndex = pendingFrame.Frame.Index
|
||||||
|
displayedVideoWidth = pendingFrame.Frame.Width
|
||||||
|
displayedVideoHeight = pendingFrame.Frame.Height
|
||||||
|
displayedVideoStride = pendingFrame.Frame.Stride
|
||||||
hasFrame = true
|
hasFrame = true
|
||||||
} else if frameErr != nil &&
|
} else if frameErr != nil &&
|
||||||
!errors.Is(frameErr, context.DeadlineExceeded) &&
|
!errors.Is(frameErr, context.DeadlineExceeded) &&
|
||||||
@@ -731,14 +738,12 @@ func main() {
|
|||||||
cimgui.Text(fmt.Sprintf("FPS: %.1f", fps))
|
cimgui.Text(fmt.Sprintf("FPS: %.1f", fps))
|
||||||
cimgui.Text(fmt.Sprintf("Dropped: %d", dropped))
|
cimgui.Text(fmt.Sprintf("Dropped: %d", dropped))
|
||||||
cimgui.Text(fmt.Sprintf("Index: %d", shownIndex))
|
cimgui.Text(fmt.Sprintf("Index: %d", shownIndex))
|
||||||
if videoSrc != nil {
|
if displayedVideoWidth != 0 && displayedVideoHeight != 0 {
|
||||||
cimgui.Text(fmt.Sprintf("Video: %dx%d %.2fp", videoSrc.Width(), videoSrc.Height(),
|
cimgui.Text(fmt.Sprintf(
|
||||||
float32(videoSrc.Rate().Num/videoSrc.Rate().Den)))
|
"Video: %dx%d",
|
||||||
}
|
displayedVideoWidth,
|
||||||
if syncSrc != nil {
|
displayedVideoHeight,
|
||||||
cimgui.Text(fmt.Sprintf("Video: %dx%d %.2fp", syncSrc.Width(), syncSrc.Height(),
|
))
|
||||||
float32(syncSrc.Rate().Num/syncSrc.Rate().Den)))
|
|
||||||
cimgui.Text(fmt.Sprintf("Audio: %dch %dkHz", syncSrc.Channels(), syncSrc.AudioRate().Num))
|
|
||||||
}
|
}
|
||||||
cimgui.Text("\nPress F1 to hide stats")
|
cimgui.Text("\nPress F1 to hide stats")
|
||||||
cimgui.Text("Q or Esc to quit")
|
cimgui.Text("Q or Esc to quit")
|
||||||
@@ -757,13 +762,11 @@ func main() {
|
|||||||
gui.EndFrame()
|
gui.EndFrame()
|
||||||
lastFrame = time.Now()
|
lastFrame = time.Now()
|
||||||
// end of test widget
|
// end of test widget
|
||||||
var w, h, stride uint32
|
err := r.DrawFrame(
|
||||||
if syncSrc != nil {
|
displayedVideoWidth,
|
||||||
w, h, stride = syncSrc.Width(), syncSrc.Height(), syncSrc.Stride()
|
displayedVideoHeight,
|
||||||
} else if videoSrc != nil {
|
displayedVideoStride,
|
||||||
w, h, stride = videoSrc.Width(), videoSrc.Height(), videoSrc.Stride()
|
)
|
||||||
}
|
|
||||||
err := r.DrawFrame(w, h, stride)
|
|
||||||
if errors.Is(err, renderer.ErrOutOfDate) {
|
if errors.Is(err, renderer.ErrOutOfDate) {
|
||||||
if rerr := r.RecreateSwapchain(); rerr != nil {
|
if rerr := r.RecreateSwapchain(); rerr != nil {
|
||||||
if errors.Is(rerr, renderer.ErrMinimized) {
|
if errors.Is(rerr, renderer.ErrMinimized) {
|
||||||
|
|||||||
Reference in New Issue
Block a user