Ignore:
Timestamp:
May 8, 2002, 1:26:30 PM (23 years ago)
Author:
sandervl
Message:

merge with latest Wine

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/comctl32/animate.c

    r6709 r8382  
    55 * Copyright 1998, 1999 Eric Kohl
    66 *                 1999 Eric Pouech
     7 *
     8 * This library is free software; you can redistribute it and/or
     9 * modify it under the terms of the GNU Lesser General Public
     10 * License as published by the Free Software Foundation; either
     11 * version 2.1 of the License, or (at your option) any later version.
     12 *
     13 * This library is distributed in the hope that it will be useful,
     14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
     15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
     16 * Lesser General Public License for more details.
     17 *
     18 * You should have received a copy of the GNU Lesser General Public
     19 * License along with this library; if not, write to the Free Software
     20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    721 *
    822 * NOTES
     
    2034#include "vfw.h"
    2135#include "mmsystem.h"
    22 #include "debugtools.h"
     36#include "wine/debug.h"
     37
     38WINE_DEFAULT_DEBUG_CHANNEL(animate);
     39
     40static struct {
     41    HMODULE     hModule;
    2342#ifdef __WIN32OS2__
    24 #include "ccbase.h"
     43    HIC         (* WINAPI fnICOpen)(DWORD, DWORD, UINT);
     44    LRESULT     (* WINAPI fnICClose)(HIC);
     45    LRESULT     (* WINAPI fnICSendMessage)(HIC, UINT, DWORD, DWORD);
     46    DWORD       (* WINAPIV fnICDecompress)(HIC,DWORD,LPBITMAPINFOHEADER,LPVOID,LPBITMAPINFOHEADER,LPVOID);
     47#else
     48    HIC         (WINAPI *fnICOpen)(DWORD, DWORD, UINT);
     49    LRESULT     (WINAPI *fnICClose)(HIC);
     50    LRESULT     (WINAPI *fnICSendMessage)(HIC, UINT, DWORD, DWORD);
     51    DWORD       (WINAPIV *fnICDecompress)(HIC,DWORD,LPBITMAPINFOHEADER,LPVOID,LPBITMAPINFOHEADER,LPVOID);
    2552#endif
    26 
    27 DEFAULT_DEBUG_CHANNEL(animate);
     53} fnIC;
    2854
    2955typedef struct
    3056{
    31 #ifdef __WIN32OS2__
    32    COMCTL32_HEADER      header;
    33 #endif
    3457   /* reference to input stream (file or resource) */
    3558   HGLOBAL              hRes;
     
    7194}
    7295
    73 #ifdef __WIN32OS2__
    74 static BOOL ANIMATE_LoadRes(ANIMATE_INFO *infoPtr,HINSTANCE hInst,LPWSTR lpName,BOOL unicode)
    75 #else
    7696static BOOL ANIMATE_LoadResA(ANIMATE_INFO *infoPtr, HINSTANCE hInst, LPSTR lpName)
    77 #endif
    7897{
    7998    HRSRC       hrsrc;
     
    81100    LPVOID      lpAvi;
    82101   
    83 #ifdef __WIN32OS2__
    84     if (unicode)
    85       hrsrc = FindResourceW(hInst,lpName,(LPWSTR)L"AVI");
    86     else
    87       hrsrc = FindResourceA(hInst,(LPCSTR)lpName,"AVI");
    88 #else
    89102    hrsrc = FindResourceA(hInst, lpName, "AVI");
    90 #endif
    91103    if (!hrsrc)
    92104        return FALSE;
     
    114126
    115127
    116 #ifdef __WIN32OS2__
    117 static BOOL ANIMATE_LoadFile(ANIMATE_INFO *infoPtr,LPWSTR lpName,BOOL unicode)
    118 #else
    119128static BOOL ANIMATE_LoadFileA(ANIMATE_INFO *infoPtr, LPSTR lpName)
    120 #endif
    121 {
    122 #ifdef __WIN32OS2__
    123     if (unicode)
    124       infoPtr->hMMio = mmioOpenW(lpName,NULL,MMIO_ALLOCBUF | MMIO_READ | MMIO_DENYWRITE);
    125     else
    126       infoPtr->hMMio = mmioOpenA((LPSTR)lpName,NULL,MMIO_ALLOCBUF | MMIO_READ | MMIO_DENYWRITE);
    127 #else
     129{
    128130    infoPtr->hMMio = mmioOpenA((LPSTR)lpName, NULL,
    129131                               MMIO_ALLOCBUF | MMIO_READ | MMIO_DENYWRITE);
    130 #endif
     132   
    131133    if (!infoPtr->hMMio)
    132134        return FALSE;
     
    174176        }
    175177        if (infoPtr->hic) {
    176             ICClose(infoPtr->hic);
     178            fnIC.fnICClose(infoPtr->hic);
    177179            infoPtr->hic = 0;
    178180        }
     
    348350   
    349351    if (infoPtr->hic &&
    350         ICDecompress(infoPtr->hic, 0, infoPtr->inbih, infoPtr->indata,
     352        fnIC.fnICDecompress(infoPtr->hic, 0, infoPtr->inbih, infoPtr->indata,
    351353                     infoPtr->outbih, infoPtr->outdata) != ICERR_OK) {
    352354        LeaveCriticalSection(&infoPtr->cs);
     
    636638    /* check uncompressed AVI */
    637639    if ((infoPtr->ash.fccHandler == mmioFOURCC('D', 'I', 'B', ' ')) ||
    638        (infoPtr->ash.fccHandler == mmioFOURCC('R', 'L', 'E', ' ')))
     640       (infoPtr->ash.fccHandler == mmioFOURCC('R', 'L', 'E', ' ')) ||
     641       (infoPtr->ash.fccHandler == mmioFOURCC(0, 0, 0, 0)))
    639642    {
    640643        infoPtr->hic = 0;             
     
    643646
    644647    /* try to get a decompressor for that type */
    645     infoPtr->hic = ICOpen(ICTYPE_VIDEO, infoPtr->ash.fccHandler, ICMODE_DECOMPRESS);
     648    infoPtr->hic = fnIC.fnICOpen(ICTYPE_VIDEO, infoPtr->ash.fccHandler, ICMODE_DECOMPRESS);
    646649    if (!infoPtr->hic) {
    647650        WARN("Can't load codec for the file\n");
     
    649652    }
    650653   
    651     outSize = ICSendMessage(infoPtr->hic, ICM_DECOMPRESS_GET_FORMAT,
     654    outSize = fnIC.fnICSendMessage(infoPtr->hic, ICM_DECOMPRESS_GET_FORMAT,
    652655                            (DWORD)infoPtr->inbih, 0L);
    653656
     
    658661    }
    659662
    660     if (ICSendMessage(infoPtr->hic, ICM_DECOMPRESS_GET_FORMAT,
     663    if (fnIC.fnICSendMessage(infoPtr->hic, ICM_DECOMPRESS_GET_FORMAT,
    661664                      (DWORD)infoPtr->inbih, (DWORD)infoPtr->outbih) != ICERR_OK) {
    662665        WARN("Can't get output BIH\n");
     
    670673    }
    671674
    672     if (ICSendMessage(infoPtr->hic, ICM_DECOMPRESS_BEGIN,
     675    if (fnIC.fnICSendMessage(infoPtr->hic, ICM_DECOMPRESS_BEGIN,
    673676                      (DWORD)infoPtr->inbih, (DWORD)infoPtr->outbih) != ICERR_OK) {
    674677        WARN("Can't begin decompression\n");
     
    679682}
    680683
    681 #ifdef __WIN32OS2__
    682 static LRESULT ANIMATE_Open(HWND hWnd, WPARAM wParam, LPARAM lParam,BOOL unicode)
    683 #else
    684684static LRESULT ANIMATE_OpenA(HWND hWnd, WPARAM wParam, LPARAM lParam)
    685 #endif
    686685{
    687686    ANIMATE_INFO *infoPtr = ANIMATE_GetInfoPtr(hWnd);
     
    689688
    690689    ANIMATE_Free(infoPtr);
     690    infoPtr->hWnd = hWnd;
    691691
    692692    if (!lParam) {
     
    698698       hInstance = GetWindowLongA(hWnd, GWL_HINSTANCE);
    699699
    700 #ifdef __WIN32OS2__
    701     if (HIWORD(lParam)) {
    702         //TRACE("(\"%s\");\n", (LPSTR)lParam);
    703 
    704         if (!ANIMATE_LoadRes(infoPtr, hInstance, (LPWSTR)lParam,unicode)) {
    705             TRACE("No AVI resource found!\n");
    706             if (!ANIMATE_LoadFile(infoPtr, (LPWSTR)lParam,unicode)) {
    707                 WARN("No AVI file found!\n");
    708                 return FALSE;
    709             }
    710         }
    711     } else {
    712         //TRACE("(%u);\n", (WORD)LOWORD(lParam));
    713 
    714         if (!ANIMATE_LoadRes(infoPtr,hInstance,unicode ? MAKEINTRESOURCEW((INT)lParam):(LPWSTR)MAKEINTRESOURCEA((INT)lParam),unicode)) {
    715             WARN("No AVI resource found!\n");
    716             return FALSE;
    717         }
    718     }
    719 #else
    720700    if (HIWORD(lParam)) {
    721701        TRACE("(\"%s\");\n", (LPSTR)lParam);
     
    737717        }
    738718    }
    739 #endif
     719
    740720    if (!ANIMATE_GetAviInfo(infoPtr)) {
    741721        WARN("Can't get AVI information\n");
     
    782762    ANIMATE_INFO*       infoPtr;
    783763
     764    if (!fnIC.hModule) /* FIXME: not thread safe */
     765    {
     766        /* since there's a circular dep between msvfw32 and comctl32, we could either:
     767         * - fix the build chain to allow this circular dep
     768         * - handle it by hand
     769         * AJ wants the latter :-(
     770         */
     771        fnIC.hModule = LoadLibraryA("msvfw32.dll");
     772        if (!fnIC.hModule) return FALSE;
     773
     774        fnIC.fnICOpen        = (void*)GetProcAddress(fnIC.hModule, "ICOpen");
     775        fnIC.fnICClose       = (void*)GetProcAddress(fnIC.hModule, "ICClose");
     776        fnIC.fnICSendMessage = (void*)GetProcAddress(fnIC.hModule, "ICSendMessage");
     777        fnIC.fnICDecompress  = (void*)GetProcAddress(fnIC.hModule, "ICDecompress");
     778    }
     779
    784780    /* allocate memory for info structure */
    785 #ifdef __WIN32OS2__
    786     infoPtr = (ANIMATE_INFO*)initControl(hWnd,sizeof(ANIMATE_INFO));
    787 #else
    788781    infoPtr = (ANIMATE_INFO *)COMCTL32_Alloc(sizeof(ANIMATE_INFO));
    789 #endif
    790782    if (!infoPtr) {
    791783        ERR("could not allocate info memory!\n");
     
    854846    switch (uMsg)
    855847    {
    856 #ifdef __WIN32OS2__
    857     case ACM_OPENA:
    858         return ANIMATE_Open(hWnd,wParam,lParam,FALSE);
    859 
    860     case ACM_OPENW:
    861         return ANIMATE_Open(hWnd,wParam,lParam,TRUE);
    862 #else
    863848    case ACM_OPENA:
    864849        return ANIMATE_OpenA(hWnd, wParam, lParam);
     
    866851        /*      case ACM_OPEN32W: FIXME!! */
    867852        /*          return ANIMATE_Open32W(hWnd, wParam, lParam); */
    868 #endif
    869853       
    870854    case ACM_PLAY:
     
    944928            ERR("unknown msg %04x wp=%08x lp=%08lx\n", uMsg, wParam, lParam);
    945929       
    946 #ifdef __WIN32OS2__
    947         return defComCtl32ProcA (hWnd, uMsg, wParam, lParam);
    948 #else
    949930        return DefWindowProcA(hWnd, uMsg, wParam, lParam);
    950 #endif
    951931    }
    952932    return 0;
    953933}
    954 
    955934
    956935void ANIMATE_Register(void)
Note: See TracChangeset for help on using the changeset viewer.