|
MythTV
0.27pre
|
A class used to display video frames and associated imagery using the OpenGL API. More...
#include <openglvideo.h>

Public Member Functions | |
| OpenGLVideo () | |
| Create a new OpenGLVideo instance that must be initialised with a call to OpenGLVideo::Init() | |
| ~OpenGLVideo () | |
| bool | Init (MythRenderOpenGL *glcontext, VideoColourSpace *colourspace, QSize videoDim, QSize videoDispDim, QRect displayVisibleRect, QRect displayVideoRect, QRect videoRect, bool viewport_control, QString options, bool hwaccel) |
| uint | GetInputTexture (void) const |
| uint | GetTextureType (void) const |
| void | SetInputUpdated (void) |
| void | UpdateInputFrame (const VideoFrame *frame, bool soft_bob=false) |
| Update the current input texture using the data from the given YV12 video frame. | |
| bool | AddFilter (const QString &filter) |
| Public interface to AddFilter(OpenGLFilterType filter) | |
| bool | RemoveFilter (const QString &filter) |
| bool | AddDeinterlacer (const QString &deinterlacer) |
| Extends the functionality of the basic YUV->RGB filter stage to include deinterlacing (combining the stages is significantly more efficient than 2 separate stages). | |
| void | SetDeinterlacing (bool deinterlacing) |
| QString | GetDeinterlacer (void) const |
| void | SetSoftwareDeinterlacer (const QString &filter) |
| void | PrepareFrame (bool topfieldfirst, FrameScanType scan, bool softwareDeinterlacing, long long frame, StereoscopicMode stereo, bool draw_border=false) |
| Render the contents of the current input texture to the framebuffer using the currently enabled filters. | |
| void | SetMasterViewport (QSize size) |
| QSize | GetViewPort (void) const |
| void | SetVideoRect (const QRect &dispvidrect, const QRect &vidrect) |
| QSize | GetVideoSize (void) const |
Private Member Functions | |
| void | Teardown (void) |
| void | SetViewPort (const QSize &new_viewport_size) |
| bool | AddFilter (OpenGLFilterType filter) |
| Add a new filter stage and create any additional resources needed. | |
| bool | RemoveFilter (OpenGLFilterType filter) |
| void | CheckResize (bool deinterlacing, bool allow=true) |
| Determine if the output is to be scaled at all and create or destroy the appropriate filter as necessary. | |
| bool | OptimiseFilters (void) |
| Ensure the current chain of OpenGLFilters is logically correct and has the resources required to complete rendering. | |
| bool | AddFrameBuffer (uint &framebuffer, uint &texture, QSize vid_size) |
| Add a FrameBuffer object of the correct size to the given texture. | |
| uint | AddFragmentProgram (OpenGLFilterType name, QString deint=QString::null, FrameScanType field=kScan_Progressive) |
| Create the correct fragment program for the given filter type. | |
| uint | CreateVideoTexture (QSize size, QSize &tex_size) |
| Create and initialise an OpenGL texture suitable for a YV12 video frame of the given size. | |
| QString | GetProgramString (OpenGLFilterType filter, QString deint=QString::null, FrameScanType field=kScan_Progressive) |
| void | GetProgramStrings (QString &vertex, QString &fragment, OpenGLFilterType filter, QString deint=QString::null, FrameScanType field=kScan_Progressive) |
| void | CustomiseProgramString (QString &string) |
| QSize | GetTextureSize (const QSize &size) |
| void | SetFiltering (void) |
| Set the OpenGL texture mapping functions to optimise speed and quality. | |
| void | RotateTextures (void) |
| void | SetTextureFilters (vector< GLuint > *textures, int filt, int clamp) |
| void | DeleteTextures (vector< GLuint > *textures) |
| void | TearDownDeinterlacer (void) |
Static Private Member Functions | |
| static QString | FilterToString (OpenGLFilterType filter) |
| static OpenGLFilterType | StringToFilter (const QString &filter) |
Private Attributes | |
| MythRenderOpenGL * | gl_context |
| QSize | video_disp_dim |
| QSize | video_dim |
| QSize | viewportSize |
| QSize | masterViewportSize |
| QRect | display_visible_rect |
| QRect | display_video_rect |
| QRect | video_rect |
| QRect | frameBufferRect |
| QString | softwareDeinterlacer |
| QString | hardwareDeinterlacer |
| bool | hardwareDeinterlacing |
| VideoColourSpace * | colourSpace |
| bool | viewportControl |
| vector< GLuint > | referenceTextures |
| vector< GLuint > | inputTextures |
| QSize | inputTextureSize |
| glfilt_map_t | filters |
| long long | currentFrameNum |
| bool | inputUpdated |
| int | refsNeeded |
| bool | textureRects |
| uint | textureType |
| uint | helperTexture |
| OpenGLFilterType | defaultUpsize |
| uint | gl_features |
| uint | videoTextureType |
| bool | preferYCBCR |
A class used to display video frames and associated imagery using the OpenGL API.
The basic operational concept is to use a series of filter stages to generate the desired video output, using limited software assistance alongside OpenGL fragment programs (deinterlacing and YUV->RGB conversion) , FrameBuffer Objects (flexible GPU storage) and PixelBuffer Objects (faster CPU->GPU memory transfers).
In the most basic case, for example, a YV12 frame pre-converted in software to BGRA format is simply blitted to the frame buffer. Currently, the most complicated example is the rendering of a standard definition, interlaced frame to a high(er) definition display using OpenGL (i.e. hardware based) deinterlacing, colourspace conversion and bicubic upsampling.
Higher level tasks such as coordination between OpenGLVideo instances, video buffer management, audio/video synchronisation etc are handled by the higher level classes VideoOutput and NuppelVideoPlayer. The bulk of the lower level interface with the window system and OpenGL is handled by MythRenderOpenGL.
N.B. Direct use of OpenGL calls is minimised to maintain platform independance. The only member function where this is impractical is PrepareFrame().
Definition at line 37 of file openglvideo.h.
| OpenGLVideo::OpenGLVideo | ( | ) |
Create a new OpenGLVideo instance that must be initialised with a call to OpenGLVideo::Init()
Definition at line 65 of file openglvideo.cpp.
| OpenGLVideo::~OpenGLVideo | ( | ) |
Definition at line 82 of file openglvideo.cpp.
| bool OpenGLVideo::Init | ( | MythRenderOpenGL * | glcontext, |
| VideoColourSpace * | colourspace, | ||
| QSize | videoDim, | ||
| QSize | videoDispDim, | ||
| QRect | displayVisibleRect, | ||
| QRect | displayVideoRect, | ||
| QRect | videoRect, | ||
| bool | viewport_control, | ||
| QString | options, | ||
| bool | hwaccel | ||
| ) |
| glcontext | the MythRenderOpenGL object responsible for lower levelwindow and OpenGL context integration |
| colour_control | if true, manipulation of video attributes (colour, contrast etc) will be enabled |
| videoDim | the size of the video source |
| displayVisibleRect | the bounding rectangle of the OpenGL window |
| displayVideoRect | the bounding rectangle for the area to display the video frame |
| videoRect | the portion of the video frame to display in displayVideoRect |
| viewport_control | if true, this instance may permanently change the OpenGL viewport |
| options | a string defining OpenGL features to disable |
| hw_accel | if true, a GPU decoder will copy frames directly to an RGBA texture |
Definition at line 126 of file openglvideo.cpp.
Referenced by VideoOutputOpenGL::SetupOpenGL(), and VideoOutputOpenGL::ShowPIP().
Definition at line 771 of file openglvideo.cpp.
Referenced by VideoOutputOpenGLVAAPI::ProcessFrame().
Definition at line 776 of file openglvideo.cpp.
Referenced by VideoOutputOpenGLVAAPI::ProcessFrame().
Definition at line 781 of file openglvideo.cpp.
Referenced by VideoOutputOpenGLVAAPI::ProcessFrame().
| void OpenGLVideo::UpdateInputFrame | ( | const VideoFrame * | frame, |
| bool | soft_bob = false |
||
| ) |
Update the current input texture using the data from the given YV12 video frame.
If the required hardware support is not available, fall back to software YUV->RGB conversion.
Definition at line 793 of file openglvideo.cpp.
Referenced by VideoOutputOpenGL::ProcessFrame(), and VideoOutputOpenGL::ShowPIP().
|
inline |
Public interface to AddFilter(OpenGLFilterType filter)
Definition at line 55 of file openglvideo.h.
Referenced by AddFilter(), CheckResize(), and Init().
|
inline |
Definition at line 57 of file openglvideo.h.
Referenced by AddFilter(), CheckResize(), RemoveFilter(), and Teardown().
| bool OpenGLVideo::AddDeinterlacer | ( | const QString & | deinterlacer | ) |
Extends the functionality of the basic YUV->RGB filter stage to include deinterlacing (combining the stages is significantly more efficient than 2 separate stages).
Create 2 deinterlacing fragment programs, 1 for each required field.
Definition at line 562 of file openglvideo.cpp.
Referenced by VideoOutputOpenGL::SetupDeinterlace().
Definition at line 847 of file openglvideo.cpp.
Referenced by VideoOutputOpenGL::SetDeinterlacingEnabled(), and VideoOutputOpenGL::SetupDeinterlace().
|
inline |
Definition at line 62 of file openglvideo.h.
Referenced by VideoOutputOpenGL::SetDeinterlacingEnabled(), and VideoOutputOpenGL::SetupDeinterlace().
| void OpenGLVideo::SetSoftwareDeinterlacer | ( | const QString & | filter | ) |
Definition at line 854 of file openglvideo.cpp.
Referenced by VideoOutputOpenGL::SetupDeinterlace(), and VideoOutputOpenGL::SetupOpenGL().
| void OpenGLVideo::PrepareFrame | ( | bool | topfieldfirst, |
| FrameScanType | scan, | ||
| bool | softwareDeinterlacing, | ||
| long long | frame, | ||
| StereoscopicMode | stereo, | ||
| bool | draw_border = false |
||
| ) |
Render the contents of the current input texture to the framebuffer using the currently enabled filters.
| topfieldfirst | the frame is interlaced and top_field_first is set |
| scan | interlaced or progressive? |
| softwareDeinerlacing | the frame has been deinterlaced in software |
| frame | the frame number |
| draw_border | if true, draw a red border around the frame |
Definition at line 878 of file openglvideo.cpp.
Referenced by VideoOutputOpenGL::PrepareFrame().
|
inline |
Definition at line 71 of file openglvideo.h.
Referenced by VideoOutputOpenGL::ShowPIP().
|
inline |
Definition at line 72 of file openglvideo.h.
Referenced by VideoOutputOpenGL::ShowPIP().
|
inline |
Definition at line 73 of file openglvideo.h.
Referenced by VideoOutputOpenGL::MoveResize(), VideoOutputOpenGL::PrepareFrame(), and VideoOutputOpenGL::ShowPIP().
|
inline |
Definition at line 75 of file openglvideo.h.
Referenced by VideoOutputOpenGL::ShowPIP().
Definition at line 88 of file openglvideo.cpp.
Referenced by Init(), and ~OpenGLVideo().
|
private |
Definition at line 698 of file openglvideo.cpp.
Referenced by Init().
|
private |
Add a new filter stage and create any additional resources needed.
Definition at line 422 of file openglvideo.cpp.
|
private |
Definition at line 502 of file openglvideo.cpp.
Determine if the output is to be scaled at all and create or destroy the appropriate filter as necessary.
Definition at line 280 of file openglvideo.cpp.
Referenced by AddDeinterlacer(), Init(), SetDeinterlacing(), and SetSoftwareDeinterlacer().
Ensure the current chain of OpenGLFilters is logically correct and has the resources required to complete rendering.
Definition at line 323 of file openglvideo.cpp.
Referenced by AddFilter(), and CheckResize().
Add a FrameBuffer object of the correct size to the given texture.
Definition at line 679 of file openglvideo.cpp.
Referenced by OptimiseFilters().
|
private |
Create the correct fragment program for the given filter type.
Definition at line 649 of file openglvideo.cpp.
Referenced by AddDeinterlacer(), and AddFilter().
|
private |
Create and initialise an OpenGL texture suitable for a YV12 video frame of the given size.
Definition at line 718 of file openglvideo.cpp.
Referenced by AddDeinterlacer(), and Init().
|
private |
Definition at line 1279 of file openglvideo.cpp.
Referenced by AddFragmentProgram().
|
private |
Definition at line 1578 of file openglvideo.cpp.
Referenced by AddFragmentProgram().
|
private |
Definition at line 1356 of file openglvideo.cpp.
Referenced by GetProgramString(), and GetProgramStrings().
|
staticprivate |
Definition at line 1128 of file openglvideo.cpp.
Referenced by AddFilter(), GetProgramString(), and RemoveFilter().
|
staticprivate |
Definition at line 1114 of file openglvideo.cpp.
|
private |
Definition at line 750 of file openglvideo.cpp.
Referenced by CustomiseProgramString(), and PrepareFrame().
Set the OpenGL texture mapping functions to optimise speed and quality.
Definition at line 386 of file openglvideo.cpp.
Referenced by OptimiseFilters().
Definition at line 1077 of file openglvideo.cpp.
Referenced by UpdateInputFrame().
Definition at line 1104 of file openglvideo.cpp.
Referenced by SetFiltering().
|
private |
Definition at line 1094 of file openglvideo.cpp.
Referenced by RemoveFilter(), Teardown(), and TearDownDeinterlacer().
Definition at line 531 of file openglvideo.cpp.
Referenced by AddDeinterlacer().
|
private |
Definition at line 107 of file openglvideo.h.
Referenced by AddDeinterlacer(), AddFilter(), AddFragmentProgram(), AddFrameBuffer(), CreateVideoTexture(), DeleteTextures(), Init(), OptimiseFilters(), PrepareFrame(), RemoveFilter(), SetDeinterlacing(), SetTextureFilters(), SetViewPort(), Teardown(), TearDownDeinterlacer(), UpdateInputFrame(), and ~OpenGLVideo().
|
private |
Definition at line 108 of file openglvideo.h.
Referenced by CheckResize(), CustomiseProgramString(), Init(), OptimiseFilters(), PrepareFrame(), and SetViewPort().
|
private |
Definition at line 109 of file openglvideo.h.
Referenced by AddDeinterlacer(), Init(), PrepareFrame(), and UpdateInputFrame().
|
private |
Definition at line 110 of file openglvideo.h.
Referenced by SetViewPort().
|
private |
Definition at line 111 of file openglvideo.h.
Referenced by Init(), and PrepareFrame().
|
private |
Definition at line 112 of file openglvideo.h.
Referenced by Init(), and PrepareFrame().
|
private |
Definition at line 113 of file openglvideo.h.
Referenced by CheckResize(), Init(), and PrepareFrame().
|
private |
Definition at line 114 of file openglvideo.h.
Referenced by Init(), and PrepareFrame().
|
private |
Definition at line 115 of file openglvideo.h.
Referenced by Init(), and PrepareFrame().
|
private |
Definition at line 116 of file openglvideo.h.
Referenced by Init(), PrepareFrame(), and SetSoftwareDeinterlacer().
|
private |
Definition at line 117 of file openglvideo.h.
Referenced by AddDeinterlacer(), and PrepareFrame().
|
private |
Definition at line 118 of file openglvideo.h.
Referenced by AddDeinterlacer(), Init(), PrepareFrame(), SetDeinterlacing(), and UpdateInputFrame().
|
private |
Definition at line 119 of file openglvideo.h.
Referenced by Init(), and PrepareFrame().
|
private |
Definition at line 120 of file openglvideo.h.
Referenced by Init(), PrepareFrame(), and SetViewPort().
|
private |
Definition at line 121 of file openglvideo.h.
Referenced by AddDeinterlacer(), PrepareFrame(), RotateTextures(), SetFiltering(), Teardown(), and TearDownDeinterlacer().
|
private |
Definition at line 122 of file openglvideo.h.
Referenced by GetInputTexture(), Init(), PrepareFrame(), RotateTextures(), SetFiltering(), Teardown(), and UpdateInputFrame().
|
private |
Definition at line 123 of file openglvideo.h.
Referenced by AddDeinterlacer(), CustomiseProgramString(), Init(), and PrepareFrame().
|
private |
Definition at line 124 of file openglvideo.h.
Referenced by AddDeinterlacer(), AddFilter(), CheckResize(), Init(), OptimiseFilters(), PrepareFrame(), RemoveFilter(), SetFiltering(), Teardown(), TearDownDeinterlacer(), and UpdateInputFrame().
|
private |
Definition at line 125 of file openglvideo.h.
Referenced by Init(), and PrepareFrame().
|
private |
Definition at line 126 of file openglvideo.h.
Referenced by Init(), PrepareFrame(), SetInputUpdated(), and UpdateInputFrame().
|
private |
Definition at line 127 of file openglvideo.h.
Referenced by AddDeinterlacer(), PrepareFrame(), RotateTextures(), and TearDownDeinterlacer().
|
private |
Definition at line 128 of file openglvideo.h.
Referenced by CustomiseProgramString(), GetTextureSize(), Init(), and PrepareFrame().
|
private |
Definition at line 129 of file openglvideo.h.
Referenced by AddFrameBuffer(), CreateVideoTexture(), GetTextureType(), and Init().
|
private |
Definition at line 130 of file openglvideo.h.
Referenced by AddFilter(), PrepareFrame(), and Teardown().
|
private |
Definition at line 131 of file openglvideo.h.
Referenced by CheckResize(), and Init().
|
private |
Definition at line 132 of file openglvideo.h.
Referenced by AddDeinterlacer(), AddFilter(), AddFragmentProgram(), AddFrameBuffer(), CreateVideoTexture(), and Init().
|
private |
Definition at line 133 of file openglvideo.h.
Referenced by CheckResize(), CreateVideoTexture(), GetProgramString(), GetProgramStrings(), Init(), PrepareFrame(), and UpdateInputFrame().
|
private |
Definition at line 134 of file openglvideo.h.
Referenced by Init().
1.8.1.2