mp_msg.c: Avoid out-of-bounds read if empty string is printed
[mplayer/glamo.git] / TOOLS / vdpau_functions.py
blob098e30a251fc32946d15a3f815659a93c3d0024d
1 # Generate vdpau_template.c
3 functions = """
4 # get_error_string should be first, because the function lookup loop should
5 # have it available to print errors for other functions
6 get_error_string
8 bitmap_surface_create
9 bitmap_surface_destroy
10 bitmap_surface_put_bits_native
11 bitmap_surface_query_capabilities
12 decoder_create
13 decoder_destroy
14 decoder_render
15 device_destroy
16 generate_csc_matrix GenerateCSCMatrix # CSC completely capitalized
17 output_surface_create
18 output_surface_destroy
19 output_surface_put_bits_indexed
20 output_surface_put_bits_native
21 output_surface_render_bitmap_surface
22 output_surface_render_output_surface
23 preemption_callback_register
24 presentation_queue_block_until_surface_idle
25 presentation_queue_create
26 presentation_queue_destroy
27 presentation_queue_display
28 presentation_queue_get_time
29 presentation_queue_query_surface_status
30 presentation_queue_target_create_x11
31 presentation_queue_target_destroy
32 video_mixer_create
33 video_mixer_destroy
34 video_mixer_query_feature_support
35 video_mixer_render
36 video_mixer_set_attribute_values
37 video_mixer_set_feature_enables
38 video_surface_create
39 video_surface_destroy
40 video_surface_put_bits_y_cb_cr
41 """
43 print("""
44 /* List the VDPAU functions used by MPlayer.
45 * Generated by vdpau_functions.py.
46 * First argument on each line is the VDPAU function type name,
47 * second macro name needed to get function address,
48 * third name MPlayer uses for the function.
50 """)
51 for line in functions.splitlines():
52 parts = line.split('#')[0].strip().split()
53 if not parts:
54 continue # empty/comment line
55 if len(parts) > 1:
56 mp_name, vdpau_name = parts
57 else:
58 mp_name = parts[0]
59 vdpau_name = ''.join(part.capitalize() for part in mp_name.split('_'))
60 macro_name = mp_name.upper()
61 print('VDP_FUNCTION(Vdp%s, VDP_FUNC_ID_%s, %s)' % (vdpau_name, macro_name, mp_name))