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