VideoOutputXv Class Reference

Supports common video output methods used with X11 Servers. More...

#include <videoout_xv.h>

Inheritance diagram for VideoOutputXv:
VideoOutput

List of all members.

Public Member Functions

 VideoOutputXv ()
 ~VideoOutputXv ()
bool Init (int width, int height, float aspect, WId winid, const QRect &win_rect, MythCodecID codec_id)
bool SetDeinterlacingEnabled (bool)
 Attempts to enable/disable deinterlacing using existing deinterlace method when enabling.
bool SetupDeinterlace (bool interlaced, const QString &ovrf="")
 Attempts to enable or disable deinterlacing.
bool ApproveDeintFilter (const QString &filtername) const
 Approves bobdeint filter for XVideo and otherwise defers to VideoOutput::ApproveDeintFilter(const QString&).
void ProcessFrame (VideoFrame *frame, OSD *osd, FilterChain *filterList, const PIPMap &pipPlayers, FrameScanType scan)
void PrepareFrame (VideoFrame *, FrameScanType, OSD *osd)
void Show (FrameScanType)
void ClearAfterSeek (void)
 Tells video output to toss decoded buffers due to a seek.
void WindowResized (const QSize &new_size)
void MoveResize (void)
 performs all the calculations for video framing and any resizing.
bool InputChanged (const QSize &input_size, float aspect, MythCodecID av_codec_id, void *codec_private, bool &aspect_only)
 Tells video output to discard decoded frames and wait for new ones.
void Zoom (ZoomDirection direction)
 Sets up zooming into to different parts of the video, the zoom is actually applied in MoveResize().
void VideoAspectRatioChanged (float aspect)
 Calls SetVideoAspectRatio(float aspect), then calls MoveResize() to apply changes.
void EmbedInWidget (const QRect &rect)
 Tells video output to embed video in an existing window.
void StopEmbedding (void)
 Tells video output to stop embedding video in an existing window.
void MoveResizeWindow (QRect new_rect)
void DrawUnusedRects (bool sync=true)
 Draws non-video portions of the screen.
virtual void UpdatePauseFrame (int64_t &default_tc)
 Updates frame displayed when video is paused.
int SetPictureAttribute (PictureAttribute attribute, int newValue)
 Sets a specified picture attribute.
void InitPictureAttributes (void)
virtual bool IsPIPSupported (void) const
virtual bool IsPBPSupported (void) const
virtual bool NeedExtraAudioDecode (void) const
virtual QRect GetPIPRect (PIPLocation location, MythPlayer *pipplayer=NULL, bool do_pixel_adj=true) const
 returns QRect of PIP based on PIPLocation
VOSType VideoOutputSubType () const
virtual MythPainterGetOSDPainter (void)

Static Public Member Functions

static void GetRenderOptions (render_opts &opts, QStringList &cpudeints)
static MythCodecID GetBestSupportedCodec (uint stream_type)
static int GrabSuitableXvPort (MythXDisplay *disp, Window root, MythCodecID type, uint width, uint height, bool &xvsetdefaults, QString *adaptor_name=NULL)
 Internal function used to grab a XVideo port with the desired properties.
static void UngrabXvPort (MythXDisplay *disp, int port)
 Internal function used to release an XVideo port.
static QStringList GetAllowedRenderers (MythCodecID myth_codec_id, const QSize &video_dim)

Private Member Functions

virtual bool hasFullScreenOSD (void) const
void DiscardFrame (VideoFrame *)
 Frame is ready to be reused by decoder added to the done or available list.
void DiscardFrames (bool next_frame_keyframe)
 Releases all frames not being actively displayed from any queue onto the queue of frames ready for decoding onto.
void PrepareFrameXv (VideoFrame *)
void PrepareFrameMem (VideoFrame *, FrameScanType)
void ShowXVideo (FrameScanType scan)
int SetXVPictureAttribute (PictureAttribute attribute, int newValue)
void InitColorKey (bool turnoffautopaint)
 Initializes color keying support used by XVideo output methods.
bool InitVideoBuffers (bool use_xv, bool use_shm)
 Creates and initializes video buffers.
bool InitXVideo (void)
 Creates and initializes video buffers.
bool InitXShm (void)
 Creates and initializes video buffers.
bool InitXlib (void)
 Creates and initializes video buffers.
bool InitOSD (void)
bool CreateBuffers (VOSType subtype)
vector< unsigned char * > CreateShmImages (uint num, bool use_xv)
 Creates Shared Memory Images.
void CreatePauseFrame (VOSType subtype)
 Creates an extra frame for pause.
void DeleteBuffers (VOSType subtype, bool delete_pause_frame)
bool InitSetupBuffers (void)

Private Attributes

VOSType video_output_subtype
QMutex global_lock
Window XJ_win
Window XJ_curwin
MythXDisplaydisp
unsigned long XJ_letterbox_colour
bool XJ_started
VideoFrame av_pause_frame
vector< XShmSegmentInfo * > XJ_shm_infos
vector< YUVInfoXJ_yuv_infos
XImage * XJ_non_xv_image
long long non_xv_frames_shown
int non_xv_show_frame
int non_xv_fps
PixelFormat non_xv_av_format
time_t non_xv_stop_time
int xv_port
int xv_hue_base
int xv_colorkey
bool xv_draw_colorkey
int xv_chroma
bool xv_set_defaults
buffer_map_t xv_buffers
bool xv_need_bobdeint_repaint
bool xv_use_picture_controls
QMap< PictureAttribute, int > xv_attribute_min
QMap< PictureAttribute, int > xv_attribute_max
QMap< PictureAttribute, int > xv_attribute_def
ChromaKeyOSDchroma_osd

Friends

class ChromaKeyOSD

Detailed Description

Supports common video output methods used with X11 Servers.

This class supports XVideo with color transform and scaling acceleration. When this is not available, we also try to use X Shared memory, and if that fails we try standard Xlib output.

See also:
VideoOutput, VideoBuffers

Definition at line 28 of file videoout_xv.h.


Constructor & Destructor Documentation

VideoOutputXv::VideoOutputXv (  ) 

Definition at line 136 of file videoout_xv.cpp.

VideoOutputXv::~VideoOutputXv (  ) 

Definition at line 161 of file videoout_xv.cpp.


Member Function Documentation

void VideoOutputXv::GetRenderOptions ( render_opts opts,
QStringList &  cpudeints 
) [static]

Definition at line 79 of file videoout_xv.cpp.

bool VideoOutputXv::Init ( int  width,
int  height,
float  aspect,
WId  winid,
const QRect &  win_rect,
MythCodecID  codec_id 
) [virtual]

Reimplemented from VideoOutput.

Definition at line 873 of file videoout_xv.cpp.

bool VideoOutputXv::SetDeinterlacingEnabled ( bool  enable  )  [virtual]

Attempts to enable/disable deinterlacing using existing deinterlace method when enabling.

Reimplemented from VideoOutput.

Definition at line 995 of file videoout_xv.cpp.

bool VideoOutputXv::SetupDeinterlace ( bool  i,
const QString &  ovrf = "" 
) [virtual]

Attempts to enable or disable deinterlacing.

Returns:
true if successful, false otherwise.
Parameters:
overridefilter optional, explicitly use this nondefault deint filter

Reimplemented from VideoOutput.

Definition at line 1002 of file videoout_xv.cpp.

bool VideoOutputXv::ApproveDeintFilter ( const QString &  filtername  )  const [virtual]

Approves bobdeint filter for XVideo and otherwise defers to VideoOutput::ApproveDeintFilter(const QString&).

Approves all deinterlace filters, except ones which must be supported by a specific video output class.

Returns:
whether current video output supports a specific filter.

Reimplemented from VideoOutput.

Definition at line 1017 of file videoout_xv.cpp.

void VideoOutputXv::ProcessFrame ( VideoFrame frame,
OSD osd,
FilterChain filterList,
const PIPMap pipPlayers,
FrameScanType  scan 
) [virtual]

Implements VideoOutput.

Definition at line 1783 of file videoout_xv.cpp.

void VideoOutputXv::PrepareFrame ( VideoFrame buffer,
FrameScanType  scan,
OSD osd 
) [virtual]

Implements VideoOutput.

Definition at line 1481 of file videoout_xv.cpp.

void VideoOutputXv::Show ( FrameScanType  scan  )  [virtual]

Implements VideoOutput.

Definition at line 1620 of file videoout_xv.cpp.

void VideoOutputXv::ClearAfterSeek ( void   )  [virtual]

Tells video output to toss decoded buffers due to a seek.

Reimplemented from VideoOutput.

Definition at line 1342 of file videoout_xv.cpp.

void VideoOutputXv::WindowResized ( const QSize &  new_size  )  [virtual]

Reimplemented from VideoOutput.

Definition at line 218 of file videoout_xv.cpp.

void VideoOutputXv::MoveResize ( void   )  [virtual]

performs all the calculations for video framing and any resizing.

First we apply playback over/underscanning and offsetting, then we letterbox settings, and finally we apply manual scale & move properties for "Zoom Mode".

See also:
Zoom(ZoomDirection), ToggleAdjustFill(int)

Reimplemented from VideoOutput.

Definition at line 210 of file videoout_xv.cpp.

Referenced by EmbedInWidget(), Init(), InputChanged(), StopEmbedding(), WindowResized(), and Zoom().

bool VideoOutputXv::InputChanged ( const QSize &  input_size,
float  aspect,
MythCodecID  myth_codec_id,
void *  codec_private,
bool aspect_only 
) [virtual]

Tells video output to discard decoded frames and wait for new ones.

Bug:
We set the new width height and aspect ratio here, but we should do this based on the new video frames in Show().

Reimplemented from VideoOutput.

Definition at line 240 of file videoout_xv.cpp.

void VideoOutputXv::Zoom ( ZoomDirection  direction  )  [virtual]

Sets up zooming into to different parts of the video, the zoom is actually applied in MoveResize().

See also:
ToggleAdjustFill(AdjustFillMode)

Reimplemented from VideoOutput.

Definition at line 202 of file videoout_xv.cpp.

void VideoOutputXv::VideoAspectRatioChanged ( float  aspect  )  [virtual]

Calls SetVideoAspectRatio(float aspect), then calls MoveResize() to apply changes.

Parameters:
aspect video aspect ratio to use

Reimplemented from VideoOutput.

Definition at line 1746 of file videoout_xv.cpp.

Referenced by InputChanged().

void VideoOutputXv::EmbedInWidget ( const QRect &  rect  )  [virtual]

Tells video output to embed video in an existing window.

See also:
StopEmbedding()

Reimplemented from VideoOutput.

Definition at line 1307 of file videoout_xv.cpp.

void VideoOutputXv::StopEmbedding ( void   )  [virtual]

Tells video output to stop embedding video in an existing window.

See also:
EmbedInWidget(const QRect&)

Reimplemented from VideoOutput.

Definition at line 1316 of file videoout_xv.cpp.

void VideoOutputXv::MoveResizeWindow ( QRect  new_rect  )  [virtual]

Implements VideoOutput.

Definition at line 310 of file videoout_xv.cpp.

void VideoOutputXv::DrawUnusedRects ( bool  sync = true  )  [virtual]

Draws non-video portions of the screen.

Parameters:
sync if set any queued up draws are sent immediately to the graphics context and we block until they have completed.

Implements VideoOutput.

Definition at line 1640 of file videoout_xv.cpp.

Referenced by Show().

void VideoOutputXv::UpdatePauseFrame ( int64_t disp_timecode  )  [virtual]

Updates frame displayed when video is paused.

Implements VideoOutput.

Definition at line 1752 of file videoout_xv.cpp.

int VideoOutputXv::SetPictureAttribute ( PictureAttribute  attribute,
int  newValue 
) [virtual]

Sets a specified picture attribute.

Parameters:
attribute Picture attribute to set.
newValue Value to set attribute to.
Returns:
Set value if it succeeds, -1 if it does not.

Reimplemented from VideoOutput.

Definition at line 1838 of file videoout_xv.cpp.

void VideoOutputXv::InitPictureAttributes ( void   )  [virtual]

Reimplemented from VideoOutput.

Definition at line 1881 of file videoout_xv.cpp.

Referenced by InitSetupBuffers().

virtual bool VideoOutputXv::IsPIPSupported ( void   )  const [inline, virtual]

Reimplemented from VideoOutput.

Definition at line 71 of file videoout_xv.h.

virtual bool VideoOutputXv::IsPBPSupported ( void   )  const [inline, virtual]

Reimplemented from VideoOutput.

Definition at line 73 of file videoout_xv.h.

virtual bool VideoOutputXv::NeedExtraAudioDecode ( void   )  const [inline, virtual]

Reimplemented from VideoOutput.

Definition at line 75 of file videoout_xv.h.

QRect VideoOutputXv::GetPIPRect ( PIPLocation  location,
MythPlayer pipplayer = NULL,
bool  do_pixel_adj = true 
) const [virtual]

returns QRect of PIP based on PIPLocation

Reimplemented from VideoOutput.

Definition at line 1923 of file videoout_xv.cpp.

MythCodecID VideoOutputXv::GetBestSupportedCodec ( uint  stream_type  )  [static]
Returns:
MythCodecID for the best supported codec on the main display.

Definition at line 754 of file videoout_xv.cpp.

int VideoOutputXv::GrabSuitableXvPort ( MythXDisplay disp,
Window  root,
MythCodecID  mcodecid,
uint  width,
uint  height,
bool xvsetdefaults,
QString *  adaptor_name = NULL 
) [static]

Internal function used to grab a XVideo port with the desired properties.

Returns:
port number if it succeeds, else -1.

Definition at line 357 of file videoout_xv.cpp.

Referenced by InitXVideo().

void VideoOutputXv::UngrabXvPort ( MythXDisplay disp,
int  port 
) [static]

Internal function used to release an XVideo port.

Definition at line 338 of file videoout_xv.cpp.

Referenced by InitXVideo(), InputChanged(), and ~VideoOutputXv().

QStringList VideoOutputXv::GetAllowedRenderers ( MythCodecID  myth_codec_id,
const QSize &  video_dim 
) [static]

Definition at line 2000 of file videoout_xv.cpp.

Referenced by VideoOutput::Create().

VOSType VideoOutputXv::VideoOutputSubType (  )  const [inline]
MythPainter * VideoOutputXv::GetOSDPainter ( void   )  [virtual]

Reimplemented from VideoOutput.

Definition at line 2018 of file videoout_xv.cpp.

virtual bool VideoOutputXv::hasFullScreenOSD ( void   )  const [inline, private, virtual]

Reimplemented from VideoOutput.

Definition at line 97 of file videoout_xv.h.

void VideoOutputXv::DiscardFrame ( VideoFrame frame  )  [private, virtual]

Frame is ready to be reused by decoder added to the done or available list.

Parameters:
frame to discard.

Reimplemented from VideoOutput.

Definition at line 1334 of file videoout_xv.cpp.

void VideoOutputXv::DiscardFrames ( bool  kf  )  [private, virtual]

Releases all frames not being actively displayed from any queue onto the queue of frames ready for decoding onto.

Reimplemented from VideoOutput.

Definition at line 1348 of file videoout_xv.cpp.

Referenced by ClearAfterSeek(), and DeleteBuffers().

void VideoOutputXv::PrepareFrameXv ( VideoFrame frame  )  [private]

Definition at line 1367 of file videoout_xv.cpp.

Referenced by PrepareFrame().

void VideoOutputXv::PrepareFrameMem ( VideoFrame buffer,
FrameScanType   
) [private]

Definition at line 1385 of file videoout_xv.cpp.

Referenced by PrepareFrame().

void VideoOutputXv::ShowXVideo ( FrameScanType  scan  )  [private]

Definition at line 1578 of file videoout_xv.cpp.

Referenced by Show().

int VideoOutputXv::SetXVPictureAttribute ( PictureAttribute  attribute,
int  newValue 
) [private]

Definition at line 1847 of file videoout_xv.cpp.

Referenced by InitPictureAttributes(), and SetPictureAttribute().

void VideoOutputXv::InitColorKey ( bool  turnoffautopaint  )  [private]

Initializes color keying support used by XVideo output methods.

Parameters:
turnoffautopaint turn off or on XV_AUTOPAINT_COLORKEY property.

Definition at line 926 of file videoout_xv.cpp.

Referenced by Init(), and InputChanged().

bool VideoOutputXv::InitVideoBuffers ( bool  use_xv,
bool  use_shm 
) [private]

Creates and initializes video buffers.

Side Effects:
sets video_output_subtype if it succeeds.
Returns:
success or failure at creating any buffers.

Definition at line 545 of file videoout_xv.cpp.

Referenced by InitSetupBuffers().

bool VideoOutputXv::InitXVideo ( void   )  [private]

Creates and initializes video buffers.

Side Effects:
sets video_output_subtype if it succeeds.
Returns:
success or failure at creating any buffers.

Definition at line 594 of file videoout_xv.cpp.

Referenced by InitVideoBuffers().

bool VideoOutputXv::InitXShm ( void   )  [private]

Creates and initializes video buffers.

Side Effects:
sets video_output_subtype if it succeeds.
Returns:
success or failure at creating any buffers.

Definition at line 691 of file videoout_xv.cpp.

Referenced by InitVideoBuffers().

bool VideoOutputXv::InitXlib ( void   )  [private]

Creates and initializes video buffers.

Side Effects:
sets video_output_subtype if it succeeds.
Returns:
success or failure at creating any buffers.

Definition at line 725 of file videoout_xv.cpp.

Referenced by InitVideoBuffers().

bool VideoOutputXv::InitOSD ( void   )  [private]

Definition at line 759 of file videoout_xv.cpp.

Referenced by Init(), and InputChanged().

bool VideoOutputXv::CreateBuffers ( VOSType  subtype  )  [private]

Definition at line 1168 of file videoout_xv.cpp.

Referenced by InitXlib(), InitXShm(), InitXVideo(), and InputChanged().

vector< unsigned char * > VideoOutputXv::CreateShmImages ( uint  num,
bool  use_xv 
) [private]

Creates Shared Memory Images.

Each XvImage/XImage created is added to xv_buffers, and shared memory info is added to XJ_shm_infos.

Parameters:
num number of buffers to create
use_xv use XvShmCreateImage instead of XShmCreateImage
Returns:
vector containing image data for each buffer created

Definition at line 1039 of file videoout_xv.cpp.

Referenced by CreateBuffers().

void VideoOutputXv::CreatePauseFrame ( VOSType  subtype  )  [private]

Creates an extra frame for pause.

This creates a pause frame by copies the scratch frame settings, a and allocating a databuffer, so a scratch must already exist.

Side Effects:
sets av_pause_frame.

Definition at line 519 of file videoout_xv.cpp.

Referenced by CreateBuffers().

void VideoOutputXv::DeleteBuffers ( VOSType  subtype,
bool  delete_pause_frame 
) [private]

Definition at line 1253 of file videoout_xv.cpp.

Referenced by InitXlib(), InitXShm(), InitXVideo(), InputChanged(), and ~VideoOutputXv().

bool VideoOutputXv::InitSetupBuffers ( void   )  [private]

Definition at line 810 of file videoout_xv.cpp.

Referenced by Init(), and InputChanged().


Friends And Related Function Documentation

friend class ChromaKeyOSD [friend]

Definition at line 30 of file videoout_xv.h.

Referenced by InitOSD().


Member Data Documentation

QMutex VideoOutputXv::global_lock [private]
Window VideoOutputXv::XJ_win [private]

Definition at line 129 of file videoout_xv.h.

Referenced by Init(), and MoveResizeWindow().

Window VideoOutputXv::XJ_curwin [private]
unsigned long VideoOutputXv::XJ_letterbox_colour [private]

Definition at line 132 of file videoout_xv.h.

Referenced by DrawUnusedRects(), Init(), InitColorKey(), InitOSD(), and ChromaKeyOSD::ProcessOSD().

Definition at line 133 of file videoout_xv.h.

Referenced by Init(), and ~VideoOutputXv().

vector<XShmSegmentInfo*> VideoOutputXv::XJ_shm_infos [private]

Definition at line 136 of file videoout_xv.h.

Referenced by CreateShmImages(), and DeleteBuffers().

Definition at line 137 of file videoout_xv.h.

Referenced by CreateBuffers(), CreateShmImages(), and DeleteBuffers().

XImage* VideoOutputXv::XJ_non_xv_image [private]

Definition at line 140 of file videoout_xv.h.

Referenced by CreateBuffers(), DeleteBuffers(), and PrepareFrameMem().

Definition at line 141 of file videoout_xv.h.

Referenced by PrepareFrameMem().

Definition at line 142 of file videoout_xv.h.

Referenced by PrepareFrameMem().

Definition at line 143 of file videoout_xv.h.

Referenced by PrepareFrameMem().

PixelFormat VideoOutputXv::non_xv_av_format [private]

Definition at line 144 of file videoout_xv.h.

Referenced by CreateBuffers(), and PrepareFrameMem().

Definition at line 145 of file videoout_xv.h.

Referenced by PrepareFrameMem().

int VideoOutputXv::xv_port [private]

Definition at line 149 of file videoout_xv.h.

Referenced by InitXVideo(), and SetXVPictureAttribute().

Definition at line 150 of file videoout_xv.h.

Referenced by DrawUnusedRects(), InitColorKey(), InitOSD(), and ChromaKeyOSD::ProcessOSD().

Definition at line 151 of file videoout_xv.h.

Referenced by DrawUnusedRects(), and InitColorKey().

int VideoOutputXv::xv_chroma [private]

Definition at line 152 of file videoout_xv.h.

Referenced by CreateShmImages(), and InitXVideo().

Definition at line 153 of file videoout_xv.h.

Referenced by InitPictureAttributes(), InitXVideo(), and SetXVPictureAttribute().

Definition at line 154 of file videoout_xv.h.

Referenced by CreateBuffers(), CreateShmImages(), DeleteBuffers(), and ShowXVideo().

Definition at line 155 of file videoout_xv.h.

Referenced by DrawUnusedRects(), SetDeinterlacingEnabled(), and Show().

Definition at line 156 of file videoout_xv.h.

Referenced by InitSetupBuffers(), and InitXVideo().

Definition at line 157 of file videoout_xv.h.

Referenced by InitPictureAttributes(), and SetXVPictureAttribute().

Definition at line 158 of file videoout_xv.h.

Referenced by InitPictureAttributes(), and SetXVPictureAttribute().

Definition at line 159 of file videoout_xv.h.

Referenced by InitPictureAttributes(), and SetXVPictureAttribute().


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends
Generated on Mon May 28 06:42:32 2012 for MythTV by  doxygen 1.6.3