Changeset 8382 for trunk/src/comctl32/animate.c
- Timestamp:
- May 8, 2002, 1:26:30 PM (23 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/comctl32/animate.c
r6709 r8382 5 5 * Copyright 1998, 1999 Eric Kohl 6 6 * 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 7 21 * 8 22 * NOTES … … 20 34 #include "vfw.h" 21 35 #include "mmsystem.h" 22 #include "debugtools.h" 36 #include "wine/debug.h" 37 38 WINE_DEFAULT_DEBUG_CHANNEL(animate); 39 40 static struct { 41 HMODULE hModule; 23 42 #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); 25 52 #endif 26 27 DEFAULT_DEBUG_CHANNEL(animate); 53 } fnIC; 28 54 29 55 typedef struct 30 56 { 31 #ifdef __WIN32OS2__32 COMCTL32_HEADER header;33 #endif34 57 /* reference to input stream (file or resource) */ 35 58 HGLOBAL hRes; … … 71 94 } 72 95 73 #ifdef __WIN32OS2__74 static BOOL ANIMATE_LoadRes(ANIMATE_INFO *infoPtr,HINSTANCE hInst,LPWSTR lpName,BOOL unicode)75 #else76 96 static BOOL ANIMATE_LoadResA(ANIMATE_INFO *infoPtr, HINSTANCE hInst, LPSTR lpName) 77 #endif78 97 { 79 98 HRSRC hrsrc; … … 81 100 LPVOID lpAvi; 82 101 83 #ifdef __WIN32OS2__84 if (unicode)85 hrsrc = FindResourceW(hInst,lpName,(LPWSTR)L"AVI");86 else87 hrsrc = FindResourceA(hInst,(LPCSTR)lpName,"AVI");88 #else89 102 hrsrc = FindResourceA(hInst, lpName, "AVI"); 90 #endif91 103 if (!hrsrc) 92 104 return FALSE; … … 114 126 115 127 116 #ifdef __WIN32OS2__117 static BOOL ANIMATE_LoadFile(ANIMATE_INFO *infoPtr,LPWSTR lpName,BOOL unicode)118 #else119 128 static 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 { 128 130 infoPtr->hMMio = mmioOpenA((LPSTR)lpName, NULL, 129 131 MMIO_ALLOCBUF | MMIO_READ | MMIO_DENYWRITE); 130 #endif 132 131 133 if (!infoPtr->hMMio) 132 134 return FALSE; … … 174 176 } 175 177 if (infoPtr->hic) { 176 ICClose(infoPtr->hic);178 fnIC.fnICClose(infoPtr->hic); 177 179 infoPtr->hic = 0; 178 180 } … … 348 350 349 351 if (infoPtr->hic && 350 ICDecompress(infoPtr->hic, 0, infoPtr->inbih, infoPtr->indata,352 fnIC.fnICDecompress(infoPtr->hic, 0, infoPtr->inbih, infoPtr->indata, 351 353 infoPtr->outbih, infoPtr->outdata) != ICERR_OK) { 352 354 LeaveCriticalSection(&infoPtr->cs); … … 636 638 /* check uncompressed AVI */ 637 639 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))) 639 642 { 640 643 infoPtr->hic = 0; … … 643 646 644 647 /* 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); 646 649 if (!infoPtr->hic) { 647 650 WARN("Can't load codec for the file\n"); … … 649 652 } 650 653 651 outSize = ICSendMessage(infoPtr->hic, ICM_DECOMPRESS_GET_FORMAT,654 outSize = fnIC.fnICSendMessage(infoPtr->hic, ICM_DECOMPRESS_GET_FORMAT, 652 655 (DWORD)infoPtr->inbih, 0L); 653 656 … … 658 661 } 659 662 660 if ( ICSendMessage(infoPtr->hic, ICM_DECOMPRESS_GET_FORMAT,663 if (fnIC.fnICSendMessage(infoPtr->hic, ICM_DECOMPRESS_GET_FORMAT, 661 664 (DWORD)infoPtr->inbih, (DWORD)infoPtr->outbih) != ICERR_OK) { 662 665 WARN("Can't get output BIH\n"); … … 670 673 } 671 674 672 if ( ICSendMessage(infoPtr->hic, ICM_DECOMPRESS_BEGIN,675 if (fnIC.fnICSendMessage(infoPtr->hic, ICM_DECOMPRESS_BEGIN, 673 676 (DWORD)infoPtr->inbih, (DWORD)infoPtr->outbih) != ICERR_OK) { 674 677 WARN("Can't begin decompression\n"); … … 679 682 } 680 683 681 #ifdef __WIN32OS2__682 static LRESULT ANIMATE_Open(HWND hWnd, WPARAM wParam, LPARAM lParam,BOOL unicode)683 #else684 684 static LRESULT ANIMATE_OpenA(HWND hWnd, WPARAM wParam, LPARAM lParam) 685 #endif686 685 { 687 686 ANIMATE_INFO *infoPtr = ANIMATE_GetInfoPtr(hWnd); … … 689 688 690 689 ANIMATE_Free(infoPtr); 690 infoPtr->hWnd = hWnd; 691 691 692 692 if (!lParam) { … … 698 698 hInstance = GetWindowLongA(hWnd, GWL_HINSTANCE); 699 699 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 #else720 700 if (HIWORD(lParam)) { 721 701 TRACE("(\"%s\");\n", (LPSTR)lParam); … … 737 717 } 738 718 } 739 #endif 719 740 720 if (!ANIMATE_GetAviInfo(infoPtr)) { 741 721 WARN("Can't get AVI information\n"); … … 782 762 ANIMATE_INFO* infoPtr; 783 763 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 784 780 /* allocate memory for info structure */ 785 #ifdef __WIN32OS2__786 infoPtr = (ANIMATE_INFO*)initControl(hWnd,sizeof(ANIMATE_INFO));787 #else788 781 infoPtr = (ANIMATE_INFO *)COMCTL32_Alloc(sizeof(ANIMATE_INFO)); 789 #endif790 782 if (!infoPtr) { 791 783 ERR("could not allocate info memory!\n"); … … 854 846 switch (uMsg) 855 847 { 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 #else863 848 case ACM_OPENA: 864 849 return ANIMATE_OpenA(hWnd, wParam, lParam); … … 866 851 /* case ACM_OPEN32W: FIXME!! */ 867 852 /* return ANIMATE_Open32W(hWnd, wParam, lParam); */ 868 #endif869 853 870 854 case ACM_PLAY: … … 944 928 ERR("unknown msg %04x wp=%08x lp=%08lx\n", uMsg, wParam, lParam); 945 929 946 #ifdef __WIN32OS2__947 return defComCtl32ProcA (hWnd, uMsg, wParam, lParam);948 #else949 930 return DefWindowProcA(hWnd, uMsg, wParam, lParam); 950 #endif951 931 } 952 932 return 0; 953 933 } 954 955 934 956 935 void ANIMATE_Register(void)
Note:
See TracChangeset
for help on using the changeset viewer.