Ticket #4270: 4270-mythtv-v1.patch

File 4270-mythtv-v1.patch, 110.8 KB (added by danielk, 16 years ago)

Version of mythtv portion after reading it over and making small edits (the .pro files still need some work).

  • libs/libmythtv/NuppelVideoPlayer.cpp

     
    1313#include <fcntl.h>
    1414#include <sched.h>
    1515#include <sys/time.h>
    16 #include <sys/ioctl.h>
    1716
    1817// C++ headers
    1918#include <algorithm>
     
    66096608
    66106609                OSDTypeImage* image = new OSDTypeImage();
    66116610                image->SetPosition(QPoint(rect->x, rect->y), hmult, vmult);
    6612                 image->LoadFromQImage(qImage);
     6611                image->Load(qImage);
    66136612
    66146613                subtitleOSD->AddType(image);
    66156614
     
    69246923
    69256924        OSDTypeImage* image = new OSDTypeImage();
    69266925        image->SetPosition(QPoint(btnX, btnY), hmult, vmult);
    6927         image->LoadFromQImage(hl_button);
     6926        image->Load(hl_button);
    69286927        image->SetDontRoundPosition(true);
    69296928
    69306929        subtitleOSD->AddType(image);
  • libs/libmythtv/osdlistbtntype.cpp

     
    709709        QImage img(data, width, height, 32, NULL, 65536 * 65536,
    710710                   QImage::LittleEndian);
    711711        img.setAlphaBuffer(alpha<255);
    712         osdImg.LoadFromQImage(img);
     712        osdImg.Load(img);
    713713    }
    714714    delete[] data;
    715715}
     
    717717void OSDListBtnType::LoadPixmap(OSDTypeImage& pix, const QString& fileName)
    718718{
    719719    QString path = gContext->GetThemesParentDir() + "default/lb-";
    720     pix.LoadImage(path + fileName + ".png", m_wmult, m_hmult);
     720    pix.Load(path + fileName + ".png", m_wmult, m_hmult);
    721721}
    722722
    723723/////////////////////////////////////////////////////////////////////////////
  • libs/libmythtv/videoout_d3d.cpp

     
     1// -*- Mode: c++ -*-
     2
     3#include <map>
     4#include <iostream>
     5#include <algorithm>
     6using namespace std;
     7
     8#define _WIN32_WINNT 0x500
     9#include "mythcontext.h"
     10#include "videoout_d3d.h"
     11#include "filtermanager.h"
     12#include "fourcc.h"
     13
     14#include "mmsystem.h"
     15#include "tv.h"
     16
     17#include <qapplication.h>
     18
     19#undef UNICODE
     20
     21extern "C" {
     22#include "../libavcodec/avcodec.h"
     23}
     24
     25typedef struct
     26{
     27    FLOAT       x;          // vertex untransformed x position
     28    FLOAT       y;          // vertex untransformed y position
     29    FLOAT       z;          // vertex untransformed z position
     30    FLOAT       rhw;        // eye distance
     31    D3DCOLOR    diffuse;    // diffuse color
     32    FLOAT       tu;         // texture u coordinate
     33    FLOAT       tv;         // texture v coordinate
     34} CUSTOMVERTEX;
     35
     36#define D3DFVF_CUSTOMVERTEX (D3DFVF_XYZRHW|D3DFVF_DIFFUSE|D3DFVF_TEX1)
     37
     38const int kNumBuffers = 31;
     39const int kNeedFreeFrames = 1;
     40const int kPrebufferFramesNormal = 10;
     41const int kPrebufferFramesSmall = 4;
     42const int kKeepPrebuffer = 2;
     43
     44#define LOC      QString("VideoOutputD3D: ")
     45#define LOC_WARN QString("VideoOutputD3D Warning: ")
     46#define LOC_ERR  QString("VideoOutputD3D Error: ")
     47
     48VideoOutputD3D::VideoOutputD3D(void)
     49    : VideoOutput(), m_InputCX(0), m_InputCY(0),
     50      m_lock(true), m_RefreshRate(60), m_hWnd(NULL),
     51      m_ddFormat(D3DFMT_UNKNOWN), m_pD3D(NULL), m_pd3dDevice(NULL),
     52      m_pSurface(NULL), m_pTexture(NULL), m_pVertexBuffer(NULL)
     53{
     54    VERBOSE(VB_PLAYBACK, LOC + "ctor");
     55    m_pauseFrame.buf = NULL;
     56}
     57
     58VideoOutputD3D::~VideoOutputD3D()
     59{
     60    Exit();
     61}
     62
     63void VideoOutputD3D::Exit(void)
     64{
     65    VERBOSE(VB_PLAYBACK, LOC + "Exit()");
     66    QMutexLocker locker(&m_lock);
     67    vbuffers.DeleteBuffers();
     68    if (m_pauseFrame.buf)
     69    {
     70        delete [] m_pauseFrame.buf;
     71        m_pauseFrame.buf = NULL;
     72    }
     73    UnInitD3D();
     74}
     75
     76void VideoOutputD3D::UnInitD3D(void)
     77{
     78    QMutexLocker locker(&m_lock);
     79
     80    if (m_pVertexBuffer)
     81    {
     82        m_pVertexBuffer->Release();
     83        m_pVertexBuffer = NULL;
     84    }
     85
     86    if (m_pTexture)
     87    {
     88        m_pTexture->Release();
     89        m_pTexture = NULL;
     90    }
     91
     92    if (m_pSurface)
     93    {
     94        m_pSurface->Release();
     95        m_pSurface = NULL;
     96    }
     97
     98    if (m_pd3dDevice)
     99    {
     100        m_pd3dDevice->Release();
     101        m_pd3dDevice = NULL;
     102    }
     103
     104    if (m_pD3D)
     105    {
     106        m_pD3D->Release();
     107        m_pD3D = NULL;
     108    }
     109}
     110
     111bool VideoOutputD3D::InputChanged(const QSize &input_size,
     112                                  float        aspect,
     113                                  MythCodecID  av_codec_id,
     114                                  void        *codec_private)
     115{
     116    QMutexLocker locker(&m_lock);
     117    VideoOutput::InputChanged(input_size, aspect, av_codec_id, codec_private);
     118    db_vdisp_profile->SetVideoRenderer("didect3d");
     119
     120    if (input_size.width()  == m_InputCX &&
     121        input_size.height() == m_InputCY)
     122    {
     123        MoveResize();
     124        return true;
     125    }
     126
     127    m_InputCX = input_size.width();
     128    m_InputCY = input_size.height();
     129    VERBOSE(VB_PLAYBACK, LOC + "InputChanged, x="<< m_InputCX
     130            << ", y=" << m_InputCY);
     131
     132    video_dim = input_size;
     133    vbuffers.DeleteBuffers();
     134
     135    MoveResize();
     136
     137    if (!vbuffers.CreateBuffers(m_InputCX, m_InputCY))
     138    {
     139        VERBOSE(VB_IMPORTANT, LOC + "InputChanged(): "
     140                "Failed to recreate buffers");
     141        errored = true;
     142    }
     143
     144    if (!InitD3D())
     145        UnInitD3D();
     146
     147    if (m_pauseFrame.buf)
     148    {
     149        delete [] m_pauseFrame.buf;
     150        m_pauseFrame.buf = NULL;
     151    }
     152
     153    m_pauseFrame.height = vbuffers.GetScratchFrame()->height;
     154    m_pauseFrame.width  = vbuffers.GetScratchFrame()->width;
     155    m_pauseFrame.bpp    = vbuffers.GetScratchFrame()->bpp;
     156    m_pauseFrame.size   = vbuffers.GetScratchFrame()->size;
     157    m_pauseFrame.buf    = new unsigned char[m_pauseFrame.size + 128];
     158    m_pauseFrame.frameNumber = vbuffers.GetScratchFrame()->frameNumber;
     159
     160    return true;
     161}
     162
     163bool VideoOutputD3D::InitD3D()
     164{
     165    VERBOSE(VB_PLAYBACK, LOC + QString("InitD3D start (x=%1, y=%2)")
     166            .arg(m_InputCX).arg(m_InputCY));
     167
     168    QMutexLocker locker(&m_lock);
     169    D3DCAPS9 d3dCaps;
     170
     171    typedef LPDIRECT3D9 (WINAPI *LPFND3DC)(UINT SDKVersion);
     172    static LPFND3DC OurDirect3DCreate9 = NULL;
     173    static HINSTANCE hD3DLib = NULL;
     174
     175    if (!hD3DLib)
     176    {
     177        hD3DLib = LoadLibrary(TEXT("D3D9.DLL"));
     178        if (!hD3DLib)
     179        {
     180            VERBOSE(VB_IMPORTANT, LOC_ERR + "Cannot load d3d9.dll (Direct3D)");
     181            return false;
     182        }
     183    }
     184
     185    if (!OurDirect3DCreate9)
     186    {
     187        OurDirect3DCreate9 = (LPFND3DC) GetProcAddress(
     188            hD3DLib, TEXT("Direct3DCreate9"));
     189
     190        if (!OurDirect3DCreate9)
     191        {
     192            VERBOSE(VB_IMPORTANT, LOC_ERR + "Cannot locate reference to "
     193                    "Direct3DCreate9 ABI in DLL");
     194
     195            return false;
     196        }
     197    }
     198
     199    /* Create the D3D object. */
     200    m_pD3D = OurDirect3DCreate9(D3D_SDK_VERSION);
     201    if (!m_pD3D)
     202    {
     203        VERBOSE(VB_IMPORTANT, LOC_ERR +
     204                "Could not create Direct3D9 instance.");
     205
     206        return false;
     207    }
     208
     209    // Get device capabilities
     210    ZeroMemory(&d3dCaps, sizeof(d3dCaps));
     211
     212    if (D3D_OK != m_pD3D->GetDeviceCaps(
     213            D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, &d3dCaps))
     214    {
     215        VERBOSE(VB_IMPORTANT, LOC_ERR +
     216                "Could not read adapter capabilities.");
     217
     218        return false;
     219    }
     220
     221    D3DDISPLAYMODE d3ddm;
     222    // Get the current desktop display mode, so we can set up a back
     223    // buffer of the same format
     224    if (D3D_OK != m_pD3D->GetAdapterDisplayMode(D3DADAPTER_DEFAULT, &d3ddm))
     225    {
     226        VERBOSE(VB_IMPORTANT, LOC_ERR +
     227                "Could not read adapter display mode.");
     228
     229        return false;
     230    }
     231    m_RefreshRate = d3ddm.RefreshRate;
     232
     233    m_ddFormat = d3ddm.Format;
     234    D3DPRESENT_PARAMETERS d3dpp;
     235
     236    /* Set up the structure used to create the D3DDevice. */
     237    ZeroMemory(&d3dpp, sizeof(D3DPRESENT_PARAMETERS));
     238    d3dpp.Flags                  = D3DPRESENTFLAG_VIDEO;
     239    d3dpp.Windowed               = TRUE;
     240    d3dpp.hDeviceWindow          = m_hWnd;
     241    d3dpp.BackBufferWidth        = m_InputCX;
     242    d3dpp.BackBufferHeight       = m_InputCY;
     243    d3dpp.SwapEffect             = D3DSWAPEFFECT_COPY;
     244    d3dpp.MultiSampleType        = D3DMULTISAMPLE_NONE;
     245    d3dpp.PresentationInterval   = D3DPRESENT_INTERVAL_ONE;
     246    d3dpp.BackBufferFormat       = d3ddm.Format;
     247    d3dpp.BackBufferCount        = 1;
     248    d3dpp.EnableAutoDepthStencil = FALSE;
     249
     250    // Create the D3DDevice
     251    if (D3D_OK != m_pD3D->CreateDevice(D3DADAPTER_DEFAULT,
     252                                       D3DDEVTYPE_HAL, m_hWnd,
     253                                       D3DCREATE_SOFTWARE_VERTEXPROCESSING,
     254                                       &d3dpp, &m_pd3dDevice))
     255    {
     256        VERBOSE(VB_IMPORTANT, LOC_ERR + "Could not create the D3D device!");
     257        return false;
     258    }
     259
     260    //input seems to always be PIX_FMT_YUV420P
     261    //MAKEFOURCC('I','4','2','0');
     262    //D3DFMT_G8R8_G8B8???
     263
     264    D3DFORMAT format = D3DFMT_X8R8G8B8;
     265    /* test whether device can create a surface of that format */
     266    HRESULT hr = m_pD3D->CheckDeviceFormat(
     267        D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, m_ddFormat, 0,
     268        D3DRTYPE_SURFACE, format);
     269
     270    if (SUCCEEDED(hr))
     271    {
     272        /* test whether device can perform color-conversion
     273        ** from that format to target format
     274        */
     275        hr = m_pD3D->CheckDeviceFormatConversion(
     276            D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL,
     277            format, m_ddFormat);
     278
     279        if (FAILED(hr))
     280        {
     281            VERBOSE(VB_IMPORTANT, LOC_ERR +
     282                    "CheckDeviceFormatConversion failed");
     283
     284            return false;
     285        }
     286    }
     287    else
     288    {
     289        VERBOSE(VB_IMPORTANT, LOC_ERR + "CheckDeviceFormat failed");
     290        return false;
     291    }
     292
     293    hr = m_pd3dDevice->CreateOffscreenPlainSurface(
     294        m_InputCX,
     295        m_InputCY,
     296        format,
     297        D3DPOOL_DEFAULT,
     298        &m_pSurface,
     299        NULL);
     300
     301    if (FAILED(hr))
     302    {
     303        VERBOSE(VB_IMPORTANT, LOC_ERR + "Failed to create picture surface");
     304        return false;
     305    }
     306
     307    /* fill surface with black color */
     308    m_pd3dDevice->ColorFill(m_pSurface, NULL, D3DCOLOR_ARGB(0xFF, 0, 0, 0) );
     309
     310    /*
     311    ** Create a texture for use when rendering a scene
     312    ** for performance reason, texture format is identical to backbuffer
     313    ** which would usually be a RGB format
     314    */
     315    hr = m_pd3dDevice->CreateTexture(
     316        m_InputCX,
     317        m_InputCY,
     318        1,
     319        D3DUSAGE_RENDERTARGET,
     320        m_ddFormat,
     321        D3DPOOL_DEFAULT,
     322        &m_pTexture,
     323        NULL);
     324
     325    if (FAILED(hr))
     326    {
     327        VERBOSE(VB_IMPORTANT, LOC_ERR + "Failed to create texture");
     328        return false;
     329    }
     330
     331    /*
     332    ** Create a vertex buffer for use when rendering scene
     333    */
     334    hr = m_pd3dDevice->CreateVertexBuffer(
     335        sizeof(CUSTOMVERTEX)*4,
     336        D3DUSAGE_DYNAMIC|D3DUSAGE_WRITEONLY,
     337        D3DFVF_CUSTOMVERTEX,
     338        D3DPOOL_DEFAULT,
     339        &m_pVertexBuffer,
     340        NULL);
     341    if (FAILED(hr))
     342    {
     343        VERBOSE(VB_IMPORTANT, LOC_ERR + "Failed to create vertex buffer");
     344        return false;
     345    }
     346
     347    /* Update the vertex buffer */
     348    CUSTOMVERTEX *p_vertices;
     349    hr = m_pVertexBuffer->Lock(0, 0, (VOID **)(&p_vertices), D3DLOCK_DISCARD);
     350
     351    if (FAILED(hr))
     352    {
     353        VERBOSE(VB_IMPORTANT, LOC_ERR + "Failed to lock vertex buffer");
     354        return false;
     355    }
     356
     357    /* Setup vertices */
     358    p_vertices[0].x       = 0.0f;       // left
     359    p_vertices[0].y       = 0.0f;       // top
     360    p_vertices[0].z       = 0.0f;
     361    p_vertices[0].diffuse = D3DCOLOR_ARGB(255, 255, 255, 255);
     362    p_vertices[0].rhw     = 1.0f;
     363    p_vertices[0].tu      = 0.0f;
     364    p_vertices[0].tv      = 0.0f;
     365
     366    p_vertices[1].x       = (float)m_InputCX;    // right
     367    p_vertices[1].y       = 0.0f;       // top
     368    p_vertices[1].z       = 0.0f;
     369    p_vertices[1].diffuse = D3DCOLOR_ARGB(255, 255, 255, 255);
     370    p_vertices[1].rhw     = 1.0f;
     371    p_vertices[1].tu      = 1.0f;
     372    p_vertices[1].tv      = 0.0f;
     373
     374    p_vertices[2].x       = (float)m_InputCX;    // right
     375    p_vertices[2].y       = (float)m_InputCY;   // bottom
     376    p_vertices[2].z       = 0.0f;
     377    p_vertices[2].diffuse = D3DCOLOR_ARGB(255, 255, 255, 255);
     378    p_vertices[2].rhw     = 1.0f;
     379    p_vertices[2].tu      = 1.0f;
     380    p_vertices[2].tv      = 1.0f;
     381
     382    p_vertices[3].x       = 0.0f;       // left
     383    p_vertices[3].y       = (float)m_InputCY;   // bottom
     384    p_vertices[3].z       = 0.0f;
     385    p_vertices[3].diffuse = D3DCOLOR_ARGB(255, 255, 255, 255);
     386    p_vertices[3].rhw     = 1.0f;
     387    p_vertices[3].tu      = 0.0f;
     388    p_vertices[3].tv      = 1.0f;
     389
     390    hr = m_pVertexBuffer->Unlock();
     391    if (FAILED(hr))
     392    {
     393        VERBOSE(VB_IMPORTANT, LOC_ERR + "Failed to unlock vertex buffer");
     394        return false;
     395    }
     396
     397    // Texture coordinates outside the range [0.0, 1.0] are set
     398    // to the texture color at 0.0 or 1.0, respectively.
     399    m_pd3dDevice->SetSamplerState(0, D3DSAMP_ADDRESSU, D3DTADDRESS_CLAMP);
     400    m_pd3dDevice->SetSamplerState(0, D3DSAMP_ADDRESSV, D3DTADDRESS_CLAMP);
     401
     402    // Set linear filtering quality
     403    m_pd3dDevice->SetSamplerState(0, D3DSAMP_MINFILTER, D3DTEXF_LINEAR);
     404    m_pd3dDevice->SetSamplerState(0, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR);
     405
     406    // set maximum ambient light
     407    m_pd3dDevice->SetRenderState(D3DRS_AMBIENT, D3DCOLOR_XRGB(255,255,255));
     408
     409    // Turn off culling
     410    m_pd3dDevice->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE);
     411
     412    // Turn off the zbuffer
     413    m_pd3dDevice->SetRenderState(D3DRS_ZENABLE, D3DZB_FALSE);
     414
     415    // Turn off lights
     416    m_pd3dDevice->SetRenderState(D3DRS_LIGHTING, FALSE);
     417
     418    // Enable dithering
     419    m_pd3dDevice->SetRenderState(D3DRS_DITHERENABLE, TRUE);
     420
     421    // disable stencil
     422    m_pd3dDevice->SetRenderState(D3DRS_STENCILENABLE, FALSE);
     423
     424    // manage blending
     425    m_pd3dDevice->SetRenderState(D3DRS_ALPHABLENDENABLE, TRUE);
     426    m_pd3dDevice->SetRenderState(D3DRS_SRCBLEND,D3DBLEND_SRCALPHA);
     427    m_pd3dDevice->SetRenderState(D3DRS_DESTBLEND,D3DBLEND_INVSRCALPHA);
     428    m_pd3dDevice->SetRenderState(D3DRS_ALPHATESTENABLE,TRUE);
     429    m_pd3dDevice->SetRenderState(D3DRS_ALPHAREF, 0x10);
     430    m_pd3dDevice->SetRenderState(D3DRS_ALPHAFUNC,D3DCMP_GREATER);
     431
     432    // Set texture states
     433    m_pd3dDevice->SetTextureStageState(0, D3DTSS_COLOROP,D3DTOP_MODULATE);
     434    m_pd3dDevice->SetTextureStageState(0, D3DTSS_COLORARG1,D3DTA_TEXTURE);
     435    m_pd3dDevice->SetTextureStageState(0, D3DTSS_COLORARG2,D3DTA_DIFFUSE);
     436
     437    // turn off alpha operation
     438    m_pd3dDevice->SetTextureStageState(0, D3DTSS_ALPHAOP, D3DTOP_DISABLE);
     439
     440    VERBOSE(VB_GENERAL, LOC +
     441            "Direct3D device adapter successfully initialized");
     442
     443    return true;
     444}
     445
     446int VideoOutputD3D::GetRefreshRate(void)
     447{
     448    return 1000000 / m_RefreshRate;
     449}
     450
     451bool VideoOutputD3D::Init(int width, int height, float aspect,
     452                          WId winid, int winx, int winy, int winw,
     453                          int winh, WId embedid)
     454{
     455    VERBOSE(VB_PLAYBACK, LOC_ERR +
     456            "Init w=" << width << " h=" << height);
     457
     458    db_vdisp_profile->SetVideoRenderer("direct3d");
     459
     460    vbuffers.Init(kNumBuffers, true, kNeedFreeFrames,
     461                  kPrebufferFramesNormal, kPrebufferFramesSmall,
     462                  kKeepPrebuffer);
     463
     464    VideoOutput::Init(width, height, aspect, winid,
     465                      winx, winy, winw, winh, embedid);
     466
     467    m_hWnd = winid;
     468
     469    m_InputCX  = width;
     470    m_InputCY = height;
     471
     472    if (!vbuffers.CreateBuffers(width, height))
     473        return false;
     474
     475    if (!InitD3D())
     476    {
     477        UnInitD3D();
     478        return false;
     479    }
     480
     481    m_pauseFrame.height = vbuffers.GetScratchFrame()->height;
     482    m_pauseFrame.width  = vbuffers.GetScratchFrame()->width;
     483    m_pauseFrame.bpp    = vbuffers.GetScratchFrame()->bpp;
     484    m_pauseFrame.size   = vbuffers.GetScratchFrame()->size;
     485    m_pauseFrame.buf    = new unsigned char[m_pauseFrame.size + 128];
     486    m_pauseFrame.frameNumber = vbuffers.GetScratchFrame()->frameNumber;
     487
     488    MoveResize();
     489
     490    return true;
     491}
     492
     493void VideoOutputD3D::PrepareFrame(VideoFrame *buffer, FrameScanType t)
     494{
     495    if (IsErrored())
     496    {
     497        VERBOSE(VB_IMPORTANT, LOC_ERR +
     498                "PrepareFrame() called while IsErrored is true.");
     499        return;
     500    }
     501
     502    if (!buffer)
     503        buffer = vbuffers.GetScratchFrame();
     504
     505    framesPlayed = buffer->frameNumber + 1;
     506    AVPicture image_in, image_out;
     507
     508    D3DLOCKED_RECT d3drect;
     509    /* Lock the surface to get a valid pointer to the picture buffer */
     510    HRESULT hr = m_pSurface->LockRect(&d3drect, NULL, 0);
     511    if (FAILED(hr))
     512    {
     513        VERBOSE(VB_IMPORTANT, LOC_ERR + "Failed to lock picture surface");
     514        return;
     515    }
     516
     517    avpicture_fill(&image_out, (uint8_t*) d3drect.pBits,
     518                   PIX_FMT_RGBA32, m_InputCX, m_InputCY);
     519    image_out.linesize[0] = d3drect.Pitch;
     520    avpicture_fill(&image_in, buffer->buf,
     521                   PIX_FMT_YUV420P, m_InputCX, m_InputCY);
     522    img_convert(&image_out, PIX_FMT_RGBA32, &image_in,
     523                PIX_FMT_YUV420P, m_InputCX, m_InputCY);
     524
     525#if 0
     526    static int c = 0;
     527    for (int y = 0; y < m_InputCY; y++)
     528    {
     529        for (int x = 0; x < m_InputCX; x++)
     530        {
     531            ((int*)d3drect.pBits)[y * d3drect.Pitch / 4 + x] =
     532                ((x + c) & 0xff) << 8;
     533        }
     534    }
     535    c += 5;
     536#endif
     537
     538    hr = m_pSurface->UnlockRect();
     539    if (FAILED(hr))
     540    {
     541        VERBOSE(VB_IMPORTANT, LOC_ERR + "Failed to unlock picture surface");
     542        return;
     543    }
     544}
     545
     546void VideoOutputD3D::Show(FrameScanType )
     547{
     548    if (IsErrored())
     549    {
     550        VERBOSE(VB_IMPORTANT, LOC_ERR +
     551                "Show() called while IsErrored is true.");
     552
     553        return;
     554    }
     555
     556    if (m_pd3dDevice)
     557    {
     558        LPDIRECT3DSURFACE9      p_d3ddest;
     559        HRESULT hr;
     560
     561        // check if device is still available
     562        hr = m_pd3dDevice->TestCooperativeLevel();
     563        if (FAILED(hr))
     564        {
     565            if (D3DERR_DEVICENOTRESET != hr)
     566            {
     567                // device is not usable at present
     568                // (lost device, out of video mem ?)
     569                goto RenderError;
     570            }
     571        }
     572
     573        /* Clear the backbuffer and the zbuffer */
     574        hr = m_pd3dDevice->Clear(0, NULL, D3DCLEAR_TARGET,
     575                                 D3DCOLOR_XRGB(0, 0, 0), 1.0f, 0);
     576        if (FAILED(hr))
     577            goto RenderError;
     578
     579        /* retrieve texture top-level surface */
     580        hr = m_pTexture->GetSurfaceLevel(0, &p_d3ddest);
     581        if (FAILED(hr))
     582            goto RenderError;
     583
     584        /* Copy picture surface into texture surface,
     585           color space conversion happens here */
     586        hr = m_pd3dDevice->StretchRect(m_pSurface, NULL, p_d3ddest,
     587                                       NULL, D3DTEXF_NONE);
     588        p_d3ddest->Release();
     589        if (FAILED(hr))
     590            goto RenderError;
     591
     592        // Begin the scene
     593        hr = m_pd3dDevice->BeginScene();
     594        if (FAILED(hr))
     595            goto RenderError;
     596
     597        // Setup our texture. Using textures introduces the texture
     598        // stage states, which govern how textures get blended together
     599        // (in the case of multiple textures) and lighting information.
     600        // In this case, we are modulating (blending) our texture with
     601        // the diffuse color of the vertices.
     602        hr = m_pd3dDevice->SetTexture(0, (LPDIRECT3DBASETEXTURE9)m_pTexture);
     603        if (FAILED(hr))
     604        {
     605            m_pd3dDevice->EndScene();
     606            goto RenderError;
     607        }
     608
     609        // Render the vertex buffer contents
     610        hr = m_pd3dDevice->SetStreamSource(0, m_pVertexBuffer,
     611                                           0, sizeof(CUSTOMVERTEX));
     612        if (FAILED(hr))
     613        {
     614            m_pd3dDevice->EndScene();
     615            goto RenderError;
     616        }
     617
     618        // we use FVF instead of vertex shader
     619        hr = m_pd3dDevice->SetVertexShader(NULL);
     620        if (FAILED(hr))
     621        {
     622            m_pd3dDevice->EndScene();
     623            goto RenderError;
     624        }
     625
     626        hr = m_pd3dDevice->SetFVF(D3DFVF_CUSTOMVERTEX);
     627        if (FAILED(hr))
     628        {
     629            m_pd3dDevice->EndScene();
     630            goto RenderError;
     631        }
     632
     633        // draw rectangle
     634        hr = m_pd3dDevice->DrawPrimitive(D3DPT_TRIANGLEFAN, 0, 2);
     635        if (FAILED(hr))
     636        {
     637            m_pd3dDevice->EndScene();
     638            goto RenderError;
     639        }
     640
     641        // End the scene
     642        hr = m_pd3dDevice->EndScene();
     643        if (FAILED(hr))
     644        {
     645            goto RenderError;
     646        }
     647
     648        {
     649            RECT rc_dest;
     650            if (!embedding)
     651            {
     652                ::GetClientRect(m_hWnd, &rc_dest);
     653                rc_dest.right--;
     654                rc_dest.bottom--;
     655            }
     656            else
     657            {
     658                rc_dest.left = display_visible_rect.left();
     659                rc_dest.top = display_visible_rect.top();
     660                rc_dest.right = display_visible_rect.right();
     661                rc_dest.bottom = display_visible_rect.bottom();
     662            }
     663
     664            RECT rc_src =
     665                {0, 0, m_InputCX-1, m_InputCY-1};
     666
     667            // A
     668            if (display_video_rect.height() < rc_dest.bottom - rc_dest.top)
     669            {
     670                rc_dest.top    = display_video_rect.top();
     671                rc_dest.bottom = display_video_rect.bottom();
     672                rc_src.left    = (display_video_rect.width() -
     673                                  (rc_dest.right - rc_dest.left)) / 2;
     674                rc_src.right  -= rc_src.left;
     675            }
     676            // B
     677            if (display_video_rect.width() < rc_dest.right - rc_dest.left)
     678            {
     679                rc_dest.left   = display_video_rect.left();
     680                rc_dest.right  = display_video_rect.right();
     681                rc_src.top     = (display_video_rect.height() -
     682                                  (rc_dest.bottom - rc_dest.top)) / 2;
     683                rc_src.bottom -= rc_src.top;
     684            }
     685
     686            m_rcDest = rc_dest;
     687            hr = m_pd3dDevice->Present(&rc_src, &rc_dest, NULL, NULL);
     688        }
     689
     690        if (FAILED(hr))
     691            RenderError:
     692
     693        VERBOSE(VB_IMPORTANT, LOC_ERR + "Video rendering failed");
     694
     695        qApp->wakeUpGuiThread();
     696    }
     697    else
     698    {
     699        VERBOSE(VB_IMPORTANT, LOC_ERR + "Direct3D device not initialized");
     700    }
     701}
     702
     703void VideoOutputD3D::Zoom(ZoomDirection direction)
     704{
     705    RECT rc;
     706    ::GetClientRect(m_hWnd, &rc);
     707
     708    HDC hdc = ::GetDC(m_hWnd);
     709    if (hdc)
     710    {
     711        ::FillRect(hdc, &rc, (HBRUSH)::GetStockObject(BLACK_BRUSH));
     712        ::ReleaseDC(m_hWnd, hdc);
     713    }
     714}
     715
     716void VideoOutputD3D::UpdatePauseFrame(void)
     717{
     718    QMutexLocker locker(&m_lock);
     719    VideoFrame *used_frame = vbuffers.head(kVideoBuffer_used);
     720    if (!used_frame)
     721        used_frame = vbuffers.GetScratchFrame();
     722
     723    CopyFrame(&m_pauseFrame, used_frame);
     724}
     725
     726void VideoOutputD3D::ProcessFrame(VideoFrame *frame, OSD *osd,
     727                                  FilterChain *filterList,
     728                                  NuppelVideoPlayer *pipPlayer)
     729{
     730    QMutexLocker locker(&m_lock);
     731    if (IsErrored())
     732    {
     733        VERBOSE(VB_IMPORTANT, LOC_ERR +
     734                "ProcessFrame() called while IsErrored is true.");
     735        return;
     736    }
     737
     738    if (!frame)
     739    {
     740        frame = vbuffers.GetScratchFrame();
     741        CopyFrame(vbuffers.GetScratchFrame(), &m_pauseFrame);
     742    }
     743
     744    if (m_deinterlacing && m_deintFilter != NULL)
     745        m_deintFilter->ProcessFrame(frame);
     746
     747    if (filterList)
     748        filterList->ProcessFrame(frame);
     749
     750    ShowPip(frame, pipPlayer);
     751    DisplayOSD(frame, osd);
     752}
     753
     754float VideoOutputD3D::GetDisplayAspect(void) const
     755{
     756    VERBOSE(VB_PLAYBACK, LOC + "GetDisplayAspect");
     757
     758    float width  = display_visible_rect.width();
     759    float height = display_visible_rect.height();
     760
     761    if (height <= 0.0001f)
     762        return 16.0f / 9.0f;
     763
     764    return width / height;
     765}
     766
     767QStringList VideoOutputD3D::GetAllowedRenderers(
     768    MythCodecID myth_codec_id, const QSize &video_dim)
     769{
     770    QStringList list;
     771    list += "direct3d";
     772    return list;
     773}
  • libs/libmythtv/osdtypes.cpp

     
    12991299    m_dontround = false;
    13001300    m_cacheitem = NULL;
    13011301
    1302     LoadImage(filename, wmult, hmult, scalew, scaleh);
     1302    Load(filename, wmult, hmult, scalew, scaleh);
    13031303}
    13041304
    13051305OSDTypeImage::OSDTypeImage(const OSDTypeImage &other)
     
    14171417        QPoint((int)round(m_unbiasedpos.x() * wmult),
    14181418               (int)round(m_unbiasedpos.y() * hmult));
    14191419
    1420     LoadImage(m_filename, wmult, hmult, m_scalew, m_scaleh);
     1420    Load(m_filename, wmult, hmult, m_scalew, m_scaleh);
    14211421}
    14221422
    1423 void OSDTypeImage::LoadImage(const QString &filename, float wmult, float hmult,
    1424                              int scalew, int scaleh, bool usecache)
     1423void OSDTypeImage::Load(const QString &filename, float wmult, float hmult,
     1424                        int scalew, int scaleh, bool usecache)
    14251425{
    14261426    QString ckey;
    14271427
     
    15351535    }
    15361536}
    15371537
    1538 void OSDTypeImage::LoadFromQImage(const QImage &img)
     1538void OSDTypeImage::Load(const QImage &img)
    15391539{
    15401540    // this method is not cached
    15411541
     
    18351835    m_scaleh = scaleh;
    18361836    m_cacheitem = NULL;
    18371837
    1838     LoadImage(m_redname, wmult, hmult, scalew, scaleh, false);
     1838    Load(m_redname, wmult, hmult, scalew, scaleh, false);
    18391839    if (m_isvalid)
    18401840    {
    18411841        m_risvalid = m_isvalid;
     
    18501850        m_alpha = m_yuv = NULL;
    18511851    }
    18521852
    1853     LoadImage(m_bluename, wmult, hmult, scalew, scaleh, false);
     1853    Load(m_bluename, wmult, hmult, scalew, scaleh, false);
    18541854}
    18551855
    18561856OSDTypeEditSlider::~OSDTypeEditSlider()
     
    18711871
    18721872    m_displaypos = m_displayrect.topLeft();
    18731873
    1874     LoadImage(m_redname, wmult, hmult, m_scalew, m_scaleh, false);
     1874    Load(m_redname, wmult, hmult, m_scalew, m_scaleh, false);
    18751875    if (m_isvalid)
    18761876    {
    18771877        m_risvalid = m_isvalid;
     
    18861886        m_alpha = m_yuv = NULL;
    18871887    }
    18881888
    1889     LoadImage(m_bluename, wmult, hmult, m_scalew, m_scaleh, false);
     1889    Load(m_bluename, wmult, hmult, m_scalew, m_scaleh, false);
    18901890}
    18911891
    18921892void OSDTypeEditSlider::ClearAll(void)
  • libs/libmythtv/jobqueue.cpp

     
    88
    99#include <sys/types.h>
    1010#include <sys/stat.h>
    11 #include <sys/wait.h>
    12 #include <sys/resource.h>
    1311
    1412#include <iostream>
    1513#include <cstdlib>
     
    2321#include "NuppelVideoPlayer.h"
    2422#include "mythdbcon.h"
    2523#include "previewgenerator.h"
     24#include "compat.h"
    2625
    2726#define LOC     QString("JobQueue: ")
    2827#define LOC_ERR QString("JobQueue Error: ")
  • libs/libmythtv/DVDRingBuffer.cpp

     
    77#include "iso639.h"
    88
    99#include "NuppelVideoPlayer.h"
     10#include "compat.h"
    1011
    1112#define LOC QString("DVDRB: ")
    1213#define LOC_ERR QString("DVDRB, Error: ")
  • libs/libmythtv/libmythtv.pro

     
    77target.path = $${LIBDIR}
    88INSTALLS = target
    99
    10 INCLUDEPATH += ../.. ..
     10INCLUDEPATH += ../.. .. .
    1111INCLUDEPATH += ../libmyth ../libavcodec ../libavutil ../libmythmpeg2
    1212INCLUDEPATH += ./dvbdev ./mpeg ./iptv
    1313INCLUDEPATH += ../libmythlivemedia/BasicUsageEnvironment/include
     
    4343TARGETDEPS += ../libmythmpeg2/libmythmpeg2-$${MYTH_LIB_EXT}
    4444TARGETDEPS += ../libmythdvdnav/libmythdvdnav-$${MYTH_LIB_EXT}
    4545TARGETDEPS += ../libmythfreemheg/libmythfreemheg-$${MYTH_SHLIB_EXT}
    46 TARGETDEPS += ../libmythlivemedia/libmythlivemedia-$${MYTH_SHLIB_EXT}
     46using_live: TARGETDEPS += ../libmythlivemedia/libmythlivemedia-$${MYTH_SHLIB_EXT}
    4747
    4848
    4949DEFINES += _LARGEFILE_SOURCE
     
    114114
    115115# Headers needed by frontend & backend
    116116HEADERS += filter.h                 format.h
    117 HEADERS += frame.h
     117HEADERS += frame.h                  compat.h
    118118
    119119# LZO / RTjpegN, used by NuppelDecoder & NuppelVideoRecorder
    120120HEADERS += lzoconf.h
     
    497497    QMAKE_CXXFLAGS += -fvisibility=hidden
    498498}
    499499
     500mingw {
     501    DEFINES -= USING_OPENGL_VSYNC
     502    DEFINES += USING_D3D USING_MINGW
     503
     504    HEADERS -= util-opengl.h   openglcontext.h
     505    HEADERS += videoout_d3d.h
     506    SOURCES -= util-opengl.cpp openglcontext.cpp
     507    SOURCES += videoout_d3d.cpp
     508
     509    LIBS += -lpthread
     510    LIBS += -L../libmythfreemheg -lmythfreemheg-$${LIBVERSION}
     511    LIBS += -L. -lmythui-bootstrap
     512
     513    target.path = $${PREFIX}/bin
     514    implib.target = libmythui-bootstrap.a
     515    implib.commands = test -e libmythui-bootstrap.a || dlltool --input-def ../libmythui/libmythui.def --dllname libmythui-$${LIBVERSION}.dll --output-lib libmythui-bootstrap.a -k
     516    QMAKE_EXTRA_WIN_TARGETS += implib
     517    POST_TARGETDEPS += libmythui-bootstrap.a
     518}
     519
    500520# install headers required by mytharchive
    501521inc.path = $${PREFIX}/include/mythtv/libmythtv/
    502522inc.files = programinfo.h remoteutil.h recordingtypes.h
  • libs/libmythtv/osdtypeteletext.h

     
    2121class OSDTypeTeletext;
    2222class TV;
    2323
    24 class TTColor
     24typedef enum
    2525{
    26   public:
    27     static const uint BLACK       = 0;
    28     static const uint RED         = 1;
    29     static const uint GREEN       = 2;
    30     static const uint YELLOW      = 3;
    31     static const uint BLUE        = 4;
    32     static const uint MAGENTA     = 5;
    33     static const uint CYAN        = 6;
    34     static const uint WHITE       = 7;
    35     static const uint TRANSPARENT = 8;
    36 };
     26    kTTColorBlack       = 0,
     27    kTTColorRed         = 1,
     28    kTTColorGreen       = 2,
     29    kTTColorYellow      = 3,
     30    kTTColorBlue        = 4,
     31    kTTColorMagenta     = 5,
     32    kTTColorCyan        = 6,
     33    kTTColorWhite       = 7,
     34    kTTColorTransparent = 8,
     35} TTColor;
    3736
    3837class TTKey
    3938{
  • libs/libmythtv/ThreadedFileWriter.cpp

     
    1313// MythTV headers
    1414#include "ThreadedFileWriter.h"
    1515#include "mythcontext.h"
     16#include "compat.h"
    1617
    1718#if defined(_POSIX_SYNCHRONIZED_IO) && _POSIX_SYNCHRONIZED_IO > 0
    1819#define HAVE_FDATASYNC
  • libs/libmythtv/osdtypes.h

     
    310310    void SetName(const QString &name);
    311311    void Reinit(float wmult, float hmult);
    312312
    313     void LoadImage(const QString &filename, float wmult, float hmult,
    314                    int scalew = -1, int scaleh = -1, bool usecache = true);
    315     void LoadFromQImage(const QImage &img);
     313    void Load(const QString &filename, float wmult, float hmult,
     314              int scalew = -1, int scaleh = -1, bool usecache = true);
     315    void Load(const QImage &img);
    316316
    317317    void SetStaticSize(int scalew, int scaleh) { m_scalew = scalew;
    318318                                                 m_scaleh = scaleh; }
  • libs/libmythtv/dsmcccache.h

     
    106106    void SetGateway(const DSMCCCacheReference &ref);
    107107
    108108    // Return the contents.
    109     int GetObject(QStringList &objectPath, QByteArray &result);
     109    int GetDSMObject(QStringList &objectPath, QByteArray &result);
    110110
    111111  protected:
    112112    // Find File, Directory or Gateway by reference.
  • libs/libmythtv/guidegrid.cpp

     
    11671167                else if (type)
    11681168                    iconsize = type->GetSize();
    11691169                if (!chinfo->iconload)
    1170                     chinfo->LoadIcon(iconsize);
     1170                    chinfo->LoadChannelIcon(iconsize);
    11711171                if (chinfo->iconload)
    11721172                {
    11731173                    if (itype)
     
    11951195                else if (type)
    11961196                    iconsize = type->GetSize();
    11971197                if (!chinfo->iconload)
    1198                     chinfo->LoadIcon(iconsize);
     1198                    chinfo->LoadChannelIcon(iconsize);
    11991199                if (chinfo->iconload)
    12001200                    type->SetIcon(y, chinfo->icon);
    12011201                else
     
    13161316            int iconsize = 0;
    13171317            iconsize = itype->GetSize().width();
    13181318            if (!chinfo->iconload)
    1319                 chinfo->LoadIcon(iconsize);
     1319                chinfo->LoadChannelIcon(iconsize);
    13201320            if (chinfo->iconload)
    13211321                itype->SetImage(chinfo->icon);
    13221322            else
  • libs/libmythtv/siscan.cpp

     
    3030#include "dvbchannel.h"
    3131#include "hdhrchannel.h"
    3232#include "channel.h"
     33#include "compat.h"
    3334
    3435QString SIScan::loc(const SIScan *siscan)
    3536{
  • libs/libmythtv/fifowriter.cpp

     
    1212
    1313#include "fifowriter.h"
    1414#include "mythcontext.h"
     15#include "compat.h"
    1516
    1617#include "config.h"
    1718#ifdef CONFIG_DARWIN
  • libs/libmythtv/videoout_d3d.h

     
     1// -*- Mode: c++ -*-
     2
     3#ifndef VIDEOOUT_D3D_H_
     4#define VIDEOOUT_D3D_H_
     5
     6/* ACK! <windows.h> and <d3d3.h> should only be in cpp's compiled in
     7 * windows only. Some of the variables in VideoOutputDX need to be
     8 * moved to a private class before removing these includes though.
     9 */
     10#include <windows.h> // HACK HACK HACK
     11#include <d3d9.h>    // HACK HACK HACK
     12
     13// MythTV headers
     14#include "videooutbase.h"
     15
     16class VideoOutputD3D : public VideoOutput
     17{
     18  public:
     19    VideoOutputD3D();
     20   ~VideoOutputD3D();
     21
     22    bool Init(int width, int height, float aspect, WId winid,
     23              int winx, int winy, int winw, int winh, WId embedid = 0);
     24
     25    bool InitD3D();
     26    void UnInitD3D();
     27    void PrepareFrame(VideoFrame *buffer, FrameScanType);
     28    void ProcessFrame(VideoFrame *frame, OSD *osd,
     29                      FilterChain *filterList,
     30                      NuppelVideoPlayer *pipPlayer);
     31    void Show(FrameScanType );
     32
     33    bool InputChanged(const QSize &input_size,
     34                      float        aspect,
     35                      MythCodecID  av_codec_id,
     36                      void        *codec_private);
     37    int GetRefreshRate(void);
     38    void UpdatePauseFrame(void);
     39    void DrawUnusedRects(bool) {};
     40    void Zoom(ZoomDirection direction);
     41
     42    float GetDisplayAspect(void) const;
     43
     44    static QStringList GetAllowedRenderers(MythCodecID myth_codec_id,
     45                                           const QSize &video_dim);
     46
     47  private:
     48    void Exit(void);
     49
     50  private:
     51    int                     m_InputCX;
     52    int                     m_InputCY;
     53    RECT                    m_rcDest;
     54
     55    VideoFrame              m_pauseFrame;
     56    QMutex                  m_lock;
     57
     58    int                     m_RefreshRate;
     59    HWND                    m_hWnd;
     60    D3DFORMAT               m_ddFormat;
     61    IDirect3D9             *m_pD3D;
     62    IDirect3DDevice9       *m_pd3dDevice;
     63    IDirect3DSurface9      *m_pSurface;
     64    IDirect3DTexture9      *m_pTexture;
     65    IDirect3DVertexBuffer9 *m_pVertexBuffer;
     66};
     67
     68#endif
  • libs/libmythtv/channelbase.cpp

     
    77#include <unistd.h>
    88#include <fcntl.h>
    99#include <signal.h>
    10 #include <sys/ioctl.h>
     10#include <sys/stat.h>
    1111#include <sys/types.h>
    12 #include <sys/stat.h>
    13 #include <sys/wait.h>
    1412
    1513// C++ headers
    1614#include <iostream>
     
    2624#include "mythdbcon.h"
    2725#include "cardutil.h"
    2826#include "channelutil.h"
     27#include "compat.h"
    2928
    3029#define LOC QString("ChannelBase(%1): ").arg(GetCardID())
    3130#define LOC_ERR QString("ChannelBase(%1) Error: ").arg(GetCardID())
     
    225224
    226225bool ChannelBase::ChangeExternalChannel(const QString &channum)
    227226{
     227#ifdef USING_MINGW
     228    VERBOSE(VB_IMPORTANT, LOC_WARN +
     229            QString("ChangeExternalChannel is not implemented in MinGW."));
     230    return false;
     231#else
    228232    InputMap::const_iterator it = inputs.find(currentInputID);
    229233    QString changer = (*it)->externalChanger;
    230234
     
    312316    }
    313317
    314318    return true;
     319#endif // !USING_MINGW
    315320}
    316321
    317322/** \fn ChannelBase::GetCardID(void) const
  • libs/libmythtv/cc708decoder.h

     
    99#include <qstringlist.h>
    1010
    1111#include "format.h"
     12#include "compat.h"
    1213
    1314#ifndef __CC_CALLBACKS_H__
    1415/** EIA-708-A closed caption packet */
  • libs/libmythtv/vbitext/vbi.c

     
     1// POSIX headers
     2#include <unistd.h>
     3#include <fcntl.h>
     4
     5#ifndef _WIN32
     6#include <sys/ioctl.h>
     7#endif
     8
     9// ANSI C headers
    110#include <stdlib.h>
    211#include <string.h>
    3 #include <unistd.h>
    4 #include <fcntl.h>
    512#include <stdio.h>
    6 #include <sys/ioctl.h>
    713#include <stdarg.h>
    8 //#include "os.h"
     14
     15// vbitext headers
    916#include "vt.h"
    1017#include "vbi.h"
    1118#include "hamm.h"
    12 //#include "lang.h"
    1319
    1420#define FAC    (1<<16)         // factor for fix-point arithmetic
    1521
  • libs/libmythtv/vbitext/cc.cpp

     
    2020 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
    2121 */
    2222
    23 #include <cstdio>
    2423#include <cstdlib>
    2524#include <cstdarg>
    2625#include <unistd.h>
     
    2827#include <cctype>
    2928#include <cerrno>
    3029#include <fcntl.h>
    31 #include <sys/ioctl.h>
    3230#include <sys/types.h>
    3331#ifdef HAVE_GETOPT_H
    3432# include <getopt.h>
  • libs/libmythtv/dsmcccache.cpp

     
    271271// Returns zero for success, -1 if we know the object does not
    272272// currently exist and +1 if the carousel has not so far loaded
    273273// the object or one of the parent files.
    274 int DSMCCCache::GetObject(QStringList &objectPath, QByteArray &result)
     274int DSMCCCache::GetDSMObject(QStringList &objectPath, QByteArray &result)
    275275{
    276276    DSMCCCacheDir *dir = FindGateway(m_GatewayRef);
    277277    if (dir == NULL)
  • libs/libmythtv/filtermanager.cpp

     
    11// POSIX headers
     2#ifndef USING_MINGW // dlfcn for mingw defined in compat.h
    23#include <dlfcn.h> // needed for dlopen(), dlerror(), dlsym(), and dlclose()
     4#else
     5#include "compat.h"
     6#endif
    37
    48// Qt headers
    59#include <qdir.h>
  • libs/libmythtv/infostructs.h

     
    55
    66#include "mythexp.h"
    77
     8#ifdef USING_MINGW
     9#undef LoadIcon
     10#endif
     11
    812class QPixmap;
    913
    1014class MPUBLIC ChannelInfo
     
    1317    ChannelInfo() {}
    1418   ~ChannelInfo() {}
    1519
    16     void LoadIcon(int width, int height=0);
     20    void LoadChannelIcon(int width, int height = 0);
    1721    QString Text(QString format);
    1822
    1923    QString callsign;
  • libs/libmythtv/previewgenerator.cpp

     
    66#include <sys/stat.h>  // for stat
    77#include <unistd.h>    // for stat
    88#include <sys/time.h>
    9 #include <sys/resource.h>
    109#include <sys/types.h>
    1110#include <sys/stat.h>
    1211#include <fcntl.h>
     
    2524#include "mythsocket.h"
    2625#include "remotefile.h"
    2726#include "storagegroup.h"
     27#include "util.h"
    2828
    2929#define LOC QString("Preview: ")
    3030#define LOC_ERR QString("Preview Error: ")
     
    606606        if (!invalid)
    607607        {
    608608            // Check size too, QFileInfo can not handle large files
    609             struct stat status;
    610             stat(filename.ascii(), &status);
    611             // Using off_t requires a lot of 32/64 bit checking.
    612             // So just get the size in blocks.
    613             unsigned long long bsize = status.st_blksize;
    614             unsigned long long nblk  = status.st_blocks;
    615             unsigned long long approx_size = nblk * bsize;
    616             invalid = (approx_size < 8*1024);
     609            unsigned long long fsize =
     610                myth_get_approximate_large_file_size(filename);
     611            invalid = (fsize < 8*1024);
    617612        }
    618613        if (invalid)
    619614        {
  • libs/libmythtv/DeviceReadBuffer.h

     
    66
    77#include <unistd.h>
    88#include <pthread.h>
    9 #include <sys/poll.h>
    109
    1110#include <qmutex.h>
    1211#include <qwaitcondition.h>
  • libs/libmythtv/infostructs.cpp

     
    99#include "infostructs.h"
    1010#include "mythcontext.h"
    1111
    12 void ChannelInfo::LoadIcon(int width, int height)
     12void ChannelInfo::LoadChannelIcon(int width, int height)
    1313{
    1414    QImage tempimage(iconpath);
    1515
  • libs/libmythtv/signalmonitor.cpp

     
    99// MythTV headers
    1010#include "mythcontext.h"
    1111#include "signalmonitor.h"
     12#include "compat.h"
    1213
    1314extern "C" {
    1415#include "../libavcodec/avcodec.h"
  • libs/libmythtv/dsmcc.cpp

     
    479479    // Can we actually have more than one carousel?
    480480    for (; (car = it.current()) != NULL; ++it)
    481481    {
    482         int res = car->filecache.GetObject(objectPath, result);
     482        int res = car->filecache.GetDSMObject(objectPath, result);
    483483        if (res != -1)
    484484            return res;
    485485    }
  • libs/libmythtv/RingBuffer.cpp

     
    3131#include "livetvchain.h"
    3232#include "DVDRingBuffer.h"
    3333#include "util.h"
     34#include "compat.h"
    3435
    3536#ifndef O_STREAMING
    3637#define O_STREAMING 0
  • libs/libmythtv/vsync.cpp

     
    2222#include <unistd.h>
    2323#include <fcntl.h>
    2424
    25 #include <sys/ioctl.h>
    2625#include <sys/types.h>
    2726#include <sys/stat.h>
     27#include "compat.h"
     28
     29#ifndef _WIN32
     30#include <sys/ioctl.h>
    2831#include <sys/poll.h>
     32#endif
    2933
    3034#include <mythcontext.h>
    3135#include "mythdialogs.h" // for OpenGL VSync
     
    8690        m_forceskip = 0;
    8791    }
    8892   
     93#ifndef _WIN32
    8994    TESTVIDEOSYNC(nVidiaVideoSync);
    9095    TESTVIDEOSYNC(DRMVideoSync);
    9196    if (tryOpenGL)
    9297        TESTVIDEOSYNC(OpenGLVideoSync);
     98#endif // _WIN32
    9399#ifdef __linux__
    94100    TESTVIDEOSYNC(RTCVideoSync);
    95 #endif
     101#endif // __linux__
     102
    96103    TESTVIDEOSYNC(BusyWaitVideoSync);
    97104
    98105    tryingVideoSync=false;
     
    238245    struct drm_wait_vblank_reply reply;
    239246} drm_wait_vblank_t;
    240247
     248#ifndef _WIN32
    241249#define DRM_IOCTL_BASE                  'd'
    242250#define DRM_IOWR(nr,type)               _IOWR(DRM_IOCTL_BASE,nr,type)
    243251
    244252#define DRM_IOCTL_WAIT_VBLANK           DRM_IOWR(0x3a, drm_wait_vblank_t)
     253#endif
    245254
    246255static int drmWaitVBlank(int fd, drm_wait_vblank_t *vbl)
    247256{
     
    363372
    364373bool nVidiaVideoSync::dopoll() const
    365374{
     375#ifdef _WIN32
     376    return false;
     377#else
    366378    int ret;
    367379    struct pollfd polldata;
    368380    polldata.fd = m_nvidia_fd;
     
    377389        return false;
    378390    }
    379391    return true;
     392#endif
    380393}
    381394
    382395bool nVidiaVideoSync::TryInit(void)
     
    711724
    712725bool RTCVideoSync::TryInit(void)
    713726{
     727#ifdef _WIN32
     728    return false;
     729#else
    714730    m_rtcfd = open("/dev/rtc", O_RDONLY);
    715731    if (m_rtcfd < 0)
    716732    {
     
    735751    }
    736752   
    737753    return true;
     754#endif
    738755}
    739756
    740757void RTCVideoSync::WaitForFrame(int sync_delay)
  • libs/libmythtv/osdtypeteletext.cpp

     
    684684{
    685685    QColor color;
    686686
    687     switch (ttcolor & ~TTColor::TRANSPARENT)
     687    switch (ttcolor & ~kTTColorTransparent)
    688688    {
    689         case TTColor::BLACK:   color = OSDTypeTeletext::kColorBlack;   break;
    690         case TTColor::RED:     color = OSDTypeTeletext::kColorRed;     break;
    691         case TTColor::GREEN:   color = OSDTypeTeletext::kColorGreen;   break;
    692         case TTColor::YELLOW:  color = OSDTypeTeletext::kColorYellow;  break;
    693         case TTColor::BLUE:    color = OSDTypeTeletext::kColorBlue;    break;
    694         case TTColor::MAGENTA: color = OSDTypeTeletext::kColorMagenta; break;
    695         case TTColor::CYAN:    color = OSDTypeTeletext::kColorCyan;    break;
    696         case TTColor::WHITE:   color = OSDTypeTeletext::kColorWhite;   break;
     689        case kTTColorBlack:   color = OSDTypeTeletext::kColorBlack;   break;
     690        case kTTColorRed:     color = OSDTypeTeletext::kColorRed;     break;
     691        case kTTColorGreen:   color = OSDTypeTeletext::kColorGreen;   break;
     692        case kTTColorYellow:  color = OSDTypeTeletext::kColorYellow;  break;
     693        case kTTColorBlue:    color = OSDTypeTeletext::kColorBlue;    break;
     694        case kTTColorMagenta: color = OSDTypeTeletext::kColorMagenta; break;
     695        case kTTColorCyan:    color = OSDTypeTeletext::kColorCyan;    break;
     696        case kTTColorWhite:   color = OSDTypeTeletext::kColorWhite;   break;
    697697    }
    698698
    699699    return color;
     
    702702/** \fn OSDTypeTeletext::SetForegroundColor(int) const
    703703 *  \brief Set the font color to the given color.
    704704 *
    705  *   NOTE: TTColor::TRANSPARENT does not do anything!
     705 *   NOTE: kTTColorTransparent does not do anything!
    706706 *  \sa TTColor
    707707 */
    708708void OSDTypeTeletext::SetForegroundColor(int ttcolor) const
     
    732732    m_bgcolor_y = (uint8_t)(y);
    733733    m_bgcolor_u = (uint8_t)(127 + u);
    734734    m_bgcolor_v = (uint8_t)(127 + v);
    735     m_bgcolor_a = (ttcolor & TTColor::TRANSPARENT) ? 0x00 : 0xff;
     735    m_bgcolor_a = (ttcolor & kTTColorTransparent) ? 0x00 : 0xff;
    736736}
    737737
    738738/** \fn OSDTypeTeletext::DrawBackground(OSDSurface*,int,int) const
     
    890890    char last_ch = ' ';
    891891    char ch;
    892892
    893     uint fgcolor = TTColor::WHITE;
    894     uint bgcolor = TTColor::BLACK;
    895     uint newfgcolor = TTColor::WHITE;
    896     uint newbgcolor = TTColor::BLACK;
     893    uint fgcolor = kTTColorWhite;
     894    uint bgcolor = kTTColorBlack;
     895    uint newfgcolor = kTTColorWhite;
     896    uint newbgcolor = kTTColorBlack;
    897897
    898898    if (m_curpage_issubtitle || m_transparent)
    899899    {
    900         bgcolor    = TTColor::TRANSPARENT;
    901         newbgcolor = TTColor::TRANSPARENT;
     900        bgcolor    = kTTColorTransparent;
     901        newbgcolor = kTTColorTransparent;
    902902    }
    903903
    904904    SetForegroundColor(fgcolor);
     
    925925    {
    926926        if (startbox)
    927927        {
    928             bgcolor = TTColor::BLACK;
     928            bgcolor = kTTColorBlack;
    929929            startbox = false;
    930930        }
    931931
    932932        if (endbox)
    933933        {
    934             bgcolor = TTColor::TRANSPARENT;
     934            bgcolor = kTTColorTransparent;
    935935            endbox = false;
    936936        }
    937937
     
    982982                seperation = true;
    983983                goto ctrl;
    984984            case 0x1c: // black background
    985                 bgcolor = TTColor::BLACK;
     985                bgcolor = kTTColorBlack;
    986986                goto ctrl;
    987987            case 0x1d: // new background
    988988                bgcolor = fgcolor;
     
    10341034        if ((row != 0) || (x > 7))
    10351035        {
    10361036            if (m_transparent)
    1037                 SetBackgroundColor(TTColor::TRANSPARENT);
     1037                SetBackgroundColor(kTTColorTransparent);
    10381038
    10391039            DrawBackground(surface, x, row);
    10401040            if (doubleheight && row < (uint)kTeletextRows)
     
    11281128
    11291129void OSDTypeTeletext::DrawStatus(OSDSurface *surface) const
    11301130{
    1131     SetForegroundColor(TTColor::WHITE);
    1132     SetBackgroundColor(TTColor::BLACK);
     1131    SetForegroundColor(kTTColorWhite);
     1132    SetBackgroundColor(kTTColorBlack);
    11331133
    11341134    if (!m_transparent)
    11351135        for (int i = 0; i < 40; ++i)
     
    11441144
    11451145    if (!ttpage)
    11461146    {
    1147         SetBackgroundColor(TTColor::BLACK);
    1148         SetForegroundColor(TTColor::WHITE);
     1147        SetBackgroundColor(kTTColorBlack);
     1148        SetForegroundColor(kTTColorWhite);
    11491149
    11501150        if (!m_transparent)
    11511151            for (int i = 7; i < 40; i++)
     
    12081208        str = "  <" + str.mid(startPos * 3, 27) + " > ";
    12091209    }
    12101210
    1211     SetForegroundColor(TTColor::WHITE);
     1211    SetForegroundColor(kTTColorWhite);
    12121212    for (int x = 0; x < 11; x++)
    12131213    {
    12141214        if (m_transparent)
    1215             SetBackgroundColor(TTColor::TRANSPARENT);
     1215            SetBackgroundColor(kTTColorTransparent);
    12161216        else
    1217             SetBackgroundColor(TTColor::BLACK);
     1217            SetBackgroundColor(kTTColorBlack);
    12181218
    12191219        DrawBackground(surface, x * 3 + 7, 0);
    12201220
    12211221        if (str[x * 3] == '*')
    12221222        {
    12231223            str[x * 3] = ' ';
    1224             SetBackgroundColor(TTColor::RED);
     1224            SetBackgroundColor(kTTColorRed);
    12251225        }
    12261226
    12271227        DrawBackground(surface, x * 3 + 8, 0);
  • libs/libmythtv/tv_play.cpp

     
    4141#include "datadirect.h"
    4242#include "sourceutil.h"
    4343#include "util-osx-cocoa.h"
     44#include "compat.h"
    4445
    4546#ifndef HAVE_ROUND
    4647#define round(x) ((int) ((x) + 0.5))
  • libs/libmythtv/videooutbase.cpp

     
    2525#include "videoout_dx.h"
    2626#endif
    2727
     28#ifdef USING_D3D
     29#include "videoout_d3d.h"
     30#endif
     31
    2832#ifdef Q_OS_MACX
    2933#include "videoout_quartz.h"
    3034#endif
     
    7074    renderers += VideoOutputDirectfb::GetAllowedRenderers(codec_id, video_dim);
    7175#endif // USING_DIRECTFB
    7276
     77#ifdef USING_D3D
     78    renderers += VideoOutputD3D::GetAllowedRenderers(codec_id, video_dim);
     79#endif
     80
    7381#ifdef USING_DIRECTX
    74     renderers += VideoOutputDX::GetAllowedRenderers(coded_id, video_dim);
     82    renderers += VideoOutputDX::GetAllowedRenderers(codec_id, video_dim);
    7583#endif // USING_DIRECTX
    7684
    7785#ifdef USING_XV
     
    129137            vo = new VideoOutputDirectfb();
    130138#endif // USING_DIRECTFB
    131139
     140#ifdef USING_D3D
     141        if (renderer == "direct3d")
     142            vo = new VideoOutputD3D();
     143#endif // USING_D3D
     144
    132145#ifdef USING_DIRECTX
    133146        if (renderer == "directx")
    134147            vo = new VideoOutputDX();
  • libs/libmythtv/vsync.h

     
    197197 *  \sa http://www.ac3.edu.au/SGI_Developer/books/OpenGLonSGI/sgi_html/ch10.html#id37188
    198198 *  \sa http://www.inb.mu-luebeck.de/~boehme/xvideo_sync.html
    199199 */
     200#ifndef USING_MINGW
    200201class OpenGLVideoSync : public VideoSync
    201202{
    202203  public:
     
    217218  private:
    218219    QMutex      m_lock;
    219220};
     221#endif // USING_MINGW
    220222
    221223#ifdef __linux__
    222224/** \brief Video synchronization class employing /dev/rtc
  • libs/libmythtv/cardutil.cpp

     
    11// Standard UNIX C headers
    22#include <fcntl.h>
    3 #include <sys/ioctl.h>
    43#include <unistd.h>
    54
     5#if defined(USING_V4L) || defined(USING_DVB)
     6#include <sys/ioctl.h>
     7#endif
     8
    69// MythTV headers
    710#include "cardutil.h"
    811#include "videosource.h"
  • libs/libmythtv/fifowriter.h

     
    11#ifndef FIFOWRITER
    22#define FIFOWRITER
    33
    4 #include <vector>
     4// POSIX headers
     5#include <pthread.h>
     6
     7// Qt headers
    58#include <qstring.h>
    69#include <qmutex.h>
    710#include <qptrqueue.h>
    811
     12// MythTV headers
    913#include "mythexp.h"
    1014
    1115using namespace std;
  • libs/libmythtv/videosource.cpp

     
    33// Standard UNIX C headers
    44#include <unistd.h>
    55#include <fcntl.h>
    6 #include <sys/ioctl.h>
    76#include <sys/types.h>
    87#include <sys/stat.h>
    98
  • libs/libmythtv/frequencytables.cpp

     
    11#include "frequencies.h"
    22#include "frequencytables.h"
    33#include "channelutil.h"
     4#include "compat.h"
    45
    56freq_table_map_t frequencies;
    67
  • libs/libmythtv/udpnotify.cpp

     
    2525match they will be ignored.
    2626*/
    2727
    28 
    2928#include <cstdio>
    3029#include <cstdlib>
    3130#include <cstring>
    3231#include <unistd.h>
    3332#include <pthread.h>
    3433#include <sys/types.h>
    35 #include <sys/socket.h>
    3634
    3735#include <qapplication.h>
    3836#include <qsocketdevice.h>
    3937#include <qsocketnotifier.h>
    4038#include <qhostaddress.h>
    4139
    42 #include <iostream>
    43 using namespace std;
    44 
    4540#include "udpnotify.h"
    4641#include "mythcontext.h"
    4742#include "osd.h"
    4843#include "tv_play.h"
     44#include "compat.h"
    4945
    5046UDPNotifyOSDSet::UDPNotifyOSDSet(const QString &name)
    5147{
  • libs/libmythtv/DeviceReadBuffer.cpp

     
    44#include "DeviceReadBuffer.h"
    55#include "mythcontext.h"
    66#include "tspacket.h"
     7#include "compat.h"
    78
     9#ifndef USING_MINGW
     10#include <sys/poll.h>
     11#endif
     12
    813/// Set this to 1 to report on statistics
    914#define REPORT_RING_STATS 0
    1015
     
    282287
    283288bool DeviceReadBuffer::Poll(void) const
    284289{
     290#ifdef USING_MINGW
     291#warning mingw DeviceReadBuffer::Poll
     292    VERBOSE(VB_IMPORTANT, LOC_ERR +
     293            "mingw DeviceReadBuffer::Poll is not implemented");
     294    return false;
     295#else
    285296    bool retval = true;
    286297    while (true)
    287298    {
     
    310321        usleep(2500);
    311322    }
    312323    return retval;
     324#endif //!USING_MINGW
    313325}
    314326
    315327bool DeviceReadBuffer::CheckForErrors(ssize_t len, uint &errcnt)
    316328{
     329#ifdef USING_MINGW
     330#warning mingw DeviceReadBuffer::CheckForErrors
     331    VERBOSE(VB_IMPORTANT, LOC_ERR +
     332            "mingw DeviceReadBuffer::CheckForErrors is not implemented");
     333    return false;
     334#else
    317335    if (len < 0)
    318336    {
    319337        if (EINTR == errno)
     
    360378        return false;
    361379    }
    362380    return true;
     381#endif
    363382}
    364383
    365384/** \fn DeviceReadBuffer::Read(unsigned char*, const uint)
  • libs/libmythtv/filtermanager.h

     
    99#include <qdict.h>
    1010#include <qptrlist.h>
    1111#include <qstring.h>
    12 #include <cstdlib>
    13 #include <dlfcn.h>
    1412
    1513using namespace std;
    1614
  • libs/libmythtv/eitscanner.cpp

     
    22
    33// POSIX headers
    44#include <sys/time.h>
    5 #include <sys/resource.h>
     5#include "compat.h"
    66
    77#include <cstdlib>
    88
  • libs/libmythtv/osdsurface.cpp

     
    11#include "osdsurface.h"
    22#include "dithertable.h"
    33#include "mythcontext.h"
     4#include "compat.h"
    45
    56#include <algorithm>
    67using namespace std;
  • libs/libmythtv/dtvsignalmonitor.cpp

     
    77#include "mpegtables.h"
    88#include "atsctables.h"
    99#include "dvbtables.h"
     10#include "compat.h"
    1011
    1112#undef DBG_SM
    1213#define DBG_SM(FUNC, MSG) VERBOSE(VB_CHANNEL, \
  • libs/libmythtv/osd.cpp

     
    2626#include "textsubtitleparser.h"
    2727#include "libmyth/oldsettings.h"
    2828#include "udpnotify.h"
     29#include "compat.h"
    2930
    3031#include "osdtypeteletext.h"
    3132#include "osdlistbtntype.h"
     
    12441245        filename = themepath + filename;
    12451246
    12461247    image->SetStaticSize(scale.x(), scale.y());
    1247     image->LoadImage(filename, wmult, hmult, scale.x(), scale.y());
     1248    image->Load(filename, wmult, hmult, scale.x(), scale.y());
    12481249
    12491250    container->AddType(image);
    12501251}
     
    16461647        if (cs)
    16471648        {
    16481649            if ((infoMap.contains("iconpath")) && (infoMap["iconpath"] != ""))
    1649                 cs->LoadImage(infoMap["iconpath"], wmult, hmult, 30, 30);
     1650                cs->Load(infoMap["iconpath"], wmult, hmult, 30, 30);
    16501651            else
    1651                 cs->LoadImage(" ", wmult, hmult, 30, 30);
     1652                cs->Load(" ", wmult, hmult, 30, 30);
    16521653        }
    16531654
    16541655        m_setsvisible = true;
     
    16691670        if (cs)
    16701671        {
    16711672            if ((infoMap.contains("iconpath")) && (infoMap["iconpath"] != ""))
    1672                 cs->LoadImage(infoMap["iconpath"], wmult, hmult, 30, 30);
     1673                cs->Load(infoMap["iconpath"], wmult, hmult, 30, 30);
    16731674            else
    1674                 cs->LoadImage(" ", wmult, hmult, 30, 30);
     1675                cs->Load(" ", wmult, hmult, 30, 30);
    16751676        }
    16761677
    16771678        container->DisplayFor(length * 1000000);
     
    17251726            type->SetText(callsign.left(5));
    17261727        OSDTypeImage *cs = (OSDTypeImage *)container->GetType("channelicon");
    17271728        if (cs)
    1728             cs->LoadImage(iconpath, wmult, hmult, 30, 30);
     1729            cs->Load(iconpath, wmult, hmult, 30, 30);
    17291730
    17301731        container->DisplayFor(length * 1000000);
    17311732        m_setsvisible = true;
  • libs/libmythtv/diseqc.cpp

     
    1717#include "mythdbcon.h"
    1818#include "diseqc.h"
    1919#include "dtvmultiplex.h"
     20#include "compat.h"
    2021
    2122#ifdef USING_DVB
    2223#   include "dvbtypes.h"
  • libs/libmythtv/mhi.cpp

     
    424424    {
    425425        OSDTypeImage* image = new OSDTypeImage();
    426426        image->SetPosition(QPoint(data->m_x, data->m_y), 1.0, 1.0);
    427         image->LoadFromQImage(data->m_image);
     427        image->Load(data->m_image);
    428428        osdSet->AddType(image);
    429429    }
    430430}
  • libs/libmythtv/videodisplayprofile.cpp

     
    12821282    safe_custom += "xshm";
    12831283    safe_custom += "directfb";
    12841284    safe_custom += "directx";
     1285    safe_custom += "direct3d";
    12851286    safe_custom += "quartz-blit";
    12861287    safe_custom += "xv-blit";
    12871288    safe_custom += "opengl";
     
    13441345        safe_renderer[*it2] += "xshm";
    13451346        safe_renderer[*it2] += "directfb";
    13461347        safe_renderer[*it2] += "directx";
     1348        safe_renderer[*it2] += "direct3d";
    13471349        safe_renderer[*it2] += "quartz-blit";
    13481350        safe_renderer[*it2] += "xv-blit";
    13491351        safe_renderer[*it2] += "opengl";
     
    13671369    safe_renderer_priority["xvmc-opengl"]  = 100;
    13681370    safe_renderer_priority["directfb"]     =  60;
    13691371    safe_renderer_priority["directx"]      =  50;
     1372    safe_renderer_priority["direct3d"]     =  55;
    13701373    safe_renderer_priority["quartz-blit"]  =  70;
    13711374    safe_renderer_priority["quartz-accel"] =  80;
    13721375    safe_renderer_priority["ivtv"]         =  40;
  • libs/libmythtv/videobuffers.cpp

     
    88#include "../libavcodec/avcodec.h"
    99}
    1010#include "fourcc.h"
     11#include "compat.h"
    1112
    1213#ifdef USING_XVMC
    1314#include "videoout_xv.h" // for xvmc stuff
  • libs/libmythtv/videoout_dx.cpp

     
    1010#include "fourcc.h"
    1111
    1212#include "mmsystem.h"
    13 #ifdef CONFIG_CYGWIN
    1413#include "tv.h"
    15 #endif
    1614
     15#undef UNICODE
     16
    1717extern "C" {
    1818#include "../libavcodec/avcodec.h"
    1919}
     
    201201
    202202    MoveResize();
    203203
    204 #ifndef CONFIG_CYGWIN   
    205     if (!CreateVideoBuffers())
    206         return false;
    207 #endif
    208 
    209204    pauseFrame.height = vbuffers.GetScratchFrame()->height;
    210205    pauseFrame.width  = vbuffers.GetScratchFrame()->width;
    211206    pauseFrame.bpp    = vbuffers.GetScratchFrame()->bpp;
     
    11741169
    11751170            outputpictures = 1;
    11761171
    1177             VERBOSE(VB_IMPORTANT, "created plain surface of chroma: " << PRINT_FOURCC(chroma) );
     1172            VERBOSE(VB_IMPORTANT, "created plain surface");
    11781173        }
    11791174    }
    11801175
     
    13601355        int diff_x  = display_visible_rect.left();
    13611356        diff_x     -= display_video_rect.left();
    13621357        int diff_w  = display_video_rect.width();
    1363         diff_x     -= display_visible_rect.width()
     1358        diff_x     -= display_visible_rect.width();
    13641359
    13651360        rect_src.left  += (XJ_width * diff_x) / display_video_rect.width();
    13661361        rect_src.right -= ((XJ_width * (diff_w - diff_x)) /
     
    13831378        int diff_h  = display_video_rect.height();
    13841379        diff_h     -= display_visible_rect.height();
    13851380
    1386         rect_src.top += ((video_rect.width() * diff_x) /
     1381        rect_src.top += ((video_rect.width() * diff_y) /
    13871382                         display_video_rect.height());
    13881383
    13891384        rect_src.bottom -= (video_rect.height() * (diff_h - diff_y) /
  • libs/libavcodec/libavcodec.pro

     
    77target.path = $${LIBDIR}
    88INSTALLS = target
    99
    10 INCLUDEPATH = ../ ../../ ../libavutil ../libswscale
     10INCLUDEPATH = ./ ../ ../../ ../libavutil ../libswscale
    1111
    1212# remove MMX define since it clashes with a libmp3lame enum
    1313DEFINES -= MMX
     
    2828}
    2929
    3030cygwin:LIBS += -lz
     31mingw:target.path = $${PREFIX}/bin
    3132
    3233!profile:QMAKE_CFLAGS_DEBUG += -O
    3334
  • libs/libavcodec/rtjpeg.h

     
    2323#define FFMPEG_RTJPEG_H
    2424
    2525#include <stdint.h>
    26 #include <dsputil.h>
     26#include "dsputil.h"
    2727
    2828typedef struct {
    2929    int w, h;
  • libs/libavutil/libavutil.pro

     
    5252    QMAKE_LFLAGS_SHLIB += -single_module
    5353    QMAKE_LFLAGS_SHLIB += -seg1addr 0xC2000000
    5454}
     55
     56mingw:  target.path = $${PREFIX}/bin
  • libs/libavformat/utils.c

     
    2626#include <sys/time.h>
    2727#include <time.h>
    2828
     29#ifdef _WIN32
     30#define gmtime_r(X, Y)    (memcpy(Y, gmtime(X),    sizeof(struct tm)), Y)
     31#define localtime_r(X, Y) (memcpy(Y, localtime(X), sizeof(struct tm)), Y)
     32#endif
     33
    2934#undef NDEBUG
    3035#include <assert.h>
    3136
  • libs/libavformat/libavformat.pro

     
    1515
    1616cygwin :LIBS += -lz
    1717
     18mingw:  target.path = $${PREFIX}/bin
     19
    1820QMAKE_CLEAN += $(TARGET) $(TARGETA) $(TARGETD) $(TARGET0) $(TARGET1) $(TARGET2)
    1921
    2022# Input
     
    197199#    SOURCES            += audio-darwin.c
    198200}
    199201
     202mingw:SOURCES -= audio.c
  • libs/libmythui/mythpainter_qt.cpp

     
    44#include "mythpainter_qt.h"
    55#include "mythfontproperties.h"
    66#include "mythmainwindow.h"
     7#include "compat.h"
    78
    89class MythQtImage : public MythImage
    910{
  • libs/libmythui/mythmainwindow.cpp

     
    611611/* FIXME compatability only */
    612612void MythMainWindow::attach(QWidget *child)
    613613{
     614#ifdef USING_MINGW
     615#warning TODO FIXME MythMainWindow::attach() not implemented on MS Windows!
     616    // if windows are created on different threads,
     617    // or if setFocus() is called from a thread other than the main UI thread,
     618    // setFocus() hangs the thread that called it
     619    // currently, it's impossible to switch to program guide from livetv
     620    VERBOSE(VB_IMPORTANT,
     621            QString("MythMainWindow::attach old: %1, new: %2, thread: %3")
     622            .arg(currentWidget() ? currentWidget()->name() : "none")
     623            .arg(child->name())
     624            .arg(::GetCurrentThreadId()));
     625#endif
    614626    if (currentWidget())
    615627        currentWidget()->setEnabled(false);
    616628
     
    15061518    float floatSize = pointSize;
    15071519    float desired = 100.0;
    15081520
     1521#ifdef USING_MINGW
     1522#warning TODO FIXME DPI needs to be calculated on MS Windows systems..
     1523    int logicalDpiY = 100;
     1524#else
     1525    int logicalDpiY = pdm.logicalDpiY();
     1526#endif
     1527
    15091528    // adjust for screen resolution relative to 100 dpi
    1510     floatSize = floatSize * desired / pdm.logicalDpiY();
     1529    floatSize = floatSize * desired / logicalDpiY;
    15111530    // adjust for myth GUI size relative to 800x600
    15121531    floatSize = floatSize * d->hmult;
    15131532    // adjust by the configurable fine tuning percentage
     
    15181537    return pointSize;
    15191538}
    15201539
    1521 QFont MythMainWindow::CreateFont(const QString &face, int pointSize,
    1522                                  int weight, bool italic)
     1540QFont MythMainWindow::CreateQFont(const QString &face, int pointSize,
     1541                                  int weight, bool italic)
    15231542{
    15241543    QFont font = QFont(face);
    15251544    if (!font.exactMatch())
  • libs/libmythui/mythuitype.cpp

     
    471471        (*it)->AddFocusableChildrenToList(focusList);
    472472}
    473473
    474 QFont MythUIType::CreateFont(const QString &face, int pointSize,
    475                              int weight, bool italic)
     474QFont MythUIType::CreateQFont(const QString &face, int pointSize,
     475                              int weight, bool italic)
    476476{
    477     return GetMythMainWindow()->CreateFont(face, pointSize, weight, italic);
     477    return GetMythMainWindow()->CreateQFont(face, pointSize, weight, italic);
    478478}
    479479
    480480QRect MythUIType::NormRect(const QRect &rect)
  • libs/libmythui/mythuitext.cpp

     
    66#include "mythfontproperties.h"
    77
    88#include "mythcontext.h"
     9#include "compat.h"
    910
    1011MythUIText::MythUIText(MythUIType *parent, const char *name)
    1112          : MythUIType(parent, name)
  • libs/libmythui/myththemedmenu.cpp

     
    687687        }
    688688    }
    689689
    690     QFont font = GetMythMainWindow()->CreateFont(fontname, fontsize,
    691                                                 weight, italic);
     690    QFont font = GetMythMainWindow()->CreateQFont(
     691        fontname, fontsize, weight, italic);
    692692
    693693    attributes.font.SetFace(font);
    694694
  • libs/libmythui/mythpainter.h

     
    77
    88//  #include "mythfontproperties.h"
    99
     10#include "compat.h"
    1011
    1112class MythFontProperties;
    1213class MythImage;
  • libs/libmythui/mythpainter_qt.h

     
    33
    44#include "mythpainter.h"
    55#include "mythimage.h"
     6#include "compat.h"
    67
    78class QPainter;
    89class QPixmap;
  • libs/libmythui/mythmainwindow.h

     
    105105    QRect GetUIScreenRect();
    106106
    107107    int NormalizeFontSize(int pointSize);
    108     QFont CreateFont(const QString &face, int pointSize = 12,
    109                      int weight = QFont::Normal, bool italic = FALSE);
     108    QFont CreateQFont(const QString &face, int pointSize = 12,
     109                      int weight = QFont::Normal, bool italic = FALSE);
    110110    QRect NormRect(const QRect &rect);
    111111    QPoint NormPoint(const QPoint &point);
    112112    QSize NormSize(const QSize &size);
  • libs/libmythui/libmythui.pro

     
    7272}
    7373
    7474cygwin:DEFINES += _WIN32
     75
     76mingw {
     77    DEFINES += USING_MINGW
     78    target.path = $${PREFIX}/bin
     79    using_opengl {
     80        LIBS += -lopengl32
     81        DEFINES += USE_OPENGL_PAINTER
     82        SOURCES += mythpainter_ogl.cpp
     83        HEADERS += mythpainter_ogl.h
     84        inc.files += mythpainter_ogl.h
     85    }
     86}
  • libs/libmythui/mythuitype.h

     
    109109
    110110    int CalcAlpha(int alphamod);
    111111
    112     QFont CreateFont(const QString &face, int pointSize = 12,
    113                      int weight = QFont::Normal, bool italic = FALSE);
     112    QFont CreateQFont(const QString &face, int pointSize = 12,
     113                      int weight = QFont::Normal, bool italic = FALSE);
    114114    QRect NormRect(const QRect &rect);
    115115    QPoint NormPoint(const QPoint &point);
    116116    int NormX(const int width);
  • libs/libmyth/lcddevice.cpp

     
    77    (c) 2002, 2003 Thor Sigvaldason, Dan Morphis and Isaac Richards
    88*/
    99
    10 #include "lcddevice.h"
    11 #include "mythcontext.h"
    12 #include "mythdialogs.h"
     10// ANSI C headers
     11#include <cstdlib>
     12#include <cmath>
    1313
    14 #include "libmythui/mythmainwindow.h"
    15 
     14// POSIX headers
    1615#include <unistd.h>
    17 #ifndef USING_MINGW
    18 #include <stdlib.h>
    19 #include <sys/wait.h>   // For WIFEXITED on Mac OS X
    20 #else
    21 #include "compat.h"
    22 #endif
    23 #include <cmath>
    2416
     17// Qt headers
    2518#include <qapplication.h>
    2619#include <qregexp.h>
    2720
     21// MythTV headers
     22#include "libmythui/mythmainwindow.h"
     23#include "lcddevice.h"
     24#include "mythcontext.h"
     25#include "mythdialogs.h"
     26#include "compat.h"
    2827
    2928/*
    3029  LCD_DEVICE_DEBUG control how much debug info we get
  • libs/libmyth/util.cpp

     
    99#include <fcntl.h>
    1010
    1111// System specific C headers
     12#include "compat.h"
    1213#ifdef USING_MINGW
    1314# include <sys/types.h>
    1415# include <sys/stat.h>
    1516# include <sys/param.h>
    16 # include "compat.h"
    1717#else
    1818# include <sys/types.h>
    1919# include <sys/wait.h>
     
    857857QString createTempFile(QString name_template, bool dir)
    858858{
    859859#ifdef USING_MINGW
    860 #warning Implement createTempFile
    861         return "";
     860    char *tmp = new char[MAX_PATH+1];
     861    QFileInfo fi(name_template);
     862    ::GetTempFileNameA(fi.filePath(), fi.baseName(), 0, tmp);
     863    return QString(tmp);
    862864#else
    863865    const char *tmp = name_template.ascii();
    864866    char *ctemplate = strdup(tmp);
     
    898900#endif // USING_X11
    899901    return pixelAspect;
    900902}
     903
     904unsigned long long myth_get_approximate_large_file_size(const QString &fname)
     905{
     906    // .local8Bit() not thread-safe.. even with Qt4, make a deep copy first..
     907    QString filename = QDeepCopy<QString>(fname);
     908#ifdef USING_MINGW
     909    struct _stati64 status;
     910    _stati64(filename.local8Bit(), &status);
     911    return status.st_size;
     912#else
     913    struct stat status;
     914    stat(filename.local8Bit(), &status);
     915    // Using off_t requires a lot of 32/64 bit checking.
     916    // So just get the size in blocks.
     917    unsigned long long bsize = status.st_blksize;
     918    unsigned long long nblk  = status.st_blocks;
     919    unsigned long long approx_size = nblk * bsize;
     920    return approx_size;
     921#endif
     922}
  • libs/libmyth/compat.h

     
    1313#ifdef _WIN32
    1414#define close wsock_close
    1515#include <windows.h>
     16#include <winsock2.h>
     17#include <ws2tcpip.h>
     18#define setsockopt(a, b, c, d, e) setsockopt(a, b, c, (const char*)(d), e)
    1619#undef close
     20#else
     21#include <sys/resource.h> // for setpriority
     22#include <sys/socket.h>
     23#include <sys/wait.h>   // For WIFEXITED on Mac OS X
    1724#endif
    1825
    1926#ifdef _WIN32
     
    2229
    2330#ifdef _WIN32
    2431#undef DialogBox
     32#undef DrawText
    2533#endif
    2634
    2735// Dealing with Microsoft min/max mess:
     
    5462#endif
    5563
    5664#ifdef USING_MINGW
    57 #define gmtime_r(x, y) gmtime((x))
    58 #define localtime_r(x, y) localtime((x))
     65#define gmtime_r(X, Y)    (memcpy(Y, gmtime(X),    sizeof(struct tm)), Y)
     66#define localtime_r(X, Y) (memcpy(Y, localtime(X), sizeof(struct tm)), Y)
     67#define lseek(X,Y,Z) lseek64(X,Y,Z)
     68#define fsync(FD) 0
     69#define signal(X,Y) 0
    5970//used in videodevice only - that code is not windows-compatible anyway
    60 #define minor(x) 0
     71#define minor(X) 0
    6172#endif
    6273
    6374#if defined(__cplusplus) && defined(USING_MINGW)
     
    6980#endif // USING_MINGW
    7081
    7182#if defined(__cplusplus) && defined(USING_MINGW)
     83#define setenv(x, y, z) ::SetEnvironmentVariableA(x, y)
     84#define unsetenv(x) 0
     85#endif
     86
     87#if defined(__cplusplus) && defined(USING_MINGW)
    7288#include <pthread.h>
    7389inline bool operator==(const pthread_t& pt, const int n)
    7490{
  • libs/libmyth/util.h

     
    7777MPUBLIC long long copy(QFile &dst, QFile &src, uint block_size = 0);
    7878MPUBLIC QString createTempFile(QString name_template = "/tmp/mythtv_XXXXXX",
    7979                               bool dir = false);
     80MPUBLIC unsigned long long myth_get_approximate_large_file_size(
     81    const QString &fname);
    8082
    8183MPUBLIC double MythGetPixelAspectRatio(void);
    8284
  • libs/libmythfreemheg/libmythfreemheg.pro

     
    2424
    2525LIBS += $$EXTRA_LIBS
    2626
     27mingw {
     28    DEFINES += USING_MINGW
     29    target.path = $${PREFIX}/bin
     30}
  • libs/libmythupnp/upnptasknotify.cpp

     
    88//                                                                           
    99//////////////////////////////////////////////////////////////////////////////
    1010
    11 #include "upnp.h"
    12 #include "multicast.h"
    13 #include "broadcast.h"
     11// ANSI C headers
     12#include <cstdlib>
    1413
     14// POSIX headers
    1515#include <unistd.h>
    16 #include <stdlib.h>
     16#include <sys/time.h>
     17
     18// Qt headers
    1719#include <qstringlist.h>
    1820#include <quuid.h>
    1921#include <qdom.h>
    2022#include <qfile.h>
    21 #include <sys/time.h>
    2223
     24// MythTV headers
     25#include "upnp.h"
     26#include "multicast.h"
     27#include "broadcast.h"
     28#include "compat.h"
    2329
    2430/////////////////////////////////////////////////////////////////////////////
    2531/////////////////////////////////////////////////////////////////////////////
  • libs/libmythupnp/httpserver.cpp

     
    99//                                                                           
    1010//////////////////////////////////////////////////////////////////////////////
    1111
     12// ANSI C headers
     13#include <cmath>
     14
     15// POSIX headers
    1216#include <unistd.h>
     17#include <sys/time.h>
     18#ifndef USING_MINGW
     19#include <sys/utsname.h>
     20#endif
    1321
     22// Qt headers
    1423#include <qregexp.h>
    1524#include <qstringlist.h>
    1625#include <qtextstream.h>
    1726#include <qdatetime.h>
    18 #include <math.h>
    19 #include <sys/time.h>
    2027
    21 #include <sys/utsname.h>
    22 
     28// MythTV headers
    2329#include "httpserver.h"
    2430#include "upnputil.h"
     31#include "upnp.h" // only needed for Config... remove once config is moved.
     32#include "compat.h"
    2533
    26 #include "upnp.h"       // only needed for Config... remove once config is moved.
    27 
    2834/////////////////////////////////////////////////////////////////////////////
    2935/////////////////////////////////////////////////////////////////////////////
    3036//
     
    5157    // Build Platform String
    5258    // ----------------------------------------------------------------------
    5359
     60#ifdef USING_MINGW
     61    g_sPlatform = QString( "Windows %1.%1" )
     62        .arg(LOBYTE(LOWORD(GetVersion())))
     63        .arg(HIBYTE(LOWORD(GetVersion())));
     64#else
    5465    struct utsname uname_info;
    5566
    5667    uname( &uname_info );
    5768
    5869    g_sPlatform = QString( "%1 %2" ).arg( uname_info.sysname )
    5970                                    .arg( uname_info.release );
     71#endif
    6072
    6173    // -=>TODO: Load Config XML
    6274    // -=>TODO: Load & initialize - HttpServerExtensions
  • libs/libmythupnp/multicast.h

     
    1111#ifndef __MULTICAST_H__
    1212#define __MULTICAST_H__
    1313
     14// Qt headers
    1415#include <qsocketdevice.h>
    1516
     17// MythTV headers
     18#include "compat.h"
     19
    1620/////////////////////////////////////////////////////////////////////////////
    1721/////////////////////////////////////////////////////////////////////////////
    1822//
  • libs/libmythupnp/upnputil.cpp

     
    88//
    99//////////////////////////////////////////////////////////////////////////////
    1010
    11 #include "mythconfig.h"
    12 #include "upnputil.h"
    13 #include "upnp.h"
     11// POSIX headers
     12#include <sys/types.h>
     13#include <sys/time.h>
    1414
    15 #include <quuid.h>
    16 #include <sys/types.h>
    17 #include <sys/socket.h>
    18 #include <sys/ioctl.h>
     15#ifndef USING_MINGW
    1916#include <net/if.h>
    20 #include <netinet/in.h>
    21 #include <arpa/inet.h>
    22 #include <sys/utsname.h>
    23 #include <sys/time.h>
     17#endif // USING_MINGW
     18
     19#include "mythconfig.h" // for HAVE_GETIFADDRS
    2420#ifdef HAVE_GETIFADDRS
    2521#include <ifaddrs.h>
    2622#endif
    2723
     24// Qt headers
     25#include <quuid.h>
     26
     27// MythTV headers
     28#include "upnputil.h"
     29#include "upnp.h"
     30#include "compat.h"
     31
    2832/////////////////////////////////////////////////////////////////////////////
    2933//
    3034/////////////////////////////////////////////////////////////////////////////
     
    117121
    118122long GetIPAddressList( QStringList &sStrList )
    119123{
     124#ifdef USING_MINGW
     125    VERBOSE(VB_UPNP, QString("GetIPAddressList() not implemented in MinGW"));
     126    return 0;
     127#else
     128
    120129    sStrList.clear();
    121130
    122131    QSocketDevice socket( QSocketDevice::Datagram );
     
    179188    }
    180189
    181190    return( sStrList.count() );
     191#endif // !USING_MINGW
    182192}
    183193
    184194#endif // HAVE_GETIFADDRS
  • libs/libmythupnp/bufferedsocketdevice.h

     
    1111#ifndef __BUFFEREDSOCKETDEVICE_H__
    1212#define __BUFFEREDSOCKETDEVICE_H__
    1313
     14// Qt headers
    1415#include <qsocketdevice.h>
    15 #include <sys/socket.h>
    1616
     17// MythTV headers
    1718#include "private/qinternal_p.h"
     19#include "compat.h"
    1820
    1921/////////////////////////////////////////////////////////////////////////////
    2022/////////////////////////////////////////////////////////////////////////////
  • libs/libmythupnp/httprequest.cpp

     
    1818#include <qfileinfo.h>
    1919
    2020#include "mythconfig.h"
    21 #if defined CONFIG_DARWIN || defined CONFIG_CYGWIN || defined(__FreeBSD__)
     21#if defined CONFIG_DARWIN || defined CONFIG_CYGWIN || defined(__FreeBSD__) || defined(USING_MINGW)
    2222#include "darwin-sendfile.h"
    2323#else
    2424#define USE_SETSOCKOPT
    2525#include <sys/sendfile.h>
    2626#endif
    27 #include <sys/socket.h>
    2827#include <sys/types.h>
    2928#include <sys/stat.h>
    30 #include <netinet/tcp.h>
    3129#include <unistd.h>
    3230#include <stdlib.h>
    3331#include <fcntl.h>
    3432
     33#ifndef USING_MINGW
     34#include <netinet/tcp.h>
     35#endif
     36
    3537#include "util.h"
    3638#include "mythcontext.h"  // for VERBOSE
    3739#include "upnp.h"
     40#include "compat.h"
    3841
    3942#ifndef O_LARGEFILE
    4043#define O_LARGEFILE 0
  • libs/libmythupnp/libmythupnp.pro

     
    4040
    4141TARGETDEPS += ../libmyth/libmyth-$${MYTH_SHLIB_EXT}
    4242
     43mingw {
     44    DEFINES += USING_MINGW
     45    HEADERS += darwin-sendfile.h
     46    SOURCES += darwin-sendfile.c
     47    target.path = $${PREFIX}/bin
     48}
     49
    4350inc.path = $${PREFIX}/include/mythtv/upnp/
    4451
    4552inc.files  = httprequest.h upnp.h ssdp.h taskqueue.h bufferedsocketdevice.h
  • libs/libmythupnp/upnptasksearch.h

     
    1111#ifndef __UPNPTASKSEARCH_H__
    1212#define __UPNPTASKSEARCH_H__
    1313
    14 #include <qsocketdevice.h>
    15 
     14// POSIX headers
    1615#include <sys/types.h>
    17 #include <sys/socket.h>
     16#ifndef USING_MINGW
    1817#include <netinet/in.h>
    1918#include <arpa/inet.h>
     19#endif
    2020
     21// Qt headers
     22#include <qsocketdevice.h>
     23
     24// MythTV headers
    2125#include "upnp.h"
     26#include "compat.h"
    2227
    2328/////////////////////////////////////////////////////////////////////////////
    2429/////////////////////////////////////////////////////////////////////////////
  • libs/libmythupnp/upnptasknotify.h

     
    1111#ifndef __UPNPTASKNOTIFY_H__
    1212#define __UPNPTASKNOTIFY_H__
    1313
    14 #include <qsocketdevice.h>
    15 
     14// POSIX headers
    1615#include <sys/types.h>
    17 #include <sys/socket.h>
     16#ifdef USING_MINGW
    1817#include <netinet/in.h>
    1918#include <arpa/inet.h>
     19#endif
    2020
     21// Qt headers
     22#include <qsocketdevice.h>
     23
     24// MythTV headers
    2125#include "upnp.h"
    2226#include "multicast.h"
     27#include "compat.h"
    2328
    2429/////////////////////////////////////////////////////////////////////////////
    2530// Typedefs
  • libs/libmythupnp/httpserver.h

     
    1212#ifndef __HTTPSERVER_H__
    1313#define __HTTPSERVER_H__
    1414
     15// POSIX headers
     16#include <sys/types.h>
     17#ifdef USING_MINGW
     18#include <netinet/in.h>
     19#include <arpa/inet.h>
     20#endif
     21
     22// Qt headers
    1523#include <qthread.h>
    1624#include <qserversocket.h>
    1725#include <qsocketdevice.h>
     
    2129#include <qtimer.h>
    2230#include <qptrlist.h>
    2331
    24 #include <sys/types.h>
    25 #include <sys/socket.h>
    26 #include <netinet/in.h>
    27 #include <arpa/inet.h>
    28 
     32// MythTV headers
    2933#include "upnputil.h"
    3034#include "httprequest.h"
    3135#include "threadpool.h"
    3236#include "refcounted.h"
     37#include "compat.h"
    3338
    34 
    3539typedef struct timeval  TaskTime;
    3640
    3741class HttpWorkerThread;
  • libs/libmythupnp/taskqueue.h

     
    1111#ifndef __TASKQUEUE_H__
    1212#define __TASKQUEUE_H__
    1313
    14 #include <qthread.h>
    15 #include <qsocketdevice.h>
    16 
     14// POSIX headers
    1715#include <sys/types.h>
     16#ifndef USING_MINGW
    1817#include <sys/socket.h>
    1918#include <netinet/in.h>
    2019#include <arpa/inet.h>
     20#endif // USING_MINGW
     21
     22// C++ headers
    2123#include <map>
    2224
     25// Qt headers
     26#include <qthread.h>
     27#include <qsocketdevice.h>
     28
     29// MythTV headers
    2330#include "upnputil.h"
    2431#include "refcounted.h"
    2532
  • libs/libmythupnp/upnptasksearch.cpp

     
    1010
    1111#include "upnp.h"
    1212#include "upnptasksearch.h"
     13#include "compat.h"
    1314
    1415#include <unistd.h>
    1516#include <stdlib.h>
  • libs/libmythdvdnav/decoder.h

     
    2626#define DECODER_H_INCLUDED
    2727
    2828#include <inttypes.h>
     29
     30#ifndef USING_MINGW
    2931#include <sys/time.h>
     32#endif
    3033
    3134#include "ifo_types.h" /*  vm_cmd_t */
    3235#include "dvdnav_internal.h"
  • libs/libmythdvdnav/dvdnav_internal.h

     
    2424#ifndef DVDNAV_INTERNAL_H_INCLUDED
    2525#define DVDNAV_INTERNAL_H_INCLUDED
    2626
    27 #include "config.h"
    28 
    2927#include <stdlib.h>
    3028#include <stdio.h>
    3129#include <unistd.h>
    3230#include <limits.h>
    3331#include <string.h>
    3432
     33// MythTV headers
     34#include "mythconfig.h"
     35#include "compat.h"
     36
    3537#ifdef WIN32
    3638
    3739/* pthread_mutex_* wrapper for win32 */
  • libs/libmythdvdnav/libmythdvdnav.pro

     
    66CONFIG += thread staticlib warn_off
    77target.path = $${LIBDIR}
    88
    9 INCLUDEPATH += ../ ../../
     9INCLUDEPATH += ../ ../../ ../libmyth
    1010
    1111#build position independent code since the library is linked into a shared library
    1212QMAKE_CFLAGS += -fPIC -DPIC
     
    3636    # Globals in static libraries need special treatment on OS X
    3737    QMAKE_CFLAGS += -fno-common
    3838}
     39
     40mingw:DEFINES += STDC_HEADERS
  • libs/libmythdvdnav/dvd_input.c

     
    4848#else
    4949
    5050/* dlopening libdvdcss */
     51#include "compat.h"
     52#ifndef USING_MINGW
    5153#include <dlfcn.h>
     54#endif
    5255
    5356typedef struct dvdcss_s *dvdcss_handle;
    5457static dvdcss_handle (*DVDcss_open)  (const char *);
     
    288291#ifdef CONFIG_DARWIN
    289292  dvdcss_library = dlopen("libdvdcss.2.dylib", RTLD_LAZY);
    290293#endif
    291 #ifdef WIN32
     294#ifdef _WIN32
    292295  dvdcss_library = dlopen("libdvdcss.dll", RTLD_LAZY);
    293296#endif
    294297
  • libs/libmythdvdnav/read_cache.c

     
    2929
    3030#include "config.h"
    3131
     32#include "dvdnav_internal.h"
    3233#include "dvdnav.h"
    33 #include "dvdnav_internal.h"
    3434#include "read_cache.h"
     35
     36#include <time.h>
     37#ifndef _WIN32
    3538#include <sys/time.h>
    36 #include <time.h>
     39#endif
    3740
    3841#define READ_CACHE_CHUNKS 10
    3942
  • libs/libmythdvdnav/dvdnav.c

     
    3333
    3434#include <stdlib.h>
    3535#include <stdio.h>
     36
     37// POSIX headers
     38#ifndef _WIN32
    3639#include <sys/time.h>
     40#endif
    3741
    3842#include "remap.h"
    3943
  • programs/mythuitest/btnlisttest.cpp

     
    4646    vbuttons = new MythListButton(this, "vlist", r, true, true);
    4747
    4848    MythFontProperties fontProp;
    49     fontProp.SetFace(CreateFont("Arial", 24, QFont::Bold));
     49    fontProp.SetFace(CreateQFont("Arial", 24, QFont::Bold));
    5050    fontProp.SetColor(QColor(Qt::white));
    5151    fontProp.SetShadow(true, NormPoint(QPoint(4, 4)), QColor(Qt::black), 64);
    5252
     
    7171    hbuttons = new MythHorizListButton(this,"hlist",r,true,true, 3);
    7272
    7373    MythFontProperties fontProp;
    74     fontProp.SetFace(CreateFont("Arial", 24, QFont::Bold));
     74    fontProp.SetFace(CreateQFont("Arial", 24, QFont::Bold));
    7575    fontProp.SetColor(QColor(Qt::white));
    7676    fontProp.SetShadow(true, NormPoint(QPoint(4, 4)), QColor(Qt::black), 64);
    7777
  • programs/mythuitest/test1.cpp

     
    1515           : MythScreenType(parent, name)
    1616{
    1717    MythFontProperties fontProp1;
    18     fontProp1.SetFace(CreateFont("Arial", 48, QFont::Bold));
     18    fontProp1.SetFace(CreateQFont("Arial", 48, QFont::Bold));
    1919    fontProp1.SetColor(QColor(Qt::white));
    2020    fontProp1.SetShadow(true, NormPoint(QPoint(4, 4)), QColor(Qt::black), 64);
    2121
     
    2525    main->SetJustification(Qt::AlignCenter);
    2626
    2727    MythFontProperties fontProp;
    28     fontProp.SetFace(CreateFont("Arial", 14));
     28    fontProp.SetFace(CreateQFont("Arial", 14));
    2929    fontProp.SetColor(QColor(Qt::white));
    3030    fontProp.SetShadow(true, NormPoint(QPoint(1, 1)), QColor(Qt::black), 64);
    3131
     
    280280    image->SetPosition(NormPoint(QPoint(30, 30)));
    281281    image->Load();
    282282
    283     QFont fontFace = CreateFont("Arial", 28, QFont::Bold);
     283    QFont fontFace = CreateQFont("Arial", 28, QFont::Bold);
    284284
    285285    MythFontProperties fontProp;
    286286    fontProp.SetFace(fontFace);
  • programs/programs-libs.pro

     
    1616LIBS += -lmythupnp-$$LIBVERSION
    1717LIBS += -lmythlivemedia-$$LIBVERSION
    1818LIBS += -lmyth-$$LIBVERSION -lmythui-$$LIBVERSION $$EXTRA_LIBS
     19mingw {
     20    LIBS += -lpthread
     21    CONFIG += console
     22}
    1923
    2024TARGETDEPS += ../../libs/libmythui/libmythui-$${MYTH_SHLIB_EXT}
    2125TARGETDEPS += ../../libs/libmyth/libmyth-$${MYTH_SHLIB_EXT}
     
    2428TARGETDEPS += ../../libs/libavcodec/libmythavcodec-$${MYTH_SHLIB_EXT}
    2529TARGETDEPS += ../../libs/libavformat/libmythavformat-$${MYTH_SHLIB_EXT}
    2630TARGETDEPS += ../../libs/libmythupnp/libmythupnp-$${MYTH_SHLIB_EXT}
    27 TARGETDEPS += ../../libs/libmythlivemedia/libmythlivemedia-$${MYTH_SHLIB_EXT}
     31using_live: TARGETDEPS += ../../libs/libmythlivemedia/libmythlivemedia-$${MYTH_SHLIB_EXT}
    2832
    2933DEPENDPATH += ../.. ../../libs ../../libs/libmyth ../../libs/libmythtv
    3034DEPENDPATH += ../../libs/libavutil ../../libs/libavformat ../../libs/libsavcodec
  • programs/mythfrontend/channelrecpriority.cpp

     
    665665                if (curitem->iconpath == "none" || curitem->iconpath == "")
    666666                    curitem->iconpath = "blankicon.jpg";
    667667                if (!curitem->iconload)
    668                     curitem->LoadIcon(iconwidth, iconheight);
     668                    curitem->LoadChannelIcon(iconwidth, iconheight);
    669669                if (curitem->iconload)
    670670                    itype->SetImage(curitem->icon);
    671671            }
  • programs/mythfrontend/mediarenderer.cpp

     
    99/////////////////////////////////////////////////////////////////////////////
    1010
    1111#include "mediarenderer.h"
     12#include "compat.h"
    1213
    1314/////////////////////////////////////////////////////////////////////////////
    1415/////////////////////////////////////////////////////////////////////////////
  • programs/mythfrontend/globalsettings.cpp

     
    33// Standard UNIX C headers
    44#include <unistd.h>
    55#include <fcntl.h>
    6 #include <sys/ioctl.h>
    76#include <sys/types.h>
    87#include <sys/stat.h>
    98
     
    6867#ifdef USING_COREAUDIO
    6968    gc->addSelection("CoreAudio:", "CoreAudio:");
    7069#endif
     70#ifdef USING_DIRECTX
     71        gc->addSelection("DirectX:");
     72#endif
     73#ifdef USING_MINGW
     74        gc->addSelection("Windows:");
     75#endif
    7176    gc->addSelection("NULL", "NULL");
    7277
    7378    return gc;
     
    7984
    8085    gc->setLabel(QObject::tr("Passthrough output device"));
    8186    gc->addSelection(QObject::tr("Default"), "Default");
     87#ifndef USING_MINGW
    8288    gc->addSelection("ALSA:iec958:{ AES0 0x02 }", "ALSA:iec958:{ AES0 0x02 }");
     89#endif
    8390
    8491    gc->setHelpText(QObject::tr("Audio output device to use for AC3 and "
    8592                    "DTS passthrough. Default is the same as Audio output "
     
    117124#ifdef USING_ALSA
    118125    gc->addSelection("ALSA:default", "ALSA:default");
    119126#endif
     127#ifdef USING_DIRECTX
     128    gc->addSelection("DirectX:", "DirectX:");
     129#endif
     130#ifdef USING_WINAUDIO
     131    gc->addSelection("Windows:", "Windows:");
     132#endif
    120133
    121134    return gc;
    122135}
     
    46374650
    46384651    theme->addChild(new ThemeSelector("Theme"));
    46394652
    4640     HorizontalConfigurationGroup *grp1 =
     4653    HorizontalConfigurationGroup *hgrp1 =
    46414654        new HorizontalConfigurationGroup(false, false, false, false);
    4642     grp1->addChild(RandomTheme());
    4643     grp1->addChild(ThemeCacheSize());
    4644     theme->addChild(grp1);
     4655    hgrp1->addChild(RandomTheme());
     4656    hgrp1->addChild(ThemeCacheSize());
     4657    theme->addChild(hgrp1);
    46454658
    46464659    theme->addChild(ThemePainter());
    46474660    theme->addChild(new StyleSetting());
  • programs/mythfrontend/networkcontrol.cpp

     
    1414#include "programinfo.h"
    1515#include "remoteutil.h"
    1616#include "previewgenerator.h"
     17#include "compat.h"
    1718
    1819#define LOC QString("NetworkControl: ")
    1920#define LOC_ERR QString("NetworkControl Error: ")
  • programs/mythtranscode/replex/replex.c

     
    4242#include "avcodec.h"
    4343#include "avformat.h"
    4444
     45#ifdef USING_MINGW
     46# define S_IRGRP 0
     47# define S_IWGRP 0
     48# define S_IROTH 0
     49# define S_IWOTH 0
     50#endif
     51
    4552#ifndef O_LARGEFILE
    4653#define O_LARGEFILE 0
    4754#endif
  • programs/mythtranscode/replex/ts.c

     
    2828#include <stdint.h>
    2929#include <string.h>
    3030#include <stdio.h>
     31
     32#ifdef USING_MINGW
     33#include <winsock2.h>
     34#else
    3135#include <netinet/in.h>
     36#endif
    3237
    3338#include "ts.h"
    3439#include "element.h"
  • programs/mythtranscode/replex/pes.c

     
    2626
    2727#include <stdlib.h>
    2828#include <stdio.h>
    29 #include <netinet/in.h>
    3029#include <string.h>
    3130
     31#ifdef USING_MINGW
     32#include <winsock2.h>
     33#else
     34#include <netinet/in.h>
     35#endif
     36
    3237#include "pes.h"
    3338void printpts(int64_t pts)
    3439{
  • programs/mythtranscode/mpeg2fix.cpp

     
    1111#include <sys/stat.h>
    1212#include <fcntl.h>
    1313#include <unistd.h>
    14 #include <netinet/in.h>
    1514#include <getopt.h>
    1615#include <stdint.h>
    1716
     17#ifdef USING_MINGW
     18#include <winsock2.h>
     19#else
     20#include <netinet/in.h>
     21#endif
     22
    1823#ifndef O_LARGEFILE
    1924#define O_LARGEFILE 0
    2025#endif
  • programs/mythcommflag/BorderDetector.cpp

     
    44#include "avcodec.h"        /* AVPicture */
    55}
    66#include "mythcontext.h"    /* gContext */
     7#include "compat.h"
    78
    89#include "CommDetector2.h"
    910#include "FrameAnalyzer.h"
  • programs/mythcommflag/CommDetector2.cpp

     
    44#include <unistd.h>
    55
    66#include "NuppelVideoPlayer.h"
     7#include "compat.h"
    78
    89#include "CommDetector.h"
    910#include "CommDetector2.h"
  • programs/mythtv-setup/main.cpp

     
    1212#include <cstdio>
    1313#include <fcntl.h>
    1414#include <cstdlib>
    15 #include <sys/ioctl.h>
    1615#include <sys/types.h>
    1716
    1817#include <iostream>
  • programs/mythbackend/main.cpp

     
    11// POSIX headers
    22#include <sys/time.h>     // for setpriority
    3 #include <sys/resource.h> // for setpriority
    43
    54#include <qapplication.h>
    65#include <qsqldatabase.h>
     
    3635#include "libmyth/mythcontext.h"
    3736#include "libmyth/mythdbcon.h"
    3837#include "libmyth/exitcodes.h"
     38#include "libmyth/compat.h"
    3939#include "libmythtv/programinfo.h"
    4040#include "libmythtv/dbcheck.h"
    4141#include "libmythtv/jobqueue.h"
     
    368368
    369369int main(int argc, char **argv)
    370370{
    371     for(int i = 3; i < sysconf(_SC_OPEN_MAX) - 1; ++i)
     371#ifdef USING_MINGW
     372#warning TODO FIXME plugins leave open file descriptors on MS Windows
     373#else
     374    for (int i = 3; i < sysconf(_SC_OPEN_MAX) - 1; ++i)
    372375        close(i);
     376#endif
    373377
    374378    QApplication a(argc, argv, false);
    375379
  • programs/mythbackend/mainserver.cpp

     
    1919#elif HAVE_SOUNDCARD_H
    2020    #include <soundcard.h>
    2121#endif
     22#ifndef USING_MINGW
    2223#include <sys/ioctl.h>
     24#endif
    2325
    2426#include <list>
    2527#include <iostream>
    2628using namespace std;
    2729
    2830#include <sys/stat.h>
    29 #ifdef linux
    30 #include <sys/vfs.h>
    31 #else
    32 #include <sys/param.h>
    33 #include <sys/mount.h>
    34 #endif
     31#ifdef __linux__
     32#  include <sys/vfs.h>
     33#else // if !__linux__
     34#  include <sys/param.h>
     35#  ifndef USING_MINGW
     36#    include <sys/mount.h>
     37#  endif // USING_MINGW
     38#endif // !__linux__
    3539
    3640#include "libmyth/exitcodes.h"
    3741#include "libmyth/mythcontext.h"
     
    4650#include "autoexpire.h"
    4751#include "previewgenerator.h"
    4852#include "storagegroup.h"
     53#include "compat.h"
    4954
    5055/** Milliseconds to wait for an existing thread from
    5156 *  process request thread pool.
  • programs/mythbackend/scheduler.cpp

     
    99#include <algorithm>
    1010using namespace std;
    1111
    12 #ifdef linux
    13 #include <sys/vfs.h>
    14 #else
    15 #include <sys/param.h>
    16 #include <sys/mount.h>
    17 #include <sys/resource.h>
    18 #endif
     12#ifdef __linux__
     13#  include <sys/vfs.h>
     14#else // if !__linux__
     15#  include <sys/param.h>
     16#  ifndef USING_MINGW
     17#    include <sys/mount.h>
     18#  endif // USING_MINGW
     19#endif // !__linux__
    1920
    2021#include <sys/stat.h>
    2122#include <sys/time.h>
    2223#include <sys/types.h>
    23 #include <sys/wait.h>
    2424
    2525#include "scheduler.h"
    2626#include "encoderlink.h"
     
    3131#include "libmyth/exitcodes.h"
    3232#include "libmyth/mythcontext.h"
    3333#include "libmyth/mythdbcon.h"
     34#include "libmyth/compat.h"
    3435#include "libmythtv/programinfo.h"
    3536#include "libmythtv/scheduledrecording.h"
    3637#include "libmythtv/storagegroup.h"
  • programs/mythbackend/housekeeper.cpp

     
    11#include <unistd.h>
    22#include <sys/types.h>
    3 #include <sys/wait.h>
    43#include <unistd.h>
    54#include <qsqldatabase.h>
    65#include <qsqlquery.h>
     
    1918#include "libmyth/mythcontext.h"
    2019#include "libmyth/mythdbcon.h"
    2120#include "libmyth/util.h"
     21#include "libmyth/compat.h"
    2222
    2323#include "programinfo.h"
    2424
  • programs/mythbackend/httpstatus.cpp

     
    1515#include "libmyth/mythcontext.h"
    1616#include "libmyth/util.h"
    1717#include "libmyth/mythdbcon.h"
     18#include "libmyth/compat.h"
    1819
    1920#include <qtextstream.h>
    2021#include <qdir.h>
  • programs/mythbackend/backendutil.cpp

     
    1818#include "libmyth/mythcontext.h"
    1919#include "libmyth/mythdbcon.h"
    2020#include "libmyth/util.h"
     21#include "libmyth/compat.h"
    2122
    2223static QMap<int, int> fsID_cache;
    2324static QMutex cache_lock;
  • programs/mythbackend/autoexpire.cpp

     
    1515using namespace std;
    1616
    1717#include <sys/stat.h>
    18 #ifdef linux
    19 #include <sys/vfs.h>
    20 #else
    21 #include <sys/param.h>
    22 #include <sys/mount.h>
    23 #endif
     18#ifdef __linux__
     19#  include <sys/vfs.h>
     20#else // if !__linux__
     21#  include <sys/param.h>
     22#  ifndef USING_MINGW
     23#    include <sys/mount.h>
     24#  endif // USING_MINGW
     25#endif // !__linux__
    2426
    2527#include "autoexpire.h"
    2628#include "programinfo.h"
     
    3234#include "libmythtv/storagegroup.h"
    3335#include "encoderlink.h"
    3436#include "backendutil.h"
     37#include "compat.h"
    3538
    3639#define LOC QString("AutoExpire: ")
    3740
  • programs/mythbackend/encoderlink.cpp

     
    1515#include "previewgenerator.h"
    1616#include "storagegroup.h"
    1717#include "backendutil.h"
     18#include "compat.h"
    1819
    1920/**
    2021 * \class EncoderLink
  • programs/mythtv/main.cpp

     
    1313#include "libmyth/mythcontext.h"
    1414#include "libmyth/mythdbcon.h"
    1515#include "libmyth/mythdialogs.h"
     16#include "libmyth/compat.h"
    1617
    1718#include <iostream>
    1819using namespace std;
  • programs/mythlcdserver/main.cpp

     
    2020#include "mythcontext.h"
    2121#include "mythdbcon.h"
    2222#include "tv_play.h"
     23#include "compat.h"
    2324
    2425#include "lcdserver.h"
    2526
  • programs/mythlcdserver/lcdprocclient.cpp

     
    1919#include "tv.h"
    2020#include "lcdserver.h"
    2121#include "lcddevice.h"
     22#include "compat.h"
    2223
    23 
    2424#define LCD_START_COL 3
    2525
    2626#define LCD_VERSION_4 1
  • programs/mythwelcome/welcomedialog.cpp

     
     1// ANSI C
     2#include <cstdlib>
     3
     4// POSIX
    15#include <unistd.h>
    2 #include <stdlib.h>
    3 #include <sys/wait.h>   // For WIFEXITED on Mac OS X
    46
    57// qt
    68#include <qapplication.h>
     
    1315#include "programinfo.h"
    1416#include "uitypes.h"
    1517#include "remoteutil.h"
     18#include "compat.h"
    1619
    1720#include "welcomedialog.h"
    1821#include "welcomesettings.h"
  • programs/mythtvosd/main.cpp

     
     1// ANSI C headers
    12#include <cstdlib>
     3
     4// POSIX headers
    25#include <sys/types.h>
    3 #include <sys/socket.h>
    46
     7// C++ headers
    58#include <iostream>
    6 #include <cstdlib>
     9using namespace std;
    710
     11// Qt headers
    812#include <qapplication.h>
    913#include <qsocketdevice.h>
    1014#include <qstring.h>
     
    1216#include <qfile.h>
    1317#include <qhostaddress.h>
    1418
     19// MythTV headers
    1520#include "exitcodes.h"
     21#include "compat.h"
    1622
    17 using namespace std;
    18 
    1923const QString kalert =
    2024"<mythnotify version=\"1\">\n"
    2125"  <container name=\"notify_alert_text\">\n"
  • programs/mythshutdown/main.cpp

     
    77using namespace std;
    88#include <unistd.h>
    99
    10 #include <sys/wait.h>   // For WIFEXITED on Mac OS X
    11 
    1210#include <exitcodes.h>
    1311#include <mythcontext.h>
    1412#include <mythdbcon.h>
    1513#include "libmythtv/programinfo.h"
    1614#include "libmythtv/jobqueue.h"
    1715#include "tv.h"
     16#include "compat.h"
    1817
    1918void setGlobalSetting(const QString &key, const QString &value)
    2019{
  • programs/mythfilldatabase/filldata.cpp

     
    11// POSIX headers
    22#include <unistd.h>
    33#include <signal.h>
    4 #include <sys/wait.h>
    54
    65// Std C headers
    76#include <cstdlib>
     
    2221#include "exitcodes.h"
    2322#include "mythcontext.h"
    2423#include "mythdbcon.h"
     24#include "compat.h"
    2525
    2626// libmythtv headers
    2727#include "videosource.h" // for is_grabber..
     
    299299    if (xmltv_grabber == "schedulesdirect1")
    300300        return grabDDData(source, offset, *qCurrentDate, DD_SCHEDULES_DIRECT);
    301301
     302#ifdef USING_MINGW
     303    char tempfilename[MAX_PATH] = "";
     304    if (GetTempFileNameA("%TEMP%", "mth", 0, tempfilename) == 0)
     305#else
    302306    char tempfilename[] = "/tmp/mythXXXXXX";
    303307    if (mkstemp(tempfilename) == -1)
     308#endif
    304309    {
    305310        VERBOSE(VB_IMPORTANT,
    306311                QString("Error creating temporary file in /tmp, %1")
  • programs/mythfilldatabase/icondata.cpp

     
    11// POSIX headers
    22#include <unistd.h>
    33#include <signal.h>
    4 #include <sys/wait.h>
    54
    65// Qt headers
    76#include <qdom.h>
  • settings.pro

     
    77LIBVERSION = 0.20
    88VERSION = 0.20.0
    99
     10isEmpty(TARGET_OS) : win32 {
     11    CONFIG += mingw
     12    DEFINES -= UNICODE
     13    QMAKE_EXTENSION_SHLIB = dll
     14    VERSION =
     15    CONFIG_OPENGL_LIBS =
     16}
     17
    1018# if CYGWIN compile, set up flag in CONFIG
    1119contains(TARGET_OS, CYGWIN) {
    1220    CONFIG += cygwin
  • filters/postprocess/postprocess.pro

     
    99# Lots of symbols like pp_free_context, pp_free_mode, pp_get_context, pp_help
    1010# are used but not defined, which sometimes prevents linking on OS X.
    1111macx:LIBS += -undefined define_a_way
     12
     13mingw {
     14  SOURCES += ../../libs/libpostproc/postprocess.c
     15  TARGET = postprocess
     16}
  • filters/greedyhdeint/greedyh.asm

     
    1717/////////////////////////////////////////////////////////////////////////////
    1818
    1919#include "x86-64_macros.inc"
    20 #include <mangle.h>
     20#include "mangle.h"
    2121
    2222#if !defined(MASKS_DEFINED)
    2323#define MASKS_DEFINED