MythTV  master
videoout_d3d.cpp
Go to the documentation of this file.
1 // -*- Mode: c++ -*-
2 
3 #include <map>
4 #include <iostream>
5 #include <algorithm>
6 
7 #include "libmyth/mythcontext.h"
9 
10 #include "fourcc.h"
11 #include "mmsystem.h"
12 #include "mythavutil.h"
13 #include "mythplayer.h"
14 #include "mythvideoprofile.h"
15 #include "osd.h"
16 #include "tv.h"
17 #include "videoout_d3d.h"
18 
19 extern "C" {
20 #include "libavutil/imgutils.h"
21 }
22 
23 #undef UNICODE
24 
25 const int kNumBuffers = 31;
26 const int kNeedFreeFrames = 1;
27 const int kPrebufferFramesNormal = 10;
28 const int kPrebufferFramesSmall = 4;
29 
30 #define LOC QString("VideoOutputD3D: ")
31 
33 {
34  Options.renderers->append("direct3d");
35  (*Options.safe_renderers)["dummy"].append("direct3d");
36  (*Options.safe_renderers)["nuppel"].append("direct3d");
37  if (Options.decoders->contains("ffmpeg"))
38  (*Options.safe_renderers)["ffmpeg"].append("direct3d");
39  Options.priorities->insert("direct3d", 70);
40 
41 #ifdef USING_DXVA2
42  if (opts.decoders->contains("dxva2"))
43  (*opts.safe_renderers)["dxva2"].append("direct3d");
44 #endif
45 }
46 
48  : MythVideoOutput(),
49 {
50  m_pauseFrame.m_buffer = nullptr;
51 }
52 
54 {
55  TearDown();
56 }
57 
59 {
60  QMutexLocker locker(&m_lock);
63  m_videoBuffers.DeleteBuffers();
65  {
66  delete [] m_pauseFrame.m_buffer;
67  m_pauseFrame.m_buffer = nullptr;
68  }
69 
70  if (m_osdPainter)
71  {
72  // Hack to ensure that the osd painter is not
73  // deleted while image load thread is still busy
74  // loading images with that painter
76  if (invalid_osd_painter)
77  delete invalid_osd_painter;
78  invalid_osd_painter = m_osdPainter;
79  m_osdPainter = nullptr;
80  }
81 
82  DeleteDecoder();
84 }
85 
87 {
88  QMutexLocker locker(&m_lock);
89  m_renderValid = false;
90  m_renderReset = false;
91 
92  while (!m_pips.empty())
93  {
94  delete *m_pips.begin();
95  m_pips.erase(m_pips.begin());
96  }
97  m_pipReady.clear();
98 
99  if (m_video)
100  {
101  delete m_video;
102  m_video = nullptr;
103  }
104 
105  if (m_render)
106  {
107  m_render->DecrRef();
108  m_render = nullptr;
109  }
110 }
111 
112 void VideoOutputD3D::WindowResized(const QSize &new_size)
113 {
114  // FIXME this now requires the context to be re-created
115  /*
116  QMutexLocker locker(&m_lock);
117  window.SetDisplayVisibleRect(QRect(QPoint(0, 0), new_size));
118  window.SetDisplayAspect(
119  ((float)new_size.width()) / new_size.height());
120 
121  MoveResize();
122  */
123 }
124 
125 bool VideoOutputD3D::InputChanged(const QSize &video_dim_buf,
126  const QSize &video_dim_disp,
127  float video_aspect,
128  MythCodecID av_codec_id,
129  bool &aspect_only,
130  MythMultiLocker*)
131 {
132  QMutexLocker locker(&m_lock);
133 
134  QSize cursize = m_window.GetVideoDim();
135 
136  LOG(VB_PLAYBACK, LOG_INFO, LOC +
137  QString("InputChanged from %1: %2x%3 aspect %4 to %5: %6x%7 aspect %9")
138  .arg(toString(m_videoCodecID)).arg(cursize.width())
139  .arg(cursize.height()).arg(m_window.GetVideoAspect())
140  .arg(toString(av_codec_id)).arg(video_dim_disp.width())
141  .arg(video_dim_disp.height()).arg(video_aspect));
142 
143 
144  bool cid_changed = (m_videoCodecID != av_codec_id);
145  bool res_changed = video_dim_disp != cursize;
146  bool asp_changed = video_aspect != m_window.GetVideoAspect();
147 
148  if (!res_changed && !cid_changed)
149  {
150  if (asp_changed)
151  {
152  aspect_only = true;
153  VideoAspectRatioChanged(video_aspect);
154  MoveResize();
155  }
156  return true;
157  }
158 
159  TearDown();
160  QRect disp = m_window.GetDisplayVisibleRect();
161  if (Init(video_dim_buf, video_dim_disp,
162  video_aspect, (WId)m_hWnd, disp, av_codec_id))
163  {
164  return true;
165  }
166 
167  LOG(VB_GENERAL, LOG_ERR, LOC + "Failed to re-initialise video output.");
169 
170  return false;
171 }
172 
174 {
175  QMutexLocker locker(&m_lock);
176  DestroyContext();
177  QSize size = m_window.GetVideoDim();
178  m_render = new MythRenderD3D9();
179  if (!(m_render && m_render->Create(m_window.GetDisplayVisibleRect().size(),
180  m_hWnd)))
181  return false;
182 
183  m_video = new D3D9Image(m_render, size, true);
184  if (!(m_video && m_video->IsValid()))
185  return false;
186 
187  LOG(VB_PLAYBACK, LOG_INFO, LOC +
188  "Direct3D device successfully initialized.");
189  m_renderValid = true;
190  return true;
191 }
192 
193 bool VideoOutputD3D::Init(const QSize &video_dim_buf,
194  const QSize &video_dim_disp,
195  float video_aspect, WId winid,
196  const QRect &win_rect,MythCodecID codec_id)
197 {
198  MythPainter *painter = GetMythPainter();
199  if (painter)
200  painter->FreeResources();
201 
202  QMutexLocker locker(&m_lock);
203  m_hWnd = (HWND)winid;
204 
205  MythVideoOutput::Init(video_dim_buf, video_dim_disp,
206  video_aspect, winid, win_rect, codec_id);
207 
208  LOG(VB_PLAYBACK, LOG_INFO, LOC + QString("Init with codec: %1")
209  .arg(toString(codec_id)));
210  SetProfile();
211 
212  bool success = true;
213  success &= SetupContext();
214  InitDisplayMeasurements(video_dim_disp.width(), video_dim_disp.height(),
215  false);
216 
218  {
219  if (!CreateDecoder())
220  return false;
221  }
222 
223  success &= CreateBuffers();
224  success &= InitBuffers();
225  success &= CreatePauseFrame();
226 
227  MoveResize();
228 
229  if (!success)
230  TearDown();
231  else
232  {
234  if (m_osdPainter)
235  {
237  LOG(VB_PLAYBACK, LOG_INFO, LOC + "Created D3D9 osd painter.");
238  }
239  else
240  LOG(VB_GENERAL, LOG_ERR, LOC +
241  "Failed to create D3D9 osd painter.");
242  }
243  return success;
244 }
245 
247 {
248  if (m_videoProfile)
249  m_videoProfile->SetVideoRenderer("direct3d");
250 }
251 
253 {
255  {
257  LOG(VB_PLAYBACK, LOG_INFO, LOC + QString("Created %1 empty DXVA2 buffers.")
259  return true;
260  }
261 
264  return true;
265 
266 }
267 
269 {
270 #ifdef USING_DXVA2
271  if ((codec_is_dxva2(video_codec_id)) && m_decoder)
272  {
273  QMutexLocker locker(&m_lock);
274  const QSize video_dim = window.GetVideoDim();
275  bool ok = true;
276  for (int i = 0; i < NUM_DXVA2_BUFS; i++)
277  {
278  ok &= vbuffers.CreateBuffer(video_dim.width(),
279  video_dim.height(), i,
281  }
282  if (ok)
283  LOG(VB_PLAYBACK, LOG_INFO, LOC + "Initialised DXVA2 buffers.");
284  return ok;
285  }
286 #endif
288  m_window.GetVideoDim().width(),
289  m_window.GetVideoDim().height());
290 }
291 
293 {
295  return true;
296 
297  init(&m_pauseFrame, FMT_YV12,
298  new unsigned char[m_videoBuffers.GetScratchFrame()->m_bufferSize + 128],
299  m_videoBuffers.GetScratchFrame()->m_width,
300  m_videoBuffers.GetScratchFrame()->m_height,
301  m_videoBuffers.GetScratchFrame()->m_bufferSize);
302 
303  m_pauseFrame.m_frameNumber = m_videoBuffers.GetScratchFrame()->m_frameNumber;
304  return true;
305 }
306 
308 {
309  (void)osd;
310  if (IsErrored())
311  {
312  LOG(VB_GENERAL, LOG_ERR, LOC +
313  "RenderFrame() called while IsErrored is true.");
314  return;
315  }
316 
317  if (!buffer && codec_is_std(m_videoCodecID))
318  buffer = m_videoBuffers.GetScratchFrame();
319 
320  bool dummy = false;
321  if (buffer)
322  {
323  dummy = buffer->m_dummy;
324  m_framesPlayed = buffer->m_frameNumber + 1;
325  }
326 
327  if (!m_render || !m_video)
328  return;
329 
331  if (m_renderValid)
332  {
333  QRect dvr = m_window.GetITVResizing() ? m_window.GetITVDisplayRect() :
334  m_window.GetDisplayVideoRect();
335  bool ok = m_render->ClearBuffer();
336  if (ok && !dummy)
337  ok = m_video->UpdateVertices(dvr, m_window.GetVideoRect(),
338  255, true);
339 
340  if (ok)
341  {
342  ok = m_render->Begin();
343  if (ok)
344  {
345  if (!dummy)
346  m_video->Draw();
347  QMap<MythPlayer*,D3D9Image*>::iterator it = m_pips.begin();
348  for (; it != m_pips.end(); ++it)
349  {
350  if (m_pipReady[it.key()])
351  {
352  if (m_pipActive == *it)
353  {
354  QRect rect = (*it)->GetRect();
355  if (!rect.isNull())
356  {
357  rect.adjust(-10, -10, 10, 10);
358  m_render->DrawRect(rect, QColor(128,0,0,255), 255);
359  }
360  }
361  (*it)->Draw();
362  }
363  }
364 
365  if (m_visual)
366  m_visual->Draw(GetTotalOSDBounds(), m_osdPainter, nullptr);
367 
368  if (osd && m_osdPainter && !m_window.IsEmbedding())
369  osd->Draw(m_osdPainter, GetTotalOSDBounds().size(),
370  true);
371  m_render->End();
372  }
373  }
374 
375  }
376 }
377 
379 {
380  if (IsErrored())
381  {
382  LOG(VB_GENERAL, LOG_ERR, LOC +
383  "Show() called while IsErrored is true.");
384  return;
385  }
386 
387  if (!m_render)
388  return;
389 
391  if (m_renderValid)
392  m_render->Present(m_window.IsEmbedding() ? m_hEmbedWnd : nullptr);
393 }
394 
395 void VideoOutputD3D::EmbedInWidget(const QRect &rect)
396 {
397  if (m_window.IsEmbedding())
398  return;
399 
400  MythVideoOutput::EmbedInWidget(rect);
401  // TODO: Initialise m_hEmbedWnd?
402 }
403 
405 {
406  if (!m_window.IsEmbedding())
407  return;
408 
409  MythVideoOutput::StopEmbedding();
410 }
411 
412 void VideoOutputD3D::UpdatePauseFrame(std::chrono::milliseconds &disp_timecode, FrameScanType)
413 {
414  QMutexLocker locker(&m_lock);
416 
418  {
419  if (!used_frame)
420  used_frame = m_videoBuffers.GetScratchFrame();
421  CopyFrame(&m_pauseFrame, used_frame);
422  disp_timecode = m_pauseFrame.m_displayTimecode;
423  }
424  else if (codec_is_dxva2(m_videoCodecID))
425  {
426  if (used_frame)
427  {
428  m_pauseSurface = used_frame->m_buffer;
429  disp_timecode = used_frame->m_displayTimecode;
430  }
431  else
432  LOG(VB_PLAYBACK, LOG_WARNING, LOC + "Failed to update pause frame");
433  }
434 }
435 
437 {
439  return;
440 
441  // TODO - add a size check
442  bool hardware_conv = false;
443  uint pitch = 0;
444  uint8_t *buf = img->GetBuffer(hardware_conv, pitch);
445  if (buf && hardware_conv)
446  {
447  copybuffer(buf, frame, pitch);
448  }
449  else if (buf && !hardware_conv)
450  {
451  AVFrame image_out;
452  av_image_fill_arrays(image_out.data, image_out.linesize,
453  (uint8_t*)buf,
454  AV_PIX_FMT_RGB32, frame->m_width, frame->m_height, IMAGE_ALIGN);
455  image_out.linesize[0] = pitch;
456  m_copyFrame.Copy(&image_out, frame,(uint8_t*)buf, AV_PIX_FMT_RGB32);
457  }
458  img->ReleaseBuffer();
459 }
460 
461 void VideoOutputD3D::PrepareFrame(MythVideoFrame *frame, const PIPMap &pipPlayers,
463 {
464  if (!m_render || !m_video)
465  return;
466 
467  QMutexLocker locker(&m_lock);
468  if (IsErrored())
469  {
470  LOG(VB_GENERAL, LOG_ERR, LOC +
471  "ProcessFrame() called while IsErrored is true.");
472  return;
473  }
474 
475  bool gpu = codec_is_dxva2(m_videoCodecID);
476 
477  if (gpu && frame && frame->m_type != FMT_DXVA2)
478  {
479  LOG(VB_GENERAL, LOG_ERR, LOC + "Wrong frame format");
480  return;
481  }
482 
483  bool dummy = false;
484  bool pauseframe = false;
485  if (!frame)
486  {
487  if (!gpu)
488  {
489  frame = m_videoBuffers.GetScratchFrame();
490  CopyFrame(m_videoBuffers.GetScratchFrame(), &m_pauseFrame);
491  }
492  pauseframe = true;
493  }
494 
495  if (frame)
496  dummy = frame->m_dummy;
497 
498  if (!m_window.IsEmbedding())
499  ShowPIPs(pipPlayers);
500 
501  // Test the device
503  if (m_renderReset)
504  SetupContext();
505 
506  // Update a software decoded frame
507  if (m_renderValid && !gpu && !dummy)
508  UpdateFrame(frame, m_video);
509 
510  // Update a GPU decoded frame
511  if (m_renderValid && gpu && !dummy)
512  {
514  if (m_renderReset)
515  CreateDecoder();
516 
517  if (m_renderValid && frame)
518  {
520  }
521  else if (m_renderValid && pauseframe)
522  {
524  }
525  }
526 }
527 
528 void VideoOutputD3D::ShowPIP(MythPlayer *pipplayer, PIPLocation loc)
529 {
530  if (!pipplayer)
531  return;
532 
533  int pipw, piph;
534  MythVideoFrame *pipimage = pipplayer->GetCurrentFrame(pipw, piph);
535  const float pipVideoAspect = pipplayer->GetVideoAspect();
536  const QSize pipVideoDim = pipplayer->GetVideoBufferSize();
537  const bool pipActive = pipplayer->IsPIPActive();
538  const bool pipVisible = pipplayer->IsPIPVisible();
539  const uint pipVideoWidth = pipVideoDim.width();
540  const uint pipVideoHeight = pipVideoDim.height();
541 
542  if ((pipVideoAspect <= 0) || !pipimage ||
543  !pipimage->m_buffer || (pipimage->m_type != FMT_YV12) || !pipVisible)
544  {
545  pipplayer->ReleaseCurrentFrame(pipimage);
546  return;
547  }
548 
549  QRect position = GetPIPRect(loc, pipplayer);
550 
551  m_pipReady[pipplayer] = false;
552  D3D9Image *m_pip = m_pips[pipplayer];
553  if (!m_pip)
554  {
555  LOG(VB_PLAYBACK, LOG_INFO, LOC + "Initialise PiP.");
556  m_pip = new D3D9Image(m_render, QSize(pipVideoWidth, pipVideoHeight),
557  true);
558  m_pips[pipplayer] = m_pip;
559  if (!m_pip->IsValid())
560  {
561  pipplayer->ReleaseCurrentFrame(pipimage);
562  return;
563  }
564  }
565 
566  QSize current = m_pip->GetSize();
567  if ((uint)current.width() != pipVideoWidth ||
568  (uint)current.height() != pipVideoHeight)
569  {
570  LOG(VB_PLAYBACK, LOG_INFO, LOC + "Re-initialise PiP.");
571  delete m_pip;
572  m_pip = new D3D9Image(m_render, QSize(pipVideoWidth, pipVideoHeight),
573  true);
574  m_pips[pipplayer] = m_pip;
575  if (!m_pip->IsValid())
576  {
577  pipplayer->ReleaseCurrentFrame(pipimage);
578  return;
579  }
580  }
581  m_pip->UpdateVertices(position, QRect(0, 0, pipVideoWidth, pipVideoHeight),
582  255, true);
583  UpdateFrame(pipimage, m_pip);
584  m_pipReady[pipplayer] = true;
585  if (pipActive)
586  m_pipActive = m_pip;
587 
588  pipplayer->ReleaseCurrentFrame(pipimage);
589 }
590 
592 {
593  if (!m_pips.contains(pipplayer))
594  return;
595 
596  QMutexLocker locker(&m_lock);
597 
598  D3D9Image *m_pip = m_pips[pipplayer];
599  if (m_pip)
600  delete m_pip;
601  m_pipReady.remove(pipplayer);
602  m_pips.remove(pipplayer);
603 }
604 
606  MythCodecID myth_codec_id, const QSize &video_dim)
607 {
608  QStringList list;
609  if (codec_is_std(myth_codec_id) || (codec_is_dxva2_hw(myth_codec_id) &&
610  !getenv("NO_DXVA2")))
611  {
612  list += "direct3d";
613  }
614  return list;
615 }
616 
618 {
619  return m_osdPainter;
620 }
621 
623  uint width, uint height, const QString &decoder,
624  uint stream_type, bool no_acceleration,
625  AVPixelFormat &pix_fmt)
626 {
627 #ifdef USING_DXVA2
628  QSize size(width, height);
629  bool use_cpu = no_acceleration;
630  MythCodecID test_cid = (MythCodecID)(kCodec_MPEG1_DXVA2 + (stream_type - 1));
631  use_cpu |= !codec_is_dxva2_hw(test_cid);
632  pix_fmt = AV_PIX_FMT_DXVA2_VLD;
633  if ((decoder == "dxva2") && !getenv("NO_DXVA2") && !use_cpu)
634  return test_cid;
635 #endif
636  return (MythCodecID)(kCodec_MPEG1 + (stream_type - 1));
637 }
638 
640 {
641 #ifdef USING_DXVA2
642  QMutexLocker locker(&m_lock);
643  if (m_decoder)
644  DeleteDecoder();
645  QSize video_dim = window.GetVideoDim();
646  m_decoder = new DXVA2Decoder(NUM_DXVA2_BUFS, video_codec_id,
647  video_dim.width(), video_dim.height());
648  return (m_decoder && m_decoder->Init(m_render));
649 #else
650  return false;
651 #endif
652 }
653 
655 {
656 #ifdef USING_DXVA2
657  QMutexLocker locker(&m_lock);
658  delete m_decoder;
659  m_decoder = nullptr;
660 #endif
661 }
662 
663 /* vim: set expandtab tabstop=4 shiftwidth=4: */
VideoOutputD3D::CreateDecoder
bool CreateDecoder(void)
Definition: videoout_d3d.cpp:639
VideoOutputD3D::InitBuffers
bool InitBuffers(void)
Definition: videoout_d3d.cpp:268
MythDate::toString
QString toString(const QDateTime &raw_dt, uint format)
Returns formatted string representing the time.
Definition: mythdate.cpp:84
tv.h
DXVA2Decoder::Init
bool Init(MythRenderD3D9 *render)
Definition: dxva2decoder.cpp:149
VideoOutputD3D::PrepareFrame
void PrepareFrame(MythVideoFrame *frame, const PIPMap &pipPlayers, FrameScanType scan) override
Definition: videoout_d3d.cpp:461
MythVideoOutput
Definition: mythvideoout.h:35
D3D9Image::UpdateVertices
bool UpdateVertices(const QRect &dvr, const QRect &vr, int alpha=255, bool video=false)
Definition: mythrender_d3d9.cpp:87
videoout_d3d.h
VideoOutputD3D::WindowResized
void WindowResized(const QSize &new_size) override
Definition: videoout_d3d.cpp:112
MythVideoBounds::VideoAspectRatioChanged
void VideoAspectRatioChanged(float Aspect)
Calls SetVideoAspectRatio(float aspect), then calls MoveResize() to apply changes.
Definition: mythvideobounds.cpp:513
VideoBuffers::Head
MythVideoFrame * Head(BufferType Type)
Definition: videobuffers.cpp:648
ReferenceCounter::DecrRef
virtual int DecrRef(void)
Decrements reference count and deletes on 0.
Definition: referencecounter.cpp:125
VideoOutputD3D::GetRenderOptions
static void GetRenderOptions(RenderOptions &Options)
Definition: videoout_d3d.cpp:32
RenderOptions::renderers
QStringList * renderers
Definition: mythvideoprofile.h:47
kPrebufferFramesNormal
const int kPrebufferFramesNormal
Definition: videoout_d3d.cpp:27
VideoOutputD3D::m_hWnd
HWND m_hWnd
Definition: videoout_d3d.h:74
MythVideoOutput::m_framesPlayed
long long m_framesPlayed
Definition: mythvideoout.h:103
MythVideoOutput::m_errorState
VideoErrorState m_errorState
Definition: mythvideoout.h:102
VideoOutputD3D::GetOSDPainter
MythPainter * GetOSDPainter(void) override
Definition: videoout_d3d.cpp:617
VideoOutputD3D::VideoOutputD3D
VideoOutputD3D()
Definition: videoout_d3d.cpp:47
VideoOutputD3D::Init
bool Init(const QSize &video_dim_buf, const QSize &video_dim_disp, float video_aspect, WId winid, const QRect &win_rect, MythCodecID codec_id) override
Definition: videoout_d3d.cpp:193
VideoOutputD3D::m_osdPainter
MythD3D9Painter * m_osdPainter
Definition: videoout_d3d.h:85
FrameScanType
FrameScanType
Definition: videoouttypes.h:94
osd.h
MythVideoFrame::m_width
int m_width
Definition: mythframe.h:121
VideoOutputD3D::m_hEmbedWnd
HWND m_hEmbedWnd
Definition: videoout_d3d.h:75
LOG
#define LOG(_MASK_, _LEVEL_, _QSTRING_)
Definition: mythlogging.h:39
VideoOutputD3D::TearDown
void TearDown(void)
Definition: videoout_d3d.cpp:58
mythplayer.h
MythPlayer
Definition: mythplayer.h:84
VideoOutputD3D::CreatePauseFrame
bool CreatePauseFrame(void)
Definition: videoout_d3d.cpp:292
MythRenderD3D9::Create
bool Create(QSize size, HWND window)
Definition: mythrender_d3d9.cpp:219
VideoOutputD3D::UpdatePauseFrame
void UpdatePauseFrame(std::chrono::milliseconds &disp_timecode, FrameScanType Scan=kScan_Progressive) override
Definition: videoout_d3d.cpp:412
MythVideoFrame::m_displayTimecode
std::chrono::milliseconds m_displayTimecode
Definition: mythframe.h:132
VideoOutputD3D::m_render
MythRenderD3D9 * m_render
Definition: videoout_d3d.h:76
hardwareprofile.scan.scan
def scan(profile, smoonURL, gate)
Definition: scan.py:57
MythDate::current
QDateTime current(bool stripped)
Returns current Date and Time in UTC.
Definition: mythdate.cpp:14
VideoOutputD3D::EndFrame
void EndFrame() override
Definition: videoout_d3d.cpp:378
VideoBuffers::CreateBuffers
bool CreateBuffers(VideoFrameType Type, const VideoFrameTypes *RenderFormats, QSize Size, uint NeedFree, uint NeedprebufferNormal, uint NeedPrebufferSmall, int MaxReferenceFrames=16)
Definition: videobuffers.cpp:941
kError_Unknown
@ kError_Unknown
Definition: videoouttypes.h:185
kNeedFreeFrames
const int kNeedFreeFrames
Definition: videoout_d3d.cpp:26
MythVideoFrame::m_dummy
bool m_dummy
Definition: mythframe.h:140
MythRenderD3D9::End
bool End(void)
Definition: mythrender_d3d9.cpp:453
VideoOutputD3D::m_pauseFrame
MythVideoFrame m_pauseFrame
Definition: videoout_d3d.h:68
MythVideoOutput::m_copyFrame
MythAVCopy m_copyFrame
Definition: mythvideoout.h:104
MythCodecID
MythCodecID
Definition: mythcodecid.h:10
MythRenderD3D9::ClearBuffer
bool ClearBuffer(void)
Definition: mythrender_d3d9.cpp:420
AVFrame
struct AVFrame AVFrame
Definition: BorderDetector.h:15
kCodec_MPEG1_DXVA2
@ kCodec_MPEG1_DXVA2
Definition: mythcodecid.h:101
MythD3D9Painter::Teardown
void Teardown(void) override
Definition: mythpainter_d3d9.cpp:46
RenderOptions::decoders
QStringList * decoders
Definition: mythvideoprofile.h:51
MythVideoOutput::Init
virtual bool Init(QSize VideoDim, QSize VideoDispDim, float VideoAspect, QRect WindowRect, MythCodecID CodecID)
Definition: mythvideoout.cpp:110
codec_is_dxva2_hw
static bool codec_is_dxva2_hw(MythCodecID id)
Definition: mythcodecid.h:328
RenderOptions
Definition: mythvideoprofile.h:45
codec_is_dxva2
static bool codec_is_dxva2(MythCodecID id)
Definition: mythcodecid.h:325
DXVA2Decoder
Definition: dxva2decoder.h:15
MythPlayer::GetVideoBufferSize
QSize GetVideoBufferSize(void) const
Definition: mythplayer.h:132
FMT_YV12
@ FMT_YV12
Definition: mythframe.h:24
hardwareprofile.i18n.t
t
Definition: i18n.py:36
VideoOutputD3D::GetBestSupportedCodec
static MythCodecID GetBestSupportedCodec(uint width, uint height, const QString &decoder, uint stream_type, bool no_acceleration, AVPixelFormat &pix_fmt)
Definition: videoout_d3d.cpp:622
VideoOutputD3D::SetupContext
bool SetupContext(void)
Definition: videoout_d3d.cpp:173
D3D9Image::GetBuffer
uint8_t * GetBuffer(bool &hardware_conv, uint &pitch)
Definition: mythrender_d3d9.cpp:102
kCodec_MPEG1
@ kCodec_MPEG1
Definition: mythcodecid.h:21
D3D9Image
Definition: mythrender_d3d9.h:21
VideoOutputD3D::m_pipActive
D3D9Image * m_pipActive
Definition: videoout_d3d.h:83
MythVideoOutput::m_videoProfile
MythVideoProfilePtr m_videoProfile
Definition: mythvideoout.h:100
VideoOutputD3D::DestroyContext
void DestroyContext(void)
Definition: videoout_d3d.cpp:86
VideoOutputD3D::m_lock
QRecursiveMutex m_lock
Definition: videoout_d3d.h:72
OSD::Draw
void Draw()
Definition: osd.cpp:455
MythRenderD3D9::DrawRect
void DrawRect(const QRect &rect, const QColor &color, int alpha)
Definition: mythrender_d3d9.cpp:544
MythD3D9Painter::SetSwapControl
void SetSwapControl(bool swap)
Definition: mythpainter_d3d9.h:21
MythRenderD3D9
Definition: mythrender_d3d9.h:87
MythVideoFrame::m_frameNumber
long long m_frameNumber
Definition: mythframe.h:129
RenderOptions::safe_renderers
QMap< QString, QStringList > * safe_renderers
Definition: mythvideoprofile.h:48
VideoOutputD3D::CreateBuffers
bool CreateBuffers(void)
Definition: videoout_d3d.cpp:252
MythRenderD3D9::Present
bool Present(HWND win)
Definition: mythrender_d3d9.cpp:662
VideoOutputD3D::m_pauseSurface
void * m_pauseSurface
Definition: videoout_d3d.h:92
VideoBuffers::Reset
void Reset(void)
Definition: videobuffers.cpp:265
mythvideoprofile.h
MythVideoOutput::m_videoCodecID
MythCodecID m_videoCodecID
Definition: mythvideoout.h:98
VideoOutputD3D::RemovePIP
void RemovePIP(MythPlayer *pipplayer) override
Definition: videoout_d3d.cpp:591
uint
unsigned int uint
Definition: compat.h:81
MythPainter::FreeResources
virtual void FreeResources(void)
Definition: mythpainter.h:53
D3D9Image::IsValid
bool IsValid(void) const
Definition: mythrender_d3d9.h:27
VideoOutputD3D::ShowPIP
void ShowPIP(MythPlayer *pipplayer, PIPLocation loc) override
Definition: videoout_d3d.cpp:528
VideoOutputD3D::InputChanged
bool InputChanged(const QSize &video_dim_buf, const QSize &video_dim_disp, float video_aspect, MythCodecID av_codec_id, bool &aspect_only, MythMultiLocker *Locks) override
Definition: videoout_d3d.cpp:125
kPrebufferFramesSmall
const int kPrebufferFramesSmall
Definition: videoout_d3d.cpp:28
kNumBuffers
const int kNumBuffers
Definition: videoout_d3d.cpp:25
MythRenderD3D9::CopyFrame
void CopyFrame(void *surface, D3D9Image *img)
Definition: mythrender_d3d9.cpp:469
MythVideoOutput::IsErrored
bool IsErrored() const
Definition: mythvideoout.cpp:255
D3D9Image::GetSize
QSize GetSize(void) const
Definition: mythrender_d3d9.h:28
VideoOutputD3D::m_pips
QMap< MythPlayer *, D3D9Image * > m_pips
Definition: videoout_d3d.h:81
MythRenderD3D9::Begin
bool Begin(void)
Definition: mythrender_d3d9.cpp:437
VideoOutputD3D::m_decoder
DXVA2Decoder * m_decoder
Definition: videoout_d3d.h:90
MythVideoBounds::MoveResize
void MoveResize(void)
performs all the calculations for video framing and any resizing.
Definition: mythvideobounds.cpp:137
LOC
#define LOC
Definition: videoout_d3d.cpp:30
D3D9Image::Draw
bool Draw(void)
Definition: mythrender_d3d9.cpp:95
kVideoBuffer_used
@ kVideoBuffer_used
Definition: videobuffers.h:34
MythVideoFrame::m_type
VideoFrameType m_type
Definition: mythframe.h:119
MythPainter
Definition: mythpainter.h:34
MythD3D9Painter
Definition: mythpainter_d3d9.h:13
VideoOutputD3D::DeleteDecoder
void DeleteDecoder(void)
Definition: videoout_d3d.cpp:654
MythRenderD3D9::Test
bool Test(bool &reset)
Definition: mythrender_d3d9.cpp:377
FMT_DXVA2
@ FMT_DXVA2
Definition: mythframe.h:59
VideoOutputD3D::EmbedInWidget
void EmbedInWidget(const QRect &rect) override
Definition: videoout_d3d.cpp:395
VideoOutputD3D::RenderFrame
void RenderFrame(MythVideoFrame *buffer, FrameScanType, OSD *osd) override
Definition: videoout_d3d.cpp:307
mythavutil.h
MythPlayer::GetVideoAspect
float GetVideoAspect(void) const
Definition: mythplayer.h:134
VideoOutputD3D::m_renderReset
bool m_renderReset
Definition: videoout_d3d.h:79
VideoOutputD3D::StopEmbedding
void StopEmbedding(void) override
Definition: videoout_d3d.cpp:404
mythcontext.h
DXVA2Decoder::GetSurface
void * GetSurface(uint num)
Definition: dxva2decoder.cpp:377
VideoOutputD3D::~VideoOutputD3D
~VideoOutputD3D()
Definition: videoout_d3d.cpp:53
VideoOutputD3D::m_video
D3D9Image * m_video
Definition: videoout_d3d.h:77
MythVideoFrame::m_height
int m_height
Definition: mythframe.h:122
codec_is_std
static bool codec_is_std(MythCodecID id)
Definition: mythcodecid.h:293
VideoOutputD3D::m_pipReady
QMap< MythPlayer *, bool > m_pipReady
Definition: videoout_d3d.h:82
MythVideoFrame
Definition: mythframe.h:88
VideoBuffers::DiscardFrames
void DiscardFrames(bool NextFrameIsKeyFrame)
Definition: videobuffers.cpp:809
MythAVCopy::Copy
int Copy(AVFrame *To, const MythVideoFrame *From, unsigned char *Buffer, AVPixelFormat Fmt=AV_PIX_FMT_YUV420P)
Initialise AVFrame and copy contents of VideoFrame frame into it, performing any required conversion.
Definition: mythavutil.cpp:266
GetMythPainter
MythPainter * GetMythPainter(void)
Definition: mythmainwindow.cpp:117
VideoOutputD3D::UpdateFrame
void UpdateFrame(MythVideoFrame *frame, D3D9Image *img)
Definition: videoout_d3d.cpp:436
mythmainwindow.h
VideoOutputD3D::m_renderValid
bool m_renderValid
Definition: videoout_d3d.h:78
VideoBuffers::Init
void Init(uint NumDecode, uint NeedFree, uint NeedprebufferNormal, uint NeedPrebufferSmall)
Creates buffers and sets various buffer management parameters.
Definition: videobuffers.cpp:176
D3D9Image::ReleaseBuffer
void ReleaseBuffer(void)
Definition: mythrender_d3d9.cpp:111
OSD
Definition: osd.h:93
VideoBuffers::GetNumBuffers
static uint GetNumBuffers(int PixelFormat, int MaxReferenceFrames=16, bool Decoder=false)
Definition: videobuffers.cpp:136
VideoOutputD3D::SetProfile
void SetProfile(void)
Definition: videoout_d3d.cpp:246
VideoOutputD3D::GetAllowedRenderers
static QStringList GetAllowedRenderers(MythCodecID myth_codec_id, const QSize &video_dim)
Definition: videoout_d3d.cpp:605
MythVideoOutput::m_videoBuffers
VideoBuffers m_videoBuffers
Definition: mythvideoout.h:101
RenderOptions::priorities
QMap< QString, uint > * priorities
Definition: mythvideoprofile.h:50
fourcc.h
MythVideoFrame::m_buffer
uint8_t * m_buffer
Definition: mythframe.h:120