[MPlayer-cvslog] r32059 - trunk/libvo/vo_vdpau.c
cehoyos
subversion at mplayerhq.hu
Wed Sep 8 00:03:29 CEST 2010
Author: cehoyos
Date: Wed Sep 8 00:03:29 2010
New Revision: 32059
Log:
Factorize some initialisation code.
This also fixes a possible invalid memory access present since r29052,
reported by Dan Oscarsson.
Modified:
trunk/libvo/vo_vdpau.c
Modified: trunk/libvo/vo_vdpau.c
==============================================================================
--- trunk/libvo/vo_vdpau.c Tue Sep 7 22:26:37 2010 (r32058)
+++ trunk/libvo/vo_vdpau.c Wed Sep 8 00:03:29 2010 (r32059)
@@ -521,16 +521,12 @@ static int create_vdp_mixer(VdpChromaTyp
return 0;
}
-// Free everything specific to a certain video file
-static void free_video_specific(void)
+static void mark_invalid(void)
{
int i;
- VdpStatus vdp_st;
- if (decoder != VDP_INVALID_HANDLE)
- vdp_decoder_destroy(decoder);
decoder = VDP_INVALID_HANDLE;
- decoder_max_refs = -1;
+ video_mixer = VDP_INVALID_HANDLE;
for (i = 0; i < 3; i++)
deint_surfaces[i] = VDP_INVALID_HANDLE;
@@ -540,6 +536,17 @@ static void free_video_specific(void)
deint_mpi[i]->usage_count--;
deint_mpi[i] = NULL;
}
+}
+
+// Free everything specific to a certain video file
+static void free_video_specific(void)
+{
+ int i;
+ VdpStatus vdp_st;
+
+ if (decoder != VDP_INVALID_HANDLE)
+ vdp_decoder_destroy(decoder);
+ decoder_max_refs = -1;
for (i = 0; i < MAX_VIDEO_SURFACES; i++) {
if (surface_render[i].surface != VDP_INVALID_HANDLE) {
@@ -553,7 +560,7 @@ static void free_video_specific(void)
vdp_st = vdp_video_mixer_destroy(video_mixer);
CHECK_ST_WARNING("Error when calling vdp_video_mixer_destroy")
}
- video_mixer = VDP_INVALID_HANDLE;
+ mark_invalid();
}
static int create_vdp_decoder(uint32_t format, uint32_t width, uint32_t height,
@@ -603,16 +610,8 @@ static void mark_vdpau_objects_uninitial
{
int i;
- decoder = VDP_INVALID_HANDLE;
for (i = 0; i < MAX_VIDEO_SURFACES; i++)
surface_render[i].surface = VDP_INVALID_HANDLE;
- for (i = 0; i < 3; i++) {
- deint_surfaces[i] = VDP_INVALID_HANDLE;
- if (i < 2 && deint_mpi[i])
- deint_mpi[i]->usage_count--;
- deint_mpi[i] = NULL;
- }
- video_mixer = VDP_INVALID_HANDLE;
vdp_flip_queue = VDP_INVALID_HANDLE;
vdp_flip_target = VDP_INVALID_HANDLE;
for (i = 0; i <= NUM_OUTPUT_SURFACES; i++)
@@ -623,6 +622,7 @@ static void mark_vdpau_objects_uninitial
output_surface_width = output_surface_height = -1;
eosd_render_count = 0;
visible_buf = 0;
+ mark_invalid();
}
static int handle_preemption(void)
More information about the MPlayer-cvslog
mailing list