1 |
From e7004a036cbd8beea34dfd31476b6c9690e9bc73 Mon Sep 17 00:00:00 2001 |
2 |
From: anssih <anssih@568bbfeb-2a22-0410-94d2-cc84cf5bfa90> |
3 |
Date: Fri, 3 Sep 2010 17:42:16 +0000 |
4 |
Subject: [PATCH 1/8] changed: split CDVDVideoCodecFFmpeg::GetPicture() |
5 |
|
6 |
Factor the part of CDVDVideoCodecFFmpeg::GetPicture() which is used by |
7 |
hardware decoder classes to a separate GetPictureCommon() function that |
8 |
can be used to fill up a DVDVideoPicture structure. |
9 |
|
10 |
This allows hardware decoder classes to fill DVDVideoPicture structures |
11 |
in advance, which is needed if there is a delay between decoding and |
12 |
display (as is needed for e.g. VDPAU advanced deinterlacing). |
13 |
|
14 |
git-svn-id: https://xbmc.svn.sourceforge.net/svnroot/xbmc/trunk@33501 568bbfeb-2a22-0410-94d2-cc84cf5bfa90 |
15 |
(cherry picked from commit 574162c225787e4fbda4a1f8bd56b2a9c4e4d9a2) |
16 |
--- |
17 |
.../DVDCodecs/Video/DVDVideoCodecFFmpeg.cpp | 14 +++++++++++--- |
18 |
.../DVDCodecs/Video/DVDVideoCodecFFmpeg.h | 1 + |
19 |
xbmc/cores/dvdplayer/DVDCodecs/Video/DXVA.cpp | 1 + |
20 |
xbmc/cores/dvdplayer/DVDCodecs/Video/VAAPI.cpp | 1 + |
21 |
xbmc/cores/dvdplayer/DVDCodecs/Video/VDPAU.cpp | 2 ++ |
22 |
5 files changed, 16 insertions(+), 3 deletions(-) |
23 |
|
24 |
diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.cpp |
25 |
index fbc3b4e..76cdd79 100644 |
26 |
--- a/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.cpp |
27 |
+++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.cpp |
28 |
@@ -506,7 +506,7 @@ void CDVDVideoCodecFFmpeg::Reset() |
29 |
} |
30 |
} |
31 |
|
32 |
-bool CDVDVideoCodecFFmpeg::GetPicture(DVDVideoPicture* pDvdVideoPicture) |
33 |
+bool CDVDVideoCodecFFmpeg::GetPictureCommon(DVDVideoPicture* pDvdVideoPicture) |
34 |
{ |
35 |
GetVideoAspect(m_pCodecContext, pDvdVideoPicture->iDisplayWidth, pDvdVideoPicture->iDisplayHeight); |
36 |
|
37 |
@@ -564,9 +564,17 @@ bool CDVDVideoCodecFFmpeg::GetPicture(DVDVideoPicture* pDvdVideoPicture) |
38 |
if(!m_started) |
39 |
pDvdVideoPicture->iFlags |= DVP_FLAG_DROPPED; |
40 |
|
41 |
+ return true; |
42 |
+} |
43 |
+ |
44 |
+bool CDVDVideoCodecFFmpeg::GetPicture(DVDVideoPicture* pDvdVideoPicture) |
45 |
+{ |
46 |
if(m_pHardware) |
47 |
return m_pHardware->GetPicture(m_pCodecContext, m_pFrame, pDvdVideoPicture); |
48 |
|
49 |
+ if(!GetPictureCommon(pDvdVideoPicture)) |
50 |
+ return false; |
51 |
+ |
52 |
if(m_pConvertFrame) |
53 |
{ |
54 |
for (int i = 0; i < 4; i++) |
55 |
@@ -577,9 +585,9 @@ bool CDVDVideoCodecFFmpeg::GetPicture(DVDVideoPicture* pDvdVideoPicture) |
56 |
else |
57 |
{ |
58 |
for (int i = 0; i < 4; i++) |
59 |
- pDvdVideoPicture->data[i] = frame->data[i]; |
60 |
+ pDvdVideoPicture->data[i] = m_pFrame->data[i]; |
61 |
for (int i = 0; i < 4; i++) |
62 |
- pDvdVideoPicture->iLineSize[i] = frame->linesize[i]; |
63 |
+ pDvdVideoPicture->iLineSize[i] = m_pFrame->linesize[i]; |
64 |
} |
65 |
|
66 |
pDvdVideoPicture->iFlags |= pDvdVideoPicture->data[0] ? 0 : DVP_FLAG_DROPPED; |
67 |
diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.h b/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.h |
68 |
index 321e2b7..b54de02 100644 |
69 |
--- a/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.h |
70 |
+++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.h |
71 |
@@ -55,6 +55,7 @@ public: |
72 |
virtual void Dispose(); |
73 |
virtual int Decode(BYTE* pData, int iSize, double dts, double pts); |
74 |
virtual void Reset(); |
75 |
+ bool GetPictureCommon(DVDVideoPicture* pDvdVideoPicture); |
76 |
virtual bool GetPicture(DVDVideoPicture* pDvdVideoPicture); |
77 |
virtual void SetDropState(bool bDrop); |
78 |
virtual const char* GetName() { return m_name.c_str(); }; // m_name is never changed after open |
79 |
diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/DXVA.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Video/DXVA.cpp |
80 |
index 03ec463..7fd1ec4 100644 |
81 |
--- a/xbmc/cores/dvdplayer/DVDCodecs/Video/DXVA.cpp |
82 |
+++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/DXVA.cpp |
83 |
@@ -540,6 +540,7 @@ int CDecoder::Decode(AVCodecContext* avctx, AVFrame* frame) |
84 |
|
85 |
bool CDecoder::GetPicture(AVCodecContext* avctx, AVFrame* frame, DVDVideoPicture* picture) |
86 |
{ |
87 |
+ ((CDVDVideoCodecFFmpeg*)avctx->opaque)->GetPictureCommon(picture); |
88 |
CSingleLock lock(m_section); |
89 |
picture->format = DVDVideoPicture::FMT_DXVA; |
90 |
picture->proc = m_processor; |
91 |
diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/VAAPI.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Video/VAAPI.cpp |
92 |
index 6b1853d..c5b4362 100644 |
93 |
--- a/xbmc/cores/dvdplayer/DVDCodecs/Video/VAAPI.cpp |
94 |
+++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/VAAPI.cpp |
95 |
@@ -404,6 +404,7 @@ int CDecoder::Decode(AVCodecContext* avctx, AVFrame* frame) |
96 |
|
97 |
bool CDecoder::GetPicture(AVCodecContext* avctx, AVFrame* frame, DVDVideoPicture* picture) |
98 |
{ |
99 |
+ ((CDVDVideoCodecFFmpeg*)avctx->opaque)->GetPictureCommon(picture); |
100 |
VASurfaceID surface = GetSurfaceID(frame); |
101 |
|
102 |
|
103 |
diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/VDPAU.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Video/VDPAU.cpp |
104 |
index 4de8c99..04b9e6b 100644 |
105 |
--- a/xbmc/cores/dvdplayer/DVDCodecs/Video/VDPAU.cpp |
106 |
+++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/VDPAU.cpp |
107 |
@@ -1287,6 +1287,8 @@ int CVDPAU::Decode(AVCodecContext *avctx, AVFrame *pFrame) |
108 |
|
109 |
bool CVDPAU::GetPicture(AVCodecContext* avctx, AVFrame* frame, DVDVideoPicture* picture) |
110 |
{ |
111 |
+ ((CDVDVideoCodecFFmpeg*)avctx->opaque)->GetPictureCommon(picture); |
112 |
+ |
113 |
picture->format = DVDVideoPicture::FMT_VDPAU; |
114 |
picture->iFlags &= DVP_FLAG_DROPPED; |
115 |
picture->iWidth = OutWidth; |
116 |
-- |
117 |
1.7.3 |
118 |
|