MythTV  0.28pre
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Groups Pages
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
VideoOutputQuartz Class Reference

Implementation of Quartz (Mac OS X windowing system) video output. More...

#include <videoout_quartz.h>

Inheritance diagram for VideoOutputQuartz:
Inheritance graph
[legend]
Collaboration diagram for VideoOutputQuartz:
Collaboration graph
[legend]

Public Member Functions

 VideoOutputQuartz ()
 
 ~VideoOutputQuartz ()
 
bool Init (const QSize &video_dim_buf, const QSize &video_dim_disp, float aspect, WId winid, const QRect &win_rect, MythCodecID codec_id)
 Performs most of the initialization for VideoOutput. More...
 
void ProcessFrame (VideoFrame *frame, OSD *osd, FilterChain *filterList, const PIPMap &pipPlayers, FrameScanType scan)
 Draw OSD, apply filters and deinterlacing, copy frame buffer if using QuickTime to decode. More...
 
void PrepareFrame (VideoFrame *buffer, FrameScanType t, OSD *osd)
 Makes sure we have a valid frame to show. More...
 
void Show (FrameScanType)
 Display the frame. More...
 
void SetVideoFrameRate (float playback_fps)
 
void ToggleAspectOverride (AspectOverrideMode aspectMode)
 Enforce different aspect ration than detected, then calls VideoAspectRatioChanged(float) to apply them. More...
 
bool InputChanged (const QSize &video_dim_buf, const QSize &video_dim_disp, float aspect, MythCodecID av_codec_id, void *codec_private, bool &aspect_only)
 Tells video output to discard decoded frames and wait for new ones. More...
 
void VideoAspectRatioChanged (float aspect)
 Calls SetVideoAspectRatio(float aspect), then calls MoveResize() to apply changes. More...
 
void MoveResize (void)
 performs all the calculations for video framing and any resizing. More...
 
void Zoom (ZoomDirection direction)
 Sets up zooming into to different parts of the video, the zoom is actually applied in MoveResize(). More...
 
void ToggleAdjustFill (AdjustFillMode adjustFill)
 Sets up letterboxing for various standard video frame and monitor dimensions, then calls MoveResize() to apply them. More...
 
void EmbedInWidget (const QRect &rect)
 Tells video output to embed video in an existing window. More...
 
void StopEmbedding (void)
 Tells video output to stop embedding video in an existing window. More...
 
void MoveResizeWindow (QRect new_rect)
 
void DrawUnusedRects (bool sync=true)
 Draws non-video portions of the screen. More...
 
void UpdatePauseFrame (int64_t &disp_timecode)
 Updates frame displayed when video is paused. More...
 
void ResizeForGui (void)
 Subclassed so we can hide the QuickTime drawn layer and show the GUI. More...
 
void ResizeForVideo (uint width=0, uint height=0)
 Subclassed so we can redisplay the QuickTime layer after ResizeForGui() More...
 
virtual bool NeedExtraAudioDecode (void) const
 
- Public Member Functions inherited from VideoOutput
 VideoOutput ()
 This constructor for VideoOutput must be followed by an Init(int,int,float,WId,int,int,int,int,WId) call. More...
 
virtual ~VideoOutput ()
 Shuts down video output. More...
 
virtual void InitOSD (OSD *osd)
 
virtual bool IsPreferredRenderer (QSize video_size)
 
virtual bool SetDeinterlacingEnabled (bool)
 Attempts to enable/disable deinterlacing using existing deinterlace method when enabling. More...
 
virtual bool SetupDeinterlace (bool i, const QString &ovrf="")
 Attempts to enable or disable deinterlacing. More...
 
virtual void FallbackDeint (void)
 Fallback to non-frame-rate-doubling deinterlacing method. More...
 
virtual void BestDeint (void)
 Change to the best deinterlacing method. More...
 
virtual bool NeedsDoubleFramerate (void) const
 Should Prepare() and Show() be called twice for every ProcessFrame(). More...
 
virtual bool IsBobDeint (void) const
 
virtual bool IsExtraProcessingRequired (void) const
 Should Prepare() and Show() and ProcessFrame be called twice for every Frameloop(). More...
 
virtual bool ApproveDeintFilter (const QString &filtername) const
 Approves bobdeint filter for XVideo and otherwise defers to VideoOutput::ApproveDeintFilter(const QString&). More...
 
void GetDeinterlacers (QStringList &deinterlacers)
 
QString GetDeinterlacer (void)
 
virtual void WindowResized (const QSize &new_size)
 
virtual void ResizeDisplayWindow (const QRect &, bool)
 Resize Display Window. More...
 
virtual void GetOSDBounds (QRect &total, QRect &visible, float &visibleAspect, float &fontScale, float themeAspect) const
 
QRect GetMHEGBounds (void)
 
virtual void DrawSlice (VideoFrame *frame, int x, int y, int w, int h)
 Informs video output of new data for frame, used for hardware accelerated decoding. More...
 
virtual float GetDisplayAspect (void) const
 Returns current display aspect ratio. More...
 
AspectOverrideMode GetAspectOverride (void) const
 Returns current aspect override mode. More...
 
AdjustFillMode GetAdjustFill (void) const
 Returns current adjust fill mode. More...
 
QString GetZoomString (void) const
 
void CropToDisplay (VideoFrame *frame)
 
void ExposeEvent (void)
 Tells video output that a full repaint is needed. More...
 
PictureAttributeSupported GetSupportedPictureAttributes (void)
 
int ChangePictureAttribute (PictureAttribute, bool direction)
 
virtual int SetPictureAttribute (PictureAttribute, int newValue)
 Sets a specified picture attribute. More...
 
int GetPictureAttribute (PictureAttribute)
 
virtual void InitPictureAttributes (void)
 
bool AllowPreviewEPG (void) const
 
virtual bool IsPIPSupported (void) const
 
virtual bool IsPBPSupported (void) const
 
virtual bool hasHWAcceleration (void) const
 Return true if HW Acceleration is running. More...
 
virtual voidGetDecoderContext (unsigned char *buf, uint8_t *&id)
 
virtual void SetFramesPlayed (long long fp)
 Sets the number of frames played. More...
 
virtual long long GetFramesPlayed (void)
 Returns the number of frames played. More...
 
bool IsErrored () const
 Returns true if a fatal error has been encountered. More...
 
VideoErrorState GetError (void) const
 Returns error type. More...
 
void SetPrebuffering (bool normal)
 Sets whether to use a normal number of buffers or fewer buffers. More...
 
virtual void ClearAfterSeek (void)
 Tells video output to toss decoded buffers due to a seek. More...
 
virtual int ValidVideoFrames (void) const
 Returns number of frames that are fully decoded. More...
 
int FreeVideoFrames (void)
 Returns number of frames available for decoding onto. More...
 
bool EnoughFreeFrames (void)
 Returns true iff enough frames are available to decode onto. More...
 
bool EnoughDecodedFrames (void)
 Returns true iff there are plenty of decoded frames ready for display. More...
 
bool EnoughPrebufferedFrames (void)
 Returns true iff we have at least the minimum number of decoded frames ready for display. More...
 
bool IsEmbedding (void)
 Returns if videooutput is embedding. More...
 
virtual VideoFrameGetNextFreeFrame (void)
 Blocks until it is possible to return a frame for decoding onto. More...
 
virtual void ReleaseFrame (VideoFrame *frame)
 Releases a frame from the ready for decoding queue onto the queue of frames ready for display. More...
 
virtual void DeLimboFrame (VideoFrame *frame)
 Releases a frame for reuse if it is in limbo. More...
 
virtual void StartDisplayingFrame (void)
 Tell GetLastShownFrame() to return the next frame from the head of the queue of frames to display. More...
 
virtual void DoneDisplayingFrame (VideoFrame *frame)
 Releases frame returned from GetLastShownFrame() onto the queue of frames ready for decoding onto. More...
 
virtual void DiscardFrame (VideoFrame *frame)
 Releases frame from any queue onto the queue of frames ready for decoding onto. More...
 
virtual void DiscardFrames (bool kf)
 Releases all frames not being actively displayed from any queue onto the queue of frames ready for decoding onto. More...
 
virtual void ClearDummyFrame (VideoFrame *frame)
 Clears the frame to black. More...
 
virtual void CheckFrameStates (void)
 
virtual VideoFrameGetLastDecodedFrame (void)
 
virtual VideoFrameGetLastShownFrame (void)
 Returns frame from the head of the ready to be displayed queue, if StartDisplayingFrame has been called. More...
 
QString GetFrameStatus (void) const
 Returns string with status of each frame for debugging. More...
 
void SetVideoResize (const QRect &videoRect)
 Tells the player to resize the video frame (used for ITV) More...
 
void SetVideoScalingAllowed (bool change)
 Disable or enable underscan/overscan. More...
 
bool IsVideoScalingAllowed (void) const
 check if video underscan/overscan is allowed More...
 
virtual void SetVideoFlip (void)
 Tells the player to flip the video frames for proper display. More...
 
virtual QRect GetPIPRect (PIPLocation location, MythPlayer *pipplayer=NULL, bool do_pixel_adj=true) const
 returns QRect of PIP based on PIPLocation More...
 
virtual void RemovePIP (MythPlayer *pipplayer)
 
virtual void SetPIPState (PIPState setting)
 
virtual QString GetOSDRenderer (void) const
 \ brief return OSD renderer type for this videoOutput More...
 
virtual MythPainterGetOSDPainter (void)
 
virtual bool GetScreenShot (int width=0, int height=0, QString filename="")
 
QString GetFilters (void) const
 
QRect GetImageRect (const QRect &rect, QRect *display=NULL)
 translates caption/dvd button rectangle into 'screen' space More...
 
QRect GetSafeRect (void)
 Returns a QRect describing an area of the screen on which it is 'safe' to render the On Screen Display. More...
 
bool EnableVisualisation (AudioPlayer *audio, bool enable, const QString &name=QString(""))
 
virtual bool CanVisualise (AudioPlayer *audio, MythRender *render)
 
virtual bool SetupVisualisation (AudioPlayer *audio, MythRender *render, const QString &name)
 
VideoVisualGetVisualisation (void)
 
QString GetVisualiserName (void)
 
virtual QStringList GetVisualiserList (void)
 
void DestroyVisualisation (void)
 
virtual bool StereoscopicModesAllowed (void) const
 
void SetStereoscopicMode (StereoscopicMode mode)
 
StereoscopicMode GetStereoscopicMode (void) const
 

Static Public Member Functions

static void GetRenderOptions (render_opts &opts, QStringList &cpudeints)
 
static QStringList GetAllowedRenderers (MythCodecID myth_codec_id, const QSize &video_dim)
 
static MythCodecID GetBestSupportedCodec (uint width, uint height, uint osd_width, uint osd_height, uint stream_type, uint fourcc)
 
- Static Public Member Functions inherited from VideoOutput
static void GetRenderOptions (render_opts &opts)
 
static VideoOutputCreate (const QString &decoder, MythCodecID codec_id, void *codec_priv, PIPState pipState, const QSize &video_dim_buf, const QSize &video_dim_disp, float video_aspect, QWidget *parentwidget, const QRect &embed_rect, float video_prate, uint playerFlags)
 Depending on compile-time configure settings and run-time renderer settings, create a relevant VideoOutput subclass. More...
 
static int CalcHueBase (const QString &adaptor_name)
 

Private Member Functions

void Exit (void)
 
bool CreateQuartzBuffers (void)
 
void DeleteQuartzBuffers (void)
 

Private Attributes

bool Started
 
QuartzDatadata
 
VideoFrame pauseFrame
 

Additional Inherited Members

- Protected Member Functions inherited from VideoOutput
void InitBuffers (int numdecode, bool extra_for_pause, int need_free, int needprebuffer_normal, int needprebuffer_small, int keepprebuffer)
 
void InitDisplayMeasurements (uint width, uint height, bool resize)
 Init display measurements based on database settings and actual screen parameters. More...
 
virtual void ShowPIPs (VideoFrame *frame, const PIPMap &pipPlayers)
 
virtual void ShowPIP (VideoFrame *frame, MythPlayer *pipplayer, PIPLocation loc)
 Composites PiP image onto a video frame. More...
 
virtual bool DisplayOSD (VideoFrame *frame, OSD *osd)
 If the OSD has changed, this will convert the OSD buffer to the OSDSurface's color format. More...
 
QRect GetVisibleOSDBounds (float &, float &, float) const
 Returns visible portions of total OSD bounds. More...
 
QRect GetTotalOSDBounds (void) const
 Returns total OSD bounds. More...
 
virtual bool hasFullScreenOSD (void) const
 
void DoPipResize (int pipwidth, int pipheight)
 Sets up Picture in Picture image resampler. More...
 
void ShutdownPipResize (void)
 Shuts down Picture in Picture image resampler. More...
 
void ResizeVideo (VideoFrame *frame)
 
void DoVideoResize (const QSize &inDim, const QSize &outDim)
 Sets up Picture in Picture image resampler. More...
 
virtual void ShutdownVideoResize (void)
 
- Static Protected Member Functions inherited from VideoOutput
static void CopyFrame (VideoFrame *to, const VideoFrame *from)
 Copies frame data from one VideoFrame to another. More...
 
- Protected Attributes inherited from VideoOutput
VideoOutWindow window
 
QSize db_display_dim
 Screen dimensions in millimeters from DB. More...
 
VideoColourSpace videoColourSpace
 
AspectOverrideMode db_aspectoverride
 
AdjustFillMode db_adjustfill
 
LetterBoxColour db_letterbox_colour
 
QString db_deint_filtername
 
MythCodecID video_codec_id
 
VideoDisplayProfiledb_vdisp_profile
 
QSize pip_desired_display_size
 
QSize pip_display_size
 
QSize pip_video_size
 
unsigned char * pip_tmp_buf
 
unsigned char * pip_tmp_buf2
 
struct SwsContext * pip_scaling_context
 
VideoFrame pip_tmp_image
 
bool vsz_enabled
 
QRect vsz_desired_display_rect
 
QSize vsz_display_size
 
QSize vsz_video_size
 
unsigned char * vsz_tmp_buf
 
struct SwsContext * vsz_scale_context
 
bool m_deinterlacing
 
QString m_deintfiltername
 
FilterManagerm_deintFiltMan
 
FilterChainm_deintFilter
 
bool m_deinterlaceBeforeOSD
 
VideoBuffers vbuffers
 VideoBuffers instance used to track video output buffers. More...
 
VideoErrorState errorState
 
long long framesPlayed
 
DisplayResdisplay_res
 
QSize monitor_sz
 
QSize monitor_dim
 
MythYUVAPainterosd_painter
 
MythImageosd_image
 
VideoVisualm_visual
 
StereoscopicMode m_stereo
 

Detailed Description

Implementation of Quartz (Mac OS X windowing system) video output.

Definition at line 8 of file videoout_quartz.h.

Constructor & Destructor Documentation

VideoOutputQuartz::VideoOutputQuartz ( )

Definition at line 1109 of file videoout_quartz.cpp.

VideoOutputQuartz::~VideoOutputQuartz ( )

Definition at line 1115 of file videoout_quartz.cpp.

Member Function Documentation

void VideoOutputQuartz::GetRenderOptions ( render_opts opts,
QStringList &  cpudeints 
)
static

Definition at line 1088 of file videoout_quartz.cpp.

Referenced by VideoOutput::GetRenderOptions().

bool VideoOutputQuartz::Init ( const QSize &  video_dim_buf,
const QSize &  video_dim_disp,
float  aspect,
WId  winid,
const QRect &  win_rect,
MythCodecID  codec_id 
)
virtual

Performs most of the initialization for VideoOutput.

Returns
true if successful, false otherwise.

Reimplemented from VideoOutput.

Definition at line 1233 of file videoout_quartz.cpp.

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

Draw OSD, apply filters and deinterlacing, copy frame buffer if using QuickTime to decode.

Implements VideoOutput.

Definition at line 1678 of file videoout_quartz.cpp.

void VideoOutputQuartz::PrepareFrame ( VideoFrame buffer,
FrameScanType  t,
OSD osd 
)
virtual

Makes sure we have a valid frame to show.

Implements VideoOutput.

Definition at line 1627 of file videoout_quartz.cpp.

void VideoOutputQuartz::Show ( FrameScanType  t)
virtual

Display the frame.

See Also
VideoOutputQuartzView

Implements VideoOutput.

Definition at line 1641 of file videoout_quartz.cpp.

void VideoOutputQuartz::SetVideoFrameRate ( float  playback_fps)
virtual

Reimplemented from VideoOutput.

Definition at line 1417 of file videoout_quartz.cpp.

void VideoOutputQuartz::ToggleAspectOverride ( AspectOverrideMode  aspectOverrideMode)
virtual

Enforce different aspect ration than detected, then calls VideoAspectRatioChanged(float) to apply them.

See Also
Zoom(ZoomDirection), ToggleAdjustFill(AdjustFillMode)

Reimplemented from VideoOutput.

Definition at line 1173 of file videoout_quartz.cpp.

bool VideoOutputQuartz::InputChanged ( const QSize &  video_dim_buf,
const QSize &  video_dim_disp,
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 1179 of file videoout_quartz.cpp.

void VideoOutputQuartz::VideoAspectRatioChanged ( float  aspect)
virtual

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

Parameters
aspectvideo aspect ratio to use

Reimplemented from VideoOutput.

Definition at line 1126 of file videoout_quartz.cpp.

void VideoOutputQuartz::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 1158 of file videoout_quartz.cpp.

Referenced by Init(), InputChanged(), ToggleAspectOverride(), and Zoom().

void VideoOutputQuartz::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 1139 of file videoout_quartz.cpp.

void VideoOutputQuartz::ToggleAdjustFill ( AdjustFillMode  adjustFillMode)
virtual

Sets up letterboxing for various standard video frame and monitor dimensions, then calls MoveResize() to apply them.

See Also
Zoom(ZoomDirection), ToggleAspectOverride(AspectOverrideMode)

Reimplemented from VideoOutput.

Definition at line 1148 of file videoout_quartz.cpp.

void VideoOutputQuartz::EmbedInWidget ( const QRect &  rect)
virtual

Tells video output to embed video in an existing window.

See Also
StopEmbedding()

Reimplemented from VideoOutput.

Definition at line 1564 of file videoout_quartz.cpp.

void VideoOutputQuartz::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 1597 of file videoout_quartz.cpp.

void VideoOutputQuartz::MoveResizeWindow ( QRect  new_rect)
inlinevirtual

Implements VideoOutput.

Definition at line 43 of file videoout_quartz.h.

void VideoOutputQuartz::DrawUnusedRects ( bool  sync = true)
virtual

Draws non-video portions of the screen.

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

Implements VideoOutput.

Definition at line 1652 of file videoout_quartz.cpp.

void VideoOutputQuartz::UpdatePauseFrame ( int64_t &  disp_timecode)
virtual

Updates frame displayed when video is paused.

Implements VideoOutput.

Definition at line 1656 of file videoout_quartz.cpp.

void VideoOutputQuartz::ResizeForGui ( void  )
virtual

Subclassed so we can hide the QuickTime drawn layer and show the GUI.

Reimplemented from VideoOutput.

Definition at line 1730 of file videoout_quartz.cpp.

void VideoOutputQuartz::ResizeForVideo ( uint  width = 0,
uint  height = 0 
)
virtual

Subclassed so we can redisplay the QuickTime layer after ResizeForGui()

Reimplemented from VideoOutput.

Definition at line 1742 of file videoout_quartz.cpp.

QStringList VideoOutputQuartz::GetAllowedRenderers ( MythCodecID  myth_codec_id,
const QSize &  video_dim 
)
static

Definition at line 1756 of file videoout_quartz.cpp.

Referenced by VideoOutput::Create(), and CreateQuartzBuffers().

MythCodecID VideoOutputQuartz::GetBestSupportedCodec ( uint  width,
uint  height,
uint  osd_width,
uint  osd_height,
uint  stream_type,
uint  fourcc 
)
static

Definition at line 1771 of file videoout_quartz.cpp.

virtual bool VideoOutputQuartz::NeedExtraAudioDecode ( void  ) const
inlinevirtual

Reimplemented from VideoOutput.

Definition at line 58 of file videoout_quartz.h.

void VideoOutputQuartz::Exit ( void  )
private

Definition at line 1516 of file videoout_quartz.cpp.

Referenced by ~VideoOutputQuartz().

bool VideoOutputQuartz::CreateQuartzBuffers ( void  )
private

Definition at line 1435 of file videoout_quartz.cpp.

Referenced by Init(), and InputChanged().

void VideoOutputQuartz::DeleteQuartzBuffers ( void  )
private

Definition at line 1539 of file videoout_quartz.cpp.

Referenced by Exit(), and InputChanged().

Member Data Documentation

bool VideoOutputQuartz::Started
private

Definition at line 66 of file videoout_quartz.h.

Referenced by Exit(), and Init().

QuartzData* VideoOutputQuartz::data
private

Definition at line 67 of file videoout_quartz.h.

Referenced by ~VideoOutputQuartz().

VideoFrame VideoOutputQuartz::pauseFrame
private

The documentation for this class was generated from the following files: