Mercurial > mplayer.hg
comparison libvo/vo_directx.c @ 12021:cd33d1e3b709
move refreshrate and adapter_num variables to video_out because they might be usefull for other drivers, too
author | faust3 |
---|---|
date | Sat, 13 Mar 2004 16:48:52 +0000 |
parents | 1604d07d3539 |
children | ff9f315741a7 |
comparison
equal
deleted
inserted
replaced
12020:1604d07d3539 | 12021:cd33d1e3b709 |
---|---|
56 static uint32_t vm_bpp=0; | 56 static uint32_t vm_bpp=0; |
57 static uint32_t dstride; //surface stride | 57 static uint32_t dstride; //surface stride |
58 static uint32_t nooverlay = 0; //NonOverlay mode | 58 static uint32_t nooverlay = 0; //NonOverlay mode |
59 static DWORD destcolorkey; //colorkey for our surface | 59 static DWORD destcolorkey; //colorkey for our surface |
60 static COLORREF windowcolor = RGB(0,0,16); //windowcolor == colorkey | 60 static COLORREF windowcolor = RGB(0,0,16); //windowcolor == colorkey |
61 int adapter_num=0; | |
62 int refresh_rate=0; | |
63 static int adapter_count=0; | 61 static int adapter_count=0; |
64 static GUID selected_guid; | 62 static GUID selected_guid; |
65 static GUID *selected_guid_ptr = NULL; | 63 static GUID *selected_guid_ptr = NULL; |
66 | 64 |
67 extern void mplayer_put_key(int code); //let mplayer handel the keyevents | 65 extern void mplayer_put_key(int code); //let mplayer handel the keyevents |
178 DDSURFACEDESC2 ddsd; | 176 DDSURFACEDESC2 ddsd; |
179 //cleanup | 177 //cleanup |
180 if(g_lpddsPrimary)g_lpddsPrimary->lpVtbl->Release(g_lpddsPrimary); | 178 if(g_lpddsPrimary)g_lpddsPrimary->lpVtbl->Release(g_lpddsPrimary); |
181 g_lpddsPrimary=NULL; | 179 g_lpddsPrimary=NULL; |
182 | 180 |
183 if(vidmode)g_lpdd->lpVtbl->SetDisplayMode(g_lpdd,vm_width,vm_height,vm_bpp,refresh_rate,0); | 181 if(vidmode)g_lpdd->lpVtbl->SetDisplayMode(g_lpdd,vm_width,vm_height,vm_bpp,vo_refresh_rate,0); |
184 ZeroMemory(&ddsd, sizeof(ddsd)); | 182 ZeroMemory(&ddsd, sizeof(ddsd)); |
185 ddsd.dwSize = sizeof(ddsd); | 183 ddsd.dwSize = sizeof(ddsd); |
186 //set flags and create a primary surface. | 184 //set flags and create a primary surface. |
187 ddsd.dwFlags = DDSD_CAPS; | 185 ddsd.dwFlags = DDSD_CAPS; |
188 ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE; | 186 ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE; |
344 else | 342 else |
345 { | 343 { |
346 mp_msg(MSGT_VO, MSGL_INFO ,"%s", lpDriverDescription); | 344 mp_msg(MSGT_VO, MSGL_INFO ,"%s", lpDriverDescription); |
347 } | 345 } |
348 | 346 |
349 if(adapter_count == adapter_num){ | 347 if(adapter_count == vo_adapter_num){ |
350 if (!lpGUID) | 348 if (!lpGUID) |
351 selected_guid_ptr = NULL; | 349 selected_guid_ptr = NULL; |
352 else | 350 else |
353 { | 351 { |
354 selected_guid = *lpGUID; | 352 selected_guid = *lpGUID; |
378 { | 376 { |
379 mp_msg(MSGT_VO, MSGL_FATAL,"<vo_directx><FATAL ERROR>failed loading ddraw.dll\n" ); | 377 mp_msg(MSGT_VO, MSGL_FATAL,"<vo_directx><FATAL ERROR>failed loading ddraw.dll\n" ); |
380 return 1; | 378 return 1; |
381 } | 379 } |
382 | 380 |
383 if(adapter_num){ //display other than default | 381 if(vo_adapter_num){ //display other than default |
384 OurDirectDrawEnumerateEx = (LPDIRECTDRAWENUMERATEEX) GetProcAddress(hddraw_dll,"DirectDrawEnumerateExA"); | 382 OurDirectDrawEnumerateEx = (LPDIRECTDRAWENUMERATEEX) GetProcAddress(hddraw_dll,"DirectDrawEnumerateExA"); |
385 if (!OurDirectDrawEnumerateEx){ | 383 if (!OurDirectDrawEnumerateEx){ |
386 FreeLibrary( hddraw_dll ); | 384 FreeLibrary( hddraw_dll ); |
387 hddraw_dll = NULL; | 385 hddraw_dll = NULL; |
388 mp_msg(MSGT_VO, MSGL_FATAL,"<vo_directx><FATAL ERROR>failed geting proc address: DirectDrawEnumerateEx\n"); | 386 mp_msg(MSGT_VO, MSGL_FATAL,"<vo_directx><FATAL ERROR>failed geting proc address: DirectDrawEnumerateEx\n"); |
391 } | 389 } |
392 | 390 |
393 // enumerate all display devices attached to the desktop | 391 // enumerate all display devices attached to the desktop |
394 OurDirectDrawEnumerateEx(EnumCallbackEx, NULL, DDENUM_ATTACHEDSECONDARYDEVICES ); | 392 OurDirectDrawEnumerateEx(EnumCallbackEx, NULL, DDENUM_ATTACHEDSECONDARYDEVICES ); |
395 | 393 |
396 if(adapter_num >= adapter_count) | 394 if(vo_adapter_num >= adapter_count) |
397 mp_msg(MSGT_VO, MSGL_ERR,"Selected adapter (%d) doesn't exist: Default Display Adapter selected\n",adapter_num); | 395 mp_msg(MSGT_VO, MSGL_ERR,"Selected adapter (%d) doesn't exist: Default Display Adapter selected\n",vo_adapter_num); |
398 } | 396 } |
399 | 397 |
400 OurDirectDrawCreateEx = (void *)GetProcAddress(hddraw_dll, "DirectDrawCreateEx"); | 398 OurDirectDrawCreateEx = (void *)GetProcAddress(hddraw_dll, "DirectDrawCreateEx"); |
401 if ( OurDirectDrawCreateEx == NULL ) | 399 if ( OurDirectDrawCreateEx == NULL ) |
402 { | 400 { |
444 if(g_lpdd->lpVtbl->SetDisplayMode(g_lpdd,vm_width, vm_height, vm_bpp,0,0) != DD_OK) | 442 if(g_lpdd->lpVtbl->SetDisplayMode(g_lpdd,vm_width, vm_height, vm_bpp,0,0) != DD_OK) |
445 { | 443 { |
446 mp_msg(MSGT_VO, MSGL_FATAL,"<vo_directx><FATAL ERROR>can't set displaymode\n"); | 444 mp_msg(MSGT_VO, MSGL_FATAL,"<vo_directx><FATAL ERROR>can't set displaymode\n"); |
447 return 1; | 445 return 1; |
448 } | 446 } |
449 mp_msg(MSGT_VO, MSGL_V,"<vo_directx><INFO>Inited adapter %i for %i x %i @ %i \n",adapter_num,vm_width,vm_height,vm_bpp); | 447 mp_msg(MSGT_VO, MSGL_V,"<vo_directx><INFO>Inited adapter %i for %i x %i @ %i \n",vo_adapter_num,vm_width,vm_height,vm_bpp); |
450 return 0; | 448 return 0; |
451 } | 449 } |
452 if (g_lpdd->lpVtbl->SetCooperativeLevel(g_lpdd, hWnd, DDSCL_NORMAL) != DD_OK) // or DDSCL_SETFOCUSWINDOW | 450 if (g_lpdd->lpVtbl->SetCooperativeLevel(g_lpdd, hWnd, DDSCL_NORMAL) != DD_OK) // or DDSCL_SETFOCUSWINDOW |
453 { | 451 { |
454 mp_msg(MSGT_VO, MSGL_FATAL,"<vo_directx><FATAL ERROR>could not set cooperativelevel for hardwarecheck\n"); | 452 mp_msg(MSGT_VO, MSGL_FATAL,"<vo_directx><FATAL ERROR>could not set cooperativelevel for hardwarecheck\n"); |