Mercurial > mplayer.hg
comparison libvo/vo_vdpau.c @ 36319:4e5239ebd43d
Avoid some code duplication.
author | reimar |
---|---|
date | Fri, 09 Aug 2013 20:11:22 +0000 |
parents | e2073bd749cf |
children | d649e84ea8d5 |
comparison
equal
deleted
inserted
replaced
36318:df2964c3d543 | 36319:4e5239ebd43d |
---|---|
343 static void preemption_callback(VdpDevice device, void *context) | 343 static void preemption_callback(VdpDevice device, void *context) |
344 { | 344 { |
345 mp_msg(MSGT_VO, MSGL_ERR, "[vdpau] Display preemption detected\n"); | 345 mp_msg(MSGT_VO, MSGL_ERR, "[vdpau] Display preemption detected\n"); |
346 is_preempted = 1; | 346 is_preempted = 1; |
347 } | 347 } |
348 | |
349 static void mark_vdpau_objects_uninitialized(void); | |
348 | 350 |
349 /* Initialize vdp_get_proc_address, called from preinit() */ | 351 /* Initialize vdp_get_proc_address, called from preinit() */ |
350 static int win_x11_init_vdpau_procs(void) | 352 static int win_x11_init_vdpau_procs(void) |
351 { | 353 { |
352 VdpStatus vdp_st; | 354 VdpStatus vdp_st; |
406 {VDP_FUNC_ID_PREEMPTION_CALLBACK_REGISTER, | 408 {VDP_FUNC_ID_PREEMPTION_CALLBACK_REGISTER, |
407 &vdp_preemption_callback_register}, | 409 &vdp_preemption_callback_register}, |
408 {0, NULL} | 410 {0, NULL} |
409 }; | 411 }; |
410 | 412 |
413 mark_vdpau_objects_uninitialized(); | |
414 | |
411 vdp_st = vdp_device_create_x11(mDisplay, mScreen, | 415 vdp_st = vdp_device_create_x11(mDisplay, mScreen, |
412 &vdp_device, &vdp_get_proc_address); | 416 &vdp_device, &vdp_get_proc_address); |
413 if (vdp_st != VDP_STATUS_OK) { | 417 if (vdp_st != VDP_STATUS_OK) { |
414 mp_msg(MSGT_VO, MSGL_ERR, "[vdpau] Error when calling vdp_device_create_x11: %i\n", vdp_st); | 418 mp_msg(MSGT_VO, MSGL_ERR, "[vdpau] Error when calling vdp_device_create_x11: %i\n", vdp_st); |
415 return -1; | 419 return -1; |
652 { | 656 { |
653 if (!is_preempted) | 657 if (!is_preempted) |
654 return 0; | 658 return 0; |
655 is_preempted = 0; | 659 is_preempted = 0; |
656 mp_msg(MSGT_VO, MSGL_INFO, "[vdpau] Attempting to recover from preemption.\n"); | 660 mp_msg(MSGT_VO, MSGL_INFO, "[vdpau] Attempting to recover from preemption.\n"); |
657 mark_vdpau_objects_uninitialized(); | |
658 if (win_x11_init_vdpau_procs() < 0 || | 661 if (win_x11_init_vdpau_procs() < 0 || |
659 win_x11_init_vdpau_flip_queue() < 0 || | 662 win_x11_init_vdpau_flip_queue() < 0 || |
660 create_vdp_mixer(vdp_chroma_type) < 0) { | 663 create_vdp_mixer(vdp_chroma_type) < 0) { |
661 mp_msg(MSGT_VO, MSGL_ERR, "[vdpau] Recovering from preemption failed\n"); | 664 mp_msg(MSGT_VO, MSGL_ERR, "[vdpau] Recovering from preemption failed\n"); |
662 is_preempted = 1; | 665 is_preempted = 1; |
1272 colorspace = 1; | 1275 colorspace = 1; |
1273 } | 1276 } |
1274 | 1277 |
1275 if (!vo_init() || win_x11_init_vdpau_procs()) | 1278 if (!vo_init() || win_x11_init_vdpau_procs()) |
1276 return -1; | 1279 return -1; |
1277 | |
1278 decoder = VDP_INVALID_HANDLE; | |
1279 for (i = 0; i < MAX_VIDEO_SURFACES; i++) | |
1280 surface_render[i].surface = VDP_INVALID_HANDLE; | |
1281 video_mixer = VDP_INVALID_HANDLE; | |
1282 for (i = 0; i <= NUM_OUTPUT_SURFACES; i++) | |
1283 output_surfaces[i] = VDP_INVALID_HANDLE; | |
1284 vdp_flip_queue = VDP_INVALID_HANDLE; | |
1285 output_surface_width = output_surface_height = -1; | |
1286 rgba_surface = VDP_INVALID_HANDLE; | |
1287 | 1280 |
1288 // full grayscale palette. | 1281 // full grayscale palette. |
1289 for (i = 0; i < PALETTE_SIZE; ++i) | 1282 for (i = 0; i < PALETTE_SIZE; ++i) |
1290 palette[i] = (i << 16) | (i << 8) | i; | 1283 palette[i] = (i << 16) | (i << 8) | i; |
1291 index_data = NULL; | 1284 index_data = NULL; |