diff options
46 files changed, 825 insertions, 683 deletions
diff --git a/DOCS/tech/patches.txt b/DOCS/tech/patches.txt index 692666d1a8..dfff16bf85 100644 --- a/DOCS/tech/patches.txt +++ b/DOCS/tech/patches.txt @@ -56,8 +56,8 @@ that your patch will be included. and committed separately. Logical units should stay together, though, i.e. do not send a patch for every file or directory you change. - 9. Send your patch to the mplayer-dev-eng mailing list as a base64-encoded - attachment with the subject line: + 9. Send your patch to the mplayer-dev-eng mailing list as attachment with + the subject line: '[PATCH] very short description of the patch'. In the mail, describe in a few sentences what you change and why. The subject line is very important if you do not want your patch to get diff --git a/DOCS/xml/cs/mencoder.xml b/DOCS/xml/cs/mencoder.xml index 19c289d137..3b3ff87f3c 100644 --- a/DOCS/xml/cs/mencoder.xml +++ b/DOCS/xml/cs/mencoder.xml @@ -402,9 +402,9 @@ Budete-li respektovat následující omezení, neměli byste narazit na potíže <title>Enkódování do PSP</title> <para> <screen> -mencoder -ofps 30000/1001 -af lavcresample=24000 -vf harddup -of lavf \ - -oac lavc -ovc lavc -lavcopts aglobal=1:vglobal=1:vcodec=mpeg4:acodec=aac \ - -lavfopts format=psp \ +mencoder -ofps 30000/1001 -af lavcresample=24000 -vf harddup -oac lavc \ + -ovc lavc -lavcopts aglobal=1:vglobal=1:vcodec=mpeg4:acodec=libfaac \ + -of lavf -lavfopts format=psp \ <replaceable>vstupní.video</replaceable> -o <replaceable>výstupní.psp</replaceable> </screen> Poznamenejme, že můžete nastavit jméno videa pomocí diff --git a/DOCS/xml/de/mencoder.xml b/DOCS/xml/de/mencoder.xml index 299aa9f907..90afe5b91b 100644 --- a/DOCS/xml/de/mencoder.xml +++ b/DOCS/xml/de/mencoder.xml @@ -344,7 +344,7 @@ <para> <screen> mencoder -ofps 30000/1001 -af lavcresample=24000 -vf harddup -of lavf \ - -oac lavc -ovc lavc -lavcopts aglobal=1:vglobal=1:vcodec=mpeg4:acodec=aac \ + -oac lavc -ovc lavc -lavcopts aglobal=1:vglobal=1:vcodec=mpeg4:acodec=libfaac \ -lavfopts format=psp \ <replaceable>input.video</replaceable> -o <replaceable>output.psp</replaceable> </screen> diff --git a/DOCS/xml/en/mencoder.xml b/DOCS/xml/en/mencoder.xml index 8914d229d1..e866016740 100644 --- a/DOCS/xml/en/mencoder.xml +++ b/DOCS/xml/en/mencoder.xml @@ -401,9 +401,9 @@ You should be safe if you respect the following constraints: <title>encode for PSP</title> <para> <screen> -mencoder -ofps 30000/1001 -af lavcresample=24000 -vf harddup -of lavf \ - -oac lavc -ovc lavc -lavcopts aglobal=1:vglobal=1:vcodec=mpeg4:acodec=aac \ - -lavfopts format=psp \ +mencoder -ofps 30000/1001 -af lavcresample=24000 -vf harddup -oac lavc \ + -ovc lavc -lavcopts aglobal=1:vglobal=1:vcodec=mpeg4:acodec=libfaac \ + -of lavf -lavfopts format=psp \ <replaceable>input.video</replaceable> -o <replaceable>output.psp</replaceable> </screen> Note that you can set the title of the video with @@ -615,7 +615,7 @@ mencoder mf://<replaceable>@list.txt</replaceable> -mf w=800:h=600:fps=25:type=j </informalexample> You can mix different types of images, regardless of the method you use -— individual filenames, wildcard or file with list — provided of +t — individual filenames, wildcard or file with list — provided of course they have the same dimensions. So you can e.g. take title frame from PNG file, and then put a slideshow of your JPEG photos. diff --git a/DOCS/xml/fr/mencoder.xml b/DOCS/xml/fr/mencoder.xml index f147cd1de7..a10ad2101f 100644 --- a/DOCS/xml/fr/mencoder.xml +++ b/DOCS/xml/fr/mencoder.xml @@ -417,9 +417,9 @@ mencoder dvd://2 -ovc lavc -lavcopts vcodec=mpeg4:mbd=2:trell:vpass=2 \ <title>Encodage pour PSP</title> <para> <screen> -mencoder -ofps 30000/1001 -af lavcresample=24000 -vf harddup -of lavf \ - -oac lavc -ovc lavc -lavcopts aglobal=1:vglobal=1:vcodec=mpeg4:acodec=aac \ - -lavfopts format=psp \ +mencoder -ofps 30000/1001 -af lavcresample=24000 -vf harddup -oac lavc \ + -ovc lavc -lavcopts aglobal=1:vglobal=1:vcodec=mpeg4:acodec=libfaac \ + -of lavf -lavfopts format=psp \ <replaceable>entree.video</replaceable> -o <replaceable>sortie.psp</replaceable> </screen> Vous pouvez définir le titre de la vidéo avec diff --git a/DOCS/xml/hu/mencoder.xml b/DOCS/xml/hu/mencoder.xml index 8ab02d7a54..aa44999324 100644 --- a/DOCS/xml/hu/mencoder.xml +++ b/DOCS/xml/hu/mencoder.xml @@ -400,9 +400,9 @@ Nyugodt lehetsz, ha a következő korlátokat figyelembe veszed: <title>kódolás PSP-be</title> <para> <screen> -mencoder -ofps 30000/1001 -af resample=24000 -vf harddup -of lavf \ - -oac lavc -ovc lavc -lavcopts aglobal=1:vglobal=1:vcodec=mpeg4:acodec=aac \ - -lavfopts format=psp \ +mencoder -ofps 30000/1001 -af lavcresample=24000 -vf harddup -oac lavc \ + -ovc lavc -lavcopts aglobal=1:vglobal=1:vcodec=mpeg4:acodec=libfaac \ + -of lavf -lavfopts format=psp \ <replaceable>bemenet.video</replaceable> -o <replaceable>kimenet.psp</replaceable> </screen> Figyelj rá, hogy beállíthatod a videó címét a diff --git a/DOCS/xml/it/encoding-guide.xml b/DOCS/xml/it/encoding-guide.xml index e0f1f4da07..dd326c2fa4 100644 --- a/DOCS/xml/it/encoding-guide.xml +++ b/DOCS/xml/it/encoding-guide.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> -<!-- 44% synced with r22753 (row 2361) --> +<!-- 44% synced with r22753 (row 2377) --> <chapter id="encoding-guide"> <title>La codifica con <application>MEncoder</application></title> @@ -2360,18 +2360,18 @@ tipi. </listitem> <listitem><formalpara> - <title>About encoding parameters and quality:</title> + <title>Riguardo i parameti di codifica e la qualità:</title> <para> - Just because I recommend <option>mbd=2</option> here does not mean it - should not be used elsewhere. Along with <option>trell</option>, - <option>mbd=2</option> is one of the two - <systemitem class="library">libavcodec</systemitem> options that - increases quality the most, and you should always use at least those - two unless the drop in encoding speed is prohibitive (e.g. realtime - encoding). There are many other options to - <systemitem class="library">libavcodec</systemitem> that increase - encoding quality (and decrease encoding speed) but that is beyond - the scope of this document. + Il fatto che qui venga cosigliata <option>mbd=2</option> non significa che + non si debba usare altrimenti. Insieme con <option>trell</option>, + <option>mbd=2</option> è una delle due opzioni di + <systemitem class="library">libavcodec</systemitem> che ottimizzano al + meglio la qualità e sarebbero sempre da utilizzare entrambe a meno che + l'aumento della velocità di codifica sua proibitivo (ad es. per la codifica + in tempo reale (realtime)). Ci sono molte altre opzioni di + <systemitem class="library">libavcodec</systemitem> che aumentano la + qualità (e rallentano la codifica), ma questo non è l'obiettivo di + questa documentaziione. </para> </formalpara></listitem> @@ -2570,16 +2570,48 @@ mencoder dvd://2 -o <replaceable>title2.avi</replaceable> -ovc lavc -lavcopts vc </thead> <tbody> <row> + <entry>ac3</entry> + <entry>Dolby Digital (AC-3)</entry> +</row> +<row> + <entry>adpcm_*</entry> + <entry>Adaptive PCM formats - see supplementary table</entry> +</row> +<row> + <entry>flac</entry> + <entry>Free Lossless Audio Codec (FLAC)</entry> +</row> +<row> + <entry>g726</entry> + <entry>G.726 ADPCM</entry> +</row> +<row> + <entry>libfaac</entry> + <entry>Advanced Audio Coding (AAC) - using FAAC</entry> +</row> +<row> + <entry>libgsm</entry> + <entry>ETSI GSM 06.10 full rate</entry> +</row> +<row> + <entry>libgsm_ms</entry> + <entry>Microsoft GSM</entry> +</row> +<row> + <entry>libmp3lame</entry> + <entry>MPEG-1 audio layer 3 (MP3) - using LAME</entry> +</row> +<row> <entry>mp2</entry> - <entry>MPEG Layer 2</entry> + <entry>MPEG-1 audio layer 2 (MP2)</entry> </row> <row> - <entry>ac3</entry> - <entry>AC-3, AKA Dolby Digital</entry> + <entry>pcm_*</entry> + <entry>PCM formats - see supplementary table</entry> </row> <row> - <entry>adpcm_ima_wav</entry> - <entry>IMA adaptive PCM (4 bits per sample, 4:1 compression)</entry> + <entry>roq_dpcm</entry> + <entry>Id Software RoQ DPCM</entry> </row> <row> <entry>sonic</entry> @@ -2591,15 +2623,15 @@ mencoder dvd://2 -o <replaceable>title2.avi</replaceable> -ovc lavc -lavcopts vc </row> <row> <entry>vorbis</entry> - <entry>Xiph Ogg Vorbis codec</entry> + <entry>Vorbis</entry> </row> <row> <entry>wmav1</entry> - <entry>Windows Media Audio v1 codec</entry> + <entry>Windows Media Audio v1</entry> </row> <row> <entry>wmav2</entry> - <entry>Windows Media Audio v2 codec</entry> + <entry>Windows Media Audio v2</entry> </row> </tbody> </tgroup> diff --git a/DOCS/xml/it/mencoder.xml b/DOCS/xml/it/mencoder.xml index 35745d8413..dedd53c31f 100644 --- a/DOCS/xml/it/mencoder.xml +++ b/DOCS/xml/it/mencoder.xml @@ -401,9 +401,9 @@ Dovresti accertarti di rispettare i seguenti vincoli: <title>codificare per PSP</title> <para> <screen> -mencoder -ofps 30000/1001 -af lavcresample=24000 -vf harddup -of lavf \ - -oac lavc -ovc lavc -lavcopts aglobal=1:vglobal=1:vcodec=mpeg4:acodec=aac \ - -lavfopts format=psp \ +mencoder -ofps 30000/1001 -af lavcresample=24000 -vf harddup -oac lavc \ + -ovc lavc -lavcopts aglobal=1:vglobal=1:vcodec=mpeg4:acodec=libfaac \ + -of lavf -lavfopts format=psp \ <replaceable>input.video</replaceable> -o <replaceable>output.psp</replaceable> </screen> Nota che puoi impostare il titolo del video con diff --git a/DOCS/xml/pl/mencoder.xml b/DOCS/xml/pl/mencoder.xml index 3ad695a522..f14583bf38 100644 --- a/DOCS/xml/pl/mencoder.xml +++ b/DOCS/xml/pl/mencoder.xml @@ -387,9 +387,9 @@ Powinieneś byś bezpieczny, jeśli respektujesz poniższe ograniczenia: <title>kodowanie dla PSP</title> <para> <screen> -mencoder -ofps 30000/1001 -af lavcresample=24000 -vf harddup -of lavf \ - -oac lavc -ovc lavc -lavcopts aglobal=1:vglobal=1:vcodec=mpeg4:acodec=aac \ - -lavfopts format=psp:i_certify_that_my_video_stream_does_not_use_b_frames \ +mencoder -ofps 30000/1001 -af lavcresample=24000 -vf harddup -oac lavc \ + -ovc lavc -lavcopts aglobal=1:vglobal=1:vcodec=mpeg4:acodec=libfaac \ + -of lavf -lavfopts format=psp \ <replaceable>wejściowe.video</replaceable> -o <replaceable>wyjście.psp</replaceable> </screen> Możesz też ustawić tytuł filmu dzięki diff --git a/DOCS/xml/ru/mencoder.xml b/DOCS/xml/ru/mencoder.xml index d5376e4e33..e45ee509f1 100644 --- a/DOCS/xml/ru/mencoder.xml +++ b/DOCS/xml/ru/mencoder.xml @@ -394,9 +394,9 @@ Sony PSP, но, в зависимости от ревизии программн <title>Кодирование для PSP</title> <para> <screen> -mencoder -ofps 30000/1001 -af lavcresample=24000 -vf harddup -of lavf \ - -oac lavc -ovc lavc -lavcopts aglobal=1:vglobal=1:vcodec=mpeg4:acodec=aac \ - -lavfopts format=psp \ +mencoder -ofps 30000/1001 -af lavcresample=24000 -vf harddup -oac lavc \ + -ovc lavc -lavcopts aglobal=1:vglobal=1:vcodec=mpeg4:acodec=libfaac \ + -of lavf -lavfopts format=psp \ <replaceable>input.video</replaceable> -o <replaceable>output.psp</replaceable> </screen> Заметьте, что можно задать заголовок видео опцией diff --git a/DOCS/xml/zh_CN/mencoder.xml b/DOCS/xml/zh_CN/mencoder.xml index 81ab1170dc..878e2f4bec 100644 --- a/DOCS/xml/zh_CN/mencoder.xml +++ b/DOCS/xml/zh_CN/mencoder.xml @@ -364,9 +364,9 @@ PSP软件修改,对不同软件限制也许会有不同。 <title>编码到PSP</title> <para> <screen> -mencoder -ofps 30000/1001 -af lavcresample=24000 -vf harddup -of lavf \ - -oac lavc -ovc lavc -lavcopts aglobal=1:vglobal=1:vcodec=mpeg4:acodec=aac \ - -lavfopts format=psp:i_certify_that_my_video_stream_does_not_use_b_frames \ +mencoder -ofps 30000/1001 -af lavcresample=24000 -vf harddup -oac lavc \ + -ovc lavc -lavcopts aglobal=1:vglobal=1:vcodec=mpeg4:acodec=libfaac \ + -of lavf -lavfopts format=psp \ <replaceable>input.video</replaceable> -o <replaceable>output.psp</replaceable> </screen> 注意你可以通过 diff --git a/cfg-mencoder.h b/cfg-mencoder.h index ac2ffd8e10..c067bcc8d7 100644 --- a/cfg-mencoder.h +++ b/cfg-mencoder.h @@ -23,24 +23,22 @@ * config for cfgparser */ +#include "libmpcodecs/ve_x264.h" #include "cfg-common.h" extern int sws_flags; extern char *pp_help; -extern m_option_t lameopts_conf[]; -extern m_option_t lavcopts_conf[]; -extern m_option_t toolameopts_conf[]; -extern m_option_t twolameopts_conf[]; -extern m_option_t faacopts_conf[]; -extern m_option_t vfwopts_conf[]; -extern m_option_t xvidencopts_conf[]; - -void x264enc_set_param(const m_option_t* opt, char* arg); - -extern m_option_t nuvopts_conf[]; -extern m_option_t mpegopts_conf[]; -extern m_option_t lavfopts_conf[]; +extern const m_option_t faacopts_conf[]; +extern const m_option_t lameopts_conf[]; +extern const m_option_t lavcopts_conf[]; +extern const m_option_t lavfopts_conf[]; +extern const m_option_t mpegopts_conf[]; +extern const m_option_t nuvopts_conf[]; +extern const m_option_t toolameopts_conf[]; +extern const m_option_t twolameopts_conf[]; +extern const m_option_t vfwopts_conf[]; +extern const m_option_t xvidencopts_conf[]; const m_option_t ovc_conf[]={ {"copy", &out_video_codec, CONF_TYPE_FLAG, 0, 0, VCODEC_COPY, NULL}, diff --git a/cfg-mplayer.h b/cfg-mplayer.h index a622c5c0b6..dd4f08a8f6 100644 --- a/cfg-mplayer.h +++ b/cfg-mplayer.h @@ -53,7 +53,7 @@ extern int menu_fribidi_flip_commas; extern char *unrar_executable; -extern m_option_t dxr2_opts[]; +extern const m_option_t dxr2_opts[]; extern int sws_flags; extern char* pp_help; @@ -1815,7 +1815,9 @@ cat > $TMPC << EOF int main(void) { return 0; } EOF if test "$_runtime_cpudetection" = no ; then - cc_check -march=native && proc=native + if test $cc_vendor != "intel" ; then + cc_check -march=native && proc=native + fi if test "$proc" = "k8"; then cc_check -march=$proc $cpuopt=$proc || proc=athlon-xp fi @@ -1963,7 +1965,9 @@ int main(void) { return 0; } EOF # This is a stripped-down version of the i386 fallback. if test "$_runtime_cpudetection" = no ; then - cc_check -march=native && proc=native + if test $cc_vendor != "intel" ; then + cc_check -march=native && proc=native + fi # --- AMD processors --- if test "$proc" = "k8"; then cc_check -march=$proc $cpuopt=$proc || proc=athlon-xp @@ -8492,7 +8496,6 @@ $def_yasm #define CONFIG_LIBVORBIS 0 #define CONFIG_POWERPC_PERF 0 #define CONFIG_SMALL 0 -#define CONFIG_SWSCALE 1 #define CONFIG_SWSCALE_ALPHA 1 #define HAVE_ATTRIBUTE_PACKED 1 diff --git a/etc/codecs.conf b/etc/codecs.conf index 808f1e3335..a8fc871bd7 100644 --- a/etc/codecs.conf +++ b/etc/codecs.conf @@ -3044,7 +3044,7 @@ videocodec ffc93 dll c93 out BGR8 -videocodec eatgv +videocodec ffeatgv info "FFmpeg Electronic Arts TGV" status working fourcc fVGT @@ -4242,7 +4242,7 @@ audiocodec dvdpcm format 0x10001 driver dvdpcm -audiocodec lpcm +audiocodec fflpcm info "Bluray LPCM" status working fourcc BPCM ; internal MPlayer FourCC diff --git a/libmenu/menu_chapsel.c b/libmenu/menu_chapsel.c index f350655311..fb159eaeee 100644 --- a/libmenu/menu_chapsel.c +++ b/libmenu/menu_chapsel.c @@ -61,7 +61,7 @@ static struct menu_priv_s cfg_dflt = { #define ST_OFF(m) M_ST_OFF(struct menu_priv_s,m) -static m_option_t cfg_fields[] = { +static const m_option_t cfg_fields[] = { MENU_LIST_PRIV_FIELDS, { "title", ST_OFF (title), CONF_TYPE_STRING, 0, 0, 0, NULL }, { "auto-close", ST_OFF (auto_close), CONF_TYPE_FLAG, 0, 0, 1, NULL }, diff --git a/libmenu/menu_cmdlist.c b/libmenu/menu_cmdlist.c index 4d29fa14fe..d09c45fc8d 100644 --- a/libmenu/menu_cmdlist.c +++ b/libmenu/menu_cmdlist.c @@ -58,7 +58,7 @@ static struct menu_priv_s cfg_dflt = { MENU_LIST_PRIV_DFLT, }; -static m_option_t cfg_fields[] = { +static const m_option_t cfg_fields[] = { MENU_LIST_PRIV_FIELDS, { "title",M_ST_OFF(struct menu_priv_s,p.title), CONF_TYPE_STRING, 0, 0, 0, NULL }, { NULL, NULL, NULL, 0,0,0,NULL } diff --git a/libmenu/menu_console.c b/libmenu/menu_console.c index f0bb029e91..8e82412327 100644 --- a/libmenu/menu_console.c +++ b/libmenu/menu_console.c @@ -109,7 +109,7 @@ static struct menu_priv_s cfg_dflt = { #define ST_OFF(m) M_ST_OFF(struct menu_priv_s,m) -static m_option_t cfg_fields[] = { +static const m_option_t cfg_fields[] = { { "prompt", ST_OFF(mp_prompt), CONF_TYPE_STRING, M_OPT_MIN, 1, 0, NULL }, { "child-prompt", ST_OFF(child_prompt), CONF_TYPE_STRING, M_OPT_MIN, 1, 0, NULL }, { "buffer-lines", ST_OFF(buf_lines), CONF_TYPE_INT, M_OPT_MIN, 5, 0, NULL }, diff --git a/libmenu/menu_dvbin.c b/libmenu/menu_dvbin.c index e2b99a0f07..35ce114687 100644 --- a/libmenu/menu_dvbin.c +++ b/libmenu/menu_dvbin.c @@ -64,7 +64,7 @@ struct menu_priv_s { #define ST_OFF(m) M_ST_OFF(struct menu_priv_s, m) #define mpriv (menu->priv) -static m_option_t cfg_fields[] = { +static const m_option_t cfg_fields[] = { MENU_LIST_PRIV_FIELDS, { "title", ST_OFF(title), CONF_TYPE_STRING, 0, 0, 0, NULL }, { "auto-close", ST_OFF(auto_close), CONF_TYPE_FLAG, 0, 0, 1, NULL }, diff --git a/libmenu/menu_filesel.c b/libmenu/menu_filesel.c index fd16642ddf..aa15cc0147 100644 --- a/libmenu/menu_filesel.c +++ b/libmenu/menu_filesel.c @@ -79,7 +79,7 @@ static struct menu_priv_s cfg_dflt = { #define ST_OFF(m) M_ST_OFF(struct menu_priv_s,m) -static m_option_t cfg_fields[] = { +static const m_option_t cfg_fields[] = { MENU_LIST_PRIV_FIELDS, { "path", ST_OFF(path), CONF_TYPE_STRING, 0, 0, 0, NULL }, { "title", ST_OFF(title), CONF_TYPE_STRING, 0, 0, 0, NULL }, diff --git a/libmenu/menu_param.c b/libmenu/menu_param.c index f1836dffe0..135761b3d0 100644 --- a/libmenu/menu_param.c +++ b/libmenu/menu_param.c @@ -68,7 +68,7 @@ static struct menu_priv_s cfg_dflt = { 1 }; -static m_option_t cfg_fields[] = { +static const m_option_t cfg_fields[] = { MENU_LIST_PRIV_FIELDS, { "title", M_ST_OFF(menu_list_priv_t,title), CONF_TYPE_STRING, 0, 0, 0, NULL }, { "na", M_ST_OFF(struct menu_priv_s,na), CONF_TYPE_STRING, 0, 0, 0, NULL }, diff --git a/libmenu/menu_pt.c b/libmenu/menu_pt.c index ceba4de41a..7008db2896 100644 --- a/libmenu/menu_pt.c +++ b/libmenu/menu_pt.c @@ -59,7 +59,7 @@ static struct menu_priv_s cfg_dflt = { #define ST_OFF(m) M_ST_OFF(struct menu_priv_s,m) -static m_option_t cfg_fields[] = { +static const m_option_t cfg_fields[] = { MENU_LIST_PRIV_FIELDS, { "title", ST_OFF(title), CONF_TYPE_STRING, 0, 0, 0, NULL }, { "auto-close", ST_OFF(auto_close), CONF_TYPE_FLAG, 0, 0, 1, NULL }, diff --git a/libmenu/menu_txt.c b/libmenu/menu_txt.c index 7064167b67..308d9547c0 100644 --- a/libmenu/menu_txt.c +++ b/libmenu/menu_txt.c @@ -55,7 +55,7 @@ static struct menu_priv_s cfg_dflt = { #define ST_OFF(m) M_ST_OFF(struct menu_priv_s,m) -static m_option_t cfg_fields[] = { +static const m_option_t cfg_fields[] = { { "minbor", ST_OFF(minb), CONF_TYPE_INT, M_OPT_MIN, 0, 0, NULL }, { "hspace", ST_OFF(hspace), CONF_TYPE_INT, M_OPT_MIN, 0, 0, NULL }, { "file", ST_OFF(file), CONF_TYPE_STRING, 0, 0, 0, NULL }, diff --git a/libmpcodecs/ae_faac.c b/libmpcodecs/ae_faac.c index 33c994757d..63c716378d 100644 --- a/libmpcodecs/ae_faac.c +++ b/libmpcodecs/ae_faac.c @@ -52,7 +52,7 @@ static unsigned long samples_input, max_bytes_output; static unsigned char *decoder_specific_buffer = NULL; static unsigned long decoder_specific_len = 0; -m_option_t faacopts_conf[] = { +const m_option_t faacopts_conf[] = { {"br", ¶m_bitrate, CONF_TYPE_INT, 0, 0, 0, NULL}, {"quality", ¶m_quality, CONF_TYPE_INT, CONF_RANGE, 0, 1000, NULL}, {"object", ¶m_object_type, CONF_TYPE_INT, CONF_RANGE, 1, 4, NULL}, diff --git a/libmpcodecs/ae_lame.c b/libmpcodecs/ae_lame.c index ec748d77c5..90ed31dfe7 100644 --- a/libmpcodecs/ae_lame.c +++ b/libmpcodecs/ae_lame.c @@ -106,7 +106,7 @@ static int lame_presets_set( lame_t gfp, int fast, int cbr, const char* preset_ -m_option_t lameopts_conf[]={ +const m_option_t lameopts_conf[] = { {"q", &lame_param_quality, CONF_TYPE_INT, CONF_RANGE, 0, 9, NULL}, {"aq", &lame_param_algqual, CONF_TYPE_INT, CONF_RANGE, 0, 9, NULL}, {"vbr", &lame_param_vbr, CONF_TYPE_INT, CONF_RANGE, 0, vbr_max_indicator, NULL}, diff --git a/libmpcodecs/ae_toolame.c b/libmpcodecs/ae_toolame.c index 851fa845f9..077b83d740 100644 --- a/libmpcodecs/ae_toolame.c +++ b/libmpcodecs/ae_toolame.c @@ -43,7 +43,7 @@ static int static float param_vbr = 0; static char *param_mode = "stereo"; -m_option_t toolameopts_conf[] = { +const m_option_t toolameopts_conf[] = { {"br", ¶m_bitrate, CONF_TYPE_INT, 0, 0, 0, NULL}, {"mode", ¶m_mode, CONF_TYPE_STRING, 0, 0, 0, NULL}, {"psy", ¶m_psy, CONF_TYPE_INT, CONF_RANGE, -1, 4, NULL}, diff --git a/libmpcodecs/ae_twolame.c b/libmpcodecs/ae_twolame.c index e15206dee6..52e6ea8417 100644 --- a/libmpcodecs/ae_twolame.c +++ b/libmpcodecs/ae_twolame.c @@ -43,7 +43,7 @@ static int static float param_vbr = 0; static char *param_mode = "stereo"; -m_option_t twolameopts_conf[] = { +const m_option_t twolameopts_conf[] = { {"br", ¶m_bitrate, CONF_TYPE_INT, 0, 0, 0, NULL}, {"mode", ¶m_mode, CONF_TYPE_STRING, 0, 0, 0, NULL}, {"psy", ¶m_psy, CONF_TYPE_INT, CONF_RANGE, -1, 4, NULL}, diff --git a/libmpcodecs/ve_lavc.c b/libmpcodecs/ve_lavc.c index 064d34b5f0..febfa04a45 100644 --- a/libmpcodecs/ve_lavc.c +++ b/libmpcodecs/ve_lavc.c @@ -182,8 +182,7 @@ static char *lavc_param_avopt = NULL; #include "m_option.h" -#ifdef CONFIG_LIBAVCODEC -m_option_t lavcopts_conf[]={ +const m_option_t lavcopts_conf[]={ {"acodec", &lavc_param_acodec, CONF_TYPE_STRING, 0, 0, 0, NULL}, {"abitrate", &lavc_param_abitrate, CONF_TYPE_INT, CONF_RANGE, 1, 1000000, NULL}, {"atag", &lavc_param_atag, CONF_TYPE_INT, CONF_RANGE, 0, 0xffff, NULL}, @@ -330,7 +329,6 @@ m_option_t lavcopts_conf[]={ {"o", &lavc_param_avopt, CONF_TYPE_STRING, 0, 0, 0, NULL}, {NULL, NULL, 0, 0, 0, 0, NULL} }; -#endif struct vf_priv_s { muxer_stream_t* mux; diff --git a/libmpcodecs/ve_nuv.c b/libmpcodecs/ve_nuv.c index 5f4a0a2808..83c848ffa1 100644 --- a/libmpcodecs/ve_nuv.c +++ b/libmpcodecs/ve_nuv.c @@ -71,7 +71,7 @@ struct vf_priv_s nuv_priv_dflt = { NULL,NULL }; -m_option_t nuvopts_conf[]={ +const m_option_t nuvopts_conf[] = { {"raw", &nuv_priv_dflt.raw, CONF_TYPE_FLAG, 0, 0, 1, NULL}, {"rtjpeg", &nuv_priv_dflt.raw, CONF_TYPE_FLAG, 0, 1, 0, NULL}, {"lzo", &nuv_priv_dflt.lzo, CONF_TYPE_FLAG, 0, 0, 1, NULL}, diff --git a/libmpcodecs/ve_vfw.c b/libmpcodecs/ve_vfw.c index 4a84d5faa8..40a6d6ea0b 100644 --- a/libmpcodecs/ve_vfw.c +++ b/libmpcodecs/ve_vfw.c @@ -54,7 +54,7 @@ static HRESULT CoInitRes = -1; #include "m_option.h" -m_option_t vfwopts_conf[]={ +const m_option_t vfwopts_conf[]={ {"codec", &vfw_param_codec, CONF_TYPE_STRING, 0, 0, 0, NULL}, {"compdata", &vfw_param_compdata, CONF_TYPE_STRING, 0, 0, 0, NULL}, {NULL, NULL, 0, 0, 0, 0, NULL} diff --git a/libmpcodecs/ve_x264.c b/libmpcodecs/ve_x264.c index fc7ac6c1ff..832d58ac6a 100644 --- a/libmpcodecs/ve_x264.c +++ b/libmpcodecs/ve_x264.c @@ -45,6 +45,7 @@ #include "img_format.h" #include "mp_image.h" #include "vf.h" +#include "ve_x264.h" #include <x264.h> diff --git a/libmpcodecs/ve_x264.h b/libmpcodecs/ve_x264.h new file mode 100644 index 0000000000..93da150514 --- /dev/null +++ b/libmpcodecs/ve_x264.h @@ -0,0 +1,26 @@ +/* + * This file is part of MPlayer. + * + * MPlayer is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * MPlayer is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with MPlayer; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#ifndef MPLAYER_X264_H +#define MPLAYER_X264_H + +#include "m_option.h" + +void x264enc_set_param(const m_option_t* opt, char* arg); + +#endif /* MPLAYER_X264_H */ diff --git a/libmpcodecs/ve_xvid4.c b/libmpcodecs/ve_xvid4.c index 858ca903f4..d724765ce5 100644 --- a/libmpcodecs/ve_xvid4.c +++ b/libmpcodecs/ve_xvid4.c @@ -216,7 +216,7 @@ static int xvidenc_autoaspect = 0; static char *xvidenc_zones = NULL; // zones string -m_option_t xvidencopts_conf[] = +const m_option_t xvidencopts_conf[] = { /* Standard things mencoder should be able to treat directly */ {"bitrate", &xvidenc_bitrate, CONF_TYPE_INT, 0, 0, 0, NULL}, diff --git a/libmpdemux/demux_avi.c b/libmpdemux/demux_avi.c index 7b0e229ac6..0d5e59078c 100644 --- a/libmpdemux/demux_avi.c +++ b/libmpdemux/demux_avi.c @@ -804,7 +804,7 @@ static int demux_avi_control(demuxer_t *demuxer,int cmd, void *arg){ int maxid = FFMIN(100, audio ? MAX_A_STREAMS : MAX_V_STREAMS); int chunkid; if (ds->id < -1) - return DEMUXER_CTRL_NOTIMPL; + ds->id = -1; if (*(int *)arg >= 0) ds->id = *(int *)arg; diff --git a/libmpdemux/muxer_lavf.c b/libmpdemux/muxer_lavf.c index 83ece42083..a4113c7d9a 100644 --- a/libmpdemux/muxer_lavf.c +++ b/libmpdemux/muxer_lavf.c @@ -73,7 +73,7 @@ static float mux_preload= 0.5; static float mux_max_delay= 0.7; static char *mux_avopt = NULL; -m_option_t lavfopts_conf[] = { +const m_option_t lavfopts_conf[] = { {"format", &(conf_format), CONF_TYPE_STRING, 0, 0, 0, NULL}, {"muxrate", &mux_rate, CONF_TYPE_INT, CONF_RANGE, 0, INT_MAX, NULL}, {"packetsize", &mux_packet_size, CONF_TYPE_INT, CONF_RANGE, 0, INT_MAX, NULL}, diff --git a/libmpdemux/muxer_mpeg.c b/libmpdemux/muxer_mpeg.c index 00bb9d0792..55e2923a13 100644 --- a/libmpdemux/muxer_mpeg.c +++ b/libmpdemux/muxer_mpeg.c @@ -207,7 +207,7 @@ typedef struct { #define TELECINE_FILM2PAL 2 #define TELECINE_DGPULLDOWN 3 -m_option_t mpegopts_conf[] = { +const m_option_t mpegopts_conf[] = { {"format", &(conf_mux), CONF_TYPE_STRING, M_OPT_GLOBAL, 0 ,0, NULL}, {"size", &(conf_packet_size), CONF_TYPE_INT, M_OPT_GLOBAL|M_OPT_RANGE, 0, 65535, NULL}, {"muxrate", &(conf_muxrate), CONF_TYPE_INT, M_OPT_GLOBAL|M_OPT_RANGE, 0, 12000000, NULL}, //12 Mb/s diff --git a/libvo/gl_common.c b/libvo/gl_common.c index 3daeab046d..bdc501998e 100644 --- a/libvo/gl_common.c +++ b/libvo/gl_common.c @@ -36,57 +36,57 @@ #include "gl_common.h" #include "csputils.h" -void (GLAPIENTRY *Begin)(GLenum); -void (GLAPIENTRY *End)(void); -void (GLAPIENTRY *Viewport)(GLint, GLint, GLsizei, GLsizei); -void (GLAPIENTRY *MatrixMode)(GLenum); -void (GLAPIENTRY *LoadIdentity)(void); -void (GLAPIENTRY *Translated)(double, double, double); -void (GLAPIENTRY *Scaled)(double, double, double); -void (GLAPIENTRY *Ortho)(double, double, double, double, double, double); -void (GLAPIENTRY *Frustum)(double, double, double, double, double, double); -void (GLAPIENTRY *PushMatrix)(void); -void (GLAPIENTRY *PopMatrix)(void); -void (GLAPIENTRY *Clear)(GLbitfield); -GLuint (GLAPIENTRY *GenLists)(GLsizei); -void (GLAPIENTRY *DeleteLists)(GLuint, GLsizei); -void (GLAPIENTRY *NewList)(GLuint, GLenum); -void (GLAPIENTRY *EndList)(void); -void (GLAPIENTRY *CallList)(GLuint); -void (GLAPIENTRY *CallLists)(GLsizei, GLenum, const GLvoid *); -void (GLAPIENTRY *GenTextures)(GLsizei, GLuint *); -void (GLAPIENTRY *DeleteTextures)(GLsizei, const GLuint *); -void (GLAPIENTRY *TexEnvf)(GLenum, GLenum, GLfloat); -void (GLAPIENTRY *TexEnvi)(GLenum, GLenum, GLint); -void (GLAPIENTRY *Color4ub)(GLubyte, GLubyte, GLubyte, GLubyte); -void (GLAPIENTRY *Color3f)(GLfloat, GLfloat, GLfloat); -void (GLAPIENTRY *Color4f)(GLfloat, GLfloat, GLfloat, GLfloat); -void (GLAPIENTRY *ClearColor)(GLclampf, GLclampf, GLclampf, GLclampf); -void (GLAPIENTRY *ClearDepth)(GLclampd); -void (GLAPIENTRY *DepthFunc)(GLenum); -void (GLAPIENTRY *Enable)(GLenum); -void (GLAPIENTRY *Disable)(GLenum); -const GLubyte *(GLAPIENTRY *GetString)(GLenum); -void (GLAPIENTRY *DrawBuffer)(GLenum); -void (GLAPIENTRY *DepthMask)(GLboolean); -void (GLAPIENTRY *BlendFunc)(GLenum, GLenum); -void (GLAPIENTRY *Flush)(void); -void (GLAPIENTRY *Finish)(void); -void (GLAPIENTRY *PixelStorei)(GLenum, GLint); -void (GLAPIENTRY *TexImage1D)(GLenum, GLint, GLint, GLsizei, GLint, GLenum, GLenum, const GLvoid *); -void (GLAPIENTRY *TexImage2D)(GLenum, GLint, GLint, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid *); -void (GLAPIENTRY *TexSubImage2D)(GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *); -void (GLAPIENTRY *TexParameteri)(GLenum, GLenum, GLint); -void (GLAPIENTRY *TexParameterf)(GLenum, GLenum, GLfloat); -void (GLAPIENTRY *TexParameterfv)(GLenum, GLenum, const GLfloat *); -void (GLAPIENTRY *TexCoord2f)(GLfloat, GLfloat); -void (GLAPIENTRY *Vertex2f)(GLfloat, GLfloat); -void (GLAPIENTRY *Vertex3f)(GLfloat, GLfloat, GLfloat); -void (GLAPIENTRY *Normal3f)(GLfloat, GLfloat, GLfloat); -void (GLAPIENTRY *Lightfv)(GLenum, GLenum, const GLfloat *); -void (GLAPIENTRY *ColorMaterial)(GLenum, GLenum); -void (GLAPIENTRY *ShadeModel)(GLenum); -void (GLAPIENTRY *GetIntegerv)(GLenum, GLint *); +void (GLAPIENTRY *mpglBegin)(GLenum); +void (GLAPIENTRY *mpglEnd)(void); +void (GLAPIENTRY *mpglViewport)(GLint, GLint, GLsizei, GLsizei); +void (GLAPIENTRY *mpglMatrixMode)(GLenum); +void (GLAPIENTRY *mpglLoadIdentity)(void); +void (GLAPIENTRY *mpglTranslated)(double, double, double); +void (GLAPIENTRY *mpglScaled)(double, double, double); +void (GLAPIENTRY *mpglOrtho)(double, double, double, double, double, double); +void (GLAPIENTRY *mpglFrustum)(double, double, double, double, double, double); +void (GLAPIENTRY *mpglPushMatrix)(void); +void (GLAPIENTRY *mpglPopMatrix)(void); +void (GLAPIENTRY *mpglClear)(GLbitfield); +GLuint (GLAPIENTRY *mpglGenLists)(GLsizei); +void (GLAPIENTRY *mpglDeleteLists)(GLuint, GLsizei); +void (GLAPIENTRY *mpglNewList)(GLuint, GLenum); +void (GLAPIENTRY *mpglEndList)(void); +void (GLAPIENTRY *mpglCallList)(GLuint); +void (GLAPIENTRY *mpglCallLists)(GLsizei, GLenum, const GLvoid *); +void (GLAPIENTRY *mpglGenTextures)(GLsizei, GLuint *); +void (GLAPIENTRY *mpglDeleteTextures)(GLsizei, const GLuint *); +void (GLAPIENTRY *mpglTexEnvf)(GLenum, GLenum, GLfloat); +void (GLAPIENTRY *mpglTexEnvi)(GLenum, GLenum, GLint); +void (GLAPIENTRY *mpglColor4ub)(GLubyte, GLubyte, GLubyte, GLubyte); +void (GLAPIENTRY *mpglColor3f)(GLfloat, GLfloat, GLfloat); +void (GLAPIENTRY *mpglColor4f)(GLfloat, GLfloat, GLfloat, GLfloat); +void (GLAPIENTRY *mpglClearColor)(GLclampf, GLclampf, GLclampf, GLclampf); +void (GLAPIENTRY *mpglClearDepth)(GLclampd); +void (GLAPIENTRY *mpglDepthFunc)(GLenum); +void (GLAPIENTRY *mpglEnable)(GLenum); +void (GLAPIENTRY *mpglDisable)(GLenum); +const GLubyte *(GLAPIENTRY *mpglGetString)(GLenum); +void (GLAPIENTRY *mpglDrawBuffer)(GLenum); +void (GLAPIENTRY *mpglDepthMask)(GLboolean); +void (GLAPIENTRY *mpglBlendFunc)(GLenum, GLenum); +void (GLAPIENTRY *mpglFlush)(void); +void (GLAPIENTRY *mpglFinish)(void); +void (GLAPIENTRY *mpglPixelStorei)(GLenum, GLint); +void (GLAPIENTRY *mpglTexImage1D)(GLenum, GLint, GLint, GLsizei, GLint, GLenum, GLenum, const GLvoid *); +void (GLAPIENTRY *mpglTexImage2D)(GLenum, GLint, GLint, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid *); +void (GLAPIENTRY *mpglTexSubImage2D)(GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *); +void (GLAPIENTRY *mpglTexParameteri)(GLenum, GLenum, GLint); +void (GLAPIENTRY *mpglTexParameterf)(GLenum, GLenum, GLfloat); +void (GLAPIENTRY *mpglTexParameterfv)(GLenum, GLenum, const GLfloat *); +void (GLAPIENTRY *mpglTexCoord2f)(GLfloat, GLfloat); +void (GLAPIENTRY *mpglVertex2f)(GLfloat, GLfloat); +void (GLAPIENTRY *mpglVertex3f)(GLfloat, GLfloat, GLfloat); +void (GLAPIENTRY *mpglNormal3f)(GLfloat, GLfloat, GLfloat); +void (GLAPIENTRY *mpglLightfv)(GLenum, GLenum, const GLfloat *); +void (GLAPIENTRY *mpglColorMaterial)(GLenum, GLenum); +void (GLAPIENTRY *mpglShadeModel)(GLenum); +void (GLAPIENTRY *mpglGetIntegerv)(GLenum, GLint *); /** * \defgroup glextfunctions OpenGL extension functions @@ -95,43 +95,43 @@ void (GLAPIENTRY *GetIntegerv)(GLenum, GLint *); * context is created * \{ */ -void (GLAPIENTRY *GenBuffers)(GLsizei, GLuint *); -void (GLAPIENTRY *DeleteBuffers)(GLsizei, const GLuint *); -void (GLAPIENTRY *BindBuffer)(GLenum, GLuint); -GLvoid* (GLAPIENTRY *MapBuffer)(GLenum, GLenum); -GLboolean (GLAPIENTRY *UnmapBuffer)(GLenum); -void (GLAPIENTRY *BufferData)(GLenum, intptr_t, const GLvoid *, GLenum); -void (GLAPIENTRY *CombinerParameterfv)(GLenum, const GLfloat *); -void (GLAPIENTRY *CombinerParameteri)(GLenum, GLint); -void (GLAPIENTRY *CombinerInput)(GLenum, GLenum, GLenum, GLenum, GLenum, +void (GLAPIENTRY *mpglGenBuffers)(GLsizei, GLuint *); +void (GLAPIENTRY *mpglDeleteBuffers)(GLsizei, const GLuint *); +void (GLAPIENTRY *mpglBindBuffer)(GLenum, GLuint); +GLvoid* (GLAPIENTRY *mpglMapBuffer)(GLenum, GLenum); +GLboolean (GLAPIENTRY *mpglUnmapBuffer)(GLenum); +void (GLAPIENTRY *mpglBufferData)(GLenum, intptr_t, const GLvoid *, GLenum); +void (GLAPIENTRY *mpglCombinerParameterfv)(GLenum, const GLfloat *); +void (GLAPIENTRY *mpglCombinerParameteri)(GLenum, GLint); +void (GLAPIENTRY *mpglCombinerInput)(GLenum, GLenum, GLenum, GLenum, GLenum, GLenum); -void (GLAPIENTRY *CombinerOutput)(GLenum, GLenum, GLenum, GLenum, GLenum, +void (GLAPIENTRY *mpglCombinerOutput)(GLenum, GLenum, GLenum, GLenum, GLenum, GLenum, GLenum, GLboolean, GLboolean, GLboolean); -void (GLAPIENTRY *BeginFragmentShader)(void); -void (GLAPIENTRY *EndFragmentShader)(void); -void (GLAPIENTRY *SampleMap)(GLuint, GLuint, GLenum); -void (GLAPIENTRY *ColorFragmentOp2)(GLenum, GLuint, GLuint, GLuint, GLuint, +void (GLAPIENTRY *mpglBeginFragmentShader)(void); +void (GLAPIENTRY *mpglEndFragmentShader)(void); +void (GLAPIENTRY *mpglSampleMap)(GLuint, GLuint, GLenum); +void (GLAPIENTRY *mpglColorFragmentOp2)(GLenum, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint); -void (GLAPIENTRY *ColorFragmentOp3)(GLenum, GLuint, GLuint, GLuint, GLuint, +void (GLAPIENTRY *mpglColorFragmentOp3)(GLenum, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint); -void (GLAPIENTRY *SetFragmentShaderConstant)(GLuint, const GLfloat *); -void (GLAPIENTRY *ActiveTexture)(GLenum); -void (GLAPIENTRY *BindTexture)(GLenum, GLuint); -void (GLAPIENTRY *MultiTexCoord2f)(GLenum, GLfloat, GLfloat); -void (GLAPIENTRY *GenPrograms)(GLsizei, GLuint *); -void (GLAPIENTRY *DeletePrograms)(GLsizei, const GLuint *); -void (GLAPIENTRY *BindProgram)(GLenum, GLuint); -void (GLAPIENTRY *ProgramString)(GLenum, GLenum, GLsizei, const GLvoid *); -void (GLAPIENTRY *GetProgramiv)(GLenum, GLenum, GLint *); -void (GLAPIENTRY *ProgramEnvParameter4f)(GLenum, GLuint, GLfloat, GLfloat, +void (GLAPIENTRY *mpglSetFragmentShaderConstant)(GLuint, const GLfloat *); +void (GLAPIENTRY *mpglActiveTexture)(GLenum); +void (GLAPIENTRY *mpglBindTexture)(GLenum, GLuint); +void (GLAPIENTRY *mpglMultiTexCoord2f)(GLenum, GLfloat, GLfloat); +void (GLAPIENTRY *mpglGenPrograms)(GLsizei, GLuint *); +void (GLAPIENTRY *mpglDeletePrograms)(GLsizei, const GLuint *); +void (GLAPIENTRY *mpglBindProgram)(GLenum, GLuint); +void (GLAPIENTRY *mpglProgramString)(GLenum, GLenum, GLsizei, const GLvoid *); +void (GLAPIENTRY *mpglGetProgramiv)(GLenum, GLenum, GLint *); +void (GLAPIENTRY *mpglProgramEnvParameter4f)(GLenum, GLuint, GLfloat, GLfloat, GLfloat, GLfloat); -int (GLAPIENTRY *SwapInterval)(int); -void (GLAPIENTRY *TexImage3D)(GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, +int (GLAPIENTRY *mpglSwapInterval)(int); +void (GLAPIENTRY *mpglTexImage3D)(GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid *); -void* (GLAPIENTRY *AllocateMemoryMESA)(void *, int, size_t, float, float, float); -void (GLAPIENTRY *FreeMemoryMESA)(void *, int, void *); +void* (GLAPIENTRY *mpglAllocateMemoryMESA)(void *, int, size_t, float, float, float); +void (GLAPIENTRY *mpglFreeMemoryMESA)(void *, int, void *); /** \} */ // end of glextfunctions group //! \defgroup glgeneral OpenGL general helper functions @@ -159,7 +159,7 @@ void glAdjustAlignment(int stride) { gl_alignment=2; else gl_alignment=1; - PixelStorei(GL_UNPACK_ALIGNMENT, gl_alignment); + mpglPixelStorei(GL_UNPACK_ALIGNMENT, gl_alignment); } struct gl_name_map_struct { @@ -361,7 +361,7 @@ typedef struct { void *fallback; } extfunc_desc_t; -#define DEF_FUNC_DESC(name) {&name, NULL, {"gl"#name, NULL}, gl ##name} +#define DEF_FUNC_DESC(name) {&mpgl##name, NULL, {"gl"#name, NULL}, gl ##name} static const extfunc_desc_t extfuncs[] = { // these aren't extension functions but we query them anyway to allow // different "backends" with one binary @@ -417,35 +417,35 @@ static const extfunc_desc_t extfuncs[] = { DEF_FUNC_DESC(GetIntegerv), // here start the real extensions - {&GenBuffers, NULL, {"glGenBuffers", "glGenBuffersARB", NULL}}, - {&DeleteBuffers, NULL, {"glDeleteBuffers", "glDeleteBuffersARB", NULL}}, - {&BindBuffer, NULL, {"glBindBuffer", "glBindBufferARB", NULL}}, - {&MapBuffer, NULL, {"glMapBuffer", "glMapBufferARB", NULL}}, - {&UnmapBuffer, NULL, {"glUnmapBuffer", "glUnmapBufferARB", NULL}}, - {&BufferData, NULL, {"glBufferData", "glBufferDataARB", NULL}}, - {&CombinerParameterfv, "NV_register_combiners", {"glCombinerParameterfv", "glCombinerParameterfvNV", NULL}}, - {&CombinerParameteri, "NV_register_combiners", {"glCombinerParameteri", "glCombinerParameteriNV", NULL}}, - {&CombinerInput, "NV_register_combiners", {"glCombinerInput", "glCombinerInputNV", NULL}}, - {&CombinerOutput, "NV_register_combiners", {"glCombinerOutput", "glCombinerOutputNV", NULL}}, - {&BeginFragmentShader, "ATI_fragment_shader", {"glBeginFragmentShaderATI", NULL}}, - {&EndFragmentShader, "ATI_fragment_shader", {"glEndFragmentShaderATI", NULL}}, - {&SampleMap, "ATI_fragment_shader", {"glSampleMapATI", NULL}}, - {&ColorFragmentOp2, "ATI_fragment_shader", {"glColorFragmentOp2ATI", NULL}}, - {&ColorFragmentOp3, "ATI_fragment_shader", {"glColorFragmentOp3ATI", NULL}}, - {&SetFragmentShaderConstant, "ATI_fragment_shader", {"glSetFragmentShaderConstantATI", NULL}}, - {&ActiveTexture, NULL, {"glActiveTexture", "glActiveTextureARB", NULL}}, - {&BindTexture, NULL, {"glBindTexture", "glBindTextureARB", "glBindTextureEXT", NULL}}, - {&MultiTexCoord2f, NULL, {"glMultiTexCoord2f", "glMultiTexCoord2fARB", NULL}}, - {&GenPrograms, "_program", {"glGenProgramsARB", NULL}}, - {&DeletePrograms, "_program", {"glDeleteProgramsARB", NULL}}, - {&BindProgram, "_program", {"glBindProgramARB", NULL}}, - {&ProgramString, "_program", {"glProgramStringARB", NULL}}, - {&GetProgramiv, "_program", {"glGetProgramivARB", NULL}}, - {&ProgramEnvParameter4f, "_program", {"glProgramEnvParameter4fARB", NULL}}, - {&SwapInterval, "_swap_control", {"glXSwapIntervalSGI", "glXSwapInterval", "wglSwapIntervalSGI", "wglSwapInterval", "wglSwapIntervalEXT", NULL}}, - {&TexImage3D, NULL, {"glTexImage3D", NULL}}, - {&AllocateMemoryMESA, "GLX_MESA_allocate_memory", {"glXAllocateMemoryMESA", NULL}}, - {&FreeMemoryMESA, "GLX_MESA_allocate_memory", {"glXFreeMemoryMESA", NULL}}, + {&mpglGenBuffers, NULL, {"glGenBuffers", "glGenBuffersARB", NULL}}, + {&mpglDeleteBuffers, NULL, {"glDeleteBuffers", "glDeleteBuffersARB", NULL}}, + {&mpglBindBuffer, NULL, {"glBindBuffer", "glBindBufferARB", NULL}}, + {&mpglMapBuffer, NULL, {"glMapBuffer", "glMapBufferARB", NULL}}, + {&mpglUnmapBuffer, NULL, {"glUnmapBuffer", "glUnmapBufferARB", NULL}}, + {&mpglBufferData, NULL, {"glBufferData", "glBufferDataARB", NULL}}, + {&mpglCombinerParameterfv, "NV_register_combiners", {"glCombinerParameterfv", "glCombinerParameterfvNV", NULL}}, + {&mpglCombinerParameteri, "NV_register_combiners", {"glCombinerParameteri", "glCombinerParameteriNV", NULL}}, + {&mpglCombinerInput, "NV_register_combiners", {"glCombinerInput", "glCombinerInputNV", NULL}}, + {&mpglCombinerOutput, "NV_register_combiners", {"glCombinerOutput", "glCombinerOutputNV", NULL}}, + {&mpglBeginFragmentShader, "ATI_fragment_shader", {"glBeginFragmentShaderATI", NULL}}, + {&mpglEndFragmentShader, "ATI_fragment_shader", {"glEndFragmentShaderATI", NULL}}, + {&mpglSampleMap, "ATI_fragment_shader", {"glSampleMapATI", NULL}}, + {&mpglColorFragmentOp2, "ATI_fragment_shader", {"glColorFragmentOp2ATI", NULL}}, + {&mpglColorFragmentOp3, "ATI_fragment_shader", {"glColorFragmentOp3ATI", NULL}}, + {&mpglSetFragmentShaderConstant, "ATI_fragment_shader", {"glSetFragmentShaderConstantATI", NULL}}, + {&mpglActiveTexture, NULL, {"glActiveTexture", "glActiveTextureARB", NULL}}, + {&mpglBindTexture, NULL, {"glBindTexture", "glBindTextureARB", "glBindTextureEXT", NULL}}, + {&mpglMultiTexCoord2f, NULL, {"glMultiTexCoord2f", "glMultiTexCoord2fARB", NULL}}, + {&mpglGenPrograms, "_program", {"glGenProgramsARB", NULL}}, + {&mpglDeletePrograms, "_program", {"glDeleteProgramsARB", NULL}}, + {&mpglBindProgram, "_program", {"glBindProgramARB", NULL}}, + {&mpglProgramString, "_program", {"glProgramStringARB", NULL}}, + {&mpglGetProgramiv, "_program", {"glGetProgramivARB", NULL}}, + {&mpglProgramEnvParameter4f, "_program", {"glProgramEnvParameter4fARB", NULL}}, + {&mpglSwapInterval, "_swap_control", {"glXSwapIntervalSGI", "glXSwapInterval", "wglSwapIntervalSGI", "wglSwapInterval", "wglSwapIntervalEXT", NULL}}, + {&mpglTexImage3D, NULL, {"glTexImage3D", NULL}}, + {&mpglAllocateMemoryMESA, "GLX_MESA_allocate_memory", {"glXAllocateMemoryMESA", NULL}}, + {&mpglFreeMemoryMESA, "GLX_MESA_allocate_memory", {"glXFreeMemoryMESA", NULL}}, {NULL} }; @@ -464,11 +464,11 @@ static void getFunctions(void *(*getProcAddress)(const GLubyte *), getProcAddress = setNull; // special case, we need glGetString before starting to find the other functions - GetString = getProcAddress("glGetString"); - if (!GetString) - GetString = glGetString; + mpglGetString = getProcAddress("glGetString"); + if (!mpglGetString) + mpglGetString = glGetString; - extensions = (const char *)GetString(GL_EXTENSIONS); + extensions = (const char *)mpglGetString(GL_EXTENSIONS); if (!extensions) extensions = ""; if (!ext2) ext2 = ""; allexts = malloc(strlen(extensions) + strlen(ext2) + 2); @@ -518,16 +518,16 @@ void glCreateClearTex(GLenum target, GLenum fmt, GLenum format, GLenum type, GLi init = malloc(stride * h); memset(init, val, stride * h); glAdjustAlignment(stride); - PixelStorei(GL_UNPACK_ROW_LENGTH, w); - TexImage2D(target, 0, fmt, w, h, 0, format, type, init); - TexParameterf(target, GL_TEXTURE_PRIORITY, 1.0); - TexParameteri(target, GL_TEXTURE_MIN_FILTER, filter); - TexParameteri(target, GL_TEXTURE_MAG_FILTER, filter); - TexParameteri(target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); - TexParameteri(target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + mpglPixelStorei(GL_UNPACK_ROW_LENGTH, w); + mpglTexImage2D(target, 0, fmt, w, h, 0, format, type, init); + mpglTexParameterf(target, GL_TEXTURE_PRIORITY, 1.0); + mpglTexParameteri(target, GL_TEXTURE_MIN_FILTER, filter); + mpglTexParameteri(target, GL_TEXTURE_MAG_FILTER, filter); + mpglTexParameteri(target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + mpglTexParameteri(target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); // Border texels should not be used with CLAMP_TO_EDGE // We set a sane default anyway. - TexParameterfv(target, GL_TEXTURE_BORDER_COLOR, border); + mpglTexParameterfv(target, GL_TEXTURE_BORDER_COLOR, border); free(init); } @@ -675,13 +675,13 @@ void glUploadTex(GLenum target, GLenum format, GLenum type, } // this is not always correct, but should work for MPlayer glAdjustAlignment(stride); - PixelStorei(GL_UNPACK_ROW_LENGTH, stride / glFmt2bpp(format, type)); + mpglPixelStorei(GL_UNPACK_ROW_LENGTH, stride / glFmt2bpp(format, type)); for (; y + slice <= y_max; y += slice) { - TexSubImage2D(target, 0, x, y, w, slice, format, type, data); + mpglTexSubImage2D(target, 0, x, y, w, slice, format, type, data); data += stride * slice; } if (y < y_max) - TexSubImage2D(target, 0, x, y, w, y_max - y, format, type, data); + mpglTexSubImage2D(target, 0, x, y, w, y_max - y, format, type, data); } static void fillUVcoeff(GLfloat *ucoef, GLfloat *vcoef, @@ -715,98 +715,147 @@ static void glSetupYUVCombiners(float uvcos, float uvsin) { GLfloat ucoef[4]; GLfloat vcoef[4]; GLint i; - if (!CombinerInput || !CombinerOutput || - !CombinerParameterfv || !CombinerParameteri) { + if (!mpglCombinerInput || !mpglCombinerOutput || + !mpglCombinerParameterfv || !mpglCombinerParameteri) { mp_msg(MSGT_VO, MSGL_FATAL, "[gl] Combiner functions missing!\n"); return; } - GetIntegerv(GL_MAX_GENERAL_COMBINERS_NV, &i); + mpglGetIntegerv(GL_MAX_GENERAL_COMBINERS_NV, &i); if (i < 2) mp_msg(MSGT_VO, MSGL_ERR, "[gl] 2 general combiners needed for YUV combiner support (found %i)\n", i); - GetIntegerv(GL_MAX_TEXTURE_UNITS, &i); + mpglGetIntegerv(GL_MAX_TEXTURE_UNITS, &i); if (i < 3) mp_msg(MSGT_VO, MSGL_ERR, "[gl] 3 texture units needed for YUV combiner support (found %i)\n", i); fillUVcoeff(ucoef, vcoef, uvcos, uvsin); - CombinerParameterfv(GL_CONSTANT_COLOR0_NV, ucoef); - CombinerParameterfv(GL_CONSTANT_COLOR1_NV, vcoef); + mpglCombinerParameterfv(GL_CONSTANT_COLOR0_NV, ucoef); + mpglCombinerParameterfv(GL_CONSTANT_COLOR1_NV, vcoef); // UV first, like this green component cannot overflow - CombinerInput(GL_COMBINER0_NV, GL_RGB, GL_VARIABLE_A_NV, - GL_TEXTURE1, GL_HALF_BIAS_NORMAL_NV, GL_RGB); - CombinerInput(GL_COMBINER0_NV, GL_RGB, GL_VARIABLE_B_NV, - GL_CONSTANT_COLOR0_NV, GL_HALF_BIAS_NORMAL_NV, GL_RGB); - CombinerInput(GL_COMBINER0_NV, GL_RGB, GL_VARIABLE_C_NV, - GL_TEXTURE2, GL_HALF_BIAS_NORMAL_NV, GL_RGB); - CombinerInput(GL_COMBINER0_NV, GL_RGB, GL_VARIABLE_D_NV, - GL_CONSTANT_COLOR1_NV, GL_HALF_BIAS_NORMAL_NV, GL_RGB); - CombinerOutput(GL_COMBINER0_NV, GL_RGB, GL_DISCARD_NV, GL_DISCARD_NV, - GL_SPARE0_NV, GL_SCALE_BY_FOUR_NV, GL_NONE, GL_FALSE, - GL_FALSE, GL_FALSE); + mpglCombinerInput(GL_COMBINER0_NV, GL_RGB, GL_VARIABLE_A_NV, + GL_TEXTURE1, GL_HALF_BIAS_NORMAL_NV, GL_RGB); + mpglCombinerInput(GL_COMBINER0_NV, GL_RGB, GL_VARIABLE_B_NV, + GL_CONSTANT_COLOR0_NV, GL_HALF_BIAS_NORMAL_NV, GL_RGB); + mpglCombinerInput(GL_COMBINER0_NV, GL_RGB, GL_VARIABLE_C_NV, + GL_TEXTURE2, GL_HALF_BIAS_NORMAL_NV, GL_RGB); + mpglCombinerInput(GL_COMBINER0_NV, GL_RGB, GL_VARIABLE_D_NV, + GL_CONSTANT_COLOR1_NV, GL_HALF_BIAS_NORMAL_NV, GL_RGB); + mpglCombinerOutput(GL_COMBINER0_NV, GL_RGB, GL_DISCARD_NV, GL_DISCARD_NV, + GL_SPARE0_NV, GL_SCALE_BY_FOUR_NV, GL_NONE, GL_FALSE, + GL_FALSE, GL_FALSE); // stage 2 - CombinerInput(GL_COMBINER1_NV, GL_RGB, GL_VARIABLE_A_NV, GL_SPARE0_NV, - GL_SIGNED_IDENTITY_NV, GL_RGB); - CombinerInput(GL_COMBINER1_NV, GL_RGB, GL_VARIABLE_B_NV, GL_ZERO, - GL_UNSIGNED_INVERT_NV, GL_RGB); - CombinerInput(GL_COMBINER1_NV, GL_RGB, GL_VARIABLE_C_NV, - GL_TEXTURE0, GL_SIGNED_IDENTITY_NV, GL_RGB); - CombinerInput(GL_COMBINER1_NV, GL_RGB, GL_VARIABLE_D_NV, GL_ZERO, - GL_UNSIGNED_INVERT_NV, GL_RGB); - CombinerOutput(GL_COMBINER1_NV, GL_RGB, GL_DISCARD_NV, GL_DISCARD_NV, - GL_SPARE0_NV, GL_NONE, GL_NONE, GL_FALSE, - GL_FALSE, GL_FALSE); + mpglCombinerInput(GL_COMBINER1_NV, GL_RGB, GL_VARIABLE_A_NV, GL_SPARE0_NV, + GL_SIGNED_IDENTITY_NV, GL_RGB); + mpglCombinerInput(GL_COMBINER1_NV, GL_RGB, GL_VARIABLE_B_NV, GL_ZERO, + GL_UNSIGNED_INVERT_NV, GL_RGB); + mpglCombinerInput(GL_COMBINER1_NV, GL_RGB, GL_VARIABLE_C_NV, + GL_TEXTURE0, GL_SIGNED_IDENTITY_NV, GL_RGB); + mpglCombinerInput(GL_COMBINER1_NV, GL_RGB, GL_VARIABLE_D_NV, GL_ZERO, + GL_UNSIGNED_INVERT_NV, GL_RGB); + mpglCombinerOutput(GL_COMBINER1_NV, GL_RGB, GL_DISCARD_NV, GL_DISCARD_NV, + GL_SPARE0_NV, GL_NONE, GL_NONE, GL_FALSE, + GL_FALSE, GL_FALSE); // leave final combiner stage in default mode - CombinerParameteri(GL_NUM_GENERAL_COMBINERS_NV, 2); + mpglCombinerParameteri(GL_NUM_GENERAL_COMBINERS_NV, 2); } /** * \brief Setup ATI version of register combiners for YUV to RGB conversion. - * \param uvcos used for saturation and hue adjustment - * \param uvsin used for saturation and hue adjustment - * - * ATI called this fragment shader, but the name is confusing in the - * light of a very different OpenGL 2.0 extension with the same name + * \param csp_params parameters used for colorspace conversion + * \param text if set use the GL_ATI_text_fragment_shader API as + * used on OS X. */ -static void glSetupYUVCombinersATI(float uvcos, float uvsin) { - GLfloat ucoef[4]; - GLfloat vcoef[4]; +static void glSetupYUVFragmentATI(struct mp_csp_params *csp_params, + int text) { GLint i; - if (!BeginFragmentShader || !EndFragmentShader || - !SetFragmentShaderConstant || !SampleMap || - !ColorFragmentOp2 || !ColorFragmentOp3) { - mp_msg(MSGT_VO, MSGL_FATAL, "[gl] Combiner (ATI) functions missing!\n"); - return; - } - GetIntegerv(GL_NUM_FRAGMENT_REGISTERS_ATI, &i); - if (i < 3) - mp_msg(MSGT_VO, MSGL_ERR, - "[gl] 3 registers needed for YUV combiner (ATI) support (found %i)\n", i); - GetIntegerv (GL_MAX_TEXTURE_UNITS, &i); + float yuv2rgb[3][4]; + + mpglGetIntegerv (GL_MAX_TEXTURE_UNITS, &i); if (i < 3) mp_msg(MSGT_VO, MSGL_ERR, "[gl] 3 texture units needed for YUV combiner (ATI) support (found %i)\n", i); - fillUVcoeff(ucoef, vcoef, uvcos, uvsin); - BeginFragmentShader(); - SetFragmentShaderConstant(GL_CON_0_ATI, ucoef); - SetFragmentShaderConstant(GL_CON_1_ATI, vcoef); - SampleMap(GL_REG_0_ATI, GL_TEXTURE0, GL_SWIZZLE_STR_ATI); - SampleMap(GL_REG_1_ATI, GL_TEXTURE1, GL_SWIZZLE_STR_ATI); - SampleMap(GL_REG_2_ATI, GL_TEXTURE2, GL_SWIZZLE_STR_ATI); - // UV first, like this green component cannot overflow - ColorFragmentOp2(GL_MUL_ATI, GL_REG_1_ATI, GL_NONE, GL_NONE, - GL_REG_1_ATI, GL_NONE, GL_BIAS_BIT_ATI, - GL_CON_0_ATI, GL_NONE, GL_BIAS_BIT_ATI); - ColorFragmentOp3(GL_MAD_ATI, GL_REG_2_ATI, GL_NONE, GL_4X_BIT_ATI, - GL_REG_2_ATI, GL_NONE, GL_BIAS_BIT_ATI, - GL_CON_1_ATI, GL_NONE, GL_BIAS_BIT_ATI, - GL_REG_1_ATI, GL_NONE, GL_NONE); - ColorFragmentOp2(GL_ADD_ATI, GL_REG_0_ATI, GL_NONE, GL_NONE, - GL_REG_0_ATI, GL_NONE, GL_NONE, - GL_REG_2_ATI, GL_NONE, GL_NONE); - EndFragmentShader(); + + mp_get_yuv2rgb_coeffs(csp_params, yuv2rgb); + for (i = 0; i < 3; i++) { + int j; + yuv2rgb[i][3] -= -0.5 * (yuv2rgb[i][1] + yuv2rgb[i][2]); + for (j = 0; j < 4; j++) { + yuv2rgb[i][j] *= 0.125; + yuv2rgb[i][j] += 0.5; + if (yuv2rgb[i][j] > 1) + yuv2rgb[i][j] = 1; + if (yuv2rgb[i][j] < 0) + yuv2rgb[i][j] = 0; + } + } + if (text == 0) { + GLfloat c0[4] = {yuv2rgb[0][0], yuv2rgb[1][0], yuv2rgb[2][0]}; + GLfloat c1[4] = {yuv2rgb[0][1], yuv2rgb[1][1], yuv2rgb[2][1]}; + GLfloat c2[4] = {yuv2rgb[0][2], yuv2rgb[1][2], yuv2rgb[2][2]}; + GLfloat c3[4] = {yuv2rgb[0][3], yuv2rgb[1][3], yuv2rgb[2][3]}; + if (!mpglBeginFragmentShader || !mpglEndFragmentShader || + !mpglSetFragmentShaderConstant || !mpglSampleMap || + !mpglColorFragmentOp2 || !mpglColorFragmentOp3) { + mp_msg(MSGT_VO, MSGL_FATAL, "[gl] Combiner (ATI) functions missing!\n"); + return; + } + mpglGetIntegerv(GL_NUM_FRAGMENT_REGISTERS_ATI, &i); + if (i < 3) + mp_msg(MSGT_VO, MSGL_ERR, + "[gl] 3 registers needed for YUV combiner (ATI) support (found %i)\n", i); + mpglBeginFragmentShader(); + mpglSetFragmentShaderConstant(GL_CON_0_ATI, c0); + mpglSetFragmentShaderConstant(GL_CON_1_ATI, c1); + mpglSetFragmentShaderConstant(GL_CON_2_ATI, c2); + mpglSetFragmentShaderConstant(GL_CON_3_ATI, c3); + mpglSampleMap(GL_REG_0_ATI, GL_TEXTURE0, GL_SWIZZLE_STR_ATI); + mpglSampleMap(GL_REG_1_ATI, GL_TEXTURE1, GL_SWIZZLE_STR_ATI); + mpglSampleMap(GL_REG_2_ATI, GL_TEXTURE2, GL_SWIZZLE_STR_ATI); + mpglColorFragmentOp2(GL_MUL_ATI, GL_REG_1_ATI, GL_NONE, GL_NONE, + GL_REG_1_ATI, GL_NONE, GL_BIAS_BIT_ATI, + GL_CON_1_ATI, GL_NONE, GL_BIAS_BIT_ATI); + mpglColorFragmentOp3(GL_MAD_ATI, GL_REG_2_ATI, GL_NONE, GL_NONE, + GL_REG_2_ATI, GL_NONE, GL_BIAS_BIT_ATI, + GL_CON_2_ATI, GL_NONE, GL_BIAS_BIT_ATI, + GL_REG_1_ATI, GL_NONE, GL_NONE); + mpglColorFragmentOp3(GL_MAD_ATI, GL_REG_0_ATI, GL_NONE, GL_NONE, + GL_REG_0_ATI, GL_NONE, GL_NONE, + GL_CON_0_ATI, GL_NONE, GL_BIAS_BIT_ATI, + GL_REG_2_ATI, GL_NONE, GL_NONE); + mpglColorFragmentOp2(GL_ADD_ATI, GL_REG_0_ATI, GL_NONE, GL_8X_BIT_ATI, + GL_REG_0_ATI, GL_NONE, GL_NONE, + GL_CON_3_ATI, GL_NONE, GL_BIAS_BIT_ATI); + mpglEndFragmentShader(); + } else { + static const char template[] = + "!!ATIfs1.0\n" + "StartConstants;\n" + " CONSTANT c0 = {%e, %e, %e};\n" + " CONSTANT c1 = {%e, %e, %e};\n" + " CONSTANT c2 = {%e, %e, %e};\n" + " CONSTANT c3 = {%e, %e, %e};\n" + "EndConstants;\n" + "StartOutputPass;\n" + " SampleMap r0, t0.str;\n" + " SampleMap r1, t1.str;\n" + " SampleMap r2, t2.str;\n" + " MUL r1.rgb, r1.bias, c1.bias;\n" + " MAD r2.rgb, r2.bias, c2.bias, r1;\n" + " MAD r0.rgb, r0, c0.bias, r2;\n" + " ADD r0.rgb.8x, r0, c3.bias;\n" + "EndPass;\n"; + char buffer[512]; + snprintf(buffer, sizeof(buffer), template, + yuv2rgb[0][0], yuv2rgb[1][0], yuv2rgb[2][0], + yuv2rgb[0][1], yuv2rgb[1][1], yuv2rgb[2][1], + yuv2rgb[0][2], yuv2rgb[1][2], yuv2rgb[2][2], + yuv2rgb[0][3], yuv2rgb[1][3], yuv2rgb[2][3]); + mp_msg(MSGT_VO, MSGL_DBG2, "[gl] generated fragment program:\n%s\n", buffer); + loadGPUProgram(GL_TEXT_FRAGMENT_SHADER_ATI, buffer); + } } /** @@ -845,13 +894,13 @@ static void gen_spline_lookup_tex(GLenum unit) { } store_weights(0, tex); store_weights(1, &tex[4 * (LOOKUP_BSPLINE_RES - 1)]); - ActiveTexture(unit); - TexImage1D(GL_TEXTURE_1D, 0, GL_RGBA16, LOOKUP_BSPLINE_RES, 0, GL_RGBA, GL_FLOAT, tex); - TexParameterf(GL_TEXTURE_1D, GL_TEXTURE_PRIORITY, 1.0); - TexParameteri(GL_TEXTURE_1D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - TexParameteri(GL_TEXTURE_1D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - TexParameteri(GL_TEXTURE_1D, GL_TEXTURE_WRAP_S, GL_REPEAT); - ActiveTexture(GL_TEXTURE0); + mpglActiveTexture(unit); + mpglTexImage1D(GL_TEXTURE_1D, 0, GL_RGBA16, LOOKUP_BSPLINE_RES, 0, GL_RGBA, GL_FLOAT, tex); + mpglTexParameterf(GL_TEXTURE_1D, GL_TEXTURE_PRIORITY, 1.0); + mpglTexParameteri(GL_TEXTURE_1D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + mpglTexParameteri(GL_TEXTURE_1D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + mpglTexParameteri(GL_TEXTURE_1D, GL_TEXTURE_WRAP_S, GL_REPEAT); + mpglActiveTexture(GL_TEXTURE0); free(tex); } @@ -1063,7 +1112,7 @@ static void create_conv_textures(gl_conversion_params_t *params, int *texu, char break; case YUV_CONVERSION_FRAGMENT_LOOKUP: texs[0] = (*texu)++; - ActiveTexture(GL_TEXTURE0 + texs[0]); + mpglActiveTexture(GL_TEXTURE0 + texs[0]); lookup_data = malloc(4 * LOOKUP_RES); mp_gen_gamma_map(lookup_data, LOOKUP_RES, params->csp_params.rgamma); mp_gen_gamma_map(&lookup_data[LOOKUP_RES], LOOKUP_RES, params->csp_params.ggamma); @@ -1072,31 +1121,31 @@ static void create_conv_textures(gl_conversion_params_t *params, int *texu, char LOOKUP_RES, 4, 0); glUploadTex(GL_TEXTURE_2D, GL_LUMINANCE, GL_UNSIGNED_BYTE, lookup_data, LOOKUP_RES, 0, 0, LOOKUP_RES, 4, 0); - ActiveTexture(GL_TEXTURE0); + mpglActiveTexture(GL_TEXTURE0); texs[0] += '0'; break; case YUV_CONVERSION_FRAGMENT_LOOKUP3D: { int sz = LOOKUP_3DRES + 2; // texture size including borders - if (!TexImage3D) { + if (!mpglTexImage3D) { mp_msg(MSGT_VO, MSGL_ERR, "[gl] Missing 3D texture function!\n"); break; } texs[0] = (*texu)++; - ActiveTexture(GL_TEXTURE0 + texs[0]); + mpglActiveTexture(GL_TEXTURE0 + texs[0]); lookup_data = malloc(3 * sz * sz * sz); mp_gen_yuv2rgb_map(¶ms->csp_params, lookup_data, LOOKUP_3DRES); glAdjustAlignment(sz); - PixelStorei(GL_UNPACK_ROW_LENGTH, 0); - TexImage3D(GL_TEXTURE_3D, 0, 3, sz, sz, sz, 1, - GL_RGB, GL_UNSIGNED_BYTE, lookup_data); - TexParameterf(GL_TEXTURE_3D, GL_TEXTURE_PRIORITY, 1.0); - TexParameteri(GL_TEXTURE_3D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - TexParameteri(GL_TEXTURE_3D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - TexParameteri(GL_TEXTURE_3D, GL_TEXTURE_WRAP_S, GL_CLAMP); - TexParameteri(GL_TEXTURE_3D, GL_TEXTURE_WRAP_T, GL_CLAMP); - TexParameteri(GL_TEXTURE_3D, GL_TEXTURE_WRAP_R, GL_CLAMP); - ActiveTexture(GL_TEXTURE0); + mpglPixelStorei(GL_UNPACK_ROW_LENGTH, 0); + mpglTexImage3D(GL_TEXTURE_3D, 0, 3, sz, sz, sz, 1, + GL_RGB, GL_UNSIGNED_BYTE, lookup_data); + mpglTexParameterf(GL_TEXTURE_3D, GL_TEXTURE_PRIORITY, 1.0); + mpglTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + mpglTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + mpglTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_WRAP_S, GL_CLAMP); + mpglTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_WRAP_T, GL_CLAMP); + mpglTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_WRAP_R, GL_CLAMP); + mpglActiveTexture(GL_TEXTURE0); texs[0] += '0'; } break; @@ -1216,26 +1265,26 @@ static const struct { int loadGPUProgram(GLenum target, char *prog) { int i; GLint cur = 0, max = 0, err = 0; - if (!ProgramString) { + if (!mpglProgramString) { mp_msg(MSGT_VO, MSGL_ERR, "[gl] Missing GPU program function\n"); return 0; } - ProgramString(target, GL_PROGRAM_FORMAT_ASCII, strlen(prog), prog); - GetIntegerv(GL_PROGRAM_ERROR_POSITION, &err); + mpglProgramString(target, GL_PROGRAM_FORMAT_ASCII, strlen(prog), prog); + mpglGetIntegerv(GL_PROGRAM_ERROR_POSITION, &err); if (err != -1) { mp_msg(MSGT_VO, MSGL_ERR, "[gl] Error compiling fragment program, make sure your card supports\n" "[gl] GL_ARB_fragment_program (use glxinfo to check).\n" "[gl] Error message:\n %s at %.10s\n", - GetString(GL_PROGRAM_ERROR_STRING), &prog[err]); + mpglGetString(GL_PROGRAM_ERROR_STRING), &prog[err]); return 0; } - if (!GetProgramiv || !mp_msg_test(MSGT_VO, MSGL_DBG2)) + if (!mpglGetProgramiv || !mp_msg_test(MSGT_VO, MSGL_DBG2)) return 1; mp_msg(MSGT_VO, MSGL_V, "[gl] Program statistics:\n"); for (i = 0; progstats[i].name; i++) { - GetProgramiv(target, progstats[i].cur, &cur); - GetProgramiv(target, progstats[i].max, &max); + mpglGetProgramiv(target, progstats[i].cur, &cur); + mpglGetProgramiv(target, progstats[i].max, &max); mp_msg(MSGT_VO, MSGL_V, "[gl] %s: %i/%i\n", progstats[i].name, cur, max); } return 1; @@ -1275,12 +1324,12 @@ static void glSetupYUVFragprog(gl_conversion_params_t *params) { memcpy(chrom_scale_texs, lum_scale_texs, sizeof(chrom_scale_texs)); else create_scaler_textures(YUV_CHROM_SCALER(type), &cur_texu, chrom_scale_texs); - GetIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS, &i); + mpglGetIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS, &i); if (i < cur_texu) mp_msg(MSGT_VO, MSGL_ERR, "[gl] %i texture units needed for this type of YUV fragment support (found %i)\n", cur_texu, i); - if (!ProgramString) { + if (!mpglProgramString) { mp_msg(MSGT_VO, MSGL_FATAL, "[gl] ProgramString function missing!\n"); return; } @@ -1345,7 +1394,10 @@ void glSetupYUVConversion(gl_conversion_params_t *params) { glSetupYUVCombiners(uvcos, uvsin); break; case YUV_CONVERSION_COMBINERS_ATI: - glSetupYUVCombinersATI(uvcos, uvsin); + glSetupYUVFragmentATI(¶ms->csp_params, 0); + break; + case YUV_CONVERSION_TEXT_FRAGMENT: + glSetupYUVFragmentATI(¶ms->csp_params, 1); break; case YUV_CONVERSION_FRAGMENT_LOOKUP: case YUV_CONVERSION_FRAGMENT_LOOKUP3D: @@ -1369,27 +1421,35 @@ void glSetupYUVConversion(gl_conversion_params_t *params) { void glEnableYUVConversion(GLenum target, int type) { switch (YUV_CONVERSION(type)) { case YUV_CONVERSION_COMBINERS: - ActiveTexture(GL_TEXTURE1); - Enable(target); - ActiveTexture(GL_TEXTURE2); - Enable(target); - ActiveTexture(GL_TEXTURE0); - Enable(GL_REGISTER_COMBINERS_NV); + mpglActiveTexture(GL_TEXTURE1); + mpglEnable(target); + mpglActiveTexture(GL_TEXTURE2); + mpglEnable(target); + mpglActiveTexture(GL_TEXTURE0); + mpglEnable(GL_REGISTER_COMBINERS_NV); break; case YUV_CONVERSION_COMBINERS_ATI: - ActiveTexture(GL_TEXTURE1); - Enable(target); - ActiveTexture(GL_TEXTURE2); - Enable(target); - ActiveTexture(GL_TEXTURE0); - Enable(GL_FRAGMENT_SHADER_ATI); + mpglActiveTexture(GL_TEXTURE1); + mpglEnable(target); + mpglActiveTexture(GL_TEXTURE2); + mpglEnable(target); + mpglActiveTexture(GL_TEXTURE0); + mpglEnable(GL_FRAGMENT_SHADER_ATI); + break; + case YUV_CONVERSION_TEXT_FRAGMENT: + mpglActiveTexture(GL_TEXTURE1); + mpglEnable(target); + mpglActiveTexture(GL_TEXTURE2); + mpglEnable(target); + mpglActiveTexture(GL_TEXTURE0); + mpglEnable(GL_TEXT_FRAGMENT_SHADER_ATI); break; case YUV_CONVERSION_FRAGMENT_LOOKUP3D: case YUV_CONVERSION_FRAGMENT_LOOKUP: case YUV_CONVERSION_FRAGMENT_POW: case YUV_CONVERSION_FRAGMENT: case YUV_CONVERSION_NONE: - Enable(GL_FRAGMENT_PROGRAM); + mpglEnable(GL_FRAGMENT_PROGRAM); break; } } @@ -1403,27 +1463,35 @@ void glEnableYUVConversion(GLenum target, int type) { void glDisableYUVConversion(GLenum target, int type) { switch (YUV_CONVERSION(type)) { case YUV_CONVERSION_COMBINERS: - ActiveTexture(GL_TEXTURE1); - Disable(target); - ActiveTexture(GL_TEXTURE2); - Disable(target); - ActiveTexture(GL_TEXTURE0); - Disable(GL_REGISTER_COMBINERS_NV); + mpglActiveTexture(GL_TEXTURE1); + mpglDisable(target); + mpglActiveTexture(GL_TEXTURE2); + mpglDisable(target); + mpglActiveTexture(GL_TEXTURE0); + mpglDisable(GL_REGISTER_COMBINERS_NV); break; case YUV_CONVERSION_COMBINERS_ATI: - ActiveTexture(GL_TEXTURE1); - Disable(target); - ActiveTexture(GL_TEXTURE2); - Disable(target); - ActiveTexture(GL_TEXTURE0); - Disable(GL_FRAGMENT_SHADER_ATI); + mpglActiveTexture(GL_TEXTURE1); + mpglDisable(target); + mpglActiveTexture(GL_TEXTURE2); + mpglDisable(target); + mpglActiveTexture(GL_TEXTURE0); + mpglDisable(GL_FRAGMENT_SHADER_ATI); + break; + case YUV_CONVERSION_TEXT_FRAGMENT: + mpglActiveTexture(GL_TEXTURE1); + mpglDisable(target); + mpglActiveTexture(GL_TEXTURE2); + mpglDisable(target); + mpglActiveTexture(GL_TEXTURE0); + mpglDisable(GL_TEXT_FRAGMENT_SHADER_ATI); break; case YUV_CONVERSION_FRAGMENT_LOOKUP3D: case YUV_CONVERSION_FRAGMENT_LOOKUP: case YUV_CONVERSION_FRAGMENT_POW: case YUV_CONVERSION_FRAGMENT: case YUV_CONVERSION_NONE: - Disable(GL_FRAGMENT_PROGRAM); + mpglDisable(GL_FRAGMENT_PROGRAM); break; } } @@ -1462,32 +1530,32 @@ void glDrawTex(GLfloat x, GLfloat y, GLfloat w, GLfloat h, y += h; h = -h; } - Begin(GL_QUADS); - TexCoord2f(tx, ty); + mpglBegin(GL_QUADS); + mpglTexCoord2f(tx, ty); if (is_yv12) { - MultiTexCoord2f(GL_TEXTURE1, tx2, ty2); - MultiTexCoord2f(GL_TEXTURE2, tx2, ty2); + mpglMultiTexCoord2f(GL_TEXTURE1, tx2, ty2); + mpglMultiTexCoord2f(GL_TEXTURE2, tx2, ty2); } - Vertex2f(x, y); - TexCoord2f(tx, ty + th); + mpglVertex2f(x, y); + mpglTexCoord2f(tx, ty + th); if (is_yv12) { - MultiTexCoord2f(GL_TEXTURE1, tx2, ty2 + th2); - MultiTexCoord2f(GL_TEXTURE2, tx2, ty2 + th2); + mpglMultiTexCoord2f(GL_TEXTURE1, tx2, ty2 + th2); + mpglMultiTexCoord2f(GL_TEXTURE2, tx2, ty2 + th2); } - Vertex2f(x, y + h); - TexCoord2f(tx + tw, ty + th); + mpglVertex2f(x, y + h); + mpglTexCoord2f(tx + tw, ty + th); if (is_yv12) { - MultiTexCoord2f(GL_TEXTURE1, tx2 + tw2, ty2 + th2); - MultiTexCoord2f(GL_TEXTURE2, tx2 + tw2, ty2 + th2); + mpglMultiTexCoord2f(GL_TEXTURE1, tx2 + tw2, ty2 + th2); + mpglMultiTexCoord2f(GL_TEXTURE2, tx2 + tw2, ty2 + th2); } - Vertex2f(x + w, y + h); - TexCoord2f(tx + tw, ty); + mpglVertex2f(x + w, y + h); + mpglTexCoord2f(tx + tw, ty); if (is_yv12) { - MultiTexCoord2f(GL_TEXTURE1, tx2 + tw2, ty2); - MultiTexCoord2f(GL_TEXTURE2, tx2 + tw2, ty2); + mpglMultiTexCoord2f(GL_TEXTURE1, tx2 + tw2, ty2); + mpglMultiTexCoord2f(GL_TEXTURE2, tx2 + tw2, ty2); } - Vertex2f(x + w, y); - End(); + mpglVertex2f(x + w, y); + mpglEnd(); } #ifdef CONFIG_GL_WIN32 @@ -1520,7 +1588,7 @@ static int setGlWindow_w32(MPGLContext *ctx) // should only be needed when keeping context, but not doing glFinish // can cause flickering even when we do not keep it. if (*context) - Finish(); + mpglFinish(); new_vinfo = GetPixelFormat(windc); if (*context && *vinfo && new_vinfo && *vinfo == new_vinfo) { // we can keep the wglContext @@ -1661,7 +1729,7 @@ static int setGlWindow_x11(MPGLContext *ctx) // should only be needed when keeping context, but not doing glFinish // can cause flickering even when we do not keep it. if (*context) - Finish(); + mpglFinish(); new_vinfo = getWindowVisualInfo(win); if (*context && *vinfo && new_vinfo && (*vinfo)->visualid == new_vinfo->visualid) { @@ -1703,7 +1771,7 @@ static int setGlWindow_x11(MPGLContext *ctx) if (*vinfo) XFree(*vinfo); *vinfo = new_vinfo; - getProcAddress = getdladdr("glXGetProcAddress"); + getProcAddress = getdladdr("glXGetProcAddress"); if (!getProcAddress) getProcAddress = getdladdr("glXGetProcAddressARB"); if (!getProcAddress) @@ -1719,6 +1787,12 @@ static int setGlWindow_x11(MPGLContext *ctx) appendstr(&glxstr, glXExtStr(mDisplay, GLX_EXTENSIONS)); getFunctions(getProcAddress, glxstr); + if (!mpglGenPrograms && mpglGetString && + getProcAddress != (void *)getdladdr && + strstr(mpglGetString(GL_EXTENSIONS), "GL_ARB_vertex_program")) { + mp_msg(MSGT_VO, MSGL_WARN, "Broken glXGetProcAddress detected, trying workaround\n"); + getFunctions((void *)getdladdr, glxstr); + } free(glxstr); // and inform that reinit is neccessary @@ -1739,7 +1813,7 @@ static void releaseGlContext_x11(MPGLContext *ctx) { *vinfo = NULL; if (*context) { - Finish(); + mpglFinish(); glXMakeCurrent(mDisplay, None, NULL); glXDestroyContext(mDisplay, *context); } diff --git a/libvo/gl_common.h b/libvo/gl_common.h index 0be98cf6ed..82770908f8 100644 --- a/libvo/gl_common.h +++ b/libvo/gl_common.h @@ -73,6 +73,9 @@ #ifndef GL_GENERATE_MIPMAP #define GL_GENERATE_MIPMAP 0x8191 #endif +#ifndef GL_TEXT_FRAGMENT_SHADER_ATI +#define GL_TEXT_FRAGMENT_SHADER_ATI 0x8200 +#endif #ifndef GL_REGISTER_COMBINERS_NV #define GL_REGISTER_COMBINERS_NV 0x8522 #endif @@ -305,6 +308,8 @@ int loadGPUProgram(GLenum target, char *prog); #define YUV_CONVERSION_COMBINERS_ATI 5 //! use a fragment program with 3D table lookup for YUV conversion #define YUV_CONVERSION_FRAGMENT_LOOKUP3D 6 +//! use ATI specific "text" register combiners ("fragment program") +#define YUV_CONVERSION_TEXT_FRAGMENT 7 //! use normal bilinear scaling for textures #define YUV_SCALER_BILIN 0 //! use higher quality bicubic scaling for textures @@ -390,93 +395,93 @@ typedef struct MPGLContext { int init_mpglcontext(MPGLContext *ctx, enum MPGLType type); void uninit_mpglcontext(MPGLContext *ctx); -extern void (GLAPIENTRY *Begin)(GLenum); -extern void (GLAPIENTRY *End)(void); -extern void (GLAPIENTRY *Viewport)(GLint, GLint, GLsizei, GLsizei); -extern void (GLAPIENTRY *MatrixMode)(GLenum); -extern void (GLAPIENTRY *LoadIdentity)(void); -extern void (GLAPIENTRY *Translated)(double, double, double); -extern void (GLAPIENTRY *Scaled)(double, double, double); -extern void (GLAPIENTRY *Ortho)(double, double, double, double, double, double); -extern void (GLAPIENTRY *Frustum)(double, double, double, double, double, double); -extern void (GLAPIENTRY *PushMatrix)(void); -extern void (GLAPIENTRY *PopMatrix)(void); -extern void (GLAPIENTRY *Clear)(GLbitfield); -extern GLuint (GLAPIENTRY *GenLists)(GLsizei); -extern void (GLAPIENTRY *DeleteLists)(GLuint, GLsizei); -extern void (GLAPIENTRY *NewList)(GLuint, GLenum); -extern void (GLAPIENTRY *EndList)(void); -extern void (GLAPIENTRY *CallList)(GLuint); -extern void (GLAPIENTRY *CallLists)(GLsizei, GLenum, const GLvoid *); -extern void (GLAPIENTRY *GenTextures)(GLsizei, GLuint *); -extern void (GLAPIENTRY *DeleteTextures)(GLsizei, const GLuint *); -extern void (GLAPIENTRY *TexEnvf)(GLenum, GLenum, GLfloat); -extern void (GLAPIENTRY *TexEnvi)(GLenum, GLenum, GLint); -extern void (GLAPIENTRY *Color4ub)(GLubyte, GLubyte, GLubyte, GLubyte); -extern void (GLAPIENTRY *Color3f)(GLfloat, GLfloat, GLfloat); -extern void (GLAPIENTRY *Color4f)(GLfloat, GLfloat, GLfloat, GLfloat); -extern void (GLAPIENTRY *ClearColor)(GLclampf, GLclampf, GLclampf, GLclampf); -extern void (GLAPIENTRY *ClearDepth)(GLclampd); -extern void (GLAPIENTRY *DepthFunc)(GLenum); -extern void (GLAPIENTRY *Enable)(GLenum); -extern void (GLAPIENTRY *Disable)(GLenum); -extern const GLubyte *(GLAPIENTRY *GetString)(GLenum); -extern void (GLAPIENTRY *DrawBuffer)(GLenum); -extern void (GLAPIENTRY *DepthMask)(GLboolean); -extern void (GLAPIENTRY *BlendFunc)(GLenum, GLenum); -extern void (GLAPIENTRY *Flush)(void); -extern void (GLAPIENTRY *Finish)(void); -extern void (GLAPIENTRY *PixelStorei)(GLenum, GLint); -extern void (GLAPIENTRY *TexImage1D)(GLenum, GLint, GLint, GLsizei, GLint, GLenum, GLenum, const GLvoid *); -extern void (GLAPIENTRY *TexImage2D)(GLenum, GLint, GLint, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid *); -extern void (GLAPIENTRY *TexSubImage2D)(GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *); -extern void (GLAPIENTRY *TexParameteri)(GLenum, GLenum, GLint); -extern void (GLAPIENTRY *TexParameterf)(GLenum, GLenum, GLfloat); -extern void (GLAPIENTRY *TexParameterfv)(GLenum, GLenum, const GLfloat *); -extern void (GLAPIENTRY *TexCoord2f)(GLfloat, GLfloat); -extern void (GLAPIENTRY *Vertex2f)(GLfloat, GLfloat); -extern void (GLAPIENTRY *Vertex3f)(GLfloat, GLfloat, GLfloat); -extern void (GLAPIENTRY *Normal3f)(GLfloat, GLfloat, GLfloat); -extern void (GLAPIENTRY *Lightfv)(GLenum, GLenum, const GLfloat *); -extern void (GLAPIENTRY *ColorMaterial)(GLenum, GLenum); -extern void (GLAPIENTRY *ShadeModel)(GLenum); -extern void (GLAPIENTRY *GetIntegerv)(GLenum, GLint *); +extern void (GLAPIENTRY *mpglBegin)(GLenum); +extern void (GLAPIENTRY *mpglEnd)(void); +extern void (GLAPIENTRY *mpglViewport)(GLint, GLint, GLsizei, GLsizei); +extern void (GLAPIENTRY *mpglMatrixMode)(GLenum); +extern void (GLAPIENTRY *mpglLoadIdentity)(void); +extern void (GLAPIENTRY *mpglTranslated)(double, double, double); +extern void (GLAPIENTRY *mpglScaled)(double, double, double); +extern void (GLAPIENTRY *mpglOrtho)(double, double, double, double, double, double); +extern void (GLAPIENTRY *mpglFrustum)(double, double, double, double, double, double); +extern void (GLAPIENTRY *mpglPushMatrix)(void); +extern void (GLAPIENTRY *mpglPopMatrix)(void); +extern void (GLAPIENTRY *mpglClear)(GLbitfield); +extern GLuint (GLAPIENTRY *mpglGenLists)(GLsizei); +extern void (GLAPIENTRY *mpglDeleteLists)(GLuint, GLsizei); +extern void (GLAPIENTRY *mpglNewList)(GLuint, GLenum); +extern void (GLAPIENTRY *mpglEndList)(void); +extern void (GLAPIENTRY *mpglCallList)(GLuint); +extern void (GLAPIENTRY *mpglCallLists)(GLsizei, GLenum, const GLvoid *); +extern void (GLAPIENTRY *mpglGenTextures)(GLsizei, GLuint *); +extern void (GLAPIENTRY *mpglDeleteTextures)(GLsizei, const GLuint *); +extern void (GLAPIENTRY *mpglTexEnvf)(GLenum, GLenum, GLfloat); +extern void (GLAPIENTRY *mpglTexEnvi)(GLenum, GLenum, GLint); +extern void (GLAPIENTRY *mpglColor4ub)(GLubyte, GLubyte, GLubyte, GLubyte); +extern void (GLAPIENTRY *mpglColor3f)(GLfloat, GLfloat, GLfloat); +extern void (GLAPIENTRY *mpglColor4f)(GLfloat, GLfloat, GLfloat, GLfloat); +extern void (GLAPIENTRY *mpglClearColor)(GLclampf, GLclampf, GLclampf, GLclampf); +extern void (GLAPIENTRY *mpglClearDepth)(GLclampd); +extern void (GLAPIENTRY *mpglDepthFunc)(GLenum); +extern void (GLAPIENTRY *mpglEnable)(GLenum); +extern void (GLAPIENTRY *mpglDisable)(GLenum); +extern const GLubyte *(GLAPIENTRY *mpglGetString)(GLenum); +extern void (GLAPIENTRY *mpglDrawBuffer)(GLenum); +extern void (GLAPIENTRY *mpglDepthMask)(GLboolean); +extern void (GLAPIENTRY *mpglBlendFunc)(GLenum, GLenum); +extern void (GLAPIENTRY *mpglFlush)(void); +extern void (GLAPIENTRY *mpglFinish)(void); +extern void (GLAPIENTRY *mpglPixelStorei)(GLenum, GLint); +extern void (GLAPIENTRY *mpglTexImage1D)(GLenum, GLint, GLint, GLsizei, GLint, GLenum, GLenum, const GLvoid *); +extern void (GLAPIENTRY *mpglTexImage2D)(GLenum, GLint, GLint, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid *); +extern void (GLAPIENTRY *mpglTexSubImage2D)(GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *); +extern void (GLAPIENTRY *mpglTexParameteri)(GLenum, GLenum, GLint); +extern void (GLAPIENTRY *mpglTexParameterf)(GLenum, GLenum, GLfloat); +extern void (GLAPIENTRY *mpglTexParameterfv)(GLenum, GLenum, const GLfloat *); +extern void (GLAPIENTRY *mpglTexCoord2f)(GLfloat, GLfloat); +extern void (GLAPIENTRY *mpglVertex2f)(GLfloat, GLfloat); +extern void (GLAPIENTRY *mpglVertex3f)(GLfloat, GLfloat, GLfloat); +extern void (GLAPIENTRY *mpglNormal3f)(GLfloat, GLfloat, GLfloat); +extern void (GLAPIENTRY *mpglLightfv)(GLenum, GLenum, const GLfloat *); +extern void (GLAPIENTRY *mpglColorMaterial)(GLenum, GLenum); +extern void (GLAPIENTRY *mpglShadeModel)(GLenum); +extern void (GLAPIENTRY *mpglGetIntegerv)(GLenum, GLint *); -extern void (GLAPIENTRY *GenBuffers)(GLsizei, GLuint *); -extern void (GLAPIENTRY *DeleteBuffers)(GLsizei, const GLuint *); -extern void (GLAPIENTRY *BindBuffer)(GLenum, GLuint); -extern GLvoid* (GLAPIENTRY *MapBuffer)(GLenum, GLenum); -extern GLboolean (GLAPIENTRY *UnmapBuffer)(GLenum); -extern void (GLAPIENTRY *BufferData)(GLenum, intptr_t, const GLvoid *, GLenum); -extern void (GLAPIENTRY *CombinerParameterfv)(GLenum, const GLfloat *); -extern void (GLAPIENTRY *CombinerParameteri)(GLenum, GLint); -extern void (GLAPIENTRY *CombinerInput)(GLenum, GLenum, GLenum, GLenum, GLenum, +extern void (GLAPIENTRY *mpglGenBuffers)(GLsizei, GLuint *); +extern void (GLAPIENTRY *mpglDeleteBuffers)(GLsizei, const GLuint *); +extern void (GLAPIENTRY *mpglBindBuffer)(GLenum, GLuint); +extern GLvoid* (GLAPIENTRY *mpglMapBuffer)(GLenum, GLenum); +extern GLboolean (GLAPIENTRY *mpglUnmapBuffer)(GLenum); +extern void (GLAPIENTRY *mpglBufferData)(GLenum, intptr_t, const GLvoid *, GLenum); +extern void (GLAPIENTRY *mpglCombinerParameterfv)(GLenum, const GLfloat *); +extern void (GLAPIENTRY *mpglCombinerParameteri)(GLenum, GLint); +extern void (GLAPIENTRY *mpglCombinerInput)(GLenum, GLenum, GLenum, GLenum, GLenum, GLenum); -extern void (GLAPIENTRY *CombinerOutput)(GLenum, GLenum, GLenum, GLenum, GLenum, +extern void (GLAPIENTRY *mpglCombinerOutput)(GLenum, GLenum, GLenum, GLenum, GLenum, GLenum, GLenum, GLboolean, GLboolean, GLboolean); -extern void (GLAPIENTRY *BeginFragmentShader)(void); -extern void (GLAPIENTRY *EndFragmentShader)(void); -extern void (GLAPIENTRY *SampleMap)(GLuint, GLuint, GLenum); -extern void (GLAPIENTRY *ColorFragmentOp2)(GLenum, GLuint, GLuint, GLuint, GLuint, +extern void (GLAPIENTRY *mpglBeginFragmentShader)(void); +extern void (GLAPIENTRY *mpglEndFragmentShader)(void); +extern void (GLAPIENTRY *mpglSampleMap)(GLuint, GLuint, GLenum); +extern void (GLAPIENTRY *mpglColorFragmentOp2)(GLenum, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint); -extern void (GLAPIENTRY *ColorFragmentOp3)(GLenum, GLuint, GLuint, GLuint, GLuint, +extern void (GLAPIENTRY *mpglColorFragmentOp3)(GLenum, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint); -extern void (GLAPIENTRY *SetFragmentShaderConstant)(GLuint, const GLfloat *); -extern void (GLAPIENTRY *ActiveTexture)(GLenum); -extern void (GLAPIENTRY *BindTexture)(GLenum, GLuint); -extern void (GLAPIENTRY *MultiTexCoord2f)(GLenum, GLfloat, GLfloat); -extern void (GLAPIENTRY *GenPrograms)(GLsizei, GLuint *); -extern void (GLAPIENTRY *DeletePrograms)(GLsizei, const GLuint *); -extern void (GLAPIENTRY *BindProgram)(GLenum, GLuint); -extern void (GLAPIENTRY *ProgramString)(GLenum, GLenum, GLsizei, const GLvoid *); -extern void (GLAPIENTRY *ProgramEnvParameter4f)(GLenum, GLuint, GLfloat, GLfloat, +extern void (GLAPIENTRY *mpglSetFragmentShaderConstant)(GLuint, const GLfloat *); +extern void (GLAPIENTRY *mpglActiveTexture)(GLenum); +extern void (GLAPIENTRY *mpglBindTexture)(GLenum, GLuint); +extern void (GLAPIENTRY *mpglMultiTexCoord2f)(GLenum, GLfloat, GLfloat); +extern void (GLAPIENTRY *mpglGenPrograms)(GLsizei, GLuint *); +extern void (GLAPIENTRY *mpglDeletePrograms)(GLsizei, const GLuint *); +extern void (GLAPIENTRY *mpglBindProgram)(GLenum, GLuint); +extern void (GLAPIENTRY *mpglProgramString)(GLenum, GLenum, GLsizei, const GLvoid *); +extern void (GLAPIENTRY *mpglProgramEnvParameter4f)(GLenum, GLuint, GLfloat, GLfloat, GLfloat, GLfloat); -extern int (GLAPIENTRY *SwapInterval)(int); -extern void (GLAPIENTRY *TexImage3D)(GLenum, GLint, GLenum, GLsizei, GLsizei, +extern int (GLAPIENTRY *mpglSwapInterval)(int); +extern void (GLAPIENTRY *mpglTexImage3D)(GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid *); -extern void* (GLAPIENTRY *AllocateMemoryMESA)(void *, int, size_t, float, float, float); -extern void (GLAPIENTRY *FreeMemoryMESA)(void *, int, void *); +extern void* (GLAPIENTRY *mpglAllocateMemoryMESA)(void *, int, size_t, float, float, float); +extern void (GLAPIENTRY *mpglFreeMemoryMESA)(void *, int, void *); #endif /* MPLAYER_GL_COMMON_H */ diff --git a/libvo/matrixview.c b/libvo/matrixview.c index f2dff111a3..0aa43e5303 100644 --- a/libvo/matrixview.c +++ b/libvo/matrixview.c @@ -76,17 +76,17 @@ static void draw_char(int num, float light, float x, float y, float z) num3 = num - (num2 * 10); ty = (float)num2 / 7; tx = (float)num3 / 10; - Normal3f(0.0f, 0.0f, 1.0f); // Needed for lighting - Color4f(0.0, 1.0, 0.0, light); // Basic polygon color - - TexCoord2f(tx, ty); - Vertex3f(x, y, z); - TexCoord2f(tx + 0.1, ty); - Vertex3f(x + 1, y, z); - TexCoord2f(tx + 0.1, ty + 0.166); - Vertex3f(x + 1, y - 1, z); - TexCoord2f(tx, ty + 0.166); - Vertex3f(x, y - 1, z); + mpglNormal3f(0.0f, 0.0f, 1.0f); // Needed for lighting + mpglColor4f(0.0, 1.0, 0.0, light); // Basic polygon color + + mpglTexCoord2f(tx, ty); + mpglVertex3f(x, y, z); + mpglTexCoord2f(tx + 0.1, ty); + mpglVertex3f(x + 1, y, z); + mpglTexCoord2f(tx + 0.1, ty + 0.166); + mpglVertex3f(x + 1, y - 1, z); + mpglTexCoord2f(tx, ty + 0.166); + mpglVertex3f(x, y - 1, z); } static void draw_illuminatedchar(int num, float x, float y, float z) @@ -98,32 +98,32 @@ static void draw_illuminatedchar(int num, float x, float y, float z) num3 = num - (num2 * 10); ty = (float)num2 / 7; tx = (float)num3 / 10; - Normal3f(0.0f, 0.0f, 1.0f); // Needed for lighting - Color4f(1.0, 1.0, 1.0, .5); // Basic polygon color - - TexCoord2f(tx, ty); - Vertex3f(x, y, z); - TexCoord2f(tx + 0.1, ty); - Vertex3f(x + 1, y, z); - TexCoord2f(tx + 0.1, ty + 0.166); - Vertex3f(x + 1, y - 1, z); - TexCoord2f(tx, ty + 0.166); - Vertex3f(x, y - 1, z); + mpglNormal3f(0.0f, 0.0f, 1.0f); // Needed for lighting + mpglColor4f(1.0, 1.0, 1.0, .5); // Basic polygon color + + mpglTexCoord2f(tx, ty); + mpglVertex3f(x, y, z); + mpglTexCoord2f(tx + 0.1, ty); + mpglVertex3f(x + 1, y, z); + mpglTexCoord2f(tx + 0.1, ty + 0.166); + mpglVertex3f(x + 1, y - 1, z); + mpglTexCoord2f(tx, ty + 0.166); + mpglVertex3f(x, y - 1, z); } static void draw_flare(float x, float y, float z) //flare { - Normal3f(0.0f, 0.0f, 1.0f); // Needed for lighting - Color4f(1.0, 1.0, 1.0, .8); // Basic polygon color - - TexCoord2f(0, 0); - Vertex3f(x - 1, y + 1, z); - TexCoord2f(0.75, 0); - Vertex3f(x + 2, y + 1, z); - TexCoord2f(0.75, 0.75); - Vertex3f(x + 2, y - 2, z); - TexCoord2f(0, 0.75); - Vertex3f(x - 1, y - 2, z); + mpglNormal3f(0.0f, 0.0f, 1.0f); // Needed for lighting + mpglColor4f(1.0, 1.0, 1.0, .8); // Basic polygon color + + mpglTexCoord2f(0, 0); + mpglVertex3f(x - 1, y + 1, z); + mpglTexCoord2f(0.75, 0); + mpglVertex3f(x + 2, y + 1, z); + mpglTexCoord2f(0.75, 0.75); + mpglVertex3f(x + 2, y - 2, z); + mpglTexCoord2f(0, 0.75); + mpglVertex3f(x - 1, y - 2, z); } static void draw_text(uint8_t *pic) @@ -251,21 +251,21 @@ static void make_text(void) static void ourBuildTextures(void) { - TexImage2D(GL_TEXTURE_2D, 0, 1, 128, 64, 0, GL_LUMINANCE, GL_UNSIGNED_BYTE, - font_texture); - TexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - TexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + mpglTexImage2D(GL_TEXTURE_2D, 0, 1, 128, 64, 0, GL_LUMINANCE, GL_UNSIGNED_BYTE, + font_texture); + mpglTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + mpglTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - BindTexture(GL_TEXTURE_2D, 1); - TexImage2D(GL_TEXTURE_2D, 0, 1, 4, 4, 0, GL_LUMINANCE, GL_UNSIGNED_BYTE, - flare); - TexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - TexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + mpglBindTexture(GL_TEXTURE_2D, 1); + mpglTexImage2D(GL_TEXTURE_2D, 0, 1, 4, 4, 0, GL_LUMINANCE, GL_UNSIGNED_BYTE, + flare); + mpglTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + mpglTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); // Some pretty standard settings for wrapping and filtering. - TexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); - TexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); - BindTexture(GL_TEXTURE_2D, 0); + mpglTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); + mpglTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); + mpglBindTexture(GL_TEXTURE_2D, 0); } void matrixview_init(int w, int h) @@ -275,27 +275,27 @@ void matrixview_init(int w, int h) ourBuildTextures(); // Color to clear color buffer to. - ClearColor(0.0f, 0.0f, 0.0f, 0.0f); + mpglClearColor(0.0f, 0.0f, 0.0f, 0.0f); // Depth to clear depth buffer to; type of test. - ClearDepth(1.0); - DepthFunc(GL_LESS); + mpglClearDepth(1.0); + mpglDepthFunc(GL_LESS); // Enables Smooth Color Shading; try GL_FLAT for (lack of) fun. - ShadeModel(GL_SMOOTH); + mpglShadeModel(GL_SMOOTH); // Set up a light, turn it on. - Lightfv(GL_LIGHT1, GL_POSITION, Light_Position); - Lightfv(GL_LIGHT1, GL_AMBIENT, Light_Ambient); - Lightfv(GL_LIGHT1, GL_DIFFUSE, Light_Diffuse); - Enable(GL_LIGHT1); + mpglLightfv(GL_LIGHT1, GL_POSITION, Light_Position); + mpglLightfv(GL_LIGHT1, GL_AMBIENT, Light_Ambient); + mpglLightfv(GL_LIGHT1, GL_DIFFUSE, Light_Diffuse); + mpglEnable(GL_LIGHT1); // A handy trick -- have surface material mirror the color. - ColorMaterial(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE); - Enable(GL_COLOR_MATERIAL); + mpglColorMaterial(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE); + mpglEnable(GL_COLOR_MATERIAL); // Allow adjusting of texture color via glColor - TexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); + mpglTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); matrixview_reshape(w, h); } @@ -303,48 +303,48 @@ void matrixview_init(int w, int h) void matrixview_reshape(int w, int h) { - Viewport(0, 0, w, h); + mpglViewport(0, 0, w, h); - MatrixMode(GL_PROJECTION); - LoadIdentity(); - Frustum(-_text_x, _text_x, -_text_y, _text_y, -Z_Off - Z_Depth, -Z_Off); + mpglMatrixMode(GL_PROJECTION); + mpglLoadIdentity(); + mpglFrustum(-_text_x, _text_x, -_text_y, _text_y, -Z_Off - Z_Depth, -Z_Off); - MatrixMode(GL_MODELVIEW); + mpglMatrixMode(GL_MODELVIEW); } void matrixview_draw(int w, int h, double currentTime, float frameTime, uint8_t *data) { - Enable(GL_BLEND); - Enable(GL_TEXTURE_2D); + mpglEnable(GL_BLEND); + mpglEnable(GL_TEXTURE_2D); - Disable(GL_LIGHTING); - BlendFunc(GL_SRC_ALPHA, GL_ONE); - Disable(GL_DEPTH_TEST); + mpglDisable(GL_LIGHTING); + mpglBlendFunc(GL_SRC_ALPHA, GL_ONE); + mpglDisable(GL_DEPTH_TEST); - MatrixMode(GL_MODELVIEW); - LoadIdentity(); - Translated(0.0f, 0.0f, Z_Off); + mpglMatrixMode(GL_MODELVIEW); + mpglLoadIdentity(); + mpglTranslated(0.0f, 0.0f, Z_Off); // Clear the color and depth buffers. - Clear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); + mpglClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // OK, let's start drawing our planer quads. - Begin(GL_QUADS); + mpglBegin(GL_QUADS); draw_text(data); - End(); + mpglEnd(); - BindTexture(GL_TEXTURE_2D, 1); - Begin(GL_QUADS); + mpglBindTexture(GL_TEXTURE_2D, 1); + mpglBegin(GL_QUADS); draw_flares(); - End(); - BindTexture(GL_TEXTURE_2D, 0); + mpglEnd(); + mpglBindTexture(GL_TEXTURE_2D, 0); make_change(currentTime); - LoadIdentity(); - MatrixMode(GL_PROJECTION); + mpglLoadIdentity(); + mpglMatrixMode(GL_PROJECTION); } void matrixview_contrast_set(float contrast) diff --git a/libvo/vo_dxr2.c b/libvo/vo_dxr2.c index defede12ad..099446f635 100644 --- a/libvo/vo_dxr2.c +++ b/libvo/vo_dxr2.c @@ -88,7 +88,7 @@ static int ck_b = 0xFF; static int cr_left = 0, cr_right = 0; static int cr_top = 55, cr_bot = 300; -m_option_t dxr2_opts[] = { +const m_option_t dxr2_opts[] = { { "overlay", &use_ol, CONF_TYPE_FLAG, 0, 0, 1, NULL}, { "nooverlay", &use_ol, CONF_TYPE_FLAG, 0, 1, 0, NULL}, { "overlay-ratio", &ol_ratio, CONF_TYPE_INT, CONF_RANGE, 1, 2500, NULL }, diff --git a/libvo/vo_gl.c b/libvo/vo_gl.c index cf5cbcbbb2..3ae3075e4a 100644 --- a/libvo/vo_gl.c +++ b/libvo/vo_gl.c @@ -186,12 +186,12 @@ static void resize(int x,int y){ if (WinID >= 0) { int top = 0, left = 0, w = x, h = y; geometry(&top, &left, &w, &h, vo_screenwidth, vo_screenheight); - Viewport(top, left, w, h); + mpglViewport(top, left, w, h); } else - Viewport( 0, 0, x, y ); + mpglViewport( 0, 0, x, y ); - MatrixMode(GL_PROJECTION); - LoadIdentity(); + mpglMatrixMode(GL_PROJECTION); + mpglLoadIdentity(); ass_border_x = ass_border_y = 0; if (aspect_scaling() && use_aspect) { int new_w, new_h; @@ -202,14 +202,14 @@ static void resize(int x,int y){ new_h += vo_panscan_y; scale_x = (GLdouble)new_w / (GLdouble)x; scale_y = (GLdouble)new_h / (GLdouble)y; - Scaled(scale_x, scale_y, 1); + mpglScaled(scale_x, scale_y, 1); ass_border_x = (vo_dwidth - new_w) / 2; ass_border_y = (vo_dheight - new_h) / 2; } - Ortho(0, image_width, image_height, 0, -1,1); + mpglOrtho(0, image_width, image_height, 0, -1,1); - MatrixMode(GL_MODELVIEW); - LoadIdentity(); + mpglMatrixMode(GL_MODELVIEW); + mpglLoadIdentity(); if (!scaled_osd) { #ifdef CONFIG_FREETYPE @@ -218,7 +218,7 @@ static void resize(int x,int y){ #endif vo_osd_changed(OSDTYPE_OSD); } - Clear(GL_COLOR_BUFFER_BIT); + mpglClear(GL_COLOR_BUFFER_BIT); redraw(); } @@ -267,7 +267,7 @@ static void update_yuvconv(void) { loadGPUProgram(GL_FRAGMENT_PROGRAM, prog); free(prog); } - ProgramEnvParameter4f(GL_FRAGMENT_PROGRAM, 0, + mpglProgramEnvParameter4f(GL_FRAGMENT_PROGRAM, 0, 1.0 / texture_width, 1.0 / texture_height, texture_width, texture_height); } @@ -278,17 +278,17 @@ static void update_yuvconv(void) { "[gl] Could not read customtex %s\n", custom_tex); else { int width, height, maxval; - ActiveTexture(GL_TEXTURE3); + mpglActiveTexture(GL_TEXTURE3); if (glCreatePPMTex(custom_trect?GL_TEXTURE_RECTANGLE:GL_TEXTURE_2D, 0, custom_tlin?GL_LINEAR:GL_NEAREST, f, &width, &height, &maxval)) - ProgramEnvParameter4f(GL_FRAGMENT_PROGRAM, 1, + mpglProgramEnvParameter4f(GL_FRAGMENT_PROGRAM, 1, 1.0 / width, 1.0 / height, width, height); else mp_msg(MSGT_VO, MSGL_WARN, "[gl] Error parsing customtex %s\n", custom_tex); fclose(f); - ActiveTexture(GL_TEXTURE0); + mpglActiveTexture(GL_TEXTURE0); } } } @@ -300,14 +300,14 @@ static void clearOSD(void) { int i; if (!osdtexCnt) return; - DeleteTextures(osdtexCnt, osdtex); + mpglDeleteTextures(osdtexCnt, osdtex); #ifndef FAST_OSD - DeleteTextures(osdtexCnt, osdatex); + mpglDeleteTextures(osdtexCnt, osdatex); for (i = 0; i < osdtexCnt; i++) - DeleteLists(osdaDispList[i], 1); + mpglDeleteLists(osdaDispList[i], 1); #endif for (i = 0; i < osdtexCnt; i++) - DeleteLists(osdDispList[i], 1); + mpglDeleteLists(osdDispList[i], 1); osdtexCnt = 0; } @@ -316,10 +316,10 @@ static void clearOSD(void) { */ static void clearEOSD(void) { if (eosdDispList) - DeleteLists(eosdDispList, 1); + mpglDeleteLists(eosdDispList, 1); eosdDispList = 0; if (eosdtexCnt) - DeleteTextures(eosdtexCnt, eosdtex); + mpglDeleteTextures(eosdtexCnt, eosdtex); eosdtexCnt = 0; free(eosdtex); eosdtex = NULL; @@ -366,10 +366,10 @@ static void genEOSD(mp_eosd_images_t *imgs) { if (!img) return; if (!largeeosdtex[0]) { - glGenTextures(2, largeeosdtex); - BindTexture(gl_target, largeeosdtex[0]); + mpglGenTextures(2, largeeosdtex); + mpglBindTexture(gl_target, largeeosdtex[0]); glCreateClearTex(gl_target, GL_ALPHA, GL_ALPHA, GL_UNSIGNED_BYTE, scale_type, LARGE_EOSD_TEX_SIZE, LARGE_EOSD_TEX_SIZE, 0); - BindTexture(gl_target, largeeosdtex[1]); + mpglBindTexture(gl_target, largeeosdtex[1]); glCreateClearTex(gl_target, GL_ALPHA, GL_ALPHA, GL_UNSIGNED_BYTE, scale_type, LARGE_EOSD_TEX_SIZE, LARGE_EOSD_TEX_SIZE, 0); } for (i = img; i; i = i->next) @@ -387,7 +387,7 @@ static void genEOSD(mp_eosd_images_t *imgs) { tinytexcur, smalltexcur, eosdtexCnt); if (eosdtexCnt) { eosdtex = calloc(eosdtexCnt, sizeof(GLuint)); - glGenTextures(eosdtexCnt, eosdtex); + mpglGenTextures(eosdtexCnt, eosdtex); } tinytexcur = smalltexcur = 0; for (i = img, curtex = eosdtex; i; i = i->next) { @@ -398,47 +398,47 @@ static void genEOSD(mp_eosd_images_t *imgs) { } if (is_tinytex(i, tinytexcur)) { tinytex_pos(tinytexcur, &x, &y); - BindTexture(gl_target, largeeosdtex[0]); + mpglBindTexture(gl_target, largeeosdtex[0]); tinytexcur++; } else if (is_smalltex(i, smalltexcur)) { smalltex_pos(smalltexcur, &x, &y); - BindTexture(gl_target, largeeosdtex[1]); + mpglBindTexture(gl_target, largeeosdtex[1]); smalltexcur++; } else { texSize(i->w, i->h, &sx, &sy); - BindTexture(gl_target, *curtex++); + mpglBindTexture(gl_target, *curtex++); glCreateClearTex(gl_target, GL_ALPHA, GL_ALPHA, GL_UNSIGNED_BYTE, scale_type, sx, sy, 0); } glUploadTex(gl_target, GL_ALPHA, GL_UNSIGNED_BYTE, i->bitmap, i->stride, x, y, i->w, i->h, 0); } - eosdDispList = GenLists(1); + eosdDispList = mpglGenLists(1); skip_upload: - NewList(eosdDispList, GL_COMPILE); + mpglNewList(eosdDispList, GL_COMPILE); tinytexcur = smalltexcur = 0; for (i = img, curtex = eosdtex; i; i = i->next) { int x = 0, y = 0; if (i->w <= 0 || i->h <= 0 || i->stride < i->w) continue; - Color4ub(i->color >> 24, (i->color >> 16) & 0xff, (i->color >> 8) & 0xff, 255 - (i->color & 0xff)); + mpglColor4ub(i->color >> 24, (i->color >> 16) & 0xff, (i->color >> 8) & 0xff, 255 - (i->color & 0xff)); if (is_tinytex(i, tinytexcur)) { tinytex_pos(tinytexcur, &x, &y); sx = sy = LARGE_EOSD_TEX_SIZE; - BindTexture(gl_target, largeeosdtex[0]); + mpglBindTexture(gl_target, largeeosdtex[0]); tinytexcur++; } else if (is_smalltex(i, smalltexcur)) { smalltex_pos(smalltexcur, &x, &y); sx = sy = LARGE_EOSD_TEX_SIZE; - BindTexture(gl_target, largeeosdtex[1]); + mpglBindTexture(gl_target, largeeosdtex[1]); smalltexcur++; } else { texSize(i->w, i->h, &sx, &sy); - BindTexture(gl_target, *curtex++); + mpglBindTexture(gl_target, *curtex++); } glDrawTex(i->dst_x, i->dst_y, i->w, i->h, x, y, i->w, i->h, sx, sy, use_rectangle == 1, 0, 0); } - EndList(); - BindTexture(gl_target, 0); + mpglEndList(); + mpglBindTexture(gl_target, 0); } /** @@ -446,30 +446,30 @@ skip_upload: */ static void uninitGl(void) { int i = 0; - if (DeletePrograms && fragprog) - DeletePrograms(1, &fragprog); + if (mpglDeletePrograms && fragprog) + mpglDeletePrograms(1, &fragprog); fragprog = 0; while (default_texs[i] != 0) i++; if (i) - DeleteTextures(i, default_texs); + mpglDeleteTextures(i, default_texs); default_texs[0] = 0; clearOSD(); clearEOSD(); if (largeeosdtex[0]) - DeleteTextures(2, largeeosdtex); + mpglDeleteTextures(2, largeeosdtex); largeeosdtex[0] = 0; - if (DeleteBuffers && gl_buffer) - DeleteBuffers(1, &gl_buffer); + if (mpglDeleteBuffers && gl_buffer) + mpglDeleteBuffers(1, &gl_buffer); gl_buffer = 0; gl_buffersize = 0; gl_bufferptr = NULL; - if (DeleteBuffers && gl_buffer_uv[0]) - DeleteBuffers(2, gl_buffer_uv); + if (mpglDeleteBuffers && gl_buffer_uv[0]) + mpglDeleteBuffers(2, gl_buffer_uv); gl_buffer_uv[0] = gl_buffer_uv[1] = 0; gl_buffersize_uv = 0; gl_bufferptr_uv[0] = gl_bufferptr_uv[1] = 0; #ifdef CONFIG_GL_X11 if (mesa_bufferptr) - FreeMemoryMESA(mDisplay, mScreen, mesa_bufferptr); + mpglFreeMemoryMESA(mDisplay, mScreen, mesa_bufferptr); #endif mesa_bufferptr = NULL; err_shown = 0; @@ -477,14 +477,14 @@ static void uninitGl(void) { static int isSoftwareGl(void) { - const char *renderer = GetString(GL_RENDERER); + const char *renderer = mpglGetString(GL_RENDERER); return strcmp(renderer, "Software Rasterizer") == 0; } static void autodetectGlExtensions(void) { - const char *extensions = GetString(GL_EXTENSIONS); - const char *vendor = GetString(GL_VENDOR); - const char *version = GetString(GL_VERSION); + const char *extensions = mpglGetString(GL_EXTENSIONS); + const char *vendor = mpglGetString(GL_VENDOR); + const char *version = mpglGetString(GL_VERSION); int is_ati = strstr(vendor, "ATI") != NULL; int ati_broken_pbo = 0; mp_msg(MSGT_VO, MSGL_V, "[gl] Running on OpenGL by '%s', versions '%s'\n", vendor, version); @@ -516,13 +516,13 @@ static int initGl(uint32_t d_width, uint32_t d_height) { texSize(image_width, image_height, &texture_width, &texture_height); - Disable(GL_BLEND); - Disable(GL_DEPTH_TEST); - DepthMask(GL_FALSE); - Disable(GL_CULL_FACE); - Enable(gl_target); - DrawBuffer(vo_doublebuffering?GL_BACK:GL_FRONT); - TexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); + mpglDisable(GL_BLEND); + mpglDisable(GL_DEPTH_TEST); + mpglDepthMask(GL_FALSE); + mpglDisable(GL_CULL_FACE); + mpglEnable(gl_target); + mpglDrawBuffer(vo_doublebuffering?GL_BACK:GL_FRONT); + mpglTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); mp_msg(MSGT_VO, MSGL_V, "[gl] Creating %dx%d texture...\n", texture_width, texture_height); @@ -531,35 +531,35 @@ static int initGl(uint32_t d_width, uint32_t d_height) { int i; int xs, ys; mp_get_chroma_shift(image_format, &xs, &ys); - GenTextures(21, default_texs); + mpglGenTextures(21, default_texs); default_texs[21] = 0; for (i = 0; i < 7; i++) { - ActiveTexture(GL_TEXTURE1 + i); - BindTexture(GL_TEXTURE_2D, default_texs[i]); - BindTexture(GL_TEXTURE_RECTANGLE, default_texs[i + 7]); - BindTexture(GL_TEXTURE_3D, default_texs[i + 14]); + mpglActiveTexture(GL_TEXTURE1 + i); + mpglBindTexture(GL_TEXTURE_2D, default_texs[i]); + mpglBindTexture(GL_TEXTURE_RECTANGLE, default_texs[i + 7]); + mpglBindTexture(GL_TEXTURE_3D, default_texs[i + 14]); } - ActiveTexture(GL_TEXTURE1); + mpglActiveTexture(GL_TEXTURE1); glCreateClearTex(gl_target, gl_texfmt, gl_format, gl_type, scale_type, texture_width >> xs, texture_height >> ys, 128); if (mipmap_gen) - TexParameteri(gl_target, GL_GENERATE_MIPMAP, GL_TRUE); - ActiveTexture(GL_TEXTURE2); + mpglTexParameteri(gl_target, GL_GENERATE_MIPMAP, GL_TRUE); + mpglActiveTexture(GL_TEXTURE2); glCreateClearTex(gl_target, gl_texfmt, gl_format, gl_type, scale_type, texture_width >> xs, texture_height >> ys, 128); if (mipmap_gen) - TexParameteri(gl_target, GL_GENERATE_MIPMAP, GL_TRUE); - ActiveTexture(GL_TEXTURE0); - BindTexture(gl_target, 0); + mpglTexParameteri(gl_target, GL_GENERATE_MIPMAP, GL_TRUE); + mpglActiveTexture(GL_TEXTURE0); + mpglBindTexture(gl_target, 0); } if (is_yuv || custom_prog) { if ((MASK_NOT_COMBINERS & (1 << use_yuv)) || custom_prog) { - if (!GenPrograms || !BindProgram) { + if (!mpglGenPrograms || !mpglBindProgram) { mp_msg(MSGT_VO, MSGL_ERR, "[gl] fragment program functions missing!\n"); } else { - GenPrograms(1, &fragprog); - BindProgram(GL_FRAGMENT_PROGRAM, fragprog); + mpglGenPrograms(1, &fragprog); + mpglBindProgram(GL_FRAGMENT_PROGRAM, fragprog); } } update_yuvconv(); @@ -567,14 +567,14 @@ static int initGl(uint32_t d_width, uint32_t d_height) { glCreateClearTex(gl_target, gl_texfmt, gl_format, gl_type, scale_type, texture_width, texture_height, 0); if (mipmap_gen) - TexParameteri(gl_target, GL_GENERATE_MIPMAP, GL_TRUE); + mpglTexParameteri(gl_target, GL_GENERATE_MIPMAP, GL_TRUE); resize(d_width, d_height); - ClearColor( 0.0f,0.0f,0.0f,0.0f ); - Clear( GL_COLOR_BUFFER_BIT ); - if (SwapInterval && swap_interval >= 0) - SwapInterval(swap_interval); + mpglClearColor( 0.0f,0.0f,0.0f,0.0f ); + mpglClear( GL_COLOR_BUFFER_BIT ); + if (mpglSwapInterval && swap_interval >= 0) + mpglSwapInterval(swap_interval); return 1; } @@ -626,7 +626,7 @@ glconfig: uninitGl(); if (glctx.setGlWindow(&glctx) == SET_WINDOW_FAILED) return -1; - if (mesa_buffer && !AllocateMemoryMESA) { + if (mesa_buffer && !mpglAllocateMemoryMESA) { mp_msg(MSGT_VO, MSGL_ERR, "Can not enable mesa-buffer because AllocateMemoryMESA was not found\n"); mesa_buffer = 0; } @@ -667,15 +667,15 @@ static void create_osd_texture(int x0, int y0, int w, int h, } // create Textures for OSD part - GenTextures(1, &osdtex[osdtexCnt]); - BindTexture(gl_target, osdtex[osdtexCnt]); + mpglGenTextures(1, &osdtex[osdtexCnt]); + mpglBindTexture(gl_target, osdtex[osdtexCnt]); glCreateClearTex(gl_target, GL_LUMINANCE, GL_LUMINANCE, GL_UNSIGNED_BYTE, scale_type, sx, sy, 0); glUploadTex(gl_target, GL_LUMINANCE, GL_UNSIGNED_BYTE, src, stride, 0, 0, w, h, 0); #ifndef FAST_OSD - GenTextures(1, &osdatex[osdtexCnt]); - BindTexture(gl_target, osdatex[osdtexCnt]); + mpglGenTextures(1, &osdatex[osdtexCnt]); + mpglBindTexture(gl_target, osdatex[osdtexCnt]); glCreateClearTex(gl_target, GL_ALPHA, GL_ALPHA, GL_UNSIGNED_BYTE, scale_type, sx, sy, 0); { int i; @@ -690,23 +690,23 @@ static void create_osd_texture(int x0, int y0, int w, int h, } #endif - BindTexture(gl_target, 0); + mpglBindTexture(gl_target, 0); // Create a list for rendering this OSD part #ifndef FAST_OSD - osdaDispList[osdtexCnt] = GenLists(1); - NewList(osdaDispList[osdtexCnt], GL_COMPILE); + osdaDispList[osdtexCnt] = mpglGenLists(1); + mpglNewList(osdaDispList[osdtexCnt], GL_COMPILE); // render alpha - BindTexture(gl_target, osdatex[osdtexCnt]); + mpglBindTexture(gl_target, osdatex[osdtexCnt]); glDrawTex(x0, y0, w, h, 0, 0, w, h, sx, sy, use_rectangle == 1, 0, 0); - EndList(); + mpglEndList(); #endif - osdDispList[osdtexCnt] = GenLists(1); - NewList(osdDispList[osdtexCnt], GL_COMPILE); + osdDispList[osdtexCnt] = mpglGenLists(1); + mpglNewList(osdDispList[osdtexCnt], GL_COMPILE); // render OSD - BindTexture(gl_target, osdtex[osdtexCnt]); + mpglBindTexture(gl_target, osdtex[osdtexCnt]); glDrawTex(x0, y0, w, h, 0, 0, w, h, sx, sy, use_rectangle == 1, 0, 0); - EndList(); + mpglEndList(); osdtexCnt++; } @@ -718,31 +718,31 @@ static void do_render_osd(int type) { if (((type & 1) && osdtexCnt > 0) || ((type & 2) && eosdDispList)) { // set special rendering parameters if (!scaled_osd) { - MatrixMode(GL_PROJECTION); - PushMatrix(); - LoadIdentity(); - Ortho(0, vo_dwidth, vo_dheight, 0, -1, 1); + mpglMatrixMode(GL_PROJECTION); + mpglPushMatrix(); + mpglLoadIdentity(); + mpglOrtho(0, vo_dwidth, vo_dheight, 0, -1, 1); } - Enable(GL_BLEND); + mpglEnable(GL_BLEND); if ((type & 2) && eosdDispList) { - BlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - CallList(eosdDispList); + mpglBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + mpglCallList(eosdDispList); } if ((type & 1) && osdtexCnt > 0) { - Color4ub((osd_color >> 16) & 0xff, (osd_color >> 8) & 0xff, osd_color & 0xff, 0xff - (osd_color >> 24)); + mpglColor4ub((osd_color >> 16) & 0xff, (osd_color >> 8) & 0xff, osd_color & 0xff, 0xff - (osd_color >> 24)); // draw OSD #ifndef FAST_OSD - BlendFunc(GL_ZERO, GL_ONE_MINUS_SRC_ALPHA); - CallLists(osdtexCnt, GL_UNSIGNED_INT, osdaDispList); + mpglBlendFunc(GL_ZERO, GL_ONE_MINUS_SRC_ALPHA); + mpglCallLists(osdtexCnt, GL_UNSIGNED_INT, osdaDispList); #endif - BlendFunc(GL_SRC_ALPHA, GL_ONE); - CallLists(osdtexCnt, GL_UNSIGNED_INT, osdDispList); + mpglBlendFunc(GL_SRC_ALPHA, GL_ONE); + mpglCallLists(osdtexCnt, GL_UNSIGNED_INT, osdDispList); } // set rendering parameters back to defaults - Disable(GL_BLEND); + mpglDisable(GL_BLEND); if (!scaled_osd) - PopMatrix(); - BindTexture(gl_target, 0); + mpglPopMatrix(); + mpglBindTexture(gl_target, 0); } } @@ -764,7 +764,7 @@ static void do_render(void) { // Enable(GL_TEXTURE_2D); // BindTexture(GL_TEXTURE_2D, texture_id); - Color3f(1,1,1); + mpglColor3f(1,1,1); if (is_yuv || custom_prog) glEnableYUVConversion(gl_target, yuvconvtype); glDrawTex(0, 0, image_width, image_height, @@ -778,15 +778,15 @@ static void do_render(void) { static void flip_page(void) { if (vo_doublebuffering) { - if (use_glFinish) Finish(); + if (use_glFinish) mpglFinish(); glctx.swapGlBuffers(&glctx); if (aspect_scaling() && use_aspect) - Clear(GL_COLOR_BUFFER_BIT); + mpglClear(GL_COLOR_BUFFER_BIT); } else { do_render(); do_render_osd(3); - if (use_glFinish) Finish(); - else Flush(); + if (use_glFinish) mpglFinish(); + else mpglFlush(); } } @@ -804,20 +804,20 @@ static int draw_slice(uint8_t *src[], int stride[], int w,int h,int x,int y) if (is_yuv) { int xs, ys; mp_get_chroma_shift(image_format, &xs, &ys); - ActiveTexture(GL_TEXTURE1); + mpglActiveTexture(GL_TEXTURE1); glUploadTex(gl_target, gl_format, gl_type, src[1], stride[1], x >> xs, y >> ys, w >> xs, h >> ys, slice_height); - ActiveTexture(GL_TEXTURE2); + mpglActiveTexture(GL_TEXTURE2); glUploadTex(gl_target, gl_format, gl_type, src[2], stride[2], x >> xs, y >> ys, w >> xs, h >> ys, slice_height); - ActiveTexture(GL_TEXTURE0); + mpglActiveTexture(GL_TEXTURE0); } return 0; } static uint32_t get_image(mp_image_t *mpi) { int needed_size; - if (!GenBuffers || !BindBuffer || !BufferData || !MapBuffer) { + if (!mpglGenBuffers || !mpglBindBuffer || !mpglBufferData || !mpglMapBuffer) { if (!err_shown) mp_msg(MSGT_VO, MSGL_ERR, "[gl] extensions missing for dr\n" "Expect a _major_ speed penalty\n"); @@ -838,27 +838,27 @@ static uint32_t get_image(mp_image_t *mpi) { if (mesa_buffer) { #ifdef CONFIG_GL_X11 if (mesa_bufferptr && needed_size > mesa_buffersize) { - FreeMemoryMESA(mDisplay, mScreen, mesa_bufferptr); + mpglFreeMemoryMESA(mDisplay, mScreen, mesa_bufferptr); mesa_bufferptr = NULL; } if (!mesa_bufferptr) - mesa_bufferptr = AllocateMemoryMESA(mDisplay, mScreen, needed_size, 0, 1.0, 1.0); + mesa_bufferptr = mpglAllocateMemoryMESA(mDisplay, mScreen, needed_size, 0, 1.0, 1.0); mesa_buffersize = needed_size; #endif mpi->planes[0] = mesa_bufferptr; } else { if (!gl_buffer) - GenBuffers(1, &gl_buffer); - BindBuffer(GL_PIXEL_UNPACK_BUFFER, gl_buffer); + mpglGenBuffers(1, &gl_buffer); + mpglBindBuffer(GL_PIXEL_UNPACK_BUFFER, gl_buffer); if (needed_size > gl_buffersize) { gl_buffersize = needed_size; - BufferData(GL_PIXEL_UNPACK_BUFFER, gl_buffersize, - NULL, GL_DYNAMIC_DRAW); + mpglBufferData(GL_PIXEL_UNPACK_BUFFER, gl_buffersize, + NULL, GL_DYNAMIC_DRAW); } if (!gl_bufferptr) - gl_bufferptr = MapBuffer(GL_PIXEL_UNPACK_BUFFER, GL_WRITE_ONLY); + gl_bufferptr = mpglMapBuffer(GL_PIXEL_UNPACK_BUFFER, GL_WRITE_ONLY); mpi->planes[0] = gl_bufferptr; - BindBuffer(GL_PIXEL_UNPACK_BUFFER, 0); + mpglBindBuffer(GL_PIXEL_UNPACK_BUFFER, 0); } if (!mpi->planes[0]) { if (!err_shown) @@ -879,21 +879,21 @@ static uint32_t get_image(mp_image_t *mpi) { mpi->stride[2] = mpi->width >> xs; if (ati_hack && !mesa_buffer) { mpi->flags &= ~MP_IMGFLAG_COMMON_PLANE; - if (!gl_buffer_uv[0]) GenBuffers(2, gl_buffer_uv); + if (!gl_buffer_uv[0]) mpglGenBuffers(2, gl_buffer_uv); if (mpi->stride[1] * mpi->height > gl_buffersize_uv) { - BindBuffer(GL_PIXEL_UNPACK_BUFFER, gl_buffer_uv[0]); - BufferData(GL_PIXEL_UNPACK_BUFFER, mpi->stride[1] * mpi->height, - NULL, GL_DYNAMIC_DRAW); - BindBuffer(GL_PIXEL_UNPACK_BUFFER, gl_buffer_uv[1]); - BufferData(GL_PIXEL_UNPACK_BUFFER, mpi->stride[1] * mpi->height, - NULL, GL_DYNAMIC_DRAW); + mpglBindBuffer(GL_PIXEL_UNPACK_BUFFER, gl_buffer_uv[0]); + mpglBufferData(GL_PIXEL_UNPACK_BUFFER, mpi->stride[1] * mpi->height, + NULL, GL_DYNAMIC_DRAW); + mpglBindBuffer(GL_PIXEL_UNPACK_BUFFER, gl_buffer_uv[1]); + mpglBufferData(GL_PIXEL_UNPACK_BUFFER, mpi->stride[1] * mpi->height, + NULL, GL_DYNAMIC_DRAW); gl_buffersize_uv = mpi->stride[1] * mpi->height; } if (!gl_bufferptr_uv[0]) { - BindBuffer(GL_PIXEL_UNPACK_BUFFER, gl_buffer_uv[0]); - gl_bufferptr_uv[0] = MapBuffer(GL_PIXEL_UNPACK_BUFFER, GL_WRITE_ONLY); - BindBuffer(GL_PIXEL_UNPACK_BUFFER, gl_buffer_uv[1]); - gl_bufferptr_uv[1] = MapBuffer(GL_PIXEL_UNPACK_BUFFER, GL_WRITE_ONLY); + mpglBindBuffer(GL_PIXEL_UNPACK_BUFFER, gl_buffer_uv[0]); + gl_bufferptr_uv[0] = mpglMapBuffer(GL_PIXEL_UNPACK_BUFFER, GL_WRITE_ONLY); + mpglBindBuffer(GL_PIXEL_UNPACK_BUFFER, gl_buffer_uv[1]); + gl_bufferptr_uv[1] = mpglMapBuffer(GL_PIXEL_UNPACK_BUFFER, GL_WRITE_ONLY); } mpi->planes[1] = gl_bufferptr_uv[0]; mpi->planes[2] = gl_bufferptr_uv[1]; @@ -948,7 +948,7 @@ static uint32_t draw_image(mp_image_t *mpi) { mpi_flipped = stride[0] < 0; if (mpi->flags & MP_IMGFLAG_DIRECT) { if (mesa_buffer) { - PixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE, 1); + mpglPixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE, 1); w = texture_width; } else { intptr_t base = (intptr_t)planes[0]; @@ -958,8 +958,8 @@ static uint32_t draw_image(mp_image_t *mpi) { planes[0] -= base; planes[1] -= base; planes[2] -= base; - BindBuffer(GL_PIXEL_UNPACK_BUFFER, gl_buffer); - UnmapBuffer(GL_PIXEL_UNPACK_BUFFER); + mpglBindBuffer(GL_PIXEL_UNPACK_BUFFER, gl_buffer); + mpglUnmapBuffer(GL_PIXEL_UNPACK_BUFFER); gl_bufferptr = NULL; if (!(mpi->flags & MP_IMGFLAG_COMMON_PLANE)) planes[0] = planes[1] = planes[2] = NULL; @@ -972,26 +972,26 @@ static uint32_t draw_image(mp_image_t *mpi) { int xs, ys; mp_get_chroma_shift(image_format, &xs, &ys); if ((mpi->flags & MP_IMGFLAG_DIRECT) && !(mpi->flags & MP_IMGFLAG_COMMON_PLANE)) { - BindBuffer(GL_PIXEL_UNPACK_BUFFER, gl_buffer_uv[0]); - UnmapBuffer(GL_PIXEL_UNPACK_BUFFER); + mpglBindBuffer(GL_PIXEL_UNPACK_BUFFER, gl_buffer_uv[0]); + mpglUnmapBuffer(GL_PIXEL_UNPACK_BUFFER); gl_bufferptr_uv[0] = NULL; } - ActiveTexture(GL_TEXTURE1); + mpglActiveTexture(GL_TEXTURE1); glUploadTex(gl_target, gl_format, gl_type, planes[1], stride[1], mpi->x >> xs, mpi->y >> ys, w >> xs, h >> ys, slice); if ((mpi->flags & MP_IMGFLAG_DIRECT) && !(mpi->flags & MP_IMGFLAG_COMMON_PLANE)) { - BindBuffer(GL_PIXEL_UNPACK_BUFFER, gl_buffer_uv[1]); - UnmapBuffer(GL_PIXEL_UNPACK_BUFFER); + mpglBindBuffer(GL_PIXEL_UNPACK_BUFFER, gl_buffer_uv[1]); + mpglUnmapBuffer(GL_PIXEL_UNPACK_BUFFER); gl_bufferptr_uv[1] = NULL; } - ActiveTexture(GL_TEXTURE2); + mpglActiveTexture(GL_TEXTURE2); glUploadTex(gl_target, gl_format, gl_type, planes[2], stride[2], mpi->x >> xs, mpi->y >> ys, w >> xs, h >> ys, slice); - ActiveTexture(GL_TEXTURE0); + mpglActiveTexture(GL_TEXTURE0); } if (mpi->flags & MP_IMGFLAG_DIRECT) { - if (mesa_buffer) PixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE, 0); - else BindBuffer(GL_PIXEL_UNPACK_BUFFER, 0); + if (mesa_buffer) mpglPixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE, 0); + else mpglBindBuffer(GL_PIXEL_UNPACK_BUFFER, 0); } skip_upload: if (vo_doublebuffering) do_render(); diff --git a/libvo/vo_gl2.c b/libvo/vo_gl2.c index 743289840e..e2cfcf2aff 100644 --- a/libvo/vo_gl2.c +++ b/libvo/vo_gl2.c @@ -263,11 +263,11 @@ static int initTextures(void) glBindTexture (GL_TEXTURE_2D, tsq->texobj); if (is_yuv) { glGenTextures(2, tsq->uvtexobjs); - ActiveTexture(GL_TEXTURE1); + mpglActiveTexture(GL_TEXTURE1); glBindTexture (GL_TEXTURE_2D, tsq->uvtexobjs[0]); - ActiveTexture(GL_TEXTURE2); + mpglActiveTexture(GL_TEXTURE2); glBindTexture (GL_TEXTURE_2D, tsq->uvtexobjs[1]); - ActiveTexture(GL_TEXTURE0); + mpglActiveTexture(GL_TEXTURE0); } glCreateClearTex(GL_TEXTURE_2D, gl_internal_format, gl_bitmap_format, gl_bitmap_type, GL_LINEAR, @@ -277,13 +277,13 @@ static int initTextures(void) if (is_yuv) { int xs, ys; mp_get_chroma_shift(image_format, &xs, &ys); - ActiveTexture(GL_TEXTURE1); + mpglActiveTexture(GL_TEXTURE1); glCreateClearTex(GL_TEXTURE_2D, gl_internal_format, gl_bitmap_format, gl_bitmap_type, GL_LINEAR, texture_width >> xs, texture_height >> ys, 128); - ActiveTexture(GL_TEXTURE2); + mpglActiveTexture(GL_TEXTURE2); glCreateClearTex(GL_TEXTURE_2D, gl_internal_format, gl_bitmap_format, gl_bitmap_type, GL_LINEAR, texture_width >> xs, texture_height >> ys, 128); - ActiveTexture(GL_TEXTURE0); + mpglActiveTexture(GL_TEXTURE0); } tsq++; @@ -393,11 +393,11 @@ static void drawTextureDisplay (void) thisw = image_width % texture_width; glBindTexture (GL_TEXTURE_2D, square->texobj); if (is_yuv) { - ActiveTexture(GL_TEXTURE1); + mpglActiveTexture(GL_TEXTURE1); glBindTexture (GL_TEXTURE_2D, square->uvtexobjs[0]); - ActiveTexture(GL_TEXTURE2); + mpglActiveTexture(GL_TEXTURE2); glBindTexture (GL_TEXTURE_2D, square->uvtexobjs[1]); - ActiveTexture(GL_TEXTURE0); + mpglActiveTexture(GL_TEXTURE0); } if (texdirty) { @@ -566,18 +566,18 @@ static int initGl(uint32_t d_width, uint32_t d_height) switch (use_yuv) { case YUV_CONVERSION_FRAGMENT_LOOKUP: glGenTextures(1, &lookupTex); - ActiveTexture(GL_TEXTURE3); + mpglActiveTexture(GL_TEXTURE3); glBindTexture(GL_TEXTURE_2D, lookupTex); - ActiveTexture(GL_TEXTURE0); + mpglActiveTexture(GL_TEXTURE0); glBindTexture(GL_TEXTURE_2D, 0); case YUV_CONVERSION_FRAGMENT_POW: case YUV_CONVERSION_FRAGMENT: - if (!GenPrograms || !BindProgram) { + if (!mpglGenPrograms || !mpglBindProgram) { mp_msg(MSGT_VO, MSGL_ERR, "[gl] fragment program functions missing!\n"); break; } - GenPrograms(1, &fragprog); - BindProgram(GL_FRAGMENT_PROGRAM, fragprog); + mpglGenPrograms(1, &fragprog); + mpglBindProgram(GL_FRAGMENT_PROGRAM, fragprog); break; } mp_get_chroma_shift(image_format, &xs, &ys); @@ -752,17 +752,17 @@ static int draw_slice(uint8_t *src[], int stride[], int w,int h,int x,int y) int subtex_w = rem_w; if (subtex_x + subtex_w > texture_width) subtex_w = texture_width - subtex_x; - ActiveTexture(GL_TEXTURE0); + mpglActiveTexture(GL_TEXTURE0); glBindTexture(GL_TEXTURE_2D, tsq->texobj); glUploadTex(GL_TEXTURE_2D, gl_bitmap_format, gl_bitmap_type, yptr, ystride, subtex_x, subtex_y, subtex_w, subtex_h, 0); - ActiveTexture(GL_TEXTURE1); + mpglActiveTexture(GL_TEXTURE1); glBindTexture(GL_TEXTURE_2D, tsq->uvtexobjs[0]); glUploadTex(GL_TEXTURE_2D, gl_bitmap_format, gl_bitmap_type, uptr, ustride, subtex_x >> xs, subtex_y >> ys, subtex_w >> xs, subtex_h >> ys, 0); - ActiveTexture(GL_TEXTURE2); + mpglActiveTexture(GL_TEXTURE2); glBindTexture(GL_TEXTURE_2D, tsq->uvtexobjs[1]); glUploadTex(GL_TEXTURE_2D, gl_bitmap_format, gl_bitmap_type, vptr, vstride, subtex_x >> xs, subtex_y >> ys, @@ -781,7 +781,7 @@ static int draw_slice(uint8_t *src[], int stride[], int w,int h,int x,int y) texline += texnumx; rem_h -= subtex_h; } - ActiveTexture(GL_TEXTURE0); + mpglActiveTexture(GL_TEXTURE0); return 0; } @@ -874,7 +874,7 @@ static int preinit(const char *arg) goto err_out; if (glctx.setGlWindow(&glctx) == SET_WINDOW_FAILED) goto err_out; - extensions = GetString(GL_EXTENSIONS); + extensions = mpglGetString(GL_EXTENSIONS); use_yuv = strstr(extensions, "GL_ARB_fragment_program") ? 2 : 0; } return 0; diff --git a/libvo/vo_xvmc.c b/libvo/vo_xvmc.c index 2294e6dea1..b47266bd80 100644 --- a/libvo/vo_xvmc.c +++ b/libvo/vo_xvmc.c @@ -119,7 +119,7 @@ static void init_osd_yuv_pal(void); static const struct{ int id;//id as xvimages or as mplayer RGB|{8,15,16,24,32} - void (* init_func_ptr)(); + void (* init_func_ptr)(void); void (* draw_func_ptr)(); void (* clear_func_ptr)(); } osd_render[]={ diff --git a/loader/wine/msacm.h b/loader/wine/msacm.h index b8b24383c6..e8cf3dabdd 100644 --- a/loader/wine/msacm.h +++ b/loader/wine/msacm.h @@ -690,6 +690,7 @@ typedef WIN_BOOL16 CALLBACK ( *ACMFORMATTAGENUMCB16)( */ DWORD WINAPI acmGetVersion16( + void ); MMRESULT16 WINAPI acmMetrics16( HACMOBJ16 hao, UINT16 uMetric, LPVOID pMetric @@ -898,6 +899,7 @@ MMRESULT WINAPI acmFormatTagEnumW( ACMFORMATTAGENUMCBW fnCallback, DWORD dwInstance, DWORD fdwEnum ); DWORD WINAPI acmGetVersion( + void ); MMRESULT WINAPI acmMetrics( HACMOBJ hao, UINT uMetric, LPVOID pMetric diff --git a/stream/http.c b/stream/http.c index c1018ff4d3..dda668e5f4 100644 --- a/stream/http.c +++ b/stream/http.c @@ -123,8 +123,13 @@ static void scast_meta_read(int fd, streaming_ctrl_t *sc) { my_read(fd, &tmp, 1, sc); metalen = tmp * 16; if (metalen > 0) { - char *info = malloc(metalen + 1); + int i; + uint8_t *info = malloc(metalen + 1); unsigned nlen = my_read(fd, info, metalen, sc); + // avoid breaking the user's terminal too much + if (nlen > 256) nlen = 256; + for (i = 0; i < nlen; i++) + if (info[i] && info[i] < 32) info[i] = '?'; info[nlen] = 0; mp_msg(MSGT_DEMUXER, MSGL_INFO, "\nICY Info: %s\n", info); free(info); diff --git a/stream/stream.c b/stream/stream.c index 890a12f41c..80e37369f7 100644 --- a/stream/stream.c +++ b/stream/stream.c @@ -47,8 +47,6 @@ #include "cache2.h" -//#include "vcd_read_bincue.h" - struct input_ctx; static int (*stream_check_interrupt_cb)(struct input_ctx *ctx, int time); static struct input_ctx *stream_check_interrupt_ctx; |