[MPlayer-dev-eng] [PATCH] Support for QNX: QSA audio and Photon GUI.
Diego Biurrun
diego at biurrun.de
Tue Feb 5 21:10:08 CET 2013
On Tue, Feb 05, 2013 at 09:26:56PM +0200, Mike Gorchak wrote:
> --- mplayer-export-2013-02-03-orig/libao2/ao_qsa.c 1970-01-01 02:00:00.000000000 +0200
> +++ mplayer-export-2013-02-03/libao2/ao_qsa.c 2013-02-05 10:29:37.000000000 +0200
> @@ -0,0 +1,416 @@
Please use K&R style, i.e.
> +static const ao_info_t info =
> +{
{ on the previous line for structs and if/do/while/for/switch,
not for function declarations
> +static int control(int cmd, void* arg)
*arg
> +{
> + switch(cmd)
> + {
> + case AOCONTROL_QUERY_FORMAT:
> + return CONTROL_TRUE;
Indent case at the same depth as switch.
> +static int init(int rate, int channels, int format, int flags)
> +{
> + int qsa_format=SND_PCM_SFMT_S16_LE;
> + int frag_multiplier=1;
> + int status;
> + int cardno;
> + int deviceno;
> + int try_again=0;
spaces around operators
> + mp_msg(MSGT_AO, MSGL_V, "qsa-init: requested format: %d Hz, %d channels, %x\n",
> + rate, channels, format);
Align a continuing line of a function call with the first character after (.
> --- mplayer-export-2013-02-03-orig/libvo/vo_photon.c 1970-01-01 02:00:00.000000000 +0200
> +++ mplayer-export-2013-02-03/libvo/vo_photon.c 2013-02-05 10:30:39.000000000 +0200
> @@ -0,0 +1,1687 @@
> +
> +static void photon_configure_layer(void);
Reorder the code to avoid forward declarations
> +static void flip_page(void)
> +{
> + switch (phrender_type)
> + {
> + case PHRENDER_USE_OFFSCREEN:
> + case PHRENDER_USE_SWOFFSCREEN:
> + {
> + PtDamageWidget(phrawcontainer);
> + PtFlush();
> + }
> + break;
> + case PHRENDER_USE_LAYER:
> + {
> + ph_image_current=!ph_image_current;
> + photon_configure_layer();
> + PtDamageWidget(phrawcontainer);
> + PtFlush();
> + if (vo_vsync)
> + {
> + PgWaitVSync();
> + }
> + }
> + break;
> + }
All the { } in your case statements are unnecessary, probably elsewhere as well.
> +typedef struct _layer_mp_map
> +{
> + unsigned int layer_id;
> + unsigned int mp_id;
> + unsigned int format_idx;
> + unsigned int found;
> + unsigned int layer_idx;
> + unsigned int layer_caps;
> + unsigned int layer_chroma_caps;
> +} layer_mp_map_t;
The _t namespace is reserved for POSIX, don't invade it.
Just drop the typedef, typedeffing structs is not a good
idea most of the time anyway...
> +layer_mp_map_t photon_layer_map[]=
> +{
> + {Pg_LAYER_FORMAT_ARGB1555, IMGFMT_BGR15, 0, 0, 0, 0, 0},
> + {Pg_LAYER_FORMAT_RGB565, IMGFMT_BGR16, 0, 0, 0, 0, 0},
> + {Pg_LAYER_FORMAT_RGB888, IMGFMT_BGR24, 0, 0, 0, 0, 0},
> + {Pg_LAYER_FORMAT_ARGB8888, IMGFMT_BGR32, 0, 0, 0, 0, 0},
> + {Pg_LAYER_FORMAT_YUY2, IMGFMT_YUY2, 0, 0, 0, 0, 0},
> + {Pg_LAYER_FORMAT_YUY2, IMGFMT_YUNV, 0, 0, 0, 0, 0},
> + {Pg_LAYER_FORMAT_UYVY, IMGFMT_UYVY, 0, 0, 0, 0, 0},
> + {Pg_LAYER_FORMAT_UYVY, IMGFMT_UYNV, 0, 0, 0, 0, 0},
> + {Pg_LAYER_FORMAT_YVYU, IMGFMT_YVYU, 0, 0, 0, 0, 0},
> + {Pg_LAYER_FORMAT_V422, IMGFMT_V422, 0, 0, 0, 0, 0},
> + {0, 0, 0, 0, 0, 0, 0},
> +};
spaces inside { }
> +typedef struct _photon_mp_keydef
> +{
> + int photon_key;
> + int mp_key;
> +} photon_mp_keydef_t;
see above
> +photon_mp_keydef_t photon_keymap[]=
> +{
> + {Pk_Tab, KEY_TAB },
> + {Pk_Return, KEY_ENTER },
> + {Pk_BackSpace, KEY_BACKSPACE},
> + {Pk_Delete, KEY_DELETE },
> + {Pk_Insert, KEY_INSERT },
> + {Pk_Home, KEY_HOME },
> + {Pk_End, KEY_END },
> + {Pk_Pg_Up, KEY_PAGE_UP },
> + {Pk_Pg_Down, KEY_PAGE_DOWN},
> + {Pk_Escape, KEY_ESC },
> + {Pk_Right, KEY_RIGHT },
> + {Pk_Left, KEY_LEFT },
> + {Pk_Down, KEY_DOWN },
> + {Pk_Up, KEY_UP },
> + {Pk_Control_L, KEY_CTRL },
> + {Pk_Control_R, KEY_CTRL },
> + {Pk_F1, KEY_F+1 },
> + {Pk_F2, KEY_F+2 },
> + {Pk_F3, KEY_F+3 },
> + {Pk_F4, KEY_F+4 },
> + {Pk_F5, KEY_F+5 },
> + {Pk_F6, KEY_F+6 },
> + {Pk_F7, KEY_F+7 },
> + {Pk_F8, KEY_F+8 },
> + {Pk_F9, KEY_F+9 },
> + {Pk_F10, KEY_F+10 },
> + {Pk_F11, KEY_F+11 },
> + {Pk_F12, KEY_F+12 },
> + {Pk_KP_0, KEY_KP0 },
> + {Pk_KP_1, KEY_KP1 },
> + {Pk_KP_2, KEY_KP2 },
> + {Pk_KP_3, KEY_KP3 },
> + {Pk_KP_4, KEY_KP4 },
> + {Pk_KP_5, KEY_KP5 },
> + {Pk_KP_6, KEY_KP6 },
> + {Pk_KP_7, KEY_KP7 },
> + {Pk_KP_8, KEY_KP8 },
> + {Pk_KP_9, KEY_KP9 },
> + {Pk_KP_Enter, KEY_KPENTER },
> + {Pk_KP_Decimal, KEY_KPDEC },
> + {0, 0 },
> +};
see above
> + if (phrender_type==PHRENDER_USE_LAYER)
> + {
> + photon_configure_layer();
> + }
note that we usually drop unnecessary {}
Diego
More information about the MPlayer-dev-eng
mailing list