~ubuntu-branches/ubuntu/trusty/libavg/trusty-proposed

« back to all changes in this revision

Viewing changes to src/video/VideoDecoderThread.cpp

  • Committer: Package Import Robot
  • Author(s): OXullo Intersecans
  • Date: 2011-12-06 22:44:56 UTC
  • mfrom: (1.1.6)
  • Revision ID: package-import@ubuntu.com-20111206224456-qc7250z3ya1vi8s9
Tags: 1.7.0-0ubuntu1
* New upstream release (LP: #899183)
* Remove patches 0002-libav-0.7.patch, 0003-fglrx-segfault-on-startup.patch
  now merged to upstream
* Remove unnecessary .la files
* Update debian/watch file
* Fix debian/copyright dep-5 compliancy
* Update standards to version 3.9.2
* Add man pages for avg_checktouch, avg_checkvsync, avg_showsvg
* Minor debian/rules enhancement
* Add librsvg2-dev, libgdk-pixbuf2.0-dev to Build-Depends
* Proper transition to dh_python2

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
//
2
2
//  libavg - Media Playback Engine. 
3
 
//  Copyright (C) 2003-2008 Ulrich von Zadow
 
3
//  Copyright (C) 2003-2011 Ulrich von Zadow
4
4
//
5
5
//  This library is free software; you can redistribute it and/or
6
6
//  modify it under the terms of the GNU Lesser General Public
25
25
#include "../base/Exception.h"
26
26
#include "../base/ScopeTimer.h"
27
27
#include "../base/TimeSource.h"
 
28
#include "../avgconfigwrapper.h"
 
29
 
 
30
struct vdpau_render_state;
28
31
 
29
32
using namespace std;
30
33
 
59
62
        }
60
63
    } else {
61
64
        ScopeTimer timer(DecoderProfilingZone);
 
65
        vdpau_render_state* pRenderState = 0;
 
66
        FrameAvailableCode frameAvailable;
62
67
        vector<BitmapPtr> pBmps;
63
 
        IntPoint size = m_pDecoder->getSize();
64
 
        IntPoint halfSize(size.x/2, size.y/2);
65
 
        PixelFormat pf = m_pDecoder->getPixelFormat();
66
 
        FrameAvailableCode frameAvailable;
67
 
        if (pixelFormatIsPlanar(pf)) {
68
 
            pBmps.push_back(getBmp(m_pBmpQ, size, I8));
69
 
            pBmps.push_back(getBmp(m_pHalfBmpQ, halfSize, I8));
70
 
            pBmps.push_back(getBmp(m_pHalfBmpQ, halfSize, I8));
71
 
            if (pf == YCbCrA420p) {
 
68
        bool usesVDPAU = m_pDecoder->getVideoInfo().m_bUsesVDPAU;
 
69
        if (usesVDPAU) {
 
70
#ifdef AVG_ENABLE_VDPAU
 
71
            frameAvailable = m_pDecoder->renderToVDPAU(&pRenderState);
 
72
#else
 
73
            frameAvailable = FA_NEW_FRAME; // Never executed - silences compiler warning.
 
74
#endif
 
75
        } else {
 
76
            IntPoint size = m_pDecoder->getSize();
 
77
            IntPoint halfSize(size.x/2, size.y/2);
 
78
            PixelFormat pf = m_pDecoder->getPixelFormat();
 
79
            if (pixelFormatIsPlanar(pf)) {
72
80
                pBmps.push_back(getBmp(m_pBmpQ, size, I8));
 
81
                pBmps.push_back(getBmp(m_pHalfBmpQ, halfSize, I8));
 
82
                pBmps.push_back(getBmp(m_pHalfBmpQ, halfSize, I8));
 
83
                if (pf == YCbCrA420p) {
 
84
                    pBmps.push_back(getBmp(m_pBmpQ, size, I8));
 
85
                }
 
86
            } else {
 
87
                pBmps.push_back(getBmp(m_pBmpQ, size, pf));
73
88
            }
74
 
        } else {
75
 
            pBmps.push_back(getBmp(m_pBmpQ, size, pf));
 
89
            frameAvailable = m_pDecoder->renderToBmps(pBmps, -1);
76
90
        }
77
 
        frameAvailable = m_pDecoder->renderToBmps(pBmps, -1);
78
 
 
79
91
        if (m_pDecoder->isEOF(SS_VIDEO)) {
80
92
            VideoMsgPtr pMsg(new VideoMsg());
81
93
            pMsg->setEOF();
82
94
            m_MsgQ.push(pMsg);
83
95
        } else {
84
96
            ScopeTimer timer(PushMsgProfilingZone);
85
 
            
86
97
            AVG_ASSERT(frameAvailable == FA_NEW_FRAME);
87
98
            VideoMsgPtr pMsg(new VideoMsg());
88
 
            pMsg->setFrame(pBmps, m_pDecoder->getCurTime(SS_VIDEO));
 
99
            if (usesVDPAU) {
 
100
                pMsg->setVDPAUFrame(pRenderState, m_pDecoder->getCurTime(SS_VIDEO));
 
101
            } else {
 
102
                pMsg->setFrame(pBmps, m_pDecoder->getCurTime(SS_VIDEO));
 
103
            }
89
104
            m_MsgQ.push(pMsg);
90
105
            msleep(0);
91
106
        }
 
107
        ThreadProfiler::get()->reset();
92
108
    }
93
109
    return true;
94
110
}