aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--.gitignore17
-rw-r--r--Changelog2
-rw-r--r--DOCS/man/de/mplayer.114
-rw-r--r--DOCS/man/en/mplayer.1174
-rw-r--r--DOCS/man/fr/mplayer.12
-rw-r--r--DOCS/tech/MAINTAINERS2
-rw-r--r--DOCS/tech/binary-packaging.txt22
-rw-r--r--DOCS/tech/general.txt1
-rw-r--r--DOCS/tech/libmpcodecs.txt22
-rw-r--r--DOCS/tech/libvo.txt1
-rw-r--r--DOCS/tech/realcodecs/TODO2
-rw-r--r--DOCS/tech/realcodecs/audio-codecs.txt3
-rw-r--r--DOCS/tech/realcodecs/video-codecs.txt2
-rw-r--r--DOCS/tech/slave.txt9
-rw-r--r--DOCS/tech/snow.txt1
-rw-r--r--DOCS/tech/subcp.txt2
-rw-r--r--DOCS/tech/swscaler_methods.txt1
-rw-r--r--DOCS/xml/en/documentation.xml1
-rw-r--r--DOCS/xml/en/faq.xml6
-rw-r--r--DOCS/xml/en/install.xml29
-rw-r--r--DOCS/xml/en/skin.xml1200
-rw-r--r--DOCS/xml/ldp.dsl1
-rw-r--r--DOCS/xml/ru/ports.xml2
-rw-r--r--Makefile179
-rw-r--r--README51
-rw-r--r--TOOLS/asfinfo.c1
-rw-r--r--TOOLS/avisubdump.c1
-rw-r--r--TOOLS/compare.c1
-rwxr-xr-xTOOLS/matroska.py397
-rw-r--r--TOOLS/modify_reg.c1
-rw-r--r--TOOLS/realcodecs/cook.c1
-rw-r--r--TOOLS/realcodecs/drv4.c1
-rw-r--r--TOOLS/realcodecs/ra.c1
-rw-r--r--TOOLS/realcodecs/rv30.c1
-rw-r--r--TOOLS/realcodecs/sipr.c1
-rw-r--r--TOOLS/vdpau_functions.py61
-rwxr-xr-xTOOLS/w32codec_dl.pl1
-rw-r--r--ass_mp.c302
-rw-r--r--ass_mp.h81
-rw-r--r--asxparser.c14
-rw-r--r--asxparser.h4
-rw-r--r--av_log.c111
-rw-r--r--av_log.h1
-rw-r--r--av_opts.c1
-rw-r--r--cfg-common-opts.h79
-rw-r--r--cfg-common.h9
-rw-r--r--cfg-mencoder.h8
-rw-r--r--cfg-mplayer.h103
-rw-r--r--codec-cfg.c73
-rw-r--r--codec-cfg.h2
-rw-r--r--command.c1084
-rw-r--r--command.h2
-rw-r--r--common.mak78
-rwxr-xr-xconfigure1051
-rw-r--r--cpudetect.h2
-rw-r--r--debian/README.debian4
-rw-r--r--debian/TODO.Debian2
-rw-r--r--debian/changelog7
-rw-r--r--debian/compat1
-rwxr-xr-xdebian/config52
-rw-r--r--debian/control4
-rw-r--r--debian/menu6
-rw-r--r--debian/postrm18
-rwxr-xr-xdebian/rules21
-rw-r--r--debian/templates26
-rw-r--r--debian/watch3
-rw-r--r--defaultopts.c62
-rw-r--r--defaultopts.h3
-rw-r--r--drivers/radeon_vid.c1
-rw-r--r--edl.c18
-rw-r--r--etc/codecs.conf63
-rw-r--r--etc/input.conf12
-rw-r--r--etc/menu.conf2
-rw-r--r--ffmpeg_files/arm/bswap.h72
-rw-r--r--ffmpeg_files/arm/intreadwrite.h78
-rw-r--r--ffmpeg_files/bfin/bswap.h45
-rw-r--r--ffmpeg_files/bswap.h103
-rw-r--r--ffmpeg_files/intreadwrite.h268
-rw-r--r--ffmpeg_files/sh4/bswap.h48
-rw-r--r--ffmpeg_files/taglists.c339
-rw-r--r--ffmpeg_files/taglists.h9
-rw-r--r--ffmpeg_files/x86/bswap.h61
-rw-r--r--ffmpeg_files/x86_cpu.h76
-rw-r--r--find_sub.c4
-rw-r--r--gui/app.c239
-rw-r--r--gui/app.h204
-rw-r--r--gui/bitmap.c187
-rw-r--r--gui/bitmap.h34
-rw-r--r--gui/cfg.c371
-rw-r--r--gui/cfg.h81
-rw-r--r--gui/interface.c1312
-rw-r--r--gui/interface.h240
-rw-r--r--gui/mplayer/gmplayer.h51
-rw-r--r--gui/mplayer/gtk/about.c346
-rw-r--r--gui/mplayer/gtk/about.h29
-rw-r--r--gui/mplayer/gtk/eq.c691
-rw-r--r--gui/mplayer/gtk/eq.h29
-rw-r--r--gui/mplayer/gtk/fs.c656
-rw-r--r--gui/mplayer/gtk/fs.h39
-rw-r--r--gui/mplayer/gtk/gtk_common.c197
-rw-r--r--gui/mplayer/gtk/gtk_common.h41
-rw-r--r--gui/mplayer/gtk/gtk_url.c171
-rw-r--r--gui/mplayer/gtk/gtk_url.h30
-rw-r--r--gui/mplayer/gtk/mb.c114
-rw-r--r--gui/mplayer/gtk/mb.h29
-rw-r--r--gui/mplayer/gtk/menu.c645
-rw-r--r--gui/mplayer/gtk/menu.h31
-rw-r--r--gui/mplayer/gtk/opts.c1832
-rw-r--r--gui/mplayer/gtk/opts.h33
-rw-r--r--gui/mplayer/gtk/pl.c546
-rw-r--r--gui/mplayer/gtk/pl.h29
-rw-r--r--gui/mplayer/gtk/sb.c211
-rw-r--r--gui/mplayer/gtk/sb.h30
-rw-r--r--gui/mplayer/gui_common.c308
-rw-r--r--gui/mplayer/gui_common.h37
-rw-r--r--gui/mplayer/menu.c175
-rw-r--r--gui/mplayer/mw.c636
-rw-r--r--gui/mplayer/pb.c265
-rw-r--r--gui/mplayer/pixmaps/MPlayer_mini.xpm638
-rw-r--r--gui/mplayer/pixmaps/a11.xpm22
-rw-r--r--gui/mplayer/pixmaps/a169.xpm22
-rw-r--r--gui/mplayer/pixmaps/a235.xpm22
-rw-r--r--gui/mplayer/pixmaps/a43.xpm22
-rw-r--r--gui/mplayer/pixmaps/ab.xpm34
-rw-r--r--gui/mplayer/pixmaps/about.xpm427
-rw-r--r--gui/mplayer/pixmaps/aspect.xpm22
-rw-r--r--gui/mplayer/pixmaps/cancel.xpm139
-rw-r--r--gui/mplayer/pixmaps/chapter.xpm23
-rw-r--r--gui/mplayer/pixmaps/delsub.xpm22
-rw-r--r--gui/mplayer/pixmaps/dir.xpm148
-rw-r--r--gui/mplayer/pixmaps/dolby.xpm23
-rw-r--r--gui/mplayer/pixmaps/double.xpm151
-rw-r--r--gui/mplayer/pixmaps/dvd.xpm129
-rw-r--r--gui/mplayer/pixmaps/empty.xpm20
-rw-r--r--gui/mplayer/pixmaps/empty1px.xpm5
-rw-r--r--gui/mplayer/pixmaps/eq.xpm35
-rw-r--r--gui/mplayer/pixmaps/error.xpm544
-rw-r--r--gui/mplayer/pixmaps/exit.xpm82
-rw-r--r--gui/mplayer/pixmaps/file.xpm26
-rw-r--r--gui/mplayer/pixmaps/file2.xpm27
-rw-r--r--gui/mplayer/pixmaps/fs.xpm109
-rw-r--r--gui/mplayer/pixmaps/half.xpm144
-rw-r--r--gui/mplayer/pixmaps/icon.xpm323
-rw-r--r--gui/mplayer/pixmaps/loadeaf.xpm151
-rw-r--r--gui/mplayer/pixmaps/logo.xpm1227
-rw-r--r--gui/mplayer/pixmaps/mplayer-desktop.xpm149
-rw-r--r--gui/mplayer/pixmaps/next.xpm79
-rw-r--r--gui/mplayer/pixmaps/normal.xpm130
-rw-r--r--gui/mplayer/pixmaps/ok.xpm24
-rw-r--r--gui/mplayer/pixmaps/open.xpm83
-rw-r--r--gui/mplayer/pixmaps/pause.xpm48
-rw-r--r--gui/mplayer/pixmaps/pl.xpm26
-rw-r--r--gui/mplayer/pixmaps/play.xpm56
-rw-r--r--gui/mplayer/pixmaps/playdvd.xpm137
-rw-r--r--gui/mplayer/pixmaps/playvcd.xpm201
-rw-r--r--gui/mplayer/pixmaps/prefs.xpm69
-rw-r--r--gui/mplayer/pixmaps/prev.xpm77
-rw-r--r--gui/mplayer/pixmaps/question.xpm335
-rw-r--r--gui/mplayer/pixmaps/skin.xpm181
-rw-r--r--gui/mplayer/pixmaps/sound.xpm140
-rw-r--r--gui/mplayer/pixmaps/stop.xpm254
-rw-r--r--gui/mplayer/pixmaps/stop2.xpm48
-rw-r--r--gui/mplayer/pixmaps/sub.xpm21
-rw-r--r--gui/mplayer/pixmaps/title.xpm23
-rw-r--r--gui/mplayer/pixmaps/tongue.xpm169
-rw-r--r--gui/mplayer/pixmaps/tonguebla.xpm156
-rw-r--r--gui/mplayer/pixmaps/up.xpm112
-rw-r--r--gui/mplayer/pixmaps/url.xpm21
-rw-r--r--gui/mplayer/pixmaps/vcd.xpm179
-rw-r--r--gui/mplayer/pixmaps/warning.xpm314
-rw-r--r--gui/mplayer/play.c387
-rw-r--r--gui/mplayer/play.h49
-rw-r--r--gui/mplayer/sw.c110
-rw-r--r--gui/mplayer/widgets.c255
-rw-r--r--gui/mplayer/widgets.h80
-rw-r--r--gui/skin/cut.c53
-rw-r--r--gui/skin/cut.h27
-rw-r--r--gui/skin/font.c269
-rw-r--r--gui/skin/font.h54
-rw-r--r--gui/skin/skin.c745
-rw-r--r--gui/skin/skin.h35
-rw-r--r--gui/win32/Changelog317
-rw-r--r--gui/win32/README21
-rw-r--r--gui/win32/dialogs.c1122
-rw-r--r--gui/win32/dialogs.h134
-rw-r--r--gui/win32/gui.c1549
-rw-r--r--gui/win32/gui.h121
-rw-r--r--gui/win32/interface.c948
-rw-r--r--gui/win32/playlist.c158
-rw-r--r--gui/win32/playlist.h61
-rw-r--r--gui/win32/preferences.c714
-rw-r--r--gui/win32/skinload.c776
-rw-r--r--gui/win32/skinload.h215
-rw-r--r--gui/win32/widgetrender.c354
-rw-r--r--gui/win32/wincfg.c147
-rw-r--r--gui/wm/ws.c1312
-rw-r--r--gui/wm/ws.h275
-rw-r--r--gui/wm/wskeys.h181
-rw-r--r--gui/wm/wsmkeys.h86
-rw-r--r--gui/wm/wsxdnd.c259
-rw-r--r--gui/wm/wsxdnd.h71
-rw-r--r--help/help_mp-en.h1
-rw-r--r--help/help_mp-es.h1
-rw-r--r--help/help_mp-hu.h1
-rw-r--r--help/help_mp-pl.h1
-rw-r--r--help/help_mp-sk.h1
-rw-r--r--help/help_mp-sv.h1
-rw-r--r--help/help_mp-uk.h1
-rw-r--r--input/appleir.c14
-rw-r--r--input/ar.c4
-rw-r--r--input/ar.h4
-rw-r--r--input/input.c859
-rw-r--r--input/input.h72
-rw-r--r--input/joystick.c20
-rw-r--r--input/joystick.h2
-rw-r--r--input/lirc.c6
-rw-r--r--libaf/af.c2
-rw-r--r--libaf/af.h2
-rw-r--r--libaf/af_delay.c2
-rw-r--r--libaf/af_equalizer.c7
-rw-r--r--libaf/af_ladspa.c30
-rw-r--r--libaf/af_lavcac3enc.c6
-rw-r--r--libaf/af_resample.c1
-rw-r--r--libaf/af_scaletempo.c33
-rw-r--r--libaf/af_sweep.c1
-rw-r--r--libaf/filter.c1
-rw-r--r--libaf/format.c2
-rw-r--r--libaf/window.c1
-rw-r--r--libao2/ao_alsa.c137
-rw-r--r--libao2/ao_alsa5.c46
-rw-r--r--libao2/ao_arts.c13
-rw-r--r--libao2/ao_dxr2.c5
-rw-r--r--libao2/ao_esd.c6
-rw-r--r--libao2/ao_ivtv.c4
-rw-r--r--libao2/ao_jack.c1
-rw-r--r--libao2/ao_mpegpes.c8
-rw-r--r--libao2/ao_openal.c1
-rw-r--r--libao2/ao_oss.c55
-rw-r--r--libao2/ao_pcm.c12
-rw-r--r--libao2/ao_sdl.c20
-rw-r--r--libao2/ao_sgi.c34
-rw-r--r--libao2/ao_sun.c9
-rw-r--r--libao2/ao_v4l2.c4
-rw-r--r--libao2/audio_out.c16
-rw-r--r--libao2/audio_out.h3
-rw-r--r--libass/ass.c1246
-rw-r--r--libass/ass.h374
-rw-r--r--libass/ass_bitmap.c537
-rw-r--r--libass/ass_bitmap.h57
-rw-r--r--libass/ass_cache.c380
-rw-r--r--libass/ass_cache.h119
-rw-r--r--libass/ass_cache_template.h122
-rw-r--r--libass/ass_drawing.c495
-rw-r--r--libass/ass_drawing.h77
-rw-r--r--libass/ass_font.c532
-rw-r--r--libass/ass_font.h66
-rw-r--r--libass/ass_fontconfig.c461
-rw-r--r--libass/ass_fontconfig.h47
-rw-r--r--libass/ass_library.c147
-rw-r--r--libass/ass_library.h43
-rw-r--r--libass/ass_mp.c278
-rw-r--r--libass/ass_mp.h75
-rw-r--r--libass/ass_parse.c926
-rw-r--r--libass/ass_parse.h38
-rw-r--r--libass/ass_render.c2694
-rw-r--r--libass/ass_render.h262
-rw-r--r--libass/ass_strtod.c247
-rw-r--r--libass/ass_types.h125
-rw-r--r--libass/ass_utils.c207
-rw-r--r--libass/ass_utils.h147
-rw-r--r--libass/mputils.h31
-rw-r--r--libmenu/menu.c50
-rw-r--r--libmenu/menu.h5
-rw-r--r--libmenu/menu_chapsel.c4
-rw-r--r--libmenu/menu_cmdlist.c18
-rw-r--r--libmenu/menu_console.c18
-rw-r--r--libmenu/menu_dvbin.c4
-rw-r--r--libmenu/menu_filesel.c17
-rw-r--r--libmenu/menu_list.c1
-rw-r--r--libmenu/menu_param.c16
-rw-r--r--libmenu/menu_pt.c8
-rw-r--r--libmenu/menu_txt.c8
-rw-r--r--libmenu/vf_menu.c25
-rw-r--r--libmpcodecs/ad.c54
-rw-r--r--libmpcodecs/ad.h6
-rw-r--r--libmpcodecs/ad_acm.c6
-rw-r--r--libmpcodecs/ad_alaw.c2
-rw-r--r--libmpcodecs/ad_dk3adpcm.c2
-rw-r--r--libmpcodecs/ad_dmo.c4
-rw-r--r--libmpcodecs/ad_dshow.c4
-rw-r--r--libmpcodecs/ad_dvdpcm.c4
-rw-r--r--libmpcodecs/ad_faad.c4
-rw-r--r--libmpcodecs/ad_ffmpeg.c8
-rw-r--r--libmpcodecs/ad_hwac3.c4
-rw-r--r--libmpcodecs/ad_hwmpa.c2
-rw-r--r--libmpcodecs/ad_imaadpcm.c2
-rw-r--r--libmpcodecs/ad_internal.h2
-rw-r--r--libmpcodecs/ad_liba52.c6
-rw-r--r--libmpcodecs/ad_libdca.c2
-rw-r--r--libmpcodecs/ad_libdv.c4
-rw-r--r--libmpcodecs/ad_libmad.c2
-rw-r--r--libmpcodecs/ad_libvorbis.c2
-rw-r--r--libmpcodecs/ad_mp3lib.c2
-rw-r--r--libmpcodecs/ad_mpc.c3
-rw-r--r--libmpcodecs/ad_msadpcm.c4
-rw-r--r--libmpcodecs/ad_msgsm.c2
-rw-r--r--libmpcodecs/ad_pcm.c41
-rw-r--r--libmpcodecs/ad_qtaudio.c2
-rw-r--r--libmpcodecs/ad_realaud.c4
-rw-r--r--libmpcodecs/ad_sample.c2
-rw-r--r--libmpcodecs/ad_speex.c3
-rw-r--r--libmpcodecs/ad_twin.c2
-rw-r--r--libmpcodecs/ae.c2
-rw-r--r--libmpcodecs/ae_lame.c182
-rw-r--r--libmpcodecs/ae_lavc.c48
-rw-r--r--libmpcodecs/ae_pcm.c1
-rw-r--r--libmpcodecs/ae_toolame.c1
-rw-r--r--libmpcodecs/ae_twolame.c1
-rw-r--r--libmpcodecs/dec_audio.c65
-rw-r--r--libmpcodecs/dec_teletext.c6
-rw-r--r--libmpcodecs/dec_video.c615
-rw-r--r--libmpcodecs/dec_video.h3
-rw-r--r--libmpcodecs/img_format.c2
-rw-r--r--libmpcodecs/mp_image.h2
-rw-r--r--libmpcodecs/native/xa_gsm.c2
-rw-r--r--libmpcodecs/pullup.c9
-rw-r--r--libmpcodecs/vd.c519
-rw-r--r--libmpcodecs/vd.h8
-rw-r--r--libmpcodecs/vd_dmo.c10
-rw-r--r--libmpcodecs/vd_dshow.c10
-rw-r--r--libmpcodecs/vd_ffmpeg.c325
-rw-r--r--libmpcodecs/vd_hmblck.c2
-rw-r--r--libmpcodecs/vd_ijpg.c4
-rw-r--r--libmpcodecs/vd_internal.h2
-rw-r--r--libmpcodecs/vd_libdv.c2
-rw-r--r--libmpcodecs/vd_libmpeg2.c6
-rw-r--r--libmpcodecs/vd_lzo.c2
-rw-r--r--libmpcodecs/vd_mpegpes.c2
-rw-r--r--libmpcodecs/vd_mpng.c2
-rw-r--r--libmpcodecs/vd_mtga.c3
-rw-r--r--libmpcodecs/vd_null.c3
-rw-r--r--libmpcodecs/vd_qtvideo.c2
-rw-r--r--libmpcodecs/vd_raw.c2
-rw-r--r--libmpcodecs/vd_realvid.c4
-rw-r--r--libmpcodecs/vd_sgi.c3
-rw-r--r--libmpcodecs/vd_theora.c2
-rw-r--r--libmpcodecs/vd_vfw.c4
-rw-r--r--libmpcodecs/vd_xanim.c2
-rw-r--r--libmpcodecs/vd_xvid4.c2
-rw-r--r--libmpcodecs/vd_zrmjpeg.c2
-rw-r--r--libmpcodecs/ve.c5
-rw-r--r--libmpcodecs/ve_lavc.c22
-rw-r--r--libmpcodecs/ve_libdv.c8
-rw-r--r--libmpcodecs/ve_nuv.c12
-rw-r--r--libmpcodecs/ve_qtvideo.c8
-rw-r--r--libmpcodecs/ve_raw.c12
-rw-r--r--libmpcodecs/ve_vfw.c22
-rw-r--r--libmpcodecs/ve_x264.c16
-rw-r--r--libmpcodecs/ve_xvid4.c10
-rw-r--r--libmpcodecs/vf.c110
-rw-r--r--libmpcodecs/vf.h62
-rw-r--r--libmpcodecs/vf_1bpp.c8
-rw-r--r--libmpcodecs/vf_2xsai.c10
-rw-r--r--libmpcodecs/vf_ass.c163
-rw-r--r--libmpcodecs/vf_blackframe.c10
-rw-r--r--libmpcodecs/vf_bmovl.c8
-rw-r--r--libmpcodecs/vf_boxblur.c6
-rw-r--r--libmpcodecs/vf_crop.c17
-rw-r--r--libmpcodecs/vf_cropdetect.c8
-rw-r--r--libmpcodecs/vf_decimate.c6
-rw-r--r--libmpcodecs/vf_delogo.c16
-rw-r--r--libmpcodecs/vf_denoise3d.c8
-rw-r--r--libmpcodecs/vf_detc.c12
-rw-r--r--libmpcodecs/vf_dint.c4
-rw-r--r--libmpcodecs/vf_divtc.c8
-rw-r--r--libmpcodecs/vf_down3dright.c9
-rw-r--r--libmpcodecs/vf_dsize.c3
-rw-r--r--libmpcodecs/vf_dvbscale.c2
-rw-r--r--libmpcodecs/vf_eq.c13
-rw-r--r--libmpcodecs/vf_expand.c72
-rw-r--r--libmpcodecs/vf_field.c6
-rw-r--r--libmpcodecs/vf_fil.c6
-rw-r--r--libmpcodecs/vf_filmdint.c17
-rw-r--r--libmpcodecs/vf_flip.c6
-rw-r--r--libmpcodecs/vf_format.c6
-rw-r--r--libmpcodecs/vf_framestep.c8
-rw-r--r--libmpcodecs/vf_fspp.c12
-rw-r--r--libmpcodecs/vf_geq.c18
-rw-r--r--libmpcodecs/vf_gradfun.c12
-rw-r--r--libmpcodecs/vf_halfpack.c9
-rw-r--r--libmpcodecs/vf_harddup.c8
-rw-r--r--libmpcodecs/vf_hqdn3d.c8
-rw-r--r--libmpcodecs/vf_hue.c13
-rw-r--r--libmpcodecs/vf_il.c2
-rw-r--r--libmpcodecs/vf_ilpack.c7
-rw-r--r--libmpcodecs/vf_ivtc.c10
-rw-r--r--libmpcodecs/vf_kerndeint.c10
-rw-r--r--libmpcodecs/vf_lavc.c10
-rw-r--r--libmpcodecs/vf_lavcdeint.c6
-rw-r--r--libmpcodecs/vf_mcdeint.c15
-rw-r--r--libmpcodecs/vf_mirror.c2
-rw-r--r--libmpcodecs/vf_noformat.c6
-rw-r--r--libmpcodecs/vf_noise.c12
-rw-r--r--libmpcodecs/vf_ow.c10
-rw-r--r--libmpcodecs/vf_palette.c16
-rw-r--r--libmpcodecs/vf_perspective.c8
-rw-r--r--libmpcodecs/vf_phase.c4
-rw-r--r--libmpcodecs/vf_pp.c48
-rw-r--r--libmpcodecs/vf_pp7.c12
-rw-r--r--libmpcodecs/vf_pullup.c14
-rw-r--r--libmpcodecs/vf_qp.c10
-rw-r--r--libmpcodecs/vf_rectangle.c6
-rw-r--r--libmpcodecs/vf_remove_logo.c10
-rw-r--r--libmpcodecs/vf_rgb2bgr.c6
-rw-r--r--libmpcodecs/vf_rgbtest.c6
-rw-r--r--libmpcodecs/vf_rotate.c6
-rw-r--r--libmpcodecs/vf_sab.c8
-rw-r--r--libmpcodecs/vf_scale.c39
-rw-r--r--libmpcodecs/vf_screenshot.c12
-rw-r--r--libmpcodecs/vf_smartblur.c8
-rw-r--r--libmpcodecs/vf_softpulldown.c6
-rw-r--r--libmpcodecs/vf_softskip.c10
-rw-r--r--libmpcodecs/vf_spp.c17
-rw-r--r--libmpcodecs/vf_swapuv.c6
-rw-r--r--libmpcodecs/vf_telecine.c10
-rw-r--r--libmpcodecs/vf_test.c8
-rw-r--r--libmpcodecs/vf_tfields.c30
-rw-r--r--libmpcodecs/vf_tile.c10
-rw-r--r--libmpcodecs/vf_tinterlace.c8
-rw-r--r--libmpcodecs/vf_unsharp.c12
-rw-r--r--libmpcodecs/vf_uspp.c12
-rw-r--r--libmpcodecs/vf_vo.c126
-rw-r--r--libmpcodecs/vf_yadif.c24
-rw-r--r--libmpcodecs/vf_yuvcsp.c8
-rw-r--r--libmpcodecs/vf_yuy2.c8
-rw-r--r--libmpcodecs/vf_yvu9.c8
-rw-r--r--libmpcodecs/vf_zrmjpeg.c7
-rw-r--r--libmpdemux/asfheader.c30
-rw-r--r--libmpdemux/aviheader.c53
-rw-r--r--libmpdemux/aviprint.c1
-rw-r--r--libmpdemux/demux_asf.c10
-rw-r--r--libmpdemux/demux_audio.c4
-rw-r--r--libmpdemux/demux_avi.c43
-rw-r--r--libmpdemux/demux_avs.c2
-rw-r--r--libmpdemux/demux_demuxers.c5
-rw-r--r--libmpdemux/demux_lavf.c39
-rw-r--r--libmpdemux/demux_lmlm4.c6
-rw-r--r--libmpdemux/demux_mkv.c4738
-rw-r--r--libmpdemux/demux_mng.c1
-rw-r--r--libmpdemux/demux_mov.c21
-rw-r--r--libmpdemux/demux_mpg.c18
-rw-r--r--libmpdemux/demux_nemesi.c2
-rw-r--r--libmpdemux/demux_nut.c4
-rw-r--r--libmpdemux/demux_ogg.c13
-rw-r--r--libmpdemux/demux_pva.c2
-rw-r--r--libmpdemux/demux_real.c12
-rw-r--r--libmpdemux/demux_rtp.cpp10
-rw-r--r--libmpdemux/demux_ty.c5
-rw-r--r--libmpdemux/demux_ty_osd.c3
-rw-r--r--libmpdemux/demux_viv.c6
-rw-r--r--libmpdemux/demux_vqf.c2
-rw-r--r--libmpdemux/demux_xmms.c6
-rw-r--r--libmpdemux/demuxer.c350
-rw-r--r--libmpdemux/demuxer.h92
-rw-r--r--libmpdemux/ebml.c754
-rw-r--r--libmpdemux/ebml.h189
-rw-r--r--libmpdemux/ebml_defs.c382
-rw-r--r--libmpdemux/ebml_types.h433
-rw-r--r--libmpdemux/extension.c1
-rw-r--r--libmpdemux/mf.c1
-rw-r--r--libmpdemux/mp3_hdr.c4
-rw-r--r--libmpdemux/mp_taglists.c21
-rw-r--r--libmpdemux/mp_taglists.h10
-rw-r--r--libmpdemux/muxer.c9
-rw-r--r--libmpdemux/muxer_avi.c8
-rw-r--r--libmpdemux/muxer_lavf.c8
-rw-r--r--libmpdemux/muxer_mpeg.c37
-rw-r--r--libmpdemux/muxer_rawaudio.c7
-rw-r--r--libmpdemux/parse_mp4.c3
-rw-r--r--libmpdemux/parse_mp4.h1
-rw-r--r--libmpdemux/stheader.h43
-rw-r--r--libmpdemux/video.c23
-rw-r--r--libmpdemux/yuv4mpeg.c2
-rw-r--r--libmpdemux/yuv4mpeg.h2
-rw-r--r--libmpdemux/yuv4mpeg_ratio.c1
-rw-r--r--libswscale/Makefile23
-rw-r--r--libswscale/bfin/internal_bfin.S606
-rw-r--r--libswscale/bfin/swscale_bfin.c93
-rw-r--r--libswscale/bfin/yuv2rgb_bfin.c203
-rw-r--r--libswscale/colorspace-test.c178
-rw-r--r--libswscale/libswscale.v4
-rw-r--r--libswscale/mlib/yuv2rgb_mlib.c88
-rw-r--r--libswscale/options.c61
-rw-r--r--libswscale/ppc/swscale_altivec_template.c545
-rw-r--r--libswscale/ppc/yuv2rgb_altivec.c953
-rw-r--r--libswscale/rgb2rgb.c444
-rw-r--r--libswscale/rgb2rgb.h161
-rw-r--r--libswscale/rgb2rgb_template.c3010
-rw-r--r--libswscale/sparc/yuv2rgb_vis.c212
-rw-r--r--libswscale/swscale-test.c260
-rw-r--r--libswscale/swscale.c1914
-rw-r--r--libswscale/swscale.h297
-rw-r--r--libswscale/swscale_internal.h460
-rw-r--r--libswscale/swscale_template.c3064
-rw-r--r--libswscale/utils.c1588
-rw-r--r--libswscale/x86/yuv2rgb_mmx.c101
-rw-r--r--libswscale/x86/yuv2rgb_template.c564
-rw-r--r--libswscale/yuv2rgb.c753
-rw-r--r--libvo/aclib.c2
-rw-r--r--libvo/aclib_template.c1
-rw-r--r--libvo/aspect.c146
-rw-r--r--libvo/aspect.h37
-rw-r--r--libvo/aspecttest.c1
-rw-r--r--libvo/font_load.h1
-rw-r--r--libvo/font_load_ft.c24
-rw-r--r--libvo/gl_common.c29
-rw-r--r--libvo/gl_common.h2
-rw-r--r--libvo/gtf.c2
-rw-r--r--libvo/mga_common.c57
-rw-r--r--libvo/old_vo_defines.h24
-rw-r--r--libvo/old_vo_wrapper.c116
-rw-r--r--libvo/old_vo_wrapper.h29
-rw-r--r--libvo/osd.c1
-rw-r--r--libvo/osx_common.c3
-rw-r--r--libvo/spuenc.c47
-rw-r--r--libvo/spuenc.h1
-rw-r--r--libvo/sub.c129
-rw-r--r--libvo/sub.h43
-rw-r--r--libvo/vdpau_template.c42
-rw-r--r--libvo/vesa_lvo.c22
-rw-r--r--libvo/vesa_lvo.h4
-rw-r--r--libvo/video_out.c395
-rw-r--r--libvo/video_out.h292
-rw-r--r--libvo/video_out_internal.h21
-rw-r--r--libvo/vo_3dfx.c20
-rw-r--r--libvo/vo_aa.c63
-rw-r--r--libvo/vo_bl.c2
-rw-r--r--libvo/vo_caca.c2
-rw-r--r--libvo/vo_corevideo.m4
-rw-r--r--libvo/vo_cvidix.c22
-rw-r--r--libvo/vo_dfbmga.c26
-rw-r--r--libvo/vo_dga.c2
-rw-r--r--libvo/vo_direct3d.c4
-rw-r--r--libvo/vo_directfb2.c22
-rw-r--r--libvo/vo_directx.c31
-rw-r--r--libvo/vo_dxr2.c17
-rw-r--r--libvo/vo_dxr3.c182
-rw-r--r--libvo/vo_fbdev.c26
-rw-r--r--libvo/vo_fbdev2.c2
-rw-r--r--libvo/vo_ggi.c12
-rw-r--r--libvo/vo_gif89a.c3
-rw-r--r--libvo/vo_gl.c54
-rw-r--r--libvo/vo_gl2.c43
-rw-r--r--libvo/vo_ivtv.c4
-rw-r--r--libvo/vo_jpeg.c49
-rw-r--r--libvo/vo_kva.c22
-rw-r--r--libvo/vo_matrixview.c32
-rw-r--r--libvo/vo_md5sum.c19
-rw-r--r--libvo/vo_mga.c5
-rw-r--r--libvo/vo_mpegpes.c11
-rw-r--r--libvo/vo_null.c4
-rw-r--r--libvo/vo_png.c79
-rw-r--r--libvo/vo_pnm.c55
-rw-r--r--libvo/vo_quartz.c2
-rw-r--r--libvo/vo_s3fb.c2
-rw-r--r--libvo/vo_sdl.c28
-rw-r--r--libvo/vo_svga.c51
-rw-r--r--libvo/vo_tdfx_vid.c45
-rw-r--r--libvo/vo_tdfxfb.c22
-rw-r--r--libvo/vo_tga.c4
-rw-r--r--libvo/vo_v4l2.c4
-rw-r--r--libvo/vo_vdpau.c2257
-rw-r--r--libvo/vo_vesa.c110
-rw-r--r--libvo/vo_wii.c2
-rw-r--r--libvo/vo_winvidix.c31
-rw-r--r--libvo/vo_x11.c35
-rw-r--r--libvo/vo_xmga.c11
-rw-r--r--libvo/vo_xover.c60
-rw-r--r--libvo/vo_xv.c947
-rw-r--r--libvo/vo_xvidix.c46
-rw-r--r--libvo/vo_xvmc.c30
-rw-r--r--libvo/vo_xvr100.c2
-rw-r--r--libvo/vo_yuv4mpeg.c64
-rw-r--r--libvo/vo_zr.c2
-rw-r--r--libvo/vo_zr2.c2
-rw-r--r--libvo/vosub_vidix.c90
-rw-r--r--libvo/vosub_vidix.h4
-rw-r--r--libvo/w32_common.c17
-rw-r--r--libvo/x11_common.c1003
-rw-r--r--libvo/x11_common.h194
-rw-r--r--loader/dmo/DMO_VideoDecoder.c1
-rw-r--r--loader/dshow/DS_VideoDecoder.c4
-rw-r--r--loader/ldt_keeper.c2
-rw-r--r--loader/qtx/qtxsdk/components.h2
-rw-r--r--loader/vfl.c1
-rw-r--r--loader/wrapper.S1
-rw-r--r--loader/wrapper.h1
-rw-r--r--m_config.c212
-rw-r--r--m_config.h7
-rw-r--r--m_option.c10
-rw-r--r--m_option.h29
-rw-r--r--m_property.c7
-rw-r--r--mencoder.c322
-rw-r--r--metadata.h5
-rw-r--r--mixer.c7
-rw-r--r--mp3lib/dct36.c1
-rw-r--r--mp3lib/dct64_sse.c3
-rw-r--r--mp3lib/layer1.c2
-rw-r--r--mp3lib/layer3.c2
-rw-r--r--mp3lib/sr1.c4
-rw-r--r--mp_core.h176
-rw-r--r--mp_fifo.c121
-rw-r--r--mp_fifo.h13
-rw-r--r--mp_msg-mencoder.c3
-rw-r--r--mp_msg.c100
-rw-r--r--mp_msg.h12
-rw-r--r--mp_osd.h6
-rw-r--r--mpbswap.h2
-rw-r--r--mpcommon.c60
-rw-r--r--mpcommon.h10
-rw-r--r--mplayer.c2526
-rw-r--r--mplayer.h23
-rw-r--r--options.h84
-rw-r--r--osdep/findfiles.c97
-rw-r--r--osdep/findfiles.h2
-rw-r--r--osdep/getch2-os2.c6
-rw-r--r--osdep/getch2-win.c6
-rw-r--r--osdep/getch2.c8
-rw-r--r--osdep/getch2.h3
-rw-r--r--osdep/mmap_anon.c2
-rw-r--r--osdep/mplayer.rc1
-rw-r--r--osdep/priority.c3
-rw-r--r--osdep/priority.h1
-rw-r--r--osdep/shmem.c2
-rw-r--r--osdep/timer-darwin.c18
-rw-r--r--osdep/timer-linux.c47
-rw-r--r--osdep/timer-win2.c14
-rw-r--r--osdep/timer.h9
-rw-r--r--parser-mecmd.c8
-rw-r--r--parser-mpcmd.c18
-rw-r--r--playtree.c18
-rw-r--r--playtree.h14
-rw-r--r--playtreeparser.c23
-rw-r--r--playtreeparser.h7
-rw-r--r--spudec.c23
-rw-r--r--spudec.h4
-rw-r--r--stream/ai_alsa.c26
-rw-r--r--stream/ai_alsa1x.c32
-rw-r--r--stream/ai_oss.c20
-rw-r--r--stream/asf_mmst_streaming.c57
-rw-r--r--stream/asf_streaming.c75
-rw-r--r--stream/audio_in.c12
-rw-r--r--stream/cache2.c15
-rw-r--r--stream/cdinfo.c6
-rw-r--r--stream/network.c44
-rw-r--r--stream/network.h3
-rw-r--r--stream/open.c4
-rw-r--r--stream/pnm.c2
-rw-r--r--stream/realrtsp/asmrp.c1
-rw-r--r--stream/realrtsp/real.c2
-rw-r--r--stream/realrtsp/rmff.c2
-rw-r--r--stream/realrtsp/sdpplin.c1
-rw-r--r--stream/stream.c55
-rw-r--r--stream/stream.h33
-rw-r--r--stream/stream_cdda.c6
-rw-r--r--stream/stream_cddb.c74
-rw-r--r--stream/stream_cue.c72
-rw-r--r--stream/stream_dvd.c52
-rw-r--r--stream/stream_dvd_common.c12
-rw-r--r--stream/stream_dvdnav.c6
-rw-r--r--stream/stream_ffmpeg.c2
-rw-r--r--stream/stream_file.c4
-rw-r--r--stream/stream_live555.c2
-rw-r--r--stream/stream_nemesi.c1
-rw-r--r--stream/stream_netstream.c6
-rw-r--r--stream/stream_radio.c147
-rw-r--r--stream/stream_radio.h12
-rw-r--r--stream/stream_rtsp.c2
-rw-r--r--stream/stream_smb.c4
-rw-r--r--stream/stream_vcd.c8
-rw-r--r--stream/stream_vstream.c4
-rw-r--r--stream/tcp.c20
-rw-r--r--stream/tv.c93
-rw-r--r--stream/tvi_bsdbt848.c62
-rw-r--r--stream/tvi_dshow.c84
-rw-r--r--stream/tvi_v4l.c4
-rw-r--r--stream/url.c22
-rw-r--r--stream/vcd_read.h2
-rw-r--r--stream/vcd_read_fbsd.h2
-rw-r--r--sub_cc.c1
-rw-r--r--sub_cc.h1
-rw-r--r--subdir.mak102
-rw-r--r--subopt-helper.c1
-rw-r--r--subreader.c5
-rw-r--r--subreader.h9
-rw-r--r--talloc.c1758
-rw-r--r--talloc.h183
-rw-r--r--unrar_exec.c1
-rwxr-xr-xversion.sh12
-rw-r--r--vidix/.gitignore5
-rw-r--r--vidix/drivers.c1
-rw-r--r--vidix/nvidia_vid.c5
-rw-r--r--vidix/sysdep/pci_alpha.c1
-rw-r--r--vobsub.h1
704 files changed, 18589 insertions, 68801 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000000..411891e554
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,17 @@
+*.o
+*.a
+*.d
+.depend
+
+/ffmpeg
+/config.h
+/config.mak
+/configure.log
+/help_mp.h
+/mencoder
+/mplayer
+/version.h
+/codecs.conf.h
+/codec-cfg
+/codec-cfg-test
+/codecs2html
diff --git a/Changelog b/Changelog
index 4418beb246..3b856cc4f6 100644
--- a/Changelog
+++ b/Changelog
@@ -41,8 +41,6 @@ MPlayer (1.0)
* -name, -title and -use-filename-title options for MPlayer
* support for stream handling via FFmpeg
Use e.g. ffmpeg://http://example.com/test
- * experimental support for external libass, configure with
- --disable-ass-internal
* better support for 16-bit-per-component formats and formats
with alpha channel.
* better out-of-the-box support for compiling for ARM, IA64,
diff --git a/DOCS/man/de/mplayer.1 b/DOCS/man/de/mplayer.1
index e0e0412b53..12a545157c 100644
--- a/DOCS/man/de/mplayer.1
+++ b/DOCS/man/de/mplayer.1
@@ -2193,7 +2193,6 @@ Siehe auch \-vf expand.
Schaltet das Zeichnen von SSA/ASS-Untertiteln ein.
Mit dieser Option wird libass für externe SSA/ASS-Untertitel und
Matroska-Spuren verwendet.
-Du möchtest vielleicht auch \-embeddedfonts verwenden.
.br
.I ANMERKUNG:
Wenn fontconfig eincompiliert wurde, schaltet \-ass automatisch \-fontconfig
@@ -2320,17 +2319,10 @@ Speichert den Untertitel-Substream eines VOB-Streams.
Siehe auch die Optionen \-dump*sub und \-vobsubout*.
.
.TP
-.B \-embeddedfonts (nur bei FreeType)
-Aktiviert die Extraktion von in Matroska eingebetteten Schriften (Standard:
-deaktiviert).
+.B \-noembeddedfonts
+Deaktiviert die Nutzung von in Matroska-Dateien und ASS-Untertiteln eingebetteten Schriften (Standard:
+aktiviert).
Diese Schriften können für das Rendern von SSA/ASS-Untertiteln verwendet werden
-(Option \-ass).
-Schriftdateien werden im Verzeichnis ~/.mplayer/\:fonts angelegt.
-.br
-.I ANMERKUNG:
-Bei der Verwendung von FontConfig 2.4.2 oder neuer werden eingebettete
-Schriften direkt vom Speicher geöffnet; diese Option ist per Voreinstellung
-aktiviert.
.
.TP
.B \-ffactor <Nummer>
diff --git a/DOCS/man/en/mplayer.1 b/DOCS/man/en/mplayer.1
index 600db5d0f0..6e9282ae25 100644
--- a/DOCS/man/en/mplayer.1
+++ b/DOCS/man/en/mplayer.1
@@ -124,11 +124,6 @@ tivo://host/[list|llist|fsid]
[options]
.
.br
-.B gmplayer
-[options]
-[\-skin\ skin]
-.
-.br
.B mencoder
[options] file
[file|URL|\-] [\-o file | file://file | smb://[user:pass@]host/filepath]
@@ -182,10 +177,7 @@ more.
.PP
.B gmplayer
is MPlayer with a graphical user interface.
-It has the same options as MPlayer, however they might not all work correctly
-due to conflicts with the configuration via the GUI (stored in gui.conf).
-In particular some options might be overwritten by settings in gui.conf while
-others might end up stored permanently in gui.conf.
+It has the same options as MPlayer.
.PP
Usage examples to get you started quickly can be found at the end
of this man page.
@@ -290,8 +282,10 @@ Show filename on the OSD.
Seek to the beginning of the previous/next chapter.
.IPs "D (\-vo xvmc, \-vo vdpau, \-vf yadif, \-vf kerndeint only)"
Activate/deactivate deinterlacer.
-.IPs "A"
+.IPs "A\ \ \ \ "
Cycle through the available DVD angles.
+.IPs "c (currently -vo vdpau and -vo xv only)"
+Change YUV colorspace.
.RE
.PD 1
.PP
@@ -365,30 +359,6 @@ Seek backward/\:forward 1 minute.
.PD 1
.PP
.RS
-(The following keys are only valid if GUI support is compiled in
-and will take precedence over the keys defined above.)
-.RE
-.PP
-.PD 0
-.RS
-.IPs ENTER
-Start playing.
-.IPs "ESC\ \ "
-Stop playing.
-.IPs "l\ \ \ \ "
-Load file.
-.IPs "t\ \ \ \ "
-Load subtitle.
-.IPs "c\ \ \ \ "
-Open skin browser.
-.IPs "p\ \ \ \ "
-Open playlist.
-.IPs "r\ \ \ \ "
-Open preferences.
-.RE
-.PD 1
-.PP
-.RS
(The following keys are only valid if you compiled with TV or DVB input
support and will take precedence over the keys defined above.)
.RE
@@ -723,8 +693,6 @@ Available options are:
.RSs
.IPs "all\ \ "
all configuration files
-.IPs "gui (GUI only)"
-GUI configuration file
.IPs system
system configuration file
.IPs "user\ "
@@ -760,7 +728,6 @@ Use the given profile(s), \-profile help displays a list of the defined profiles
.TP
.B \-really\-quiet (also see \-quiet)
Display even less output and status messages than with \-quiet.
-Also suppresses the GUI error message boxes.
.
.TP
.B \-show\-profile <profile>
@@ -834,8 +801,8 @@ xover, xv (see \-vo xv:ck), xvmc (see \-vo xv:ck) and directx video output
drivers.
.
.TP
-.B \-correct\-pts (EXPERIMENTAL)
-Switches MPlayer to an experimental mode where timestamps for video frames
+.B \-correct\-pts
+Switches MPlayer to a mode where timestamps for video frames
are calculated differently and video filters which add new frames or
modify timestamps of existing ones are supported.
The more accurate timestamps can be visible for example when playing
@@ -868,15 +835,12 @@ later.
See http://www.mplayerhq.hu/\:DOCS/\:HTML/\:en/\:edl.html for details.
.
.TP
-.B \-enqueue (GUI only)
-Enqueue files given on the command line in the playlist instead of playing them
-immediately.
-.
-.TP
-.B \-fixed\-vo
-Enforces a fixed video system for multiple files (one (un)initialization for
-all files).
+.B \-nofixed\-vo
+\-fixed\-vo enforces a fixed video system for multiple files (one
+(un)initialization for all files).
Therefore only one window will be opened for all files.
+Now enabled by default, use \-nofixed\-vo to disable and create a new window
+whenever the video stream changes.
Currently the following drivers are fixed-vo compliant: gl, gl2, mga, svga, x11,
xmga, xv, xvidix and dfbmga.
.
@@ -887,12 +851,6 @@ Video filters are not applied to such frames.
For B-frames even decoding is skipped completely.
.
.TP
-.B \-(no)gui
-Enable or disable the GUI interface (default depends on binary name).
-Only works as the first argument on the command line.
-Does not work as a config-file option.
-.
-.TP
.B \-h, \-help, \-\-help
Show short summary of options.
.
@@ -1077,6 +1035,26 @@ Turns off LIRC support.
.B \-nomouseinput
Disable mouse button press/\:release input (mozplayerxp's context menu relies
on this option).
+.TP
+.B \-noordered\-chapters
+Disable support for Matroska ordered chapters.
+MPlayer will not load or search for video segments from other files,
+and will also ignore any chapter order specified for the main file.
+.
+.TP
+.B \-pts\-association\-mode <mode number>
+Select the method used to determine which container packet timestamp
+corresponds to a particular output frame from the video decoder.
+.PD 0
+.RSs
+.IPs 0
+Try to pick a working mode from the ones below automatically (default)
+.IPs 1
+Use decoder reordering functionality.
+.IPs 2
+Maintain a buffer of unused pts values and use the lowest value for the frame.
+.RE
+.PD 1
.
.TP
.B \-rtc (RTC only)
@@ -1119,20 +1097,6 @@ Use the specified device for RTC timing.
Play files in random order.
.
.TP
-.B \-skin <name> (GUI only)
-Loads a skin from the directory given as parameter below the default skin
-directories, /usr/\:local/\:share/\:mplayer/\:skins/\: and ~/.mplayer/\:skins/.
-.sp 1
-.I EXAMPLE:
-.PD 0
-.RSs
-.IPs "\-skin fittyfene"
-Tries /usr/\:local/\:share/\:mplayer/\:skins/\:fittyfene
-and afterwards ~/.mplayer/\:skins/\:fittyfene.
-.RE
-.PD 1
-.
-.TP
.B \-slave (also see \-input)
Switches on slave mode, in which MPlayer works as a backend for other programs.
Instead of intercepting keyboard events, MPlayer will read commands separated
@@ -1335,6 +1299,12 @@ Specify which chapter to start playing at.
Optionally specify which chapter to end playing at (default: 1).
.
.TP
+.B \-edition <edition ID> (Matroska, MPlayer only)
+Specify the edition (set of chapters) to use, where 0 is the first. If set to
+-1 (the default), MPlayer will choose the first edition declared as a default,
+or if there is no default, the first edition defined.
+.
+.TP
.B \-cookies (network only)
Send cookies when making HTTP requests.
.
@@ -2100,7 +2070,6 @@ Also see \-vf expand.
Turn on SSA/ASS subtitle rendering.
With this option, libass will be used for SSA/ASS
external subtitles and Matroska tracks.
-You may also want to use \-embeddedfonts.
.br
.I NOTE:
Unlike normal OSD, libass uses fontconfig by default. To disable it, use
@@ -2157,7 +2126,7 @@ The same, but hinting will only be performed if the OSD is rendered at
screen resolution and will therefore not be scaled.
.RE
.RSs
-The default value is 7 (use native hinter for unscaled OSD and no hinting otherwise).
+The default value is 5 (use light hinter for unscaled OSD and no hinting otherwise).
.RE
.PD 1
.
@@ -2225,15 +2194,10 @@ Dumps the subtitle substream from VOB streams.
Also see the \-dump*sub and \-vobsubout* options.
.
.TP
-.B \-embeddedfonts (FreeType only)
-Enables extraction of Matroska embedded fonts (default: disabled).
+.B \-noembeddedfonts
+Disables use of fonts embedded in Matroska containers and ASS scripts (default: enabled).
These fonts can be used for SSA/ASS subtitle
rendering (\-ass option).
-Font files are created in the ~/.mplayer/\:fonts directory.
-.br
-.I NOTE:
-With FontConfig 2.4.2 or newer, embedded fonts are opened directly from memory,
-and this option is enabled by default.
.
.TP
.B \-ffactor <number>
@@ -3070,6 +3034,13 @@ VESA framebuffer does not support mode changing.
Override framebuffer mode configuration file (default: /etc/\:fb.modes).
.
.TP
+.B \-force\-window\-position
+Forcefully move MPlayer's video output window to default location whenever
+there is a change in video parameters, video stream or file.
+This used to be the default behavior.
+Currently only affects X11 VOs.
+.
+.TP
.B \-fs (also see \-zoom)
Fullscreen playback (centers movie, and paints black bands around it).
Not supported by all video output drivers.
@@ -3157,12 +3128,6 @@ Places the window at the bottom right corner of the screen.
.PD 1
.
.TP
-.B \-guiwid <window ID> (also see \-wid) (GUI only)
-This tells the GUI to also use an X11 window and stick itself to the bottom
-of the video, which is useful to embed a mini-GUI in a browser (with the
-MPlayer plugin for instance).
-.
-.TP
.B \-hue <\-100\-100>
Adjust the hue of the video signal (default: 0).
You can get a colored negative of the image with this option.
@@ -3220,8 +3185,12 @@ Useful for multihead setups.
.TP
.B \-nokeepaspect
Do not keep window aspect ratio when resizing windows.
-Only works with the x11, xv, xmga, xvidix, directx video output drivers.
-Furthermore under X11 your window manager has to honor window aspect hints.
+By default MPlayer tries to keep the correct video aspect ratio by
+instructing the window manager to maintain window aspect when resizing,
+and by adding black bars if the window manager nevertheless allows
+window shape to change.
+This option disables window manager aspect hints and scales the video
+to completely fill the window without regard for aspect ratio.
.
.TP
.B "\-ontop\ "
@@ -3307,7 +3276,7 @@ the new display mode.
Enables VBI for the vesa, dfbmga and svga video output drivers.
.
.TP
-.B \-wid <window ID> (also see \-guiwid) (X11, OpenGL and DirectX only)
+.B \-wid <window ID> (X11, OpenGL and DirectX only)
This tells MPlayer to attach to an existing window.
Useful to embed MPlayer in a browser (e.g.\& the plugger extension).
This option fills the given window completely, thus aspect scaling,
@@ -3538,11 +3507,26 @@ Use default VDPAU scaling (default).
.IPs 1\-9
Apply high quality VDPAU scaling (needs capable hardware).
.RE
-.IPs force\-mixer
-Forces the use of the VDPAU mixer, which implements all above options (default).
-Use noforce\-mixer to allow displaying BGRA colorspace.
-(Disables all above options and the hardware equalizer
-if image format BGRA is actually used.)
+.IPs fps=<number>
+Override autodetected display refresh rate value (the value is needed for framedrop to allow video playback rates higher than display refresh rate, and for vsync-aware frame timing adjustments).
+Default 0 means use autodetected value.
+A positive value is interpreted as a refresh rate in Hz and overrides the autodetected value.
+A negative value disables all timing adjustment and framedrop logic.
+.IPs queuetime_windowed=<number>
+.IPs queuetime_fs=<number>
+Use VDPAU's presentation queue functionality to queue future video frame
+changes at most this many milliseconds in advance (default: 50).
+This makes MPlayer's flip timing less sensitive to system CPU load and allows
+it to start decoding the next frame slightly earlier which can reduce jitter
+caused by individual slow-to-decode frames.
+However the NVIDIA graphics drivers can make other window behavior such as
+window moves choppy if VDPAU is using the blit queue (mainly happens
+if you have the composite extension enabled) and this feature is active.
+If this happens on your system and you care about it then you can set the
+time to 0 to disable this feature.
+The settings to use in windowed and fullscreen mode are separate because there
+should be less reason to disable this for fullscreen mode (as the driver issue
+shouldn't affect the video itself).
.RE
.PD 1
.
@@ -4429,8 +4413,6 @@ Each file takes the frame number padded with leading zeros as name.
.IPs z=<0\-9>
Specifies the compression level.
0 is no compression, 9 is maximum compression.
-.IPs outdir=<dirname>
-Specify the directory to save the PNG files to (default: ./).
.IPs alpha (default: noalpha)
Create PNG files with an alpha channel.
Note that MPlayer in general does not support alpha, so this will only
@@ -11190,14 +11172,6 @@ MEncoder user settings
input bindings (see '\-input keylist' for the full list)
.
.TP
-~/.mplayer/\:gui.conf
-GUI configuration file
-.
-.TP
-~/.mplayer/\:gui.pl
-GUI playlist
-.
-.TP
~/.mplayer/\:font/
font directory (There must be a font.desc file and files with .RAW extension.)
.
diff --git a/DOCS/man/fr/mplayer.1 b/DOCS/man/fr/mplayer.1
index ad7a42ac7b..6209931071 100644
--- a/DOCS/man/fr/mplayer.1
+++ b/DOCS/man/fr/mplayer.1
@@ -4644,8 +4644,6 @@ Ne gère que les formats RGB et BGR 24 bits/pixel.
.IPs z=<0\-9>
Définit le taux de compression.
0 équivaut à pas de compression et 9 à la compression maximale.
-.IPs outdir=<chemin>
-Définit le répertoire où sauver les fichiers PNG (par défaut\ ./).
.IPs alpha (par défaut\ : noalpha)
Crée un fichier PNG avec un canal alpha.
Notez que MPlayer ne gère en général pas les canaux alpha, donc cette
diff --git a/DOCS/tech/MAINTAINERS b/DOCS/tech/MAINTAINERS
index 7b7b1c710c..e2fcf01862 100644
--- a/DOCS/tech/MAINTAINERS
+++ b/DOCS/tech/MAINTAINERS
@@ -84,8 +84,6 @@ MPlayer code:
* playtree, input layer: Alban Bedel
* libswscale: Michael Niedermayer, Luca Abeni
* DVB support: Nico Sabbi
- * GUI: None
- * GUI skins: Diego Biurrun
* EDL code: Oded Shimon
Imported libs/projects:
diff --git a/DOCS/tech/binary-packaging.txt b/DOCS/tech/binary-packaging.txt
index 9d852372db..974a20d46f 100644
--- a/DOCS/tech/binary-packaging.txt
+++ b/DOCS/tech/binary-packaging.txt
@@ -66,9 +66,6 @@ the following features MUST be included in any official binary package:
(*) if available for your OS/hardware
-There is great demand for the GUI, so it SHOULD be included, but it MUST
-come as a separate package (see Tips and Tricks for details).
-
Including other features, like LIVE.COM streaming or JACK support, is
acceptable. They SHOULD, however, be build-time configurable, with the
default build configuration containing the above set.
@@ -111,7 +108,6 @@ for Red Hat and Fedora RPMs I am using FHS-compliant paths:
/usr/share/doc/mplayer-version/ docs
/usr/share/man/man1/ man page
/usr/share/man/XX/man1/ translated man page
-/usr/share/mplayer/skins/ GUI skins
You MUST NOT include the codecs.conf file in your package. It is useful
only for development purposes and often causes obscure problems for users.
@@ -129,13 +125,9 @@ install only what you need. This is the layout I am using for Red Hat and
Fedora RPMs:
mencoder contains MEncoder binary (mencoder)
-mplayer contains MPlayer binary without GUI (mplayer),
- config files, man pages and documentation;
- required by mplayer-gui
+mplayer contains MPlayer binary config files, man pages and
+ documentation;
mplayer-codecs-* contain binary codecs available from MPlayer's site
-mplayer-gui contains MPlayer binary with GUI (gmplayer);
- contains default skin (Blue)
-mplayer-skin-* contain various MPlayer GUI skins
There is no strict policy for now, just use your common sense.
@@ -200,14 +192,8 @@ ao=alsa,
Tips and tricks
~~~~~~~~~~~~~~~
-In my package layout, mplayer and mplayer-gui can be installed at the same
-time, because they contain differently named binaries and there is no
-conflict. The trick is to build MPlayer once with --enable-gui, rename the
-resulting binary to "gmplayer" and then build it again, without GUI, but
-keeping the rest of ./configure options the same.
-
-To provide man pages for all MPlayer suite binaries (mplayer, gmplayer,
-mencoder), you can use man-links instead of regular symbolic links.
+To provide man pages for all MPlayer suite binaries (mplayer, mencoder), you
+can use man-links instead of regular symbolic links.
Creating a mencoder man page linked to mplayer is as simple as:
echo ".so mplayer.1" >> mencoder.1
diff --git a/DOCS/tech/general.txt b/DOCS/tech/general.txt
index f4b7f0d713..631ee3f9de 100644
--- a/DOCS/tech/general.txt
+++ b/DOCS/tech/general.txt
@@ -226,4 +226,3 @@ Now, go on:
6.a audio plugins
for details on this, read libao2.txt
-
diff --git a/DOCS/tech/libmpcodecs.txt b/DOCS/tech/libmpcodecs.txt
index 22d29aaf98..5015f5dcc0 100644
--- a/DOCS/tech/libmpcodecs.txt
+++ b/DOCS/tech/libmpcodecs.txt
@@ -153,7 +153,7 @@ vf_info_t* info;
const char *name; // short name of the filter, must be FILTERNAME
const char *author; // name and email/URL of the author(s)
const char *comment; // comment, URL to papers describing algorithm etc.
- int (*open)(struct vf_instance_s* vf,char* args);
+ int (*open)(struct vf_instance* vf,char* args);
// pointer to the open() function:
Sample:
@@ -197,13 +197,13 @@ static int open(vf_instance_t *vf, char* args)
return 1;
}
-Functions in vf_instance_s:
+Functions in vf_instance:
NOTE: All these are optional, their function pointer is either NULL or points
to a default implementation. If you implement them, don't forget to set
vf->FUNCNAME in your open() !
- int (*query_format)(struct vf_instance_s* vf, unsigned int fmt);
+ int (*query_format)(struct vf_instance* vf, unsigned int fmt);
The query_format() function is called one or more times before the config(),
to find out the capabilities and/or support status of a given colorspace (fmt).
@@ -216,7 +216,7 @@ next filter will accept at least one of your possible output colorspaces!
Sample:
-static int query_format(struct vf_instance_s* vf, unsigned int fmt)
+static int query_format(struct vf_instance* vf, unsigned int fmt)
{
switch(fmt){
case IMGFMT_YV12:
@@ -232,7 +232,7 @@ For the more complex case, when you have an N -> M colorspace mapping matrix,
see vf_scale or vf_rgb2bgr for examples.
- int (*config)(struct vf_instance_s* vf,
+ int (*config)(struct vf_instance* vf,
int width, int height, int d_width, int d_height,
unsigned int flags, unsigned int outfmt);
@@ -257,7 +257,7 @@ Its parameters are already well-known from libvo:
Sample:
-static int config(struct vf_instance_s* vf,
+static int config(struct vf_instance* vf,
int width, int height, int d_width, int d_height,
unsigned int flags, unsigned int outfmt)
{
@@ -272,12 +272,12 @@ static int config(struct vf_instance_s* vf,
return vf_next_config(vf,vf->priv->w,vf->priv->h,d_width,d_height,flags,outfmt);
}
- void (*uninit)(struct vf_instance_s* vf);
+ void (*uninit)(struct vf_instance* vf);
Okay, uninit() is the simplest, it's called at the end. You can free your
private buffers etc here.
- int (*put_image)(struct vf_instance_s* vf, mp_image_t *mpi);
+ int (*put_image)(struct vf_instance* vf, mp_image_t *mpi);
Ah, put_image(). This is the main filter function, it should convert/filter/
transform the image data from one format/size/color/whatever to another.
@@ -332,7 +332,7 @@ image:
Ok, the rest is for advanced functionality only:
- int (*control)(struct vf_instance_s* vf, int request, void* data);
+ int (*control)(struct vf_instance* vf, int request, void* data);
You can control the filter at runtime from MPlayer/MEncoder/dec_video:
#define VFCTRL_QUERY_MAX_PP_LEVEL 4 /* test for postprocessing support (max level) */
@@ -343,7 +343,7 @@ You can control the filter at runtime from MPlayer/MEncoder/dec_video:
#define VFCTRL_CHANGE_RECTANGLE 9 /* Change the rectangle boundaries */
- void (*get_image)(struct vf_instance_s* vf, mp_image_t *mpi);
+ void (*get_image)(struct vf_instance* vf, mp_image_t *mpi);
This is for direct rendering support, works the same way as in libvo drivers.
It makes in-place pixel modifications possible.
@@ -359,7 +359,7 @@ order, while put_image is called for display) so the only safe place to save
it is in the mpi struct itself: mpi->priv=(void*)dmpi;
- void (*draw_slice)(struct vf_instance_s* vf, unsigned char** src,
+ void (*draw_slice)(struct vf_instance* vf, unsigned char** src,
int* stride, int w,int h, int x, int y);
It's the good old draw_slice callback, already known from libvo.
diff --git a/DOCS/tech/libvo.txt b/DOCS/tech/libvo.txt
index e80f80d2fb..945aeab952 100644
--- a/DOCS/tech/libvo.txt
+++ b/DOCS/tech/libvo.txt
@@ -171,4 +171,3 @@ Each vo driver _has_ to implement these:
real. This is 'swapbuffers' when doublebuffering.
Try to do as little work here as possible, since that affect jitter/
A-V sync.
-
diff --git a/DOCS/tech/realcodecs/TODO b/DOCS/tech/realcodecs/TODO
index 00f20f13ac..5ba035bfdd 100644
--- a/DOCS/tech/realcodecs/TODO
+++ b/DOCS/tech/realcodecs/TODO
@@ -20,5 +20,3 @@ TODO:
also statistics->streams->video->POST FILTER: ON
(i've found that custommessage calls differ wiht pp on/off, but adding
these calls to mplayer didn't make a pixel difference between outputs)
-
-
diff --git a/DOCS/tech/realcodecs/audio-codecs.txt b/DOCS/tech/realcodecs/audio-codecs.txt
index 6d79815ac0..8a0d958354 100644
--- a/DOCS/tech/realcodecs/audio-codecs.txt
+++ b/DOCS/tech/realcodecs/audio-codecs.txt
@@ -153,6 +153,3 @@ output_buffer points to the output buffer from the last
decode operation.
retval is unknown, returning always 0x18 in a specific sample
-> further investigation needed
-
-
-
diff --git a/DOCS/tech/realcodecs/video-codecs.txt b/DOCS/tech/realcodecs/video-codecs.txt
index 5ef9a51961..2bef957172 100644
--- a/DOCS/tech/realcodecs/video-codecs.txt
+++ b/DOCS/tech/realcodecs/video-codecs.txt
@@ -183,5 +183,3 @@ Transform (internally calls (0x1c,x,y))
]
Free
-
-
diff --git a/DOCS/tech/slave.txt b/DOCS/tech/slave.txt
index bab7605621..96badf539f 100644
--- a/DOCS/tech/slave.txt
+++ b/DOCS/tech/slave.txt
@@ -270,6 +270,10 @@ set_mouse_pos <x> <y>
set_property <property> <value>
Set a property.
+set_property_osd <property> <value>
+ Same as above, but show the new value on the OSD in the standard
+ manner defined for that property (if any).
+
speed_incr <value>
Add <value> to the current playback speed.
@@ -284,6 +288,10 @@ step_property <property> [value] [direction]
not given or zero. The direction is reversed if direction is less
than zero.
+step_property_osd <property> [value] [direction]
+ Same as above, but show the new value on the OSD in the standard
+ manner defined for that property (if any).
+
stop
Stop playback.
@@ -555,4 +563,3 @@ teletext_format int 0 3 X X X 0 - opaque,
3 - transp. inv.
teletext_half_page int 0 2 X X X 0 - off, 1 - top half,
2- bottom half
-
diff --git a/DOCS/tech/snow.txt b/DOCS/tech/snow.txt
index db1b558cb9..be531fcb5c 100644
--- a/DOCS/tech/snow.txt
+++ b/DOCS/tech/snow.txt
@@ -87,4 +87,3 @@ vcodec=snow:vstrict=-2:vpass=2:vbitrate=$B:pred=0:cmp=12:subcmp=12:mbcmp=1:qpel:
Decent, fast options are
vcodec=snow:vstrict=-2:vpass=1:vbitrate=$B:pred=0:cmp=1:subcmp=1:mbcmp=1
vcodec=snow:vstrict=-2:vpass=2:vbitrate=$B:pred=0:cmp=2:subcmp=2:mbcmp=1:refs=2
-
diff --git a/DOCS/tech/subcp.txt b/DOCS/tech/subcp.txt
index df96f31e80..60c370771c 100644
--- a/DOCS/tech/subcp.txt
+++ b/DOCS/tech/subcp.txt
@@ -40,5 +40,3 @@ I tested charmap2enc script only with /usr/share/i18n/charmaps/EUC-KR.gz
--
Artur Zaprzala
-
-
diff --git a/DOCS/tech/swscaler_methods.txt b/DOCS/tech/swscaler_methods.txt
index e37227b982..b2c7077652 100644
--- a/DOCS/tech/swscaler_methods.txt
+++ b/DOCS/tech/swscaler_methods.txt
@@ -66,4 +66,3 @@ m mosaic (blocky) (upscale only)
Notes:
area upscale is identical to bilinear
-
diff --git a/DOCS/xml/en/documentation.xml b/DOCS/xml/en/documentation.xml
index c13e67890e..00afd76f06 100644
--- a/DOCS/xml/en/documentation.xml
+++ b/DOCS/xml/en/documentation.xml
@@ -176,4 +176,3 @@ can be distributed under the terms of the GNU General Public License Version 2.
&encoding-guide.xml;
&faq.xml;
&bugreports.xml;
-&skin.xml;
diff --git a/DOCS/xml/en/faq.xml b/DOCS/xml/en/faq.xml
index 83989dbf3a..9234ad7334 100644
--- a/DOCS/xml/en/faq.xml
+++ b/DOCS/xml/en/faq.xml
@@ -644,11 +644,7 @@ your configuration file. Add
<programlisting>
vo = <replaceable>selected_vo</replaceable>
</programlisting>
-to <filename>~/.mplayer/config</filename> and/or
-<programlisting>
-vo_driver = <replaceable>selected_vo</replaceable>
-</programlisting>
-to <filename>~/.mplayer/gui.conf</filename>.
+to <filename>~/.mplayer/config</filename>
</para></answer>
</qandaentry>
diff --git a/DOCS/xml/en/install.xml b/DOCS/xml/en/install.xml
index 21de5406bf..dd03e00377 100644
--- a/DOCS/xml/en/install.xml
+++ b/DOCS/xml/en/install.xml
@@ -106,10 +106,6 @@ answers.
<itemizedlist>
<listitem><para>
- Decide if you need GUI. If you do, see the <link linkend="gui">GUI</link>
- section before compiling.
-</para></listitem>
-<listitem><para>
If you want to install <application>MEncoder</application> (our great
all-purpose encoder), see the
<link linkend="mencoder"><application>MEncoder</application></link> section.
@@ -184,27 +180,10 @@ See the <link linkend="subosd">Subtitles and OSD</link> section for details.
<title>What about the GUI?</title>
<para>
-The GUI needs GTK 1.2.x or GTK 2.0 (it isn't fully GTK, but the panels are),
-so <systemitem class="library">GTK</systemitem> (and the devel stuff, usually
-called <systemitem class="library">gtk-dev</systemitem>) has to be installed.
-You can build it by specifying <option>--enable-gui</option> during
-<filename>./configure</filename>. Then, to turn on GUI mode, you have to
-execute the <command>gmplayer</command> binary.
-</para>
-
-<para>
-As <application>MPlayer</application> doesn't have a skin included, you
-have to download one if you want to use the GUI. See the <ulink
-url="http://www.mplayerhq.hu/dload.html">download page</ulink>.
-It should be extracted to the usual system-wide directory (<filename
-class="directory">$PREFIX/share/mplayer/skins</filename>), or to <filename
-class="directory">$HOME/.mplayer/skins</filename>.
-<application>MPlayer</application> by default looks in these directories
-for a directory named <filename class="directory">default</filename>, but
-you can use the <option>-skin <replaceable>newskin</replaceable></option>
-option, or the <literal>skin=newskin</literal> config file directive to use
-the skin in the <filename class="directory">*/skins/newskin</filename>
-directory.
+MPlayer used to have an internal GUI, but it was removed because it was
+buggy, unmaintained and there are much better alternatives. See <ulink
+url="http://www.mplayerhq.hu/design7/projects.html#mplayer_frontends">the
+frontends page</ulink> for a list of existing GUIs.
</para>
</sect1>
diff --git a/DOCS/xml/en/skin.xml b/DOCS/xml/en/skin.xml
deleted file mode 100644
index 38feef6782..0000000000
--- a/DOCS/xml/en/skin.xml
+++ /dev/null
@@ -1,1200 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- $Revision$ -->
-<appendix id="skin">
-<title><application>MPlayer</application> skin format</title>
-
-<sect1 id="skin-overview">
-<title>Overview</title>
-
-<!-- ********** -->
-
-<sect2 id="skin-overview-components">
-<title>Skin components</title>
-
-<para>
-Skins are quite free-format (unlike the fixed-format skins of
-<application>Winamp</application>/<application>XMMS</application>,
-for example), so it is up to you to create something great.
-</para>
-
-<para>
-Currently there are four windows to be decorated: the
-<link linkend="skin-file-main">main window</link>, the
-<link linkend="skin-file-subwindow">subwindow</link>, the
-<link linkend="skin-file-main">playbar</link>, and the
-<link linkend="skin-file-menu">skin menu</link> (which can be activated
-by a right click).
-
-<itemizedlist>
-<listitem>
- <para>
- The <emphasis role="bold">main window</emphasis> and/or the
- <emphasis role="bold">playbar</emphasis> is where you can control
- <application>MPlayer</application>. The background of the window is an image.
- Various items can (and must) be placed in the window:
- <emphasis>buttons</emphasis>, <emphasis>potmeters</emphasis> (sliders) and
- <emphasis>labels</emphasis>.
- For every item, you must specify its position and size.
- </para>
-
- <para>
- A <emphasis role="bold">button</emphasis> has three states (pressed, released,
- disabled), thus its image must be divided into three parts vertically. See the
- <link linkend="skin-button">button</link> item for details.
- </para>
-
- <para>
- A <emphasis role="bold">potmeter</emphasis> (mainly used for the seek bar and
- volume/balance control) can have any number of phases by dividing its image
- into different parts below each other. See
- <link linkend="skin-hpotmeter">hpotmeter</link> and
- <link linkend="skin-potmeter">potmeter</link> for details.
- </para>
-
- <para>
- <emphasis role="bold">Labels</emphasis> are a bit special: The characters
- needed to draw them are taken from an image file, and the characters in the
- image are described by a
- <link linkend="skin-fonts">font description file</link>.
- The latter is a plain text file which specifies the x,y position and size of
- each character in the image (the image file and its font description file
- form a font <emphasis>together</emphasis>).
- See <link linkend="skin-dlabel">dlabel</link>
- and <link linkend="skin-slabel">slabel</link> for details.
- </para>
-
- <note><para>
- All images can have full transparency as described in the section about
- <link linkend="skin-overview-formats">image formats</link>. If the X server
- doesn't support the XShape extension, the parts marked transparent will be
- black. If you'd like to use this feature, the width of the main window's
- background image must be dividable by 8.
- </para></note>
-</listitem>
-
-<listitem><para>
- The <emphasis role="bold">subwindow</emphasis> is where the movie appears. It
- can display a specified image if there is no movie loaded (it is quite boring
- to have an empty window :-)) <emphasis role="bold">Note:</emphasis>
- transparency is <emphasis role="bold">not allowed</emphasis> here.
-</para></listitem>
-
-<listitem>
- <para>
- The <emphasis role="bold">skin menu</emphasis> is just a way to control
- <application>MPlayer</application> by means of menu entries. Two images
- are required for the menu: one of them is the base image that shows the
- menu in its normal state, the other one is used to display the selected
- entries. When you pop up the menu, the first image is shown. If you move
- the mouse over the menu entries, the currently selected entry is copied
- from the second image over the menu entry below the mouse pointer
- (the second image is never shown as a whole).
- </para>
- <para>
- A menu entry is defined by its position and size in the image (see the
- section about the <link linkend="skin-file-menu">skin menu</link> for
- details).
- </para>
-</listitem>
-</itemizedlist>
-</para>
-
-<para>
-There is an important thing not mentioned yet: For buttons, potmeters and
-menu entries to work, <application>MPlayer</application> must know what to
-do if they are clicked. This is done by <link linkend="skin-gui">messages</link>
-(events). For these items you must define the messages to be generated when
-they are clicked.
-</para>
-</sect2>
-
-<sect2 id="skin-overview-formats">
-<title>Image formats</title>
-
-<para>Images must be truecolor (24 or 32 bpp) PNGs.</para>
-<para>
-In the main window and in the playbar (see below) you can use images with
-`transparency': Regions filled with the color #FF00FF (magenta) are fully
-transparent when viewed by <application>MPlayer</application>. This means
-that you can even have shaped windows if your X server has the XShape extension.
-</para>
-</sect2>
-
-<!-- ********** -->
-
-<sect2 id="skin-files">
-<title>Files</title>
-
-<para>
-You need the following files to build a skin:
-<itemizedlist>
-<listitem><para>
- The configuration file named <link linkend="skin-file">skin</link> tells
- <application>MPlayer</application> how to put different parts of the skin
- together and what to do if you click somewhere in the window.
-</para></listitem>
-<listitem><para>
- The background image for the main window.
-</para></listitem>
-<listitem><para>
- Images for the items in the main window (including one or more font
- description files needed to draw labels).
-</para></listitem>
-<listitem><para>
- The image to be displayed in the subwindow (optional).
-</para></listitem>
-<listitem><para>
- Two images for the skin menu (they are needed only if you want to create
- a menu).
-</para></listitem>
-</itemizedlist>
- With the exception of the skin configuration file, you can name the other
- files whatever you want (but note that font description files must have
- a <filename>.fnt</filename> extension).
-</para>
-</sect2>
-</sect1>
-
-
-<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
-
-
-<sect1 id="skin-file">
-<title>The skin file</title>
-
-<para>
-As mentioned above, this is the skin configuration file. It is line oriented;
-comment lines start with a '<literal>;</literal>' character at the beginning of
-the line (only spaces and tabs are allowed before the '<literal>;</literal>').
-</para>
-
-<para>
-The file is made up of sections. Each section describes the skin for an
-application and has the following form:
-<programlisting>
-section = <replaceable>section name</replaceable>
-.
-.
-.
-end
-</programlisting>
-</para>
-
-<para>
-Currently there is only one application, so you need only one section: its name
-is <emphasis role="bold">movieplayer</emphasis>.
-</para>
-
-<para>
-Within this section each window is described by a block of the following form:
-<programlisting>
-window = <replaceable>window name</replaceable>
-.
-.
-.
-end
-</programlisting>
-</para>
-
-<para>
-where <replaceable>window name</replaceable> can be one of these strings:
-<itemizedlist>
-<listitem><para>
- <emphasis role="bold">main</emphasis> - for the main window
-</para></listitem>
-<listitem><para>
- <emphasis role="bold">sub</emphasis> - for the subwindow
-</para></listitem>
-<listitem><para>
- <emphasis role="bold">menu</emphasis> - for the skin menu
-</para></listitem>
-<listitem><para>
- <emphasis role="bold">playbar</emphasis> - playbar
-</para></listitem>
-</itemizedlist>
-</para>
-
-<para>
-(The sub and menu blocks are optional - you do not need to create a menu or
-decorate the subwindow.)
-</para>
-
-<para>
-Within a window block, you can define each item for the window by a line in
-this form:
-<programlisting>item = parameter</programlisting>
-Where <literal>item</literal> is a string that identifies the type of the GUI
-item, <literal>parameter</literal> is a numeric or textual value (or a list of
-values separated by commas).
-</para>
-
-<para>
-Putting the above together, the whole file looks something like this:
-<programlisting>
-section = movieplayer
- window = main
- ; ... items for main window ...
- end
-
- window = sub
- ; ... items for subwindow ...
- end
-
- window = menu
- ; ... items for menu ...
- end
-
- window = playbar
- ; ... items for playbar ...
- end
-end
-</programlisting>
-</para>
-
-<para>
-The name of an image file must be given without leading directories - images
-are searched for in the <filename class="directory">skins</filename> directory.
-You may (but you need not) specify the extension of the file. If the file does
-not exist, <application>MPlayer</application> tries to load the file
-<filename>&lt;filename&gt;.&lt;ext&gt;</filename>, where <literal>png</literal>
-and <literal>PNG</literal> are tried for <filename>&lt;ext&gt;</filename>
-(in this order). The first matching file will be used.
-</para>
-
-<para>
-Here is an example to make this clear. Suppose that you have an image called
-<filename>main.png</filename> that you use for the main window:
-<programlisting>base = main, -1, -1</programlisting>
-<application>MPlayer</application> tries to load <filename>main</filename>,
-<filename>main.png</filename>, <filename>main.PNG</filename> files.
-</para>
-
-<para>
-Finally some words about positioning. The main window and the subwindow can be
-placed in the different corners of the screen by giving <literal>X</literal>
-and <literal>Y</literal> coordinates. <literal>0</literal> is top or left,
-<literal>-1</literal> is center and <literal>-2</literal> is right or bottom, as
-shown in this illustration:
-<informalfigure>
-<screen>
-(0, 0)----(-1, 0)----(-2, 0)
- | | |
- | | |
-(0,-1)----(-1,-1)----(-2,-1)
- | | |
- | | |
-(0,-2)----(-1,-2)----(-2,-2)
-</screen>
-</informalfigure>
-</para>
-
-<!-- ********** -->
-
-<sect2 id="skin-file-main">
-<title>Main window and playbar</title>
-
-<para>
-Below is the list of entries that can be used in the
-'<literal>window = main</literal>' ... '<literal>end</literal>',
-and the '<literal>window = playbar</literal>' ... '<literal>end</literal>'
-blocks.
-</para>
-
-<variablelist>
-<varlistentry>
- <term><literal>
- <anchor id="skin-main-base"/>base = image, X, Y
- </literal></term>
- <listitem>
- <para>
- Lets you specify the background image to be used for the main window.
- The window will appear at the given <literal>X,Y</literal> position on
- the screen The window will have the size of the image.
- </para>
- <note><para>
- These coordinates do not currently work for the display window.
- </para></note>
- <warning><para>Transparent regions in the image (colored #FF00FF) appear black
- on X servers without the XShape extension. The image's width must be dividable
- by 8.</para></warning>
- </listitem>
-</varlistentry>
-
-<varlistentry>
- <term><literal>
- <anchor id="skin-button"/>button = image, X, Y, width, height, message
- </literal></term>
- <listitem>
- <para>
- Place a button of <literal>width</literal> * <literal>height</literal> size at
- position <literal>X,Y</literal>. The specified <literal>message</literal> is
- generated when the button is clicked. The image given by
- <literal>image</literal> must have three parts below each other (according to
- the possible states of the button), like this:
- </para>
- <informalfigure>
- <screen>
-+------------+
-| pressed |
-+------------+
-| released |
-+------------+
-| disabled |
-+------------+<!--
- --></screen>
- </informalfigure>
- </listitem>
-</varlistentry>
-
-<varlistentry>
- <term><literal>
- <anchor id="skin-decoration"/>decoration = enable|disable
- </literal></term>
- <listitem>
- <para>
- Enable or disable window manager decoration of the main window. Default is
- <emphasis role="bold">disable</emphasis>.
- </para>
- <note><para>
- This doesn't work for the display window, there is no need to.
- </para></note>
- </listitem>
-</varlistentry>
-
-<varlistentry>
- <term><literal>
- <anchor id="skin-hpotmeter"/>hpotmeter = button, bwidth, bheight, phases, numphases, default, X, Y, width, height, message
- </literal></term>
- <listitem><para>
- </para></listitem>
-</varlistentry>
-
-<varlistentry>
- <term><literal>
- <anchor id="skin-vpotmeter"/>vpotmeter = button, bwidth, bheight, phases, numphases, default, X, Y, width, height, message
- </literal></term>
- <listitem><para>
- Place a horizontal (hpotmeter) or vertical (vpotmeter) potmeter of
- <literal>width</literal> * <literal>height</literal> size at position
- <literal>X,Y</literal>. The image can be divided into different parts for the
- different phases of the potmeter (for example, you can have a pot for volume
- control that turns from green to red while its value changes from the minimum
- to the maximum.). <literal>hpotmeter</literal> can have a button that can be
- dragged horizontally. The parameters are:
- <itemizedlist>
- <listitem><para>
- <literal>button</literal> - the image to be used for the
- button (must have three parts below each other, like in case of
- <link linkend="skin-button">button</link>)
- </para></listitem>
- <listitem><para>
- <literal>bwidth</literal>, <literal>bheight</literal> - size
- of the button
- </para></listitem>
- <listitem><para>
- <literal>phases</literal> - the image to be used for the
- different phases of the hpotmeter. A special value of <literal>NULL</literal>
- can be used if you want no such image. The image must be divided into
- <literal>numphases</literal> parts vertically like this:
- <informalfigure><screen>
-+------------+
-| phase #1 |
-+------------+
-| phase #2 |
-+------------+
- ...
-+------------+
-| phase #n |
-+------------+<!--
- --></screen></informalfigure>
- </para></listitem>
- <listitem><para>
- <literal>numphases</literal> - number of phases stored in the
- <literal>phases</literal> image
- </para></listitem>
- <listitem><para>
- <literal>default</literal> - default value for hpotmeter
- (in the range <literal>0</literal> to <literal>100</literal>)
- </para></listitem>
- <listitem><para>
- <literal>X</literal>, <literal>Y</literal> - position for the hpotmeter
- </para></listitem>
- <listitem><para>
- <literal>width</literal>, <literal>height</literal> - width and height
- of the <literal>hpotmeter</literal>
- </para></listitem>
- <listitem><para>
- <literal>message</literal> - the message to be generated when the
- value of <literal>hpotmeter</literal> is changed
- </para></listitem>
- </itemizedlist>
- </para></listitem>
-</varlistentry>
-
-<varlistentry>
- <term><literal>
- <anchor id="skin-potmeter"/>potmeter = phases, numphases, default, X, Y, width, height, message
- </literal></term>
- <listitem><para>
- A <literal>hpotmeter</literal> without a button. (I guess it is meant to be
- turned around, but it reacts to horizontal dragging only.) For the description
- of the parameters see <link linkend="skin-hpotmeter">hpotmeter</link>.
- <literal>phases</literal> can be <literal>NULL</literal>, but it is quite
- useless, since you cannot see where the <literal>potmeter</literal> is set.
- </para></listitem>
-</varlistentry>
-
-<varlistentry>
- <term><literal>
- <anchor id="skin-font"/>font = fontfile, fontid
- </literal></term>
- <listitem><para>
- Defines a font. <literal>fontfile</literal> is the name of a font description
- file with a <filename>.fnt</filename> extension (do not specify the extension
- here). <literal>fontid</literal> is used to refer to the font
- (see <link linkend="skin-dlabel">dlabel</link>
- and <link linkend="skin-slabel">slabel</link>). Up to 25 fonts can be defined.
- </para></listitem>
-</varlistentry>
-
-<varlistentry>
- <term><literal>
- <anchor id="skin-slabel"/>slabel = X, Y, fontid, "text"
- </literal></term>
- <listitem><para>
- Place a static label at the position <literal>X,Y</literal>.
- <literal>text</literal> is displayed using the font identified by
- <literal>fontid</literal>. The text is just a raw string
- (<literal>$x</literal> variables do not work) that must be enclosed between
- double quotes (but the " character cannot be part of the text). The
- label is displayed using the font identified by <literal>fontid</literal>.
- </para></listitem>
-</varlistentry>
-
-<varlistentry>
- <term><literal>
- <anchor id="skin-dlabel"/>dlabel = X, Y, length, align, fontid, "text"
- </literal></term>
- <listitem>
- <para>
- Place a dynamic label at the position <literal>X,Y</literal>. The label is
- called dynamic because its text is refreshed periodically. The maximum length
- of the label is given by <literal>length</literal> (its height is the height
- of a character). If the text to be displayed is wider than that, it will be
- scrolled,
- otherwise it is aligned within the specified space by the value of the
- <literal>align</literal> parameter: <literal>0</literal> is for right,
- <literal>1</literal> is for center, <literal>2</literal> is for left.
- </para>
- <para>
- The text to be displayed is given by <literal>text</literal>: It must be
- written between double quotes (but the " character cannot be part of the
- text). The label is displayed using the font identified by
- <literal>fontid</literal>. You can use the following variables in the text:
- </para>
-
- <informaltable>
- <tgroup cols="2">
- <thead>
- <row><entry>Variable</entry><entry>Meaning</entry></row>
- </thead>
- <tbody>
- <row>
- <entry>$1</entry>
- <entry>play time in <emphasis>hh:mm:ss</emphasis> format</entry>
- </row>
- <row>
- <entry>$2</entry>
- <entry>play time in <emphasis>mmmm:ss</emphasis> format</entry>
- </row>
- <row>
- <entry>$3</entry>
- <entry>play time in <emphasis>hh</emphasis> format (hours)</entry>
- </row>
- <row>
- <entry>$4</entry>
- <entry>play time in <emphasis>mm</emphasis> format (minutes)</entry>
- </row>
- <row>
- <entry>$5</entry>
- <entry>play time in <emphasis>ss</emphasis> format (seconds)</entry>
- </row>
- <row>
- <entry>$6</entry>
- <entry>movie length in <emphasis>hh:mm:ss</emphasis> format</entry>
- </row>
- <row>
- <entry>$7</entry>
- <entry>movie length in <emphasis>mmmm:ss</emphasis> format</entry>
- </row>
- <row>
- <entry>$8</entry>
- <entry>play time in <emphasis>h:mm:ss</emphasis> format</entry>
- </row>
- <row>
- <entry>$v</entry>
- <entry>volume in <emphasis>xxx.xx</emphasis>% format</entry>
- </row>
- <row>
- <entry>$V</entry>
- <entry>volume in <emphasis>xxx.xx</emphasis> format</entry>
- </row>
- <row>
- <entry>$b</entry>
- <entry>balance in <emphasis>xxx.xx</emphasis>% format</entry>
- </row>
- <row>
- <entry>$B</entry>
- <entry>balance in <emphasis>xxx.xx</emphasis> format</entry>
- </row>
- <row>
- <entry>$$</entry>
- <entry>the $ character</entry>
- </row>
- <row>
- <entry>$a</entry>
- <entry>a character according to the audio type (none: <literal>n</literal>,
- mono: <literal>m</literal>, stereo: <literal>t</literal>)</entry>
- </row>
- <row>
- <entry>$t</entry>
- <entry>track number (in playlist)</entry>
- </row>
- <row>
- <entry>$o</entry>
- <entry>filename</entry>
- </row>
- <row>
- <entry>$f</entry>
- <entry>filename in lower case</entry>
- </row>
- <row>
- <entry>$F</entry>
- <entry>filename in upper case</entry>
- </row>
- <row>
- <entry>$T</entry>
- <entry>
- a character according to the stream type (file: <literal>f</literal>,
- Video CD: <literal>v</literal>, DVD: <literal>d</literal>,
- URL: <literal>u</literal>)
- </entry>
- </row>
- <row>
- <entry>$p</entry>
- <entry>the <keycap>p</keycap> character (if a movie is playing and the font
- has the <keycap>p</keycap> character)</entry>
- </row>
- <row>
- <entry>$s</entry>
- <entry>the <keycap>s</keycap> character (if the movie is stopped and the
- font has the <keycap>s</keycap> character)</entry>
- </row>
- <row>
- <entry>$e</entry>
- <entry>the <keycap>e</keycap> character (if playback is paused and the font
- has the <keycap>e</keycap> character)</entry>
- </row>
- <row>
- <entry>$x</entry>
- <entry>movie width</entry>
- </row>
- <row>
- <entry>$y</entry>
- <entry>movie height</entry>
- </row>
- <row>
- <entry>$C</entry>
- <entry>name of the codec used</entry>
- </row>
- </tbody>
- </tgroup>
- </informaltable>
-
- <note><para>
- The <literal>$a, $T, $p, $s</literal> and <literal>$e</literal>
- variables all return characters that should be displayed as special symbols
- (for example, <keycap>e</keycap> is for the pause symbol that usually looks
- something like ||). You should have a font for normal characters and
- a different font for symbols. See the section about
- <link linkend="skin-fonts-symbols">symbols</link> for more information.
- </para></note>
- </listitem>
-</varlistentry>
-</variablelist>
-</sect2>
-
-<!-- ********** -->
-
-<sect2 id="skin-file-subwindow">
-<title>Subwindow</title>
-
-<para>
-The following entries can be used in the
-'<literal>window = sub</literal>' . . . '<literal>end</literal>' block.
-</para>
-
-<variablelist>
-<varlistentry>
- <term><literal>
- <anchor id="skin-sub-base"/>base = image, X, Y, width, height
- </literal></term>
- <listitem><para>
- The image to be displayed in the window. The window will appear at the given
- <literal>X,Y</literal> position on the screen (<literal>0,0</literal> is the
- top left corner). You can specify <literal>-1</literal> for center and
- <literal>-2</literal> for right (<literal>X</literal>) and bottom
- (<literal>Y</literal>). The window will be as large as the image.
- <literal>width</literal> and <literal>height</literal>
- denote the size of the window; they are optional (if they are missing, the
- window is the same size as the image).
- </para></listitem>
-</varlistentry>
-
-<varlistentry>
- <term><literal>
- <anchor id="skin-background"/>background = R, G, B
- </literal></term>
- <listitem><para>
- Lets you set the background color. It is useful if the image is smaller than
- the window. <literal>R</literal>, <literal>G</literal> and
- <literal>B</literal> specifies the red, green and blue component of the color
- (each of them is a decimal number from 0 to 255).
- </para></listitem>
-</varlistentry>
-</variablelist>
-</sect2>
-
-<!-- ********** -->
-
-<sect2 id="skin-file-menu">
-<title>Skin menu</title>
-
-<para>
-As mentioned earlier, the menu is displayed using two images. Normal menu
-entries are taken from the image specified by the <literal>base</literal> item,
-while the currently selected entry is taken from the image specified by the
-<literal>selected</literal> item. You must define the position and size of each
-menu entry through the menu item.
-</para>
-
-<para>
-The following entries can be used in the
-'<literal>window = menu</literal>'. . .'<literal>end</literal>' block.
-</para>
-
-<variablelist>
-<varlistentry>
- <term><literal>
- <anchor id="skin-menu-base"/>base = image
- </literal></term>
- <listitem><para>
- The image for normal menu entries.
- </para></listitem>
-</varlistentry>
-
-<varlistentry>
- <term><literal>
- <anchor id="skin-selected"/>selected = image
- </literal></term>
- <listitem><para>
- The image showing the menu with all entries selected.
- </para></listitem>
-</varlistentry>
-
-<varlistentry>
- <term><literal>
- <anchor id="skin-menu"/>menu = X, Y, width, height, message
- </literal></term>
- <listitem><para>
- Defines the <literal>X,Y</literal> position and the size of a menu entry in
- the image. <literal>message</literal> is the message to be generated when the
- mouse button is released over the entry.
- </para></listitem>
-</varlistentry>
-</variablelist>
-</sect2>
-</sect1>
-
-
-<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
-
-
-<sect1 id="skin-fonts">
-<title>Fonts</title>
-<para>
-As mentioned in the section about the parts of a skin, a font is defined by an
-image and a description file. You can place the characters anywhere in the
-image, but make sure that their position and size is given in the description
-file exactly.
-</para>
-
-<para>
-The font description file (with <filename>.fnt</filename> extension) can have
-comment lines starting with '<literal>;</literal>'. The file must have a line
-in the form
-<anchor id="skin-font-image"/>
-<programlisting>image = <replaceable>image</replaceable></programlisting>
-Where <literal><replaceable>image</replaceable></literal> is the name of the
-image file to be used for the font (you do not have to specify the extension).
-<anchor id="skin-font-char"/>
-<programlisting>"char" = X, Y, width, height</programlisting>
-Here <literal>X</literal> and <literal>Y</literal> specify the position of the
-<literal>char</literal> character in the image (<literal>0,0</literal> is the
-upper left corner). <literal>width</literal> and <literal>height</literal> are
-the dimensions of the character in pixels.
-</para>
-
-<para>
-This example defines the A, B, C characters using <filename>font.png</filename>.
-<programlisting>
-; Can be "font" instead of "font.png".
-image = font.png
-
-; Three characters are enough for demonstration purposes :-)
-"A" = 0,0, 7,13
-"B" = 7,0, 7,13
-"C" = 14,0, 7,13
-</programlisting>
-</para>
-
-<!-- ********** -->
-
-<sect2 id="skin-fonts-symbols">
-<title>Symbols</title>
-
-<para>
-Some characters have special meanings when returned by some of the variables
-used in <link linkend="skin-dlabel">dlabel</link>. These characters are meant
-to be shown as symbols so that things like a nice DVD logo can be displayed
-instead of the character '<literal>d</literal>' for a DVD stream.
-</para>
-
-<para>
-The following table lists all the characters that can be used to display
-symbols (and thus require a different font).
-</para>
-
-<informaltable>
-<tgroup cols="2">
-<thead>
- <row><entry>Character</entry><entry>Symbol</entry></row>
-</thead>
-<tbody>
- <row><entry><keycap>p</keycap></entry><entry>play</entry></row>
- <row><entry><keycap>s</keycap></entry><entry>stop</entry></row>
- <row><entry><keycap>e</keycap></entry><entry>pause</entry></row>
- <row><entry><keycap>n</keycap></entry><entry>no sound</entry></row>
- <row><entry><keycap>m</keycap></entry><entry>mono sound</entry></row>
- <row><entry><keycap>t</keycap></entry><entry>stereo sound</entry></row>
- <row><entry><keycap>f</keycap></entry><entry>stream is a file</entry></row>
- <row><entry><keycap>v</keycap></entry><entry>stream is a Video CD</entry></row>
- <row><entry><keycap>d</keycap></entry><entry>stream is a DVD</entry></row>
- <row><entry><keycap>u</keycap></entry><entry>stream is a URL</entry></row>
-</tbody>
-</tgroup>
-</informaltable>
-</sect2>
-</sect1>
-
-
-<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
-
-
-<sect1 id="skin-gui">
-<title>GUI messages</title>
-
-<para>
-These are the messages that can be generated by buttons, potmeters and
-menu entries.
-</para>
-
-<variablelist>
-<title>Playback control:</title>
-<varlistentry>
- <term><emphasis role="bold">evNext</emphasis></term>
- <listitem><para>
- Jump to next track in the playlist.
- </para></listitem>
-</varlistentry>
-
-<varlistentry>
- <term><emphasis role="bold">evPause</emphasis></term>
- <listitem><para>
- Forms a switch together with <literal>evPlaySwitchToPause</literal>. They can
- be used to have a common play/pause button. Both messages should be assigned
- to buttons displayed at the very same position in the window. This message
- pauses playing and the image for the <literal>evPlaySwitchToPause</literal>
- button is displayed (to indicate that the button can be pressed to continue
- playing).
- </para></listitem>
-</varlistentry>
-
-<varlistentry>
- <term><emphasis role="bold">evPlay</emphasis></term>
- <listitem><para>
- Start playing.
- </para></listitem>
-</varlistentry>
-
-<varlistentry>
- <term><emphasis role="bold">evPlaySwitchToPause</emphasis></term>
- <listitem><para>
- The opposite of <literal>evPauseSwitchToPlay</literal>. This message starts
- playing and the image for the <literal>evPauseSwitchToPlay</literal> button
- is displayed (to indicate that the button can be pressed to pause playing).
- </para></listitem>
-</varlistentry>
-
-<varlistentry>
- <term><emphasis role="bold">evPrev</emphasis></term>
- <listitem><para>
- Jump to previous track in the playlist.
- </para></listitem>
-</varlistentry>
-
-<varlistentry>
- <term><emphasis role="bold">evStop</emphasis></term>
- <listitem><para>
- Stop playing.
- </para></listitem>
-</varlistentry>
-</variablelist>
-
-<variablelist>
-<title>Seeking:</title>
-<varlistentry>
- <term><emphasis role="bold">evBackward10sec</emphasis></term>
- <listitem><para>
- Seek backward 10 seconds.
- </para></listitem>
-</varlistentry>
-
-<varlistentry>
- <term><emphasis role="bold">evBackward1min</emphasis></term>
- <listitem><para>
- Seek backward 1 minute.
- </para></listitem>
-</varlistentry>
-
-<varlistentry>
- <term><emphasis role="bold">evBackward10min</emphasis></term>
- <listitem><para>
- Seek backward 10 minutes.
- </para></listitem>
-</varlistentry>
-
-<varlistentry>
- <term><emphasis role="bold">evForward10sec</emphasis></term>
- <listitem><para>
- Seek forward 10 seconds.
- </para></listitem>
-</varlistentry>
-
-<varlistentry>
- <term><emphasis role="bold">evForward1min</emphasis></term>
- <listitem><para>
- Seek forward 1 minute.
- </para></listitem>
-</varlistentry>
-
-<varlistentry>
- <term><emphasis role="bold">evForward10min</emphasis></term>
- <listitem><para>
- Seek forward 10 minutes.
- </para></listitem>
-</varlistentry>
-
-<varlistentry>
- <term><emphasis role="bold">evSetMoviePosition</emphasis></term>
- <listitem><para>
- Seek to position (can be used by a potmeter; the
- relative value (0-100%) of the potmeter is used).
- </para></listitem>
-</varlistentry>
-</variablelist>
-
-<variablelist>
-<title>Video control:</title>
-<varlistentry>
- <term><emphasis role="bold">evHalfSize</emphasis></term>
- <listitem><para>
- Set the movie window to half size.
- </para></listitem>
-</varlistentry>
-<varlistentry>
- <term><emphasis role="bold">evDoubleSize</emphasis></term>
- <listitem><para>
- Set the movie window to double size.
- </para></listitem>
-</varlistentry>
-<varlistentry>
- <term><emphasis role="bold">evFullScreen</emphasis></term>
- <listitem><para>
- Switch fullscreen mode on/off.
- </para></listitem>
-</varlistentry>
-<varlistentry>
- <term><emphasis role="bold">evNormalSize</emphasis></term>
- <listitem><para>
- Set the movie window to its normal size.
- </para></listitem>
-</varlistentry>
-</variablelist>
-
-<variablelist>
-<title>Audio control:</title>
-<varlistentry>
- <term><emphasis role="bold">evDecAudioBufDelay</emphasis></term>
- <listitem><para>
- Decrease audio buffer delay.
- </para></listitem>
-</varlistentry>
-
-<varlistentry>
- <term><emphasis role="bold">evDecBalance</emphasis></term>
- <listitem><para>
- Decrease balance.
- </para></listitem>
-</varlistentry>
-
-<varlistentry>
- <term><emphasis role="bold">evDecVolume</emphasis></term>
- <listitem><para>
- Decrease volume.
- </para></listitem>
-</varlistentry>
-
-<varlistentry>
- <term><emphasis role="bold">evIncAudioBufDelay</emphasis></term>
- <listitem><para>
- Increase audio buffer delay.
- </para></listitem>
-</varlistentry>
-
-<varlistentry>
- <term><emphasis role="bold">evIncBalance</emphasis></term>
- <listitem><para>
- Increase balance.
- </para></listitem>
-</varlistentry>
-
-<varlistentry>
- <term><emphasis role="bold">evIncVolume</emphasis></term>
- <listitem><para>
- Increase volume.
- </para></listitem>
-</varlistentry>
-
-<varlistentry>
- <term><emphasis role="bold">evMute</emphasis></term>
- <listitem><para>
- Mute/unmute the sound.
- </para></listitem>
-</varlistentry>
-
-<varlistentry>
- <term><emphasis role="bold">evSetBalance</emphasis></term>
- <listitem><para>
- Set balance (can be used by a potmeter; the
- relative value (0-100%) of the potmeter is used).
- </para></listitem>
-</varlistentry>
-
-<varlistentry>
- <term><emphasis role="bold">evSetVolume</emphasis></term>
- <listitem><para>
- Set volume (can be used by a potmeter; the relative
- value (0-100%) of the potmeter is used).
- </para></listitem>
-</varlistentry>
-</variablelist>
-
-<variablelist>
-<title>Miscellaneous:</title>
-<varlistentry>
- <term><emphasis role="bold">evAbout</emphasis></term>
- <listitem><para>
- Open the about window.
- </para></listitem>
-</varlistentry>
-
-<varlistentry>
- <term><emphasis role="bold">evDropSubtitle</emphasis></term>
- <listitem><para>
- Disables the currently used subtitle.
- </para></listitem>
-</varlistentry>
-
-<varlistentry>
- <term><emphasis role="bold">evEqualizer</emphasis></term>
- <listitem><para>
- Turn the equalizer on/off.
- </para></listitem>
-</varlistentry>
-
-<varlistentry>
- <term><emphasis role="bold">evExit</emphasis></term>
- <listitem><para>
- Quit the program.
- </para></listitem>
-</varlistentry>
-
-<varlistentry>
- <term><emphasis role="bold">evIconify</emphasis></term>
- <listitem><para>
- Iconify the window.
- </para></listitem>
-</varlistentry>
-
-<varlistentry>
- <term><emphasis role="bold">evLoad</emphasis></term>
- <listitem><para>
- Load a file (by opening a file browser window, where you can choose a file).
- </para></listitem>
-</varlistentry>
-
-<varlistentry>
- <term><emphasis role="bold">evLoadPlay</emphasis></term>
- <listitem><para>
- Does the same as <literal>evLoad</literal>, but it automatically starts
- playing after the file is loaded.
- </para></listitem>
-</varlistentry>
-
-<varlistentry>
- <term><emphasis role="bold">evLoadSubtitle</emphasis></term>
- <listitem><para>
- Loads a subtitle file (with the file selector).
- </para></listitem>
-</varlistentry>
-
-<varlistentry>
- <term><emphasis role="bold">evLoadAudioFile</emphasis></term>
- <listitem><para>
- Loads an audio file (with the file selector).
- </para></listitem>
-</varlistentry>
-
-<varlistentry>
- <term><emphasis role="bold">evNone</emphasis></term>
- <listitem><para>
- Empty message, it has no effect (except maybe in Subversion versions :-)).
- </para></listitem>
-</varlistentry>
-
-<varlistentry>
- <term><emphasis role="bold">evPlaylist</emphasis></term>
- <listitem><para>
- Open/close the playlist window.
- </para></listitem>
-</varlistentry>
-
-<varlistentry>
- <term><emphasis role="bold">evPlayDVD</emphasis></term>
- <listitem><para>
- Tries to open the disc in the given DVD-ROM drive.
- </para></listitem>
-</varlistentry>
-
-<varlistentry>
- <term><emphasis role="bold">evPlayVCD</emphasis></term>
- <listitem><para>
- Tries to open the disc in the given CD-ROM drive.
- </para></listitem>
-</varlistentry>
-
-<varlistentry>
- <term><emphasis role="bold">evPreferences</emphasis></term>
- <listitem><para>
- Open the preferences window.
- </para></listitem>
-</varlistentry>
-
-<varlistentry>
- <term><emphasis role="bold">evSetAspect</emphasis></term>
- <listitem><para>
- Sets displayed image aspect.
- </para></listitem>
-</varlistentry>
-
-<varlistentry>
- <term><emphasis role="bold">evSetURL</emphasis></term>
- <listitem><para>
- Displays the URL dialog window.
- </para></listitem>
-</varlistentry>
-
-<varlistentry>
- <term><emphasis role="bold">evSkinBrowser</emphasis></term>
- <listitem><para>
- Open the skin browser window.
- </para></listitem>
-</varlistentry>
-</variablelist>
-</sect1>
-
-
-<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
-
-
-<sect1 id="skin-quality">
-<title>Creating quality skins</title>
-
-<para>
-So you have read up on creating skins for the
-<application>MPlayer</application> GUI, done your best with the
-<application>Gimp</application> and wish to submit your skin to us?
-Read on for some guidelines to avoid common mistakes and produce
-a high quality skin.
-</para>
-
-<para>
-We want skins that we add to our repository to conform to certain
-quality standards. There are also a number of things that you can do
-to make our lives easier.
-</para>
-
-<para>
-As an example you can look at the <systemitem>Blue</systemitem> skin,
-it satisfies all the criteria listed below since version 1.5.
-</para>
-
-<itemizedlist>
-<listitem><para>
- Each skin should come with a
- <filename>README</filename> file that contains information about
- you, the author, copyright and license notices and anything else
- you wish to add. If you wish to have a changelog, this file is a
- good place.
-</para></listitem>
-
-<listitem><para>
- There should be a file <filename>VERSION</filename>
- with nothing more than the version number of the skin on a single
- line (e.g. 1.0).
-</para></listitem>
-
-<listitem><para>
- Horizontal and vertical controls (sliders like volume
- or position) should have the center of the knob properly centered on
- the middle of the slider. It should be possible to move the knob to
- both ends of the slider, but not past it.
-</para></listitem>
-
-<listitem><para>
- Skin elements should have the right sizes declared
- in the skin file. If this is not the case you can click outside of
- e.g. a button and still trigger it or click inside its area and not
- trigger it.
-</para></listitem>
-
-<listitem><para>
- The <filename>skin</filename> file should be
- prettyprinted and not contain tabs. Prettyprinted means that the
- numbers should line up neatly in columns.
-</para></listitem>
-</itemizedlist>
-
-</sect1>
-</appendix>
diff --git a/DOCS/xml/ldp.dsl b/DOCS/xml/ldp.dsl
index ef52e849de..20bc32277b 100644
--- a/DOCS/xml/ldp.dsl
+++ b/DOCS/xml/ldp.dsl
@@ -362,4 +362,3 @@
<external-specification id="docbook" document="docbook.dsl">
</style-sheet>
-
diff --git a/DOCS/xml/ru/ports.xml b/DOCS/xml/ru/ports.xml
index 20ddafe126..181b204b8c 100644
--- a/DOCS/xml/ru/ports.xml
+++ b/DOCS/xml/ru/ports.xml
@@ -868,5 +868,3 @@ MPlayer_source_directory
</sect2>
</sect1>
</chapter>
-
-
diff --git a/Makefile b/Makefile
index a3971dda5c..da5172ef7d 100644
--- a/Makefile
+++ b/Makefile
@@ -115,20 +115,8 @@ SRCS_COMMON-$(LIBA52_INTERNAL) += liba52/crc.c \
liba52/imdct.c \
liba52/parse.c \
-SRCS_COMMON-$(LIBASS) += libmpcodecs/vf_ass.c \
- libass/ass_mp.c \
-
-SRCS_COMMON-$(LIBASS_INTERNAL) += libass/ass.c \
- libass/ass_bitmap.c \
- libass/ass_cache.c \
- libass/ass_drawing.c \
- libass/ass_font.c \
- libass/ass_fontconfig.c \
- libass/ass_library.c \
- libass/ass_parse.c \
- libass/ass_render.c \
- libass/ass_strtod.c \
- libass/ass_utils.c \
+SRCS_COMMON-$(LIBASS) += ass_mp.c \
+ libmpcodecs/vf_ass.c \
SRCS_COMMON-$(LIBAVCODEC) += av_opts.c \
libaf/af_lavcresample.c \
@@ -137,15 +125,15 @@ SRCS_COMMON-$(LIBAVCODEC) += av_opts.c \
libmpcodecs/vf_lavc.c \
libmpcodecs/vf_lavcdeint.c \
libmpcodecs/vf_screenshot.c \
+ libmpcodecs/vf_uspp.c \
# These filters use private headers and do not work with shared libavcodec.
-SRCS_COMMON-$(LIBAVCODEC_A) += libaf/af_lavcac3enc.c \
+SRCS_COMMON-$(LIBAVCODEC_INTERNALS) += libaf/af_lavcac3enc.c \
libmpcodecs/vf_fspp.c \
libmpcodecs/vf_geq.c \
libmpcodecs/vf_mcdeint.c \
libmpcodecs/vf_qp.c \
libmpcodecs/vf_spp.c \
- libmpcodecs/vf_uspp.c \
SRCS_COMMON-$(LIBAVFORMAT) += libmpdemux/demux_lavf.c \
stream/stream_ffmpeg.c \
@@ -188,6 +176,9 @@ SRCS_COMMON-$(LIBNEMESI) += libmpdemux/demux_nemesi.c \
SRCS_COMMON-$(LIBNUT) += libmpdemux/demux_nut.c
SRCS_COMMON-$(LIBPOSTPROC) += libmpcodecs/vf_pp.c
SRCS_COMMON-$(LIBSMBCLIENT) += stream/stream_smb.c
+SRCS_COMMON-$(LIBSWSCALE_INTERNALS) += libmpcodecs/vf_palette.c \
+ libmpcodecs/vf_rgb2bgr.c \
+ libmpcodecs/vf_yuy2.c
SRCS_COMMON-$(LIBTHEORA) += libmpcodecs/vd_theora.c
SRCS_COMMON-$(LIVE555) += libmpdemux/demux_rtp.cpp \
libmpdemux/demux_rtp_codec.cpp \
@@ -330,8 +321,10 @@ SRCS_COMMON-$(XVID4) += libmpcodecs/vd_xvid4.c
SRCS_COMMON-$(ZR) += libmpcodecs/vd_zrmjpeg.c \
libmpcodecs/vf_zrmjpeg.c
SRCS_COMMON = asxparser.c \
+ av_log.c \
codec-cfg.c \
cpudetect.c \
+ defaultopts.c \
edl.c \
find_sub.c \
fmt-conversion.c \
@@ -339,6 +332,7 @@ SRCS_COMMON = asxparser.c \
m_config.c \
m_option.c \
m_struct.c \
+ mp_msg.c \
mpcommon.c \
parser-cfg.c \
playtree.c \
@@ -347,6 +341,7 @@ SRCS_COMMON = asxparser.c \
sub_cc.c \
subopt-helper.c \
subreader.c \
+ talloc.c \
vobsub.c \
libaf/af.c \
libaf/af_center.c \
@@ -438,14 +433,12 @@ SRCS_COMMON = asxparser.c \
libmpcodecs/vf_noformat.c \
libmpcodecs/vf_noise.c \
libmpcodecs/vf_ow.c \
- libmpcodecs/vf_palette.c \
libmpcodecs/vf_perspective.c \
libmpcodecs/vf_phase.c \
libmpcodecs/vf_pp7.c \
libmpcodecs/vf_pullup.c \
libmpcodecs/vf_rectangle.c \
libmpcodecs/vf_remove_logo.c \
- libmpcodecs/vf_rgb2bgr.c \
libmpcodecs/vf_rgbtest.c \
libmpcodecs/vf_rotate.c \
libmpcodecs/vf_sab.c \
@@ -463,7 +456,6 @@ SRCS_COMMON = asxparser.c \
libmpcodecs/vf_vo.c \
libmpcodecs/vf_yadif.c \
libmpcodecs/vf_yuvcsp.c \
- libmpcodecs/vf_yuy2.c \
libmpcodecs/vf_yvu9.c \
libmpdemux/aac_hdr.c \
libmpdemux/asfheader.c \
@@ -510,6 +502,7 @@ SRCS_COMMON = asxparser.c \
libmpdemux/yuv4mpeg_ratio.c \
libvo/osd.c \
libvo/sub.c \
+ osdep/findfiles.c \
osdep/$(GETCH) \
osdep/$(TIMER) \
stream/open.c \
@@ -550,41 +543,6 @@ SRCS_MPLAYER-$(GL) += libvo/gl_common.c libvo/vo_gl.c libvo/vo_gl2.c l
SRCS_MPLAYER-$(GL_WIN32) += libvo/w32_common.c
SRCS_MPLAYER-$(GL_X11) += libvo/x11_common.c
SRCS_MPLAYER-$(MATRIXVIEW) += libvo/vo_matrixview.c libvo/matrixview.c
-SRCS_MPLAYER-$(GUI) += gui/bitmap.c
-SRCS_MPLAYER-$(GUI_GTK) += gui/app.c \
- gui/cfg.c \
- gui/interface.c \
- gui/mplayer/gui_common.c \
- gui/mplayer/menu.c \
- gui/mplayer/mw.c \
- gui/mplayer/pb.c \
- gui/mplayer/play.c \
- gui/mplayer/sw.c \
- gui/mplayer/widgets.c \
- gui/mplayer/gtk/about.c \
- gui/mplayer/gtk/eq.c \
- gui/mplayer/gtk/fs.c \
- gui/mplayer/gtk/gtk_common.c \
- gui/mplayer/gtk/gtk_url.c \
- gui/mplayer/gtk/mb.c \
- gui/mplayer/gtk/menu.c \
- gui/mplayer/gtk/opts.c \
- gui/mplayer/gtk/pl.c \
- gui/mplayer/gtk/sb.c \
- gui/skin/cut.c \
- gui/skin/font.c \
- gui/skin/skin.c \
- gui/wm/ws.c \
- gui/wm/wsxdnd.c \
-
-SRCS_MPLAYER-$(GUI_WIN32) += gui/win32/dialogs.c \
- gui/win32/gui.c \
- gui/win32/interface.c \
- gui/win32/playlist.c \
- gui/win32/preferences.c \
- gui/win32/skinload.c \
- gui/win32/widgetrender.c \
- gui/win32/wincfg.c \
SRCS_MPLAYER-$(IVTV) += libao2/ao_ivtv.c libvo/vo_ivtv.c
SRCS_MPLAYER-$(JACK) += libao2/ao_jack.c
@@ -665,7 +623,6 @@ SRCS_MPLAYER = command.c \
m_property.c \
mixer.c \
mp_fifo.c \
- mp_msg.c \
mplayer.c \
parser-mpcmd.c \
input/input.c \
@@ -675,6 +632,7 @@ SRCS_MPLAYER = command.c \
libao2/audio_out.c \
libvo/aspect.c \
libvo/geometry.c \
+ libvo/old_vo_wrapper.c \
libvo/spuenc.c \
libvo/video_out.c \
libvo/vo_mpegpes.c \
@@ -696,7 +654,6 @@ SRCS_MENCODER-$(X264) += libmpcodecs/ve_x264.c
SRCS_MENCODER-$(XVID4) += libmpcodecs/ve_xvid4.c
SRCS_MENCODER = mencoder.c \
- mp_msg-mencoder.c \
parser-mecmd.c \
xvid_vbr.c \
libmpcodecs/ae.c \
@@ -710,12 +667,6 @@ SRCS_MENCODER = mencoder.c \
libmpdemux/muxer_rawvideo.c \
$(SRCS_MENCODER-yes)
-
-COMMON_LIBS-$(LIBAVFORMAT_A) += libavformat/libavformat.a
-COMMON_LIBS-$(LIBAVCODEC_A) += libavcodec/libavcodec.a
-COMMON_LIBS-$(LIBAVUTIL_A) += libavutil/libavutil.a
-COMMON_LIBS-$(LIBPOSTPROC_A) += libpostproc/libpostproc.a
-COMMON_LIBS-$(LIBSWSCALE_A) += libswscale/libswscale.a
COMMON_LIBS += $(COMMON_LIBS-yes)
OBJS_COMMON += $(addsuffix .o, $(basename $(SRCS_COMMON)))
@@ -731,38 +682,15 @@ DEPS = $(filter-out %.S,$(patsubst %.cpp,%.d,$(patsubst %.c,%.d,$(SRCS_COMMON) $
ALL_PRG-$(MPLAYER) += mplayer$(EXESUF)
ALL_PRG-$(MENCODER) += mencoder$(EXESUF)
-INSTALL_TARGETS-$(GUI) += install-gui
INSTALL_TARGETS-$(MENCODER) += install-mencoder install-mencoder-man
INSTALL_TARGETS-$(MPLAYER) += install-mplayer install-mplayer-man
DIRS = . \
- gui \
- gui/mplayer \
- gui/mplayer/gtk \
- gui/skin \
- gui/wm \
- gui/win32 \
input \
liba52 \
libaf \
libao2 \
libass \
- libavcodec \
- libavcodec/alpha \
- libavcodec/arm \
- libavcodec/bfin \
- libavcodec/mlib \
- libavcodec/ppc \
- libavcodec/sh4 \
- libavcodec/sparc \
- libavcodec/x86 \
- libavformat \
- libavutil \
- libavutil/arm \
- libavutil/bfin \
- libavutil/ppc \
- libavutil/sh4 \
- libavutil/x86 \
libdvdcss \
libdvdnav \
libdvdnav/vm \
@@ -773,7 +701,6 @@ DIRS = . \
libmpcodecs/native \
libmpdemux \
libmpeg2 \
- libpostproc \
libswscale \
libswscale/bfin \
libswscale/mlib \
@@ -801,47 +728,28 @@ ADDSUFFIXES = $(foreach suf,$(1),$(addsuffix $(suf),$(2)))
ADD_ALL_DIRS = $(call ADDSUFFIXES,$(1),$(DIRS))
ADD_ALL_EXESUFS = $(1) $(call ADDSUFFIXES,$(EXESUFS_ALL),$(1))
-FFMPEGPARTS = libavcodec \
- libavformat \
- libavutil \
- libpostproc \
- libswscale \
-
-FFMPEGLIBS = $(foreach part, $(FFMPEGPARTS), $(part)/$(part).a)
-FFMPEGFILES = $(foreach part, $(FFMPEGPARTS), $(wildcard $(part)/*.[chS] $(part)/*/*.[chS]))
-
-
-
###### generic rules #######
all: $(ALL_PRG-yes)
-%.d: %.c
- $(MPDEPEND_CMD) > $@
+%.o: %.c
+ $(CC) $(CFLAGS) -c -o $@ -MD -MP -MF $*.d $<
-%.d: %.cpp
- $(MPDEPEND_CMD_CXX) > $@
+%.o: %.cpp
+ $(CXX) $(CXXFLAGS) -c -o $@ -MD -MP -MF $*.d $<
-%.d: %.m
- $(MPDEPEND_CMD) > $@
+%.o: %.m
+ $(CC) $(CFLAGS) -c -o $@ -MD -MP -MF $*.d $<
%.ho: %.h
$(CC) $(CFLAGS) -Wno-unused -c -o $@ -x c $<
-%.o: %.m
- $(CC) $(CFLAGS) -c -o $@ $<
-
%-rc.o: %.rc
$(WINDRES) -I. $< $@
checkheaders: $(ALLHEADERS:.h=.ho)
dep depend: $(DEPS)
- for part in $(FFMPEGPARTS); do $(MAKE) -C $$part depend; done
-
-$(FFMPEGLIBS): $(FFMPEGFILES) config.h
- $(MAKE) -C $(@D)
- touch $@
mencoder$(EXESUF): $(MENCODER_DEPS)
mencoder$(EXESUF): EXTRALIBS += $(EXTRALIBS_MENCODER)
@@ -850,7 +758,7 @@ mplayer$(EXESUF): EXTRALIBS += $(EXTRALIBS_MPLAYER)
mencoder$(EXESUF) mplayer$(EXESUF):
$(CC) -o $@ $^ $(EXTRALIBS)
-codec-cfg$(EXESUF): codec-cfg.c help_mp.h
+codec-cfg$(EXESUF): codec-cfg.c codec-cfg.h help_mp.h
$(HOST_CC) -O -DCODECS2HTML -I. -o $@ $<
codecs.conf.h: codec-cfg$(EXESUF) etc/codecs.conf
@@ -865,10 +773,6 @@ config.mak: configure
help_mp.h: help/help_mp-en.h $(HELP_FILE)
help/help_create.sh $(HELP_FILE) $(CHARSET)
-# rebuild version.h each time the working copy is updated
-ifeq ($(wildcard .svn/entries),.svn/entries)
-version.h: .svn/entries
-endif
version.h: version.sh
./$< `$(CC) -dumpversion`
@@ -881,7 +785,18 @@ version.h: version.sh
# Make sure all generated header files are created.
codec-cfg.d codec-cfg.o: codecs.conf.h
$(DEPS) $(MENCODER_DEPS) $(MPLAYER_DEPS): help_mp.h
-$(call ADDSUFFIXES,.d .o,mpcommon vobsub stream/stream_cddb stream/network libmpdemux/muxer_avi gui/win32/gui): version.h
+$(call ADDSUFFIXES,.d .o,mpcommon vobsub stream/stream_cddb stream/network libmpdemux/muxer_avi): version.h
+
+# Files that depend on libswscale internals
+libvo/vo_mga.o libvo/vo_xmga.o libmpcodecs/vf_halfpack.o libmpcodecs/vf_palette.o libmpcodecs/vf_rgb2bgr.o libmpcodecs/vf_yuy2.o: CFLAGS := -I$(FFMPEG_SOURCE_PATH) $(CFLAGS)
+
+# Files that depend on libavcodec internals
+libaf/af_lavcac3enc.o libmpcodecs/vf_fspp.o libmpcodecs/vf_geq.o libmpcodecs/vf_mcdeint.o libmpcodecs/vf_qp.o libmpcodecs/vf_spp.o libvo/jpeg_enc.o: CFLAGS := -I$(FFMPEG_SOURCE_PATH) $(CFLAGS)
+
+# yuv4mpeg has rgb conversion code under #ifdef CONFIG_LIBSWSCALE_INTERNALS
+ifeq ($(LIBSWSCALE_INTERNALS),yes)
+libvo/vo_yuv4mpeg.o: CFLAGS := -I$(FFMPEG_SOURCE_PATH) $(CFLAGS)
+endif
libdvdcss/%: CFLAGS := -Ilibdvdcss -D__USE_UNIX98 -D_GNU_SOURCE -DVERSION=\"1.2.10\" $(CFLAGS_LIBDVDCSS) $(CFLAGS)
libdvdnav/%: CFLAGS := -Ilibdvdnav -D__USE_UNIX98 -D_GNU_SOURCE -DHAVE_CONFIG_H -DVERSION=\"MPlayer-custom\" $(CFLAGS)
@@ -918,36 +833,23 @@ $(VIDIX_DEPS) $(VIDIX_OBJS): $(VIDIX_PCI_FILES)
install: $(INSTALL_TARGETS-yes)
install-dirs:
- $(INSTALL) -d $(BINDIR) $(CONFDIR) $(LIBDIR)
+ if test ! -d $(BINDIR) ; then $(INSTALL) -d $(BINDIR) ; fi
+ if test ! -d $(CONFDIR) ; then $(INSTALL) -d $(CONFDIR) ; fi
+ if test ! -d $(LIBDIR) ; then $(INSTALL) -d $(LIBDIR) ; fi
install-%: %$(EXESUF) install-dirs
$(INSTALL) -m 755 $(INSTALLSTRIP) $< $(BINDIR)
-install-gui: install-mplayer
- -ln -sf mplayer$(EXESUF) $(BINDIR)/gmplayer$(EXESUF)
- $(INSTALL) -d $(DATADIR)/skins $(prefix)/share/pixmaps $(prefix)/share/applications
- $(INSTALL) -m 644 etc/mplayer.xpm $(prefix)/share/pixmaps/
- $(INSTALL) -m 644 etc/mplayer.desktop $(prefix)/share/applications/
-
-install-gui-man: $(foreach lang,$(MAN_LANGS),install-gui-man-$(lang))
install-mencoder-man: $(foreach lang,$(MAN_LANGS),install-mencoder-man-$(lang))
install-mplayer-man: $(foreach lang,$(MAN_LANGS),install-mplayer-man-$(lang))
-install-gui-man-en: install-mplayer-man-en
- cd $(MANDIR)/man1/ && ln -sf mplayer.1 gmplayer.1
-
install-mencoder-man-en: install-mplayer-man-en
cd $(MANDIR)/man1 && ln -sf mplayer.1 mencoder.1
install-mplayer-man-en:
- $(INSTALL) -d $(MANDIR)/man1
+ if test ! -d $(MANDIR)/man1 ; then $(INSTALL) -d $(MANDIR)/man1 ; fi
$(INSTALL) -m 644 DOCS/man/en/mplayer.1 $(MANDIR)/man1/
-define GUI_MAN_RULE
-install-gui-man-$(lang): install-mplayer-man-$(lang)
- cd $(MANDIR)/$(lang)/man1/ && ln -sf mplayer.1 gmplayer.1
-endef
-
define MENCODER_MAN_RULE
install-mencoder-man-$(lang): install-mplayer-man-$(lang)
cd $(MANDIR)/$(lang)/man1 && ln -sf mplayer.1 mencoder.1
@@ -955,11 +857,10 @@ endef
define MPLAYER_MAN_RULE
install-mplayer-man-$(lang):
- $(INSTALL) -d $(MANDIR)/$(lang)/man1
+ if test ! -d $(MANDIR)/$(lang)/man1 ; then $(INSTALL) -d $(MANDIR)/$(lang)/man1 ; fi
$(INSTALL) -m 644 DOCS/man/$(lang)/mplayer.1 $(MANDIR)/$(lang)/man1/
endef
-$(foreach lang,$(filter-out en,$(MAN_LANG_ALL)),$(eval $(GUI_MAN_RULE)))
$(foreach lang,$(filter-out en,$(MAN_LANG_ALL)),$(eval $(MENCODER_MAN_RULE)))
$(foreach lang,$(filter-out en,$(MAN_LANG_ALL)),$(eval $(MPLAYER_MAN_RULE)))
@@ -992,11 +893,13 @@ TAGS:
tags:
rm -f $@; find . -name '*.[chS]' -o -name '*.asm' | xargs ctags -a
-
+generated_ebml:
+ TOOLS/matroska.py --generate-header >libmpdemux/ebml_types.h
+ TOOLS/matroska.py --generate-definitions >libmpdemux/ebml_defs.c
###### tests / tools #######
-TEST_OBJS = mp_msg-mencoder.o mp_fifo.o osdep/$(GETCH) osdep/$(TIMER) -ltermcap -lm
+TEST_OBJS = mp_msg.o mp_fifo.o osdep/$(GETCH) osdep/$(TIMER) -ltermcap -lm
codec-cfg-test$(EXESUF): codec-cfg.c codecs.conf.h help_mp.h $(TEST_OBJS)
$(CC) -I. -DTESTING -o $@ $^
diff --git a/README b/README
index 7b202ba38e..acc7fcac88 100644
--- a/README
+++ b/README
@@ -2,8 +2,7 @@ Welcome to MPlayer, The Movie Player. MPlayer can play most standard video
formats out of the box and almost all others with the help of external codecs.
MPlayer currently works best from the command line, but visual feedback for
many functions is available from its onscreen status display (OSD), which is
-also used for displaying subtitles. MPlayer also has a GUI with skin support and
-several unofficial alternative graphical frontends are available.
+also used for displaying subtitles.
MEncoder is a command line video encoder for advanced users that can be built
from the MPlayer source tree. Unofficial graphical frontends exist but are
@@ -23,7 +22,6 @@ Requirements:
package(s) installed.
- To compile MPlayer with X11 support, you need to have the X Window System
development packages (like for XFree86 or X.Org) installed.
-- For the GUI you need the GTK development packages.
Before you start...
@@ -39,8 +37,7 @@ STEP0: Getting MPlayer
~~~~~~~~~~~~~~~~~~~~~~
Official releases and Subversion snapshots, as well as binary codec packages
-and a number of different skins for the GUI are available from the download
-section of our homepage at
+available from the download section of our homepage at
http://www.mplayerhq.hu/dload.html
@@ -54,9 +51,9 @@ Please note that binary codecs only work on the processor architecture they
were compiled for. Choose the correct package for your processor. No other
package is necessary.
-The GUI needs at least one skin and codec packages add support for some more
-video and audio formats. MPlayer does not come with any of these by default,
-you have to download and install them separately.
+Codec packages add support for some more video and audio formats. MPlayer does
+not come with any of these by default, you have to download and install them
+separately.
You can also get MPlayer via Subversion. Issue the following commands to get
the latest sources:
@@ -90,14 +87,8 @@ MPlayer can be adapted to all kinds of needs and hardware environments. Run
./configure
-to configure MPlayer with the default options. GUI support has to be enabled
-separately, run
-
- ./configure --enable-gui
-
-if you want to use the GUI.
-
-If something does not work as expected, try
+to configure MPlayer with the default options. If something does not work as
+expected, try
./configure --help
@@ -136,15 +127,15 @@ NOTE: If you run Debian you can configure, compile and build a proper Debian
fakeroot debian/rules binary
If you want to pass custom options to configure, you can set up the
-DEB_BUILD_OPTIONS environment variable. For instance, if you want GUI
-and OSD menu support you would use:
+DEB_BUILD_OPTIONS environment variable. For instance, if you want OSD menu
+support you would use:
- DEB_BUILD_OPTIONS="--enable-gui --enable-menu" fakeroot debian/rules binary
+ DEB_BUILD_OPTIONS="--enable-menu" fakeroot debian/rules binary
You can also pass some variables to the Makefile. For example, if you want
to compile with gcc 3.4 even if it's not the default compiler:
- CC=gcc-3.4 DEB_BUILD_OPTIONS="--enable-gui" fakeroot debian/rules binary
+ CC=gcc-3.4 DEB_BUILD_OPTIONS="--enable-menu" fakeroot debian/rules binary
To clean up the source tree run the following command:
@@ -161,32 +152,14 @@ you can create a symbolic link from either ~/.mplayer/subfont.ttf or
/usr/local/share/mplayer/subfont.ttf to your TrueType font.
-____________________________
-STEP5: Installing a GUI skin
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-Unpack the archive and put the contents in /usr/local/share/mplayer/skins/ or
-~/.mplayer/skins/. MPlayer will use the skin in the subdirectory named default
-of /usr/local/share/mplayer/skins/ or ~/.mplayer/skins/ unless told otherwise
-via the '-skin' switch. You should therefore rename your skin subdirectory or
-make a suitable symbolic link.
-
-
__________________
-STEP6: Let's play!
+STEP5: Let's play!
~~~~~~~~~~~~~~~~~~
That's it for the moment. To start playing movies, open a command line and try
mplayer <moviefile>
-or for the GUI
-
- gmplayer <moviefile>
-
-gmplayer is a symbolic link to mplayer created by 'make install'.
-Without <moviefile>, gmplayer will start with the GUI filepicker.
-
To play a VCD track or a DVD title, try:
mplayer vcd://2 -cdrom-device /dev/hdc
diff --git a/TOOLS/asfinfo.c b/TOOLS/asfinfo.c
index 500d0a3615..85883b462f 100644
--- a/TOOLS/asfinfo.c
+++ b/TOOLS/asfinfo.c
@@ -286,4 +286,3 @@ int main(int argc, char* argv[]){
return 0;
}
-
diff --git a/TOOLS/avisubdump.c b/TOOLS/avisubdump.c
index e48f1ddce7..9fc50aff46 100644
--- a/TOOLS/avisubdump.c
+++ b/TOOLS/avisubdump.c
@@ -193,4 +193,3 @@ int main(int argc,char* argv[])
return 0;
}
-
diff --git a/TOOLS/compare.c b/TOOLS/compare.c
index 67aa8ac1c2..8a48bc8255 100644
--- a/TOOLS/compare.c
+++ b/TOOLS/compare.c
@@ -71,4 +71,3 @@ int main(int argc, char **argv)
printf("%d (+/-1)differences found\n", dif);
exit(0);
}
-
diff --git a/TOOLS/matroska.py b/TOOLS/matroska.py
new file mode 100755
index 0000000000..8368f35185
--- /dev/null
+++ b/TOOLS/matroska.py
@@ -0,0 +1,397 @@
+#!/usr/bin/python
+"""
+Generate C definitions for parsing Matroska files.
+Can also be used to directly parse Matroska files and display their contents.
+"""
+
+#
+# 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.
+#
+
+
+elements_ebml = (
+ 'EBML, 1a45dfa3, sub', (
+ 'EBMLVersion, 4286, uint',
+ 'EBMLReadVersion, 42f7, uint',
+ 'EBMLMaxIDLength, 42f2, uint',
+ 'EBMLMaxSizeLength, 42f3, uint',
+ 'DocType, 4282, str',
+ 'DocTypeVersion, 4287, uint',
+ 'DocTypeReadVersion, 4285, uint',
+ ),
+
+ 'CRC32, bf, binary',
+ 'Void, ec, binary',
+)
+
+elements_matroska = (
+ 'Segment, 18538067, sub', (
+
+ 'SeekHead*, 114d9b74, sub', (
+ 'Seek*, 4dbb, sub', (
+ 'SeekID, 53ab, ebml_id',
+ 'SeekPosition, 53ac, uint',
+ ),
+ ),
+
+ 'Info*, 1549a966, sub', (
+ 'SegmentUID, 73a4, binary',
+ 'PrevUID, 3cb923, binary',
+ 'NextUID, 3eb923, binary',
+ 'TimecodeScale, 2ad7b1, uint',
+ 'DateUTC, 4461, sint',
+ 'Title, 7ba9, str',
+ 'MuxingApp, 4d80, str',
+ 'WritingApp, 5741, str',
+ 'Duration, 4489, float',
+ ),
+
+ 'Cluster*, 1f43b675, sub', (
+ 'Timecode, e7, uint',
+ 'BlockGroup*, a0, sub', (
+ 'Block, a1, binary',
+ 'BlockDuration, 9b, uint',
+ 'ReferenceBlock*, fb, sint',
+ ),
+ 'SimpleBlock*, a3, binary',
+ ),
+
+ 'Tracks*, 1654ae6b, sub', (
+ 'TrackEntry*, ae, sub', (
+ 'TrackNumber, d7, uint',
+ 'TrackUID, 73c5, uint',
+ 'TrackType, 83, uint',
+ 'FlagEnabled, b9, uint',
+ 'FlagDefault, 88, uint',
+ 'FlagForced, 55aa, uint',
+ 'FlagLacing, 9c, uint',
+ 'MinCache, 6de7, uint',
+ 'DefaultDuration, 23e383, uint',
+ 'TrackTimecodeScale, 23314f, float',
+ 'MaxBlockAdditionID, 55ee, uint',
+ 'Name, 536e, str',
+ 'Language, 22b59c, str',
+ 'CodecID, 86, str',
+ 'CodecPrivate, 63a2, binary',
+ 'CodecDecodeAll, aa, uint',
+ 'Video, e0, sub', (
+ 'FlagInterlaced, 9a, uint',
+ 'PixelWidth, b0, uint',
+ 'PixelHeight, ba, uint',
+ 'DisplayWidth, 54b0, uint',
+ 'DisplayHeight, 54ba, uint',
+ 'FrameRate, 2383e3, float',
+ ),
+ 'Audio, e1, sub', (
+ 'SamplingFrequency, b5, float',
+ 'Channels, 9f, uint',
+ 'BitDepth, 6264, uint',
+ ),
+ 'ContentEncodings, 6d80, sub', (
+ 'ContentEncoding*, 6240, sub', (
+ 'ContentEncodingOrder, 5031, uint',
+ 'ContentEncodingScope, 5032, uint',
+ 'ContentEncodingType, 5033, uint',
+ 'ContentCompression, 5034, sub', (
+ 'ContentCompAlgo, 4254, uint',
+ 'ContentCompSettings, 4255, binary',
+ ),
+ ),
+ ),
+ ),
+ ),
+
+ 'Cues, 1c53bb6b, sub', (
+ 'CuePoint*, bb, sub', (
+ 'CueTime, b3, uint',
+ 'CueTrackPositions*, b7, sub', (
+ 'CueTrack, f7, uint',
+ 'CueClusterPosition, f1, uint',
+ ),
+ ),
+ ),
+
+ 'Attachments, 1941a469, sub', (
+ 'AttachedFile*, 61a7, sub', (
+ 'FileName, 466e, str',
+ 'FileMimeType, 4660, str',
+ 'FileData, 465c, binary',
+ 'FileUID, 46ae, uint',
+ ),
+ ),
+
+ 'Chapters, 1043a770, sub', (
+ 'EditionEntry*, 45b9, sub', (
+ 'EditionUID, 45bc, uint',
+ 'EditionFlagHidden, 45bd, uint',
+ 'EditionFlagDefault, 45db, uint',
+ 'EditionFlagOrdered, 45dd, uint',
+ 'ChapterAtom*, b6, sub', (
+ 'ChapterUID, 73c4, uint',
+ 'ChapterTimeStart, 91, uint',
+ 'ChapterTimeEnd, 92, uint',
+ 'ChapterFlagHidden, 98, uint',
+ 'ChapterFlagEnabled, 4598, uint',
+ 'ChapterSegmentUID, 6e67, binary',
+ 'ChapterSegmentEditionUID, 6ebc, uint',
+ 'ChapterDisplay*, 80, sub', (
+ 'ChapString, 85, str',
+ 'ChapLanguage*, 437c, str',
+ ),
+ ),
+ ),
+ ),
+ 'Tags*, 1254c367, sub', (
+ 'Tag*, 7373, sub', (
+ 'Targets, 63c0, sub', (
+ 'TargetTypeValue, 68ca, uint',
+ ),
+ ),
+ ),
+ ),
+)
+
+
+import sys
+from math import ldexp
+
+def byte2num(s):
+ return int(s.encode('hex'), 16)
+
+def camelcase_to_words(name):
+ parts = []
+ start = 0
+ for i in range(1, len(name)):
+ if name[i].isupper() and (name[i-1].islower() or
+ name[i+1:i+2].islower()):
+ parts.append(name[start:i])
+ start = i
+ parts.append(name[start:])
+ return '_'.join(parts).lower()
+
+class MatroskaElement(object):
+
+ def __init__(self, name, elid, valtype, namespace):
+ self.name = name
+ self.definename = '%s_ID_%s' % (namespace, name.upper())
+ self.fieldname = camelcase_to_words(name)
+ self.structname = 'ebml_' + self.fieldname
+ self.elid = elid
+ self.valtype = valtype
+ if valtype == 'sub':
+ self.ebmltype = 'EBML_TYPE_SUBELEMENTS'
+ self.valname = 'struct %s' % self.structname
+ else:
+ self.ebmltype = 'EBML_TYPE_' + valtype.upper()
+ try:
+ self.valname = {'uint': 'uint64_t', 'str': 'struct bstr',
+ 'binary': 'struct bstr', 'ebml_id': 'uint32_t',
+ 'float': 'double', 'sint': 'int64_t',
+ }[valtype]
+ except KeyError:
+ raise SyntaxError('Unrecognized value type ' + valtype)
+ self.subelements = ()
+
+ def add_subelements(self, subelements):
+ self.subelements = subelements
+ self.subids = set(x[0].elid for x in subelements)
+
+elementd = {}
+elementlist = []
+def parse_elems(l, namespace):
+ subelements = []
+ for el in l:
+ if isinstance(el, str):
+ name, hexid, eltype = [x.strip() for x in el.split(',')]
+ multiple = name.endswith('*')
+ name = name.strip('*')
+ new = MatroskaElement(name, hexid, eltype, namespace)
+ elementd[hexid] = new
+ elementlist.append(new)
+ subelements.append((new, multiple))
+ else:
+ new.add_subelements(parse_elems(el, namespace))
+ return subelements
+
+parse_elems(elements_ebml, 'EBML')
+parse_elems(elements_matroska, 'MATROSKA')
+
+def generate_C_header():
+ print('// Generated by TOOLS/matroska.py, do not edit manually')
+ print
+
+ for el in elementlist:
+ print('#define %-40s 0x%s' % (el.definename, el.elid))
+
+ print
+
+ for el in reversed(elementlist):
+ if not el.subelements:
+ continue
+ print
+ print('struct %s {' % el.structname)
+ l = max(len(subel.valname) for subel, multiple in el.subelements)+1
+ for subel, multiple in el.subelements:
+ print(' %-*s %s%s;' % (l, subel.valname, (' ', '*')[multiple],
+ subel.fieldname))
+ print
+ for subel, multiple in el.subelements:
+ print(' int n_%s;' % (subel.fieldname))
+ print('};')
+
+ for el in elementlist:
+ if not el.subelements:
+ continue
+ print('extern const struct ebml_elem_desc %s_desc;' % el.structname)
+
+ print
+ print('#define MAX_EBML_SUBELEMENTS %d' % max(len(el.subelements)
+ for el in elementlist))
+
+
+
+def generate_C_definitions():
+ print('// Generated by TOOLS/matroska.py, do not edit manually')
+ print
+ for el in reversed(elementlist):
+ print
+ if el.subelements:
+ print('#define N %s' % el.fieldname)
+ print('E_S("%s", %d)' % (el.name, len(el.subelements)))
+ for subel, multiple in el.subelements:
+ print('F(%s, %s, %d)' % (subel.definename, subel.fieldname,
+ multiple))
+ print('}};')
+ print('#undef N')
+ else:
+ print('E("%s", %s, %s)' % (el.name, el.fieldname, el.ebmltype))
+
+def read(s, length):
+ t = s.read(length)
+ if len(t) != length:
+ raise IOError
+ return t
+
+def read_id(s):
+ t = read(s, 1)
+ i = 0
+ mask = 128
+ if ord(t) == 0:
+ raise SyntaxError
+ while not ord(t) & mask:
+ i += 1
+ mask >>= 1
+ t += read(s, i)
+ return t
+
+def read_vint(s):
+ t = read(s, 1)
+ i = 0
+ mask = 128
+ if ord(t) == 0:
+ raise SyntaxError
+ while not ord(t) & mask:
+ i += 1
+ mask >>= 1
+ t = chr(ord(t) & (mask - 1))
+ t += read(s, i)
+ return i+1, byte2num(t)
+
+def read_str(s, length):
+ return read(s, length)
+
+def read_uint(s, length):
+ t = read(s, length)
+ return byte2num(t)
+
+def read_sint(s, length):
+ i = read_uint(s, length)
+ mask = 1 << (length * 8 - 1)
+ if i & mask:
+ i -= 2 * mask
+ return i
+
+def read_float(s, length):
+ t = read(s, length)
+ i = byte2num(t)
+ if length == 4:
+ f = ldexp((i & 0x7fffff) + (1 << 23), (i >> 23 & 0xff) - 150)
+ if i & (1 << 31):
+ f = -f
+ return f
+ raise SyntaxError
+
+def parse_one(s, depth, parent, maxlen):
+ elid = read_id(s).encode('hex')
+ elem = elementd.get(elid)
+ if parent is not None and elid not in parent.subids and elid not in ('ec', 'bf'):
+ print('Unexpected:', elid)
+ if 1:
+ raise NotImplementedError
+ size, length = read_vint(s)
+ this_length = len(elid) / 2 + size + length
+ if elem is not None:
+ if elem.valtype != 'skip':
+ print depth, elid, elem.name, 'size:', length, 'value:',
+ if elem.valtype == 'sub':
+ print('subelements:')
+ while length > 0:
+ length -= parse_one(s, depth + 1, elem, length)
+ if length < 0:
+ raise SyntaxError
+ elif elem.valtype == 'str':
+ print 'string', repr(read_str(s, length))
+ elif elem.valtype in ('binary', 'ebml_id'):
+ t = read_str(s, length)
+ dec = ''
+ if elem.valtype == 'ebml_id':
+ idelem = elementd.get(t.encode('hex'))
+ if idelem is None:
+ dec = '(UNKNOWN)'
+ else:
+ dec = '(%s)' % idelem.name
+ if len(t) < 20:
+ t = t.encode('hex')
+ else:
+ t = '<skipped %d bytes>' % len(t)
+ print 'binary', t, dec
+ elif elem.valtype == 'uint':
+ print 'uint', read_uint(s, length)
+ elif elem.valtype == 'sint':
+ print 'sint', read_sint(s, length)
+ elif elem.valtype == 'float':
+ print 'float', read_float(s, length)
+ elif elem.valtype == 'skip':
+ read(s, length)
+ else:
+ raise NotImplementedError
+ else:
+ print(depth, 'Unknown element:', elid, 'size:', length)
+ read(s, length)
+ return this_length
+
+def parse_toplevel(s):
+ parse_one(s, 0, None, 1 << 63)
+
+if sys.argv[1] == '--generate-header':
+ generate_C_header()
+elif sys.argv[1] == '--generate-definitions':
+ generate_C_definitions()
+else:
+ s = open(sys.argv[1])
+ while 1:
+ parse_toplevel(s)
diff --git a/TOOLS/modify_reg.c b/TOOLS/modify_reg.c
index 9c4e865883..888d9eac32 100644
--- a/TOOLS/modify_reg.c
+++ b/TOOLS/modify_reg.c
@@ -180,4 +180,3 @@ int main(int argc, char *argv[]) {
}
return 0;
}
-
diff --git a/TOOLS/realcodecs/cook.c b/TOOLS/realcodecs/cook.c
index 0cbd43af54..ede9a33aca 100644
--- a/TOOLS/realcodecs/cook.c
+++ b/TOOLS/realcodecs/cook.c
@@ -426,4 +426,3 @@ void SetDLLAccessPath(ulong p1) {
hexdump((void*)p1, 44);
fprintf(stderr, "--> void\n\n\n");
}
-
diff --git a/TOOLS/realcodecs/drv4.c b/TOOLS/realcodecs/drv4.c
index 39d642a180..ad68c1ac36 100644
--- a/TOOLS/realcodecs/drv4.c
+++ b/TOOLS/realcodecs/drv4.c
@@ -402,4 +402,3 @@ ulong RV20toYUV420Transform(ulong p1,ulong p2,ulong p3,ulong p4,ulong p5) {
// fprintf(stderr, "RV20toYUV420Transform --> 0x%0lx(%ld)\n\n\n", result, result);
return result;
}
-
diff --git a/TOOLS/realcodecs/ra.c b/TOOLS/realcodecs/ra.c
index 6a17911ba5..fd6d55a688 100644
--- a/TOOLS/realcodecs/ra.c
+++ b/TOOLS/realcodecs/ra.c
@@ -392,4 +392,3 @@ void SetDLLAccessPath(ulong p1) {
hexdump((void*)p1, 44);
fprintf(stderr, "--> void\n\n\n");
}
-
diff --git a/TOOLS/realcodecs/rv30.c b/TOOLS/realcodecs/rv30.c
index 41f49eadaa..bf02fe3a78 100644
--- a/TOOLS/realcodecs/rv30.c
+++ b/TOOLS/realcodecs/rv30.c
@@ -537,4 +537,3 @@ void SetDLLAccessPath(ulong p1) {
// hexdump((void*)p1, 44);
fprintf(stderr, "--> void\n\n\n");
}
-
diff --git a/TOOLS/realcodecs/sipr.c b/TOOLS/realcodecs/sipr.c
index 9a3399ea6c..43e0805b2e 100644
--- a/TOOLS/realcodecs/sipr.c
+++ b/TOOLS/realcodecs/sipr.c
@@ -480,4 +480,3 @@ void RASetPwd(ulong p1,ulong p2) {
// hexdump((void*)p1, 44);
fprintf(stderr, "--> void\n\n\n");
}
-
diff --git a/TOOLS/vdpau_functions.py b/TOOLS/vdpau_functions.py
new file mode 100644
index 0000000000..098e30a251
--- /dev/null
+++ b/TOOLS/vdpau_functions.py
@@ -0,0 +1,61 @@
+# Generate vdpau_template.c
+
+functions = """
+# get_error_string should be first, because the function lookup loop should
+# have it available to print errors for other functions
+get_error_string
+
+bitmap_surface_create
+bitmap_surface_destroy
+bitmap_surface_put_bits_native
+bitmap_surface_query_capabilities
+decoder_create
+decoder_destroy
+decoder_render
+device_destroy
+generate_csc_matrix GenerateCSCMatrix # CSC completely capitalized
+output_surface_create
+output_surface_destroy
+output_surface_put_bits_indexed
+output_surface_put_bits_native
+output_surface_render_bitmap_surface
+output_surface_render_output_surface
+preemption_callback_register
+presentation_queue_block_until_surface_idle
+presentation_queue_create
+presentation_queue_destroy
+presentation_queue_display
+presentation_queue_get_time
+presentation_queue_query_surface_status
+presentation_queue_target_create_x11
+presentation_queue_target_destroy
+video_mixer_create
+video_mixer_destroy
+video_mixer_query_feature_support
+video_mixer_render
+video_mixer_set_attribute_values
+video_mixer_set_feature_enables
+video_surface_create
+video_surface_destroy
+video_surface_put_bits_y_cb_cr
+"""
+
+print("""
+/* List the VDPAU functions used by MPlayer.
+ * Generated by vdpau_functions.py.
+ * First argument on each line is the VDPAU function type name,
+ * second macro name needed to get function address,
+ * third name MPlayer uses for the function.
+ */
+""")
+for line in functions.splitlines():
+ parts = line.split('#')[0].strip().split()
+ if not parts:
+ continue # empty/comment line
+ if len(parts) > 1:
+ mp_name, vdpau_name = parts
+ else:
+ mp_name = parts[0]
+ vdpau_name = ''.join(part.capitalize() for part in mp_name.split('_'))
+ macro_name = mp_name.upper()
+ print('VDP_FUNCTION(Vdp%s, VDP_FUNC_ID_%s, %s)' % (vdpau_name, macro_name, mp_name))
diff --git a/TOOLS/w32codec_dl.pl b/TOOLS/w32codec_dl.pl
index 41f4f9feca..c4a16b6b58 100755
--- a/TOOLS/w32codec_dl.pl
+++ b/TOOLS/w32codec_dl.pl
@@ -166,4 +166,3 @@ sub get_codec
print "No such file!\n";
}
}
-
diff --git a/ass_mp.c b/ass_mp.c
new file mode 100644
index 0000000000..959f985446
--- /dev/null
+++ b/ass_mp.c
@@ -0,0 +1,302 @@
+/*
+ * Copyright (C) 2006 Evgeniy Stepanov <eugeni.stepanov@gmail.com>
+ *
+ * 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 libass; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include <inttypes.h>
+#include <string.h>
+#include <stdlib.h>
+#include <stdarg.h>
+
+#include <ass/ass.h>
+#include <ass/ass_types.h>
+
+#include "mp_msg.h"
+#include "get_path.h"
+#include "ass_mp.h"
+#include "subreader.h"
+
+#ifdef CONFIG_FONTCONFIG
+#include <fontconfig/fontconfig.h>
+#endif
+
+// libass-related command line options
+ASS_Library *ass_library;
+float ass_font_scale = 1.;
+float ass_line_spacing = 0.;
+int ass_top_margin = 0;
+int ass_bottom_margin = 0;
+int use_embedded_fonts = 1;
+char **ass_force_style_list = NULL;
+int ass_use_margins = 0;
+char *ass_color = NULL;
+char *ass_border_color = NULL;
+char *ass_styles_file = NULL;
+int ass_hinting = ASS_HINTING_LIGHT + 4; // light hinting for unscaled osd
+
+#ifdef CONFIG_FONTCONFIG
+extern int font_fontconfig;
+#else
+static int font_fontconfig = -1;
+#endif
+extern char *font_name;
+extern char *sub_font_name;
+extern float text_font_scale_factor;
+extern int subtitle_autoscale;
+
+#ifdef CONFIG_ICONV
+extern char *sub_cp;
+#else
+static char *sub_cp = 0;
+#endif
+
+void process_force_style(ASS_Track *track);
+
+ASS_Track *ass_default_track(ASS_Library *library)
+{
+ ASS_Track *track = ass_new_track(library);
+
+ track->track_type = TRACK_TYPE_ASS;
+ track->Timer = 100.;
+ track->PlayResY = 288;
+ track->WrapStyle = 0;
+
+ if (ass_styles_file)
+ ass_read_styles(track, ass_styles_file, sub_cp);
+
+ if (track->n_styles == 0) {
+ ASS_Style *style;
+ int sid;
+ double fs;
+ uint32_t c1, c2;
+
+ sid = ass_alloc_style(track);
+ style = track->styles + sid;
+ style->Name = strdup("Default");
+ style->FontName = (font_fontconfig >= 0
+ && sub_font_name) ? strdup(sub_font_name)
+ : (font_fontconfig >= 0
+ && font_name) ? strdup(font_name) : strdup("Sans");
+ style->treat_fontname_as_pattern = 1;
+
+ fs = track->PlayResY * text_font_scale_factor / 100.;
+ // approximate autoscale coefficients
+ if (subtitle_autoscale == 2)
+ fs *= 1.3;
+ else if (subtitle_autoscale == 3)
+ fs *= 1.4;
+ style->FontSize = fs;
+
+ if (ass_color)
+ c1 = strtoll(ass_color, NULL, 16);
+ else
+ c1 = 0xFFFF0000;
+ if (ass_border_color)
+ c2 = strtoll(ass_border_color, NULL, 16);
+ else
+ c2 = 0x00000000;
+
+ style->PrimaryColour = c1;
+ style->SecondaryColour = c1;
+ style->OutlineColour = c2;
+ style->BackColour = 0x00000000;
+ style->BorderStyle = 1;
+ style->Alignment = 2;
+ style->Outline = 2;
+ style->MarginL = 10;
+ style->MarginR = 10;
+ style->MarginV = 5;
+ style->ScaleX = 1.;
+ style->ScaleY = 1.;
+ }
+
+ ass_process_force_style(track);
+ return track;
+}
+
+static int check_duplicate_plaintext_event(ASS_Track *track)
+{
+ int i;
+ ASS_Event *evt = track->events + track->n_events - 1;
+
+ for (i = 0; i < track->n_events - 1; ++i) // ignoring last event, it is the one we are comparing with
+ if (track->events[i].Start == evt->Start &&
+ track->events[i].Duration == evt->Duration &&
+ strcmp(track->events[i].Text, evt->Text) == 0)
+ return 1;
+ return 0;
+}
+
+/**
+ * \brief Convert subtitle to ASS_Events for the given track
+ * \param track track
+ * \param sub subtitle to convert
+ * \return event id
+ * note: assumes that subtitle is _not_ fps-based; caller must manually correct
+ * Start and Duration in other case.
+ **/
+int ass_process_subtitle(ASS_Track *track, subtitle *sub)
+{
+ int eid;
+ ASS_Event *event;
+ int len = 0, j;
+ char *p;
+ char *end;
+
+ eid = ass_alloc_event(track);
+ event = track->events + eid;
+
+ event->Start = sub->start * 10;
+ event->Duration = (sub->end - sub->start) * 10;
+ event->Style = 0;
+
+ for (j = 0; j < sub->lines; ++j)
+ len += sub->text[j] ? strlen(sub->text[j]) : 0;
+
+ len += 2 * sub->lines; // '\N', including the one after the last line
+ len += 6; // {\anX}
+ len += 1; // '\0'
+
+ event->Text = malloc(len);
+ end = event->Text + len;
+ p = event->Text;
+
+ if (sub->alignment)
+ p += snprintf(p, end - p, "{\\an%d}", sub->alignment);
+
+ for (j = 0; j < sub->lines; ++j)
+ p += snprintf(p, end - p, "%s\\N", sub->text[j]);
+
+ if (sub->lines > 0)
+ p -= 2; // remove last "\N"
+ *p = 0;
+
+ if (check_duplicate_plaintext_event(track)) {
+ ass_free_event(track, eid);
+ track->n_events--;
+ return -1;
+ }
+
+ mp_msg(MSGT_ASS, MSGL_V,
+ "plaintext event at %" PRId64 ", +%" PRId64 ": %s \n",
+ (int64_t) event->Start, (int64_t) event->Duration, event->Text);
+
+ return eid;
+}
+
+
+/**
+ * \brief Convert subdata to ASS_Track
+ * \param subdata subtitles struct from subreader
+ * \param fps video framerate
+ * \return newly allocated ASS_Track, filled with subtitles from subdata
+ */
+ASS_Track *ass_read_subdata(ASS_Library *library, sub_data *subdata,
+ double fps)
+{
+ ASS_Track *track;
+ int i;
+
+ track = ass_default_track(library);
+ track->name = subdata->filename ? strdup(subdata->filename) : 0;
+
+ for (i = 0; i < subdata->sub_num; ++i) {
+ int eid = ass_process_subtitle(track, subdata->subtitles + i);
+ if (eid < 0)
+ continue;
+ if (!subdata->sub_uses_time) {
+ track->events[eid].Start *= 100. / fps;
+ track->events[eid].Duration *= 100. / fps;
+ }
+ }
+ return track;
+}
+
+void ass_configure(ASS_Renderer *priv, int w, int h, int unscaled)
+{
+ int hinting;
+ ass_set_frame_size(priv, w, h);
+ ass_set_margins(priv, ass_top_margin, ass_bottom_margin, 0, 0);
+ ass_set_use_margins(priv, ass_use_margins);
+ ass_set_font_scale(priv, ass_font_scale);
+ if (!unscaled && (ass_hinting & 4))
+ hinting = 0;
+ else
+ hinting = ass_hinting & 3;
+ ass_set_hinting(priv, hinting);
+ ass_set_line_spacing(priv, ass_line_spacing);
+}
+
+void ass_configure_fonts(ASS_Renderer *priv)
+{
+ char *dir, *path, *family;
+ dir = get_path("fonts");
+ if (font_fontconfig < 0 && sub_font_name)
+ path = strdup(sub_font_name);
+ else if (font_fontconfig < 0 && font_name)
+ path = strdup(font_name);
+ else
+ path = get_path("subfont.ttf");
+ if (font_fontconfig >= 0 && sub_font_name)
+ family = strdup(sub_font_name);
+ else if (font_fontconfig >= 0 && font_name)
+ family = strdup(font_name);
+ else
+ family = 0;
+
+ ass_set_fonts(priv, path, family, font_fontconfig + 1, NULL, 1);
+
+ free(dir);
+ free(path);
+ free(family);
+}
+
+static void message_callback(int level, const char *format, va_list va, void *ctx)
+{
+ mp_msg(MSGT_ASS, level, "[ass] ");
+ mp_msg_va(MSGT_ASS, level, format, va);
+ // libass messages lack trailing \n
+ mp_msg(MSGT_ASS, level, "\n");
+}
+
+ASS_Library *ass_init(void)
+{
+ ASS_Library *priv;
+ char *path = get_path("fonts");
+ priv = ass_library_init();
+ ass_set_message_cb(priv, message_callback, NULL);
+ ass_set_fonts_dir(priv, path);
+ ass_set_extract_fonts(priv, use_embedded_fonts);
+ ass_set_style_overrides(priv, ass_force_style_list);
+ free(path);
+ return priv;
+}
+
+int ass_force_reload = 0; // flag set if global ass-related settings were changed
+
+ASS_Image *ass_mp_render_frame(ASS_Renderer *priv, ASS_Track *track,
+ long long now, int *detect_change)
+{
+ if (ass_force_reload) {
+ ass_set_margins(priv, ass_top_margin, ass_bottom_margin, 0, 0);
+ ass_set_use_margins(priv, ass_use_margins);
+ ass_set_font_scale(priv, ass_font_scale);
+ ass_force_reload = 0;
+ }
+ return ass_render_frame(priv, track, now, detect_change);
+}
diff --git a/ass_mp.h b/ass_mp.h
new file mode 100644
index 0000000000..58ebae0938
--- /dev/null
+++ b/ass_mp.h
@@ -0,0 +1,81 @@
+/*
+ * Copyright (C) 2006 Evgeniy Stepanov <eugeni.stepanov@gmail.com>
+ *
+ * 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 libass; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifndef MPLAYER_ASS_MP_H
+#define MPLAYER_ASS_MP_H
+
+#include <stdint.h>
+
+#include "ass_mp.h"
+
+#include "subreader.h"
+
+#ifdef CONFIG_ASS
+#include <ass/ass.h>
+#include <ass/ass_types.h>
+
+extern ASS_Library *ass_library;
+extern float ass_font_scale;
+extern float ass_line_spacing;
+extern int ass_top_margin;
+extern int ass_bottom_margin;
+extern int use_embedded_fonts;
+extern char **ass_force_style_list;
+extern int ass_use_margins;
+extern char *ass_color;
+extern char *ass_border_color;
+extern char *ass_styles_file;
+extern int ass_hinting;
+
+ASS_Track *ass_default_track(ASS_Library *library);
+int ass_process_subtitle(ASS_Track *track, subtitle *sub);
+ASS_Track *ass_read_subdata(ASS_Library *library, sub_data *subdata,
+ double fps);
+
+void ass_configure(ASS_Renderer *priv, int w, int h, int hinting);
+void ass_configure_fonts(ASS_Renderer *priv);
+ASS_Library *ass_init(void);
+
+extern int ass_force_reload;
+ASS_Image *ass_mp_render_frame(ASS_Renderer *priv, ASS_Track *track,
+ long long now, int *detect_change);
+
+#else /* CONFIG_ASS */
+
+/* Needed for EOSD code using this type to compile */
+
+typedef struct ass_image {
+ int w, h;
+ int stride;
+ unsigned char *bitmap;
+ uint32_t color;
+ int dst_x, dst_y;
+ struct ass_image *next;
+} ASS_Image;
+
+#endif
+
+typedef struct {
+ ASS_Image *imgs;
+ int changed;
+} mp_eosd_images_t;
+
+
+#endif /* MPLAYER_ASS_MP_H */
diff --git a/asxparser.c b/asxparser.c
index 1505e8a625..6005987d87 100644
--- a/asxparser.c
+++ b/asxparser.c
@@ -32,8 +32,6 @@
#include "mp_msg.h"
#include "m_config.h"
-extern m_config_t* mconfig;
-
////// List utils
void
@@ -127,8 +125,10 @@ asx_attrib_to_enum(const char* val,char** valid_vals) {
#define asx_warning_body_parse_error(p,e) mp_msg(MSGT_PLAYTREE,MSGL_WARN,"At line %d : error while parsing %s body",p->line,e)
ASX_Parser_t*
-asx_parser_new(void) {
+asx_parser_new(struct m_config *mconfig)
+{
ASX_Parser_t* parser = calloc(1,sizeof(ASX_Parser_t));
+ parser->mconfig = mconfig;
return parser;
}
@@ -444,7 +444,7 @@ asx_parse_param(ASX_Parser_t* parser, char** attribs, play_tree_t* pt) {
return;
}
val = asx_get_attrib("VALUE",attribs);
- if(m_config_get_option(mconfig,name) == NULL) {
+ if(m_config_get_option(parser->mconfig,name) == NULL) {
mp_msg(MSGT_PLAYTREE,MSGL_WARN,"Found unknown param in asx: %s",name);
if(val)
mp_msg(MSGT_PLAYTREE,MSGL_WARN,"=%s\n",val);
@@ -512,7 +512,7 @@ asx_parse_entryref(ASX_Parser_t* parser,char* buffer,char** _attribs) {
mp_msg(MSGT_PLAYTREE,MSGL_V,"Adding playlist %s to element entryref\n",href);
- ptp = play_tree_parser_new(stream,parser->deep+1);
+ ptp = play_tree_parser_new(stream, parser->mconfig, parser->deep+1);
pt = play_tree_parser_get_play_tree(ptp, 1);
@@ -629,11 +629,11 @@ asx_parse_repeat(ASX_Parser_t* parser,char* buffer,char** _attribs) {
play_tree_t*
-asx_parser_build_tree(char* buffer,int deep) {
+asx_parser_build_tree(struct m_config *mconfig, char* buffer,int deep) {
char *element,*asx_body,**asx_attribs,*body = NULL, **attribs;
int r;
play_tree_t *asx,*entry,*list = NULL;
- ASX_Parser_t* parser = asx_parser_new();
+ ASX_Parser_t* parser = asx_parser_new(mconfig);
parser->line = 1;
parser->deep = deep;
diff --git a/asxparser.h b/asxparser.h
index b300dde0e3..c5a3b18fc7 100644
--- a/asxparser.h
+++ b/asxparser.h
@@ -32,10 +32,12 @@ struct ASX_Parser_t {
int ret_stack_size;
char* last_body;
int deep;
+ struct m_config *mconfig;
};
+struct m_config;
ASX_Parser_t*
-asx_parser_new(void);
+asx_parser_new(struct m_config *mconfig);
void
asx_parser_free(ASX_Parser_t* parser);
diff --git a/av_log.c b/av_log.c
new file mode 100644
index 0000000000..99f6e91a81
--- /dev/null
+++ b/av_log.c
@@ -0,0 +1,111 @@
+/*
+ * av_log to mp_msg converter
+ * Copyright (C) 2006 Michael Niedermayer
+ * Copyright (C) 2009 Uoti Urpala
+ *
+ * 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.
+ */
+
+#include <stdlib.h>
+#include <stdbool.h>
+
+#include "config.h"
+#include "mp_msg.h"
+#include <libavutil/log.h>
+
+#ifdef CONFIG_LIBAVCODEC
+#include <libavcodec/avcodec.h>
+#endif
+
+#ifdef CONFIG_LIBAVFORMAT
+#include <libavformat/avformat.h>
+#endif
+
+static int av_log_level_to_mp_level(int av_level)
+{
+ if (av_level > AV_LOG_INFO)
+ return MSGL_V;
+ if (av_level > AV_LOG_WARNING)
+ return MSGL_INFO;
+ if (av_level > AV_LOG_ERROR)
+ return MSGL_WARN;
+ if (av_level > AV_LOG_FATAL)
+ return MSGL_ERR;
+ return MSGL_FATAL;
+}
+
+static int extract_msg_type_from_ctx(void *ptr)
+{
+ if (!ptr)
+ return MSGT_FIXME;
+
+ AVClass *avc = *(AVClass **)ptr;
+
+#ifdef CONFIG_LIBAVCODEC
+ if (!strcmp(avc->class_name, "AVCodecContext")) {
+ AVCodecContext *s = ptr;
+ if (s->codec) {
+ if (s->codec->type == CODEC_TYPE_AUDIO) {
+ if (s->codec->decode)
+ return MSGT_DECAUDIO;
+ } else if (s->codec->type == CODEC_TYPE_VIDEO) {
+ if (s->codec->decode)
+ return MSGT_DECVIDEO;
+ }
+ // FIXME subtitles, encoders
+ // What msgt for them? There is nothing appropriate...
+ }
+ return MSGT_FIXME;
+ }
+#endif
+
+#ifdef CONFIG_LIBAVFORMAT
+ if (!strcmp(avc->class_name, "AVFormatContext")) {
+ AVFormatContext *s = ptr;
+ if (s->iformat)
+ return MSGT_DEMUXER;
+ else if (s->oformat)
+ return MSGT_MUXER;
+ return MSGT_FIXME;
+ }
+#endif
+
+ return MSGT_FIXME;
+}
+
+static void mp_msg_av_log_callback(void *ptr, int level, const char *fmt,
+ va_list vl)
+{
+ static bool print_prefix = 1;
+ AVClass *avc = ptr ? *(AVClass **)ptr : NULL;
+ int mp_level = av_log_level_to_mp_level(level);
+ int type = extract_msg_type_from_ctx(ptr);
+
+ if (!mp_msg_test(type, mp_level))
+ return;
+
+ if (print_prefix && avc)
+ mp_msg(type, mp_level, "[%s @ %p]", avc->item_name(ptr), avc);
+ print_prefix = fmt[strlen(fmt) - 1] == '\n';
+
+ mp_msg_va(type, mp_level, fmt, vl);
+}
+
+void set_av_log_callback(void)
+{
+ av_log_set_callback(mp_msg_av_log_callback);
+}
diff --git a/av_log.h b/av_log.h
new file mode 100644
index 0000000000..baffb276ce
--- /dev/null
+++ b/av_log.h
@@ -0,0 +1 @@
+void set_av_log_callback(void);
diff --git a/av_opts.c b/av_opts.c
index 2d708ebddc..452253b4de 100644
--- a/av_opts.c
+++ b/av_opts.c
@@ -21,6 +21,7 @@
#include <stdlib.h>
#include <string.h>
+#include "av_opts.h"
#include "libavcodec/opt.h"
int parse_avopts(void *v, char *str){
diff --git a/cfg-common-opts.h b/cfg-common-opts.h
index dd9b691002..7a32b2101a 100644
--- a/cfg-common-opts.h
+++ b/cfg-common-opts.h
@@ -16,19 +16,12 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-#ifndef MPLAYER_CFG_COMMON_OPTS_H
-#define MPLAYER_CFG_COMMON_OPTS_H
-
-#include "config.h"
-
-#include "osdep/priority.h"
-
// ------------------------- common options --------------------
{"quiet", &quiet, CONF_TYPE_FLAG, CONF_GLOBAL, 0, 1, NULL},
{"noquiet", &quiet, CONF_TYPE_FLAG, CONF_GLOBAL, 1, 0, NULL},
{"really-quiet", &verbose, CONF_TYPE_FLAG, CONF_GLOBAL|CONF_PRE_PARSE, 0, -10, NULL},
{"v", cfg_inc_verbose, CONF_TYPE_FUNC, CONF_GLOBAL|CONF_NOSAVE, 0, 0, NULL},
- {"msglevel", msgl_config, CONF_TYPE_SUBCONFIG, CONF_GLOBAL, 0, 0, NULL},
+ {"msglevel", (void *) msgl_config, CONF_TYPE_SUBCONFIG, CONF_GLOBAL, 0, 0, NULL},
{"msgcolor", &mp_msg_color, CONF_TYPE_FLAG, CONF_GLOBAL, 0, 1, NULL},
{"nomsgcolor", &mp_msg_color, CONF_TYPE_FLAG, CONF_GLOBAL, 1, 0, NULL},
{"msgmodule", &mp_msg_module, CONF_TYPE_FLAG, CONF_GLOBAL, 0, 1, NULL},
@@ -36,11 +29,10 @@
#ifdef CONFIG_ICONV
{"msgcharset", &mp_msg_charset, CONF_TYPE_STRING, CONF_GLOBAL, 0, 0, NULL},
#endif
- {"include", cfg_include, CONF_TYPE_FUNC_PARAM, CONF_NOSAVE, 0, 0, NULL},
#ifdef CONFIG_PRIORITY
{"priority", &proc_priority, CONF_TYPE_STRING, 0, 0, 0, NULL},
#endif
- {"noconfig", noconfig_opts, CONF_TYPE_SUBCONFIG, CONF_GLOBAL|CONF_NOCFG|CONF_PRE_PARSE, 0, 0, NULL},
+ {"noconfig", (void *) noconfig_opts, CONF_TYPE_SUBCONFIG, CONF_GLOBAL|CONF_NOCFG|CONF_PRE_PARSE, 0, 0, NULL},
// ------------------------- stream options --------------------
@@ -66,6 +58,7 @@
{"dvd-speed", "MPlayer was compiled without libdvdread support.\n", CONF_TYPE_PRINT, 0, 0, 0, NULL},
{"dvd", "MPlayer was compiled without libdvdread support.\n", CONF_TYPE_PRINT, CONF_NOCFG, 0, 0, NULL},
#endif /* CONFIG_DVDREAD */
+ OPT_INTRANGE("edition", edition_id, 0, -1, 8190),
{"alang", &audio_lang, CONF_TYPE_STRING, 0, 0, 0, NULL},
{"slang", &dvdsub_lang, CONF_TYPE_STRING, 0, 0, 0, NULL},
@@ -146,12 +139,12 @@
{"loadidx", &index_file_load, CONF_TYPE_STRING, 0, 0, 0, NULL},
// select audio/video/subtitle stream
- {"aid", &audio_id, CONF_TYPE_INT, CONF_RANGE, -2, 8190, NULL},
+ OPT_INTRANGE("aid", audio_id, 0, -2, 8190),
{"ausid", &audio_substream_id, CONF_TYPE_INT, 0, 0, 0, NULL},
- {"vid", &video_id, CONF_TYPE_INT, CONF_RANGE, -2, 8190, NULL},
- {"sid", &dvdsub_id, CONF_TYPE_INT, CONF_RANGE, -2, 8190, NULL},
- {"nosub", &dvdsub_id, CONF_TYPE_FLAG, 0, -1, -2, NULL},
- {"novideo", &video_id, CONF_TYPE_FLAG, 0, -1, -2, NULL},
+ OPT_INTRANGE("vid", video_id, 0, -2, 8190),
+ OPT_INTRANGE("sid", sub_id, 0, -2, 8190),
+ OPT_FLAG_CONSTANTS("nosub", sub_id, 0, -1, -2),
+ OPT_FLAG_CONSTANTS("novideo", video_id, 0, -1, -2),
{ "hr-mp3-seek", &hr_mp3_seek, CONF_TYPE_FLAG, 0, 0, 1, NULL },
{ "nohr-mp3-seek", &hr_mp3_seek, CONF_TYPE_FLAG, 0, 1, 0, NULL},
@@ -173,25 +166,25 @@
{ "extbased", &extension_parsing, CONF_TYPE_FLAG, 0, 0, 1, NULL },
{ "noextbased", &extension_parsing, CONF_TYPE_FLAG, 0, 1, 0, NULL },
- {"mf", mfopts_conf, CONF_TYPE_SUBCONFIG, 0,0,0, NULL},
+ {"mf", (void *) mfopts_conf, CONF_TYPE_SUBCONFIG, 0,0,0, NULL},
#ifdef CONFIG_RADIO
{"radio", radioopts_conf, CONF_TYPE_SUBCONFIG, 0, 0, 0, NULL},
#else
{"radio", "MPlayer was compiled without Radio interface support.\n", CONF_TYPE_PRINT, 0, 0, 0, NULL},
#endif /* CONFIG_RADIO */
#ifdef CONFIG_TV
- {"tv", tvopts_conf, CONF_TYPE_SUBCONFIG, 0, 0, 0, NULL},
+ {"tv", (void *) tvopts_conf, CONF_TYPE_SUBCONFIG, 0, 0, 0, NULL},
#else
{"tv", "MPlayer was compiled without TV interface support.\n", CONF_TYPE_PRINT, 0, 0, 0, NULL},
#endif /* CONFIG_TV */
#ifdef CONFIG_PVR
- {"pvr", pvropts_conf, CONF_TYPE_SUBCONFIG, 0, 0, 0, NULL},
+ {"pvr", (void *) pvropts_conf, CONF_TYPE_SUBCONFIG, 0, 0, 0, NULL},
#else
{"pvr", "MPlayer was compiled without V4L2/PVR interface support.\n", CONF_TYPE_PRINT, 0, 0, 0, NULL},
#endif /* CONFIG_PVR */
- {"vivo", vivoopts_conf, CONF_TYPE_SUBCONFIG, 0, 0, 0, NULL},
+ {"vivo", (void *) vivoopts_conf, CONF_TYPE_SUBCONFIG, 0, 0, 0, NULL},
#ifdef CONFIG_DVBIN
- {"dvbin", dvbin_opts_conf, CONF_TYPE_SUBCONFIG, 0, 0, 0, NULL},
+ {"dvbin", (void *) dvbin_opts_conf, CONF_TYPE_SUBCONFIG, 0, 0, 0, NULL},
#endif
// ------------------------- a-v sync options --------------------
@@ -208,7 +201,7 @@
{"srate", &force_srate, CONF_TYPE_INT, CONF_RANGE, 1000, 8*48000, NULL},
{"channels", &audio_output_channels, CONF_TYPE_INT, CONF_RANGE, 1, 8, NULL},
{"format", &audio_output_format, CONF_TYPE_AFMT, 0, 0, 0, NULL},
- {"speed", &playback_speed, CONF_TYPE_FLOAT, CONF_RANGE, 0.01, 100.0, NULL},
+ OPT_FLOATRANGE("speed", playback_speed, 0, 0.01, 100.0),
// set a-v distance
{"delay", &audio_delay, CONF_TYPE_FLOAT, CONF_RANGE, -100.0, 100.0, NULL},
@@ -229,14 +222,14 @@
#endif
// disable audio
- {"sound", &audio_id, CONF_TYPE_FLAG, 0, -2, -1, NULL},
- {"nosound", &audio_id, CONF_TYPE_FLAG, 0, -1, -2, NULL},
+ OPT_FLAG_CONSTANTS("sound", audio_id, 0, -2, -1),
+ OPT_FLAG_CONSTANTS("nosound", audio_id, 0, -1, -2),
{"af*", &af_cfg.list, CONF_TYPE_STRING_LIST, 0, 0, 0, NULL},
- {"af-adv", audio_filter_conf, CONF_TYPE_SUBCONFIG, 0, 0, 0, NULL},
+ {"af-adv", (void *) audio_filter_conf, CONF_TYPE_SUBCONFIG, 0, 0, 0, NULL},
{"vop", "-vop has been removed, use -vf instead.\n", CONF_TYPE_PRINT, CONF_NOCFG ,0,0, NULL},
- {"vf*", &vf_settings, CONF_TYPE_OBJ_SETTINGS_LIST, 0, 0, 0, &vf_obj_list},
+ OPT_SETTINGSLIST("vf*", vf_settings, 0, &vf_obj_list),
// select audio/video codec (by name) or codec family (by number):
// {"afm", &audio_family, CONF_TYPE_INT, CONF_MIN, 0, 22, NULL}, // keep ranges in sync
// {"vfm", &video_family, CONF_TYPE_INT, CONF_MIN, 0, 29, NULL}, // with codec-cfg.c
@@ -257,15 +250,15 @@
// scaling:
{"sws", &sws_flags, CONF_TYPE_INT, 0, 0, 2, NULL},
- {"ssf", scaler_filter_conf, CONF_TYPE_SUBCONFIG, 0, 0, 0, NULL},
- {"zoom", &softzoom, CONF_TYPE_FLAG, 0, 0, 1, NULL},
- {"nozoom", &softzoom, CONF_TYPE_FLAG, 0, 1, 0, NULL},
- {"aspect", &movie_aspect, CONF_TYPE_FLOAT, CONF_RANGE, 0.2, 3.0, NULL},
- {"noaspect", &movie_aspect, CONF_TYPE_FLAG, 0, 0, 0, NULL},
- {"xy", &screen_size_xy, CONF_TYPE_FLOAT, CONF_RANGE, 0.001, 4096, NULL},
-
- {"flip", &flip, CONF_TYPE_FLAG, 0, -1, 1, NULL},
- {"noflip", &flip, CONF_TYPE_FLAG, 0, -1, 0, NULL},
+ {"ssf", (void *) scaler_filter_conf, CONF_TYPE_SUBCONFIG, 0, 0, 0, NULL},
+ OPT_FLAG_ON("zoom", softzoom, 0),
+ OPT_FLAG_OFF("nozoom", softzoom, 0),
+ OPT_FLOATRANGE("aspect", movie_aspect, 0, 0.2, 3.0),
+ OPT_FLAG_CONSTANTS("noaspect", movie_aspect, 0, 0, 0),
+ OPT_FLOATRANGE("xy", screen_size_xy, 0, 0.001, 4096),
+
+ OPT_FLAG_CONSTANTS("flip", flip, 0, -1, 1),
+ OPT_FLAG_CONSTANTS("noflip", flip, 0, -1, 0),
{"tsfastparse", "-tsfastparse is no longer a valid option.\n", CONF_TYPE_PRINT, CONF_NOCFG ,0,0, NULL
},
{"tsprog", &ts_prog, CONF_TYPE_INT, CONF_RANGE, 0, 65534, NULL},
@@ -275,15 +268,15 @@
{"tskeepbroken", &ts_keep_broken, CONF_TYPE_FLAG, 0, 0, 1, NULL},
// draw by slices or whole frame (useful with libmpeg2/libavcodec)
- {"slices", &vd_use_slices, CONF_TYPE_FLAG, 0, 0, 1, NULL},
- {"noslices", &vd_use_slices, CONF_TYPE_FLAG, 0, 1, 0, NULL},
+ OPT_FLAG_ON("slices", vd_use_slices, 0),
+ OPT_FLAG_OFF("noslices", vd_use_slices, 0),
{"field-dominance", &field_dominance, CONF_TYPE_INT, CONF_RANGE, -1, 1, NULL},
#ifdef CONFIG_LIBAVCODEC
- {"lavdopts", lavc_decode_opts_conf, CONF_TYPE_SUBCONFIG, 0, 0, 0, NULL},
+ {"lavdopts", (void *) lavc_decode_opts_conf, CONF_TYPE_SUBCONFIG, 0, 0, 0, NULL},
#endif
#ifdef CONFIG_LIBAVFORMAT
- {"lavfdopts", lavfdopts_conf, CONF_TYPE_SUBCONFIG, CONF_GLOBAL, 0, 0, NULL},
+ {"lavfdopts", (void *) lavfdopts_conf, CONF_TYPE_SUBCONFIG, CONF_GLOBAL, 0, 0, NULL},
#endif
#ifdef CONFIG_XVID4
{"xvidopts", xvid_dec_opts, CONF_TYPE_SUBCONFIG, 0, 0, 0, NULL},
@@ -346,16 +339,16 @@
{"subfont-autoscale", &subtitle_autoscale, CONF_TYPE_INT, CONF_RANGE, 0, 3, NULL},
#endif
#ifdef CONFIG_ASS
- {"ass", &ass_enabled, CONF_TYPE_FLAG, 0, 0, 1, NULL},
- {"noass", &ass_enabled, CONF_TYPE_FLAG, 0, 1, 0, NULL},
+ OPT_FLAG_ON("ass", ass_enabled, 0),
+ OPT_FLAG_OFF("noass", ass_enabled, 0),
{"ass-font-scale", &ass_font_scale, CONF_TYPE_FLOAT, CONF_RANGE, 0, 100, NULL},
{"ass-line-spacing", &ass_line_spacing, CONF_TYPE_FLOAT, CONF_RANGE, -1000, 1000, NULL},
{"ass-top-margin", &ass_top_margin, CONF_TYPE_INT, CONF_RANGE, 0, 2000, NULL},
{"ass-bottom-margin", &ass_bottom_margin, CONF_TYPE_INT, CONF_RANGE, 0, 2000, NULL},
{"ass-use-margins", &ass_use_margins, CONF_TYPE_FLAG, 0, 0, 1, NULL},
{"noass-use-margins", &ass_use_margins, CONF_TYPE_FLAG, 0, 1, 0, NULL},
- {"embeddedfonts", &extract_embedded_fonts, CONF_TYPE_FLAG, 0, 0, 1, NULL},
- {"noembeddedfonts", &extract_embedded_fonts, CONF_TYPE_FLAG, 0, 1, 0, NULL},
+ {"embeddedfonts", &use_embedded_fonts, CONF_TYPE_FLAG, 0, 0, 1, NULL},
+ {"noembeddedfonts", &use_embedded_fonts, CONF_TYPE_FLAG, 0, 1, 0, NULL},
{"ass-force-style", &ass_force_style_list, CONF_TYPE_STRING_LIST, 0, 0, 0, NULL},
{"ass-color", &ass_color, CONF_TYPE_STRING, 0, 0, 0, NULL},
{"ass-border-color", &ass_border_color, CONF_TYPE_STRING, 0, 0, 0, NULL},
@@ -369,5 +362,3 @@
{"fontconfig", "MPlayer was compiled without fontconfig support.\n", CONF_TYPE_PRINT, CONF_NOCFG, 0, 0, NULL},
{"nofontconfig", "MPlayer was compiled without fontconfig support.\n", CONF_TYPE_PRINT, CONF_NOCFG, 0, 0, NULL},
#endif /* CONFIG_FONTCONFIG */
-
-#endif /* MPLAYER_CFG_COMMON_OPTS_H */
diff --git a/cfg-common.h b/cfg-common.h
index db167d2f27..e4f3af7efd 100644
--- a/cfg-common.h
+++ b/cfg-common.h
@@ -28,12 +28,6 @@ extern char *mp_msg_charset;
extern int mp_msg_color;
extern int mp_msg_module;
-// codec/filter opts: (defined at libmpcodecs/vd.c)
-extern float screen_size_xy;
-extern float movie_aspect;
-extern int softzoom;
-extern int flip;
-
/* defined in codec-cfg.c */
extern char * codecs_file;
@@ -245,7 +239,6 @@ extern int mf_w;
extern int mf_h;
extern double mf_fps;
extern char * mf_type;
-extern m_obj_settings_t* vf_settings;
extern m_obj_list_t vf_obj_list;
const m_option_t mfopts_conf[]={
@@ -273,7 +266,6 @@ const m_option_t msgl_config[]={
{ "global", &mp_msg_levels[MSGT_GLOBAL], CONF_TYPE_INT, CONF_RANGE, -1, 9, NULL },
{ "cplayer", &mp_msg_levels[MSGT_CPLAYER], CONF_TYPE_INT, CONF_RANGE, -1, 9, NULL },
- { "gplayer", &mp_msg_levels[MSGT_GPLAYER], CONF_TYPE_INT, CONF_RANGE, -1, 9, NULL },
{ "vo", &mp_msg_levels[MSGT_VO], CONF_TYPE_INT, CONF_RANGE, -1, 9, NULL },
{ "ao", &mp_msg_levels[MSGT_AO], CONF_TYPE_INT, CONF_RANGE, -1, 9, NULL },
{ "demuxer", &mp_msg_levels[MSGT_DEMUXER], CONF_TYPE_INT, CONF_RANGE, -1, 9, NULL },
@@ -319,7 +311,6 @@ const m_option_t msgl_config[]={
{"help", "Available msg modules:\n"
" global - common player errors/information\n"
" cplayer - console player (mplayer.c)\n"
- " gplayer - gui player\n"
" vo - libvo\n"
" ao - libao\n"
" demuxer - demuxer.c (general stuff)\n"
diff --git a/cfg-mencoder.h b/cfg-mencoder.h
index d58f87b4d3..4d390bfdcc 100644
--- a/cfg-mencoder.h
+++ b/cfg-mencoder.h
@@ -202,11 +202,11 @@ const m_option_t mencoder_opts[]={
{"xsize", "-xsize has been removed, use -vf crop=w:h:x:y for cropping.\n", CONF_TYPE_PRINT, CONF_NOCFG, 0, 0, NULL},
// output audio/video codec selection
- {"oac", oac_conf, CONF_TYPE_SUBCONFIG, CONF_GLOBAL, 0, 0, NULL},
- {"ovc", ovc_conf, CONF_TYPE_SUBCONFIG, CONF_GLOBAL, 0, 0, NULL},
+ {"oac", (void *) oac_conf, CONF_TYPE_SUBCONFIG, CONF_GLOBAL, 0, 0, NULL},
+ {"ovc", (void *) ovc_conf, CONF_TYPE_SUBCONFIG, CONF_GLOBAL, 0, 0, NULL},
// output file format
- {"of", of_conf, CONF_TYPE_SUBCONFIG, CONF_GLOBAL, 0, 0, NULL},
+ {"of", (void *) of_conf, CONF_TYPE_SUBCONFIG, CONF_GLOBAL, 0, 0, NULL},
// override audio format tag in output file
{"fafmttag", &force_audiofmttag, CONF_TYPE_INT, CONF_GLOBAL, 0, 0, NULL},
@@ -233,7 +233,7 @@ const m_option_t mencoder_opts[]={
{"noodml", &write_odml, CONF_TYPE_FLAG, CONF_GLOBAL, 1, 0, NULL},
// info header strings
- {"info", info_conf, CONF_TYPE_SUBCONFIG, CONF_GLOBAL, 0, 0, NULL},
+ {"info", (void *) info_conf, CONF_TYPE_SUBCONFIG, CONF_GLOBAL, 0, 0, NULL},
#ifdef CONFIG_MP3LAME
{"lameopts", lameopts_conf, CONF_TYPE_SUBCONFIG, CONF_GLOBAL, 0, 0, NULL},
diff --git a/cfg-mplayer.h b/cfg-mplayer.h
index 4eb42a3adf..d8170ec9e7 100644
--- a/cfg-mplayer.h
+++ b/cfg-mplayer.h
@@ -23,10 +23,10 @@
* config for cfgparser
*/
-#include "cfg-common.h"
+#include <stddef.h>
-extern int key_fifo_size;
-extern unsigned doubleclick_time;
+#include "cfg-common.h"
+#include "options.h"
extern char *fb_mode_cfgfile;
extern char *fb_mode_name;
@@ -34,15 +34,9 @@ extern char *dfb_params;
extern char *lirc_configfile;
-extern float vo_panscanrange;
/* only used at startup (setting these values from configfile) */
extern char *vo_geometry;
-extern int opt_screen_size_x;
-extern int opt_screen_size_y;
-extern int fullscreen;
-extern int vidmode;
-
extern char *ao_outputfilename;
extern int ao_pcm_waveheader;
@@ -63,14 +57,6 @@ void vo_zr_revertoption(const m_option_t* opt,char* pram);
extern m_option_t dxr2_opts[];
-extern char * skinName;
-extern int guiWinID;
-
-
-/* from libvo/aspect.c */
-extern float force_monitor_aspect;
-extern float monitor_pixel_aspect;
-
extern int sws_flags;
int readPPOpt(void *conf, char *arg);
void revertPPOpt(void *conf, char* opt);
@@ -108,12 +94,12 @@ const m_option_t mplayer_opts[]={
//---------------------- libao/libvo options ------------------------
{"o", "Option -o has been renamed to -vo (video-out), use -vo.\n",
CONF_TYPE_PRINT, CONF_NOCFG, 0, 0, NULL},
- {"vo", &video_driver_list, CONF_TYPE_STRING_LIST, 0, 0, 0, NULL},
- {"ao", &audio_driver_list, CONF_TYPE_STRING_LIST, 0, 0, 0, NULL},
- {"fixed-vo", &fixed_vo, CONF_TYPE_FLAG,CONF_GLOBAL , 0, 1, NULL},
- {"nofixed-vo", &fixed_vo, CONF_TYPE_FLAG,CONF_GLOBAL, 1, 0, NULL},
- {"ontop", &vo_ontop, CONF_TYPE_FLAG, 0, 0, 1, NULL},
- {"noontop", &vo_ontop, CONF_TYPE_FLAG, 0, 1, 0, NULL},
+ OPT_STRINGLIST("vo", video_driver_list, 0),
+ OPT_STRINGLIST("ao", audio_driver_list, 0),
+ OPT_FLAG_ON("fixed-vo", fixed_vo, CONF_GLOBAL),
+ OPT_FLAG_OFF("nofixed-vo", fixed_vo, CONF_GLOBAL),
+ OPT_FLAG_ON("ontop", vo_ontop, 0),
+ OPT_FLAG_OFF("noontop", vo_ontop, 0),
{"rootwin", &vo_rootwin, CONF_TYPE_FLAG, 0, 0, 1, NULL},
{"border", &vo_border, CONF_TYPE_FLAG, 0, 0, 1, NULL},
{"noborder", &vo_border, CONF_TYPE_FLAG, 0, 1, 0, NULL},
@@ -181,30 +167,32 @@ const m_option_t mplayer_opts[]={
#endif
// force window width/height or resolution (with -vm)
- {"x", &opt_screen_size_x, CONF_TYPE_INT, CONF_RANGE, 0, 4096, NULL},
- {"y", &opt_screen_size_y, CONF_TYPE_INT, CONF_RANGE, 0, 4096, NULL},
+ OPT_INTRANGE("x", screen_size_x, 0, 0, 4096),
+ OPT_INTRANGE("y", screen_size_y, 0, 0, 4096),
// set screen dimensions (when not detectable or virtual!=visible)
- {"screenw", &vo_screenwidth, CONF_TYPE_INT, CONF_RANGE|CONF_OLD, 0, 4096, NULL},
- {"screenh", &vo_screenheight, CONF_TYPE_INT, CONF_RANGE|CONF_OLD, 0, 4096, NULL},
+ OPT_INTRANGE("screenw", vo_screenwidth, CONF_OLD, 0, 4096),
+ OPT_INTRANGE("screenh", vo_screenheight, CONF_OLD, 0, 4096),
// Geometry string
{"geometry", &vo_geometry, CONF_TYPE_STRING, 0, 0, 0, NULL},
+ OPT_FLAG_ON("force-window-position", force_window_position, 0),
+ OPT_FLAG_OFF("noforce-window-position", force_window_position, 0),
// vo name (X classname) and window title strings
{"name", &vo_winname, CONF_TYPE_STRING, 0, 0, 0, NULL},
{"title", &vo_wintitle, CONF_TYPE_STRING, 0, 0, 0, NULL},
// set aspect ratio of monitor - useful for 16:9 TV-out
- {"monitoraspect", &force_monitor_aspect, CONF_TYPE_FLOAT, CONF_RANGE, 0.0, 9.0, NULL},
- {"monitorpixelaspect", &monitor_pixel_aspect, CONF_TYPE_FLOAT, CONF_RANGE, 0.2, 9.0, NULL},
+ OPT_FLOATRANGE("monitoraspect", force_monitor_aspect, 0, 0.0, 9.0),
+ OPT_FLOATRANGE("monitorpixelaspect", monitor_pixel_aspect, 0, 0.2, 9.0),
// video mode switching: (x11,xv,dga)
- {"vm", &vidmode, CONF_TYPE_FLAG, 0, 0, 1, NULL},
- {"novm", &vidmode, CONF_TYPE_FLAG, 0, 1, 0, NULL},
+ OPT_FLAG_ON("vm", vidmode, 0),
+ OPT_FLAG_OFF("novm", vidmode, 0),
// start in fullscreen mode:
- {"fs", &fullscreen, CONF_TYPE_FLAG, 0, 0, 1, NULL},
- {"nofs", &fullscreen, CONF_TYPE_FLAG, 0, 1, 0, NULL},
+ OPT_FLAG_ON("fs", fullscreen, 0),
+ OPT_FLAG_OFF("nofs", fullscreen, 0),
// set fullscreen switch method (workaround for buggy WMs)
{"fsmode", "-fsmode is obsolete, avoid it and use -fstype instead.\nIf you really want it, try -fsmode-dontuse, but don't report bugs!\n", CONF_TYPE_PRINT, CONF_RANGE, 0, 31, NULL},
{"fsmode-dontuse", &vo_fsmode, CONF_TYPE_INT, CONF_RANGE, 0, 31, NULL},
// set bpp (x11+vm, dga, fbdev, vesa, svga?)
- {"bpp", &vo_dbpp, CONF_TYPE_INT, CONF_RANGE, 0, 32, NULL},
+ OPT_INTRANGE("bpp", vo_dbpp, 0, 0, 32),
{"colorkey", &vo_colorkey, CONF_TYPE_INT, 0, 0, 0, NULL},
{"nocolorkey", &vo_colorkey, CONF_TYPE_FLAG, 0, 0, 0x1000000, NULL},
{"double", &vo_doublebuffering, CONF_TYPE_FLAG, 0, 0, 1, NULL},
@@ -213,7 +201,7 @@ const m_option_t mplayer_opts[]={
{"vsync", &vo_vsync, CONF_TYPE_FLAG, 0, 0, 1, NULL},
{"novsync", &vo_vsync, CONF_TYPE_FLAG, 0, 1, 0, NULL},
{"panscan", &vo_panscan, CONF_TYPE_FLOAT, CONF_RANGE, -1.0, 1.0, NULL},
- {"panscanrange", &vo_panscanrange, CONF_TYPE_FLOAT, CONF_RANGE, -19.0, 99.0, NULL},
+ OPT_FLOATRANGE("panscanrange", vo_panscanrange, 0, -19.0, 99.0),
{"grabpointer", &vo_grabpointer, CONF_TYPE_FLAG, 0, 0, 1, NULL},
{"nograbpointer", &vo_grabpointer, CONF_TYPE_FLAG, 0, 1, 0, NULL},
@@ -235,10 +223,10 @@ const m_option_t mplayer_opts[]={
{"xineramascreen", &xinerama_screen, CONF_TYPE_INT, CONF_RANGE, -2, 32, NULL},
- {"brightness",&vo_gamma_brightness, CONF_TYPE_INT, CONF_RANGE, -100, 100, NULL},
- {"saturation",&vo_gamma_saturation, CONF_TYPE_INT, CONF_RANGE, -100, 100, NULL},
- {"contrast",&vo_gamma_contrast, CONF_TYPE_INT, CONF_RANGE, -100, 100, NULL},
- {"hue",&vo_gamma_hue, CONF_TYPE_INT, CONF_RANGE, -100, 100, NULL},
+ OPT_INTRANGE("brightness", vo_gamma_brightness, 0, -100, 100),
+ OPT_INTRANGE("saturation", vo_gamma_saturation, 0, -100, 100),
+ OPT_INTRANGE("contrast", vo_gamma_contrast, 0, -100, 100),
+ OPT_INTRANGE("hue", vo_gamma_hue, 0, -100, 100),
{"keepaspect", &vo_keepaspect, CONF_TYPE_FLAG, 0, 0, 1, NULL},
{"nokeepaspect", &vo_keepaspect, CONF_TYPE_FLAG, 0, 1, 0, NULL},
@@ -273,8 +261,8 @@ const m_option_t mplayer_opts[]={
{"crash-debug", &crash_debug, CONF_TYPE_FLAG, CONF_GLOBAL, 0, 1, NULL},
{"nocrash-debug", &crash_debug, CONF_TYPE_FLAG, CONF_GLOBAL, 1, 0, NULL},
#endif
- {"osdlevel", &osd_level, CONF_TYPE_INT, CONF_RANGE, 0, 3, NULL},
- {"osd-duration", &osd_duration, CONF_TYPE_INT, CONF_MIN, 0, 0, NULL},
+ OPT_INTRANGE("osdlevel", osd_level, 0, 0, 3),
+ OPT_INTRANGE("osd-duration", osd_duration, 0, 0, 3600000),
#ifdef CONFIG_MENU
{"menu", &use_menu, CONF_TYPE_FLAG, CONF_GLOBAL, 0, 1, NULL},
{"nomenu", &use_menu, CONF_TYPE_FLAG, CONF_GLOBAL, 1, 0, NULL},
@@ -328,23 +316,21 @@ const m_option_t mplayer_opts[]={
{"lircconf", &lirc_configfile, CONF_TYPE_STRING, CONF_GLOBAL, 0, 0, NULL},
#endif
- {"gui", "The -gui option will only work as the first command line argument.\n", CONF_TYPE_PRINT, 0, 0, 0, (void *)1},
- {"nogui", "The -nogui option will only work as the first command line argument.\n", CONF_TYPE_PRINT, 0, 0, 0, (void *)1},
-
-#ifdef CONFIG_GUI
- {"skin", &skinName, CONF_TYPE_STRING, CONF_GLOBAL, 0, 0, NULL},
- {"enqueue", &enqueue, CONF_TYPE_FLAG, 0, 0, 1, NULL},
- {"noenqueue", &enqueue, CONF_TYPE_FLAG, 0, 1, 0, NULL},
- {"guiwid", &guiWinID, CONF_TYPE_INT, 0, 0, 0, NULL},
-#endif
+ // these should be removed when gmplayer is forgotten
+ {"gui", "Internal GUI was removed. Use some other frontend instead.\n", CONF_TYPE_PRINT, 0, 0, 0, NULL},
+ {"nogui", "Internal GUI was removed, -nogui is no longer valid.\n", CONF_TYPE_PRINT, 0, 0, 0, NULL},
- {"noloop", &mpctx_s.loop_times, CONF_TYPE_FLAG, 0, 0, -1, NULL},
- {"loop", &mpctx_s.loop_times, CONF_TYPE_INT, CONF_RANGE, -1, 10000, NULL},
+ OPT_FLAG_CONSTANTS("noloop", loop_times, 0, 0, -1),
+ OPT_INTRANGE("loop", loop_times, 0, -1, 10000),
{"playlist", NULL, CONF_TYPE_STRING, 0, 0, 0, NULL},
+ OPT_FLAG_ON("ordered-chapters", ordered_chapters, 0),
+ OPT_FLAG_OFF("noordered-chapters", ordered_chapters, 0),
+
// a-v sync stuff:
- {"correct-pts", &user_correct_pts, CONF_TYPE_FLAG, 0, 0, 1, NULL},
- {"nocorrect-pts", &user_correct_pts, CONF_TYPE_FLAG, 0, 1, 0, NULL},
+ OPT_FLAG_ON("correct-pts", user_correct_pts, 0),
+ OPT_FLAG_OFF("nocorrect-pts", user_correct_pts, 0),
+ OPT_INTRANGE("pts-association-mode", user_pts_assoc_mode, 0, 0, 2),
{"noautosync", &autosync, CONF_TYPE_FLAG, 0, 0, -1, NULL},
{"autosync", &autosync, CONF_TYPE_INT, CONF_RANGE, 0, 10000, NULL},
// {"dapsync", &dapsync, CONF_TYPE_FLAG, 0, 0, 1, NULL},
@@ -366,14 +352,14 @@ const m_option_t mplayer_opts[]={
{"idle", &player_idle_mode, CONF_TYPE_FLAG,CONF_GLOBAL , 0, 1, NULL},
{"noidle", &player_idle_mode, CONF_TYPE_FLAG,CONF_GLOBAL , 1, 0, NULL},
{"use-stdin", "-use-stdin has been renamed to -noconsolecontrols, use that instead.", CONF_TYPE_PRINT, 0, 0, 0, NULL},
- {"key-fifo-size", &key_fifo_size, CONF_TYPE_INT, CONF_RANGE, 2, 65000, NULL},
+ OPT_INTRANGE("key-fifo-size", key_fifo_size, CONF_GLOBAL, 2, 65000),
{"noconsolecontrols", &noconsolecontrols, CONF_TYPE_FLAG, CONF_GLOBAL, 0, 1, NULL},
{"consolecontrols", &noconsolecontrols, CONF_TYPE_FLAG, CONF_GLOBAL, 1, 0, NULL},
{"mouse-movements", &enable_mouse_movements, CONF_TYPE_FLAG, CONF_GLOBAL, 0, 1, NULL},
{"nomouse-movements", &enable_mouse_movements, CONF_TYPE_FLAG, CONF_GLOBAL, 1, 0, NULL},
- {"doubleclick-time", &doubleclick_time, CONF_TYPE_INT, CONF_RANGE, 0, 1000, NULL},
+ OPT_INTRANGE("doubleclick-time", doubleclick_time, 0, 0, 1000),
#ifdef CONFIG_TV
- {"tvscan", tvscan_conf, CONF_TYPE_SUBCONFIG, 0, 0, 0, NULL},
+ {"tvscan", (void *) tvscan_conf, CONF_TYPE_SUBCONFIG, 0, 0, 0, NULL},
#else
{"tvscan", "MPlayer was compiled without TV interface support.\n", CONF_TYPE_PRINT, 0, 0, 0, NULL},
#endif /* CONFIG_TV */
@@ -386,9 +372,8 @@ const m_option_t mplayer_opts[]={
{"help", help_text, CONF_TYPE_PRINT, CONF_NOCFG|CONF_GLOBAL, 0, 0, NULL},
{"h", help_text, CONF_TYPE_PRINT, CONF_NOCFG|CONF_GLOBAL, 0, 0, NULL},
- {"vd", vd_conf, CONF_TYPE_SUBCONFIG, 0, 0, 0, NULL},
+ {"vd", (void *) vd_conf, CONF_TYPE_SUBCONFIG, 0, 0, 0, NULL},
{NULL, NULL, 0, 0, 0, 0, NULL}
};
#endif /* MPLAYER_CFG_MPLAYER_H */
-
diff --git a/codec-cfg.c b/codec-cfg.c
index 5d796275ce..ae84af4c1a 100644
--- a/codec-cfg.c
+++ b/codec-cfg.c
@@ -40,10 +40,12 @@
#include <ctype.h>
#include <assert.h>
#include <string.h>
+#include <stdint.h>
#include "config.h"
#include "mp_msg.h"
#ifdef CODECS2HTML
+#define mp_tmsg mp_msg
#ifdef __GNUC__
#define mp_msg(t, l, m, args...) fprintf(stderr, m, ##args)
#else
@@ -53,9 +55,6 @@
#include "help_mp.h"
-// for mmioFOURCC:
-#include "libmpdemux/aviheader.h"
-
#include "libmpcodecs/img_format.h"
#include "codec-cfg.h"
@@ -63,6 +62,10 @@
#include "codecs.conf.h"
#endif
+#define mmioFOURCC( ch0, ch1, ch2, ch3 ) \
+ ( (uint32_t)(uint8_t)(ch0) | ( (uint32_t)(uint8_t)(ch1) << 8 ) | \
+ ( (uint32_t)(uint8_t)(ch2) << 16 ) | ( (uint32_t)(uint8_t)(ch3) << 24 ) )
+
#define PRINT_LINENUM mp_msg(MSGT_CODECCFG,MSGL_ERR," at line %d\n", line_num)
#define MAX_NR_TOKEN 16
@@ -107,13 +110,13 @@ static int add_to_fourcc(char *s, char *alias, unsigned int *fourcc,
goto err_out_parse_error;
return 1;
err_out_duplicated:
- mp_msg(MSGT_CODECCFG,MSGL_ERR,MSGTR_DuplicateFourcc);
+ mp_tmsg(MSGT_CODECCFG,MSGL_ERR,"duplicated FourCC");
return 0;
err_out_too_many:
- mp_msg(MSGT_CODECCFG,MSGL_ERR,MSGTR_TooManyFourccs);
+ mp_tmsg(MSGT_CODECCFG,MSGL_ERR,"too many FourCCs/formats...");
return 0;
err_out_parse_error:
- mp_msg(MSGT_CODECCFG,MSGL_ERR,MSGTR_ParseError);
+ mp_tmsg(MSGT_CODECCFG,MSGL_ERR,"parse error");
return 0;
}
@@ -126,20 +129,20 @@ static int add_to_format(char *s, char *alias,unsigned int *fourcc, unsigned int
for (i = 0; i < CODECS_MAX_FOURCC && fourcc[i] != 0xffffffff; i++)
/* NOTHING */;
if (i == CODECS_MAX_FOURCC) {
- mp_msg(MSGT_CODECCFG,MSGL_ERR,MSGTR_TooManyFourccs);
+ mp_tmsg(MSGT_CODECCFG,MSGL_ERR,"too many FourCCs/formats...");
return 0;
}
fourcc[i]=strtoul(s,&endptr,0);
if (*endptr != '\0') {
- mp_msg(MSGT_CODECCFG,MSGL_ERR,MSGTR_ParseErrorFIDNotNumber);
+ mp_tmsg(MSGT_CODECCFG,MSGL_ERR,"parse error (format ID not a number?)");
return 0;
}
if(alias){
fourccmap[i]=strtoul(alias,&endptr,0);
if (*endptr != '\0') {
- mp_msg(MSGT_CODECCFG,MSGL_ERR,MSGTR_ParseErrorFIDAliasNotNumber);
+ mp_tmsg(MSGT_CODECCFG,MSGL_ERR,"parse error (format ID alias not a number?)");
return 0;
}
} else
@@ -147,7 +150,7 @@ static int add_to_format(char *s, char *alias,unsigned int *fourcc, unsigned int
for (j = 0; j < i; j++)
if (fourcc[j] == fourcc[i]) {
- mp_msg(MSGT_CODECCFG,MSGL_ERR,MSGTR_DuplicateFID);
+ mp_tmsg(MSGT_CODECCFG,MSGL_ERR,"duplicated format ID");
return 0;
}
@@ -219,7 +222,7 @@ static int add_to_format(char *s, char *alias,unsigned int *fourcc, unsigned int
{"VDPAU_H264",IMGFMT_VDPAU_H264},
{"VDPAU_WMV3",IMGFMT_VDPAU_WMV3},
{"VDPAU_VC1",IMGFMT_VDPAU_VC1},
- {"VDPAU_MPEG4",IMGFMT_VDPAU_MPEG4},
+ {"VDPAU_MPEG4",IMGFMT_VDPAU_MPEG4},
{NULL, 0}
};
@@ -284,10 +287,10 @@ static int add_to_inout(char *sfmt, char *sflags, unsigned int *outfmt,
return 1;
err_out_too_many:
- mp_msg(MSGT_CODECCFG,MSGL_ERR,MSGTR_TooManyOut);
+ mp_tmsg(MSGT_CODECCFG,MSGL_ERR,"too many out...");
return 0;
err_out_parse_error:
- mp_msg(MSGT_CODECCFG,MSGL_ERR,MSGTR_ParseError);
+ mp_tmsg(MSGT_CODECCFG,MSGL_ERR,"parse error");
return 0;
}
@@ -368,7 +371,7 @@ static int validate_codec(codecs_t *c, int type)
/* NOTHING */;
if (i < strlen(tmp_name)) {
- mp_msg(MSGT_CODECCFG,MSGL_ERR,MSGTR_InvalidCodecName, c->name);
+ mp_tmsg(MSGT_CODECCFG,MSGL_ERR,"\ncodec(%s) name is not valid!\n", c->name);
return 0;
}
@@ -377,13 +380,13 @@ static int validate_codec(codecs_t *c, int type)
#if 0
if (c->fourcc[0] == 0xffffffff) {
- mp_msg(MSGT_CODECCFG,MSGL_ERR,MSGTR_CodecLacksFourcc, c->name);
+ mp_tmsg(MSGT_CODECCFG,MSGL_ERR,"\ncodec(%s) does not have FourCC/format!\n", c->name);
return 0;
}
#endif
if (!c->drv) {
- mp_msg(MSGT_CODECCFG,MSGL_ERR,MSGTR_CodecLacksDriver, c->name);
+ mp_tmsg(MSGT_CODECCFG,MSGL_ERR,"\ncodec(%s) does not have a driver!\n", c->name);
return 0;
}
@@ -392,7 +395,7 @@ static int validate_codec(codecs_t *c, int type)
#warning Where are they defined ????????????
if (!c->dll && (c->driver == 4 ||
(c->driver == 2 && type == TYPE_VIDEO))) {
- mp_msg(MSGT_CODECCFG,MSGL_ERR,MSGTR_CodecNeedsDLL, c->name);
+ mp_tmsg(MSGT_CODECCFG,MSGL_ERR,"\ncodec(%s) needs a 'dll'!\n", c->name);
return 0;
}
#warning Can guid.f1 be 0? How does one know that it was not given?
@@ -400,7 +403,7 @@ static int validate_codec(codecs_t *c, int type)
if (type == TYPE_VIDEO)
if (c->outfmt[0] == 0xffffffff) {
- mp_msg(MSGT_CODECCFG,MSGL_ERR,MSGTR_CodecNeedsOutfmt, c->name);
+ mp_tmsg(MSGT_CODECCFG,MSGL_ERR,"\ncodec(%s) needs an 'outfmt'!\n", c->name);
return 0;
}
#endif
@@ -418,7 +421,7 @@ static int add_comment(char *s, char **d)
(*d)[pos++] = '\n';
}
if (!(*d = realloc(*d, pos + strlen(s) + 1))) {
- mp_msg(MSGT_CODECCFG,MSGL_FATAL,MSGTR_CantAllocateComment);
+ mp_tmsg(MSGT_CODECCFG,MSGL_FATAL,"Can't allocate memory for comment. ");
return 0;
}
strcpy(*d + pos, s);
@@ -467,7 +470,7 @@ static int get_token(int min, int max)
char c;
if (max >= MAX_NR_TOKEN) {
- mp_msg(MSGT_CODECCFG,MSGL_ERR,MSGTR_GetTokenMaxNotLessThanMAX_NR_TOKEN);
+ mp_tmsg(MSGT_CODECCFG,MSGL_ERR,"get_token(): max >= MAX_MR_TOKEN!");
goto out_eof;
}
@@ -551,15 +554,15 @@ int parse_codec_cfg(const char *cfgfile)
#endif
}
- mp_msg(MSGT_CODECCFG,MSGL_V,MSGTR_ReadingFile, cfgfile);
+ mp_tmsg(MSGT_CODECCFG,MSGL_V,"Reading %s: ", cfgfile);
if ((fp = fopen(cfgfile, "r")) == NULL) {
- mp_msg(MSGT_CODECCFG,MSGL_V,MSGTR_CantOpenFileError, cfgfile, strerror(errno));
+ mp_tmsg(MSGT_CODECCFG,MSGL_V,"Can't open '%s': %s\n", cfgfile, strerror(errno));
return 0;
}
if ((line = malloc(MAX_LINE_LEN + 1)) == NULL) {
- mp_msg(MSGT_CODECCFG,MSGL_FATAL,MSGTR_CantGetMemoryForLine, strerror(errno));
+ mp_tmsg(MSGT_CODECCFG,MSGL_FATAL,"Can't get memory for 'line': %s\n", strerror(errno));
return 0;
}
read_nextline = 1;
@@ -617,7 +620,7 @@ int parse_codec_cfg(const char *cfgfile)
}
if (!(*codecsp = realloc(*codecsp,
sizeof(codecs_t) * (*nr_codecsp + 2)))) {
- mp_msg(MSGT_CODECCFG,MSGL_FATAL,MSGTR_CantReallocCodecsp, strerror(errno));
+ mp_tmsg(MSGT_CODECCFG,MSGL_FATAL,"Can't realloc '*codecsp': %s\n", strerror(errno));
goto err_out;
}
codec=*codecsp + *nr_codecsp;
@@ -632,19 +635,19 @@ int parse_codec_cfg(const char *cfgfile)
for (i = 0; i < *nr_codecsp - 1; i++) {
if(( (*codecsp)[i].name!=NULL) &&
(!strcmp(token[0], (*codecsp)[i].name)) ) {
- mp_msg(MSGT_CODECCFG,MSGL_ERR,MSGTR_CodecNameNotUnique, token[0]);
+ mp_tmsg(MSGT_CODECCFG,MSGL_ERR,"Codec name '%s' isn't unique.", token[0]);
goto err_out_print_linenum;
}
}
if (!(codec->name = strdup(token[0]))) {
- mp_msg(MSGT_CODECCFG,MSGL_ERR,MSGTR_CantStrdupName, strerror(errno));
+ mp_tmsg(MSGT_CODECCFG,MSGL_ERR,"Can't strdup -> 'name': %s\n", strerror(errno));
goto err_out;
}
} else if (!strcmp(token[0], "info")) {
if (codec->info || get_token(1, 1) < 0)
goto err_out_parse_error;
if (!(codec->info = strdup(token[0]))) {
- mp_msg(MSGT_CODECCFG,MSGL_ERR,MSGTR_CantStrdupInfo, strerror(errno));
+ mp_tmsg(MSGT_CODECCFG,MSGL_ERR,"Can't strdup -> 'info': %s\n", strerror(errno));
goto err_out;
}
} else if (!strcmp(token[0], "comment")) {
@@ -668,14 +671,14 @@ int parse_codec_cfg(const char *cfgfile)
if (get_token(1, 1) < 0)
goto err_out_parse_error;
if (!(codec->drv = strdup(token[0]))) {
- mp_msg(MSGT_CODECCFG,MSGL_ERR,MSGTR_CantStrdupDriver, strerror(errno));
+ mp_tmsg(MSGT_CODECCFG,MSGL_ERR,"Can't strdup -> 'driver': %s\n", strerror(errno));
goto err_out;
}
} else if (!strcmp(token[0], "dll")) {
if (get_token(1, 1) < 0)
goto err_out_parse_error;
if (!(codec->dll = strdup(token[0]))) {
- mp_msg(MSGT_CODECCFG,MSGL_ERR,MSGTR_CantStrdupDLL, strerror(errno));
+ mp_tmsg(MSGT_CODECCFG,MSGL_ERR,"Can't strdup -> 'dll': %s", strerror(errno));
goto err_out;
}
} else if (!strcmp(token[0], "guid")) {
@@ -744,7 +747,7 @@ int parse_codec_cfg(const char *cfgfile)
}
if (!validate_codec(codec, codec_type))
goto err_out_not_valid;
- mp_msg(MSGT_CODECCFG,MSGL_INFO,MSGTR_AudioVideoCodecTotals, nr_acodecs, nr_vcodecs);
+ mp_tmsg(MSGT_CODECCFG,MSGL_INFO,"%d audio & %d video codecs\n", nr_acodecs, nr_vcodecs);
if(video_codecs) video_codecs[nr_vcodecs].name = NULL;
if(audio_codecs) audio_codecs[nr_acodecs].name = NULL;
out:
@@ -754,7 +757,7 @@ out:
return 1;
err_out_parse_error:
- mp_msg(MSGT_CODECCFG,MSGL_ERR,MSGTR_ParseError);
+ mp_tmsg(MSGT_CODECCFG,MSGL_ERR,"parse error");
err_out_print_linenum:
PRINT_LINENUM;
err_out:
@@ -766,10 +769,10 @@ err_out:
fclose(fp);
return 0;
err_out_not_valid:
- mp_msg(MSGT_CODECCFG,MSGL_ERR,MSGTR_CodecDefinitionIncorrect);
+ mp_tmsg(MSGT_CODECCFG,MSGL_ERR,"Codec is not defined correctly.");
goto err_out_print_linenum;
err_out_release_num:
- mp_msg(MSGT_CODECCFG,MSGL_ERR,MSGTR_OutdatedCodecsConf);
+ mp_tmsg(MSGT_CODECCFG,MSGL_ERR,"This codecs.conf is too old and incompatible with this MPlayer release!");
goto err_out_print_linenum;
}
@@ -1053,8 +1056,8 @@ int main(int argc, char* argv[])
nr[1] = nr_acodecs;
printf("/* GENERATED FROM %s, DO NOT EDIT! */\n\n",argv[1]);
- printf("#include <stddef.h>\n",argv[1]);
- printf("#include \"codec-cfg.h\"\n\n",argv[1]);
+ printf("#include <stddef.h>\n");
+ printf("#include \"codec-cfg.h\"\n\n");
for (i=0; i<2; i++) {
printf("const codecs_t %s[] = {\n", nm[i]);
diff --git a/codec-cfg.h b/codec-cfg.h
index d3a1ae03ab..3522f68a48 100644
--- a/codec-cfg.h
+++ b/codec-cfg.h
@@ -56,7 +56,7 @@ typedef struct {
#endif
-typedef struct codecs_st {
+typedef struct codecs {
unsigned int fourcc[CODECS_MAX_FOURCC];
unsigned int fourccmap[CODECS_MAX_FOURCC];
unsigned int outfmt[CODECS_MAX_OUTFMT];
diff --git a/command.c b/command.c
index cd9d2abf5d..54b1332d16 100644
--- a/command.c
+++ b/command.c
@@ -20,8 +20,10 @@
#include <inttypes.h>
#include <unistd.h>
#include <string.h>
+#include <stdbool.h>
#include "config.h"
+#include "talloc.h"
#include "command.h"
#include "input/input.h"
#include "stream/stream.h"
@@ -36,6 +38,7 @@
#include "metadata.h"
#include "libmpcodecs/vf.h"
#include "libmpcodecs/vd.h"
+#include "mp_osd.h"
#include "libvo/video_out.h"
#include "libvo/font_load.h"
#include "playtree.h"
@@ -47,6 +50,7 @@
#include "vobsub.h"
#include "spudec.h"
#include "get_path.h"
+#include "ass_mp.h"
#include "stream/tv.h"
#include "stream/stream_radio.h"
#include "stream/pvr.h"
@@ -57,10 +61,8 @@
#include "stream/stream_dvd.h"
#endif
#include "stream/stream_dvdnav.h"
-#include "libass/ass_mp.h"
#include "m_struct.h"
#include "libmenu/menu.h"
-#include "gui/interface.h"
#include "mp_core.h"
#include "mp_fifo.h"
@@ -70,35 +72,38 @@
extern int use_menu;
-static void rescale_input_coordinates(int ix, int iy, double *dx, double *dy)
+static void rescale_input_coordinates(struct MPContext *mpctx, int ix, int iy,
+ double *dx, double *dy)
{
+ struct MPOpts *opts = &mpctx->opts;
+ struct vo *vo = mpctx->video_out;
//remove the borders, if any, and rescale to the range [0,1],[0,1]
if (vo_fs) { //we are in full-screen mode
- if (vo_screenwidth > vo_dwidth) //there are borders along the x axis
- ix -= (vo_screenwidth - vo_dwidth) / 2;
- if (vo_screenheight > vo_dheight) //there are borders along the y axis (usual way)
- iy -= (vo_screenheight - vo_dheight) / 2;
+ if (opts->vo_screenwidth > vo->dwidth) //there are borders along the x axis
+ ix -= (opts->vo_screenwidth - vo->dwidth) / 2;
+ if (opts->vo_screenheight > vo->dheight) //there are borders along the y axis (usual way)
+ iy -= (opts->vo_screenheight - vo->dheight) / 2;
- if (ix < 0 || ix > vo_dwidth) {
+ if (ix < 0 || ix > vo->dwidth) {
*dx = *dy = -1.0;
return;
} //we are on one of the borders
- if (iy < 0 || iy > vo_dheight) {
+ if (iy < 0 || iy > vo->dheight) {
*dx = *dy = -1.0;
return;
} //we are on one of the borders
}
- *dx = (double) ix / (double) vo_dwidth;
- *dy = (double) iy / (double) vo_dheight;
+ *dx = (double) ix / (double) vo->dwidth;
+ *dy = (double) iy / (double) vo->dheight;
mp_msg(MSGT_CPLAYER, MSGL_V,
- "\r\nrescaled coordinates: %.3lf, %.3lf, screen (%d x %d), vodisplay: (%d, %d), fullscreen: %d\r\n",
- *dx, *dy, vo_screenwidth, vo_screenheight, vo_dwidth,
- vo_dheight, vo_fs);
+ "\r\nrescaled coordinates: %.3f, %.3f, screen (%d x %d), vodisplay: (%d, %d), fullscreen: %d\r\n",
+ *dx, *dy, opts->vo_screenwidth, opts->vo_screenheight, vo->dwidth,
+ vo->dheight, vo_fs);
}
-static int sub_source_by_pos(MPContext * mpctx, int pos)
+static int sub_source_by_pos(MPContext *mpctx, int pos)
{
int source = -1;
int top = -1;
@@ -113,7 +118,7 @@ static int sub_source_by_pos(MPContext * mpctx, int pos)
return source;
}
-static int sub_source(MPContext * mpctx)
+static int sub_source(MPContext *mpctx)
{
return sub_source_by_pos(mpctx, mpctx->global_sub_pos);
}
@@ -128,7 +133,7 @@ static int sub_source(MPContext * mpctx)
* which need to be fixed while watching the movie.
*/
-static void log_sub(void)
+static void log_sub(struct MPContext *mpctx)
{
char *fname;
FILE *f;
@@ -144,14 +149,14 @@ static void log_sub(void)
if (subdata->sub_uses_time) {
fprintf(f,
"N: %s S: %02ld:%02ld:%02ld.%02ld E: %02ld:%02ld:%02ld.%02ld\n",
- filename, vo_sub_last->start / 360000,
+ mpctx->filename, vo_sub_last->start / 360000,
(vo_sub_last->start / 6000) % 60,
(vo_sub_last->start / 100) % 60, vo_sub_last->start % 100,
vo_sub_last->end / 360000, (vo_sub_last->end / 6000) % 60,
(vo_sub_last->end / 100) % 60, vo_sub_last->end % 100);
} else {
- fprintf(f, "N: %s S: %ld E: %ld\n", filename, vo_sub_last->start,
- vo_sub_last->end);
+ fprintf(f, "N: %s S: %ld E: %ld\n", mpctx->filename,
+ vo_sub_last->start, vo_sub_last->end);
}
for (i = 0; i < vo_sub_last->lines; i++) {
fprintf(f, "%s\n", vo_sub_last->text[i]);
@@ -168,77 +173,80 @@ static void log_sub(void)
///@{
/// OSD level (RW)
-static int mp_property_osdlevel(m_option_t * prop, int action, void *arg,
- MPContext * mpctx)
+static int mp_property_osdlevel(m_option_t *prop, int action, void *arg,
+ MPContext *mpctx)
{
- return m_property_choice(prop, action, arg, &osd_level);
+ return m_property_choice(prop, action, arg, &mpctx->opts.osd_level);
}
/// Loop (RW)
-static int mp_property_loop(m_option_t * prop, int action, void *arg,
- MPContext * mpctx)
+static int mp_property_loop(m_option_t *prop, int action, void *arg,
+ MPContext *mpctx)
{
+ struct MPOpts *opts = &mpctx->opts;
switch (action) {
case M_PROPERTY_PRINT:
if (!arg) return M_PROPERTY_ERROR;
- if (mpctx->loop_times < 0)
+ if (opts->loop_times < 0)
*(char**)arg = strdup("off");
- else if (mpctx->loop_times == 0)
+ else if (opts->loop_times == 0)
*(char**)arg = strdup("inf");
else
break;
return M_PROPERTY_OK;
}
- return m_property_int_range(prop, action, arg, &mpctx->loop_times);
+ return m_property_int_range(prop, action, arg, &opts->loop_times);
}
/// Playback speed (RW)
-static int mp_property_playback_speed(m_option_t * prop, int action,
- void *arg, MPContext * mpctx)
+static int mp_property_playback_speed(m_option_t *prop, int action,
+ void *arg, MPContext *mpctx)
{
+ struct MPOpts *opts = &mpctx->opts;
switch (action) {
case M_PROPERTY_SET:
if (!arg)
return M_PROPERTY_ERROR;
M_PROPERTY_CLAMP(prop, *(float *) arg);
- playback_speed = *(float *) arg;
- build_afilter_chain(mpctx->sh_audio, &ao_data);
+ opts->playback_speed = *(float *) arg;
+ build_afilter_chain(mpctx, mpctx->sh_audio, &ao_data);
return M_PROPERTY_OK;
case M_PROPERTY_STEP_UP:
case M_PROPERTY_STEP_DOWN:
- playback_speed += (arg ? *(float *) arg : 0.1) *
+ opts->playback_speed += (arg ? *(float *) arg : 0.1) *
(action == M_PROPERTY_STEP_DOWN ? -1 : 1);
- M_PROPERTY_CLAMP(prop, playback_speed);
- build_afilter_chain(mpctx->sh_audio, &ao_data);
+ M_PROPERTY_CLAMP(prop, opts->playback_speed);
+ build_afilter_chain(mpctx, mpctx->sh_audio, &ao_data);
return M_PROPERTY_OK;
}
- return m_property_float_range(prop, action, arg, &playback_speed);
+ return m_property_float_range(prop, action, arg, &opts->playback_speed);
}
/// filename with path (RO)
-static int mp_property_path(m_option_t * prop, int action, void *arg,
- MPContext * mpctx)
+static int mp_property_path(m_option_t *prop, int action, void *arg,
+ MPContext *mpctx)
{
- return m_property_string_ro(prop, action, arg, filename);
+ return m_property_string_ro(prop, action, arg, mpctx->filename);
}
/// filename without path (RO)
-static int mp_property_filename(m_option_t * prop, int action, void *arg,
- MPContext * mpctx)
+static int mp_property_filename(m_option_t *prop, int action, void *arg,
+ MPContext *mpctx)
{
char *f;
- if (!filename)
+ if (!mpctx->filename)
return M_PROPERTY_UNAVAILABLE;
- if (((f = strrchr(filename, '/')) || (f = strrchr(filename, '\\'))) && f[1])
+ if (((f = strrchr(mpctx->filename, '/'))
+ || (f = strrchr(mpctx->filename, '\\'))) && f[1])
f++;
else
- f = filename;
+ f = mpctx->filename;
return m_property_string_ro(prop, action, arg, f);
}
/// Demuxer name (RO)
-static int mp_property_demuxer(m_option_t * prop, int action, void *arg,
- MPContext * mpctx)
+static int mp_property_demuxer(m_option_t *prop, int action, void *arg,
+ MPContext *mpctx)
{
if (!mpctx->demuxer)
return M_PROPERTY_UNAVAILABLE;
@@ -247,8 +255,8 @@ static int mp_property_demuxer(m_option_t * prop, int action, void *arg,
}
/// Position in the stream (RW)
-static int mp_property_stream_pos(m_option_t * prop, int action, void *arg,
- MPContext * mpctx)
+static int mp_property_stream_pos(m_option_t *prop, int action, void *arg,
+ MPContext *mpctx)
{
if (!mpctx->demuxer || !mpctx->demuxer->stream)
return M_PROPERTY_UNAVAILABLE;
@@ -267,8 +275,8 @@ static int mp_property_stream_pos(m_option_t * prop, int action, void *arg,
}
/// Stream start offset (RO)
-static int mp_property_stream_start(m_option_t * prop, int action,
- void *arg, MPContext * mpctx)
+static int mp_property_stream_start(m_option_t *prop, int action,
+ void *arg, MPContext *mpctx)
{
if (!mpctx->demuxer || !mpctx->demuxer->stream)
return M_PROPERTY_UNAVAILABLE;
@@ -281,8 +289,8 @@ static int mp_property_stream_start(m_option_t * prop, int action,
}
/// Stream end offset (RO)
-static int mp_property_stream_end(m_option_t * prop, int action, void *arg,
- MPContext * mpctx)
+static int mp_property_stream_end(m_option_t *prop, int action, void *arg,
+ MPContext *mpctx)
{
if (!mpctx->demuxer || !mpctx->demuxer->stream)
return M_PROPERTY_UNAVAILABLE;
@@ -295,8 +303,8 @@ static int mp_property_stream_end(m_option_t * prop, int action, void *arg,
}
/// Stream length (RO)
-static int mp_property_stream_length(m_option_t * prop, int action,
- void *arg, MPContext * mpctx)
+static int mp_property_stream_length(m_option_t *prop, int action,
+ void *arg, MPContext *mpctx)
{
if (!mpctx->demuxer || !mpctx->demuxer->stream)
return M_PROPERTY_UNAVAILABLE;
@@ -310,8 +318,8 @@ static int mp_property_stream_length(m_option_t * prop, int action,
}
/// Media length in seconds (RO)
-static int mp_property_length(m_option_t * prop, int action, void *arg,
- MPContext * mpctx)
+static int mp_property_length(m_option_t *prop, int action, void *arg,
+ MPContext *mpctx)
{
double len;
@@ -323,8 +331,8 @@ static int mp_property_length(m_option_t * prop, int action, void *arg,
}
/// Current position in percent (RW)
-static int mp_property_percent_pos(m_option_t * prop, int action,
- void *arg, MPContext * mpctx) {
+static int mp_property_percent_pos(m_option_t *prop, int action,
+ void *arg, MPContext *mpctx) {
int pos;
if (!mpctx->demuxer)
@@ -348,14 +356,14 @@ static int mp_property_percent_pos(m_option_t * prop, int action,
demuxer_get_percent_pos(mpctx->demuxer));
}
- abs_seek_pos = SEEK_ABSOLUTE | SEEK_FACTOR;
- rel_seek_secs = pos / 100.0;
+ mpctx->abs_seek_pos = SEEK_ABSOLUTE | SEEK_FACTOR;
+ mpctx->rel_seek_secs = pos / 100.0;
return M_PROPERTY_OK;
}
/// Current position in seconds (RW)
-static int mp_property_time_pos(m_option_t * prop, int action,
- void *arg, MPContext * mpctx) {
+static int mp_property_time_pos(m_option_t *prop, int action,
+ void *arg, MPContext *mpctx) {
if (!(mpctx->sh_video || (mpctx->sh_audio && mpctx->audio_out)))
return M_PROPERTY_UNAVAILABLE;
@@ -363,34 +371,31 @@ static int mp_property_time_pos(m_option_t * prop, int action,
case M_PROPERTY_SET:
if(!arg) return M_PROPERTY_ERROR;
M_PROPERTY_CLAMP(prop, *(double*)arg);
- abs_seek_pos = SEEK_ABSOLUTE;
- rel_seek_secs = *(double*)arg;
+ mpctx->abs_seek_pos = SEEK_ABSOLUTE;
+ mpctx->rel_seek_secs = *(double*)arg;
return M_PROPERTY_OK;
case M_PROPERTY_STEP_UP:
case M_PROPERTY_STEP_DOWN:
- rel_seek_secs += (arg ? *(double*)arg : 10.0) *
+ mpctx->rel_seek_secs += (arg ? *(double*)arg : 10.0) *
(action == M_PROPERTY_STEP_UP ? 1.0 : -1.0);
return M_PROPERTY_OK;
}
return m_property_time_ro(prop, action, arg,
mpctx->sh_video ? mpctx->sh_video->pts :
- playing_audio_pts(mpctx->sh_audio,
- mpctx->d_audio,
- mpctx->audio_out));
+ playing_audio_pts(mpctx));
}
/// Current chapter (RW)
static int mp_property_chapter(m_option_t *prop, int action, void *arg,
MPContext *mpctx)
{
+ struct MPOpts *opts = &mpctx->opts;
int chapter = -1;
- float next_pts = 0;
- int chapter_num;
int step_all;
char *chapter_name = NULL;
if (mpctx->demuxer)
- chapter = demuxer_get_current_chapter(mpctx->demuxer);
+ chapter = get_current_chapter(mpctx);
if (chapter < 0)
return M_PROPERTY_UNAVAILABLE;
@@ -403,7 +408,7 @@ static int mp_property_chapter(m_option_t *prop, int action, void *arg,
case M_PROPERTY_PRINT: {
if (!arg)
return M_PROPERTY_ERROR;
- chapter_name = demuxer_chapter_display_name(mpctx->demuxer, chapter);
+ chapter_name = chapter_display_name(mpctx, chapter);
if (!chapter_name)
return M_PROPERTY_UNAVAILABLE;
*(char **) arg = chapter_name;
@@ -428,26 +433,27 @@ static int mp_property_chapter(m_option_t *prop, int action, void *arg,
default:
return M_PROPERTY_NOT_IMPLEMENTED;
}
- rel_seek_secs = 0;
- abs_seek_pos = 0;
- chapter = demuxer_seek_chapter(mpctx->demuxer, chapter, 1,
- &next_pts, &chapter_num, &chapter_name);
+
+ double next_pts = 0;
+ chapter = seek_chapter(mpctx, chapter, &next_pts, &chapter_name);
+ mpctx->rel_seek_secs = 0;
+ mpctx->abs_seek_pos = 0;
if (chapter >= 0) {
if (next_pts > -1.0) {
- abs_seek_pos = SEEK_ABSOLUTE;
- rel_seek_secs = next_pts;
+ mpctx->abs_seek_pos = SEEK_ABSOLUTE;
+ mpctx->rel_seek_secs = next_pts;
}
if (chapter_name)
- set_osd_msg(OSD_MSG_TEXT, 1, osd_duration,
- MSGTR_OSDChapter, chapter + 1, chapter_name);
+ set_osd_tmsg(OSD_MSG_TEXT, 1, opts->osd_duration,
+ "Chapter: (%d) %s", chapter + 1, chapter_name);
}
else if (step_all > 0)
- rel_seek_secs = 1000000000.;
+ mpctx->rel_seek_secs = 1000000000.;
else
- set_osd_msg(OSD_MSG_TEXT, 1, osd_duration,
- MSGTR_OSDChapter, 0, MSGTR_Unknown);
+ set_osd_tmsg(OSD_MSG_TEXT, 1, opts->osd_duration,
+ "Chapter: (%d) %s", 0, mp_gtext("unknown"));
if (chapter_name)
- free(chapter_name);
+ talloc_free(chapter_name);
return M_PROPERTY_OK;
}
@@ -466,6 +472,7 @@ static int mp_property_chapters(m_option_t *prop, int action, void *arg,
static int mp_property_angle(m_option_t *prop, int action, void *arg,
MPContext *mpctx)
{
+ struct MPOpts *opts = &mpctx->opts;
int angle = -1;
int angles;
char *angle_name = NULL;
@@ -517,19 +524,19 @@ static int mp_property_angle(m_option_t *prop, int action, void *arg,
return M_PROPERTY_NOT_IMPLEMENTED;
}
angle = demuxer_set_angle(mpctx->demuxer, angle);
- set_osd_msg(OSD_MSG_TEXT, 1, osd_duration,
- MSGTR_OSDAngle, angle, angles);
+ set_osd_tmsg(OSD_MSG_TEXT, 1, opts->osd_duration,
+ "Angle: %d/%d", angle, angles);
if (angle_name)
free(angle_name);
return M_PROPERTY_OK;
}
/// Demuxer meta data
-static int mp_property_metadata(m_option_t * prop, int action, void *arg,
- MPContext * mpctx) {
+static int mp_property_metadata(m_option_t *prop, int action, void *arg,
+ MPContext *mpctx) {
m_property_action_t* ka;
char* meta;
- static m_option_t key_type =
+ static const m_option_t key_type =
{ "metadata", NULL, CONF_TYPE_STRING, 0, 0, 0, NULL };
if (!mpctx->demuxer)
return M_PROPERTY_UNAVAILABLE;
@@ -558,10 +565,31 @@ static int mp_property_metadata(m_option_t * prop, int action, void *arg,
return M_PROPERTY_NOT_IMPLEMENTED;
}
-static int mp_property_pause(m_option_t * prop, int action, void *arg,
- MPContext * mpctx)
+static int mp_property_pause(m_option_t *prop, int action, void *arg,
+ void *ctx)
{
- return m_property_flag_ro(prop, action, arg, mpctx->osd_function == OSD_PAUSE);
+ MPContext *mpctx = ctx;
+
+ switch (action) {
+ case M_PROPERTY_SET:
+ if (!arg)
+ return M_PROPERTY_ERROR;
+ if (mpctx->paused == (bool)*(int *) arg)
+ return M_PROPERTY_OK;
+ case M_PROPERTY_STEP_UP:
+ case M_PROPERTY_STEP_DOWN:
+ if (mpctx->paused) {
+ unpause_player(mpctx);
+ mpctx->osd_function = OSD_PLAY;
+ }
+ else {
+ pause_player(mpctx);
+ mpctx->osd_function = OSD_PAUSE;
+ }
+ return M_PROPERTY_OK;
+ default:
+ return m_property_flag(prop, action, arg, &mpctx->paused);
+ }
}
@@ -572,8 +600,8 @@ static int mp_property_pause(m_option_t * prop, int action, void *arg,
///@{
/// Volume (RW)
-static int mp_property_volume(m_option_t * prop, int action, void *arg,
- MPContext * mpctx)
+static int mp_property_volume(m_option_t *prop, int action, void *arg,
+ MPContext *mpctx)
{
if (!mpctx->sh_audio)
@@ -628,8 +656,8 @@ static int mp_property_volume(m_option_t * prop, int action, void *arg,
}
/// Mute (RW)
-static int mp_property_mute(m_option_t * prop, int action, void *arg,
- MPContext * mpctx)
+static int mp_property_mute(m_option_t *prop, int action, void *arg,
+ MPContext *mpctx)
{
if (!mpctx->sh_audio)
@@ -656,7 +684,7 @@ static int mp_property_mute(m_option_t * prop, int action, void *arg,
if (!arg)
return M_PROPERTY_ERROR;
if (mpctx->edl_muted) {
- *(char **) arg = strdup(MSGTR_EnabledEdl);
+ *(char **) arg = strdup(mp_gtext("enabled (EDL)"));
return M_PROPERTY_OK;
}
default:
@@ -666,8 +694,8 @@ static int mp_property_mute(m_option_t * prop, int action, void *arg,
}
/// Audio delay (RW)
-static int mp_property_audio_delay(m_option_t * prop, int action,
- void *arg, MPContext * mpctx)
+static int mp_property_audio_delay(m_option_t *prop, int action,
+ void *arg, MPContext *mpctx)
{
if (!(mpctx->sh_audio && mpctx->sh_video))
return M_PROPERTY_UNAVAILABLE;
@@ -690,8 +718,8 @@ static int mp_property_audio_delay(m_option_t * prop, int action,
}
/// Audio codec tag (RO)
-static int mp_property_audio_format(m_option_t * prop, int action,
- void *arg, MPContext * mpctx)
+static int mp_property_audio_format(m_option_t *prop, int action,
+ void *arg, MPContext *mpctx)
{
if (!mpctx->sh_audio)
return M_PROPERTY_UNAVAILABLE;
@@ -699,8 +727,8 @@ static int mp_property_audio_format(m_option_t * prop, int action,
}
/// Audio codec name (RO)
-static int mp_property_audio_codec(m_option_t * prop, int action,
- void *arg, MPContext * mpctx)
+static int mp_property_audio_codec(m_option_t *prop, int action,
+ void *arg, MPContext *mpctx)
{
if (!mpctx->sh_audio || !mpctx->sh_audio->codec)
return M_PROPERTY_UNAVAILABLE;
@@ -708,8 +736,8 @@ static int mp_property_audio_codec(m_option_t * prop, int action,
}
/// Audio bitrate (RO)
-static int mp_property_audio_bitrate(m_option_t * prop, int action,
- void *arg, MPContext * mpctx)
+static int mp_property_audio_bitrate(m_option_t *prop, int action,
+ void *arg, MPContext *mpctx)
{
if (!mpctx->sh_audio)
return M_PROPERTY_UNAVAILABLE;
@@ -717,8 +745,8 @@ static int mp_property_audio_bitrate(m_option_t * prop, int action,
}
/// Samplerate (RO)
-static int mp_property_samplerate(m_option_t * prop, int action, void *arg,
- MPContext * mpctx)
+static int mp_property_samplerate(m_option_t *prop, int action, void *arg,
+ MPContext *mpctx)
{
if (!mpctx->sh_audio)
return M_PROPERTY_UNAVAILABLE;
@@ -733,8 +761,8 @@ static int mp_property_samplerate(m_option_t * prop, int action, void *arg,
}
/// Number of channels (RO)
-static int mp_property_channels(m_option_t * prop, int action, void *arg,
- MPContext * mpctx)
+static int mp_property_channels(m_option_t *prop, int action, void *arg,
+ MPContext *mpctx)
{
if (!mpctx->sh_audio)
return M_PROPERTY_UNAVAILABLE;
@@ -759,8 +787,8 @@ static int mp_property_channels(m_option_t * prop, int action, void *arg,
}
/// Balance (RW)
-static int mp_property_balance(m_option_t * prop, int action, void *arg,
- MPContext * mpctx)
+static int mp_property_balance(m_option_t *prop, int action, void *arg,
+ MPContext *mpctx)
{
float bal;
@@ -810,9 +838,10 @@ static int mp_property_balance(m_option_t * prop, int action, void *arg,
}
/// Selected audio id (RW)
-static int mp_property_audio(m_option_t * prop, int action, void *arg,
- MPContext * mpctx)
+static int mp_property_audio(m_option_t *prop, int action, void *arg,
+ MPContext *mpctx)
{
+ struct MPOpts *opts = &mpctx->opts;
int current_id, tmp;
if (!mpctx->demuxer || !mpctx->demuxer->audio)
return M_PROPERTY_UNAVAILABLE;
@@ -829,9 +858,10 @@ static int mp_property_audio(m_option_t * prop, int action, void *arg,
return M_PROPERTY_ERROR;
if (current_id < 0)
- *(char **) arg = strdup(MSGTR_Disabled);
+ *(char **) arg = strdup(mp_gtext("disabled"));
else {
- char lang[40] = MSGTR_Unknown;
+ char lang[40];
+ strncpy(lang, mp_gtext("unknown"), sizeof(lang));
sh_audio_t* sh = mpctx->sh_audio;
if (sh && sh->lang)
av_strlcpy(lang, sh->lang, 40);
@@ -861,21 +891,21 @@ static int mp_property_audio(m_option_t * prop, int action, void *arg,
tmp = *((int *) arg);
else
tmp = -1;
- audio_id = demuxer_switch_audio(mpctx->demuxer, tmp);
- if (audio_id == -2
- || (audio_id > -1
+ opts->audio_id = demuxer_switch_audio(mpctx->demuxer, tmp);
+ if (opts->audio_id == -2
+ || (opts->audio_id > -1
&& mpctx->demuxer->audio->id != current_id && current_id != -2))
- uninit_player(INITIALIZED_AO | INITIALIZED_ACODEC);
- if (audio_id > -1 && mpctx->demuxer->audio->id != current_id) {
+ uninit_player(mpctx, INITIALIZED_AO | INITIALIZED_ACODEC);
+ if (opts->audio_id > -1 && mpctx->demuxer->audio->id != current_id) {
sh_audio_t *sh2;
sh2 = mpctx->demuxer->a_streams[mpctx->demuxer->audio->id];
if (sh2) {
sh2->ds = mpctx->demuxer->audio;
mpctx->sh_audio = sh2;
- reinit_audio_chain();
+ reinit_audio_chain(mpctx);
}
}
- mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_AUDIO_TRACK=%d\n", audio_id);
+ mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_AUDIO_TRACK=%d\n", opts->audio_id);
return M_PROPERTY_OK;
default:
return M_PROPERTY_NOT_IMPLEMENTED;
@@ -884,9 +914,10 @@ static int mp_property_audio(m_option_t * prop, int action, void *arg,
}
/// Selected video id (RW)
-static int mp_property_video(m_option_t * prop, int action, void *arg,
- MPContext * mpctx)
+static int mp_property_video(m_option_t *prop, int action, void *arg,
+ MPContext *mpctx)
{
+ struct MPOpts *opts = &mpctx->opts;
int current_id, tmp;
if (!mpctx->demuxer || !mpctx->demuxer->video)
return M_PROPERTY_UNAVAILABLE;
@@ -903,9 +934,10 @@ static int mp_property_video(m_option_t * prop, int action, void *arg,
return M_PROPERTY_ERROR;
if (current_id < 0)
- *(char **) arg = strdup(MSGTR_Disabled);
+ *(char **) arg = strdup(mp_gtext("disabled"));
else {
- char lang[40] = MSGTR_Unknown;
+ char lang[40];
+ strncpy(lang, mp_gtext("unknown"), sizeof(lang));
*(char **) arg = malloc(64);
snprintf(*(char **) arg, 64, "(%d) %s", current_id, lang);
}
@@ -917,22 +949,22 @@ static int mp_property_video(m_option_t * prop, int action, void *arg,
tmp = *((int *) arg);
else
tmp = -1;
- video_id = demuxer_switch_video(mpctx->demuxer, tmp);
- if (video_id == -2
- || (video_id > -1 && mpctx->demuxer->video->id != current_id
+ opts->video_id = demuxer_switch_video(mpctx->demuxer, tmp);
+ if (opts->video_id == -2
+ || (opts->video_id > -1 && mpctx->demuxer->video->id != current_id
&& current_id != -2))
- uninit_player(INITIALIZED_VCODEC |
- (fixed_vo && video_id != -2 ? 0 : INITIALIZED_VO));
- if (video_id > -1 && mpctx->demuxer->video->id != current_id) {
+ uninit_player(mpctx, INITIALIZED_VCODEC |
+ (mpctx->opts.fixed_vo && opts->video_id != -2 ? 0 : INITIALIZED_VO));
+ if (opts->video_id > -1 && mpctx->demuxer->video->id != current_id) {
sh_video_t *sh2;
sh2 = mpctx->demuxer->v_streams[mpctx->demuxer->video->id];
if (sh2) {
sh2->ds = mpctx->demuxer->video;
mpctx->sh_video = sh2;
- reinit_video_chain();
+ reinit_video_chain(mpctx);
}
}
- mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_VIDEO_TRACK=%d\n", video_id);
+ mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_VIDEO_TRACK=%d\n", opts->video_id);
return M_PROPERTY_OK;
default:
@@ -940,8 +972,8 @@ static int mp_property_video(m_option_t * prop, int action, void *arg,
}
}
-static int mp_property_program(m_option_t * prop, int action, void *arg,
- MPContext * mpctx)
+static int mp_property_program(m_option_t *prop, int action, void *arg,
+ MPContext *mpctx)
{
demux_program_t prog;
@@ -977,8 +1009,8 @@ static int mp_property_program(m_option_t * prop, int action, void *arg,
///@{
/// Fullscreen state (RW)
-static int mp_property_fullscreen(m_option_t * prop, int action, void *arg,
- MPContext * mpctx)
+static int mp_property_fullscreen(m_option_t *prop, int action, void *arg,
+ MPContext *mpctx)
{
if (!mpctx->video_out)
@@ -993,21 +1025,17 @@ static int mp_property_fullscreen(m_option_t * prop, int action, void *arg,
return M_PROPERTY_OK;
case M_PROPERTY_STEP_UP:
case M_PROPERTY_STEP_DOWN:
-#ifdef CONFIG_GUI
- if (use_gui)
- guiGetEvent(guiIEvent, (char *) MP_CMD_GUI_FULLSCREEN);
- else
-#endif
- if (vo_config_count)
- mpctx->video_out->control(VOCTRL_FULLSCREEN, 0);
+ if (mpctx->video_out->config_ok)
+ vo_control(mpctx->video_out, VOCTRL_FULLSCREEN, 0);
+ mpctx->opts.fullscreen = vo_fs;
return M_PROPERTY_OK;
default:
return m_property_flag(prop, action, arg, &vo_fs);
}
}
-static int mp_property_deinterlace(m_option_t * prop, int action,
- void *arg, MPContext * mpctx)
+static int mp_property_deinterlace(m_option_t *prop, int action,
+ void *arg, MPContext *mpctx)
{
int deinterlace;
vf_instance_t *vf;
@@ -1031,20 +1059,62 @@ static int mp_property_deinterlace(m_option_t * prop, int action,
vf->control(vf, VFCTRL_GET_DEINTERLACE, &deinterlace);
deinterlace = !deinterlace;
vf->control(vf, VFCTRL_SET_DEINTERLACE, &deinterlace);
- set_osd_msg(OSD_MSG_SPEED, 1, osd_duration, MSGTR_OSDDeinterlace,
- deinterlace ? MSGTR_Enabled : MSGTR_Disabled);
+ return M_PROPERTY_OK;
+ }
+ int value = 0;
+ vf->control(vf, VFCTRL_GET_DEINTERLACE, &value);
+ return m_property_flag_ro(prop, action, arg, value);
+}
+
+static int mp_property_yuv_colorspace(m_option_t *prop, int action,
+ void *arg, MPContext *mpctx)
+{
+ if (!mpctx->sh_video || !mpctx->sh_video->vfilter)
+ return M_PROPERTY_UNAVAILABLE;
+
+ struct vf_instance *vf = mpctx->sh_video->vfilter;
+ int colorspace;
+ switch (action) {
+ case M_PROPERTY_GET:
+ if (!arg)
+ return M_PROPERTY_ERROR;
+ if (vf->control(vf, VFCTRL_GET_YUV_COLORSPACE, arg) != true)
+ return M_PROPERTY_UNAVAILABLE;
+ return M_PROPERTY_OK;
+ case M_PROPERTY_PRINT:
+ if (!arg)
+ return M_PROPERTY_ERROR;
+ if (vf->control(vf, VFCTRL_GET_YUV_COLORSPACE, &colorspace) != true)
+ return M_PROPERTY_UNAVAILABLE;
+ char * const names[] = {"BT.601 (SD)", "BT.709 (HD)", "SMPTE-240M"};
+ if (colorspace < 0 || colorspace >= sizeof(names) / sizeof(names[0]))
+ *(char **)arg = strdup("Unknown");
+ else
+ *(char**)arg = strdup(names[colorspace]);
+ return M_PROPERTY_OK;
+ case M_PROPERTY_SET:
+ if (!arg)
+ return M_PROPERTY_ERROR;
+ M_PROPERTY_CLAMP(prop, *(int *) arg);
+ vf->control(vf, VFCTRL_SET_YUV_COLORSPACE, arg);
+ return M_PROPERTY_OK;
+ case M_PROPERTY_STEP_UP:;
+ if (vf->control(vf, VFCTRL_GET_YUV_COLORSPACE, &colorspace) != true)
+ return M_PROPERTY_UNAVAILABLE;
+ colorspace += 1;
+ vf->control(vf, VFCTRL_SET_YUV_COLORSPACE, &colorspace);
return M_PROPERTY_OK;
}
return M_PROPERTY_NOT_IMPLEMENTED;
}
/// Panscan (RW)
-static int mp_property_panscan(m_option_t * prop, int action, void *arg,
- MPContext * mpctx)
+static int mp_property_panscan(m_option_t *prop, int action, void *arg,
+ MPContext *mpctx)
{
if (!mpctx->video_out
- || mpctx->video_out->control(VOCTRL_GET_PANSCAN, NULL) != VO_TRUE)
+ || vo_control(mpctx->video_out, VOCTRL_GET_PANSCAN, NULL) != VO_TRUE)
return M_PROPERTY_UNAVAILABLE;
switch (action) {
@@ -1053,7 +1123,7 @@ static int mp_property_panscan(m_option_t * prop, int action, void *arg,
return M_PROPERTY_ERROR;
M_PROPERTY_CLAMP(prop, *(float *) arg);
vo_panscan = *(float *) arg;
- mpctx->video_out->control(VOCTRL_SET_PANSCAN, NULL);
+ vo_control(mpctx->video_out, VOCTRL_SET_PANSCAN, NULL);
return M_PROPERTY_OK;
case M_PROPERTY_STEP_UP:
case M_PROPERTY_STEP_DOWN:
@@ -1063,7 +1133,7 @@ static int mp_property_panscan(m_option_t * prop, int action, void *arg,
vo_panscan = 1;
else if (vo_panscan < 0)
vo_panscan = 0;
- mpctx->video_out->control(VOCTRL_SET_PANSCAN, NULL);
+ vo_control(mpctx->video_out, VOCTRL_SET_PANSCAN, NULL);
return M_PROPERTY_OK;
default:
return m_property_float_range(prop, action, arg, &vo_panscan);
@@ -1073,8 +1143,8 @@ static int mp_property_panscan(m_option_t * prop, int action, void *arg,
/// Helper to set vo flags.
/** \ingroup PropertyImplHelper
*/
-static int mp_property_vo_flag(m_option_t * prop, int action, void *arg,
- int vo_ctrl, int *vo_var, MPContext * mpctx)
+static int mp_property_vo_flag(m_option_t *prop, int action, void *arg,
+ int vo_ctrl, int *vo_var, MPContext *mpctx)
{
if (!mpctx->video_out)
@@ -1089,8 +1159,8 @@ static int mp_property_vo_flag(m_option_t * prop, int action, void *arg,
return M_PROPERTY_OK;
case M_PROPERTY_STEP_UP:
case M_PROPERTY_STEP_DOWN:
- if (vo_config_count)
- mpctx->video_out->control(vo_ctrl, 0);
+ if (mpctx->video_out->config_ok)
+ vo_control(mpctx->video_out, vo_ctrl, 0);
return M_PROPERTY_OK;
default:
return m_property_flag(prop, action, arg, vo_var);
@@ -1098,32 +1168,32 @@ static int mp_property_vo_flag(m_option_t * prop, int action, void *arg,
}
/// Window always on top (RW)
-static int mp_property_ontop(m_option_t * prop, int action, void *arg,
- MPContext * mpctx)
+static int mp_property_ontop(m_option_t *prop, int action, void *arg,
+ MPContext *mpctx)
{
- return mp_property_vo_flag(prop, action, arg, VOCTRL_ONTOP, &vo_ontop,
- mpctx);
+ return mp_property_vo_flag(prop, action, arg, VOCTRL_ONTOP,
+ &mpctx->opts.vo_ontop, mpctx);
}
/// Display in the root window (RW)
-static int mp_property_rootwin(m_option_t * prop, int action, void *arg,
- MPContext * mpctx)
+static int mp_property_rootwin(m_option_t *prop, int action, void *arg,
+ MPContext *mpctx)
{
return mp_property_vo_flag(prop, action, arg, VOCTRL_ROOTWIN,
&vo_rootwin, mpctx);
}
/// Show window borders (RW)
-static int mp_property_border(m_option_t * prop, int action, void *arg,
- MPContext * mpctx)
+static int mp_property_border(m_option_t *prop, int action, void *arg,
+ MPContext *mpctx)
{
return mp_property_vo_flag(prop, action, arg, VOCTRL_BORDER,
&vo_border, mpctx);
}
/// Framedropping state (RW)
-static int mp_property_framedropping(m_option_t * prop, int action,
- void *arg, MPContext * mpctx)
+static int mp_property_framedropping(m_option_t *prop, int action,
+ void *arg, MPContext *mpctx)
{
if (!mpctx->sh_video)
@@ -1133,9 +1203,9 @@ static int mp_property_framedropping(m_option_t * prop, int action,
case M_PROPERTY_PRINT:
if (!arg)
return M_PROPERTY_ERROR;
- *(char **) arg = strdup(frame_dropping == 1 ? MSGTR_Enabled :
- (frame_dropping == 2 ? MSGTR_HardFrameDrop :
- MSGTR_Disabled));
+ *(char **) arg = strdup(frame_dropping == 1 ? mp_gtext("enabled") :
+ (frame_dropping == 2 ? mp_gtext("hard") :
+ mp_gtext("disabled")));
return M_PROPERTY_OK;
default:
return m_property_choice(prop, action, arg, &frame_dropping);
@@ -1143,10 +1213,11 @@ static int mp_property_framedropping(m_option_t * prop, int action,
}
/// Color settings, try to use vf/vo then fall back on TV. (RW)
-static int mp_property_gamma(m_option_t * prop, int action, void *arg,
- MPContext * mpctx)
+static int mp_property_gamma(m_option_t *prop, int action, void *arg,
+ MPContext *mpctx)
{
- int *gamma = prop->priv, r, val;
+ int *gamma = (int *)((char *)&mpctx->opts + (int)prop->priv);
+ int r, val;
if (!mpctx->sh_video)
return M_PROPERTY_UNAVAILABLE;
@@ -1200,15 +1271,15 @@ static int mp_property_gamma(m_option_t * prop, int action, void *arg,
}
/// VSync (RW)
-static int mp_property_vsync(m_option_t * prop, int action, void *arg,
- MPContext * mpctx)
+static int mp_property_vsync(m_option_t *prop, int action, void *arg,
+ MPContext *mpctx)
{
return m_property_flag(prop, action, arg, &vo_vsync);
}
/// Video codec tag (RO)
-static int mp_property_video_format(m_option_t * prop, int action,
- void *arg, MPContext * mpctx)
+static int mp_property_video_format(m_option_t *prop, int action,
+ void *arg, MPContext *mpctx)
{
char* meta;
if (!mpctx->sh_video)
@@ -1242,8 +1313,8 @@ static int mp_property_video_format(m_option_t * prop, int action,
}
/// Video codec name (RO)
-static int mp_property_video_codec(m_option_t * prop, int action,
- void *arg, MPContext * mpctx)
+static int mp_property_video_codec(m_option_t *prop, int action,
+ void *arg, MPContext *mpctx)
{
if (!mpctx->sh_video || !mpctx->sh_video->codec)
return M_PROPERTY_UNAVAILABLE;
@@ -1252,8 +1323,8 @@ static int mp_property_video_codec(m_option_t * prop, int action,
/// Video bitrate (RO)
-static int mp_property_video_bitrate(m_option_t * prop, int action,
- void *arg, MPContext * mpctx)
+static int mp_property_video_bitrate(m_option_t *prop, int action,
+ void *arg, MPContext *mpctx)
{
if (!mpctx->sh_video)
return M_PROPERTY_UNAVAILABLE;
@@ -1261,8 +1332,8 @@ static int mp_property_video_bitrate(m_option_t * prop, int action,
}
/// Video display width (RO)
-static int mp_property_width(m_option_t * prop, int action, void *arg,
- MPContext * mpctx)
+static int mp_property_width(m_option_t *prop, int action, void *arg,
+ MPContext *mpctx)
{
if (!mpctx->sh_video)
return M_PROPERTY_UNAVAILABLE;
@@ -1270,8 +1341,8 @@ static int mp_property_width(m_option_t * prop, int action, void *arg,
}
/// Video display height (RO)
-static int mp_property_height(m_option_t * prop, int action, void *arg,
- MPContext * mpctx)
+static int mp_property_height(m_option_t *prop, int action, void *arg,
+ MPContext *mpctx)
{
if (!mpctx->sh_video)
return M_PROPERTY_UNAVAILABLE;
@@ -1279,8 +1350,8 @@ static int mp_property_height(m_option_t * prop, int action, void *arg,
}
/// Video fps (RO)
-static int mp_property_fps(m_option_t * prop, int action, void *arg,
- MPContext * mpctx)
+static int mp_property_fps(m_option_t *prop, int action, void *arg,
+ MPContext *mpctx)
{
if (!mpctx->sh_video)
return M_PROPERTY_UNAVAILABLE;
@@ -1288,8 +1359,8 @@ static int mp_property_fps(m_option_t * prop, int action, void *arg,
}
/// Video aspect (RO)
-static int mp_property_aspect(m_option_t * prop, int action, void *arg,
- MPContext * mpctx)
+static int mp_property_aspect(m_option_t *prop, int action, void *arg,
+ MPContext *mpctx)
{
if (!mpctx->sh_video)
return M_PROPERTY_UNAVAILABLE;
@@ -1303,8 +1374,8 @@ static int mp_property_aspect(m_option_t * prop, int action, void *arg,
///@{
/// Text subtitle position (RW)
-static int mp_property_sub_pos(m_option_t * prop, int action, void *arg,
- MPContext * mpctx)
+static int mp_property_sub_pos(m_option_t *prop, int action, void *arg,
+ MPContext *mpctx)
{
switch (action) {
case M_PROPERTY_SET:
@@ -1319,17 +1390,17 @@ static int mp_property_sub_pos(m_option_t * prop, int action, void *arg,
}
/// Selected subtitles (RW)
-static int mp_property_sub(m_option_t * prop, int action, void *arg,
- MPContext * mpctx)
+static int mp_property_sub(m_option_t *prop, int action, void *arg,
+ MPContext *mpctx)
{
+ struct MPOpts *opts = &mpctx->opts;
demux_stream_t *const d_sub = mpctx->d_sub;
const int global_sub_size = mpctx->global_sub_size;
int source = -1, reset_spu = 0;
- double pts = 0;
char *sub_name;
if (global_sub_size <= 0)
- return M_PROPERTY_UNAVAILABLE;
+ return M_PROPERTY_UNAVAILABLE;
switch (action) {
case M_PROPERTY_GET:
@@ -1363,10 +1434,10 @@ static int mp_property_sub(m_option_t * prop, int action, void *arg,
}
#ifdef CONFIG_DVDNAV
if (mpctx->stream->type == STREAMTYPE_DVDNAV) {
- if (vo_spudec && dvdsub_id >= 0) {
+ if (vo_spudec && opts->sub_id >= 0) {
unsigned char lang[3];
- if (mp_dvdnav_lang_from_sid(mpctx->stream, dvdsub_id, lang)) {
- snprintf(*(char **) arg, 63, "(%d) %s", dvdsub_id, lang);
+ if (mp_dvdnav_lang_from_sid(mpctx->stream, opts->sub_id, lang)) {
+ snprintf(*(char **) arg, 63, "(%d) %s", opts->sub_id, lang);
return M_PROPERTY_OK;
}
}
@@ -1377,37 +1448,38 @@ static int mp_property_sub(m_option_t * prop, int action, void *arg,
|| mpctx->demuxer->type == DEMUXER_TYPE_LAVF
|| mpctx->demuxer->type == DEMUXER_TYPE_LAVF_PREFERRED
|| mpctx->demuxer->type == DEMUXER_TYPE_OGG)
- && d_sub && d_sub->sh && dvdsub_id >= 0) {
+ && d_sub && d_sub->sh && opts->sub_id >= 0) {
const char* lang = ((sh_sub_t*)d_sub->sh)->lang;
- if (!lang) lang = MSGTR_Unknown;
- snprintf(*(char **) arg, 63, "(%d) %s", dvdsub_id, lang);
+ if (!lang) lang = mp_gtext("unknown");
+ snprintf(*(char **) arg, 63, "(%d) %s", opts->sub_id, lang);
return M_PROPERTY_OK;
}
if (vo_vobsub && vobsub_id >= 0) {
- const char *language = MSGTR_Unknown;
+ const char *language = mp_gtext("unknown");
language = vobsub_get_id(vo_vobsub, (unsigned int) vobsub_id);
snprintf(*(char **) arg, 63, "(%d) %s",
- vobsub_id, language ? language : MSGTR_Unknown);
+ vobsub_id, language ? language : mp_gtext("unknown"));
return M_PROPERTY_OK;
}
#ifdef CONFIG_DVDREAD
if (vo_spudec && mpctx->stream->type == STREAMTYPE_DVD
- && dvdsub_id >= 0) {
+ && opts->sub_id >= 0) {
char lang[3];
- int code = dvd_lang_from_sid(mpctx->stream, dvdsub_id);
+ int code = dvd_lang_from_sid(mpctx->stream, opts->sub_id);
lang[0] = code >> 8;
lang[1] = code;
lang[2] = 0;
- snprintf(*(char **) arg, 63, "(%d) %s", dvdsub_id, lang);
+ snprintf(*(char **) arg, 63, "(%d) %s", opts->sub_id, lang);
return M_PROPERTY_OK;
}
#endif
- if (dvdsub_id >= 0) {
- snprintf(*(char **) arg, 63, "(%d) %s", dvdsub_id, MSGTR_Unknown);
+ if (opts->sub_id >= 0) {
+ snprintf(*(char **) arg, 63, "(%d) %s", opts->sub_id,
+ mp_gtext("unknown"));
return M_PROPERTY_OK;
}
- snprintf(*(char **) arg, 63, MSGTR_Disabled);
+ snprintf(*(char **) arg, 63, mp_gtext("disabled"));
return M_PROPERTY_OK;
case M_PROPERTY_SET:
@@ -1448,7 +1520,7 @@ static int mp_property_sub(m_option_t * prop, int action, void *arg,
subdata = NULL;
vobsub_id = -1;
- dvdsub_id = -1;
+ opts->sub_id = -1;
if (d_sub) {
if (d_sub->id > -2)
reset_spu = 1;
@@ -1464,7 +1536,7 @@ static int mp_property_sub(m_option_t * prop, int action, void *arg,
mpctx->set_of_sub_pos =
mpctx->global_sub_pos - mpctx->global_sub_indices[SUB_SOURCE_SUBS];
#ifdef CONFIG_ASS
- if (ass_enabled && mpctx->set_of_ass_tracks[mpctx->set_of_sub_pos])
+ if (opts->ass_enabled && mpctx->set_of_ass_tracks[mpctx->set_of_sub_pos])
ass_track = mpctx->set_of_ass_tracks[mpctx->set_of_sub_pos];
else
#endif
@@ -1473,17 +1545,17 @@ static int mp_property_sub(m_option_t * prop, int action, void *arg,
vo_osd_changed(OSDTYPE_SUBTITLE);
}
} else if (source == SUB_SOURCE_DEMUX) {
- dvdsub_id =
+ opts->sub_id =
mpctx->global_sub_pos - mpctx->global_sub_indices[SUB_SOURCE_DEMUX];
- if (d_sub && dvdsub_id < MAX_S_STREAMS) {
+ if (d_sub && opts->sub_id < MAX_S_STREAMS) {
int i = 0;
// default: assume 1:1 mapping of sid and stream id
- d_sub->id = dvdsub_id;
+ d_sub->id = opts->sub_id;
d_sub->sh = mpctx->demuxer->s_streams[d_sub->id];
ds_free_packs(d_sub);
for (i = 0; i < MAX_S_STREAMS; i++) {
sh_sub_t *sh = mpctx->demuxer->s_streams[i];
- if (sh && sh->sid == dvdsub_id) {
+ if (sh && sh->sid == opts->sub_id) {
d_sub->id = i;
d_sub->sh = sh;
break;
@@ -1492,9 +1564,9 @@ static int mp_property_sub(m_option_t * prop, int action, void *arg,
if (d_sub->sh && d_sub->id >= 0) {
sh_sub_t *sh = d_sub->sh;
if (sh->type == 'v')
- init_vo_spudec();
+ init_vo_spudec(mpctx);
#ifdef CONFIG_ASS
- else if (ass_enabled)
+ else if (opts->ass_enabled)
ass_track = sh->ass_track;
#endif
} else {
@@ -1507,23 +1579,20 @@ static int mp_property_sub(m_option_t * prop, int action, void *arg,
if (vo_spudec
&& (mpctx->stream->type == STREAMTYPE_DVD
|| mpctx->stream->type == STREAMTYPE_DVDNAV)
- && dvdsub_id < 0 && reset_spu) {
+ && opts->sub_id < 0 && reset_spu) {
d_sub->id = -2;
d_sub->sh = NULL;
}
#endif
- if (mpctx->sh_audio)
- pts = mpctx->sh_audio->pts;
- if (mpctx->sh_video)
- pts = mpctx->sh_video->pts;
- update_subtitles(mpctx->sh_video, pts, d_sub, 1);
+
+ update_subtitles(mpctx, &mpctx->opts, mpctx->sh_video, 0, 0, d_sub, 1);
return M_PROPERTY_OK;
}
/// Selected sub source (RW)
-static int mp_property_sub_source(m_option_t * prop, int action, void *arg,
- MPContext * mpctx)
+static int mp_property_sub_source(m_option_t *prop, int action, void *arg,
+ MPContext *mpctx)
{
int source;
if (!mpctx->sh_video || mpctx->global_sub_size <= 0)
@@ -1543,16 +1612,16 @@ static int mp_property_sub_source(m_option_t * prop, int action, void *arg,
switch (sub_source(mpctx))
{
case SUB_SOURCE_SUBS:
- snprintf(*(char **) arg, 63, MSGTR_SubSourceFile);
+ snprintf(*(char **) arg, 63, mp_gtext("file"));
break;
case SUB_SOURCE_VOBSUB:
- snprintf(*(char **) arg, 63, MSGTR_SubSourceVobsub);
+ snprintf(*(char **) arg, 63, mp_gtext("vobsub"));
break;
case SUB_SOURCE_DEMUX:
- snprintf(*(char **) arg, 63, MSGTR_SubSourceDemux);
+ snprintf(*(char **) arg, 63, mp_gtext("embedded"));
break;
default:
- snprintf(*(char **) arg, 63, MSGTR_Disabled);
+ snprintf(*(char **) arg, 63, mp_gtext("disabled"));
}
return M_PROPERTY_OK;
case M_PROPERTY_SET:
@@ -1600,8 +1669,8 @@ static int mp_property_sub_source(m_option_t * prop, int action, void *arg,
}
/// Selected subtitles from specific source (RW)
-static int mp_property_sub_by_type(m_option_t * prop, int action, void *arg,
- MPContext * mpctx)
+static int mp_property_sub_by_type(m_option_t *prop, int action, void *arg,
+ MPContext *mpctx)
{
int source, is_cur_source, offset;
if (!mpctx->sh_video || mpctx->global_sub_size <= 0)
@@ -1640,7 +1709,7 @@ static int mp_property_sub_by_type(m_option_t * prop, int action, void *arg,
return mp_property_sub(prop, M_PROPERTY_PRINT, arg, mpctx);
*(char **) arg = malloc(64);
(*(char **) arg)[63] = 0;
- snprintf(*(char **) arg, 63, MSGTR_Disabled);
+ snprintf(*(char **) arg, 63, mp_gtext("disabled"));
return M_PROPERTY_OK;
case M_PROPERTY_SET:
if (!arg)
@@ -1700,8 +1769,8 @@ static int mp_property_sub_by_type(m_option_t * prop, int action, void *arg,
}
/// Subtitle delay (RW)
-static int mp_property_sub_delay(m_option_t * prop, int action, void *arg,
- MPContext * mpctx)
+static int mp_property_sub_delay(m_option_t *prop, int action, void *arg,
+ MPContext *mpctx)
{
if (!mpctx->sh_video)
return M_PROPERTY_UNAVAILABLE;
@@ -1709,10 +1778,10 @@ static int mp_property_sub_delay(m_option_t * prop, int action, void *arg,
}
/// Alignment of text subtitles (RW)
-static int mp_property_sub_alignment(m_option_t * prop, int action,
- void *arg, MPContext * mpctx)
+static int mp_property_sub_alignment(m_option_t *prop, int action,
+ void *arg, MPContext *mpctx)
{
- char *name[] = { MSGTR_Top, MSGTR_Center, MSGTR_Bottom };
+ char *name[] = { _("top"), _("center"), _("bottom") };
if (!mpctx->sh_video || mpctx->global_sub_pos < 0
|| sub_source(mpctx) != SUB_SOURCE_SUBS)
@@ -1723,7 +1792,7 @@ static int mp_property_sub_alignment(m_option_t * prop, int action,
if (!arg)
return M_PROPERTY_ERROR;
M_PROPERTY_CLAMP(prop, sub_alignment);
- *(char **) arg = strdup(name[sub_alignment]);
+ *(char **) arg = strdup(mp_gtext(name[sub_alignment]));
return M_PROPERTY_OK;
case M_PROPERTY_SET:
if (!arg)
@@ -1737,8 +1806,8 @@ static int mp_property_sub_alignment(m_option_t * prop, int action,
}
/// Subtitle visibility (RW)
-static int mp_property_sub_visibility(m_option_t * prop, int action,
- void *arg, MPContext * mpctx)
+static int mp_property_sub_visibility(m_option_t *prop, int action,
+ void *arg, MPContext *mpctx)
{
if (!mpctx->sh_video)
return M_PROPERTY_UNAVAILABLE;
@@ -1759,8 +1828,8 @@ static int mp_property_sub_visibility(m_option_t * prop, int action,
#ifdef CONFIG_ASS
/// Use margins for libass subtitles (RW)
-static int mp_property_ass_use_margins(m_option_t * prop, int action,
- void *arg, MPContext * mpctx)
+static int mp_property_ass_use_margins(m_option_t *prop, int action,
+ void *arg, MPContext *mpctx)
{
if (!mpctx->sh_video)
return M_PROPERTY_UNAVAILABLE;
@@ -1779,8 +1848,8 @@ static int mp_property_ass_use_margins(m_option_t * prop, int action,
#endif
/// Show only forced subtitles (RW)
-static int mp_property_sub_forced_only(m_option_t * prop, int action,
- void *arg, MPContext * mpctx)
+static int mp_property_sub_forced_only(m_option_t *prop, int action,
+ void *arg, MPContext *mpctx)
{
if (!vo_spudec)
return M_PROPERTY_UNAVAILABLE;
@@ -1802,9 +1871,10 @@ static int mp_property_sub_forced_only(m_option_t * prop, int action,
#ifdef CONFIG_FREETYPE
/// Subtitle scale (RW)
-static int mp_property_sub_scale(m_option_t * prop, int action, void *arg,
- MPContext * mpctx)
+static int mp_property_sub_scale(m_option_t *prop, int action, void *arg,
+ MPContext *mpctx)
{
+ struct MPOpts *opts = &mpctx->opts;
switch (action) {
case M_PROPERTY_SET:
@@ -1812,7 +1882,7 @@ static int mp_property_sub_scale(m_option_t * prop, int action, void *arg,
return M_PROPERTY_ERROR;
M_PROPERTY_CLAMP(prop, *(float *) arg);
#ifdef CONFIG_ASS
- if (ass_enabled) {
+ if (opts->ass_enabled) {
ass_font_scale = *(float *) arg;
ass_force_reload = 1;
}
@@ -1823,7 +1893,7 @@ static int mp_property_sub_scale(m_option_t * prop, int action, void *arg,
case M_PROPERTY_STEP_UP:
case M_PROPERTY_STEP_DOWN:
#ifdef CONFIG_ASS
- if (ass_enabled) {
+ if (opts->ass_enabled) {
ass_font_scale += (arg ? *(float *) arg : 0.1)*
(action == M_PROPERTY_STEP_UP ? 1.0 : -1.0);
M_PROPERTY_CLAMP(prop, ass_font_scale);
@@ -1837,7 +1907,7 @@ static int mp_property_sub_scale(m_option_t * prop, int action, void *arg,
return M_PROPERTY_OK;
default:
#ifdef CONFIG_ASS
- if (ass_enabled)
+ if (opts->ass_enabled)
return m_property_float_ro(prop, action, arg, ass_font_scale);
else
#endif
@@ -1855,8 +1925,8 @@ static int mp_property_sub_scale(m_option_t * prop, int action, void *arg,
#ifdef CONFIG_TV
/// TV color settings (RW)
-static int mp_property_tv_color(m_option_t * prop, int action, void *arg,
- MPContext * mpctx)
+static int mp_property_tv_color(m_option_t *prop, int action, void *arg,
+ MPContext *mpctx)
{
int r, val;
tvi_handle_t *tvh = mpctx->demuxer->priv;
@@ -1888,8 +1958,8 @@ static int mp_property_tv_color(m_option_t * prop, int action, void *arg,
#endif
-static int mp_property_teletext_common(m_option_t * prop, int action, void *arg,
- MPContext * mpctx)
+static int mp_property_teletext_common(m_option_t *prop, int action, void *arg,
+ MPContext *mpctx)
{
int val,result;
int base_ioctl=(int)prop->priv;
@@ -1928,8 +1998,8 @@ static int mp_property_teletext_common(m_option_t * prop, int action, void *arg,
return result == VBI_CONTROL_TRUE ? M_PROPERTY_OK : M_PROPERTY_ERROR;
}
-static int mp_property_teletext_mode(m_option_t * prop, int action, void *arg,
- MPContext * mpctx)
+static int mp_property_teletext_mode(m_option_t *prop, int action, void *arg,
+ MPContext *mpctx)
{
int result;
int val;
@@ -1941,14 +2011,14 @@ static int mp_property_teletext_mode(m_option_t * prop, int action, void *arg,
if(teletext_control(mpctx->demuxer->teletext,
(int)prop->priv, &val)==VBI_CONTROL_TRUE && val)
- mp_input_set_section("teletext");
+ mp_input_set_section(mpctx->input, "teletext");
else
- mp_input_set_section("tv");
+ mp_input_set_section(mpctx->input, "tv");
return M_PROPERTY_OK;
}
-static int mp_property_teletext_page(m_option_t * prop, int action, void *arg,
- MPContext * mpctx)
+static int mp_property_teletext_page(m_option_t *prop, int action, void *arg,
+ MPContext *mpctx)
{
int result;
int val;
@@ -2039,6 +2109,8 @@ static const m_option_t mp_properties[] = {
M_OPT_RANGE, 0, 1, NULL },
{ "deinterlace", mp_property_deinterlace, CONF_TYPE_FLAG,
M_OPT_RANGE, 0, 1, NULL },
+ { "yuv_colorspace", mp_property_yuv_colorspace, CONF_TYPE_INT,
+ M_OPT_RANGE, 0, 2, NULL },
{ "ontop", mp_property_ontop, CONF_TYPE_FLAG,
M_OPT_RANGE, 0, 1, NULL },
{ "rootwin", mp_property_rootwin, CONF_TYPE_FLAG,
@@ -2048,15 +2120,15 @@ static const m_option_t mp_properties[] = {
{ "framedropping", mp_property_framedropping, CONF_TYPE_INT,
M_OPT_RANGE, 0, 2, NULL },
{ "gamma", mp_property_gamma, CONF_TYPE_INT,
- M_OPT_RANGE, -100, 100, &vo_gamma_gamma },
+ M_OPT_RANGE, -100, 100, (void *)offsetof(struct MPOpts, vo_gamma_gamma)},
{ "brightness", mp_property_gamma, CONF_TYPE_INT,
- M_OPT_RANGE, -100, 100, &vo_gamma_brightness },
+ M_OPT_RANGE, -100, 100, (void *)offsetof(struct MPOpts, vo_gamma_brightness) },
{ "contrast", mp_property_gamma, CONF_TYPE_INT,
- M_OPT_RANGE, -100, 100, &vo_gamma_contrast },
+ M_OPT_RANGE, -100, 100, (void *)offsetof(struct MPOpts, vo_gamma_contrast) },
{ "saturation", mp_property_gamma, CONF_TYPE_INT,
- M_OPT_RANGE, -100, 100, &vo_gamma_saturation },
+ M_OPT_RANGE, -100, 100, (void *)offsetof(struct MPOpts, vo_gamma_saturation) },
{ "hue", mp_property_gamma, CONF_TYPE_INT,
- M_OPT_RANGE, -100, 100, &vo_gamma_hue },
+ M_OPT_RANGE, -100, 100, (void *)offsetof(struct MPOpts, vo_gamma_hue) },
{ "panscan", mp_property_panscan, CONF_TYPE_FLOAT,
M_OPT_RANGE, 0, 1, NULL },
{ "vsync", mp_property_vsync, CONF_TYPE_FLAG,
@@ -2147,7 +2219,7 @@ char* mp_property_print(const char *name, void* ctx)
return ret;
}
-char *property_expand_string(MPContext * mpctx, char *str)
+char *property_expand_string(MPContext *mpctx, char *str)
{
return m_properties_expand_string(mp_properties, str, mpctx);
}
@@ -2158,8 +2230,120 @@ void property_print_help(void)
}
-///@}
-// Properties group
+/* List of default ways to show a property on OSD.
+ *
+ * Setting osd_progbar to -1 displays seek bar, other nonzero displays
+ * a bar showing the current position between min/max values of the
+ * property. In this case osd_msg is only used for terminal output
+ * if there is no video; it'll be a label shown together with percentage.
+ *
+ * Otherwise setting osd_msg will show the string on OSD, formatted with
+ * the text value of the property as argument.
+ */
+static struct property_osd_display {
+ /// property name
+ const char *name;
+ /// progressbar type
+ int osd_progbar; // -1 is special value for seek indicators
+ /// osd msg id if it must be shared
+ int osd_id;
+ /// osd msg template
+ const char *osd_msg;
+} property_osd_display[] = {
+ // general
+ { "loop", 0, -1, _("Loop: %s") },
+ { "chapter", -1, -1, NULL },
+ // audio
+ { "volume", OSD_VOLUME, -1, _("Volume") },
+ { "mute", 0, -1, _("Mute: %s") },
+ { "audio_delay", 0, -1, _("A-V delay: %s") },
+ { "switch_audio", 0, -1, _("Audio: %s") },
+ { "balance", OSD_BALANCE, -1, _("Balance") },
+ // video
+ { "panscan", OSD_PANSCAN, -1, _("Panscan") },
+ { "ontop", 0, -1, _("Stay on top: %s") },
+ { "rootwin", 0, -1, _("Rootwin: %s") },
+ { "border", 0, -1, _("Border: %s") },
+ { "framedropping", 0, -1, _("Framedropping: %s") },
+ { "deinterlace", 0, -1, _("Deinterlace: %s") },
+ { "yuv_colorspace", 0, -1, _("YUV colorspace: %s") },
+ { "gamma", OSD_BRIGHTNESS, -1, _("Gamma") },
+ { "brightness", OSD_BRIGHTNESS, -1, _("Brightness") },
+ { "contrast", OSD_CONTRAST, -1, _("Contrast") },
+ { "saturation", OSD_SATURATION, -1, _("Saturation") },
+ { "hue", OSD_HUE, -1, _("Hue") },
+ { "vsync", 0, -1, _("VSync: %s") },
+ // subs
+ { "sub", 0, -1, _("Subtitles: %s") },
+ { "sub_source", 0, -1, _("Sub source: %s") },
+ { "sub_vob", 0, -1, _("Subtitles: %s") },
+ { "sub_demux", 0, -1, _("Subtitles: %s") },
+ { "sub_file", 0, -1, _("Subtitles: %s") },
+ { "sub_pos", 0, -1, _("Sub position: %s/100") },
+ { "sub_alignment", 0, -1, _("Sub alignment: %s") },
+ { "sub_delay", 0, OSD_MSG_SUB_DELAY, _("Sub delay: %s") },
+ { "sub_visibility", 0, -1, _("Subtitles: %s") },
+ { "sub_forced_only", 0, -1, _("Forced sub only: %s") },
+#ifdef CONFIG_FREETYPE
+ { "sub_scale", 0, -1, _("Sub Scale: %s")},
+#endif
+#ifdef CONFIG_TV
+ { "tv_brightness", OSD_BRIGHTNESS, -1, _("Brightness") },
+ { "tv_hue", OSD_HUE, -1, _("Hue") },
+ { "tv_saturation", OSD_SATURATION, -1, _("Saturation") },
+ { "tv_contrast", OSD_CONTRAST, -1, _("Contrast") },
+#endif
+ {}
+};
+
+static int show_property_osd(MPContext *mpctx, const char *pname)
+{
+ struct MPOpts *opts = &mpctx->opts;
+ int r;
+ m_option_t* prop;
+ struct property_osd_display *p;
+
+ // look for the command
+ for (p = property_osd_display; p->name; p++)
+ if (!strcmp(p->name, pname))
+ break;
+ if (!p->name)
+ return -1;
+
+ if (mp_property_do(pname, M_PROPERTY_GET_TYPE, &prop, mpctx) <= 0 || !prop)
+ return -1;
+
+ if (p->osd_progbar == -1)
+ mpctx->add_osd_seek_info = true;
+ else if (p->osd_progbar) {
+ if (prop->type == CONF_TYPE_INT) {
+ if (mp_property_do(pname, M_PROPERTY_GET, &r, mpctx) > 0)
+ set_osd_bar(mpctx, p->osd_progbar, mp_gtext(p->osd_msg),
+ prop->min, prop->max, r);
+ } else if (prop->type == CONF_TYPE_FLOAT) {
+ float f;
+ if (mp_property_do(pname, M_PROPERTY_GET, &f, mpctx) > 0)
+ set_osd_bar(mpctx, p->osd_progbar, mp_gtext(p->osd_msg),
+ prop->min, prop->max, f);
+ } else {
+ mp_msg(MSGT_CPLAYER, MSGL_ERR,
+ "Property use an unsupported type.\n");
+ return -1;
+ }
+ return 0;
+ }
+
+ if (p->osd_msg) {
+ char *val = mp_property_print(pname, mpctx);
+ if (val) {
+ int index = p - property_osd_display;
+ set_osd_tmsg(p->osd_id >= 0 ? p->osd_id : OSD_MSG_PROPERTY + index,
+ 1, opts->osd_duration, p->osd_msg, val);
+ free(val);
+ }
+ }
+ return 0;
+}
/**
@@ -2189,65 +2373,59 @@ static struct {
int cmd;
/// set/adjust or toggle command
int toggle;
- /// progressbar type
- int osd_progbar;
- /// osd msg id if it must be shared
- int osd_id;
- /// osd msg template
- const char *osd_msg;
} set_prop_cmd[] = {
// general
- { "loop", MP_CMD_LOOP, 0, 0, -1, MSGTR_LoopStatus },
- { "chapter", MP_CMD_SEEK_CHAPTER, 0, 0, -1, NULL },
- { "angle", MP_CMD_SWITCH_ANGLE, 0, 0, -1, NULL },
+ { "loop", MP_CMD_LOOP, 0},
+ { "chapter", MP_CMD_SEEK_CHAPTER, 0},
+ { "angle", MP_CMD_SWITCH_ANGLE, 0},
+ { "pause", MP_CMD_PAUSE, 0},
// audio
- { "volume", MP_CMD_VOLUME, 0, OSD_VOLUME, -1, MSGTR_Volume },
- { "mute", MP_CMD_MUTE, 1, 0, -1, MSGTR_MuteStatus },
- { "audio_delay", MP_CMD_AUDIO_DELAY, 0, 0, -1, MSGTR_AVDelayStatus },
- { "switch_audio", MP_CMD_SWITCH_AUDIO, 1, 0, -1, MSGTR_OSDAudio },
- { "balance", MP_CMD_BALANCE, 0, OSD_BALANCE, -1, MSGTR_Balance },
+ { "volume", MP_CMD_VOLUME, 0},
+ { "mute", MP_CMD_MUTE, 1},
+ { "audio_delay", MP_CMD_AUDIO_DELAY, 0},
+ { "switch_audio", MP_CMD_SWITCH_AUDIO, 1},
+ { "balance", MP_CMD_BALANCE, 0},
// video
- { "fullscreen", MP_CMD_VO_FULLSCREEN, 1, 0, -1, NULL },
- { "panscan", MP_CMD_PANSCAN, 0, OSD_PANSCAN, -1, MSGTR_Panscan },
- { "ontop", MP_CMD_VO_ONTOP, 1, 0, -1, MSGTR_OnTopStatus },
- { "rootwin", MP_CMD_VO_ROOTWIN, 1, 0, -1, MSGTR_RootwinStatus },
- { "border", MP_CMD_VO_BORDER, 1, 0, -1, MSGTR_BorderStatus },
- { "framedropping", MP_CMD_FRAMEDROPPING, 1, 0, -1, MSGTR_FramedroppingStatus },
- { "gamma", MP_CMD_GAMMA, 0, OSD_BRIGHTNESS, -1, MSGTR_Gamma },
- { "brightness", MP_CMD_BRIGHTNESS, 0, OSD_BRIGHTNESS, -1, MSGTR_Brightness },
- { "contrast", MP_CMD_CONTRAST, 0, OSD_CONTRAST, -1, MSGTR_Contrast },
- { "saturation", MP_CMD_SATURATION, 0, OSD_SATURATION, -1, MSGTR_Saturation },
- { "hue", MP_CMD_HUE, 0, OSD_HUE, -1, MSGTR_Hue },
- { "vsync", MP_CMD_SWITCH_VSYNC, 1, 0, -1, MSGTR_VSyncStatus },
- // subs
- { "sub", MP_CMD_SUB_SELECT, 1, 0, -1, MSGTR_SubSelectStatus },
- { "sub_source", MP_CMD_SUB_SOURCE, 1, 0, -1, MSGTR_SubSourceStatus },
- { "sub_vob", MP_CMD_SUB_VOB, 1, 0, -1, MSGTR_SubSelectStatus },
- { "sub_demux", MP_CMD_SUB_DEMUX, 1, 0, -1, MSGTR_SubSelectStatus },
- { "sub_file", MP_CMD_SUB_FILE, 1, 0, -1, MSGTR_SubSelectStatus },
- { "sub_pos", MP_CMD_SUB_POS, 0, 0, -1, MSGTR_SubPosStatus },
- { "sub_alignment", MP_CMD_SUB_ALIGNMENT, 1, 0, -1, MSGTR_SubAlignStatus },
- { "sub_delay", MP_CMD_SUB_DELAY, 0, 0, OSD_MSG_SUB_DELAY, MSGTR_SubDelayStatus },
- { "sub_visibility", MP_CMD_SUB_VISIBILITY, 1, 0, -1, MSGTR_SubVisibleStatus },
- { "sub_forced_only", MP_CMD_SUB_FORCED_ONLY, 1, 0, -1, MSGTR_SubForcedOnlyStatus },
+ { "fullscreen", MP_CMD_VO_FULLSCREEN, 1},
+ { "panscan", MP_CMD_PANSCAN, 0},
+ { "ontop", MP_CMD_VO_ONTOP, 1},
+ { "rootwin", MP_CMD_VO_ROOTWIN, 1},
+ { "border", MP_CMD_VO_BORDER, 1},
+ { "framedropping", MP_CMD_FRAMEDROPPING, 1},
+ { "gamma", MP_CMD_GAMMA, 0},
+ { "brightness", MP_CMD_BRIGHTNESS, 0},
+ { "contrast", MP_CMD_CONTRAST, 0},
+ { "saturation", MP_CMD_SATURATION, 0},
+ { "hue", MP_CMD_HUE, 0},
+ { "vsync", MP_CMD_SWITCH_VSYNC, 1},
+ // subs
+ { "sub", MP_CMD_SUB_SELECT, 1},
+ { "sub_source", MP_CMD_SUB_SOURCE, 1},
+ { "sub_vob", MP_CMD_SUB_VOB, 1},
+ { "sub_demux", MP_CMD_SUB_DEMUX, 1},
+ { "sub_file", MP_CMD_SUB_FILE, 1},
+ { "sub_pos", MP_CMD_SUB_POS, 0},
+ { "sub_alignment", MP_CMD_SUB_ALIGNMENT, 1},
+ { "sub_delay", MP_CMD_SUB_DELAY, 0},
+ { "sub_visibility", MP_CMD_SUB_VISIBILITY, 1},
+ { "sub_forced_only", MP_CMD_SUB_FORCED_ONLY, 1},
#ifdef CONFIG_FREETYPE
- { "sub_scale", MP_CMD_SUB_SCALE, 0, 0, -1, MSGTR_SubScale},
+ { "sub_scale", MP_CMD_SUB_SCALE, 0},
#endif
#ifdef CONFIG_ASS
- { "ass_use_margins", MP_CMD_ASS_USE_MARGINS, 1, 0, -1, NULL },
+ { "ass_use_margins", MP_CMD_ASS_USE_MARGINS, 1},
#endif
#ifdef CONFIG_TV
- { "tv_brightness", MP_CMD_TV_SET_BRIGHTNESS, 0, OSD_BRIGHTNESS, -1, MSGTR_Brightness },
- { "tv_hue", MP_CMD_TV_SET_HUE, 0, OSD_HUE, -1, MSGTR_Hue },
- { "tv_saturation", MP_CMD_TV_SET_SATURATION, 0, OSD_SATURATION, -1, MSGTR_Saturation },
- { "tv_contrast", MP_CMD_TV_SET_CONTRAST, 0, OSD_CONTRAST, -1, MSGTR_Contrast },
+ { "tv_brightness", MP_CMD_TV_SET_BRIGHTNESS, 0},
+ { "tv_hue", MP_CMD_TV_SET_HUE, 0},
+ { "tv_saturation", MP_CMD_TV_SET_SATURATION, 0},
+ { "tv_contrast", MP_CMD_TV_SET_CONTRAST, 0},
#endif
- { NULL, 0, 0, 0, -1, NULL }
+ {}
};
-
/// Handle commands that set a property.
-static int set_property_command(MPContext * mpctx, mp_cmd_t * cmd)
+static int set_property_command(MPContext *mpctx, mp_cmd_t *cmd)
{
int i, r;
m_option_t* prop;
@@ -2278,31 +2456,8 @@ static int set_property_command(MPContext * mpctx, mp_cmd_t * cmd)
if (r <= 0)
return 1;
- if (set_prop_cmd[i].osd_progbar) {
- if (prop->type == CONF_TYPE_INT) {
- if (mp_property_do(pname, M_PROPERTY_GET, &r, mpctx) > 0)
- set_osd_bar(set_prop_cmd[i].osd_progbar,
- set_prop_cmd[i].osd_msg, prop->min, prop->max, r);
- } else if (prop->type == CONF_TYPE_FLOAT) {
- float f;
- if (mp_property_do(pname, M_PROPERTY_GET, &f, mpctx) > 0)
- set_osd_bar(set_prop_cmd[i].osd_progbar,
- set_prop_cmd[i].osd_msg, prop->min, prop->max, f);
- } else
- mp_msg(MSGT_CPLAYER, MSGL_ERR,
- "Property use an unsupported type.\n");
- return 1;
- }
+ show_property_osd(mpctx, pname);
- if (set_prop_cmd[i].osd_msg) {
- char *val = mp_property_print(pname, mpctx);
- if (val) {
- set_osd_msg(set_prop_cmd[i].osd_id >=
- 0 ? set_prop_cmd[i].osd_id : OSD_MSG_PROPERTY + i,
- 1, osd_duration, set_prop_cmd[i].osd_msg, val);
- free(val);
- }
- }
return 1;
}
@@ -2360,7 +2515,7 @@ static void remove_subtitle_range(MPContext *mpctx, int start, int count)
int after = mpctx->set_of_sub_size - end;
sub_data **subs = mpctx->set_of_subtitles;
#ifdef CONFIG_ASS
- ass_track_t **ass_tracks = mpctx->set_of_ass_tracks;
+ struct ass_track **ass_tracks = mpctx->set_of_ass_tracks;
#endif
if (count < 0 || count > mpctx->set_of_sub_size ||
start < 0 || start > mpctx->set_of_sub_size - count) {
@@ -2371,7 +2526,7 @@ static void remove_subtitle_range(MPContext *mpctx, int start, int count)
for (idx = start; idx < end; idx++) {
sub_data *subd = subs[idx];
mp_msg(MSGT_CPLAYER, MSGL_STATUS,
- MSGTR_RemovedSubtitleFile, idx + 1,
+ "SUB: Removed subtitle file (%d): %s\n", idx + 1,
filename_recode(subd->filename));
sub_free(subd);
subs[idx] = NULL;
@@ -2400,46 +2555,49 @@ static void remove_subtitle_range(MPContext *mpctx, int start, int count)
#ifdef CONFIG_ASS
ass_track = NULL;
#endif
- mp_input_queue_cmd(mp_input_parse_cmd("sub_select"));
+ mp_input_queue_cmd(mpctx->input, mp_input_parse_cmd("sub_select"));
} else if (mpctx->set_of_sub_pos >= end) {
mpctx->set_of_sub_pos -= count;
mpctx->global_sub_pos -= count;
}
}
-int run_command(MPContext * mpctx, mp_cmd_t * cmd)
+void run_command(MPContext *mpctx, mp_cmd_t *cmd)
{
+ struct MPOpts *opts = &mpctx->opts;
sh_audio_t * const sh_audio = mpctx->sh_audio;
sh_video_t * const sh_video = mpctx->sh_video;
- int brk_cmd = 0;
+ int osd_duration = opts->osd_duration;
+ int case_fallthrough_hack = 0;
if (!set_property_command(mpctx, cmd))
switch (cmd->id) {
case MP_CMD_SEEK:{
float v;
int abs;
- if (sh_video)
- mpctx->osd_show_percentage = sh_video->fps;
+ mpctx->add_osd_seek_info = true;
v = cmd->args[0].v.f;
abs = (cmd->nargs > 1) ? cmd->args[1].v.i : 0;
if (abs == 2) { /* Absolute seek to a specific timestamp in seconds */
- abs_seek_pos = SEEK_ABSOLUTE;
+ mpctx->abs_seek_pos = SEEK_ABSOLUTE;
if (sh_video)
mpctx->osd_function =
(v > sh_video->pts) ? OSD_FFW : OSD_REW;
- rel_seek_secs = v;
+ mpctx->rel_seek_secs = v;
} else if (abs) { /* Absolute seek by percentage */
- abs_seek_pos = SEEK_ABSOLUTE | SEEK_FACTOR;
+ mpctx->abs_seek_pos = SEEK_ABSOLUTE | SEEK_FACTOR;
if (sh_video)
mpctx->osd_function = OSD_FFW; // Direction isn't set correctly
- rel_seek_secs = v / 100.0;
+ mpctx->rel_seek_secs = v / 100.0;
} else {
- rel_seek_secs += v;
+ mpctx->rel_seek_secs += v;
mpctx->osd_function = (v > 0) ? OSD_FFW : OSD_REW;
}
- brk_cmd = 1;
}
break;
+ case MP_CMD_SET_PROPERTY_OSD:
+ case_fallthrough_hack = 1;
+
case MP_CMD_SET_PROPERTY:{
int r = mp_property_do(cmd->args[0].v.s, M_PROPERTY_PARSE,
cmd->args[1].v.s, mpctx);
@@ -2450,11 +2608,16 @@ int run_command(MPContext * mpctx, mp_cmd_t * cmd)
mp_msg(MSGT_CPLAYER, MSGL_WARN,
"Failed to set property '%s' to '%s'.\n",
cmd->args[0].v.s, cmd->args[1].v.s);
+ else if (case_fallthrough_hack)
+ show_property_osd(mpctx, cmd->args[0].v.s);
if (r <= 0)
mp_msg(MSGT_GLOBAL, MSGL_INFO, "ANS_ERROR=%s\n", property_error_string(r));
}
break;
+ case MP_CMD_STEP_PROPERTY_OSD:
+ case_fallthrough_hack = 1;
+
case MP_CMD_STEP_PROPERTY:{
void* arg = NULL;
int r,i;
@@ -2493,6 +2656,8 @@ int run_command(MPContext * mpctx, mp_cmd_t * cmd)
mp_msg(MSGT_CPLAYER, MSGL_WARN,
"Failed to increment property '%s' by %f.\n",
cmd->args[0].v.s, cmd->args[1].v.f);
+ else if (case_fallthrough_hack)
+ show_property_osd(mpctx, cmd->args[0].v.s);
if (r <= 0)
mp_msg(MSGT_GLOBAL, MSGL_INFO, "ANS_ERROR=%s\n", property_error_string(r));
}
@@ -2518,18 +2683,16 @@ int run_command(MPContext * mpctx, mp_cmd_t * cmd)
case MP_CMD_EDL_MARK:
if (edl_fd) {
float v = sh_video ? sh_video->pts :
- playing_audio_pts(sh_audio, mpctx->d_audio,
- mpctx->audio_out);
-
+ playing_audio_pts(mpctx);
if (mpctx->begin_skip == MP_NOPTS_VALUE) {
mpctx->begin_skip = v;
- mp_msg(MSGT_CPLAYER, MSGL_INFO, MSGTR_EdloutStartSkip);
+ mp_tmsg(MSGT_CPLAYER, MSGL_INFO, "EDL skip start, press 'i' again to end block.\n");
} else {
if (mpctx->begin_skip > v)
- mp_msg(MSGT_CPLAYER, MSGL_WARN, MSGTR_EdloutBadStop);
+ mp_tmsg(MSGT_CPLAYER, MSGL_WARN, "EDL skip canceled, last start > stop\n");
else {
fprintf(edl_fd, "%f %f %d\n", mpctx->begin_skip, v, 0);
- mp_msg(MSGT_CPLAYER, MSGL_INFO, MSGTR_EdloutEndSkip);
+ mp_tmsg(MSGT_CPLAYER, MSGL_INFO, "EDL skip end, line written.\n");
}
mpctx->begin_skip = MP_NOPTS_VALUE;
}
@@ -2540,40 +2703,38 @@ int run_command(MPContext * mpctx, mp_cmd_t * cmd)
if (!sh_video)
break;
if (cmd->nargs == 0 || cmd->args[0].v.f == -1)
- movie_aspect = (float) sh_video->disp_w / sh_video->disp_h;
+ opts->movie_aspect = (float) sh_video->disp_w / sh_video->disp_h;
else
- movie_aspect = cmd->args[0].v.f;
+ opts->movie_aspect = cmd->args[0].v.f;
mpcodecs_config_vo(sh_video, sh_video->disp_w, sh_video->disp_h, 0);
break;
case MP_CMD_SPEED_INCR:{
float v = cmd->args[0].v.f;
- playback_speed += v;
- build_afilter_chain(sh_audio, &ao_data);
- set_osd_msg(OSD_MSG_SPEED, 1, osd_duration, MSGTR_OSDSpeed,
- playback_speed);
+ opts->playback_speed += v;
+ build_afilter_chain(mpctx, sh_audio, &ao_data);
+ set_osd_tmsg(OSD_MSG_SPEED, 1, osd_duration, "Speed: x %6.2f",
+ opts->playback_speed);
} break;
case MP_CMD_SPEED_MULT:{
float v = cmd->args[0].v.f;
- playback_speed *= v;
- build_afilter_chain(sh_audio, &ao_data);
- set_osd_msg(OSD_MSG_SPEED, 1, osd_duration, MSGTR_OSDSpeed,
- playback_speed);
+ opts->playback_speed *= v;
+ build_afilter_chain(mpctx, sh_audio, &ao_data);
+ set_osd_tmsg(OSD_MSG_SPEED, 1, osd_duration, "Speed: x %6.2f",
+ opts->playback_speed);
} break;
case MP_CMD_SPEED_SET:{
float v = cmd->args[0].v.f;
- playback_speed = v;
- build_afilter_chain(sh_audio, &ao_data);
- set_osd_msg(OSD_MSG_SPEED, 1, osd_duration, MSGTR_OSDSpeed,
- playback_speed);
+ opts->playback_speed = v;
+ build_afilter_chain(mpctx, sh_audio, &ao_data);
+ set_osd_tmsg(OSD_MSG_SPEED, 1, osd_duration, "Speed: x %6.2f",
+ opts->playback_speed);
} break;
case MP_CMD_FRAME_STEP:
- case MP_CMD_PAUSE:
- cmd->pausing = 1;
- brk_cmd = 1;
+ add_step_frame(mpctx);
break;
case MP_CMD_FILE_FILTER:
@@ -2581,38 +2742,26 @@ int run_command(MPContext * mpctx, mp_cmd_t * cmd)
break;
case MP_CMD_QUIT:
- exit_player_with_rc(EXIT_QUIT,
+ exit_player_with_rc(mpctx, EXIT_QUIT,
(cmd->nargs > 0) ? cmd->args[0].v.i : 0);
case MP_CMD_PLAY_TREE_STEP:{
int n = cmd->args[0].v.i == 0 ? 1 : cmd->args[0].v.i;
int force = cmd->args[1].v.i;
-#ifdef CONFIG_GUI
- if (use_gui) {
- int i = 0;
- if (n > 0)
- for (i = 0; i < n; i++)
- mplNext();
- else
- for (i = 0; i < -1 * n; i++)
- mplPrev();
- } else
-#endif
{
if (!force && mpctx->playtree_iter) {
play_tree_iter_t *i =
play_tree_iter_new_copy(mpctx->playtree_iter);
if (play_tree_iter_step(i, n, 0) ==
PLAY_TREE_ITER_ENTRY)
- mpctx->eof =
+ mpctx->stop_play =
(n > 0) ? PT_NEXT_ENTRY : PT_PREV_ENTRY;
play_tree_iter_free(i);
} else
- mpctx->eof = (n > 0) ? PT_NEXT_ENTRY : PT_PREV_ENTRY;
- if (mpctx->eof)
+ mpctx->stop_play = (n > 0) ? PT_NEXT_ENTRY : PT_PREV_ENTRY;
+ if (mpctx->stop_play)
mpctx->play_tree_step = n;
- brk_cmd = 1;
}
}
break;
@@ -2625,11 +2774,10 @@ int run_command(MPContext * mpctx, mp_cmd_t * cmd)
play_tree_iter_t *i =
play_tree_iter_new_copy(mpctx->playtree_iter);
if (play_tree_iter_up_step(i, n, 0) == PLAY_TREE_ITER_ENTRY)
- mpctx->eof = (n > 0) ? PT_UP_NEXT : PT_UP_PREV;
+ mpctx->stop_play = (n > 0) ? PT_UP_NEXT : PT_UP_PREV;
play_tree_iter_free(i);
} else
- mpctx->eof = (n > 0) ? PT_UP_NEXT : PT_UP_PREV;
- brk_cmd = 1;
+ mpctx->stop_play = (n > 0) ? PT_UP_NEXT : PT_UP_PREV;
}
break;
@@ -2639,11 +2787,10 @@ int run_command(MPContext * mpctx, mp_cmd_t * cmd)
if (v > 0
&& mpctx->playtree_iter->file <
mpctx->playtree_iter->num_files)
- mpctx->eof = PT_NEXT_SRC;
+ mpctx->stop_play = PT_NEXT_SRC;
else if (v < 0 && mpctx->playtree_iter->file > 1)
- mpctx->eof = PT_PREV_SRC;
+ mpctx->stop_play = PT_PREV_SRC;
}
- brk_cmd = 1;
break;
case MP_CMD_SUB_STEP:
@@ -2657,32 +2804,32 @@ int run_command(MPContext * mpctx, mp_cmd_t * cmd)
(sh_video->pts +
sub_delay) * 1000 + .5, movement) / 1000.;
#endif
- set_osd_msg(OSD_MSG_SUB_DELAY, 1, osd_duration,
- MSGTR_OSDSubDelay, ROUND(sub_delay * 1000));
+ set_osd_tmsg(OSD_MSG_SUB_DELAY, 1, osd_duration,
+ "Sub delay: %d ms", ROUND(sub_delay * 1000));
}
break;
case MP_CMD_SUB_LOG:
- log_sub();
+ log_sub(mpctx);
break;
case MP_CMD_OSD:{
int v = cmd->args[0].v.i;
int max = (term_osd
&& !sh_video) ? MAX_TERM_OSD_LEVEL : MAX_OSD_LEVEL;
- if (osd_level > max)
- osd_level = max;
+ if (opts->osd_level > max)
+ opts->osd_level = max;
if (v < 0)
- osd_level = (osd_level + 1) % (max + 1);
+ opts->osd_level = (opts->osd_level + 1) % (max + 1);
else
- osd_level = v > max ? max : v;
+ opts->osd_level = v > max ? max : v;
/* Show OSD state when disabled, but not when an explicit
argument is given to the OSD command, i.e. in slave mode. */
- if (v == -1 && osd_level <= 1)
- set_osd_msg(OSD_MSG_OSD_STATUS, 0, osd_duration,
- MSGTR_OSDosd,
- osd_level ? MSGTR_OSDenabled :
- MSGTR_OSDdisabled);
+ if (v == -1 && opts->osd_level <= 1)
+ set_osd_tmsg(OSD_MSG_OSD_STATUS, 0, osd_duration,
+ "OSD: %s",
+ opts->osd_level ? mp_gtext("enabled") :
+ mp_gtext("disabled"));
else
rm_osd_msg(OSD_MSG_OSD_STATUS);
}
@@ -2724,17 +2871,16 @@ int run_command(MPContext * mpctx, mp_cmd_t * cmd)
play_tree_free_list(mpctx->playtree->child, 1);
play_tree_set_child(mpctx->playtree, e);
pt_iter_goto_head(mpctx->playtree_iter);
- mpctx->eof = PT_NEXT_SRC;
+ mpctx->stop_play = PT_NEXT_SRC;
}
- brk_cmd = 1;
}
break;
case MP_CMD_LOADLIST:{
- play_tree_t *e = parse_playlist_file(cmd->args[0].v.s);
+ play_tree_t *e = parse_playlist_file(mpctx->mconfig, cmd->args[0].v.s);
if (!e)
- mp_msg(MSGT_CPLAYER, MSGL_ERR,
- MSGTR_PlaylistLoadUnable, cmd->args[0].v.s);
+ mp_tmsg(MSGT_CPLAYER, MSGL_ERR,
+ "\nUnable to load playlist %s.\n", cmd->args[0].v.s);
else {
if (cmd->args[1].v.i) // append
play_tree_append_entry(mpctx->playtree->child, e);
@@ -2747,10 +2893,9 @@ int run_command(MPContext * mpctx, mp_cmd_t * cmd)
play_tree_free_list(mpctx->playtree->child, 1);
play_tree_set_child(mpctx->playtree, e);
pt_iter_goto_head(mpctx->playtree_iter);
- mpctx->eof = PT_NEXT_SRC;
+ mpctx->stop_play = PT_NEXT_SRC;
}
}
- brk_cmd = 1;
}
break;
@@ -2759,8 +2904,7 @@ int run_command(MPContext * mpctx, mp_cmd_t * cmd)
while (play_tree_iter_up_step
(mpctx->playtree_iter, 0, 1) != PLAY_TREE_ITER_END)
/* NOP */ ;
- mpctx->eof = PT_STOP;
- brk_cmd = 1;
+ mpctx->stop_play = PT_STOP;
break;
#ifdef CONFIG_RADIO
@@ -2774,9 +2918,9 @@ int run_command(MPContext * mpctx, mp_cmd_t * cmd)
radio_step_channel(mpctx->demuxer->stream,
RADIO_CHANNEL_LOWER);
if (radio_get_channel_name(mpctx->demuxer->stream)) {
- set_osd_msg(OSD_MSG_RADIO_CHANNEL, 1, osd_duration,
- MSGTR_OSDChannel,
- radio_get_channel_name(mpctx->demuxer->stream));
+ set_osd_tmsg(OSD_MSG_RADIO_CHANNEL, 1, osd_duration,
+ "Channel: %s",
+ radio_get_channel_name(mpctx->demuxer->stream));
}
}
break;
@@ -2785,9 +2929,9 @@ int run_command(MPContext * mpctx, mp_cmd_t * cmd)
if (mpctx->demuxer->stream->type == STREAMTYPE_RADIO) {
radio_set_channel(mpctx->demuxer->stream, cmd->args[0].v.s);
if (radio_get_channel_name(mpctx->demuxer->stream)) {
- set_osd_msg(OSD_MSG_RADIO_CHANNEL, 1, osd_duration,
- MSGTR_OSDChannel,
- radio_get_channel_name(mpctx->demuxer->stream));
+ set_osd_tmsg(OSD_MSG_RADIO_CHANNEL, 1, osd_duration,
+ "Channel: %s",
+ radio_get_channel_name(mpctx->demuxer->stream));
}
}
break;
@@ -2855,8 +2999,8 @@ int run_command(MPContext * mpctx, mp_cmd_t * cmd)
TV_CHANNEL_LOWER);
}
if (tv_channel_list) {
- set_osd_msg(OSD_MSG_TV_CHANNEL, 1, osd_duration,
- MSGTR_OSDChannel, tv_channel_current->name);
+ set_osd_tmsg(OSD_MSG_TV_CHANNEL, 1, osd_duration,
+ "Channel: %s", tv_channel_current->name);
//vo_osd_changed(OSDTYPE_SUBTITLE);
}
}
@@ -2882,8 +3026,10 @@ int run_command(MPContext * mpctx, mp_cmd_t * cmd)
dir = DVB_CHANNEL_LOWER;
- if (dvb_step_channel(mpctx->stream, dir))
- mpctx->eof = mpctx->dvbin_reopen = 1;
+ if (dvb_step_channel(mpctx->stream, dir)) {
+ mpctx->stop_play = PT_NEXT_ENTRY;
+ mpctx->dvbin_reopen = 1;
+ }
}
#endif /* CONFIG_DVBIN */
break;
@@ -2893,8 +3039,8 @@ int run_command(MPContext * mpctx, mp_cmd_t * cmd)
tv_set_channel((tvi_handle_t *) (mpctx->demuxer->priv),
cmd->args[0].v.s);
if (tv_channel_list) {
- set_osd_msg(OSD_MSG_TV_CHANNEL, 1, osd_duration,
- MSGTR_OSDChannel, tv_channel_current->name);
+ set_osd_tmsg(OSD_MSG_TV_CHANNEL, 1, osd_duration,
+ "Channel: %s", tv_channel_current->name);
//vo_osd_changed(OSDTYPE_SUBTITLE);
}
}
@@ -2913,9 +3059,11 @@ int run_command(MPContext * mpctx, mp_cmd_t * cmd)
if (mpctx->stream->type == STREAMTYPE_DVB) {
mpctx->last_dvb_step = 1;
- if (dvb_set_channel
- (mpctx->stream, cmd->args[1].v.i, cmd->args[0].v.i))
- mpctx->eof = mpctx->dvbin_reopen = 1;
+ if (dvb_set_channel(mpctx->stream, cmd->args[1].v.i,
+ cmd->args[0].v.i)) {
+ mpctx->stop_play = PT_NEXT_ENTRY;
+ mpctx->dvbin_reopen = 1;
+ }
}
break;
#endif /* CONFIG_DVBIN */
@@ -2924,8 +3072,8 @@ int run_command(MPContext * mpctx, mp_cmd_t * cmd)
if (mpctx->file_format == DEMUXER_TYPE_TV) {
tv_last_channel((tvi_handle_t *) (mpctx->demuxer->priv));
if (tv_channel_list) {
- set_osd_msg(OSD_MSG_TV_CHANNEL, 1, osd_duration,
- MSGTR_OSDChannel, tv_channel_current->name);
+ set_osd_tmsg(OSD_MSG_TV_CHANNEL, 1, osd_duration,
+ "Channel: %s", tv_channel_current->name);
//vo_osd_changed(OSDTYPE_SUBTITLE);
}
}
@@ -2967,7 +3115,7 @@ int run_command(MPContext * mpctx, mp_cmd_t * cmd)
case MP_CMD_SUB_LOAD:
if (sh_video) {
int n = mpctx->set_of_sub_size;
- add_subtitles(cmd->args[0].v.s, sh_video->fps, 0);
+ add_subtitles(mpctx, cmd->args[0].v.s, sh_video->fps, 0);
if (n != mpctx->set_of_sub_size) {
if (mpctx->global_sub_indices[SUB_SOURCE_SUBS] < 0)
mpctx->global_sub_indices[SUB_SOURCE_SUBS] =
@@ -2996,7 +3144,7 @@ int run_command(MPContext * mpctx, mp_cmd_t * cmd)
break;
case MP_CMD_SCREENSHOT:
- if (vo_config_count) {
+ if (mpctx->video_out && mpctx->video_out->config_ok) {
mp_msg(MSGT_CPLAYER, MSGL_INFO, "sending VFCTRL_SCREENSHOT!\n");
if (CONTROL_OK !=
((vf_instance_t *) sh_video->vfilter)->
@@ -3013,19 +3161,19 @@ int run_command(MPContext * mpctx, mp_cmd_t * cmd)
break;
case MP_CMD_GET_TIME_LENGTH:{
- mp_msg(MSGT_GLOBAL, MSGL_INFO, "ANS_LENGTH=%.2lf\n",
+ mp_msg(MSGT_GLOBAL, MSGL_INFO, "ANS_LENGTH=%.2f\n",
demuxer_get_time_length(mpctx->demuxer));
}
break;
case MP_CMD_GET_FILENAME:{
mp_msg(MSGT_GLOBAL, MSGL_INFO, "ANS_FILENAME='%s'\n",
- get_metadata(META_NAME));
+ get_metadata(mpctx, META_NAME));
}
break;
case MP_CMD_GET_VIDEO_CODEC:{
- char *inf = get_metadata(META_VIDEO_CODEC);
+ char *inf = get_metadata(mpctx, META_VIDEO_CODEC);
if (!inf)
inf = strdup("");
mp_msg(MSGT_GLOBAL, MSGL_INFO, "ANS_VIDEO_CODEC='%s'\n", inf);
@@ -3034,7 +3182,7 @@ int run_command(MPContext * mpctx, mp_cmd_t * cmd)
break;
case MP_CMD_GET_VIDEO_BITRATE:{
- char *inf = get_metadata(META_VIDEO_BITRATE);
+ char *inf = get_metadata(mpctx, META_VIDEO_BITRATE);
if (!inf)
inf = strdup("");
mp_msg(MSGT_GLOBAL, MSGL_INFO, "ANS_VIDEO_BITRATE='%s'\n", inf);
@@ -3043,7 +3191,7 @@ int run_command(MPContext * mpctx, mp_cmd_t * cmd)
break;
case MP_CMD_GET_VIDEO_RESOLUTION:{
- char *inf = get_metadata(META_VIDEO_RESOLUTION);
+ char *inf = get_metadata(mpctx, META_VIDEO_RESOLUTION);
if (!inf)
inf = strdup("");
mp_msg(MSGT_GLOBAL, MSGL_INFO,
@@ -3053,7 +3201,7 @@ int run_command(MPContext * mpctx, mp_cmd_t * cmd)
break;
case MP_CMD_GET_AUDIO_CODEC:{
- char *inf = get_metadata(META_AUDIO_CODEC);
+ char *inf = get_metadata(mpctx, META_AUDIO_CODEC);
if (!inf)
inf = strdup("");
mp_msg(MSGT_GLOBAL, MSGL_INFO, "ANS_AUDIO_CODEC='%s'\n", inf);
@@ -3062,7 +3210,7 @@ int run_command(MPContext * mpctx, mp_cmd_t * cmd)
break;
case MP_CMD_GET_AUDIO_BITRATE:{
- char *inf = get_metadata(META_AUDIO_BITRATE);
+ char *inf = get_metadata(mpctx, META_AUDIO_BITRATE);
if (!inf)
inf = strdup("");
mp_msg(MSGT_GLOBAL, MSGL_INFO, "ANS_AUDIO_BITRATE='%s'\n", inf);
@@ -3071,7 +3219,7 @@ int run_command(MPContext * mpctx, mp_cmd_t * cmd)
break;
case MP_CMD_GET_AUDIO_SAMPLES:{
- char *inf = get_metadata(META_AUDIO_SAMPLES);
+ char *inf = get_metadata(mpctx, META_AUDIO_SAMPLES);
if (!inf)
inf = strdup("");
mp_msg(MSGT_GLOBAL, MSGL_INFO, "ANS_AUDIO_SAMPLES='%s'\n", inf);
@@ -3080,7 +3228,7 @@ int run_command(MPContext * mpctx, mp_cmd_t * cmd)
break;
case MP_CMD_GET_META_TITLE:{
- char *inf = get_metadata(META_INFO_TITLE);
+ char *inf = get_metadata(mpctx, META_INFO_TITLE);
if (!inf)
inf = strdup("");
mp_msg(MSGT_GLOBAL, MSGL_INFO, "ANS_META_TITLE='%s'\n", inf);
@@ -3089,7 +3237,7 @@ int run_command(MPContext * mpctx, mp_cmd_t * cmd)
break;
case MP_CMD_GET_META_ARTIST:{
- char *inf = get_metadata(META_INFO_ARTIST);
+ char *inf = get_metadata(mpctx, META_INFO_ARTIST);
if (!inf)
inf = strdup("");
mp_msg(MSGT_GLOBAL, MSGL_INFO, "ANS_META_ARTIST='%s'\n", inf);
@@ -3098,7 +3246,7 @@ int run_command(MPContext * mpctx, mp_cmd_t * cmd)
break;
case MP_CMD_GET_META_ALBUM:{
- char *inf = get_metadata(META_INFO_ALBUM);
+ char *inf = get_metadata(mpctx, META_INFO_ALBUM);
if (!inf)
inf = strdup("");
mp_msg(MSGT_GLOBAL, MSGL_INFO, "ANS_META_ALBUM='%s'\n", inf);
@@ -3107,7 +3255,7 @@ int run_command(MPContext * mpctx, mp_cmd_t * cmd)
break;
case MP_CMD_GET_META_YEAR:{
- char *inf = get_metadata(META_INFO_YEAR);
+ char *inf = get_metadata(mpctx, META_INFO_YEAR);
if (!inf)
inf = strdup("");
mp_msg(MSGT_GLOBAL, MSGL_INFO, "ANS_META_YEAR='%s'\n", inf);
@@ -3116,7 +3264,7 @@ int run_command(MPContext * mpctx, mp_cmd_t * cmd)
break;
case MP_CMD_GET_META_COMMENT:{
- char *inf = get_metadata(META_INFO_COMMENT);
+ char *inf = get_metadata(mpctx, META_INFO_COMMENT);
if (!inf)
inf = strdup("");
mp_msg(MSGT_GLOBAL, MSGL_INFO, "ANS_META_COMMENT='%s'\n", inf);
@@ -3125,7 +3273,7 @@ int run_command(MPContext * mpctx, mp_cmd_t * cmd)
break;
case MP_CMD_GET_META_TRACK:{
- char *inf = get_metadata(META_INFO_TRACK);
+ char *inf = get_metadata(mpctx, META_INFO_TRACK);
if (!inf)
inf = strdup("");
mp_msg(MSGT_GLOBAL, MSGL_INFO, "ANS_META_TRACK='%s'\n", inf);
@@ -3134,7 +3282,7 @@ int run_command(MPContext * mpctx, mp_cmd_t * cmd)
break;
case MP_CMD_GET_META_GENRE:{
- char *inf = get_metadata(META_INFO_GENRE);
+ char *inf = get_metadata(mpctx, META_INFO_GENRE);
if (!inf)
inf = strdup("");
mp_msg(MSGT_GLOBAL, MSGL_INFO, "ANS_META_GENRE='%s'\n", inf);
@@ -3143,7 +3291,7 @@ int run_command(MPContext * mpctx, mp_cmd_t * cmd)
break;
case MP_CMD_GET_VO_FULLSCREEN:
- if (mpctx->video_out && vo_config_count)
+ if (mpctx->video_out && mpctx->video_out->config_ok)
mp_msg(MSGT_GLOBAL, MSGL_INFO, "ANS_VO_FULLSCREEN=%d\n", vo_fs);
break;
@@ -3157,9 +3305,7 @@ int run_command(MPContext * mpctx, mp_cmd_t * cmd)
if (sh_video)
pos = sh_video->pts;
else if (sh_audio && mpctx->audio_out)
- pos =
- playing_audio_pts(sh_audio, mpctx->d_audio,
- mpctx->audio_out);
+ pos = playing_audio_pts(mpctx);
mp_msg(MSGT_GLOBAL, MSGL_INFO, "ANS_TIME_POSITION=%.1f\n", pos);
}
break;
@@ -3174,7 +3320,7 @@ int run_command(MPContext * mpctx, mp_cmd_t * cmd)
break;
case MP_CMD_KEYDOWN_EVENTS:
- mplayer_put_key(cmd->args[0].v.i);
+ mplayer_put_key(mpctx->key_fifo, cmd->args[0].v.i);
break;
case MP_CMD_SET_MOUSE_POS:{
@@ -3182,7 +3328,7 @@ int run_command(MPContext * mpctx, mp_cmd_t * cmd)
double dx, dy;
pointer_x = cmd->args[0].v.i;
pointer_y = cmd->args[1].v.i;
- rescale_input_coordinates(pointer_x, pointer_y, &dx, &dy);
+ rescale_input_coordinates(mpctx, pointer_x, pointer_y, &dx, &dy);
#ifdef CONFIG_DVDNAV
if (mpctx->stream->type == STREAMTYPE_DVDNAV
&& dx > 0.0 && dy > 0.0) {
@@ -3191,7 +3337,7 @@ int run_command(MPContext * mpctx, mp_cmd_t * cmd)
pointer_y = (int) (dy * (double) sh_video->disp_h);
mp_dvdnav_update_mouse_pos(mpctx->stream,
pointer_x, pointer_y, &button);
- if (osd_level > 1 && button > 0)
+ if (opts->osd_level > 1 && button > 0)
set_osd_msg(OSD_MSG_TEXT, 1, osd_duration,
"Selected button number %d", button);
}
@@ -3218,7 +3364,7 @@ int run_command(MPContext * mpctx, mp_cmd_t * cmd)
command = mp_dvdnav_bindings[i].cmd;
mp_dvdnav_handle_input(mpctx->stream,command,&button);
- if (osd_level > 1 && button > 0)
+ if (opts->osd_level > 1 && button > 0)
set_osd_msg(OSD_MSG_TEXT, 1, osd_duration,
"Selected button number %d", button);
}
@@ -3232,29 +3378,19 @@ int run_command(MPContext * mpctx, mp_cmd_t * cmd)
#endif
default:
-#ifdef CONFIG_GUI
- if ((use_gui) && (cmd->id > MP_CMD_GUI_EVENTS))
- guiGetEvent(guiIEvent, (char *) cmd->id);
- else
-#endif
mp_msg(MSGT_CPLAYER, MSGL_V,
"Received unknown cmd %s\n", cmd->name);
}
switch (cmd->pausing) {
case 1: // "pausing"
- mpctx->osd_function = OSD_PAUSE;
+ pause_player(mpctx);
break;
case 3: // "pausing_toggle"
- mpctx->was_paused = !mpctx->was_paused;
- if (mpctx->was_paused)
- mpctx->osd_function = OSD_PAUSE;
- else if (mpctx->osd_function == OSD_PAUSE)
- mpctx->osd_function = OSD_PLAY;
+ if (mpctx->paused)
+ unpause_player(mpctx);
+ else
+ pause_player(mpctx);
break;
- case 2: // "pausing_keep"
- if (mpctx->was_paused)
- mpctx->osd_function = OSD_PAUSE;
}
- return brk_cmd;
}
diff --git a/command.h b/command.h
index 4bd01a0296..1367fa88e4 100644
--- a/command.h
+++ b/command.h
@@ -22,7 +22,7 @@
struct MPContext;
struct mp_cmd;
-int run_command(struct MPContext *mpctx, struct mp_cmd *cmd);
+void run_command(struct MPContext *mpctx, struct mp_cmd *cmd);
char *property_expand_string(struct MPContext *mpctx, char *str);
void property_print_help(void);
diff --git a/common.mak b/common.mak
deleted file mode 100644
index 343ca749b5..0000000000
--- a/common.mak
+++ /dev/null
@@ -1,78 +0,0 @@
-#
-# common bits used by all libraries
-#
-
-all: # make "all" default target
-
-ifndef SUBDIR
-vpath %.c $(SRC_DIR)
-vpath %.h $(SRC_DIR)
-vpath %.S $(SRC_DIR)
-vpath %.asm $(SRC_DIR)
-
-ifeq ($(SRC_DIR),$(SRC_PATH_BARE))
-BUILD_ROOT_REL = .
-else
-BUILD_ROOT_REL = ..
-endif
-
-ALLFFLIBS = avcodec avdevice avfilter avformat avutil postproc swscale
-
-CPPFLAGS := -DHAVE_AV_CONFIG_H -I$(BUILD_ROOT_REL) -I$(SRC_PATH) $(CPPFLAGS)
-
-%.o: %.c
- $(CCDEP)
- $(CC) $(CPPFLAGS) $(CFLAGS) $(CC_DEPFLAGS) -c $(CC_O) $<
-
-%.o: %.S
- $(ASDEP)
- $(AS) $(CPPFLAGS) $(ASFLAGS) $(AS_DEPFLAGS) -c -o $@ $<
-
-%.ho: %.h
- $(CC) $(CPPFLAGS) $(CFLAGS) -Wno-unused -c -o $@ -x c $<
-
-%$(EXESUF): %.c
-
-SVN_ENTRIES = $(SRC_PATH_BARE)/.svn/entries
-ifeq ($(wildcard $(SVN_ENTRIES)),$(SVN_ENTRIES))
-$(BUILD_ROOT_REL)/version.h: $(SVN_ENTRIES)
-endif
-
-$(BUILD_ROOT_REL)/version.h: $(SRC_PATH_BARE)/version.sh config.mak
- $< $(SRC_PATH) $@ $(EXTRA_VERSION)
-
-install: install-libs install-headers
-
-uninstall: uninstall-libs uninstall-headers
-
-.PHONY: all depend dep *clean install* uninstall* examples testprogs
-endif
-
-OBJS-$(HAVE_MMX) += $(MMX-OBJS-yes)
-
-CFLAGS += $(CFLAGS-yes)
-OBJS += $(OBJS-yes)
-FFLIBS := $(FFLIBS-yes) $(FFLIBS)
-TESTPROGS += $(TESTPROGS-yes)
-
-FFEXTRALIBS := $(addprefix -l,$(addsuffix $(BUILDSUF),$(FFLIBS))) $(EXTRALIBS)
-FFLDFLAGS := $(addprefix -L$(BUILD_ROOT)/lib,$(ALLFFLIBS)) $(LDFLAGS)
-
-EXAMPLES := $(addprefix $(SUBDIR),$(addsuffix -example$(EXESUF),$(EXAMPLES)))
-OBJS := $(addprefix $(SUBDIR),$(OBJS))
-TESTPROGS := $(addprefix $(SUBDIR),$(addsuffix -test$(EXESUF),$(TESTPROGS)))
-
-DEP_LIBS := $(foreach NAME,$(FFLIBS),$(BUILD_ROOT_REL)/lib$(NAME)/$($(CONFIG_SHARED:yes=S)LIBNAME))
-
-ALLHEADERS := $(subst $(SRC_DIR)/,$(SUBDIR),$(wildcard $(SRC_DIR)/*.h $(SRC_DIR)/$(ARCH)/*.h))
-SKIPHEADERS = $(addprefix $(SUBDIR),$(SKIPHEADERS-))
-checkheaders: $(filter-out $(SKIPHEADERS:.h=.ho),$(ALLHEADERS:.h=.ho))
-
-DEPS := $(OBJS:.o=.d)
-depend dep: $(DEPS)
-
-CLEANSUFFIXES = *.o *~ *.ho *.map
-DISTCLEANSUFFIXES = *.d *.pc
-LIBSUFFIXES = *.a *.lib *.so *.so.* *.dylib *.dll *.def *.dll.a *.exp
-
--include $(wildcard $(DEPS))
diff --git a/configure b/configure
index 89c84bc3fb..519edaad26 100755
--- a/configure
+++ b/configure
@@ -216,6 +216,7 @@ Installation directories:
--mandir=DIR directory for installing man pages [PREFIX/share/man]
--confdir=DIR directory for installing configuration files
[PREFIX/etc/mplayer]
+ --localedir=DIR directory for locale tree [PREFIX/share/locale]
--libdir=DIR directory for object code libraries [PREFIX/lib]
--codecsdir=DIR directory for binary codecs [LIBDIR/codecs]
--win32codecsdir=DIR directory for Windows DLLs [LIBDIR/codecs]
@@ -225,8 +226,6 @@ Installation directories:
Optional features:
--disable-mencoder disable MEncoder (A/V encoder) compilation [enable]
--disable-mplayer disable MPlayer compilation [enable]
- --enable-gui enable GMPlayer compilation (GTK+ GUI) [disable]
- --enable-gtk1 force using GTK 1.2 for the GUI [disable]
--disable-largefiles disable support for files > 2GB [enable]
--enable-linux-devfs set default devices to devfs [disable]
--enable-termcap use termcap database for key codes [autodetect]
@@ -280,8 +279,7 @@ Optional features:
--disable-vstream disable TiVo vstream client support [autodetect]
--disable-pthreads disable Posix threads support [autodetect]
--disable-w32threads disable Win32 threads support [autodetect]
- --disable-ass-internal disable internal SSA/ASS subtitle support [autodetect]
- --disable-ass disable SSA/ASS subtitle support [autodetect]
+ --disable-ass disable internal SSA/ASS subtitle support [autodetect]
--enable-rpath enable runtime linker path for extra libs [disabled]
Codecs:
@@ -296,25 +294,13 @@ Codecs:
--disable-xanim disable XAnim codecs support [enabled]
--disable-real disable RealPlayer codecs support [enabled]
--disable-xvid disable Xvid [autodetect]
- --disable-xvid-lavc disable Xvid in libavcodec [autodetect]
--disable-x264 disable x264 [autodetect]
- --disable-x264-lavc disable x264 in libavcodec [autodetect]
- --disable-libdirac-lavc disable Dirac in libavcodec [autodetect]
- --disable-libschroedinger-lavc disable Dirac in libavcodec (Schroedinger
- decoder) [autodetect]
--disable-libnut disable libnut [autodetect]
- --disable-libavutil_a disable static libavutil [autodetect]
- --disable-libavcodec_a disable static libavcodec [autodetect]
- --disable-libavformat_a disable static libavformat [autodetect]
- --disable-libpostproc_a disable static libpostproc [autodetect]
- --disable-libswscale_a disable static libswscale [autodetect]
- --disable-libavutil_so disable shared libavutil [autodetect]
- --disable-libavcodec_so disable shared libavcodec [autodetect]
- --disable-libavformat_so disable shared libavformat [autodetect]
- --disable-libpostproc_so disable shared libpostproc [autodetect]
- --disable-libswscale_so disable shared libswscale [autodetect]
- --disable-libavcodec_mpegaudio_hp disable high precision audio decoding
- in libavcodec [enabled]
+ --disable-libavutil disable libavutil [autodetect]
+ --disable-libavcodec disable libavcodec [autodetect]
+ --disable-libavformat disable libavformat [autodetect]
+ --disable-libpostproc disable libpostproc [autodetect]
+ --disable-libswscale disable libswscale [autodetect]
--disable-tremor-internal disable internal Tremor [enabled]
--enable-tremor-low enable lower accuracy internal Tremor [disabled]
--enable-tremor enable external Tremor [autodetect]
@@ -325,13 +311,11 @@ Codecs:
--disable-faad-internal disable internal FAAD2 (AAC) [autodetect]
--enable-faad-fixed enable fixed-point mode in internal FAAD2 [disabled]
--disable-faac disable support for FAAC (AAC encoder) [autodetect]
- --disable-faac-lavc disable support for FAAC in libavcodec [autodetect]
--disable-ladspa disable LADSPA plugin support [autodetect]
--disable-libbs2b disable libbs2b audio filter support [autodetect]
--disable-libdv disable libdv 0.9.5 en/decoding support [autodetect]
--disable-mad disable libmad (MPEG audio) support [autodetect]
--disable-mp3lame disable LAME MP3 encoding support [autodetect]
- --disable-mp3lame-lavc disable LAME in libavcodec [autodetect]
--disable-toolame disable Toolame (MPEG layer 2) encoding [autodetect]
--disable-twolame disable Twolame (MPEG layer 2) encoding [autodetect]
--enable-xmms enable XMMS input plugin support [disabled]
@@ -341,21 +325,6 @@ Codecs:
--enable-liba52-internal enable builtin liba52 [disabled]
--disable-libmpeg2 disable builtin libmpeg2 [autodetect]
--disable-musepack disable musepack support [autodetect]
- --disable-libopencore_amrnb disable libopencore_amr narrowband [autodetect]
- --disable-libopencore_amrwb disable libopencore_amr wideband [autodetect]
- --disable-libopenjpeg disable OpenJPEG (JPEG2000) input/output support [autodetect]
- --disable-decoder=DECODER disable specified FFmpeg decoder
- --enable-decoder=DECODER enable specified FFmpeg decoder
- --disable-encoder=ENCODER disable specified FFmpeg encoder
- --enable-encoder=ENCODER enable specified FFmpeg encoder
- --disable-parser=PARSER disable specified FFmpeg parser
- --enable-parser=PARSER enable specified FFmpeg parser
- --disable-protocol=PROTO disable specified FFmpeg protocol
- --enable-protocol=PROTO enable specified FFmpeg protocol
- --disable-demuxer=DEMUXER disable specified FFmpeg demuxer
- --enable-demuxer=DEMUXER enable specified FFmpeg demuxer
- --disable-muxer=MUXER disable specified FFmpeg muxer
- --enable-muxer=MUXER enable specified FFmpeg muxer
Video output:
--disable-vidix disable VIDIX [for x86 *nix]
@@ -420,7 +389,7 @@ Audio output:
--disable-esd disable esd audio output [autodetect]
--disable-pulse disable Pulseaudio audio output [autodetect]
--disable-jack disable JACK audio output [autodetect]
- --disable-openal disable OpenAL audio output [autodetect]
+ --enable-openal enable OpenAL audio output [disable]
--disable-nas disable NAS audio output [autodetect]
--disable-sgiaudio disable SGI audio output [autodetect]
--disable-sunaudio disable Sun audio output [autodetect]
@@ -430,10 +399,11 @@ Audio output:
--disable-select disable using select() on the audio device [enable]
Language options:
+ --enable-translation enable support for translated output [disable]
--charset=charset convert the console messages to this character set
--language-doc=lang language to use for the documentation [en]
--language-man=lang language to use for the man pages [en]
- --language-msg=lang language to use for the messages and the GUI [en]
+ --language-msg=lang language to use for the messages [en]
--language=lang default language to use [en]
Specific options override --language. You can pass a list of languages separated
by whitespace or commas instead of a single language. Nonexisting translations
@@ -475,13 +445,13 @@ Advanced options:
--enable-neon enable NEON (ARM) [autodetect]
--enable-iwmmxt enable iWMMXt (ARM) [autodetect]
--disable-fastmemcpy disable 3DNow!/SSE/MMX optimized memcpy [enable]
- --enable-hardcoded-tables put tables in binary instead of calculating them at startup [disable]
--enable-big-endian force byte order to big-endian [autodetect]
--enable-debug[=1-3] compile-in debugging information [disable]
--enable-profile compile-in profiling information [disable]
--disable-sighandler disable sighandler for crashes [enable]
--enable-crash-debug enable automatic gdb attach on crash [disable]
--enable-dynamic-plugins enable dynamic A/V plugins [disable]
+ --ffmpeg-source-dir=PATH enable features requiring internal FFmpeg headers
Use these options if autodetection fails:
--extra-cflags=FLAGS extra CFLAGS
@@ -540,37 +510,13 @@ _yasm=yasm
_runtime_cpudetection=no
_cross_compile=auto
_prefix="/usr/local"
-_libavutil_a=auto
-_libavutil_so=auto
-_libavcodec_a=auto
-_libopencore_amrnb=auto
-_libopencore_amrwb=auto
-libopenjpeg=auto
-_libavdecoders_all=$(sed -n 's/^[^#]*DEC.*(.*, *\(.*\)).*/\1_decoder/p' libavcodec/allcodecs.c | tr '[a-z]' '[A-Z]')
-_libavdecoders=$(echo $_libavdecoders_all | sed -e 's/ LIB[A-Z0-9_]*_DECODER//g' -e s/MPEG4AAC_DECODER//)
-_libavencoders_all=$(sed -n 's/^[^#]*ENC.*(.*, *\(.*\)).*/\1_encoder/p' libavcodec/allcodecs.c | tr '[a-z]' '[A-Z]')
-_libavencoders=$(echo $_libavencoders_all | sed -e 's/ LIB[A-Z0-9_]*_ENCODER//g' -e s/AAC_ENCODER//)
-_libavparsers_all=$(sed -n 's/^[^#]*PARSER.*(.*, *\(.*\)).*/\1_parser/p' libavcodec/allcodecs.c | tr '[a-z]' '[A-Z]')
-_libavparsers=$_libavparsers_all
-_libavbsfs_all=$(sed -n 's/^[^#]*BSF.*(.*, *\(.*\)).*/\1_bsf/p' libavcodec/allcodecs.c | tr '[a-z]' '[A-Z]')
-_libavbsfs=$_libavbsfs_all
-_libavhwaccels_all=$(sed -n 's/^[^#]*HWACCEL.*(.*, *\(.*\)).*/\1_hwaccel/p' libavcodec/allcodecs.c | tr '[a-z]' '[A-Z]')
-# Disable all hardware accelerators for now.
-_libavhwaccels=
-_libavdemuxers_all=$(sed -n 's/^[^#]*DEMUX.*(.*, *\(.*\)).*/\1_demuxer/p' libavformat/allformats.c | tr '[a-z]' '[A-Z]')
-_libavdemuxers=$(echo $_libavdemuxers_all | sed -e 's/ LIB[A-Z0-9_]*_DEMUXER//g' -e s/REDIR_DEMUXER// -e s/RTSP_DEMUXER// -e s/SDP_DEMUXER// -e s/AVISYNTH_DEMUXER//)
-_libavmuxers_all=$(sed -n 's/^[^#]*_MUX.*(.*, *\(.*\)).*/\1_muxer/p' libavformat/allformats.c | tr '[a-z]' '[A-Z]')
-_libavmuxers=$(echo $_libavmuxers_all | sed -e 's/ LIB[A-Z0-9_]*_MUXER//g' -e s/RTP_MUXER//)
-_libavprotocols_all=$(sed -n 's/^[^#]*PROTOCOL.*(.*, *\(.*\)).*/\1_protocol/p' libavformat/allformats.c | tr '[a-z]' '[A-Z]')
-_libavprotocols=$_libavprotocols_all
-_libavcodec_so=auto
-_libavformat_a=auto
-_libavformat_so=auto
-_libpostproc_a=auto
-_libpostproc_so=auto
-_libswscale_a=auto
-_libswscale_so=auto
-_libavcodec_mpegaudio_hp=yes
+_libavutil=auto
+_libavcodec=auto
+_libavformat=auto
+_libpostproc=auto
+_libswscale=auto
+_libavcodec_internals=no
+_libswscale_internals=no
_mencoder=yes
_mplayer=yes
_x11=auto
@@ -618,12 +564,11 @@ _esd=auto
_pulse=auto
_jack=auto
_dart=auto
-_openal=auto
+_openal=no
_libcdio=auto
_liblzo=auto
_mad=auto
_mp3lame=auto
-_mp3lame_lavc=auto
_toolame=auto
_twolame=auto
_tremor=auto
@@ -641,7 +586,6 @@ _faad=auto
_faad_internal=auto
_faad_fixed=no
_faac=auto
-_faac_lavc=auto
_ladspa=auto
_libbs2b=auto
_xmms=no
@@ -667,7 +611,6 @@ _sgiaudio=auto
_sunaudio=auto
_alsa=auto
_fastmemcpy=yes
-hardcoded_tables=no
_unrar_exec=auto
_win32dll=auto
_select=yes
@@ -684,9 +627,6 @@ _tv_dshow=auto
_pvr=auto
_network=yes
_winsock2_h=auto
-_struct_addrinfo=auto
-_getaddrinfo=auto
-_struct_sockaddr_storage=auto
_smb=auto
_vidix=auto
_vidix_pcidb=yes
@@ -694,11 +634,7 @@ _dhahelper=no
_svgalib_helper=no
_joystick=no
_xvid=auto
-_xvid_lavc=auto
_x264=auto
-_x264_lavc=auto
-_libdirac_lavc=auto
-_libschroedinger_lavc=auto
_libnut=auto
_lirc=auto
_lircc=auto
@@ -722,6 +658,7 @@ _largefiles=yes
#language=en
_shm=auto
_linux_devfs=no
+_translation=no
_charset="UTF-8"
_dynamic_plugins=no
_crash_debug=no
@@ -755,7 +692,6 @@ _vstream=auto
_pthreads=auto
_w32threads=auto
_ass=auto
-ass_internal=yes
_rpath=no
_asmalign_pot=auto
_stream_cache=yes
@@ -800,6 +736,9 @@ for ac_option do
--realcodecsdir=*)
_realcodecsdir=$(echo $ac_option | cut -d '=' -f 2)
;;
+ --localedir=*)
+ _localedir=$(echo $ac_option | cut -d '=' -f 2)
+ ;;
--with-install=*)
_install=$(echo $ac_option | cut -d '=' -f 2 )
@@ -831,10 +770,10 @@ for ac_option do
;;
--extra-cflags=*)
- extra_cflags=$(echo $ac_option | cut -d '=' -f 2-)
+ extra_cflags="$extra_cflags $(echo $ac_option | cut -d '=' -f 2-)"
;;
--extra-ldflags=*)
- extra_ldflags=$(echo $ac_option | cut -d '=' -f 2-)
+ extra_ldflags="$extra_ldflags $(echo $ac_option | cut -d '=' -f 2-)"
;;
--extra-libs=*)
extra_libs=$(echo $ac_option | cut -d '=' -f 2)
@@ -910,6 +849,8 @@ for ac_option do
--disable-debug)
_debug=
;;
+ --enable-translation) _translation=yes ;;
+ --disable-translation) _translation=no ;;
--enable-runtime-cpudetection) _runtime_cpudetection=yes ;;
--disable-runtime-cpudetection) _runtime_cpudetection=no ;;
--enable-cross-compile) _cross_compile=yes ;;
@@ -950,8 +891,6 @@ for ac_option do
--disable-mng) _mng=no ;;
--enable-jpeg) _jpeg=yes ;;
--disable-jpeg) _jpeg=no ;;
- --enable-libopenjpeg) libopenjpeg=yes ;;
- --disable-libopenjpeg)libopenjpeg=no ;;
--enable-pnm) _pnm=yes ;;
--disable-pnm) _pnm=no ;;
--enable-md5sum) _md5sum=yes ;;
@@ -1016,8 +955,6 @@ for ac_option do
--disable-mad) _mad=no ;;
--enable-mp3lame) _mp3lame=yes ;;
--disable-mp3lame) _mp3lame=no ;;
- --enable-mp3lame-lavc) _mp3lame_lavc=yes ;;
- --disable-mp3lame-lavc) _mp3lame_lavc=no ;;
--enable-toolame) _toolame=yes ;;
--disable-toolame) _toolame=no ;;
--enable-twolame) _twolame=yes ;;
@@ -1058,8 +995,6 @@ for ac_option do
--disable-faad-fixed) _faad_fixed=no ;;
--enable-faac) _faac=yes ;;
--disable-faac) _faac=no ;;
- --enable-faac-lavc) _faac_lavc=yes ;;
- --disable-faac-lavc) _faac_lavc=no ;;
--enable-ladspa) _ladspa=yes ;;
--disable-ladspa) _ladspa=no ;;
--enable-libbs2b) _libbs2b=yes ;;
@@ -1126,8 +1061,6 @@ for ac_option do
--disable-pvr) _pvr=no ;;
--enable-fastmemcpy) _fastmemcpy=yes ;;
--disable-fastmemcpy) _fastmemcpy=no ;;
- --enable-hardcoded-tables) hardcoded_tables=yes ;;
- --disable-hardcoded-tables) hardcoded_tables=no ;;
--enable-network) _network=yes ;;
--disable-network) _network=no ;;
--enable-winsock2_h) _winsock2_h=yes ;;
@@ -1148,56 +1081,22 @@ for ac_option do
--disable-joystick) _joystick=no ;;
--enable-xvid) _xvid=yes ;;
--disable-xvid) _xvid=no ;;
- --enable-xvid-lavc) _xvid_lavc=yes ;;
- --disable-xvid-lavc) _xvid_lavc=no ;;
--enable-x264) _x264=yes ;;
--disable-x264) _x264=no ;;
- --enable-x264-lavc) _x264_lavc=yes ;;
- --disable-x264-lavc) _x264_lavc=no ;;
- --enable-libdirac-lavc) _libdirac_lavc=yes ;;
- --disable-libdirac-lavc) _libdirac_lavc=no ;;
- --enable-libschroedinger-lavc) _libschroedinger_lavc=yes ;;
- --disable-libschroedinger-lavc) _libschroedinger_lavc=no ;;
--enable-libnut) _libnut=yes ;;
--disable-libnut) _libnut=no ;;
- --enable-libavutil_a) _libavutil_a=yes ;;
- --disable-libavutil_a) _libavutil_a=no ;;
- --enable-libavutil_so) _libavutil_so=yes ;;
- --disable-libavutil_so) _libavutil_so=no ;;
- --enable-libavcodec_a) _libavcodec_a=yes ;;
- --disable-libavcodec_a) _libavcodec_a=no ;;
- --enable-libavcodec_so) _libavcodec_so=yes ;;
- --disable-libavcodec_so) _libavcodec_so=no ;;
- --enable-libopencore_amrnb) _libopencore_amrnb=yes ;;
- --disable-libopencore_amrnb) _libopencore_amrnb=no ;;
- --enable-libopencore_amrwb) _libopencore_amrwb=yes ;;
- --disable-libopencore_amrwb) _libopencore_amrwb=no ;;
- --enable-decoder=*) _libavdecoders="$_libavdecoders $(echo $ac_option | cut -d '=' -f 2 | tr '[a-z]' '[A-Z]')" ;;
- --disable-decoder=*) _libavdecoders=$(echo $_libavdecoders | sed "s/$(echo $ac_option | cut -d '=' -f 2 | tr '[a-z]' '[A-Z]')//g") ;;
- --enable-encoder=*) _libavencoders="$_libavencoders $(echo $ac_option | cut -d '=' -f 2 | tr '[a-z]' '[A-Z]')" ;;
- --disable-encoder=*) _libavencoders=$(echo $_libavencoders | sed "s/$(echo $ac_option | cut -d '=' -f 2 | tr '[a-z]' '[A-Z]')//g") ;;
- --enable-parser=*) _libavparsers="$_libavparsers $(echo $ac_option | cut -d '=' -f 2 | tr '[a-z]' '[A-Z]')" ;;
- --disable-parser=*) _libavparsers=$(echo $_libavparsers | sed "s/$(echo $ac_option | cut -d '=' -f 2 | tr '[a-z]' '[A-Z]')//g") ;;
- --enable-protocol=*) _libavprotocols="$_libavprotocols $(echo $ac_option | cut -d '=' -f 2 | tr '[a-z]' '[A-Z]')" ;;
- --disable-protocol=*) _libavprotocols=$(echo $_libavprotocols | sed "s/$(echo $ac_option | cut -d '=' -f 2 | tr '[a-z]' '[A-Z]')//g") ;;
- --enable-demuxer=*) _libavdemuxers="$_libavdemuxers $(echo $ac_option | cut -d '=' -f 2 | tr '[a-z]' '[A-Z]')" ;;
- --disable-demuxer=*) _libavdemuxers=$(echo $_libavdemuxers | sed "s/$(echo $ac_option | cut -d '=' -f 2 | tr '[a-z]' '[A-Z]')//g") ;;
- --enable-muxer=*) _libavmuxers="$_libavmuxers $(echo $ac_option | cut -d '=' -f 2 | tr '[a-z]' '[A-Z]')" ;;
- --disable-muxer=*) _libavmuxers=$(echo $_libavmuxers | sed "s/$(echo $ac_option | cut -d '=' -f 2 | tr '[a-z]' '[A-Z]')//g") ;;
- --enable-libavformat_a) _libavformat_a=yes ;;
- --disable-libavformat_a) _libavformat_a=no ;;
- --enable-libavformat_so) _libavformat_so=yes ;;
- --disable-libavformat_so) _libavformat_so=no ;;
- --enable-libpostproc_a) _libpostproc_a=yes ;;
- --disable-libpostproc_a) _libpostproc_a=no ;;
- --enable-libpostproc_so) _libpostproc_so=yes ;;
- --disable-libpostproc_so) _libpostproc_so=no ;;
- --enable-libswscale_a) _libswscale_a=yes ;;
- --disable-libswscale_a) _libswscale_a=no ;;
- --enable-libswscale_so) _libswscale_so=yes ;;
- --disable-libswscale_so) _libswscale_so=no ;;
- --enable-libavcodec_mpegaudio_hp) _libavcodec_mpegaudio_hp=yes ;;
- --disable-libavcodec_mpegaudio_hp) _libavcodec_mpegaudio_hp=no ;;
+ --enable-libavutil) _libavutil=yes ;;
+ --disable-libavutil) _libavutil=no ;;
+ --enable-libavcodec) _libavcodec=yes ;;
+ --disable-libavcodec) _libavcodec=no ;;
+ --enable-libavformat) _libavformat=yes ;;
+ --disable-libavformat) _libavformat=no ;;
+ --enable-libpostproc) _libpostproc=yes ;;
+ --disable-libpostproc) _libpostproc=no ;;
+ --enable-libswscale) _libswscale=yes ;;
+ --disable-libswscale) _libswscale=no ;;
+ --ffmpeg-source-dir=*)
+ _ffmpeg_source=$(echo $ac_option | cut -d '=' -f 2 ) ;;
--enable-lirc) _lirc=yes ;;
--disable-lirc) _lirc=no ;;
@@ -1269,8 +1168,6 @@ for ac_option do
--disable-w32threads) _w32threads=no ;;
--enable-ass) _ass=yes ;;
--disable-ass) _ass=no ;;
- --enable-ass-internal) ass_internal=yes ;;
- --disable-ass-internal) ass_internal=no ;;
--enable-rpath) _rpath=yes ;;
--disable-rpath) _rpath=no ;;
@@ -1365,12 +1262,18 @@ for ac_option do
esac
done
+if test "$_gui" = yes ; then
+ die "Internal GUI was removed from MPlayer. Please use one of many available\n frontends\
+ (http://www.mplayerhq.hu/design7/projects.html#mplayer_frontends)."
+fi
+
# Atmos: moved this here, to be correct, if --prefix is specified
test -z "$_bindir" && _bindir="$_prefix/bin"
test -z "$_datadir" && _datadir="$_prefix/share/mplayer"
test -z "$_mandir" && _mandir="$_prefix/share/man"
test -z "$_confdir" && _confdir="$_prefix/etc/mplayer"
test -z "$_libdir" && _libdir="$_prefix/lib"
+test -z "$_localedir" && _localedir="$_prefix/share/locale"
# Determine our OS name and CPU architecture
if test -z "$_target" ; then
@@ -2286,6 +2189,7 @@ EOF
_arch='ALPHA'
_target_arch='ARCH_ALPHA = yes'
iproc='alpha'
+ def_fast_64bit='#define HAVE_FAST_64BIT 1'
echocheck "CPU type"
cat > $TMPC << EOF
@@ -2435,12 +2339,10 @@ if test "$_big_endian" = yes ; then
_byte_order='big-endian'
def_words_endian='#define WORDS_BIGENDIAN 1'
def_bigendian='#define HAVE_BIGENDIAN 1'
- def_av_bigendian='#define AV_HAVE_BIGENDIAN 1'
else
_byte_order='little-endian'
def_words_endian='#undef WORDS_BIGENDIAN'
def_bigendian='#define HAVE_BIGENDIAN 0'
- def_av_bigendian='#define AV_HAVE_BIGENDIAN 0'
fi
echores "$_byte_order"
@@ -2488,8 +2390,8 @@ cat > $TMPC << EOF
__attribute__((noinline)) static int foo3(int i1, int i2, int i3) { return i3; }
int main(void) { return foo3(1,2,3) == 3 ? 0 : 1; }
EOF
- cc_check -O4 -mstackrealign && tmp_run && cflags_stackrealign=-mstackrealign
- test -z "$cflags_stackrealign" && cc_check -O4 -mstackrealign -fno-unit-at-a-time \
+ cc_check -O2 -mstackrealign && tmp_run && cflags_stackrealign=-mstackrealign
+ test -z "$cflags_stackrealign" && cc_check -O2 -mstackrealign -fno-unit-at-a-time \
&& tmp_run && cflags_stackrealign="-mstackrealign -fno-unit-at-a-time"
test -n "$cflags_stackrealign" && echores "yes" || echores "no"
fi # if darwin && test "$cc_vendor" = "gnu" ; then
@@ -2508,7 +2410,7 @@ elif test -z "$CFLAGS" ; then
elif test "$cc_vendor" != "gnu" ; then
CFLAGS="-O2 $_march $_mcpu $_pipe"
else
- CFLAGS="-Wall -Wno-switch -Wpointer-arith -Wredundant-decls -O4 $_march $_mcpu $_pipe -ffast-math -fomit-frame-pointer"
+ CFLAGS="-Wall -Wno-switch -Wpointer-arith -Wredundant-decls -O2 $_march $_mcpu $_pipe -ffast-math -fomit-frame-pointer"
extra_ldflags="$extra_ldflags -ffast-math"
fi
else
@@ -2520,7 +2422,6 @@ int main(void) { return 0; }
EOF
if test "$cc_vendor" = "gnu" ; then
cc_check -std=gnu99 && CFLAGS="-std=gnu99 $CFLAGS"
- cc_check -Wdeclaration-after-statement && CFLAGS="-Wdeclaration-after-statement $CFLAGS"
cc_check -Wno-pointer-sign && CFLAGS="-Wno-pointer-sign $CFLAGS"
cc_check -Wdisabled-optimization && CFLAGS="-Wdisabled-optimization $CFLAGS"
cc_check -Wundef && CFLAGS="-Wundef $CFLAGS"
@@ -2933,6 +2834,14 @@ fi
echores "$_langinfo"
+echocheck "translation support"
+if test "$_translation" = yes; then
+ def_translation="#define CONFIG_TRANSLATION 1"
+else
+ def_translation="#undef CONFIG_TRANSLATION"
+fi
+echores "$_translation"
+
echocheck "language"
# Set preferred languages, "all" uses English as main language.
test -z "$language" && language=$LINGUAS
@@ -3135,80 +3044,8 @@ echores "$_socklib"
if test $_winsock2_h = yes ; then
_ld_sock="-lws2_32"
def_winsock2_h='#define HAVE_WINSOCK2_H 1'
- cc_check_winsock2_h='-DHAVE_WINSOCK2_H=1'
else
def_winsock2_h='#define HAVE_WINSOCK2_H 0'
- cc_check_winsock2_h='-DHAVE_WINSOCK2_H=0'
-fi
-
-
-echocheck "netdb.h, struct addrinfo"
-if test "$_struct_addrinfo" = auto; then
- _struct_addrinfo=no
- cat > $TMPC << EOF
-#if HAVE_WINSOCK2_H
-#include <winsock2.h>
-#else
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netdb.h>
-#endif
-int main(void) { struct addrinfo *ai; return 0; }
-EOF
- cc_check $cc_check_winsock2_h && _struct_addrinfo=yes
-fi
-echores "$_struct_addrinfo"
-
-if test "$_struct_addrinfo" = yes; then
- def_addrinfo="#define HAVE_STRUCT_ADDRINFO 1"
-else
- def_addrinfo="#define HAVE_STRUCT_ADDRINFO 0"
-fi
-
-
-echocheck "netdb.h, getaddrinfo()"
-if test "$_getaddrinfo" = auto; then
- _getaddrinfo=no
- cat > $TMPC << EOF
-#if HAVE_WINSOCK2_H
-#include <winsock2.h>
-#else
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netdb.h>
-#endif
-int main(void) { (void) getaddrinfo(0, 0, 0, 0); return 0; }
-EOF
- cc_check $cc_check_winsock2_h && _getaddrinfo=yes
-fi
-echores "$_getaddrinfo"
-
-if test "$_getaddrinfo" = yes; then
- def_getaddrinfo="#define HAVE_GETADDRINFO 1"
-else
- def_getaddrinfo="#define HAVE_GETADDRINFO 0"
-fi
-
-
-echocheck "sockaddr_storage"
-if test "$_struct_sockaddr_storage" = auto; then
- _struct_sockaddr_storage=no
- cat > $TMPC << EOF
-#if HAVE_WINSOCK2_H
-#include <winsock2.h>
-#else
-#include <sys/socket.h>
-#endif
-int main(void) { struct sockaddr_storage sas; return 0; }
-EOF
- cc_check $cc_check_winsock2_h && _struct_sockaddr_storage=yes
-fi
-echores "$_struct_sockaddr_storage"
-
-if test "$_struct_sockaddr_storage" = yes; then
- def_sockaddr_storage="#define HAVE_STRUCT_SOCKADDR_STORAGE 1"
-else
- def_sockaddr_storage="#define HAVE_STRUCT_SOCKADDR_STORAGE 0"
fi
@@ -3473,16 +3310,6 @@ fi
echores "$_fastmemcpy"
-echocheck "hard-coded tables"
-if test "$hardcoded_tables" = yes ; then
- def_hardcoded_tables='#define CONFIG_HARDCODED_TABLES 1'
- mak_hardcoded_tables='CONFIG_HARDCODED_TABLES = yes'
-else
- def_hardcoded_tables='#define CONFIG_HARDCODED_TABLES 0'
-fi
-echores "$hardcoded_tables"
-
-
echocheck "mman.h"
cat > $TMPC << EOF
#include <sys/types.h>
@@ -4494,7 +4321,6 @@ if test "$_xvmc" = yes ; then
else
def_xvmc='#define CONFIG_XVMC 0'
_novomodules="xvmc $_novomodules"
- _libavdecoders=$(echo $_libavdecoders | sed -e s/MPEG_XVMC_DECODER//)
fi
echores "$_xvmc"
@@ -4507,7 +4333,7 @@ if test "$_vdpau" = auto ; then
#include <vdpau/vdpau_x11.h>
int main(void) {
(void) vdp_device_create_x11(0, 0, 0, 0);
- return VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L1; }
+ return VDP_VIDEO_MIXER_ATTRIBUTE_SKIP_CHROMA_DEINTERLACE;}
EOF
cc_check -lvdpau && _vdpau=yes
fi
@@ -4519,7 +4345,6 @@ if test "$_vdpau" = yes ; then
else
def_vdpau='#define CONFIG_VDPAU 0'
_novomodules="vdpau $_novomodules"
- _libavdecoders=$(echo $_libavdecoders | sed -e s/MPEG_VDPAU_DECODER// -e s/MPEG1_VDPAU_DECODER// -e s/H264_VDPAU_DECODER// -e s/WMV3_VDPAU_DECODER// -e s/VC1_VDPAU_DECODER// -e s/MPEG4_VDPAU_DECODER//)
fi
echores "$_vdpau"
@@ -4732,35 +4557,6 @@ else
_novomodules="xvidix $_novomodules"
fi
-echocheck "/dev/mga_vid"
-if test "$_mga" = auto ; then
- _mga=no
- test -c /dev/mga_vid && _mga=yes
-fi
-if test "$_mga" = yes ; then
- def_mga='#define CONFIG_MGA 1'
- _vomodules="mga $_vomodules"
-else
- def_mga='#undef CONFIG_MGA'
- _novomodules="mga $_novomodules"
-fi
-echores "$_mga"
-
-echocheck "xmga"
-if test "$_xmga" = auto ; then
- _xmga=no
- test "$_x11" = yes && test "$_mga" = yes && _xmga=yes
-fi
-if test "$_xmga" = yes ; then
- def_xmga='#define CONFIG_XMGA 1'
- _vomodules="xmga $_vomodules"
-else
- def_xmga='#undef CONFIG_XMGA'
- _novomodules="xmga $_novomodules"
-fi
-echores "$_xmga"
-
-
echocheck "GGI"
if test "$_ggi" = auto ; then
cat > $TMPC << EOF
@@ -5197,28 +4993,6 @@ else
fi
-echocheck "OpenJPEG (JPEG2000) support"
-if test "$libopenjpeg" = auto ; then
- libopenjpeg=no
-cat > $TMPC << EOF
-#define OPJ_STATIC
-#include <openjpeg.h>
-int main(void) { opj_dparameters_t dec_params; opj_set_default_decoder_parameters(&dec_params); return 0; }
-EOF
- cc_check -lopenjpeg $_ld_lm && libopenjpeg=yes
-fi
-echores "$libopenjpeg"
-if test "$libopenjpeg" = yes ; then
- def_libopenjpeg='#define CONFIG_LIBOPENJPEG 1'
- extra_ldflags="$extra_ldflags -lopenjpeg"
- _libavdecoders="$_libavdecoders LIBOPENJPEG_DECODER"
- _libavencoders="$_libavencoders LIBOPENJPEG_ENCODER"
- _codecmodules="OpenJPEG $_codecmodules"
-else
- def_libopenjpeg='#define CONFIG_LIBOPENJPEG 0'
- _nocodecmodules="OpenJPEG $_nocodecmodules"
-fi
-
echocheck "PNM support"
if test "$_pnm" = yes; then
@@ -5651,6 +5425,15 @@ EOF
cc_check && _real_ossaudio=yes
if test "$_real_ossaudio" = yes; then
def_ossaudio_devdsp='#define PATH_DEV_DSP "/dev/dsp"'
+ # Check for OSS4 headers (override default headers)
+ # Does not apply to systems where OSS4 is native (e.g. FreeBSD)
+ if test -f /etc/oss.conf; then
+ . /etc/oss.conf
+ _ossinc="$OSSLIBDIR/include"
+ if test -f "$_ossinc/sys/soundcard.h"; then
+ extra_cflags="-I$_ossinc $extra_cflags"
+ fi
+ fi
elif netbsd || openbsd ; then
def_ossaudio_devdsp='#define PATH_DEV_DSP "/dev/sound"'
extra_ldflags="$extra_ldflags -lossaudio"
@@ -6099,6 +5882,9 @@ echores "$_vcd"
echocheck "dvdread"
+if test "$_dvdread_internal" = auto && test ! -f "libdvdread4/dvd_reader.c" ; then
+ _dvdread_internal=no
+fi
if test "$_dvdread_internal" = auto ; then
_dvdread_internal=no
_dvdread=no
@@ -6350,42 +6136,19 @@ echores "$_fontconfig"
echocheck "SSA/ASS support"
-# libass depends on FreeType
-if test "$_freetype" = no ; then
- _ass=no
- ass_internal=no
- _res_comment="FreeType support needed"
-fi
-
-if test "$_ass" = auto ; then
- cat > $TMPC << EOF
-#include <ft2build.h>
-#include FT_FREETYPE_H
-#if ((FREETYPE_MAJOR < 2) || (FREETYPE_MINOR < 2) || ((FREETYPE_MINOR == 2) && (FREETYPE_PATCH < 1)))
-#error "Need FreeType 2.2.1 or newer"
-#endif
-int main(void) { return 0; }
-EOF
- _ass=no
- cc_check $($_freetypeconfig --cflags) $($_freetypeconfig --libs) && _ass=yes
- if test "$_ass" = no ; then
- ass_internal=no
- _res_comment="FreeType >= 2.2.1 needed"
- elif test "$ass_internal" = no ; then
- _res_comment="external"
- extra_ldflags="$extra_ldflags -lass"
- fi
-fi
-if test "$_ass" = yes ; then
- def_ass='#define CONFIG_ASS 1'
+if test "$_ass" = auto -o "$_ass" = yes ; then
+ if $_pkg_config libass; then
+ _ass=yes
+ def_ass='#define CONFIG_ASS 1'
+ extra_ldflags="$extra_ldflags $($_pkg_config --libs libass)"
+ extra_cflags="$extra_cflags $($_pkg_config --cflags libass)"
+ else
+ _ass=no
+ def_ass='#undef CONFIG_ASS'
+ fi
else
def_ass='#undef CONFIG_ASS'
fi
-if test "$ass_internal" = yes ; then
- def_ass_internal='#define CONFIG_ASS_INTERNAL 1'
-else
- def_ass_internal='#undef CONFIG_ASS_INTERNAL'
-fi
echores "$_ass"
@@ -6464,8 +6227,6 @@ if test "$_zlib" = yes ; then
extra_ldflags="$extra_ldflags -lz"
else
def_zlib='#define CONFIG_ZLIB 0'
- _libavdecoders=$(echo $_libavdecoders | sed -e s/FLASHSV_DECODER// -e s/PNG_DECODER// -e s/ZMBV_DECODER// -e s/ZLIB_DECODER// -e s/DXA_DECODER// -e s/TSCC_DECODER//)
- _libavencoders=$(echo $_libavencoders | sed -e s/FLASHSV_ENCODER// -e s/PNG_ENCODER// -e s/ZMBV_ENCODER// -e s/ZLIB_ENCODER//)
fi
echores "$_zlib"
@@ -6847,25 +6608,16 @@ int main(void) { unsigned long x, y; faacEncOpen(48000, 2, &x, &y); return 0; }
EOF
_faac=no
for _ld_faac in "-lfaac" "-lfaac -lmp4v2 -lstdc++" ; do
- cc_check -O4 $_ld_faac $_ld_lm && libs_mencoder="$libs_mencoder $_ld_faac" && _faac=yes && break
+ cc_check -O2 $_ld_faac $_ld_lm && libs_mencoder="$libs_mencoder $_ld_faac" && _faac=yes && break
done
fi
if test "$_faac" = yes ; then
def_faac="#define CONFIG_FAAC 1"
- test "$_faac_lavc" = auto && _faac_lavc=yes
- if test "$_faac_lavc" = yes ; then
- def_faac_lavc="#define CONFIG_LIBFAAC 1"
- libs_mplayer="$libs_mplayer $_ld_faac"
- _libavencoders="$_libavencoders LIBFAAC_ENCODER"
- fi
_codecmodules="faac $_codecmodules"
else
- _faac_lavc=no
def_faac="#undef CONFIG_FAAC"
- def_faac_lavc="#define CONFIG_LIBFAAC 0"
_nocodecmodules="faac $_nocodecmodules"
fi
-_res_comment="in libavcodec: $_faac_lavc"
echores "$_faac"
@@ -7166,15 +6918,8 @@ echores "$_live"
echocheck "FFmpeg libavutil"
-if test "$_libavutil_a" = auto ; then
- if test -d libavutil ; then
- _libavutil_a=yes
- _res_comment="static"
- else
- die "MPlayer will not compile without libavutil in the source tree."
- fi
-elif test "$_libavutil_so" = auto ; then
- _libavutil_so=no
+if test "$_libavutil" = auto ; then
+ _libavutil=no
cat > $TMPC << EOF
#include <libavutil/common.h>
int main(void) { av_gcd(1,1); return 0; }
@@ -7182,38 +6927,24 @@ EOF
if $_pkg_config --exists libavutil ; then
_inc_libavutil=$($_pkg_config --cflags libavutil)
_ld_tmp=$($_pkg_config --libs libavutil)
- cc_check $_inc_libavutil $_ld_tmp && extra_ldflags="$extra_ldflags $_ld_tmp" \
- && _libavutil_so=yes
+ cc_check $_inc_libavutil $_ld_tmp && extra_ldflags="$extra_ldflags $_ld_tmp" extra_cflags="$extra_cflags $_inc_libavutil" \
+ && _libavutil=yes
elif cc_check -lavutil $_ld_lm ; then
extra_ldflags="$extra_ldflags -lavutil"
- _libavutil_so=yes
- _res_comment="using libavutil.so, but static libavutil is recommended"
+ _libavutil=yes
fi
fi
-_libavutil=no
def_libavutil='#undef CONFIG_LIBAVUTIL'
-def_libavutil_a='#undef CONFIG_LIBAVUTIL_A'
-def_libavutil_so='#undef CONFIG_LIBAVUTIL_SO'
-test "$_libavutil_a" = yes || test "$_libavutil_so" = yes && _libavutil=yes
test "$_libavutil" = yes && def_libavutil='#define CONFIG_LIBAVUTIL 1'
-test "$_libavutil_a" = yes && def_libavutil_a='#define CONFIG_LIBAVUTIL_A 1'
-test "$_libavutil_so" = yes && def_libavutil_so='#define CONFIG_LIBAVUTIL_SO 1'
-# neither static nor shared libavutil is available, but it is mandatory ...
+# libavutil is not available, but it is mandatory ...
if test "$_libavutil" = no ; then
- die "You need static or shared libavutil, MPlayer will not compile without!"
+ die "You need libavutil, MPlayer will not compile without!"
fi
echores "$_libavutil"
echocheck "FFmpeg libavcodec"
-if test "$_libavcodec_a" = auto ; then
- _libavcodec_a=no
- if test -d libavcodec && test -f libavcodec/utils.c ; then
- _libavcodec_a="yes"
- _res_comment="static"
- fi
-elif test "$_libavcodec_so" = auto ; then
- _libavcodec_so=no
- _res_comment="libavcodec.so is discouraged over static libavcodec"
+if test "$_libavcodec" = auto ; then
+ _libavcodec=no
cat > $TMPC << EOF
#include <libavcodec/avcodec.h>
int main(void) { avcodec_find_encoder_by_name(""); return 0; }
@@ -7221,43 +6952,25 @@ EOF
if $_pkg_config --exists libavcodec ; then
_inc_libavcodec=$($_pkg_config --cflags libavcodec)
_ld_tmp=$($_pkg_config --libs libavcodec)
- cc_check $_inc_libavcodec $_ld_tmp && extra_ldflags="$extra_ldflags $_ld_tmp" \
- && _libavcodec_so=yes
+ cc_check $_inc_libavcodec $_ld_tmp && extra_ldflags="$extra_ldflags $_ld_tmp" && extra_cflags="$extra_cflags $_inc_libavcodec" \
+ && _libavcodec=yes
elif cc_check -lavcodec $_ld_lm ; then
extra_ldflags="$extra_ldflags -lavcodec"
- _libavcodec_so=yes
- _res_comment="using libavcodec.so, but static libavcodec is recommended"
+ _libavcodec=yes
fi
fi
-_libavcodec=no
def_libavcodec='#undef CONFIG_LIBAVCODEC'
-def_libavcodec_a='#undef CONFIG_LIBAVCODEC_A'
-def_libavcodec_so='#undef CONFIG_LIBAVCODEC_SO'
-test "$_libavcodec_a" = yes || test "$_libavcodec_so" = yes && _libavcodec=yes
test "$_libavcodec" = yes && def_libavcodec='#define CONFIG_LIBAVCODEC 1'
-test "$_libavcodec_a" = yes && def_libavcodec_a='#define CONFIG_LIBAVCODEC_A 1'
-test "$_libavcodec_so" = yes && def_libavcodec_so='#define CONFIG_LIBAVCODEC_SO 1'
-test "$_libavcodec_mpegaudio_hp" = yes \
- && def_libavcodec_mpegaudio_hp='#define CONFIG_MPEGAUDIO_HP 1' \
- && mak_libavcodec_mpegaudio_hp='CONFIG_MPEGAUDIO_HP = yes'
-if test "$_libavcodec_a" = yes ; then
- _codecmodules="libavcodec(internal) $_codecmodules"
-elif test "$_libavcodec_so" = yes ; then
- _codecmodules="libavcodec.so $_codecmodules"
+if test "$_libavcodec" = yes ; then
+ _codecmodules="libavcodec $_codecmodules"
else
_nocodecmodules="libavcodec $_nocodecmodules"
fi
echores "$_libavcodec"
echocheck "FFmpeg libavformat"
-if test "$_libavformat_a" = auto ; then
- _libavformat_a=no
- if test -d libavformat && test -f libavformat/utils.c ; then
- _libavformat_a=yes
- _res_comment="static"
- fi
-elif test "$_libavformat_so" = auto ; then
- _libavformat_so=no
+if test "$_libavformat" = auto ; then
+ _libavformat=no
cat > $TMPC <<EOF
#include <libavformat/avformat.h>
#include <libavcodec/opt.h>
@@ -7266,66 +6979,42 @@ EOF
if $_pkg_config --exists libavformat ; then
_inc_libavformat=$($_pkg_config --cflags libavformat)
_ld_tmp=$($_pkg_config --libs libavformat)
- cc_check $_inc_libavformat $_ld_tmp && extra_ldflags="$extra_ldflags $_ld_tmp" \
- && _libavformat_so=yes
+ cc_check $_inc_libavformat $_ld_tmp && extra_ldflags="$extra_ldflags $_ld_tmp" && extra_cflags="$extra_cflags $_inc_libavformat" \
+ && _libavformat=yes
elif cc_check $_ld_lm -lavformat ; then
extra_ldflags="$extra_ldflags -lavformat"
- _libavformat_so=yes
- _res_comment="using libavformat.so, but static libavformat is recommended"
+ _libavformat=yes
fi
fi
-_libavformat=no
def_libavformat='#undef CONFIG_LIBAVFORMAT'
-def_libavformat_a='#undef CONFIG_LIBAVFORMAT_A'
-def_libavformat_so='#undef CONFIG_LIBAVFORMAT_SO'
-test "$_libavformat_a" = yes || test "$_libavformat_so" = yes && _libavformat=yes
test "$_libavformat" = yes && def_libavformat='#define CONFIG_LIBAVFORMAT 1'
-test "$_libavformat_a" = yes && def_libavformat_a='#define CONFIG_LIBAVFORMAT_A 1'
-test "$_libavformat_so" = yes \
- && def_libavformat_so='#define CONFIG_LIBAVFORMAT_SO 1'
echores "$_libavformat"
echocheck "FFmpeg libpostproc"
-if test "$_libpostproc_a" = auto ; then
- _libpostproc_a=no
- if test -d libpostproc && test -f libpostproc/postprocess.h ; then
- _libpostproc_a='yes'
- _res_comment="static"
- fi
-elif test "$_libpostproc_so" = auto ; then
- _libpostproc_so=no
+if test "$_libpostproc" = auto ; then
+ _libpostproc=no
cat > $TMPC << EOF
#include <inttypes.h>
#include <libpostproc/postprocess.h>
int main(void) { pp_get_mode_by_name_and_quality("de", 0); return 0; }
EOF
- if cc_check -lpostproc $_ld_lm ; then
+ if $_pkg_config --exists libpostproc ; then
+ _inc_libpostproc=$($_pkg_config --cflags libpostproc)
+ _ld_tmp=$($_pkg_config --libs libpostproc)
+ cc_check $_inc_libpostproc $_ld_tmp && extra_ldflags="$extra_ldflags $_ld_tmp" && extra_cflags="$extra_cflags $_inc_libpostproc" \
+ && _libpostproc=yes
+ elif cc_check -lpostproc $_ld_lm ; then
extra_ldflags="$extra_ldflags -lpostproc"
- _libpostproc_so=yes
- _res_comment="using libpostproc.so, but static libpostproc is recommended"
+ _libpostproc=yes
fi
fi
-_libpostproc=no
def_libpostproc='#undef CONFIG_LIBPOSTPROC'
-def_libpostproc_a='#undef CONFIG_LIBPOSTPROC_A'
-def_libpostproc_so='#undef CONFIG_LIBPOSTPROC_SO'
-test "$_libpostproc_a" = yes || test "$_libpostproc_so" = yes && _libpostproc=yes
test "$_libpostproc" = yes && def_libpostproc='#define CONFIG_LIBPOSTPROC 1'
-test "$_libpostproc_a" = yes && def_libpostproc_a='#define CONFIG_LIBPOSTPROC_A 1'
-test "$_libpostproc_so" = yes \
- && def_libpostproc_so='#define CONFIG_LIBPOSTPROC_SO 1'
echores "$_libpostproc"
echocheck "FFmpeg libswscale"
-if test "$_libswscale_a" = auto ; then
- _libswscale_a=no
- if test -d libswscale && test -f libswscale/swscale.h ; then
- _libswscale_a='yes'
- _res_comment="static"
- fi
-elif test "$_libswscale_so" = auto ; then
- _libswscale_so=no
- _res_comment="using libswscale.so, but static libswscale is recommended"
+if test "$_libswscale" = auto ; then
+ _libswscale=no
cat > $TMPC << EOF
#include <libswscale/swscale.h>
int main(void) { sws_scale(0, 0, 0, 0, 0, 0, 0); return 0; }
@@ -7333,76 +7022,26 @@ EOF
if $_pkg_config --exists libswscale ; then
_inc_libswscale=$($_pkg_config --cflags libswscale)
_ld_tmp=$($_pkg_config --libs libswscale)
- cc_check $_inc_libswscale $_ld_tmp && extra_ldflags="$extra_ldflags $_ld_tmp" \
- && _libswscale_so=yes
+ cc_check $_inc_libswscale $_ld_tmp && extra_ldflags="$extra_ldflags $_ld_tmp" extra_cflags="$extra_cflags $_inc_libswscale" \
+ && _libswscale=yes
elif cc_check -lswscale ; then
extra_ldflags="$extra_ldflags -lswscale"
- _libswscale_so=yes
+ _libswscale=yes
fi
fi
-_libswscale=no
def_libswscale='#undef CONFIG_LIBSWSCALE'
-def_libswscale_a='#undef CONFIG_LIBSWSCALE_A'
-def_libswscale_so='#undef CONFIG_LIBSWSCALE_SO'
-test "$_libswscale_a" = yes || test "$_libswscale_so" = yes && _libswscale=yes
test "$_libswscale" = yes && def_libswscale='#define CONFIG_LIBSWSCALE 1'
-test "$_libswscale_a" = yes && def_libswscale_a='#define CONFIG_LIBSWSCALE_A 1'
-test "$_libswscale_so" = yes \
- && def_libswscale_so='#define CONFIG_LIBSWSCALE_SO 1'
echores "$_libswscale"
-echocheck "libopencore_amr narrowband"
-if test "$_libopencore_amrnb" = auto ; then
- _libopencore_amrnb=no
- cat > $TMPC << EOF
-#include <opencore-amrnb/interf_dec.h>
-int main(void) { Decoder_Interface_init(); return 0; }
-EOF
- cc_check -lopencore-amrnb && _libopencore_amrnb=yes
- if test "$_libavcodec_a" != yes ; then
- _libopencore_amrnb=no
- _res_comment="libavcodec (static) is required by libopencore_amrnb, sorry"
- fi
-fi
-if test "$_libopencore_amrnb" = yes ; then
- _libopencore_amr=yes
- extra_ldflags="$extra_ldflags -lopencore-amrnb"
- def_libopencore_amrnb='#define CONFIG_LIBOPENCORE_AMRNB 1'
- _libavdecoders="$_libavdecoders LIBOPENCORE_AMRNB_DECODER"
- _libavencoders="$_libavencoders LIBOPENCORE_AMRNB_ENCODER"
- _codecmodules="libopencore_amrnb $_codecmodules"
-else
- def_libopencore_amrnb='#define CONFIG_LIBOPENCORE_AMRNB 0'
- _nocodecmodules="libopencore_amrnb $_nocodecmodules"
+def_libswscale_internals="#undef CONFIG_LIBSWSCALE_INTERNALS"
+if ! test -z "$_ffmpeg_source" ; then
+ test "$_libswscale" = yes && def_libswscale_internals="#define CONFIG_LIBSWSCALE_INTERNALS 1" && _libswscale_internals=yes
fi
-echores "$_libopencore_amrnb"
-
-echocheck "libopencore_amr wideband"
-if test "$_libopencore_amrwb" = auto ; then
- _libopencore_amrwb=no
- cat > $TMPC << EOF
-#include <opencore-amrwb/dec_if.h>
-int main(void) { D_IF_init(); return 0; }
-EOF
- cc_check -lopencore-amrwb && _libopencore_amrwb=yes
- if test "$_libavcodec_a" != yes ; then
- _libopencore_amrwb=no
- _res_comment="libavcodec (static) is required by libopencore_amrwb, sorry"
- fi
+def_libavcodec_internals="#undef CONFIG_LIBAVCODEC_INTERNALS"
+if ! test -z "$_ffmpeg_source" ; then
+ test "$_libavcodec" = yes && def_libavcodec_internals="#define CONFIG_LIBAVCODEC_INTERNALS 1" && _libavcodec_internals=yes
fi
-if test "$_libopencore_amrwb" = yes ; then
- _libopencore_amr=yes
- extra_ldflags="$extra_ldflags -lopencore-amrwb"
- def_libopencore_amrwb='#define CONFIG_LIBOPENCORE_AMRWB 1'
- _libavdecoders="$_libavdecoders LIBOPENCORE_AMRWB_DECODER"
- _libavencoders="$_libavencoders LIBOPENCORE_AMRWB_DECODER"
- _codecmodules="libopencore_amrwb $_codecmodules"
-else
- def_libopencore_amrwb='#define LIBOPENCORE_AMRWB 0'
- _nocodecmodules="libopencore_amrwb $_nocodecmodules"
-fi
-echores "$_libopencore_amrwb"
echocheck "libdv-0.9.5+"
if test "$_libdv" = auto ; then
@@ -7445,30 +7084,12 @@ else
fi
echores "$_xvid"
-echocheck "Xvid two pass plugin"
-if test "$_xvid" = yes && test "$_xvid_lavc" = auto ; then
- cat > $TMPC << EOF
-#include <xvid.h>
-int main(void) { xvid_plugin_2pass2_t s; s.vbv_size=0; return 0; }
-EOF
- cc_check && _xvid_lavc=yes
-fi
-if test "$_xvid_lavc" = yes ; then
- def_xvid_lavc='#define CONFIG_LIBXVID 1'
- _libavencoders="$_libavencoders LIBXVID_ENCODER"
-else
- _xvid_lavc=no
- def_xvid_lavc='#define CONFIG_LIBXVID 0'
-fi
-echores "$_xvid_lavc"
-
-
echocheck "x264"
if test "$_x264" = auto ; then
cat > $TMPC << EOF
#include <inttypes.h>
#include <x264.h>
-#if X264_BUILD < 83
+#if X264_BUILD < 79
#error We do not support old versions of x264. Get the latest from git.
#endif
int main(void) { x264_encoder_open((void*)0); return 0; }
@@ -7482,95 +7103,12 @@ fi
if test "$_x264" = yes ; then
def_x264='#define CONFIG_X264 1'
_codecmodules="x264 $_codecmodules"
- test "$_x264_lavc" = auto && _x264_lavc=yes
- if test "$_x264_lavc" = yes ; then
- def_x264_lavc='#define CONFIG_LIBX264 1'
- libs_mplayer="$libs_mplayer $_ld_x264"
- _libavencoders="$_libavencoders LIBX264_ENCODER"
- fi
else
- _x264_lavc=no
def_x264='#undef CONFIG_X264'
- def_x264_lavc='#define CONFIG_LIBX264 0'
_nocodecmodules="x264 $_nocodecmodules"
fi
-_res_comment="in libavcodec: $_x264_lavc"
echores "$_x264"
-
-echocheck "libdirac"
-if test "$_libdirac_lavc" = auto; then
- _libdirac_lavc=no
- if test "$_libavcodec_a" != yes; then
- _res_comment="libavcodec (static) is required by libdirac, sorry"
- else
- cat > $TMPC << EOF
-#include <libdirac_encoder/dirac_encoder.h>
-#include <libdirac_decoder/dirac_parser.h>
-int main(void)
-{
- dirac_encoder_context_t enc_ctx;
- dirac_decoder_t *dec_handle;
- dirac_encoder_context_init(&enc_ctx, VIDEO_FORMAT_SD_576I50);
- dec_handle = dirac_decoder_init(0);
- if (dec_handle)
- dirac_decoder_close(dec_handle);
- return 0;
-}
-EOF
- if $_pkg_config --exists dirac ; then
- _inc_dirac=$($_pkg_config --silence-errors --cflags dirac)
- _ld_dirac=$($_pkg_config --silence-errors --libs dirac)
- cc_check $_inc_dirac $_ld_dirac &&
- _libdirac_lavc=yes &&
- extra_cflags="$extra_cflags $_inc_dirac" &&
- extra_ldflags="$extra_ldflags $_ld_dirac"
- fi
- fi
-fi
-if test "$_libdirac_lavc" = yes ; then
- def_libdirac_lavc='#define CONFIG_LIBDIRAC 1'
- _libavencoders="$_libavencoders LIBDIRAC_ENCODER"
- _libavdecoders="$_libavdecoders LIBDIRAC_DECODER"
- _codecmodules="libdirac $_codecmodules"
-else
- def_libdirac_lavc='#define CONFIG_LIBDIRAC 0'
- _nocodecmodules="libdirac $_nocodecmodules"
-fi
-echores "$_libdirac_lavc"
-
-
-echocheck "libschroedinger"
-if test "$_libschroedinger_lavc" = auto ; then
- _libschroedinger_lavc=no
- if test "$_libavcodec_a" != yes; then
- _res_comment="libavcodec (static) is required by libschroedinger, sorry"
- else
- cat > $TMPC << EOF
-#include <schroedinger/schro.h>
-int main(void) { schro_init(); return 0; }
-EOF
- if $_pkg_config --exists schroedinger-1.0 ; then
- _inc_schroedinger=$($_pkg_config --silence-errors --cflags schroedinger-1.0)
- _ld_schroedinger=$($_pkg_config --silence-errors --libs schroedinger-1.0)
- cc_check $_inc_schroedinger $_ld_schroedinger &&
- _libschroedinger_lavc=yes &&
- extra_cflags="$extra_cflags $_inc_schroedinger" &&
- extra_ldflags="$extra_ldflags $_ld_schroedinger"
- fi
- fi
-fi
-if test "$_libschroedinger_lavc" = yes ; then
- def_libschroedinger_lavc='#define CONFIG_LIBSCHROEDINGER 1'
- _libavencoders="$_libavencoders LIBSCHROEDINGER_ENCODER"
- _libavdecoders="$_libavdecoders LIBSCHROEDINGER_DECODER"
- _codecmodules="libschroedinger $_codecmodules"
-else
- def_libschroedinger_lavc='#define CONFIG_LIBSCHROEDINGER 0'
- _nocodecmodules="libschroedinger $_nocodecmodules"
-fi
-echores "$_libschroedinger_lavc"
-
echocheck "libnut"
if test "$_libnut" = auto ; then
cat > $TMPC << EOF
@@ -7593,7 +7131,48 @@ else
fi
echores "$_libnut"
-#check must be done after libavcodec one
+# These VO checks must be done after libavcodec/libswscale one
+echocheck "/dev/mga_vid"
+if test "$_mga" = auto ; then
+ _mga=no
+ test -c /dev/mga_vid && _mga=yes
+fi
+if test "$_mga" = yes ; then
+ if test "$_libswscale_internals" = yes ; then
+ def_mga='#define CONFIG_MGA 1'
+ _vomodules="mga $_vomodules"
+ else
+ _res_comment="libswscale internal headers are required by mga, sorry"
+ def_mga='#undef CONFIG_MGA'
+ _novomodules="mga $_novomodules"
+ fi
+else
+ def_mga='#undef CONFIG_MGA'
+ _novomodules="mga $_novomodules"
+fi
+echores "$_mga"
+
+
+echocheck "xmga"
+if test "$_xmga" = auto ; then
+ _xmga=no
+ test "$_x11" = yes && test "$_mga" = yes && _xmga=yes
+fi
+if test "$_xmga" = yes ; then
+ if test "$_libswscale_internals" = yes ; then
+ def_xmga='#define CONFIG_XMGA 1'
+ _vomodules="xmga $_vomodules"
+ else
+ _res_comment="libswscale internal headers are required by mga, sorry"
+ def_xmga='#undef CONFIG_XMGA'
+ _novomodules="xmga $_novomodules"
+ fi
+else
+ def_xmga='#undef CONFIG_XMGA'
+ _novomodules="xmga $_novomodules"
+fi
+echores "$_xmga"
+
echocheck "zr"
if test "$_zr" = auto ; then
#36067's seem to identify themselves as 36057PQC's, so the line
@@ -7605,11 +7184,11 @@ if test "$_zr" = auto ; then
fi
fi
if test "$_zr" = yes ; then
- if test "$_libavcodec_a" = yes ; then
+ if test "$_libavcodec_internals" = yes ; then
def_zr='#define CONFIG_ZR 1'
_vomodules="zr zr2 $_vomodules"
else
- _res_comment="libavcodec (static) is required by zr, sorry"
+ _res_comment="libavcodec internal headers are required by zr, sorry"
_novomodules="zr $_novomodules"
def_zr='#undef CONFIG_ZR'
fi
@@ -7649,18 +7228,9 @@ EOF
int main(void) { lame_set_preset(NULL, MEDIUM_FAST); return 0; }
EOF
cc_check $_ld_mp3lame $_ld_lm && def_mp3lame_preset_medium="#define CONFIG_MP3LAME_PRESET_MEDIUM 1"
- test "$_mp3lame_lavc" = auto && _mp3lame_lavc=yes
- if test "$_mp3lame_lavc" = yes ; then
- def_mp3lame_lavc="#define CONFIG_LIBMP3LAME 1"
- _libavencoders="$_libavencoders LIBMP3LAME_ENCODER"
- libs_mplayer="$libs_mplayer $_ld_mp3lame"
- fi
else
- _mp3lame_lavc=no
def_mp3lame='#undef CONFIG_MP3LAME'
- def_mp3lame_lavc="#define CONFIG_LIBMP3LAME 0"
fi
-_res_comment="in libavcodec: $_mp3lame_lavc"
echores "$_mp3lame"
fi # test "$_mencoder" != no
@@ -7669,10 +7239,6 @@ echocheck "mencoder"
if test "$_mencoder" = yes ; then
def_muxers='#define CONFIG_MUXERS 1'
else
- # mpeg1video for vf_lavc, snow for vf_uspp and vf_mcdeint, png for vf_screenshot
- _libavencoders="MPEG1VIDEO_ENCODER SNOW_ENCODER"
- test "$_zlib" = yes && _libavencoders="$_libavencoders PNG_ENCODER"
- _libavmuxers=""
def_muxers='#define CONFIG_MUXERS 0'
fi
echores "$_mencoder"
@@ -8048,135 +7614,6 @@ else
fi
echores "$_xmms"
-
-# --------------- GUI specific tests begin -------------------
-echocheck "GUI"
-echo "$_gui"
-if test "$_gui" = yes ; then
-
- # Required libraries
- if test "$_libavcodec" != yes ||
- ! echo $_libavdecoders | grep -q PNG_DECODER ; then
- die "The GUI requires libavcodec with PNG support (needs zlib)."
- fi
- test "$_freetype" = no && test "$_bitmap_font" = no && \
- die "The GUI requires either FreeType or bitmap font support."
-if ! win32 ; then
- _gui_gtk=yes
- test "$_x11" != yes && die "X11 support required for GUI compilation."
-
- echocheck "XShape extension"
- if test "$_xshape" = auto ; then
- _xshape=no
- cat > $TMPC << EOF
-#include <X11/Xlib.h>
-#include <X11/Xproto.h>
-#include <X11/Xutil.h>
-#include <X11/extensions/shape.h>
-#include <stdlib.h>
-int main(void) {
- char *name = ":0.0";
- Display *wsDisplay;
- int exitvar = 0;
- int eventbase, errorbase;
- if (getenv("DISPLAY"))
- name=getenv("DISPLAY");
- wsDisplay=XOpenDisplay(name);
- if (!XShapeQueryExtension(wsDisplay,&eventbase,&errorbase))
- exitvar=1;
- XCloseDisplay(wsDisplay);
- return exitvar;
-}
-EOF
- cc_check -lXext && _xshape=yes
- fi
- if test "$_xshape" = yes ; then
- def_xshape='#define CONFIG_XSHAPE 1'
- else
- die "The GUI requires the X11 extension XShape (which was not found)."
- fi
- echores "$_xshape"
-
-#Check for GTK
-if test "$_gtk1" = no ; then
- #Check for GTK2 :
- echocheck "GTK+ version"
-
- if $_pkg_config gtk+-2.0 --exists ; then
- _gtk=$($_pkg_config gtk+-2.0 --modversion 2>/dev/null)
- extra_cflags="$extra_cflags $($_pkg_config gtk+-2.0 --cflags 2>/dev/null)"
- libs_mplayer="$libs_mplayer $($_pkg_config gtk+-2.0 --libs 2>/dev/null)"
- echores "$_gtk"
-
- # Check for GLIB2
- if $_pkg_config glib-2.0 --exists ; then
- echocheck "glib version"
- _glib=$($_pkg_config glib-2.0 --modversion 2>/dev/null)
- libs_mplayer="$libs_mplayer $($_pkg_config glib-2.0 --libs 2>/dev/null)"
- echores "$_glib"
-
- def_gui='#define CONFIG_GUI 1'
- def_gtk2='#define CONFIG_GTK2 1'
- else
- _gtk1=yes
- echo "GLIB-2 devel packages were not found, trying GTK 1.2"
- fi
- else
- echo "GTK-2 devel packages were not found, trying GTK 1.2"
- _gtk1=yes
- fi
-fi
-
-if test "$_gtk1" = yes ; then
- # Check for old GTK (1.2.x)
- echocheck "GTK version"
- if test -z "$_gtkconfig" ; then
- if ( gtk-config --version ) >/dev/null 2>&1 ; then
- _gtkconfig="gtk-config"
- elif ( gtk12-config --version ) >/dev/null 2>&1 ; then
- _gtkconfig="gtk12-config"
- else
- die "The GUI requires GTK devel packages (which were not found)."
- fi
- fi
- _gtk=$($_gtkconfig --version 2>&1)
- extra_cflags="$extra_cflags $($_gtkconfig --cflags 2>&1)"
- libs_mplayer="$libs_mplayer $($_gtkconfig --libs 2>&1)"
- echores "$_gtk (using $_gtkconfig)"
-
- # Check for GLIB
- echocheck "glib version"
- if test -z "$_glibconfig" ; then
- if ( glib-config --version ) >/dev/null 2>&1 ; then
- _glibconfig="glib-config"
- elif ( glib12-config --version ) >/dev/null 2>&1 ; then
- _glibconfig="glib12-config"
- else
- die "The GUI requires GLIB devel packages (which were not found)"
- fi
- fi
- _glib=$($_glibconfig --version 2>&1)
- libs_mplayer="$libs_mplayer $($_glibconfig --libs 2>&1)"
- echores "$_glib (using $_glibconfig)"
-
- def_gui='#define CONFIG_GUI 1'
- def_gtk2='#undef CONFIG_GTK2'
-fi
-
-else #if ! win32
- _gui_win32=yes
- libs_mplayer="$libs_mplayer -lcomdlg32 -lcomctl32 -lshell32 -lkernel32"
- def_gui='#define CONFIG_GUI 1'
- def_gtk2='#undef CONFIG_GTK2'
-fi #if ! win32
-
-else #if test "$_gui"
- def_gui='#undef CONFIG_GUI'
- def_gtk2='#undef CONFIG_GTK2'
-fi #if test "$_gui"
-# --------------- GUI specific tests end -------------------
-
-
if test "$_charset" != "noconv" ; then
def_charset="#define MSG_CHARSET \"$_charset\""
else
@@ -8192,7 +7629,6 @@ if test "$?" -ne 0 ; then
echo "No working iconv program found, use "
echo "--charset=UTF-8 to continue anyway."
echo "If you also have problems with iconv library functions use --charset=noconv."
- echo "Messages in the GTK-2 interface will be broken then."
exit 1
else
echores "yes"
@@ -8347,7 +7783,7 @@ if test "$_largefiles" = yes || freebsd ; then
fi
fi
-CXXFLAGS=" $CFLAGS -D__STDC_LIMIT_MACROS"
+CXXFLAGS=" $CFLAGS -Iffmpeg -D__STDC_LIMIT_MACROS"
# This must be the last test to be performed. Any other tests following it
# could fail due to linker errors. libdvdnavmini is intentionally not linked
@@ -8355,6 +7791,9 @@ CXXFLAGS=" $CFLAGS -D__STDC_LIMIT_MACROS"
# So any compilation using the flags added here but not linking against
# libdvdread can fail.
echocheck "DVD support (libdvdnav)"
+if test "$_dvdread_internal" = yes && test ! -f "libdvdnav/dvdnav.c" ; then
+ _dvdnav=no
+fi
dvdnav_internal=no
if test "$_dvdnav" = auto ; then
if test "$_dvdread_internal" = yes ; then
@@ -8418,6 +7857,7 @@ DATADIR = \$(DESTDIR)$_datadir
LIBDIR = \$(DESTDIR)$_libdir
MANDIR = \$(DESTDIR)$_mandir
CONFDIR = \$(DESTDIR)$_confdir
+LOCALEDIR = \$(DESTDIR)$_localedir
AR = $_ar
AS = $_cc
@@ -8431,8 +7871,6 @@ RANLIB = $_ranlib
WINDRES = $_windres
CFLAGS = $CFLAGS $extra_cflags
-ASFLAGS = $CFLAGS $extra_cflags
-OPTFLAGS = $CFLAGS $extra_cflags
CXXFLAGS = $CXXFLAGS $extra_cflags $extra_cxxflags
CFLAGS_DHAHELPER = $cflags_dhahelper
CFLAGS_FAAD_FIXED = $cflags_faad_fixed
@@ -8449,8 +7887,6 @@ EXTRALIBS = $extra_ldflags $_ld_static $_ld_lm $extra_libs
EXTRALIBS_MPLAYER = $libs_mplayer
EXTRALIBS_MENCODER = $libs_mencoder
-DEPEND_CMD = \$(CC) -MM \$(CFLAGS) \$(filter-out %.h,\$^) | sed "s,[0-9a-z._-]*: \(\$(SRC_DIR)/\)*\([a-z0-9]*/\)[^/]* ,\\2&,"
-
MPDEPEND_CMD = \$(CC) -MM \$(CFLAGS) \$(filter-out %.xpm,\$(filter-out %.h,$^)) | sed -e "s,[0-9a-z._-]*: \([a-z0-9/]*/\)[^/]* ,\1&," -e "s,\(.*\)\.o: ,\1.d &,"
MPDEPEND_CMD_CXX = \$(CC) -MM \$(CXXFLAGS) \$(filter-out %.hh,\$(filter-out %.h,$^)) | sed -e "s,[0-9a-z._-]*: \([a-z0-9/]*/\)[^/]* ,\1&," -e "s,\(.*\)\.o: ,\1.d &,"
@@ -8512,8 +7948,6 @@ FAAC=$_faac
FAAD = $_faad
FAAD_INTERNAL = $_faad_internal
FASTMEMCPY = $_fastmemcpy
-$mak_hardcoded_tables
-$mak_libavcodec_mpegaudio_hp
FBDEV = $_fbdev
FREETYPE = $_freetype
FTP = $_ftp
@@ -8523,9 +7957,6 @@ GL = $_gl
GL_WIN32 = $_gl_win32
GL_X11 = $_gl_x11
MATRIXVIEW = $matrixview
-GUI = $_gui
-GUI_GTK = $_gui_gtk
-GUI_WIN32 = $_gui_win32
HAVE_POSIX_SELECT = $_posix_select
HAVE_SYS_MMAN_H = $_mman
IVTV = $_ivtv
@@ -8537,7 +7968,6 @@ LADSPA = $_ladspa
LIBA52 = $_liba52
LIBA52_INTERNAL = $_liba52_internal
LIBASS = $_ass
-LIBASS_INTERNAL = $ass_internal
LIBBS2B = $_libbs2b
LIBDCA = $_libdca
LIBDV = $_libdv
@@ -8641,33 +8071,13 @@ ZR = $_zr
# FFmpeg
LIBAVUTIL = $_libavutil
-LIBAVUTIL_A = $_libavutil_a
-LIBAVUTIL_SO = $_libavutil_so
LIBAVCODEC = $_libavcodec
-LIBAVCODEC_A = $_libavcodec_a
-LIBAVCODEC_SO = $_libavcodec_so
LIBAVFORMAT = $_libavformat
-LIBAVFORMAT_A = $_libavformat_a
-LIBAVFORMAT_SO = $_libavformat_so
LIBPOSTPROC = $_libpostproc
-LIBPOSTPROC_A = $_libpostproc_a
-LIBPOSTPROC_SO = $_libpostproc_so
LIBSWSCALE = $_libswscale
-LIBSWSCALE_A = $_libswscale_a
-LIBSWSCALE_SO = $_libswscale_so
-
-HOSTCC=\$(HOST_CC)
-HOSTCFLAGS=-D_ISOC99_SOURCE -D_POSIX_C_SOURCE=200112 -O3
-HOSTLIBS=-lm
-CC_O=-o \$@
-LD=gcc
-CONFIG_STATIC=yes
-SRC_PATH=..
-BUILD_ROOT=..
-LIBPREF=lib
-LIBSUF=.a
-LIBNAME=\$(LIBPREF)\$(NAME)\$(LIBSUF)
-FULLNAME=\$(NAME)\$(BUILDSUF)
+LIBAVCODEC_INTERNALS = $_libavcodec_internals
+LIBSWSCALE_INTERNALS = $_libswscale_internals
+FFMPEG_SOURCE_PATH = $_ffmpeg_source
# Some FFmpeg codecs depend on these. Enable them unconditionally for now.
CONFIG_AANDCT=yes
@@ -8681,25 +8091,8 @@ CONFIG_RDFT=yes
CONFIG_BZLIB=$bzlib
CONFIG_ENCODERS=yes
CONFIG_GPL=yes
-CONFIG_LIBDIRAC_DECODER=$_libdirac_lavc
-CONFIG_LIBDIRAC_ENCODER=$_libdirac_lavc
-CONFIG_LIBFAAC_ENCODER=$_faac_lavc
-CONFIG_LIBMP3LAME_ENCODER=$_mp3lame_lavc
-CONFIG_LIBOPENCORE_AMRNB_DECODER=$_libopencore_amrnb
-CONFIG_LIBOPENCORE_AMRNB_ENCODER=$_libopencore_amrnb
-CONFIG_LIBOPENCORE_AMRWB_DECODER=$_libopencore_amrwb
-OCNFIG_LIBOPENJPEG_DECODER = $libopenjpeg
-OCNFIG_LIBOPENJPEG_ENCODER = $libopenjpeg
-CONFIG_LIBSCHROEDINGER_DECODER=$_libschroedinger_lavc
-CONFIG_LIBSCHROEDINGER_ENCODER=$_libschroedinger_lavc
-CONFIG_LIBVORBIS_ENCODER=$_libvorbis
-CONFIG_LIBX264_ENCODER=$_x264_lavc
-CONFIG_LIBXVID_ENCODER=$_xvid_lavc
CONFIG_MLIB = $_mlib
CONFIG_MUXERS=$_mencoder
-CONFIG_POSTPROC = yes
-# Prevent building libavcodec/imgresample.c with conflicting symbols
-CONFIG_SWSCALE=yes
CONFIG_VDPAU=$_vdpau
CONFIG_XVMC=$_xvmc
CONFIG_ZLIB=$_zlib
@@ -8709,14 +8102,6 @@ HAVE_SHM = $_shm
HAVE_W32THREADS = $_w32threads
HAVE_YASM = $_have_yasm
-$(echo $_libavdecoders | tr '[a-z] ' '[A-Z]\n' | sed 's/^/CONFIG_/;s/$/=yes/')
-$(echo $_libavencoders | tr '[a-z] ' '[A-Z]\n' | sed 's/^/CONFIG_/;s/$/=yes/')
-$(echo $_libavparsers | tr '[a-z] ' '[A-Z]\n' | sed 's/^/CONFIG_/;s/$/=yes/')
-$(echo $_libavdemuxers | tr '[a-z] ' '[A-Z]\n' | sed 's/^/CONFIG_/;s/$/=yes/')
-$(echo $_libavmuxers | tr '[a-z] ' '[A-Z]\n' | sed 's/^/CONFIG_/;s/$/=yes/')
-$(echo $_libavprotocols | tr '[a-z] ' '[A-Z]\n' | sed 's/^/CONFIG_/;s/$/=yes/')
-$(echo $_libavbsfs | tr '[a-z] ' '[A-Z]\n' | sed 's/^/CONFIG_/;s/$/=yes/')
-$(echo $_libavhwaccels | tr '[a-z] ' '[A-Z]\n' | sed 's/^/CONFIG_/;s/$/=yes/')
EOF
#############################################################################
@@ -8752,9 +8137,6 @@ cat > $TMPH << EOF
*/
#define CONFIG_FAKE_MONO 1
-/* set up max. outburst. use 65536 for ALSA 0.5, for others 16384 is enough */
-#define MAX_OUTBURST 65536
-
/* set up audio OUTBURST. Do not change this! */
#define OUTBURST 512
@@ -8773,6 +8155,9 @@ cat > $TMPH << EOF
#define MPLAYER_DATADIR "$_datadir"
#define MPLAYER_CONFDIR "$_confdir"
#define MPLAYER_LIBDIR "$_libdir"
+#define MPLAYER_LOCALEDIR "$_localedir"
+
+$def_translation
/* definitions needed by included libraries */
#define HAVE_INTTYPES_H 1
@@ -8871,7 +8256,6 @@ $def_crash_debug
$def_debug
$def_dynamic_plugins
$def_fastmemcpy
-$def_hardcoded_tables
$def_menu
$def_runtime_cpudetection
$def_sighandler
@@ -8953,12 +8337,6 @@ $def_xmms
#define XMMS_INPUT_PLUGIN_DIR "$_xmmsplugindir"
-/* GUI */
-$def_gtk2
-$def_gui
-$def_xshape
-
-
/* Audio output drivers */
$def_alsa
$def_alsa1x
@@ -9009,7 +8387,6 @@ $def_tv_v4l2
/* font stuff */
$def_ass
-$def_ass_internal
$def_bitmap_font
$def_enca
$def_fontconfig
@@ -9029,9 +8406,6 @@ $def_network
$def_smb
$def_socklen_t
$def_vstream
-$def_addrinfo
-$def_getaddrinfo
-$def_sockaddr_storage
/* libvo options */
@@ -9115,20 +8489,12 @@ $def_zr
/* FFmpeg */
$def_libavcodec
-$def_libavcodec_a
-$def_libavcodec_so
$def_libavformat
-$def_libavformat_a
-$def_libavformat_so
$def_libavutil
-$def_libavutil_a
-$def_libavutil_so
$def_libpostproc
-$def_libpostproc_a
-$def_libpostproc_so
$def_libswscale
-$def_libswscale_a
-$def_libswscale_so
+$def_libavcodec_internals
+$def_libswscale_internals
#define CONFIG_DECODERS 1
#define CONFIG_ENCODERS 1
@@ -9142,7 +8508,6 @@ $def_dcbzl
$def_dos_paths
$def_fast_64bit
$def_fast_unaligned
-$def_libavcodec_mpegaudio_hp
$def_memalign_hack
$def_mlib
$def_mkstemp
@@ -9157,29 +8522,19 @@ $def_yasm
#define CONFIG_FFSERVER 0
#define CONFIG_GPL 1
#define CONFIG_GRAY 0
+#define CONFIG_HARDCODED_TABLES 0
#define CONFIG_LIBVORBIS 0
#define CONFIG_POWERPC_PERF 0
#define CONFIG_SMALL 0
#define CONFIG_SWSCALE 1
#define CONFIG_SWSCALE_ALPHA 1
-#if defined(HAVE_AF_INET6) && (!defined(_WIN32) || defined(__CYGWIN__))
-#define CONFIG_IPV6 1
-#else
-#define CONFIG_IPV6 0
-#endif
-
-#define HAVE_ATTRIBUTE_MAY_ALIAS 1
#define HAVE_ATTRIBUTE_PACKED 1
#define HAVE_GETHRTIME 0
#define HAVE_INLINE_ASM 1
#define HAVE_LDBRX 0
#define HAVE_POLL_H 1
#define HAVE_PPC4XX 0
-#define HAVE_SETMODE 0
-#define HAVE_STRUCT_IPV6_MREQ 1
-#define HAVE_STRUCT_SOCKADDR_IN6 1
-#define HAVE_SYS_SELECT_H 0
#define HAVE_VFP_ARGS 1
#define HAVE_VIRTUALALLOC 0
@@ -9199,28 +8554,12 @@ $def_ebx_available
#define HAVE_EBP_AVAILABLE 0
#endif
-#define FFMPEG_CONFIGURATION "--enable-gpl --enable-postproc"
-#define FFMPEG_LICENSE "GPL version 2 or later"
-
-/* External libraries used through libavcodec. */
-$def_faac_lavc
-$def_libdirac_lavc
-$def_libopencore_amrnb
-$def_libopencore_amrwb
-$def_libopenjpeg
-$def_libschroedinger_lavc
-$def_mp3lame_lavc
-$def_x264_lavc
-$def_xvid_lavc
-
-$(ff_config_enable "$_libavdecoders_all" "$_libavdecoders")
-$(ff_config_enable "$_libavencoders_all" "$_libavencoders")
-$(ff_config_enable "$_libavparsers_all" "$_libavparsers")
-$(ff_config_enable "$_libavdemuxers_all" "$_libavdemuxers")
-$(ff_config_enable "$_libavmuxers_all" "$_libavmuxers")
-$(ff_config_enable "$_libavprotocols_all" "$_libavprotocols")
-$(ff_config_enable "$_libavbsfs_all" "$_libavbsfs")
-$(ff_config_enable "$_libavhwaccels_all" "$_libavhwaccels")
+#define CONFIG_H263_VAAPI_HWACCEL 0
+#define CONFIG_MPEG2_VAAPI_HWACCEL 0
+#define CONFIG_MPEG4_VAAPI_HWACCEL 0
+#define CONFIG_H264_VAAPI_HWACCEL 0
+#define CONFIG_VC1_VAAPI_HWACCEL 0
+#define CONFIG_WMV3_VAAPI_HWACCEL 0
#endif /* MPLAYER_CONFIG_H */
EOF
@@ -9228,22 +8567,10 @@ EOF
# Do not overwrite an unchanged config.h to avoid superfluous rebuilds.
cmp -s "$TMPH" config.h || mv -f "$TMPH" config.h
-############################################################################
-
-# Create avconfig.h for FFmpeg.
-cat > "$TMPH" << EOF
-/* Generated by mpconfigure */
-#ifndef AVUTIL_AVCONFIG_H
-#define AVUTIL_AVCONFIG_H
-$def_av_bigendian
-#endif /* AVUTIL_AVCONFIG_H */
-EOF
-
-# Do not overwrite an unchanged avconfig.h to avoid superfluous rebuilds.
-cmp -s "$TMPH" libavutil/avconfig.h || mv -f "$TMPH" libavutil/avconfig.h
-
#############################################################################
+./version.sh `$_cc -dumpversion`
+
cat << EOF
Config files successfully generated by ./configure $_configuration !
@@ -9256,7 +8583,7 @@ Config files successfully generated by ./configure $_configuration !
Optimizing for: $_optimizing
Languages:
- Messages/GUI: $language_msg
+ Messages: $language_msg
Manual pages: $language_man
Documentation: $language_doc
@@ -9306,7 +8633,7 @@ skipping autodetection. This behavior is unlike what you may be used to from
autoconf-based configure scripts that can decide to override you. This greater
level of control comes at a price. You may have to provide the correct compiler
and linker flags yourself.
-If you used one of these options (except --enable-gui and similar ones that
+If you used one of these options (except --enable-menu and similar ones that
turn on internal features) and experience a compilation or linking failure,
make sure you have passed the necessary compiler/linker flags to configure.
diff --git a/cpudetect.h b/cpudetect.h
index 7c0f7e7cd0..cf39819d0b 100644
--- a/cpudetect.h
+++ b/cpudetect.h
@@ -26,7 +26,7 @@
#define CPUTYPE_I586 5
#define CPUTYPE_I686 6
-#include "libavutil/x86_cpu.h"
+#include "ffmpeg_files/x86_cpu.h"
typedef struct cpucaps_s {
int cpuType;
diff --git a/debian/README.debian b/debian/README.debian
index 23fc3ea415..80874c8de6 100644
--- a/debian/README.debian
+++ b/debian/README.debian
@@ -8,9 +8,9 @@ mplayer for Debian
directory
In case you would like to pass some parameters to ./configure, set variable
- DEB_BUILD_OPTIONS like that:
+ DEB_BUILD_CONFIGURE like that:
- eyck@ghost$ DEB_BUILD_OPTIONS="--enable-streaming" fakeroot debian/rules binary
+ eyck@ghost$ DEB_BUILD_CONFIGURE"--enable-streaming" fakeroot debian/rules binary
Dariush Pietrzak <eyck@ghost.anime.pl> Sat Jan 5 20:28:23 CET 2002
diff --git a/debian/TODO.Debian b/debian/TODO.Debian
index 4f73f9ba38..8b13789179 100644
--- a/debian/TODO.Debian
+++ b/debian/TODO.Debian
@@ -1 +1 @@
-- Figure out why /etc/mplayer/mplayer.config.1 gets created and fix this.
+
diff --git a/debian/changelog b/debian/changelog
index 8b16dbce63..ace71aa772 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,10 @@
+mplayer (1.0git) unstable; urgency=low
+
+ * change version name to git.
+ * update standards version to 3.8.2
+
+ -- Anton Khirnov <wyskas@gmail.com> Sat, 08 Aug 2009 13:15:57 +0200
+
mplayer (1.0svn) unstable; urgency=low
* change version naming from cvs to svn.
diff --git a/debian/compat b/debian/compat
new file mode 100644
index 0000000000..7f8f011eb7
--- /dev/null
+++ b/debian/compat
@@ -0,0 +1 @@
+7
diff --git a/debian/config b/debian/config
deleted file mode 100755
index ab3c8c1b5b..0000000000
--- a/debian/config
+++ /dev/null
@@ -1,52 +0,0 @@
-#!/bin/sh
-
-CONFIGFILE=/etc/mplayer/mplayer.conf
-
-set -e
-
-# Source debconf library.
-. /usr/share/debconf/confmodule
-
-if test -r $CONFIGFILE && ! grep -q '### mplayer DEBCONF AREA' $CONFIGFILE
-then
- db_input medium 'mplayer/replace-existing-files' || true
- db_go || true
- if [ "$RET" != "true" ]; then
- exit 0
- fi
- db_get 'mplayer/replace-existing-files' || true
-fi
-
-########################################## find fonts
-#default font (if available)
-BESTFONT=/usr/share/fonts/truetype/Arial.ttf
-[ -r $BESTFONT ] || BESTFONT=/usr/share/fonts/truetype/freefont/FreeSans.ttf
-
-t=$(tempfile -p fonts )
-find /usr/share/fonts/ /?/?in*/?ont* -type f -iname '*.ttf' -maxdepth 3 2> /dev/null > $t || true
-
-if test -s $t
-then
- fonts=$( awk '{print a $0;a=", "}' $t || true )
- db_subst "mplayer/ttfont" ttfontchoices $fonts || true
- ## suppose the question is skipped: give a default
- a=$BESTFONT
- [ -r $BESTFONT ] || a=$(head -1 $t)
- db_subst "mplayer/ttfont" ttfontdefault $a || true
-
- db_input medium mplayer/ttfont || true
- if [ "$?" = 30 ] ; then
- db_set mplayer/ttfont $a || true
- fi
-else
- db_input medium "mplayer/no-ttfont" || true
-fi
-
-rm $t
-
-db_go || true
-
-############################################################
-
-
-exit 0
diff --git a/debian/control b/debian/control
index f8a5704f54..fb578fee1c 100644
--- a/debian/control
+++ b/debian/control
@@ -2,8 +2,8 @@ Source: mplayer
Section: misc
Priority: optional
Maintainer: Diego Biurrun <diego@biurrun.de>
-Standards-Version: 3.2.1
-Build-Depends: libgtk1.2-dev | libgtk2.0-dev, libpng12-dev, zlib1g-dev, x11proto-core-dev, libx11-dev, libxext-dev, libxinerama-dev, libxv-dev, debhelper (>= 2)
+Standards-Version: 3.8.2
+Build-Depends: libpng12-dev, zlib1g-dev, x11proto-core-dev, libx11-dev, libxext-dev, libxinerama-dev, libxv-dev, debhelper (>= 7)
Package: mplayer
Architecture: any
diff --git a/debian/menu b/debian/menu
deleted file mode 100644
index 06a7c7f583..0000000000
--- a/debian/menu
+++ /dev/null
@@ -1,6 +0,0 @@
-?package(mplayer):\
- needs="X11"\
- section="Apps/Viewers"\
- title="MPlayer"\
- command="/usr/bin/gmplayer"\
- icon="/usr/share/pixmaps/mplayer.xpm"
diff --git a/debian/postrm b/debian/postrm
deleted file mode 100644
index 5cfa18c857..0000000000
--- a/debian/postrm
+++ /dev/null
@@ -1,18 +0,0 @@
-#!/bin/sh
-
-set -e
-
-if [ "$1" = "purge" ]; then
- if [ -e /usr/share/debconf/confmodule ]; then
- # Source debconf library.
- . /usr/share/debconf/confmodule
- # Remove my changes to the db.
- db_purge
- fi
-
- if [ -d /etc/mplayer/ ]; then
- rm -rf /etc/mplayer/
- fi
-fi
-
-#DEBHELPER#
diff --git a/debian/rules b/debian/rules
index 17c06b0621..5a775b8906 100755
--- a/debian/rules
+++ b/debian/rules
@@ -2,8 +2,10 @@
# Made with the aid of debmake, by Christoph Lameter,
# based on the sample debian/rules file for GNU hello by Ian Jackson.
#export DH_VERBOSE=1
-# This is the debhelper compatability version to use.
-export DH_COMPAT=4
+
+# do not run the actual rules of this makefile in parallel. sub-makes
+# can go in parallel
+.NOTPARALLEL:
package := mplayer
prefix := $(shell pwd)/debian/$(package)
@@ -14,6 +16,11 @@ arch := $(shell dpkg --print-architecture)
# https://wiki.ubuntu.com/DistCompilerFlags
CLEAN_ENV=env -u CFLAGS -u CPPFLAGS -u LDFLAGS -u FFLAGS -u CXXFLAGS
+ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
+ NUMJOBS = $(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
+ MAKEFLAGS += -j$(NUMJOBS)
+endif
+
configure: configure-stamp
configure-stamp:
dh_testdir
@@ -23,7 +30,7 @@ configure-stamp:
# you may want to add the "--enable-runtime-cpudetection" option to
# the line below, but beware: the resulting binary will run slower
$(CLEAN_ENV) \
- ./configure --prefix=/usr --confdir=/etc/mplayer $(DEB_BUILD_OPTIONS)
+ ./configure --prefix=/usr --confdir=/etc/mplayer $(DEB_BUILD_CONFIGURE)
touch configure-stamp
@@ -44,7 +51,6 @@ clean:
# commands to clean up after the build process.
-$(MAKE) distclean
- rm -f help_mp.h config.h config.mak
dh_clean
# Build architecture-independent files here.
@@ -61,14 +67,9 @@ binary-arch: build
# commands to install the package into debian/<packagename>
$(MAKE) prefix=$(prefix)/usr BINDIR=$(prefix)/usr/bin CONFDIR=$(prefix)/etc/mplayer LIBDIR=$(prefix)/usr/lib DATADIR=$(prefix)/usr/share/mplayer MANDIR=$(prefix)/usr/share/man install
- dh_link usr/bin/mplayer usr/bin/gmplayer \
- usr/share/man/man1/mplayer.1.gz usr/share/man/man1/gmplayer.1.gz
-
-
- dh_installdebconf
+ install -D -m 644 etc/example.conf $(prefix)/etc/mplayer/mplayer.conf
dh_installdocs -X.svn -Xmplayer.1 DOCS/*
dh_installexamples etc/example.conf etc/dvb-menu.conf etc/input.conf etc/menu.conf
- dh_installmenu
dh_installmime
dh_installinfo
dh_installchangelogs
diff --git a/debian/templates b/debian/templates
deleted file mode 100644
index 8fc8ca072b..0000000000
--- a/debian/templates
+++ /dev/null
@@ -1,26 +0,0 @@
-Template: mplayer/replace-existing-files
-Type: boolean
-Default: true
-Description: Upgrade existing system?
- It looks like you've configured MPlayer already. If you'd like to
- configure it with this program, the old configuration
- /etc/mplayer/mplayer.conf will be deleted. Do you want to continue
- configuration with this program? If you say "Yes", your old
- configuration will be deleted and you can create it anew with this
- program. If you say "No" your existing files will be kept. If you
- change your mind later, you can run 'dpkg-reconfigure mplayer'.
-
-Template: mplayer/ttfont
-Type: select
-Choices: ${ttfontchoices}
-Default: ${ttfontdefault}
-Description: MPlayer fonts
- MPlayer can use TrueType fonts to render the OSD and subtitles.
- Choose your favorite.
-
-Template: mplayer/no-ttfont
-Type: note
-Description: MPlayer cannot find TrueType fonts
- You should install a package providing TrueType fonts (such as
- 'ttf-freefont' or 'ttf-bitstream-vera' or 'msttcorefonts' )
- and reconfigure mplayer.
diff --git a/debian/watch b/debian/watch
deleted file mode 100644
index f02e397260..0000000000
--- a/debian/watch
+++ /dev/null
@@ -1,3 +0,0 @@
-# Site Directory Pattern Version Script
-version=2
-http://www.mplayerhq.hu /MPlayer/releases/ MPlayer-(.*)\.tar\.bz2 debian uupdate
diff --git a/defaultopts.c b/defaultopts.c
new file mode 100644
index 0000000000..b5917c53a7
--- /dev/null
+++ b/defaultopts.c
@@ -0,0 +1,62 @@
+#include <stddef.h>
+
+#include "config.h"
+#include "defaultopts.h"
+#include "options.h"
+
+void set_default_mplayer_options(struct MPOpts *opts)
+{
+ *opts = (const struct MPOpts){
+ .audio_driver_list = NULL,
+ .video_driver_list = NULL,
+ .fixed_vo = 1,
+ .monitor_pixel_aspect = 1.0,
+ .vo_panscanrange = 1.0,
+ .vo_gamma_gamma = 1000,
+ .vo_gamma_brightness = 1000,
+ .vo_gamma_contrast = 1000,
+ .vo_gamma_saturation = 1000,
+ .vo_gamma_hue = 1000,
+ .osd_level = 1,
+ .osd_duration = 1000,
+ .loop_times = -1,
+ .ordered_chapters = 1,
+ .edition_id = -1,
+ .user_correct_pts = -1,
+ .key_fifo_size = 7,
+ .doubleclick_time = 300,
+ .audio_id = -1,
+ .video_id = -1,
+ .sub_id = -1,
+ .playback_speed = 1.,
+ .movie_aspect = -1.,
+ .flip = -1,
+ .vd_use_slices = 1,
+ .lavc_param = {
+ .workaround_bugs = 1, // autodetect
+ .error_resilience = 2,
+ .error_concealment = 3,
+ .threads = 1,
+ },
+ .input = {
+ .config_file = "input.conf",
+ .ar_delay = 100,
+ .ar_rate = 8,
+ .use_joystick = 1,
+ .use_lirc = 1,
+ .use_lircc = 1,
+#ifdef CONFIG_APPLE_REMOTE
+ .use_ar = 1,
+#else
+ .use_ar = 0,
+#endif
+ .default_bindings = 1,
+ }
+ };
+}
+
+void set_default_mencoder_options(struct MPOpts *opts)
+{
+ set_default_mplayer_options(opts);
+ opts->user_correct_pts = 0;
+}
diff --git a/defaultopts.h b/defaultopts.h
new file mode 100644
index 0000000000..15067204a7
--- /dev/null
+++ b/defaultopts.h
@@ -0,0 +1,3 @@
+struct MPOpts;
+void set_default_mplayer_options(struct MPOpts *opts);
+void set_default_mencoder_options(struct MPOpts *opts);
diff --git a/drivers/radeon_vid.c b/drivers/radeon_vid.c
index 222f03b375..9367d4b36a 100644
--- a/drivers/radeon_vid.c
+++ b/drivers/radeon_vid.c
@@ -1547,4 +1547,3 @@ void __exit cleanup_module(void)
radeon_ram_size*0x100000);
#endif /* CONFIG_MTRR */
}
-
diff --git a/edl.c b/edl.c
index 6711c1f2e5..f20ee3d049 100644
--- a/edl.c
+++ b/edl.c
@@ -37,7 +37,7 @@ static edl_record_ptr edl_alloc_new(edl_record_ptr next_edl_record)
{
edl_record_ptr new_record = calloc(1, sizeof(struct edl_record));
if (!new_record) {
- mp_msg(MSGT_CPLAYER, MSGL_FATAL, MSGTR_EdlOutOfMem);
+ mp_tmsg(MSGT_CPLAYER, MSGL_FATAL, "Can't allocate enough memory to hold EDL data.\n");
exit(1);
}
@@ -96,24 +96,26 @@ edl_record_ptr edl_parse_file(void)
if ((sscanf(line, "%f %f %d", &start, &stop, &action))
!= 3)
{
- mp_msg(MSGT_CPLAYER, MSGL_WARN, MSGTR_EdlBadlyFormattedLine,
+ mp_tmsg(MSGT_CPLAYER, MSGL_WARN, "Badly formatted EDL line [%d], discarding.\n",
lineCount);
continue;
}
if (next_edl_record && start <= next_edl_record->stop_sec)
{
- mp_msg(MSGT_CPLAYER, MSGL_WARN, MSGTR_EdlNOValidLine, line);
- mp_msg(MSGT_CPLAYER, MSGL_WARN, MSGTR_EdlBadLineOverlap,
+ mp_tmsg(MSGT_CPLAYER, MSGL_WARN, "Invalid EDL line: %s\n", line);
+ mp_tmsg(MSGT_CPLAYER, MSGL_WARN,
+ "Last stop position was [%f]; next start is [%f].\n"\
+ "Entries must be in chronological order, cannot overlap. Discarding.\n",
next_edl_record->stop_sec, start);
continue;
}
if (stop <= start)
{
- mp_msg(MSGT_CPLAYER, MSGL_WARN, MSGTR_EdlNOValidLine,
+ mp_tmsg(MSGT_CPLAYER, MSGL_WARN, "Invalid EDL line: %s\n",
line);
- mp_msg(MSGT_CPLAYER, MSGL_WARN, MSGTR_EdlBadLineBadStop);
+ mp_tmsg(MSGT_CPLAYER, MSGL_WARN, "Stop time has to be after start time.\n");
continue;
}
@@ -149,9 +151,9 @@ edl_record_ptr edl_parse_file(void)
}
if (edl_records)
- mp_msg(MSGT_CPLAYER, MSGL_INFO, MSGTR_EdlRecordsNo, record_count);
+ mp_tmsg(MSGT_CPLAYER, MSGL_INFO, "Read %d EDL actions.\n", record_count);
else
- mp_msg(MSGT_CPLAYER, MSGL_INFO, MSGTR_EdlQueueEmpty);
+ mp_tmsg(MSGT_CPLAYER, MSGL_INFO, "There are no EDL actions to take care of.\n");
return edl_records;
}
diff --git a/etc/codecs.conf b/etc/codecs.conf
index d018d2d0a2..fffb1e0c2f 100644
--- a/etc/codecs.conf
+++ b/etc/codecs.conf
@@ -102,37 +102,6 @@ videocodec blackmagic
out BGR32,RGB32
; MPEG-1/2 decoding:
-; Note: mpegpes is preferred for hw decoders:
-
-videocodec mpegpes
- info "MPEG-PES output (.mpg or DXR3/IVTV/DVB/V4L2 card)"
- comment "for hardware decoding"
- status working
- format 0x10000001 ; mpeg 1
- format 0x10000002 ; mpeg 2
- fourcc mpg1,MPG1,mpg2,MPG2
- fourcc MPEG
- fourcc hdv1,hdv2,hdv3
- fourcc hdv5
- fourcc hdv6,hdv7,hdv8
- fourcc xdv1,xdv2,xdv3
- fourcc xdv4,xdv5,xdv6
- fourcc xdv7,xdv8,xdv9
- fourcc xdva,xdvb,xdvc
- fourcc xdvd,xdve,xdvf
- fourcc xd5a,xd5b,xd5c
- fourcc xd5d,xd5e,xd5f
- fourcc xd59
- fourcc mx5n,mx4n,mx4p
- fourcc mx3n,mx3p
- fourcc AVmp
- fourcc mp2v,mpgv
- fourcc m2v1,m1v1
- fourcc PIM1 ; Pinnacle hardware-MPEG-1
- fourcc PIM2 ; Pinnacle hardware-MPEG-2
- fourcc LMP2 ; Lead mpeg2 in avi
- driver mpegpes
- out MPES
videocodec ffmpeg1
info "FFmpeg MPEG-1"
@@ -333,6 +302,36 @@ videocodec ffmpeg12vdpau
out VDPAU_MPEG1
out VDPAU_MPEG2
+videocodec mpegpes
+ info "MPEG-PES output (.mpg or DXR3/IVTV/DVB/V4L2 card)"
+ comment "for hardware decoding"
+ status working
+ format 0x10000001 ; mpeg 1
+ format 0x10000002 ; mpeg 2
+ fourcc mpg1,MPG1,mpg2,MPG2
+ fourcc MPEG
+ fourcc hdv1,hdv2,hdv3
+ fourcc hdv5
+ fourcc hdv6,hdv7,hdv8
+ fourcc xdv1,xdv2,xdv3
+ fourcc xdv4,xdv5,xdv6
+ fourcc xdv7,xdv8,xdv9
+ fourcc xdva,xdvb,xdvc
+ fourcc xdvd,xdve,xdvf
+ fourcc xd5a,xd5b,xd5c
+ fourcc xd5d,xd5e,xd5f
+ fourcc xd59
+ fourcc mx5n,mx4n,mx4p
+ fourcc mx3n,mx3p
+ fourcc AVmp
+ fourcc mp2v,mpgv
+ fourcc m2v1,m1v1
+ fourcc PIM1 ; Pinnacle hardware-MPEG-1
+ fourcc PIM2 ; Pinnacle hardware-MPEG-2
+ fourcc LMP2 ; Lead mpeg2 in avi
+ driver mpegpes
+ out MPES
+
; we have only native open source codecs for these:
videocodec ffnuv
@@ -2101,7 +2100,7 @@ videocodec ffvp6a
videocodec ffvp6f
info "FFmpeg VP6 Flash"
status working
- fourcc VP6F
+ fourcc VP6F,FLV4
driver ffmpeg
dll "vp6f"
out YV12
diff --git a/etc/input.conf b/etc/input.conf
index 8efa099002..3ed118018f 100644
--- a/etc/input.conf
+++ b/etc/input.conf
@@ -78,18 +78,6 @@ n tv_step_norm
b tv_step_chanlist
##
-## GUI
-##
-
-#l gui_loadfile
-#t gui_loadsubtitle
-#a gui_about
-#s gui_stop
-#p gui_playlist
-#r gui_preferences
-#c gui_skinbrowser
-
-##
## Joystick section
## WARNING: joystick support has to be explicitly enabled at
## compiletime with --enable-joystick
diff --git a/etc/menu.conf b/etc/menu.conf
index 8aa273bcb7..635a2f2a1c 100644
--- a/etc/menu.conf
+++ b/etc/menu.conf
@@ -149,5 +149,3 @@
<e name="Console" ok="set_menu console0"/>
<e name="Quit" ok="quit"/>
</cmdlist>
-
-
diff --git a/ffmpeg_files/arm/bswap.h b/ffmpeg_files/arm/bswap.h
new file mode 100644
index 0000000000..98147449b1
--- /dev/null
+++ b/ffmpeg_files/arm/bswap.h
@@ -0,0 +1,72 @@
+/*
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef MP_AVUTIL_ARM_BSWAP_H
+#define MP_AVUTIL_ARM_BSWAP_H
+
+#include <stdint.h>
+#include "config.h"
+#include "libavutil/common.h"
+
+#ifdef __ARMCC_VERSION
+
+#if HAVE_ARMV6
+#define bswap_16 bswap_16
+static av_always_inline av_const uint16_t bswap_16(uint16_t x)
+{
+ __asm { rev16 x, x }
+ return x;
+}
+
+#define bswap_32 bswap_32
+static av_always_inline av_const uint32_t bswap_32(uint32_t x)
+{
+ return __rev(x);
+}
+#endif /* HAVE_ARMV6 */
+
+#elif HAVE_INLINE_ASM
+
+#if HAVE_ARMV6
+#define bswap_16 bswap_16
+static av_always_inline av_const uint16_t bswap_16(uint16_t x)
+{
+ __asm__("rev16 %0, %0" : "+r"(x));
+ return x;
+}
+#endif
+
+#define bswap_32 bswap_32
+static av_always_inline av_const uint32_t bswap_32(uint32_t x)
+{
+#if HAVE_ARMV6
+ __asm__("rev %0, %0" : "+r"(x));
+#else
+ uint32_t t;
+ __asm__ ("eor %1, %0, %0, ror #16 \n\t"
+ "bic %1, %1, #0xFF0000 \n\t"
+ "mov %0, %0, ror #8 \n\t"
+ "eor %0, %0, %1, lsr #8 \n\t"
+ : "+r"(x), "=&r"(t));
+#endif /* HAVE_ARMV6 */
+ return x;
+}
+
+#endif /* __ARMCC_VERSION */
+
+#endif /* AVUTIL_ARM_BSWAP_H */
diff --git a/ffmpeg_files/arm/intreadwrite.h b/ffmpeg_files/arm/intreadwrite.h
new file mode 100644
index 0000000000..34b5ec8e4a
--- /dev/null
+++ b/ffmpeg_files/arm/intreadwrite.h
@@ -0,0 +1,78 @@
+/*
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef MP_AVUTIL_ARM_INTREADWRITE_H
+#define MP_AVUTIL_ARM_INTREADWRITE_H
+
+#include <stdint.h>
+#include "config.h"
+
+#if HAVE_FAST_UNALIGNED && HAVE_INLINE_ASM
+
+#define AV_RN16 AV_RN16
+static inline uint16_t AV_RN16(const void *p)
+{
+ uint16_t v;
+ __asm__ ("ldrh %0, %1" : "=r"(v) : "m"(*(const uint16_t *)p));
+ return v;
+}
+
+#define AV_WN16 AV_WN16
+static inline void AV_WN16(void *p, uint16_t v)
+{
+ __asm__ ("strh %1, %0" : "=m"(*(uint16_t *)p) : "r"(v));
+}
+
+#define AV_RN32 AV_RN32
+static inline uint32_t AV_RN32(const void *p)
+{
+ uint32_t v;
+ __asm__ ("ldr %0, %1" : "=r"(v) : "m"(*(const uint32_t *)p));
+ return v;
+}
+
+#define AV_WN32 AV_WN32
+static inline void AV_WN32(void *p, uint32_t v)
+{
+ __asm__ ("str %1, %0" : "=m"(*(uint32_t *)p) : "r"(v));
+}
+
+#define AV_RN64 AV_RN64
+static inline uint64_t AV_RN64(const void *p)
+{
+ union { uint64_t v; uint32_t hl[2]; } v;
+ __asm__ ("ldr %0, %2 \n\t"
+ "ldr %1, %3 \n\t"
+ : "=r"(v.hl[0]), "=r"(v.hl[1])
+ : "m"(*(const uint32_t*)p), "m"(*((const uint32_t*)p+1)));
+ return v.v;
+}
+
+#define AV_WN64 AV_WN64
+static inline void AV_WN64(void *p, uint64_t v)
+{
+ union { uint64_t v; uint32_t hl[2]; } vv = { v };
+ __asm__ ("str %2, %0 \n\t"
+ "str %3, %1 \n\t"
+ : "=m"(*(uint32_t*)p), "=m"(*((uint32_t*)p+1))
+ : "r"(vv.hl[0]), "r"(vv.hl[1]));
+}
+
+#endif /* HAVE_INLINE_ASM */
+
+#endif /* AVUTIL_ARM_INTREADWRITE_H */
diff --git a/ffmpeg_files/bfin/bswap.h b/ffmpeg_files/bfin/bswap.h
new file mode 100644
index 0000000000..0f7e5a26eb
--- /dev/null
+++ b/ffmpeg_files/bfin/bswap.h
@@ -0,0 +1,45 @@
+/*
+ * Copyright (C) 2007 Marc Hoffman
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+/**
+ * @file libavutil/bfin/bswap.h
+ * byte swapping routines
+ */
+
+#ifndef MP_AVUTIL_BFIN_BSWAP_H
+#define MP_AVUTIL_BFIN_BSWAP_H
+
+#include <stdint.h>
+#include "config.h"
+#include "libavutil/common.h"
+
+#define bswap_32 bswap_32
+static av_always_inline av_const uint32_t bswap_32(uint32_t x)
+{
+ unsigned tmp;
+ __asm__("%1 = %0 >> 8 (V); \n\t"
+ "%0 = %0 << 8 (V); \n\t"
+ "%0 = %0 | %1; \n\t"
+ "%0 = PACK(%0.L, %0.H); \n\t"
+ : "+d"(x), "=&d"(tmp));
+ return x;
+}
+
+#endif /* AVUTIL_BFIN_BSWAP_H */
diff --git a/ffmpeg_files/bswap.h b/ffmpeg_files/bswap.h
new file mode 100644
index 0000000000..3bfa6aa631
--- /dev/null
+++ b/ffmpeg_files/bswap.h
@@ -0,0 +1,103 @@
+/*
+ * copyright (c) 2006 Michael Niedermayer <michaelni@gmx.at>
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+
+// This file in MPlayer is otherwise the same as in FFmpeg, except it
+// includes "libavutil/common.h" instead of "common.h".
+
+/**
+ * @file libavutil/bswap.h
+ * byte swapping routines
+ */
+
+#ifndef MP_AVUTIL_BSWAP_H
+#define MP_AVUTIL_BSWAP_H
+
+#include <stdint.h>
+#include "libavutil/common.h"
+#include "config.h"
+
+#if ARCH_ARM
+# include "arm/bswap.h"
+#elif ARCH_BFIN
+# include "bfin/bswap.h"
+#elif ARCH_SH4
+# include "sh4/bswap.h"
+#elif ARCH_X86
+# include "x86/bswap.h"
+#endif
+
+#ifndef bswap_16
+static av_always_inline av_const uint16_t bswap_16(uint16_t x)
+{
+ x= (x>>8) | (x<<8);
+ return x;
+}
+#endif
+
+#ifndef bswap_32
+static av_always_inline av_const uint32_t bswap_32(uint32_t x)
+{
+ x= ((x<<8)&0xFF00FF00) | ((x>>8)&0x00FF00FF);
+ x= (x>>16) | (x<<16);
+ return x;
+}
+#endif
+
+#ifndef bswap_64
+static inline uint64_t av_const bswap_64(uint64_t x)
+{
+#if 0
+ x= ((x<< 8)&0xFF00FF00FF00FF00ULL) | ((x>> 8)&0x00FF00FF00FF00FFULL);
+ x= ((x<<16)&0xFFFF0000FFFF0000ULL) | ((x>>16)&0x0000FFFF0000FFFFULL);
+ return (x>>32) | (x<<32);
+#else
+ union {
+ uint64_t ll;
+ uint32_t l[2];
+ } w, r;
+ w.ll = x;
+ r.l[0] = bswap_32 (w.l[1]);
+ r.l[1] = bswap_32 (w.l[0]);
+ return r.ll;
+#endif
+}
+#endif
+
+// be2me ... big-endian to machine-endian
+// le2me ... little-endian to machine-endian
+
+#ifdef WORDS_BIGENDIAN
+#define be2me_16(x) (x)
+#define be2me_32(x) (x)
+#define be2me_64(x) (x)
+#define le2me_16(x) bswap_16(x)
+#define le2me_32(x) bswap_32(x)
+#define le2me_64(x) bswap_64(x)
+#else
+#define be2me_16(x) bswap_16(x)
+#define be2me_32(x) bswap_32(x)
+#define be2me_64(x) bswap_64(x)
+#define le2me_16(x) (x)
+#define le2me_32(x) (x)
+#define le2me_64(x) (x)
+#endif
+
+#endif /* AVUTIL_BSWAP_H */
diff --git a/ffmpeg_files/intreadwrite.h b/ffmpeg_files/intreadwrite.h
new file mode 100644
index 0000000000..bc61ccceb7
--- /dev/null
+++ b/ffmpeg_files/intreadwrite.h
@@ -0,0 +1,268 @@
+/*
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef MP_AVUTIL_INTREADWRITE_H
+#define MP_AVUTIL_INTREADWRITE_H
+
+#include <stdint.h>
+#include "config.h"
+#include "bswap.h"
+
+/*
+ * Arch-specific headers can provide any combination of
+ * AV_[RW][BLN](16|32|64) macros. Preprocessor symbols must be
+ * defined, even if these are implemented as inline functions.
+ */
+
+#if ARCH_ARM
+# include "arm/intreadwrite.h"
+#elif ARCH_MIPS
+# include "mips/intreadwrite.h"
+#elif ARCH_PPC
+# include "ppc/intreadwrite.h"
+#endif
+
+/*
+ * Define AV_[RW]N helper macros to simplify definitions not provided
+ * by per-arch headers.
+ */
+
+#if defined(__GNUC__)
+
+struct unaligned_64 { uint64_t l; } __attribute__((packed));
+struct unaligned_32 { uint32_t l; } __attribute__((packed));
+struct unaligned_16 { uint16_t l; } __attribute__((packed));
+
+# define AV_RN(s, p) (((const struct unaligned_##s *) (p))->l)
+# define AV_WN(s, p, v) (((struct unaligned_##s *) (p))->l) = (v)
+
+#elif defined(__DECC)
+
+# define AV_RN(s, p) (*((const __unaligned uint##s##_t*)(p)))
+# define AV_WN(s, p, v) *((__unaligned uint##s##_t*)(p)) = (v)
+
+#elif HAVE_FAST_UNALIGNED
+
+# define AV_RN(s, p) (*((const uint##s##_t*)(p)))
+# define AV_WN(s, p, v) *((uint##s##_t*)(p)) = (v)
+
+#else
+
+#ifndef AV_RB16
+#define AV_RB16(x) ((((const uint8_t*)(x))[0] << 8) | \
+ ((const uint8_t*)(x))[1])
+#endif
+#ifndef AV_WB16
+#define AV_WB16(p, d) do { \
+ ((uint8_t*)(p))[1] = (d); \
+ ((uint8_t*)(p))[0] = (d)>>8; } while(0)
+#endif
+
+#ifndef AV_RL16
+#define AV_RL16(x) ((((const uint8_t*)(x))[1] << 8) | \
+ ((const uint8_t*)(x))[0])
+#endif
+#ifndef AV_WL16
+#define AV_WL16(p, d) do { \
+ ((uint8_t*)(p))[0] = (d); \
+ ((uint8_t*)(p))[1] = (d)>>8; } while(0)
+#endif
+
+#ifndef AV_RB32
+#define AV_RB32(x) ((((const uint8_t*)(x))[0] << 24) | \
+ (((const uint8_t*)(x))[1] << 16) | \
+ (((const uint8_t*)(x))[2] << 8) | \
+ ((const uint8_t*)(x))[3])
+#endif
+#ifndef AV_WB32
+#define AV_WB32(p, d) do { \
+ ((uint8_t*)(p))[3] = (d); \
+ ((uint8_t*)(p))[2] = (d)>>8; \
+ ((uint8_t*)(p))[1] = (d)>>16; \
+ ((uint8_t*)(p))[0] = (d)>>24; } while(0)
+#endif
+
+#ifndef AV_RL32
+#define AV_RL32(x) ((((const uint8_t*)(x))[3] << 24) | \
+ (((const uint8_t*)(x))[2] << 16) | \
+ (((const uint8_t*)(x))[1] << 8) | \
+ ((const uint8_t*)(x))[0])
+#endif
+#ifndef AV_WL32
+#define AV_WL32(p, d) do { \
+ ((uint8_t*)(p))[0] = (d); \
+ ((uint8_t*)(p))[1] = (d)>>8; \
+ ((uint8_t*)(p))[2] = (d)>>16; \
+ ((uint8_t*)(p))[3] = (d)>>24; } while(0)
+#endif
+
+#ifndef AV_RB64
+#define AV_RB64(x) (((uint64_t)((const uint8_t*)(x))[0] << 56) | \
+ ((uint64_t)((const uint8_t*)(x))[1] << 48) | \
+ ((uint64_t)((const uint8_t*)(x))[2] << 40) | \
+ ((uint64_t)((const uint8_t*)(x))[3] << 32) | \
+ ((uint64_t)((const uint8_t*)(x))[4] << 24) | \
+ ((uint64_t)((const uint8_t*)(x))[5] << 16) | \
+ ((uint64_t)((const uint8_t*)(x))[6] << 8) | \
+ (uint64_t)((const uint8_t*)(x))[7])
+#endif
+#ifndef AV_WB64
+#define AV_WB64(p, d) do { \
+ ((uint8_t*)(p))[7] = (d); \
+ ((uint8_t*)(p))[6] = (d)>>8; \
+ ((uint8_t*)(p))[5] = (d)>>16; \
+ ((uint8_t*)(p))[4] = (d)>>24; \
+ ((uint8_t*)(p))[3] = (d)>>32; \
+ ((uint8_t*)(p))[2] = (d)>>40; \
+ ((uint8_t*)(p))[1] = (d)>>48; \
+ ((uint8_t*)(p))[0] = (d)>>56; } while(0)
+#endif
+
+#ifndef AV_RL64
+#define AV_RL64(x) (((uint64_t)((const uint8_t*)(x))[7] << 56) | \
+ ((uint64_t)((const uint8_t*)(x))[6] << 48) | \
+ ((uint64_t)((const uint8_t*)(x))[5] << 40) | \
+ ((uint64_t)((const uint8_t*)(x))[4] << 32) | \
+ ((uint64_t)((const uint8_t*)(x))[3] << 24) | \
+ ((uint64_t)((const uint8_t*)(x))[2] << 16) | \
+ ((uint64_t)((const uint8_t*)(x))[1] << 8) | \
+ (uint64_t)((const uint8_t*)(x))[0])
+#endif
+#ifndef AV_WL64
+#define AV_WL64(p, d) do { \
+ ((uint8_t*)(p))[0] = (d); \
+ ((uint8_t*)(p))[1] = (d)>>8; \
+ ((uint8_t*)(p))[2] = (d)>>16; \
+ ((uint8_t*)(p))[3] = (d)>>24; \
+ ((uint8_t*)(p))[4] = (d)>>32; \
+ ((uint8_t*)(p))[5] = (d)>>40; \
+ ((uint8_t*)(p))[6] = (d)>>48; \
+ ((uint8_t*)(p))[7] = (d)>>56; } while(0)
+#endif
+
+#ifdef WORDS_BIGENDIAN
+# define AV_RN(s, p) AV_RB##s(p)
+# define AV_WN(s, p, v) AV_WB##s(p, v)
+#else
+# define AV_RN(s, p) AV_RL##s(p)
+# define AV_WN(s, p, v) AV_WL##s(p, v)
+#endif
+
+#endif /* HAVE_FAST_UNALIGNED */
+
+#ifndef AV_RN16
+# define AV_RN16(p) AV_RN(16, p)
+#endif
+
+#ifndef AV_RN32
+# define AV_RN32(p) AV_RN(32, p)
+#endif
+
+#ifndef AV_RN64
+# define AV_RN64(p) AV_RN(64, p)
+#endif
+
+#ifndef AV_WN16
+# define AV_WN16(p, v) AV_WN(16, p, v)
+#endif
+
+#ifndef AV_WN32
+# define AV_WN32(p, v) AV_WN(32, p, v)
+#endif
+
+#ifndef AV_WN64
+# define AV_WN64(p, v) AV_WN(64, p, v)
+#endif
+
+#ifdef WORDS_BIGENDIAN
+# define AV_RB(s, p) AV_RN(s, p)
+# define AV_WB(s, p, v) AV_WN(s, p, v)
+# define AV_RL(s, p) bswap_##s(AV_RN(s, p))
+# define AV_WL(s, p, v) AV_WN(s, p, bswap_##s(v))
+#else
+# define AV_RB(s, p) bswap_##s(AV_RN(s, p))
+# define AV_WB(s, p, v) AV_WN(s, p, bswap_##s(v))
+# define AV_RL(s, p) AV_RN(s, p)
+# define AV_WL(s, p, v) AV_WN(s, p, v)
+#endif
+
+#define AV_RB8(x) (((const uint8_t*)(x))[0])
+#define AV_WB8(p, d) do { ((uint8_t*)(p))[0] = (d); } while(0)
+
+#define AV_RL8(x) AV_RB8(x)
+#define AV_WL8(p, d) AV_WB8(p, d)
+
+#ifndef AV_RB16
+# define AV_RB16(p) AV_RB(16, p)
+#endif
+#ifndef AV_WB16
+# define AV_WB16(p, v) AV_WB(16, p, v)
+#endif
+
+#ifndef AV_RL16
+# define AV_RL16(p) AV_RL(16, p)
+#endif
+#ifndef AV_WL16
+# define AV_WL16(p, v) AV_WL(16, p, v)
+#endif
+
+#ifndef AV_RB32
+# define AV_RB32(p) AV_RB(32, p)
+#endif
+#ifndef AV_WB32
+# define AV_WB32(p, v) AV_WB(32, p, v)
+#endif
+
+#ifndef AV_RL32
+# define AV_RL32(p) AV_RL(32, p)
+#endif
+#ifndef AV_WL32
+# define AV_WL32(p, v) AV_WL(32, p, v)
+#endif
+
+#ifndef AV_RB64
+# define AV_RB64(p) AV_RB(64, p)
+#endif
+#ifndef AV_WB64
+# define AV_WB64(p, v) AV_WB(64, p, v)
+#endif
+
+#ifndef AV_RL64
+# define AV_RL64(p) AV_RL(64, p)
+#endif
+#ifndef AV_WL64
+# define AV_WL64(p, v) AV_WL(64, p, v)
+#endif
+
+#define AV_RB24(x) ((((const uint8_t*)(x))[0] << 16) | \
+ (((const uint8_t*)(x))[1] << 8) | \
+ ((const uint8_t*)(x))[2])
+#define AV_WB24(p, d) do { \
+ ((uint8_t*)(p))[2] = (d); \
+ ((uint8_t*)(p))[1] = (d)>>8; \
+ ((uint8_t*)(p))[0] = (d)>>16; } while(0)
+
+#define AV_RL24(x) ((((const uint8_t*)(x))[2] << 16) | \
+ (((const uint8_t*)(x))[1] << 8) | \
+ ((const uint8_t*)(x))[0])
+#define AV_WL24(p, d) do { \
+ ((uint8_t*)(p))[0] = (d); \
+ ((uint8_t*)(p))[1] = (d)>>8; \
+ ((uint8_t*)(p))[2] = (d)>>16; } while(0)
+
+#endif /* AVUTIL_INTREADWRITE_H */
diff --git a/ffmpeg_files/sh4/bswap.h b/ffmpeg_files/sh4/bswap.h
new file mode 100644
index 0000000000..47b91397ea
--- /dev/null
+++ b/ffmpeg_files/sh4/bswap.h
@@ -0,0 +1,48 @@
+/*
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+/**
+ * @file libavutil/sh4/bswap.h
+ * byte swapping routines
+ */
+
+#ifndef MP_AVUTIL_SH4_BSWAP_H
+#define MP_AVUTIL_SH4_BSWAP_H
+
+#include <stdint.h>
+#include "config.h"
+#include "libavutil/common.h"
+
+#define bswap_16 bswap_16
+static av_always_inline av_const uint16_t bswap_16(uint16_t x)
+{
+ __asm__("swap.b %0,%0" : "+r"(x));
+ return x;
+}
+
+#define bswap_32 bswap_32
+static av_always_inline av_const uint32_t bswap_32(uint32_t x)
+{
+ __asm__("swap.b %0,%0\n"
+ "swap.w %0,%0\n"
+ "swap.b %0,%0\n"
+ : "+r"(x));
+ return x;
+}
+
+#endif /* AVUTIL_SH4_BSWAP_H */
diff --git a/ffmpeg_files/taglists.c b/ffmpeg_files/taglists.c
new file mode 100644
index 0000000000..ad2e78c557
--- /dev/null
+++ b/ffmpeg_files/taglists.c
@@ -0,0 +1,339 @@
+/*
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+
+/* This file contains:
+ * - the tables ff_codec_bmp_tags and ff_codec_wav_tags from FFmpeg's
+ * libavformat/riff.c, renamed to have an extra mp_ prefix
+ * - an implementation of av_codec_get_tag and av_codec_get_id from
+ * libavformat/utils.c, renamed to have an extra mp_ prefix
+ */
+
+
+const struct mp_AVCodecTag mp_ff_codec_bmp_tags[] = {
+ { CODEC_ID_H264, MKTAG('H', '2', '6', '4') },
+ { CODEC_ID_H264, MKTAG('h', '2', '6', '4') },
+ { CODEC_ID_H264, MKTAG('X', '2', '6', '4') },
+ { CODEC_ID_H264, MKTAG('x', '2', '6', '4') },
+ { CODEC_ID_H264, MKTAG('a', 'v', 'c', '1') },
+ { CODEC_ID_H264, MKTAG('V', 'S', 'S', 'H') },
+ { CODEC_ID_H263, MKTAG('H', '2', '6', '3') },
+ { CODEC_ID_H263, MKTAG('X', '2', '6', '3') },
+ { CODEC_ID_H263, MKTAG('T', '2', '6', '3') },
+ { CODEC_ID_H263, MKTAG('L', '2', '6', '3') },
+ { CODEC_ID_H263, MKTAG('V', 'X', '1', 'K') },
+ { CODEC_ID_H263, MKTAG('Z', 'y', 'G', 'o') },
+ { CODEC_ID_H263P, MKTAG('H', '2', '6', '3') },
+ { CODEC_ID_H263I, MKTAG('I', '2', '6', '3') }, /* intel h263 */
+ { CODEC_ID_H261, MKTAG('H', '2', '6', '1') },
+ { CODEC_ID_H263P, MKTAG('U', '2', '6', '3') },
+ { CODEC_ID_H263P, MKTAG('v', 'i', 'v', '1') },
+ { CODEC_ID_MPEG4, MKTAG('F', 'M', 'P', '4') },
+ { CODEC_ID_MPEG4, MKTAG('D', 'I', 'V', 'X') },
+ { CODEC_ID_MPEG4, MKTAG('D', 'X', '5', '0') },
+ { CODEC_ID_MPEG4, MKTAG('X', 'V', 'I', 'D') },
+ { CODEC_ID_MPEG4, MKTAG('M', 'P', '4', 'S') },
+ { CODEC_ID_MPEG4, MKTAG('M', '4', 'S', '2') },
+ { CODEC_ID_MPEG4, MKTAG( 4 , 0 , 0 , 0 ) }, /* some broken avi use this */
+ { CODEC_ID_MPEG4, MKTAG('D', 'I', 'V', '1') },
+ { CODEC_ID_MPEG4, MKTAG('B', 'L', 'Z', '0') },
+ { CODEC_ID_MPEG4, MKTAG('m', 'p', '4', 'v') },
+ { CODEC_ID_MPEG4, MKTAG('U', 'M', 'P', '4') },
+ { CODEC_ID_MPEG4, MKTAG('W', 'V', '1', 'F') },
+ { CODEC_ID_MPEG4, MKTAG('S', 'E', 'D', 'G') },
+ { CODEC_ID_MPEG4, MKTAG('R', 'M', 'P', '4') },
+ { CODEC_ID_MPEG4, MKTAG('3', 'I', 'V', '2') },
+ { CODEC_ID_MPEG4, MKTAG('F', 'F', 'D', 'S') },
+ { CODEC_ID_MPEG4, MKTAG('F', 'V', 'F', 'W') },
+ { CODEC_ID_MPEG4, MKTAG('D', 'C', 'O', 'D') },
+ { CODEC_ID_MPEG4, MKTAG('M', 'V', 'X', 'M') },
+ { CODEC_ID_MPEG4, MKTAG('P', 'M', '4', 'V') },
+ { CODEC_ID_MPEG4, MKTAG('S', 'M', 'P', '4') },
+ { CODEC_ID_MPEG4, MKTAG('D', 'X', 'G', 'M') },
+ { CODEC_ID_MPEG4, MKTAG('V', 'I', 'D', 'M') },
+ { CODEC_ID_MPEG4, MKTAG('M', '4', 'T', '3') },
+ { CODEC_ID_MPEG4, MKTAG('G', 'E', 'O', 'X') },
+ { CODEC_ID_MPEG4, MKTAG('H', 'D', 'X', '4') }, /* flipped video */
+ { CODEC_ID_MPEG4, MKTAG('D', 'M', 'K', '2') },
+ { CODEC_ID_MPEG4, MKTAG('D', 'I', 'G', 'I') },
+ { CODEC_ID_MPEG4, MKTAG('I', 'N', 'M', 'C') },
+ { CODEC_ID_MPEG4, MKTAG('E', 'P', 'H', 'V') }, /* Ephv MPEG-4 */
+ { CODEC_ID_MPEG4, MKTAG('E', 'M', '4', 'A') },
+ { CODEC_ID_MPEG4, MKTAG('M', '4', 'C', 'C') }, /* Divio MPEG-4 */
+ { CODEC_ID_MPEG4, MKTAG('S', 'N', '4', '0') },
+ { CODEC_ID_MSMPEG4V3, MKTAG('D', 'I', 'V', '3') }, /* default signature when using MSMPEG4 */
+ { CODEC_ID_MSMPEG4V3, MKTAG('M', 'P', '4', '3') },
+ { CODEC_ID_MSMPEG4V3, MKTAG('M', 'P', 'G', '3') },
+ { CODEC_ID_MSMPEG4V3, MKTAG('D', 'I', 'V', '5') },
+ { CODEC_ID_MSMPEG4V3, MKTAG('D', 'I', 'V', '6') },
+ { CODEC_ID_MSMPEG4V3, MKTAG('D', 'I', 'V', '4') },
+ { CODEC_ID_MSMPEG4V3, MKTAG('D', 'V', 'X', '3') },
+ { CODEC_ID_MSMPEG4V3, MKTAG('A', 'P', '4', '1') },
+ { CODEC_ID_MSMPEG4V3, MKTAG('C', 'O', 'L', '1') },
+ { CODEC_ID_MSMPEG4V3, MKTAG('C', 'O', 'L', '0') },
+ { CODEC_ID_MSMPEG4V2, MKTAG('M', 'P', '4', '2') },
+ { CODEC_ID_MSMPEG4V2, MKTAG('D', 'I', 'V', '2') },
+ { CODEC_ID_MSMPEG4V1, MKTAG('M', 'P', 'G', '4') },
+ { CODEC_ID_MSMPEG4V1, MKTAG('M', 'P', '4', '1') },
+ { CODEC_ID_WMV1, MKTAG('W', 'M', 'V', '1') },
+ { CODEC_ID_WMV2, MKTAG('W', 'M', 'V', '2') },
+ { CODEC_ID_DVVIDEO, MKTAG('d', 'v', 's', 'd') },
+ { CODEC_ID_DVVIDEO, MKTAG('d', 'v', 'h', 'd') },
+ { CODEC_ID_DVVIDEO, MKTAG('d', 'v', 'h', '1') },
+ { CODEC_ID_DVVIDEO, MKTAG('d', 'v', 's', 'l') },
+ { CODEC_ID_DVVIDEO, MKTAG('d', 'v', '2', '5') },
+ { CODEC_ID_DVVIDEO, MKTAG('d', 'v', '5', '0') },
+ { CODEC_ID_DVVIDEO, MKTAG('c', 'd', 'v', 'c') }, /* Canopus DV */
+ { CODEC_ID_DVVIDEO, MKTAG('C', 'D', 'V', 'H') }, /* Canopus DV */
+ { CODEC_ID_DVVIDEO, MKTAG('d', 'v', 'c', ' ') },
+ { CODEC_ID_DVVIDEO, MKTAG('d', 'v', 'c', 's') },
+ { CODEC_ID_DVVIDEO, MKTAG('d', 'v', 'h', '1') },
+ { CODEC_ID_MPEG1VIDEO, MKTAG('m', 'p', 'g', '1') },
+ { CODEC_ID_MPEG1VIDEO, MKTAG('m', 'p', 'g', '2') },
+ { CODEC_ID_MPEG2VIDEO, MKTAG('m', 'p', 'g', '2') },
+ { CODEC_ID_MPEG2VIDEO, MKTAG('M', 'P', 'E', 'G') },
+ { CODEC_ID_MPEG1VIDEO, MKTAG('P', 'I', 'M', '1') },
+ { CODEC_ID_MPEG2VIDEO, MKTAG('P', 'I', 'M', '2') },
+ { CODEC_ID_MPEG1VIDEO, MKTAG('V', 'C', 'R', '2') },
+ { CODEC_ID_MPEG1VIDEO, MKTAG( 1 , 0 , 0 , 16) },
+ { CODEC_ID_MPEG2VIDEO, MKTAG( 2 , 0 , 0 , 16) },
+ { CODEC_ID_MPEG4, MKTAG( 4 , 0 , 0 , 16) },
+ { CODEC_ID_MPEG2VIDEO, MKTAG('D', 'V', 'R', ' ') },
+ { CODEC_ID_MPEG2VIDEO, MKTAG('M', 'M', 'E', 'S') },
+ { CODEC_ID_MPEG2VIDEO, MKTAG('L', 'M', 'P', '2') }, /* Lead MPEG2 in avi */
+ { CODEC_ID_MPEG2VIDEO, MKTAG('s', 'l', 'i', 'f') },
+ { CODEC_ID_MPEG2VIDEO, MKTAG('E', 'M', '2', 'V') },
+ { CODEC_ID_MJPEG, MKTAG('M', 'J', 'P', 'G') },
+ { CODEC_ID_MJPEG, MKTAG('L', 'J', 'P', 'G') },
+ { CODEC_ID_MJPEG, MKTAG('d', 'm', 'b', '1') },
+ { CODEC_ID_MJPEG, MKTAG('m', 'j', 'p', 'a') },
+ { CODEC_ID_LJPEG, MKTAG('L', 'J', 'P', 'G') },
+ { CODEC_ID_MJPEG, MKTAG('J', 'P', 'G', 'L') }, /* Pegasus lossless JPEG */
+ { CODEC_ID_JPEGLS, MKTAG('M', 'J', 'L', 'S') }, /* JPEG-LS custom FOURCC for avi - encoder */
+ { CODEC_ID_MJPEG, MKTAG('M', 'J', 'L', 'S') }, /* JPEG-LS custom FOURCC for avi - decoder */
+ { CODEC_ID_MJPEG, MKTAG('j', 'p', 'e', 'g') },
+ { CODEC_ID_MJPEG, MKTAG('I', 'J', 'P', 'G') },
+ { CODEC_ID_MJPEG, MKTAG('A', 'V', 'R', 'n') },
+ { CODEC_ID_MJPEG, MKTAG('A', 'C', 'D', 'V') },
+ { CODEC_ID_MJPEG, MKTAG('Q', 'I', 'V', 'G') },
+ { CODEC_ID_MJPEG, MKTAG('S', 'L', 'M', 'J') }, /* SL M-JPEG */
+ { CODEC_ID_MJPEG, MKTAG('C', 'J', 'P', 'G') }, /* Creative Webcam JPEG */
+ { CODEC_ID_MJPEG, MKTAG('I', 'J', 'L', 'V') }, /* Intel JPEG Library Video Codec */
+ { CODEC_ID_MJPEG, MKTAG('M', 'V', 'J', 'P') }, /* Midvid JPEG Video Codec */
+ { CODEC_ID_MJPEG, MKTAG('A', 'V', 'I', '1') },
+ { CODEC_ID_MJPEG, MKTAG('A', 'V', 'I', '2') },
+ { CODEC_ID_MJPEG, MKTAG('M', 'T', 'S', 'J') },
+ { CODEC_ID_MJPEG, MKTAG('Z', 'J', 'P', 'G') }, /* Paradigm Matrix M-JPEG Codec */
+ { CODEC_ID_HUFFYUV, MKTAG('H', 'F', 'Y', 'U') },
+ { CODEC_ID_FFVHUFF, MKTAG('F', 'F', 'V', 'H') },
+ { CODEC_ID_CYUV, MKTAG('C', 'Y', 'U', 'V') },
+ { CODEC_ID_RAWVIDEO, MKTAG( 0 , 0 , 0 , 0 ) },
+ { CODEC_ID_RAWVIDEO, MKTAG( 3 , 0 , 0 , 0 ) },
+ { CODEC_ID_RAWVIDEO, MKTAG('I', '4', '2', '0') },
+ { CODEC_ID_RAWVIDEO, MKTAG('Y', 'U', 'Y', '2') },
+ { CODEC_ID_RAWVIDEO, MKTAG('Y', '4', '2', '2') },
+ { CODEC_ID_RAWVIDEO, MKTAG('V', '4', '2', '2') },
+ { CODEC_ID_RAWVIDEO, MKTAG('Y', 'U', 'N', 'V') },
+ { CODEC_ID_RAWVIDEO, MKTAG('U', 'Y', 'N', 'V') },
+ { CODEC_ID_RAWVIDEO, MKTAG('U', 'Y', 'N', 'Y') },
+ { CODEC_ID_RAWVIDEO, MKTAG('u', 'y', 'v', '1') },
+ { CODEC_ID_RAWVIDEO, MKTAG('2', 'V', 'u', '1') },
+ { CODEC_ID_RAWVIDEO, MKTAG('2', 'v', 'u', 'y') },
+ { CODEC_ID_RAWVIDEO, MKTAG('P', '4', '2', '2') },
+ { CODEC_ID_RAWVIDEO, MKTAG('Y', 'V', '1', '2') },
+ { CODEC_ID_RAWVIDEO, MKTAG('U', 'Y', 'V', 'Y') },
+ { CODEC_ID_RAWVIDEO, MKTAG('V', 'Y', 'U', 'Y') },
+ { CODEC_ID_RAWVIDEO, MKTAG('I', 'Y', 'U', 'V') },
+ { CODEC_ID_RAWVIDEO, MKTAG('Y', '8', '0', '0') },
+ { CODEC_ID_RAWVIDEO, MKTAG('H', 'D', 'Y', 'C') },
+ { CODEC_ID_RAWVIDEO, MKTAG('Y', 'V', 'U', '9') },
+ { CODEC_ID_FRWU, MKTAG('F', 'R', 'W', 'U') },
+ { CODEC_ID_R210, MKTAG('r', '2', '1', '0') },
+ { CODEC_ID_V210, MKTAG('v', '2', '1', '0') },
+ { CODEC_ID_INDEO3, MKTAG('I', 'V', '3', '1') },
+ { CODEC_ID_INDEO3, MKTAG('I', 'V', '3', '2') },
+ { CODEC_ID_INDEO4, MKTAG('I', 'V', '4', '1') },
+ { CODEC_ID_INDEO5, MKTAG('I', 'V', '5', '0') },
+ { CODEC_ID_VP3, MKTAG('V', 'P', '3', '1') },
+ { CODEC_ID_VP3, MKTAG('V', 'P', '3', '0') },
+ { CODEC_ID_VP5, MKTAG('V', 'P', '5', '0') },
+ { CODEC_ID_VP6, MKTAG('V', 'P', '6', '0') },
+ { CODEC_ID_VP6, MKTAG('V', 'P', '6', '1') },
+ { CODEC_ID_VP6, MKTAG('V', 'P', '6', '2') },
+ { CODEC_ID_ASV1, MKTAG('A', 'S', 'V', '1') },
+ { CODEC_ID_ASV2, MKTAG('A', 'S', 'V', '2') },
+ { CODEC_ID_VCR1, MKTAG('V', 'C', 'R', '1') },
+ { CODEC_ID_FFV1, MKTAG('F', 'F', 'V', '1') },
+ { CODEC_ID_XAN_WC4, MKTAG('X', 'x', 'a', 'n') },
+ { CODEC_ID_MIMIC, MKTAG('L', 'M', '2', '0') },
+ { CODEC_ID_MSRLE, MKTAG('m', 'r', 'l', 'e') },
+ { CODEC_ID_MSRLE, MKTAG( 1 , 0 , 0 , 0 ) },
+ { CODEC_ID_MSRLE, MKTAG( 2 , 0 , 0 , 0 ) },
+ { CODEC_ID_MSVIDEO1, MKTAG('M', 'S', 'V', 'C') },
+ { CODEC_ID_MSVIDEO1, MKTAG('m', 's', 'v', 'c') },
+ { CODEC_ID_MSVIDEO1, MKTAG('C', 'R', 'A', 'M') },
+ { CODEC_ID_MSVIDEO1, MKTAG('c', 'r', 'a', 'm') },
+ { CODEC_ID_MSVIDEO1, MKTAG('W', 'H', 'A', 'M') },
+ { CODEC_ID_MSVIDEO1, MKTAG('w', 'h', 'a', 'm') },
+ { CODEC_ID_CINEPAK, MKTAG('c', 'v', 'i', 'd') },
+ { CODEC_ID_TRUEMOTION1, MKTAG('D', 'U', 'C', 'K') },
+ { CODEC_ID_TRUEMOTION1, MKTAG('P', 'V', 'E', 'Z') },
+ { CODEC_ID_MSZH, MKTAG('M', 'S', 'Z', 'H') },
+ { CODEC_ID_ZLIB, MKTAG('Z', 'L', 'I', 'B') },
+ { CODEC_ID_SNOW, MKTAG('S', 'N', 'O', 'W') },
+ { CODEC_ID_4XM, MKTAG('4', 'X', 'M', 'V') },
+ { CODEC_ID_FLV1, MKTAG('F', 'L', 'V', '1') },
+ { CODEC_ID_FLASHSV, MKTAG('F', 'S', 'V', '1') },
+ { CODEC_ID_VP6F, MKTAG('V', 'P', '6', 'F') },
+ { CODEC_ID_SVQ1, MKTAG('s', 'v', 'q', '1') },
+ { CODEC_ID_TSCC, MKTAG('t', 's', 'c', 'c') },
+ { CODEC_ID_ULTI, MKTAG('U', 'L', 'T', 'I') },
+ { CODEC_ID_VIXL, MKTAG('V', 'I', 'X', 'L') },
+ { CODEC_ID_QPEG, MKTAG('Q', 'P', 'E', 'G') },
+ { CODEC_ID_QPEG, MKTAG('Q', '1', '.', '0') },
+ { CODEC_ID_QPEG, MKTAG('Q', '1', '.', '1') },
+ { CODEC_ID_WMV3, MKTAG('W', 'M', 'V', '3') },
+ { CODEC_ID_VC1, MKTAG('W', 'V', 'C', '1') },
+ { CODEC_ID_VC1, MKTAG('W', 'M', 'V', 'A') },
+ { CODEC_ID_LOCO, MKTAG('L', 'O', 'C', 'O') },
+ { CODEC_ID_WNV1, MKTAG('W', 'N', 'V', '1') },
+ { CODEC_ID_AASC, MKTAG('A', 'A', 'S', 'C') },
+ { CODEC_ID_INDEO2, MKTAG('R', 'T', '2', '1') },
+ { CODEC_ID_FRAPS, MKTAG('F', 'P', 'S', '1') },
+ { CODEC_ID_THEORA, MKTAG('t', 'h', 'e', 'o') },
+ { CODEC_ID_TRUEMOTION2, MKTAG('T', 'M', '2', '0') },
+ { CODEC_ID_CSCD, MKTAG('C', 'S', 'C', 'D') },
+ { CODEC_ID_ZMBV, MKTAG('Z', 'M', 'B', 'V') },
+ { CODEC_ID_KMVC, MKTAG('K', 'M', 'V', 'C') },
+ { CODEC_ID_CAVS, MKTAG('C', 'A', 'V', 'S') },
+ { CODEC_ID_JPEG2000, MKTAG('M', 'J', '2', 'C') },
+ { CODEC_ID_VMNC, MKTAG('V', 'M', 'n', 'c') },
+ { CODEC_ID_TARGA, MKTAG('t', 'g', 'a', ' ') },
+ { CODEC_ID_PNG, MKTAG('M', 'P', 'N', 'G') },
+ { CODEC_ID_PNG, MKTAG('P', 'N', 'G', '1') },
+ { CODEC_ID_CLJR, MKTAG('c', 'l', 'j', 'r') },
+ { CODEC_ID_DIRAC, MKTAG('d', 'r', 'a', 'c') },
+ { CODEC_ID_RPZA, MKTAG('a', 'z', 'p', 'r') },
+ { CODEC_ID_RPZA, MKTAG('R', 'P', 'Z', 'A') },
+ { CODEC_ID_RPZA, MKTAG('r', 'p', 'z', 'a') },
+ { CODEC_ID_SP5X, MKTAG('S', 'P', '5', '4') },
+ { CODEC_ID_AURA, MKTAG('A', 'U', 'R', 'A') },
+ { CODEC_ID_AURA2, MKTAG('A', 'U', 'R', '2') },
+ { CODEC_ID_DPX, MKTAG('d', 'p', 'x', ' ') },
+ { CODEC_ID_NONE, 0 }
+};
+
+const struct mp_AVCodecTag mp_ff_codec_wav_tags[] = {
+ { CODEC_ID_PCM_S16LE, 0x0001 },
+ { CODEC_ID_PCM_U8, 0x0001 }, /* must come after s16le in this list */
+ { CODEC_ID_PCM_S24LE, 0x0001 },
+ { CODEC_ID_PCM_S32LE, 0x0001 },
+ { CODEC_ID_ADPCM_MS, 0x0002 },
+ { CODEC_ID_PCM_F32LE, 0x0003 },
+ { CODEC_ID_PCM_F64LE, 0x0003 }, /* must come after f32le in this list */
+ { CODEC_ID_PCM_ALAW, 0x0006 },
+ { CODEC_ID_PCM_MULAW, 0x0007 },
+ { CODEC_ID_WMAVOICE, 0x000A },
+ { CODEC_ID_ADPCM_IMA_WAV, 0x0011 },
+ { CODEC_ID_PCM_ZORK, 0x0011 }, /* must come after adpcm_ima_wav in this list */
+ { CODEC_ID_ADPCM_YAMAHA, 0x0020 },
+ { CODEC_ID_TRUESPEECH, 0x0022 },
+ { CODEC_ID_GSM_MS, 0x0031 },
+ { CODEC_ID_ADPCM_G726, 0x0045 },
+ { CODEC_ID_MP2, 0x0050 },
+ { CODEC_ID_MP3, 0x0055 },
+ { CODEC_ID_AMR_NB, 0x0057 },
+ { CODEC_ID_AMR_WB, 0x0058 },
+ { CODEC_ID_ADPCM_IMA_DK4, 0x0061 }, /* rogue format number */
+ { CODEC_ID_ADPCM_IMA_DK3, 0x0062 }, /* rogue format number */
+ { CODEC_ID_ADPCM_IMA_WAV, 0x0069 },
+ { CODEC_ID_VOXWARE, 0x0075 },
+ { CODEC_ID_AAC, 0x00ff },
+ { CODEC_ID_SIPR, 0x0130 },
+ { CODEC_ID_WMAV1, 0x0160 },
+ { CODEC_ID_WMAV2, 0x0161 },
+ { CODEC_ID_WMAPRO, 0x0162 },
+ { CODEC_ID_WMALOSSLESS, 0x0163 },
+ { CODEC_ID_ADPCM_CT, 0x0200 },
+ { CODEC_ID_ATRAC3, 0x0270 },
+ { CODEC_ID_IMC, 0x0401 },
+ { CODEC_ID_AC3, 0x2000 },
+ { CODEC_ID_DTS, 0x2001 },
+ { CODEC_ID_SONIC, 0x2048 },
+ { CODEC_ID_SONIC_LS, 0x2048 },
+ { CODEC_ID_PCM_MULAW, 0x6c75 },
+ { CODEC_ID_AAC, 0x706d },
+ { CODEC_ID_AAC, 0x4143 },
+ { CODEC_ID_FLAC, 0xF1AC },
+ { CODEC_ID_ADPCM_SWF, ('S'<<8)+'F' },
+ { CODEC_ID_VORBIS, ('V'<<8)+'o' }, //HACK/FIXME, does vorbis in WAV/AVI have an (in)official id?
+
+ /* FIXME: All of the IDs below are not 16 bit and thus illegal. */
+ // for NuppelVideo (nuv.c)
+ { CODEC_ID_PCM_S16LE, MKTAG('R', 'A', 'W', 'A') },
+ { CODEC_ID_MP3, MKTAG('L', 'A', 'M', 'E') },
+ { CODEC_ID_MP3, MKTAG('M', 'P', '3', ' ') },
+ { CODEC_ID_NONE, 0 },
+};
+
+static unsigned int ff_codec_get_tag(const struct mp_AVCodecTag *tags, int id)
+{
+ while (tags->id != CODEC_ID_NONE) {
+ if (tags->id == id)
+ return tags->tag;
+ tags++;
+ }
+ return 0;
+}
+
+static enum CodecID ff_codec_get_id(const struct mp_AVCodecTag *tags, unsigned int tag)
+{
+ int i;
+ for(i=0; tags[i].id != CODEC_ID_NONE;i++) {
+ if(tag == tags[i].tag)
+ return tags[i].id;
+ }
+ for(i=0; tags[i].id != CODEC_ID_NONE; i++) {
+ if( toupper((tag >> 0)&0xFF) == toupper((tags[i].tag >> 0)&0xFF)
+ && toupper((tag >> 8)&0xFF) == toupper((tags[i].tag >> 8)&0xFF)
+ && toupper((tag >>16)&0xFF) == toupper((tags[i].tag >>16)&0xFF)
+ && toupper((tag >>24)&0xFF) == toupper((tags[i].tag >>24)&0xFF))
+ return tags[i].id;
+ }
+ return CODEC_ID_NONE;
+}
+
+unsigned int mp_av_codec_get_tag(const struct mp_AVCodecTag * const *tags, enum CodecID id)
+{
+ int i;
+ for(i=0; tags && tags[i]; i++){
+ int tag= ff_codec_get_tag(tags[i], id);
+ if(tag) return tag;
+ }
+ return 0;
+}
+
+enum CodecID mp_av_codec_get_id(const struct mp_AVCodecTag * const *tags, unsigned int tag)
+{
+ int i;
+ for(i=0; tags && tags[i]; i++){
+ enum CodecID id= ff_codec_get_id(tags[i], tag);
+ if(id!=CODEC_ID_NONE) return id;
+ }
+ return CODEC_ID_NONE;
+}
diff --git a/ffmpeg_files/taglists.h b/ffmpeg_files/taglists.h
new file mode 100644
index 0000000000..4c8f9bfdbd
--- /dev/null
+++ b/ffmpeg_files/taglists.h
@@ -0,0 +1,9 @@
+#include "libavcodec/avcodec.h"
+
+struct mp_AVCodecTag {
+ int id;
+ unsigned int tag;
+};
+
+unsigned int mp_av_codec_get_tag(const struct mp_AVCodecTag * const *tags, enum CodecID id);
+enum CodecID mp_av_codec_get_id(const struct mp_AVCodecTag * const *tags, unsigned int tag);
diff --git a/ffmpeg_files/x86/bswap.h b/ffmpeg_files/x86/bswap.h
new file mode 100644
index 0000000000..62238d178a
--- /dev/null
+++ b/ffmpeg_files/x86/bswap.h
@@ -0,0 +1,61 @@
+/*
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+/**
+ * @file libavutil/x86/bswap.h
+ * byte swapping routines
+ */
+
+#ifndef MP_AVUTIL_X86_BSWAP_H
+#define MP_AVUTIL_X86_BSWAP_H
+
+#include <stdint.h>
+#include "config.h"
+#include "libavutil/common.h"
+
+#define bswap_16 bswap_16
+static av_always_inline av_const uint16_t bswap_16(uint16_t x)
+{
+ __asm__("rorw $8, %0" : "+r"(x));
+ return x;
+}
+
+#define bswap_32 bswap_32
+static av_always_inline av_const uint32_t bswap_32(uint32_t x)
+{
+#if HAVE_BSWAP
+ __asm__("bswap %0" : "+r" (x));
+#else
+ __asm__("rorw $8, %w0 \n\t"
+ "rorl $16, %0 \n\t"
+ "rorw $8, %w0"
+ : "+r"(x));
+#endif
+ return x;
+}
+
+#if ARCH_X86_64
+#define bswap_64 bswap_64
+static inline uint64_t av_const bswap_64(uint64_t x)
+{
+ __asm__("bswap %0": "=r" (x) : "0" (x));
+ return x;
+}
+#endif
+
+#endif /* AVUTIL_X86_BSWAP_H */
diff --git a/ffmpeg_files/x86_cpu.h b/ffmpeg_files/x86_cpu.h
new file mode 100644
index 0000000000..49a5b28a35
--- /dev/null
+++ b/ffmpeg_files/x86_cpu.h
@@ -0,0 +1,76 @@
+/*
+ * copyright (c) 2006 Michael Niedermayer <michaelni@gmx.at>
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef MP_AVUTIL_X86_CPU_H
+#define MP_AVUTIL_X86_CPU_H
+
+#include <stdint.h>
+#include "config.h"
+
+#if ARCH_X86_64
+# define REG_a "rax"
+# define REG_b "rbx"
+# define REG_c "rcx"
+# define REG_d "rdx"
+# define REG_D "rdi"
+# define REG_S "rsi"
+# define PTR_SIZE "8"
+typedef int64_t x86_reg;
+
+# define REG_SP "rsp"
+# define REG_BP "rbp"
+# define REGBP rbp
+# define REGa rax
+# define REGb rbx
+# define REGc rcx
+# define REGd rdx
+# define REGSP rsp
+
+#elif ARCH_X86_32
+
+# define REG_a "eax"
+# define REG_b "ebx"
+# define REG_c "ecx"
+# define REG_d "edx"
+# define REG_D "edi"
+# define REG_S "esi"
+# define PTR_SIZE "4"
+typedef int32_t x86_reg;
+
+# define REG_SP "esp"
+# define REG_BP "ebp"
+# define REGBP ebp
+# define REGa eax
+# define REGb ebx
+# define REGc ecx
+# define REGd edx
+# define REGSP esp
+#else
+typedef int x86_reg;
+#endif
+
+#define HAVE_7REGS (ARCH_X86_64 || (HAVE_EBX_AVAILABLE && HAVE_EBP_AVAILABLE))
+#define HAVE_6REGS (ARCH_X86_64 || (HAVE_EBX_AVAILABLE || HAVE_EBP_AVAILABLE))
+
+#if ARCH_X86_64 && defined(PIC)
+# define BROKEN_RELOCATIONS 1
+#endif
+
+#endif /* AVUTIL_X86_CPU_H */
diff --git a/find_sub.c b/find_sub.c
index dcd045eb60..7b7e0493ce 100644
--- a/find_sub.c
+++ b/find_sub.c
@@ -69,7 +69,7 @@ void step_sub(sub_data *subd, float pts, int movement) {
sub_delay = subs[current_sub].start / (subd->sub_uses_time ? 100 : sub_fps) - pts;
}
-void find_sub(sub_data* subd,int key){
+void find_sub(struct MPContext *mpctx, sub_data* subd,int key){
subtitle *subs;
subtitle *new_sub = NULL;
int i,j;
@@ -174,5 +174,5 @@ void find_sub(sub_data* subd,int key){
new_sub=NULL; // no sub here
update:
- set_osd_subtitle(new_sub);
+ set_osd_subtitle(mpctx, new_sub);
}
diff --git a/gui/app.c b/gui/app.c
deleted file mode 100644
index a389013c98..0000000000
--- a/gui/app.c
+++ /dev/null
@@ -1,239 +0,0 @@
-/*
- * 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.
- */
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-
-#include "config.h"
-#include "mp_msg.h"
-#include "help_mp.h"
-
-#include "app.h"
-#include "wm/wskeys.h"
-#include "skin/skin.h"
-#include "mplayer/gmplayer.h"
-#include "interface.h"
-
-static const evName evNames[] =
- {
- { evNone, "evNone" },
- { evPlay, "evPlay" },
- { evStop, "evStop" },
- { evPause, "evPause" },
- { evPrev, "evPrev" },
- { evNext, "evNext" },
- { evLoad, "evLoad" },
- { evEqualizer, "evEqualizer" },
- { evEqualizer, "evEqualeaser" },
- { evPlayList, "evPlaylist" },
- { evExit, "evExit" },
- { evIconify, "evIconify" },
- { evIncBalance, "evIncBalance" },
- { evDecBalance, "evDecBalance" },
- { evFullScreen, "evFullScreen" },
- { evFName, "evFName" },
- { evMovieTime, "evMovieTime" },
- { evAbout, "evAbout" },
- { evLoadPlay, "evLoadPlay" },
- { evPreferences, "evPreferences" },
- { evSkinBrowser, "evSkinBrowser" },
- { evBackward10sec, "evBackward10sec" },
- { evForward10sec, "evForward10sec" },
- { evBackward1min, "evBackward1min" },
- { evForward1min, "evForward1min" },
- { evBackward10min, "evBackward10min" },
- { evForward10min, "evForward10min" },
- { evIncVolume, "evIncVolume" },
- { evDecVolume, "evDecVolume" },
- { evMute, "evMute" },
- { evIncAudioBufDelay, "evIncAudioBufDelay" },
- { evDecAudioBufDelay, "evDecAudioBufDelay" },
- { evPlaySwitchToPause, "evPlaySwitchToPause" },
- { evPauseSwitchToPlay, "evPauseSwitchToPlay" },
- { evNormalSize, "evHalfSize" },
- { evNormalSize, "evNormalSize" },
- { evDoubleSize, "evDoubleSize" },
- { evSetMoviePosition, "evSetMoviePosition" },
- { evSetVolume, "evSetVolume" },
- { evSetBalance, "evSetBalance" },
- { evHelp, "evHelp" },
- { evLoadSubtitle, "evLoadSubtitle" },
- { evPlayDVD, "evPlayDVD" },
- { evPlayVCD, "evPlayVCD" },
- { evSetURL, "evSetURL" },
- { evLoadAudioFile, "evLoadAudioFile" },
- { evDropSubtitle, "evDropSubtitle" },
- { evSetAspect, "evSetAspect" }
- };
-
-static const int evBoxs = sizeof( evNames ) / sizeof( evName );
-
-// ---
-
-listItems appMPlayer;
-
-/* FIXME: Eventually remove the obsolete directory names. */
-char * skinDirInHome=NULL;
-char * skinDirInHome_obsolete=NULL;
-char * skinMPlayerDir=NULL;
-char * skinMPlayerDir_obsolete=NULL;
-char * skinName = NULL;
-
-void appClearItem( wItem * item )
-{
- item->type=0;
-// ---
- item->x=0; item->y=0; item->width=0; item->height=0;
-// ---
- item->px=0; item->py=0; item->psx=0; item->psy=0;
-// ---
- item->msg=0; item->msg2=0;
- item->pressed=btnReleased;
- item->tmp=0;
- item->key=0; item->key2=0;
- item->Bitmap.Width=0; item->Bitmap.Height=0; item->Bitmap.BPP=0; item->Bitmap.ImageSize=0;
- if ( item->Bitmap.Image ) free( item->Bitmap.Image );
- item->Bitmap.Image=NULL;
-// ---
- item->fontid=0;
- if ( item->label ) free( item->label ); item->label=NULL;
- item->event=0;
-}
-
-void appCopy( listItems * dest,listItems * source )
-{
- dest->NumberOfItems=source->NumberOfItems;
- memcpy( &dest->Items,&source->Items,128 * sizeof( wItem ) );
-
- dest->NumberOfMenuItems=source->NumberOfMenuItems;
- memcpy( &dest->MenuItems,&source->MenuItems,32 * sizeof( wItem ) );
-
- memcpy( &dest->main,&source->main,sizeof( wItem ) );
- memcpy( &dest->sub,&source->sub,sizeof( wItem ) );
- memcpy( &dest->menuBase,&source->menuBase,sizeof( wItem ) );
- memcpy( &dest->menuSelected,&source->menuSelected,sizeof( wItem ) );
-}
-
-void appInitStruct( listItems * item )
-{
- int i;
- for ( i=0;i<item->NumberOfItems;i++ )
- appClearItem( &item->Items[i] );
- for ( i=0;i<item->NumberOfMenuItems;i++ )
- appClearItem( &item->MenuItems[i] );
- for ( i=0;i<item->NumberOfBarItems;i++ )
- appClearItem( &item->barItems[i] );
-
- item->NumberOfItems=-1;
- memset( item->Items,0,256 * sizeof( wItem ) );
- item->NumberOfMenuItems=-1;
- memset( item->MenuItems,0,64 * sizeof( wItem ) );
- item->NumberOfBarItems=-1;
- memset( item->barItems,0,256 * sizeof( wItem ) );
-
- appClearItem( &item->main );
- item->mainDecoration=0;
- appClearItem( &item->sub );
- item->sub.width=0; item->sub.height=0;
- item->sub.x=-1; item->sub.y=-1;
- appClearItem( &item->menuBase );
- appClearItem( &item->menuSelected );
- item->sub.R=item->sub.G=item->sub.B=0;
- item->bar.R=item->bar.G=item->bar.B=0;
- item->main.R=item->main.G=item->main.B=0;
- item->barIsPresent=0;
- item->menuIsPresent=0;
-}
-
-int appFindKey( unsigned char * name )
-{
- int i;
- for ( i=0;i<wsKeyNumber;i++ )
- if ( !strcmp( wsKeyNames[i].name,name ) ) return wsKeyNames[i].code;
- return -1;
-}
-
-int appFindMessage( unsigned char * str )
-{
- int i;
- for ( i=0;i<evBoxs;i++ )
- if ( !strcmp( evNames[i].name,str ) ) return evNames[i].msg;
- return -1;
-}
-
-void btnModify( int event,float state )
-{
- int j;
- for ( j=0;j < appMPlayer.NumberOfItems + 1;j++ )
- if ( appMPlayer.Items[j].msg == event )
- {
- switch ( appMPlayer.Items[j].type )
- {
- case itButton:
- appMPlayer.Items[j].pressed=(int)state;
- appMPlayer.Items[j].tmp=(int)state;
- break;
- case itPotmeter:
- case itVPotmeter:
- case itHPotmeter:
- if ( state < 0.0f ) state=0.0f;
- if ( state > 100.f ) state=100.0f;
- appMPlayer.Items[j].value=state;
- break;
- }
- }
-
- for ( j=0;j < appMPlayer.NumberOfBarItems + 1;j++ )
- if ( appMPlayer.barItems[j].msg == event )
- {
- switch ( appMPlayer.barItems[j].type )
- {
- case itButton:
- appMPlayer.barItems[j].pressed=(int)state;
- appMPlayer.barItems[j].tmp=(int)state;
- break;
- case itPotmeter:
- case itVPotmeter:
- case itHPotmeter:
- if ( state < 0.0f ) state=0.0f;
- if ( state > 100.f ) state=100.0f;
- appMPlayer.barItems[j].value=state;
- break;
- }
- }
-}
-
-float btnGetValue( int event )
-{
- int j;
- for ( j=0;j<appMPlayer.NumberOfItems + 1;j++ )
- if ( appMPlayer.Items[j].msg == event ) return appMPlayer.Items[j].value;
- return 0;
-}
-
-void btnSet( int event,int set )
-{
- int j;
- for ( j=0;j<appMPlayer.NumberOfItems + 1;j++ )
- if ( appMPlayer.Items[j].msg == event )
- { appMPlayer.Items[j].pressed=set; appMPlayer.barItems[j].tmp=0; }
- for ( j=0;j<appMPlayer.NumberOfBarItems + 1;j++ )
- if ( appMPlayer.barItems[j].msg == event )
- { appMPlayer.barItems[j].pressed=set; appMPlayer.barItems[j].tmp=0; }
-}
diff --git a/gui/app.h b/gui/app.h
deleted file mode 100644
index fd924ffcbc..0000000000
--- a/gui/app.h
+++ /dev/null
@@ -1,204 +0,0 @@
-/*
- * 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_GUI_APP_H
-#define MPLAYER_GUI_APP_H
-
-#include "bitmap.h"
-#include "wm/ws.h"
-#include "wm/wskeys.h"
-
-// --- User events ------
-
-#define evNone 0
-#define evPlay 1
-#define evStop 2
-#define evPause 3
-#define evPrev 6
-#define evNext 7
-#define evLoad 8
-#define evEqualizer 9
-#define evPlayList 10
-#define evIconify 11
-#define evAbout 12
-#define evLoadPlay 13
-#define evPreferences 14
-#define evSkinBrowser 15
-#define evPlaySwitchToPause 16
-#define evPauseSwitchToPlay 17
-
-#define evBackward10sec 18
-#define evForward10sec 19
-#define evBackward1min 20
-#define evForward1min 21
-#define evBackward10min 22
-#define evForward10min 23
-
-#define evHalfSize 301
-#define evNormalSize 24
-#define evDoubleSize 25
-#define evFullScreen 26
-
-#define evSetMoviePosition 27
-#define evSetVolume 28
-#define evSetBalance 29
-#define evMute 30
-
-#define evIncVolume 31
-#define evDecVolume 32
-#define evIncAudioBufDelay 33
-#define evDecAudioBufDelay 34
-#define evIncBalance 35
-#define evDecBalance 36
-
-#define evHelp 37
-
-#define evLoadSubtitle 38
-#define evDropSubtitle 43
-#define evPlayDVD 39
-#define evPlayVCD 40
-#define evPlayNetwork 41
-#define evLoadAudioFile 42
-#define evSetAspect 44
-#define evSetAudio 45
-#define evSetVideo 46
-#define evSetSubtitle 47
-// 48 ...
-
-#define evExit 1000
-
-// --- General events ---
-
-#define evFileLoaded 5000
-#define evHideMouseCursor 5001
-#define evMessageBox 5002
-#define evGeneralTimer 5003
-#define evGtkIsOk 5004
-#define evShowPopUpMenu 5005
-#define evHidePopUpMenu 5006
-#define evSetDVDAudio 5007
-#define evSetDVDSubtitle 5008
-#define evSetDVDTitle 5009
-#define evSetDVDChapter 5010
-#define evSubtitleLoaded 5011
-#define evSetVCDTrack 5012
-#define evSetURL 5013
-
-#define evFName 7000
-#define evMovieTime 7001
-#define evRedraw 7002
-#define evHideWindow 7003
-#define evShowWindow 7004
-#define evFirstLoad 7005
-
-// ----------------------
-
-typedef struct
-{
- int msg;
- const char * name;
-} evName;
-
-#define itNULL 0
-#define itButton 101 // button
-#define itHPotmeter 102 // horizontal potmeter
-#define itVPotmeter 103 // vertical potmeter
-#define itSLabel 104 // static label
-#define itDLabel 105 // dynamic label
-#define itBase 106
-#define itPotmeter 107
-#define itFont 108
-// ---
-#define btnPressed 0
-#define btnReleased 1
-#define btnDisabled 2
-// ---
-typedef struct
-{
- int type;
-// ---
- int x,y;
- int width,height;
-// ---
- int px,py,psx,psy;
-// ---
- int msg,msg2;
- int pressed,tmp;
- int key,key2;
- int phases;
- float value;
- txSample Bitmap;
- txSample Mask;
-// ---
- int fontid;
- int align;
- char * label;
-// ---
- int event;
-// ---
- int R,G,B;
-} wItem;
-
-typedef struct
-{
- wItem main;
- wsTWindow mainWindow;
- int mainDecoration;
-
- wItem sub;
- wsTWindow subWindow;
-
- wItem bar;
- wsTWindow barWindow;
- int barIsPresent;
-
- wItem menuBase;
- wItem menuSelected;
- wsTWindow menuWindow;
- int menuIsPresent;
-
-// ---
- int NumberOfItems;
- wItem Items[256];
-// ---
- int NumberOfMenuItems;
- wItem MenuItems[64];
-// ---
- int NumberOfBarItems;
- wItem barItems[256];
-} listItems;
-
-extern listItems appMPlayer;
-
-extern char * skinDirInHome;
-extern char * skinDirInHome_obsolete;
-extern char * skinMPlayerDir;
-extern char * skinMPlayerDir_obsolete;
-extern char * skinName;
-
-void appInitStruct( listItems * item );
-void appClearItem( wItem * item );
-void appCopy( listItems * item1, listItems * item2 );
-int appFindMessage( unsigned char * str );
-int appFindKey( unsigned char * name );
-
-void btnModify( int event, float state );
-float btnGetValue( int event );
-void btnSet( int event, int set );
-
-#endif /* MPLAYER_GUI_APP_H */
diff --git a/gui/bitmap.c b/gui/bitmap.c
deleted file mode 100644
index b61c3c90cf..0000000000
--- a/gui/bitmap.c
+++ /dev/null
@@ -1,187 +0,0 @@
-/*
- * 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.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "mp_msg.h"
-#include "help_mp.h"
-#include "bitmap.h"
-#include "libavcodec/avcodec.h"
-#include "libavutil/intreadwrite.h"
-#include "libvo/fastmemcpy.h"
-
-static int pngRead( unsigned char * fname,txSample * bf )
-{
- int decode_ok;
- void *data;
- int len;
- AVCodecContext *avctx;
- AVFrame *frame;
-
- FILE *fp=fopen( fname,"rb" );
- if ( !fp )
- {
- mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[png] file read error ( %s )\n",fname );
- return 1;
- }
-
- fseek(fp, 0, SEEK_END);
- len = ftell(fp);
- if (len > 50 * 1024 * 1024) return 2;
- data = av_malloc(len + FF_INPUT_BUFFER_PADDING_SIZE);
- fseek(fp, 0, SEEK_SET);
- fread(data, len, 1, fp);
- fclose(fp);
- avctx = avcodec_alloc_context();
- frame = avcodec_alloc_frame();
- avcodec_register_all();
- avcodec_open(avctx, avcodec_find_decoder(CODEC_ID_PNG));
- avcodec_decode_video(avctx, frame, &decode_ok, data, len);
- memset(bf, 0, sizeof(*bf));
- switch (avctx->pix_fmt) {
- case PIX_FMT_GRAY8: bf->BPP = 8; break;
- case PIX_FMT_GRAY16BE: bf->BPP = 16; break;
- case PIX_FMT_RGB24: bf->BPP = 24; break;
- case PIX_FMT_BGRA:
- case PIX_FMT_ARGB: bf->BPP = 32; break;
- default: bf->BPP = 0; break;
- }
- if (decode_ok && bf->BPP) {
- int bpl;
- bf->Width = avctx->width; bf->Height = avctx->height;
- bpl = bf->Width * (bf->BPP / 8);
- bf->ImageSize = bpl * bf->Height;
- bf->Image = malloc(bf->ImageSize);
- memcpy_pic(bf->Image, frame->data[0], bpl, bf->Height, bpl, frame->linesize[0]);
- }
- avcodec_close(avctx);
- av_freep(&frame);
- av_freep(&avctx);
- av_freep(&data);
-
- mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[png] filename: %s.\n",fname );
- mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[png] size: %dx%d bits: %d\n",bf->Width,bf->Height,bf->BPP );
- mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[png] imagesize: %lu\n",bf->ImageSize );
- return !(decode_ok && bf->BPP);
-}
-
-static int conv24to32( txSample * bf )
-{
- unsigned char * tmpImage;
- int i,c;
-
- if ( bf->BPP == 24 )
- {
- tmpImage=bf->Image;
- bf->ImageSize=bf->Width * bf->Height * 4;
- bf->BPP=32;
- if ( ( bf->Image=calloc( 1, bf->ImageSize ) ) == NULL )
- {
- free( tmpImage );
- mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[bitmap] not enough memory for image\n" );
- return 1;
- }
- for ( c=0,i=0; c < bf->ImageSize; c += 4, i += 3)
- {
- *(uint32_t *)&bf->Image[c] = AV_RB24(&tmpImage[i]);
- }
- free( tmpImage );
- }
- return 0;
-}
-
-static void Normalize( txSample * bf )
-{
- int i;
-#if !HAVE_BIGENDIAN
- for ( i=0;i < (int)bf->ImageSize;i+=4 ) bf->Image[i+3]=0;
-#else
- for ( i=0;i < (int)bf->ImageSize;i+=4 ) bf->Image[i]=0;
-#endif
-}
-
-static unsigned char tmp[512];
-
-static unsigned char * fExist( unsigned char * fname )
-{
- FILE * fl;
- unsigned char ext[][6] = { ".png\0",".PNG\0" };
- int i;
-
- fl=fopen( fname,"rb" );
- if ( fl != NULL )
- {
- fclose( fl );
- return fname;
- }
- for ( i=0;i<2;i++ )
- {
- snprintf( tmp,511,"%s%s",fname,ext[i] );
- fl=fopen( tmp,"rb" );
- if ( fl != NULL )
- {
- fclose( fl );
- return tmp;
- }
- }
- return NULL;
-}
-
-int bpRead( char * fname, txSample * bf )
-{
- fname=fExist( fname );
- if ( fname == NULL ) return -2;
- if ( pngRead( fname,bf ) )
- {
- mp_dbg( MSGT_GPLAYER,MSGL_FATAL,"[bitmap] unknown file type ( %s )\n",fname );
- return -5;
- }
- if ( bf->BPP < 24 )
- {
- mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[bitmap] Sorry, only 24 and 32 bpp bitmaps are supported.\n" );
- return -1;
- }
- if ( conv24to32( bf ) ) return -8;
- Normalize( bf );
- return 0;
-}
-
-void Convert32to1( txSample * in,txSample * out,int adaptivlimit )
-{
- out->Width=in->Width;
- out->Height=in->Height;
- out->BPP=1;
- out->ImageSize=(out->Width * out->Height + 7) / 8;
- mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[c32to1] imagesize: %d\n",out->ImageSize );
- out->Image=calloc( 1,out->ImageSize );
- if ( out->Image == NULL ) mp_msg( MSGT_GPLAYER,MSGL_WARN,MSGTR_NotEnoughMemoryC32To1 );
- {
- int i,b,c=0; unsigned int * buf = NULL; unsigned char tmp = 0; int nothaveshape = 1;
- buf=(unsigned int *)in->Image;
- for ( b=0,i=0;i < (int)(out->Width * out->Height);i++ )
- {
- if ( (int)buf[i] != adaptivlimit ) tmp=( tmp >> 1 )|128;
- else { tmp=tmp >> 1; buf[i]=nothaveshape=0; }
- if ( b++ == 7 ) { out->Image[c++]=tmp; tmp=b=0; }
- }
- if ( b ) out->Image[c]=tmp;
- if ( nothaveshape ) { free( out->Image ); out->Image=NULL; }
- }
-}
diff --git a/gui/bitmap.h b/gui/bitmap.h
deleted file mode 100644
index 67e7fabb43..0000000000
--- a/gui/bitmap.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * 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_GUI_BITMAP_H
-#define MPLAYER_GUI_BITMAP_H
-
-typedef struct txSample
-{
- unsigned long Width;
- unsigned long Height;
- unsigned int BPP;
- unsigned long ImageSize;
- char * Image;
-} txSample;
-
-int bpRead( char * fname, txSample * bf );
-void Convert32to1( txSample * in,txSample * out,int adaptivlimit );
-
-#endif /* MPLAYER_GUI_BITMAP_H */
diff --git a/gui/cfg.c b/gui/cfg.c
deleted file mode 100644
index 3d54f7aad7..0000000000
--- a/gui/cfg.c
+++ /dev/null
@@ -1,371 +0,0 @@
-/*
- * 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.
- */
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-
-#include "config.h"
-#include "mp_msg.h"
-#include "help_mp.h"
-#include "mixer.h"
-#include "mplayer.h"
-#include "m_config.h"
-#include "m_option.h"
-#include "get_path.h"
-#include "libvo/sub.h"
-#include "libvo/video_out.h"
-#include "stream/stream.h"
-#include "libmpdemux/demuxer.h"
-#include "libass/ass_mp.h"
-
-#include "cfg.h"
-#include "app.h"
-#include "interface.h"
-#include "mplayer/play.h"
-
-// --- params
-
-int gtkEnableAudioEqualizer = 0;
-
-int gtkVfPP = 0;
-#ifdef CONFIG_LIBAVCODEC
- int gtkVfLAVC = 0;
-#endif
-
-int gtkAONorm = 0;
-int gtkAOSurround = 0;
-int gtkAOExtraStereo = 0;
-float gtkAOExtraStereoMul = 1.0;
-#ifdef CONFIG_OSS_AUDIO
-char * gtkAOOSSMixer;
-char * gtkAOOSSMixerChannel;
-char * gtkAOOSSDevice;
-#endif
-#ifdef CONFIG_ALSA
-char * gtkAOALSAMixer;
-char * gtkAOALSAMixerChannel;
-char * gtkAOALSADevice;
-#endif
-#ifdef CONFIG_SDL
-char * gtkAOSDLDriver;
-#endif
-#ifdef CONFIG_ESD
-char * gtkAOESDDevice;
-#endif
-
-int gtkCacheOn = 0;
-int gtkCacheSize = 2048;
-
-int gtkAutoSyncOn = 0;
-int gtkAutoSync = 0;
-
-#ifdef CONFIG_DXR3
- char * gtkDXR3Device;
-#endif
-
-int gtkSubDumpMPSub = 0;
-int gtkSubDumpSrt = 0;
-
-int gtkLoadFullscreen = 0;
-int gtkShowVideoWindow = 1;
-int gtkEnablePlayBar = 1;
-
-int gui_save_pos = 1;
-int gui_main_pos_x = -2;
-int gui_main_pos_y = -2;
-int gui_sub_pos_x = -1;
-int gui_sub_pos_y = -1;
-
-#ifdef CONFIG_ASS
-gtkASS_t gtkASS;
-#endif
-// ---
-
-extern int stop_xscreensaver;
-extern int disable_gui_conf;
-int m_config_parse_config_file(m_config_t* config, char *conffile);
-
-static m_config_t * gui_conf;
-static const m_option_t gui_opts[] =
-{
- { "enable_audio_equ",&gtkEnableAudioEqualizer,CONF_TYPE_FLAG,0,0,1,NULL },
-
- { "vo_driver",&video_driver_list,CONF_TYPE_STRING_LIST,0,0,0,NULL },
- { "vo_panscan",&vo_panscan,CONF_TYPE_FLOAT,CONF_RANGE,0.0,1.0,NULL },
- { "vo_doublebuffering",&vo_doublebuffering,CONF_TYPE_FLAG,0,0,1,NULL },
- { "vo_direct_render",&vo_directrendering,CONF_TYPE_FLAG,0,0,1,NULL },
-#ifdef CONFIG_DXR3
- { "vo_dxr3_device",&gtkDXR3Device,CONF_TYPE_STRING,0,0,0,NULL },
-#endif
-
- { "v_framedrop",&frame_dropping,CONF_TYPE_INT,CONF_RANGE,0,2,NULL },
- { "v_flip",&flip,CONF_TYPE_INT,CONF_RANGE,-1,1,NULL },
- { "v_ni",&force_ni,CONF_TYPE_FLAG,0,0,1,NULL },
- { "v_idx",&index_mode,CONF_TYPE_INT,CONF_RANGE,-1,2,NULL },
- { "v_vfm",&video_fm_list,CONF_TYPE_STRING_LIST,0,0,0,NULL },
- { "a_afm",&audio_fm_list,CONF_TYPE_STRING_LIST,0,0,0,NULL },
-
- { "vf_pp",&gtkVfPP,CONF_TYPE_FLAG,0,0,1,NULL },
- { "vf_autoq",&auto_quality,CONF_TYPE_INT,CONF_RANGE,0,100,NULL },
-#ifdef CONFIG_LIBAVCODEC
- { "vf_lavc",&gtkVfLAVC,CONF_TYPE_FLAG,0,0,1,NULL },
-#endif
-
- { "ao_driver",&audio_driver_list,CONF_TYPE_STRING_LIST,0,0,0,NULL },
- { "ao_volnorm",&gtkAONorm,CONF_TYPE_FLAG,0,0,1,NULL },
- { "softvol",&soft_vol,CONF_TYPE_FLAG,0,0,1,NULL },
- { "ao_surround",&gtkAOSurround,CONF_TYPE_FLAG,0,0,1,NULL },
- { "ao_extra_stereo",&gtkAOExtraStereo,CONF_TYPE_FLAG,0,0,1,NULL },
- { "ao_extra_stereo_coefficient",&gtkAOExtraStereoMul,CONF_TYPE_FLOAT,CONF_RANGE,-10,10,NULL },
-#ifdef CONFIG_OSS_AUDIO
- { "ao_oss_mixer",&gtkAOOSSMixer,CONF_TYPE_STRING,0,0,0,NULL },
- { "ao_oss_mixer_channel",&gtkAOOSSMixerChannel,CONF_TYPE_STRING,0,0,0,NULL },
- { "ao_oss_device",&gtkAOOSSDevice,CONF_TYPE_STRING,0,0,0,NULL },
-#endif
-#ifdef CONFIG_ALSA
- { "ao_alsa_mixer",&gtkAOALSAMixer,CONF_TYPE_STRING,0,0,0,NULL },
- { "ao_alsa_mixer_channel",&gtkAOALSAMixerChannel,CONF_TYPE_STRING,0,0,0,NULL },
- { "ao_alsa_device",&gtkAOALSADevice,CONF_TYPE_STRING,0,0,0,NULL },
-#endif
-#ifdef CONFIG_SDL
- { "ao_sdl_subdriver",&gtkAOSDLDriver,CONF_TYPE_STRING,0,0,0,NULL },
-#endif
-#ifdef CONFIG_ESD
- { "ao_esd_device",&gtkAOESDDevice,CONF_TYPE_STRING,0,0,0,NULL },
-#endif
-
- { "dvd_device",&dvd_device,CONF_TYPE_STRING,0,0,0,NULL },
- { "cdrom_device",&cdrom_device,CONF_TYPE_STRING,0,0,0,NULL },
-
- { "osd_level",&osd_level,CONF_TYPE_INT,CONF_RANGE,0,3,NULL },
- { "sub_auto_load",&sub_auto,CONF_TYPE_FLAG,0,0,1,NULL },
- { "sub_unicode",&sub_unicode,CONF_TYPE_FLAG,0,0,1,NULL },
-#ifdef CONFIG_ASS
- { "ass_enabled",&ass_enabled,CONF_TYPE_FLAG,0,0,1,NULL },
- { "ass_use_margins",&ass_use_margins,CONF_TYPE_FLAG,0,0,1,NULL },
- { "ass_top_margin",&ass_top_margin,CONF_TYPE_INT,CONF_RANGE,0,512,NULL },
- { "ass_bottom_margin",&ass_bottom_margin,CONF_TYPE_INT,CONF_RANGE,0,512,NULL },
-#endif
- { "sub_pos",&sub_pos,CONF_TYPE_INT,CONF_RANGE,0,200,NULL },
- { "sub_overlap",&suboverlap_enabled,CONF_TYPE_FLAG,0,0,0,NULL },
-#ifdef CONFIG_ICONV
- { "sub_cp",&sub_cp,CONF_TYPE_STRING,0,0,0,NULL },
-#endif
- { "font_factor",&font_factor,CONF_TYPE_FLOAT,CONF_RANGE,0.0,10.0,NULL },
- { "font_name",&font_name,CONF_TYPE_STRING,0,0,0,NULL },
-#ifdef CONFIG_FREETYPE
- { "font_encoding",&subtitle_font_encoding,CONF_TYPE_STRING,0,0,0,NULL },
- { "font_text_scale",&text_font_scale_factor,CONF_TYPE_FLOAT,CONF_RANGE,0,100,NULL },
- { "font_osd_scale",&osd_font_scale_factor,CONF_TYPE_FLOAT,CONF_RANGE,0,100,NULL },
- { "font_blur",&subtitle_font_radius,CONF_TYPE_FLOAT,CONF_RANGE,0,8,NULL },
- { "font_outline",&subtitle_font_thickness,CONF_TYPE_FLOAT,CONF_RANGE,0,8,NULL },
- { "font_autoscale",&subtitle_autoscale,CONF_TYPE_INT,CONF_RANGE,0,3,NULL },
-#endif
-
- { "cache",&gtkCacheOn,CONF_TYPE_FLAG,0,0,1,NULL },
- { "cache_size",&gtkCacheSize,CONF_TYPE_INT,CONF_RANGE,-1,65535,NULL },
-
- { "playbar",&gtkEnablePlayBar,CONF_TYPE_FLAG,0,0,1,NULL },
- { "load_fullscreen",&gtkLoadFullscreen,CONF_TYPE_FLAG,0,0,1,NULL },
- { "show_videowin", &gtkShowVideoWindow,CONF_TYPE_FLAG,0,0,1,NULL },
- { "stopxscreensaver",&stop_xscreensaver,CONF_TYPE_FLAG,0,0,1,NULL },
-
- { "autosync",&gtkAutoSyncOn,CONF_TYPE_FLAG,0,0,1,NULL },
- { "autosync_size",&gtkAutoSync,CONF_TYPE_INT,CONF_RANGE,0,10000,NULL },
-
- { "gui_skin",&skinName,CONF_TYPE_STRING,0,0,0,NULL },
-
- { "gui_save_pos", &gui_save_pos, CONF_TYPE_FLAG,0,0,1,NULL},
- { "gui_main_pos_x", &gui_main_pos_x, CONF_TYPE_INT,0,0,0,NULL},
- { "gui_main_pos_y", &gui_main_pos_y, CONF_TYPE_INT,0,0,0,NULL},
- { "gui_video_out_pos_x", &gui_sub_pos_x, CONF_TYPE_INT,0,0,0,NULL},
- { "gui_video_out_pos_y", &gui_sub_pos_y, CONF_TYPE_INT,0,0,0,NULL},
-
- { "equ_channel_1",&gtkEquChannel1,CONF_TYPE_STRING,0,0,0,NULL },
- { "equ_channel_2",&gtkEquChannel2,CONF_TYPE_STRING,0,0,0,NULL },
- { "equ_channel_3",&gtkEquChannel3,CONF_TYPE_STRING,0,0,0,NULL },
- { "equ_channel_4",&gtkEquChannel4,CONF_TYPE_STRING,0,0,0,NULL },
- { "equ_channel_5",&gtkEquChannel5,CONF_TYPE_STRING,0,0,0,NULL },
- { "equ_channel_6",&gtkEquChannel6,CONF_TYPE_STRING,0,0,0,NULL },
-
-#if 1
-#define audio_equ_row( i,j ) { "equ_band_"#i#j,&gtkEquChannels[i][j],CONF_TYPE_FLOAT,CONF_RANGE,-15.0,15.0,NULL },
- audio_equ_row( 0,0 ) audio_equ_row( 0,1 ) audio_equ_row( 0,2 ) audio_equ_row( 0,3 ) audio_equ_row( 0,4 ) audio_equ_row( 0,5 ) audio_equ_row( 0,6 ) audio_equ_row( 0,7 ) audio_equ_row( 0,8 ) audio_equ_row( 0,9 )
- audio_equ_row( 1,0 ) audio_equ_row( 1,1 ) audio_equ_row( 1,2 ) audio_equ_row( 1,3 ) audio_equ_row( 1,4 ) audio_equ_row( 1,5 ) audio_equ_row( 1,6 ) audio_equ_row( 1,7 ) audio_equ_row( 1,8 ) audio_equ_row( 1,9 )
- audio_equ_row( 2,0 ) audio_equ_row( 2,1 ) audio_equ_row( 2,2 ) audio_equ_row( 2,3 ) audio_equ_row( 2,4 ) audio_equ_row( 2,5 ) audio_equ_row( 2,6 ) audio_equ_row( 2,7 ) audio_equ_row( 2,8 ) audio_equ_row( 2,9 )
- audio_equ_row( 3,0 ) audio_equ_row( 3,1 ) audio_equ_row( 3,2 ) audio_equ_row( 3,3 ) audio_equ_row( 3,4 ) audio_equ_row( 3,5 ) audio_equ_row( 3,6 ) audio_equ_row( 3,7 ) audio_equ_row( 3,8 ) audio_equ_row( 3,9 )
- audio_equ_row( 4,0 ) audio_equ_row( 4,1 ) audio_equ_row( 4,2 ) audio_equ_row( 4,3 ) audio_equ_row( 4,4 ) audio_equ_row( 4,5 ) audio_equ_row( 4,6 ) audio_equ_row( 4,7 ) audio_equ_row( 4,8 ) audio_equ_row( 4,9 )
- audio_equ_row( 5,0 ) audio_equ_row( 5,1 ) audio_equ_row( 5,2 ) audio_equ_row( 5,3 ) audio_equ_row( 5,4 ) audio_equ_row( 5,5 ) audio_equ_row( 5,6 ) audio_equ_row( 5,7 ) audio_equ_row( 5,8 ) audio_equ_row( 5,9 )
-#undef audio_equ_row
-#endif
-
- { NULL, NULL, 0, 0, 0, 0, NULL }
-};
-
-char * gfgets( char * str, int size, FILE * f )
-{
- char * s = fgets( str,size,f );
- char c;
- if ( s )
- {
- c=s[ strlen( s ) - 1 ]; if ( c == '\n' || c == '\r' ) s[ strlen( s ) - 1 ]=0;
- c=s[ strlen( s ) - 1 ]; if ( c == '\n' || c == '\r' ) s[ strlen( s ) - 1 ]=0;
- }
- return s;
-}
-
-int cfg_read( void )
-{
- char * cfg = get_path( "gui.conf" );
- FILE * f;
-
-// -- read configuration
- mp_msg( MSGT_GPLAYER,MSGL_V,"[cfg] reading config file: %s\n",cfg );
- gui_conf=m_config_new();
- m_config_register_options( gui_conf,gui_opts );
- if ( !disable_gui_conf && m_config_parse_config_file( gui_conf,cfg ) < 0 )
- {
- mp_msg( MSGT_GPLAYER,MSGL_FATAL,MSGTR_ConfigFileError );
-// exit( 1 );
- }
- free( cfg );
-
-// -- read pl
- cfg=get_path( "gui.pl" );
- if ( (f=fopen( cfg,"rt" )) )
- {
- while ( !feof( f ) )
- {
- char tmp[512]; plItem * item;
- if ( gfgets( tmp,512,f ) == NULL ) continue;
- item=calloc( 1,sizeof( plItem ) );
- item->path=strdup( tmp );
- gfgets( tmp,512,f );
- item->name=strdup( tmp );
- gtkSet( gtkAddPlItem,0,(void*)item );
- }
- fclose( f );
- }
- free( cfg );
-
- //-- read previously visited urls
- cfg=get_path( "gui.url" );
- if ( (f=fopen( cfg,"rt" )) )
- {
- while ( !feof( f ) )
- {
- char tmp[512]; URLItem * item;
- if ( gfgets( tmp,512,f ) == NULL ) continue;
- item=calloc( 1,sizeof( URLItem ) );
- item->url=strdup( tmp );
- gtkSet( gtkAddURLItem,0,(void*)item );
- }
- fclose( f );
- }
- free( cfg );
-
-// -- reade file loader history
- cfg=get_path( "gui.history" );
- if ( (f=fopen( cfg,"rt+" )) )
- {
- int i = 0;
- while ( !feof( f ) )
- {
- char tmp[512];
- if ( gfgets( tmp,512,f ) == NULL ) continue;
- fsHistory[i++]=gstrdup( tmp );
- }
- fclose( f );
- }
- free( cfg );
-
- return 0;
-}
-
-int cfg_write( void )
-{
- char * cfg = get_path( "gui.conf" );
- FILE * f;
- int i;
-
-// -- save configuration
- if ( (f=fopen( cfg,"wt+" )) )
- {
- for ( i=0;gui_opts[i].name;i++ )
- {
- char* v = m_option_print(&gui_opts[i],gui_opts[i].p);
- if(v == (char *)-1) {
- mp_msg(MSGT_GPLAYER,MSGL_WARN,MSGTR_UnableToSaveOption, gui_opts[i].name);
- v = NULL;
- }
- if(v) {
- fprintf( f,"%s = \"%s\"\n",gui_opts[i].name, v);
- free(v);
- }
- }
- fclose( f );
- }
- free( cfg );
-
-// -- save playlist
- cfg=get_path( "gui.pl" );
- if ( (f=fopen( cfg,"wt+" )) )
- {
- plCurrent=plList;
- while ( plCurrent )
- {
- if ( plCurrent->path && plCurrent->name )
- {
- fprintf( f,"%s\n",plCurrent->path );
- fprintf( f,"%s\n",plCurrent->name );
- }
- plCurrent=plCurrent->next;
- }
- fclose( f );
- }
- free( cfg );
-
-// -- save URL's
- cfg=get_path( "gui.url" );
- if ( (f=fopen( cfg,"wt+" )) )
- {
- while ( URLList )
- {
- if ( URLList->url ) fprintf( f,"%s\n",URLList->url );
- URLList=URLList->next;
- }
- fclose( f );
- }
- free( cfg );
-
-// -- save file loader history
- cfg=get_path( "gui.history" );
- if ( (f=fopen( cfg,"wt+" )) )
- {
- int i = 0;
-// while ( fsHistory[i] != NULL )
- for ( i=0;i < 5; i++)
- if( fsHistory[i] ) fprintf( f,"%s\n",fsHistory[i] );
- fclose( f );
- }
- free( cfg );
-
- return 0;
-}
-
diff --git a/gui/cfg.h b/gui/cfg.h
deleted file mode 100644
index 82eb36122a..0000000000
--- a/gui/cfg.h
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * 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_GUI_CFG_H
-#define MPLAYER_GUI_CFG_H
-
-#include "config.h"
-
-extern int gtkEnableAudioEqualizer;
-
-extern int gtkVfPP;
-extern int gtkVfLAVC;
-
-extern int gtkAONorm;
-extern int gtkAOFakeSurround;
-extern int gtkAOExtraStereo;
-extern float gtkAOExtraStereoMul;
-extern char * gtkAOOSSMixer;
-extern char * gtkAOOSSMixerChannel;
-extern char * gtkAOOSSDevice;
-extern char * gtkAOALSAMixer;
-extern char * gtkAOALSAMixerChannel;
-extern char * gtkAOALSADevice;
-extern char * gtkAOSDLDriver;
-extern char * gtkAOESDDevice;
-extern char * gtkDXR3Device;
-
-extern int gtkCacheOn;
-extern int gtkCacheSize;
-
-extern int gtkAutoSyncOn;
-extern int gtkAutoSync;
-
-extern int gtkSubDumpMPSub;
-extern int gtkSubDumpSrt;
-
-extern char * gtkEquChannel1;
-extern char * gtkEquChannel2;
-extern char * gtkEquChannel3;
-extern char * gtkEquChannel4;
-extern char * gtkEquChannel5;
-extern char * gtkEquChannel6;
-extern int gtkLoadFullscreen;
-extern int gtkShowVideoWindow;
-extern int gtkEnablePlayBar;
-
-extern int gui_save_pos;
-extern int gui_main_pos_x;
-extern int gui_main_pos_y;
-extern int gui_sub_pos_x;
-extern int gui_sub_pos_y;
-
-#ifdef CONFIG_ASS
-typedef struct {
- int enabled;
- int use_margins;
- int top_margin;
- int bottom_margin;
-} gtkASS_t;
-extern gtkASS_t gtkASS;
-#endif
-
-int cfg_read( void );
-int cfg_write( void );
-
-#endif /* MPLAYER_GUI_CFG_H */
diff --git a/gui/interface.c b/gui/interface.c
deleted file mode 100644
index 3351656d87..0000000000
--- a/gui/interface.c
+++ /dev/null
@@ -1,1312 +0,0 @@
-/*
- * 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.
- */
-
-#include <inttypes.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <sys/types.h>
-
-#include "wm/ws.h"
-#include "wm/wsxdnd.h"
-#include "interface.h"
-#include "skin/skin.h"
-
-#include "mplayer/gtk/eq.h"
-#include "mplayer/widgets.h"
-#include "mplayer/gmplayer.h"
-#include "mplayer/play.h"
-
-#include "access_mpcontext.h"
-#include "app.h"
-#include "cfg.h"
-#include "help_mp.h"
-#include "get_path.h"
-#include "libvo/x11_common.h"
-#include "libvo/video_out.h"
-#include "libvo/font_load.h"
-#include "libvo/sub.h"
-#include "input/input.h"
-#include "libao2/audio_out.h"
-#include "mixer.h"
-#include "libaf/af.h"
-#include "libaf/equalizer.h"
-#include "libass/ass_mp.h"
-
-extern af_cfg_t af_cfg;
-
-#ifdef CONFIG_ICONV
-#include <iconv.h>
-#endif
-
-#include "stream/stream.h"
-#include "libmpdemux/demuxer.h"
-#include "libmpdemux/stheader.h"
-#include "libmpcodecs/dec_video.h"
-
-#ifdef CONFIG_DVDREAD
-#include "stream/stream_dvd.h"
-#endif
-
-int vcd_seek_to_track(void *vcd, int track);
-
-#include "m_config.h"
-#include "m_option.h"
-
-
-guiInterface_t guiIntfStruct;
-int guiWinID=-1;
-
-char * gstrcat( char ** dest,const char * src )
-{
- char * tmp = NULL;
-
- if ( !src ) return NULL;
-
- if ( *dest )
- {
- tmp=malloc( strlen( *dest ) + strlen( src ) + 1 );
-
- if ( tmp ) /* TODO: advanced error handling */
- {
- strcpy( tmp,*dest ); strcat( tmp,src ); free( *dest );
- }
- }
- else
- { tmp=malloc( strlen( src ) + 1 ); strcpy( tmp,src ); }
- *dest=tmp;
- return tmp;
-}
-
-int gstrcmp( const char * a,const char * b )
-{
- if ( !a && !b ) return 0;
- if ( !a || !b ) return -1;
- return strcmp( a,b );
-}
-
-int gstrncmp( const char * a,const char * b,int size )
-{
- if ( !a && !b ) return 0;
- if ( !a || !b ) return -1;
- return strncmp( a,b,size );
-}
-
-char * gstrdup( const char * str )
-{
- if ( !str ) return NULL;
- return strdup( str );
-}
-
-char * gstrchr( char * str,int c )
-{
- if ( !str ) return NULL;
- return strchr( str,c );
-}
-
-void gfree( void ** p )
-{
- if ( *p == NULL ) return;
- free( *p ); *p=NULL;
-}
-
-void gset( char ** str, const char * what )
-{
- if ( *str ) { if ( !strstr( *str,what ) ) { gstrcat( str,"," ); gstrcat( str,what ); }}
- else gstrcat( str,what );
-}
-
-/**
- * \brief this actually creates a new list containing only one element...
- */
-void gaddlist( char *** list,const char * entry )
-{
- int i;
-
- if ( (*list) )
- {
- for ( i=0;(*list)[i];i++ ) free( (*list)[i] );
- free( (*list) );
- }
-
- (*list)=malloc( 2 * sizeof(char **) );
- (*list)[0]=gstrdup( entry );
- (*list)[1]=NULL;
-}
-
-/**
- * \brief this replaces a string starting with search by replace.
- * If not found, replace is appended.
- */
-void greplace(char ***list, const char *search, const char *replace)
-{
- int i = 0;
- int len = (search) ? strlen(search) : 0;
-
- if (*list) {
- for (i = 0; (*list)[i]; i++) {
- if (search && (strncmp((*list)[i], search, len) == 0)) {
- free((*list)[i]);
- (*list)[i] = gstrdup(replace);
- return;
- }
- }
- *list = realloc(*list, (i + 2) * sizeof(char *));
- }
- else
- *list = malloc(2 * sizeof(char *));
-
- (*list)[i] = gstrdup(replace);
- (*list)[i + 1] = NULL;
-}
-
-void guiInit( void )
-{
- int i;
-
- memset( &guiIntfStruct,0,sizeof( guiIntfStruct ) );
- guiIntfStruct.Balance=50.0f;
- guiIntfStruct.StreamType=-1;
-
- memset( &gtkEquChannels,0,sizeof( gtkEquChannels ) );
-#ifdef CONFIG_DXR3
- if ( !gtkDXR3Device ) gtkDXR3Device=strdup( "/dev/em8300-0" );
-#endif
- if ( stream_cache_size > 0 ) { gtkCacheOn=1; gtkCacheSize=stream_cache_size; }
- else if ( stream_cache_size == 0 ) gtkCacheOn = 0;
- if ( autosync && autosync != gtkAutoSync ) { gtkAutoSyncOn=1; gtkAutoSync=autosync; }
-
-#ifdef CONFIG_ASS
- gtkASS.enabled = ass_enabled;
- gtkASS.use_margins = ass_use_margins;
- gtkASS.top_margin = ass_top_margin;
- gtkASS.bottom_margin = ass_bottom_margin;
-#endif
-
- gtkInit();
-// --- initialize X
- wsXInit( (void *)mDisplay );
-// --- load skin
- skinDirInHome=get_path("skins");
- skinDirInHome_obsolete=get_path("Skin");
- skinMPlayerDir=MPLAYER_DATADIR "/skins";
- skinMPlayerDir_obsolete=MPLAYER_DATADIR "/Skin";
- mp_msg( MSGT_GPLAYER,MSGL_V,"SKIN dir 1: '%s'\n",skinDirInHome);
- mp_msg( MSGT_GPLAYER,MSGL_V,"SKIN dir 1 (obsolete): '%s'\n",skinDirInHome_obsolete);
- mp_msg( MSGT_GPLAYER,MSGL_V,"SKIN dir 2: '%s'\n",skinMPlayerDir);
- mp_msg( MSGT_GPLAYER,MSGL_V,"SKIN dir 2 (obsolete): '%s'\n",skinMPlayerDir_obsolete);
- if ( !skinName ) skinName=strdup( "default" );
- i = skinRead( skinName );
- if ((i == -1) && strcmp(skinName,"default"))
- {
- mp_msg( MSGT_GPLAYER,MSGL_WARN,MSGTR_SKIN_SKINCFG_SelectedSkinNotFound, skinName);
- skinName=strdup( "default" );
- i = skinRead( skinName );
- }
- switch (i) {
- case -1: mp_msg( MSGT_GPLAYER,MSGL_ERR,MSGTR_SKIN_SKINCFG_SkinNotFound,skinName ); exit( 0 );
- case -2: mp_msg( MSGT_GPLAYER,MSGL_ERR,MSGTR_SKIN_SKINCFG_SkinCfgReadError,skinName ); exit( 0 );
- }
-// --- initialize windows
- if ( ( mplDrawBuffer = malloc( appMPlayer.main.Bitmap.ImageSize ) ) == NULL )
- {
- fprintf( stderr,MSGTR_NEMDB );
- exit( 0 );
- }
-
- if ( gui_save_pos )
- {
- appMPlayer.main.x = gui_main_pos_x;
- appMPlayer.main.y = gui_main_pos_y;
- appMPlayer.sub.x = gui_sub_pos_x;
- appMPlayer.sub.y = gui_sub_pos_y;
- }
-
- if (WinID>0)
- {
- appMPlayer.subWindow.Parent=WinID;
- appMPlayer.sub.x=0;
- appMPlayer.sub.y=0;
- }
- if (guiWinID>=0) appMPlayer.mainWindow.Parent=guiWinID;
-
- wsCreateWindow( &appMPlayer.subWindow,
- appMPlayer.sub.x,appMPlayer.sub.y,appMPlayer.sub.width,appMPlayer.sub.height,
- wsNoBorder,wsShowMouseCursor|wsHandleMouseButton|wsHandleMouseMove,wsShowFrame|wsHideWindow,"MPlayer - Video" );
-
- wsDestroyImage( &appMPlayer.subWindow );
- wsCreateImage( &appMPlayer.subWindow,appMPlayer.sub.Bitmap.Width,appMPlayer.sub.Bitmap.Height );
- wsXDNDMakeAwareness(&appMPlayer.subWindow);
-
- mplMenuInit();
- mplPBInit();
-
- vo_setwindow( appMPlayer.subWindow.WindowID, appMPlayer.subWindow.wGC );
-
-// i=wsHideFrame|wsMaxSize|wsHideWindow;
-// if ( appMPlayer.mainDecoration ) i=wsShowFrame|wsMaxSize|wsHideWindow;
- i=wsShowFrame|wsMaxSize|wsHideWindow;
- wsCreateWindow( &appMPlayer.mainWindow,
- appMPlayer.main.x,appMPlayer.main.y,appMPlayer.main.width,appMPlayer.main.height,
- wsNoBorder,wsShowMouseCursor|wsHandleMouseButton|wsHandleMouseMove,i,"MPlayer" );
-
- wsSetShape( &appMPlayer.mainWindow,appMPlayer.main.Mask.Image );
- wsXDNDMakeAwareness(&appMPlayer.mainWindow);
-
-#ifdef DEBUG
- mp_msg( MSGT_GPLAYER,MSGL_DBG2,"[main] depth on screen: %d\n",wsDepthOnScreen );
- mp_msg( MSGT_GPLAYER,MSGL_DBG2,"[main] parent: 0x%x\n",(int)appMPlayer.mainWindow.WindowID );
- mp_msg( MSGT_GPLAYER,MSGL_DBG2,"[main] sub: 0x%x\n",(int)appMPlayer.subWindow.WindowID );
-#endif
-
- appMPlayer.mainWindow.ReDraw=(void *)mplMainDraw;
- appMPlayer.mainWindow.MouseHandler=mplMainMouseHandle;
- appMPlayer.mainWindow.KeyHandler=mplMainKeyHandle;
- appMPlayer.mainWindow.DandDHandler=mplDandDHandler;
-
- appMPlayer.subWindow.ReDraw=(void *)mplSubDraw;
- appMPlayer.subWindow.MouseHandler=mplSubMouseHandle;
- appMPlayer.subWindow.KeyHandler=mplMainKeyHandle;
- appMPlayer.subWindow.DandDHandler=mplDandDHandler;
-
- wsSetBackgroundRGB( &appMPlayer.subWindow,appMPlayer.sub.R,appMPlayer.sub.G,appMPlayer.sub.B );
- wsClearWindow( appMPlayer.subWindow );
- if ( appMPlayer.sub.Bitmap.Image ) wsConvert( &appMPlayer.subWindow,appMPlayer.sub.Bitmap.Image,appMPlayer.sub.Bitmap.ImageSize );
-
- btnModify( evSetVolume,guiIntfStruct.Volume );
- btnModify( evSetBalance,guiIntfStruct.Balance );
- btnModify( evSetMoviePosition,guiIntfStruct.Position );
-
- wsSetIcon( wsDisplay,appMPlayer.mainWindow.WindowID,guiIcon,guiIconMask );
- wsSetIcon( wsDisplay,appMPlayer.subWindow.WindowID,guiIcon,guiIconMask );
-
- guiIntfStruct.Playing=0;
-
- if ( !appMPlayer.mainDecoration ) wsWindowDecoration( &appMPlayer.mainWindow,0 );
-
- wsVisibleWindow( &appMPlayer.mainWindow,wsShowWindow );
-#if 0
- wsVisibleWindow( &appMPlayer.subWindow,wsShowWindow );
-
- {
- XEvent xev;
- do { XNextEvent( wsDisplay,&xev ); } while ( xev.type != MapNotify || xev.xmap.event != appMPlayer.subWindow.WindowID );
- appMPlayer.subWindow.Mapped=wsMapped;
- }
-
- if ( !fullscreen ) fullscreen=gtkLoadFullscreen;
- if ( fullscreen )
- {
- mplFullScreen();
- btnModify( evFullScreen,btnPressed );
- }
-#else
- if ( !fullscreen ) fullscreen=gtkLoadFullscreen;
- if ( gtkShowVideoWindow )
- {
- wsVisibleWindow( &appMPlayer.subWindow,wsShowWindow );
- {
- XEvent xev;
- do { XNextEvent( wsDisplay,&xev ); } while ( xev.type != MapNotify || xev.xmap.event != appMPlayer.subWindow.WindowID );
- appMPlayer.subWindow.Mapped=wsMapped;
- }
-
- if ( fullscreen )
- {
- mplFullScreen();
- btnModify( evFullScreen,btnPressed );
- }
- }
- else
- {
- if ( fullscreen )
- {
- wsVisibleWindow( &appMPlayer.subWindow,wsShowWindow );
- {
- XEvent xev;
- do { XNextEvent( wsDisplay,&xev ); } while ( xev.type != MapNotify || xev.xmap.event != appMPlayer.subWindow.WindowID );
- appMPlayer.subWindow.Mapped=wsMapped;
- }
- wsVisibleWindow( &appMPlayer.subWindow, wsShowWindow );
-
- mplFullScreen();
- btnModify( evFullScreen,btnPressed );
- }
- }
-#endif
- mplSubRender=1;
-// ---
-
- if ( filename ) mplSetFileName( NULL,filename,STREAMTYPE_FILE );
- if ( plCurrent && !filename ) mplSetFileName( plCurrent->path,plCurrent->name,STREAMTYPE_FILE );
- if ( subdata ) guiSetFilename( guiIntfStruct.Subtitlename, subdata->filename );
- guiLoadFont();
-}
-
-void guiDone( void )
-{
- mplMainRender=0;
- mp_msg( MSGT_GPLAYER,MSGL_V,"[GUI] done.\n" );
-
- if ( gui_save_pos )
- {
- gui_main_pos_x=appMPlayer.mainWindow.X; gui_main_pos_y=appMPlayer.mainWindow.Y;
- gui_sub_pos_x=appMPlayer.subWindow.X; gui_sub_pos_y=appMPlayer.subWindow.Y;
- }
-
-#ifdef CONFIG_ASS
- ass_enabled = gtkASS.enabled;
- ass_use_margins = gtkASS.use_margins;
- ass_top_margin = gtkASS.top_margin;
- ass_bottom_margin = gtkASS.bottom_margin;
-#endif
-
- cfg_write();
- wsXDone();
-}
-
-int guiCMDArray[] =
- {
- evLoadPlay,
- evLoadSubtitle,
- evAbout,
- evPlay,
- evStop,
- evPlayList,
- evPreferences,
- evFullScreen,
- evSkinBrowser
- };
-
-extern int stream_dump_type;
-extern int vcd_track;
-extern m_obj_settings_t * vf_settings;
-
-void guiLoadFont( void )
-{
-#ifdef CONFIG_FREETYPE
- load_font_ft(vo_image_width, vo_image_height, &vo_font, font_name, osd_font_scale_factor);
-#else
- if ( vo_font )
- {
- int i;
- if ( vo_font->name ) free( vo_font->name );
- if ( vo_font->fpath ) free( vo_font->fpath );
- for ( i=0;i<16;i++ )
- if ( vo_font->pic_a[i] )
- {
- if ( vo_font->pic_a[i]->bmp ) free( vo_font->pic_a[i]->bmp );
- if ( vo_font->pic_a[i]->pal ) free( vo_font->pic_a[i]->pal );
- }
- for ( i=0;i<16;i++ )
- if ( vo_font->pic_b[i] )
- {
- if ( vo_font->pic_b[i]->bmp ) free( vo_font->pic_b[i]->bmp );
- if ( vo_font->pic_b[i]->pal ) free( vo_font->pic_b[i]->pal );
- }
- free( vo_font ); vo_font=NULL;
- }
- if ( font_name )
- {
- vo_font=read_font_desc( font_name,font_factor,0 );
- if ( !vo_font ) mp_msg( MSGT_CPLAYER,MSGL_ERR,MSGTR_CantLoadFont,font_name );
- }
- else
- {
- font_name=gstrdup( get_path( "font/font.desc" ) );
- vo_font=read_font_desc( font_name,font_factor,0 );
- if ( !vo_font )
- {
- gfree( (void **)&font_name ); font_name=gstrdup(MPLAYER_DATADIR "/font/font.desc" );
- vo_font=read_font_desc( font_name,font_factor,0 );
- }
- }
-#endif
-}
-
-extern mp_osd_obj_t* vo_osd_list;
-
-extern char **sub_name;
-
-void guiLoadSubtitle( char * name )
-{
- if ( guiIntfStruct.Playing == 0 )
- {
- guiIntfStruct.SubtitleChanged=1; //what is this for? (mw)
- return;
- }
- if ( subdata )
- {
- mp_msg( MSGT_GPLAYER,MSGL_INFO,MSGTR_DeletingSubtitles );
- sub_free( subdata );
- subdata=NULL;
- vo_sub=NULL;
- if ( vo_osd_list )
- {
- int len;
- mp_osd_obj_t * osd = vo_osd_list;
- while ( osd )
- {
- if ( osd->type == OSDTYPE_SUBTITLE ) break;
- osd=osd->next;
- }
- if ( osd && osd->flags&OSDFLAG_VISIBLE )
- {
- len=osd->stride * ( osd->bbox.y2 - osd->bbox.y1 );
- memset( osd->bitmap_buffer,0,len );
- memset( osd->alpha_buffer,0,len );
- }
- }
- }
- if ( name )
- {
- mp_msg( MSGT_GPLAYER,MSGL_INFO,MSGTR_LoadingSubtitles,name );
- subdata=sub_read_file( name, guiIntfStruct.FPS );
- if ( !subdata ) mp_msg( MSGT_GPLAYER,MSGL_ERR,MSGTR_CantLoadSub,name );
- sub_name = (malloc(2 * sizeof(char*))); //when mplayer will be restarted
- sub_name[0] = strdup(name); //sub_name[0] will be read
- sub_name[1] = NULL;
- }
- update_set_of_subtitles();
-
-}
-
-static void add_vf( char * str )
-{
- mp_msg( MSGT_GPLAYER,MSGL_STATUS,MSGTR_AddingVideoFilter,str );
- if ( vf_settings )
- {
- int i = 0;
- while ( vf_settings[i].name ) if ( !gstrcmp( vf_settings[i++].name,str ) ) { i=-1; break; }
- if ( i != -1 )
- { vf_settings=realloc( vf_settings,( i + 2 ) * sizeof( m_obj_settings_t ) ); vf_settings[i].name=strdup( str );vf_settings[i].attribs = NULL; vf_settings[i+1].name=NULL; }
- } else { vf_settings=malloc( 2 * sizeof( m_obj_settings_t ) ); vf_settings[0].name=strdup( str );vf_settings[0].attribs = NULL; vf_settings[1].name=NULL; }
-}
-
-static void remove_vf( char * str )
-{
- int n = 0;
-
- if ( !vf_settings ) return;
-
- mp_msg( MSGT_GPLAYER,MSGL_STATUS,MSGTR_RemovingVideoFilter,str );
-
- while ( vf_settings[n++].name ); n--;
- if ( n > -1 )
- {
- int i = 0,m = -1;
- while ( vf_settings[i].name ) if ( !gstrcmp( vf_settings[i++].name,str ) ) { m=i - 1; break; }
- i--;
- if ( m > -1 )
- {
- if ( n == 1 ) { free( vf_settings[0].name );free( vf_settings[0].attribs ); free( vf_settings ); vf_settings=NULL; }
- else { free( vf_settings[i].name );free( vf_settings[i].attribs ); memcpy( &vf_settings[i],&vf_settings[i + 1],( n - i ) * sizeof( m_obj_settings_t ) ); }
- }
- }
-}
-
-int guiGetEvent( int type,char * arg )
-{
- const ao_functions_t *audio_out = NULL;
- const vo_functions_t *video_out = NULL;
- mixer_t *mixer = NULL;
-
- stream_t * stream = (stream_t *) arg;
-#ifdef CONFIG_DVDREAD
- dvd_priv_t * dvdp = (dvd_priv_t *) arg;
-#endif
-
- if (guiIntfStruct.mpcontext) {
- audio_out = mpctx_get_audio_out(guiIntfStruct.mpcontext);
- video_out = mpctx_get_video_out(guiIntfStruct.mpcontext);
- mixer = mpctx_get_mixer(guiIntfStruct.mpcontext);
- }
-
- switch ( type )
- {
- case guiXEvent:
- guiIntfStruct.event_struct=(void *)arg;
- wsEvents( wsDisplay,(XEvent *)arg,NULL );
- gtkEventHandling();
- break;
- case guiCEvent:
- switch ( (int)arg )
- {
- case guiSetPlay:
- guiIntfStruct.Playing=1;
-// if ( !gtkShowVideoWindow ) wsVisibleWindow( &appMPlayer.subWindow,wsHideWindow );
- break;
- case guiSetStop:
- guiIntfStruct.Playing=0;
-// if ( !gtkShowVideoWindow ) wsVisibleWindow( &appMPlayer.subWindow,wsHideWindow );
- break;
- case guiSetPause: guiIntfStruct.Playing=2; break;
- }
- mplState();
- break;
- case guiSetState:
- mplState();
- break;
- case guiSetFileName:
- if ( arg ) guiSetFilename( guiIntfStruct.Filename,arg );
- break;
- case guiSetAudioOnly:
- guiIntfStruct.AudioOnly=(int)arg;
- if ( (int)arg ) { guiIntfStruct.NoWindow=True; wsVisibleWindow( &appMPlayer.subWindow,wsHideWindow ); }
- else wsVisibleWindow( &appMPlayer.subWindow,wsShowWindow );
- break;
- case guiSetContext:
- guiIntfStruct.mpcontext=(void *)arg;
- case guiSetDemuxer:
- guiIntfStruct.demuxer=(void *)arg;
- break;
- case guiSetAfilter:
- guiIntfStruct.afilter=(void *)arg;
- break;
- case guiSetShVideo:
- {
- if ( !appMPlayer.subWindow.isFullScreen )
- {
- wsResizeWindow( &appMPlayer.subWindow,vo_dwidth,vo_dheight );
- wsMoveWindow( &appMPlayer.subWindow,True,appMPlayer.sub.x,appMPlayer.sub.y );
- }
- guiIntfStruct.MovieWidth=vo_dwidth;
- guiIntfStruct.MovieHeight=vo_dheight;
- if (guiWinID>=0)
- wsMoveWindow( &appMPlayer.mainWindow,0,0, vo_dheight);
- }
- break;
-#ifdef CONFIG_DVDREAD
- case guiSetDVD:
- guiIntfStruct.DVD.titles=dvdp->vmg_file->tt_srpt->nr_of_srpts;
- guiIntfStruct.DVD.chapters=dvdp->vmg_file->tt_srpt->title[dvd_title].nr_of_ptts;
- guiIntfStruct.DVD.angles=dvdp->vmg_file->tt_srpt->title[dvd_title].nr_of_angles;
- guiIntfStruct.DVD.nr_of_audio_channels=dvdp->nr_of_channels;
- memcpy( guiIntfStruct.DVD.audio_streams,dvdp->audio_streams,sizeof( dvdp->audio_streams ) );
- guiIntfStruct.DVD.nr_of_subtitles=dvdp->nr_of_subtitles;
- memcpy( guiIntfStruct.DVD.subtitles,dvdp->subtitles,sizeof( dvdp->subtitles ) );
- guiIntfStruct.DVD.current_title=dvd_title + 1;
- guiIntfStruct.DVD.current_chapter=dvd_chapter + 1;
- guiIntfStruct.DVD.current_angle=dvd_angle + 1;
- guiIntfStruct.Track=dvd_title + 1;
- break;
-#endif
- case guiSetStream:
- guiIntfStruct.StreamType=stream->type;
- switch( stream->type )
- {
-#ifdef CONFIG_DVDREAD
- case STREAMTYPE_DVD:
- guiGetEvent( guiSetDVD,(char *)stream->priv );
- break;
-#endif
-#ifdef CONFIG_VCD
- case STREAMTYPE_VCD:
- {
- int i;
-
- if (!stream->priv)
- {
- guiIntfStruct.VCDTracks=0;
- break;
- }
- for ( i=1;i < 100;i++ )
- if ( vcd_seek_to_track( stream->priv,i ) < 0 ) break;
- vcd_seek_to_track( stream->priv,vcd_track );
- guiIntfStruct.VCDTracks=--i;
- break;
- }
-#endif
- default: break;
- }
- break;
- case guiIEvent:
- mp_msg( MSGT_GPLAYER,MSGL_V,"cmd: %d\n",(int)arg );
- switch( (int)arg )
- {
- case MP_CMD_QUIT:
- mplEventHandling( evExit,0 );
- break;
- case MP_CMD_VO_FULLSCREEN:
- mplEventHandling( evFullScreen,0 );
- break;
- default:
- mplEventHandling( guiCMDArray[ (int)arg - MP_CMD_GUI_EVENTS - 1 ],0 );
- }
- break;
- case guiReDraw:
- mplEventHandling( evRedraw,0 );
- break;
- case guiSetVolume:
- if ( audio_out )
- {
- float l,r;
- mixer_getvolume( mixer,&l,&r );
- guiIntfStruct.Volume=(r>l?r:l);
- if ( r != l ) guiIntfStruct.Balance=( ( r - l ) + 100 ) * 0.5f;
- else guiIntfStruct.Balance=50.0f;
- btnModify( evSetVolume,guiIntfStruct.Volume );
- btnModify( evSetBalance,guiIntfStruct.Balance );
- }
- break;
- case guiSetFileFormat:
- guiIntfStruct.FileFormat=(int)arg;
- break;
- case guiSetValues:
-// -- video
- guiIntfStruct.sh_video=arg;
- if ( arg )
- {
- sh_video_t * sh = (sh_video_t *)arg;
- guiIntfStruct.FPS=sh->fps;
- }
-
- if ( guiIntfStruct.NoWindow ) wsVisibleWindow( &appMPlayer.subWindow,wsHideWindow );
-
- if ( guiIntfStruct.StreamType == STREAMTYPE_STREAM ) btnSet( evSetMoviePosition,btnDisabled );
- else btnSet( evSetMoviePosition,btnReleased );
-
-// -- audio
- if ( audio_out )
- {
- float l,r;
- mixer_getvolume( mixer,&l,&r );
- guiIntfStruct.Volume=(r>l?r:l);
- if ( r != l ) guiIntfStruct.Balance=( ( r - l ) + 100 ) * 0.5f;
- else guiIntfStruct.Balance=50.0f;
- btnModify( evSetVolume,guiIntfStruct.Volume );
- btnModify( evSetBalance,guiIntfStruct.Balance );
- }
-
- if ( gtkEnableAudioEqualizer )
- {
- equalizer_t eq;
- int i,j;
- for ( i=0;i<6;i++ )
- for ( j=0;j<10;j++ )
- {
- eq.channel=i; eq.band=j; eq.gain=gtkEquChannels[i][j];
- gtkSet( gtkSetEqualizer,0,&eq );
- }
- }
-// -- subtitle
-#ifdef CONFIG_DXR3
- if ( video_driver_list && !gstrcmp( video_driver_list[0],"dxr3" ) && guiIntfStruct.FileFormat != DEMUXER_TYPE_MPEG_PS
-#ifdef CONFIG_LIBAVCODEC
- && !gtkVfLAVC
-#endif
- )
- {
- gtkMessageBox( GTK_MB_FATAL,MSGTR_NEEDLAVC );
- guiIntfStruct.Playing=0;
- return True;
- }
-#endif
- break;
- case guiSetDefaults:
-// if ( guiIntfStruct.Playing == 1 && guiIntfStruct.FilenameChanged )
- if ( guiIntfStruct.FilenameChanged )
- {
- audio_id=-1;
- video_id=-1;
- dvdsub_id=-1;
- vobsub_id=-1;
- stream_cache_size=-1;
- autosync=0;
- vcd_track=0;
- dvd_title=0;
- force_fps=0;
- }
- guiIntfStruct.demuxer=NULL;
- guiIntfStruct.sh_video=NULL;
- wsPostRedisplay( &appMPlayer.subWindow );
- break;
- case guiSetParameters:
- guiGetEvent( guiSetDefaults,NULL );
- switch ( guiIntfStruct.StreamType )
- {
- case STREAMTYPE_PLAYLIST:
- break;
-#ifdef CONFIG_VCD
- case STREAMTYPE_VCD:
- {
- char tmp[512];
- sprintf( tmp,"vcd://%d",guiIntfStruct.Track + 1 );
- guiSetFilename( guiIntfStruct.Filename,tmp );
- }
- break;
-#endif
-#ifdef CONFIG_DVDREAD
- case STREAMTYPE_DVD:
- {
- char tmp[512];
- sprintf( tmp,"dvd://%d",guiIntfStruct.Title );
- guiSetFilename( guiIntfStruct.Filename,tmp );
- }
- dvd_chapter=guiIntfStruct.Chapter;
- dvd_angle=guiIntfStruct.Angle;
- break;
-#endif
- }
- //if ( guiIntfStruct.StreamType != STREAMTYPE_PLAYLIST ) // Does not make problems anymore!
- {
- if ( guiIntfStruct.Filename ) filename=gstrdup( guiIntfStruct.Filename );
- else if ( filename ) guiSetFilename( guiIntfStruct.Filename,filename );
- }
-// --- video opts
-
- if ( !video_driver_list )
- {
- int i = 0;
- while ( video_out_drivers[i++] )
- if ( video_out_drivers[i - 1]->control( VOCTRL_GUISUPPORT,NULL ) == VO_TRUE )
- {
- gaddlist( &video_driver_list,(char *)video_out_drivers[i - 1]->info->short_name );
- break;
- }
- }
-
- if ( !video_driver_list && !video_driver_list[0] ) { gtkMessageBox( GTK_MB_FATAL,MSGTR_IDFGCVD ); exit_player( "gui init" ); }
-
- {
- int i = 0;
- guiIntfStruct.NoWindow=False;
- while ( video_out_drivers[i++] )
- if ( video_out_drivers[i - 1]->control( VOCTRL_GUISUPPORT,NULL ) == VO_TRUE )
- {
- if ( ( video_driver_list && !gstrcmp( video_driver_list[0],(char *)video_out_drivers[i - 1]->info->short_name ) )&&( video_out_drivers[i - 1]->control( VOCTRL_GUI_NOWINDOW,NULL ) == VO_TRUE ) )
- { guiIntfStruct.NoWindow=True; break; }
- }
- }
-
-#ifdef CONFIG_DXR3
-#ifdef CONFIG_LIBAVCODEC
- remove_vf( "lavc" );
-#endif
- if ( video_driver_list && !gstrcmp( video_driver_list[0],"dxr3" ) )
- {
- if ( ( guiIntfStruct.StreamType != STREAMTYPE_DVD)&&( guiIntfStruct.StreamType != STREAMTYPE_VCD ) )
- {
-#ifdef CONFIG_LIBAVCODEC
- if ( gtkVfLAVC ) add_vf( "lavc" );
-#endif
- }
- }
-#endif
-// ---
- if ( gtkVfPP ) add_vf( "pp" );
- else remove_vf( "pp" );
-
-// --- audio opts
-// if ( ao_plugin_cfg.plugin_list ) { free( ao_plugin_cfg.plugin_list ); ao_plugin_cfg.plugin_list=NULL; }
- if (gtkAONorm)
- greplace(&af_cfg.list, "volnorm", "volnorm");
- if (gtkEnableAudioEqualizer)
- greplace(&af_cfg.list, "equalizer", "equalizer");
- if ( gtkAOExtraStereo )
- {
- char *name = malloc(12 + 20 + 1);
- snprintf(name, 12 + 20, "extrastereo=%f", gtkAOExtraStereoMul);
- name[12 + 20] = 0;
- greplace(&af_cfg.list, "extrastereo", name);
- free(name);
- }
-#ifdef CONFIG_OSS_AUDIO
- if ( audio_driver_list && !gstrncmp( audio_driver_list[0],"oss",3 ) )
- {
- char *tmp;
- mixer_device = gtkAOOSSMixer;
- mixer_channel = gtkAOOSSMixerChannel;
- if (gtkAOOSSDevice) {
- tmp = calloc( 1,strlen( gtkAOOSSDevice ) + 7 );
- sprintf( tmp,"oss:%s",gtkAOOSSDevice );
- } else
- tmp = strdup("oss");
- gaddlist( &audio_driver_list,tmp );
- free(tmp);
- }
-#endif
-#ifdef CONFIG_ALSA
- if ( audio_driver_list && !gstrncmp( audio_driver_list[0],"alsa",4 ) )
- {
- char *tmp;
- mixer_device = gtkAOALSAMixer;
- mixer_channel = gtkAOALSAMixerChannel;
- if (gtkAOALSADevice) {
- tmp = calloc( 1,strlen( gtkAOALSADevice ) + 14 );
- sprintf( tmp,"alsa:device=%s",gtkAOALSADevice );
- } else
- tmp = strdup("alsa");
- gaddlist( &audio_driver_list,tmp );
- free(tmp);
- }
-#endif
-#ifdef CONFIG_SDL
- if ( audio_driver_list && !gstrncmp( audio_driver_list[0],"sdl",3 ) )
- {
- char *tmp;
- if (gtkAOSDLDriver) {
- tmp = calloc( 1,strlen( gtkAOSDLDriver ) + 10 );
- sprintf( tmp,"sdl:%s",gtkAOSDLDriver );
- } else
- tmp = strdup("sdl");
- gaddlist( &audio_driver_list,tmp );
- free(tmp);
- }
-#endif
-#ifdef CONFIG_ESD
- if ( audio_driver_list && !gstrncmp( audio_driver_list[0],"esd",3 ) )
- {
- char *tmp;
- if (gtkAOESDDevice) {
- tmp = calloc( 1,strlen( gtkAOESDDevice ) + 10 );
- sprintf( tmp,"esd:%s",gtkAOESDDevice );
- } else
- tmp = strdup("esd");
- gaddlist( &audio_driver_list,tmp );
- free(tmp);
- }
-#endif
-// -- subtitle
- //subdata->filename=gstrdup( guiIntfStruct.Subtitlename );
- stream_dump_type=0;
- if ( gtkSubDumpMPSub ) stream_dump_type=4;
- if ( gtkSubDumpSrt ) stream_dump_type=6;
- gtkSubDumpMPSub=gtkSubDumpSrt=0;
- guiLoadFont();
-
-// --- misc
- if ( gtkCacheOn ) stream_cache_size=gtkCacheSize;
- if ( gtkAutoSyncOn ) autosync=gtkAutoSync;
-
- if ( guiIntfStruct.AudioFile ) audio_stream=gstrdup( guiIntfStruct.AudioFile );
- else if ( guiIntfStruct.FilenameChanged ) gfree( (void**)&audio_stream );
- //audio_stream=NULL;
-
- guiIntfStruct.DiskChanged=0;
- guiIntfStruct.FilenameChanged=0;
- guiIntfStruct.NewPlay=0;
-
-#ifdef CONFIG_ASS
- ass_enabled = gtkASS.enabled;
- ass_use_margins = gtkASS.use_margins;
- ass_top_margin = gtkASS.top_margin;
- ass_bottom_margin = gtkASS.bottom_margin;
-#endif
-
- break;
- }
- return False;
-}
-
-void guiEventHandling( void )
-{
- if ( !guiIntfStruct.Playing || guiIntfStruct.NoWindow ) wsHandleEvents();
- gtkEventHandling();
-}
-
-// ---
-
-float gtkEquChannels[6][10];
-
-plItem * plCurrent = NULL;
-plItem * plList = NULL;
-plItem * plLastPlayed = NULL;
-
-URLItem *URLList = NULL;
-
-char *fsHistory[fsPersistant_MaxPos] = { NULL,NULL,NULL,NULL,NULL };
-
-#if defined( MP_DEBUG ) && 0
-void list( void )
-{
- plItem * next = plList;
- printf( "--- list ---\n" );
- while( next || next->next )
- {
- printf( "item: %s/%s\n",next->path,next->name );
- if ( next->next ) next=next->next; else break;
- }
- printf( "--- end of list ---\n" );
-}
-#else
-#define list();
-#endif
-
-void * gtkSet( int cmd,float fparam, void * vparam )
-{
- equalizer_t * eq = (equalizer_t *)vparam;
- plItem * item = (plItem *)vparam;
-
- URLItem * url_item = (URLItem *)vparam;
- int is_added = True;
-
- switch ( cmd )
- {
-// --- handle playlist
- case gtkAddPlItem: // add item to playlist
- if ( plList )
- {
- plItem * next = plList;
- while ( next->next ) { /*printf( "%s\n",next->name );*/ next=next->next; }
- next->next=item; item->prev=next;
- } else { item->prev=item->next=NULL; plCurrent=plList=item; }
- list();
- return NULL;
- case gtkInsertPlItem: // add item into playlist after current
- if ( plCurrent )
- {
- plItem * curr = plCurrent;
- item->next=curr->next;
- if (item->next)
- item->next->prev=item;
- item->prev=curr;
- curr->next=item;
- plCurrent=plCurrent->next;
- return plCurrent;
- }
- else
- return gtkSet(gtkAddPlItem,0,(void*)item);
- return NULL;
- case gtkGetNextPlItem: // get current item from playlist
- if ( plCurrent && plCurrent->next)
- {
- plCurrent=plCurrent->next;
- /*if ( !plCurrent && plList )
- {
- plItem * next = plList;
- while ( next->next ) { if ( !next->next ) break; next=next->next; }
- plCurrent=next;
- }*/
- return plCurrent;
- }
- return NULL;
- case gtkGetPrevPlItem:
- if ( plCurrent && plCurrent->prev)
- {
- plCurrent=plCurrent->prev;
- //if ( !plCurrent && plList ) plCurrent=plList;
- return plCurrent;
- }
- return NULL;
- case gtkSetCurrPlItem: // set current item
- plCurrent=item;
- return plCurrent;
- case gtkGetCurrPlItem: // get current item
- return plCurrent;
- case gtkDelCurrPlItem: // delete current item
- {
- plItem * curr = plCurrent;
-
- if (!curr)
- return NULL;
- if (curr->prev)
- curr->prev->next=curr->next;
- if (curr->next)
- curr->next->prev=curr->prev;
- if (curr==plList)
- plList=curr->next;
- plCurrent=curr->next;
- // Free it
- if ( curr->path ) free( curr->path );
- if ( curr->name ) free( curr->name );
- free( curr );
- }
- mplCurr(); // Instead of using mplNext && mplPrev
-
- return plCurrent;
- case gtkDelPl: // delete list
- {
- plItem * curr = plList;
- plItem * next;
- if ( !plList ) return NULL;
- if ( !curr->next )
- {
- if ( curr->path ) free( curr->path );
- if ( curr->name ) free( curr->name );
- free( curr );
- }
- else
- {
- while ( curr->next )
- {
- next=curr->next;
- if ( curr->path ) free( curr->path );
- if ( curr->name ) free( curr->name );
- free( curr );
- curr=next;
- }
- }
- plList=NULL; plCurrent=NULL;
- }
- return NULL;
- // ----- Handle url
- case gtkAddURLItem:
- if ( URLList )
- {
- URLItem * next_url = URLList;
- is_added = False;
- while ( next_url->next )
- {
- if ( !gstrcmp( next_url->url,url_item->url ) )
- {
- is_added=True;
- break;
- }
- next_url=next_url->next;
- }
- if ( ( !is_added )&&( gstrcmp( next_url->url,url_item->url ) ) ) next_url->next=url_item;
- } else { url_item->next=NULL; URLList=url_item; }
- return NULL;
-// --- subtitle
-#ifndef CONFIG_FREETYPE
- case gtkSetFontFactor:
- font_factor=fparam;
- guiLoadFont();
- return NULL;
-#else
- case gtkSetFontOutLine:
- subtitle_font_thickness=( 8.0f / 100.0f ) * fparam;
- guiLoadFont();
- return NULL;
- case gtkSetFontBlur:
- subtitle_font_radius=( 8.0f / 100.0f ) * fparam;
- guiLoadFont();
- return NULL;
- case gtkSetFontTextScale:
- text_font_scale_factor=fparam;
- guiLoadFont();
- return NULL;
- case gtkSetFontOSDScale:
- osd_font_scale_factor=fparam;
- guiLoadFont();
- return NULL;
- case gtkSetFontEncoding:
- gfree( (void **)&subtitle_font_encoding );
- subtitle_font_encoding=gstrdup( (char *)vparam );
- guiLoadFont();
- return NULL;
- case gtkSetFontAutoScale:
- subtitle_autoscale=(int)fparam;
- guiLoadFont();
- return NULL;
-#endif
-#ifdef CONFIG_ICONV
- case gtkSetSubEncoding:
- gfree( (void **)&sub_cp );
- sub_cp=gstrdup( (char *)vparam );
- break;
-#endif
-// --- misc
- case gtkClearStruct:
- if ( (unsigned int)vparam & guiFilenames )
- {
- gfree( (void **)&guiIntfStruct.Filename );
- gfree( (void **)&guiIntfStruct.Subtitlename );
- gfree( (void **)&guiIntfStruct.AudioFile );
- gtkSet( gtkDelPl,0,NULL );
- }
-#ifdef CONFIG_DVDREAD
- if ( (unsigned int)vparam & guiDVD ) memset( &guiIntfStruct.DVD,0,sizeof( guiDVDStruct ) );
-#endif
-#ifdef CONFIG_VCD
- if ( (unsigned int)vparam & guiVCD ) guiIntfStruct.VCDTracks=0;
-#endif
- return NULL;
- case gtkSetExtraStereo:
- gtkAOExtraStereoMul=fparam;
- if (guiIntfStruct.afilter)
- af_control_any_rev(guiIntfStruct.afilter,
- AF_CONTROL_ES_MUL | AF_CONTROL_SET, &gtkAOExtraStereoMul);
- return NULL;
- case gtkSetPanscan:
- {
- mp_cmd_t * mp_cmd;
- mp_cmd=calloc( 1,sizeof( *mp_cmd ) );
- mp_cmd->id=MP_CMD_PANSCAN; mp_cmd->name=strdup( "panscan" );
- mp_cmd->args[0].v.f=fparam; mp_cmd->args[1].v.i=1;
- mp_input_queue_cmd( mp_cmd );
- }
- return NULL;
- case gtkSetAutoq:
- auto_quality=(int)fparam;
- return NULL;
-// --- set equalizers
- case gtkSetContrast:
- if ( guiIntfStruct.sh_video ) set_video_colors( guiIntfStruct.sh_video,"contrast",(int)fparam );
- return NULL;
- case gtkSetBrightness:
- if ( guiIntfStruct.sh_video ) set_video_colors( guiIntfStruct.sh_video,"brightness",(int)fparam );
- return NULL;
- case gtkSetHue:
- if ( guiIntfStruct.sh_video ) set_video_colors( guiIntfStruct.sh_video,"hue",(int)fparam );
- return NULL;
- case gtkSetSaturation:
- if ( guiIntfStruct.sh_video ) set_video_colors( guiIntfStruct.sh_video,"saturation",(int)fparam );
- return NULL;
- case gtkSetEqualizer:
- {
- af_control_ext_t tmp;
- if ( eq )
- {
- gtkEquChannels[eq->channel][eq->band]=eq->gain;
- tmp.ch = eq->channel;
- tmp.arg = gtkEquChannels[eq->channel];
- if (guiIntfStruct.afilter)
- af_control_any_rev(guiIntfStruct.afilter,
- AF_CONTROL_EQUALIZER_GAIN | AF_CONTROL_SET, &tmp);
- }
- else
- {
- int i;
- memset( gtkEquChannels,0,sizeof( gtkEquChannels ) );
- if (guiIntfStruct.afilter)
- for ( i=0;i<6;i++ )
- {
- tmp.ch = i;
- tmp.arg = gtkEquChannels[i];
- af_control_any_rev(guiIntfStruct.afilter,
- AF_CONTROL_EQUALIZER_GAIN | AF_CONTROL_SET, &tmp);
- }
- }
- return NULL;
- }
- }
- return NULL;
-}
-
-#define mp_basename(s) (strrchr(s,'/')==NULL?(char*)s:(strrchr(s,'/')+1))
-
-#include "playtree.h"
-
-//This function adds/inserts one file into the gui playlist
-
-int import_file_into_gui(char* temp, int insert)
-{
- char *filename, *pathname;
- plItem * item;
-
- filename = strdup(mp_basename(temp));
- pathname = strdup(temp);
- if (strlen(pathname)-strlen(filename)>0)
- pathname[strlen(pathname)-strlen(filename)-1]='\0'; // We have some path so remove / at end
- else
- pathname[strlen(pathname)-strlen(filename)]='\0';
- mp_msg(MSGT_PLAYTREE,MSGL_V, "Adding filename %s && pathname %s\n",filename,pathname); //FIXME: Change to MSGL_DBG2 ?
- item=calloc( 1,sizeof( plItem ) );
- if (!item)
- return 0;
- item->name=filename;
- item->path=pathname;
- if (insert)
- gtkSet( gtkInsertPlItem,0,(void*)item ); // Inserts the item after current, and makes current=item
- else
- gtkSet( gtkAddPlItem,0,(void*)item );
- return 1;
-}
-
-
-// This function imports the initial playtree (based on cmd-line files) into the gui playlist
-// by either:
-// - overwriting gui pl (enqueue=0)
-// - appending it to gui pl (enqueue=1)
-
-int import_initial_playtree_into_gui(play_tree_t* my_playtree, m_config_t* config, int enqueue)
-{
- play_tree_iter_t* my_pt_iter=NULL;
- int result=0;
-
- if (!enqueue) // Delete playlist before "appending"
- gtkSet(gtkDelPl,0,0);
-
- if((my_pt_iter=pt_iter_create(&my_playtree,config)))
- {
- while ((filename=pt_iter_get_next_file(my_pt_iter))!=NULL)
- {
- if (import_file_into_gui(filename, 0)) // Add it to end of list
- result=1;
- }
- }
-
- mplCurr(); // Update filename
- mplGotoTheNext=1;
-
- if (!enqueue)
- filename=guiIntfStruct.Filename; // Backward compatibility; if file is specified on commandline,
- // gmplayer does directly start in Play-Mode.
- else
- filename=NULL;
-
- return result;
-}
-
-// This function imports and inserts an playtree, that is created "on the fly", for example by
-// parsing some MOV-Reference-File; or by loading an playlist with "File Open"
-//
-// The file which contained the playlist is thereby replaced with it's contents.
-
-int import_playtree_playlist_into_gui(play_tree_t* my_playtree, m_config_t* config)
-{
- play_tree_iter_t* my_pt_iter=NULL;
- int result=0;
- plItem * save=(plItem*)gtkSet( gtkGetCurrPlItem, 0, 0); // Save current item
-
- if((my_pt_iter=pt_iter_create(&my_playtree,config)))
- {
- while ((filename=pt_iter_get_next_file(my_pt_iter))!=NULL)
- {
- if (import_file_into_gui(filename, 1)) // insert it into the list and set plCurrent=new item
- result=1;
- }
- pt_iter_destroy(&my_pt_iter);
- }
-
- if (save)
- gtkSet(gtkSetCurrPlItem, 0, (void*)save);
- else
- gtkSet(gtkSetCurrPlItem, 0, (void*)plList); // go to head, if plList was empty before
-
- if (save && result)
- gtkSet(gtkDelCurrPlItem, 0, 0);
-
- mplCurr(); // Update filename
- filename=NULL;
-
- return result;
-}
-
-// wrapper function for mp_msg to display a message box for errors and warnings.
-
-void guiMessageBox(int level, char * str) {
- switch(level) {
- case MSGL_FATAL:
- gtkMessageBox(GTK_MB_FATAL|GTK_MB_SIMPLE, str);
- break;
- case MSGL_ERR:
- gtkMessageBox(GTK_MB_ERROR|GTK_MB_SIMPLE, str);
- break;
-#if 0
-// WARNING! Do NOT enable this! There are too many non-critical messages with
-// MSGL_WARN, for example: broken SPU packets, codec's bit error messages,
-// etc etc, they should not raise up a new window every time.
- case MSGL_WARN:
- gtkMessageBox(GTK_MB_WARNING|GTK_MB_SIMPLE, str);
- break;
-#endif
- }
-}
diff --git a/gui/interface.h b/gui/interface.h
deleted file mode 100644
index 5ac532c481..0000000000
--- a/gui/interface.h
+++ /dev/null
@@ -1,240 +0,0 @@
-/*
- * 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_GUI_INTERFACE_H
-#define MPLAYER_GUI_INTERFACE_H
-
-#include "config.h"
-#include "mplayer/play.h"
-#include "libvo/font_load.h"
-#include "cfg.h"
-#include "stream/stream.h"
-
-typedef struct
-{
- int x;
- int y;
- int width;
- int height;
-} guiResizeStruct;
-
-typedef struct
-{
- int signal;
- char module[512];
-} guiUnknownErrorStruct;
-
-typedef struct
-{
- int seek;
- int format;
- int width;
- int height;
- char codecdll[128];
-} guiVideoStruct;
-
-#ifdef CONFIG_DVDREAD
-typedef struct
-{
- int titles;
- int chapters;
- int angles;
- int current_chapter;
- int current_title;
- int current_angle;
- int nr_of_audio_channels;
- stream_language_t audio_streams[32];
- int nr_of_subtitles;
- stream_language_t subtitles[32];
-} guiDVDStruct;
-#endif
-
-typedef struct
-{
- int message;
- guiResizeStruct resize;
- guiVideoStruct videodata;
- guiUnknownErrorStruct error;
-
- struct MPContext * mpcontext;
- void * sh_video;
- void * afilter;
- void * demuxer;
- void * event_struct;
-
- int DiskChanged;
- int NewPlay;
-
-#ifdef CONFIG_DVDREAD
- guiDVDStruct DVD;
- int Title;
- int Angle;
- int Chapter;
-#endif
-
-#ifdef CONFIG_VCD
- int VCDTracks;
-#endif
-
- int Playing;
- float Position;
-
- int MovieWidth;
- int MovieHeight;
- int NoWindow;
-
- float Volume;
- float Balance;
-
- int Track;
- int AudioType;
- int StreamType;
- int AudioOnly;
- int TimeSec;
- int LengthInSec;
- int FrameDrop;
- int FileFormat;
- float FPS;
-
- char * Filename;
- int FilenameChanged;
-
- char * Subtitlename;
- int SubtitleChanged;
-
- char * Othername;
- int OtherChanged;
-
- char * AudioFile;
- int AudioFileChanged;
-
- int SkinChange;
-} guiInterface_t;
-
-extern guiInterface_t guiIntfStruct;
-
-#define guiXEvent 0
-#define guiCEvent 1
-#define guiIEvent 2
-#define guiSetDVD 3
-#define guiSetFileName 4
-#define guiSetState 5
-#define guiSetAudioOnly 6
-#define guiReDrawSubWindow 7
-#define guiSetShVideo 8
-#define guiSetStream 9
-#define guiReDraw 10
-#define guiSetVolume 11
-#define guiSetDefaults 12
-#define guiSetValues 13
-#define guiSetFileFormat 14
-#define guiSetDemuxer 15
-#define guiSetParameters 16
-#define guiSetAfilter 17
-#define guiSetContext 18
-
-#define guiSetStop 0
-#define guiSetPlay 1
-#define guiSetPause 2
-
-#define guiDVD 1
-#define guiVCD 2
-#define guiFilenames 4
-#define guiALL 0xffffffff
-
-extern int use_gui;
-
-void guiInit( void );
-void guiDone( void );
-int guiGetEvent( int type,char * arg );
-void guiEventHandling( void );
-void guiLoadFont( void );
-void guiLoadSubtitle( char * name );
-void guiMessageBox(int level, char * str);
-
-typedef struct plItem
-{
- struct plItem * prev,* next;
- int played;
- char * path;
- char * name;
-} plItem;
-
-typedef struct urlItem
-{
- struct urlItem *next;
- char * url;
-} URLItem;
-
-extern plItem * plList;
-extern plItem * plCurrent;
-extern plItem * plLastPlayed;
-
-extern URLItem * URLList;
-
-#define fsPersistant_MaxPath 512
-#define fsPersistant_MaxPos 5
-extern char * fsHistory[fsPersistant_MaxPos];
-
-#define gtkSetContrast 0
-#define gtkSetBrightness 1
-#define gtkSetHue 2
-#define gtkSetSaturation 3
-#define gtkSetEqualizer 4
-#define gtkAddPlItem 5
-#define gtkGetNextPlItem 6
-#define gtkGetPrevPlItem 7
-#define gtkGetCurrPlItem 8
-#define gtkDelPl 9
-#define gtkSetExtraStereo 10
-#define gtkSetPanscan 11
-#define gtkSetFontFactor 12
-#define gtkSetAutoq 13
-#define gtkClearStruct 14
-#define gtkAddURLItem 15
-#define gtkSetFontOutLine 16
-#define gtkSetFontBlur 17
-#define gtkSetFontTextScale 18
-#define gtkSetFontOSDScale 19
-#define gtkSetFontEncoding 20
-#define gtkSetFontAutoScale 21
-#define gtkSetSubEncoding 22
-#define gtkDelCurrPlItem 23
-#define gtkInsertPlItem 24
-#define gtkSetCurrPlItem 25
-
-extern float gtkEquChannels[6][10];
-
-void * gtkSet( int cmd, float param, void * vparam );
-
-char * gstrdup( const char * str );
-int gstrcmp( const char * a, const char * b );
-void gfree( void ** p );
-void gaddlist( char *** list, const char * entry );
-char * gstrchr( char * str, int c );
-
-#define guiSetFilename( s,n ) { gfree( (void **)&s ); s=gstrdup( n ); }
-
-#define guiSetDF( s,d,n ) \
- { \
- gfree( (void **)&s ); \
- s=malloc( strlen( d ) + strlen( n ) + 5 ); \
- sprintf( s,"%s/%s",d,n ); \
- }
-
-#endif /* MPLAYER_GUI_INTERFACE_H */
diff --git a/gui/mplayer/gmplayer.h b/gui/mplayer/gmplayer.h
deleted file mode 100644
index 636e6ab570..0000000000
--- a/gui/mplayer/gmplayer.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * 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_GUI_GMPLAYER_H
-#define MPLAYER_GUI_GMPLAYER_H
-
-extern int mplSubRender;
-extern int mplMainRender;
-
-extern unsigned char * mplDrawBuffer;
-extern unsigned char * mplMenuDrawBuffer;
-extern int mainVisible;
-
-extern int mplMainAutoPlay;
-extern int mplMiddleMenu;
-
-void mplInit( void * disp );
-
-void mplMainDraw( void );
-void mplEventHandling( int msg, float param );
-void mplMainMouseHandle( int Button, int X, int Y, int RX, int RY );
-void mplMainKeyHandle( int KeyCode, int Type, int Key );
-void mplDandDHandler(int num, char** files);
-
-void mplSubDraw( void );
-void mplSubMouseHandle( int Button, int X, int Y, int RX, int RY );
-
-void mplMenuInit( void );
-void mplHideMenu( int mx, int my, int w );
-void mplShowMenu( int mx, int my );
-void mplMenuMouseHandle( int X, int Y, int RX, int RY );
-
-void mplPBInit( void );
-void mplPBShow( int x, int y );
-
-#endif /* MPLAYER_GUI_GMPLAYER_H */
diff --git a/gui/mplayer/gtk/about.c b/gui/mplayer/gtk/about.c
deleted file mode 100644
index ea3adf0717..0000000000
--- a/gui/mplayer/gtk/about.c
+++ /dev/null
@@ -1,346 +0,0 @@
-/*
- * 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.
- */
-
-#include "config.h"
-#include "gui/app.h"
-#include "help_mp.h"
-
-#include "gui/mplayer/pixmaps/about.xpm"
-#include "gui/mplayer/widgets.h"
-#include "about.h"
-#include "gtk_common.h"
-
-GtkWidget * About = NULL;
-
-void ShowAboutBox( void )
-{
- if ( About ) gtkActive( About );
- else About=create_About();
- gtk_widget_show( About );
-}
-
-void abWidgetDestroy( GtkWidget * widget,GtkWidget ** widget_pointer )
-{ WidgetDestroy( NULL,&About ); }
-
-GtkWidget * create_About( void )
-{
- GtkWidget * vbox;
- GtkWidget * pixmap1;
- GtkWidget * scrolledwindow1;
- GtkWidget * AboutText;
- GtkWidget * Ok;
-
-#ifdef CONFIG_GTK2
- GtkTextBuffer * AboutTextBuffer;
- GtkTextIter iter;
-#endif /* CONFIG_GTK2 */
-
- GtkStyle * pixmapstyle;
- GdkPixmap * pixmapwid;
- GdkBitmap * mask;
-
- GtkAccelGroup * accel_group;
-
- accel_group=gtk_accel_group_new();
-
- About=gtk_window_new( GTK_WINDOW_TOPLEVEL );
- gtk_widget_set_name( About,MSGTR_About );
- gtk_object_set_data( GTK_OBJECT( About ),MSGTR_About,About );
- gtk_widget_set_usize( About,340,415 );
- gtk_window_set_title( GTK_WINDOW( About ),MSGTR_About );
- gtk_window_set_position( GTK_WINDOW( About ),GTK_WIN_POS_CENTER );
- gtk_window_set_policy( GTK_WINDOW( About ),TRUE,FALSE,FALSE );
- gtk_window_set_wmclass( GTK_WINDOW( About ),"About","MPlayer" );
-
- gtk_widget_realize( About );
- gtkAddIcon( About );
-
- vbox=AddVBox( AddDialogFrame( About ),0 );
-
- pixmapstyle=gtk_widget_get_style( About );
- pixmapwid=gdk_pixmap_colormap_create_from_xpm_d( About->window,gdk_colormap_get_system(),&mask,&pixmapstyle->bg[GTK_STATE_NORMAL],about_xpm );
- pixmap1=gtk_pixmap_new( pixmapwid,mask );
-
- gtk_widget_set_name( pixmap1,"pixmap1" );
- gtk_widget_show( pixmap1 );
- gtk_box_pack_start( GTK_BOX( vbox ),pixmap1,FALSE,FALSE,0 );
- gtk_widget_set_usize( pixmap1,-2,174 );
-
- AddHSeparator( vbox );
-
- scrolledwindow1=gtk_scrolled_window_new( NULL,NULL );
- gtk_widget_set_name( scrolledwindow1,"scrolledwindow1" );
- gtk_widget_show( scrolledwindow1 );
- gtk_box_pack_start( GTK_BOX( vbox ),scrolledwindow1,TRUE,TRUE,0 );
- gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW( scrolledwindow1 ),GTK_POLICY_AUTOMATIC,GTK_POLICY_AUTOMATIC );
-
-#ifdef CONFIG_GTK2
- AboutText = gtk_text_view_new();
- gtk_text_view_set_editable(GTK_TEXT_VIEW(AboutText), FALSE);
- gtk_text_view_set_cursor_visible(GTK_TEXT_VIEW(AboutText), FALSE);
- AboutTextBuffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (AboutText));
- gtk_text_buffer_get_iter_at_offset (AboutTextBuffer, &iter, 0);
-#else
- AboutText=gtk_text_new( NULL,NULL );
- gtk_text_set_editable(GTK_TEXT(AboutText), FALSE);
-#endif
- gtk_widget_set_name( AboutText,"AboutText" );
- gtk_widget_show( AboutText );
- gtk_container_add( GTK_CONTAINER( scrolledwindow1 ),AboutText );
-#ifdef CONFIG_GTK2
- gtk_text_buffer_insert (AboutTextBuffer, &iter,
-#else
- gtk_text_insert( GTK_TEXT( AboutText ),NULL,NULL,NULL,
-#endif
- "\n"
- MSGTR_ABOUT_UHU
- " (http://www.uhulinux.hu/)\n"
- "\n"
- MSGTR_ABOUT_Contributors
- "\n"
- " * Ackermann, Andreas\n"
- " * adland\n"
- " * Anholt, Eric\n"
- " * Ashberg, Folke\n"
- " * Balatoni, Dénes\n"
- " * Barat, Zsolt\n"
- " * Barbato, Luca\n"
- " * Baryshkov, Dmitry\n"
- " * Baudet, Bertrand\n"
- " * Bedel, Alban\n"
- " * Behrisch, Michael\n"
- " * Belev, Luchezar\n"
- " * Bérczi, Gábor\n"
- " * Berecz, Szabolcs\n"
- " * Beregszászi, Alex\n"
- " * Bitterberg, Tilmann\n"
- " * Biurrun, Diego\n"
- " * Blomenkamp, Marcsu\n"
- " * Buehler, Andrew\n"
- " * Bulgroz, Eviv\n"
- " * Bünemann, Felix\n"
- " * Bunkus, Moritz\n"
- " * Christiansen, Dan Villiom Podlaski\n"
- " * Clagg, Jeff\n"
- " * Compn\n"
- " * Comstedt, Marcus\n"
- " * Cook, Kees\n"
- " * Davies, Stephen\n"
- " * Di Vita, Piero\n"
- " * Diedrich, Tobias\n"
- " * Dietrich, Florian\n"
- " * Dobbelaere, Jeroen\n"
- " * Döffinger, Reimar\n"
- " * Dolbeau, Romain\n"
- " * Dönmez, Ismail\n"
- " * Edele, Robert\n"
- " * Egger, Christoph\n"
- " * Elsinghorst, Paul Wilhelm\n"
- " * Ernesti, Bernd\n"
- " * Falco, Salvatore\n"
- " * Feigl, Johannes\n"
- " * Felker, D Richard III\n"
- " * Ferguson, Tim\n"
- " * Finlayson, Ross\n"
- " * Forghieri, Daniele\n"
- " * Foth, Kilian A.\n"
- " * Franz, Fabian\n"
- " * Gansser, Martin\n"
- " * Gereöffy, Ãrpád\n"
- " * Giani, Matteo\n"
- " * Goethel, Sven\n"
- " * Gomez Garcia, German\n"
- " * Gottwald, Alexander\n"
- " * Graffam, Michael\n"
- " * Gritsenko, Andriy N.\n"
- " * Guyomarch, Rémi\n"
- " * Hammelmann, Jürgen\n"
- " * Hertel, Christopher R.\n"
- " * Hess, Andreas\n"
- " * Hickey, Corey\n"
- " * Hidvégi, Zoltán\n"
- " * Hoffmann, Jens\n"
- " * Holm, David\n"
- " * Horst, Bohdan\n"
- " * Hug, Hampa\n"
- " * Hurka, Tomas\n"
- " * Isani, Sidik\n"
- " * Issaris, Panagiotis\n"
- " * Jacobs, Aurelien\n"
- " * Jelveh, Reza\n"
- " * Jermann, Jonas\n"
- " * Johansson, Anders\n"
- " * Kain, Nicholas\n"
- " * Kalinski, Filip\n"
- " * Kalvachev, Ivan\n"
- " * Kaniewski, Wojtek\n"
- " * Kaplan, Kim Minh\n"
- " * Kärkkäinen, Samuli\n"
- " * Keil, Jürgen\n"
- " * Kesterson, Robert\n"
- " * Kinali, Attila\n"
- " * Kovriga, Gregory\n"
- " * Kühling, David\n"
- " * Kuivinen, Fredrik\n"
- " * Kurshev, Nick\n"
- " * Kuschak, Brian\n"
- " * Kushnir, Vladimir\n"
- " * Lambley, Dave\n"
- " * László, Gyula\n"
- " * Le Gaillart, Nicolas\n"
- " * Lénárt, Gábor\n"
- " * Leroy, Colin\n"
- " * Liljeblad, Oskar\n"
- " * Lin, Sam\n"
- " * Lombard, Pierre\n"
- " * Madick, Puk\n"
- " * Makovicka, Jindrich\n"
- " * Marek, Rudolf\n"
- " * Megyer, László\n"
- " * Melanson, Mike\n"
- " * von Merkatz, Arwed\n"
- " * Merritt, Loren\n"
- " * Mierzejewski, Dominik\n"
- " * Milushev, Mihail\n"
- " * Mistry, Nehal\n"
- " * Mohari, András\n"
- " * Mueller, Steven\n"
- " * Neundorf, Alexander\n"
- " * Niedermayer, Michael\n"
- " * Noring, Fredrik\n"
- " * Ohm, Christian\n"
- " * Parrish, Joey\n"
- " * Pietrzak, Dariusz\n"
- " * Plourde, Nicolas\n"
- " * Poettering, Lennart\n"
- " * Poirier, Guillaume\n"
- " * Ponekker, Zoltán\n"
- " * van Poorten, Ivo\n"
- " * Ran, Lu\n"
- " * Reder, Uwe\n"
- " * rgselk\n"
- " * Rune Petersen\n"
- " * Saari, Ville\n"
- " * Sabbi, Nico\n"
- " * Sandell, Björn\n"
- " * Sauerbeck, Tilman\n"
- " * Scherthan, Frank\n"
- " * Schneider, Florian\n"
- " * Schoenbrunner, Oliver\n"
- " * Shimon, Oded\n"
- " * Simon, Peter\n"
- " * Snel, Rik\n"
- " * Sommer, Sascha\n"
- " * Strasser, Alexander\n"
- " * Strzelecki, Kamil\n"
- " * Svoboda, Jiri\n"
- " * Swain, Robert\n"
- " * Syrjälä, Ville\n"
- " * Szecsi, Gabor\n"
- " * Tackaberry, Jason\n"
- " * Tam, Howell\n"
- " * Tlalka, Adam\n"
- " * Tiesi, Gianluigi\n"
- " * Togni, Roberto\n"
- " * Tropea, Salvador Eduardo\n"
- " * Vajna, Miklós\n"
- " * Verdejo Pinochet, Reynaldo H.\n"
- " * Wigren, Per\n"
- " * Witt, Derek J\n"
- " * Young, Alan\n"
- " * Zaprzala, Artur\n"
- " * Zealey, Mark\n"
- " * Ziv-Av, Matan\n"
- " * Zoltán, Márk Vicián\n"
- "\n"
- MSGTR_ABOUT_Codecs_libs_contributions
- "\n"
- " * Bellard, Fabrice\n"
- " * Chappelier, Vivien and Vincent, Damien\n"
- " * Hipp, Michael\n"
- " * Holtzman, Aaron\n"
- " * Janovetz, Jake\n"
- " * Kabelac, Zdenek\n"
- " * Kuznetsov, Eugene\n"
- " * Lespinasse, Michel\n"
- " * Podlipec, Mark\n"
- "\n"
- MSGTR_ABOUT_Translations
- "\n"
- " * Biernat, Marcin\n"
- " * Fargas, Marc\n"
- " * Heryan, Jiri\n"
- " * Jarycki, Marek\n"
- " * Kaplita, Leszek\n"
- " * Krämer, Sebastian\n"
- " * López, Juan Martin\n"
- " * Michniewski, Piotr\n"
- " * Misiorny, Jakub\n"
- " * Mizda, Gábor\n"
- " * Paszta, Maciej\n"
- " * Proszek, Åukasz\n"
- " * Schiller, Wacław\n"
- " * Zubimendi, Andoni\n"
- "\n"
- MSGTR_ABOUT_Skins
- "\n"
- " * Azrael\n"
- " * Bekesi, Viktor\n"
- " * Burt.S.\n"
- " * Carpenter, Andrew\n"
- " * Foucault, Charles\n"
- " * Gyimesi, Attila\n"
- " * Hertroys, Alban\n"
- " * Juan Pablo\n"
- " * Kiss, Balint\n"
- " * Kuehne, Andre\n"
- " * Kuhlmann, Rüdiger\n"
- " * Naumov, Dan\n"
- " * Northam, Ryan\n"
- " * Oyarzun Arroyo\n"
- " * Park, DongCheon\n"
- " * Pehrson, Jurgen\n"
- " * Pizurica, Nikola\n"
- " * Ptak, Oliwier\n"
- " * Riccio, Pasquale\n"
- " * Schultz, Jesper\n"
- " * Szumiela, Marcin\n"
- " * Tisi, Massimo\n"
- " * Tyr, Jiri jun.\n"
- " * Vasilev, Ognian\n"
- " * Veres, Imre\n"
- " * Vesko, Radic\n"
- " * Vigvary, Balasz\n"
- " * Weber, Andrew\n"
- " * Whitmore, Gary Jr.\n"
- " * Wilamowski, Franciszek\n"
- " * Zeising, Michael\n"
- "\n",-1 );
-
- AddHSeparator( vbox );
- Ok=AddButton( MSGTR_Ok,AddHButtonBox( vbox ) );
-
- gtk_signal_connect( GTK_OBJECT( About ),"destroy",GTK_SIGNAL_FUNC( WidgetDestroy ),&About );
- gtk_signal_connect_object( GTK_OBJECT( Ok ),"clicked",GTK_SIGNAL_FUNC( abWidgetDestroy ),NULL );
-
- gtk_widget_add_accelerator( Ok,"clicked",accel_group,GDK_Escape,0,GTK_ACCEL_VISIBLE );
- gtk_widget_add_accelerator( Ok,"clicked",accel_group,GDK_Return,0,GTK_ACCEL_VISIBLE );
- gtk_window_add_accel_group( GTK_WINDOW( About ),accel_group );
-
- return About;
-}
diff --git a/gui/mplayer/gtk/about.h b/gui/mplayer/gtk/about.h
deleted file mode 100644
index 68997ac51b..0000000000
--- a/gui/mplayer/gtk/about.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * 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_GUI_ABOUT_H
-#define MPLAYER_GUI_ABOUT_H
-
-#include <gtk/gtk.h>
-
-extern GtkWidget * About;
-
-GtkWidget * create_About( void );
-void ShowAboutBox( void );
-
-#endif /* MPLAYER_GUI_ABOUT_H */
diff --git a/gui/mplayer/gtk/eq.c b/gui/mplayer/gtk/eq.c
deleted file mode 100644
index a344e741ab..0000000000
--- a/gui/mplayer/gtk/eq.c
+++ /dev/null
@@ -1,691 +0,0 @@
-/*
- * 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.
- */
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <unistd.h>
-#include <string.h>
-
-#include <gdk/gdkkeysyms.h>
-#include <gtk/gtk.h>
-
-#include "config.h"
-#include "gui/app.h"
-#include "gui/cfg.h"
-#include "help_mp.h"
-#include "libaf/equalizer.h"
-#include "libvo/video_out.h"
-#include "stream/stream.h"
-#include "libmpdemux/demuxer.h"
-#include "libmpdemux/stheader.h"
-#include "libmpcodecs/dec_video.h"
-#include "gui/mplayer/widgets.h"
-
-#include "eq.h"
-#include "gtk_common.h"
-
-#define eqRange 15
-
-GtkWidget * Equalizer = NULL;
-static GtkWidget * EquConfig;
-
-static GtkWidget * Notebook;
-static GtkWidget * ChannelsList;
-static GtkWidget * VContrast, * VBrightness, * VHue, * VSaturation;
-static GtkAdjustment * VContrastadj, * VBrightnessadj, * VHueadj, * VSaturationadj;
-static GtkWidget * Ok, * Clear, * Config;
-static GtkWidget * A3125, * A125, * A6250, * A250, * A500, * A1000, * A2000, * A4000, * A8000, * A16000;
-static GtkAdjustment * A3125adj, * A125adj, * A6250adj, * A250adj, * A500adj, * A1000adj, * A2000adj, * A4000adj, * A8000adj, * A16000adj;
-
-static int Channel = -1;
-
-// ---
-
-char * gtkEquChannel1 = NULL;
-char * gtkEquChannel2 = NULL;
-char * gtkEquChannel3 = NULL;
-char * gtkEquChannel4 = NULL;
-char * gtkEquChannel5 = NULL;
-char * gtkEquChannel6 = NULL;
-
-// ---
-
-void ShowEquConfig( void );
-void HideEquConfig( void );
-
-static void eqSetBands( int channel )
-{
- if ( channel < 0 ) channel=0;
- gtk_adjustment_set_value( A3125adj,0.0f - gtkEquChannels[channel][0] );
- gtk_adjustment_set_value( A6250adj,0.0f - gtkEquChannels[channel][1] );
- gtk_adjustment_set_value( A125adj,0.0f - gtkEquChannels[channel][2] );
- gtk_adjustment_set_value( A250adj,0.0f - gtkEquChannels[channel][3] );
- gtk_adjustment_set_value( A500adj,0.0f - gtkEquChannels[channel][4] );
- gtk_adjustment_set_value( A1000adj,0.0f - gtkEquChannels[channel][5] );
- gtk_adjustment_set_value( A2000adj,0.0f - gtkEquChannels[channel][6] );
- gtk_adjustment_set_value( A4000adj,0.0f - gtkEquChannels[channel][7] );
- gtk_adjustment_set_value( A8000adj,0.0f - gtkEquChannels[channel][8] );
- gtk_adjustment_set_value( A16000adj,0.0f - gtkEquChannels[channel][9] );
-
- if ( guiIntfStruct.sh_video )
- {
- get_video_colors( guiIntfStruct.sh_video,"brightness",&vo_gamma_brightness );
- get_video_colors( guiIntfStruct.sh_video,"contrast",&vo_gamma_contrast );
- get_video_colors( guiIntfStruct.sh_video,"hue",&vo_gamma_hue );
- get_video_colors( guiIntfStruct.sh_video,"saturation",&vo_gamma_saturation );
- }
-
- gtk_adjustment_set_value( VContrastadj,(float)vo_gamma_contrast );
- gtk_adjustment_set_value( VBrightnessadj,(float)vo_gamma_brightness );
- gtk_adjustment_set_value( VHueadj,(float)vo_gamma_hue );
- gtk_adjustment_set_value( VSaturationadj,(float)vo_gamma_saturation );
-}
-
-static void eqSetChannelNames( void )
-{
- gchar * str[2];
- gtk_clist_clear( GTK_CLIST( ChannelsList ) );
- str[1]="";
- str[0]=MSGTR_EQU_All;
- gtk_clist_append( GTK_CLIST( ChannelsList ) ,str);
- if ( guiIntfStruct.AudioType > 1 )
- {
- str[0]=gtkEquChannel1; gtk_clist_append( GTK_CLIST( ChannelsList ) ,str);
- str[0]=gtkEquChannel2; gtk_clist_append( GTK_CLIST( ChannelsList ) ,str);
- }
- if ( guiIntfStruct.AudioType > 2 )
- {
- str[0]=gtkEquChannel3; gtk_clist_append( GTK_CLIST( ChannelsList ) ,str);
- str[0]=gtkEquChannel4; gtk_clist_append( GTK_CLIST( ChannelsList ) ,str);
- }
- if ( guiIntfStruct.AudioType > 4 )
- {
- str[0]=gtkEquChannel5; gtk_clist_append( GTK_CLIST( ChannelsList ) ,str);
- str[0]=gtkEquChannel6; gtk_clist_append( GTK_CLIST( ChannelsList ) ,str);
- }
- gtk_clist_select_row( GTK_CLIST( ChannelsList ),0,0 );
-}
-
-void ShowEqualizer( void )
-{
- if ( Equalizer ) gtkActive( Equalizer );
- else Equalizer=create_Equalizer();
-
- if ( !gtkEquChannel1 ) gtkEquChannel1=strdup( MSGTR_EQU_Front_Right );
- if ( !gtkEquChannel2 ) gtkEquChannel2=strdup( MSGTR_EQU_Front_Left );
- if ( !gtkEquChannel3 ) gtkEquChannel3=strdup( MSGTR_EQU_Back_Right );
- if ( !gtkEquChannel4 ) gtkEquChannel4=strdup( MSGTR_EQU_Back_Left );
- if ( !gtkEquChannel5 ) gtkEquChannel5=strdup( MSGTR_EQU_Center );
- if ( !gtkEquChannel6 ) gtkEquChannel6=strdup( MSGTR_EQU_Bass );
-
- eqSetChannelNames();
-
- if ( !guiIntfStruct.Playing || !guiIntfStruct.sh_video )
- {
- gtk_widget_set_sensitive( VContrast,FALSE );
- gtk_widget_set_sensitive( VBrightness,FALSE );
- gtk_widget_set_sensitive( VHue,FALSE );
- gtk_widget_set_sensitive( VSaturation,FALSE );
- }
- Channel=-1;
- eqSetBands( 0 );
- if ( !guiIntfStruct.Playing || !gtkEnableAudioEqualizer )
- {
- gtk_widget_set_sensitive( ChannelsList,FALSE );
- gtk_widget_set_sensitive( A3125,FALSE );
- gtk_widget_set_sensitive( A125,FALSE );
- gtk_widget_set_sensitive( A6250,FALSE );
- gtk_widget_set_sensitive( A250,FALSE );
- gtk_widget_set_sensitive( A500,FALSE );
- gtk_widget_set_sensitive( A1000,FALSE );
- gtk_widget_set_sensitive( A2000,FALSE );
- gtk_widget_set_sensitive( A4000,FALSE );
- gtk_widget_set_sensitive( A8000,FALSE );
- gtk_widget_set_sensitive( A16000,FALSE );
- }
-
- if ( gtk_notebook_get_current_page( GTK_NOTEBOOK( Notebook ) ) == 0 ) gtk_widget_show( Config );
- gtk_widget_show( Equalizer );
-}
-
-void HideEqualizer( void )
-{
- if ( !Equalizer ) return;
- gtk_widget_hide( Equalizer );
- gtk_widget_destroy( Equalizer );
- Equalizer=NULL;
- if ( EquConfig ) HideEquConfig();
-}
-
-static gboolean eqHScaleMotion( GtkWidget * widget,GdkEventMotion * event,gpointer user_data )
-{
- equalizer_t eq;
- switch ( (int)user_data )
- {
- case 0: eq.gain=A3125adj->value; break;
- case 1: eq.gain=A6250adj->value; break;
- case 2: eq.gain=A125adj->value; break;
- case 3: eq.gain=A250adj->value; break;
- case 4: eq.gain=A500adj->value; break;
- case 5: eq.gain=A1000adj->value; break;
- case 6: eq.gain=A2000adj->value; break;
- case 7: eq.gain=A4000adj->value; break;
- case 8: eq.gain=A8000adj->value; break;
- case 9: eq.gain=A16000adj->value; break;
- default: return FALSE;
- }
- eq.gain=0.0f - eq.gain;
- eq.band=(int)user_data;
- if ( Channel == -1 )
- {
- int i;
- for ( i=0;i<6;i++ )
- { eq.channel=i; gtkSet( gtkSetEqualizer,0,&eq ); }
- } else { eq.channel=Channel; gtkSet( gtkSetEqualizer,0,&eq ); }
-
- return FALSE;
-}
-
-static gboolean eqVScaleMotion( GtkWidget * widget,GdkEventMotion * event,gpointer user_data )
-{
-
- switch( (int)user_data )
- {
- case 1: gtkSet( gtkSetContrast,VContrastadj->value,NULL ); break;
- case 2: gtkSet( gtkSetBrightness,VBrightnessadj->value,NULL ); break;
- case 3: gtkSet( gtkSetHue,VHueadj->value,NULL ); break;
- case 4: gtkSet( gtkSetSaturation,VSaturationadj->value,NULL ); break;
- }
-
- return FALSE;
-}
-
-static void eqButtonReleased( GtkButton * button,gpointer user_data )
-{
- switch( (int)user_data )
- {
- case 0: HideEqualizer(); break;
- case 1:
- if ( gtk_notebook_get_current_page( GTK_NOTEBOOK( Notebook ) ) == 0 )
- {
- if ( !guiIntfStruct.Playing || !gtkEnableAudioEqualizer ) break;
- gtkSet( gtkSetEqualizer,0,NULL );
- eqSetBands( Channel );
- }
- else
- {
- if ( !guiIntfStruct.Playing ) break;
- gtkSet( gtkSetContrast,0.0f,NULL );
- gtkSet( gtkSetBrightness,0.0f,NULL );
- gtkSet( gtkSetHue,0.0f,NULL );
- gtkSet( gtkSetSaturation,0.0f,NULL );
- eqSetBands( Channel );
- }
- break;
- case 2:
- ShowEquConfig();
- break;
- }
-}
-
-static void eqFocus( GtkWindow * window,GtkWidget * widget,gpointer user_data )
-{ eqSetBands( Channel ); }
-
-static void eqSelectChannelsListRow( GtkCList * clist,gint row,gint column,GdkEvent * event,gpointer user_data )
-{
- Channel=row - 1;
- eqSetBands( Channel );
- if ( Channel == -1 )
- {
- int i,j; equalizer_t eq;
- for ( i=1;i<6;i++ )
- for ( j=0;j<10;j++ )
- { eq.band=j; eq.channel=i; eq.gain=gtkEquChannels[0][j]; gtkSet( gtkSetEqualizer,0,&eq ); }
- }
-}
-
-void eqNotebook( GtkNotebook * notebook,GtkNotebookPage * page,gint page_num,gpointer user_data )
-{
- if ( page_num ) gtk_widget_hide( Config );
- else gtk_widget_show( Config );
-}
-
-GtkWidget * create_Equalizer( void )
-{
- GtkWidget * vbox1;
- GtkWidget * hbox1;
- GtkWidget * scrolledwindow1;
- GtkWidget * table1;
- GtkWidget * hbuttonbox1;
- GtkAccelGroup * accel_group;
-
- accel_group=gtk_accel_group_new();
-
- Equalizer=gtk_window_new( GTK_WINDOW_TOPLEVEL );
- gtk_widget_set_name( Equalizer,MSGTR_Equalizer );
- gtk_object_set_data( GTK_OBJECT( Equalizer ),MSGTR_Equalizer,Equalizer );
- gtk_widget_set_usize( Equalizer,-1,256 );
- gtk_window_set_title( GTK_WINDOW( Equalizer ),MSGTR_Equalizer );
- gtk_window_set_position( GTK_WINDOW( Equalizer ),GTK_WIN_POS_CENTER );
- gtk_window_set_policy( GTK_WINDOW( Equalizer ),FALSE,FALSE,FALSE );
- gtk_window_set_wmclass( GTK_WINDOW( Equalizer ),"Equalizer","MPlayer" );
-
- gtk_widget_realize( Equalizer );
- gtkAddIcon( Equalizer );
-
- vbox1=AddVBox( AddDialogFrame( Equalizer ),0 );
-
- Notebook=gtk_notebook_new();
- gtk_widget_set_name( Notebook,"Notebook" );
- gtk_widget_show( Notebook );
- gtk_box_pack_start( GTK_BOX( vbox1 ),Notebook,TRUE,TRUE,0 );
- gtk_container_set_border_width( GTK_CONTAINER( Notebook ),1 );
-
- hbox1=AddHBox( Notebook,0 );
-
- scrolledwindow1=gtk_scrolled_window_new( NULL,NULL );
- gtk_widget_set_name( scrolledwindow1,"scrolledwindow1" );
- gtk_widget_show( scrolledwindow1 );
- gtk_box_pack_start( GTK_BOX( hbox1 ),scrolledwindow1,FALSE,FALSE,0 );
- gtk_widget_set_usize( scrolledwindow1,106,-2 );
- gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW( scrolledwindow1 ),GTK_POLICY_AUTOMATIC,GTK_POLICY_AUTOMATIC );
-
- ChannelsList=gtk_clist_new( 1 );
- gtk_widget_set_name( ChannelsList,"ChannelsList" );
- gtk_widget_show( ChannelsList );
- gtk_container_add( GTK_CONTAINER( scrolledwindow1 ),ChannelsList );
- gtk_clist_set_column_width( GTK_CLIST( ChannelsList ),0,80 );
- gtk_clist_column_titles_hide( GTK_CLIST( ChannelsList ) );
-
- table1=gtk_table_new( 2,10,FALSE );
- gtk_widget_set_name( table1,"table1" );
- gtk_widget_show( table1 );
- gtk_box_pack_start( GTK_BOX( hbox1 ),table1,FALSE,FALSE,0 );
- gtk_table_set_row_spacings( GTK_TABLE( table1 ),4 );
- gtk_table_set_col_spacings( GTK_TABLE( table1 ),9 );
-
- A3125adj=GTK_ADJUSTMENT( gtk_adjustment_new( 0,-eqRange,eqRange,0.5,0,0 ) );
- A3125=AddVScaler( A3125adj,NULL,-1 );
- gtk_table_attach( GTK_TABLE( table1 ),A3125,0,1,0,1,(GtkAttachOptions)( GTK_FILL ),(GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),0,0 );
-
- A6250adj=GTK_ADJUSTMENT( gtk_adjustment_new( 0,-eqRange,eqRange,0.5,0,0 ) );
- A6250=AddVScaler( A6250adj,NULL,-1 );
- gtk_table_attach( GTK_TABLE( table1 ),A6250,1,2,0,1,(GtkAttachOptions)( GTK_FILL ),(GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),0,0 );
-
- A125adj=GTK_ADJUSTMENT( gtk_adjustment_new( 0,-eqRange,eqRange,0.5,0,0 ) );
- A125=AddVScaler( A125adj,NULL,-1 );
- gtk_table_attach( GTK_TABLE( table1 ),A125,2,3,0,1,(GtkAttachOptions)( GTK_FILL ),(GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),0,0 );
-
- A250adj=GTK_ADJUSTMENT( gtk_adjustment_new( 0,-eqRange,eqRange,0.5,0,0 ) );
- A250=AddVScaler( A250adj,NULL,-1 );
- gtk_table_attach( GTK_TABLE( table1 ),A250,3,4,0,1,(GtkAttachOptions)( GTK_FILL ),(GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),0,0 );
-
- A500adj=GTK_ADJUSTMENT( gtk_adjustment_new( 0,-eqRange,eqRange,0.5,0,0 ) );
- A500=AddVScaler( A500adj,NULL,-1 );
- gtk_table_attach( GTK_TABLE( table1 ),A500,4,5,0,1,(GtkAttachOptions)( GTK_FILL ),(GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),0,0 );
-
- A1000adj=GTK_ADJUSTMENT( gtk_adjustment_new( 0,-eqRange,eqRange,0.5,0,0 ) );
- A1000=AddVScaler( A1000adj,NULL,-1 );
- gtk_table_attach( GTK_TABLE( table1 ),A1000,5,6,0,1,(GtkAttachOptions)( GTK_FILL ),(GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),0,0 );
-
- A2000adj=GTK_ADJUSTMENT( gtk_adjustment_new( 0,-eqRange,eqRange,0.5,0,0 ) );
- A2000=AddVScaler( A2000adj,NULL,-1 );
- gtk_table_attach( GTK_TABLE( table1 ),A2000,6,7,0,1,(GtkAttachOptions)( GTK_FILL ),(GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),0,0 );
-
- A4000adj=GTK_ADJUSTMENT( gtk_adjustment_new( 0,-eqRange,eqRange,0.5,0,0 ) );
- A4000=AddVScaler( A4000adj,NULL,-1 );
- gtk_table_attach( GTK_TABLE( table1 ),A4000,7,8,0,1,(GtkAttachOptions)( GTK_FILL ),(GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),0,0 );
-
- A8000adj=GTK_ADJUSTMENT( gtk_adjustment_new( 0,-eqRange,eqRange,0.5,0,0 ) );
- A8000=AddVScaler( A8000adj,NULL,-1 );
- gtk_table_attach( GTK_TABLE( table1 ),A8000,8,9,0,1,(GtkAttachOptions)( GTK_FILL ),(GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),0,0 );
-
- A16000adj=GTK_ADJUSTMENT( gtk_adjustment_new( 0,-eqRange,eqRange,0.5,0,0 ) );
- A16000=AddVScaler( A16000adj,NULL,-1 );
- gtk_table_attach( GTK_TABLE( table1 ),A16000,9,10,0,1,(GtkAttachOptions)( GTK_FILL ),(GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),0,0 );
-
- gtk_table_attach( GTK_TABLE( table1 ),
- AddLabel( "31.25",NULL ),
- 0,1,1,2,(GtkAttachOptions)( GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 );
-
- gtk_table_attach( GTK_TABLE( table1 ),
- AddLabel( "62.50",NULL ),
- 1,2,1,2,(GtkAttachOptions)( GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 );
-
- gtk_table_attach( GTK_TABLE( table1 ),
- AddLabel( "125",NULL ),
- 2,3,1,2,(GtkAttachOptions)( GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 );
-
- gtk_table_attach( GTK_TABLE( table1 ),
- AddLabel( "250",NULL ),
- 3,4,1,2,(GtkAttachOptions)( GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 );
-
- gtk_table_attach( GTK_TABLE( table1 ),
- AddLabel( "500",NULL ),
- 4,5,1,2,(GtkAttachOptions)( GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 );
-
- gtk_table_attach( GTK_TABLE( table1 ),
- AddLabel( "1000",NULL ),
- 5,6,1,2,(GtkAttachOptions)( GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 );
-
- gtk_table_attach( GTK_TABLE( table1 ),
- AddLabel( "2000",NULL ),
- 6,7,1,2,(GtkAttachOptions)( GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 );
-
- gtk_table_attach( GTK_TABLE( table1 ),
- AddLabel( "4000",NULL ),
- 7,8,1,2,(GtkAttachOptions)( GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 );
-
- gtk_table_attach( GTK_TABLE( table1 ),
- AddLabel( "8000",NULL ),
- 8,9,1,2,(GtkAttachOptions)( GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 );
-
- gtk_table_attach( GTK_TABLE( table1 ),
- AddLabel( "16000",NULL ),
- 9,10,1,2,(GtkAttachOptions)( GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 );
-
- gtk_notebook_set_tab_label( GTK_NOTEBOOK( Notebook ),gtk_notebook_get_nth_page( GTK_NOTEBOOK( Notebook ),0 ),
- AddLabel( MSGTR_EQU_Audio,NULL ) );
-
- table1=gtk_table_new( 4,2,FALSE );
- gtk_widget_set_name( table1,"table1" );
- gtk_widget_show( table1 );
- gtk_container_add( GTK_CONTAINER( Notebook ),table1 );
-
- gtk_table_attach( GTK_TABLE( table1 ),
- AddLabel( MSGTR_EQU_Contrast,NULL ),
- 0,1,0,1,(GtkAttachOptions)( GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 );
-
- gtk_table_attach( GTK_TABLE( table1 ),
- AddLabel( MSGTR_EQU_Brightness,NULL ),
- 0,1,1,2,(GtkAttachOptions)( GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 );
-
- gtk_table_attach( GTK_TABLE( table1 ),
- AddLabel( MSGTR_EQU_Hue,NULL ),
- 0,1,2,3,(GtkAttachOptions)( GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 );
-
- gtk_table_attach( GTK_TABLE( table1 ),
- AddLabel( MSGTR_EQU_Saturation,NULL ),
- 0,1,3,4,(GtkAttachOptions)( GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 );
-
- VContrastadj=GTK_ADJUSTMENT( gtk_adjustment_new( 0,-100,100,1,0,0 ) );
- VContrast=AddHScaler( VContrastadj,NULL,1 );
- gtk_table_attach( GTK_TABLE( table1 ),VContrast,1,2,0,1,(GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 );
- gtk_widget_set_usize( VContrast,-1,45 );
-
- VBrightnessadj=GTK_ADJUSTMENT( gtk_adjustment_new( 0,-100,100,1,0,0 ) );
- VBrightness=AddHScaler( VBrightnessadj,NULL,1 );
- gtk_table_attach( GTK_TABLE( table1 ),VBrightness,1,2,1,2,(GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 );
- gtk_widget_set_usize( VBrightness,-1,45 );
-
- VHueadj=GTK_ADJUSTMENT( gtk_adjustment_new( 0,-100,100,1,0,0 ) );
- VHue=AddHScaler( VHueadj,NULL,1 );
- gtk_table_attach( GTK_TABLE( table1 ),VHue,1,2,2,3,(GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 );
- gtk_widget_set_usize( VHue,-1,45 );
-
- VSaturationadj=GTK_ADJUSTMENT( gtk_adjustment_new( 0,-100,100,1,0,0 ) );
- VSaturation=AddHScaler( VSaturationadj,NULL,1 );
- gtk_table_attach( GTK_TABLE( table1 ),VSaturation,1,2,3,4,(GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 );
- gtk_widget_set_usize( VSaturation,-1,45 );
-
- gtk_notebook_set_tab_label( GTK_NOTEBOOK( Notebook ),gtk_notebook_get_nth_page( GTK_NOTEBOOK( Notebook ),1 ),
- AddLabel( MSGTR_EQU_Video,NULL ) );
-
- AddHSeparator( vbox1 );
-
- hbuttonbox1=AddHButtonBox( vbox1 );
- gtk_button_box_set_layout( GTK_BUTTON_BOX( hbuttonbox1 ),GTK_BUTTONBOX_END );
- gtk_button_box_set_spacing( GTK_BUTTON_BOX( hbuttonbox1 ),10 );
-
- Config=AddButton( MSGTR_Config,hbuttonbox1 );
- Clear=AddButton( MSGTR_Clear,hbuttonbox1 );
- Ok=AddButton( MSGTR_Ok,hbuttonbox1 );
-
- gtk_widget_add_accelerator( Ok,"clicked",accel_group,GDK_Escape,0,GTK_ACCEL_VISIBLE );
- gtk_widget_add_accelerator( Ok,"clicked",accel_group,GDK_Return,0,GTK_ACCEL_VISIBLE );
-
- gtk_signal_connect( GTK_OBJECT( Equalizer ),"destroy",GTK_SIGNAL_FUNC( WidgetDestroy ),&Equalizer );
- gtk_signal_connect( GTK_OBJECT( Equalizer ),"focus_in_event",GTK_SIGNAL_FUNC( eqFocus ),(void *)2 );
-
- gtk_signal_connect( GTK_OBJECT( ChannelsList ),"select_row",GTK_SIGNAL_FUNC( eqSelectChannelsListRow ),NULL );
-
- gtk_signal_connect( GTK_OBJECT( A3125 ),"motion_notify_event",GTK_SIGNAL_FUNC( eqHScaleMotion ),(void*)0 );
- gtk_signal_connect( GTK_OBJECT( A6250 ),"motion_notify_event",GTK_SIGNAL_FUNC( eqHScaleMotion ),(void*)1 );
- gtk_signal_connect( GTK_OBJECT( A125 ),"motion_notify_event",GTK_SIGNAL_FUNC( eqHScaleMotion ),(void*)2 );
- gtk_signal_connect( GTK_OBJECT( A250 ),"motion_notify_event",GTK_SIGNAL_FUNC( eqHScaleMotion ),(void*)3 );
- gtk_signal_connect( GTK_OBJECT( A500 ),"motion_notify_event",GTK_SIGNAL_FUNC( eqHScaleMotion ),(void*)4 );
- gtk_signal_connect( GTK_OBJECT( A1000 ),"motion_notify_event",GTK_SIGNAL_FUNC( eqHScaleMotion ),(void*)5 );
- gtk_signal_connect( GTK_OBJECT( A2000 ),"motion_notify_event",GTK_SIGNAL_FUNC( eqHScaleMotion ),(void*)6 );
- gtk_signal_connect( GTK_OBJECT( A4000 ),"motion_notify_event",GTK_SIGNAL_FUNC( eqHScaleMotion ),(void*)7 );
- gtk_signal_connect( GTK_OBJECT( A8000 ),"motion_notify_event",GTK_SIGNAL_FUNC( eqHScaleMotion ),(void*)8 );
- gtk_signal_connect( GTK_OBJECT( A16000 ),"motion_notify_event",GTK_SIGNAL_FUNC( eqHScaleMotion ),(void*)9 );
-
- gtk_signal_connect( GTK_OBJECT( VContrast ),"motion_notify_event",GTK_SIGNAL_FUNC( eqVScaleMotion ),(void*)1 );
- gtk_signal_connect( GTK_OBJECT( VBrightness ),"motion_notify_event",GTK_SIGNAL_FUNC( eqVScaleMotion ),(void*)2 );
- gtk_signal_connect( GTK_OBJECT( VHue ),"motion_notify_event",GTK_SIGNAL_FUNC( eqVScaleMotion ),(void*)3 );
- gtk_signal_connect( GTK_OBJECT( VSaturation ),"motion_notify_event",GTK_SIGNAL_FUNC( eqVScaleMotion ),(void *)4 );
-
- gtk_signal_connect( GTK_OBJECT( Ok ),"clicked",GTK_SIGNAL_FUNC( eqButtonReleased ),(void *)0 );
- gtk_signal_connect( GTK_OBJECT( Clear ),"clicked",GTK_SIGNAL_FUNC( eqButtonReleased ),(void *)1 );
- gtk_signal_connect( GTK_OBJECT( Config ),"clicked",GTK_SIGNAL_FUNC( eqButtonReleased ),(void *)2 );
-
- gtk_signal_connect( GTK_OBJECT( Notebook ),"switch_page",GTK_SIGNAL_FUNC( eqNotebook ),NULL );
-
- gtk_window_add_accel_group( GTK_WINDOW( Equalizer ),accel_group );
-
- return Equalizer;
-}
-
-// --- equalizer config dialog box
-
-static GtkWidget * CBChannel1;
-static GtkWidget * CEChannel1;
-static GtkWidget * CBChannel2;
-static GtkWidget * CEChannel2;
-static GtkWidget * CBChannel3;
-static GtkWidget * CEChannel3;
-static GtkWidget * CBChannel4;
-static GtkWidget * CEChannel4;
-static GtkWidget * CBChannel5;
-static GtkWidget * CEChannel5;
-static GtkWidget * CBChannel6;
-static GtkWidget * CEChannel6;
-static GtkWidget * ecOk;
-static GtkWidget * ecCancel;
-
-GtkWidget * create_EquConfig( void );
-
-void ShowEquConfig( void )
-{
- GList * Items = NULL;
-
- if ( EquConfig ) gtkActive( EquConfig );
- else EquConfig=create_EquConfig();
-
- Items=g_list_append( Items,(gpointer)MSGTR_EQU_Front_Right );
- Items=g_list_append( Items,(gpointer)MSGTR_EQU_Front_Left );
- Items=g_list_append( Items,(gpointer)MSGTR_EQU_Back_Right );
- Items=g_list_append( Items,(gpointer)MSGTR_EQU_Back_Left );
- Items=g_list_append( Items,(gpointer)MSGTR_EQU_Center );
- Items=g_list_append( Items,(gpointer)MSGTR_EQU_Bass );
-
- gtk_combo_set_popdown_strings( GTK_COMBO( CBChannel1 ),Items );
- gtk_combo_set_popdown_strings( GTK_COMBO( CBChannel2 ),Items );
- gtk_combo_set_popdown_strings( GTK_COMBO( CBChannel3 ),Items );
- gtk_combo_set_popdown_strings( GTK_COMBO( CBChannel4 ),Items );
- gtk_combo_set_popdown_strings( GTK_COMBO( CBChannel5 ),Items );
- gtk_combo_set_popdown_strings( GTK_COMBO( CBChannel6 ),Items );
-
- g_list_free( Items );
-
- gtk_entry_set_text( GTK_ENTRY( CEChannel1 ),gtkEquChannel1 ); gtk_entry_set_editable( GTK_ENTRY( CEChannel1 ),FALSE );
- gtk_entry_set_text( GTK_ENTRY( CEChannel2 ),gtkEquChannel2 ); gtk_entry_set_editable( GTK_ENTRY( CEChannel2 ),FALSE );
- gtk_entry_set_text( GTK_ENTRY( CEChannel3 ),gtkEquChannel3 ); gtk_entry_set_editable( GTK_ENTRY( CEChannel3 ),FALSE );
- gtk_entry_set_text( GTK_ENTRY( CEChannel4 ),gtkEquChannel4 ); gtk_entry_set_editable( GTK_ENTRY( CEChannel4 ),FALSE );
- gtk_entry_set_text( GTK_ENTRY( CEChannel5 ),gtkEquChannel5 ); gtk_entry_set_editable( GTK_ENTRY( CEChannel5 ),FALSE );
- gtk_entry_set_text( GTK_ENTRY( CEChannel6 ),gtkEquChannel6 ); gtk_entry_set_editable( GTK_ENTRY( CEChannel6 ),FALSE );
-
- gtk_widget_show( EquConfig );
- gtkSetLayer( EquConfig );
-}
-
-void HideEquConfig( void )
-{
- if ( !EquConfig ) return;
- gtk_widget_hide( EquConfig );
- gtk_widget_destroy( EquConfig );
- EquConfig=NULL;
-}
-
-static void ecButtonReleased( GtkButton * button,gpointer user_data )
-{
- if ( (int)user_data )
- { // if you pressed Ok
- gfree( (void **)&gtkEquChannel1 ); gtkEquChannel1=gstrdup( gtk_entry_get_text( GTK_ENTRY( CEChannel1 ) ) );
- gfree( (void **)&gtkEquChannel2 ); gtkEquChannel2=gstrdup( gtk_entry_get_text( GTK_ENTRY( CEChannel2 ) ) );
- gfree( (void **)&gtkEquChannel3 ); gtkEquChannel3=gstrdup( gtk_entry_get_text( GTK_ENTRY( CEChannel3 ) ) );
- gfree( (void **)&gtkEquChannel4 ); gtkEquChannel4=gstrdup( gtk_entry_get_text( GTK_ENTRY( CEChannel4 ) ) );
- gfree( (void **)&gtkEquChannel5 ); gtkEquChannel5=gstrdup( gtk_entry_get_text( GTK_ENTRY( CEChannel5 ) ) );
- gfree( (void **)&gtkEquChannel6 ); gtkEquChannel6=gstrdup( gtk_entry_get_text( GTK_ENTRY( CEChannel6 ) ) );
- eqSetChannelNames();
- }
- HideEquConfig();
-}
-
-GtkWidget * create_EquConfig( void )
-{
- GtkWidget * vbox1;
- GtkWidget * table1;
- GtkWidget * hbuttonbox1;
- GtkAccelGroup * accel_group;
-
- accel_group=gtk_accel_group_new();
-
- EquConfig=gtk_window_new( GTK_WINDOW_TOPLEVEL );
- gtk_widget_set_name( EquConfig,"EquConfig" );
- gtk_object_set_data( GTK_OBJECT( EquConfig ),"EquConfig",EquConfig );
- gtk_widget_set_usize( EquConfig,350,260 );
- GTK_WIDGET_SET_FLAGS( EquConfig,GTK_CAN_DEFAULT );
- gtk_window_set_title( GTK_WINDOW( EquConfig ),MSGTR_ConfigureEqualizer );
- gtk_window_set_position( GTK_WINDOW( EquConfig ),GTK_WIN_POS_CENTER );
-// gtk_window_set_modal( GTK_WINDOW( EquConfig ),TRUE );
- gtk_window_set_policy( GTK_WINDOW( EquConfig ),FALSE,FALSE,FALSE );
- gtk_window_set_wmclass( GTK_WINDOW( EquConfig ),"EquConfig","MPlayer" );
-
- gtk_widget_realize( EquConfig );
- gtkAddIcon( EquConfig );
-
- vbox1=AddVBox( AddDialogFrame( EquConfig ),0 );
-
- table1=gtk_table_new( 6,2,FALSE );
- gtk_widget_set_name( table1,"table1" );
- gtk_widget_show( table1 );
- gtk_box_pack_start( GTK_BOX( vbox1 ),table1,TRUE,TRUE,0 );
- gtk_table_set_row_spacings( GTK_TABLE( table1 ),4 );
- gtk_table_set_col_spacings( GTK_TABLE( table1 ),4 );
-
- gtk_table_attach( GTK_TABLE( table1 ),
- AddLabel( MSGTR_EQU_Channel1,NULL ),
- 0,1,0,1,(GtkAttachOptions)( GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 );
-
- gtk_table_attach( GTK_TABLE( table1 ),
- AddLabel( MSGTR_EQU_Channel2,NULL ),
- 0,1,1,2,(GtkAttachOptions)( GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 );
-
- gtk_table_attach( GTK_TABLE( table1 ),
- AddLabel( MSGTR_EQU_Channel3,NULL ),
- 0,1,2,3,(GtkAttachOptions)( GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 );
-
- gtk_table_attach( GTK_TABLE( table1 ),
- AddLabel( MSGTR_EQU_Channel4,NULL ),
- 0,1,3,4,(GtkAttachOptions)( GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 );
-
- gtk_table_attach( GTK_TABLE( table1 ),
- AddLabel( MSGTR_EQU_Channel5,NULL ),
- 0,1,4,5,(GtkAttachOptions)( GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 );
-
- gtk_table_attach( GTK_TABLE( table1 ),
- AddLabel( MSGTR_EQU_Channel6,NULL ),
- 0,1,5,6,(GtkAttachOptions)( GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 );
-
- CBChannel1=AddComboBox( NULL );
- gtk_table_attach( GTK_TABLE( table1 ),CBChannel1,1,2,0,1,(GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 );
-
- CEChannel1=GTK_COMBO( CBChannel1 )->entry;
- gtk_widget_set_name( CEChannel1,"CEChannel1" );
- gtk_widget_show( CEChannel1 );
-
- CBChannel2=AddComboBox( NULL );
- gtk_table_attach( GTK_TABLE( table1 ),CBChannel2,1,2,1,2,(GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 );
-
- CEChannel2=GTK_COMBO( CBChannel2 )->entry;
- gtk_widget_set_name( CEChannel2,"CEChannel2" );
- gtk_widget_show( CEChannel2 );
-
- CBChannel3=AddComboBox( NULL );
- gtk_table_attach( GTK_TABLE( table1 ),CBChannel3,1,2,2,3,(GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 );
-
- CEChannel3=GTK_COMBO( CBChannel3 )->entry;
- gtk_widget_set_name( CEChannel3,"CEChannel3" );
- gtk_widget_show( CEChannel3 );
-
- CBChannel4=AddComboBox( NULL );
- gtk_table_attach( GTK_TABLE( table1 ),CBChannel4,1,2,3,4,(GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 );
-
- CEChannel4=GTK_COMBO( CBChannel4 )->entry;
- gtk_widget_set_name( CEChannel4,"CEChannel4" );
- gtk_widget_show( CEChannel4 );
-
- CBChannel5=AddComboBox( NULL );
- gtk_table_attach( GTK_TABLE( table1 ),CBChannel5,1,2,4,5,(GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 );
-
- CEChannel5=GTK_COMBO( CBChannel5 )->entry;
- gtk_widget_set_name( CEChannel5,"CEChannel5" );
- gtk_widget_show( CEChannel5 );
-
- CBChannel6=AddComboBox( NULL );
- gtk_table_attach( GTK_TABLE( table1 ),CBChannel6,1,2,5,6,(GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 );
-
- CEChannel6=GTK_COMBO( CBChannel6 )->entry;
- gtk_widget_set_name( CEChannel6,"CEChannel6" );
- gtk_widget_show( CEChannel6 );
-
- AddHSeparator( vbox1 );
-
- hbuttonbox1=AddHButtonBox( vbox1 );
- gtk_button_box_set_layout( GTK_BUTTON_BOX( hbuttonbox1 ),GTK_BUTTONBOX_END );
- gtk_button_box_set_spacing( GTK_BUTTON_BOX( hbuttonbox1 ),10 );
-
- ecOk=AddButton( MSGTR_Ok,hbuttonbox1 );
- ecCancel=AddButton( MSGTR_Cancel,hbuttonbox1 );
-
- gtk_widget_add_accelerator( ecOk,"clicked",accel_group,GDK_Return,0,GTK_ACCEL_VISIBLE );
- gtk_widget_add_accelerator( ecCancel,"clicked",accel_group,GDK_Escape,0,GTK_ACCEL_VISIBLE );
-
- gtk_signal_connect( GTK_OBJECT( EquConfig ),"destroy",GTK_SIGNAL_FUNC( WidgetDestroy ),&EquConfig );
-
- gtk_signal_connect( GTK_OBJECT( ecOk ),"clicked",GTK_SIGNAL_FUNC( ecButtonReleased ),(void *)1 );
- gtk_signal_connect( GTK_OBJECT( ecCancel ),"clicked",GTK_SIGNAL_FUNC( ecButtonReleased ),(void *)0 );
-
- gtk_window_add_accel_group( GTK_WINDOW( EquConfig ),accel_group );
-
- return EquConfig;
-}
-
diff --git a/gui/mplayer/gtk/eq.h b/gui/mplayer/gtk/eq.h
deleted file mode 100644
index 8d4d5f117f..0000000000
--- a/gui/mplayer/gtk/eq.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * 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_GUI_EQ_H
-#define MPLAYER_GUI_EQ_H
-
-#include <gtk/gtk.h>
-
-extern GtkWidget * Equalizer;
-
-GtkWidget * create_Equalizer( void );
-void ShowEqualizer( void );
-
-#endif /* MPLAYER_GUI_EQ_H */
diff --git a/gui/mplayer/gtk/fs.c b/gui/mplayer/gtk/fs.c
deleted file mode 100644
index 238697e985..0000000000
--- a/gui/mplayer/gtk/fs.c
+++ /dev/null
@@ -1,656 +0,0 @@
-/*
- * 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.
- */
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <sys/stat.h>
-#include <glob.h>
-#include <unistd.h>
-
-#include "config.h"
-#include "gui/mplayer/gmplayer.h"
-
-#include "gui/mplayer/pixmaps/up.xpm"
-#include "gui/mplayer/pixmaps/dir.xpm"
-#include "gui/mplayer/pixmaps/file.xpm"
-
-#include "gui/app.h"
-#include "gui/interface.h"
-#include "help_mp.h"
-#include "stream/stream.h"
-
-#include "gui/mplayer/widgets.h"
-#include "fs.h"
-#include "opts.h"
-#include "gtk_common.h"
-
-#ifndef __linux__
-#define get_current_dir_name() getcwd(NULL, PATH_MAX)
-#else
-char * get_current_dir_name( void );
-#endif
-
-gchar * fsSelectedFile = NULL;
-gchar * fsSelectedDirectory = NULL;
-unsigned char * fsThatDir = ".";
-const gchar * fsFilter = "*";
-
-int fsType = 0;
-
-char * fsVideoFilterNames[][2] =
- {
- { "ASF files (*.asf)", "*.asf" },
- { "AVI files (*.avi)", "*.avi" },
- { "Autodesk animations (*.fli,*.flc)", "*.fli,*.flc" },
- { "DGStation Cuberevo recordings (*.trp)", "*.trp" },
- { "DiVX files (*.divx)", "*.divx" },
- { "MP3 files (*.mp3,*.mp2)", "*.mp3,*.mp2" },
- { "MPEG files (*.mpg,*.mpeg,*.m1v)", "*.mpg,*.mpeg,*.m1v" },
- { "Macromedia Flash Video (*.flv)", "*.flv" },
- { "Matroska Audio files (*.mka)", "*.mka" },
- { "Matroska Media files (*.mkv)", "*.mkv" },
- { "NuppelVideo files (*.nuv)", "*.nuv" },
- { "OGG Vorbis files (*.ogg)", "*.ogg" },
- { "OGG Media files (*.ogm)", "*.ogm" },
- { "QuickTime files (*.mov,*.qt,*.mp4)", "*.mov,*.qt,*.mp4" },
- { "RealVideo files (*.rm,*.rmvb)", "*.rm,*.rmvb" },
- { "Tivo files (*.ty)", "*.ty" },
- { "VCD/SVCD Images (*.bin)", "*.bin" },
- { "VIVO files (*.viv)", "*.viv" },
- { "VOB files (*.vob)", "*.vob" },
- { "Wave files (*.wav)", "*.wav" },
- { "Windows Media Audio (*.wma)", "*.wma" },
- { "Windows Media Video (*.wmv)", "*.wmv" },
- { "Audio files", "*.mp2,*.mp3,*.mka,*.ogg,*.wav,*.wma" },
- { "Video files", "*.asf,*.avi,*.fli,*.flc,*.trp,*.divx,*.mpg,*.mpeg,*.m1v,*.flv,*.mkv,*.nuv,*.ogm,*.mov,*.qt,*.mp4,*.rm,*.rmvb,*.ty,*.bin,*.viv,*.vob,*.wmv" },
- { "All files", "*" },
- { NULL,NULL }
- };
-int fsLastVideoFilterSelected = -1;
-
-char * fsSubtitleFilterNames[][2] =
- {
- { "AQT (*.aqt)", "*.aqt" },
- { "ASS (*.ass)", "*.ass" },
- { "RT (*.rt) ", "*.rt" },
- { "SMI (*.smi)", "*.smi" },
- { "SRT (*.srt)", "*.srt" },
- { "SSA (*.ssa)", "*.ssa" },
- { "SUB (*.sub)", "*.sub" },
- { "TXT (*.txt)", "*.txt" },
- { "UTF (*.utf)", "*.utf" },
- { "Subtitles", "*.aqt,*.ass,*.rt,*.smi,*.srt,*.ssa,*.sub,*.txt,*.utf" },
- { "All files", "*" },
- { NULL,NULL }
- };
-int fsLastSubtitleFilterSelected = -1;
-
-char * fsOtherFilterNames[][2] =
- {
- { "All files", "*" },
- { NULL,NULL }
- };
-
-char * fsAudioFileNames[][2] =
- {
- { "MP3 files (*.mp2, *.mp3)", "*.mp2,*.mp3" },
- { "Matroska Audio files (*.mka)", "*.mka" },
- { "OGG Vorbis files (*.ogg)", "*.ogg" },
- { "WAV files (*.wav)", "*.wav" },
- { "WMA files (*.wma)", "*.wma" },
- { "Audio files", "*.mp2,*.mp3,*.mka,*.ogg,*.wav,*.wma" },
- { "All files", "*" },
- { NULL, NULL }
- };
-int fsLastAudioFilterSelected = -1;
-
-char * fsFontFileNames[][2] =
- {
-#ifdef CONFIG_FREETYPE
- { "True Type fonts (*.ttf)", "*.ttf" },
- { "Type1 fonts (*.pfb)", "*.pfb" },
- { "All fonts", "*.ttf,*.pfb" },
-#else
- { "Font files (*.desc)", "*.desc" },
-#endif
- { "All files", "*" },
- { NULL,NULL }
- };
-int fsLastFontFilterSelected = -1;
-
-GtkWidget * fsFileNamesList;
-GtkWidget * fsFNameList;
-GtkWidget * fsFileSelect = NULL;
-GdkColormap * fsColorMap;
-GtkWidget * fsOk;
-GtkWidget * fsUp;
-GtkWidget * fsCancel;
-GtkWidget * fsCombo4;
-GtkWidget * fsPathCombo;
-GList * fsList_items = NULL;
-GList * fsTopList_items = NULL;
-GtkWidget * List;
-GtkWidget * fsFilterCombo;
-
-GtkStyle * style;
-GdkPixmap * dpixmap;
-GdkPixmap * fpixmap;
-GdkBitmap * dmask;
-GdkBitmap * fmask;
-
-static char * Filter( const char * name )
-{
- static char tmp[32];
- int i,c;
- for ( i=0,c=0;i < strlen( name );i++ )
- {
- if ( ( name[i] >='a' )&&( name[i] <= 'z' ) ) { tmp[c++]='['; tmp[c++]=name[i]; tmp[c++]=name[i] - 32; tmp[c++]=']'; }
- else tmp[c++]=name[i];
- }
- tmp[c]=0;
- return tmp;
-}
-
-static void clist_append_fname(GtkWidget * list, char *fname,
- GdkPixmap *pixmap, GdkPixmap *mask) {
- gint pos;
- gchar *str[2];
- str[0] = NULL;
- str[1] = fname;
- pos = gtk_clist_append(GTK_CLIST(list), str);
- gtk_clist_set_pixmap(GTK_CLIST(list), pos, 0, pixmap, mask);
-}
-
-void CheckDir( GtkWidget * list,char * directory )
-{
- struct stat fs;
- int i;
- glob_t gg;
-
- if ( !fsFilter[0] ) return;
-
- gtk_widget_hide( list );
- gtk_clist_clear( GTK_CLIST( list ) );
-
- clist_append_fname(list, ".", dpixmap, dmask);
- clist_append_fname(list, "..", dpixmap, dmask);
-
- glob( "*",0,NULL,&gg );
- for( i=0;(unsigned)i<gg.gl_pathc;i++ )
- {
- stat( gg.gl_pathv[i],&fs );
- if( !S_ISDIR( fs.st_mode ) ) continue;
- clist_append_fname(list, gg.gl_pathv[i], dpixmap, dmask);
- }
- globfree( &gg );
-
- if ( strchr( fsFilter,',' ) )
- {
- char tmp[8];
- int i,c,glob_param = 0;
- for ( i=0,c=0;i<(int)strlen( fsFilter ) + 1;i++,c++ )
- {
- tmp[c]=fsFilter[i];
- if ( ( tmp[c] == ',' )||( tmp[c] == '\0' ) )
- {
- tmp[c]=0; c=-1;
- glob( Filter( tmp ),glob_param,NULL,&gg );
- glob_param=GLOB_APPEND;
- }
- }
- } else glob( Filter( fsFilter ),0,NULL,&gg );
-
- for( i=0;(unsigned)i<gg.gl_pathc;i++ )
- {
- stat( gg.gl_pathv[i],&fs );
- if( S_ISDIR( fs.st_mode ) ) continue;
- clist_append_fname(list, gg.gl_pathv[i], fpixmap, fmask);
- }
- globfree( &gg );
-
- gtk_clist_set_column_width( GTK_CLIST( list ),0,17 );
- gtk_clist_select_row( GTK_CLIST( list ),0,1 );
- gtk_widget_show( list );
-}
-
-void fs_PersistantHistory( char *subject ); /* forward declaration */
-
-void ShowFileSelect( int type,int modal )
-{
- int i, k;
- char * tmp = NULL;
-
- if ( fsFileSelect ) gtkActive( fsFileSelect );
- else fsFileSelect=create_FileSelect();
-
- fsType=type;
- switch ( type )
- {
- case fsVideoSelector:
- gtk_window_set_title( GTK_WINDOW( fsFileSelect ),MSGTR_FileSelect );
- fsList_items=NULL;
- for( i=0;fsVideoFilterNames[i][0];i++ )
- fsList_items=g_list_append( fsList_items,fsVideoFilterNames[i][0] );
- k = fsLastVideoFilterSelected;
- gtk_combo_set_popdown_strings( GTK_COMBO( List ),fsList_items );
- g_list_free( fsList_items );
- gtk_entry_set_text( GTK_ENTRY( fsFilterCombo ),fsVideoFilterNames[k >= 0 ? k : i-2][0] );
- tmp=guiIntfStruct.Filename;
- break;
- case fsSubtitleSelector:
- gtk_window_set_title( GTK_WINDOW( fsFileSelect ),MSGTR_SubtitleSelect );
- fsList_items=NULL;
- for( i=0;fsSubtitleFilterNames[i][0];i++ )
- fsList_items=g_list_append( fsList_items,fsSubtitleFilterNames[i][0] );
- k = fsLastSubtitleFilterSelected;
- gtk_combo_set_popdown_strings( GTK_COMBO( List ),fsList_items );
- g_list_free( fsList_items );
- gtk_entry_set_text( GTK_ENTRY( fsFilterCombo ),fsSubtitleFilterNames[k >= 0 ? k : i-2][0] );
- tmp=guiIntfStruct.Subtitlename;
- break;
- case fsOtherSelector:
- gtk_window_set_title( GTK_WINDOW( fsFileSelect ),MSGTR_OtherSelect );
- fsList_items=NULL;
- for( i=0;fsOtherFilterNames[i][0];i++ )
- fsList_items=g_list_append( fsList_items,fsOtherFilterNames[i][0] );
- gtk_combo_set_popdown_strings( GTK_COMBO( List ),fsList_items );
- g_list_free( fsList_items );
- gtk_entry_set_text( GTK_ENTRY( fsFilterCombo ),fsOtherFilterNames[0][0] );
- tmp=guiIntfStruct.Othername;
- break;
- case fsAudioSelector:
- gtk_window_set_title( GTK_WINDOW( fsFileSelect ),MSGTR_AudioFileSelect );
- fsList_items=NULL;
- for( i=0;fsAudioFileNames[i][0];i++ )
- fsList_items=g_list_append( fsList_items,fsAudioFileNames[i][0] );
- k = fsLastAudioFilterSelected;
- gtk_combo_set_popdown_strings( GTK_COMBO( List ),fsList_items );
- g_list_free( fsList_items );
- gtk_entry_set_text( GTK_ENTRY( fsFilterCombo ),fsAudioFileNames[k >= 0 ? k : i-2][0] );
- tmp=guiIntfStruct.AudioFile;
- break;
- case fsFontSelector:
- gtk_window_set_title( GTK_WINDOW( fsFileSelect ),MSGTR_FontSelect );
- fsList_items=NULL;
- for( i=0;fsFontFileNames[i][0];i++ )
- fsList_items=g_list_append( fsList_items,fsFontFileNames[i][0] );
- k = fsLastFontFilterSelected;
- gtk_combo_set_popdown_strings( GTK_COMBO( List ),fsList_items );
- g_list_free( fsList_items );
- gtk_entry_set_text( GTK_ENTRY( fsFilterCombo ),fsFontFileNames[k >= 0 ? k : i-2][0] );
- tmp=font_name;
- break;
- }
-
- if ( tmp && tmp[0] )
- {
- struct stat f;
- char * dir = strdup( tmp );
-
- do
- {
- char * c = strrchr( dir,'/' );
- stat( dir,&f );
- if ( S_ISDIR( f.st_mode ) ) break;
- if ( c ) *c=0;
- } while ( strrchr( dir,'/' ) );
-
- if ( dir[0] ) chdir( dir );
-
- free( dir );
- }
-
- if ( fsTopList_items ) g_list_free( fsTopList_items ); fsTopList_items=NULL;
- {
- int i, c = 1;
-
- if ( fsType == fsVideoSelector )
- {
- for ( i=0;i < fsPersistant_MaxPos;i++ )
- if ( fsHistory[i] ) { fsTopList_items=g_list_append( fsTopList_items,fsHistory[i] ); c=0; }
- }
- if ( c ) fsTopList_items=g_list_append( fsTopList_items,(gchar *)get_current_dir_name() );
- }
- if ( getenv( "HOME" ) ) fsTopList_items=g_list_append( fsTopList_items,getenv( "HOME" ) );
- fsTopList_items=g_list_append( fsTopList_items,"/home" );
- fsTopList_items=g_list_append( fsTopList_items,"/mnt" );
- fsTopList_items=g_list_append( fsTopList_items,"/" );
- gtk_combo_set_popdown_strings( GTK_COMBO( fsCombo4 ),fsTopList_items );
-
- gtk_window_set_modal( GTK_WINDOW( fsFileSelect ),modal );
-
- gtk_widget_show( fsFileSelect );
-}
-
-void HideFileSelect( void )
-{
- if ( !fsFileSelect ) return;
- gtk_widget_hide( fsFileSelect );
- gtk_widget_destroy( fsFileSelect );
- fsFileSelect=NULL;
-}
-
-void fs_PersistantHistory( char * subject )
-{
- int i;
-
- if ( fsType != fsVideoSelector ) return;
-
- for ( i=0;i < fsPersistant_MaxPos;i++ )
- if ( fsHistory[i] && !strcmp( fsHistory[i],subject ) )
- {
- char * tmp = fsHistory[i]; fsHistory[i]=fsHistory[0]; fsHistory[0]=tmp;
- return;
- }
- gfree( (void **)&fsHistory[fsPersistant_MaxPos - 1] );
- for ( i=fsPersistant_MaxPos - 1;i;i-- ) fsHistory[i]=fsHistory[i - 1];
- fsHistory[0]=gstrdup( subject );
-}
-//-----------------------------------------------
-
-void fs_fsFilterCombo_activate( GtkEditable * editable,gpointer user_data )
-{
- fsFilter=gtk_entry_get_text( GTK_ENTRY( user_data ) );
- CheckDir( fsFNameList,get_current_dir_name() );
-}
-
-void fs_fsFilterCombo_changed( GtkEditable * editable,gpointer user_data )
-{
- const char * str;
- int i;
-
- str=gtk_entry_get_text( GTK_ENTRY(user_data ) );
-
- switch ( fsType )
- {
- case fsVideoSelector:
- for( i=0;fsVideoFilterNames[i][0];i++ )
- if( !strcmp( str,fsVideoFilterNames[i][0] ) )
- { fsFilter=fsVideoFilterNames[i][1]; fsLastVideoFilterSelected = i; break; }
- break;
- case fsSubtitleSelector:
- for( i=0;fsSubtitleFilterNames[i][0];i++ )
- if( !strcmp( str,fsSubtitleFilterNames[i][0] ) )
- { fsFilter=fsSubtitleFilterNames[i][1]; fsLastSubtitleFilterSelected = i; break; }
- break;
- case fsOtherSelector:
- for( i=0;fsOtherFilterNames[i][0];i++ )
- if( !strcmp( str,fsOtherFilterNames[i][0] ) )
- { fsFilter=fsOtherFilterNames[i][1]; break; }
- break;
- case fsAudioSelector:
- for( i=0;fsAudioFileNames[i][0];i++ )
- if( !strcmp( str,fsAudioFileNames[i][0] ) )
- { fsFilter=fsAudioFileNames[i][1]; fsLastAudioFilterSelected = i; break; }
- break;
- case fsFontSelector:
- for( i=0;fsFontFileNames[i][0];i++ )
- if( !strcmp( str,fsFontFileNames[i][0] ) )
- { fsFilter=fsFontFileNames[i][1]; fsLastFontFilterSelected = i; break; }
- break;
- default: return;
- }
- CheckDir( fsFNameList,get_current_dir_name() );
-}
-
-void fs_fsPathCombo_activate( GtkEditable * editable,gpointer user_data )
-{
- const unsigned char * str;
-
- str=gtk_entry_get_text( GTK_ENTRY( user_data ) );
- if ( chdir( str ) != -1 ) CheckDir( fsFNameList,get_current_dir_name() );
-}
-
-void fs_fsPathCombo_changed( GtkEditable * editable,gpointer user_data )
-{
- const unsigned char * str;
-
- str=gtk_entry_get_text( GTK_ENTRY( user_data ) );
- if ( chdir( str ) != -1 ) CheckDir( fsFNameList,get_current_dir_name() );
-}
-
-void fs_Up_released( GtkButton * button,gpointer user_data )
-{
- chdir( ".." );
- fsSelectedFile=fsThatDir;
- CheckDir( fsFNameList,get_current_dir_name() );
- gtk_entry_set_text( GTK_ENTRY( fsPathCombo ),(unsigned char *)get_current_dir_name() );
- return;
-}
-
-int fsFileExist( unsigned char * fname )
-{
- FILE * f = fopen( fname,"r" );
- if ( f == NULL ) return 0;
- fclose( f );
- return 1;
-}
-
-void fs_Ok_released( GtkButton * button,gpointer user_data )
-{
- GList * item;
- int i = 1;
- struct stat fs;
-
- stat( fsSelectedFile,&fs );
- if( S_ISDIR(fs.st_mode ) )
- {
- chdir( fsSelectedFile );
- fsSelectedFile=fsThatDir;
- CheckDir( fsFNameList,get_current_dir_name() );
- gtk_entry_set_text( GTK_ENTRY( fsPathCombo ),(unsigned char *)get_current_dir_name() );
- return;
- }
-
- fsSelectedDirectory=(unsigned char *)get_current_dir_name();
- switch ( fsType )
- {
- case fsVideoSelector:
- guiSetDF( guiIntfStruct.Filename,fsSelectedDirectory,fsSelectedFile );
- guiIntfStruct.StreamType=STREAMTYPE_FILE;
- guiIntfStruct.FilenameChanged=1; sub_fps=0;
- gfree( (void **)&guiIntfStruct.AudioFile );
- gfree( (void **)&guiIntfStruct.Subtitlename );
- fs_PersistantHistory( fsSelectedDirectory ); //totem, write into history
- break;
- case fsSubtitleSelector:
- guiSetDF( guiIntfStruct.Subtitlename,fsSelectedDirectory,fsSelectedFile );
- guiLoadSubtitle( guiIntfStruct.Subtitlename );
- break;
- case fsOtherSelector:
- guiSetDF( guiIntfStruct.Othername,fsSelectedDirectory,fsSelectedFile );
- break;
- case fsAudioSelector:
- guiSetDF( guiIntfStruct.AudioFile,fsSelectedDirectory,fsSelectedFile );
- break;
- case fsFontSelector:
- guiSetDF( font_name,fsSelectedDirectory,fsSelectedFile );
- guiLoadFont();
- if ( Preferences ) gtk_entry_set_text( GTK_ENTRY( prEFontName ),font_name );
- break;
- }
-
- HideFileSelect();
-
- item=fsTopList_items;
- while( item )
- {
- if ( !strcmp( item->data,fsSelectedDirectory ) ) i=0;
- item=item->next;
- }
- if ( i ) fsTopList_items=g_list_prepend( fsTopList_items,(gchar *)get_current_dir_name() );
- if ( mplMainAutoPlay ) { mplMainAutoPlay=0; mplEventHandling( evPlay,0 ); }
- else guiGetEvent( guiCEvent,guiSetStop );
-}
-
-void fs_Cancel_released( GtkButton * button,gpointer user_data )
-{
- HideFileSelect();
- fs_PersistantHistory( get_current_dir_name() ); //totem, write into history file
-}
-
-void fs_fsFNameList_select_row( GtkWidget * widget,gint row,gint column,GdkEventButton *bevent,gpointer user_data )
-{
- gtk_clist_get_text( GTK_CLIST(widget ),row,1,&fsSelectedFile );
- if( bevent && bevent->type == GDK_BUTTON_PRESS ) gtk_button_released( GTK_BUTTON( fsOk ) );
-}
-
-gboolean on_FileSelect_key_release_event( GtkWidget * widget,GdkEventKey * event,gpointer user_data )
-{
- switch ( event->keyval )
- {
- case GDK_Escape:
- gtk_button_released( GTK_BUTTON( fsCancel ) );
- break;
- case GDK_Return:
- gtk_button_released( GTK_BUTTON( fsOk ) );
- break;
- case GDK_BackSpace:
- gtk_button_released( GTK_BUTTON( fsUp ) );
- break;
- }
- return FALSE;
-}
-
-GtkWidget * create_FileSelect( void )
-{
- GtkWidget * vbox4;
- GtkWidget * hbox4;
- GtkWidget * vseparator1;
- GtkWidget * hbox6;
- GtkWidget * fsFNameListWindow;
- GtkWidget * hbuttonbox3;
-
- GtkWidget * uppixmapwid;
- GdkPixmap * uppixmap;
- GdkBitmap * upmask;
- GtkStyle * upstyle;
-
-
- fsFileSelect=gtk_window_new( GTK_WINDOW_TOPLEVEL );
- gtk_widget_set_name( fsFileSelect,"fsFileSelect" );
- gtk_object_set_data( GTK_OBJECT( fsFileSelect ),"fsFileSelect",fsFileSelect );
- gtk_widget_set_usize( fsFileSelect,512,300 );
- GTK_WIDGET_SET_FLAGS( fsFileSelect,GTK_CAN_DEFAULT );
- gtk_widget_set_events( fsFileSelect,GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK | GDK_FOCUS_CHANGE_MASK | GDK_STRUCTURE_MASK | GDK_PROPERTY_CHANGE_MASK | GDK_VISIBILITY_NOTIFY_MASK );
- gtk_window_set_title( GTK_WINDOW( fsFileSelect ),MSGTR_FileSelect );
- gtk_window_set_position( GTK_WINDOW( fsFileSelect ),GTK_WIN_POS_CENTER );
- gtk_window_set_policy( GTK_WINDOW( fsFileSelect ),TRUE,TRUE,TRUE );
- gtk_window_set_wmclass( GTK_WINDOW( fsFileSelect ),"FileSelect","MPlayer" );
- fsColorMap=gdk_colormap_get_system();
-
- gtk_widget_realize( fsFileSelect );
- gtkAddIcon( fsFileSelect );
-
- style=gtk_widget_get_style( fsFileSelect );
- dpixmap=gdk_pixmap_colormap_create_from_xpm_d( fsFileSelect->window,fsColorMap,&dmask,&style->bg[GTK_STATE_NORMAL],(gchar **)dir_xpm );
- fpixmap=gdk_pixmap_colormap_create_from_xpm_d( fsFileSelect->window,fsColorMap,&fmask,&style->bg[GTK_STATE_NORMAL],(gchar **)file_xpm );
-
- vbox4=AddVBox( AddDialogFrame( fsFileSelect ),0 );
- hbox4=AddHBox( vbox4,1 );
-
- fsCombo4=gtk_combo_new();
- gtk_widget_set_name( fsCombo4,"fsCombo4" );
- gtk_widget_show( fsCombo4 );
- gtk_box_pack_start( GTK_BOX( hbox4 ),fsCombo4,TRUE,TRUE,0 );
- gtk_widget_set_usize( fsCombo4,-2,20 );
-
- fsPathCombo=GTK_COMBO( fsCombo4 )->entry;
- gtk_widget_set_name( fsPathCombo,"fsPathCombo" );
- gtk_widget_show( fsPathCombo );
- gtk_widget_set_usize( fsPathCombo,-2,20 );
-
- vseparator1=gtk_vseparator_new();
- gtk_widget_set_name( vseparator1,"vseparator1" );
- gtk_widget_show( vseparator1 );
- gtk_box_pack_start( GTK_BOX( hbox4 ),vseparator1,FALSE,TRUE,0 );
- gtk_widget_set_usize( vseparator1,7,20 );
-
- upstyle=gtk_widget_get_style( fsFileSelect );
- uppixmap=gdk_pixmap_colormap_create_from_xpm_d( fsFileSelect->window,fsColorMap,&upmask,&upstyle->bg[GTK_STATE_NORMAL],(gchar **)up_xpm );
- uppixmapwid=gtk_pixmap_new( uppixmap,upmask );
- gtk_widget_show( uppixmapwid );
-
- fsUp=gtk_button_new();
- gtk_container_add( GTK_CONTAINER(fsUp ),uppixmapwid );
- gtk_widget_show( fsUp );
- gtk_box_pack_start( GTK_BOX( hbox4 ),fsUp,FALSE,FALSE,0 );
- gtk_widget_set_usize( fsUp,65,15 );
-
- AddHSeparator( vbox4 );
-
- hbox6=AddHBox( NULL,0 );
- gtk_box_pack_start( GTK_BOX( vbox4 ),hbox6,TRUE,TRUE,0 );
-
- fsFNameListWindow=gtk_scrolled_window_new( NULL,NULL );
- gtk_widget_set_name( fsFNameListWindow,"fsFNameListWindow" );
- gtk_widget_show( fsFNameListWindow );
- gtk_box_pack_start( GTK_BOX( hbox6 ),fsFNameListWindow,TRUE,TRUE,0 );
- gtk_widget_set_usize( fsFNameListWindow,-2,145 );
- gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW( fsFNameListWindow ),GTK_POLICY_NEVER,GTK_POLICY_AUTOMATIC );
-
- fsFNameList=gtk_clist_new( 2 );
- gtk_widget_set_name( fsFNameList,"fsFNameList" );
- gtk_container_add( GTK_CONTAINER( fsFNameListWindow ),fsFNameList );
- gtk_clist_set_column_width( GTK_CLIST( fsFNameList ),0,80 );
- gtk_clist_set_selection_mode( GTK_CLIST( fsFNameList ),GTK_SELECTION_BROWSE );
- gtk_clist_column_titles_hide( GTK_CLIST( fsFNameList ) );
- gtk_clist_set_shadow_type( GTK_CLIST( fsFNameList ),GTK_SHADOW_ETCHED_OUT );
-
- AddHSeparator( vbox4 );
-
- List=gtk_combo_new();
- gtk_widget_set_name( List,"List" );
- gtk_widget_ref( List );
- gtk_object_set_data_full( GTK_OBJECT( fsFileSelect ),"List",List,(GtkDestroyNotify)gtk_widget_unref );
- gtk_widget_show( List );
- gtk_box_pack_start( GTK_BOX( vbox4 ),List,FALSE,FALSE,0 );
- gtk_widget_set_usize( List,-2,20 );
-
- fsFilterCombo=GTK_COMBO( List )->entry;
- gtk_widget_set_name( fsFilterCombo,"fsFilterCombo" );
- gtk_widget_show( fsFilterCombo );
- gtk_entry_set_editable (GTK_ENTRY( fsFilterCombo ),FALSE );
-
- AddHSeparator( vbox4 );
-
- hbuttonbox3=AddHButtonBox( vbox4 );
- gtk_button_box_set_layout( GTK_BUTTON_BOX( hbuttonbox3 ),GTK_BUTTONBOX_END );
- gtk_button_box_set_spacing( GTK_BUTTON_BOX( hbuttonbox3 ),10 );
-
- fsOk=AddButton( MSGTR_Ok,hbuttonbox3 );
- fsCancel=AddButton( MSGTR_Cancel,hbuttonbox3 );
-
- gtk_signal_connect( GTK_OBJECT( fsFileSelect ),"destroy",GTK_SIGNAL_FUNC( WidgetDestroy ),&fsFileSelect );
- gtk_signal_connect( GTK_OBJECT( fsFileSelect ),"key_release_event",GTK_SIGNAL_FUNC( on_FileSelect_key_release_event ),NULL );
-
- gtk_signal_connect( GTK_OBJECT( fsFilterCombo ),"changed",GTK_SIGNAL_FUNC( fs_fsFilterCombo_changed ),fsFilterCombo );
- gtk_signal_connect( GTK_OBJECT( fsFilterCombo ),"activate",GTK_SIGNAL_FUNC( fs_fsFilterCombo_activate ),fsFilterCombo );
- gtk_signal_connect( GTK_OBJECT( fsPathCombo ),"changed",GTK_SIGNAL_FUNC( fs_fsPathCombo_changed ),fsPathCombo );
- gtk_signal_connect( GTK_OBJECT( fsPathCombo ),"activate",GTK_SIGNAL_FUNC( fs_fsPathCombo_activate ),fsPathCombo );
- gtk_signal_connect( GTK_OBJECT( fsUp ),"released",GTK_SIGNAL_FUNC( fs_Up_released ),fsFNameList );
- gtk_signal_connect( GTK_OBJECT( fsOk ),"released",GTK_SIGNAL_FUNC( fs_Ok_released ),fsCombo4 );
- gtk_signal_connect( GTK_OBJECT( fsCancel ),"released",GTK_SIGNAL_FUNC( fs_Cancel_released ),NULL );
- gtk_signal_connect( GTK_OBJECT( fsFNameList ),"select_row",(GtkSignalFunc)fs_fsFNameList_select_row,NULL );
-
- gtk_widget_grab_focus( fsFNameList );
-
- return fsFileSelect;
-}
-
diff --git a/gui/mplayer/gtk/fs.h b/gui/mplayer/gtk/fs.h
deleted file mode 100644
index bb0dfe2afd..0000000000
--- a/gui/mplayer/gtk/fs.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * 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_GUI_FS_H
-#define MPLAYER_GUI_FS_H
-
-#include <gtk/gtk.h>
-
-#define fsVideoSelector 0
-#define fsSubtitleSelector 1
-#define fsOtherSelector 2
-#define fsAudioSelector 3
-#define fsFontSelector 4
-
-#include <errno.h>
-
-extern GtkWidget * fsFileSelect;
-
-void HideFileSelect( void );
-void ShowFileSelect( int type, int modal );
-
-GtkWidget * create_FileSelect( void );
-
-#endif /* MPLAYER_GUI_FS_H */
diff --git a/gui/mplayer/gtk/gtk_common.c b/gui/mplayer/gtk/gtk_common.c
deleted file mode 100644
index 495a5ea637..0000000000
--- a/gui/mplayer/gtk/gtk_common.c
+++ /dev/null
@@ -1,197 +0,0 @@
-/*
- * 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.
- */
-
-#include <gdk/gdkkeysyms.h>
-#include <gtk/gtk.h>
-
-#include "gtk_common.h"
-
-void WidgetDestroy( GtkWidget * widget,GtkWidget ** widget_pointer )
-{
- if ( !widget_pointer ) return;
- gtk_widget_hide( *widget_pointer );
- gtk_widget_destroy( *widget_pointer );
- *widget_pointer=NULL;
-}
-
-GtkWidget * AddDialogFrame( GtkWidget * parent )
-{
- GtkWidget * frame;
- frame=AddFrame( NULL,GTK_SHADOW_IN,parent,1 );
- gtk_container_set_border_width( GTK_CONTAINER( frame ),1 );
- frame=AddFrame( NULL,GTK_SHADOW_NONE,frame,1 );
- frame=AddFrame( NULL,GTK_SHADOW_ETCHED_OUT,frame,1 );
- frame=AddFrame( NULL,GTK_SHADOW_NONE,frame,1 );
- return frame;
-}
-
-GtkWidget * AddFrame( const char * title,int type,GtkWidget * parent,int add )
-{
- GtkWidget * frame = NULL;
- frame=gtk_frame_new( title );
- gtk_widget_set_name( frame,"frame" );
- gtk_widget_show( frame );
- gtk_frame_set_shadow_type( GTK_FRAME( frame ),type );
- if ( !parent ) return frame;
- if ( add ) gtk_container_add( GTK_CONTAINER( parent ),frame );
- else gtk_box_pack_start( GTK_BOX( parent ),frame,FALSE,FALSE,0 );
- return frame;
-}
-
-GtkWidget * AddLabel( const char * title,GtkWidget * parent )
-{
- GtkWidget * label;
- label=gtk_label_new( title );
- gtk_widget_set_name( label,"label" );
- gtk_widget_show( label );
- if ( parent ) gtk_box_pack_start( GTK_BOX( parent ),label,FALSE,FALSE,0 );
- gtk_misc_set_alignment( GTK_MISC( label ),0,0.5 );
- gtk_misc_set_padding( GTK_MISC( label ),4,0 );
- return label;
-}
-
-GtkWidget * AddVBox( GtkWidget * parent,int type )
-{
- GtkWidget * vbox;
- vbox=gtk_vbox_new( FALSE,0 );
- gtk_widget_set_name( vbox,"vbox" );
- gtk_widget_show( vbox );
- if ( parent )
- {
- if ( type ) gtk_box_pack_start( GTK_BOX( parent ),vbox,FALSE,FALSE,0 );
- else gtk_container_add( GTK_CONTAINER( parent ),vbox );
- }
- return vbox;
-}
-
-GtkWidget * AddHBox( GtkWidget * parent,int type )
-{
- GtkWidget * hbox;
- hbox=gtk_hbox_new( FALSE,0 );
- gtk_widget_set_name( hbox,"hbox" );
- gtk_widget_show( hbox );
- if ( parent )
- {
- if ( type ) gtk_box_pack_start( GTK_BOX( parent ),hbox,FALSE,FALSE,0 );
- else gtk_container_add( GTK_CONTAINER( parent ),hbox );
- }
- return hbox;
-}
-
-GtkWidget * AddCheckButton( const char * title, GtkWidget * parent )
-{
- GtkWidget * CB;
- CB=gtk_check_button_new_with_label( title );
- gtk_widget_set_name( CB,"CB" );
- gtk_widget_show( CB );
- gtk_box_pack_start( GTK_BOX( parent ),CB,FALSE,FALSE,0 );
- return CB;
-}
-
-GtkWidget * AddRadioButton( const char * title,GSList ** group,GtkWidget * parent )
-{
- GtkWidget * RB;
- RB=gtk_radio_button_new_with_label( *group,title );
- *group=gtk_radio_button_group( GTK_RADIO_BUTTON( RB ) );
- gtk_widget_set_name( RB,"RB" );
- gtk_widget_show( RB );
- gtk_box_pack_start( GTK_BOX( parent ),RB,FALSE,FALSE,0 );
- return RB;
-}
-
-GtkWidget * AddSpinButton( const char * title,GtkAdjustment * adj,GtkWidget * parent )
-{
- GtkWidget * SB;
- GtkWidget * label;
- label=gtk_label_new( title );
- gtk_misc_set_alignment( GTK_MISC( label ),0,0.5 );
- gtk_box_pack_start( GTK_BOX( parent ),label,FALSE,FALSE,0 );
- gtk_widget_show( label );
- SB=gtk_spin_button_new( adj,0,0 );
- gtk_widget_set_name( SB,"SB" );
- gtk_box_pack_start( GTK_BOX( parent ),SB,FALSE,FALSE,0 );
- gtk_widget_show( SB );
- return SB;
-}
-
-GtkWidget * AddButton( const char * title,GtkWidget * parent )
-{
- GtkWidget * B;
- B=gtk_button_new_with_label( title );
- gtk_widget_set_name( B,"B" );
- gtk_widget_show( B );
- gtk_container_add( GTK_CONTAINER( parent ),B );
- return B;
-}
-
-GtkWidget * AddHSeparator( GtkWidget * parent )
-{
- GtkWidget * hseparator;
- hseparator=gtk_hseparator_new();
- gtk_widget_set_name( hseparator,"hseparator1" );
- gtk_widget_show( hseparator );
- gtk_box_pack_start( GTK_BOX( parent ),hseparator,FALSE,FALSE,0 );
- gtk_widget_set_usize( hseparator,-2,6 );
- return hseparator;
-}
-
-GtkWidget * AddHButtonBox( GtkWidget * parent )
-{
- GtkWidget * hbuttonbox;
- hbuttonbox=gtk_hbutton_box_new();
- gtk_widget_set_name( hbuttonbox,"hbuttonbox" );
- gtk_widget_show( hbuttonbox );
- gtk_box_pack_start( GTK_BOX( parent ),hbuttonbox,FALSE,FALSE,0 );
- gtk_button_box_set_child_size( GTK_BUTTON_BOX( hbuttonbox ),85,20 );
- return hbuttonbox;
-}
-
-GtkWidget * AddHScaler( GtkAdjustment * adj,GtkWidget * parent,int digit )
-{
- GtkWidget * HS;
- HS=gtk_hscale_new( adj );
- gtk_widget_set_name( HS,"HS" );
- gtk_widget_show( HS );
- if ( parent ) gtk_box_pack_start( GTK_BOX( parent ),HS,TRUE,TRUE,0 );
- gtk_scale_set_value_pos( GTK_SCALE( HS ),GTK_POS_RIGHT );
- gtk_scale_set_digits( GTK_SCALE( HS ),digit );
- return HS;
-}
-
-GtkWidget * AddVScaler( GtkAdjustment * adj,GtkWidget * parent,int digit )
-{
- GtkWidget * VS;
- VS=gtk_vscale_new( adj );
- gtk_widget_set_name( VS,"VS" );
- gtk_widget_show( VS );
- if ( parent ) gtk_box_pack_start( GTK_BOX( parent ),VS,TRUE,TRUE,0 );
-// gtk_scale_set_value_pos( GTK_SCALE( VS ),GTK_POS_RIGHT );
- if ( digit == -1 ) gtk_scale_set_draw_value( GTK_SCALE( VS ),FALSE );
- else gtk_scale_set_digits( GTK_SCALE( VS ),digit );
- return VS;
-}
-
-GtkWidget * AddComboBox( GtkWidget * parent )
-{
- GtkWidget * CB;
- CB=gtk_combo_new();
- gtk_widget_set_name( CB,"CB" );
- gtk_widget_show( CB );
- if ( parent ) gtk_box_pack_start( GTK_BOX( parent ),CB,TRUE,TRUE,0 );
- return CB;
-}
diff --git a/gui/mplayer/gtk/gtk_common.h b/gui/mplayer/gtk/gtk_common.h
deleted file mode 100644
index eff9887e1f..0000000000
--- a/gui/mplayer/gtk/gtk_common.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * 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_GUI_GTK_COMMON_H
-#define MPLAYER_GUI_GTK_COMMON_H
-
-#include <gdk/gdkkeysyms.h>
-#include <gtk/gtk.h>
-
-GtkWidget * AddDialogFrame( GtkWidget * parent );
-GtkWidget * AddFrame( const char * title, int type, GtkWidget * parent, int add );
-GtkWidget * AddLabel( const char * title, GtkWidget * parent );
-GtkWidget * AddVBox( GtkWidget * parent, int type );
-GtkWidget * AddHBox( GtkWidget * parent, int type );
-GtkWidget * AddCheckButton( const char * title, GtkWidget * parent );
-GtkWidget * AddRadioButton( const char * title, GSList ** group, GtkWidget * parent );
-GtkWidget * AddSpinButton( const char * title, GtkAdjustment * adj, GtkWidget * parent );
-GtkWidget * AddButton( const char * title, GtkWidget * parent );
-GtkWidget * AddHSeparator( GtkWidget * parent );
-GtkWidget * AddHButtonBox( GtkWidget * parent );
-GtkWidget * AddHScaler( GtkAdjustment * adj, GtkWidget * parent, int digit );
-GtkWidget * AddVScaler( GtkAdjustment * adj, GtkWidget * parent, int digit );
-GtkWidget * AddComboBox( GtkWidget * parent );
-void WidgetDestroy( GtkWidget * widget, GtkWidget ** widget_pointer );
-
-#endif /* MPLAYER_GUI_GTK_COMMON_H */
diff --git a/gui/mplayer/gtk/gtk_url.c b/gui/mplayer/gtk/gtk_url.c
deleted file mode 100644
index 4899e801b1..0000000000
--- a/gui/mplayer/gtk/gtk_url.c
+++ /dev/null
@@ -1,171 +0,0 @@
-/*
- * 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.
- */
-
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-
-#include <gdk/gdkkeysyms.h>
-#include <gtk/gtk.h>
-
-#include "gtk_url.h"
-#include "gtk_common.h"
-#include "gui/interface.h"
-#include "gui/app.h"
-#include "gui/mplayer/gmplayer.h"
-#include "gui/mplayer/widgets.h"
-#include "help_mp.h"
-
-GtkWidget * URL = NULL;
-
-static GtkWidget * URLCombo;
-static GtkWidget * URLEntry;
-static GList * URLComboEntrys = NULL;
-
-void ShowURLDialogBox( void )
-{
- if ( URL ) gtkActive( URL );
- else URL=create_URL();
-
- if ( URLList )
- {
- URLItem * item = URLList;
- g_list_free( URLComboEntrys );
- URLComboEntrys=NULL;
- while( item )
- {
- URLComboEntrys=g_list_append( URLComboEntrys,(gchar *)item->url );
- item=item->next;
- }
- }
-
- if ( URLComboEntrys )
- {
- gtk_entry_set_text( GTK_ENTRY( URLEntry ),URLComboEntrys->data );
- gtk_combo_set_popdown_strings( GTK_COMBO( URLCombo ),URLComboEntrys );
- }
-
- gtk_widget_show( URL );
-}
-
-void HideURLDialogBox( void )
-{
- if ( !URL ) return;
- gtk_widget_hide( URL );
- gtk_widget_destroy( URL );
- URL=0;
-}
-
-static void on_Button_pressed( GtkButton * button,gpointer user_data )
-{
- URLItem * item;
-
- if ( (int)user_data )
- {
- gchar * str= strdup( gtk_entry_get_text( GTK_ENTRY( URLEntry ) ) );
-
- if ( str )
- {
- if ( strncmp( str,"http://",7 )
- && strncmp( str,"ftp://",6 )
- && strncmp( str,"mms://",6 )
- && strncmp( str,"pnm://",6 )
- && strncmp( str,"rtsp://",7 ) )
- {
- gchar * tmp;
- tmp=malloc( strlen( str ) + 8 );
- sprintf( tmp,"http://%s",str );
- free( str ); str=tmp;
- }
- URLComboEntrys=g_list_prepend( URLComboEntrys,(gchar *)str );
-
- item=calloc( 1,sizeof( URLItem ) );
- item->url=gstrdup( str );
- gtkSet( gtkAddURLItem,0,(void *)item );
-
- guiSetFilename( guiIntfStruct.Filename,str ); guiIntfStruct.FilenameChanged=1;
- mplEventHandling( evPlayNetwork,0 );
- }
- }
- HideURLDialogBox();
-}
-
-GtkWidget * create_URL( void )
-{
- GtkWidget * vbox1;
- GtkWidget * hbox1;
- GtkWidget * hbuttonbox1;
- GtkWidget * Ok;
- GtkWidget * Cancel;
- GtkAccelGroup * accel_group;
-
- accel_group=gtk_accel_group_new();
-
- URL=gtk_window_new( GTK_WINDOW_TOPLEVEL );
- gtk_widget_set_name( URL,"URL" );
- gtk_object_set_data( GTK_OBJECT( URL ),"URL",URL );
- gtk_widget_set_usize( URL,384,70 );
- GTK_WIDGET_SET_FLAGS( URL,GTK_CAN_DEFAULT );
- gtk_window_set_title( GTK_WINDOW( URL ),MSGTR_Network );
- gtk_window_set_position( GTK_WINDOW( URL ),GTK_WIN_POS_CENTER );
- gtk_window_set_policy( GTK_WINDOW( URL ),TRUE,TRUE,FALSE );
- gtk_window_set_wmclass( GTK_WINDOW( URL ),"Network","MPlayer" );
-
- gtk_widget_realize( URL );
- gtkAddIcon( URL );
-
- vbox1=AddVBox( AddDialogFrame( URL ),0 );
- hbox1=AddHBox( vbox1,1 );
- AddLabel( "URL: ",hbox1 );
-
- URLCombo=AddComboBox( hbox1 );
-/*
- gtk_combo_new();
- gtk_widget_set_name( URLCombo,"URLCombo" );
- gtk_widget_show( URLCombo );
- gtk_box_pack_start( GTK_BOX( hbox1 ),URLCombo,TRUE,TRUE,0 );
-*/
- URLEntry=GTK_COMBO( URLCombo )->entry;
- gtk_widget_set_name( URLEntry,"URLEntry" );
- gtk_widget_show( URLEntry );
-
- AddHSeparator( vbox1 );
-
- hbuttonbox1=AddHButtonBox( vbox1 );
- gtk_button_box_set_layout( GTK_BUTTON_BOX( hbuttonbox1 ),GTK_BUTTONBOX_END );
- gtk_button_box_set_spacing( GTK_BUTTON_BOX( hbuttonbox1 ),10 );
-
- Ok=AddButton( MSGTR_Ok,hbuttonbox1 );
- Cancel=AddButton( MSGTR_Cancel,hbuttonbox1 );
-
- gtk_widget_add_accelerator( Ok,"clicked",accel_group,GDK_Return,0,GTK_ACCEL_VISIBLE );
- gtk_widget_add_accelerator( Cancel,"clicked",accel_group,GDK_Escape,0,GTK_ACCEL_VISIBLE );
-
- gtk_signal_connect( GTK_OBJECT( URL ),"destroy",GTK_SIGNAL_FUNC( WidgetDestroy ),&URL );
- gtk_signal_connect( GTK_OBJECT( Ok ),"clicked",GTK_SIGNAL_FUNC( on_Button_pressed ),(void *)1 );
- gtk_signal_connect( GTK_OBJECT( Cancel ),"clicked",GTK_SIGNAL_FUNC( on_Button_pressed ),NULL );
-
- gtk_widget_grab_focus( URLEntry );
- gtk_window_add_accel_group( GTK_WINDOW( URL ),accel_group );
-
- return URL;
-}
-
diff --git a/gui/mplayer/gtk/gtk_url.h b/gui/mplayer/gtk/gtk_url.h
deleted file mode 100644
index 814c053bd4..0000000000
--- a/gui/mplayer/gtk/gtk_url.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * 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_GUI_GTK_URL_H
-#define MPLAYER_GUI_GTK_URL_H
-
-#include <gtk/gtk.h>
-
-extern GtkWidget * URL;
-extern int gtkVURLDialogBox;
-
-void ShowURLDialogBox( void );
-GtkWidget * create_URL( void );
-
-#endif /* MPLAYER_GUI_GTK_URL_H */
diff --git a/gui/mplayer/gtk/mb.c b/gui/mplayer/gtk/mb.c
deleted file mode 100644
index 76137d629c..0000000000
--- a/gui/mplayer/gtk/mb.c
+++ /dev/null
@@ -1,114 +0,0 @@
-/*
- * 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.
- */
-
-#include "config.h"
-#include "gui/app.h"
-#include "help_mp.h"
-
-#include "gui/mplayer/pixmaps/error.xpm"
-#include "gui/mplayer/pixmaps/warning.xpm"
-
-#include "gui/mplayer/widgets.h"
-#include "mb.h"
-#include "gtk_common.h"
-
-GtkWidget * gtkMessageBoxText;
-GtkWidget * MessageBox = NULL;
-
-void ShowMessageBox( const char * msg )
-{
- if ( MessageBox ) { gtk_widget_hide( MessageBox ); gtk_widget_destroy( MessageBox ); }
- MessageBox=create_MessageBox( 0 );
- if ( strlen( msg ) < 20 ) gtk_widget_set_usize( MessageBox,196,-1 );
-}
-
-static void on_Ok_released( GtkButton * button,gpointer user_data )
-{
- gtk_widget_hide( MessageBox );
- gtk_widget_destroy( MessageBox );
- MessageBox=NULL;
-}
-
-GtkWidget * create_MessageBox( int type )
-{
- GtkWidget * vbox1;
- GtkWidget * hbox1;
- GtkWidget * hbuttonbox1;
- GtkWidget * Ok;
- GtkAccelGroup * accel_group;
- GtkStyle * pixmapstyle;
- GdkPixmap * pixmapwid;
- GdkBitmap * mask;
-
- accel_group=gtk_accel_group_new();
-
- MessageBox=gtk_window_new( GTK_WINDOW_TOPLEVEL );
- gtk_widget_set_name( MessageBox,"MessageBox" );
- gtk_object_set_data( GTK_OBJECT( MessageBox ),"MessageBox",MessageBox );
- gtk_widget_set_events( MessageBox,GDK_EXPOSURE_MASK | GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK | GDK_VISIBILITY_NOTIFY_MASK );
- gtk_window_set_title( GTK_WINDOW( MessageBox ),"MPlayer ..." );
- gtk_window_set_position( GTK_WINDOW( MessageBox ),GTK_WIN_POS_CENTER );
- gtk_window_set_modal( GTK_WINDOW( MessageBox ),TRUE );
- gtk_window_set_policy( GTK_WINDOW( MessageBox ),TRUE,TRUE,FALSE );
- gtk_window_set_wmclass( GTK_WINDOW( MessageBox ),"Message","MPlayer" );
-
- gtk_widget_realize( MessageBox );
- gtkAddIcon( MessageBox );
-
- vbox1=AddVBox( AddDialogFrame( MessageBox ),0 );
- hbox1=AddHBox( vbox1,1 );
-
- pixmapstyle=gtk_widget_get_style( MessageBox );
-
- pixmapwid=gdk_pixmap_colormap_create_from_xpm_d( MessageBox->window,gdk_colormap_get_system(),&mask,&pixmapstyle->bg[GTK_STATE_NORMAL],(gchar ** )warning_xpm );
- WarningPixmap=gtk_pixmap_new( pixmapwid,mask );
- pixmapwid=gdk_pixmap_colormap_create_from_xpm_d( MessageBox->window,gdk_colormap_get_system(),&mask,&pixmapstyle->bg[GTK_STATE_NORMAL],(gchar ** )error_xpm );
- ErrorPixmap=gtk_pixmap_new( pixmapwid,mask );
-
- gtk_widget_set_name( WarningPixmap,"pixmap1" );
- gtk_widget_hide( WarningPixmap );
- gtk_box_pack_start( GTK_BOX( hbox1 ),WarningPixmap,FALSE,FALSE,0 );
- gtk_widget_set_usize( WarningPixmap,55,-2 );
-
- gtk_widget_set_name( ErrorPixmap,"pixmap1" );
- gtk_widget_hide( ErrorPixmap );
- gtk_box_pack_start( GTK_BOX( hbox1 ),ErrorPixmap,FALSE,FALSE,0 );
- gtk_widget_set_usize( ErrorPixmap,55,-2 );
-
- gtkMessageBoxText=gtk_label_new( "Text jol. Ha ezt megerted,akkor neked nagyon jo a magyar tudasod,te." );
- gtk_widget_set_name( gtkMessageBoxText,"gtkMessageBoxText" );
- gtk_widget_show( gtkMessageBoxText );
- gtk_box_pack_start( GTK_BOX( hbox1 ),gtkMessageBoxText,TRUE,TRUE,0 );
-// gtk_label_set_justify( GTK_LABEL( gtkMessageBoxText ),GTK_JUSTIFY_FILL );
- gtk_label_set_justify( GTK_LABEL( gtkMessageBoxText ),GTK_JUSTIFY_CENTER );
- gtk_label_set_line_wrap( GTK_LABEL( gtkMessageBoxText ),FALSE );
-
- AddHSeparator( vbox1 );
- hbuttonbox1=AddHButtonBox( vbox1 );
- Ok=AddButton( MSGTR_Ok,hbuttonbox1 );
-
- gtk_widget_add_accelerator( Ok,"clicked",accel_group,GDK_Return,0,GTK_ACCEL_VISIBLE );
- gtk_widget_add_accelerator( Ok,"clicked",accel_group,GDK_Escape,0,GTK_ACCEL_VISIBLE );
-
- gtk_signal_connect( GTK_OBJECT( MessageBox ),"destroy",GTK_SIGNAL_FUNC( WidgetDestroy ),&MessageBox );
- gtk_signal_connect( GTK_OBJECT( Ok ),"clicked",GTK_SIGNAL_FUNC( on_Ok_released ),NULL );
-
- gtk_window_add_accel_group( GTK_WINDOW( MessageBox ),accel_group );
-
- return MessageBox;
-}
diff --git a/gui/mplayer/gtk/mb.h b/gui/mplayer/gtk/mb.h
deleted file mode 100644
index 75b0a2cc62..0000000000
--- a/gui/mplayer/gtk/mb.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * 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_GUI_MB_H
-#define MPLAYER_GUI_MB_H
-
-#include <gtk/gtk.h>
-
-extern GtkWidget * MessageBox;
-
-GtkWidget * create_MessageBox( int type );
-void ShowMessageBox( const char * msg );
-
-#endif /* MPLAYER_GUI_MB_H */
diff --git a/gui/mplayer/gtk/menu.c b/gui/mplayer/gtk/menu.c
deleted file mode 100644
index 48736ce81b..0000000000
--- a/gui/mplayer/gtk/menu.c
+++ /dev/null
@@ -1,645 +0,0 @@
-/*
- * 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.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "config.h"
-#include "help_mp.h"
-#include "access_mpcontext.h"
-#include "mixer.h"
-
-#include "menu.h"
-#include "gui/mplayer/widgets.h"
-#include "gui/mplayer/gmplayer.h"
-#include "gui/app.h"
-
-#include "stream/stream.h"
-#include "libmpdemux/demuxer.h"
-#include "libmpdemux/stheader.h"
-
-#include "gui/mplayer/pixmaps/ab.xpm"
-#include "gui/mplayer/pixmaps/half.xpm"
-#include "gui/mplayer/pixmaps/normal.xpm"
-#include "gui/mplayer/pixmaps/double.xpm"
-#include "gui/mplayer/pixmaps/fs.xpm"
-#include "gui/mplayer/pixmaps/exit.xpm"
-#include "gui/mplayer/pixmaps/prefs.xpm"
-#include "gui/mplayer/pixmaps/eq.xpm"
-#include "gui/mplayer/pixmaps/pl.xpm"
-#include "gui/mplayer/pixmaps/skin.xpm"
-#include "gui/mplayer/pixmaps/sound.xpm"
-#include "gui/mplayer/pixmaps/open.xpm"
-#include "gui/mplayer/pixmaps/play.xpm"
-#include "gui/mplayer/pixmaps/stop2.xpm"
-#include "gui/mplayer/pixmaps/pause.xpm"
-#include "gui/mplayer/pixmaps/prev.xpm"
-#include "gui/mplayer/pixmaps/next.xpm"
-#include "gui/mplayer/pixmaps/aspect.xpm"
-#include "gui/mplayer/pixmaps/a11.xpm"
-#include "gui/mplayer/pixmaps/a169.xpm"
-#include "gui/mplayer/pixmaps/a235.xpm"
-#include "gui/mplayer/pixmaps/a43.xpm"
-#include "gui/mplayer/pixmaps/file2.xpm"
-#include "gui/mplayer/pixmaps/url.xpm"
-#include "gui/mplayer/pixmaps/sub.xpm"
-#include "gui/mplayer/pixmaps/delsub.xpm"
-#include "gui/mplayer/pixmaps/empty.xpm"
-#include "gui/mplayer/pixmaps/loadeaf.xpm"
-#include "gui/mplayer/pixmaps/title.xpm"
-#ifdef CONFIG_DVDREAD
-#include "gui/mplayer/pixmaps/dvd.xpm"
-#include "gui/mplayer/pixmaps/playdvd.xpm"
-#include "gui/mplayer/pixmaps/chapter.xpm"
-#include "gui/mplayer/pixmaps/dolby.xpm"
-#include "gui/mplayer/pixmaps/tongue.xpm"
-#include "gui/mplayer/pixmaps/tonguebla.xpm"
-#include "gui/mplayer/pixmaps/empty1px.xpm"
-#endif
-#ifdef CONFIG_VCD
-#include "gui/mplayer/pixmaps/vcd.xpm"
-#include "gui/mplayer/pixmaps/playvcd.xpm"
-#endif
-
-void ActivateMenuItem( int Item )
-{
-// fprintf( stderr,"[menu] item: %d.%d\n",Item&0xffff,Item>>16 );
- gtkPopupMenu=Item & 0x0000ffff;
- gtkPopupMenuParam=Item >> 16;
- mplEventHandling( Item & 0x0000ffff,Item >> 16 );
-}
-
-static GtkWidget * AddMenuCheckItem(GtkWidget *window1, const char * immagine_xpm, GtkWidget* Menu,const char* label, gboolean state, int Number)
-{
- GtkWidget * Label = NULL;
- GtkWidget * Pixmap = NULL;
- GtkWidget * hbox = NULL;
- GtkWidget * Item = NULL;
-
- GdkPixmap *PixmapIcon = NULL;
- GdkColor transparent;
- GdkBitmap *MaskIcon = NULL;
-
- PixmapIcon = gdk_pixmap_create_from_xpm_d (window1->window, &MaskIcon, &transparent,(gchar **)immagine_xpm );
- Pixmap = gtk_pixmap_new (PixmapIcon, MaskIcon);
- gdk_pixmap_unref (PixmapIcon);
-
- Item=gtk_check_menu_item_new();
- Label = gtk_label_new (label);
-
- hbox = gtk_hbox_new (FALSE, 8);
- gtk_box_pack_start (GTK_BOX (hbox), Pixmap, FALSE, FALSE, 0);
- gtk_box_pack_start (GTK_BOX (hbox), Label, FALSE, FALSE, 0);
- gtk_container_add (GTK_CONTAINER (Item), hbox);
-
- gtk_menu_append( GTK_MENU( Menu ),Item );
-
- gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(Item),state);
- gtk_signal_connect_object( GTK_OBJECT(Item),"activate",
- GTK_SIGNAL_FUNC(ActivateMenuItem),(gpointer)Number );
- gtk_menu_item_right_justify (GTK_MENU_ITEM (Item));
- gtk_widget_show_all(Item);
-
- return Item;
-}
-GtkWidget * AddMenuItem( GtkWidget *window1, const char * immagine_xpm, GtkWidget * SubMenu,const char * label,int Number )
-{
- GtkWidget * Label = NULL;
- GtkWidget * Pixmap = NULL;
- GtkWidget * hbox = NULL;
- GtkWidget * Item = NULL;
- GdkPixmap * PixmapIcon = NULL;
- GdkColor transparent;
- GdkBitmap * MaskIcon = NULL;
-
- PixmapIcon = gdk_pixmap_create_from_xpm_d (window1->window, &MaskIcon, &transparent,(gchar **)immagine_xpm );
- Pixmap = gtk_pixmap_new (PixmapIcon, MaskIcon);
- gdk_pixmap_unref (PixmapIcon);
-
- Item=gtk_menu_item_new();
- Label = gtk_label_new (label);
-
- hbox = gtk_hbox_new (FALSE, 8);
- gtk_box_pack_start (GTK_BOX (hbox), Pixmap, FALSE, FALSE, 0);
- gtk_box_pack_start (GTK_BOX (hbox), Label, FALSE, FALSE, 0);
- gtk_container_add (GTK_CONTAINER (Item), hbox);
-
-
- gtk_menu_append( GTK_MENU( SubMenu ),Item );
- gtk_signal_connect_object( GTK_OBJECT(Item),"activate",
- GTK_SIGNAL_FUNC(ActivateMenuItem),(gpointer)Number );
-
- gtk_menu_item_right_justify (GTK_MENU_ITEM (Item));
- gtk_widget_show_all(Item);
- return Item;
-}
-
-
-GtkWidget * AddSubMenu( GtkWidget *window1, const char * immagine_xpm, GtkWidget * Menu,const char * label )
-{
- GtkWidget * Label = NULL;
- GtkWidget * Pixmap = NULL;
- GtkWidget * hbox = NULL;
- GtkWidget * Item = NULL;
- GtkWidget * SubItem = NULL;
- GdkPixmap * PixmapIcon = NULL;
- GdkColor transparent;
- GdkBitmap * MaskIcon = NULL;
-
- PixmapIcon = gdk_pixmap_create_from_xpm_d (window1->window, &MaskIcon, &transparent,(gchar **)immagine_xpm);
- Pixmap = gtk_pixmap_new (PixmapIcon, MaskIcon);
- gdk_pixmap_unref (PixmapIcon);
-
- SubItem=gtk_menu_item_new();
- Item=gtk_menu_new();
- Label = gtk_label_new (label);
-
- hbox = gtk_hbox_new (FALSE, 8);
- gtk_box_pack_start (GTK_BOX (hbox), Pixmap, FALSE, FALSE, 0);
- gtk_box_pack_start (GTK_BOX (hbox), Label, FALSE, FALSE, 0);
- gtk_container_add (GTK_CONTAINER (SubItem), hbox);
-
- gtk_menu_append( GTK_MENU( Menu ),SubItem );
- gtk_menu_item_set_submenu( GTK_MENU_ITEM( SubItem ),Item );
-
- gtk_widget_show_all( SubItem );
- return Item;
-}
-
-GtkWidget * AddSeparator( GtkWidget * Menu )
-{
- GtkWidget * Item = NULL;
-
- Item=gtk_menu_item_new ();
- gtk_widget_show( Item );
- gtk_container_add( GTK_CONTAINER( Menu ),Item );
- gtk_widget_set_sensitive( Item,FALSE );
-
- return Item;
-}
-
-typedef struct
-{
- int id;
- const char * name;
-} Languages_t;
-
-#define lng( a,b ) ( (int)(a) * 256 + b )
-static Languages_t Languages[] =
- {
- { lng( 'a','b' ), "Abkhazian" },
- { lng( 'a','a' ), "Afar" },
- { lng( 'a','f' ), "Afrikaans" },
- { lng( 's','q' ), "Albanian" },
- { lng( 'a','m' ), "Amharic" },
- { lng( 'a','r' ), "Arabic" },
- { lng( 'h','y' ), "Armenian" },
- { lng( 'a','s' ), "Assamese" },
- { lng( 'a','e' ), "Avestan" },
- { lng( 'a','y' ), "Aymara" },
- { lng( 'a','z' ), "Azerbaijani" },
- { lng( 'b','a' ), "Bashkir" },
- { lng( 'e','u' ), "Basque" },
- { lng( 'b','e' ), "Belarusian" },
- { lng( 'b','n' ), "Bengali" },
- { lng( 'b','h' ), "Bihari" },
- { lng( 'b','i' ), "Bislama" },
- { lng( 'b','s' ), "Bosnian" },
- { lng( 'b','r' ), "Breton" },
- { lng( 'b','g' ), "Bulgarian" },
- { lng( 'm','y' ), "Burmese" },
- { lng( 'c','a' ), "Catalan" },
- { lng( 'c','h' ), "Chamorro" },
- { lng( 'c','e' ), "Chechen" },
- { lng( 'n','y' ), "Chichewa;Nyanja" },
- { lng( 'z','h' ), "Chinese" },
- { lng( 'c','u' ), "ChurchSlavic" },
- { lng( 'c','v' ), "Chuvash" },
- { lng( 'k','w' ), "Cornish" },
- { lng( 'c','o' ), "Corsican" },
- { lng( 'h','r' ), "Croatian" },
- { lng( 'c','s' ), "Czech" },
- { lng( 'd','a' ), "Danish" },
- { lng( 'n','l' ), "Dutch" },
- { lng( 'd','z' ), "Dzongkha" },
- { lng( 'e','n' ), "English" },
- { lng( 'e','o' ), "Esperanto" },
- { lng( 'e','t' ), "Estonian" },
- { lng( 'f','o' ), "Faroese" },
- { lng( 'f','j' ), "Fijian" },
- { lng( 'f','i' ), "Finnish" },
- { lng( 'f','r' ), "French" },
- { lng( 'f','y' ), "Frisian" },
- { lng( 'g','d' ), "Gaelic(Scots" },
- { lng( 'g','l' ), "Gallegan" },
- { lng( 'k','a' ), "Georgian" },
- { lng( 'd','e' ), "German" },
- { lng( 'e','l' ), "Greek" },
- { lng( 'g','n' ), "Guarani" },
- { lng( 'g','u' ), "Gujarati" },
- { lng( 'h','a' ), "Hausa" },
- { lng( 'h','e' ), "Hebrew" },
- { lng( 'i','w' ), "Hebrew" },
- { lng( 'h','z' ), "Herero" },
- { lng( 'h','i' ), "Hindi" },
- { lng( 'h','o' ), "HiriMotu" },
- { lng( 'h','u' ), "Hungarian" },
- { lng( 'i','s' ), "Icelandic" },
- { lng( 'i','d' ), "Indonesian" },
- { lng( 'i','n' ), "Indonesian" },
- { lng( 'i','a' ), "Interlingua" },
- { lng( 'i','e' ), "Interlingue" },
- { lng( 'i','u' ), "Inuktitut" },
- { lng( 'i','k' ), "Inupiaq" },
- { lng( 'g','a' ), "Irish" },
- { lng( 'i','t' ), "Italian" },
- { lng( 'j','a' ), "Japanese" },
- { lng( 'j','v' ), "Javanese" },
- { lng( 'j','w' ), "Javanese" },
- { lng( 'k','l' ), "Kalaallisut" },
- { lng( 'k','n' ), "Kannada" },
- { lng( 'k','s' ), "Kashmiri" },
- { lng( 'k','k' ), "Kazakh" },
- { lng( 'k','m' ), "Khmer" },
- { lng( 'k','i' ), "Kikuyu" },
- { lng( 'r','w' ), "Kinyarwanda" },
- { lng( 'k','y' ), "Kirghiz" },
- { lng( 'k','v' ), "Komi" },
- { lng( 'k','o' ), "Korean" },
- { lng( 'k','j' ), "Kuanyama" },
- { lng( 'k','u' ), "Kurdish" },
- { lng( 'l','o' ), "Lao" },
- { lng( 'l','a' ), "Latin" },
- { lng( 'l','v' ), "Latvian" },
- { lng( 'l','b' ), "Letzeburgesch" },
- { lng( 'l','n' ), "Lingala" },
- { lng( 'l','t' ), "Lithuanian" },
- { lng( 'm','k' ), "Macedonian" },
- { lng( 'm','g' ), "Malagasy" },
- { lng( 'm','s' ), "Malay" },
- { lng( 'm','l' ), "Malayalam" },
- { lng( 'm','t' ), "Maltese" },
- { lng( 'g','v' ), "Manx" },
- { lng( 'm','i' ), "Maori" },
- { lng( 'm','r' ), "Marathi" },
- { lng( 'm','h' ), "Marshall" },
- { lng( 'm','o' ), "Moldavian" },
- { lng( 'm','n' ), "Mongolian" },
- { lng( 'n','a' ), "Nauru" },
- { lng( 'n','v' ), "Navajo" },
- { lng( 'n','d' ), "North Ndebele" },
- { lng( 'n','r' ), "South Ndebele" },
- { lng( 'n','g' ), "Ndonga" },
- { lng( 'n','e' ), "Nepali" },
- { lng( 's','e' ), "NorthernSami" },
- { lng( 'n','o' ), "Norwegian" },
- { lng( 'n','b' ), "NorwegianBokmål" },
- { lng( 'n','n' ), "NorwegianNynorsk" },
- { lng( 'n','y' ), "Nyanja;Chichewa" },
- { lng( 'o','c' ), "Occitan(post1500;Provençal" },
- { lng( 'o','r' ), "Oriya" },
- { lng( 'o','m' ), "Oromo" },
- { lng( 'o','s' ), "Ossetian;Ossetic" },
- { lng( 'p','i' ), "Pali" },
- { lng( 'p','a' ), "Panjabi" },
- { lng( 'f','a' ), "Persian" },
- { lng( 'p','l' ), "Polish" },
- { lng( 'p','t' ), "Portuguese" },
- { lng( 'o','c' ), "Provençal;Occitan(post1500" },
- { lng( 'p','s' ), "Pushto" },
- { lng( 'q','u' ), "Quechua" },
- { lng( 'r','m' ), "Raeto-Romance" },
- { lng( 'r','o' ), "Romanian" },
- { lng( 'r','n' ), "Rundi" },
- { lng( 'r','u' ), "Russian" },
- { lng( 's','m' ), "Samoan" },
- { lng( 's','g' ), "Sango" },
- { lng( 's','a' ), "Sanskrit" },
- { lng( 's','c' ), "Sardinian" },
- { lng( 's','r' ), "Serbian" },
- { lng( 's','n' ), "Shona" },
- { lng( 's','d' ), "Sindhi" },
- { lng( 's','i' ), "Sinhalese" },
- { lng( 's','k' ), "Slovak" },
- { lng( 's','l' ), "Slovenian" },
- { lng( 's','o' ), "Somali" },
- { lng( 's','t' ), "Sotho" },
- { lng( 'e','s' ), "Spanish" },
- { lng( 's','u' ), "Sundanese" },
- { lng( 's','w' ), "Swahili" },
- { lng( 's','s' ), "Swati" },
- { lng( 's','v' ), "Swedish" },
- { lng( 't','l' ), "Tagalog" },
- { lng( 't','y' ), "Tahitian" },
- { lng( 't','g' ), "Tajik" },
- { lng( 't','a' ), "Tamil" },
- { lng( 't','t' ), "Tatar" },
- { lng( 't','e' ), "Telugu" },
- { lng( 't','h' ), "Thai" },
- { lng( 'b','o' ), "Tibetan" },
- { lng( 't','i' ), "Tigrinya" },
- { lng( 't','o' ), "Tonga" },
- { lng( 't','s' ), "Tsonga" },
- { lng( 't','n' ), "Tswana" },
- { lng( 't','r' ), "Turkish" },
- { lng( 't','k' ), "Turkmen" },
- { lng( 't','w' ), "Twi" },
- { lng( 'u','g' ), "Uighur" },
- { lng( 'u','k' ), "Ukrainian" },
- { lng( 'u','r' ), "Urdu" },
- { lng( 'u','z' ), "Uzbek" },
- { lng( 'v','i' ), "Vietnamese" },
- { lng( 'v','o' ), "Volapük" },
- { lng( 'c','y' ), "Welsh" },
- { lng( 'w','o' ), "Wolof" },
- { lng( 'x','h' ), "Xhosa" },
- { lng( 'y','i' ), "Yiddish" },
- { lng( 'j','i' ), "Yiddish" },
- { lng( 'y','o' ), "Yoruba" },
- { lng( 'z','a' ), "Zhuang" },
- { lng( 'z','u' ), "Zulu" },
- };
-#undef lng
-
-#ifdef CONFIG_DVDREAD
-static char * ChannelTypes[] =
- { "Dolby Digital","","Mpeg1","Mpeg2","PCM","","Digital Theatre System" };
-static char * ChannelNumbers[] =
- { "","Stereo","","","","5.1" };
-#endif
-
-const char * GetLanguage( int language )
-{
- unsigned int i;
- for ( i=0;i<sizeof( Languages ) / sizeof( Languages_t );i++ )
- if ( Languages[i].id == language ) return Languages[i].name;
- return NULL;
-}
-
-
-GtkWidget * DVDSubMenu;
-GtkWidget * DVDTitleMenu;
-GtkWidget * DVDChapterMenu;
-GtkWidget * DVDAudioLanguageMenu;
-GtkWidget * DVDSubtitleLanguageMenu;
-GtkWidget * AspectMenu;
-GtkWidget * VCDSubMenu;
-GtkWidget * VCDTitleMenu;
-
-GtkWidget * create_PopUpMenu( void )
-{
- GtkWidget * window1;
- GtkWidget * Menu = NULL;
- GtkWidget * SubMenu = NULL;
- GtkWidget * MenuItem = NULL;
- GtkWidget * H, * N, * D, * F;
- mixer_t *mixer = mpctx_get_mixer(guiIntfStruct.mpcontext);
- int global_sub_size = mpctx_get_global_sub_size(guiIntfStruct.mpcontext);
-
- Menu=gtk_menu_new();
- gtk_widget_realize (Menu);
- window1 = gtk_widget_get_toplevel(Menu);
-
-
- AddMenuItem( window1, (const char*)ab_xpm, Menu,MSGTR_MENU_AboutMPlayer" ", evAbout );
- AddSeparator( Menu );
- SubMenu=AddSubMenu( window1, (const char*)open_xpm, Menu,MSGTR_MENU_Open );
- AddMenuItem( window1, (const char*)file2_xpm, SubMenu,MSGTR_MENU_PlayFile" ", evLoadPlay );
-#ifdef CONFIG_VCD
- AddMenuItem( window1, (const char*)playvcd_xpm, SubMenu,MSGTR_MENU_PlayVCD, evPlayVCD );
-#endif
-#ifdef CONFIG_DVDREAD
- AddMenuItem( window1, (const char*)playdvd_xpm, SubMenu,MSGTR_MENU_PlayDVD, evPlayDVD );
-#endif
- AddMenuItem( window1, (const char*)url_xpm, SubMenu,MSGTR_MENU_PlayURL, evSetURL );
- AddMenuItem( window1, (const char*)sub_xpm, SubMenu,MSGTR_MENU_LoadSubtitle" ", evLoadSubtitle );
- AddMenuItem( window1, (const char*)delsub_xpm, SubMenu,MSGTR_MENU_DropSubtitle,evDropSubtitle );
- AddMenuItem( window1, (const char*)loadeaf_xpm, SubMenu,MSGTR_MENU_LoadExternAudioFile, evLoadAudioFile );
- SubMenu=AddSubMenu(window1, (const char*)play_xpm, Menu,MSGTR_MENU_Playing );
- AddMenuItem( window1, (const char*)play_xpm, SubMenu,MSGTR_MENU_Play" ", evPlay );
- AddMenuItem( window1, (const char*)pause_xpm, SubMenu,MSGTR_MENU_Pause, evPause );
- AddMenuItem( window1, (const char*)stop2_xpm, SubMenu,MSGTR_MENU_Stop, evStop );
- AddMenuItem( window1, (const char*)next_xpm, SubMenu,MSGTR_MENU_NextStream, evNext );
- AddMenuItem( window1, (const char*)prev_xpm, SubMenu,MSGTR_MENU_PrevStream, evPrev );
-// AddSeparator( SubMenu );
-// AddMenuItem( SubMenu,"Back 10 sec", evBackward10sec );
-// AddMenuItem( SubMenu,"Fwd 10 sec", evForward10sec );
-// AddMenuItem( SubMenu,"Back 1 min", evBackward1min );
-// AddMenuItem( SubMenu,"Fwd 1 min", evForward1min );
-// SubMenu=AddSubMenu( Menu,MSGTR_MENU_Size );
-// AddMenuItem( SubMenu,MSGTR_MENU_NormalSize" ", evNormalSize );
-// AddMenuItem( SubMenu,MSGTR_MENU_DoubleSize, evDoubleSize );
-// AddMenuItem( SubMenu,MSGTR_MENU_FullScreen, evFullScreen );
-#ifdef CONFIG_VCD
- VCDSubMenu=AddSubMenu( window1, (const char*)vcd_xpm, Menu,MSGTR_MENU_VCD );
- AddMenuItem( window1, (const char*)playvcd_xpm, VCDSubMenu,MSGTR_MENU_PlayDisc,evPlayVCD );
- AddSeparator( VCDSubMenu );
- VCDTitleMenu=AddSubMenu( window1, (const char*)title_xpm, VCDSubMenu,MSGTR_MENU_Titles );
- if ( guiIntfStruct.VCDTracks )
- {
- char tmp[32]; int i;
- for ( i=0;i < guiIntfStruct.VCDTracks;i++ )
- {
- snprintf( tmp,32,MSGTR_MENU_Title,i+1 );
- //AddMenuItem( VCDTitleMenu,tmp,( (i+1) << 16 ) + evSetVCDTrack );
- AddMenuItem(window1, (const char*)empty_xpm, VCDTitleMenu,tmp,( (i+1) << 16 ) + evSetVCDTrack );
- }
- }
- else
- {
- MenuItem=AddMenuItem( window1, (const char*)empty_xpm, VCDTitleMenu,MSGTR_MENU_None,evNone );
- gtk_widget_set_sensitive( MenuItem,FALSE );
- }
-#endif
-#ifdef CONFIG_DVDREAD
- DVDSubMenu=AddSubMenu( window1, (const char*)dvd_xpm, Menu,MSGTR_MENU_DVD );
- AddMenuItem( window1, (const char*)playdvd_xpm, DVDSubMenu,MSGTR_MENU_PlayDisc" ", evPlayDVD );
-// AddMenuItem( DVDSubMenu,MSGTR_MENU_ShowDVDMenu, evNone );
- AddSeparator( DVDSubMenu );
- DVDTitleMenu=AddSubMenu( window1, (const char*)title_xpm, DVDSubMenu,MSGTR_MENU_Titles );
- if ( guiIntfStruct.DVD.titles )
- {
- char tmp[32]; int i;
- for ( i=1 ; i<= guiIntfStruct.DVD.titles;i++ )
- {
- snprintf( tmp,32,MSGTR_MENU_Title,i);
- AddMenuCheckItem( window1, (const char*)empty1px_xpm, DVDTitleMenu,tmp,
- guiIntfStruct.DVD.current_title == i,
- (i << 16) + evSetDVDTitle );
- }
- }
- else
- {
- MenuItem=AddMenuItem( window1, (const char*)empty_xpm, DVDTitleMenu,MSGTR_MENU_None,evNone );
- gtk_widget_set_sensitive( MenuItem,FALSE );
- }
- DVDChapterMenu=AddSubMenu( window1, (const char*)chapter_xpm, DVDSubMenu,MSGTR_MENU_Chapters );
- if ( guiIntfStruct.DVD.chapters )
- {
- char tmp[32]; int i;
- for ( i=1;i <= guiIntfStruct.DVD.chapters;i++ )
- {
- snprintf( tmp,32,MSGTR_MENU_Chapter,i );
- AddMenuCheckItem( window1, (const char*)empty1px_xpm, DVDChapterMenu,tmp,guiIntfStruct.DVD.current_chapter == i,
- ( i << 16 ) + evSetDVDChapter );
- }
- }
- else
- {
- MenuItem=AddMenuItem( window1, (const char*)empty_xpm, DVDChapterMenu,MSGTR_MENU_None,evNone );
- gtk_widget_set_sensitive( MenuItem,FALSE );
- }
- DVDAudioLanguageMenu=AddSubMenu( window1, (const char*)tongue_xpm, DVDSubMenu,MSGTR_MENU_AudioLanguages );
- if ( guiIntfStruct.DVD.nr_of_audio_channels )
- {
- char tmp[64]; int i, id = guiIntfStruct.demuxer ? ((demuxer_t *)guiIntfStruct.demuxer)->audio->id : audio_id;
- for ( i=0;i < guiIntfStruct.DVD.nr_of_audio_channels;i++ )
- {
- snprintf( tmp,64,"%s - %s %s",GetLanguage( guiIntfStruct.DVD.audio_streams[i].language ),
- ChannelTypes[ guiIntfStruct.DVD.audio_streams[i].type ],
- ChannelNumbers[ guiIntfStruct.DVD.audio_streams[i].channels ] );
-// if ( id == -1 ) id=audio_id; //guiIntfStruct.DVD.audio_streams[i].id;
- AddMenuCheckItem( window1, (const char*)dolby_xpm, DVDAudioLanguageMenu,tmp,
- id == guiIntfStruct.DVD.audio_streams[i].id,
- ( guiIntfStruct.DVD.audio_streams[i].id << 16 ) + evSetDVDAudio );
- }
- }
- else
- {
- MenuItem=AddMenuItem( window1, (const char*)empty_xpm, DVDAudioLanguageMenu,MSGTR_MENU_None,evNone );
- gtk_widget_set_sensitive( MenuItem,FALSE );
- }
- DVDSubtitleLanguageMenu=AddSubMenu( window1, (const char*)tonguebla_xpm, DVDSubMenu,MSGTR_MENU_SubtitleLanguages );
- if ( guiIntfStruct.DVD.nr_of_subtitles )
- {
- char tmp[64]; int i;
- AddMenuItem( window1, (const char*)empty1px_xpm, DVDSubtitleLanguageMenu,MSGTR_MENU_None,( (unsigned short)-1 << 16 ) + evSetDVDSubtitle );
- for ( i=0;i < guiIntfStruct.DVD.nr_of_subtitles;i++ )
- {
- snprintf( tmp,64,"%s",GetLanguage( guiIntfStruct.DVD.subtitles[i].language ) );
- AddMenuCheckItem( window1, (const char*)empty1px_xpm, DVDSubtitleLanguageMenu,tmp,
- dvdsub_id == guiIntfStruct.DVD.subtitles[i].id,
- ( guiIntfStruct.DVD.subtitles[i].id << 16 ) + evSetDVDSubtitle );
- }
- }
- else
- {
- MenuItem=AddMenuItem( window1, (const char*)empty_xpm, DVDSubtitleLanguageMenu,MSGTR_MENU_None,evNone );
- gtk_widget_set_sensitive( MenuItem,FALSE );
- }
-#endif
-
-// if ( guiIntfStruct.Playing )
- {
- AspectMenu=AddSubMenu( window1, (const char*)aspect_xpm, Menu,MSGTR_MENU_AspectRatio );
- AddMenuItem( window1, (const char*)a11_xpm, AspectMenu,MSGTR_MENU_Original,( 1 << 16 ) + evSetAspect );
- AddMenuItem( window1, (const char*)a169_xpm, AspectMenu,"16:9",( 2 << 16 ) + evSetAspect );
- AddMenuItem( window1, (const char*)a43_xpm, AspectMenu,"4:3",( 3 << 16 ) + evSetAspect );
- AddMenuItem( window1, (const char*)a235_xpm, AspectMenu,"2.35",( 4 << 16 ) + evSetAspect );
- }
-
- if ( guiIntfStruct.Playing && guiIntfStruct.demuxer && guiIntfStruct.StreamType != STREAMTYPE_DVD )
- {
- int i,c = 0;
-
- for ( i=0;i < MAX_A_STREAMS;i++ )
- if ( ((demuxer_t *)guiIntfStruct.demuxer)->a_streams[i] ) c++;
-
- if ( c > 1 )
- {
- SubMenu=AddSubMenu( window1, (const char*)empty_xpm, Menu,MSGTR_MENU_AudioTrack );
- for ( i=0;i < MAX_A_STREAMS;i++ )
- if ( ((demuxer_t *)guiIntfStruct.demuxer)->a_streams[i] )
- {
- int aid = ((sh_audio_t *)((demuxer_t *)guiIntfStruct.demuxer)->a_streams[i])->aid;
- char tmp[32];
- snprintf( tmp,32,MSGTR_MENU_Track,aid );
- AddMenuItem( window1, (const char*)empty_xpm, SubMenu,tmp,( aid << 16 ) + evSetAudio );
- }
- }
-
- for ( c=0,i=0;i < MAX_V_STREAMS;i++ )
- if ( ((demuxer_t *)guiIntfStruct.demuxer)->v_streams[i] ) c++;
-
- if ( c > 1 )
- {
- SubMenu=AddSubMenu( window1, (const char*)empty_xpm, Menu,MSGTR_MENU_VideoTrack );
- for ( i=0;i < MAX_V_STREAMS;i++ )
- if ( ((demuxer_t *)guiIntfStruct.demuxer)->v_streams[i] )
- {
- int vid = ((sh_video_t *)((demuxer_t *)guiIntfStruct.demuxer)->v_streams[i])->vid;
- char tmp[32];
- snprintf( tmp,32,MSGTR_MENU_Track,vid );
- AddMenuItem( window1, (const char*)empty_xpm, SubMenu,tmp,( vid << 16 ) + evSetVideo );
- }
- }
- }
-
- /* cheap subtitle switching for non-DVD streams */
- if ( global_sub_size && guiIntfStruct.StreamType != STREAMTYPE_DVD )
- {
- int i;
- SubMenu=AddSubMenu( window1, (const char*)empty_xpm, Menu, MSGTR_MENU_Subtitles );
- AddMenuItem( window1, (const char*)empty_xpm, SubMenu, MSGTR_MENU_None, (-1 << 16) + evSetSubtitle );
- for ( i=0;i < global_sub_size;i++ )
- {
- char tmp[32];
- snprintf( tmp, 32, MSGTR_MENU_Track, i );
- AddMenuItem( window1,(const char*)empty_xpm,SubMenu,tmp,( i << 16 ) + evSetSubtitle );
- }
- }
-
- AddSeparator( Menu );
- MenuItem=AddMenuCheckItem( window1, (const char*)sound_xpm, Menu,MSGTR_MENU_Mute,mixer->muted,evMute );
- if ( !guiIntfStruct.AudioType ) gtk_widget_set_sensitive( MenuItem,FALSE );
- AddMenuItem( window1, (const char*)pl_xpm, Menu,MSGTR_MENU_PlayList, evPlayList );
- AddMenuItem( window1, (const char*)skin_xpm, Menu,MSGTR_MENU_SkinBrowser, evSkinBrowser );
- AddMenuItem( window1, (const char*)prefs_xpm, Menu,MSGTR_MENU_Preferences, evPreferences );
- AddMenuItem( window1, (const char*)eq_xpm, Menu,MSGTR_Equalizer, evEqualizer );
-
- if ( guiIntfStruct.NoWindow == False )
- {
- int b1 = 0, b2 = 0, b_half = 0;
- AddSeparator( Menu );
- if ( !appMPlayer.subWindow.isFullScreen && guiIntfStruct.Playing )
- {
- if ( ( appMPlayer.subWindow.Width == guiIntfStruct.MovieWidth * 2 )&&
- ( appMPlayer.subWindow.Height == guiIntfStruct.MovieHeight * 2 ) ) b2=1;
- else if ( ( appMPlayer.subWindow.Width == guiIntfStruct.MovieWidth / 2 ) &&
- ( appMPlayer.subWindow.Height == guiIntfStruct.MovieHeight / 2 ) ) b_half=1;
- else b1=1;
- } else b1=!appMPlayer.subWindow.isFullScreen;
- H=AddMenuCheckItem( window1, (const char*)half_xpm, Menu,MSGTR_MENU_HalfSize,b_half,evHalfSize );
- N=AddMenuCheckItem( window1, (const char*)normal_xpm, Menu,MSGTR_MENU_NormalSize" ",b1,evNormalSize );
- D=AddMenuCheckItem( window1, (const char*)double_xpm, Menu,MSGTR_MENU_DoubleSize,b2,evDoubleSize );
- F=AddMenuCheckItem( window1, (const char*)fs_xpm, Menu,MSGTR_MENU_FullScreen,appMPlayer.subWindow.isFullScreen,evFullScreen );
- if ( !gtkShowVideoWindow && !guiIntfStruct.Playing )
- {
- gtk_widget_set_sensitive( H,FALSE );
- gtk_widget_set_sensitive( N,FALSE );
- gtk_widget_set_sensitive( D,FALSE );
- gtk_widget_set_sensitive( F,FALSE );
- }
- }
-
- AddSeparator( Menu );
- AddMenuItem( window1, (const char*)exit_xpm, Menu,MSGTR_MENU_Exit, evExit );
-
- return Menu;
-}
diff --git a/gui/mplayer/gtk/menu.h b/gui/mplayer/gtk/menu.h
deleted file mode 100644
index a5e86d70ee..0000000000
--- a/gui/mplayer/gtk/menu.h
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * 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_GUI_MENU_H
-#define MPLAYER_GUI_MENU_H
-
-#include <gtk/gtk.h>
-
-extern GtkWidget * DVDSubMenu;
-
-GtkWidget * AddMenuItem( GtkWidget *window1, const char * immagine_xpm, GtkWidget * SubMenu, const char * label, int Number );
-GtkWidget * AddSubMenu( GtkWidget *window1, const char * immagine_xpm, GtkWidget * Menu, const char * label );
-GtkWidget * AddSeparator( GtkWidget * Menu );
-GtkWidget * create_PopUpMenu( void );
-
-#endif /* MPLAYER_GUI_MENU_H */
diff --git a/gui/mplayer/gtk/opts.c b/gui/mplayer/gtk/opts.c
deleted file mode 100644
index a1c8d226f3..0000000000
--- a/gui/mplayer/gtk/opts.c
+++ /dev/null
@@ -1,1832 +0,0 @@
-/*
- * 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.
- */
-
-#include <stdlib.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <unistd.h>
-#include <string.h>
-
-#include <gdk/gdkkeysyms.h>
-#include <gtk/gtk.h>
-
-#include "config.h"
-#include "help_mp.h"
-#include "mixer.h"
-#include "libao2/audio_out.h"
-#include "libvo/sub.h"
-#include "libvo/video_out.h"
-#include "stream/stream.h"
-#include "libmpdemux/demuxer.h"
-#include "libmpdemux/stheader.h"
-#include "libmpcodecs/dec_video.h"
-
-#include "gui/app.h"
-#include "gui/cfg.h"
-#include "gui/interface.h"
-#include "gui/mplayer/widgets.h"
-#include "opts.h"
-#include "fs.h"
-#include "gtk_common.h"
-
-// for mpcodecs_[av]d_drivers:
-#include "libmpcodecs/vd.h"
-#include "libmpcodecs/ad.h"
-
- GtkWidget * Preferences = NULL;
-static GtkWidget * AConfig;
-static GtkWidget * VConfig;
-//static GtkWidget * BLoadSubtitle;
-static GtkWidget * BLoadFont;
-static GtkWidget * BOk;
-static GtkWidget * BCancel;
-
-static GtkWidget * CLADrivers;
-static GtkWidget * CLVDrivers;
-
-//static GtkWidget * ESubtitleName;
- GtkWidget * prEFontName;
- GtkWidget * prEDVDDevice;
- GtkWidget * prECDRomDevice;
-static GtkWidget * EVFM;
-static GtkWidget * EAFM;
-
-static GtkWidget * CBVFM;
-static GtkWidget * CBAFM;
-static GtkWidget * CBAudioEqualizer;
-//static GtkWidget * CBSurround;
-static GtkWidget * CBExtraStereo;
-static GtkWidget * CBNormalize;
-static GtkWidget * CBSoftwareMixer;
-static GtkWidget * CBDoubleBuffer;
-static GtkWidget * CBDR;
-static GtkWidget * CBFramedrop;
-static GtkWidget * CBHFramedrop;
-//static GtkWidget * CBFullScreen;
-static GtkWidget * CBShowVideoWindow;
-static GtkWidget * CBNonInterlaved;
-static GtkWidget * CBIndex;
-static GtkWidget * CBFlip;
-static GtkWidget * CBNoAutoSub;
-static GtkWidget * CBSubUnicode;
-static GtkWidget * CBSubOverlap;
-static GtkWidget * CBDumpMPSub;
-static GtkWidget * CBDumpSrt;
-static GtkWidget * CBUseASS;
-static GtkWidget * CBASSUseMargins;
-static GtkWidget * SBASSTopMargin;
-static GtkWidget * SBASSBottomMargin;
-static GtkWidget * CBPostprocess;
-static GtkWidget * CBCache;
-static GtkWidget * CBLoadFullscreen;
-static GtkWidget * CBSaveWinPos;
-static GtkWidget * CBStopXScreenSaver;
-static GtkWidget * CBPlayBar;
-
-static GtkWidget * SBCache;
-static GtkAdjustment * SBCacheadj;
-
-static GtkWidget * CBAutoSync;
-static GtkWidget * SBAutoSync;
-static GtkAdjustment * SBAutoSyncadj;
-
-static GtkWidget * RBOSDNone;
-static GtkWidget * RBOSDTandP;
-static GtkWidget * RBOSDIndicator;
-static GtkWidget * RBOSDTPTT;
-
-static GtkWidget * HSAudioDelay;
-static GtkWidget * HSExtraStereoMul;
-static GtkWidget * HSPanscan;
-static GtkWidget * HSSubDelay;
-static GtkWidget * HSSubPosition;
-static GtkWidget * HSSubFPS;
-static GtkWidget * HSPPQuality;
-static GtkWidget * HSFPS;
-
-static GtkAdjustment * HSExtraStereoMuladj, * HSAudioDelayadj, * HSPanscanadj, * HSSubDelayadj;
-static GtkAdjustment * HSSubPositionadj, * HSSubFPSadj, * HSPPQualityadj, * HSFPSadj;
-
-#ifndef CONFIG_FREETYPE
-static GtkWidget * HSFontFactor;
-static GtkAdjustment * HSFontFactoradj;
-#else
-static GtkWidget * HSFontBlur, * HSFontOutLine, * HSFontTextScale, * HSFontOSDScale;
-static GtkAdjustment * HSFontBluradj, * HSFontOutLineadj, * HSFontTextScaleadj, * HSFontOSDScaleadj;
-static GtkWidget * CBFontEncoding, * EFontEncoding;
-static GtkWidget * RBFontNoAutoScale, * RBFontAutoScaleWidth, * RBFontAutoScaleHeight, * RBFontAutoScaleDiagonal;
-//static GtkWidget * AutoScale;
-#endif
-
-#ifdef CONFIG_ICONV
-static GtkWidget * CBSubEncoding, * ESubEncoding;
-#endif
-
-#if defined(CONFIG_FREETYPE) || defined(CONFIG_ICONV)
-static struct
-{
- char * name;
- char * comment;
-} lEncoding[] =
- {
- { "unicode", MSGTR_PREFERENCES_FontEncoding1 },
- { "iso-8859-1", MSGTR_PREFERENCES_FontEncoding2 },
- { "iso-8859-15", MSGTR_PREFERENCES_FontEncoding3 },
- { "iso-8859-2", MSGTR_PREFERENCES_FontEncoding4 },
- { "cp1250", MSGTR_PREFERENCES_FontEncoding22},
- { "iso-8859-3", MSGTR_PREFERENCES_FontEncoding5 },
- { "iso-8859-4", MSGTR_PREFERENCES_FontEncoding6 },
- { "iso-8859-5", MSGTR_PREFERENCES_FontEncoding7 },
- { "cp1251", MSGTR_PREFERENCES_FontEncoding21},
- { "iso-8859-6", MSGTR_PREFERENCES_FontEncoding8 },
- { "cp1256", MSGTR_PREFERENCES_FontEncoding23 },
- { "iso-8859-7", MSGTR_PREFERENCES_FontEncoding9 },
- { "iso-8859-9", MSGTR_PREFERENCES_FontEncoding10 },
- { "iso-8859-13", MSGTR_PREFERENCES_FontEncoding11 },
- { "iso-8859-14", MSGTR_PREFERENCES_FontEncoding12 },
- { "iso-8859-8", MSGTR_PREFERENCES_FontEncoding13 },
- { "koi8-r", MSGTR_PREFERENCES_FontEncoding14 },
- { "koi8-u/ru", MSGTR_PREFERENCES_FontEncoding15 },
- { "cp936", MSGTR_PREFERENCES_FontEncoding16 },
- { "big5", MSGTR_PREFERENCES_FontEncoding17 },
- { "shift-jis", MSGTR_PREFERENCES_FontEncoding18 },
- { "cp949", MSGTR_PREFERENCES_FontEncoding19 },
- { "cp874", MSGTR_PREFERENCES_FontEncoding20 },
- { NULL,NULL }
- };
-char * lCEncoding = NULL;
-char * lSEncoding = NULL;
-#endif
-
-static int old_audio_driver = 0;
-static char * ao_driver[3];
-static char * vo_driver[3];
-static int old_video_driver = 0;
-
-#ifdef CONFIG_DXR3
- void ShowDXR3Config( void );
- void HideDXR3Config( void );
-#endif
- void ShowAudioConfig( void );
- void HideAudioConfig( void );
-
-static gboolean prHScaler( GtkWidget * widget,GdkEventMotion * event,gpointer user_data );
-static void prToggled( GtkToggleButton * togglebutton,gpointer user_data );
-static void prCListRow( GtkCList * clist,gint row,gint column,GdkEvent * event,gpointer user_data );
-#if defined(CONFIG_FREETYPE) || defined(CONFIG_ICONV)
-static void prEntry( GtkContainer * container,gpointer user_data );
-#endif
-
-extern int stop_xscreensaver;
-
-void ShowPreferences( void )
-{
- if ( Preferences ) gtkActive( Preferences );
- else Preferences=create_Preferences();
-
-// -- 1. page
- gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( CBAudioEqualizer ),gtkEnableAudioEqualizer );
-#if 0
- gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( CBSurround ),gtkAOSurround );
-#endif
- gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( CBExtraStereo ),gtkAOExtraStereo );
- gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( CBNormalize ),gtkAONorm );
- gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( CBSoftwareMixer ),soft_vol );
- gtk_adjustment_set_value( HSExtraStereoMuladj,gtkAOExtraStereoMul );
- {
- int i = 0;
- char * tmp[3]; tmp[2]="";
- old_audio_driver=-1;
- if ( CLADrivers ) gtk_clist_clear( GTK_CLIST( CLADrivers ) );
- while ( audio_out_drivers[i] )
- {
- const ao_info_t *info = audio_out_drivers[i++]->info;
- if ( !strcmp( info->short_name,"plugin" ) ) continue;
- if ( audio_driver_list )
- {
- char * name = gstrdup( audio_driver_list[0] );
- char * sep = gstrchr( audio_driver_list[0],':' );
- if ( sep ) *sep=0;
- if ( !gstrcmp( name,(char *)info->short_name ) ) old_audio_driver=i - 1;
- free( name );
- }
- tmp[0]=(char *)info->short_name; tmp[1]=(char *)info->name; gtk_clist_append( GTK_CLIST( CLADrivers ),tmp );
- }
- if ( old_audio_driver > -1 )
- {
- gtk_clist_select_row( GTK_CLIST( CLADrivers ),old_audio_driver,0 );
- gtk_clist_get_text( GTK_CLIST( CLADrivers ),old_audio_driver,0,(char **)&ao_driver );
- gtk_widget_set_sensitive( AConfig,FALSE );
- if ( !strncmp( ao_driver[0],"oss",3 ) ||
- !strncmp( ao_driver[0],"alsa",4 ) ||
- !strncmp( ao_driver[0],"esd",3 ) ||
- !strncmp( ao_driver[0],"sdl",3 ) )
- gtk_widget_set_sensitive( AConfig,TRUE );
- }
- }
-
-// -- 2. page
- gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( CBDoubleBuffer ),vo_doublebuffering );
- gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( CBDR ),vo_directrendering );
-
- gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( CBFramedrop ),FALSE );
- gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( CBHFramedrop ),FALSE );
- switch ( frame_dropping )
- {
- case 2: gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( CBHFramedrop ),TRUE );
- case 1: gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( CBFramedrop ),TRUE );
- }
-
- if (flip != -1)
- gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( CBFlip ),flip );
- gtk_adjustment_set_value( HSPanscanadj,vo_panscan );
-
- {
- int i = 0, c = 0;
- char * tmp[3]; tmp[2]="";
- old_video_driver=0;
- if ( CLVDrivers ) gtk_clist_clear( GTK_CLIST( CLVDrivers ) );
- while ( video_out_drivers[i] )
- if ( video_out_drivers[i++]->control( VOCTRL_GUISUPPORT,NULL ) == VO_TRUE )
- {
- if ( video_driver_list && !gstrcmp( video_driver_list[0],(char *)video_out_drivers[i - 1]->info->short_name ) ) old_video_driver=c; c++;
- tmp[0]=(char *)video_out_drivers[i - 1]->info->short_name; tmp[1]=(char *)video_out_drivers[i - 1]->info->name;
- gtk_clist_append( GTK_CLIST( CLVDrivers ),tmp );
- }
- gtk_clist_select_row( GTK_CLIST( CLVDrivers ),old_video_driver,0 );
- gtk_clist_get_text( GTK_CLIST( CLVDrivers ),old_video_driver,0,(char **)&vo_driver );
- gtk_widget_set_sensitive( VConfig,FALSE );
-#ifdef CONFIG_DXR3
- if ( !gstrcmp( vo_driver[0],"dxr3" ) ) gtk_widget_set_sensitive( VConfig,TRUE );
-#endif
- }
-
- gtk_adjustment_set_value( HSFPSadj,force_fps );
-
-// -- 3. page
- gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( CBSubOverlap ),suboverlap_enabled );
- gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( CBNoAutoSub ),!sub_auto );
- gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( CBDumpMPSub ),gtkSubDumpMPSub );
- gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( CBDumpSrt ),gtkSubDumpSrt );
- gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( CBSubUnicode ),sub_unicode );
-#ifdef CONFIG_ASS
- gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( CBUseASS ),gtkASS.enabled );
- gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( CBASSUseMargins ),gtkASS.use_margins );
- gtk_spin_button_set_value( (GtkSpinButton *)SBASSTopMargin,(gdouble)gtkASS.top_margin );
- gtk_spin_button_set_value( (GtkSpinButton *)SBASSBottomMargin,(gdouble)gtkASS.bottom_margin );
-
- if ( !gtkASS.enabled )
- {
- gtk_widget_set_sensitive( CBASSUseMargins,FALSE );
- gtk_widget_set_sensitive( SBASSTopMargin,FALSE );
- gtk_widget_set_sensitive( SBASSBottomMargin,FALSE );
- }
-#endif
-
- gtk_adjustment_set_value( HSSubDelayadj,sub_delay );
- gtk_adjustment_set_value( HSSubFPSadj,sub_fps );
- gtk_adjustment_set_value( HSSubPositionadj,sub_pos );
- switch ( osd_level )
- {
- case 0: gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( RBOSDNone ),TRUE ); break;
- case 1: gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( RBOSDIndicator ),TRUE ); break;
- case 2: gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( RBOSDTandP ),TRUE ); break;
- case 3: gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( RBOSDTPTT ),TRUE ); break;
- }
-#if 0
- if ( guiIntfStruct.Subtitlename ) gtk_entry_set_text( GTK_ENTRY( ESubtitleName ),guiIntfStruct.Subtitlename );
-#endif
-
-#ifdef CONFIG_ICONV
- if ( sub_cp )
- {
- int i;
- for ( i=0;lEncoding[i].name;i++ )
- if ( !gstrcmp( sub_cp,lEncoding[i].name ) ) break;
- if ( lEncoding[i].name ) lSEncoding=lEncoding[i].comment;
- gtk_entry_set_text( GTK_ENTRY( ESubEncoding ),lSEncoding );
- }
-#endif
-
-// --- 4. page
- // font ...
- if ( font_name ) gtk_entry_set_text( GTK_ENTRY( prEFontName ),font_name );
-#ifndef CONFIG_FREETYPE
- gtk_adjustment_set_value( HSFontFactoradj,font_factor );
-#else
- gtk_adjustment_set_value( HSFontBluradj,( subtitle_font_radius / 8.0f ) * 100.0f );
- gtk_adjustment_set_value( HSFontOutLineadj,( subtitle_font_thickness / 8.0f ) * 100.0f );
- gtk_adjustment_set_value( HSFontTextScaleadj,text_font_scale_factor );
- gtk_adjustment_set_value( HSFontOSDScaleadj,osd_font_scale_factor );
- if ( subtitle_font_encoding )
- {
- int i;
- for ( i=0;lEncoding[i].name;i++ )
- if ( !gstrcmp( subtitle_font_encoding,lEncoding[i].name ) ) break;
- if ( lEncoding[i].name ) lCEncoding=lEncoding[i].comment;
- gtk_entry_set_text( GTK_ENTRY( EFontEncoding ),lCEncoding );
- }
- switch ( subtitle_autoscale )
- {
- case 0: gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( RBFontNoAutoScale ),TRUE ); break;
- case 1: gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( RBFontAutoScaleHeight ),TRUE ); break;
- case 2: gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( RBFontAutoScaleWidth ),TRUE ); break;
- case 3: gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( RBFontAutoScaleDiagonal ),TRUE ); break;
- }
-#endif
-
-// -- 5. page
- gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( CBNonInterlaved ),force_ni );
- if ( index_mode == 1 ) gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( CBIndex ),1 );
- {
- int i;
- GList * Items = NULL;
- char * name = NULL;
-
- Items=g_list_append( Items,MSGTR_PREFERENCES_None );
- for( i=0;mpcodecs_vd_drivers[i];i++ )
- {
- Items=g_list_append( Items,(char *)mpcodecs_vd_drivers[i]->info->name );
- if ( video_fm_list && !gstrcmp( video_fm_list[0],(char *)mpcodecs_vd_drivers[i]->info->short_name ) ) name=(char *)mpcodecs_vd_drivers[i]->info->name;
- }
- gtk_combo_set_popdown_strings( GTK_COMBO( CBVFM ),Items );
- g_list_free( Items );
- if ( name ) gtk_entry_set_text( GTK_ENTRY( EVFM ),name );
- }
-
- {
- int i;
- GList * Items = NULL;
- char * name = NULL;
-
- Items=g_list_append( Items,MSGTR_PREFERENCES_None );
- for( i=0;mpcodecs_ad_drivers[i];i++ )
- {
- Items=g_list_append( Items,(char *)mpcodecs_ad_drivers[i]->info->name );
- if ( audio_fm_list && !gstrcmp( audio_fm_list[0],(char *)mpcodecs_ad_drivers[i]->info->short_name ) ) name=(char *)mpcodecs_ad_drivers[i]->info->name;
- }
- gtk_combo_set_popdown_strings( GTK_COMBO( CBAFM ),Items );
- g_list_free( Items );
- if ( name ) gtk_entry_set_text( GTK_ENTRY( EAFM ),name );
- }
-
-// --- 6. page
- gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( CBPostprocess ),gtkVfPP );
- gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( CBLoadFullscreen ),gtkLoadFullscreen );
- gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( CBSaveWinPos ),gui_save_pos );
- gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( CBShowVideoWindow ),gtkShowVideoWindow );
- if ( !gtkShowVideoWindow )
- {
- gtk_widget_set_sensitive( CBLoadFullscreen,FALSE );
- gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( CBLoadFullscreen ),0 );
- }
- gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( CBStopXScreenSaver ),stop_xscreensaver );
- gtk_adjustment_set_value( HSPPQualityadj,auto_quality );
-
- gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( CBPlayBar ),gtkEnablePlayBar );
- if ( !appMPlayer.barIsPresent )
- {
- gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( CBPlayBar ),0 );
- gtk_widget_set_sensitive( CBPlayBar,FALSE );
- }
-
- gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( CBCache ),0 );
- gtk_adjustment_set_value( SBCacheadj,(float)gtkCacheSize );
- if ( !gtkCacheOn ) gtk_widget_set_sensitive( SBCache,FALSE );
- else gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( CBCache ),TRUE );
-
- gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( CBAutoSync ),0 );
- gtk_adjustment_set_value( SBAutoSyncadj,(float)gtkAutoSync );
- if ( !gtkAutoSyncOn ) gtk_widget_set_sensitive( SBAutoSync,FALSE );
- else gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( CBAutoSync ),TRUE );
-
- if ( dvd_device ) gtk_entry_set_text( GTK_ENTRY( prEDVDDevice ),dvd_device );
- else gtk_entry_set_text( GTK_ENTRY( prEDVDDevice ),DEFAULT_DVD_DEVICE );
- if ( cdrom_device ) gtk_entry_set_text( GTK_ENTRY( prECDRomDevice ),cdrom_device );
- else gtk_entry_set_text( GTK_ENTRY( prECDRomDevice ),DEFAULT_CDROM_DEVICE );
-
-// -- disables
-#ifndef CONFIG_ASS
- gtk_widget_set_sensitive( CBUseASS,FALSE );
- gtk_widget_set_sensitive( CBASSUseMargins,FALSE );
- gtk_widget_set_sensitive( SBASSTopMargin,FALSE );
- gtk_widget_set_sensitive( SBASSBottomMargin,FALSE );
-#endif
-
-// -- signals
- gtk_signal_connect( GTK_OBJECT( CBExtraStereo ),"toggled",GTK_SIGNAL_FUNC( prToggled ),(void*)0 );
- gtk_signal_connect( GTK_OBJECT( CBNormalize ),"toggled",GTK_SIGNAL_FUNC( prToggled ),(void*)1 );
- gtk_signal_connect( GTK_OBJECT( CBSoftwareMixer ),"toggled",GTK_SIGNAL_FUNC( prToggled ),(void*)1 );
- gtk_signal_connect( GTK_OBJECT( CBAudioEqualizer ),"toggled",GTK_SIGNAL_FUNC( prToggled ),(void*)2 );
- gtk_signal_connect( GTK_OBJECT( CBShowVideoWindow ),"toggled",GTK_SIGNAL_FUNC( prToggled ), (void*)3 );
-#ifdef CONFIG_FREETYPE
- gtk_signal_connect( GTK_OBJECT( RBFontNoAutoScale ),"toggled",GTK_SIGNAL_FUNC( prToggled ),(void*)4 );
- gtk_signal_connect( GTK_OBJECT( RBFontAutoScaleHeight ),"toggled",GTK_SIGNAL_FUNC( prToggled ),(void*)5 );
- gtk_signal_connect( GTK_OBJECT( RBFontAutoScaleWidth ),"toggled",GTK_SIGNAL_FUNC( prToggled ),(void*)6 );
- gtk_signal_connect( GTK_OBJECT( RBFontAutoScaleDiagonal ),"toggled",GTK_SIGNAL_FUNC( prToggled ),(void*)7 );
-#endif
- gtk_signal_connect( GTK_OBJECT( CBCache ),"toggled",GTK_SIGNAL_FUNC( prToggled ),(void*)8);
- gtk_signal_connect( GTK_OBJECT( CBAutoSync ),"toggled",GTK_SIGNAL_FUNC( prToggled ),(void*)9);
-#ifdef CONFIG_ASS
- gtk_signal_connect( GTK_OBJECT( CBUseASS ),"toggled",GTK_SIGNAL_FUNC( prToggled ),(void*)10);
-#endif
-
- gtk_signal_connect( GTK_OBJECT( HSExtraStereoMul ),"motion_notify_event",GTK_SIGNAL_FUNC( prHScaler ),(void*)0 );
- gtk_signal_connect( GTK_OBJECT( HSAudioDelay ),"motion_notify_event",GTK_SIGNAL_FUNC( prHScaler ),(void*)1 );
- gtk_signal_connect( GTK_OBJECT( HSPanscan ),"motion_notify_event",GTK_SIGNAL_FUNC( prHScaler ),(void*)2 );
- gtk_signal_connect( GTK_OBJECT( HSSubDelay ),"motion_notify_event",GTK_SIGNAL_FUNC( prHScaler ),(void*)3 );
- gtk_signal_connect( GTK_OBJECT( HSSubPosition ),"motion_notify_event",GTK_SIGNAL_FUNC( prHScaler ),(void*)4 );
-#ifndef CONFIG_FREETYPE
- gtk_signal_connect( GTK_OBJECT( HSFontFactor ),"motion_notify_event",GTK_SIGNAL_FUNC( prHScaler ),(void*)5 );
-#else
- gtk_signal_connect( GTK_OBJECT( HSFontBlur ),"motion_notify_event",GTK_SIGNAL_FUNC( prHScaler ),(void*)6 );
- gtk_signal_connect( GTK_OBJECT( HSFontOutLine ),"motion_notify_event",GTK_SIGNAL_FUNC( prHScaler ),(void*)7 );
- gtk_signal_connect( GTK_OBJECT( HSFontTextScale ),"motion_notify_event",GTK_SIGNAL_FUNC( prHScaler ),(void*)8 );
- gtk_signal_connect( GTK_OBJECT( HSFontOSDScale ),"motion_notify_event",GTK_SIGNAL_FUNC( prHScaler ),(void*)9 );
- gtk_signal_connect( GTK_OBJECT( EFontEncoding ),"changed",GTK_SIGNAL_FUNC( prEntry ),(void *)0 );
-#endif
-#ifdef CONFIG_ICONV
- gtk_signal_connect( GTK_OBJECT( ESubEncoding ),"changed",GTK_SIGNAL_FUNC( prEntry ),(void *)1 );
-#endif
- gtk_signal_connect( GTK_OBJECT( HSPPQuality ),"motion_notify_event",GTK_SIGNAL_FUNC( prHScaler ),(void*)10 );
-
- gtk_signal_connect( GTK_OBJECT( CLADrivers ),"select_row",GTK_SIGNAL_FUNC( prCListRow ),(void*)0 );
- gtk_signal_connect( GTK_OBJECT( CLVDrivers ),"select_row",GTK_SIGNAL_FUNC( prCListRow ),(void*)1 );
-
- gtk_widget_show( Preferences );
- gtkSetLayer( Preferences );
- {
- static int visible = 1;
- if ( visible )
- {
- gtkMessageBox( GTK_MB_WARNING,MSGTR_PREFERENCES_Message );
- visible=0;
- }
- }
-}
-
-void HidePreferences( void )
-{
- if ( !Preferences ) return;
- gtk_widget_hide( Preferences );
- gtk_widget_destroy( Preferences );
- Preferences=NULL;
- HideAudioConfig();
-#ifdef CONFIG_DXR3
- HideDXR3Config();
-#endif
-}
-
-#if defined(CONFIG_FREETYPE) || defined(CONFIG_ICONV)
-static void prEntry( GtkContainer * container,gpointer user_data )
-{
- const char * comment;
- int i;
-
- switch( (int)user_data )
- {
-#ifdef CONFIG_FREETYPE
- case 0: // font encoding
- comment=gtk_entry_get_text( GTK_ENTRY( EFontEncoding ) );
- for ( i=0;lEncoding[i].name;i++ )
- if ( !gstrcmp( lEncoding[i].comment,comment ) ) break;
- if ( lEncoding[i].comment ) gtkSet( gtkSetFontEncoding,0,lEncoding[i].name );
- break;
-#endif
-#ifdef CONFIG_ICONV
- case 1: // sub encoding
- comment=gtk_entry_get_text( GTK_ENTRY( ESubEncoding ) );
- for ( i=0;lEncoding[i].name;i++ )
- if ( !gstrcmp( lEncoding[i].comment,comment ) ) break;
- if ( lEncoding[i].comment ) gtkSet( gtkSetSubEncoding,0,lEncoding[i].name );
- else gtkSet( gtkSetSubEncoding,0,NULL );
- break;
-#endif
- }
-}
-#endif
-
-#define bAConfig 0
-#define bVconfig 1
-#define bOk 2
-#define bCancel 3
-#define bLSubtitle 4
-#define bLFont 5
-
-void prButton( GtkButton * button,gpointer user_data )
-{
- switch ( (int)user_data )
- {
- case bOk:
- // -- 1. page
- gtkEnableAudioEqualizer=gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( CBAudioEqualizer ) );
- gtkAOExtraStereo=gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( CBExtraStereo ) );
- gtkAONorm=gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( CBNormalize ) );
- soft_vol=gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( CBSoftwareMixer ) );
- gtkSet( gtkSetExtraStereo,HSExtraStereoMuladj->value,NULL );
- audio_delay=HSAudioDelayadj->value;
-
- gaddlist( &audio_driver_list,ao_driver[0] );
- gaddlist( &video_driver_list,vo_driver[0] );
-
- // -- 2. page
- vo_doublebuffering=gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( CBDoubleBuffer ) );
- vo_directrendering=gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( CBDR ) );
-
- frame_dropping=0;
- if ( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( CBFramedrop ) ) == TRUE ) frame_dropping=1;
- if ( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( CBHFramedrop ) ) == TRUE ) frame_dropping=2;
-
- flip=-1;
- if ( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( CBFlip ) ) ) flip=1;
-
- force_fps=HSFPSadj->value;
-
- // -- 3. page
- suboverlap_enabled=gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( CBSubOverlap ) );
- sub_auto=!gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( CBNoAutoSub ) );
- gtkSubDumpMPSub=gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( CBDumpMPSub ) );
- gtkSubDumpSrt=gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( CBDumpSrt ) );
- sub_unicode=gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( CBSubUnicode ) );
-#ifdef CONFIG_ASS
- gtkASS.enabled=gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( CBUseASS ) );
- gtkASS.use_margins=gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( CBASSUseMargins ) );
- gtkASS.top_margin=gtk_spin_button_get_value_as_int( GTK_SPIN_BUTTON( SBASSTopMargin ) );
- gtkASS.bottom_margin=gtk_spin_button_get_value_as_int( GTK_SPIN_BUTTON( SBASSBottomMargin ) );
-#endif
- sub_delay=HSSubDelayadj->value;
- sub_fps=HSSubFPSadj->value;
- sub_pos=(int)HSSubPositionadj->value;
- if ( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( RBOSDNone ) ) ) osd_level=0;
- if ( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( RBOSDIndicator ) ) ) osd_level=1;
- if ( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( RBOSDTandP ) ) ) osd_level=2;
- if ( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( RBOSDTPTT ) ) ) osd_level=3;
-
-
- // --- 4. page
- guiSetFilename( font_name,gtk_entry_get_text( GTK_ENTRY( prEFontName ) ) );
-#ifndef CONFIG_FREETYPE
- gtkSet( gtkSetFontFactor,HSFontFactoradj->value,NULL );
-#else
- gtkSet( gtkSetFontBlur,HSFontBluradj->value,NULL );
- gtkSet( gtkSetFontOutLine,HSFontOutLineadj->value,NULL );
- gtkSet( gtkSetFontTextScale,HSFontTextScaleadj->value,NULL );
- gtkSet( gtkSetFontOSDScale,HSFontOSDScaleadj->value,NULL );
- if ( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( RBFontNoAutoScale ) ) ) gtkSet( gtkSetFontAutoScale,0,NULL );
- if ( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( RBFontAutoScaleHeight ) ) ) gtkSet( gtkSetFontAutoScale,1,NULL );
- if ( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( RBFontAutoScaleWidth ) ) ) gtkSet( gtkSetFontAutoScale,2,NULL );
- if ( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( RBFontAutoScaleDiagonal ) ) ) gtkSet( gtkSetFontAutoScale,3,NULL );
-#endif
-
- // -- 5. page
- force_ni=gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( CBNonInterlaved ) );
- index_mode=-1;
- if ( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( CBIndex ) ) ) index_mode=1;
-
- {
- int i;
- const char * tmp = gtk_entry_get_text( GTK_ENTRY( EVFM ) );
- for( i=0;mpcodecs_vd_drivers[i];i++ )
- if ( !gstrcmp( tmp,(char *)mpcodecs_vd_drivers[i]->info->name ) )
- { gaddlist( &video_fm_list,(char *)mpcodecs_vd_drivers[i]->info->short_name ); break; }
- }
-
- {
- int i;
- const char * tmp = gtk_entry_get_text( GTK_ENTRY( EAFM ) );
- for( i=0;mpcodecs_ad_drivers[i];i++ )
- if ( !gstrcmp( tmp,(char *)mpcodecs_ad_drivers[i]->info->name ) )
- { gaddlist( &audio_fm_list,(char *)mpcodecs_ad_drivers[i]->info->short_name ); break; }
- }
-
- // --- 6. page
- gtkVfPP=gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( CBPostprocess ) );
- gtkLoadFullscreen=gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( CBLoadFullscreen ) );
- gui_save_pos=gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( CBSaveWinPos ) );
- gtkShowVideoWindow=gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( CBShowVideoWindow ) );
- stop_xscreensaver=gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( CBStopXScreenSaver ) );
- gtkEnablePlayBar=gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( CBPlayBar ) );
- gtkSet( gtkSetAutoq,HSPPQualityadj->value,NULL );
-
- if ( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( CBCache ) ) ) { gtkCacheSize=(int)SBCacheadj->value; gtkCacheOn=1; }
- else gtkCacheOn=0;
-
- if ( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( CBAutoSync ) ) ) { gtkAutoSync=(int)SBAutoSyncadj->value; gtkAutoSyncOn=1; }
- else gtkAutoSyncOn=0;
-
- guiSetFilename( dvd_device,gtk_entry_get_text( GTK_ENTRY( prEDVDDevice ) ) );
- guiSetFilename( cdrom_device,gtk_entry_get_text( GTK_ENTRY( prECDRomDevice ) ) );
-
- case bCancel:
- HidePreferences();
- break;
- case bAConfig:
- if ( !ao_driver[0] ) break;
- gtk_widget_set_sensitive( AConfig,FALSE );
- if ( !strncmp( ao_driver[0],"oss",3 ) ||
- !strncmp( ao_driver[0],"alsa",4 ) ||
- !strncmp( ao_driver[0],"esd",3 ) ||
- !strncmp( ao_driver[0],"sdl",3 ) ) {
- ShowAudioConfig();
- gtk_widget_set_sensitive( AConfig,TRUE );
- }
- break;
- case bVconfig:
- if ( !vo_driver[0] ) break;
- gtk_widget_set_sensitive( VConfig,FALSE );
-#ifdef CONFIG_DXR3
- if ( !gstrcmp( vo_driver[0],"dxr3" ) ) { ShowDXR3Config(); gtk_widget_set_sensitive( VConfig,TRUE ); }
-#endif
- break;
-#if 0
- case bLSubtitle:
- break;
-#endif
- case bLFont:
- ShowFileSelect( fsFontSelector,FALSE );
- gtkSetLayer( fsFileSelect );
- break;
- }
-}
-
-static gboolean prHScaler( GtkWidget * widget,GdkEventMotion * event,gpointer user_data )
-{
- switch ( (int)user_data )
- {
- case 0: // extra stereo coefficient
- if ( !guiIntfStruct.Playing ) break;
- gtkSet( gtkSetExtraStereo,HSExtraStereoMuladj->value,NULL );
- break;
- case 1: // audio delay
- audio_delay=HSAudioDelayadj->value;
- break;
- case 2: // panscan
- gtkSet( gtkSetPanscan,HSPanscanadj->value,NULL );
- break;
- case 3: // sub delay
- sub_delay=HSSubDelayadj->value;
- break;
- case 4: // sub position
- sub_pos=(int)HSSubPositionadj->value;
- break;
-#ifndef CONFIG_FREETYPE
- case 5: // font factor
- gtkSet( gtkSetFontFactor,HSFontFactoradj->value,NULL );
- break;
-#else
- case 6: // font blur
- gtkSet( gtkSetFontBlur,HSFontBluradj->value,NULL );
- break;
- case 7: // font outline
- gtkSet( gtkSetFontOutLine,HSFontOutLineadj->value,NULL );
- break;
- case 8: // text scale
- gtkSet( gtkSetFontTextScale,HSFontTextScaleadj->value,NULL );
- break;
- case 9: // osd scale
- gtkSet( gtkSetFontOSDScale,HSFontOSDScaleadj->value,NULL );
- break;
-#endif
- case 10: // auto quality
- gtkSet( gtkSetAutoq,HSPPQualityadj->value,NULL );
- break;
- }
- return FALSE;
-}
-
-static void prToggled( GtkToggleButton * togglebutton,gpointer user_data )
-{
- int window;
- switch ( (int)user_data )
- {
- case 0: // extra stereo coefficient
- if ( guiIntfStruct.Playing )
- gtk_widget_set_sensitive( HSExtraStereoMul,gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( CBExtraStereo ) ) );
- break;
-// case 1: // normalize
-// case 2: // equalizer
-// if ( guiIntfStruct.Playing ) gtkMessageBox( GTK_MB_WARNING,"Please remember, this function need restart the playing." );
-// break;
- case 3:
- if ( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( CBShowVideoWindow ) ) ) gtk_widget_set_sensitive( CBLoadFullscreen,TRUE );
- else
- {
- gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( CBLoadFullscreen ),0 );
- gtk_widget_set_sensitive( CBLoadFullscreen,FALSE );
- }
- if ( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( CBShowVideoWindow ) ) )
- {
- window=wsShowWindow;
- gtkActive( Preferences );
- } else window=wsHideWindow;
-
- if ( !guiIntfStruct.Playing ) wsVisibleWindow( &appMPlayer.subWindow,window );
- break;
- case 4:
- case 5:
- case 6:
- case 7:
- gtkSet( gtkSetFontAutoScale,(float)((int)user_data - 4 ),NULL );
- break;
- case 8:
- if ( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( CBCache ) ) ) gtk_widget_set_sensitive( SBCache,TRUE );
- else gtk_widget_set_sensitive( SBCache,FALSE );
- break;
- case 9:
- if ( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( CBAutoSync ) ) ) gtk_widget_set_sensitive( SBAutoSync,TRUE );
- else gtk_widget_set_sensitive( SBAutoSync,FALSE );
- break;
-#ifdef CONFIG_ASS
- case 10:
- if ( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( CBUseASS ) ) )
- {
- gtk_widget_set_sensitive( CBASSUseMargins,TRUE );
- gtk_widget_set_sensitive( SBASSTopMargin,TRUE );
- gtk_widget_set_sensitive( SBASSBottomMargin,TRUE );
- }
- else
- {
- gtk_widget_set_sensitive( CBASSUseMargins,FALSE );
- gtk_widget_set_sensitive( SBASSTopMargin,FALSE );
- gtk_widget_set_sensitive( SBASSBottomMargin,FALSE );
- }
- break;
-#endif
- }
-}
-
-static void prCListRow( GtkCList * clist,gint row,gint column,GdkEvent * event,gpointer user_data )
-{
- switch ( (int)user_data )
- {
- case 0: // audio driver
- gtk_clist_get_text( GTK_CLIST( CLADrivers ),row,0,(char **)&ao_driver );
- gtk_widget_set_sensitive( AConfig,FALSE );
- if ( !strncmp( ao_driver[0],"oss",3 ) ||
- !strncmp( ao_driver[0],"alsa",4 ) ||
- !strncmp( ao_driver[0],"esd",3 ) ||
- !strncmp( ao_driver[0],"sdl",3 ) )
- gtk_widget_set_sensitive( AConfig,TRUE );
-#ifndef CONFIG_GTK2
- if ( !strncmp( ao_driver[0],"arts",4 ) )
- gtkMessageBox(GTK_MB_WARNING|GTK_MB_SIMPLE, MSGTR_PREFERENCES_ArtsBroken);
-#endif
- break;
- case 1: // video driver
- gtk_clist_get_text( GTK_CLIST( CLVDrivers ),row,0,(char **)&vo_driver );
- gtk_widget_set_sensitive( VConfig,FALSE );
-#ifdef CONFIG_DXR3
- if ( !gstrcmp( vo_driver[0],"dxr3" ) ) gtk_widget_set_sensitive( VConfig,TRUE );
-#endif
- break;
- }
-}
-
-GtkWidget * create_Preferences( void )
-{
- GtkWidget * label;
- GtkWidget * frame;
-
- GtkWidget * vbox1;
- GtkWidget * notebook1;
- GtkWidget * hbox1;
- GtkWidget * vbox2;
- GtkWidget * scrolledwindow3;
- GtkWidget * vbox3;
- GtkWidget * hbox8;
- GtkWidget * hbox2;
- GtkWidget * vbox4;
- GtkWidget * scrolledwindow2;
- GtkWidget * hbuttonbox3;
- GtkWidget * vbox5;
- GtkWidget * vbox6;
- GtkWidget * vbox600;
- GSList * OSD_group = NULL;
- GSList * Font_group = NULL;
- GList * CBFontEncoding_items = NULL;
- GList * CBSubEncoding_items = NULL;
- GtkWidget * vbox7;
- GtkWidget * vbox8;
- GtkWidget * table1;
- GtkWidget * vbox9;
- GtkWidget * vbox603;
- GtkWidget * hbox6;
- GtkWidget * hbuttonbox5;
-#ifndef CONFIG_FREETYPE
- GtkWidget * hbox7;
-#endif
- GtkWidget * vbox601;
- GtkWidget * vbox602;
- GtkWidget * hbox5;
- GtkWidget * hbuttonbox1;
- GtkAccelGroup * accel_group;
-
- GtkWidget * hbox9;
- GtkWidget * hbox91;
- GtkWidget * hbox92;
-
- accel_group=gtk_accel_group_new();
-
- Preferences=gtk_window_new( GTK_WINDOW_TOPLEVEL );
- gtk_widget_set_name( Preferences,"Preferences" );
- gtk_object_set_data( GTK_OBJECT( Preferences ),"Preferences",Preferences );
- gtk_window_set_title( GTK_WINDOW( Preferences ),MSGTR_Preferences );
- gtk_window_set_position( GTK_WINDOW( Preferences ),GTK_WIN_POS_CENTER );
-// gtk_window_set_policy( GTK_WINDOW( Preferences ),FALSE,FALSE,FALSE );
- gtk_window_set_wmclass( GTK_WINDOW( Preferences ),"Preferences","MPlayer" );
-
- gtk_widget_realize( Preferences );
- gtkAddIcon( Preferences );
-
- vbox1=AddVBox( AddDialogFrame( Preferences ),0 );
- notebook1=gtk_notebook_new();
- gtk_widget_set_name( notebook1,"notebook1" );
- gtk_widget_show( notebook1 );
- gtk_box_pack_start( GTK_BOX( vbox1 ),notebook1,TRUE,TRUE,0 );
-
- hbox1=AddVBox( notebook1,0 );
-
- frame=AddFrame( NULL,GTK_SHADOW_ETCHED_OUT,hbox1,1 );
- frame=AddFrame( NULL,GTK_SHADOW_NONE,frame,1 );
-
-// --- 1. page
-
- vbox2=AddVBox( frame,0 );
-
- scrolledwindow3=gtk_scrolled_window_new( NULL,NULL );
- gtk_widget_set_name( scrolledwindow3,"scrolledwindow3" );
- gtk_widget_show( scrolledwindow3 );
- gtk_box_pack_start( GTK_BOX( vbox2 ),scrolledwindow3,TRUE,TRUE,0 );
- gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW( scrolledwindow3 ),GTK_POLICY_NEVER,GTK_POLICY_AUTOMATIC );
-
- CLADrivers=gtk_clist_new( 2 );
- gtk_widget_set_name( CLADrivers,"CLADrivers" );
- gtk_widget_show( CLADrivers );
- gtk_container_add( GTK_CONTAINER( scrolledwindow3 ),CLADrivers );
- gtk_clist_set_column_width( GTK_CLIST( CLADrivers ),0,50 );
- gtk_clist_column_titles_show( GTK_CLIST( CLADrivers ) );
- gtk_clist_set_shadow_type( GTK_CLIST( CLADrivers ),GTK_SHADOW_NONE );
- gtk_widget_set_usize( CLADrivers,250,-2 );
- gtk_clist_set_column_widget( GTK_CLIST( CLADrivers ),0,
- AddLabel( MSGTR_PREFERENCES_AvailableDrivers,NULL ) );
-
- AConfig=AddButton( MSGTR_ConfigDriver,
- AddHButtonBox( vbox2 ) );
-
- vbox3=AddVBox(
- AddFrame( NULL,GTK_SHADOW_NONE,
- AddFrame( NULL,GTK_SHADOW_ETCHED_OUT,hbox1,0 ),1 ),0 );
- gtk_widget_set_usize( vbox3,250,-2 );
-
- CBNormalize=AddCheckButton( MSGTR_PREFERENCES_NormalizeSound,vbox3 );
- CBAudioEqualizer=AddCheckButton( MSGTR_PREFERENCES_EnableEqualizer,vbox3 );
- CBSoftwareMixer=AddCheckButton( MSGTR_PREFERENCES_SoftwareMixer,vbox3 );
-#if 0
- CBSurround=AddCheckButton( "Enable surround",vbox3 );
-#endif
-
- AddHSeparator( vbox3 );
- CBExtraStereo=AddCheckButton( MSGTR_PREFERENCES_ExtraStereo,vbox3 );
- hbox8=AddHBox( vbox3,1 );
- label=AddLabel( MSGTR_PREFERENCES_Coefficient,hbox8 );
-// gtk_misc_set_padding( GTK_MISC( label ),20,0 );
- HSExtraStereoMuladj=GTK_ADJUSTMENT( gtk_adjustment_new( 0,-10,10,0.1,0,0 ) );
- HSExtraStereoMul=AddHScaler( HSExtraStereoMuladj,hbox8,1 );
- AddHSeparator( vbox3 );
-
- hbox8=AddHBox( vbox3,1 );
- AddLabel( MSGTR_PREFERENCES_AudioDelay,hbox8 );
-
- HSAudioDelayadj=GTK_ADJUSTMENT( gtk_adjustment_new( 0,-10,10,0.01,0,0 ) );
- HSAudioDelay=AddHScaler( HSAudioDelayadj,hbox8,2 );
- label=AddLabel( MSGTR_PREFERENCES_Audio,NULL );
- gtk_notebook_set_tab_label( GTK_NOTEBOOK( notebook1 ),gtk_notebook_get_nth_page( GTK_NOTEBOOK( notebook1 ),0 ),label );
-
-// --- 2. page
-
- hbox2=AddVBox( notebook1,0 );
-
- vbox4=AddVBox(
- AddFrame( NULL,GTK_SHADOW_NONE,
- AddFrame( NULL,GTK_SHADOW_ETCHED_OUT,hbox2,1 ),1 ),0 );
-
- scrolledwindow2=gtk_scrolled_window_new( NULL,NULL );
- gtk_widget_set_name( scrolledwindow2,"scrolledwindow2" );
- gtk_widget_show( scrolledwindow2 );
- gtk_box_pack_start( GTK_BOX( vbox4 ),scrolledwindow2,TRUE,TRUE,0 );
- gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW( scrolledwindow2 ),GTK_POLICY_NEVER,GTK_POLICY_AUTOMATIC );
-
- CLVDrivers=gtk_clist_new( 2 );
- gtk_widget_set_name( CLVDrivers,"CLVDrivers" );
- gtk_widget_show( CLVDrivers );
- gtk_container_add( GTK_CONTAINER( scrolledwindow2 ),CLVDrivers );
- gtk_clist_set_column_width( GTK_CLIST( CLVDrivers ),0,50 );
- gtk_clist_column_titles_show( GTK_CLIST( CLVDrivers ) );
- gtk_clist_set_shadow_type( GTK_CLIST( CLVDrivers ),GTK_SHADOW_NONE );
- gtk_widget_set_usize( CLVDrivers,250,-2 );
-
- label=AddLabel( MSGTR_PREFERENCES_AvailableDrivers,NULL );
- gtk_clist_set_column_widget( GTK_CLIST( CLVDrivers ),0,label );
-
- hbuttonbox3=AddHButtonBox( vbox4 );
- VConfig=AddButton( MSGTR_ConfigDriver,hbuttonbox3 );
-
- vbox5=AddVBox(
- AddFrame( NULL,GTK_SHADOW_NONE,
- AddFrame( NULL,GTK_SHADOW_ETCHED_OUT,hbox2,0 ),1 ),0 );
- gtk_widget_set_usize( vbox5,250,-2 );
-
- CBDoubleBuffer=AddCheckButton( MSGTR_PREFERENCES_DoubleBuffer,vbox5 );
- CBDR=AddCheckButton( MSGTR_PREFERENCES_DirectRender,vbox5 );
- CBFramedrop=AddCheckButton( MSGTR_PREFERENCES_FrameDrop,vbox5 );
- CBHFramedrop=AddCheckButton( MSGTR_PREFERENCES_HFrameDrop,vbox5 );
- CBFlip=AddCheckButton( MSGTR_PREFERENCES_Flip,vbox5 );
-
- table1=gtk_table_new( 3,2,FALSE );
- gtk_widget_set_name( table1,"table1" );
- gtk_widget_show( table1 );
- gtk_box_pack_start( GTK_BOX( vbox5 ),table1,FALSE,FALSE,0 );
-
- label=AddLabel( MSGTR_PREFERENCES_Panscan,NULL );
- gtk_table_attach( GTK_TABLE( table1 ),label,0,1,0,1,(GtkAttachOptions)( GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 );
-
- label=AddLabel( MSGTR_PREFERENCES_FPS,NULL );
- gtk_table_attach( GTK_TABLE( table1 ),label,0,1,1,2,(GtkAttachOptions)( GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 );
-
- HSPanscanadj=GTK_ADJUSTMENT( gtk_adjustment_new( 0,0,1,0.001,0,0 ) );
- HSPanscan=AddHScaler( HSPanscanadj,NULL,1 );
- gtk_table_attach( GTK_TABLE( table1 ),HSPanscan,1,2,0,1,(GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 );
-
- HSFPSadj=GTK_ADJUSTMENT( gtk_adjustment_new( 0,0,1000,0.001,0,0 ) );
- HSFPS=gtk_spin_button_new( GTK_ADJUSTMENT( HSFPSadj ),1,3 );
- gtk_widget_set_name( HSFPS,"HSFPS" );
- gtk_widget_show( HSFPS );
- gtk_spin_button_set_numeric( GTK_SPIN_BUTTON( HSFPS ),TRUE );
- gtk_table_attach( GTK_TABLE( table1 ),HSFPS,1,2,1,2,(GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 );
-
- label=AddLabel( MSGTR_PREFERENCES_Video,NULL );
- gtk_notebook_set_tab_label( GTK_NOTEBOOK( notebook1 ),gtk_notebook_get_nth_page( GTK_NOTEBOOK( notebook1 ),1 ),label );
-
-// --- 3. page
-
- vbox6=AddVBox( notebook1,0 );
-
- vbox600=AddVBox(
- AddFrame( NULL,GTK_SHADOW_NONE,
- AddFrame( MSGTR_PREFERENCES_FRAME_OSD_Level,GTK_SHADOW_ETCHED_OUT,vbox6,0 ),1 ),0 );
-
- RBOSDNone=AddRadioButton( MSGTR_PREFERENCES_None,&OSD_group,vbox600 );
- RBOSDTandP=AddRadioButton( MSGTR_PREFERENCES_OSDTimer,&OSD_group,vbox600 );
- RBOSDIndicator=AddRadioButton( MSGTR_PREFERENCES_OSDProgress,&OSD_group,vbox600 );
- RBOSDTPTT=AddRadioButton( MSGTR_PREFERENCES_OSDTimerPercentageTotalTime,&OSD_group,vbox600 );
-
- vbox7=AddVBox(
- AddFrame( NULL,GTK_SHADOW_NONE,
- AddFrame( MSGTR_PREFERENCES_FRAME_Subtitle,GTK_SHADOW_ETCHED_OUT,vbox6,0 ),1 ),0 );
-
-#if 0
- hbox4=AddHBox( vbox7,1 );
-
- AddLabel( MSGTR_PREFERENCES_Subtitle,hbox4 );
-
- ESubtitleName=gtk_entry_new();
- gtk_widget_set_name( ESubtitleName,"ESubtitleName" );
- gtk_widget_show( ESubtitleName );
- gtk_box_pack_start( GTK_BOX( hbox4 ),ESubtitleName,TRUE,TRUE,0 );
-
- hbuttonbox4=AddHButtonBox( hbuttonbox4 );
- gtk_container_set_border_width( GTK_CONTAINER( hbuttonbox4 ),3 );
- BLoadSubtitle=AddButton( MSGTR_Browse,hbuttonbox4 );
-#endif
-
- vbox8=AddVBox( vbox7,0 );
-
- table1=gtk_table_new( 3,2,FALSE );
- gtk_widget_set_name( table1,"table1" );
- gtk_widget_show( table1 );
- gtk_box_pack_start( GTK_BOX( vbox8 ),table1,FALSE,FALSE,0 );
-
- label=AddLabel( MSGTR_PREFERENCES_SUB_Delay,NULL );
- gtk_table_attach( GTK_TABLE( table1 ),label,0,1,0,1,(GtkAttachOptions)( GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 );
-
- label=AddLabel( MSGTR_PREFERENCES_SUB_POS,NULL );
- gtk_table_attach( GTK_TABLE( table1 ),label,0,1,1,2,(GtkAttachOptions)( GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 );
-
- label=AddLabel( MSGTR_PREFERENCES_SUB_FPS,NULL );
- gtk_table_attach( GTK_TABLE( table1 ),label,0,1,2,3,(GtkAttachOptions)( GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 );
-
-#ifdef CONFIG_ICONV
- label=AddLabel( MSGTR_PREFERENCES_FontEncoding,NULL );
- gtk_table_attach( GTK_TABLE( table1 ),label,0,1,3,4,(GtkAttachOptions)( GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 );
-#endif
-
- HSSubDelayadj=GTK_ADJUSTMENT( gtk_adjustment_new( 0,-10.0,10,0.01,0,0 ) );
- HSSubDelay=AddHScaler( HSSubDelayadj,NULL,1 );
- gtk_table_attach( GTK_TABLE( table1 ),HSSubDelay,1,2,0,1,(GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 );
-
- HSSubPositionadj=GTK_ADJUSTMENT( gtk_adjustment_new( 100,0,100,1,0,0 ) );
- HSSubPosition=AddHScaler( HSSubPositionadj,NULL,0 );
- gtk_table_attach( GTK_TABLE( table1 ),HSSubPosition,1,2,1,2,(GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 );
-
- HSSubFPSadj=GTK_ADJUSTMENT( gtk_adjustment_new( 0,0,100,0.01,0,0 ) );
- HSSubFPS=gtk_spin_button_new( GTK_ADJUSTMENT( HSSubFPSadj ),1,3 );
- gtk_widget_set_name( HSSubFPS,"HSSubFPS" );
- gtk_widget_show( HSSubFPS );
- gtk_widget_set_usize( HSSubFPS,60,-1 );
- gtk_spin_button_set_numeric( GTK_SPIN_BUTTON( HSSubFPS ),TRUE );
- gtk_table_attach( GTK_TABLE( table1 ),HSSubFPS,1,2,2,3,(GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 );
-
-#ifdef CONFIG_ICONV
- CBSubEncoding=gtk_combo_new();
- gtk_widget_set_name( CBSubEncoding,"CBSubEncoding" );
- gtk_widget_show( CBSubEncoding );
- gtk_table_attach( GTK_TABLE( table1 ),CBSubEncoding,1,2,3,4,(GtkAttachOptions)( GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 );
- CBSubEncoding_items=g_list_append( CBSubEncoding_items,MSGTR_PREFERENCES_None );
- {
- int i;
- for ( i=0;lEncoding[i].name;i++ ) CBSubEncoding_items=g_list_append( CBSubEncoding_items,lEncoding[i].comment );
- }
- gtk_combo_set_popdown_strings( GTK_COMBO( CBSubEncoding ),CBSubEncoding_items );
- g_list_free( CBSubEncoding_items );
-
- ESubEncoding=GTK_COMBO( CBSubEncoding )->entry;
- gtk_widget_set_name( ESubEncoding,"ESubEncoding" );
- gtk_entry_set_editable( GTK_ENTRY( ESubEncoding ),FALSE );
- gtk_widget_show( ESubEncoding );
-#endif
-
- vbox9=AddVBox( vbox8,0 );
-
- CBSubOverlap=AddCheckButton( MSGTR_PREFERENCES_SUB_Overlap,vbox9 );
- CBNoAutoSub=AddCheckButton( MSGTR_PREFERENCES_SUB_AutoLoad,vbox9 );
- CBSubUnicode=AddCheckButton( MSGTR_PREFERENCES_SUB_Unicode,vbox9 );
- CBDumpMPSub=AddCheckButton( MSGTR_PREFERENCES_SUB_MPSUB,vbox9 );
- CBDumpSrt=AddCheckButton( MSGTR_PREFERENCES_SUB_SRT,vbox9 );
-
- AddHSeparator( vbox9 );
- CBUseASS=AddCheckButton( MSGTR_PREFERENCES_SUB_USE_ASS,vbox9 );
- hbox9=AddHBox( vbox9,0 );
- CBASSUseMargins=AddCheckButton( MSGTR_PREFERENCES_SUB_ASS_USE_MARGINS,hbox9 );
-
- hbox91=gtk_hbox_new( FALSE,0 );
- gtk_widget_set_name( hbox91,"hbox91" );
- gtk_box_pack_start( GTK_BOX( hbox9 ),hbox91,TRUE,FALSE,0 );
- gtk_widget_show( hbox91 );
- SBASSTopMargin=AddSpinButton( MSGTR_PREFERENCES_SUB_ASS_TOP_MARGIN,
- (GtkAdjustment *)gtk_adjustment_new(0,0,512,1,8,0),hbox91 );
-
- hbox92=gtk_hbox_new( FALSE,0 );
- gtk_widget_set_name( hbox92,"hbox92" );
- gtk_box_pack_start( GTK_BOX( hbox9 ),hbox92,TRUE,FALSE,0 );
- gtk_widget_show( hbox92 );
- SBASSBottomMargin=AddSpinButton( MSGTR_PREFERENCES_SUB_ASS_BOTTOM_MARGIN,
- (GtkAdjustment *)gtk_adjustment_new(0,0,512,1,8,0),hbox92 );
-
- label=AddLabel( MSGTR_PREFERENCES_SubtitleOSD,NULL );
- gtk_notebook_set_tab_label( GTK_NOTEBOOK( notebook1 ),gtk_notebook_get_nth_page( GTK_NOTEBOOK( notebook1 ),2 ),label );
- vbox601=AddVBox( notebook1,0 );
-
-// --- 4. page
-
- vbox603=AddVBox(
- AddFrame( NULL,GTK_SHADOW_NONE,
- AddFrame( MSGTR_PREFERENCES_FRAME_Font,GTK_SHADOW_ETCHED_OUT,vbox601,0 ),1 ),0 );
-
- hbox6=AddHBox( vbox603,1 );
- AddLabel( MSGTR_PREFERENCES_Font,hbox6 );
- prEFontName=gtk_entry_new();
- gtk_widget_set_name( prEFontName,"prEFontName" );
- gtk_widget_show( prEFontName );
- gtk_box_pack_start( GTK_BOX( hbox6 ),prEFontName,TRUE,TRUE,0 );
- hbuttonbox5=AddHButtonBox( hbox6 );
- gtk_container_set_border_width( GTK_CONTAINER( hbuttonbox5 ),3 );
- BLoadFont=AddButton( MSGTR_Browse,hbuttonbox5 );
-
-#ifndef CONFIG_FREETYPE
- hbox7=AddHBox( vbox603,1 );
- AddLabel( MSGTR_PREFERENCES_FontFactor,hbox7 );
- HSFontFactoradj=GTK_ADJUSTMENT( gtk_adjustment_new( 0,0,10,0.05,0,0 ) );
- HSFontFactor=AddHScaler( HSFontFactoradj,hbox7,2 );
-#else
-
- RBFontNoAutoScale=AddRadioButton( MSGTR_PREFERENCES_FontNoAutoScale,&Font_group,vbox603 );
- RBFontAutoScaleHeight=AddRadioButton( MSGTR_PREFERENCES_FontPropHeight,&Font_group,vbox603 );
- RBFontAutoScaleWidth=AddRadioButton( MSGTR_PREFERENCES_FontPropWidth,&Font_group,vbox603 );
- RBFontAutoScaleDiagonal=AddRadioButton( MSGTR_PREFERENCES_FontPropDiagonal,&Font_group,vbox603 );
-
- table1=gtk_table_new( 3,2,FALSE );
- gtk_widget_set_name( table1,"table1" );
- gtk_widget_show( table1 );
- gtk_box_pack_start( GTK_BOX( vbox603 ),table1,FALSE,FALSE,0 );
-
- label=AddLabel( MSGTR_PREFERENCES_FontEncoding,NULL );
- gtk_table_attach( GTK_TABLE( table1 ),label,0,1,0,1,(GtkAttachOptions)( GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 );
-
- CBFontEncoding=gtk_combo_new();
- gtk_widget_set_name( CBFontEncoding,"CBFontEncoding" );
- gtk_widget_show( CBFontEncoding );
- gtk_table_attach( GTK_TABLE( table1 ),CBFontEncoding,1,2,0,1,(GtkAttachOptions)( GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 );
- {
- int i;
- for ( i=0;lEncoding[i].name;i++ ) CBFontEncoding_items=g_list_append( CBFontEncoding_items,lEncoding[i].comment );
- }
- gtk_combo_set_popdown_strings( GTK_COMBO( CBFontEncoding ),CBFontEncoding_items );
- g_list_free( CBFontEncoding_items );
-
- EFontEncoding=GTK_COMBO( CBFontEncoding )->entry;
- gtk_widget_set_name( EFontEncoding,"EFontEncoding" );
- gtk_entry_set_editable( GTK_ENTRY( EFontEncoding ),FALSE );
- gtk_widget_show( EFontEncoding );
-
- label=AddLabel( MSGTR_PREFERENCES_FontBlur,NULL );
- gtk_table_attach( GTK_TABLE( table1 ),label,0,1,1,2,(GtkAttachOptions)( GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 );
-
- HSFontBluradj=GTK_ADJUSTMENT( gtk_adjustment_new( 0,0,100,0.1,0,0 ) );
- HSFontBlur=AddHScaler( HSFontBluradj,NULL,2 );
- gtk_table_attach( GTK_TABLE( table1 ),HSFontBlur,1,2,1,2,(GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 );
-
- label=AddLabel( MSGTR_PREFERENCES_FontOutLine,NULL );
- gtk_table_attach( GTK_TABLE( table1 ),label,0,1,2,3,(GtkAttachOptions)( GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 );
-
- HSFontOutLineadj=GTK_ADJUSTMENT( gtk_adjustment_new( 0,0,100,0.1,0,0 ) );
- HSFontOutLine=AddHScaler( HSFontOutLineadj,NULL,2 );
- gtk_table_attach( GTK_TABLE( table1 ),HSFontOutLine,1,2,2,3,(GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 );
-
- label=AddLabel( MSGTR_PREFERENCES_FontTextScale,NULL );
- gtk_table_attach( GTK_TABLE( table1 ),label,0,1,3,4,(GtkAttachOptions)( GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 );
-
- HSFontTextScaleadj=GTK_ADJUSTMENT( gtk_adjustment_new( 0,0,100,0.1,0,0 ) );
- HSFontTextScale=AddHScaler( HSFontTextScaleadj,NULL,2 );
- gtk_table_attach( GTK_TABLE( table1 ),HSFontTextScale,1,2,3,4,(GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 );
-
- label=AddLabel( MSGTR_PREFERENCES_FontOSDScale,NULL );
- gtk_table_attach( GTK_TABLE( table1 ),label,0,1,4,5,(GtkAttachOptions)( GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 );
-
- HSFontOSDScaleadj=GTK_ADJUSTMENT( gtk_adjustment_new( 0,0,100,0.1,0,0 ) );
- HSFontOSDScale=AddHScaler( HSFontOSDScaleadj,NULL,2 );
- gtk_table_attach( GTK_TABLE( table1 ),HSFontOSDScale,1,2,4,5,(GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 );
-#endif
-
- label=AddLabel( MSGTR_PREFERENCES_FRAME_Font,NULL );
- gtk_notebook_set_tab_label( GTK_NOTEBOOK( notebook1 ),gtk_notebook_get_nth_page( GTK_NOTEBOOK( notebook1 ),3 ),label );
-
-// --- 5. page
-
- vbox601=AddVBox( notebook1,0 );
-
- vbox602=AddVBox(
- AddFrame( NULL,GTK_SHADOW_NONE,
- AddFrame( MSGTR_PREFERENCES_FRAME_CodecDemuxer,GTK_SHADOW_ETCHED_OUT,vbox601,0 ),1 ),0 );
-
- CBNonInterlaved=AddCheckButton( MSGTR_PREFERENCES_NI,vbox602 );
- CBIndex=AddCheckButton( MSGTR_PREFERENCES_IDX,vbox602 );
-
- hbox5=AddHBox( vbox602,1 );
-
- AddLabel( MSGTR_PREFERENCES_VideoCodecFamily,hbox5 );
-
- CBVFM=gtk_combo_new();
- gtk_widget_set_name( CBVFM,"CBVFM" );
- gtk_widget_show( CBVFM );
- gtk_box_pack_start( GTK_BOX( hbox5 ),CBVFM,TRUE,TRUE,0 );
-
- EVFM=GTK_COMBO( CBVFM )->entry;
- gtk_widget_set_name( EVFM,"CEVFM" );
- gtk_entry_set_editable( GTK_ENTRY( EVFM ),FALSE );
- gtk_widget_show( EVFM );
-
- hbox5=AddHBox( vbox602,1 );
-
- AddLabel( MSGTR_PREFERENCES_AudioCodecFamily,hbox5 );
-
- CBAFM=gtk_combo_new();
- gtk_widget_set_name( CBAFM,"CBAFM" );
- gtk_widget_show( CBAFM );
- gtk_box_pack_start( GTK_BOX( hbox5 ),CBAFM,TRUE,TRUE,0 );
-
- EAFM=GTK_COMBO( CBAFM )->entry;
- gtk_widget_set_name( EAFM,"EAFM" );
- gtk_entry_set_editable( GTK_ENTRY( EAFM ),FALSE );
- gtk_widget_show( EAFM );
-
- label=AddLabel( MSGTR_PREFERENCES_Codecs,NULL );
- gtk_notebook_set_tab_label( GTK_NOTEBOOK( notebook1 ),gtk_notebook_get_nth_page( GTK_NOTEBOOK( notebook1 ),4 ),label );
-
- vbox601=AddVBox( notebook1,0 );
-
-// --- 6. page
-
- vbox602=AddVBox(
- AddFrame( NULL,GTK_SHADOW_NONE,
- AddFrame( MSGTR_PREFERENCES_FRAME_PostProcess,GTK_SHADOW_ETCHED_OUT,vbox601,0 ),1 ),0 );
-
- CBPostprocess=AddCheckButton( MSGTR_PREFERENCES_PostProcess,vbox602 );
-
- hbox5=AddHBox( vbox602,1 );
-
- AddLabel( MSGTR_PREFERENCES_AutoQuality,hbox5 );
-
- if ( guiIntfStruct.sh_video && guiIntfStruct.Playing ) HSPPQualityadj=GTK_ADJUSTMENT( gtk_adjustment_new( 0,0,get_video_quality_max( guiIntfStruct.sh_video ),0,0,0 ) );
- else HSPPQualityadj=GTK_ADJUSTMENT( gtk_adjustment_new( 0,0,100,0,0,0 ) );
- HSPPQuality=AddHScaler( HSPPQualityadj,hbox5,0 );
-
- vbox602=AddVBox(
- AddFrame( NULL,GTK_SHADOW_NONE,
- AddFrame( MSGTR_PREFERENCES_FRAME_Cache,GTK_SHADOW_ETCHED_OUT,vbox601,0 ),1 ),0 );
-
- CBCache=AddCheckButton( MSGTR_PREFERENCES_Cache,vbox602 );
-
- hbox5=AddHBox( vbox602,1 );
-
- AddLabel( MSGTR_PREFERENCES_CacheSize,hbox5 );
-
- SBCacheadj=GTK_ADJUSTMENT( gtk_adjustment_new( 2048,4,65535,1,10,10 ) );
- SBCache=gtk_spin_button_new( GTK_ADJUSTMENT( SBCacheadj ),1,0 );
- gtk_widget_show( SBCache );
- gtk_box_pack_start( GTK_BOX( hbox5 ),SBCache,TRUE,TRUE,0 );
-
- vbox602=AddVBox(
- AddFrame( NULL,GTK_SHADOW_NONE,
- AddFrame( MSGTR_PREFERENCES_FRAME_Misc,GTK_SHADOW_ETCHED_OUT,vbox601,1 ),1 ),0 );
-
- CBShowVideoWindow=AddCheckButton( MSGTR_PREFERENCES_ShowVideoWindow,vbox602 );
- CBLoadFullscreen=AddCheckButton( MSGTR_PREFERENCES_LoadFullscreen,vbox602 );
- CBSaveWinPos=AddCheckButton( MSGTR_PREFERENCES_SaveWinPos,vbox602 );
- CBStopXScreenSaver=AddCheckButton( MSGTR_PREFERENCES_XSCREENSAVER,vbox602 );
- CBPlayBar=AddCheckButton( MSGTR_PREFERENCES_PlayBar,vbox602 );
-
- AddHSeparator( vbox602 );
-
- CBAutoSync=AddCheckButton( MSGTR_PREFERENCES_AutoSync,vbox602 );
- hbox5=AddHBox( vbox602,1 );
- AddLabel( MSGTR_PREFERENCES_AutoSyncValue,hbox5 );
- SBAutoSyncadj=GTK_ADJUSTMENT( gtk_adjustment_new( 0,0,10000,1,10,10 ) );
- SBAutoSync=gtk_spin_button_new( GTK_ADJUSTMENT( SBAutoSyncadj ),1,0 );
- gtk_widget_show( SBAutoSync );
- gtk_box_pack_start( GTK_BOX( hbox5 ),SBAutoSync,TRUE,TRUE,0 );
-
- AddHSeparator( vbox602 );
-
- table1=gtk_table_new( 2,2,FALSE );
- gtk_widget_set_name( table1,"table1" );
- gtk_widget_show( table1 );
- gtk_box_pack_start( GTK_BOX( vbox602 ),table1,FALSE,FALSE,0 );
-
- label=AddLabel( MSGTR_PREFERENCES_DVDDevice,NULL );
- gtk_table_attach( GTK_TABLE( table1 ),label,0,1,0,1,(GtkAttachOptions)( GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 );
- prEDVDDevice=gtk_entry_new();
- gtk_widget_set_name( prEDVDDevice,"prEDVDDevice" );
- gtk_widget_show( prEDVDDevice );
- gtk_table_attach( GTK_TABLE( table1 ),prEDVDDevice,1,2,0,1,(GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 );
-
- label=AddLabel( MSGTR_PREFERENCES_CDROMDevice,NULL );
- gtk_table_attach( GTK_TABLE( table1 ),label,0,1,1,2,(GtkAttachOptions)( GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 );
- prECDRomDevice=gtk_entry_new();
- gtk_widget_set_name( prECDRomDevice,"prECDRomDevice" );
- gtk_widget_show( prECDRomDevice );
- gtk_table_attach( GTK_TABLE( table1 ),prECDRomDevice,1,2,1,2,(GtkAttachOptions)( GTK_EXPAND | GTK_FILL ),(GtkAttachOptions)( 0 ),0,0 );
-
-// AddHSeparator( vbox602 );
-
- label=AddLabel( MSGTR_PREFERENCES_Misc,NULL );
- gtk_notebook_set_tab_label( GTK_NOTEBOOK( notebook1 ),gtk_notebook_get_nth_page( GTK_NOTEBOOK( notebook1 ),5 ),label );
-
-// ---
-
- AddHSeparator( vbox1 );
-
- hbuttonbox1=AddHButtonBox( vbox1 );
- gtk_button_box_set_layout( GTK_BUTTON_BOX( hbuttonbox1 ),GTK_BUTTONBOX_END );
- gtk_button_box_set_spacing( GTK_BUTTON_BOX( hbuttonbox1 ),10 );
- BOk=AddButton( MSGTR_Ok,hbuttonbox1 );
- BCancel=AddButton( MSGTR_Cancel,hbuttonbox1 );
-
- gtk_widget_add_accelerator( BOk,"clicked",accel_group,GDK_Return,0,GTK_ACCEL_VISIBLE );
- gtk_widget_add_accelerator( BCancel,"clicked",accel_group,GDK_Escape,0,GTK_ACCEL_VISIBLE );
-
- gtk_signal_connect( GTK_OBJECT( Preferences ),"destroy",GTK_SIGNAL_FUNC( WidgetDestroy ),&Preferences );
-
- gtk_signal_connect( GTK_OBJECT( AConfig ),"clicked",GTK_SIGNAL_FUNC( prButton ),(void*)bAConfig );
- gtk_signal_connect( GTK_OBJECT( BOk ),"clicked",GTK_SIGNAL_FUNC( prButton ),(void*)bOk );
- gtk_signal_connect( GTK_OBJECT( BCancel ),"clicked",GTK_SIGNAL_FUNC( prButton ),(void*)bCancel );
- gtk_signal_connect( GTK_OBJECT( VConfig ),"clicked",GTK_SIGNAL_FUNC( prButton ),(void*)bVconfig );
-#if 0
- gtk_signal_connect( GTK_OBJECT( BLoadSubtitle ),"clicked",GTK_SIGNAL_FUNC( prButton ),(void*)bLSubtitle );
-#endif
- gtk_signal_connect( GTK_OBJECT( BLoadFont ),"clicked",GTK_SIGNAL_FUNC( prButton ),(void*)bLFont );
-
-#if 0
- gtk_signal_connect( GTK_OBJECT( CBNormalize ),"toggled",GTK_SIGNAL_FUNC( on_CBNormalize_toggled ),NULL );
- gtk_signal_connect( GTK_OBJECT( CBSoftwareMixer ),"toggled",GTK_SIGNAL_FUNC( on_CBSoftwareMixer_toggled ),NULL );
- gtk_signal_connect( GTK_OBJECT( CBSurround ),"toggled",GTK_SIGNAL_FUNC( on_CBSurround_toggled ),NULL );
- gtk_signal_connect( GTK_OBJECT( CBExtraStereo ),"toggled",GTK_SIGNAL_FUNC( on_CBExtraStereo_toggled ),NULL );
- gtk_signal_connect( GTK_OBJECT( CBDoubleBuffer ),"toggled",GTK_SIGNAL_FUNC( on_CBDoubleBuffer_toggled ),NULL );
- gtk_signal_connect( GTK_OBJECT( CBDR ),"toggled",GTK_SIGNAL_FUNC( on_CBDR_toggled ),NULL );
- gtk_signal_connect( GTK_OBJECT( CBFramedrop ),"toggled",GTK_SIGNAL_FUNC( on_CBFramedrop_toggled ),NULL );
- gtk_signal_connect( GTK_OBJECT( CBHFramedrop ),"toggled",GTK_SIGNAL_FUNC( on_CBHFramedrop_toggled ),NULL );
- gtk_signal_connect( GTK_OBJECT( CBFullScreen ),"toggled",GTK_SIGNAL_FUNC( on_CBFullScreen_toggled ),NULL );
- gtk_signal_connect( GTK_OBJECT( CBNonInterlaved ),"toggled",GTK_SIGNAL_FUNC( on_CBNonInterlaved_toggled ),NULL );
- gtk_signal_connect( GTK_OBJECT( CBFlip ),"toggled",GTK_SIGNAL_FUNC( on_CBFlip_toggled ),NULL );
- gtk_signal_connect( GTK_OBJECT( CBPostprocess ),"toggled",GTK_SIGNAL_FUNC( on_CBPostprocess_toggled ),NULL );
- gtk_signal_connect( GTK_OBJECT( CBNoAutoSub ),"toggled",GTK_SIGNAL_FUNC( on_CBNoAutoSub_toggled ),NULL );
- gtk_signal_connect( GTK_OBJECT( CBSubUnicode ),"toggled",GTK_SIGNAL_FUNC( on_CNSubUnicode_toggled ),NULL );
- gtk_signal_connect( GTK_OBJECT( CBDumpMPSub ),"toggled",GTK_SIGNAL_FUNC( on_CBDumpMPSub_toggled ),NULL );
- gtk_signal_connect( GTK_OBJECT( CBDumpSrt ),"toggled",GTK_SIGNAL_FUNC( on_CBDumpSrt_toggled ),NULL );
-#endif
-#if 0
- gtk_signal_connect( GTK_OBJECT( RBOSDNone ),"toggled",GTK_SIGNAL_FUNC( on_RBOSDNone_toggled ),NULL );
- gtk_signal_connect( GTK_OBJECT( RBOSDTandP ),"toggled",GTK_SIGNAL_FUNC( on_RBOSDTandP_toggled ),NULL );
- gtk_signal_connect( GTK_OBJECT( RBOSDIndicator ),"toggled",GTK_SIGNAL_FUNC( on_RBOSDIndicator_toggled ),NULL );
- gtk_signal_connect( GTK_OBJECT( RBOSDTPTT ),"toggled",GTK_SIGNAL_FUNC( on_RBOSDIndicator_toggled ),NULL );
- gtk_signal_connect( GTK_OBJECT( CBAudioEqualizer ),"toggled",GTK_SIGNAL_FUNC( on_CBAudioEqualizer_toggled ),NULL );
-#endif
-#if 0
- gtk_signal_connect( GTK_OBJECT( HSAudioDelay ),"motion_notify_event",GTK_SIGNAL_FUNC( on_HSAudioDelay_motion_notify_event ),NULL );
- gtk_signal_connect( GTK_OBJECT( HSPanscan ),"motion_notify_event",GTK_SIGNAL_FUNC( on_HSPanscan_motion_notify_event ),NULL );
- gtk_signal_connect( GTK_OBJECT( label2 ),"motion_notify_event",GTK_SIGNAL_FUNC( on_label2_motion_notify_event ),NULL );
- gtk_signal_connect( GTK_OBJECT( HSSubDelay ),"motion_notify_event",GTK_SIGNAL_FUNC( on_HSSubDelay_motion_notify_event ),NULL );
- gtk_signal_connect( GTK_OBJECT( HSSubPosition ),"motion_notify_event",GTK_SIGNAL_FUNC( on_HSSubPosition_motion_notify_event ),NULL );
- gtk_signal_connect( GTK_OBJECT( HSSubFPS ),"motion_notify_event",GTK_SIGNAL_FUNC( on_HSSubFPS_motion_notify_event ),NULL );
- gtk_signal_connect( GTK_OBJECT( HSFontFactor ),"motion_notify_event",GTK_SIGNAL_FUNC( on_HSFontFactor_motion_notify_event ),NULL );
- gtk_signal_connect( GTK_OBJECT( HSPPQuality ),"motion_notify_event",GTK_SIGNAL_FUNC( on_HSPPQuality_motion_notify_event ),NULL );
-#endif
-
- gtk_notebook_set_page( GTK_NOTEBOOK( notebook1 ),2 );
-
- gtk_window_add_accel_group( GTK_WINDOW( Preferences ),accel_group );
-
- return Preferences;
-}
-
-#ifdef CONFIG_OSS_AUDIO
-GList *appendOSSDevices(GList *l) {
- // careful! the current implementation allows only string constants!
- l = g_list_append(l, (gpointer)"/dev/dsp");
- if (gtkAOOSSDevice && strncmp(gtkAOOSSDevice, "/dev/sound", 10) == 0) {
- l = g_list_append(l, (gpointer)"/dev/sound/dsp0");
- l = g_list_append(l, (gpointer)"/dev/sound/dsp1");
- l = g_list_append(l, (gpointer)"/dev/sound/dsp2");
- l = g_list_append(l, (gpointer)"/dev/sound/dsp3");
- } else {
- l = g_list_append(l, (gpointer)"/dev/dsp0");
- l = g_list_append(l, (gpointer)"/dev/dsp1");
- l = g_list_append(l, (gpointer)"/dev/dsp2");
- l = g_list_append(l, (gpointer)"/dev/dsp3");
- }
-#ifdef CONFIG_DXR3
- l = g_list_append(l, (gpointer)"/dev/em8300_ma");
- l = g_list_append(l, (gpointer)"/dev/em8300_ma-0");
- l = g_list_append(l, (gpointer)"/dev/em8300_ma-1");
- l = g_list_append(l, (gpointer)"/dev/em8300_ma-2");
- l = g_list_append(l, (gpointer)"/dev/em8300_ma-3");
-#endif
- return l;
-}
-
-GList *appendOSSMixers(GList *l) {
- // careful! the current implementation allows only string constants!
- l = g_list_append(l, (gpointer)"/dev/mixer");
- if (gtkAOOSSMixer && strncmp(gtkAOOSSMixer, "/dev/sound", 10) == 0) {
- l = g_list_append(l, (gpointer)"/dev/sound/mixer0");
- l = g_list_append(l, (gpointer)"/dev/sound/mixer1");
- l = g_list_append(l, (gpointer)"/dev/sound/mixer2");
- l = g_list_append(l, (gpointer)"/dev/sound/mixer3");
- } else {
- l = g_list_append(l, (gpointer)"/dev/mixer0");
- l = g_list_append(l, (gpointer)"/dev/mixer1");
- l = g_list_append(l, (gpointer)"/dev/mixer2");
- l = g_list_append(l, (gpointer)"/dev/mixer3");
- }
- return l;
-}
-
-GList *appendOSSMixerChannels(GList *l) {
- l = g_list_append(l, (gpointer)"vol");
- l = g_list_append(l, (gpointer)"pcm");
- l = g_list_append(l, (gpointer)"line");
- return l;
-}
-#endif
-
-#ifdef CONFIG_ALSA
-GList *appendALSADevices(GList *l) {
- l = g_list_append(l, (gpointer)"default");
- l = g_list_append(l, (gpointer)"hw=0.0");
- l = g_list_append(l, (gpointer)"hw=0.1");
- l = g_list_append(l, (gpointer)"hw=0.2");
- l = g_list_append(l, (gpointer)"surround40");
- l = g_list_append(l, (gpointer)"surround51");
- l = g_list_append(l, (gpointer)"plug=surround40");
- l = g_list_append(l, (gpointer)"plug=surround51");
- return l;
-}
-
-GList *appendALSAMixers(GList *l) {
- l = g_list_append(l, (gpointer)"default");
- return l;
-}
-
-GList *appendALSAMixerChannels(GList *l) {
- l = g_list_append(l, (gpointer)"Master");
- l = g_list_append(l, (gpointer)"Line");
- l = g_list_append(l, (gpointer)"PCM");
- l = g_list_append(l, (gpointer)"PCM,1");
- return l;
-}
-#endif
-
-#ifdef CONFIG_SDL
-GList *appendSDLDevices(GList *l) {
- l = g_list_append(l, (gpointer)"alsa");
- l = g_list_append(l, (gpointer)"arts");
- l = g_list_append(l, (gpointer)"esd");
- l = g_list_append(l, (gpointer)"jack");
- l = g_list_append(l, (gpointer)"oss");
- l = g_list_append(l, (gpointer)"nas");
- return l;
-}
-#endif
-
-#ifdef CONFIG_ESD
-GList *appendESDDevices(GList *l) {
- l = g_list_append(l, (gpointer)"Enter Remote IP");
- l = g_list_append(l, (gpointer)"Use Software Mixer");
- return l;
-}
-#endif
-
-// Gets text string from a gtk entry, interpreting
-// MSGTR_PREFERENCES_DriverDefault as null string.
-const char *getGtkEntryText(GtkWidget *from) {
- const char *tmp = gtk_entry_get_text(GTK_ENTRY(from));
- if (strcmp(tmp, MSGTR_PREFERENCES_DriverDefault) == 0) {
- tmp = NULL;
- }
- return tmp;
-}
-
-// Sets text string of a gtk entry, interpreting
-// null string as MSGTR_PREFERENCES_DriverDefault.
-void setGtkEntryText(GtkWidget *dest, char *to) {
- if (!to) {
- to = MSGTR_PREFERENCES_DriverDefault;
- }
- gtk_entry_set_text(GTK_ENTRY(dest),to);
-}
-
- GtkWidget *AudioConfig;
-static GtkWidget *CEAudioDevice;
-static GtkWidget *CBAudioDevice;
-static GtkWidget *CEAudioMixer;
-static GtkWidget *CBAudioMixer;
-static GtkWidget *CEAudioMixerChannel;
-static GtkWidget *CBAudioMixerChannel;
-static GtkWidget *BAudioOk;
-static GtkWidget *BAudioCancel;
-
-void ShowAudioConfig( void ) {
- if (AudioConfig) gtkActive(AudioConfig);
- else AudioConfig = create_AudioConfig();
-
-#ifdef CONFIG_OSS_AUDIO
- if (strncmp(ao_driver[0], "oss", 3) == 0) {
- setGtkEntryText(CEAudioDevice, gtkAOOSSDevice);
- setGtkEntryText(CEAudioMixer, gtkAOOSSMixer);
- setGtkEntryText(CEAudioMixerChannel, gtkAOOSSMixerChannel);
- }
-#endif
-#ifdef CONFIG_ALSA
- if (strncmp(ao_driver[0], "alsa", 4) == 0) {
- setGtkEntryText(CEAudioDevice, gtkAOALSADevice);
- setGtkEntryText(CEAudioMixer, gtkAOALSAMixer);
- setGtkEntryText(CEAudioMixerChannel, gtkAOALSAMixerChannel);
- }
-#endif
-#ifdef CONFIG_SDL
- if (strncmp(ao_driver[0], "sdl", 3) == 0) {
- setGtkEntryText(CEAudioDevice, gtkAOSDLDriver);
- }
-#endif
-#ifdef CONFIG_ESD
- if (strncmp(ao_driver[0], "esd", 3) == 0) {
- setGtkEntryText(CEAudioDevice, gtkAOESDDevice);
- }
-#endif
-
- gtk_widget_show(AudioConfig);
- gtkSetLayer(AudioConfig);
-}
-
-void HideAudioConfig( void ) {
- if (!AudioConfig) return;
- gtk_widget_hide(AudioConfig);
- gtk_widget_destroy(AudioConfig);
- AudioConfig=NULL;
-}
-
-static void audioButton(GtkButton *button, gpointer user_data) {
- switch( (int)user_data ) {
- case 1:
-#ifdef CONFIG_OSS_AUDIO
- if (strncmp(ao_driver[0], "oss", 3) == 0) {
- gfree(&gtkAOOSSDevice);
- gtkAOOSSDevice = gstrdup(getGtkEntryText(CEAudioDevice));
- gfree(&gtkAOOSSMixer);
- gtkAOOSSMixer = gstrdup(getGtkEntryText(CEAudioMixer));
- gfree(&gtkAOOSSMixerChannel);
- gtkAOOSSMixerChannel = gstrdup(getGtkEntryText(CEAudioMixerChannel));
- }
-#endif
-#ifdef CONFIG_ALSA
- if (strncmp(ao_driver[0], "alsa", 4) == 0) {
- gfree(&gtkAOALSADevice);
- gtkAOALSADevice = gstrdup(getGtkEntryText(CEAudioDevice));
- gfree(&gtkAOALSAMixer);
- gtkAOALSAMixer = gstrdup(getGtkEntryText(CEAudioMixer));
- gfree(&gtkAOALSAMixerChannel);
- gtkAOALSAMixerChannel = gstrdup(getGtkEntryText(CEAudioMixerChannel));
- }
-#endif
-#ifdef CONFIG_SDL
- if (strncmp(ao_driver[0], "sdl", 3) == 0) {
- gfree(&gtkAOSDLDriver);
- gtkAOSDLDriver = gstrdup(getGtkEntryText(CEAudioDevice));
- }
-#endif
-#ifdef CONFIG_ESD
- if (strncmp(ao_driver[0], "esd", 3) == 0) {
- gfree(&gtkAOESDDevice);
- gtkAOESDDevice = gstrdup(getGtkEntryText(CEAudioDevice));
- }
-#endif
- case 0:
- HideAudioConfig();
- break;
- }
-}
-
-GtkWidget *create_AudioConfig( void ) {
- GList *items = NULL;
- GtkWidget *vbox;
- GtkWidget *table;
- GtkWidget *label;
- GtkWidget *hbuttonbox;
- GtkAccelGroup *accel_group;
-
- AudioConfig = gtk_window_new(GTK_WINDOW_TOPLEVEL);
- gtk_widget_set_name(AudioConfig, "AudioConfig");
- gtk_object_set_data(GTK_OBJECT(AudioConfig), "AudioConfig", AudioConfig);
- gtk_window_set_title(GTK_WINDOW(AudioConfig), MSGTR_AudioPreferences);
- gtk_window_set_position(GTK_WINDOW(AudioConfig), GTK_WIN_POS_CENTER);
- gtk_window_set_policy(GTK_WINDOW(AudioConfig), FALSE, FALSE, FALSE);
- gtk_window_set_wmclass(GTK_WINDOW(AudioConfig), "Audio Config", "MPlayer");
-
- gtk_widget_realize(AudioConfig);
- gtkAddIcon(AudioConfig);
-
- vbox = AddVBox(AddDialogFrame(AudioConfig), 0);
-
- table = gtk_table_new(2, 3, FALSE);
- gtk_widget_set_name(table, "table");
- gtk_widget_show(table);
- gtk_box_pack_start(GTK_BOX(vbox), table, TRUE, TRUE, 0);
-
- label = AddLabel(MSGTR_PREFERENCES_Audio_Device, NULL);
- gtk_table_attach(GTK_TABLE(table), label, 0, 1, 0, 1, (GtkAttachOptions)(GTK_FILL), (GtkAttachOptions)(0), 0, 0);
-
- CBAudioDevice = AddComboBox(NULL);
- gtk_table_attach(GTK_TABLE(table), CBAudioDevice, 1, 2, 0, 1, (GtkAttachOptions)(GTK_EXPAND | GTK_FILL), (GtkAttachOptions)(0), 0, 0);
- items = g_list_append(items,(gpointer)MSGTR_PREFERENCES_DriverDefault);
-#ifdef CONFIG_OSS_AUDIO
- if (strncmp(ao_driver[0], "oss", 3) == 0)
- items = appendOSSDevices(items);
-#endif
-#ifdef CONFIG_ALSA
- if (strncmp(ao_driver[0], "alsa", 4) == 0)
- items = appendALSADevices(items);
-#endif
-#ifdef CONFIG_SDL
- if (strncmp(ao_driver[0], "sdl", 3) == 0)
- items = appendSDLDevices(items);
-#endif
-#ifdef CONFIG_ESD
- if (strncmp(ao_driver[0], "esd", 3) == 0)
- items = appendESDDevices(items);
-#endif
- gtk_combo_set_popdown_strings(GTK_COMBO(CBAudioDevice), items);
- g_list_free(items);
- items = NULL;
-
- CEAudioDevice = GTK_COMBO(CBAudioDevice)->entry;
- gtk_widget_set_name(CEAudioDevice, "CEAudioDevice");
- gtk_widget_show(CEAudioDevice);
-
- label = AddLabel(MSGTR_PREFERENCES_Audio_Mixer, NULL);
- gtk_table_attach(GTK_TABLE(table), label, 0, 1, 1, 2, (GtkAttachOptions)(GTK_FILL), (GtkAttachOptions)(0), 0, 0);
-
- CBAudioMixer = AddComboBox(NULL);
- gtk_table_attach(GTK_TABLE(table), CBAudioMixer, 1, 2, 1, 2, (GtkAttachOptions)(GTK_EXPAND | GTK_FILL), (GtkAttachOptions)(0), 0, 0);
- items = g_list_append(items, (gpointer)MSGTR_PREFERENCES_DriverDefault);
-#ifdef CONFIG_OSS_AUDIO
- if (strncmp(ao_driver[0], "oss", 3) == 0)
- items = appendOSSMixers(items);
-#endif
-#ifdef CONFIG_ALSA
- if (strncmp(ao_driver[0], "alsa", 4) == 0)
- items = appendALSAMixers(items);
-#endif
- gtk_combo_set_popdown_strings(GTK_COMBO(CBAudioMixer), items);
- g_list_free(items);
- items = NULL;
-
- CEAudioMixer = GTK_COMBO(CBAudioMixer)->entry;
- gtk_widget_set_name(CEAudioMixer, "CEAudioMixer");
- gtk_widget_show(CEAudioMixer);
-
- label = AddLabel(MSGTR_PREFERENCES_Audio_MixerChannel, NULL);
- gtk_table_attach(GTK_TABLE(table), label, 0, 1, 2, 3, (GtkAttachOptions)(GTK_FILL), (GtkAttachOptions)(0), 0, 0);
-
- CBAudioMixerChannel = AddComboBox(NULL);
- gtk_table_attach(GTK_TABLE(table), CBAudioMixerChannel, 1, 2, 2, 3, (GtkAttachOptions)(GTK_EXPAND | GTK_FILL), (GtkAttachOptions)(0), 0, 0);
- items = g_list_append(items, (gpointer)MSGTR_PREFERENCES_DriverDefault);
-#ifdef CONFIG_OSS_AUDIO
- if (strncmp(ao_driver[0], "oss", 3) == 0)
- items = appendOSSMixerChannels(items);
-#endif
-#ifdef CONFIG_ALSA
- if (strncmp(ao_driver[0], "alsa", 4) == 0)
- items = appendALSAMixerChannels(items);
-#endif
- gtk_combo_set_popdown_strings(GTK_COMBO(CBAudioMixerChannel), items);
- g_list_free(items);
- items = NULL;
-
- CEAudioMixerChannel = GTK_COMBO(CBAudioMixerChannel)->entry;
- gtk_widget_set_name(CEAudioMixerChannel, "CEAudioMixerChannel");
- gtk_widget_show(CEAudioMixerChannel);
-
- AddHSeparator(vbox);
-
- hbuttonbox = AddHButtonBox(vbox);
- gtk_button_box_set_layout(GTK_BUTTON_BOX(hbuttonbox), GTK_BUTTONBOX_END);
- gtk_button_box_set_spacing(GTK_BUTTON_BOX(hbuttonbox), 10);
- BAudioOk = AddButton(MSGTR_Ok, hbuttonbox);
- BAudioCancel = AddButton(MSGTR_Cancel, hbuttonbox);
-
- gtk_signal_connect(GTK_OBJECT(AudioConfig), "destroy", GTK_SIGNAL_FUNC(WidgetDestroy), &AudioConfig);
- gtk_signal_connect(GTK_OBJECT(BAudioOk), "clicked", GTK_SIGNAL_FUNC(audioButton), (void*)1);
- gtk_signal_connect(GTK_OBJECT(BAudioCancel), "clicked", GTK_SIGNAL_FUNC(audioButton), (void*)0);
-
- accel_group = gtk_accel_group_new();
- gtk_widget_add_accelerator(BAudioOk, "clicked", accel_group, GDK_Return, 0, GTK_ACCEL_VISIBLE);
- gtk_widget_add_accelerator(BAudioCancel, "clicked", accel_group, GDK_Escape, 0, GTK_ACCEL_VISIBLE);
- gtk_window_add_accel_group(GTK_WINDOW(AudioConfig), accel_group);
-
- return AudioConfig;
-}
-
-#ifdef CONFIG_DXR3
-// --- dxr3 config box
-
-static GtkWidget * DXR3Config;
-static GtkWidget * CBDevice;
-static GtkWidget * CEDXR3Device;
-static GtkWidget * RBVNone;
-#ifdef CONFIG_LIBAVCODEC
- static GtkWidget * RBVLavc;
-#endif
-static GtkWidget * dxr3BOk;
-static GtkWidget * dxr3BCancel;
-
-GtkWidget * create_DXR3Config( void );
-
-void ShowDXR3Config( void )
-{
- if ( DXR3Config ) gtkActive( DXR3Config );
- else DXR3Config=create_DXR3Config();
-
- gtk_entry_set_text( GTK_ENTRY( CEDXR3Device ),gtkDXR3Device );
-
- gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( RBVNone ),TRUE );
-#ifdef CONFIG_LIBAVCODEC
- if ( gtkVfLAVC ) gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( RBVLavc ),TRUE );
-#endif
-
- gtk_widget_show( DXR3Config );
- gtkSetLayer( DXR3Config );
-}
-
-void HideDXR3Config( void )
-{
- if ( !DXR3Config ) return;
- gtk_widget_hide( DXR3Config );
- gtk_widget_destroy( DXR3Config );
- DXR3Config=NULL;
-}
-
-static void dxr3Button( GtkButton * button,gpointer user_data )
-{
- switch ( (int)user_data )
- {
- case 0: // Ok
- gfree( (void **)&gtkDXR3Device ); gtkDXR3Device=strdup( gtk_entry_get_text( GTK_ENTRY( CEDXR3Device ) ) );
-#ifdef CONFIG_LIBAVCODEC
- gtkVfLAVC=gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( RBVLavc ) );
-#endif
- case 1: // Cancel
- HideDXR3Config();
- break;
- }
-}
-
-GtkWidget * create_DXR3Config( void )
-{
- GtkWidget * vbox1;
- GtkWidget * vbox2;
- GtkWidget * hbox1;
- GList * CBDevice_items = NULL;
- GtkWidget * vbox3;
- GSList * VEncoder_group = NULL;
- GtkWidget * hbuttonbox1;
- GtkAccelGroup * accel_group;
-
- accel_group=gtk_accel_group_new();
-
- DXR3Config=gtk_window_new( GTK_WINDOW_TOPLEVEL );
- gtk_widget_set_name( DXR3Config,"DXR3Config" );
- gtk_object_set_data( GTK_OBJECT( DXR3Config ),"DXR3Config",DXR3Config );
-// gtk_widget_set_usize( DXR3Config,300,156 );
- GTK_WIDGET_SET_FLAGS( DXR3Config,GTK_CAN_DEFAULT );
- gtk_window_set_title( GTK_WINDOW( DXR3Config ),"DXR3/H+" );
- gtk_window_set_position( GTK_WINDOW( DXR3Config ),GTK_WIN_POS_CENTER );
- gtk_window_set_policy( GTK_WINDOW( DXR3Config ),FALSE,FALSE,FALSE );
- gtk_window_set_wmclass( GTK_WINDOW( DXR3Config ),"DXR3","MPlayer" );
-
- gtk_widget_realize( DXR3Config );
- gtkAddIcon( DXR3Config );
-
- vbox1=AddVBox( AddDialogFrame( DXR3Config ),0 );
- vbox2=AddVBox( vbox1,0 );
- hbox1=AddHBox( vbox2,1 );
- AddLabel( MSGTR_PREFERENCES_Audio_Device,hbox1 );
-
- CBDevice=AddComboBox( hbox1 );
-
- CBDevice_items=g_list_append( CBDevice_items,( gpointer ) "/dev/em8300" );
- CBDevice_items=g_list_append( CBDevice_items,( gpointer ) "/dev/em8300-0" );
- CBDevice_items=g_list_append( CBDevice_items,( gpointer ) "/dev/em8300-1" );
- CBDevice_items=g_list_append( CBDevice_items,( gpointer ) "/dev/em8300-2" );
- CBDevice_items=g_list_append( CBDevice_items,( gpointer ) "/dev/em8300-3" );
- gtk_combo_set_popdown_strings( GTK_COMBO( CBDevice ),CBDevice_items );
- g_list_free( CBDevice_items );
-
- CEDXR3Device=GTK_COMBO( CBDevice )->entry;
- gtk_widget_set_name( CEDXR3Device,"CEDXR3Device" );
- gtk_widget_show( CEDXR3Device );
- gtk_entry_set_text( GTK_ENTRY( CEDXR3Device ),"/dev/em8300" );
-
-#ifdef CONFIG_LIBAVCODEC
- AddHSeparator( vbox2 );
- vbox3=AddVBox( vbox2,0 );
- AddLabel( MSGTR_PREFERENCES_DXR3_VENC,vbox3 );
- RBVNone=AddRadioButton( MSGTR_PREFERENCES_None,&VEncoder_group,vbox3 );
- RBVLavc=AddRadioButton( MSGTR_PREFERENCES_DXR3_LAVC,&VEncoder_group,vbox3 );
-#endif
-
- AddHSeparator( vbox1 );
-
- hbuttonbox1=AddHButtonBox( vbox1 );
- gtk_button_box_set_layout( GTK_BUTTON_BOX( hbuttonbox1 ),GTK_BUTTONBOX_END );
- gtk_button_box_set_spacing( GTK_BUTTON_BOX( hbuttonbox1 ),10 );
- dxr3BOk=AddButton( MSGTR_Ok,hbuttonbox1 );
- dxr3BCancel=AddButton( MSGTR_Cancel,hbuttonbox1 );
-
- gtk_widget_add_accelerator( dxr3BOk,"clicked",accel_group,GDK_Return,0,GTK_ACCEL_VISIBLE );
- gtk_widget_add_accelerator( dxr3BCancel,"clicked",accel_group,GDK_Escape,0,GTK_ACCEL_VISIBLE );
-
- gtk_signal_connect( GTK_OBJECT( DXR3Config ),"destroy",GTK_SIGNAL_FUNC( WidgetDestroy ),&DXR3Config );
-
- gtk_signal_connect( GTK_OBJECT( dxr3BOk ),"clicked",GTK_SIGNAL_FUNC( dxr3Button ),(void *)0 );
- gtk_signal_connect( GTK_OBJECT( dxr3BCancel ),"clicked",GTK_SIGNAL_FUNC( dxr3Button ),(void *)1 );
-
- gtk_window_add_accel_group( GTK_WINDOW( DXR3Config ),accel_group );
-
- return DXR3Config;
-}
-
-#endif
diff --git a/gui/mplayer/gtk/opts.h b/gui/mplayer/gtk/opts.h
deleted file mode 100644
index b503c4811b..0000000000
--- a/gui/mplayer/gtk/opts.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * 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_GUI_OPTS_H
-#define MPLAYER_GUI_OPTS_H
-
-#include <gtk/gtk.h>
-
-extern GtkWidget * AudioConfig;
-extern GtkWidget * Preferences;
-extern GtkWidget * prEFontName;
-
-GtkWidget * create_Preferences( void );
-GtkWidget * create_AudioConfig( void );
-
-void ShowPreferences( void );
-
-#endif /* MPLAYER_GUI_OPTS_H */
diff --git a/gui/mplayer/gtk/pl.c b/gui/mplayer/gtk/pl.c
deleted file mode 100644
index 2dade2bbc3..0000000000
--- a/gui/mplayer/gtk/pl.c
+++ /dev/null
@@ -1,546 +0,0 @@
-/*
- * 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.
- */
-
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <string.h>
-#include <dirent.h>
-#include <unistd.h>
-#include <stdio.h>
-#include <stdlib.h>
-
-#include <gdk/gdkkeysyms.h>
-#include <gtk/gtk.h>
-
-#include "config.h"
-#include "help_mp.h"
-#include "stream/stream.h"
-
-#include "gui/interface.h"
-#include "gui/mplayer/widgets.h"
-#include "pl.h"
-#include "gtk_common.h"
-
-static char * book_open_xpm[] = {
- "16 16 4 1",
- " c None s None",
- ". c black",
- "X c #808080",
- "o c white",
- " ",
- " .. ",
- " .Xo. ... ",
- " .Xoo. ..oo. ",
- " .Xooo.Xooo... ",
- " .Xooo.oooo.X. ",
- " .Xooo.Xooo.X. ",
- " .Xooo.oooo.X. ",
- " .Xooo.Xooo.X. ",
- " .Xooo.oooo.X. ",
- " .Xoo.Xoo..X. ",
- " .Xo.o..ooX. ",
- " .X..XXXXX. ",
- " ..X....... ",
- " .. ",
- " "};
-
-static char * book_closed_xpm[] = {
- "16 16 6 1",
- " c None s None",
- ". c black",
- "X c blue",
- "o c yellow",
- "O c #007FEA",
- "# c white",
- " ",
- " .. ",
- " ..XX. ",
- " ..XXXXX. ",
- " ..XXXXXXXX. ",
- ".ooXXXXXXXXX. ",
- "..ooXXXXXXXXX. ",
- ".X.ooXXXXXXXXX. ",
- ".XX.ooXXXXXX.. ",
- " .XX.ooXXX..#O ",
- " .XX.oo..##OO. ",
- " .XX..##OO.. ",
- " .X.#OO.. ",
- " ..O.. ",
- " .. ",
- " "};
-
- GtkWidget * PlayList = NULL;
-static GtkWidget * CTDirTree;
-static GtkWidget * CLFiles;
-static GtkWidget * CLSelected;
-static GtkWidget * Add;
-static GtkWidget * Remove;
-static GtkWidget * Ok;
-static GtkWidget * Cancel;
-static GdkPixmap * pxOpenedBook;
-static GdkPixmap * pxClosedBook;
-static GdkBitmap * msOpenedBook;
-static GdkBitmap * msClosedBook;
-
-static int NrOfEntrys = 0;
-static int NrOfSelected = 0;
-static int * CLFileSelected = NULL;
-static int * CLListSelected = NULL;
-
-static int sigSel;
-static int sigUnsel;
-
-typedef struct
-{
- int scaned;
- char * path;
-} DirNodeType;
-
-static GtkCTreeNode * sibling;
-static GtkCTreeNode * parent;
-static gchar * current_path;
-static gchar * old_path = NULL;
-
-static int compare_func(const void *a, const void *b)
-{
- char * tmp;
- int i;
- if ( !a || !b || !( (DirNodeType *)a )->path ) return -1;
- tmp=strdup( (char *)b ); tmp[strlen( tmp )-1]=0;
- i=strcmp( ( (DirNodeType *)a )->path,tmp );
- free( tmp );
- return i;
-}
-
-static void scan_dir( char * path );
-
-void ShowPlayList( void )
-{
- if ( PlayList ) gtkActive( PlayList );
- else PlayList=create_PlayList();
-
- if ( old_path && *old_path )
- {
- char * currentdir = strdup( old_path );
- char * tpath,* pos;
- GtkCTreeNode * node,* nextnode;
- gboolean leaf;
- tpath=strdup( "/" );
- pos=strtok( currentdir,"/" );
- node=gtk_ctree_find_by_row_data_custom( GTK_CTREE( CTDirTree ),NULL,"/",compare_func );
- do
- {
- char * tpathnew = g_strconcat( tpath,pos,"/",NULL );
- free( tpath ); tpath=tpathnew;
- nextnode=gtk_ctree_find_by_row_data_custom( GTK_CTREE( CTDirTree ),node,tpath,compare_func );
- if ( !nextnode ) break;
- node=nextnode;
- pos=strtok( NULL,"/" );
- gtk_ctree_get_node_info( GTK_CTREE( CTDirTree ),node,NULL,NULL,NULL,NULL,NULL,NULL,&leaf,NULL );
- if ( !leaf && pos ) gtk_ctree_expand( GTK_CTREE( CTDirTree ),node );
- else
- {
- DirNodeType * DirNode;
- gtk_ctree_select( GTK_CTREE( CTDirTree ),node );
- DirNode=gtk_ctree_node_get_row_data( GTK_CTREE( CTDirTree ),node );
- current_path=DirNode->path;
- scan_dir( DirNode->path );
- if ( CLFileSelected ) free( CLFileSelected ); CLFileSelected=calloc( 1,NrOfEntrys * sizeof( int ) );
- break;
- }
- } while( pos );
- free( tpath );
- free( currentdir );
- }
- else gtk_ctree_select( GTK_CTREE( CTDirTree ),parent );
-
- gtk_clist_freeze( GTK_CLIST( CLSelected ) );
- gtk_clist_clear( GTK_CLIST( CLSelected ) );
- if ( plList )
- {
- plItem * next = plList;
- while ( next || next->next )
- {
- char * text[1][3]; text[0][2]="";
- text[0][0]=next->name;
- text[0][1]=next->path;
- gtk_clist_append( GTK_CLIST( CLSelected ),text[0] );
- NrOfSelected++;
- if ( next->next ) next=next->next; else break;
- }
- CLListSelected=calloc( 1,NrOfSelected * sizeof( int ) );
- }
- gtk_clist_thaw( GTK_CLIST( CLSelected ) );
-
- gtk_widget_show( PlayList );
-}
-
-void HidePlayList( void )
-{
- if ( !PlayList ) return;
- NrOfSelected=NrOfEntrys=0;
- gfree( (void **)&CLListSelected ); gfree( (void **)&CLFileSelected );
- if ( old_path ) free( old_path ); old_path=strdup( current_path );
- gtk_widget_hide( PlayList );
- gtk_widget_destroy( PlayList );
- PlayList=NULL;
-}
-
-static void plRowSelect( GtkCList * clist,gint row,gint column,GdkEvent * event,gpointer user_data )
-{
- switch ( (int) user_data )
- {
- case 0: CLFileSelected[row]=1; break;
- case 1: CLListSelected[row]=1; break;
- }
-}
-
-static void plUnRowSelect( GtkCList * clist,gint row,gint column,GdkEvent * event,gpointer user_data )
-{
- switch ( (int) user_data )
- {
- case 0: CLFileSelected[row]=0; break;
- case 1: CLListSelected[row]=0; break;
- }
-}
-
-static void plButtonReleased( GtkButton * button,gpointer user_data )
-{
- switch ( (int) user_data )
- {
- case 1: // ok
- {
- int i;
- if ( plList ) gtkSet( gtkDelPl,0,NULL );
- for ( i=0;i<NrOfSelected;i++ )
- {
- plItem * item;
- char * text[3];
- item=calloc( 1,sizeof( plItem ) );
- gtk_clist_get_text( GTK_CLIST( CLSelected ),i,0,&text[0] );
- gtk_clist_get_text( GTK_CLIST( CLSelected ),i,1,&text[1] );
- item->name=strdup( text[0] );
- item->path=strdup( text[1] );
- gtkSet( gtkAddPlItem,0,(void*)item );
- }
- if ( plCurrent )
- {
- mplSetFileName( plCurrent->path,plCurrent->name,STREAMTYPE_FILE );
-// guiSetDF( guiIntfStruct.Filename,plCurrent->path,plCurrent->name );
-// guiIntfStruct.FilenameChanged=1;
-// guiIntfStruct.StreamType=STREAMTYPE_FILE;
- }
- }
- case 0: // cancel
- HidePlayList();
- break;
- case 2: // remove
- {
- int i; int j; int c=0;
-
- gtk_signal_handler_block( GTK_OBJECT( CLSelected ),sigSel );
- gtk_signal_handler_block( GTK_OBJECT( CLSelected ),sigUnsel );
-
- gtk_clist_freeze( GTK_CLIST( CLSelected ) );
- for ( i=0;i<NrOfSelected-c;i++ )
- if ( CLListSelected[i] )
- {
- gtk_clist_remove( GTK_CLIST( CLSelected ),i - c );
- c++;
- for ( j=i;j<NrOfSelected-c;j++ )
- CLListSelected[i] = CLListSelected[i+1];
- }
- NrOfSelected-=c;
- gtk_clist_thaw( GTK_CLIST( CLSelected ) );
-
- gtk_signal_handler_unblock( GTK_OBJECT( CLSelected ),sigSel );
- gtk_signal_handler_unblock( GTK_OBJECT( CLSelected ),sigUnsel );
-
- }
- break;
- case 3: // add
- {
- int i;
- char * itext[1][2];
- char * text[1][3]; text[0][2]="";
- gtk_clist_freeze( GTK_CLIST( CLSelected ) );
- for ( i=0;i<NrOfEntrys;i++ )
- {
- if ( CLFileSelected[i] )
- {
- gtk_clist_get_text( GTK_CLIST( CLFiles ),i,0,(char **)&itext );
- text[0][0]=itext[0][0]; text[0][1]=current_path;
- gtk_clist_append( GTK_CLIST( CLSelected ),text[0] );
- NrOfSelected++;
- CLListSelected=realloc( CLListSelected,NrOfSelected * sizeof( int ) );
- CLListSelected[NrOfSelected - 1]=0;
- }
- }
- gtk_clist_thaw( GTK_CLIST( CLSelected ) );
- }
- break;
- }
-}
-
-static int check_for_subdir( gchar * path )
-{
- DIR * dir;
- struct dirent * dirent;
- struct stat statbuf;
- gchar * npath;
-
- if ( (dir=opendir( path )) )
- {
- while ( (dirent=readdir( dir )) )
- {
- if ( dirent->d_name[0] != '.' )
- {
- npath=calloc( 1,strlen( path ) + strlen( dirent->d_name ) + 3 );
- sprintf( npath,"%s/%s",path,dirent->d_name );
- if ( stat( npath,&statbuf ) != -1 && S_ISDIR( statbuf.st_mode ) )
- { free( npath ); closedir( dir ); return 1; }
- free( npath );
- }
- }
- closedir( dir );
- }
- return 0;
-}
-
-static void plCTree( GtkCTree * ctree,GtkCTreeNode * parent_node,gpointer user_data )
-{
- GtkCTreeNode * node;
- DirNodeType * DirNode;
- gchar * text;
- gchar * dummy = "dummy";
- int subdir = 1;
- DIR * dir = NULL;
- struct dirent * dirent;
- gchar * path;
- struct stat statbuf;
-
- DirNode=gtk_ctree_node_get_row_data( ctree,parent_node );
- if ( !DirNode->scaned )
- {
- DirNode->scaned=1; current_path=DirNode->path;
- gtk_clist_freeze( GTK_CLIST( ctree ) );
- node=gtk_ctree_find_by_row_data( ctree,parent_node,NULL );
- gtk_ctree_remove_node( ctree,node );
-
- if ( (dir=opendir( DirNode->path ) ) )
- {
- while( (dirent=readdir( dir )) )
- {
- path=calloc( 1,strlen( DirNode->path ) + strlen( dirent->d_name ) + 2 );
- if ( !strcmp( current_path,"/" ) ) sprintf( path,"/%s",dirent->d_name );
- else sprintf( path,"%s/%s",current_path,dirent->d_name );
- text=dirent->d_name;
-
- if ( stat( path,&statbuf ) != -1 && S_ISDIR( statbuf.st_mode ) && dirent->d_name[0] != '.' )
- {
- DirNode=malloc( sizeof( DirNodeType ) ); DirNode->scaned=0; DirNode->path=strdup( path );
- subdir=check_for_subdir( path );
- node=gtk_ctree_insert_node( ctree,parent_node,NULL,&text,4,pxOpenedBook,msOpenedBook,pxClosedBook,msClosedBook,!subdir,FALSE );
- gtk_ctree_node_set_row_data_full( ctree,node,DirNode,NULL );
- if ( subdir ) node=gtk_ctree_insert_node( ctree,node,NULL,&dummy,4,NULL,NULL,NULL,NULL,FALSE,FALSE );
- }
- free( path ); path=NULL;
- }
- closedir( dir );
- }
-
- gtk_ctree_sort_node( ctree,parent_node );
- gtk_clist_thaw( GTK_CLIST( ctree ) );
- }
-}
-
-static void scan_dir( char * path )
-{
- DIR * dir = NULL;
- char * curr;
- struct dirent * dirent;
- struct stat statbuf;
- char * text[1][2]; text[0][1]="";
-
- gtk_clist_clear( GTK_CLIST( CLFiles ) );
- if ( (dir=opendir( path )) )
- {
- NrOfEntrys=0;
- while( (dirent=readdir( dir )) )
- {
- curr=calloc( 1,strlen( path ) + strlen( dirent->d_name ) + 3 ); sprintf( curr,"%s/%s",path,dirent->d_name );
- if ( stat( curr,&statbuf ) != -1 && ( S_ISREG( statbuf.st_mode ) || S_ISLNK( statbuf.st_mode ) ) )
- {
- text[0][0]=dirent->d_name;
- gtk_clist_append( GTK_CLIST( CLFiles ),text[0] );
- NrOfEntrys++;
- }
- free( curr );
- }
- closedir( dir );
- gtk_clist_sort( GTK_CLIST( CLFiles ) );
- }
-}
-
-static void plCTRow(GtkWidget * widget, gint row, gint column, GdkEventButton * bevent, gpointer data)
-{
- DirNodeType * DirNode;
- GtkCTreeNode * node;
- node=gtk_ctree_node_nth( GTK_CTREE( widget ),row );
- DirNode=gtk_ctree_node_get_row_data( GTK_CTREE( widget ),node );
- current_path=DirNode->path;
- gtk_ctree_expand( GTK_CTREE( widget ),node );
- scan_dir( DirNode->path );
- if ( CLFileSelected ) free( CLFileSelected ); CLFileSelected=calloc( 1,NrOfEntrys * sizeof( int ) );
-}
-
-GtkWidget * create_PlayList( void )
-{
- GtkWidget * vbox1;
- GtkWidget * hbox1;
- GtkWidget * scrolledwindow1;
- GtkWidget * vbox2;
- GtkWidget * scrolledwindow2;
- GtkWidget * scrolledwindow3;
- GtkWidget * hbuttonbox1;
- GtkAccelGroup * accel_group;
- GdkColor transparent = { 0,0,0,0 };
- gchar * root = "/";
- gchar * dummy = "dummy";
- DirNodeType * DirNode;
-
- accel_group=gtk_accel_group_new();
-
- PlayList=gtk_window_new( GTK_WINDOW_TOPLEVEL );
- gtk_object_set_data( GTK_OBJECT( PlayList ),"PlayList",PlayList );
- gtk_widget_set_usize( PlayList,512,384 );
- gtk_window_set_title( GTK_WINDOW( PlayList ),MSGTR_PlayList );
- gtk_window_set_position( GTK_WINDOW( PlayList ),GTK_WIN_POS_CENTER );
-// gtk_window_set_policy( GTK_WINDOW( PlayList ),FALSE,FALSE,FALSE );
- gtk_window_set_wmclass( GTK_WINDOW( PlayList ),"Playlist","MPlayer" );
-
- gtk_widget_realize( PlayList );
- gtkAddIcon( PlayList );
-
- vbox1=AddVBox( AddDialogFrame( PlayList ),0 );
- hbox1=AddHBox( NULL,1 );
- gtk_box_pack_start( GTK_BOX( vbox1 ),hbox1,TRUE,TRUE,0 );
-
- scrolledwindow1=gtk_scrolled_window_new( NULL,NULL );
- gtk_widget_show( scrolledwindow1 );
- gtk_container_add( GTK_CONTAINER(
- AddFrame( NULL,0,hbox1,1 ) ),scrolledwindow1 );
- gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW( scrolledwindow1 ),GTK_POLICY_AUTOMATIC,GTK_POLICY_AUTOMATIC );
-
- CTDirTree=gtk_ctree_new( 1,0 );
- gtk_signal_connect( GTK_OBJECT( CTDirTree ),"tree_expand",GTK_SIGNAL_FUNC( plCTree ),(void*)0 );
- gtk_signal_connect( GTK_OBJECT( CTDirTree ),"select_row",GTK_SIGNAL_FUNC( plCTRow ),(void *)0 );
- gtk_container_add( GTK_CONTAINER( scrolledwindow1 ),CTDirTree );
- gtk_clist_set_column_auto_resize( GTK_CLIST( CTDirTree ),0,TRUE );
- gtk_clist_set_column_width( GTK_CLIST( CTDirTree ),0,80 );
- gtk_clist_set_selection_mode( GTK_CLIST( CTDirTree ),GTK_SELECTION_SINGLE );
- gtk_ctree_set_line_style( GTK_CTREE( CTDirTree ),GTK_CTREE_LINES_SOLID );
- gtk_clist_column_titles_show( GTK_CLIST( CTDirTree ) );
- gtk_clist_set_shadow_type( GTK_CLIST( CTDirTree ),GTK_SHADOW_NONE );
-
- if ( !pxOpenedBook ) pxOpenedBook=gdk_pixmap_create_from_xpm_d( PlayList->window,&msOpenedBook,&transparent,book_closed_xpm );
- if ( !pxClosedBook ) pxClosedBook=gdk_pixmap_create_from_xpm_d( PlayList->window,&msClosedBook,&transparent,book_open_xpm );
-
- parent=gtk_ctree_insert_node( GTK_CTREE( CTDirTree ),NULL,NULL,&root,4,pxOpenedBook,msOpenedBook,pxClosedBook,msClosedBook,FALSE,FALSE );
- DirNode=malloc( sizeof( DirNodeType ) );
- DirNode->scaned=0; DirNode->path=strdup( root );
- gtk_ctree_node_set_row_data_full(GTK_CTREE( CTDirTree ),parent,DirNode,NULL );
- sibling=gtk_ctree_insert_node( GTK_CTREE( CTDirTree ),parent,NULL,&dummy,4,NULL,NULL,NULL,NULL,TRUE,TRUE );
- gtk_ctree_expand( GTK_CTREE( CTDirTree ),parent );
- gtk_widget_show( CTDirTree );
-
-
- gtk_clist_set_column_widget( GTK_CLIST( CTDirTree ),0,
- AddLabel( MSGTR_PLAYLIST_DirectoryTree,NULL ) );
-
- vbox2=AddVBox(
- AddFrame( NULL,1,hbox1,1 ),0 );
-
- scrolledwindow2=gtk_scrolled_window_new( NULL,NULL );
- gtk_widget_show( scrolledwindow2 );
- gtk_box_pack_start( GTK_BOX( vbox2 ),scrolledwindow2,TRUE,TRUE,0 );
- gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW( scrolledwindow2 ),GTK_POLICY_AUTOMATIC,GTK_POLICY_AUTOMATIC );
-
- CLFiles=gtk_clist_new( 1 );
- gtk_widget_show( CLFiles );
- gtk_container_add( GTK_CONTAINER( scrolledwindow2 ),CLFiles );
- gtk_clist_set_column_width( GTK_CLIST( CLFiles ),0,80 );
- gtk_clist_set_selection_mode( GTK_CLIST( CLFiles ),GTK_SELECTION_EXTENDED );
- gtk_clist_column_titles_show( GTK_CLIST( CLFiles ) );
- gtk_clist_set_shadow_type( GTK_CLIST( CLFiles ),GTK_SHADOW_NONE );
-
- gtk_clist_set_column_widget( GTK_CLIST( CLFiles ),0,
- AddLabel( MSGTR_PLAYLIST_Files,NULL ) );
-
- AddHSeparator( vbox2 );
-
- scrolledwindow3=gtk_scrolled_window_new( NULL,NULL );
- gtk_widget_show( scrolledwindow3 );
- gtk_box_pack_start( GTK_BOX( vbox2 ),scrolledwindow3,TRUE,TRUE,0 );
- gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW( scrolledwindow3 ),GTK_POLICY_AUTOMATIC,GTK_POLICY_AUTOMATIC );
-
- CLSelected=gtk_clist_new( 2 );
- gtk_widget_show( CLSelected );
- gtk_container_add( GTK_CONTAINER( scrolledwindow3 ),CLSelected );
- gtk_clist_set_column_width( GTK_CLIST( CLSelected ),0,295 );
- gtk_clist_set_column_width( GTK_CLIST( CLSelected ),1,295 );
- gtk_clist_set_selection_mode( GTK_CLIST( CLSelected ),GTK_SELECTION_MULTIPLE );
- gtk_clist_column_titles_show( GTK_CLIST( CLSelected ) );
- gtk_clist_set_shadow_type( GTK_CLIST( CLSelected ),GTK_SHADOW_NONE );
-
- gtk_clist_set_column_widget( GTK_CLIST( CLSelected ),0,
- AddLabel( MSGTR_PLAYLIST_Selected,NULL ) );
-
- gtk_clist_set_column_widget( GTK_CLIST( CLSelected ),1,
- AddLabel( MSGTR_PLAYLIST_Path,NULL ) );
-
- AddHSeparator( vbox1 );
-
- hbuttonbox1=AddHButtonBox( vbox1 );
- gtk_button_box_set_layout( GTK_BUTTON_BOX( hbuttonbox1 ),GTK_BUTTONBOX_END );
- gtk_button_box_set_spacing( GTK_BUTTON_BOX( hbuttonbox1 ),10 );
-
- Add=AddButton( MSGTR_Add,hbuttonbox1 );
- Remove=AddButton( MSGTR_Remove,hbuttonbox1 );
- Ok=AddButton( MSGTR_Ok,hbuttonbox1 );
- Cancel=AddButton( MSGTR_Cancel,hbuttonbox1 );
-
- gtk_widget_add_accelerator( Cancel,"clicked",accel_group,GDK_Escape,0,GTK_ACCEL_VISIBLE );
-
- gtk_signal_connect( GTK_OBJECT( PlayList ),"destroy",GTK_SIGNAL_FUNC( WidgetDestroy ),&PlayList );
-
- gtk_signal_connect( GTK_OBJECT( CLFiles ),"select_row",GTK_SIGNAL_FUNC( plRowSelect ),(void *)0 );
- gtk_signal_connect( GTK_OBJECT( CLFiles ),"unselect_row",GTK_SIGNAL_FUNC( plUnRowSelect ),(void *)0 );
- sigSel=gtk_signal_connect( GTK_OBJECT( CLSelected ),"select_row",GTK_SIGNAL_FUNC( plRowSelect ),(void*)1 );
- sigUnsel=gtk_signal_connect( GTK_OBJECT( CLSelected ),"unselect_row",GTK_SIGNAL_FUNC( plUnRowSelect ),(void*)1 );
-
- gtk_signal_connect( GTK_OBJECT( Add ),"clicked",GTK_SIGNAL_FUNC( plButtonReleased ),(void*)3 );
- gtk_signal_connect( GTK_OBJECT( Remove ),"clicked",GTK_SIGNAL_FUNC( plButtonReleased ),(void*)2 );
- gtk_signal_connect( GTK_OBJECT( Ok ),"clicked",GTK_SIGNAL_FUNC( plButtonReleased ),(void*)1 );
- gtk_signal_connect( GTK_OBJECT( Cancel ),"clicked",GTK_SIGNAL_FUNC( plButtonReleased ),(void*)0 );
-
- gtk_window_add_accel_group( GTK_WINDOW( PlayList ),accel_group );
-
- return PlayList;
-}
-
diff --git a/gui/mplayer/gtk/pl.h b/gui/mplayer/gtk/pl.h
deleted file mode 100644
index 003c589847..0000000000
--- a/gui/mplayer/gtk/pl.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * 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_GUI_PL_H
-#define MPLAYER_GUI_PL_H
-
-#include <gtk/gtk.h>
-
-void ShowPlayList( void );
-void HidePlayList( void );
-
-GtkWidget * create_PlayList (void);
-
-#endif /* MPLAYER_GUI_PL_H */
diff --git a/gui/mplayer/gtk/sb.c b/gui/mplayer/gtk/sb.c
deleted file mode 100644
index 7b793a73b3..0000000000
--- a/gui/mplayer/gtk/sb.c
+++ /dev/null
@@ -1,211 +0,0 @@
-/*
- * 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.
- */
-
-#include <sys/stat.h>
-#include <glob.h>
-#include <unistd.h>
-#include <string.h>
-#include <stdlib.h>
-#include <stdio.h>
-
-#include "config.h"
-#include "sb.h"
-#include "gtk_common.h"
-
-#include "gui/app.h"
-#include "help_mp.h"
-
-#include "gui/mplayer/widgets.h"
-
-GtkWidget * SkinList = NULL;
-char * sbSelectedSkin=NULL;
-/* FIXME: Eventually remove the obsolete directory names. */
-char * sbMPlayerDirInHome=NULL;
-char * sbMPlayerDirInHome_obsolete=NULL;
-char * sbMPlayerPrefixDir=NULL;
-char * sbMPlayerPrefixDir_obsolete=NULL;
-
-char * gtkOldSkin=NULL;
-static char * prev=NULL;
-
-GtkWidget * SkinBrowser = NULL;
-
-void ShowSkinBrowser( void )
-{
- if ( SkinBrowser ) gtkActive( SkinBrowser );
- else SkinBrowser=create_SkinBrowser();
-}
-
-void HideSkinBrowser( void )
-{
- if ( !SkinBrowser ) return;
- gtk_widget_hide( SkinBrowser );
- gtk_widget_destroy( SkinBrowser );
- SkinBrowser=NULL;
-}
-
-int gtkFillSkinList( gchar * mdir )
-{
- gchar * str[2];
- gchar * tmp;
- int i;
- glob_t gg;
- struct stat fs;
-
- gtkOldSkin=strdup( skinName );
- prev=gtkOldSkin;
-
- str[0]="default";
- str[1]="";
- if ( gtkFindCList( SkinList,str[0] ) == -1 ) gtk_clist_append( GTK_CLIST( SkinList ),str );
-
- glob( mdir,GLOB_NOSORT,NULL,&gg );
- for( i=0;i<(int)gg.gl_pathc;i++ )
- {
- if ( !strcmp( gg.gl_pathv[i],"." ) || !strcmp( gg.gl_pathv[i],".." ) ) continue;
- stat( gg.gl_pathv[i],&fs );
- if ( S_ISDIR( fs.st_mode ) )
- {
- tmp=strrchr( gg.gl_pathv[i],'/' ); tmp++;
- if ( !strcmp( tmp,"default" ) ) continue;
- str[0]=tmp;
- if ( gtkFindCList( SkinList,str[0] ) == -1 ) gtk_clist_append( GTK_CLIST( SkinList ),str );
- }
- }
- globfree( &gg );
- return 1;
-}
-
-static void prButton( GtkObject * object,gpointer user_data )
-{
- if ( sbSelectedSkin )
- {
- switch ( (int)user_data )
- {
- case 0: // cancel
- if ( strcmp( sbSelectedSkin,gtkOldSkin ) ) ChangeSkin( gtkOldSkin );
- break;
- case 1: // ok
- ChangeSkin( sbSelectedSkin );
- if ( skinName ) free( skinName );
- skinName=strdup( sbSelectedSkin );
- break;
- }
- }
- HideSkinBrowser();
-}
-
-static void on_SkinList_select_row( GtkCList * clist,gint row,gint column,GdkEvent * bevent,gpointer user_data )
-{
- gtk_clist_get_text( clist,row,0,&sbSelectedSkin );
- if ( strcmp( prev,sbSelectedSkin ) )
- {
- prev=sbSelectedSkin;
- ChangeSkin( sbSelectedSkin );
- gtkActive( SkinBrowser );
- }
- if( !bevent ) return;
- if( bevent->type == GDK_2BUTTON_PRESS )
- {
- if ( skinName ) free( skinName );
- skinName=strdup( sbSelectedSkin );
- HideSkinBrowser();
- }
-}
-
-GtkWidget * create_SkinBrowser( void )
-{
- GtkWidget * vbox5;
- GtkWidget * scrolledwindow1;
- GtkWidget * hbuttonbox4;
- GtkWidget * Cancel;
- GtkWidget * Ok;
- GtkAccelGroup * accel_group;
-
- accel_group = gtk_accel_group_new ();
-
- SkinBrowser=gtk_window_new( GTK_WINDOW_TOPLEVEL );
- gtk_widget_set_name( SkinBrowser,MSGTR_SkinBrowser );
- gtk_object_set_data( GTK_OBJECT( SkinBrowser ),MSGTR_SkinBrowser,SkinBrowser );
- gtk_widget_set_usize( SkinBrowser,256,320 );
- gtk_container_set_border_width( GTK_CONTAINER( SkinBrowser ),1 );
- GTK_WIDGET_SET_FLAGS( SkinBrowser,GTK_CAN_DEFAULT );
- gtk_widget_set_events( SkinBrowser,GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK | GDK_FOCUS_CHANGE_MASK | GDK_STRUCTURE_MASK | GDK_PROPERTY_CHANGE_MASK | GDK_VISIBILITY_NOTIFY_MASK );
- gtk_window_set_title( GTK_WINDOW( SkinBrowser ),MSGTR_SkinBrowser );
- gtk_window_set_position( GTK_WINDOW( SkinBrowser ),GTK_WIN_POS_CENTER );
- gtk_window_set_policy( GTK_WINDOW( SkinBrowser ),FALSE,FALSE,TRUE );
- gtk_window_set_wmclass( GTK_WINDOW( SkinBrowser ),"SkinBrowser","MPlayer" );
-
- gtk_widget_realize( SkinBrowser );
- gtkAddIcon( SkinBrowser );
-
- vbox5=AddVBox( AddDialogFrame( SkinBrowser ),0 );
- AddLabel( MSGTR_SKIN_LABEL,vbox5 );
- AddHSeparator( vbox5 );
-
- scrolledwindow1=gtk_scrolled_window_new( NULL,NULL );
- gtk_widget_set_name( scrolledwindow1,"scrolledwindow1" );
- gtk_widget_ref( scrolledwindow1 );
- gtk_object_set_data_full( GTK_OBJECT( SkinBrowser ),"scrolledwindow1",scrolledwindow1,(GtkDestroyNotify)gtk_widget_unref );
- gtk_widget_show( scrolledwindow1 );
- gtk_box_pack_start( GTK_BOX( vbox5 ),scrolledwindow1,TRUE,TRUE,0 );
- gtk_container_set_border_width( GTK_CONTAINER( scrolledwindow1 ),2 );
- gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW( scrolledwindow1 ),GTK_POLICY_NEVER,GTK_POLICY_AUTOMATIC );
-
- SkinList=gtk_clist_new( 1 );
- gtk_widget_set_name( SkinList,"SkinList" );
- gtk_widget_ref( SkinList );
- gtk_object_set_data_full( GTK_OBJECT( SkinBrowser ),"SkinList",SkinList,(GtkDestroyNotify)gtk_widget_unref );
- gtk_widget_show( SkinList );
- gtk_container_add( GTK_CONTAINER( scrolledwindow1 ),SkinList );
- gtk_clist_set_column_width( GTK_CLIST( SkinList ),0,80 );
- gtk_clist_set_selection_mode( GTK_CLIST( SkinList ),GTK_SELECTION_SINGLE );
- gtk_clist_column_titles_hide( GTK_CLIST( SkinList ) );
- gtk_clist_set_shadow_type( GTK_CLIST( SkinList ),GTK_SHADOW_ETCHED_OUT );
-
- AddHSeparator( vbox5 );
-
- hbuttonbox4=AddHButtonBox( vbox5 );
- gtk_button_box_set_layout( GTK_BUTTON_BOX( hbuttonbox4 ),GTK_BUTTONBOX_SPREAD );
- gtk_button_box_set_spacing( GTK_BUTTON_BOX( hbuttonbox4 ),10 );
-
- Ok=AddButton( MSGTR_Ok,hbuttonbox4 );
- Cancel=AddButton( MSGTR_Cancel,hbuttonbox4 );
-
- gtk_widget_add_accelerator( Ok,"clicked",accel_group,GDK_Return,0,GTK_ACCEL_VISIBLE );
- gtk_widget_add_accelerator( Cancel,"clicked",accel_group,GDK_Escape,0,GTK_ACCEL_VISIBLE );
-
- gtk_signal_connect( GTK_OBJECT( SkinBrowser ),"destroy",GTK_SIGNAL_FUNC( WidgetDestroy ),&SkinBrowser );
- gtk_signal_connect( GTK_OBJECT( SkinList ),"select_row",GTK_SIGNAL_FUNC( on_SkinList_select_row ),NULL );
- gtk_signal_connect( GTK_OBJECT( Ok ),"clicked",GTK_SIGNAL_FUNC( prButton ),(void *)1 );
- gtk_signal_connect( GTK_OBJECT( Cancel ),"clicked",GTK_SIGNAL_FUNC( prButton ),(void *)0 );
-
- if ( ( sbMPlayerDirInHome_obsolete=calloc( 1,strlen( skinDirInHome_obsolete ) + 4 ) ) != NULL )
- { strcpy( sbMPlayerDirInHome_obsolete,skinDirInHome_obsolete ); strcat( sbMPlayerDirInHome_obsolete,"/*" ); }
- if ( ( sbMPlayerDirInHome=calloc( 1,strlen( skinDirInHome ) + 4 ) ) != NULL )
- { strcpy( sbMPlayerDirInHome,skinDirInHome ); strcat( sbMPlayerDirInHome,"/*" ); }
- if ( ( sbMPlayerPrefixDir_obsolete=calloc( 1,strlen( skinMPlayerDir ) + 4 ) ) != NULL )
- { strcpy( sbMPlayerPrefixDir_obsolete,skinMPlayerDir ); strcat( sbMPlayerPrefixDir_obsolete,"/*" ); }
- if ( ( sbMPlayerPrefixDir=calloc( 1,strlen( skinMPlayerDir ) + 4 ) ) != NULL )
- { strcpy( sbMPlayerPrefixDir,skinMPlayerDir ); strcat( sbMPlayerPrefixDir,"/*" ); }
-
- gtk_window_add_accel_group( GTK_WINDOW( SkinBrowser ),accel_group );
- gtk_widget_grab_focus( SkinList );
-
- return SkinBrowser;
-}
diff --git a/gui/mplayer/gtk/sb.h b/gui/mplayer/gtk/sb.h
deleted file mode 100644
index b9f37a8c48..0000000000
--- a/gui/mplayer/gtk/sb.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * 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_GUI_SB_H
-#define MPLAYER_GUI_SB_H
-
-#include <gtk/gtk.h>
-
-extern char * sbSelectedSkin;
-extern GtkWidget * SkinBrowser;
-
-void ShowSkinBrowser( void );
-GtkWidget * create_SkinBrowser( void );
-
-#endif /* MPLAYER_GUI_SB_H */
diff --git a/gui/mplayer/gui_common.c b/gui/mplayer/gui_common.c
deleted file mode 100644
index 646b76929b..0000000000
--- a/gui/mplayer/gui_common.c
+++ /dev/null
@@ -1,308 +0,0 @@
-/*
- * main window
- *
- * 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.
- */
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <inttypes.h>
-#include <sys/stat.h>
-#include <unistd.h>
-#include <string.h>
-
-#include "gui/app.h"
-#include "gui/skin/font.h"
-#include "gui/skin/skin.h"
-#include "gui/wm/ws.h"
-
-#include "config.h"
-#include "help_mp.h"
-#include "libvo/x11_common.h"
-
-#include "stream/stream.h"
-#include "mixer.h"
-#include "libvo/sub.h"
-
-#include "libmpdemux/demuxer.h"
-#include "libmpdemux/stheader.h"
-#include "codec-cfg.h"
-#include "access_mpcontext.h"
-#include "libavutil/avstring.h"
-
-
-#include "play.h"
-#include "widgets.h"
-
-unsigned int GetTimerMS( void );
-
-static inline void TranslateFilename( int c,char * tmp,size_t tmplen )
-{
- int i;
- char * p;
-
- switch ( guiIntfStruct.StreamType )
- {
- case STREAMTYPE_STREAM:
- av_strlcpy(tmp, guiIntfStruct.Filename, tmplen);
- break;
- case STREAMTYPE_FILE:
- if ( ( guiIntfStruct.Filename )&&( guiIntfStruct.Filename[0] ) )
- {
- if ( (p = strrchr(guiIntfStruct.Filename, '/')) )
- av_strlcpy(tmp, p + 1, tmplen);
- else
- av_strlcpy(tmp, guiIntfStruct.Filename, tmplen);
- if ( tmp[strlen( tmp ) - 4] == '.' ) tmp[strlen( tmp ) - 4]=0;
- if ( tmp[strlen( tmp ) - 5] == '.' ) tmp[strlen( tmp ) - 5]=0;
- } else av_strlcpy( tmp,MSGTR_NoFileLoaded,tmplen );
- break;
-#ifdef CONFIG_DVDREAD
- case STREAMTYPE_DVD:
- if ( guiIntfStruct.DVD.current_chapter ) snprintf(tmp,tmplen,MSGTR_Chapter,guiIntfStruct.DVD.current_chapter );
- else av_strlcat( tmp,MSGTR_NoChapter,tmplen );
- break;
-#endif
-#ifdef CONFIG_VCD
- case STREAMTYPE_VCD:
- snprintf( tmp,tmplen,MSGTR_VCDTrack,guiIntfStruct.Track );
- break;
-#endif
- default: av_strlcpy( tmp,MSGTR_NoMediaOpened,tmplen );
- }
- if ( c )
- {
- for ( i=0;i < (int)strlen( tmp );i++ )
- {
- int t=0;
- if ( c == 1 ) { if ( ( tmp[i] >= 'A' )&&( tmp[i] <= 'Z' ) ) t=32; }
- if ( c == 2 ) { if ( ( tmp[i] >= 'a' )&&( tmp[i] <= 'z' ) ) t=-32; }
- tmp[i]=(char)( tmp[i] + t );
- }
- }
-}
-
-/* Unsafe! Pass only null-terminated strings as (char *)str. */
-char * Translate( char * str )
-{
- mixer_t *mixer = mpctx_get_mixer(guiIntfStruct.mpcontext);
- static char trbuf[512];
- char tmp[512];
- int i,c;
- int t;
- int strsize = 0;
- memset( trbuf,0,512 );
- memset( tmp,0,128 );
- strsize = strlen(str);
- for ( c=0,i=0;i < strsize;i++ )
- {
- if ( str[i] != '$' ) { trbuf[c++]=str[i]; trbuf[c]=0; }
- else
- {
- switch ( str[++i] )
- {
- case 't': snprintf( tmp,sizeof( tmp ),"%02d",guiIntfStruct.Track );
- av_strlcat( trbuf,tmp,sizeof( trbuf ) ); break;
- case 'o': TranslateFilename( 0,tmp,sizeof( tmp ) );
- av_strlcat( trbuf,tmp,sizeof( trbuf ) ); break;
- case 'f': TranslateFilename( 1,tmp,sizeof( tmp ) );
- av_strlcat( trbuf,tmp,sizeof( trbuf ) ); break;
- case 'F': TranslateFilename( 2,tmp,sizeof( tmp ) );
- av_strlcat( trbuf,tmp,sizeof( trbuf ) ); break;
- case '6': t=guiIntfStruct.LengthInSec; goto calclengthhhmmss;
- case '1': t=guiIntfStruct.TimeSec;
-calclengthhhmmss:
- snprintf( tmp,sizeof( tmp ),"%02d:%02d:%02d",t/3600,t/60%60,t%60 );
- av_strlcat( trbuf,tmp,sizeof( trbuf ) );
- break;
- case '7': t=guiIntfStruct.LengthInSec; goto calclengthmmmmss;
- case '2': t=guiIntfStruct.TimeSec;
-calclengthmmmmss:
- snprintf( tmp,sizeof( tmp ),"%04d:%02d",t/60,t%60 );
- av_strlcat( trbuf,tmp,sizeof( trbuf ) );
- break;
- case '3': snprintf( tmp,sizeof( tmp ),"%02d",guiIntfStruct.TimeSec / 3600 );
- av_strlcat( trbuf,tmp,sizeof( trbuf ) ); break;
- case '4': snprintf( tmp,sizeof( tmp ),"%02d",( ( guiIntfStruct.TimeSec / 60 ) % 60 ) );
- av_strlcat( trbuf,tmp,sizeof( trbuf ) ); break;
- case '5': snprintf( tmp,sizeof( tmp ),"%02d",guiIntfStruct.TimeSec % 60 );
- av_strlcat( trbuf,tmp,sizeof( trbuf ) ); break;
- case '8': snprintf( tmp,sizeof( tmp ),"%01d:%02d:%02d",guiIntfStruct.TimeSec / 3600,( guiIntfStruct.TimeSec / 60 ) % 60,guiIntfStruct.TimeSec % 60 ); av_strlcat( trbuf,tmp,sizeof( trbuf ) ); break;
- case 'v': snprintf( tmp,sizeof( tmp ),"%3.2f%%",guiIntfStruct.Volume );
- av_strlcat( trbuf,tmp,sizeof( trbuf ) ); break;
- case 'V': snprintf( tmp,sizeof( tmp ),"%3.1f",guiIntfStruct.Volume );
- av_strlcat( trbuf,tmp,sizeof( trbuf ) ); break;
- case 'b': snprintf( tmp,sizeof( tmp ),"%3.2f%%",guiIntfStruct.Balance );
- av_strlcat( trbuf,tmp,sizeof( trbuf ) ); break;
- case 'B': snprintf( tmp,sizeof( tmp ),"%3.1f",guiIntfStruct.Balance );
- av_strlcat( trbuf,tmp,sizeof( trbuf ) ); break;
- case 'd': snprintf( tmp,sizeof( tmp ),"%d",guiIntfStruct.FrameDrop );
- av_strlcat( trbuf,tmp,sizeof( trbuf ) ); break;
- case 'x': snprintf( tmp,sizeof( tmp ),"%d",guiIntfStruct.MovieWidth );
- av_strlcat( trbuf,tmp,sizeof( trbuf ) ); break;
- case 'y': snprintf( tmp,sizeof( tmp ),"%d",guiIntfStruct.MovieHeight );
- av_strlcat( trbuf,tmp,sizeof( trbuf ) ); break;
- case 'C': snprintf( tmp,sizeof( tmp ),"%s", guiIntfStruct.sh_video? ((sh_video_t *)guiIntfStruct.sh_video)->codec->name : "");
- av_strlcat( trbuf,tmp,sizeof( trbuf ) ); break;
- case 's': if ( guiIntfStruct.Playing == 0 ) av_strlcat( trbuf,"s",sizeof( trbuf ) ); break;
- case 'l': if ( guiIntfStruct.Playing == 1 ) av_strlcat( trbuf,"p",sizeof( trbuf ) ); break;
- case 'e': if ( guiIntfStruct.Playing == 2 ) av_strlcat( trbuf,"e",sizeof( trbuf ) ); break;
- case 'a':
- if ( mixer->muted ) { av_strlcat( trbuf,"n",sizeof( trbuf ) ); break; }
- switch ( guiIntfStruct.AudioType )
- {
- case 0: av_strlcat( trbuf,"n",sizeof( trbuf ) ); break;
- case 1: av_strlcat( trbuf,"m",sizeof( trbuf ) ); break;
- case 2: av_strlcat( trbuf,"t",sizeof( trbuf ) ); break;
- }
- break;
- case 'T':
- switch ( guiIntfStruct.StreamType )
- {
- case STREAMTYPE_FILE: av_strlcat( trbuf,"f",sizeof( trbuf ) ); break;
-#ifdef CONFIG_VCD
- case STREAMTYPE_VCD: av_strlcat( trbuf,"v",sizeof( trbuf ) ); break;
-#endif
- case STREAMTYPE_STREAM: av_strlcat( trbuf,"u",sizeof( trbuf ) ); break;
-#ifdef CONFIG_DVDREAD
- case STREAMTYPE_DVD: av_strlcat( trbuf,"d",sizeof( trbuf ) ); break;
-#endif
- default: av_strlcat( trbuf," ",sizeof( trbuf ) ); break;
- }
- break;
- case '$': av_strlcat( trbuf,"$",sizeof( trbuf ) ); break;
- default: continue;
- }
- c=strlen( trbuf );
- }
- }
- return trbuf;
-}
-
-static char * image_buffer = NULL;
-static int image_width = 0;
-
-void PutImage( txSample * bf,int x,int y,int max,int ofs )
-{
- int i=0,ix,iy;
- uint32_t * buf = NULL;
- uint32_t * drw = NULL;
- register uint32_t tmp;
- /* register uint32_t yc; */
-
- if ( ( !bf )||( bf->Image == NULL ) ) return;
-
- i=( bf->Width * ( bf->Height / max ) ) * ofs;
- buf=(uint32_t *)image_buffer;
- drw=(uint32_t *)bf->Image;
-
-#if 1
- for ( iy=y;iy < (int)(y+bf->Height / max);iy++ )
- for ( ix=x;ix < (int)(x+bf->Width);ix++ )
- {
- tmp=drw[i++];
- if ( tmp != 0x00ff00ff ) buf[iy * image_width + ix]=tmp;
- }
-#else
- yc=y * image_width;
- for ( iy=y;iy < (int)(y+bf->Height / max);iy++ )
- {
- for ( ix=x;ix < (int)(x+bf->Width);ix++ )
- {
- tmp=drw[i++];
- if ( tmp != 0x00ff00ff ) buf[yc + ix]=tmp;
- }
- yc+=image_width;
- }
-#endif
-}
-
-void SimplePotmeterPutImage( txSample * bf,int x,int y,float frac )
-{
- int i=0,w,r,ix,iy;
- uint32_t * buf = NULL;
- uint32_t * drw = NULL;
- register uint32_t tmp;
-
- if ( ( !bf )||( bf->Image == NULL ) ) return;
-
- buf=(uint32_t *)image_buffer;
- drw=(uint32_t *)bf->Image;
- w=bf->Width*frac;
- r=bf->Width-w;
- for ( iy=y;iy < (int)(y+bf->Height);iy++ )
- {
- for ( ix=x;ix < (int)(x+w);ix++ )
- {
- tmp=drw[i++];
- if ( tmp != 0x00ff00ff ) buf[iy * image_width + ix]=tmp;
- }
- i+=r;
- }
-}
-
-void Render( wsTWindow * window,wItem * Items,int nrItems,char * db,int size )
-{
- wItem * item;
- txSample * image = NULL;
- int i;
-
- image_buffer=db;
- image_width=window->Width;
-
- for( i=0;i < nrItems + 1;i++ )
- {
- item=&Items[i];
- switch( item->type )
- {
- case itButton:
- PutImage( &item->Bitmap,item->x,item->y,3,item->pressed );
- break;
- case itPotmeter:
- if (item->phases == 1)SimplePotmeterPutImage( &item->Bitmap,item->x,item->y, item->value / 100.0f );
- else PutImage( &item->Bitmap,item->x,item->y,item->phases,( item->phases - 1 ) * ( item->value / 100.0f ) );
- break;
- case itHPotmeter:
- if (item->phases == 1)SimplePotmeterPutImage( &item->Bitmap,item->x,item->y, item->value / 100.0f );
- else PutImage( &item->Bitmap,item->x,item->y,item->phases,( item->phases - 1 ) * ( item->value / 100.0f ) );
- PutImage( &item->Mask,item->x + (int)( ( item->width - item->psx ) * item->value / 100.0f ),item->y,3,item->pressed );
- break;
- case itVPotmeter:
- PutImage( &item->Bitmap,
- item->x,item->y,
- item->phases,
- item->phases * ( 1. - item->value / 100.0f ) );
- PutImage( &item->Mask,
- item->x,item->y + (int)( ( item->height - item->psy ) * ( 1. - item->value / 100.0f ) ),
- 3,item->pressed );
- break;
- case itSLabel:
- image=fntRender( item,0,"%s",item->label );
- if ( image ) PutImage( image,item->x,item->y,1,0 );
- case itDLabel:
- {
- char * t = Translate( item->label );
- int l = fntTextWidth( item->fontid,t );
- l=(l?l:item->width);
- image=fntRender( item,l-(GetTimerMS() / 20)%l,"%s",t );
- }
- if ( image ) PutImage( image,item->x,item->y,1,0 );
- break;
- }
- }
- wsConvert( window,db,size );
-}
diff --git a/gui/mplayer/gui_common.h b/gui/mplayer/gui_common.h
deleted file mode 100644
index d067d39618..0000000000
--- a/gui/mplayer/gui_common.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * 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_GUI_GUI_COMMON_H
-#define MPLAYER_GUI_GUI_COMMON_H
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <inttypes.h>
-#include <sys/stat.h>
-#include <unistd.h>
-
-#include "gui/app.h"
-#include "gui/bitmap.h"
-#include "gui/wm/ws.h"
-
-char * Translate( char * str );
-void PutImage( txSample * bf,int x, int y, int max, int ofs );
-void SimplePotmeterPutImage( txSample * bf, int x, int y, float frac );
-void Render( wsTWindow * window, wItem * Items, int nrItems, char * db, int size );
-
-#endif /* MPLAYER_GUI_GUI_COMMON_H */
diff --git a/gui/mplayer/menu.c b/gui/mplayer/menu.c
deleted file mode 100644
index 2c541cc733..0000000000
--- a/gui/mplayer/menu.c
+++ /dev/null
@@ -1,175 +0,0 @@
-/*
- * 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.
- */
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <inttypes.h>
-
-#include "config.h"
-#include "help_mp.h"
-#include "mp_msg.h"
-#include "gui/app.h"
-#include "gmplayer.h"
-
-#include "widgets.h"
-
-unsigned char * mplMenuDrawBuffer = NULL;
-int mplMenuRender = 1;
-int mplMenuItem = -1;
-int mplOldMenuItem = -1;
-int mplMenuX,mplMenuY;
-static int mplMenuIsInitialized = 0;
-
-void mplMenuDraw( void )
-{
- uint32_t * buf = NULL;
- uint32_t * drw = NULL;
- int x,y,tmp;
-
- if ( !appMPlayer.menuIsPresent || !appMPlayer.menuBase.Bitmap.Image ) return;
- if ( !mplMenuRender && !appMPlayer.menuWindow.Visible ) return;
-
- if ( mplMenuRender || mplMenuItem != mplOldMenuItem )
- {
- memcpy( mplMenuDrawBuffer,appMPlayer.menuBase.Bitmap.Image,appMPlayer.menuBase.Bitmap.ImageSize );
-// ---
- if ( mplMenuItem != -1 )
- {
- buf=(uint32_t *)mplMenuDrawBuffer;
- drw=(uint32_t *)appMPlayer.menuSelected.Bitmap.Image;
- for ( y=appMPlayer.MenuItems[ mplMenuItem ].y; y < appMPlayer.MenuItems[ mplMenuItem ].y + appMPlayer.MenuItems[ mplMenuItem ].height; y++ )
- for ( x=appMPlayer.MenuItems[ mplMenuItem ].x; x < appMPlayer.MenuItems[ mplMenuItem ].x + appMPlayer.MenuItems[ mplMenuItem ].width; x++ )
- {
- tmp=drw[ y * appMPlayer.menuSelected.width + x ];
- if ( tmp != 0x00ff00ff ) buf[ y * appMPlayer.menuBase.width + x ]=tmp;
- }
- }
- mplOldMenuItem=mplMenuItem;
-// ---
- wsConvert( &appMPlayer.menuWindow,mplMenuDrawBuffer,appMPlayer.menuBase.Bitmap.ImageSize );
- mplMenuRender=0;
- }
- wsPutImage( &appMPlayer.menuWindow );
-}
-
-void mplMenuMouseHandle( int X,int Y,int RX,int RY )
-{
- int x,y,i;
-
- if ( !appMPlayer.menuBase.Bitmap.Image ) return;
-
- mplMenuItem=-1;
- x=RX - appMPlayer.menuWindow.X;
- y=RY - appMPlayer.menuWindow.Y;
- if ( ( x < 0 ) || ( y < 0 ) || ( x > appMPlayer.menuBase.width ) || ( y > appMPlayer.menuBase.height ) )
- {
- wsPostRedisplay( &appMPlayer.menuWindow );
- return;
- }
-
- for( i=0;i<=appMPlayer.NumberOfMenuItems;i++ )
- {
- if ( wgIsRect( x,y,
- appMPlayer.MenuItems[i].x,appMPlayer.MenuItems[i].y,
- appMPlayer.MenuItems[i].x+appMPlayer.MenuItems[i].width,appMPlayer.MenuItems[i].y+appMPlayer.MenuItems[i].height ) ) { mplMenuItem=i; break; }
- }
- wsPostRedisplay( &appMPlayer.menuWindow );
-}
-
-void mplShowMenu( int mx,int my )
-{
- int x,y;
-
- if ( !appMPlayer.menuIsPresent || !appMPlayer.menuBase.Bitmap.Image ) return;
-
- x=mx;
- if ( x + appMPlayer.menuWindow.Width > wsMaxX ) x=wsMaxX - appMPlayer.menuWindow.Width - 1 + wsOrgX;
- y=my;
- if ( y + appMPlayer.menuWindow.Height > wsMaxY ) y=wsMaxY - appMPlayer.menuWindow.Height - 1 + wsOrgY;
-
- mplMenuX=x; mplMenuY=y;
-
- mplMenuItem = 0;
-
- wsMoveWindow( &appMPlayer.menuWindow,False,x,y );
- wsMoveTopWindow( wsDisplay,appMPlayer.menuWindow.WindowID );
- wsSetLayer( wsDisplay,appMPlayer.menuWindow.WindowID,1 );
- mplMenuRender=1;
- wsVisibleWindow( &appMPlayer.menuWindow,wsShowWindow );
- wsPostRedisplay( &appMPlayer.menuWindow );
-}
-
-void mplHideMenu( int mx,int my,int w )
-{
- int x,y,i=mplMenuItem;
-
- if ( !appMPlayer.menuIsPresent || !appMPlayer.menuBase.Bitmap.Image ) return;
-
- x=mx-mplMenuX;
- y=my-mplMenuY;
-// x=RX - appMPlayer.menuWindow.X;
-// y=RY - appMPlayer.menuWindow.Y;
-
- wsVisibleWindow( &appMPlayer.menuWindow,wsHideWindow );
-
- if ( ( x < 0 ) || ( y < 0 ) ) return;
-
-// printf( "---------> %d %d,%d\n",i,x,y );
-// printf( "--------> mi: %d,%d %dx%d\n",appMPlayer.MenuItems[i].x,appMPlayer.MenuItems[i].y,appMPlayer.MenuItems[i].width,appMPlayer.MenuItems[i].height );
- if ( wgIsRect( x,y,
- appMPlayer.MenuItems[i].x,appMPlayer.MenuItems[i].y,
- appMPlayer.MenuItems[i].x+appMPlayer.MenuItems[i].width,
- appMPlayer.MenuItems[i].y+appMPlayer.MenuItems[i].height ) )
- {
- mplEventHandling( appMPlayer.MenuItems[i].msg,(float)w );
- }
-}
-
-void mplMenuInit( void )
-{
-
- if ( mplMenuIsInitialized || !appMPlayer.menuIsPresent || !appMPlayer.menuBase.Bitmap.Image ) return;
-
- appMPlayer.menuBase.x=0;
- appMPlayer.menuBase.y=0;
-
- if ( ( mplMenuDrawBuffer = calloc( 1,appMPlayer.menuBase.Bitmap.ImageSize ) ) == NULL )
- {
-#ifdef DEBUG
- mp_msg( MSGT_GPLAYER,MSGL_DBG2,"[menu.h] %s",MSGTR_NEMFMR );
-#endif
- gtkMessageBox( GTK_MB_FATAL,MSGTR_NEMFMR );
- return;
- }
-
- wsCreateWindow( &appMPlayer.menuWindow,
- appMPlayer.menuBase.x,appMPlayer.menuBase.y,appMPlayer.menuBase.width,appMPlayer.menuBase.height,
- wsNoBorder,wsShowMouseCursor|wsHandleMouseButton|wsHandleMouseMove,wsOverredirect|wsHideFrame|wsMaxSize|wsMinSize|wsHideWindow,"MPlayer menu" );
-
- wsSetShape( &appMPlayer.menuWindow,appMPlayer.menuBase.Mask.Image );
-
-#ifdef DEBUG
- mp_msg( MSGT_GPLAYER,MSGL_DBG2,"[menu.h] menu: 0x%x\n",(int)appMPlayer.menuWindow.WindowID );
-#endif
-
- mplMenuIsInitialized=1;
- appMPlayer.menuWindow.ReDraw=mplMenuDraw;
-// appMPlayer.menuWindow.MouseHandler=mplMenuMouseHandle;
-// appMPlayer.menuWindow.KeyHandler=mplMainKeyHandle;
- mplMenuRender=1; wsPostRedisplay( &appMPlayer.menuWindow );
-}
diff --git a/gui/mplayer/mw.c b/gui/mplayer/mw.c
deleted file mode 100644
index 4e64af3a51..0000000000
--- a/gui/mplayer/mw.c
+++ /dev/null
@@ -1,636 +0,0 @@
-/*
- * main window
- *
- * 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.
- */
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <inttypes.h>
-#include <sys/stat.h>
-#include <unistd.h>
-#include <string.h>
-
-#include "config.h"
-#include "gmplayer.h"
-#include "gui/app.h"
-#include "gui/skin/font.h"
-#include "gui/skin/skin.h"
-#include "gui/wm/ws.h"
-
-#include "help_mp.h"
-#include "libvo/x11_common.h"
-#include "libvo/fastmemcpy.h"
-
-#include "stream/stream.h"
-#include "stream/url.h"
-#include "mixer.h"
-#include "libvo/sub.h"
-#include "access_mpcontext.h"
-
-#include "libmpdemux/demuxer.h"
-#include "libmpdemux/stheader.h"
-#include "codec-cfg.h"
-#include "m_option.h"
-#include "m_property.h"
-
-#define GUI_REDRAW_WAIT 375
-
-#include "play.h"
-#include "widgets.h"
-
-unsigned int GetTimerMS( void );
-
-unsigned char * mplDrawBuffer = NULL;
-int mplMainRender = 1;
-
-int mplMainAutoPlay = 0;
-int mplMiddleMenu = 0;
-
-int mainVisible = 1;
-
-int boxMoved = 0;
-int sx = 0,sy = 0;
-int i,pot = 0;
-
-#include "gui_common.h"
-
-void mplMainDraw( void )
-{
-
- if ( appMPlayer.mainWindow.State == wsWindowClosed ) exit_player( MSGTR_Exit_quit );
-
- if ( appMPlayer.mainWindow.Visible == wsWindowNotVisible ||
- !mainVisible ) return;
-// !appMPlayer.mainWindow.Mapped ) return;
-
- if ( mplMainRender && appMPlayer.mainWindow.State == wsWindowExpose )
- {
- btnModify( evSetMoviePosition,guiIntfStruct.Position );
- btnModify( evSetVolume,guiIntfStruct.Volume );
-
- fast_memcpy( mplDrawBuffer,appMPlayer.main.Bitmap.Image,appMPlayer.main.Bitmap.ImageSize );
- Render( &appMPlayer.mainWindow,appMPlayer.Items,appMPlayer.NumberOfItems,mplDrawBuffer,appMPlayer.main.Bitmap.ImageSize );
- mplMainRender=0;
- }
- wsPutImage( &appMPlayer.mainWindow );
-// XFlush( wsDisplay );
-}
-
-static unsigned last_redraw_time = 0;
-
-void mplEventHandling( int msg,float param )
-{
- int iparam = (int)param;
- mixer_t *mixer = mpctx_get_mixer(guiIntfStruct.mpcontext);
-
- switch( msg )
- {
-// --- user events
- case evExit:
- exit_player( "Exit" );
- break;
-
- case evPlayNetwork:
- gfree( (void **)&guiIntfStruct.Subtitlename );
- gfree( (void **)&guiIntfStruct.AudioFile );
- guiIntfStruct.StreamType=STREAMTYPE_STREAM;
- goto play;
- case evSetURL:
- gtkShow( evPlayNetwork,NULL );
- break;
-
- case evSetAudio:
- if ( !guiIntfStruct.demuxer || audio_id == iparam ) break;
- audio_id=iparam;
- goto play;
-
- case evSetVideo:
- if ( !guiIntfStruct.demuxer || video_id == iparam ) break;
- video_id=iparam;
- goto play;
-
- case evSetSubtitle:
- mp_property_do("sub",M_PROPERTY_SET,&iparam,guiIntfStruct.mpcontext);
- break;
-
-#ifdef CONFIG_VCD
- case evSetVCDTrack:
- guiIntfStruct.Track=iparam;
- case evPlayVCD:
- gtkSet( gtkClearStruct,0,(void *)guiALL );
- guiIntfStruct.StreamType=STREAMTYPE_VCD;
- goto play;
-#endif
-#ifdef CONFIG_DVDREAD
- case evPlayDVD:
- guiIntfStruct.DVD.current_title=1;
- guiIntfStruct.DVD.current_chapter=1;
- guiIntfStruct.DVD.current_angle=1;
-play_dvd_2:
- gtkSet( gtkClearStruct,0,(void *)(guiALL - guiDVD) );
- guiIntfStruct.StreamType=STREAMTYPE_DVD;
- goto play;
-#endif
- case evPlay:
- case evPlaySwitchToPause:
-play:
-
- if ( ( msg == evPlaySwitchToPause )&&( guiIntfStruct.Playing == 2 ) ) goto NoPause;
-
- if ( gtkSet( gtkGetCurrPlItem,0,NULL ) &&( guiIntfStruct.StreamType == STREAMTYPE_FILE ) )
- {
- plItem * next = gtkSet( gtkGetCurrPlItem,0,NULL );
- plLastPlayed=next;
- mplSetFileName( next->path,next->name,STREAMTYPE_FILE );
- }
-
- switch ( guiIntfStruct.StreamType )
- {
- case STREAMTYPE_STREAM:
- case STREAMTYPE_FILE:
- gtkSet( gtkClearStruct,0,(void *)(guiALL - guiFilenames) );
- break;
-#ifdef CONFIG_VCD
- case STREAMTYPE_VCD:
- gtkSet( gtkClearStruct,0,(void *)(guiALL - guiVCD - guiFilenames) );
- if ( !cdrom_device ) cdrom_device=gstrdup( DEFAULT_CDROM_DEVICE );
- mplSetFileName( NULL,cdrom_device,STREAMTYPE_VCD );
- if ( guiIntfStruct.Playing != 2 )
- {
- if ( !guiIntfStruct.Track )
- {
- if ( guiIntfStruct.VCDTracks > 1 ) guiIntfStruct.Track=2;
- else guiIntfStruct.Track=1;
- }
- guiIntfStruct.DiskChanged=1;
- }
- break;
-#endif
-#ifdef CONFIG_DVDREAD
- case STREAMTYPE_DVD:
- gtkSet( gtkClearStruct,0,(void *)(guiALL - guiDVD - guiFilenames) );
- if ( !dvd_device ) dvd_device=gstrdup( DEFAULT_DVD_DEVICE );
- mplSetFileName( NULL,dvd_device,STREAMTYPE_DVD );
- if ( guiIntfStruct.Playing != 2 )
- {
- guiIntfStruct.Title=guiIntfStruct.DVD.current_title;
- guiIntfStruct.Chapter=guiIntfStruct.DVD.current_chapter;
- guiIntfStruct.Angle=guiIntfStruct.DVD.current_angle;
- guiIntfStruct.DiskChanged=1;
- }
- break;
-#endif
- }
- guiIntfStruct.NewPlay=1;
- mplPlay();
- break;
-#ifdef CONFIG_DVDREAD
- case evSetDVDSubtitle:
- dvdsub_id=iparam;
- goto play_dvd_2;
- break;
- case evSetDVDAudio:
- audio_id=iparam;
- goto play_dvd_2;
- break;
- case evSetDVDChapter:
- guiIntfStruct.DVD.current_chapter=iparam;
- goto play_dvd_2;
- break;
- case evSetDVDTitle:
- guiIntfStruct.DVD.current_title=iparam;
- guiIntfStruct.DVD.current_chapter=1;
- guiIntfStruct.DVD.current_angle=1;
- goto play_dvd_2;
- break;
-#endif
-
- case evPause:
- case evPauseSwitchToPlay:
-NoPause:
- mplPause();
- break;
-
- case evStop:
- guiIntfStruct.Playing=guiSetStop;
- mplState();
- guiIntfStruct.NoWindow=False;
- break;
-
- case evLoadPlay:
- mplMainAutoPlay=1;
-// guiIntfStruct.StreamType=STREAMTYPE_FILE;
- case evLoad:
- gtkSet( gtkDelPl,0,NULL );
- gtkShow( evLoad,NULL );
- break;
- case evLoadSubtitle: gtkShow( evLoadSubtitle,NULL ); break;
- case evDropSubtitle:
- gfree( (void **)&guiIntfStruct.Subtitlename );
- guiLoadSubtitle( NULL );
- break;
- case evLoadAudioFile: gtkShow( evLoadAudioFile,NULL ); break;
- case evPrev: mplPrev(); break;
- case evNext: mplNext(); break;
-
- case evPlayList: gtkShow( evPlayList,NULL ); break;
- case evSkinBrowser: gtkShow( evSkinBrowser,skinName ); break;
- case evAbout: gtkShow( evAbout,NULL ); break;
- case evPreferences: gtkShow( evPreferences,NULL ); break;
- case evEqualizer: gtkShow( evEqualizer,NULL ); break;
-
- case evForward10min: mplRelSeek( 600 ); break;
- case evBackward10min: mplRelSeek( -600 );break;
- case evForward1min: mplRelSeek( 60 ); break;
- case evBackward1min: mplRelSeek( -60 ); break;
- case evForward10sec: mplRelSeek( 10 ); break;
- case evBackward10sec: mplRelSeek( -10 ); break;
- case evSetMoviePosition: mplAbsSeek( param ); break;
-
- case evIncVolume: vo_x11_putkey( wsGrayMul ); break;
- case evDecVolume: vo_x11_putkey( wsGrayDiv ); break;
- case evMute: mixer_mute( mixer ); break;
-
- case evSetVolume:
- guiIntfStruct.Volume=param;
- goto set_volume;
- case evSetBalance:
- guiIntfStruct.Balance=param;
-set_volume:
- {
- float l = guiIntfStruct.Volume * ( ( 100.0 - guiIntfStruct.Balance ) / 50.0 );
- float r = guiIntfStruct.Volume * ( ( guiIntfStruct.Balance ) / 50.0 );
- if ( l > guiIntfStruct.Volume ) l=guiIntfStruct.Volume;
- if ( r > guiIntfStruct.Volume ) r=guiIntfStruct.Volume;
-// printf( "!!! v: %.2f b: %.2f -> %.2f x %.2f\n",guiIntfStruct.Volume,guiIntfStruct.Balance,l,r );
- mixer_setvolume( mixer,l,r );
- }
- if ( osd_level )
- {
- osd_visible=(GetTimerMS() + 1000) | 1;
- vo_osd_progbar_type=OSD_VOLUME;
- vo_osd_progbar_value=( ( guiIntfStruct.Volume ) * 256.0 ) / 100.0;
- vo_osd_changed( OSDTYPE_PROGBAR );
- }
- break;
-
-
- case evIconify:
- switch ( iparam )
- {
- case 0: wsIconify( appMPlayer.mainWindow ); break;
- case 1: wsIconify( appMPlayer.subWindow ); break;
- }
- break;
- case evHalfSize:
- btnSet( evFullScreen,btnReleased );
- if ( guiIntfStruct.Playing )
- {
- if ( appMPlayer.subWindow.isFullScreen )
- {
- mplFullScreen();
- }
- wsResizeWindow( &appMPlayer.subWindow, guiIntfStruct.MovieWidth / 2, guiIntfStruct.MovieHeight / 2 );
- wsMoveWindow( &appMPlayer.subWindow, 0,
- ( wsMaxX - guiIntfStruct.MovieWidth/2 )/2 + wsOrgX,
- ( wsMaxY - guiIntfStruct.MovieHeight/2 )/2 + wsOrgY );
- }
- break;
- case evDoubleSize:
- btnSet( evFullScreen,btnReleased );
- if ( guiIntfStruct.Playing )
- {
- if ( appMPlayer.subWindow.isFullScreen )
- {
- mplFullScreen();
- }
- wsResizeWindow( &appMPlayer.subWindow, guiIntfStruct.MovieWidth * 2, guiIntfStruct.MovieHeight * 2 );
- wsMoveWindow( &appMPlayer.subWindow, 0,
- ( wsMaxX - guiIntfStruct.MovieWidth*2 )/2 + wsOrgX,
- ( wsMaxY - guiIntfStruct.MovieHeight*2 )/2 + wsOrgY );
- }
- break;
- case evNormalSize:
- btnSet( evFullScreen,btnReleased );
- if ( guiIntfStruct.Playing )
- {
- if ( appMPlayer.subWindow.isFullScreen )
- {
- mplFullScreen();
- }
- wsResizeWindow( &appMPlayer.subWindow, guiIntfStruct.MovieWidth, guiIntfStruct.MovieHeight );
- wsMoveWindow( &appMPlayer.subWindow, 0,
- ( wsMaxX - guiIntfStruct.MovieWidth )/2 + wsOrgX,
- ( wsMaxY - guiIntfStruct.MovieHeight )/2 + wsOrgY );
- break;
- } else if ( !appMPlayer.subWindow.isFullScreen ) break;
- case evFullScreen:
- if ( !guiIntfStruct.Playing && !gtkShowVideoWindow ) break;
- mplFullScreen();
- if ( appMPlayer.subWindow.isFullScreen ) btnSet( evFullScreen,btnPressed );
- else btnSet( evFullScreen,btnReleased );
- break;
-
- case evSetAspect:
- switch ( iparam )
- {
- case 2: movie_aspect=16.0f / 9.0f; break;
- case 3: movie_aspect=4.0f / 3.0f; break;
- case 4: movie_aspect=2.35; break;
- case 1:
- default: movie_aspect=-1;
- }
- wsClearWindow( appMPlayer.subWindow );
-#ifdef CONFIG_DVDREAD
- if ( guiIntfStruct.StreamType == STREAMTYPE_DVD || guiIntfStruct.StreamType == STREAMTYPE_VCD ) goto play_dvd_2;
- else
-#endif
- guiIntfStruct.NewPlay=1;
- break;
-
-// --- timer events
- case evRedraw:
- {
- unsigned now = GetTimerMS();
- extern int mplPBFade;
- if ((now > last_redraw_time) &&
- (now < last_redraw_time + GUI_REDRAW_WAIT) &&
- !mplPBFade)
- break;
- last_redraw_time = now;
- }
- mplMainRender=1;
- wsPostRedisplay( &appMPlayer.mainWindow );
- wsPostRedisplay( &appMPlayer.barWindow );
- break;
-// --- system events
-#ifdef MP_DEBUG
- case evNone:
- mp_msg( MSGT_GPLAYER,MSGL_STATUS,"[mw] event none received.\n" );
- break;
- default:
- mp_msg( MSGT_GPLAYER,MSGL_STATUS,"[mw] unknown event received ( %d,%.2f ).\n",msg,param );
- break;
-#endif
- }
-}
-
-#define itPLMButton (itNULL - 1)
-#define itPRMButton (itNULL - 2)
-
-void mplMainMouseHandle( int Button,int X,int Y,int RX,int RY )
-{
- static int itemtype = 0;
- int i;
- wItem * item = NULL;
- float value = 0.0f;
-
- static int SelectedItem = -1;
- int currentselected = -1;
-
- for ( i=0;i < appMPlayer.NumberOfItems + 1;i++ )
- if ( ( appMPlayer.Items[i].pressed != btnDisabled )&&
- ( wgIsRect( X,Y,appMPlayer.Items[i].x,appMPlayer.Items[i].y,appMPlayer.Items[i].x+appMPlayer.Items[i].width,appMPlayer.Items[i].y+appMPlayer.Items[i].height ) ) )
- { currentselected=i; break; }
-
- switch ( Button )
- {
- case wsPMMouseButton:
- gtkShow( evHidePopUpMenu,NULL );
- mplShowMenu( RX,RY );
- itemtype=itPRMButton;
- break;
- case wsRMMouseButton:
- mplHideMenu( RX,RY,0 );
- break;
-
- case wsPLMouseButton:
- gtkShow( evHidePopUpMenu,NULL );
- sx=X; sy=Y; boxMoved=1; itemtype=itPLMButton;
- SelectedItem=currentselected;
- if ( SelectedItem == -1 ) break;
- boxMoved=0;
- item=&appMPlayer.Items[SelectedItem];
- itemtype=item->type;
- item->pressed=btnPressed;
- switch( item->type )
- {
- case itButton:
- if ( ( SelectedItem > -1 ) &&
- ( ( ( item->msg == evPlaySwitchToPause && item->msg == evPauseSwitchToPlay ) ) ||
- ( ( item->msg == evPauseSwitchToPlay && item->msg == evPlaySwitchToPause ) ) ) )
- { item->pressed=btnDisabled; }
- break;
- }
- break;
- case wsRLMouseButton:
- boxMoved=0;
- item=&appMPlayer.Items[SelectedItem];
- item->pressed=btnReleased;
- SelectedItem=-1;
- if ( currentselected == - 1 ) { itemtype=0; break; }
- value=0;
- switch( itemtype )
- {
- case itPotmeter:
- case itHPotmeter:
- btnModify( item->msg,(float)( X - item->x ) / item->width * 100.0f );
- mplEventHandling( item->msg,item->value );
- value=item->value;
- break;
- case itVPotmeter:
- btnModify( item->msg, ( 1. - (float)( Y - item->y ) / item->height) * 100.0f );
- mplEventHandling( item->msg,item->value );
- value=item->value;
- break;
- }
- mplEventHandling( item->msg,value );
- itemtype=0;
- break;
-
- case wsRRMouseButton:
- gtkShow( evShowPopUpMenu,NULL );
- break;
-
-// --- rolled mouse ... de szar :)))
- case wsP5MouseButton: value=-2.5f; goto rollerhandled;
- case wsP4MouseButton: value= 2.5f;
-rollerhandled:
- item=&appMPlayer.Items[currentselected];
- if ( ( item->type == itHPotmeter )||( item->type == itVPotmeter )||( item->type == itPotmeter ) )
- {
- item->value+=value;
- btnModify( item->msg,item->value );
- mplEventHandling( item->msg,item->value );
- }
- break;
-
-// --- moving
- case wsMoveMouse:
- item=&appMPlayer.Items[SelectedItem];
- switch ( itemtype )
- {
- case itPLMButton:
- wsMoveWindow( &appMPlayer.mainWindow,False,RX - abs( sx ),RY - abs( sy ) );
- mplMainRender=0;
- break;
- case itPRMButton:
- mplMenuMouseHandle( X,Y,RX,RY );
- break;
- case itPotmeter:
- item->value=(float)( X - item->x ) / item->width * 100.0f;
- goto potihandled;
- case itVPotmeter:
- item->value=(1. - (float)( Y - item->y ) / item->height) * 100.0f;
- goto potihandled;
- case itHPotmeter:
- item->value=(float)( X - item->x ) / item->width * 100.0f;
-potihandled:
- if ( item->value > 100.0f ) item->value=100.0f;
- if ( item->value < 0.0f ) item->value=0.0f;
- mplEventHandling( item->msg,item->value );
- break;
- }
- break;
- }
-}
-
-int keyPressed = 0;
-
-void mplMainKeyHandle( int KeyCode,int Type,int Key )
-{
- int msg = evNone;
-
- if ( Type != wsKeyPressed ) return;
-
- if ( !Key )
- {
- switch ( KeyCode )
- {
- case wsXFMMPrev: msg=evPrev; break;
- case wsXFMMStop: msg=evStop; break;
- case wsXFMMPlay: msg=evPlaySwitchToPause; break;
- case wsXFMMNext: msg=evNext; break;
- case wsXFMMVolUp: msg=evIncVolume; break;
- case wsXFMMVolDown: msg=evDecVolume; break;
- case wsXFMMMute: msg=evMute; break;
- }
- }
- else
- {
- switch ( Key )
- {
- case wsEnter: msg=evPlay; break;
- case wsXF86LowerVolume: msg=evDecVolume; break;
- case wsXF86RaiseVolume: msg=evIncVolume; break;
- case wsXF86Mute: msg=evMute; break;
- case wsXF86Play: msg=evPlaySwitchToPause; break;
- case wsXF86Stop: msg=evStop; break;
- case wsXF86Prev: msg=evPrev; break;
- case wsXF86Next: msg=evNext; break;
- case wsXF86Media: msg=evLoad; break;
- case wsEscape:
- if ( appMPlayer.subWindow.isFullScreen )
- {
- if ( guiIntfStruct.event_struct ) ((XEvent *)guiIntfStruct.event_struct)->type=None;
- mplEventHandling( evNormalSize,0 );
- return;
- }
- default: vo_x11_putkey( Key ); return;
- }
- }
- if ( msg != evNone ) mplEventHandling( msg,0 );
-}
-
-/* this will be used to handle Drag&Drop files */
-void mplDandDHandler(int num,char** files)
-{
- struct stat buf;
- int f = 0;
-
- char* subtitles = NULL;
- char* filename = NULL;
-
- if (num <= 0)
- return;
-
-
- /* now fill it with new items */
- for(f=0; f < num; f++){
- char* str = strdup( files[f] );
- plItem* item;
-
- url_unescape_string(str, files[f]);
-
- if(stat(str,&buf) == 0 && S_ISDIR(buf.st_mode) == 0) {
- /* this is not a directory so try to play it */
- mp_msg( MSGT_GPLAYER,MSGL_V,"Received D&D %s\n",str );
-
- /* check if it is a subtitle file */
- {
- char* ext = strrchr(str,'.');
- if (ext) {
- static char supported[] = "utf/sub/srt/smi/rt//txt/ssa/aqt/";
- char* type;
- int len;
- if((len=strlen(++ext)) && (type=strstr(supported,ext)) &&\
- (type-supported)%4 == 0 && *(type+len) == '/'){
- /* handle subtitle file */
- gfree((void**)&subtitles);
- subtitles = str;
- continue;
- }
- }
- }
-
- /* clear playlist */
- if (filename == NULL) {
- filename = files[f];
- gtkSet(gtkDelPl,0,NULL);
- }
-
- item = calloc(1,sizeof(plItem));
-
- /* FIXME: decompose file name ? */
- /* yes -- Pontscho */
- if ( strrchr( str,'/' ) ) {
- char * s = strrchr( str,'/' ); *s=0; s++;
- item->name = gstrdup( s );
- item->path = gstrdup( str );
- } else {
- item->name = strdup(str);
- item->path = strdup("");
- }
- gtkSet(gtkAddPlItem,0,(void*)item);
- } else {
- mp_msg( MSGT_GPLAYER,MSGL_WARN,MSGTR_NotAFile,str );
- }
- free( str );
- }
-
- if (filename) {
- mplSetFileName( NULL,filename,STREAMTYPE_FILE );
- if ( guiIntfStruct.Playing == 1 ) mplEventHandling( evStop,0 );
- mplEventHandling( evPlay,0 );
- }
- if (subtitles) {
- gfree((void**)&guiIntfStruct.Subtitlename);
- guiIntfStruct.Subtitlename = subtitles;
- guiLoadSubtitle(guiIntfStruct.Subtitlename);
- }
-}
diff --git a/gui/mplayer/pb.c b/gui/mplayer/pb.c
deleted file mode 100644
index 9238755d91..0000000000
--- a/gui/mplayer/pb.c
+++ /dev/null
@@ -1,265 +0,0 @@
-/*
- * main window
- *
- * 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.
- */
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <inttypes.h>
-#include <sys/stat.h>
-#include <unistd.h>
-#include <string.h>
-
-#include "config.h"
-#include "gui/app.h"
-#include "gui/skin/font.h"
-#include "gui/skin/skin.h"
-#include "gui/wm/ws.h"
-
-#include "help_mp.h"
-#include "libvo/x11_common.h"
-#include "libvo/fastmemcpy.h"
-
-#include "stream/stream.h"
-#include "mixer.h"
-#include "libvo/sub.h"
-
-#include "libmpdemux/demuxer.h"
-#include "libmpdemux/stheader.h"
-#include "codec-cfg.h"
-
-#include "gmplayer.h"
-#include "play.h"
-#include "widgets.h"
-#include "gui_common.h"
-
-unsigned int GetTimerMS( void );
-unsigned int GetTimer( void );
-
-unsigned char * mplPBDrawBuffer = NULL;
-int mplPBVisible = 0;
-int mplPBLength = 0;
-int mplPBFade = 0;
-
-void mplPBDraw( void )
-{
- int x;
-
- if ( !appMPlayer.subWindow.isFullScreen ) return;
- if ( !mplPBVisible || !appMPlayer.barIsPresent ) return;
-
-// appMPlayer.bar.x=( appMPlayer.subWindow.Width - appMPlayer.bar.width ) / 2;
- switch( appMPlayer.bar.x )
- {
- case -1: x=( appMPlayer.subWindow.Width - appMPlayer.bar.width ) / 2; break;
- case -2: x=( appMPlayer.subWindow.Width - appMPlayer.bar.width ); break;
- default: x=appMPlayer.bar.x;
- }
-
- switch ( mplPBFade )
- {
- case 1: // fade in
- mplPBLength--;
- if ( appMPlayer.subWindow.Height - appMPlayer.bar.height >= mplPBLength )
- {
- mplPBLength=appMPlayer.subWindow.Height - appMPlayer.bar.height;
- mplPBFade=0;
- vo_mouse_autohide=0;
- }
- wsMoveWindow( &appMPlayer.barWindow,0,x,mplPBLength );
- break;
- case 2: // fade out
- mplPBLength+=10;
- if ( mplPBLength > appMPlayer.subWindow.Height )
- {
- mplPBLength=appMPlayer.subWindow.Height;
- mplPBFade=mplPBVisible=0;
- vo_mouse_autohide=1;
- wsVisibleWindow( &appMPlayer.barWindow,wsHideWindow );
- return;
- }
- wsMoveWindow( &appMPlayer.barWindow,0,x,mplPBLength );
- break;
- }
-
-// --- render
- if ( appMPlayer.barWindow.State == wsWindowExpose )
- {
- btnModify( evSetMoviePosition,guiIntfStruct.Position );
- btnModify( evSetVolume,guiIntfStruct.Volume );
-
- vo_mouse_autohide=0;
-
- fast_memcpy( mplPBDrawBuffer,appMPlayer.bar.Bitmap.Image,appMPlayer.bar.Bitmap.ImageSize );
- Render( &appMPlayer.barWindow,appMPlayer.barItems,appMPlayer.NumberOfBarItems,mplPBDrawBuffer,appMPlayer.bar.Bitmap.ImageSize );
- wsConvert( &appMPlayer.barWindow,mplPBDrawBuffer,appMPlayer.bar.Bitmap.ImageSize );
- }
- wsPutImage( &appMPlayer.barWindow );
-}
-
-#define itPLMButton (itNULL - 1)
-#define itPRMButton (itNULL - 2)
-
-void mplPBMouseHandle( int Button,int X,int Y,int RX,int RY )
-{
- static int itemtype = 0;
- int i;
- wItem * item = NULL;
- float value = 0.0f;
-
- static int SelectedItem = -1;
- int currentselected = -1;
-
- for ( i=0;i < appMPlayer.NumberOfBarItems + 1;i++ )
- if ( ( appMPlayer.barItems[i].pressed != btnDisabled )&&
- ( wgIsRect( X,Y,appMPlayer.barItems[i].x,appMPlayer.barItems[i].y,appMPlayer.barItems[i].x+appMPlayer.barItems[i].width,appMPlayer.barItems[i].y+appMPlayer.barItems[i].height ) ) )
- { currentselected=i; break; }
-
- switch ( Button )
- {
- case wsPMMouseButton:
- gtkShow( evHidePopUpMenu,NULL );
- mplShowMenu( RX,RY );
- break;
- case wsRMMouseButton:
- mplHideMenu( RX,RY,0 );
- break;
- case wsRRMouseButton:
- gtkShow( evShowPopUpMenu,NULL );
- break;
-// ---
- case wsPLMouseButton:
- gtkShow( evHidePopUpMenu,NULL );
- SelectedItem=currentselected;
- if ( SelectedItem == -1 ) break; // yeees, i'm move the fucking window
- item=&appMPlayer.barItems[SelectedItem];
- itemtype=item->type;
- item->pressed=btnPressed;
-
- switch( item->type )
- {
- case itButton:
- if ( ( SelectedItem > -1 ) &&
- ( ( ( item->msg == evPlaySwitchToPause && item->msg == evPauseSwitchToPlay ) ) ||
- ( ( item->msg == evPauseSwitchToPlay && item->msg == evPlaySwitchToPause ) ) ) )
- { item->pressed=btnDisabled; }
- break;
- }
-
- break;
- case wsRLMouseButton:
- item=&appMPlayer.barItems[SelectedItem];
- item->pressed=btnReleased;
- SelectedItem=-1;
- if ( currentselected == - 1 ) { itemtype=0; break; }
- value=0;
-
- switch( itemtype )
- {
- case itPotmeter:
- case itHPotmeter:
- btnModify( item->msg,(float)( X - item->x ) / item->width * 100.0f );
- mplEventHandling( item->msg,item->value );
- value=item->value;
- break;
- case itVPotmeter:
- btnModify( item->msg, ( 1. - (float)( Y - item->y ) / item->height) * 100.0f );
- mplEventHandling( item->msg,item->value );
- value=item->value;
- break;
- }
- mplEventHandling( item->msg,value );
-
- itemtype=0;
- break;
-// ---
- case wsP5MouseButton: value=-2.5f; goto rollerhandled;
- case wsP4MouseButton: value= 2.5f;
-rollerhandled:
- item=&appMPlayer.barItems[currentselected];
- if ( ( item->type == itHPotmeter )||( item->type == itVPotmeter )||( item->type == itPotmeter ) )
- {
- item->value+=value;
- btnModify( item->msg,item->value );
- mplEventHandling( item->msg,item->value );
- }
- break;
-// ---
- case wsMoveMouse:
- item=&appMPlayer.barItems[SelectedItem];
- switch ( itemtype )
- {
- case itPRMButton:
- mplMenuMouseHandle( X,Y,RX,RY );
- break;
- case itPotmeter:
- item->value=(float)( X - item->x ) / item->width * 100.0f;
- goto potihandled;
- case itVPotmeter:
- item->value=(1. - (float)( Y - item->y ) / item->height) * 100.0f;
- goto potihandled;
- case itHPotmeter:
- item->value=(float)( X - item->x ) / item->width * 100.0f;
-potihandled:
- if ( item->value > 100.0f ) item->value=100.0f;
- if ( item->value < 0.0f ) item->value=0.0f;
- mplEventHandling( item->msg,item->value );
- break;
- }
- break;
- }
-}
-
-void mplPBShow( int x, int y )
-{
- if ( !appMPlayer.barIsPresent || !gtkEnablePlayBar ) return;
- if ( !appMPlayer.subWindow.isFullScreen ) return;
-
- if ( y > appMPlayer.subWindow.Height - appMPlayer.bar.height )
- {
- if ( !mplPBFade ) wsVisibleWindow( &appMPlayer.barWindow,wsShowWindow );
- mplPBFade=1; mplPBVisible=1; wsPostRedisplay( &appMPlayer.barWindow );
- }
- else if ( !mplPBFade ) mplPBFade=2;
-}
-
-void mplPBInit( void )
-{
- if ( !appMPlayer.barIsPresent ) return;
-
- gfree( (void**)&mplPBDrawBuffer );
-
- if ( ( mplPBDrawBuffer = malloc( appMPlayer.bar.Bitmap.ImageSize ) ) == NULL )
- {
- mp_msg( MSGT_GPLAYER,MSGL_FATAL,MSGTR_NEMDB );
- exit( 0 );
- }
-
- appMPlayer.barWindow.Parent=appMPlayer.subWindow.WindowID;
- wsCreateWindow( &appMPlayer.barWindow,
- appMPlayer.bar.x,appMPlayer.bar.y,appMPlayer.bar.width,appMPlayer.bar.height,
- wsNoBorder,wsShowMouseCursor|wsHandleMouseButton|wsHandleMouseMove,wsHideFrame|wsHideWindow,"PlayBar" );
-
- wsSetShape( &appMPlayer.barWindow,appMPlayer.bar.Mask.Image );
-
- appMPlayer.barWindow.ReDraw=(void *)mplPBDraw;
- appMPlayer.barWindow.MouseHandler=mplPBMouseHandle;
- appMPlayer.barWindow.KeyHandler=mplMainKeyHandle;
-
- mplPBLength=appMPlayer.subWindow.Height;
-}
diff --git a/gui/mplayer/pixmaps/MPlayer_mini.xpm b/gui/mplayer/pixmaps/MPlayer_mini.xpm
deleted file mode 100644
index e038014f09..0000000000
--- a/gui/mplayer/pixmaps/MPlayer_mini.xpm
+++ /dev/null
@@ -1,638 +0,0 @@
-/* XPM */
-static const char * const MPlayer_mini_xpm[] = {
-"146 121 514 2",
-" c None",
-". c #2C2256",
-"+ c #2C2257",
-"@ c #251B4D",
-"# c #2E2655",
-"$ c #383063",
-"% c #382F66",
-"& c #382E6A",
-"* c #392D6D",
-"= c #392C71",
-"- c #392C74",
-"; c #392B76",
-"> c #392C72",
-", c #392D6F",
-"' c #392E6A",
-") c #251B4F",
-"! c #2C2159",
-"~ c #3A2F6B",
-"{ c #3A2D75",
-"] c #392B78",
-"^ c #392B7A",
-"/ c #392A7B",
-"( c #382A79",
-"_ c #382E6D",
-": c #2C2457",
-"< c #2B2450",
-"[ c #342C5D",
-"} c #392F64",
-"| c #392A7D",
-"1 c #3A2B7E",
-"2 c #392A7F",
-"3 c #382B7B",
-"4 c #382C74",
-"5 c #342965",
-"6 c #3A2E6C",
-"7 c #382B70",
-"8 c #38297C",
-"9 c #392D6B",
-"0 c #251C49",
-"a c #2B224F",
-"b c #32285A",
-"c c #392E68",
-"d c #3A2D73",
-"e c #3A2E6E",
-"f c #2B2257",
-"g c #322761",
-"h c #2C234E",
-"i c #2F2655",
-"j c #382D71",
-"k c #3B297D",
-"l c #382B73",
-"m c #382A77",
-"n c #3A287C",
-"o c #382D72",
-"p c #2B2356",
-"q c #392F61",
-"r c #392E66",
-"s c #382B7A",
-"t c #382E6B",
-"u c #241A4E",
-"v c #362B67",
-"w c #312958",
-"x c #352B5F",
-"y c #261C50",
-"z c #3A2E70",
-"A c #38297E",
-"B c #382B7D",
-"C c #3A2F69",
-"D c #2B2740",
-"E c #30294A",
-"F c #393156",
-"G c #38315A",
-"H c #38315D",
-"I c #392F63",
-"J c #3A2D72",
-"K c #383E3E",
-"L c #686868",
-"M c #878787",
-"N c #9F9EA3",
-"O c #9B99A4",
-"P c #9B98A9",
-"Q c #9C97AB",
-"R c #9D98AC",
-"S c #9B98AD",
-"T c #9C97AE",
-"U c #9C96B0",
-"V c #9B97B0",
-"W c #9B97B2",
-"X c #9C95B6",
-"Y c #9B96B6",
-"Z c #9B95B7",
-"` c #9C94B9",
-" . c #9B95B9",
-".. c #9C94BB",
-"+. c #9B95BB",
-"@. c #716A94",
-"#. c #726998",
-"$. c #106A8C",
-"%. c #23A5D6",
-"&. c #1E4D5F",
-"*. c #365E6A",
-"=. c #6E878C",
-"-. c #EDFBFC",
-";. c #FBFFFF",
-">. c #FFFFFF",
-",. c #FFFEFF",
-"'. c #FFFDFF",
-"). c #FFFCFF",
-"!. c #FFFAFF",
-"~. c #FFF9FF",
-"{. c #C0B9E3",
-"]. c #726A9D",
-"^. c #379FC2",
-"/. c #599DB4",
-"(. c #C4ECF8",
-"_. c #F2FFFF",
-":. c #FCFFFF",
-"<. c #FEFFFF",
-"[. c #EDE9FF",
-"}. c #382C6A",
-"|. c #2F245E",
-"1. c #30A1CB",
-"2. c #1FA6D6",
-"3. c #1CA8DB",
-"4. c #23A6D4",
-"5. c #4AB1D4",
-"6. c #CAFFFF",
-"7. c #E9FFFF",
-"8. c #F8FFFF",
-"9. c #FEFEFE",
-"0. c #C1B9E2",
-"a. c #2AA3CE",
-"b. c #20A7D7",
-"c. c #18A9DE",
-"d. c #13AAE1",
-"e. c #6FC2E0",
-"f. c #DCFFFF",
-"g. c #EDFFFF",
-"h. c #F7FFFF",
-"i. c #FFFFFD",
-"j. c #DFDAF8",
-"k. c #382F64",
-"l. c #257B9C",
-"m. c #11ACE4",
-"n. c #0EADE7",
-"o. c #12ADE5",
-"p. c #47B1D8",
-"q. c #F4FFFF",
-"r. c #DFD9FD",
-"s. c #383258",
-"t. c #1B7EA5",
-"u. c #22A6D7",
-"v. c #15AAE2",
-"w. c #0DADE7",
-"x. c #0DADE9",
-"y. c #19A9DD",
-"z. c #3CA7CB",
-"A. c #BFFFFF",
-"B. c #EBFFFF",
-"C. c #FEFFFD",
-"D. c #C0BDCE",
-"E. c #277C9B",
-"F. c #10ACE7",
-"G. c #0EAEE8",
-"H. c #10ACE5",
-"I. c #25A5D4",
-"J. c #8FD9F2",
-"K. c #E4FFFF",
-"L. c #FEFEFF",
-"M. c #87868C",
-"N. c #015778",
-"O. c #26A5D2",
-"P. c #0BAEE7",
-"Q. c #17AADE",
-"R. c #44B1D8",
-"S. c #202022",
-"T. c #2EA1CD",
-"U. c #14ABE2",
-"V. c #0BAEE9",
-"W. c #22A4D5",
-"X. c #83DDFF",
-"Y. c #33A0C9",
-"Z. c #BCFFFF",
-"`. c #EEFFFF",
-" + c #CDCDCF",
-".+ c #0BADEB",
-"++ c #50AED2",
-"@+ c #D6FFFF",
-"#+ c #1FA7D9",
-"$+ c #6EC3E2",
-"%+ c #DDFFFF",
-"&+ c #FFFDFE",
-"*+ c #1EA8D9",
-"=+ c #1FA7D7",
-"-+ c #72C1E0",
-";+ c #E2FFFF",
-">+ c #F5FFFF",
-",+ c #0CAFEA",
-"'+ c #75C2DE",
-")+ c #E3FFFF",
-"!+ c #002F41",
-"~+ c #28A5D3",
-"{+ c #22A6D6",
-"]+ c #91D9F2",
-"^+ c #E7FFFF",
-"/+ c #94D7F1",
-"(+ c #EAFFFF",
-"_+ c #29A4D0",
-":+ c #0AAFE9",
-"<+ c #2CA3CE",
-"[+ c #FEFEFC",
-"}+ c #F0FFFF",
-"|+ c #12ACE2",
-"1+ c #94D8EF",
-"2+ c #12ABE4",
-"3+ c #E8FFFF",
-"4+ c #E6FFFF",
-"5+ c #17AAE0",
-"6+ c #1BA8DD",
-"7+ c #E0FFFF",
-"8+ c #1EA7DB",
-"9+ c #20A6D9",
-"0+ c #2AA3D0",
-"a+ c #92D8F1",
-"b+ c #FFFBFF",
-"c+ c #9B97AE",
-"d+ c #9A94B6",
-"e+ c #B1ADC6",
-"f+ c #B1AEC1",
-"g+ c #9B93B8",
-"h+ c #CECAE3",
-"i+ c #DFDFDF",
-"j+ c #BBBBBB",
-"k+ c #BCBCBC",
-"l+ c #9F9F9F",
-"m+ c #15ABE0",
-"n+ c #EFE9FF",
-"o+ c #39305B",
-"p+ c #F3F0FF",
-"q+ c #CFC8EA",
-"r+ c #716B8F",
-"s+ c #382C6E",
-"t+ c #9B94BD",
-"u+ c #4F4F4F",
-"v+ c #000000",
-"w+ c #676767",
-"x+ c #FEFCFF",
-"y+ c #CFC7EC",
-"z+ c #3A2C77",
-"A+ c #382D6F",
-"B+ c #B1ACCC",
-"C+ c #716799",
-"D+ c #716A96",
-"E+ c #3A2C79",
-"F+ c #3C3C3C",
-"G+ c #94D7F2",
-"H+ c #9C93C0",
-"I+ c #382B71",
-"J+ c #F3EFFF",
-"K+ c #382C6C",
-"L+ c #CDC9E2",
-"M+ c #C1BCDA",
-"N+ c #3D3D3D",
-"O+ c #29A2CD",
-"P+ c #95D7EF",
-"Q+ c #F9FFFF",
-"R+ c #72689C",
-"S+ c #3A2C7B",
-"T+ c #EEE8FF",
-"U+ c #B1ABCD",
-"V+ c #B1ACCA",
-"W+ c #CFC6F5",
-"X+ c #D0C8ED",
-"Y+ c #B2A9D6",
-"Z+ c #7267A1",
-"`+ c #716A93",
-" @ c #0AADE8",
-".@ c #24A4D3",
-"+@ c #B6F0FF",
-"@@ c #7368A2",
-"#@ c #38297A",
-"$@ c #9C93C2",
-"%@ c #38305F",
-"&@ c #382A7F",
-"*@ c #EEE9FF",
-"=@ c #CECED0",
-"-@ c #B8EFFF",
-";@ c #382D69",
-">@ c #3A2B7C",
-",@ c #CEC7F0",
-"'@ c #FEFDFF",
-")@ c #FFF8FF",
-"!@ c #9F9FA1",
-"~@ c #CFCFCF",
-"{@ c #E0E0E0",
-"]@ c #EEEEEE",
-"^@ c #CECECE",
-"/@ c #EEEBFF",
-"(@ c #C1BCDC",
-"_@ c #72679F",
-":@ c #726A99",
-"<@ c #202020",
-"[@ c #505050",
-"}@ c #010100",
-"|@ c #CECAE5",
-"1@ c #7265AD",
-"2@ c #716998",
-"3@ c #F3ECFF",
-"4@ c #383061",
-"5@ c #CEC8EE",
-"6@ c #CFCBE6",
-"7@ c #B1ABCF",
-"8@ c #71699A",
-"9@ c #726994",
-"0@ c #1F1F1F",
-"a@ c #EFEFEF",
-"b@ c #D0C5FF",
-"c@ c #9C90D2",
-"d@ c #CEC5FE",
-"e@ c #372D69",
-"f@ c #010101",
-"g@ c #888888",
-"h@ c #27A6D3",
-"i@ c #B9F0FF",
-"j@ c #7266A6",
-"k@ c #FFF7FF",
-"l@ c #39305F",
-"m@ c #9C91CB",
-"n@ c #CEC6F7",
-"o@ c #BDBDBD",
-"p@ c #68686A",
-"q@ c #000002",
-"r@ c #868686",
-"s@ c #F4EBFF",
-"t@ c #B2AAD3",
-"u@ c #9C96B8",
-"v@ c #372F62",
-"w@ c #9C92C4",
-"x@ c #F4F0FF",
-"y@ c #726A93",
-"z@ c #9C91C9",
-"A@ c #9C93BE",
-"B@ c #CEC6EB",
-"C@ c #F4EEFF",
-"D@ c #3E3E3E",
-"E@ c #B2A9D4",
-"F@ c #CEC8EC",
-"G@ c #382F68",
-"H@ c #D0C8EF",
-"I@ c #72689D",
-"J@ c #EDEDED",
-"K@ c #9B94C0",
-"L@ c #F3EDFF",
-"M@ c #B2ABD5",
-"N@ c #F3EEFF",
-"O@ c #9B96B4",
-"P@ c #CECBE0",
-"Q@ c #EDEFEE",
-"R@ c #27A4D0",
-"S@ c #716B91",
-"T@ c #716B8D",
-"U@ c #C0BDD2",
-"V@ c #2EA2CB",
-"W@ c #26A4D4",
-"X@ c #9D96B5",
-"Y@ c #9B92BF",
-"Z@ c #B2ABCD",
-"`@ c #EEEBFE",
-" # c #EEECF7",
-".# c #9C95B7",
-"+# c #CECBDC",
-"@# c #9B92C1",
-"## c #9D94C3",
-"$# c #676769",
-"%# c #9E9EA0",
-"&# c #EEEEF0",
-"*# c #19A9DE",
-"=# c #1DA9DE",
-"-# c #3D3D3F",
-";# c #878789",
-"># c #1DA7D8",
-",# c #B7EEFF",
-"'# c #27A4D2",
-")# c #B7F0FF",
-"!# c #BBEEFF",
-"~# c #31A2CA",
-"{# c #379FC4",
-"]# c #3E9CBE",
-"^# c #459AB9",
-"/# c #4D97B2",
-"(# c #5395AD",
-"_# c #CECAE1",
-":# c #DFDCF1",
-"<# c #5993A7",
-"[# c #F1FFFF",
-"}# c #C0B9E2",
-"|# c #72689A",
-"1# c #382D67",
-"2# c #F4EDFF",
-"3# c #EEEAFF",
-"4# c #3B2A7A",
-"5# c #3B2A78",
-"6# c #F2EDFF",
-"7# c #CEC9E7",
-"8# c #C0BADC",
-"9# c #C1BADB",
-"0# c #C0BBDB",
-"a# c #F5EEFF",
-"b# c #B2A9D8",
-"c# c #9A93BD",
-"d# c #716893",
-"e# c #09AEE8",
-"f# c #3A2A75",
-"g# c #DFDEE3",
-"h# c #C0BAE0",
-"i# c #BAEFFF",
-"j# c #382E63",
-"k# c #BCBCBE",
-"l# c #DFDBF6",
-"m# c #B1F2FF",
-"n# c #87868B",
-"o# c #71C2DF",
-"p# c #3E3D43",
-"q# c #878785",
-"r# c #EEEEEC",
-"s# c #B1AAD3",
-"t# c #D1FFFF",
-"u# c #3EA6CB",
-"v# c #FBFDFF",
-"w# c #86DCFD",
-"x# c #DFDCED",
-"y# c #393164",
-"z# c #B1AAD6",
-"A# c #BCBCBA",
-"B# c #342F71",
-"C# c #C3CDF1",
-"D# c #D0FFFF",
-"E# c #37A8D4",
-"F# c #383353",
-"G# c #B1AAD4",
-"H# c #372F60",
-"I# c #73699E",
-"J# c #322E78",
-"K# c #6070A1",
-"L# c #84B8DF",
-"M# c #379EC9",
-"N# c #71689D",
-"O# c #322E7A",
-"P# c #243772",
-"Q# c #5D83B0",
-"R# c #29607E",
-"S# c #DFDBF4",
-"T# c #332C79",
-"U# c #293474",
-"V# c #000A36",
-"W# c #3C2C73",
-"X# c #382C78",
-"Y# c #342F6F",
-"Z# c #FEFBFF",
-"`# c #CEC8EA",
-" $ c #9C94BD",
-".$ c #3B2C71",
-"+$ c #71669E",
-"@$ c #D0C7F2",
-"#$ c #71679C",
-"$$ c #EEEDF3",
-"%$ c #393067",
-"&$ c #DFDFE1",
-"*$ c #9D95BC",
-"=$ c #3B2B72",
-"-$ c #2F2557",
-";$ c #342661",
-">$ c #BBBDBC",
-",$ c #241A4C",
-"'$ c #71679B",
-")$ c #3B297B",
-"!$ c #3A2B80",
-"~$ c #352B5D",
-"{$ c #2C2350",
-"]$ c #010000",
-"^$ c #726996",
-"/$ c #251B50",
-"($ c #FDFFFE",
-"_$ c #3B2B74",
-":$ c #3B2B76",
-"<$ c #2E2753",
-"[$ c #322958",
-"}$ c #2B244E",
-"|$ c #E0D8FD",
-"1$ c #32285D",
-"2$ c #9D94C1",
-"3$ c #2F2653",
-"4$ c #393065",
-"5$ c #382A75",
-"6$ c #EFE7FF",
-"7$ c #2D2355",
-"8$ c #32275F",
-"9$ c #342C5B",
-"0$ c #CEC9E9",
-"a$ c #EFE8FF",
-"b$ c #241C4B",
-"c$ c #2F255A",
-"d$ c #352A62",
-"e$ c #2E2659",
-"f$ c #E0D9FB",
-"g$ c #3A3065",
-"h$ c #342B62",
-"i$ c #32285C",
-"j$ c #342C5F",
-"k$ c #2C2254",
-"l$ c #382D65",
-"m$ c #372E63",
-"n$ c #332B5E",
-"o$ c #241C4D",
-" . + + @ ",
-" # $ % & * = - ; ; > , ' $ ",
-" ) ! ~ * , , = = > { ; ; ] ^ ^ / / ( ^ ] - = _ : ",
-" < [ } ' , > - ] / | | | | | | | | | | | 1 | | | 2 2 | | 3 4 % ",
-" @ ! 5 6 * , 7 = > - - ; ] ^ ^ / | | | | | | | | | | | | | | | 8 | 8 | 1 | ^ ; 9 0 ",
-" a b } c 9 , d ; / | | | | | | | 8 | 1 | | | | | | | | 1 | | 8 | | | | | | | | | | | | | | ] e 0 ",
-" f g 9 * , = = > - - ; ] ^ ^ / | | | | | | | | | | | | 2 2 | | 2 2 | | | | | | | | / / | | | | | | | | 2 / ] 9 ",
-" h i $ % ' * j 4 ^ / k k | | | | | | 2 2 | | 2 2 | | | | | | | | | | 2 2 | | 2 2 | | | | | | | | / / | | | | | | | | 2 2 | - % ",
-" @ ! ' 9 * , = > > l ; ; m ^ ^ / | k n | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ^ o p ",
-" < q r 9 , , > ; ^ | | | | | | | | | 8 | | 8 | k k | 1 | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | / s t ",
-" u ! v 9 * , , = > - ; ] ^ ^ ^ / | | 2 | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | / = ",
-" h w $ r 9 , > ] ^ / | | | | | | | 2 2 8 | | | 2 2 | | | | 1 | 8 | | 1 | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - x ",
-" y ! g 9 * , z = > > - ; ] m ^ / / | | | | | | | | | | 8 | | | 2 A | | B B | | | | | | | | | | 8 | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ; C ",
-" D E F G H I r ' 9 , = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 7 = j j = = = = = = = = = = = J = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = > > - ] ^ / | | ] * ",
-" K L M N O P Q R S S T U V W X X Y Z ` ` . .` ` . ..... . ..... . .` ` . .` ` . .` ` . .` ` . . . . . ..... .` ` ` ` .` ` ` ` ` ` . .` ` . .` ` . .` ` ` ` ` ` . .` ` . .` ` . .` ` ` ` ` ` . .` ..+.@.#.} t o ^ | / ] = ",
-" $.%.&.*.=.-.;.>.>.,.'.'.).).'.'.).).'.'.).).'.'.).).'.'.).).).).).).'.'.).).'.'.).'.'.'.'.).'.'.).).'.'.).).'.'.'.'.'.'.).).'.'.).).'.'.).).).).).).'.'.).).'.'.).).'.'.).).).).).).'.'.).).'.'.).).'.'.).).).).).).'.'.).).).).!.~.{.].9 = ; ] - + ",
-" $.%.%.%.^./.(._.:.<.>.>.>.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.'.'.).[.@.}.- ] |. ",
-" $.%.1.2.3.4.5.6.7.8.>.>.>.9.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.,.).0.c > c ",
-" $.a.b.c.d.%.e.f.g.h.:.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.i.i.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.,.'.j.k.$ ",
-" l.4.m.n.o.3.p.f.q.;.<.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.i.i.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.'.r.s. ",
-" t.u.v.w.x.y.z.A.B.;.<.>.>.>.>.>.>.>.>.i.>.>.>.>.>.>.>.>.>.>.C.C.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.9.>.>.>.>.>.>.>.9.,.'.D. ",
-" E.u.F.w.G.H.I.J.K.h.>.>.>.>.9.>.>.L.>.>.i.>.>.>.>.>.>.>.>.>.>.C.C.>.>.>.>.>.>.>.>.i.i.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.,.,.M. ",
-" N.O.v.w.P.H.Q.R.f.h.:.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.9.>.>.S. ",
-" n.T.U.n.V.P.d.W.X.7.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.i.i.>.M ",
-" n.n.n.x.V.V.c.Y.Z.`.,.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.<.<.>.>.>. + ",
-" n.n.n..+V.V.V.3.++@+_.,.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.<.<.>.>.>.>. ",
-" n.n.U.V.V.V.V.#+$+%+q.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.9.&+,.>.>.*+ ",
-" n.n.H.V.V.V.V.=+-+;+>+>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.,.,.>.>.*+ ",
-" n.n.w.V.V.V.V.=+-+;+>+>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.*+ ",
-" n.n.,+V.V.V.V.b.'+)+h.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.:.*+ ",
-"!+~+V.V.V.V.V.V.{+]+^+8.>.,.,.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.8.*+ ",
-"!+O.V.V.V.V.V.V.{+/+(+8.>.,.,.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>+*+ ",
-" _+,+:+:+V.V.V.{+/+(+8.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.i.i.>._.*+ ",
-" <+n.V.:+V.V.V.{+/+(+8.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.[+i.>.}+*+ ",
-" <+|+w.:+V.V.V.{+1+(+8.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.`.n.*+ ",
-" <+y.H.:+V.V.V.{+1+(+8.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.B.n.*+ ",
-" n.#+2+V.V.V.V.{+/+(+8.>.>.>.>.>.,.,.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.<.<.>.>.9.3+n.*+ ",
-" n.<+U.V.V.V.V.{+/+(+8.>.>.>.>.>.,.,.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.<.<.>.>.>.4+n.*+ ",
-" n.<+5+:+V.V.V.{+/+(+8.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.,.,.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.9.>.K.n.*+ ",
-" <+c.:+V.V.V.{+/+(+8.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.,.,.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.)+n.*+ ",
-" <+6+V.V.P.V.{+/+(+8.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.i.i.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.9.>.>.<.7+n.*+ ",
-" <+8+V.V.P.V.{+/+(+8.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.i.i.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.<.7+n.n.*+ ",
-" <+9+V.V.V.V.{+/+(+h.<.>.>.>.>.<.<.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.i.i.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.7+n.n.*+ ",
-" n.u.V.V.V.V.{+/+(+h.<.>.>.>.>.<.<.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.i.i.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.7+0+n.*+ ",
-" n.<+.+V.V.V.{+/+(+8.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.i.i.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.i.i.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.9.>.7+0+n.*+ ",
-" n.<+.+V.V.V.{+a+(+8.i.>.>.>.>.>.>.>.>.>.>.,.,.,.>.>.>.>.>.>.>.>.>.,.,.,.,.>.>.>.>.>.>.,.,.,.,.,.,.,.,.>.>.>.>.>.>.>.>.>.>.>.>.i.i.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.;+0+n.*+ ",
-" <+x.V.V.:+{+a+(+8.>.>.>.>.>.>.>.>.>.,.,.'.'.'.,.,.>.>.>.>.>.,.,.'.'.'.'.,.>.>.>.,.,.).).b+).'.'.'.'.,.>.>.>.>.>.i.i.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.9.>.>.>.9.>.9.>.>.>.>.>.>.>.>.>.9.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.,.;+0+n.*+ ",
-" <+H.w.V.:+{+a+(+8.>.>.>.>.>.>.>.>.,.'.c+Y d+Z e+'.>.>.>.>.,.).V Y Z Z e+,.9.>.,.'.f+X g+` ` . . .Y h+).'.,.>.>.[+i.i+j+k+l+M M l+>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.,.;+0+n.n.n. ",
-" <+m+H.V.V.{+a+(+8.>.>.>.>.>.>.>.>.,.n+o+' = j $ p+,.>.>.>.'.q+I ' , , q '.i.>.,.).r+c = = = = = = = s+c t+b+,.>.>.>.l+u+v+v+v+v+w+>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.;+0+n.n.*+ ",
-" <+3.m.V.V.{+/+(+8.>.>.>.>.>.>.>.>.x+y+c z+| B A+B+'.,.>.L.).C+J ] / | 9 p+>.>.,.b+D+> | | / ] ; ^ / | E+t @.).,.>.>.>.>.F+v+v+v+l+>.>.>.>.>.>.>.9.>.>.>.>.>.>.>.>.>.>.>.9.>.>.>.>.>.>.>.9.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.7+0+n.n.*+ ",
-" <+I.U.V.V.{+G+(+8.>.>.>.>.>.>.>.>.'.H+s+] | | I+@.).,.>.,.J+' ^ / | | K+L+,.>.,.b+@.> | | ] 9 c , - / / ] ' M+'.,.>.9.>.N+v+v+v+i+>.>.>.>.>.>.>.9.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.9.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.7+0+n.n.*+ ",
-" <+O+5+V.V.%.P+g.Q+>.>.>.>.>.>.>.9.).R+- S+/ | ; % T+'.,.'.U+, | | | 1 , V+,.,.,.b+@.> | | > W+X+Y+Z+; | | > `+).,.>.>.>. v+v+ >.>.>.>.>.>.>.9.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.9.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.7+0+w.n.*+ ",
-" n.<+c.V. @.@+@_.;.,.>.>.i.i.>.>.>.).@@] #@| | ^ = $@'.,.b+%@> | | | | = .'.,.,.b+@.d | &@A+!.'.'.*@, | 2 - q !.'.,.>.=@v+v+v+u+>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.9.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.i.i.>.>.>.7+0+V.n.*+ ",
-" <+6+V.,+O.-@>+:.,.>.>.i.i.>.>.>.).;@/ 1 | >@/ ] c b+).,@& ; | / / | > @.).'@,.b+@.> 8 &@_ ).<.,.b+K+| 2 ; I )@'.,.>.!@v+v+v+M >.>.>.>.>.>.>.~@j+k+>.>.>.>.>.>.>.>.>.>.i+j+{@>.>.9.>.>.>.]@k+k+^@>.>.>.>.>.>.>.>.^@k+j+]@>.>.>.>.>.>.>.>.>.>.>.>.>.i+j+]@>.>.>.i.i.>.>.>.7+0+V.n.n.*+ ",
-" <+8+x.V.O.-@>+:.>.>.>.,.,.>.>.>./@9 8 | / ^ ^ / , (@!._@- ^ #@^ ^ #@> :@b+L.<.b+@.> | | _ b+,.'.T+, | 2 - q !.'.,.>.L v+v+v+k+>.>.>.>.>.M <@v+<@N+ M M [@<@k+9.>.k+N+}@v+v+L >.>.>.>.k+v+v+v+[@9.>.>.>.>.i+L <@<@v+v+N+^@>.>.i+L <@v+ w+9.]@[@v+v+ ]@>.>.>.>.>.>.>.7+0+V.n.n.*+ ",
-" <+#+x.,+O.-@q.:.>.>.>.,.,.>.>.,.|@* | / ^ 1@- / - 2@3@= / / ] 1@- ^ - 4@b+,.<.b+@.> | | = 5@6@7@8@- | | > 9@b+'.,.>.0@v+v+v+>.>.>.>.]@N+v+v+[@a@>.k+v+v+v+v+]@>.>.w+M v+v+v+k+>.>.>.l+v+v+v+M >.>.>.>.M v+v+[@>.]@ v+v+<@>.>.N+N+ v+v+v+M N+N+v+v+v+M >.>.>.>.>.>.>.7+0+V.V.n.*+ ",
-" <+u.V.V.O.-@q.:.>.>.>.>.>.>.,.). .= / ^ - b@' ; ] , c@] / ] > d@e@; - I *@'.,.b+@.o B 2 ^ = * = - ^ >@/ * B+'.,.>.]@v+v+v+N+>.>.>.>.N+v+v+<@]@>.>.>.v+v+v+<@>.>.>.>.>.M v+v+v+k+>.>.>.M v+v+v+k+>.>.>.l+v+f@v+i+>.>.N+v+f@v+>.>.>.>.g@v+v+v+v+l+L v+v+v+M >.>.>.>.>.>.>.7+0+V.x.n.*+ ",
-" <+%.V.V.h@i@q.:.>.>.>.>.>.>.,.b+@.> / ] j@k@l@> / ] ] / ^ = m@n@k.- ; r q+'.,.b+@.o B 2 | ^ ^ ^ S+; > * #.).,.>.>.o@v+f@v+M >.>.>.M v+v+v+M >.>.>.k+v+v+v+L >.>.>.>.>.p@q@v+v+k+>.>.>.N+v+v+v+i+>.>.i+v+v+v+[@>.>.>.N+v+v+N+>.>.>.>.r@v+v+v+M 9.N+v+v+v+^@>.>.>.>.>.>.>.7+_+V.x.n.*+ ",
-" <+O.V.V.O.-@q.:.>.>.>.>.>.>.,.b+2@> ^ - _@!.U+, 8 / / | ; r s@)@$ - ] 9 t@'.,.b+@.> | | ^ > = = * c l@u@p+,.>.>.>.L v+v+v+k+>.>.>. v+v+v+{@>.>.>.M v+v+v+r@>.>.>.>.>.N+v+v+v+>.>.>.>.<@v+v+v+>.>.>.L v+v+v+M >.>.l+v+v+ ^@>.>.>.>.[@v+v+v+^@>.^@[@N+k+>.>.>.>.>.>.>.>.7+_+:+V.n.*+ ",
-" <+w.V.O.i@q.:.>.>.>.>.>.>.'.!.v@{ ^ = w@).x@' ^ / | / = y@~.~.4@- ^ = $@'.,.).@.> | | ; z@$@$@A@B@C@'.,.>.>.>.>.N+v+v+v+]@>.>.k+v+v+v+ >.>.>.>.[@v+v+v+^@>.>.>.>.]@v+v+v+N+>.>.>.>.v+v+v+D@>.>.>.0@v+v+v+M M [@v+ L ]@>.>.>.>.>.<@v+v+ >.>.>.>.>.>.>.>.>.>.>.>.>.>.7+_+:+V.n.n.*+ ",
-" <+H.w.O.-@q.:.>.>.>.>.i.>.'.*@$ - ] * E@'.).R+> ^ / ^ 9 |@).b+D+> / ] _@).,.).@.> | | s+!.'.'.'.'.,.,.>.>.>.>.>.v+v+v+N+<.<.>.g@v+v+v+N+>.>.>.>.<@v+v+ >.>.>.9.>.o@v+v+v+L >.>.>.k+v+v+v+L >.>.>.v+v+v+v+N+L M ~@>.9.>.>.9.>.>.i+f@v+v+N+>.>.>.>.>.>.>.>.>.>.>.i.i.i.7+_+V.x.n.n.*+ ",
-" <+U.n.O.-@q.:.>.>.>.i.i.>.'.F@G@; ; ' H@'.'.0.9 ] ^ ; I@).,.).`+= | / ' ).,.).@.> | | 9 ).9.>.>.>.>.>.>.>.>.>.k+v+v+v+L <.<.>.M v+v+v+N+>.>.>.i+v+v+v+N+>.>.>.>.>.M v+v+v+k+>.>.>.l+v+v+v+M >.>.>.v+v+v+v+k+>.>.>.>.>.J@>.>.>.>.k+v+v+v+M >.>.>.>.>.>.>.>.>.>.>.i.i.i.7+0+V.V.n.n.*+ ",
-" <+3.m.O.-@q.:.>.>.>.>.>.>.'.K@A+] ; r L@'.,.b+4@- ] _ M@'.,.). .= | | 9 ).,.b+@.> | | 9 ).>.>.>.>.>.>.>.>.>.>.M v+v+v+M <.<.>.r@v+v+v+<@>.>.>.k+v+v+v+g@>.>.>.>.>.N+q@q@v+k+>.>.]@N+v+v+v+k+>.>.>.N+v+v+v+L >.>.>.>.>.[@M >.>.>.L v+v+v+k+>.>.>.>.>.>.>.>.>.>.>.>.>.>.7+0+V.V.n.n.*+ ",
-" <+{+|+O.-@q.:.>.>.>.>.>.>.'.2@, ; = %@b+,.,.). .e = $ N@'.,.'.O@9 E+^ ' P@'.).`+, ] ^ c ).>.>.>.>.>.>.>.>.>.>.M v+v+v+L <.Q@]@i+v+v+v+v+l+>.k+ v+v+v+[@>.]@]@>.>.N+q@q@v+L k+r@ v+v+v+]@>.>.>.k+v+v+v+ l+>.>.k+N+D@]@>.>.>.N+v+v+f@]@>.>.>.>.>.>.>.>.>.>.>.>.>.>.7+0+V.:+n.n.*+ ",
-" <+R@m+O.-@q.:.>.i.i.>.>.,.).9@' K+c S@).,.>.,./@I r T@).,.>.,.P@I , = I U@x+).r+C , = I ).,.>.>.>.>.>.>.>.>.>.i+v+f@v+v+v+ ]@>.M v+v+v+v+v+N+k+ v+v+v+v+ a@>.>.!@v+v+v+v+v+<@=@S.q@q@<@>.>.>.9.>.l+f@v+v+v+v+v+v+L ]@>.>.>.>.v+v+v+N+>.>.>.>.>.>.>.>.>.>.>.>.,.,.>.7+0+V. @n.n.*+ ",
-" <+V@5+W@-@q.:.>.i.i.>.>.,.'.X@A@Y@..e+'.,.>.>.'.Z@` `@,.>.>.>. #.#$@$@` +#,.'.e+..@###.#).,.>.>.>.>.>.>.>.>.>.9.=@$#F+[@%#&#>.>.>.k+L N+[@l+>.>.^@L N+[@l+]@>.>.>.>.l+N+N+L l+>.=@q@q@q@L >.>.>.>.>.>.i+M N+N+[@M i+>.>.>.>.>.i+M M M k+>.>.>.>.>.>.>.>.>.>.>.>.,.,.>.7+0+V. @V.n.n.*+ ",
-" <+*#W@-@q.:.>.>.>.>.>.>.>.'.).'.'.,.,.>.>.>.,.'.'.,.>.>.>.>.,.'.'.'.'.,.>.,.,.'.'.'.'.,.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>. +=@>.>.>.>.>.L v+q@q@i+>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.9.>.>.>.>.>.>.9.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.7+0+V.V.V.n.n.*+ ",
-" <+=#W@-@q.:.>.>.>.>.>.>.>.i.i.i.i.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.i.i.>.>.>.>.>.>.i.>.>.>.>.>.>.>.>.>.>.>.>.9.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.!@q@q@-#]@>.>.]@ v+q@;#>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.7+0+V.V.V.P.n.*+ ",
-" <+>#W@,#q.:.>.,.,.i.i.>.>.,.,.>.>.>.>.>.9.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.i.i.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.9.9.>.>.>.9.>.>.>.>.N+v+v+v+L >.>.u+q@q@L >.>.>.>.>.>.>.>.>.>.9.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.7+0+V.V.V.V.n.*+ ",
-" <+b.O.,#q.:.>.,.,.i.i.>.>.,.,.>.>.>.>.>.>.>.>.>.>.>.>.>.>.9.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.i.i.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.k+v+v+v+v+l+N+v+ ;#>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.7+0+V.V.V. @n.*+ ",
-" <+%.O.-@q.:.>.>.>.,.,.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.^@M N+N+N+L l+a@>.9.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.,.,.>.>.>.>.>.>.>.>.>.>.>.>.i.i.i.i.>.>.>.>.>.7+0+V.V.V.V.n.*+ ",
-" <+I.O.-@q.;.>.>.>.,.,.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.,.,.>.>.>.>.>.>.>.>.>.>.>.>.i.i.i.i.>.>.>.>.>.7+0+V.V.V.V.n.n.*+ ",
-" <+'#O.)#q.;.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.9.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.7+0+V.V.V.V.V.V.*+ ",
-" <+a._+!#h.:.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.;+0+V.V.V.V.V.V.*+ ",
-" <+~#7+:.<.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.9.>.>.>.9.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.,.;+0+V.V.V.V.V.V.*+ ",
-" <+{#4+>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.,.;+0+V.V.V.V.V.V.*+ ",
-" <+]#^+>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.9.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.i.i.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.;+0+V.V. @V.V.n.*+ ",
-" <+^#(+>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.9.>.>.>.9.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.7+0+V. @V.V.V.w.*+ ",
-" <+/#g.>.>.>.>.>.>.>.>.i.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.i.i.9.>.>.>.>.>.>.>.>.>.>.>.>.i.>.>.>.>.i.i.>.>.>.>.>.>.>.>.>.>.>.7+0+V.V.V.V.V.V.n.*+",
-" <+(#`.>.>.>.>.>.>.>.i.i.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.i.>.>.,.,.'.).).)./@_#_#_#:#).).).'.'.,.>.i.>.>.>.>.>.>.>.>.>.>.>.7+0+V.V.V.V.,+V.n.*+",
-" <+<#[#>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.,.'.b+}#|#_@' 9 * * * 9 9 1#R+E@2#b+,.>.>.>.>.>.>.>.,.,.>.>.>.7+0+V.V.V.V.V.:+n.*+",
-" <+_.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.,.'.).3# .4@& > ] / | / / / / | S+- * } y@3#).'.,.>.>.>.>.,.,.>.>.>.7+0+V.V.V.V.V.V.n.*+",
-" <+>+>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.'.2#$@' 7 - ; ^ #@| / ] ; ] ^ / / 4#5#{ = 9 |#6#'.,.>.>.>.>.>.>.>.>.7+0+V. @V.V.V.P.n.*+",
-" <+8.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.,.'.7#I , ^ #@] ; I+, * ' _@I@_@' 9 , > - ( ^ ^ = $ 8#).,.L.>.>.>.>.>.>.7+0+V.V.,+V.V.2+n. ",
-" <+;.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.,.).E@' > ^ | ^ , r 9@9#J+).).).).).J+0#@.} = ; ^ ^ - ' A@!.,.>.>.>.<.<.>.7+0+V.V.V.V.V.n.n. ",
-" :.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.,.).y@9 ; ^ ^ - 9 @#a#b+).,.>.>.>.>.L.,.'.).~.b#c = ; / ] 9 9@).,.>.>.<.<.<.7+_+V.V.V.V.V.n.*+ ",
-" <.<.>.>.>.>.>.>.[+i.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.,.,.>.>.,.,.>.>.>.>.>.>.>.>.>.>.,.,.>.>.,.,.>.>.>.>.>.>.>.>.>.>.,.,.>.>.,.,.>.>.>.>.>.>.>.>.,.,.>.>.>.>.>.>.<.<.>.>.,.).E@9 ; S+; * D+N@).'.,.,.>.>.>.>.>.>.>.,.,.'.).J+c#G@; / ] * d#!.,.>.>.<.;.%+_+V.e#:+.+V.n. ",
-" <.<.>.>.>.>.>.>.i.i.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.,.,.>.>.,.,.>.>.>.>.>.>.>.>.>.>.,.,.>.>.,.,.>.>.>.>.>.>.>.>.>.>.,.,.>.>.,.,.>.>.>.>.>.>.>.>.,.,.>.>.>.>.>.>.<.<.>.,.'.9#' f#^ ; 9 Y+b+,.g#k+>.>.>.>.>.>.>.>.>.>.>.>.>.,.).h#c - ^ ] 9 E@).>.>.:.>+i#O.V.:+w.V.V.*+ ",
-" =@>.>.>.>.>.>.>.9.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.x+2#j#> ^ ; 9 7@).,.>.k#v+-#=@>.>.>.>.>.>.>.>.>.>.>.>.,.).j.4@- / ] c l#,.>.Q+`.m#4.V.V.H.V.*+ ",
-" n#>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.,.).|#= ^ ] 9 E@).,.>.>.k+v+q@q@L {@>.>.>.>.>.>.>.>.>.>.>.,.'.j.' ; / > @.).,.>+;+o#b.w.H.V.V.*+ ",
-" p#,.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.,.'.|@9 ^ | > +.).,.>.>.>.k+v+v+v+v+v+q#r#>.>.>.>.>.>.>.>.>.>.,.).s#& ; ] * E@'.}+t#u#6+H.V.V.*+ ",
-" O ,.,.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.,.).S@= #@^ ' x@,.>.>.>.>.o@v+v+v+v+v+v+ M >.>.>.>.>.>.>.>.>.9.'@b+D+> / ] G@v#4+w#_+V.V.V.*+ ",
-" x#'.,.,.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.'.*@y#- ; _ z#).>.>.>.>.>.A#v+v+q@v+v+v+v+v+<@l+>.>.>.>.>.>.>.>.>.,.|@9 / 3 B#C#D#E#V.V.n.*+ ",
-" F#J+).,.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.'.G#t ; > H#!.'.>.>.>.>.>.A#v+v+q@v+v+v+v+v+v+v+N+k+>.>.>.>.>.>.>.>.).I#; 3 J#K#L#M#n.n.*+ ",
-" I R+J+,.,.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.<.'@N#4 ^ , U+'.,.>.>.>.>.>.k+v+v+v+v+v+v+v+v+v+v+v+v+N+k+>.>.>.>.>.>.'.E@* ] O#P#Q#R#*+ ",
-" ' , D+l#).'.,.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.9.>.<.x+& s / 9 S#,.>.>.>.>.>.>.k+v+v+v+v+v+v+v+v+v+v+v+v+v+v+L i+>.>.>.>.'.2#r ; T#U#V# ",
-" c ; = ' H+~.'.,.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.i.>.>.>.>.>.>.>._#9 >@^ ' ).>.>.>.>.>.>.>.k+v+v+v+v+v+v+v+v+v+v+v+v+v+f@v+v+L ]@>.>.'@!.#.W#X#Y# ",
-" ! ; / ] , I U+J+Z#'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.x+x+x+'.'.'.'.).`#, / ] _@Z#>.>.>.9.>.>.>.k+v+v+v+v+v+v+v+v+v+v+v+v+v+v+v+v+v+ M ]@,.b+ $.$5#* ",
-" @ = ^ | ] - = 9 +$$@E@y+`#`#q+q+`#`#q+q+`#`#q+q+`#`#q+q+`#`#q+q+`#`#q+q+`#`#q+q+`#`#q+q+`#`#q+q+`#`#q+q+`#`#q+q+`#`#q+q+`#`#q+q+`#`#q+q+`#`#q+q+`#`#q+q+`#`#q+q+`#F@@$#$- ^ - R+).>.>.>.>.>.>.>.k+v+v+v+q@q@v+v+q@q@v+v+v+v+v+v+v+v+v+v+-#$$b+..= E+, ",
-" ' ] 2 | 8 2 / ; = 9 c % %$r r % k.r r % % r } % k.r } % k.r } % k.r } % k.r } % k.r } % k.r } % k.r } % k.r } % k.r } % k.r } % k.r } % k.r } % k.} } I $ q l@H %@} }.] ^ > w@).>.>.>.>.>.>.>.k+v+v+v+q@q@v+v+q@q@v+v+v+v+v+v+v+v+v+L &$,.).*$= ] = ",
-" [ - | | | | | / ^ ] ; ; ; ; ; ; - ; ; ; ; ; - ; - ; - ; - ; - ; - ; - ; - ; - ; - ; - ; - ; - ; - ; - ; - ; - ; - ; - ; - ; - ; - ; - ; - ; - ; - =$= , 9 r I H H -$;$; ^ > w@).>.>.>.>.>.>.>.k+v+v+v+v+v+v+v+v+v+v+v+v+v+v+v+v+F+>$<.>.,.).` J ] = ",
-" , / | | | | 8 | | | 8 | | 8 | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | / ^ ^ ] ; - - > = = z * ' g ! ,$ - ^ - '$Z#>.>.9.>.>.>.>.k+v+v+v+v+v+v+v+v+v+v+v+v+v+v+ l+>.<.<.>.,.b+ $= ] , ",
-" ' ] )$n / / | | | | | | !$2 | | | | 2 2 | 1 | | | | | | | | / >@| | | 1 | | | | | | | | | | | | | | | | | | | | 2 2 | / ] - = * ' } ~${$ , / ] _@).>.>.>.>.>.<.<.k+v+v+v+]$]$v+v+v+v+v+v+v+v+M ]@>.>.>.>.>.,.b+^$=$5#* ",
-" * 5#k / / | | | 1 | | 2 2 | | | | 2 2 | | | | | | | | | | / / 8 | | | | | | | | | | 8 | | | / ^ m ] ; - > > = = , * ' |./$ 6 ^ ^ ;@b+,.>.>.>.>.<.($k+v+v+v+]$]$v+v+v+v+v+v+[@i+>.>.>.>.>.>.>.'.~.I _$:$' ",
-" <$> / | | | | | 1 | | | | | | | | | | | | | | 2 2 | 1 | | | 8 | | | | | | | | | | | | &@B / ] > , t G@} [$}$ g ] / , 0#'.,.>.>.>.>.>.k+v+v+v+v+v+v+v+v+v+<@k+>.>.>.>.>.>.>.>.>.'.|$r ; { } ",
-" 1$> ^ | | | | | | | | | | | | | | | | | | | 2 2 | | | 8 | | | / ^ ^ ] ; l - > = = A+A+_ v ! u @ > ^ > @.b+,.>.>.>.>.>.k+v+v+v+v+v+v+v+ g@>.>.>.>.>.>.>.>.>.>.>.).2$, ] > 3$ ",
-" # = / | 8 | | | | | | | | | | | 1 | | | | | | | 1 | | | | / ] - = * c 4$4@{$ & 5$; c 6$'.>.9.>.>.>.k#q@v+v+v+v+q@p@]@>.>.>.>.>.i.i.>.>.>.>.,.J+c m / , ",
-" 7$* > ] >@| | | | | | | | | | | / ^ ^ ] ; - - > = = , * ' 8$. 9$> ^ = |#).,.>.>.>.>.k#q@v+v+v+N+=@>.>.>.>.>.>.>.i.i.>.>.>.,.'. .= / ^ ' ",
-" b 9 ; / | | 8 | / / | | | / ] - = * ' } ~${$ , >@^ 9 0$'.,.>.>.>.k+v+v+0@k#>.>.>.>.>.>.>.>.>.>.>.<.<.9.'.a$} - ^ j b$ ",
-" c$t * , = = , , , A+K+~ ! ) d$z+/ > %@J+x+>.>.>.k+ g@>.>.>.>.>.>.>.>.>.>.>.>.>.<.<.,.b+|#= ] - k. ",
-" ~ ; ^ = R+J+,.,.>.]@]@>.>.>.>.>.>.>.>.>.>.>.>.>.>.C.L.b+#., ] ^ * ",
-" 0 , ^ ^ , @.J+'.,.>.>.>.>.>.>.>.>.>.>.>.>.>.>.>.,.'.b+#.* ] ^ > e$ ",
-" c$> ^ ] , I@f$).,.>.>.>.>.>.>.>.>.>.>.>.i.>.,.'.L@R+, ] / > [ ",
-" d$= ] ^ > g$..J+'.'.,.,.,.>.>.>.,.,.,.'.'.b+7@r = ] ^ > h$ ",
-" i$, ] ^ - , c $@a$b+).'.,.,.,.'.).!.N@G#c = ; ^ ^ > j$ ",
-" k$9 - ^ ^ ] = l$^$` B+h+L+h+V+..^$m$_ m 1 / ; , c$ ",
-" n$= m ^ ^ :$> = , * * * , = > - ] / ^ - c ",
-" o$e@, d ; ] ^ ^ / >@/ ( ^ ] ; > = t . ",
-" w G@K+= > ; ; ; - j _ % w ",
-" @ + + ! + ",
-" "};
diff --git a/gui/mplayer/pixmaps/a11.xpm b/gui/mplayer/pixmaps/a11.xpm
deleted file mode 100644
index 389ef67f14..0000000000
--- a/gui/mplayer/pixmaps/a11.xpm
+++ /dev/null
@@ -1,22 +0,0 @@
-/* XPM */
-static const char * const a11_xpm[] = {
-"18 16 3 1",
-" c None",
-". c #000000",
-"+ c #FFFFFF",
-" ",
-" ",
-" ",
-" ................ ",
-"..++++++++++++++..",
-".+..............+.",
-".+...+...+...+..+.",
-".+..++......++..+.",
-".+...+.......+..+.",
-".+...+.......+..+.",
-".+...+...+...+..+.",
-".+..............+.",
-"..++++++++++++++..",
-" ................ ",
-" ",
-" "};
diff --git a/gui/mplayer/pixmaps/a169.xpm b/gui/mplayer/pixmaps/a169.xpm
deleted file mode 100644
index 7c1cb60001..0000000000
--- a/gui/mplayer/pixmaps/a169.xpm
+++ /dev/null
@@ -1,22 +0,0 @@
-/* XPM */
-static const char * const a169_xpm[] = {
-"18 16 3 1",
-" c None",
-". c #000000",
-"+ c #FFFFFF",
-" ",
-" ",
-" ",
-" ................ ",
-"..++++++++++++++..",
-".+..............+.",
-".+..+.+++.+.+++.+.",
-".+.++.+.....+.+.+.",
-".+..+.+++...+++.+.",
-".+..+.+.+.....+.+.",
-".+..+.+++.+.+++.+.",
-".+..............+.",
-"..++++++++++++++..",
-" ................ ",
-" ",
-" "};
diff --git a/gui/mplayer/pixmaps/a235.xpm b/gui/mplayer/pixmaps/a235.xpm
deleted file mode 100644
index 8a2fcc2160..0000000000
--- a/gui/mplayer/pixmaps/a235.xpm
+++ /dev/null
@@ -1,22 +0,0 @@
-/* XPM */
-static const char * const a235_xpm[] = {
-"18 16 3 1",
-" c None",
-". c #000000",
-"+ c #FFFFFF",
-" ",
-" ",
-" ",
-" ................ ",
-"..++++++++++++++..",
-".+..............+.",
-".+..++..+.++.++.+.",
-".+.+..+....+.+..+.",
-".+...+....++.++.+.",
-".+..+......+..+.+.",
-".+.++++.+.++.++.+.",
-".+..............+.",
-"..++++++++++++++..",
-" ................ ",
-" ",
-" "};
diff --git a/gui/mplayer/pixmaps/a43.xpm b/gui/mplayer/pixmaps/a43.xpm
deleted file mode 100644
index ed11abb53b..0000000000
--- a/gui/mplayer/pixmaps/a43.xpm
+++ /dev/null
@@ -1,22 +0,0 @@
-/* XPM */
-static const char * const a43_xpm[] = {
-"18 16 3 1",
-" c None",
-". c #000000",
-"+ c #FFFFFF",
-" ",
-" ",
-" ",
-" ................ ",
-"..++++++++++++++..",
-".+..............+.",
-".+...++..+.++...+.",
-".+..+.+......+..+.",
-".+..+.+....+++..+.",
-".+..++++.....+..+.",
-".+....+..+.+++..+.",
-".+..............+.",
-"..++++++++++++++..",
-" ................ ",
-" ",
-" "};
diff --git a/gui/mplayer/pixmaps/ab.xpm b/gui/mplayer/pixmaps/ab.xpm
deleted file mode 100644
index 661de74233..0000000000
--- a/gui/mplayer/pixmaps/ab.xpm
+++ /dev/null
@@ -1,34 +0,0 @@
-/* XPM */
-static const char * const ab_xpm[] = {
-"16 16 15 1",
-" c None",
-". c #000000",
-"+ c #EEF63E",
-"@ c #EAF13D",
-"# c #F0F83F",
-"$ c #CBD235",
-"% c #E9F03D",
-"& c #E5EC3C",
-"* c #E8F03D",
-"= c #ABB02D",
-"- c #ECF33E",
-"; c #EFF73F",
-"> c #CED636",
-", c #B4BA2F",
-"' c #CDD435",
-" ",
-" ",
-" ",
-" ",
-" . ",
-" .+. ",
-" ..@#$.. ",
-" .######%. ",
-" .####&. ",
-" .*###=. ",
-" .#-.;>. ",
-" .,. .'. ",
-" . . ",
-" ",
-" ",
-" "};
diff --git a/gui/mplayer/pixmaps/about.xpm b/gui/mplayer/pixmaps/about.xpm
deleted file mode 100644
index f2c276d4f8..0000000000
--- a/gui/mplayer/pixmaps/about.xpm
+++ /dev/null
@@ -1,427 +0,0 @@
-/* XPM */
-static const char * const about_xpm[] = {
-"320 170 254 2",
-" c None",
-". c #070707",
-"+ c #131313",
-"@ c #151515",
-"# c #0C0C0C",
-"$ c #040404",
-"% c #010101",
-"& c #060606",
-"* c #0D0D0D",
-"= c #050505",
-"- c #1B1B1B",
-"; c #0E0E0E",
-"> c #1C1C1C",
-", c #3B3B3B",
-"' c #2B2B2B",
-") c #121212",
-"! c #323232",
-"~ c #5B5B5B",
-"{ c #3F3F3F",
-"] c #0B0B0B",
-"^ c #111111",
-"/ c #424242",
-"( c #434343",
-"_ c #222222",
-": c #020202",
-"< c #202020",
-"[ c #4D4D4D",
-"} c #2C2C2C",
-"| c #030303",
-"1 c #464646",
-"2 c #414141",
-"3 c #0F0F0F",
-"4 c #0A0A0A",
-"5 c #101010",
-"6 c #161616",
-"7 c #3A3A3A",
-"8 c #505050",
-"9 c #181818",
-"0 c #565656",
-"a c #3E3E3E",
-"b c #313131",
-"c c #474747",
-"d c #3C3C3C",
-"e c #494949",
-"f c #333333",
-"g c #2D2D2D",
-"h c #212121",
-"i c #515151",
-"j c #555555",
-"k c #282828",
-"l c #232323",
-"m c #343434",
-"n c #454545",
-"o c #2F2F2F",
-"p c #272727",
-"q c #1A1A1A",
-"r c #4B4B4B",
-"s c #000000",
-"t c #252525",
-"u c #373737",
-"v c #242424",
-"w c #080808",
-"x c #090909",
-"y c #141414",
-"z c #363636",
-"A c #404040",
-"B c #393939",
-"C c #1E1E1E",
-"D c #353535",
-"E c #383838",
-"F c #1D1D1D",
-"G c #292929",
-"H c #171717",
-"I c #2A2A2A",
-"J c #262626",
-"K c #525252",
-"L c #545454",
-"M c #303030",
-"N c #484848",
-"O c #2E2E2E",
-"P c #1F1F1F",
-"Q c #3D3D3D",
-"R c #4C4C4C",
-"S c #535353",
-"T c #191919",
-"U c #4F4F4F",
-"V c #444444",
-"W c #616161",
-"X c #5C5C5C",
-"Y c #4A4A4A",
-"Z c #585858",
-"` c #5D5D5D",
-" . c #646464",
-".. c #626262",
-"+. c #5A5A5A",
-"@. c #606060",
-"#. c #595959",
-"$. c #6A6A6A",
-"%. c #676767",
-"&. c #4E4E4E",
-"*. c #848484",
-"=. c #5E5E5E",
-"-. c #5F5F5F",
-";. c #636363",
-">. c #666666",
-",. c #686868",
-"'. c #696969",
-"). c #6E6E6E",
-"!. c #656565",
-"~. c #757575",
-"{. c #7A7A7A",
-"]. c #797979",
-"^. c #7E7E7E",
-"/. c #707070",
-"(. c #6B6B6B",
-"_. c #6F6F6F",
-":. c #727272",
-"<. c #575757",
-"[. c #747474",
-"}. c #737373",
-"|. c #717171",
-"1. c #888888",
-"2. c #6D6D6D",
-"3. c #A6A6A6",
-"4. c #A0A0A0",
-"5. c #828282",
-"6. c #777777",
-"7. c #7B7B7B",
-"8. c #7C7C7C",
-"9. c #858585",
-"0. c #939393",
-"a. c #7D7D7D",
-"b. c #A4A4A4",
-"c. c #AEAEAE",
-"d. c #989898",
-"e. c #818181",
-"f. c #808080",
-"g. c #787878",
-"h. c #838383",
-"i. c #6C6C6C",
-"j. c #767676",
-"k. c #909090",
-"l. c #8D8D8D",
-"m. c #9E9E9E",
-"n. c #A9A9A9",
-"o. c #AAAAAA",
-"p. c #969696",
-"q. c #7F7F7F",
-"r. c #898989",
-"s. c #8F8F8F",
-"t. c #9F9F9F",
-"u. c #A3A3A3",
-"v. c #A2A2A2",
-"w. c #929292",
-"x. c #868686",
-"y. c #959595",
-"z. c #878787",
-"A. c #949494",
-"B. c #8A8A8A",
-"C. c #9A9A9A",
-"D. c #979797",
-"E. c #919191",
-"F. c #8C8C8C",
-"G. c #8B8B8B",
-"H. c #8E8E8E",
-"I. c #A1A1A1",
-"J. c #9B9B9B",
-"K. c #A5A5A5",
-"L. c #999999",
-"M. c #A7A7A7",
-"N. c #9D9D9D",
-"O. c #B0B0B0",
-"P. c #CECECE",
-"Q. c #D0D0D0",
-"R. c #C8C8C8",
-"S. c #BDBDBD",
-"T. c #ABABAB",
-"U. c #ADADAD",
-"V. c #B2B2B2",
-"W. c #CFCFCF",
-"X. c #C1C1C1",
-"Y. c #CCCCCC",
-"Z. c #E4E4E4",
-"`. c #D8D8D8",
-" + c #C0C0C0",
-".+ c #D4D4D4",
-"++ c #E5E5E5",
-"@+ c #E7E7E7",
-"#+ c #E3E3E3",
-"$+ c #E2E2E2",
-"%+ c #DFDFDF",
-"&+ c #D3D3D3",
-"*+ c #CDCDCD",
-"=+ c #E9E9E9",
-"-+ c #EFEFEF",
-";+ c #EEEEEE",
-">+ c #EBEBEB",
-",+ c #DDDDDD",
-"'+ c #9C9C9C",
-")+ c #CBCBCB",
-"!+ c #E6E6E6",
-"~+ c #ECECEC",
-"{+ c #F4F4F4",
-"]+ c #F6F6F6",
-"^+ c #F5F5F5",
-"/+ c #F3F3F3",
-"(+ c #F2F2F2",
-"_+ c #EDEDED",
-":+ c #EAEAEA",
-"<+ c #C5C5C5",
-"[+ c #CACACA",
-"}+ c #D6D6D6",
-"|+ c #C7C7C7",
-"1+ c #B8B8B8",
-"2+ c #B9B9B9",
-"3+ c #BEBEBE",
-"4+ c #B5B5B5",
-"5+ c #B6B6B6",
-"6+ c #F1F1F1",
-"7+ c #D9D9D9",
-"8+ c #DADADA",
-"9+ c #C3C3C3",
-"0+ c #BCBCBC",
-"a+ c #AFAFAF",
-"b+ c #ACACAC",
-"c+ c #D5D5D5",
-"d+ c #DBDBDB",
-"e+ c #E0E0E0",
-"f+ c #E8E8E8",
-"g+ c #F0F0F0",
-"h+ c #F7F7F7",
-"i+ c #E1E1E1",
-"j+ c #F8F8F8",
-"k+ c #F9F9F9",
-"l+ c #DCDCDC",
-"m+ c #D1D1D1",
-"n+ c #C2C2C2",
-"o+ c #B4B4B4",
-"p+ c #FAFAFA",
-"q+ c #FBFBFB",
-"r+ c #D2D2D2",
-"s+ c #C9C9C9",
-"t+ c #BBBBBB",
-"u+ c #B1B1B1",
-"v+ c #B7B7B7",
-"w+ c #DEDEDE",
-"x+ c #BABABA",
-"y+ c #D7D7D7",
-"z+ c #C4C4C4",
-"A+ c #B3B3B3",
-"B+ c #A8A8A8",
-"C+ c #BFBFBF",
-"D+ c #C6C6C6",
-"E+ c #FFFFFF",
-". + @ # $ % % % & * = # - ; > , ' ) ! ~ { - ] % ^ / ( _ - : < [ } | % % % ; 1 2 % | ; 3 4 5 6 > - 7 8 9 } 0 < < a % & b c # d e 5 f c g b | 9 8 h h i 4 % % % h j k % % % % % : # l m n 4 & o p : p _ % % : & # d a % % % % % % % % % % % % % % % % % % : q r % % % % % % s : t . ; d u v v > & % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % : : = . & = | : % : % % % % % % % % % % % % : | : : % % % % % % % % % : | | $ = w x w $ $ | : : : : | x y _ } f z , A / B g p > ^ w & * C ' D 7 E b } p F 3 $ | : = # 9 v G m E E z E ! z B D f } _ q > H 5 ] | % s % % : & - I f m g p - x : % % 3 H @ + 5 ] . | : | & ) < J ' z , A 1 e } ",
-"= 5 5 4 $ % % % % % % % % . 6 9 6 h K , | | % % = @ l 5 : y ! r L A ^ % & J r u $ & M z x x ; ) _ { v H ( v y d h % 6 ( I 9 N < q K f # $ % F n < D O % % % P N l % % % % % : > f ; 7 Q . G m , l N n % | 9 f m R C % % % % % % & 3 ) 3 % : : % % % % % % = y % % % % % : 9 N . s # [ S P f r k % % | h K % % % % % % % % | 5 * & % % % % % % % % % % % % % % % % | = # T C P > + 5 w % % % % % % % % : & 4 # 3 ; 3 # & % % % % % % % = . 4 ] * ^ 6 C > T 9 H 9 @ 4 $ : | = 3 - G M 7 A e r ( ! } < ^ x x + h m , B z M ' J C 3 | | ] q k ! 7 / R 8 K U e c V V 2 A u I _ l F @ 5 ] % % % % % : 3 > p M k v y . : % s . ] # # x & : % : $ ] y P p O 7 V N R r k ",
-"| 4 ] = : % % % % % % s % = y H H d W } $ % % : : : : : . n / . ^ r a 4 : * H @ . & , Q * $ . 4 J O . G f | _ 2 C = } n M / l % ' X ' 3 ; % P E t 6 : % % l z 5 w # % % % % > d q P Y T % @ A Q J 2 p : _ { ) - A | % % % % % 5 h h N d % C ( u l < C % y C . % : : : | h Y 6 s s + j M % % g Z ) % : @ O % % % % : : : : 4 / X a $ w 7 i v ] - : % % % : : : : : $ v O t } o M g I - x : : : : : : | ] q P h < q q @ # | % % : $ ] + F v G k t ' O M o g ' I ' p < y 4 = $ x ) C k E V U S r B O C ^ x . ^ l f B E m } I _ q ] = ) v b Q V Y L X ` ...+.i 8 R e n E g G J < q ^ x : % % : % % = * F l < q + & : % % : : : | % % % : | 4 y C t k b d ( N R R J ",
-"$ . & : % % % % % % % % : & ] ) g ( Y } . % % % % % % % % M B ; w / } : % % % % % 3 } > % : | % $ = % # ] % + - $ # / R l . % % h N ! H . = d i C | % : o 8 2 b ! q % % % = d d ) e 7 % % O 1 H ' B = H 1 ' % I O % % % % % 6 D - h 1 q P m o O 3 , O 9 2 N H % % % % y / ! % % : I S H % % - X ' % | % : % % % % % % % % % 5 L z s 3 a < . . F T % % % % % % : 3 7 m @.#.e f e +.[ k T = | | | | | 4 > I k k t h F @ . : | . + > I b u u d A 1 N e / / 2 Q , B z D ' < y x . ] 5 C M Q 8 ~ j ( M < 5 & : # _ g ! m } G t > 5 4 - O d e S Z Z +.@. .$.%.W ~ j &.c 2 B O t < > H # x w . . | % % | = ) H 9 H 3 = % % % % % % % % % % = # y P G o M m Q n e e N G ",
-"$ ] w | : % % % % % % % % | $ 4 # 4 = | % % % % % % % % % % @ P h ] : % % % % % % 5 = % % % % % % % % % s s s s s b n ) s % % % = ; 3 % * D m A i ! & 6 E / / 1 ' ] : : % 3 ( A o S a # - 1 J - V M = u A # C , q % % % % ] B g ^ 1 f = q M ! + q u ) C 0 Q w % % % | m e 3 % % 5 c 2 : % % k Z l & I u 3 & J D h 6 q = % % x Q n T E 6 % % % P B % % % % % % # u B @ B R c D 0 *.~ b _ y w | | & x T G ' G t l v T * $ = ^ v o E { N U R S 0 ~ @.=.0 8 &.U r r Y e a f t > @ ^ ] ^ k Q i -.#.1 m P # $ | x q t G ' p p C ) ] 6 b ( R #.;.>.,.>.,.'.).'.!.;.X i V A D } J h F H 5 5 ) ^ ; w | : : : & w w ] & % % % % % % % % % % % ] H h p O D z E a / n / A < ",
-"= * 4 | : % % % % % % % % % | | : % % % s s % % % % % % % % % % % % % % % % % % % % % % % % % % % % s s s s s s ) r 1 * % : : % % % % % > X P % k X < % : = 4 3 w % % % % w J C y m < % I E 4 ' 2 _ 5 A b 3 1 c O 5 % % % h N g f 8 t % % { g % z } % u [ 9 % % % % @ R M % % % h [ J % % & , R - J L e h k ! z h J Q * % % % ' X a 5 % % % % I c & $ | | : s l Y q x ^ P } z -.~.{ M v y # | | & ; _ k _ l _ l l H . # ! >.{.=.U Z .].^./.(._.:.)...X =.` +.` @.@.<.r u G J C ) 5 F E &.Z +.e } 6 . : % | ) > C _ h > y 4 ) p , Y 0 .).[.}.|.:./.}._.,...Z R A u M I } p h F q q 9 H y * & : % % % % % % % % % % % % % % % % % & @ > J M D Q a { { { Q d E T ",
-"| 3 ; | : % % % % % % % % % : : % % % % % % % % % % % % % % % % % % % % s % % % % % % % % % % % % % % % % % % % J o u # % : : : | | | | ] B l ] J B 5 | | $ $ $ | | : : : : % % % % : % & w % ; 6 . ] G z ^ p f ; % % % % h A I u c I & 5 1 > J ' . 9 i 2 q & % % % J r C % : : , / 5 % % h i M | o +.I q _ d f % f 7 = % % | J j ' = w ; 5 5 a L h ^ ) ) 3 - R r 6 ) f G q 7 ,.Z M p C 6 4 | | = ; > - - q q q q # x 9 E /.1.2. ._.*.3.4.5.6.].6.[. .@.=.=.W %._.[.|.;.[ d b p C @ @ J A R U Q v # : : : : . 3 y 6 5 ] . 3 v D V K @.).].7.8.~.~.:.:.).,.X K 1 , m g ' k p p J h v h C 9 5 . : % % % s s % % % % % % % % % s % : w ) P G m a a { a 7 u o g p ) ",
-"$ 3 * | % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % : : : : : | | = . w ] 3 6 F J p P ^ @ y 5 3 + 9 6 ) 5 * # * x x 4 & = | % % : $ 3 P t v < C T 4 | % % % % 4 y . @ v w % ] M ! @ = % P N O y & % % % G ( 6 & x H K E $ % _ N 7 ; y L [ C ; h / < * , P % % w } u S e < F t v J X +.} _ l < h f 0 g F Q +.E ] d ~ z h l b #.E : # f S O ) ^ 3 3 ; ] x H g &.9.0.a.6.1.b.c.d.e.^.a.7.:.$...=.` ;.,.6.e.f.{.%.i Q b ' h @ 6 g { a f > $ % : = ] ; + . = $ $ = > M A &.=.(.g.h.5.^.{.g./.).'.=.S e 7 } I t t J G g G G ' G J P y # : % % % % % % % % % % % % % % % % : & * C } z { 2 A Q B M v F y & ",
-"$ 3 ] | % : % % % % % % % % % % % : : : : : % s % % % % % % % % % % % % % % % : : % % % : : % % % : % % % : : : $ . ] 5 9 > - H @ q C - T H - q C l h C F > C < v G G t t > 3 3 y q 6 @ ; # # q ' o f D ! } k C 5 : % % % % % % % : % : % : s % % % & 5 4 % % % % : - { H * H Q [ V f ' E M 4 # z !.[ z @ D c H E p & : ; D m 9 8 i.A ! f z e j.<.u z m E E #.` m l L ~ l ] Y , + ^ / ! { z : m o J q w w . . x x 9 G R !.{.k.1.l.m.n.o.p.*.q.7.a.j._.,...W W ,.[.8.f.f.j...S { o p T ] H O o I H $ % : @ &.[ @ : : : | ; p B N +.%.j.e.r.r.h.e.].:.$.=.K ( u J - T q F v G } g ! B D M I _ T x : % % % : : % % % % % % % % % % % % . - k m 7 A { 7 m p - 5 $ % ",
-"$ ] & % % : % % % % % % % % % % % % % % % % % % % s s % % % % % % % % % % % % % % % % % % % % % : : % : | = & ] ) > k p v C F - < < q @ y + @ 6 > C h - @ @ 6 > p g } ' G F - C P p J t g ' J _ P l O m 7 E f k - = : % % % % s % % % % % % % % % : : : : % % % % : | 1 6 # 3 + @ 9 C F ; $ ] ^ o &.z - ^ O { ! h & : T n E t I c {.Z A a A $.[.&.V a / n e ].` f ( ).{ ) } U H | g r E _ w % m A y = | | $ $ w y I D !.W j.d.s.t.d.u.v.1.{.j.7.^.w.p.].i.x.j.2.*.q.j.q.h.:.%.0 2 O F ] . H ' m + : % % 5 n M : : | : = q f n S @.2.].h.9.9.h.f.j.(.-.&.2 b > * & $ . + F G g f E { V , m g v 9 & : % % % % % % % % % % % % % % % : & T J ! E a Q u g _ 9 ] : s ",
-": $ : % % % % % % % % % % % % % % % % % % % % s % % % % % % % % % % % % % % % s s s % % % % % : : $ . # y ) + q F _ t F 9 F _ t h > - 6 y - P _ h < v < q 9 T < ' g t < > @ ^ @ h t l h h _ < P < t l h _ p I k P * & $ | : : % % % % $ & ; ^ ) y ) 5 5 ^ * & $ % : | ( 5 * ; # # ] 4 | = & ] ) q C - + # * ; ) $ : & v d D M 7 ` ).6.Z e ` e.-.R e c Y Y !.e.i Q ,._.j v 0 &.p % n S ^ : % % @ K h : : | = & # _ ! N '.@.f.v.b.y.z.m.s.:.$.7.{.,.s.h.~.g.A.*.6.p.f.'.{.m.5.q.z.+.B v ^ $ @ c 8 m C w % ' V 9 % % : | 3 k A K -.(.[.].8.8.{.{.j.i.-.i a G ^ $ % % : : # T I D A ` [.` e 2 u O P * : % % % % % % % % % % % % % % % : & H l b z Q d u ' _ H x % s ",
-"% % % % % % % % % % % % % % % % % s s s s % % % % % % : | % % % % % % % % % % s % % : | : $ = w * 6 < v F q _ G h H y + y < G v - ) ; ; ; + > J p k ' p l v l v < P < q H y + q _ J v h _ q ^ ) P J v v h P > H > _ > T @ ] . = = x 3 H C p M O o g k _ > q 9 ; & $ $ * @ ; y @ ^ 3 ; & = . ] ^ H q T + x w . | : = * - I f Q ( N [ L 0 ..1.i.K &.Y R e r g.~.j r ).$.1 ' +.e k % 1 [ < J $ g | L T u } w $ w q } B $.!.` B.n.y.].{.C.|.#.!.q.j $.h. .@.'.D.z.].E.2... .F.z.g.5.~ A k ) = 9 #.E { 0 9 : N D . % % y v r e 1 (.g./.*.^.{.[.|.(.!.` &.a p * : % s % % : $ @ I u a (.h...j R 2 m k H = % % % % % % % % % % % % % % % : & 9 v ! 7 ( 2 7 o J q 5 = : ",
-": % : % % % % % % % % % % % % % % s s s s % % % % * t l . s % % % % s s % % % : : | $ $ . x ) F l J P H T C t l C 6 y + 9 < _ P F H ) ^ @ > t b } 9 3 ; 5 6 F h l l t _ h P h J ' G C T - C y @ - < C < t I b G h v p J p v F ) 3 F G E a V N V ( { 7 b g t v > ) . = = 4 ; + 6 ) 5 ; x . # 5 ) y @ y # | = | % $ * C G z / 1 [ j j #.(.z.2.Z L K Y X &.0 x.#.K S S 8 2 B E k # : C o < % % O m I | r ! = = @ p z e r.;...G.p._.=.{.H.8 V j.W [ e.$.&.K ^.z.>.x.a.-.#.0 g.5./.$.[ f h ; % l 8 3 O +.+ q S 6 % % M 9 l ..( &.g.A.~.m.0.].j.5.w.8.S [ =.} ' ; % ; 6 w : | 5 p B N ^.j.` -.<.R Q O F 4 % % % % % % % % % % % % % % % % . 6 E <.N n n n , b G P y . ",
-"$ = % % % % % % % % % % % % % % % s s s % % % % % 9 S V % % % % % % : % % % : : | = . 4 * y P J h F T > v G ' p > y + H P l k o o p l P _ t t p _ 6 + @ y T l I < H 6 5 ; 5 F k I p h P _ J q F k v v q + @ H @ H F h h P t < 9 9 _ t m c #.X Z j R 1 / d D ! O P + 4 $ | w * * # # # x ] * 4 * 4 * 4 & | | : $ 5 C ' z Q n U K #.X =.2.W #.L 8 Y V 2.=.|.` i i S K r / u p 6 4 % % s % % s s : | s ^ ] % . q l a =./.2.X ~.@.S ~ }.j.r , j. .-.5.i.i S F.W >.l.[.X L L ~.8.>.V B v 5 | % 2 , | r d | d d w s I u $ n i b Y <.E.[.l.x.j.l.r.r.^.;.<.i.8 1 5 y D Z k & : 5 k 7 %.9.[.5.g...K 2 m F ^ : : % % % % % % % % % % % % % : = y D R A 2 N e V a D o G ) ",
-"= ^ | % % % % % & G h w C ^ : # & % % H g = % % % > c P % % % % % | | | . . 4 * # x ; H F < C + 5 3 ) - p G P y ; ; 6 < J P _ < @ 3 ; ) _ g O G t k l h v v l t l > ) 3 + 9 v J t _ P T @ H C p k < v t l k t 9 6 > t J J G J h h F T F _ u R X ;.=.L S e c A Q ! p 6 4 $ $ x x ] x ] . w 4 . = : | % % % % & 3 C } u 2 c U <.` @.-.` ` <.U r n A a ( 8 U [ U &.U R ( 7 M h ; : % % % % % % % % % % s s s : ) > } z ( i j 0 K e 1 V n V a =.=.8 |.;.N ..i.e !.6...#.S [ {.[.L B p @ = % # Z > z / 3 . +.G & . Z + P X ' l z N k.6.x.[.8.I.9.h.;.i #.$.m 9 x E c o F @ ] q O / *.r.{.J.e.` U &.{ ( 0 ^ : M u k H F & s * H ] | : % % : x q v M E A c R e 2 a z @ ",
-"& y w % % % % w q V 2 k K E q j m $ J i <.8 , ; = 7 V x | : = $ : $ x 3 ^ ^ + + ; * 5 @ P q + ) ) 6 t G < 6 6 T > P p j :.<.< y I Y o - k M G - + # # ) < ' g O ' k _ l } M g I ' v T 4 x ] T _ v t G I g ' J _ p t k G G J v F + ^ H < J k _ J g E c Z +.<.i r c d } 9 4 : : : | | : | = & $ : % % % s % : * P o u { V [ 0 ~ -.` ~ <.&.c { , u ! f ! z 2 r 8 i R r / u } 6 = % % % % % % % % % % % s s s % x 5 - G E N S 8 R n E G G ! 2 [ S j j 0 8 e { Q n e 1 [ R r *.!.f ' q 4 $ % I <.O g ; % > j ! P C ~ I , X p P ! c k.8.6.).l.u.~. .~ [ |.<.@ 4 5 b '.f O I J o a ~ p.f.(.C._.U #.W k &.E * u l 1 ) p A . 3 M i 7 # = $ : : C E p _ ( K V U U d Q D 6 ",
-"& @ 4 % % % % : 6 r Q M 8 { D R p > Y (.Y ` _.f k S 7 v l p O , 8 g 3 1 A P z p ^ ^ T _ - T F F > T F G g h P v l J < z $.i G l 2 U O p I _ y # x x * @ J o h C < + @ } V E l > k o p 9 q - _ v v J - q t q ; 3 @ _ g M O G J _ P 9 @ > p l > H C F q < f V ` W ` S 2 o H | % % % % % % % % % % % : : % % = 9 I D a V e K <.Z ~ <.8 r A E o p v l v t } u 1 R i &.e ( , G + | % % % % % % % % % % % s s s % % $ ) v z N e [ e { ! P _ ! 1 i 0 #.~ #.L e m ! u a %.Z <.#.-.d f ' h * $ : 0 ' + % % % ; g 3 % y Q 6 v 1 + 9 O R H.g.,.2.H.I.6.5.#.@.f.f + ; _ k !.S m u z { r g.l.!.(.k.j R j.u b ` 3 @ } ! m : D M 4 ( f { Q C - T + G 2 =.> _ K ..R '.$.2 !. .q ",
-"x H 5 : s % s s M c @ m K _ ! B ' ! ,.}.i ~.8.r W !./ a c W r <.W ' b i &.I 0 a @ J 2 $.V > 7 j i 0 , I h 5 ; ^ C O o M ` R T m A ! k P t p F F q > _ p o o < ^ * # 3 ( ).j O ' 8 ).n v } O ' k J t p p } C 5 5 H F t O k I O p C v J k M p C q C F H - - < B Z $.%.S A I ; % % % % % % % % % % s : : : : 3 t b a / r K Z #.#.<.K e 2 m I C y @ T T > J g { e R [ r N A g y | % % % % % % % % % % % s s s s s % * C b 2 c [ e ( f h _ o a N i <.~ #.i 1 M g z ( 2.(.-.+.Y 1 2 7 b C ; ' X 5 % % % % % % % % % % : $ w : 6 G ~ 6.` X %.{.G.h.@.<.$.,.h ^ * f A ` R D , d / L H._.#.q.)./ +...< U e = ] 9 @.^ . 8 * v X l D t o m b o ' .Y # * / j a @.` i .0 q ",
-"4 > 5 : : % % . r h 3 [ } ) 8 7 7 R 9.).'.s.[. .G._.L K ^.%.Z ^.~ f g M j p r O 9 S 1 i u p { Z X a - 5 * x x ; P O ' C &.K e m P ' o g , a p t ' } l P } m o } h + y D 2.S M t 2 ! ) 5 H < J p J o } g M F H _ O G g M t q 6 ; * y F k ' I p _ h > + @ q v G } z Y #.&.u 9 : % % % % % % % % % % % : % = T G z / 1 [ j <.<.<.L Y A f t y w $ $ w * ^ q _ m ( e &.i &.V D q $ % % % % % % % % % % % s s s s s % = F o A c R r 1 E I < _ o { 1 e &.&.c d ' k z ( 0 -.0 j Z #.S R a O b c V P % % % % % % % % % % % | 6 7 k A K c &.j @.....@.X j i ( t @ ; < d 1 M m D m A ~ f.W ).!.2 M i &.b c Y p ) f =.3 a ' % Q ~ 6 O z 1 e c ( X 6.g 5 ] 0 D ] @.i - ).! H ",
-"] < y $ : % % l z # u c @ f Z i Y _.1.{.0.*.|.x.I.B.|.8.l.!.{.x.<.D 9 < X p o q A #.2 p ^ ; R S ' - 5 ; 5 ) @ F _ l v _ / =.M y T _ ' c Y -.k 6 V %.K v q F h p ' g G b ,.X Q e ' 5 x 4 3 9 F t b 8 , _ y * ) v O G G G ' M O P y T h _ J } I ' v q - C J } l C } a B u 7 J & % % % % % % % s % % % % : * l } B V e 8 0 j i U e Q b J ) $ : % s % = ] ) F I d Y U K r ( z h & % % % % % % % % % % % s s s % % % $ > M A R S L i n z G _ l p O f z 7 m ' l I u V R j ` =...%.,.X [ E k T 3 4 % s s s s s % % % % % | y E D z Q { r L #.X +.~ X #.8 n ! P ^ 5 y F p ' o f Q N R r Y d g P v l ] b u @ T M j ! J * $ m K o R ( K <.Z L *.g.j g B Y % ! [ $ z / v - ",
-"x J 6 & = $ : + < < z f p 7 Y d 0 s.p.G.^.].{.E.v.C.1.A.y.*.r.x.K T * h Z E 9 y ` .p F q J ;.f _ p G G v l _ h G u 7 B ).Z I p l T 7 R d Q 9 > +.( z g h - + 6 t } k P Z ,.%.c g C T } [ 0 M g [ .m + ] ] ; > k } o } G O k < J I b I G t T H y 3 ; @ B a ' p L >.M F l l 6 = : % % s % % % s % % % | @ k m { V &.S j S U Y n z J + | % s % % % $ 4 5 9 < O A R U R A z t ; : % % % % % % % % % % % % s % % % | q ! Q R K 0 Z K ( m k < y @ > < v < P l f 2 r L ~ W >.>.).:.2.Z 2 b h 5 % % s s s s s % % % % % % $ 3 _ I f A Y j Z +.Z <.` ~ Z U { b < 9 6 5 + C v I f B B z M k C y * ; y 9 q h v p p h H ] $ ^ t M o c <.W W W x.6.L V @.b y Y T = [ a ! m ",
-"4 J T 4 x & * < g f z u z ! ! ( ).4.j.{.^.a.a.1.E.B.x.k.s.~.].Z ) * ) { .M @ 6 Z ` m , T S -.p k ' J t P - H - J k p Q _., h l k I %.K a T + C ).N F 9 6 ) ] ; 9 } G F i '.7 ' l l m %.Y >.E A ^.$./ g T ^ T v M Q A +.d l } p q f d } t } g ' v H 3 p #.Q < l ~ i - ^ 9 F v 3 = : : % % % % s s % % | H G D { ( U i K i [ e / b F x | % % % % % | = ] 5 6 _ f { V a m } < ^ $ % % % % % % % % % % % % % : : | | 3 k m a r K j U ( D I > + 4 4 4 3 ; T l z Y i Z @.W %.$._.}.).~ 1 z t @ | % s s s s s % % % % % % : | y l o B n &.L L i i <.Z Z 8 N a m I _ 5 ] # ^ 9 F _ l _ < C C P F C h v t I O O G l H . : % | @ b e #. .$.(.(.>.X 8 j E b B 3 ) V m o ! ",
-"# I > ] ] 3 < ! { N r 1 n A Q 1 e.0.2.[.].a.q.5.*.*.h.9.{.=.g ; ] ^ ^ S b 6 ) H M D t # ) c d J @ ; @ - C _ h t k < v r i.q + 9 I 1 a.#.{ I _ g &...t T 9 * x ] y C k ! ).8 J H 3 ^ #.+.=.{ _ / 6.2 ' G O ! b ! ` E =.;.o D [ d I -.'.u G 7 #.i.{ G } 0 >.B < 7 '.a t C P p ' v ^ & $ % s % % s % % % : 5 h o Q 1 e 8 S S 8 N ( g - & : % % % % : = . q + @ _ } ! z ! p F @ w % % : | | : % s % % s : = ] 4 * ) # & @ ' m Q 2 c ( 7 f I T # x ] x . ; q I Q U Z ` %.2.(.2.:.[.i.-.Y E ' y : % % % % % % % % % % % % % % . 9 l M a Y U i 8 &.S 0 #.j K [ n 7 ! h 9 6 y y q F h v k O ' g G g o b f z , 7 b J 9 4 : % | ^ M e <.,./.:.[./.,. .Z &./ f I k o E 7 P ",
-"] v - ^ y F ! / R S L L 8 [ e W i.~.,.'.[.a.e.f.8.^.a.|.[ C ] ! c O , h ; 5 + 6 9 3 # 3 ^ ) H H ; ] * ) 6 _ G P + 5 m [ L A q v } B ).-./ G J Y A '.8 h.e T 3 q < v k B '.b h + 4 H ;.8 Q m ' X =.J H - l O g '.N e *.S m E W 8 d -.r D { '.m S S l m ~.[ g C 8 8 b >.c z ! V ` Y q H b ) > & % % % % % . 9 M d N [ K <.0 K r / ! P w : % % : : w ; @ L g F l v k ' t q 5 = % % : # ; # * | & 4 $ % ] - C P h v h ] . y l O M o I ' G < y x = & = 4 6 h b n 0 -.$.j.~.[.6.7.~.).-.Y E p ^ | % % % % % % % % % % % % % % | ; F J E N Y &.8 8 i j +.~ X #.8 e 2 f o g O ' G G O O M z u u B a Q 2 ( Y Y V 7 M F ; : % | 5 g V +.>.).6.a.^.{.:.,.X K R V { 2 1 c J ",
-"4 _ F 6 _ f ( L X W W @.` Z U N 2 { r #.'.:.j.].j.:.,.2 + x ] < z t T 5 ; 5 H - T ) y - _ v > T ) 6 P h v v > ^ x x 4 3 + T t J - T M 7 _ y 9 2 V b A ,.M h _ ' g G Q W 8.S &.! 5 ' /.8 K m l ).0 h ] * 9 O i .k -.).m g 7 :.N u ,.E z (.Z t .8 9 A _.o t o 6.W V ~.B 9 e 0 @.~ E ! ` { r * % % % % ! 1 q 0 >.[ !.$.~ <.#.L c m _ 4 : % % : : & . x k H H - < v _ T ; = % % $ ) H H 6 + E ~ h % : 9 G ' g b b I 6 = | 4 ) y ^ ; + + 3 # . = & * H t b , [ -.(.:.g.{.7.7.6._.,.Z A ! P . : % : % : % % % % % % % % % % % = ^ F O Q / R L S 0 S ~ ;.;.;.#.<.L r c ( 2 2 a u E u d / n ( N &.8 K S 0 K Y { m J ) | % : * I V <.>./.g.^.q.^.6.).>.W ~ S i U j 0 I ",
-"x > F < g Q R X ;.;.@.W ` Z U 1 7 f D ( 8 @.$.'.%.X d + 4 # 3 5 5 + @ q - q - _ l F - C - < v v J v h _ l l _ > q 6 6 5 y T 6 ^ ] 4 * H h < h k ' k I M G C @ T h I e ` W ` A O l ! ;...n A Y }.` u H x 3 J =.%.<.2.i.E @ ~ X k ~ Y m M 5.` L r.+.C #.&.t k i 6.( G _.' f ).Y U ' t u @.Q < = % % % - , a 1 $._.$.q.5.+.~ ).|.{.n t @ m f v y C $ . y * * + - F < F 3 = % % | l _ P < q y u V ; % : T M E E Q a D v ^ 4 & $ : : % $ $ : : | w y C G D 2 e j _.~.j.].7.a.].|.$.+.Y z t * % % % % % % % % % % % % % % % % % % $ + t u d N K 0 Z ` .%.$.,.W X +.+.Z L K 8 [ e n 1 R K j j j +.` X ~ ` #.j N Q o - = : % 5 k A L W 2.}.].6.[./.'.!.W @.+.Z ~ ~ ~ O ",
-"x 9 - v O a K -.%.,.'. .@.X K e B } G o B r #.X i b y + H - 9 @ @ y + ) 9 - q q < - T F C H T C _ t v h P ' z ! G } I ' G l < 9 3 x w x * 6 G ! t q ) ) - P > - < t o m d M h 9 C < ' 1 ~ ~ &.8 j i f F h f &.&.O +.K T < ;.A D (.2 V f [.G +./.D D ~.<.G - %.` v , 0 h i ~.M t h q 8 8 > > x | : % s ( j > [.7.#.B.2.Z |.B.i /.,.! U ' e 5 } { 5 v &.M ; 6 V >.( 6 w : % = F -.Y A o P - @.} $ % : 6 b { 2 n e n E M G v h H ] = | | $ ] @ P I ! { c i ..a.h.B.].].8.8.[.i.W U A o @ : % s % & | % % % % % s s % % % % s % % . > o E / &.<.X !.,.2.(.'.@.` -.;...-.@.W +.Z Z Z =. .!.W @.;. .>.%.'.%.W 0 1 z < ] % $ 5 J Q K =.2.}.~.|.).i.,. .` Z Z +.` ` ` M ",
-"w 5 + _ I , R ~ .'.,.-.` j R { M _ v t g ! , 2 I + ) C < 9 ^ + 6 ) ) ) @ - P q q @ + P ' h y ) ) 9 v v - _ k p k I g I _ k 7 1 2 g 9 ^ T C < H 3 4 w w ] ) > _ g M _ F < C 6 6 T 9 k E , z f f m M B D b B n ( 2 1 D 3 y b } b A } I m { / R J g 7 %.S , / g.a D K > 9 X ~.g ( T ' !.} < v > ] $ : 6 X + k }.&.L e.#.X l.~.[ 9.>.z ( B f % B ! ; V @.G 5 c V [ A & % % % 3 Y /.K 8.j I d ,.4 % % = J { ` V R .#.K U Y n Q z } h q T F v } m d 1 U j ~ E.}./.j._.[.:.).;.#.U A o F & % % # m E x % * 3 | % % | $ | : % % s % % x C } Q n 8 X ;.(.2._.%.W =.W ;.!.%.'.(.>. .>.%.'.(.,.!. .%.,.i./.:.}.(.@.S Q ' 5 : : * J , [ #.,._./.i.,.!.-.X 0 i 8 j #.+.#.' ",
-"& 4 ; F J z n L +.-.-.<.i Y 2 f h H 9 > P h k p H ; 6 q T + 3 # ] ] 3 ) + - - 5 * # 5 F P ) # ] ; y C J I k < 6 6 P I F + < ! D g O _ p G p } z B _ ; * * 5 @ _ v > ^ # ] 3 C p F H P k M ' _ 9 y @ _ ' B U +.#.0 &.7 P q < k t H T } o P y h ' b O m ! E 8 .S X { l T 1 ;.[ M } c [ 3 @ G g _ w = z f & S i ! |.).~ ` A.@.Z e.8 p ' >.^ 4 i # x <.Y * v ;.o m $ % % : * q !.!.{ *.i.E =.Y | % $ E @ j $.Q ..A.:.}.d.>...#.[.^.[ n 0 8 r K r K Z @. .5.p.(.i.$.$.'.%.X S e Q o < x : % $ : +.{ . % } { x % & ^ 6 + ; w : : % % % 4 C O 7 V L -.;.$.2.%...-.-.W %.$.2.2.$.,.$.$.(.>.....>.$.2.}.g.8.7.j.'.X 1 M @ | | ; p E e <.@.%.2.%.W ` Z j S &.r r i L j G ",
-"$ = = 5 C O 7 V Y i 8 r e Q o > * 4 ] ^ 6 > < ) 3 ; ) y T T 9 5 # 6 o } < + 4 4 * > > 6 3 * 6 J m f G G h + ^ ; 6 J o G _ v < - P } o } t ' E e Y z p v ' o G _ _ t H w = w 5 > h h J O J h k J H ^ + J z Q d , m I k I p p u { u o m b 6 # 9 J ! u b p u A { ! I } p P h J G g O m b + 6 } b J ) ] d 4 + [ } z }.;.#.+.r.<.|.,.! b Y i.v 1 D = } =.t * d +.w : : % % w 9 M ].8 Z B.=.V 6.G : % e _ T (.2 u %.7.F.).K.~.:.d.}.L.'.|.^.h.7.a...!.$./.7.m.y.{.).h.].|.#.i [ 1 f k 5 | % : = ^ X ^ % % ) H : : 3 - < < 9 ^ 4 : % % % % . - p m ( &.+. .,.,.!...W >.,.2.:.:.i.'.>. ...@.-.;.%.'.|.j.7.e.h.a./.-.r m > & = ^ J z V i ` @. .-.#.L i 8 R 1 V 1 N r U I ",
-"| % % : ; P G m E a a , 7 o q x | | | & * y 5 3 ; * ^ C l C - H C g k h H 5 + J M J q 5 T b / [ S ( _ ; ] ] * @ P C ' , o k > 5 ^ q f I y H } D M J v f ! } t h o N 2 J + ; @ l I k - ; 4 w x 9 _ _ 9 > k I } f G - q > F ! R L 8 S S V } P G p ' } P k O l @ 6 p ! p h p t - q T 6 F v l t P H q ) 4 $ | ; - g N c e 8 -.!.-.u D E e >.n ! - ^ Q U < F { L 6 M : : | ; C [ |.R [.:.( Z |.5 | G c & c ..o B Y $.y.$.y.~.s.L.1.x./.6.E.G.7.:.)._.:.~.a.v.}.$.e.x.'.G.i r +.j.d #.| % % : | m r % % ; ; % % w 9 P t v < 9 y w | % % : s = 5 P o , N i X ` @.@...>. .$.).).E.p.'.q.9..._.{.$.2.{.g.q.e.F.8.|...&.z > $ $ ) J E A R L #.~ Z S r N c 1 2 a 2 2 e Y v ",
-"| | % % : ] + T l G g o b g C ] | | $ w 5 3 ^ 3 5 + H H H 6 @ @ 6 q q @ H P J ' l < l k B e 1 d 7 b h - t u , u ! p I l y * ] ] 5 J z g _ C p G C + @ P M } - C ! Q E g g g J J T H C ; & = & w ; q l h F > h O o < + y > t O b z , m p _ t v p B Q Q Y [ a v + P u M < t e ,.-.( t ) y J g ' _ 6 y H x $ | ; < ' D A c Y n , z u E E B z k h - t l x % P E G % % : 3 H k (.|.=.i./ { >.!.m 3 / 1 D X @.{ { N 2.A.2.[.j.4.p.6.[.~.{.4.a./.}.}.}.}.:.r.0.%.'.0.i.@.r.S ( [ @.V l : % : : = j ' % 6 E Y 4 w , <.h <.(.t _ o / T w C $ % = $ ] - } B n [ i Z ` ;.;.!.i.).(.G.J.;.{.A.Z r.e.i.r.J.h.x.M.v.7.|.@.&.z T = $ ) t z ( e K S S U c V a a Q E z Q 2 / ( C ",
-"$ | : % % | . ; q f t _ g -.A # $ | . 3 + ^ y ^ ) + ; ; y y ) ^ y q 9 ) 6 h p G - 6 _ I ! M k h G Q e e S <.c d b > ) F G h 6 C J h q } Q f p > 5 * 3 q g o l C J } J p } g k v C t f J J F 3 + q _ I h + 5 * ^ l v > C l l p f D k C T H J o 7 ` ^.H.D.y.5.W 7 I g } C 9 n a.B.e.>.M q g u b p T ) y ) w $ = ^ < p m Q A d f b M o M ! b g p P @ ; w % s % % % % $ + C 1 j.L R a E 7 U n ; x m m I Z #.A a 1 _.1._.>.j.v.w.a.9.[.w.A.'.i.(.(.,.,.$.s.7.X _.B.&. .a.u q c V : : : | | w l -.4 = l L [ . k M i &.0 %.G 7 Z |.} E Z & . O i % l ` v D B { 1 U Z ` @.>.i._.f.N...|.0.:.[.#.(.l._.:.j.u.F.:.$.Z c b @ | | ^ _ m ( c &.U 8 c A V ..! b M M z d , 7 q ",
-"| : % : : % | * A U l q l #.C & x & . ; 6 > 9 ^ ; # 4 ; 6 @ ; * ; H q 9 H + y 9 q H 9 < p k J 6 > ! a n 1 E M O O J p 2 8 V , B ! J < I _ @ q G < 9 _ v v o O v v - 5 ) P p h H T p z u b I ' m O J I p q * . x ; > p ' g v _ k _ C C 6 ) T C } &.2.9.p.N.F.2.N I I M k F k a N R 1 D k J F q < f G y < H & $ & ; T p b D b I p I p o b m b I _ @ ) x $ : : : % : 4 q f 2.>.u m ! M o I P 4 % = . y ' o m 7 r 8.:.Z =.i.l.G.7._./.F.j.~ Z X X ~ +.).F.X 8 !.'.Q '.i 3 < S T : % : w * > [ [ ^ # I +.- s . / +.b '.K m A W !.a ).u & + q K 7 I O 4 q t G b a N &.S X >._.h.4.$.i.y.{.~ !.9._.$.i.8.I./.$.;.S { } 5 : : # - , >.r e r r ( d a ,.' p k g ! m z f 6 ",
-": % % % % % % T ` N < 6 c Y T 5 ] w 3 H @ H 9 H ) * + _ H * x x ; y - > + ; 3 @ h _ q 9 6 y H @ 9 U 1 o g ' J > ' z 2 S ..i a m O l 9 y @ _ a r E ! b k J l @ * 3 * ] 5 t b O ' C l } k > 6 q p _ _ } ! O _ ) 5 @ P F 9 H ) 3 y l p p t h - C g u , U $.,.e 2 d f D O I z , I T - > J G l F T y 6 C > F k y $ | $ . H _ l _ F _ t p ' O o O I v F @ 3 4 w $ | | | # p [ $.#.b o O O G l 9 . % % : ; h / Y V Z ;.r U L #.=.W -.~ #.` K Y c Y r [ K /.6.( Q n <.V A ; 4 Q ( % % $ ] @ P z /.K M _ L Y ] $ l 0 t ( (.E , U ~.S .~.I 6 w 4 ( f % $ : | w ; 9 I f 7 A Y L -.].m.]./.D.$.-.f.[.@...%.l.z.8.D.'.R 7 p > q < # h X |.{ ( 1 1 , } _ O C C J k ' o M G 3 ",
-"s % % % % % % } L _ q H !.O / @.^ 4 5 A +.v - C T T m r J 3 w 3 z 7 ^ * ] * H h _ q 5 3 5 T l h F e O T 6 h C + v ! { ].[.{ m b v h } E ( 0 0 / M ! E M ' } ' g l + 5 T p g g J _ P P 9 ) ) < D M I o b t < J J G G F _ } } l P 9 9 9 < t v ' g ! b B , ! h G u K ].7.~.~.'.d @ ^ P l < t A Q p 6 ) l M b J w $ : : & ; ; 3 @ > v I } } } G ' t P > H ) # w = & x # 9 ' D , D f b b O h 9 = % % | ; t U Z U &.n N [ U 8 0 j i r ( { / A Q ( r V <.:.[ u f g I F x % 4 h 9 | ] ) _ I b n ).i ! o =.d C @ { ! l >.W &.Y ~.B.i.~./., I l C [ O % % % : : : & 3 F v ' z A &.!.p.6.G.p./.:.}.X -.@.).L.q.8.d.,.R { 2 T V ( 3 E ).#.V 7 a 7 ' b a p F < u , p v J < x ",
-"% % % % s % % N z x * b @.z ' ` x . S P !.k 6 > 9 q g U S d G U i.K U { M N 0 Y O # ] ; - C P > 6 6 5 ^ q I P y @ H T !., h g } v g Q Y N n d M g I v l t (.` V D t l k l o D + 3 q < ) # y ' f M } t _ < p g } J J m [ 8.E.^.<.z _ F h _ v J 9 t M p k } _ C k ..O.P.Q.R.S.H./ 6 T C @ k ).4.w.N 3 ; < h P ) = : % % : % = * 9 h v t h l t v _ C 9 ) * * ; 3 + 6 + > h J G } o m b g t H = % % % x T O 7 u B Q / n 1 c Y R 1 2 B B d B B 1 ~ 0 i 1 t h F 6 w : % % : % : * > G D , A n N d M I D > % y b 5 J #.N { U ~.j.(./.$.r Y +.( / L P ' 2 - % s : = 4 # ) q G E ~ k.f.{.l.x.2.L #.+.@.8.s.,./.k.0 U ..o 9 &.q ; a !.O o b o g z i W f C { +. .k T 6 3 | ",
-"| : : : % % ^ +.5 : | K r # J n x , U B D ) ^ 9 - > g X C > O ( $.h 8 e.@.L ..c X ) t r !.].6 H m b ; y P m u B _ T O ..^ 6 G h 6 > l p l F k G t < P I E 2.Y ! t f O l > @.W h l z Q J H @ C O I P F < t C 9 _ J h } A =.X N E g ' G G k I ! J - 6 3 T I ' v l 7 -.7.9.r.F.6.V l h p h t R 9.T.F.M 5 F F h 9 4 = : : : % | x + F C > - C < F - q y 5 3 + @ 9 - < h G G G O o g M b g t q . % % % & 5 P } ! D B Q A / V 1 c ( a { a , z g ' ! z _ + ] # . : % % % % % | ] - g E ( 1 Y r ( a D k F 3 : : % & H J b a c K L i X i V #.~ M D Y 9 v 1 H | x # ^ * x & x T } R g.;.=.x.a.~ i L 0 .r.g.;.^.^.S !.+.9 ( { | 9 U c J p J J _ M ;.+.h k j Y } P H ; & % ",
-"| : % % s | m X - . - ` C 4 1 t ) =.e w w x ^ 9 q > P ;.O _ v 1 -.I $.q.7 0 S E V b X ^.Q { 9 D (.'., a N g d $.v ^ Y ( 6 C P P p G 7 M J ; F < g J > o D b ! m 2 ` v J < ).i Q U <.V M I h > b _ * ) / ;._ < g O _ Z { ' _ < b m l } { j 7.F.x.}.K g F v D b k ' m D z u f b M M o ' J p f d &.( k P ' I t ) * ; . : : % % $ * - C T T < l _ < h F T > < h t J ' ! E u u E E z m b } v - ] % : : $ ; > g u B d { A 2 1 N r c [ r / 7 o _ - ^ ] . = : % % % : : | & = * > } u V Y [ i U r / , b h 3 % : : x 6 k m Q ( e r Y c ( ( n V 7 ! ' v 6 6 y y C l t P H w | 4 P , R a Z ).-.Z 8 8 S :.*.>.].*.@.=.[.<.7 8 f = M ~ M _ < P < < / ;.7 h t 8 =.p _ 9 * = : ",
-"$ : : % s & D V ^ 4 f { 9 - n # > '.e H J x y ) 5 H < ( K T v !.1 O ).D } i./ 7 f c !.8 h ) F -.k.>.N #.=.y ( r @ O 6.c a o y - P d Q 8 g C N A z 0 C O 8 c P o ;. .G ' &.f.e r &.A G J J F t @.} ; 3 N X k _ v b m ~ Q o 9 9 g G 9 ( {.:.g.x.5.a.'.a Y Z c o I } I l h p } M ' C v p k ' J _ I G k g g t q ^ 5 + 5 = : : s % 4 y 6 H > > l h v J p J I I g o ! E a A A / / ( A Q 7 f k - # : % : & 3 q k D B d a 2 1 R K 0 S j U 2 f p > * : s % % s s % $ w ] * ; 5 q p m 2 1 8 i L L i c { f v ; % : % 4 q G D { V r r N c ( / e r 1 A 7 ! I J v k o M o O v @ & $ 5 h ' D n K K S i K j (./.[.^.(.X ` (.&.E n } y { =.a t F < - o ` ..d f O n .d t > ^ ] $ ",
-"| : % % s % 4 ; % $ H H P F & x - e 1 P * ; ; x 3 I 1 M Q 3 7 .O ~ z - u (.2 D o O (.g t f i k.a.b M >.f p ..B R g.B.a 7 G @ 3 3 V f c P <.` 2 Q ;.! n >.U ) } ).o P h '.+.V j.r M H ) P o <.7.V ( K 1...B F _ p F < G _ @ q _ l l k ! ;.i / A A z v Z j.r m v _ P H y H - _ o ' ! m z ! F y 6 T _ t T y y 9 > l } ^ | : % : : 3 # ; 6 6 F t t G I M m u B a 2 1 c 1 1 Y Y N e 1 2 u ' C # : : : . H h k ! , Q / n r S 0 #.` #.8 A M l 9 x % : % % % : x y @ 6 + + C J O E 1 r S Z <.0 S N d ! _ x % % : 5 C g B a ( e e n / 2 V n c Y 1 / d z b o O E , , E g P y & x 6 v O Q 1 c r r Y U K ~ ..!. .X K Y m q > # . I D _ F > q T O L R b 7 1 K L , G P T 5 $ ",
-": % s % % % % % % % % % : $ . # 9 T 6 3 # ] x ] @ p E t w q j ` m H ^ 6 b +.( f k k ~ O d A Z 9.~ N 2 >.M <.g.&.#.8.W ! g - 3 @ g =.[.c e 2.U C e d 3 B -._ q &.%.> @ I ~.r g ..M t ) y k Q g. .c n #.g.( 2.&.k a ,.j.;.U <.j f _ 1 X ).].2 O b m b G ...C v D %.=.V O > H _ ' 7 .d.U.u._.O 3 * y l _ - y 9 F J M v . ; ) # % = # ; 3 + T h _ J I ! B A ( 1 e U &.&.8 K K U &.R 2 z } l 5 | % : ; F p } f , Q A N [ 8 L #.X <.R A f k - w % % : | x 5 9 < > C C > l } M Q e &.0 0 j L 8 V , o - & % % $ 5 > ' z Q { ( / Q d , { Q / c e N V 7 m b b B a V A f J H w : * P } z 2 V c c r &.0 ` ;.$.%.@.j / ! T = % | * ) 9 - T 6 @ > v I p g 2 r d D b I h ) | ",
-"% % % % % % s s s s % : | $ x ; 5 H 9 H @ # 3 g d ) & x < r @.F w x ) h k g J 5 @ < B B - @ ! &.! _ , K D ~ (./ e ].=.1 < h ' c #.:.q.z +.W J O @.H H ~ c C g -.n o } &...> T X F < y @ h , :., o B %.L c X >.@.l.V.c.x.[.{.W r m j.2.K I > @ @ F _ M [...~ a.o.W.X.O.H.@.r X 5.K.Y.Z.Z.`. +s.{ 9 _ O D e ' 3 5 T > @ # u X x s | . 4 . ] @ 9 > h ' m d / Y Y U U i K <.<.S U &.Y A E g l ; : % % # C } O f E a / c r 8 8 i S U n a z k C w % : . 3 T C h l v k t t k } b { N &.i K 8 R r 2 D p 9 = % % & ^ C } m u 7 B u D f m z u 7 d V e V A u O ' f Q / A f J 6 & | w > } z a A V r [ Z ~ ..%.'.,.;.#.r u P & % : ] y q q F T T C h _ J G O f d d u o J H $ ",
-"% % % : : : % % s s s : | & x # # + ^ @ y 5 q G @ w x ' ~ >.Y ; w # @ y ^ ] x ] > G t - @ * x * ; @ J J T k O + h c f F - p u / A K .a S R ' 2 } P { (.<.[ Q ,.V P t 0 D ; { K p v H 5 F [ <.q v c _.b l /.|.}.p.K.7.-.+./.! D B <.k C 9 q q q v E -.C.v. +.+++@+#+$+%+&+*+`.=+-+;+>+>+Z.,+Y.J.,.g.'+I.n.1.u 4 x 3 < _ A / : : = 4 4 $ | $ . ; 6 t O 7 ( N [ i L S L j S i &.r c a , o O w % % % ] F J k M m B a V / c c e R c A u g v + : : . 5 9 C v J J p k _ < l G g u a ( n V n / , z I F ^ | % : | 3 > G o b b O I k v v k p ' b 7 a d E ! p C h ' ! f k P ^ = = . T J o ! E A e U Z ` .. .>.!...#.r E q | % % & 3 y - C q q < h h _ p O m d , D o v 9 & ",
-"s s s % % % % % % % % : $ = . w # 5 ; 3 ) 6 C T + * + p E A u - F f J * w . . * 6 q - H ; w . w # T h l C 3 ] 4 * 6 h > H _ G J o , a ! M r n ' J g R %.Y B 1 <.b y b K h ! r l - p k - M ;.R < k #.S ^ u _.e +.*.%.D b Q i.R D D ~ B.g.-.U c 0 ~.t.)+,+,+$+!+-+~+~+;+{+]+{+^+/+(+>+_+~+:+++!+&+<+[+}+}+|+1+0.=.< I y 9 ..Q ; ] 5 @ ^ w | % : . @ h ' 7 2 N &.0 <.Z <.!.-.i [ Y V a ` [.B = % : : # C G G ' M m B { 2 A 2 c N 2 , ! k < ; | . H > P v p I k p v F - P v M ! m B B u E D g J h T # : % s | ^ > v I I I k J < q 9 > F < p O z u f o t 6 ^ 9 P v F 6 ] | = ] 9 h } O D 2 e K Z ~ @.W W -.+.S 1 z q | s s = ; y - F > q h _ J l k } f u u D g l 9 . ",
-": % : : : $ = | | : : $ & ] # x ] ] ] 3 ^ 6 q @ y 9 - 9 5 * * C M G 6 4 w * T h 6 3 4 w . 4 ) t O _ @ ^ ] w w 4 + h ' _ - H H 6 q p k 9 q ' ! m } k O b o G h T * ; M D ! / } q T q + ; p L E C B ..V 7 Q z G #.g.Z c f 7 +...Q .L.2+X.3+4+5+X.)+`.!+#+$+#+~+6+;+6+(+(+^+(+^+{+{+;+-+_+=+@+#+7+,+,+W.8+&+9+0+a+{.` H v #.o Z -.- O Z #.y $ | $ * H v M Q e 8 j <.#.!.x.#.r r 1 A d 8 !.5 : % % % . @ J k G k G ! f b f B Q 2 Q E O _ - # $ ) l m { G O g t C 9 @ @ 9 _ G I g I p l J < > T T 3 | % % % $ 3 6 _ J l l l C T 5 ] * 3 @ F l k O g k P ^ 4 3 + 9 y w : | & * - J o ! z 2 e [ L Z <.` #.0 i e d g 6 | s : $ # 6 F C T H P < h v k g ! z D m } h 9 . ",
-"% : = & # y y 5 # & = & x 5 ; # & & ] 5 3 3 ^ 5 ; ) @ ) ^ ) 6 P > T 5 ] y v t T # . & 4 T G z d k 5 x w x ] + _ _ H > k h C @ 3 + h < ^ 5 T l l v p O p T P - y 9 F T - l g g l H # 4 4 ) h C > M a 2 i o - P / &.M P B U 1 V -.b+c+d+e+!+=+_+~+~+;+_+f+!+:+6+(+g+/+/+/+h+h+]+{+(+6+g+~+f+>+i+%+$+d+}+%+&+|+)+Y.U.z.M u Q 9 ( b } i Y A H 3 | : $ * > } / -.}.e.-.@.a.1.+.e c 2 Q a W / x % % : : % * > v v h l p t v p O f V #.B g v 6 w w < Z ( $.a } I h 9 @ ; # ) - _ _ h C 9 + ^ 4 ] 4 = : % s % : & ; @ > h P > 9 y # & % : | x ; @ C l v P T ^ w $ $ . & % % % | 3 F G o m z Q n 1 &.i L K i r ( Q ! l 5 : s s $ # ) q > H 9 q P F _ J g ! D 7 f I _ @ = ",
-"| 4 3 + y > < C 6 ; x w 4 ; * . = $ $ & . 4 ^ ) # ] @ + ) y C _ F > T 6 F _ > T 9 9 > g m k v < ; * ) F k J J k T @ @ 5 4 w x ; F } J F @ @ 6 ) # ^ J o ' m G P k I ' M O J + 4 4 ; 6 - p ! b ' k } g m v ^ 3 ^ @ q F t u a j B.X.,+++~+g+6+6+g+/+^+(+;+>+>+/+g+6+6+{+j+k+j+h+^+6+(+_+f+;+:+i+++@+8+e+$+}+)+Q.Y.4+t.[.8 f m P . I @.+.G P @ ] $ | x P ( W &.].a.0 !.x.2.K r c / Q [ $.v w x k n I % w ^ p } o h q F < _ t 7 !.).u } _ ) # 6 R S G B I J v P H 3 # . * y 9 q H 6 ; = : : % : % % s % % : x 3 H P _ F @ 5 * = : % % % & ; ) + 9 - 9 3 # : : $ $ % % % % % * F } ! m b z , 2 n N r [ N / d B o P 4 % % % % & ; H H 9 @ - - - h I O D u d E } t - . ",
-": 3 @ @ H P t v P H 5 x w 5 ) ] & = & & . ] ^ * 4 * H 9 + * 3 y y + 9 > < @ 5 H I I G G > q P C > T > ' O h J ' 9 * x & = $ w 3 6 9 6 - 9 3 ] x x T b b v J C v b G I l F J F ^ + l M g ' G ' k I O M b J C _ I ' o u n Z ~.L.4+Y.$+=+g+/+/+6+g+g+(+6+-+-+g+(+g+/+^+h+^+(+{+(+/+6+g+~+=+@+%+d+Z.$+d+e+l+m+W.m+n+o+c.v.!.2 / * y h 8 %.z _ T # $ | x f ~ 1 j 8.` 8 :.f.j &.N V 2 1 !.~ 9 ; g / f Q : ^ } p c U @ 6 , ~ e v [ [.@.f J P @ 5 o @.u _ J _ C - y * ] = = = x 3 * x ] & % s % % s % % s s % % : # @ - > 9 5 * w $ : | * $ 4 3 3 y H ) ; w : % : | % % % % % % = ^ < p _ t G b z B d A ( A Q 7 ! k - . % % % : | 3 y 6 + @ 9 - P t ' O u d { B o p F . ",
-"$ + > 6 T P v t P - 6 # w 3 + ) 3 # x w # T ^ . w # ) + ] 4 ; H + ^ 3 ; 5 3 3 @ < h l h q + ^ q l > T P t _ p F # . & = w y > t _ y 3 x & $ | $ # - J } J - y 9 H @ C > q J o t v ' g o ' h t o ' v ' A S $.[.7.f.x.k.d.u.V.3+)+`.!+_+/+{+{+(+-+;+-+;+g+/+(+(+/+{+]+p+q+p+k+/+~+_+~+:+@+e+l+8+l+,+d+7+.+m+r+s+t+4+5+u+'.S %.c n m e #.n 2 J ; = | # 8 +.{ /.(.r @.7.$.&.c 2 2 { L ).1 < ! Y , } ] * z M P &.m ] } V q J p Z (.B M G > F k U L o v B ` ( l + h m k < 9 w x . ] 4 | % s s % s % % s s s % $ 4 ) T q 9 y # x & | x J + 4 ] 3 3 ^ ; = : % % . 9 F 5 | : : % | = 3 @ @ H C v } M b b D m m f M l 6 $ % % % % | 4 ; 3 y 6 > < k O f m , A A B b t - & ",
-"$ H C - F h t v _ F y w & x ; 6 C F 5 ; + 9 x . w 6 ) x . w ^ T - 5 4 # T C H + 6 ) ^ ^ 9 ^ 5 - J l _ _ I _ @ F > 3 * T k I g o F x $ | : : | & ^ ) 6 C 9 ^ * ] * q } v 9 q v f D u f E g G M M k D 8 i.f.k.m.b.O.v+2+X.Y.`.w+$+@+~+g+^+]+^+(+/+/+(+-+6+/+/+6+;+;+/+^+{+q+]+-+;+_+f+=+!+$+l+8+7+}+m+c+c+Q.)+<+3+v+4+T.:.U -.n b V S z m ..D 4 $ : 6 0 X L ~.2.K }.x._.i 2 a / n (.:.a g i [ @ s % f A _ c [ - ^ G U G T D ;.j o ' G P C O e } @ / [ G R c < 2 Z Z c ' * x . x g 1 F } m 5 < p x s $ 5 # & ] 3 H - q + 3 ; ; 5 * h ! . w 4 ] ] 4 | % % % 4 , ` Q w ^ / t s $ 4 x # 3 y - < v t I ' o o ' p C 5 | % % % % : w * ^ T - v G } ! u u { / 2 7 b p T x ",
-"| + - T > < v _ F - + w & . # 5 y + ) ) ^ ] . . # + x & = ] T ; w & w ] 9 h F 9 ^ ; 3 @ < F 9 5 3 5 ] # 6 h T > P T < G O g P y 3 4 & = & x ^ F C y # x = = = = . + t p p l P v _ > q l } } ! Q r ..7.0.b.o.O.V.x+9+)+`.w+@+>+_+6+6+{+]+^+^+^+^+(+g+;+-+(+(+/+/+^+]+{+/+]+;+>+6+;+f+++$+l+y+y+}+c+r+r+W.W.[+<+X.1+U.u.6.Q f O l T > > u +.k & % : ; u , d +.i c ).].~ n { / / Y :.).&., <.N k q + r n D .e F q F L V - N -., g I v > T d 2 5 < i m G ;.n C 1 W R M C 6 ; 4 3 2 [ O N r I N n ] | P N N H & ] + q 6 H C h < P > z e | = w . = : % % s | ] Q [ x : v c | | $ x w = & # ^ @ H - P l J p t < y # : % % % % $ # y 9 > h I o D B , Q A n V , m ' F . ",
-": 4 @ + 6 F < p m T y x & & w 4 t .9 T + 3 ^ ) y ] . x ) v @ & $ = ] 3 5 ^ # x x x # + T P < ^ ] w & # 6 H ^ 3 ; 5 + @ 6 9 ^ 5 C v 6 y q C C v F ] = | : : $ . 5 q C l g G @ ; ; 3 3 ) C O ( <.(.z.v.u+O.c.2+<+W.}+w+Z.=+f+:+-+g+(+(+6+(+(+{+^+{+(+(+_+_+g+{+^+^+]+]+]+]+(+g+g+_+f+#+w+y+r+&+&+.+r+P.Y.P.|+X.0+1+O.I.[.o q t q ^ @ F } J 3 $ : : x @ h k g 7 c j S ( A 2 / / 1 #.[ ! p / [ < = 5 ( a 7 -.c l { I R Q _ X ,.n ' v C q q &.m : ' [ _ m .., _ +.<.' G p _ > y 5 a R _ ( [ p 2 o % G Q u u 9 = w ) 6 P v I 1 L b < / S y & | % % % % : % & C 0 d $ $ k O : | w # & | | & w 4 # * + q < h F > y ] | % % % : . * y - P v k o z d { / V N Y / , O _ w ",
-"| : & & # @ < L / q 6 5 x . & w T { @ y 5 + P J P ) ; F X +.x . w ^ l C ) w = $ = . 5 - _ 5 ; . = & w ) > h q ; # 4 w x ; 6 y 5 y v ' } ' l @ - v ; & = & 4 ^ h } p t I J q ^ 3 + C p Q L ,.~.f.l.t.a+3+[+&+8+w+Z.Z.=+:+f+:+-+6+g+/+{+^+{+^+]+h+]+/+/+(+6+(+(+(+^+^+]+h+/+g+-+g+_+:+!+i+d+`.c+&+r+&+Q.*+P.|+z+0+1+A+u.[.O + l H # + T 9 ) x = : % w ) C v O 7 N R e 2 2 ( e e Y ( B O J - ; | % & > _ t B I - z N u < I S 8 D J P h @ I U - % ' ! > j / h c 2.c b M ! O k _ d j h t [ h k M # 3 &., v 5 : $ x 3 _ G M b c 0 m v 8 8 H $ % % % % % % $ 4 7 X I $ & 4 : 9 7 B t p - | w q P + ] ^ 9 C h _ C - 5 & % s % : w * 9 C J I o D Q n c r Y R [ c 2 m P . ",
-"% % : : | ^ , !.m - k I @ y = & 4 3 # * 3 3 ) @ + y T g ~ M ^ 5 - p > H 5 w = . x + M %.n $ : : | & ] 5 3 ^ + * . & & w + l v H ^ + ^ 3 + ) 6 t F ^ y F p k _ J p k v T v } M d i '.a.E.C.C.L.D.'+U.<+`.w+%+$+++@+@+=+>+>+;+6+g+-+6+(+g+/+{+{+{+/+/+{+^+^+(+;+_+(+]+^+(+6+(+g+-+~+f+!+$+l+7+`.y+c+}+m+*+Y.<+n+t+1+a+B+e.b # q + * 5 ^ 3 # $ | % % $ # H l g u Q { E 7 a / Y &.r 1 E ' h @ x | : $ ; 9 q q q 9 - > T T q _ J _ < C 6 3 V f 4 : & O a J q C K Z E m E B u ! k #.a 9 i O $ n b & G ~ v & % : $ ] 6 J G g O I ' t o W 2 # % % % % % % % = 5 K U 9 $ % % k g f O H 1 I | I { j } * ) q h J I J F 6 4 % s % : & ; - l I M B a V Y [ r R [ [ 1 d ! P = ",
-"s s % : | + r &.h g n W 2 1 . p { - . 5 Q A > 5 ; 9 h d #.3 5 ) - h ) F t @ ^ + C J g ..> . = & w y q H 3 H ; | : $ . ] + + H q ^ ] x # @ H @ F l g g t < h < T I z h E Z W ).x.m.u+S.X.S.4+O.4+ +)+.+w+$+#+Z.++++=+:+=+~+_+g+_+_+_+_+~+6+/+{+/+(+(+g+{+h+^+/+6+(+^+/+/+]+(+g+g+_+=+!+i+8+&+.+c+7+8+&+r+P.<+ +S.5+T.b.q.B 5 5 ) 5 5 ) ; w | : % % : & ^ C G ! E u f z d ( e 8 S r { M < @ & : % | ; T - - - T P F H 6 9 - P P T 2 _ l c + : % | $ 4 5 H P M m o m Q { / d V 0 ! ! n 6 ; V l = J i g I # : | . 6 < v k 1 / O k R .G * % % % % % % | & p =.m # = % % O l { l @ V T _ e Q / t ) q C p O o ' l q * : s s : x ) - l O u { n [ S S i 8 U R 2 f k ^ | ",
-"% % % % : J <.! H M c Z Q l p K K q * f { N G y k z D i a ] 4 ] ^ 9 5 + l g O J T F R ~ ) 5 5 6 _ I _ ; - A H : | & 5 C > ; x & = = = ] y @ ) ^ + H T q q - 6 k r Z W ).h.F.N.O.C+R.r+&+.+r+}+`.}+7+d+%+e+++++++Z.++!+++f+:+>+=+_+g+~+>+-+6+/+{+^+/+(+{+/+(+/+g+/+{+/+;+{+{+/+6+_+>+++$+d+.+c+}+c+&+&+m+Q.[+<+C+S.c.b.5.Q H @ + + ) ^ ] . : % % % $ $ * T v } ! B B d / N &.j <.8 n 7 I H $ % | * H < l _ C F < > 6 + @ > P C H 7 } M ) : : : | & x ] ) q v I b u A n 1 n 2 7 ! ' h T ) H w : # _ I $ % | | & ^ > v ' X j O b >.Y v @ $ : % % % % | = c ` - x : % % = Q D ] u } * Y A ! H * 6 > v } o f O J F * : % % | x y C p f d c U L #.#.Z L K R A b h 5 $ ",
-": % s % w 2 K < - g 8 M ) ^ } ` f | ! R ! ' ] C / l @ / l ] x # H v v T ) 5 ) H ) k @.c F P a W c _ H k V K + # q t h 6 4 = | | | | = # H - - P q ^ 3 ; ] # k <.a +.^.r.C.o.1+D+Q.}+8+l+,+w+w+8+`.,+l+w+$+$+%+i+e+#+++Z.f+!+!+=+>+_+~+-+6+6+(+^+^+{+(+g+g+_+;+-+_+6+/+(+k+p+{+-+:+!+Z.#+7+c+&+r+W.W.*+[+s+D+X.0+v+T.v.{.E q C H 6 @ + ; w : % : : % : . y C G f A V 1 r L #.+.` +.S ( f > $ | 3 t k o g J < > _ C y ) 6 > q H + H H 4 % % : | $ = $ & * 6 C t O z Q n V V a E m M J h H # & : % % % % % % % $ * 9 F h 7 ! o ` #.o l H x . | % % : . T U U 6 . % % : w j J - a ^ @ <.u H ) + 6 P k O b M ' v H 4 : % % : w H _ g z { Y K <.~ #.~ Z S r a M P ^ & ",
-"% % % % > ~ <.k p N V ^ # H r S q - K a ] = ; A E | O z . x * @ H @ 6 3 * 3 H h @ , j < 6 E r p N n h a ~ n p m 8 .c w $ : | $ & x + v J h < @ 3 # # 3 ^ G W g...~.*.0.3.v+z+P.&+c+d+d+d+d+d+`.`.8+w+!+!+i+w+,+$+$+$+Z.=+>+>+=+=+~+>+~+6+;+6+g+g+~+_+_+>+:+~+;+:+~+;+;+6+/+(+6+~+@+e+l+}+.+Y.[+*+Y.R.s+R.z+z+3+4+o.v.g.B > h t t l h 9 3 w | : % % % | ; C G m ( N R j -.!.,.2.(.;.K Q v 4 3 h l k ' O G P - < q 9 - P C > 6 y 6 ^ . | % % | $ = | $ w 3 9 C G M D , Q a , E m b G l 9 * . $ % % % % % : : = ] @ H T P M j <.b } l T H @ 5 4 4 4 # T l ' 5 = : % % $ , g v 5 % * Y , p F 6 C t ' o b o k F + 4 % % s $ ] - t b 7 / N 8 j j <.~ ~ j r , } - ; . ",
-"% % % % P K 2 l B S k & x t Z Y I Q W , J 9 M N < > R z 5 H y 5 ; ] x w x ; 9 T t L 7 3 F e b < @.( ) / 8 _ 6 u 2 > g ; = & w # 5 H l o O _ H _ E &.d T ' .0.0.9.r.l.D.T.0+R.Y.&+}+8+y+7+w+8+y+}+`.l+Z.Z.,+$+$+e+%+$+$+#+f+f+Z.!+:+:+f+f+#+Z.$+l+`.w+#+Z.Z.f+~+~+_+>+;+g+-+;+-+_+++$+,+7+}+*+s+[+[+[+Y.[+<+9+3+1+a+4.a.( ' b z E z b } l @ x | % % : w y F I z / Y i +. ./.j.[.:.'.X Y f + H P l k J G k - @ > T - _ v v h P > F 6 # = : % | = w w . x ; @ q _ I o m m m f ! o I t F y # w $ : % % % % : = . ] ) ) + 9 D V v G I t v l _ P q y 5 # # ] x & $ : % % : | = = s s : T v 4 * 9 h p O f z z g l H x % % % x + C ' z { n Y U i L <.+.<.U 1 z v 6 ; = ",
-"% % % % ; t l v } G * = . > Q O ^ _ c &.b 9 a &.p { <.[ J 6 9 < l _ q + ^ 9 @ * E &._ $ J c - O W f > r o . & t r k T 6 5 9 h G p C < _ T y _ R f } W L X y.B+N.4.t.N.b.A+C+R.Y.*+r+r+}+,+$+%+l+`.y+w+++%+,+l+8+8+}+7+,+w+$+i+l+d+y+}+Q.9+x+t+C+z+|+R.[+*+r+`.,+#+>+~+~+>+_+_+;+:+@+i+8+8+.+Y.R.|+)+W.W.D+n+X.C+x+O.v.^.( g u , A A d D ' _ 9 5 | % $ ^ q _ G f Q c 8 ` !.}.].6.|.$.=.8 , h F l p p k ' t C @ C - > t I I G I p t C y * & : $ w ; ^ ^ 3 ; @ H - l J I ' g I G p t < 6 ^ 4 . $ % % % % % $ = = ] 3 ; * # 9 9 C p I ' } M o O ' _ H + 5 ; ; 4 . : % % s % % s % % s s % = ; q t ' m a ( A d b l ) : : $ ^ F p o 7 { c U j K <.0 0 i n Q g C ^ ] | ",
-"% % % : 5 < t v l ) . = = w ; 5 * ; y T 6 6 _ ! g f V J 3 - E W e.q.=., k v y . A Y z ; I o 6 8 d ^ a K } = ; + S Q - k O O O g k t ' } J h e +.m %.k.8.H.4+4+5+0+0+3+3+<+)+W.r+r+W.P.c+%+,+,+++w+y+i+#+7+`.7+`.d+%+w+y+}+c+s+C+t+U.v.m.u.U.O.u+A+o+V.A+o+5+0+D+P.}+i+!+=+>+=+!+++Z.e+l+7+r+*+Y.)+P.Y.)+D+z+9+n+3+A+K.*.R m { n N ( { B M ' J 9 . : x 9 _ t G M 7 V [ 0 W ).~.}._.,.` K Q p q C G I ' o I F 6 F q > p O M f ! ! ' v P y 4 = = 5 F F C T 6 T T T P _ v v J t t l F 6 ; 4 4 & : % % % % % | . w ] 5 ; w . # @ C } M b f m E 7 z ' v - + ) ) ; . | % % % % % s s s s s : x + P } ! , n &.Y / E G y $ % # q J O ! u d n K S S L S &.n , b l y $ : : ",
-"% % % | ^ < k I J 9 4 & $ $ & . . ] * # 5 ) ) ) 5 5 @ 5 ^ P D Z }.` z J C > - ^ g b # w * D r b ^ & 7 e t = O h U u @ - q + 6 C J v < P ' z |.%.S k.u.d.A+D+<+Y.&+&+&+&+&+y+y+`.}+}+.+8+e+8+d+++,+8+++8+c+}+d+7+r+}+R.v+2+ +3.3.K.9.f.s.u+2+K.K.0+3+2+T.3.b.'+w.y.3.A+S.D+P.}+d+l+`.8+y+&+W.Y.[+Y.Y.*+|+s+R.<+9+3+4+M.x.8 a '.f.#.( 2 a u m I P ; = * T _ _ k O D a 1 &.0 ;.'./.i.!.` U Q _ * ^ G I } o v - F > q v ' g f ! m b ' G h T ; & 4 9 C _ < > F h - F h > - C h h _ P H 5 4 . . $ % % % % % % $ & w # ) 4 w . # y P } M f D E 7 Q 7 f G l T T 6 * x | % s % % % s s s s s : * - J D Q c K <.L r a M - & & 5 C ' ! m E Q n U U [ &.r / 7 b t 6 . : $ w ",
-"% % % $ y l k k h @ ; x $ $ : : : : $ . ^ 5 * # # 9 C + ; ) 6 6 H 6 ) * ] 9 g l @ ) q l k J y w $ | y q . w G ( Q q * ] ; ] x . x x * q o f (.-.8.b.t.n.[+*+*+y+l+l+,+8+8+8+7+7+y+y+c+,+,+}+%+e+`.w+#+7+c+8+8+)+m+&+C+v+U.S.c.B+B+0.D.C.D.H.7.8.p.J.k.6.g.8.x._.` -.%././.h.b.C+*+*+W.m+m+r+*+D+D+[+[+R.s+D+9+n+C+4+o.1.S a i.(.N V 2 a , D g t ^ | * 9 P C J ' b u / X }.>.` '.2...0 N u q x # h J J k < F 9 T > _ J O o M O g } p P H * x ] 9 P l < F l _ > F q @ H H 6 y ) 3 x x = . | : % % % % % % : ] # * 5 4 & & ] H C k o M M u d { A f g v F F > @ 3 & % s % % % s s s s s % * F G z A [ Z ~ j r Q g 9 . $ 3 < o m z u 7 / Y Y V { B o k h ^ . : w + ; ",
-"% % : $ y h t v J H ^ 3 # . = | : : | $ & . x 9 ! ' T y ^ ] 4 x w w 4 4 # 5 > q q < 6 3 5 @ + & $ = . ] 9 h v _ y 4 . $ | : % : | w 6 h J ! K ~.k.k.m.A+P.s+.+l+w+w+w+d+8+d+8+7+&+c+&+%+7+l+%+`.c+i+d+`.`.$+`.y+%+}+[+z+0+R.0+4+3.t.A+n.v.0.F.C.b+0.g.%.|.].=.N c &.L ..;.` @.7.K.x+0+z+Y.}+m+[+}+Q.D+)+m+<+z+*+n+u+n.r.Z +.{.` N c / Q E ! O v ) = * @ q C l J ' D , !.a.X 0 $.5.(.[ Q I ) # T C _ v v l T ^ 6 T C v k f b g G I J > y 4 . 5 H _ _ P P _ _ < - T ^ # # 4 x & = : = | | $ : % % % s s s % w ] 5 y # # x ] + q _ } g b E 2 / d D g v J P T y 3 w : % % % % % % % % % : * > G z / 8 j j K r a ' T ] = * 9 ' f u u , A 2 7 ! g h q 5 w : | * > p + ",
-"% : $ . H p ' G v @ ^ 9 T @ * ^ ] $ $ & . x p X +.J ] 3 ; x . . 4 ; @ ^ 3 ; 3 # # x w w ] H 9 @ @ C _ v I o g - y 4 $ : : | | $ . ) h v O ( Z i.f.A.u.<+Q.Q.d+,+e+i+e+%+w+,+w+d+7+y+l+i+,+d+7+y+8+++$+$+$+@+e+%+i+.+R. +x+)+R.3+v+n+*+0+A+5+S.Q.r+C+T.C.F.u.h...0 ` ..,._.!.W (.z.b.A+t+)+`.W.}+7+*+*+m+.+*+W.7+s+o+u+u.7.8.~.#.U #.(._.Y B 1 E v H + q P l < l k o E i.` Q 1 L W <.n ! P . 4 q l k k G p q 3 H h k I O u m O p l v - 5 x . 5 F J p k J J t C q 6 ^ ] w = $ $ = | | : | . = % s s s s s : & # y T y + ^ ; ) T < p } ! u A 2 Q , D o b t q 6 ) 4 | % % % % % % % % % % w T J D V U S <.<.S V ! P 3 & # C o D 7 a , d B M k < y ] : : ] @ h M f > ",
-"% % | 4 - p ' I h ] ; 6 y ) @ - @ ) 3 5 ; q U #., H w . . . w x # 3 ) ) 9 q 3 x w 4 ] # 5 H ' u M m m ' k } T 3 # = | | . 4 4 4 @ J ' J f c <.'.w.c.a+s+[+r+l+,+e+e+w+%+w+l+`.y+8+7+Z.,+d+`.`.y+8+e+%+,+$+Z.,+8+d+Y.|+n+D+y+*+z+9+P.}+s+P.s+&+e+c+s+ +3+U.t+u+s.j./.$.>.).2...!.7.p.u.U.<+R.)+8+m+|+z+Y.c+R.Y.W.X.o+C+K.@.j.=.U 0 8.$.{.8 , .<.8 } y H q < > > P h { @.z G E n ( { f < ] % & 6 < v _ t h H # @ l } ! m B z O _ - 9 3 & : $ 3 T P , B v h C T ^ 3 ] & $ . | | = = | | = . & : % s s s % % w y 9 @ y + @ ) + y - > < k g m d a 7 u u f p F y x | : % % % % % % % % % % | 3 > } B e i j +.j 1 D P w : w q } m 7 B z u b t T * $ % % ] T l O u , < ",
-"% : & 4 T k I k F x x 4 ] 3 5 ) + - 9 > 6 l d M q # 4 # * # * * ) y # # 3 3 # 3 y > < < h 9 - P T H - q ) 5 w $ | : | ] H F P F t f } G u V Z $.*.m.u+2+[+c+w+%+%+e+w+,+,+d+l+,+d+$+f+l+y+7+`.`.7+}+y+8+l+`.y+m+*+<+X.n+W.&+D+ +X.D+Y.W.<+9+P.&+s+<+3+X.S. +v+v.0.x.~.)._./.2.i.].G.L.b+s+n+*+`.[+|+z+m+<+C+m+ +4+3+X.p.%.|.U r 8.6.[.#.7 f >.e g w . ) @ H y 9 T 9 i n y C V ;.Q k , S ) J <.p > k 1 7 h p 9 > I f f b ! b I _ y ; . | % | 4 - 0 n h < h C 6 3 ] . = $ $ & & % | $ & w # x & $ % % % $ 3 q < h C - q q y y y y @ T F G m u m f b ! M k P # : % % % s s % % % % : % : | . 5 P b A &.<.~ #.R Q v & % = @ J b u f o o I > 3 $ s | ; F J } m A ( l ",
-": : = 4 F k ' } - x = & . ] 4 # 3 ) 6 6 6 _ p y 3 ) H 6 9 > < _ G - * 3 ) 5 ^ y 9 _ G I P y * # x & = = $ | : : : | & 5 > p t G D / B , 1 U ;.}.1.J.n.x+*+`.#+$+$+#+$+#+Z.i+$+$+i+++!+i+d+l+d+7+`.`.`..+y+c+c+m+P.m+z+R.P.[+9+ +2+1+A+A+V.b+b+U.o.T.U.O.V.u+B+b.'+w.x.^.{.g.g.].f.1.E.a+z+R.Y.r+P.R..+m+0+[+)+C+o+|+a+0.G.:.U L r.|.&.a ! , W - : : $ # ^ ^ ^ y 6 _ ;._ . T U W p M D / D M [ T J n |.Q b #.g t V :.z m '.z h 6 4 | : % % % 3 S 1 l q T 9 H 5 * # x & = & y b + $ & ] ; 3 # # x | : % . 9 v k ' p l > q H y 6 @ 6 T q I m o I I ' I I l < ] % % % % s % % % % | | : $ | | & 3 _ u N <.-.X j 1 ' x % = ) _ o o } k v - * $ % % 3 h G f d / r 8 ' ",
-"% % : 4 F I O g _ y x = = = = . ] * ] * ] # 3 ; 5 T > P I k l y q P J J T 5 5 6 C h F q T 5 w $ : % % % : : : : | = ] + > P v } 2 n E A L ;.(.g.r.D.n.0+*+`.e+i+Z.i+#+!+++$+%+e+e+w+w+8+d+l+`.d+d+8+}+r+Q.Q.*+[+|+)+z+3+t+x+t+1+a+u.d.E.H.z.h.5.5.9.B.l.w.A.p.y.p.A.H.*.a.{.7.^.5.z.l.u.V.5+<+[+R.Y.`.D+5+s+X.A+o.2+L.B.L._.>.W G.'.X N o ..N = : : : = & & . * 5 7 [ # x T ` M ] * D i 5 A m ; y , j P S , H f f ..Z A / - ^ . : % % % % : f 8 P y + r u h 7 < @ l y . = c 2 # | w * 3 5 3 ; 4 . % : * 6 h J I I t C > H 6 @ H @ 9 > p M g I p p _ _ > @ $ % % % s s $ : % % $ | $ % : : : $ 3 J { i +.+.j Y b 3 % . ^ < p J v _ ) w | % | * < G f d c &.0 #.g ",
-"% s : w C I ' ' t q ; . $ : : $ & . . 4 w w + @ y @ ) + 3 ; x x * h m M h - - F q H > I p - # & $ $ | | $ $ = = & x ; 9 _ J } 7 ( d V U @.>.:.9.y.4.V.n+Y.c+%+e+i+!+#+$+$+e+%+w+%+e+,+d+8+d+7+}+`.7+.+W.W.)+<+ +2+t+t+A+u+c.B+L.1.{.i...Z <.<.@. .~ L =.%./.7.z.H.k.s.1.8.8.{.7.h.l.p.t.T.x+X.D+[+)+R.x+5+2+u+n.4.J.k.%.'.j N j ].~.r E E @.v % % : % % % $ | & & Z / O w 1 Z > $ 5 ~ 9 ) i x w ; S ' f ` H 3 l _ [ 8 q 3 w w | % s % | : * ~ p * ] _ W ( u -.d o =.M & t Z f 5 - d ( J ! P ) 5 ] 4 ^ ) 9 _ p k I k > - 9 H 9 - > P _ g o O I t l F T 6 ] % % % % : z S @ : % % : : % % % % % & @ E r S j U V f 6 : . ) > q - 9 * : % % % x > g z A n 8 0 +.` } ",
-": % : w T k } G _ @ y ) # 3 x $ | | | = & 4 6 9 6 3 # w = & w x 3 F ' ! o } l C P t D A B } v > C p t q + ] # # # H _ J I G o Q V 1 e <.%.|.^.E.t.T.v+<+W.&+d+e+++++=+$+$+e+i+$+#+i+i+,+,+7+8+d+`..+&+c+Q.)+<+n+0+v+V.U.u.4.E.:.<.&.U j +.=. .}.~.-.8 i U &.0 ;.g.x.x.f.^.{.6.^.9.H.D.t.a+2+z+[+)+|+<+0+5+u+o.4.E.^.'.8 G l ( U U R d ! O g ; | : : : s % : : % % e f - w 8 2 } 4 E V % 1 A I ^ , '.N [ 0 T w > - K c x . | : : | $ 4 4 & b =.] w * 6 ..1 } W ( o ` F & D N . P 7 m 1 > j f + 3 + l <.- M ).' } -./ G / k l z } t t n U b g k h q @ ^ x | s : s s s , z x s % s | | $ : % % % J =.1 2 1 N A d b - | & 5 H 6 y * | % : % . T ' z { N U j =. .!.b ",
-": : : w T t G k - ; + q k &.z y x & = = & w w & & . & w @ - ^ 5 + H h I C l P F g c K [ V d z D D , / { ! p h q y q < t k O m { N r j %.6.^.B.C.c.1+ +R.Y.W.`.$+$+Z.$+i+#+$+e+#+#+e+i+,+8+`.d+8+7+.+r+m+r+*+s+ +4+a+T.t.H.{.(.U { , d / / d B u z z 7 / , z E , &.%.[.x.r.6._.[.7.9.w.u.u+t+ +|+)+R.X.x+c.o.v.D.*.|.~ a h h A L N { m M t T ; & | : % % : % % s % * 4 % : _ P $ % D T : { I 4 9 N Z Q ( e _ 3 f d O =.G P $ w ; 5 @ 6 5 ; 1 R ] x # E L @ 7 X l E Q # x <.G & ! < #.J 9 (.p + 5 H # Y 1 B / _ { :.e a ,./ { /.1 J 7 |.W $.` O > o / g = % % % $ $ 5 Z 9 : % s s : | $ : : % % l e J f , A d D G + % : * ^ ; 4 $ % : : $ + l f Q c 8 <.=.%.2._.b ",
-": : : & H l t t q ] * ; - g v q H 5 4 ] 3 # . = w 4 ; @ _ _ < t t 2 j } y p z p / ` Z [ c V a B f z d Q 7 , { M G ' o M m , A 1 r 0 ,.8.9.l.y.K.4+x+C+D+Y.P.y+,+w+w+e+%+e+%+%+e+w+8+8+7+7+y+`.l+`.}+c+.+c+c+*+n+o+u.d.B.g.$.;.<.U 1 d E 7 / n a { B q ; 3 H G ' b S ~.h.*.].:./.~.f.0.M.U.4+C+D+Y.|+3+4+b+v.L.1.{.2.L E h G r L Y 2 ! } v 9 3 w $ : % % % % % % % : % % % % % : : % % % : | 4 9 J k q g t . + m 5 | a C $ & @ - > h h - q N n * x x <.h ) @.' ) @.l 5 t @.) 4 ; m 8 6 M j 6 ^ 4 $ % a a 3 H T J i.c b %.N A 2.b l V /.J 8 _._ h e B k . = | 4 G M Q Y & % k g t * _ | % : ] : U M ^ k M D D ' - = s % & & | | % : : % . - p f { Y S Z ;.'.:.|.m ",
-"% % % = l n U u ! - x 5 6 + @ y @ 9 q _ - * x * y + T P G ! ' < ^ V ` ( V W ).[ i +.j Y N V 2 Q Z ..2 B D B 1 &.R n d a c [ i X ,.|.7.x.H.w.m.U.1+2+S.z+[+P.r+7+l+,+i+e+%+e+e+w+w+8+y+.+c+}+l+l+l+d+d+}+7+d+y+y+&+<+2+o.'+p.C.L.A.1.j.>.K @.x.d.E.g.v & & 6 f ( B V >.].e.^.[.:.j.5.E.I.U.V.n+s+[+z+t+O.M.'+B.^.~./.i.` a ( <.Z &.a b J F H ; w . & . 4 w . = $ : % % % % s % : : % % % % % # @ - q q 9 # | % % % : % | ] 6 < J p p J t F B c ; 4 F 7 x I Y * J ` < H A ~ } + 5 R 2 - Z v } l ] * 5 1 A 4 3 + a X F A =.o c R _ < 8 #.- j +.+ @ ~ y # + @ H / S # u } : u v { v + Z | % > B G X 3 = 6 t G J h # % % % : % % : : % % : y p M a c U <.X ..'.|._.f ",
-"s % s @ , V <.f i b @ } [ J 3 + E @.O ^ D { z < < ' h J g J T 5 J ~.8.).i { { 2 i 0 S R Y N n ( -...N { A V #.h.).8 Y Y ~ $.%._./.}.q.r.w.D.M.V.V.4+t+ +D+)+m+.+y+d+,+l+d+,+w+y+`.`.}+.+r+&+y+8+`.`.y+`.8+d+l+l+,+8+}+W.n+S.x+5+1+5+b+C.z.q.9.*.l.~.m * x P B [ ( [ ).e.B.f.|._.[.*.w.I.U.v+X.R.|+ +A+3.A.5.g.{.f.*.B.a.=.+.@.Z N Q g C 6 3 ] x w ] # 3 + + @ 6 ^ = % % % s % % % % % % % % ] @ H H 6 + . : s % % % | * q l k } g } } J F J i * x & w & 5 @ 4 9 G ; * k D * 4 ^ a ( E k T ( &.+ D O t +.g k H =.g - ` G 9 %.} < v .u v ,.t * x &.Q H > F ! :.o _ 0 y : / + c & T 8 % P 8 = 6 1 % % | * 5 ] 4 | % % % s s s s s s % & h b d N K Z Z X >.$.2.(.g ",
-"s % s t J <., > #.t > N ` C x [ v j G h M R &.b d ~ k i E @ - 2 B.5+0.K B ( g m L -.X 8 R c 1 N R U &.K L #.2.^.` S K Z [.'.!./.6.a.H.A.N.3.a+u+O.A+t+X.D+s+W.m+.+8+d+d+w+w+8+.+}+l+y+c+m+W.r+}+8+}+c+7+8+8+l+w+%+w+7+c+Y.D+ +1+5+5+2+4+5+5+K.w.1.6.j I P O 1 L <.-.6.*.h.g.|._.6.h.D.B+5+ +)+)+s+t+U.D.*.8.f.z.B.l.E.q.$.-.W +.e d } T 3 * 4 # # 5 9 h v t t t h 6 w % s s s % % % % % % : . y T T @ ) : % % % % | * > l k M z E z b t > l V 4 = | | $ = 4 4 x ] x . . ] ; # ^ T F P C < V &.* G x = D q # ' ( H M ( 4 p @.g J , .G ` I ^ H J b <.F ' > 0 S v a W T * * Q p % B J ] S v % o t % % % % : % % s % s s s s s s s s : x < f ( [ Z @.-.;.$.2.2...J ",
-"s % % : G S C t S + 6 +.f $ b Y , k = f 6 ( < , { X I |.( u ).b+&+t+_.[ ` [., 2 |.F.h.>.8.S r %.).` =.%.q.^.'+z.'.W X a.:.(.[.h.G.p.'+t.B+a+u+V.u+1+0+ +<+*+r+c+`.`.}+y+%+@+Z.8+}+8+w+++i+`.`.l+8+l+e+%+e+%+%+%+i+#+Z.l+.+W.|+t+a+b+V.t+|+P.z+5+a+4.s.}...Z j ;.|.~.1.l.r.8.|.g.5.l.t.O.t+s+&+y+P.0+3.H.*.h.h.x.z.r.H.q.>. ...~ i 2 o C 3 # # # ) T p g o b ! o } P H . : % % % % % % % % % . ^ 6 ) 5 w % % s : : x @ _ k b u Q Q B b v q H @ * $ $ | | | . w & & $ $ = 4 ; ^ 9 C _ t p M m P : : : % % = # + T y 6 H 5 P ! > J 0 <.7 9 3 # q V b ' G 8 p ~ Q f @.+./ H 6 #.^ - Q w ' i | + K 5 % % % % % % % % % % % s s s s s % & ) v z c U ~ .$./././.(.` h ",
-"% % % % Q 2 6 [ J ) Y -.C = 8 [ w : : 4 u d 4 L d k t ;.K H.z+.+m+E.<.8 7.]./ 6.].0.}.W l.@.i.0.A././.w.J.'+V.l.^.6.*.h.[.7.J.b.M.I.u.3.o+o+O.o+O.5+0+C+R.Y.m+.+c+}+}+}+&+$+$+w+`.`.d+l+}+.+l+e+,+,+,+d+l+f+!+%+e+e+e+i+d+}+m+R.t+A+o.b.c.5+x+2+o+A+3.'+y.1.8.6.5.D.N.t.d.*.{.h.F.0.b.u+t+R.c+7+*+0+v.r.8.6./.|.[.g.q.}. .X @.Z i ( ! < y * # # H J M o b ! u m ! J C 6 . % % % % % % % % % . ; ; x $ % % % s % | # @ l g f B Q , D I F 6 ; = | % : : : | | | | | : : | = * 9 P k I } g M J y = % % % % % . ] * # ] * ; ^ q h d !._ ^ * ] & w ^ * = p [ > o z C 2 A P T l &.t h 5 & u Q ) , L t f 8 # % % % % % % % % % % % s % : # + h M 2 [ #.!.).[.j.).'.<.F ",
-"% % % % O 7 ' p 4 3 <.U Q ) ~ R 9 I & & W I ) ;.O y 0 f.a+c+.+c+C+~.<.>.F.=.S ].f.w.;.!.7.>.s.a+p.h.J.a+m.M.4+L.A.E.4.*.h.J.3.d.5+M.K.U.R.x+X.*+b+1+Q.z+[+P.7+w+}+}+c+}+c+e+$+8+c+y+w+c+&+c+7+8+y+}+8+}+}+Z.w+7+,+w+e+#+%+.+m+)+9+t+U.I.A+x+4+T.b.u.v.v.3.b.t.L.m.5+0+O.K.A.G.A.C.J.n.1+z+*+`.l+m+S.J.{.i.W j i 8 #.>.W #.#.~ j S 1 E t q ; # ^ q I O b m B B B E M G t H & % % % % % % % % . ; * . | % % : % : . 3 9 J } z z E ! I P + # & : % s % : | : | : : % % : | | * > l ' g b z D M k ^ : % % % % = x ; 5 5 ; 5 y T M #.~ h ; & . $ | : % 4 h P : | & x ; ^ y 9 ) 6 ) 4 : & q G 6 q M 3 l { $ s % % % % % % % % % % : % $ * 3 - O a U -.'.:.6.g._.>.i q ",
-"s % % : & * ^ $ $ . O O 6 5 B ( l x w 5 8 2 m =.J 1 J.|+$+!+}+`.A+x.@.r.l.:.$.i.d.[.;.9.(.e.3+ +N.N.C+V.a+ +2+B+3.v+m.E.w.o+D.D.3+a+n.A+|+3+z+s+1+t+Q.9+|+`.c+d+.+c+y+c+y+%+i+8+8+++l+}+c+7+l+c+}+.+}+c+e+@+l+d+d+,+l+d+d+l+,+8+.+W.R.C+ +C+C.F.l.H.A.L.t.K.b.O.[+m+[+2+o.3.u+v+B+b+A+C+[+r+y+c+Y.3+m.{.>.K V B b } 2 e 8 j L K K c Q M _ y 3 * - ' f , A ( 2 { Q E D O h H & % % % % % % : . w ] . & | % % s : w ) - J } M M O G > 3 . $ : : % % % % % : : : : % % % : | ; P J k O ! u d , E t . : % % : = 4 ) H 6 y y 9 P D N V G ^ ] = | % % % & w % % % % $ w ] 5 3 # # ; ] = $ $ 4 * * . % % | % % % % % % % % % % % % % % | w ; t { U @.'.~.^.h.8.:.%.S > ",
-": : % % % % : : | | $ . # 5 ^ ; x * p k h J J a 8 q.D+_+-+>+`.Q.b.g.).D.k.9.:.;.A.(.~.5.{.5+w+.+)+ +R.A+C+r+0+5+3+c.u.4.u.5+9.v.n+U.o.t+z+A+9+Y.O.0+n+C+<+`.m+W.Q.Q.&+.+.+l+e+8+i+l+y+y+7+%+Z.`.c+`.l+,+!+,+7+7+w+e+i+w+%+w+i+w+y+}+c+r+`.)+U.'+s.z.G.H.k.d.K.0+m+*+z+S.A+n.1+<+v+4+v+n+y+`.Q.W.[+0+w.V y 4 = = . x - M 2 n Y &.Y V a M v @ # 3 - G f Q A n ( / { 7 E o ' l * % % % % % % : $ . & $ % s s s s % . ) P v J k J P y 4 = % % % % % % % | ; 5 ) # & : % % : : ] h G k o m , A / Q b @ % % s : w * H > F T q F > C P C 6 3 x $ % % % % % % % % s % : = $ . x x 3 ; * ] 4 3 5 @ H 3 = % % % % % s % % % % % % % % % % : 4 h a L !.j.e.1.E.w.x.7._.+.C ",
-"% % % % % % % % : : : $ . ] ] y H v < * x # y z _.'+7+k+]+~+%+*+o.l.f.z.B.a.}. .].:./.2.J.,+_+!+7+W.*+ +D+P.9+z+C+n.b.I.b.b+l.t+x+B+c.|+u+a+[+x+U.X.A+3+ +P.`.)+Y.P.r+r+m+l+Z.c+y+r+c+c+y+Z.i+y+y+i+8+c+#+7+}+y+$+,+@+%+e+#+i+@+%+l+7+`.Z.`.R.x+b+I.d.d.p.4.o+b+[+z+S.5+5+4+0+z+D+5+t+X.&+)+)+*+s+C+J.c w = = & ] 6 - ' / *.<.8 e 1 7 } v H ^ @ C g u d A / / / / { , f O - $ % % % % % % % : : % % % % : : : : & y < _ < _ > 3 w & : % % s % % % | + C _ p t q 3 | % : : = > G g f B { c Y V z _ = % % & # ) q l P < _ t v t J l F y w | % % % % % % % : : : = w . & * @ 9 9 9 + ^ H q P > y 3 4 : % % s s % % % % % % : : : : : * b [ .{.x.E.N.I.m.p.x.{.!._ ",
-": % % % : : = w . | : : $ & 4 q < - 6 3 3 4 # N G.n.&+]+j+g+Z.7+R.2+B+v.t.B./.W X -.;.}.u.`.>+>+#+c+*+D+C+S.1+2+B+M.b.K.I.T.4.a+o.B+4+3+n.0+ +b+5+x+5+2+|+ +8+R.W.Y.)+W.*+}+i+d+*+Q..+&+7+++y+c+,+%+&+8+#+8+`.i+i+$+w+8+e+++l+++#+`.c+,+!+7+r+)+9+1+b+T.O.z+1+3+W.S.v+V.v+S.2+2+*+0+S.X.r+z+D+|+ +x+B+$.> . & & x * H I 2 2.-.i n / m k < 6 ) 6 P I m 7 B d Q A A , B O l x : % % % % % % % % % % % : : : : : : $ ^ > - C C - y 3 $ : % % % % % | * F ' ! m D o t * : % : $ ^ J M m , c K U c , k # : : ; 5 9 F _ P P v J I ' ' ' v T ] | % % % % % & x * w w ] w . x y < _ < h P F h v J v q T ) & : % % % % % % % % : : : : : : @ 7 0 2.h.w.4.n.U.o.I.p.z._.J ",
-": : : : $ w # ; ; 4 | | : | & 4 ] * ^ P l # 5 V z.B+t+#+^+/+~+++d+&+|+1+3.x.].[.>. .).q.L. +i+6+-+,+Y.z+0+v+V.u+c.U.c.c.u.p.A.'+u.3.a+c.o.4+U.M.1+A+B+1+R.D+Y.9+c+*+<+R.R.Q.l+P.W.Q.*+m+w+%+.+c+i+}+c+w+,+.+7+Z.w+8+l+8+!+i+%+f+$+y+c+,+e+8+c+W.P.R.0+x+9+|+z+)+m+2+v+5+5+D+4+o+[+9+1+X.R.X.9+|+t+2+u+l.2 n O ; k h w 3 _ u [ N 7 M k P 9 + ^ @ C k O m D u u z m O J q * | : % % % % % % % % % % % x } = % % % = 5 @ F h J _ < T ] | % % % % % $ ^ < b B { , , M - = % | $ w q I ! 2 U #.Z r A g 5 % = ] 5 6 > h l v p G O o b O g C ^ = : : : | w ^ + ) 5 ] 4 4 4 y < p ' I I ' I o b g J < F - 3 = : % : : : : : : | | : : : $ > A X :.r.y.B+o+A+u+n.I.k.].} ",
-"% % : | & x 3 ^ 3 4 . & = = & x 5 ; 4 ] ] 3 5 b [.'+u.4+y+-+/+>+++$+}+R.0+n+|+v+D.a.f.k.J.T.Y._+{+Z.Q. +5+U.U.b+T.T.a+T.4.y.w.I.3.B+3.b+o.K.M.T.T.u.u.o+C+S.0+X.W.[+n+<+9+|+*+s+W.W.)+W.%+d+&+.+%+r+}+$+,+8+d+!+l+%+i+w+:+,+Z.:+e+l+l+Z.d+}+.+r+}+P.s+&+s+C+ +W.Q.0+x+v+5+R.v+5+9+P.x+[+z+n+n+9+<+X.4+T.m.f.h.i ~ #.f c ,.i ! N $.I } [ < ; + ' D g } o M g ' ' l H 5 . : % : % % % % % % % % % % % 3 K = % % % = ^ H P G o g } I > w : : : : : $ ^ J D , / / ( u p ; | | & & 3 F b n S @.X j c m 9 & $ x 3 @ 9 > _ l ' b z D z b I l 9 x : : | 4 y - P < 9 ; w 4 @ < ' } ! M ! D m B u b I k l > + 4 $ : : : : : : : | & w & $ $ @ a ~ }.z.d.o.o+1+o+O.n.N.*.f ",
-": % | = ; ) y ^ 3 3 * y 9 C q ] 4 4 ] ; 9 ) 5 J Z k.v.y.t. +7+f+~+~+:+!+~+/+6+6+l+0+B+K.U.a+x+e+6+@+&+S.u+A+o.T.c.U.o.B+u.D.C.n.T.U.c.A+c.3.B+U.c.u.b.5+2+x+t+X.<+X.C+C+z+R.s+D+[+)+P.&+.+c+r+&+7+y+W.8+7+}+7+#+$+e+i+l+#+e+@+@+e+Z.f+f+w+`.}+8+`.m+`.Q.R.|+s+8+&+D+C+x+<+s+S.3+n+.+*+m+|+R.|+|+[+9+1+A+O.4.4+*.+.Y c ).{.e u A (.M m ` + 4 k R %.e ' o g , !.k - R F $ % w # ) ] s : % % % % % % % % 9 % % % % w 6 > v o m E D f ' H . : : % % % . T M d / ( <.i O @ ] ; v F . ) O n L .~ 0 e u h * $ & w x 5 9 l p o ! z E z ! g _ H 4 $ | 4 9 < t k ' _ H y ) > G D D z E u E d d B ! } p l > ) 4 w & | : : : = = w ; y ^ 3 x 3 O K i.^.0.3.u+2+1+V.a+M.w., ",
-"$ . w 4 ^ y ) ^ ; x * + C t H x . 5 H H P 3 5 h B :.t.t.r.r.J.o+*+7+w+,+#+>+(+k+j+-+%+Y.X.v+z+%+#+w+Y. +5+a+3.c.5+A+c.T.M.y.C.a+c.o.o.o+c.M.B+b+V.B+T.4+2+v+x+C+S.v+x+0+0+S.n+<+R.Y.m+r+Q.m+Q.Y.W.P.[+[+W.r+.+7+d+d+w+d+l+i+w+w+e+++=+f+f+#+i+i+l+d+7+z+n+|+m+,+c+Y.<+[+c+)+ +0+X.r+8+&+W.Q.Y.[+Y.)+n+t+o+U.X.p.}.&.&.7.%.} l J ` P g r : H <.1 R { v J ' e &.K a / T x + h F S g : v U w < &.H % # P 4 % 4 y : ] q _ p M D B B 7 m J @ & : % % % % x P g Q 2 ;.!.! P J K I ;.j ' G @.q.}.~ K n D h # : | | w ^ 6 < J M f f z m b ' l 9 # = $ ^ C k M z f I v _ v ' ! 7 d a A 2 ( / / , o ' _ - 9 3 # ; ] & | : : : . ; @ l l F 9 + C 2 +.:.9.D.u.a+V.c.U.3.A.A ",
-": 4 4 x . w ^ y # . & w w ; * w x C } ' C ] * < I 2 r.o.I.l.5.h.A.b.n.2+z+.+i+;+/+^+h+{+_+f+l+&+s+W.&+ +U.K.3.o+1+4+O.c.B+A.J.c.c.n.o.O.U.3.b.o.u+T.O.A+1+v+1+2+1+v+2+x+S.3+X.z+R.Y.W.m+m+W.m+P.W.W.s+s+P.Q.y+7+7+7+l+e+w+,+w+,+%+%+$+++%+l+l+l+7+`.c+s+9+<+Q.c+y+c+}+y+}+m+[+D+|+)+y+m+.+d+`.W.Q.W.Y.)+S.S.2+u.h.&.<.6.1 I C e ' * c 9 $ E W I ! C t v k } 1 !.> < 6 F / H P L ] y p Z > M #.# + m 8 l 4 } X 5 { >._ Z _.B Q 2 a Q B } h # : | % s % w < f a c V M ' ;.u ) t a F k +.l.W <.[ V m h . % % : & * - _ O D u f m z b } t 9 ; & . y J g u E m M O } o m B d / n Y R N V ( B ! G C @ + 5 H 9 + w | | | : w @ t } f ! G _ C G { Z _.h.y.N.u.u.m.N.H.Q ",
-"$ ] # 4 $ : = ] x & $ = w 5 3 x x C / D l ^ ^ } I k ` N.t+<+2+N.G.z.E.t.5+9+}+f+f+#+:+/+-+@+r+t+t+W.R.o+b.B+O.1+v+5+o+O.o.L.4.a+u+b+c.A+a+n.B+b+o.b+o+1+t+2+x+2+1+x+x+3+n+9+ +9+|+*+P.*+*+[+P.P.P.Y.s+Q.r+&+&+y+d+8+`.`.7+7+,+,+,+e+e+!+Z.$+$+d+y+Q.Y.)+s+|+9+D+Q.`.7+Q.)+*+P.W.m+Y.m+}+.+8+,+.+W.s+[+r+|+1+o+o.9.<.(._.V B M R ; f [ T @ &.K 9 t I ! o M ! L ..h h l N a ^ Y m | $ p j > M ( % ^ [ i ^ ^ ! i ! V +.[ >.}.( N Y e i i Y >.B w k { z H f t I Y r u z Y 2.v H y ; ) G .8.S K N d b > = % % % . 9 v O E a Q E D D m b p q 3 w 4 + p m 7 d u D E B B B Q ( e r &.U R e A B g v 6 + ; @ < P H 3 & | | | # - o E n 1 a u M J p d S %.].z.s.s.G.r.q.B ",
-"| # 5 w | % : : $ 4 $ $ . # y 4 w M K B M k I b C l J !.M.Y.l+.+X.4+U.4+9+<+R.`.Z.}+&+c+Q.s+ +2+0+3+0+3.t.o.V.5+4+V.u+T.b.'+v.a+a+c.c.A+V.c.c.c.3.U.v+2+S.x+2+x+2+2+1+t+3+C+n+X.X.|+R.D+|+s+*+W.*+)+m+c+c+&+r+r+}+}+y+`..+}+y+}+`.7+`.e+Z.++e+8+&+Y.[+s+D+<+<+R.P.W.}+}+Q.r+W.Q.W.*+r+m+.+`.c+m+Q.W.Q.*+9+o+U.A. .d U R h < ! l ] D M 4 5 A e k 7 c #.Q j Y K i.1 E O =.M B X < $ T r l y c 5 % < j I % ] 2 V 6 r S z W <.n r &.X _.[ &.'.G f z g } 3 &.b V >.$.z , >.` M k 1 z ^ k j.~ r R r &.m y $ : % | ^ v ' z Q 2 / , u z m b G H ; 4 ] 6 p m d a A Q d 7 , d { / e ..8 R r V , f G - y 6 H > k t > 6 ; w | | ] > f 2 K 0 L &.1 D J v o 1 +.>.:.[.:.~.(.b ",
-"= ; 5 4 : % | = . # 6 > _ # . & < 7 +.Y 1 E 1 f ; t y < '.u.[+d+,+`..+.+Y.<+X.D+}+y+W.n+S.<+[+m+9+v+c.t.4.c.4+5+o+v+A+a+n.t.B+u+A+V.a+o+4+u+O.b+B+o+2+C+X.S.3+ +0+2+x+0+0+3+s+n+S.z+R.s+|+[+W.Q.[+)+.+l+7+.+&+r+c+}+c+}+y+}+y+y+}+7+l+++>+~+f+i+,+.+[+R.|+z+D+Y.Q.m+&+8+8+7+y+}+c+c+y+c+y+`.}+.+Q.c+d+&+[+ +o+b.5.e p _ > ] | | : . . % = H v C v S -.r ` / B #.e v f #.f A S ' @ m / ; 7 e T ^ 2 K F w _ Y 3 P K < D ~ z / Y #.g.i.&.:.0 g Q D [ ] C <.h 1 [.` o A i.z _ Y '.V 5 A /.Q V U ,.$.-.; : : ^ K { O @.+.V +.;.2 R e D u G q y + H h O B A N Y c V { Q d a / n #...r c A u M _ _ 0 +.) l M } k _ > + w = # < 7 U @.,.>. .~ r E l - h D e i <.#.=.~ G ",
-". * 4 | % % 4 H @ H B '.o $ O -.e Y '.0 R Q R G 4 k - F k ` d.0+*+c+7+7+m+[+z+D+W.c+Q.s+)+r+e+l+|+a+'+d.t.b+u+o+4+V.a+U.n.v.U.O.u+A+O.V.4+a+b+c.A+0+t+ + + +9+n+S.0+t+S.x+5+S.x+C+X.X.9+<+[+Y.Y.*+W.Q.&+c+c+&+W.r+.+.+c+&+W.r+&+.+`.8+++=+_+=+#+,+c+*+Y.[+|+R.[+Y.Q.&+7+,+8+7+c+Q..+.+&+&+}+}+&+Q.&+8+c+Q.*+n+A+t.2.! q * | : : & 4 * ] . & 4 y ' &.Y I O M M f } < < J 6 > G 5 ) o q ; m k = + 2 Q @ 6 M k 4 d G 3 N 8 A K &.~ e.>.2.a.R ! b i A > 2 A p +.$.f } 8 ` q F R 0 H T r r M ( !.;.&./ $ | ; g ( |.K Z =.S /.5.#.~.j., ,.%.C _ K c ! X U V -.j c Y +.>.7 7 a a [ g.( Q u b v 6 q 8 o @ k b f ! g v y x x y } V 0 2.g.{.[.%.<.Y Q p _ I D ' m B A 1 _ ",
-"| & | s s % $ x ] w } +.= | < ..} ` [.,.j U r h ^ } r W T > R q.I.2+D+W.m+m+)+R.z+<+*+Q.*+c+7+Q.2+L.r.k.4.c.V.V.V.U.T.c.K.m.n.u+4+4+O.u+A+T.T.5+t+3+3+C+ +9+X.0+t+S.3+x+4+1+x+x+0+0+t+C+9+*+*+Y.P.)+Y.)+)+)+[+*+W.Y.)+W.Q.*+P.Y.Y.r+.+8+e+++i+,+8+r+Y.s+R.z+<+R.s+[+W.r+W.Y.R.D+9+<+s+)+P.&+c+}+c+`.8+7+}+Q.[+S.b+E.L + $ : | x 6 T q H H H < p B , ! M o o g M v q ) ] & & | % % % % % | | % = ^ ^ : # q . @ k ] y a O k ..j i ~.@.|.j.K D { Z E 7 1 h A ).=.b f j 2 + o @.7 ^ ' S _ C e ,.n ! 5 $ | ] - c [.r 1 R 0 j.a.;.[.:.<.!.j h a S j Z (.W @.8.%./ +.g.~.}.>.u E R ].Q O I t - ^ ' 0 y q k f B z O _ H ] 3 < 1 (.=.:.^.5.a.j.).(.R { i 2.O + + y C k + ",
-"% % % % = q h b | $ [ E = $ 1 n } ;.:.,.X +.[ h h } U i # ) ) I <.e.t.O.0+C+0+A+a+u+x+2+1+C+t+a+E._.j.B.N.T.V.V.a+U.b+b+4.4.o.O.x+2+u+O.U.U.o+x+0+X. +C+z+D+ +S.3+ +3+t+x+C+t+x+0+t+0+ +9+z+R.|+)+R.s+|+z+<+D+R.)+[+s+)+Y.|+)+[+|+[+*+.+y+8+8+`.&+*+s+<+z+z+z+9+3+X.3+v+A+V.A+2+S.X.S.3+<+[+Q.7+8+`.l+d+`.&+P.n+V.v.{.l | $ . H h l t k ' O B Q 2 V V 2 7 b M g < H * . $ $ | % s % % % % % % % % % : % : : : % % | # ^ J j n z N 2 [ j a o z R Y g T q d @.Y G a 8 - # 2 S d O ( j g v U ~ O H ) 5 # @ l X j.[ e Y X q.!.0 a...n j u C O @.e / ~.~ =.:.[ 7 ~ i.e +.,.m p n i.z v h F 6 T / 1 z .r z A -.L v g l ) z 2.g.!.j.a.e.a.9.d.*.;.+.!._.} l - y 9 - * ",
-"% s % x z 4 ( V $ 9 !.t 3 y %.o a +.,.'. ./.8 t G ! :.c < > 4 w ^ } K }.r.w.A.s.w.y.L.y.D.k.].Z z D ;.*.N.a+4+o+A+V.V.U.v.M.O.4+3+t+o+u+a+5+C+9+z+<+9+z+s+R.9+9+n+9+X.X.C+ +X.C+S.n+ +S. +9+z+D+s+[+R.s+|+D+z+9+<+<+|+<+9+X.<+R.D+|+[+)+*+Q.Q.r+W.*+s+z+X.X.3+x+u+b+v.m.M.v+D+[+P.*+9+0+n+9+s+&+`..+c+`.d+`.`.P.3+n.A.n = x 5 F I } M 7 Q 2 e U i K S &.e E O J C 5 w = $ % : % % % % % % % % % % | : % % % % % % % & + _ v h l p O o f o k h q 6 ^ ^ 6 C t C - e u | ] O Q > 9 A A > T ( j , P f Q I D e ,.6.}.` U |.:.&.'.i.Q U n q F Y U l r W B 8 ~ z 7 -.<.b ~ 8 6 T r =.G F > 9 ^ G <.a ! 0 r { ..[.<.z ` ! q S 7.6.}.g.{.^.5.'+n.H.7.q.s.j.L V D I v _ 5 ",
-"% % 4 N q + j 9 5 / ~ F T A @.J u c =.$./.;.b - k R }.N 7.8 = $ = < G n z A j <.K 8 <.+.( o < y ^ h i q.p.B+V.o+4+o+4+T.K.T.u+1+t+1+c.O.A+C+n+z+z+n+n+X.<+|+z+n+z+9+n+n+ +n+X.n+C+ +n+ + +n+n+n+n+9+n+9+9+9+n+n+9+ +3+C+3+S. +9+9+<+9+9+D+|+|+9+9+D+X.S.5+A+b+t.p.y.E.L.U.<+Q.}+y+Q.P.|+D+R.s+m+y+}+&+&+`.}+.+m+[+A+m.$.3 $ 3 P ' ! z { 1 [ S L j L i r N d p 9 3 = % : % % : : | % % % % s % . ] 4 x | % % % % % % : = x * 5 ^ y 9 F - 6 # 4 w $ & x ; @ / l m Q + : $ = # ^ @ - - @ y t m < # f r D / B A '.>.U ~ 2.j j './ m U Q @ p 1 J b U k o [ z t a Z u 7 U t ] h j e H ^ ) * ) V Y 3 ! <.7 z #...{ i &.+ J .:.X ,.j.j.j.5.t.m.x.z.p.'+f.p.q.&.n r (.1 ",
-"% w M d = ( ( | F Z D ] > ~ V u f / =._.}.K P < d ;.>._.e.,.5 x D ) b 0 y b N 0 V z _.m 6 M 8 A ; > U 8.A.K.a+V.o+5+o+n.K.T.a+4+2+O.O.v+0+9+n+9+n+ + +z+D+D+|+n+9+X.X.n+<+9+9+ +n+<+D+z+n+z+n+C+C+C+S.C+X.3+0+0+0+S.0+x+x+0+3+X.C+ +C+C+S.S.S.S.1+t+4+u+T.v.y.A.y.k.l.C.A+)+c+d+8+7+}+r+c+r+&+y+c+}+`.y+y+`.&+[+s+S.b+1.} | * F k ! B { &.Z ~ <.S S Y n a D t ; & : : : : | & 4 4 & | s % % w 6 T + 6 3 & s % % % : : : : $ . x ] # x $ % s s % : | . ) 9 2 f M H & $ . # y + 9 T > > h _ C q 6 o G ) T h ! V r Y [ R { Y V I g D 6 w M G ^ d M = ! A C ; 2 V 7 n P 4 4 B i _ ] 4 4 = l &.h 9 N B I 7 ` &.2 +.m ; { _.-.L -.$.i.(.h.N.B.*.H.K.t.z.p.F.%.j.~.|.<.",
-"% ^ 1 2 b &.d P 2 ,.m y I @.E g b [ K $.'.n 5 _ i ).~ .z./.V d O ] e b y [ } R J / a.o ! +.E <.5 T c 6.w.v.U.O.A+3+D+3+B+T.v+n+X.A+A+x+z+9+<+9+z+n+ +z+9+z+9+|+D+z+z+z+D+|+D+X.<+D+n+9+9+n+9+X.S.S.S.0+0+x+t+S.[+Y.2+4+v+1+0+S.t+v+1+v+4+v+A+5+o+u+o.K.I.b.u.4.p.8.j.B.n.9+.+7+l+`.r+y+`..+&+y+.+}+c+c+.+c+Y.z+s+|+4+J.U & w 6 < g D A 8 #.<.<.8 Y { 7 D ' @ | % % % : $ w 4 4 w & = : % | H P P P < F # : : : % % % % % : : : % % % s % % % % | w 5 9 q > < ^ ; # . . * + H q > < t G g k C _ 6 = ; 9 l f Q 2 { 7 u f b } P + w = | | | $ ; x : @ H % ) e n C $ % % > R p = $ $ | : M { 9 a ' 3 < S :.L Z i M ; L ).L i Z =.;.%.G.r.:.[.H.u.x.h.L.x.f.E.1.}.z ",
-"% 3 D G P / E B #...2 l 7 ` Q M Q Q / ,.i./ x M $.S c [.l.).2.~ 5 m U 3 9 B d a F j !.! ;.[ 2 h ; ) Q ).l.t.b+U.o+z+U.O.M.5+z+S.|+x+4+9+c+[+Y..+z+[+r+<+9+3+s+*+z+ +n+<+z+z+D+Q.[+z+n+9+n+C+ +3+0+t+0+o+o+o+A+4+|+ +U.b+c.a+S.)+v+o.T.3.M.o.B+M.3.4.u.n.u+A+c.M.s. .0 g.s.M.t+D+[+)+s+m+`..+&+y+r+&+.+.+}+}+Y.*+Y.|+0+K.2.+ : . + P ' E 1 S K U e A m O t H & % % $ & 4 5 6 y 5 ] x . | % & F v I ' p _ @ $ $ = | : : % % % % % % % % : : % % | 4 + - > > F C q H ) * 4 * ^ @ > l J } o f O P + x = . ) < O D Q 7 f o ' t > y * $ : % % % % % % % % % % d / ] : % % ) Y G . | $ $ | : > g g ] | = y &.` E [ R J 9 ~ ).j N &.~ -./.A.9.2.i.w.G./.l.k.7.k.t.6.X G ",
-"% % = = . H q k ( Y E q b A k u 2 g A $.2.B w i ~.u L '.%.i./.<.I 8 [ 6 F Q ..! d %.N Y $.B @ ) 5 ) f '.F.4.B+U.O. +o+o.V.n+3+v+)+3+o+R..+[+Q.c+s+Q..+n+3+D+Y.r+R.X.n+R.z+z+r+7+c+.+n+X.D+|+3+z+2+x+2+u+O.a+O.o+|+T.3.K.M.M.A+n+K.b.4.4.I.I.m.'+v.n.V.v+1+v+V.c.p.-.a #.|.z.m.b+x+<+|+)+m+&+.+c+r+m+.+}+7+d+d+d+c+s+n+u+h.h : : = ] P b d 1 N ( Q ! k 9 # = : : x ] + T > _ P 9 ^ # 4 $ : 4 _ ' f ! M t 9 & w x w & $ | : % % % % % % % % % : . y P < l J G G J v C y ^ @ 9 P p b f B Q Q D p 6 x = & y - I ! u u f G ' < 9 ; . | : % % % % % % % % % q i A w % % 6 1 C & | | | : : % % : | : | | . T k F l l # ^ Q n B 7 n L <./.r.j.,.{.B.a.~.s.a.~.p.N.8.}.b ",
-"% % : % | . x _ u B O > ' M ' M b T B @.` ! ) ..-.I #.1 L '.L 7 P a d J Q ~ 2.R L i { ~ !.n E < y 9 m !.B.I.3.B+o.x+ +a+x+D+v+t+P.3+v+R.Q.D+)+r+|+)+P. +D+Q.)+Y.|+X.9+D+9+<+m+W.s+`.Y.<+Y.&+R.<+o+S.<+ +3+o.c.x+C+O.1+o.t.K.x+b+J.L.C.L.C.d.N.b.O.1+x+x+t+2+1+4+v.(.B z N W g.z.t.X.<+5+5+C+<+y+.+D+9+n+9+[+P.c+m+[+n+v+A.! : % % : * l g g ! M I - * & % % : x H 9 > h l } ' v 9 5 w | : * p o ! b ! I T . 4 ; # ] x = $ : : : : : : % % % w ) > J I } M f o ' G C 6 6 F t g f E B Q 2 { m G - 4 | $ 3 6 l ' ! D M I v > + x $ : : : % % s s s s s % p I f & % % y & : % % % % % % s s % % : : : $ ; @ + 3 4 ] 3 T l M b { Y 8 j =...!._.:.g.e.[.|._.f.l.8.!.I ",
-": : : : | | = q 7 D J - g I C Q D # m U <.D - L D x b 7 [ j I * ] + 6 h { Z '.>.L R { R i.S f o J _ D ;.z.C.t.n.b+5+C+n.0+X.V.<+<+5+S.Y.9+X.P.D+z+Y.C+n+r+W.C+S.3+0+C+z+9+[+m+z+s+&+z+n+Y.Y. +4+2+<+1+4+9+b+a+X.0+c.v+U.D.B+5+D.0.D.n.V.n.'+a+n+t+C+z+3+C+3+2+4+o.9.8 m O ! n 8 2.m.m.x.r.d.5+C+c.C.C.D.C.t.B+b+1+3+0+2+t.( $ | | ) 2 r - - T T ) $ % % % % w 6 _ P h J G o f t 9 * . | : ; t O M ! f } T ] ; 5 ) ) 3 * ] w = | | : : % : w @ > p o ! M m ! b } _ 9 @ 9 h G b z E d { ( A D t T # | | # 6 < G O O p h > 6 ; x | : : % % % % % % % % : $ = & . . 4 = % % % % % % % s % % % % % : : x 6 9 H 3 5 * ; 6 l f D 2 [ U 8 j -.>.'.%.(.i.2.2.,.;.W ..X k ",
-"% : | | % % | + ! B o v h l G Y ' 4 m U #.D 9 [ g w M z c c I 5 # 4 * t n S @.'.,. .U 2 ( ( 2 { { Q V W e.y.d.3.5+5+b+B+A+0+C+C+4+4+9+9+1+|+s+C+s+P.C+D+c+)+C+X.0+2+0+C+ +*+*+X.P.[+1+X.P.C+o+4+9+<+A+n+n+u+2+ +B+b.4+I.C.b+K.G.k.v.b+T.5+n.n+*+z+[+&+R.*+Q.X.x+v+K.f.<.Q } > p 1 L ,.E B W r.d.q.[.[.[.6.^.1.w.I.b+V.O.'+U J o | + U N 6 - @ + # : % % : & ) _ } G G I O b O v H # 4 = % # v ' o o M I < * @ y + H 6 y + 5 # 4 = | $ = ; T v k ! z D f f o g k P + @ 6 P J o b z , { / a M F @ x $ $ 5 9 h J k l F q @ ) 3 ] . $ : : : % % % % $ & x ^ * 3 5 5 + # & % : s s s s s s % % % : : & ; C - 9 6 6 ; ^ 9 p z { 8 Z -... .$.%.%. . ... .;.@.X X >.q.Q ",
-": % : : % % : 4 I m G P P p B U @ 5 , &.<.z T N < 4 _ G 2 / p - H 3 H o 2 K '.g.].}.2.-.i r U &.i L +.'.a.E.N.I.I.v.I.M.T.V.o+u+A+v+t+v+1+n+x+C+|+z+2+9+)+s+C+0+t+1+t+t+9+m+|+)+s+t+0+)+|+4+o+2+|+ +4+<+ +5+X.o+u.u+b+0.N.c.y.1.'+a+5+v+o+t+[+c+)+P.y+W.&+.+s+<+9+C+u+p.|.K B V c z ~ _ ' { ( ` b a #.6.l.9.7.z.0.3.n.v.B.=.<.I x _ Z p @ q H + ; : % : $ 4 6 g z f z z m } < C y ; M &.: * v ' ! f 1 1 g ; y 6 @ q > > - @ 6 + ^ 6 9 < I g b D 7 B m ! ! O p < 6 3 ) y q P k O m u , { u I - ; $ | : w y - l < q 6 ) ; ; w . w | : : : : : | = w ] * + y H T > 9 + 3 . : s s s s s s % % % % | w + < < F C > @ ^ h ! , Y ~ (.:.|.j.j.i.>.@.+.#.<.j L i S X _.2 ",
-"% | = = % % : $ F z p @ l H d g x l / / <.( h , - ] H q m o 6 @ q > J E E R _.e.e.q.q.j.!.+.=.-.@.!.,.}.5.y.'+t.I.m.v.b.3.n.M.b+O.A+u+V.V.o+5+1+4+4+2+0+0+t+5+5+5+1+v+x+R.Y.<+2+o+4+C+s+S.O.u+v+9+t+3+n+5+0+ +b+4+V.L.k.M.n.s.k.a+3+A+v+t+9+m+Y.s+.+m+*+m+W.*+*+*+[+|+D+2+N.z.].i 0 %.A m ' [ ( 3 < ..[.g.H.{.j.H.B+T.J.F.6.j C 6 V e 5 l 7 ' F h * : $ . * y J z d d u ! J q + ] w F G : ; 7 e m E ` (.J * ^ @ @ q C P < _ F C > h I M B a { { 2 , z ! M ' h H 5 x ] 3 y - l l ' M m f ' _ @ # $ : : . 5 > P > @ ) * ] 4 = = | | | $ | : : $ x # ; + - P l v l < 9 5 x | s s % % % % % % % % : . + t k p J l C - v D 2 8 ,.6.g.{.{.6./.%.@.Z L 8 Y Y c c r r t ",
-"| ; ) 3 $ : % | 6 B > 6 + ^ l 3 x M V u S ( ! z T H 9 ^ } m > # 9 P o d u L 8.G.r.r.G.5.{.).[.[.j.g.{.q.r.0.C.4.N.4.v.v.u.B+M.b+O.O.c.O.a+A+V.4+1+o+v+x+v+o+V.5+A+V.v+C+Q.3+o+A+a+A+x+2+A+V.u+4+x+3+5+u+A+2+3+5+c.b.J.d.U.B+p.m.t+S.t+0+2+s+*+9+*+&+D+m+m+[+m+}+.+}+}+`.m+s+s+5+E.A.J.).f z ..2 - n i.#.i.G.$.-.1.A.p.I.H.'.O & J &.g ^ O #.N g U g 3 ^ + y G [ ` #.( V { I t @ 4 x & | % G !.e M 7 =.0 > * 5 y T P < _ t k G I G o E Q { V V V 1 Q B f G _ q ) ; ; H ^ ^ y H T h k } } I p q 3 = | $ 3 T C v _ H 3 x w . & | | $ = = = & . w # ^ 9 h p k g g G J C 6 # w % s s s s % % % % % : = H J k k G G v C v u e X _.8.7.q.{.7.6./. .=.Z S R ( d a { { C ",
-"w C ' k T & | | H u O @ 4 q _ ] 4 G m E &.u ' I ) 5 y @ O f @ ] 6 l f A a >.z.F.H.A.E.k.x.a.z.1.h.1.F.s.w.E.C.K.3.K.b.I.3.b+o.U.u+a+c.u+c.u+V.4+2+o+A+v+4+4+A+V.a+V.x+)+W.S.o+V.a+A+o+u+a+a+O.o+V.a+b+U.a+c.u+c.b+3.t.'+4.k.h.F.I.c.b.b.O.S.x+t+)+|+9+c+.+*+,+,+`.`.d+w+8+8+8+|+V.t+2+z.R U .., O .%.B !.~.j ;.'+4+b+4.1.j P w B e 6 ; @ a N ! 2 ! F C > v 1 S !.Z ( ;.j Q Y ' @ z u # ; 8 './ M Y ;.( k y ] ) 9 > C P l I M m 7 1 1 c 1 c N 1 / Q 7 O P y # . $ l c H 4 # * ; @ F I V 0 { F + & | = @ p D B v T * | | = = | = = = & . x ] # ) > _ I ! z D f M I < q 9 5 = : % s s s % % % % : # H l k J t I l - t Q i >.}.f.h.*.e.f.a.[.2.;.-.+.K N ( , B B > ",
-"] g E ! o C 3 5 M 2 < ] 9 h v 4 ) t } ! ( M ; 3 5 w ^ @ p p 3 * ^ < m , 1 2.z.r.s.d.y.w.H.9.B.l.l.E.p.C.D.0.D.I.b.b.v.b.M.o.B+T.c.a+b+T.o.c.A+5+A+u+V.V.u+u+a+T.n.T.S. +9+S.u+c.O.A+V.c.b+O.u+a+U.U.b+o.U.a+U.U.T.B+u.N.s.:.W -.` =.;.).g.5.z.E.4.b.o.2+t+ +Q..+&+l+%+e+#+!+++c+C+ +a+y.[._.X g b x.).[ ~.~.{.p.b+ +b+A.{.O > T [ J $ = : p V D ! k l t G m e W <.[ U /.i i 0 m u ~ c # q S 1 G M -.@./ ;.f . * ^ 6 9 I L S u B +.|.%.S [ 1 1 V ( , m k H x | | : ^ > | $ & & # ) q l Y '.B C 6 w : & t e <.~ './ ; @ M t . | $ = & & . w w * @ P G g b z 7 7 ! ' t h T 3 & : % % % % s % % % | ; > v k p J l > y t d U .j.a.z.z.*.x.e.6./.,...-.0 r 1 2 7 z q ",
-"4 O a B 7 f J k d ! ; 6 h P I q > h E f O k 4 ; ) w * @ t g _ T ] > f d e 2.e.l.p.C.y.A.E.G.k.k.k.p.J.J.d.D.L.u.b.v.m.I.v.u.u.3.B+n.M.3.M.B+c.a+O.b+c.c.U.b+b+B+K.B+c.b+U.U.b+o.b+u+U.T.M.b+T.T.o.o.n.n.o.o.n.T.b+n.K.4.q.K d o o ! D d { 1 L X %.[.{.e.s.d.u.V.9+d+>+(+/+>+Z.l+&+)+5+v.G._...{ L L.d.).~ !.8.K.b+V.I.B.%.7 C , K , ) | & g V f > < C k p } R |.&.+.i.` / ;.i I ( X P | u r g k A (.K ! U J = x ; y > 1 n E o Q }.[.j.*.W r <.|.7.S M _ < E 9 s ] * | % % : % = 3 H l j 8 _ P - ) = x Y K G z K , # l j m : | = & w 4 . x 4 3 6 > l k O u B , E O k t H ; w $ % % % : % % % : | ] q t I p l F 9 @ l 7 N W /.^.1.G.9.r.1.5.]._.$.W ~ S [ c / 7 q ",
-"# M a d a b ' ! M > q z - > I > < } / 7 l C . ] ^ 3 < v M m _ 3 ] q m 7 r ,.h.y.J.J.C.d.A.k.y.0.p.d.J.'+J.C.N.v.K.I.I.I.b.b.t.v.K.B+3.M.B+M.T.b+o.b+U.c.c.b+o.c.n.T.o.a+o.B+n.o.T.T.b+b+B+n.T.n.M.n.B+T.n.T.b+T.c.c.b+4._.b t h P F P _ h t g B { r +...i.[.a.G.p.4.b+2+<+D+C+n+<+z+|+9+o.*.W $.r.J.5.K 1 .6.D.b.J.s.;.d @ # B A P x = x / R I @ T < p k g X j.Y [.|.Y ~ '.1 d >.e ; # 8 O - _ j @.' k 2 H $ . 4 ^ + 0 { h J 1 [.L ..B.;.<.{.$.}.j M 2 h u C ] m n 6 % : + v ( ! 9 z =.d < P C 9 # k <.a J G O k + M n H $ w . & x 4 x ] ; y y H C v ' b m E E f } v H 5 * x = & & | % s : : | * q k ' I l h C - t B N W ).^.z.H.H.E.w.H.z.^.}.).%.=.Z S r a F ",
-"; u / A d } ! B < > , d ; ] ) P O } u O C ) = & w 6 M O E D l 9 y < u Q 8 /.r.y.J.N.'+J.p.A.d.y.p.p.L.C.J.C.J.I.I.v.4.t.v.b.4.I.v.I.4.4.u.b.K.u.b.B+n.o.n.n.n.n.K.B+M.o.b.b.B+B+B+3.3.o.M.3.I.u.K.K.b.b.3.3.M.n.O.U.c.B+6.g < G J p v h C F - - P _ I , c K X !.|.{.f.9.s.k.0.p.D.C.u.c.A+V.b.t.I.p.8./ V ..}.z.H.H./.F % % | H ) | | $ . &.m 4 . * q h _ p e _.(.g.[.+.'.U 2 0 }.n G O #.B < I -., 6 Y ! ] & & . x 4 Q i C q i ..A |.{.8 6.).(.U m a ( ^ x & q j [ 5 % ! q - [ p H U L I < _ _ - H N ~ A u K U g C L a # & ; 6 ; x 4 ] ] * y @ y T P v t I M D f } l > y # w w 4 . $ | : | | | 4 H l J J / D P > _ D / ~ _.q.B.F.k.0.y.0.l.x.].:.(...` <.i N > ",
-"* E n A d , A I t , R g w & H z l - B &.n ^ $ + t t q @ u f I > ^ < ! d <.}.x.0.L.J.m.C.w.p.p.y.0.A.d.L.C.J.N.t.m.v.t.m.m.t.m.4.4.N.N.t.t.4.N.N.I.K.M.K.K.M.3.3.b.3.M.K.n.M.B+3.3.M.K.3.3.u.m.m.t.J.m.v.u.b.3.T.u+u+4+v+L.8 I o } o G k G g g I J l h G M m a Y L ..(.[.].8.e.h.x.*.9.r.l.D.I.b.'+y.~.A [ ..[.9.l.q., = : : : 4 ^ Q k < J l = w x 5 @ C < t f c 0 ~ >.-.U N { 8 ` B ) I n P q a R 7 ! N @ 4 x . . ; I p S T ; X d Y /.[ r a..., o h 0 m w | % g 0 F : o z & A 7 + P !.E h l t _ C F Z B m j g.!.z A -.I ^ 5 M 0 n @ # b +.m 6 @ @ T > l o D M b f O J C H ^ # 4 4 . $ : : : | $ 4 y < J t i a C F p M Q !.p.'+G.F.w.D.L.D.E.1.e.j._.(.,...~ 8 P ",
-"* z N 7 d u G _ u S e F = 4 u , @ H , 8 Y w = g j P 4 _ 2 ! J > ; 5 G R W }.r.0.C.L.'+d.A.A.y.E.E.E.0.y.D.L.D.J.J.J.t.t.m.'+C.L.N.'+J.C.J.J.L.d.L.'+t.t.u.u.u.b.I.I.4.u.M.3.K.I.v.b.I.v.K.v.t.t.N.'+'+N.m.u.B+T.u+1+0+S.1+l.e b , A B f ! a c U Z 0 L X =.j r n d / U X 2.[.j.{.a.^.^.8.a.8.^.e.q.x.$.A [ ,.7.x.5.0 ; : % % % : @ ! D < 9 $ & # ^ y 3 y F t o E n &.i &.Y V a d b p 6 ] & 4 @ v t G ! - ^ ] ; # w 5 A Q h . t ~ M c u I Q [.8 c f ^ ~ G - @ 5 0 r T # #.H h +.- & E <.F < < l _ - ! i O b ..a.r ! @.S _ 6 ( a / a ) O z ! T ^ 5 ^ y F / R ;.1 ! 7 !.8 j A > 3 * # ^ H ^ x $ $ $ x ; > h P } J F u K 7 7 Z 0.E.*.l.0.A.y.E.s.G.1.q.8.{.}.2.%.Z t ",
-"# D m f ( 1 1 M K .e * # F &.O x ^ d X ' . & @ < 4 # M V g _ F ) # M =.W i.*.w.D.J.'+N.U.B+k.s.l.H.C.b.J.w.w.y.p.d.J.C.d.L.d.d.L.0.E.A.A.d.p.D.0.A.y.D.'+N.t.4.m.N.4.t.t.m.t.I.4.m.'+m.I.m.L.C.L.C.J.N.t.4.K.T.u+1+0+ +n+V.*.K #._.>.( d <.).:./.:.6.h.G.k.p.k.:.Z K R r 0 ;.2.].g.~.}.[.j._._.).).~ / ~ 2.7.e.>.< | : : : % s 6 C ) # & & x 4 # + ; 5 6 l } M B ( 1 n A Q , E O < ^ = % = 3 6 H 9 H ) * * y ^ # * ) y * # S Q t # ) @ 6 2 e q ] . d V I q l +.a m v Z g 7 X v . 0 Y D q 9 - C H &.1 O A ^.>.a { ~.m C O >.f m + 4 G 0 6 x 4 ] * ^ 7 @.k i !.( c j./.,.B < H y ^ k Q c k 3 B H - O 9 F D G H _ -.-.m ! !.s.f.z.l.s.w.F.B.F.B.r.x.*.e.{.j.)...l ",
-"x l 1 { f i.#.e ).5.L F R j j < } { ~ 0 # $ C C # x H , B b l - T C d c Z i.9.E.D.C.'+N.K.N.s.l.r.l.I.5+D.G.r.l.0.y.A.w.y.A.w.k.A.w.l.s.k.E.k.w.k.E.0.A.A.L.J.'+C.C.'+m.N.m.N.N.C.N.t.'+'+'+d.D.L.d.J.N.m.t.b.B+u+v+S.9+|+ +A+0.h.G.1.;.#.g.r.e.i.!.j.k.K.B+t.m.t.v.b.5.` L #.@.>.(./.}.g.:.(.>. . .i Y 0 i.7.!._ | | : : : % s w _ 3 : $ $ w . # w x 6 - _ t J o m 7 d B E z ! p q # | : = ; + @ T 6 ) * 3 + ^ ) ) ) @ y O ,.t 3 5 3 * 4 w & & $ = + l > 6 h u ! 6 - 7 @ F A 5 % c E P # 3 3 H > ..O M Z 5...S @.[.A _ 1 !.- 5 * * 3 K ! x & w 4 5 #.e l ).!.d V 7.i B g t F y > J b z ) l +.P u u l 7 =.A 9 , '.e f I a.}.G.n.l.H.s.F.G.r.z.1.r.x.h.5.7.j.,.k ",
-"& c ` ! K (.i j }.7.' 2 N i R R 2 ' e O & P 0 [ 6 ] d ` !.S b _ O D p a (.f.l.0.p.L.J.J.d.D.0.s.B.s.M.3.H.F.z.1.k.k.k.E.w.A.s.s.F.l.G.B.1.l.F.G.G.l.s.w.E.0.C.J.C.L.t.'+J.J.L.L.C.'+m.N.J.'+C.L.N.J.L.D.J.I.M.T.V.2+S.D+s+|+3+0+O.0.[.` %.z.A.H.2.,.h.b.t+z+u.L.o+z+*+b+0.*.}.>.>.,.$.$.).2.W ..!.-.~ -.-.).).I | : : : : % : : : F 9 : | : = # ] = 4 ^ > < < h k g M D m f b ' > 3 w : % $ 3 T T > q 6 y ) ) ) 3 ) 9 < f X W 7 F q y 5 4 4 = = $ . 5 q 9 - < h < < - + & : | : % # * | & 4 ] 9 , 0 h M 0 /.8 A -. .2 l 2 -.k E 3 p q V D ] 4 4 ] * %.' o [.j a ;.}.{ u b J < @ ^ h 1 x I ' c $ ( h # r !.} - 8 ~ I G 2 ^.6.^.3.1.B.l.l.k.l.1.r.1.z.*.*.*.*.].! ",
-"> #.{ V j.=.S U r.j g 8 { Z -.R J > f H $ o W V * u S O @.'.7 t n g q L ^.A.w.I.M.J.u.u+K.L.y.D.'+u.o.d.H.r.z.r.r.G.r.G.G.F.G.r.B.z.*.9.*.*.h.9.*.z.r.F.H.E.A.A.y.d.D.p.p.C.d.p.d.J.J.C.J.L.d.p.L.C.d.L.J.'+K.a+u+2+X.<+[+s+n+3+9+A+5.+.(.1.s.e.(.).G.3.4+S.b.T.R.Z.>+0+t.M.m.r.~.,.,.2.%.+.` 2.).).|.{.7.|.E = : : : : : % % : : @ k & : : $ = = & x # 3 5 T - P p G ' g } ' < ) x $ % % = ^ - > > > @ ) 5 ^ ; ; y > t ' m f ! l P > y * w = = & 4 + q C h J J J J l > ; | : % % s s % : H F - j ' l b u / 2 , B D > q J E m * w h u B ] ] # 3 * 3 K G 0 .d Y 9.-.2 Q z G P ) x f e % A c ] ) Y & + ` V 9 < (.A I } W 7.L ).d.a.9.1.z.F.r.x.x.x.9.h.*.G.r.*.z ",
-"m W i (.5.!.e {.B.d 1 N #.` ,.! # , } . | 2 K 9 4 ~ a O (...! N { + G L q.G.z.n.n.K.u+S.T.p.t.3.d.M.u.F.r.E.'+3.k.h.F.0.m.E.h.z.*.h.e.f.9.1.*.5.*.x.x.x.z.G.k.H.s.w.s.w.A.L.d.d.J.C.L.J.C.C.D.D.C.d.4.V.X.v+B+U.V.n+m+Q.|+|+z+S.t+[+z+4.x.}.&.u A ).B.t.v+1+U.t+P.%+_+)+c.3+v+K.4.k.e.[.(.2.1.G.f.1.H.G.].a & : : % : : : % % : % @ m 5 = & $ & = . x x ] * 9 @ T P l t h _ F @ * . : % % x + T F - > T ) ^ + 3 ^ 9 P v J p J v J v _ - ) x . & w 3 - h k ' g I g } I h ^ = | % % s s % | J d O Q 6 G ! D u 7 B M < T > @ 3 x $ : | $ & w 4 * 3 + 9 k A U A n <.).c / a B O P 5 . E { # 8 P : N 5 % o =.! v B |.u k O {.~ Y a.^._.a.f.q.h.5.h.*.*.x.B.r.s.w.F.d ",
-"' .<.$.6.X X 6.#.' R ~ i.W <.q p #.z + _ +.A H t =.C M /.R R n t 3 T U F.5.9.a+t.C.4+4+'+m.O.t.F.M.C.G.0.3.D.J.*.h.t.9.k.'+z.q.8.a.7.q.E.B+y.a.L.m.h.C.d.9.F.d.E.k.p.y.A.L.L.L.d.C.J.C.p.y.L.N.t.N.N.a+9+1+n.U.2+W.y+Q.Y.[+)+D+t+1+X.D+V.E.@.o M ,.F.'+B+N.J.x+P.`.$+`.R.Y.X.b+B+3+3+3.w.J.K.A.m.v.J.B.Y . : % % % % % % % % % : @ 2 h x & = 4 = = | $ & ] 4 4 + H P h > q 6 ^ ] = % % % # 9 P F C T ) ] & # 3 5 6 > l l v J v v v h > @ 3 4 w 4 ^ T l } O } g M M G C ^ . $ | : | : : : x T _ y T p O O o I o p q H y 3 w | | | : | = w x ] y q _ J f Q [ &.[ e ( A Q u g v + . 6 o g } 7 p ] % | b e < - 1 '.2 o 8 ).e L F.-.'.[.g.j.j.7.8.q.^.5.F.s.A.d.k.A ",
-"5 { Y N L ;.Z m C . Q >./ a 1 k q 1 k 4 } L ! < f U P ~ L d =.a t 5 + W r.a.t.b.y.M.t+I.A.o.B+H.A.u.F.z.3.'+C.^._.F.E._.A.m.f.[.g.}.}.1.E.9.6.5.1.I.h.D.d.z.B.o.C.A.O.K.A.w.'+n.a+J.J.L.w.0.D.d.'+C.4.u+n+5+M.T.C+m+Q.<+D+)+s+<+X.v+U.o+n+0+M.A.g.[.9.1.,.7 K v.C+[+&+*+*+Y.9+ +)+%+.+A+c.C+o+u.u+n.d.>.> | s s % % % % % % : : : ^ n h | & x w x : : | : : : w ] * H y 6 H y * x = : : & 5 q < < F H 3 | | . x ] 3 6 F h h _ _ l t _ F 6 ; x & x 5 @ C p } } o M ' v > + & = $ | | | | : | $ 3 @ - G ' k v t v P - y + 3 x = $ | : : | . x ] - J g E a r S 0 L i N ( Q u O v y 4 & $ $ | | : % % % 4 5 # * ' a ' O R [ X ,...-.,._.[._._.}.j.{.^.5.r.l.y.y.w.Q ",
-"3 E A V +.K P w 4 P 7 Q B k 5 & = ; # = H l H P 2 <.N / f Z a m v ; > |.r.z.K.w.0.o+4+T.t.5+y.A.b+I.y.s.O.C.e.6._.D.q.'.p.l.:.,.$.2.i.].C.].2.[.:.N.x.D.G.*.1.T.'+D.c.D.l.d.K.d.N.L.d.D.y.p.D.D.N.t.u+b.2+x+o.C+z+&+Q.D+<+R.s+[+|+n+v+M.3.O.c.o+S.0+m./.B @ T V 8.u.t+9+z+<+[+&+l+$+}+|+R.l+R.2+5+B+'+0 ^ : % % % % % % % % % % : ^ [ ! $ 4 = & ] = $ | | : : $ w ) * ] 6 F H H + ] w * ) H < J J t > ^ | | = w * 3 @ T < < t t k G t C T + 3 4 ] 5 H P G ' ' } } l v P 5 & $ : | $ = = $ = x @ C l } o } t p p ' k l F > @ 3 & $ | = & x ; 6 G z 2 e 8 j ~ ` +.+.i N ( d O v > ^ # x & $ = $ | : : : : w ] H _ p o f f ( 8 Z W >.2._.2.i.).6.6.8.e.z.F.w.0.1.A ",
-"3 , #.#.2 y ^ @ q Q Q M M v ] | | $ $ w x 5 t , i E m m D E u ! l ; G ).G.k.H.L.L.T.b+L.L.a+B+0.c.u.E.s.c.m.0.x.~.m.'.6.w.(.@.W W !.i.$.y.1.).).).N.z.B.a.7.w.M.E.N.3.s.l.a+I.0.E.A.p.y.L.N.J.J.t.v.V.b.S.v+2+9+9+}+)+|+Y.m+r+d+&+Y.z+X. +o+u.3+%+}+3+a+3.H.$.V B '.u.V.2+2+)+r+y+&+*+[+C+9+m+R.u+0.[.D = % % % % % % % % : : % % . D V * x $ = w = $ & | $ | | & ] & 5 T q F q T 9 9 > q F J g g O p 9 ] = 4 4 ^ ) @ H - t I G I I l F q H 6 ^ ; y - P v t v p l v t - ] & & = 4 3 ) 3 4 * + J J G f u E M I ! D D o g G v C 6 3 4 x x 4 6 I , 1 K <.+.=... .!.-.Z U c A ! I k - H 3 * x w & . & & & = 4 * H P J } f B N S #.@. .,.i.i.2.}.6.].e.9.1.H.w.H.1.Q ",
-"^ 2 c m k t t P O D ' h < H = : = $ x ] w P Q A { D A a Q 7 f b v + , !.6.h.B.y.A.0.d.y.k.0.w.l.p.k.*.h.y.'+9.{./.].].8.@.j S i S L i.).f.{. .>.%.'+F.6./.~.u.H.5.3.s.*.w.4+E.H.l.k.s.y.D.C.C.d.J.U.b.m.3+t+C+4+<+}+s+D+W.}+|+c+`.R.z+Q.9+A+t.T.D+.+w+%+3+c.U.I.3.C.x.f.h.y.9+Y.n+0+x+t+2+y+r+v+d. .i @ % % % % % % % % % % : % % : h &.> | : : : $ = | | $ < 7 @ = . # 6 6 ^ y T > F P @ C J } g g G h y ; ^ ) 9 6 + + H h J J t l h C C H + 3 ; 5 y H > > - F > < T # & & w x ; @ 9 6 ) + h O O M B d E f u n ( d B u f I _ C 6 ) * # ^ < o 2 U <.~ -.....!.%...Z 8 c { E f } l F 6 5 ; ; x ] 4 w w ] # * + @ > G M u 1 &.U 0 +.=.;.!.'.2.:.[.{.f.9.z.r.B.5.z ",
-"4 v ! M b k ' p J v 6 @ T ] | : = ^ # x y e { d a 7 A 1 e / d z F T ( ;.|.5.H.A.p.D.t.'+w.F.B.r.l.F.9.9.*.x.h.7.}.i. .` i [ r Y r [ X i._.+.X W }.N.^.,.(.f.C.j.G.I.k.1.w.V.l.v.0.b+y.A.p.L.d.L.t.4+'+t. +9+O.A+[+r+R.|+7+&+s+8+7+|+<+`.Y.9+1+n+1+M.u+Y.l+,+m+|+c.B+v+a.L a.D.b.K.4.T.C+m+#+s+M.>.+.o } A ] : : + T & : | : : % % % 6 1 P | : | : : | | w = F g ^ w . # ) ^ 5 6 9 T P - q P G M M M b ' < > P p t _ < F P h v p l l _ l h F 9 ^ ^ ) ^ ) + ) + H q T ) * ] 4 * + 9 P < F H - p b f m a { { A 1 [ r n 2 { B f } v F T ) ^ 6 J z V U Z -.;. .,.(.(.;.=.0 &.1 A z m ! ' h 9 ^ ^ ; 3 ; ; ; 3 5 3 5 y 9 l v } { 1 U S S j #.` !.>.2.:.}.g.8.q.*.1.a.D ",
-". t b g o } H q t y 3 ^ ] w & 4 5 w & 6 A A ! ( d , 1 c [ U V B - _ N ;.^.0.J.N.J.d.L.m.D.H.G.9.x.1.r.9.*.h.e.{.[.).;.` S r c 1 V c Y R i Z Z ` 8.j.'.%.,.j.7.}.h.B.a.8.9.t.t.s.y.u+y.E.y.D.D.'+c.o+N.m.n+V.U.o+r+P.z+R.w+Q.Q.d+P.D+R..+}+Y.[+}+2+M.b.c.s+)+C+9+M.1+9+v.l.b.^.j.1.n.z+m+l+c+3.{.u Z E g X * s l O ~ T % u r 3 B 7 . D -.v % : : : : % % & $ : & & $ x 3 x ) ) + ] ^ y + H > k g M f m o G t ' g O o } ' k G ' t P _ O Q u G F @ @ 6 H 3 # * ] ^ 5 ^ 3 ; * ) H h p k J k _ P k b z d 2 n c 1 U S U N 2 Q B z ! } p - + y > k u / &.~ -.!.i.)._.i.%.@.#.i e / Q , 7 D ' h - @ ^ ) ) 5 ^ 3 # * # # @ T - l ! Q 1 R R 8 S +.@. .%.i._.j.g.7.8.q.j.O ",
-"w h m 2 ! ; H p 5 . @ w . ; = & = . H e ( O u D E A 2 A e Y ( ! 9 u <.}.9.'+t.4.N.L.0.w.s.F.l.1.x.f.5.f.q.^.8.g.~.).%...Z &.1 / A A ( n <.{.-.i.'.X @.-...!.>.i.2.|.~.j.{.q.9.z.1.w.E.s.s.E.y.v.b+U.t.N.U.3.u+C+P.)+n+<+y+Y.c+r+ +z+P.s+r+9+*+7+|+1+U.v.L.C.u+c.d.5+v+C.K.v+y.k.H.N.z+}+8+S.h.g E 0 6 > i = y U P r @ q d a Q c { E Y (.' : % : : % % : | h z ) $ 3 ' o * * + ] & 5 ; # ] 6 h t G o f b ' } b D z f m ! g ' k t > < <.6., t C 9 f #.d 3 w & w x # * 3 ) H > h ' b M } k J l k M f 7 d Q ( 1 U S K r ( Q u u f } v H + H h G E / &.` W ,././.i.$.!.-.<.0 U N V ( A d z M k F H y + y y * * x # 5 + q C < o E d { A e R S ~ W ..'.|.}.}.~.].~.(.' ",
-"# O m } ) T - x & ] C ] = . | $ w < Y U V K e / e [ L U c A A l O R >.^.F.J.v.B+u.m.J.y.k.w.s.H.1.f.a.a.8.].].j.~.|.(.%.-.0 [ n { Q a { c X #.Y 8 L #.+.-.-.;.%.%.i.|.~.[.].f.1.r.F.w.E.k.0.p.C.N.'+m.t.I.B+O.0+n+D+D+D+Q.r+r+R.z+|+r+W.z+C+Y.y+*+n+2+b+4.D.c.m.d.v+y.E.U.n.D.C.E.G.u+&+r+D.{ $ ~ o : m D % V c v ) s s 1 S % Z 0 3 ~ K f $ : : : : s s J ( X 6 $ A G V 4 # ) = w + ^ . # I 8 B M j z M 7 Q E d , E B z m M G k J k !.#.b J F H I ,.J 3 ; w x * * ; 6 C v ' O b , E z ! g G I M f f m u d n &.L S [ N / Q , b ' P 6 6 P t O u V j W '.).:.}.(.!. .-.=.~ +.j U 1 ( A Q E b G t C - > - y ; 5 y @ T h v G M f D E , / Y K <.-.!.$.2.|.2.)./.|.>.} ",
-"& * 4 ] - 9 . $ $ y > $ 4 x . ; ! L #.8 ~ <.N &.8 +.#.&.1 N b t N K 2.*.p.3.b+B+b+n.t.p.0.E.k.k.B.x.^.g.].{.6.}.:.:.i.,...+.K Y n 2 d Q { a ( V N r K 0 <.X W .. .,.2./.[.7.e.x.r.l.k.E.E.y.d.C.'+'+N.N.v.3.c.5+3+D+s+[+W.W.*+W.Y.R.D+D+D+n+n+<+n+X.S.5+c.I.L.o.b.k.r.G.V.D.k.E.l.*.'+R.t+i.@ ' S + x K ] | ~ n % x s - +.4 C X H F V d 2 = % % % s s s ] ~ d $ : 8 F 3 = ] x : # + ; x C c (.m R _.M z Z ).d ,.5.2 7 u { { [ ( } Q 6.n z v > 9 1 j T + 5 5 ; 5 5 @ > J } M b m B U R u g J k ' g g O b Q ( r S j i Y 1 2 B M p > y J h l I u N Z >.i._.:._.,.W +.Z X -.-.` i e n V / a d D b I l J l F 9 9 @ H - l k ' g O ! m u Q V r L +.W ,.(.i.(.,.,.(.;.G ",
-"| $ x 4 w ] = | : $ : | w # > N W +.j 0 Z S <.,.(.@.L K S 1 v , &.0 ).f.0.b.a+V.V.c.3.J.0.E.B.z.9.9.f.].~.~.~.:./.2.%. .-.+.L [ c / Q u m D B 7 a 1 N [ S 0 0 <.Z ` ..!._.6.7.e.e.x.G.H.0.p.p.D.L.'+'+'+m.3.b+1+S.D+|+Y.P.W.r+m+Q.Y.D+|+|+D+9+0+0+S.0+2+v+U.4.0.s.l.F.d.B+x.B.*.f.8.A.n.].^ $ ' g G J - % & [ / 9 P : E g | N } $ V ! m 2 & % % s % % : D ~ # : : ! R | = . $ $ * # 4 3 6 A K ' (.A F , 8 ..0 ` _.7 E c 8 B j.[ g #.:.1 i.+.F T ,.7 H y - z f + 6 C t ' } } g M { j.K D O k l v J h k M u a e S <.L [ e / E g C E !.V h v } 7 e 0 ;.,.'.i.(.!.@.Z L #.;.!.=.0 &.e N N 1 n n d ! ' J t _ > H + y 9 l k ' ' G O b o M B A n R <.=.;.;.;.W .. .-.G ",
-": & . = w $ % % : : : w H ' c X >.i &.0 K ~ (.[.|.>.X =.&.z u &.U -._.e.w.u.c.4+v+5+O.v.D.s.1.9.e.q.q.7.j._.i.).>.>.....X Z +.S &.c 2 , D ! ! b u 7 Q ( Y U i L K 0 +.=.'.}.6.7.^.e.*.1.k.0.y.d.C.t.N.'+N.I.o.V.A+ +|+s+W.Q..+}+&+&+R.n+X.<+n+ +0+x+x+v+o+A+T.u.3.o+w.K.B.9.h.5.a.^.G.` ; % % % | & w % s : T _ ^ s . D & ^ Q w x 1 l p &.; % % s s s . j N ' ] l * X w : : : $ w = 4 3 6 @.g ( !.> 6 q +.-.! ,.[ f A ).O N i.O ! ).>.7 0 L F z i.q 6 - [ { @.y T _ } g ' ' k ! +.7.8 D g 2 b v P > t } o { R j X 0 +.S V , I y J ;.> > p D / &.<.` .>.%.>...X Z <.#.@.%.;.=.Z X W =.r e 1 Q ! ' p v l C H 9 9 P ' I G k k k ' J _ k b u Q N K +.-.~ +.#.` j p ",
-": = $ ) 3 : % : | = ; _ o [ :./.r &.U r Z |.^.e.j.%.X Z / D L j L .}.9.p.n.O.x+C+3+v+O.b.D.l.z.*.^.8.{.g.:.$.'.!.>. .@.=.X #.<.L [ n A d z b b f ! u , 2 c R 8 8 U #...,.2.|.}.7.q.*.B.l.s.p.C.'+m.u.N.N.v.b+c.V.S.R.*+.+r+&+}+d+7+.+Y.z+z+Y.[+|+<+3+x+2+A+U.n.b.b+b.L.H.B.9.e.8.q. .y | % % s % % % s s % % % s s s % % % | % | 3 . - U ) : % % s s x / M # 4 B t u : % % : | | : = # 2 $.N N L J ) m >.t A >.p O ;.#.I $.R p c :., g '.Q < j S H 6 U Y , a @ 9 C I o } ' p G '.<.E b U i Y A @ y F v g d c &.0 +.q.|.<.c g > &.8 _ p m 2 &.<.-.` .. .!. ...=.+.X -. . .%.%...].0.$.<.<.U V u O I k l < F - q l D Q f J t h T H 9 _ k o E A r &.K K L L j i _ ",
-"% % = w : : | = w 5 F z @.a.2.8 R [ U ..~.a.8.6.$...-.1 B K +.j Z %.].B.C.n.O.2+S.9+X.x+U.t.k.r.f.8.6.[.}./.(.W ` =.` ~ Z Z j L K [ 1 V a D b M ' O ! ! z a n 1 e [ L ~ @.>.i.).[.7.q.5.z.G.k.p.J.'+'+'+m.I.M.o.u+x+n+m+.+`..+`.d+w+,+y+)+Y.&+.+.+P.D+C+2+V.a+n.3.v.4.'+D.A.E.r.q. .P | : % % % % % % s s s s s s s s % % % % % % s % + i @ : : % % % % | = : $ ) y w % % % : w | : | x E 2 t 7 V h 6 8 / q ~ i { G 8.K c ).2 o -.#.p S K _ k 2.M 9 g ;.b h ; 3 y - v k I t J z _.b p { .T E >.3 + T t M d / N U ,.1.;.8.|.z f [.V E d / ..).f.$. .{.i. .'.W =.+.=.#.X =...!...e.H.W -.-.<.R d ! } G t < f k P ' +.~.o _ - H ^ * 3 > h t I b u d / n e R 8 e _ ",
-": % % : : | = . x @ B @.j.~.,.K R i !.e.G.1.8./. .-.+.&.K +.!.~.,.$.].l.4.a+A+x+X.z+<+z+0+c.J.H.*.8.~.|._.2.$.;.X #.<.<.Z #.L j K &.Y V A B f M M O } g f E 7 A ( N r K Z @.!.$.|.6.7.^.9.F.s.0.C.N.J.'+I.t.K.B+U.5+ +)+}+-+:+y+w+i+++#+7+7+l+e+#+8+r+[+n+v+V.u+T.n.u.m.4.t.L.G.~.} | : % % % % % % % s s s s s s s s % % % % % % % % @ S + % % : % % % : : : % % % % % % % $ 4 | | = & 4 4 . 9 l * 9 Q _ > c z F E (./ Q @.A B @.[ a <.l k Y _.1 f Q .o F y ; + 9 F < k I } K ` v v i [ ; K <.* 3 H l M a ( n N '.]./ [.q.2 -.q.V [ j g.,.5.m.}.8.C.l.>.L.,.+.+.~ <.<.X ;. .%.y.7._.2.>...S ( , D o G o ..B v } ~ ..k _ 9 ) # x ] + - F l G } ! B a A ( c N P ",
-"H S 5 l c 3 < u < / }.B+'+^...i L >.{.1.s.*.g.i.W -.+.<.~ 2.h.*.%.(.g.H.4.V.4+2+n+D+<+D+D+t+U.C.x.{.~.).i.,.!.W ` <.S i L 0 i 8 U [ e ( A d f ! o ' G G } O g m B Q ( c i X ..!.,.).[.].^.h.B.l.p.D.d.L.N.N.v.K.B+a+1+D+)+&+y+`.l+e+++!+$+w+%+i+f+++w+y+Q.D+x+1+o+a+n.K.4.v.L.h.a = : % % % % % % % % s s s s s s s s % % % % % % % % @ e ] s % % % % % % % % % % % % % % % : : : : $ $ : % : ] 5 ] * 6 * 4 H C q k } p k E M ' A n 7 l l t A j M l f Z { l @ ; 3 ) 6 - _ v O $.<.g C [ k q L b x x c './.].8.i V [.-.c f.(.j.B+t.H.*.H.T.m.2+A+u.b+T.0+z.x.!.&.[ F.E+`.#.` W ~.J.].E.'+%...=.]. ./ M f i [.7 k a g.&.O _ 9 ^ ] ] x * y 9 F C h p } M f E d A F ",
-"p K u ( ` g Q ;.t R H.V.J.m.$.0 '.y.b.G.^.~.[.2. .0 Z -.j K 1.].>.(.8.H.4.c.A+0+X.9+<+D+[+D+x+B+H.a.~._.(.>...=.+.L R Y Y [ [ R [ e n 2 a , E ! } I p v p t v k O b D , 2 &.<.#.X !.i.:.6.8.*.1.l.w.p.p.d.J.N.b.b.o.c.v+C+<+[+m+&+`.%+#+$+w+,+d+Z.@+++i+w+}+P.R.X.2+5+O.o.3.d.$.+ : % % % % % % % % % s s s s s s s s % % % % % % % % + , & % % : % % % % % % : : % % % % % % : : : : : : : | ] . | 4 ; $ ] q F < C < P v p G k G I J v v k ' } t h C G J + ; # * + + @ H - G <.B y 5 g } o z : : $ 1 d.E+E+E+{.L 6.U ,.}.U )+E+E+x+L.b.K.E+E+E+e+4.%+E+;+m+8 /.X.E+E+G.0 X >.s.A.a.*.d.,./.x.0 ~ (.I m '.Z Q E -.^.Y [.i C 6 ^ ] 4 # ^ @ 9 9 q C p I ! f E 7 > ",
-"k !.p A =.p A e H p ` |.S s.*.:.L.K.T.'+g.].l.].1.6.~ j 8 ;.H.,.).{.z.L.v.c.4+t+X.<+R.[+)+Y.<+v+I.x.{.a.(. .W X Z L U Y 1 n 1 c 1 / / a n ,.8.,.b k p t _ l _ _ l G } b , n U &.U ~ @.%./.6.j.q.z.H.E.y.d.L.J.N.4.M.T.u+4+S.|+)+P.&+d+$+Z.#+i+,+e+w+%+#+#+$+`.c+Q.s+z+t+u+o.p.U = % % % % % % % s s s s s s % % % % % % % % % % % % % 6 , & % % % : % % % % % % % s % % % % % % % % % % : : : & & = w & | ; T > - q h > h t o o } M ! o b u u ! k t < F 6 ) 5 # 3 ^ ) ^ @ @ 6 - + x . 5 l T $ | | = 5 o E+E+E+8.%.:.Z W e m.E+E+|+q.k.v.s.:+E+e+_.'.~.E+E+E+N a '.E+:+[.j #.|.L.^.j.p.z.>.f.q.U :._.p , 2.B ! ( 6.|...;.i h > @ ) * 3 ) @ T T T > _ ' f B , a - ",
-"S ! w #.a 3 R 9 x 5 ;.a f ].%.8.5+b.I.F.e.p.N.(.p.f.X S U }.1. .[.9.k.d.b.c.1+C+m+c+[+`.y+m+7+Q.o+m.d.m.{./.;.~ 0 S L r / a A a a , Q a ,.e =.j.&.g J _ v l h < < _ v G b 7 c e 1 S +.~ !.,.:.f.1.x.B.k.k.0.y.d.C.t.M.M.o.u+t+D+[+*+&+8+$+!+$+%+l+w+w+e+$+%+d+.+.+m+)+z+C+b+p.U = : % % % % % % s s s s s s % % % % % % % % s s % % % 9 2 & % % % % % % % % % % % s s s s s s % % % % % : | % | & x $ : : # y T ) 6 T ) - p } p g M b m B 7 7 u } } p h T + ) # # ^ 5 3 5 + ^ ) # . $ $ $ w * w . & ] ..E+E+E+p.,.r B z L y+E+E+v.{.F.y.r.E+E+b._.,.7.E+E+E+2 , 3+E+ +N 8 ` e.F.).r.s.,._.x.:.<.7.` I S Z } f K 9.+.Y >.A v h q T y H 9 H H H - P J o E B a Q q ",
-"S q Q <.@ t i + * G ` @ 7 ` v W J.G.H.F.9.A.y.[.0.@.+.0 L k.g.'.~.9.A.v.B+u+2+<+m+c+`.d+`.7+,+8+9+o+4+I.A.'+2.W -.{.B.i V A K r 1 A u D z ! ( ~.<.k l _ < l h F P P C P l J O o z / e R S -.).t.s.7.5.z.1.r.G.k.H.y.'+t.u.M.O.1+C+9+*+}+w+%+w+l+8+8+l+e+w+,+7+c+.+Y.[+|+C+O.D.&.= : % % % % % % s s s s s % % % % % % % % % % % % % % - a & % % % % % % % % % % % s s s s s % : : % % % % : : : & & : : | 4 @ y * @ ) 5 - p l < I o o f z , { Q B f b k v > y * 3 5 3 ) ) + 3 5 # = = . . 5 9 ^ ] 4 ; Y.C.E+E+K.L - < G &+E+E+,+q.[.6.7.5+E+$+x.[.[.0+E+E+a+V (.=+E+$.( r #.{.q.~.e.$.;.i.a.;.2.}.m , >.i D 2 _._.e W |.f } J t t _ v h - - > < p O u Q { { 7 > ",
-"_ t +.n J R 8 h T N N G R # @ ~ ~.U e.1.H.t.'+e.!.+.#.#._.w.'.).8.r.D.3.A+o+5+0+.+7+Y.i+,+&+#+c+W.<+<+D.h.m.}.@.H.!.H.+.Y $.%.[ 2.c b } g } S }.} h F P P C h G t } F T C > F _ I z 7 B 2 r ..0.$._.[.8.8.q.5.*.z.1.E.y.L.4.B+c.o+2+3+[+i+l+i+e+%+d+8+w+,+%+7+c+m+Y.Y.[+n+v+u.L & : % % % % % % % % % % % % % % % % % % % % % % % % : < ( & : : : : : % % % % % % % % % % % s % % % % % % % % : w | % % | x y 3 * # w * H C F C k ' } D u B a 2 Q 7 E m O v - y 3 5 ^ + ^ ) 3 5 ; x x 4 3 9 q T + @ l E+(.E+E+K.Y q ^ 4+t+X.E+Y./.[.6.6.r+E+y+*.{.l.e+E+~+~.r *.E+E+a Q A *.8+,+l+E+^.#.#.U.e+E+E+x+(.h.}+E+>+c.=.` L.7+E+m+}.' g G k m.E+C.E+E+v.M z Q a { d 9 ",
-"= ) ! O G u u v f ..7 P = & * Q ` R n 0 5.c.v.a.;.@.X =.e.0.>.~.F.4.J.M.2+0+x+9+c+D+&+w+Q.}+l+&+.+c+&+u.m.L.(.e.z.~.%.i K G.-.<.a., b I G d 2.! q - - q - > E M Q .J 9 1 j H &.;.k } o e 1 ).}.L ` !.2.}.j.j.{.6.{.h.x.E.A.J.4.3.b+u+2+Q.Y.r+7+l+,+7+7+%+$+y+&+w+w+c+}+&+|+a+i.* w - : % % % % % % % % % % % % % % % % % % % % % % : p c & : : : : : % % % % % % % % % % % % % % % % : % % % % : : : | | $ ; ^ ; & $ ] @ 6 H - l l k b f D d Q a , 7 u b p P 9 + 3 + ; ; ; # 3 3 x & = 3 q > q > F 1.P.(.E+E+m.t ; ` A+B.=+E+*.2.[.{.p.-+E+|+b+O.%+E+R.{.&.R }+E+T.Q 7 S.E+T.` `.E+<+8 i &.b+E+r+J J } *+m.i.U 8.[+:+A.3.E+E+! f ` I.E+!+x.2+x+l.z a a d d 7 H ",
-": $ ) > < < l M -.X ; x = = & * _ o O r 6.z.D.'+e.W -.|.r.r.6.6.0.u+b.n.A+3+<+Q.D+n+y+m+*+l+d+}+y+%+.+ +o+z.(.p.e.j 8 i <.7.>.$.-., m } d W O H H @ + @ H m [ F R K ) u B e { n #.q l ( i A i./ Q Y 8 Z ` !.).].^.1._.j.G.k.k.y.t.I.3.c.5+S.s+W.c+w+%+$+=+,+r+*+.+7+z+<+m+r+5+9.- + +.: % % : | : : : : ' f h = s 4 ; = s s s s % % : ' e $ % % $ | % % s s s s s s s s s s s % % % % % % % % % % : = x | | 4 x = | $ 3 3 4 ^ T C v v G b f E ( { / { B b I v < H y ) 3 3 ^ 3 ) * 4 4 x ) < J p p I x+2+{ P.E+V.+ x c.'.6.E+E+@.(.:.6.K.E+E+L.d.A.w.k.<.<.i U E+E+*.2 a r+&+K 1 E+E+9+r N ( ^.E+E+v < [ Y.a o 7 B+E+3+7 m E+E+..Q , 0+E+x+b ! z , d A 2 V A E H ",
-"% % $ x 3 9 P / i.U > 9 + 4 . x 3 - p S 8.&.K 9.D.2.....!.2._.8.d.u+B+U.A+t+|+&+D+[+&+Y.P.d+7+.+d+++7+r+S.0.8.N.5.'.).#.,.B.$.X [ V { U .p q I 5 3 ; 3 P 0 G O @.G + @ c K > U D ^ D ~ J l ` - l ! d A N <.g.` 9.e.W {.F.D.G.y.b.A.u.1+u+a+S.<+P.c+e+=+l+m+P.W.l+m+9+3+9+l+<+0.o & l % % : : | : : | : - X e & s B Z b 4 k w s % % : g n = % 3 9 J = % s s s ] s s s s s s s % % % % % % % : : % % = w : $ ] & & $ # ^ . x 5 + _ v < t I I 7 d Q V / , f I G v - 6 6 6 T - H 6 ; 4 4 w y J k G O }.E+! [.E+E+e.* E+=._ E+E+B.#. .(.|.E+E+d.Z L Z L L S L K z+E+E+Y 1 2 z r {.E+E+E+V V { E {.E+E+h < E+P J O ~.E+E+7.g.m+E+E+2 n 5.E+E+{.E , A ( V n ( / / B ) ",
-"% % % : = 3 h u { , } p v < y ^ @ q P E Z i Y W i.#. .'.(.).}.h.d.m.v.b+v+3+X.|+[+)+)+Y.Y.W.m+}+%+i+l+&+[+U.H.l.z.2.@...^.y.z./.#.S ..{.!.#.U m ^ ^ ; ^ z =.G 8 ` 6 ^ O ~ T I &.# 6 S B ^ f V + H - < G d /.R K 5.0 +.}.2.5.'.w.D.w.U.t+B+v.c.2+ +[+8+y+Y.*+[+c+8+|+C+3+X.}+D+N.c 6 = s = & $ | : | : % % 2 R s @ u y s s # g s % % | a / : ; n - 8 i d s y [ Q s s s s % % % % % % % % % % : : % % $ = % $ & w . & w x 3 6 9 + h P - < t _ g f E { A 7 z m g p F 9 C < l F - y 3 ] w w y _ v J G 4.Q.M =.@+E+Y.+.b+1 0 E+:+[.Z @.>.l.E+E+e.S &.r [ &.K K K 7+E+7+8 r ).n.t+x+f+E+m+D D z f ` @+E+i.N.J.h l v m.E+r+6.[.j.{.f.( c L.E+=+i.1 &.U U U [ e A A E 6 ",
-": s % % : | ^ - 6 T P p O I G J < F - < ! A 1 d u 7 1 =.$._.}.q.k.'+b.O.v+0+X.9+|+Y.m+P.Y.Q.r+}+%+c+.+`..+n+v.a.$.!.).B.x._.5.F.[.` $.!.X #.V @ 5 * # ^ z r g e 8 > < c E H &.{ _ O L 6 I 8 f ) ; 5 ) C e 8 g .@.g m &.>.&.<.5.).{.3.3.G.w.J.3.O.X.W.X.9+z+[+r+&+3+3+S.z+c+ +u.2.[ P # u i c G a + $ % : < ~ v u ^ s s s 4 L s s : $ 1 a $ d Q % ^ F F % w X k % s s s s s s % % % % % % % % % % % ] y y x : | $ . w x 5 q H * F > + > P F _ ' f u f D E , z M t l G ' t - T @ ; ] . w ^ q P _ v E+}.o 2 P.E+E+E+w @ 1+E+n+&.#.W .*+E+E+j r N V e e e &.j E+E+H.S }.:+E+ .o E+E+i.J O b } ( W.E+W.E+t _ l _ E+E+~.} } D a ( V N n+E+ +1 [ j Z S i K R V ( m ^ ",
-"% % % % % % | ; q T q C J b f D O p l t t h p ' o o o d i .[.q.G.C.u.U.o+C+X.X.R.R.Q.&+c+Q.y+d+w+y+&+c+}+Q.t+y.g.'.'.s.G.!._.w.e.X L R Q b J - 5 ] x 4 @ - + _ p 4 > B @ q ( h 4 I Y > O L b P ] ] ] F &.Y / ` R > y / #.h 8 (.[ j.d.q.7.9.H.J.n. +C+c.4+1+S.*+D+0+t+3+R.W.1+4.{.K h m U j j A 2.u - ] | 3 +.e 4 s s s s 5 <.) s % $ , p > <.< % $ : % | t <.% % s s s s s s % % % % % % % % % % : y V X , % $ # u +.Q P > x ; q ^ + C - h < J I G o m d a 7 u ! o b o G F 9 ^ # ] 4 & 4 ^ T > m !+~ f ! 2+E+++V x o Q.E+a+j =. .,.,+E+8+U N A 2 2 V N U g.E+~+7.U a+E+c+d W E+!+S v I O } G v+E+@+~ I J _ v E+E+E+I ! !.e.Z ( #.c+E+D.c &.j j S i i U Y / ! ; ",
-"% % % % : : | = ; H q - - t ' b b g ' G J F P l J p o M f 2 j 6.s.N.u.c.5+t+X.z+z+R.)+Q.r+c+&+Q.}+c+m+m+.+.+)+x+k._. .2.{.}.[.6.,.+.<.i e 2 f < + 5 w w . . w w w w w = = = w . = ; q ^ 3 t y . x x x T 7 O k e f * y d 2 t d p { [.5._./.:.a.r.C.o+T.'+b.T.2+D+4+4+2+ +W.z+b+p.}.O ) B 0 :.R =.8.a E I y g Y / s s s s s H j + s : . N p Q &.T @ z u $ ] A 7 : : . J < s % & 4 = % % % % % % : : : . A ~ m : $ _ W <.T l # . ^ ] ] ^ T C H > J v P G b u u 7 B B , Q D } _ 9 + ; # x = = * * 3 y.)+/ z u F.E+m.@ ] a.E+E+'+<. .,.r.E+E+V.e { A d 7 d / ` y+E+`.;.&.}+E+&+A.f+E+W.(.l p } ' ' z.E+~ O M } t P P.E+E+2+t+=+n.#./ o.E+E+(.n R r 8 U &.&.Y N ( o ) ",
-"= ) + 4 & | : : | # > - y ) H F P l t _ t l F - C > _ J k ' D S ].w.N.n.a+4+1+0+ +9+|+R.R.[+m+W.W.W.&+r+Q.Q.r+<+c.z.'.!.@.!.>.@.X #.<.i R n , ' - * w & = $ $ $ $ $ | $ $ $ $ $ $ | | | | $ = = = = = = w w ] + ; . 4 > ' T w ] < e [ a R j @._.*.v.L.G.0.I.v+x+T.T.t+<+S.n.4.w.=.- # g .;.X 6._.i &.r &.O b K q % % % = o [ ] % : 5 i.E / I : f j 1 % q K 9 % ; m d L $ ] ! r a s s s s s % % % $ H ( L o % * V &.{ > @ & 3 # . w # > - P _ C F J t I p g E a A V 1 V d ' > y # w # t G F b+b+E+E+W.! u H.Q.{ ^.U.Z.E+E+:+7.B+)+;+E+E+E+2.d , u D m w.c+E+E+E+z.c e.E+E+g.m+E+W.i.J G O ' } z.t.} b M o t F E Q.E+E+M.a.( ,.3+E+E+E+C+( N c 1 V n ( / a B b ; ",
-". 9 P q T + & | | $ # - F + 3 ) + @ @ 6 F < 6 + ^ 3 ; ; + H P g ( S #.-.>.2.2.6.9.E.I.c.A+ +[+P.Q.m+&+c+}+y+.+P. +K.{.W X X X ~ <.<.K U R V a D k q ^ x $ $ $ | | : : | | | | | | : : : : : : | | | | | $ $ = = & $ $ | $ $ = . x ] 3 y l u n K '.F.l.f.l.I.U.o+4+1+u+T.M.L.s.:./ < - A i. .}.7.-...:.6.L p < K ! % % % y c z % % : 3 0 , 1 ^ % o S - = 7 ( % ] m n g D | C / ] + s s s s s % % % + f t A ' 4 G o i B T . 5 y F ' > 6 < C v p < P l v ' l g z E ( 2 e [ n 7 g h y 4 5 d ~ + : $ & ^ G f m M O p 9 x @ _ m n 8 ~ -.;.-.K c A , u m b ! u d a A ( a a 7 E B D O p t v p k ' } [.E+I g ! g J l _ k ! , a a { Q d B B u u 7 Q { { { { Q { Q 7 7 M 3 ",
-"4 F h 9 > P q * $ | | * > F y ^ ; ] * # * 3 ^ * x w & = w w 4 y h p p I I O o o b E Q e Z (.h.'+o+z+W.r+y+y+c+.+Y.t+p.2.+.j K K S i 8 &.Y A , m } v > ; . $ | | : : : : : : : : : : : : : : % % % % % % | | : | = | : | : : | = = . w x # + < ! V 7.a.}.a.z.F.0.p.C.N.d.d.*.K k H . y d ..|._.!.$.a.E.e.<.2 m e / ; % % } 1 @ % % : 3 $.<.d % q i 7 % - V v % h 8 f ^ & % T c < s s s s s s % % : l ' 5 1 O C G _ 8 < * # h < E =.f l r #.h &.-.o k &.2 k Y u M d , N c i .[ G C ) @ A / | : : $ ) v o f ! } v + x 3 F M A e K <.Z S N a E D D ! O M ! f u 7 z A f b M o b I k J J p I I B.I.}.O g o I v _ k f , 2 2 / ( a B z f b ! b D E E z u B f z z f O + ",
-"w - t C P h P > 3 = $ $ ] > P > ^ * x ] w w x w . $ | : | | $ = w ) P t J t t J l J I I g b M a R !.1.v.x+[+}+c+c+R.u+x.X U [ R Y e r c ( a 7 b } l > 5 4 & = $ | | : : : | $ ] ; . | % % % s s s s s s % % % : : : : $ | | : : | | | | = . w ; - U ~ +.'./.].8.q.N.}+|+|./ 3 : : & ) } 2 j ..,.$.|.j.|.x.<+ +S.W > % < c h % o.o.o.; |.~ h : O 8 Q H D K E 3 M X t # w w 2 +7.: s s s s s % % ^ G + T ~.z+5+O.C+X.a+b+' b 6 D.7+U p r +.f <.L J f @.<., ..n M z m Q e _.1.j.,.( _ M #.G & $ $ ] 6 _ g f o ' h.g.R.E+- o B ( R [ r n d z b O O } G G I I g ).W.D+1+1+<.G ' ' G k I 1+4.k @++.g g I G k t t o 7 / N N 1 / , z M g p J _ h I } g o o o ' O G p 5 ",
-"= 6 _ P < P P C > ^ & : | & 5 C - y ^ ] x ; . & = $ | : : : % % : | w + C < _ t < h l v k O O ' G } ! d K 2.E.V.n+[+X.v.2.R V n V n V A a d E b } v 9 ; 4 . . & & = $ $ | & * T q 5 . % % % % % % % % % % % : $ . x 4 x 4 x w . & = | | $ $ = & w 6 o , R j a.+./.v+E+r.} * | : | 4 T M e Z >.(.i.).)._.i.(.}+E+;.| T c v : B E+D+% ^ q.c # : P f 6 % k 7 @ % p r O T w l D r+A ! 1 + s s s % % b I % < L i R.E+@.! Q E+E+q #.7+E+@ F R Y D 8 ( > G 2 Z Y R A M } } b c {./.~ ^.@.o 0 ~ P ) ) T I 8 Z ! Y !.{.E+8.) ..h 7 ( { 2 n 2 7 u M } G J t _ h < > > z /.m+E+B v t } f ! ! ` E+E+E+0 t p p p J l v I m A 1 U S [ V B g l C F q + ) y 9 P < P v < P C F ) ",
-". @ > - F t t l _ h 6 & | : $ x @ > > f , G w & + . : : : % s % % % : $ 4 5 - _ _ _ _ J k O G p k k p k p g m c >.9.I.3.9.U d Q / 2 A a , E z o I _ T 5 ] 4 w w . = $ $ = ] y q F 6 x % % % % % % % % % % % % | * @ > P p } ! D B , m } J P h l P C < t O r+^.Y 8 <+E+J 5 & . | & ; > ! R =.,./.:.[.|.}.'.A.V.E+/.F a q : % E+E+o P ! 7.J % % % % % % % $ : % x @ y | % 9 g P : O b x s s % x > c ' : v B ..E+}.<.< % E+E+J U E+o+^ 2 &.- Q V h F t B =.Y 7 g I v ' O N :.#.+.^.#.r 2.r k t / z _ S Y 7 j 2.z+E+<.C - d ..,.1 V _.!.+.0 o d <.V v C q 9 H C Y F.E+%.C v } ! u B 7 d 7 E f o p _ h _ h C h I D a N L W ].;.u G - T H ) 3 4 x w # * ; ) 6 H q F @ ",
-"& H - < q l l v p v l @ x $ | | = 3 C 1 $.k ^ 3 L C | | % % s s % % % : : | & x ; 6 y q F < h h < h C F q T F h v I a [ 0 c f m z D B u m f ! g J _ 6 3 ] 4 w x & = $ | & 5 y H F @ w : % % % % % % % % s % % : x 5 q h I b , N R 8 &.Y / A n 8 ~ X ..~ 8+,+{.!.e.>+b.q 4 . . : . 6 - f [ X ).~.j.j.j.}.,.p.'.E+u.t . : : $+E+D+> v z X @ : % s s s s s % % % % % s % % % % % % % % % % % % = y C q $ 5 = l.E+R ( ' }.E+o.h D.E+[ < i k J 8 r t 9 l c =.e J l p t p G W >.n ).).n !.i.( D K 0 o e L m D D *.~+O.R l / L 0 L [ &.!.).~ B 7 &.L A _ h - 9 T B Z o.E+%.G p D / Y S Y V r r V Q m } l P - 9 q ' z { r j -.'.S D I H y + ; ] . = = & & x # ) 6 T < ) ",
-"p K =.&.> < 7 o l m ' v P ^ & | | $ * n +.> 9 q m * & y M w % % s % % % : : : : | | $ $ $ $ . x # # ; * 4 # * ] # ; q h _ p ' } O } M o g O I t > 9 3 ; 4 x x 4 4 . w & ] ) + 9 F T # : : % % % % % % % % % : : | # 9 < p g E A e N 1 ( a d A 1 i +.-.p.E+,+[.@.H.E+/.++E+R.& : = 8.!+E+<+'.:.].}.].~./.%.E.j E+r+G > ^ T.: E+o.| 4 > *.P.H.D+D+E s E D+E+0 % F l.D+E s E D+j % % :.$+E+o.% % % % % % % % T.E+% | = $+E+M & u+E+5 t ` [+_.T.I.) - U d+E+^.F B '+P.S z s.`.E+l+}.r {.).y+X. +E+T.'.2 l o 1 x+E+U.r ! >.K p.f+6.E+W.Y } I .+s+3.E+C.- T 9 9 U ;.S.E+Z G O S j -.8...D+W.q.|.h._+z.f+E+`.{ C J.E+Q R '.8+z+( ..Q.E+V 5 w.R.a & . w x ] ; + T C P ^ ",
-"B v W n l Y ,./ D $.B p k } D , , $ y S g H C k P T 9 / N | : : : % % % % % % % % % : % : : : : % | | $ $ $ = = = = = . ; 9 < J } G l h h _ t > @ ; # 4 . . & w & w & w ] 5 H P C q * : % s % % % % % % : : : | | $ ] @ q t M z , d a 7 B m z d V r 8 F.E++.j 8 9+f+S + Z.E+= % T.)+p ,.E+'.:.~.}.g.j.'.y.E.U E+B+B b S V c.E+. $ % d.[+p s l.E+0 % % $+l.% % % o.s s |.$+o.s % o.D+% B E+% % % % % s s j E+l.0 0 E+D+Q x | E+Z * -.E+* ^ u+u+y q F ~+B+C < J 4+T v G.;+q.2 =+8.Y E.l+E+N.0.s+{.(.c b } g Y.)+a p e x.}+j.b d -+E+A ;.m+E+M.:.A+r H 6 q } W x.E+w.r G 0 >.U :.E.d+E+j.f.o.;+g+6.R ~+E+` } E+x+d &.J.E+L.V i [+E+' 8.^.- t ) 4 * ^ ^ y F < < v H ",
-"3 I L P J K X b j [ F t a n O +.E & o 8 x * } i / P { -.Q 6 v A ] P l % % s s % % % % % % % % % % % % % : : : : : : : : | $ x 5 H P _ F ] 4 # ] w & & & $ $ | | | | | = . 4 5 t J h * : % s % % % % % % % % : : : : $ w ) - h I o ! f b } k G } z Q 2 b+:+Y V K &+4.F ) [+s+= 7 E+c h K E+B+(.i.i.j.:.!.w.g.1 .+&+u @.1.< Y.++< y ..!+S ' : 0 E+l.% % o.E+% % :.% % % F D+l.% B E+B % F E+:.% % % % % % :.$+B % % % : $ = d E+d * ; j.x @.)+A+Q D E x+E+q P h.6 9 d %+a+t g r+m+, e U.=+1 +.1 7 U g h k i %+o+D k X C+A+0 / X y+E+_.n u+:+` K _ + y H T Y @.G.f+5.B 2 |.j ..9.=.5+-+5.^.7.i+ +<.j.%+,+Y / E+s.Q Z v+(+x.8 ` X E+y+z+7 1 S _ 3 T ' , =.r } } / ! ",
-"q =.( ] _ [ n ( Z ' q d Z } R ~ _ G U z | + ( X M 3 1 +.q p c r t o n s s % % : : : : : * m I - % $ H 9 4 # : % % % % % % % % | | w 5 @ * & = = = $ $ | : % s % % % % % % % w V .I ) : % % % % % % % % % % % s % % | . 3 6 C l p G I k v C H 6 _ g ' E+0+u m [.E+i.- 9 E+;.4 T.E+O.5+3+D+W '.'.$.2.'.;.l.[ A f+E+o 1+t _ E+5+} t E+t+N t | 0 E+0 : % :.E+B F :.% % % 0 E+0 % o.E+o.o.o.o.% % % % % % % o.o.% % : : : : $ b+E+= * # <.#+s+E+7.Q < < ^.E+S D 8.y v *.E+&+4+x+2++.E z E+3+a 2 B M J t _ G G.E+7.o g 7.E+0.V [ ;.Q.E+R R E+Y.,.A v T H C J $.[ 0+)+&.! +.g.%.{.*.,.E+)+L.j.4.E+N.(.l.E+z.d ~.E+A n U }+.+S a <.i.@+E+-.! K A T H e D Q '.V M j W b ",
-"2 ~ , > { #.V X j p ' N B B >.N p N -.} 3 - &.d $ - Y E F p z 8 a } Q = $ | : : : % % @ 7 v p A # H 2 K E E % % : % % % % % w h l # % @ z h : : : : : % % % % % % % % % s s x d W I y | % % % % % % % % % % % % % % | x ] + 6 T C P < C T F 4 = & 5 %.E+J _ _ 5+4+_ h 5+E+T ; E+X H _ , K X >. ...%.@.H.z.N , f+E+2+p v 4+E+G o j.E+7 n a y T.o.% % % :.E+E o.% : % % o.o.% % E+0 % % % s s s s s s % 0 E+0 % % % % % s $ E+<.w J E+}.= E+V.y ^ 3 9 8.E+U u+3 6 G 9+D+V h I p ' O j.E+E , V ( d a .n 8 9+0+u z m 3+X.r 8 #.Z E+H.S B.E+i [ z G h P h z <.x.E+F./ 2 =.[.@.].h.I.E+].J.7.d+c+'.7.d+E+W V E+X.Y U u.E+L.Y V |.3+!+E+2 l U J 9 [ U b >.-., d j.=.b ",
-"A S o O S j M N [ G , K V r @.[ z =.>.Q J e @.I $ b c @ . 5 J +.[ o ! H ; . & $ : : % f / ^ z e + q A Y o ^ % : : % s s % $ l / u 6 w a Z Y &.l % & v E > % | 5 6 4 % % s s q R 2 I + % % % % % % % : % % | % % % % % | w # ; ^ ) ) ) M L } $ | % # N.@+@ * o Y.C.v k P.*+q y E+E+y h e /.Z -.=.X =.j 1.i.7 M 2+E+L < P Y.Y.> l [.E+Q ( A S u+A : : : : E+$+% % % % F D+l.% % E+E+% % F E s s s s s s |.$+B % % % % % % B E+7 & s.#+$ _ E+A.. 4 3 > @ E+++y y q H o+E+'.v t i.' } v.f+f Q , Q , 7 i U Y r+B+Q a A +X.R L +.A.d+~ #.A+>+&.N a b I I G ! E p.:+_.c N [ Z j.W $.x+;+6.s.J.$+9+_.6.++i+@.=.E+'+S #.3+(+D.U +.^.4+Y E+A+c N t ' }./ i ^.&.2 V !.W n ",
-"L { G g D M t b J 3 J ( ' ! N k k Z L u D X @.1 g c K p w : y &.i } p l h F H ; . & 5 Y o ; r Q | h r _ | | | : | | : % % $ E u = % ) c f q L f % g d / ! % > 7 &.o % $ _ m { c l C * % s s : | | ] } I | $ % % % % s : | $ & & & = | ' 8 ) % : : - 7+c+:.| 6.E+h.I +.E+'+C H #+E+E+E+@+/ 8 L 0 j S @.b+j E b G.W.v t S E+C.F C 0 E+&+Q 8.t++.' F ] = | $+% % % s % :.E+:.% % $+E+E+E+$+s s s s s s F D+D+F % % % % % s D+E+C % |+E+#.s+E+k._ & 3 C + ++P H y q F m.E+E+E+E+S } n E+m+E E f u Q { A A k.E+y.2 ( / n.E+J.'.p.,+,.W _.E+7+&.c { 7 D f f u j c+}+=.r r U G.7+Z |.E+w+~.g.4+E+o+:.k.E+S.+.L 7+7+w.3.g+g+K.n x.r+G =.r+*+Z 1 ' a [.Z ,.h.` 8 e e...g ",
-"i b g G p p I p v 9 ) 3 y > > + 3 J g J o / 1 g } [ a y | : t j D + 6 h t I G v > + P / H ! R > 3 r 2 5 . & . & = | $ | : s o V 5 % h n q t 8 > J V d O ; 9 2 7 D l % z M w m } $ & $ s s s | $ 4 M K U &.o : 9 ' C C 5 : # 5 . | : 3 { z % s % % C _.h.: }.U.V.x.B.1+v+5+> 9 ; c.u+C o 7 n c n n D. +C+w.z ! B.' } 1+5+5+o+e.H C #.t+S.d B a ( A O T w 7 : : : % :.o.o.:.% % % o.o.% % % % % % % :.o.o.o.:.% % % % % o.o.o.B % 7 T.= V c.Q ] 4 + @ / R > 3 y T C J 9.4+8 T _ ` v+x+3+u z D B A / 2 0.3+ +D.( 2 d 7 p.z+I. .2.2.r.Y.)+R.i Y A B z f f w. +X.n+n+<+<+<+D+0 f.)+*+W.~.o+r+&+A+A+m+W.P.W #.f.[+n.1.o.W Z X.0+2+O S.0+x+A.m t m #.1 L i.U c ..h.x.R ",
-"Y , g G G p G k I G t H * # ) T 9 + ) 9 l J J v t p J v T ] Q g # | = 4 + F G v _ P F A 7 u t x t L t & = & x . & & = $ & ) < e > % a 7 ) ( f * ( / H = % { ( } y % ! 2 5 y g + % % % % % % % % . d { C V Q F ! Y N B H ; ! V m 5 % v 2 M 7 O . : 7 2 . | = 3 6 C G J h _ T y x 4 * > t M z B z D u B 7 u ! ! M o f I k l C @ + H _ ' ! m f , K <.[ / m ^ : : % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % : = . = # . ] + 2 ].+ * ] F q 9 q < v - T k I G D , D E D z u B , B A 2 A 2 a , 7 n &.+.>.i.|./.i.%. .S 1 7 m ! o ! , { n N [ U K #.Z L X W ,.i.|.6.~.6.~.[.:./.,.;.#.~ !.'.,.>.@.j n E O ! , A Q u M o o m d { a n $.x.i =.~ ",
-"3 k } g I ' g p k I G k C H ; * 3 > C @ 6 h t l v F Q j / R m @ & | | | $ x 5 T v k k ' O ' > ^ H _ 3 . . . ] ] w w . . x f f g # 5 8 I 2 o = ^ i 7 h ) y U d ) | 5 [ J s , O w % % % : % % s s 4 N k @ i o : m r } 3 # ( g ) [ I % , Z _ 2 / w 6 e J % $ v j U O ! #.n o r l ; v - > v O b o o b f u D z z D z [ j , k l C H @ T < ' O I D a #.$.,.!.~ Q q = % % % ] H @ 3 . % % % % % % : : : : : % % % % % % % % % % % % s % s % | : : . x ; x E.^ 5 5 + - y y H l h > J k t G u f D 7 E u E 7 2 { n V / a A Q { N i =...$.2.).(.,.W j c , D D f E A V N R &.S +.@.-.=.@. .>.%.(.:.:.j.:.|.|.|.'.;.+.X ,.2._.(.!.<.R Q u 7 V r [ e Q u z 7 a { 2 / @.r.[ r <.",
-"] t M g o o I p k O g I G g p > ^ # + H > T - - < _ I d m _ C _ F ) # $ | | $ w * H P k I I l F 9 6 6 3 ] 3 ; ; * ; # # 4 - C w : z N u 3 % % & B V C 4 * 1 { J + G c H k W a P w = % : % % % % G 1 5 b / ^ : e b | s h r + J +.q > <.O 4 e ! % D 2 ^ % } a 2 N E , @.Z e -.d G =.E F B +.:.1 k p O f f D z u / $.` O h q H + y 6 F p J < } m &.(.{.q.|.~ V C $ % 3 O D o { G : % % % % % % % % % % % % % % % % % % % % % s s s s s s % : $ w.~.}.p 5 5 # q 6 ] ; 9 v P l p p p I ' b f M M z B u d a / 2 A V { , A e L =.` -.W !.!.-.0 8 R n B d a a V c Y R K j X ..W W ;.%.!. .%.$.i.i.'.,.,.%.>.-.#.+.>.i._.2.%.` 8 / { 2 r <.` Z [ ( ( V V n c / c -.-.Z d ",
-"w J O k g ' k p G G k p p p J t v F @ ; 3 5 H q F P > H y * ; 5 6 T < q ^ . $ | | $ . # ) > h _ < l _ l < T 9 6 @ @ ^ + H ; ; x 3 ` p | : % % % & # = % : q k ] % + m t P Y J ^ | = % : | : : : N ! B ( ^ % M S @ s s f B x 7 e 4 Q / . O { ^ . 8 k % ^ S 7 z > 6 M !.n { ~ z z R k C #.n , f l _ k o O M f ! <.'.[ I h ( K D 9 @ T , 2 t G I Q X 6.f.^.2.~ A > | _ Y F % < > % % % % % % % % % % % % % % % % m X A 3 & ' > s s s s s s % : = = & . # & 4 5 ^ 5 ) P h q h l p M G ' O M D ! b m m ! d ( / / 1 Q , Q n i 0 0 ~ Z ` +.<.i r 1 1 d 2 V N &.8 i j #.=.X ;.;.W ;.>.!.!.>.;.,.>...>.;.W @.` 0 #.!.%.'.'...~ &.V 2 N 8 #.@.=.j [ c N Y N N V n N r e v ",
-"x v I k I G G I G G k k k J p G G J v P y ; * ; y - > H H 5 w w x ] 5 6 y 6 y * w | | | | = ] ; ) > h _ t t h _ h > > > q 9 q T A -.} 3 & $ : : % % % % % % % % % % % | # + 5 * | = : = & $ : H L / q $ % % Q f . s s l J - R y | K < P ( @ % p 0 l : O @.l 3 ; ) [ r T e R y d G q > R +.o t P P G I I I O o .8 t C 0 7 G ~ ' + { Y c N f } M c ;.6.j.[.(.j 7 H _ S 7 . w . % % % % % % % % % % % % % % % % ! 8 P % P { > % % % % s s % % | = | . w w ; # + 9 - > H > v t g } k g M ! ! b D M g b u A A / ( Q { , V r R i S j <.<.L [ c n { Q ( e U j j #.~ =.@.@.-. ...W !.>.>.>.;.!.!... .@.X X Z j 0 =...W ;.W <.[ 1 n r K -.!.!.+.U e Y R r Y c 1 ( V ( h ",
-"* t O ' I ' } g ' } ' ' p k G p ' k G G t < T ^ # * 5 @ > q ^ ] 4 x . w w # 3 y > ) ] = : % : | | & 4 ; 9 - F h h h C - q P < p a d B H ) * & | % % % % % % % % % % % : % $ ; # $ $ & ] = : = 1 A | : % | : # x : s s % _ } . s & B z - # s s O n } 4 ! X t u # ^ K + 9 &.H y r - ) < I 2.B P T q h J k J k d $.f q m @._ d '.J t -.o z %.7 O J u [ ..;.%.>.#.( t > n X J % % % = u / _ & % % % % % % % % % : c 7 4 % D I = % % % % % % % % : $ : | . # 3 y ) 9 F q 6 - c ,.1 t t G g m } g b g k b u Q a V ( , a 7 / V r &.8 S S i R e n / { ( 1 i j ~ =.@...,.>.;.!. .!...W ..%.>.%.,.'.%.%.!.;...` #.=.@.-.-.=.~ S e n N R #.!.(.$.` L 8 &.R e e N c c N c h ",
-"* ' f } I } G ' } I } ' G I k p ' G p } k v J _ F 6 * ] 3 y 6 q H ^ x . = = = . 4 # 5 ^ 3 ; w | | : | : | $ & ] 5 6 6 6 T C F > - 6 q 9 T H 6 # | % % % % % % % % % % % : % | = $ = 4 w | = p X Q | : % & : % % % s s s s s s s s s | : s s s 3 9 = : y M ! | : k k % ! M % p 2 > ] c < .G 9 y y F P l _ t 0 ..g H c 8 F R -.- { #.P &.,.P p v J z 1 [ S j &.V b h - [ K ^ % & e l q 8 + % % % % % % % % % F <._ : % F 4 4 > > ] * & % % % % : % $ w ^ q 6 y 6 T 6 q h Y L M l I k I g g M ' G ! m i ,.R 1 { Q 2 <.` r e Y r r R 1 / / / 2 n N r 0 ~ @.%.>.2.(.2.$.>.!. . ...;.%.,.,.$.i._./._._.(.!.-. .>.W -.` #.U V { 1 U X ,._.i.=.#.0 K 8 [ r e r Y R R J ",
-"* ! , } } g J I ' ' I g } G p p I G G I k t v J k v l P 6 5 * 3 y 9 H 6 3 ] w = $ = = = . 4 ^ ; ] x $ $ : % % : | | | & w 4 ] * 3 3 + T 6 6 > > 6 + ] $ : : | : | : : % s s % % : = w & & ] Q D d . % : % % % s % % s s s s s % % % % % % % % % % % s s s s % % : | % * x % y > % | D V m T ^ 3 @ 9 - < h _ W =.( q c z J '.I @ &.A _ >.Y - o O t p o D Q a a , / P = h X l % v K x M X 3 % % % % % % % % % m R ; % % | 3 G f / @ a v : . M Z q % : $ ; C * * @ > 9 F v W { l v G p g O O o O I b 7 1 i c A d A ( 8.~.S N V ( V { E , 7 R '.Z N R j ` !.(.$._.:./.).$.,.!.>. .!... .(.i._.[.g.8.{.7.~.2._./.'.W X 0 &.2 Q 2 Y j ;.>.-.+.Z Z L K i i U 8 U S L } "};
diff --git a/gui/mplayer/pixmaps/aspect.xpm b/gui/mplayer/pixmaps/aspect.xpm
deleted file mode 100644
index 386e39d899..0000000000
--- a/gui/mplayer/pixmaps/aspect.xpm
+++ /dev/null
@@ -1,22 +0,0 @@
-/* XPM */
-static const char * const aspect_xpm[] = {
-"16 16 3 1",
-" c None",
-". c #000000",
-"+ c #FFFFFF",
-" ",
-" ",
-" ............. ",
-" .+++++++++++++.",
-" .+....+...+..+.",
-" .++++++...+..+.",
-" .+........+..+.",
-" .+........+..+.",
-" .+........+..+.",
-" .++++++++++..+.",
-" .+...........+.",
-" .+...........+.",
-" .+++++++++++++.",
-" ............. ",
-" ",
-" "};
diff --git a/gui/mplayer/pixmaps/cancel.xpm b/gui/mplayer/pixmaps/cancel.xpm
deleted file mode 100644
index d710326345..0000000000
--- a/gui/mplayer/pixmaps/cancel.xpm
+++ /dev/null
@@ -1,139 +0,0 @@
-/* XPM */
-static const char * const cancel_xpm[] = {
-"55 16 120 2",
-" c None",
-". c #786663",
-"+ c #71615F",
-"@ c #808080",
-"# c #8F8381",
-"$ c #A76C5F",
-"% c #A6503F",
-"& c #5D433E",
-"* c #736967",
-"= c #8E564B",
-"- c #874032",
-"; c #6D6B6A",
-"> c #897976",
-", c #B65846",
-"' c #C7523D",
-") c #9E3D2B",
-"! c #5B3B35",
-"~ c #80716E",
-"{ c #9E5042",
-"] c #BF4933",
-"^ c #862C1D",
-"/ c #57514F",
-"( c #894335",
-"_ c #BE4028",
-": c #BF3E26",
-"< c #A43C29",
-"[ c #724841",
-"} c #877976",
-"| c #91483A",
-"1 c #B4432F",
-"2 c #7C2516",
-"3 c #5C3832",
-"4 c #909090",
-"5 c #000000",
-"6 c #786D6B",
-"7 c #823526",
-"8 c #BF4028",
-"9 c #BE3F26",
-"0 c #9A3623",
-"a c #60413B",
-"b c #746F6E",
-"c c #83463A",
-"d c #B24733",
-"e c #6F2418",
-"f c #523834",
-"g c #858484",
-"h c #6F615E",
-"i c #823324",
-"j c #B83A21",
-"k c #932F1D",
-"l c #834437",
-"m c #BA4D39",
-"n c #782618",
-"o c #4A3531",
-"p c #848282",
-"q c #67524F",
-"r c #8A3425",
-"s c #BC3F27",
-"t c #B93922",
-"u c #C24D37",
-"v c #94301E",
-"w c #3E231D",
-"x c #6C6B6A",
-"y c #593A34",
-"z c #A34939",
-"A c #BF432C",
-"B c #BA3A23",
-"C c #B53821",
-"D c #7D2B1B",
-"E c #5B4A46",
-"F c #7F6A66",
-"G c #964E40",
-"H c #B94B37",
-"I c #8C3322",
-"J c #93311E",
-"K c #BC3E26",
-"L c #B93A22",
-"M c #7A2A1B",
-"N c #665551",
-"O c #7C6B67",
-"P c #8A473B",
-"Q c #B64A36",
-"R c #79291B",
-"S c #4E403F",
-"T c #503833",
-"U c #953826",
-"V c #B93921",
-"W c #6B605F",
-"X c #745854",
-"Y c #995245",
-"Z c #B64632",
-"` c #7A2718",
-" . c #533C38",
-".. c #61423C",
-"+. c #973725",
-"@. c #BF3F26",
-"#. c #BC3A22",
-"$. c #763226",
-"%. c #857A78",
-"&. c #9D584B",
-"*. c #BB4631",
-"=. c #7F2919",
-"-. c #4C3430",
-";. c #5A3831",
-">. c #A13C29",
-",. c #C23D25",
-"'. c #9D3420",
-"). c #574C4B",
-"!. c #837F7E",
-"~. c #7C3427",
-"{. c #7E2B1C",
-"]. c #3B2F2C",
-"^. c #5A3B36",
-"/. c #A2402E",
-"(. c #8B3121",
-"_. c #574B49",
-":. c #7B6B69",
-"<. c #554947",
-"[. c #5F514E",
-"}. c #4A3B38",
-" ",
-" . + @ ",
-"# $ % & * = - ; ",
-"> , ' ) ! ~ { ] ^ / ",
-" ( _ : < [ } | 1 2 3 4 5 5 5 5 5 5 5 ",
-" 6 7 8 9 0 a b c d e f g 5 5 5 5 5 5 5 ",
-" h i _ j k l m n o p 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 ",
-" q r s t u v w x 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 ",
-" y z A B C D E 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 ",
-" F G H I J K L M N 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 ",
-" O P Q R S T U 9 V D W 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 ",
-" X Y Z ` . ..+.@.#.$. 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 ",
-"%.&.*.=.-. ;.>.,.'.). ",
-"!.~.{.]. ^./.(._. ",
-" :.<. [.}. ",
-" "};
diff --git a/gui/mplayer/pixmaps/chapter.xpm b/gui/mplayer/pixmaps/chapter.xpm
deleted file mode 100644
index 249ce0c62f..0000000000
--- a/gui/mplayer/pixmaps/chapter.xpm
+++ /dev/null
@@ -1,23 +0,0 @@
-/* XPM */
-static const char * const chapter_xpm[] = {
-"16 16 4 1",
-" c None",
-". c #000000",
-"+ c #FFFFFF",
-"@ c #CD0909",
-" .. ",
-" .++. ",
-".++++. ",
-".++++. . . ",
-" .++. .@. .@. ",
-" .. .@@@..@@@.",
-" .@. .@. ",
-" . . ",
-" .. ",
-" .++. ",
-".++++. ",
-".++++. . . ",
-" .++. .@. .@. ",
-" .. .@@@..@@@.",
-" .@. .@. ",
-" . . "};
diff --git a/gui/mplayer/pixmaps/delsub.xpm b/gui/mplayer/pixmaps/delsub.xpm
deleted file mode 100644
index f9b8358230..0000000000
--- a/gui/mplayer/pixmaps/delsub.xpm
+++ /dev/null
@@ -1,22 +0,0 @@
-/* XPM */
-static const char * const delsub_xpm[] = {
-"16 16 3 1",
-" c None",
-". c #CD0909",
-"+ c #000000",
-" ",
-" ",
-". .",
-" .. .. ",
-" ++. + + +.+ ",
-"+ .. + . + ",
-"+ +. ..+ + ",
-" ++ + ..+ +++ ",
-" + + . . + + ",
-" + .. +.. + ",
-"+++ . +++ +.+ ",
-" . .. ",
-" .. .",
-". ",
-" ",
-" "};
diff --git a/gui/mplayer/pixmaps/dir.xpm b/gui/mplayer/pixmaps/dir.xpm
deleted file mode 100644
index 4686fb8ad6..0000000000
--- a/gui/mplayer/pixmaps/dir.xpm
+++ /dev/null
@@ -1,148 +0,0 @@
-/* XPM */
-static const char * const dir_xpm[] = {
-"16 16 129 2",
-" c None",
-". c #B5C7C7",
-"+ c #B5C6C7",
-"@ c #B5C6C8",
-"# c #BDC9D3",
-"$ c #D6DFE3",
-"% c #CBD8DA",
-"& c #B2C3CA",
-"* c #94AFBC",
-"= c #739AB4",
-"- c #7FA4B9",
-"; c #82A3BD",
-"> c #4380B1",
-", c #437FAE",
-"' c #4381AE",
-") c #7FA3BA",
-"! c #2D7088",
-"~ c #265E70",
-"{ c #255264",
-"] c #1D4C60",
-"^ c #A8D7F2",
-"/ c #C5E4FF",
-"( c #CAE7FC",
-"_ c #B1D9F2",
-": c #B1DCF0",
-"< c #71B6E4",
-"[ c #8EAEC8",
-"} c #DEECF3",
-"| c #DAEAF4",
-"1 c #D5ECF0",
-"2 c #E9F3F6",
-"3 c #FCFDFF",
-"4 c #FFFEFF",
-"5 c #FFFFFF",
-"6 c #FAFCFF",
-"7 c #D0E6F2",
-"8 c #C8E3F2",
-"9 c #75B3E4",
-"0 c #7BA5BD",
-"a c #FAFEFA",
-"b c #FDFDFD",
-"c c #FBFDFB",
-"d c #F8FCF8",
-"e c #FBFCFB",
-"f c #F9FBFE",
-"g c #BDDFF4",
-"h c #BADDF0",
-"i c #63ABDC",
-"j c #7CA2BE",
-"k c #F8FFF8",
-"l c #F9FEFF",
-"m c #FDFCFD",
-"n c #F7FBFE",
-"o c #F7FBF7",
-"p c #F3F7F7",
-"q c #F7F7FA",
-"r c #F2F7F7",
-"s c #AED7F0",
-"t c #AED6EF",
-"u c #559DDB",
-"v c #80A4C2",
-"w c #F7FBFB",
-"x c #F7F9FA",
-"y c #F2F9FA",
-"z c #EFF4F3",
-"A c #EBF3F3",
-"B c #EFF4F7",
-"C c #E5F2F6",
-"D c #A1CDE7",
-"E c #9DCBE8",
-"F c #4694D4",
-"G c #84A2BE",
-"H c #EDF3F6",
-"I c #E8F2F0",
-"J c #E6EFF1",
-"K c #E1EEEF",
-"L c #DEECEC",
-"M c #DEEBEB",
-"N c #DEECEF",
-"O c #D8E8EC",
-"P c #89BBDD",
-"Q c #89BAE4",
-"R c #3488CC",
-"S c #7BA3BD",
-"T c #D1E2E6",
-"U c #CCE4E1",
-"V c #D1E4E3",
-"W c #D1E3E5",
-"X c #D1E3E4",
-"Y c #CFE3E3",
-"Z c #D3E4E3",
-"` c #C8DDE6",
-" . c #72ADD5",
-".. c #6FAED2",
-"+. c #287AC3",
-"@. c #82A3C4",
-"#. c #B4D6D4",
-"$. c #BBD9D7",
-"%. c #BDD7DC",
-"&. c #BBD9D8",
-"*. c #BCD8D9",
-"=. c #C0DADD",
-"-. c #C5DCDE",
-";. c #B9D3DB",
-">. c #61A1CB",
-",. c #61A1C7",
-"'. c #1C70B9",
-"). c #82A2C4",
-"!. c #9EC8C7",
-"~. c #A5C9CD",
-"{. c #A7CCCE",
-"]. c #A9CCCE",
-"^. c #AECFCF",
-"/. c #B2D3D3",
-"(. c #B9D6D7",
-"_. c #AACBD6",
-":. c #5399C0",
-"<. c #539ABF",
-"[. c #176DAE",
-"}. c #004577",
-"|. c #00447A",
-"1. c #00437C",
-"2. c #00447B",
-"3. c #004380",
-"4. c #00447F",
-"5. c #00407F",
-"6. c #003B80",
-"7. c #003B82",
-"8. c #003C80",
-" ",
-" ",
-" . + @ ",
-" # $ % & * = - ; > , ' ",
-" ) ! ~ { ] ^ / / ( _ : < ",
-" [ } | 1 2 3 4 5 6 7 8 9 ",
-" 0 a 4 b c d e c f g h i ",
-" j k l m n o p q r s t u ",
-" v o w x y z A B C D E F ",
-" G H I J K L M N O P Q R ",
-" S T U V W X Y Z ` ...+. ",
-" @.#.$.%.&.*.=.-.;.>.,.'. ",
-" ).!.~.{.].^./.(._.:.<.[. ",
-" }.|.1.2.3.4.4.5.6.7.8. ",
-" ",
-" "};
diff --git a/gui/mplayer/pixmaps/dolby.xpm b/gui/mplayer/pixmaps/dolby.xpm
deleted file mode 100644
index ed60c7deff..0000000000
--- a/gui/mplayer/pixmaps/dolby.xpm
+++ /dev/null
@@ -1,23 +0,0 @@
-/* XPM */
-static const char * const dolby_xpm[] = {
-"16 11 9 1",
-" c None",
-". c #000000",
-"+ c #C3C828",
-"@ c #BCBF27",
-"# c #DBE82C",
-"$ c #B5B626",
-"% c #CAD229",
-"& c #CDD62A",
-"* c #C6CD29",
-"................",
-".+@@###..###@@+.",
-".$...%#..#%...$.",
-".$....#..#....$.",
-".$....&..&....$.",
-".$....&..&....$.",
-".$....&..&....$.",
-".$....#..#....$.",
-".$...%#..#%...$.",
-".+@@*##..##*@@+.",
-"................"};
diff --git a/gui/mplayer/pixmaps/double.xpm b/gui/mplayer/pixmaps/double.xpm
deleted file mode 100644
index 9c30019a7c..0000000000
--- a/gui/mplayer/pixmaps/double.xpm
+++ /dev/null
@@ -1,151 +0,0 @@
-/* XPM */
-static const char * const double_xpm[] = {
-"16 16 132 2",
-" c None",
-". c #000000",
-"+ c #92A0AC",
-"@ c #808F9B",
-"# c #86949F",
-"$ c #8C99A4",
-"% c #929EA8",
-"& c #98A3AC",
-"* c #9EA7B0",
-"= c #A4ACB4",
-"- c #AAB1B8",
-"; c #B0B6BC",
-"> c #B6BBC0",
-", c #BBC0C5",
-"' c #909192",
-") c #B7C4CD",
-"! c #91A3B3",
-"~ c #98A9B8",
-"{ c #9FAFBD",
-"] c #A6B5C1",
-"^ c #ADBAC6",
-"/ c #B4C0CB",
-"( c #BAC6D0",
-"_ c #C1CCD4",
-": c #C8D1D9",
-"< c #CFD7DE",
-"[ c #D7DEE3",
-"} c #BCC1C5",
-"| c #8B9EAF",
-"1 c #92A4B3",
-"2 c #A6B5C2",
-"3 c #ADBBC6",
-"4 c #BBC6D0",
-"5 c #C2CCD5",
-"6 c #C9D2D9",
-"7 c #D1D8DF",
-"8 c #B7BCC2",
-"9 c #AFBDC8",
-"0 c #8499AA",
-"a c #92A4B4",
-"b c #99AAB9",
-"c c #A0B0BD",
-"d c #A7B5C2",
-"e c #AEBBC7",
-"f c #B5C1CC",
-"g c #BBC7D0",
-"h c #CAD3DA",
-"i c #B1B8BD",
-"j c #ACB9C5",
-"k c #7E93A6",
-"l c #8599AB",
-"m c #8C9FAF",
-"n c #93A5B4",
-"o c #A0B0BE",
-"p c #BCC7D1",
-"q c #C4CED6",
-"r c #ACB3BA",
-"s c #A8B6C3",
-"t c #778EA1",
-"u c #7E94A6",
-"v c #8C9FB0",
-"w c #9AABB9",
-"x c #707A84",
-"y c #B6C2CC",
-"z c #BDC8D2",
-"A c #A6AFB6",
-"B c #A4B3C0",
-"C c #71899D",
-"D c #788EA2",
-"E c #7F94A7",
-"F c #869AAB",
-"G c #8DA0B0",
-"H c #7A8996",
-"I c #79858F",
-"J c #AFBCC8",
-"K c #B7C3CD",
-"L c #A1ABB2",
-"M c #5E7990",
-"N c #657E95",
-"O c #6C8499",
-"P c #728A9E",
-"Q c #627584",
-"R c #7A8C9B",
-"S c #8EA1B1",
-"T c #95A7B6",
-"U c #9CACBB",
-"V c #B1BEC9",
-"W c #9BA5AF",
-"X c #6A7D8E",
-"Y c #8196A8",
-"Z c #889BAD",
-"` c #8FA1B1",
-" . c #AAB8C4",
-".. c #96A1AB",
-"+. c #B2C1D2",
-"@. c #90A6BE",
-"#. c #95AAC1",
-"$. c #9AAEC3",
-"%. c #8493A4",
-"&. c #738B9F",
-"*. c #7A90A3",
-"=. c #889CAD",
-"-. c #8FA2B2",
-";. c #919DA7",
-">. c #BBC8D7",
-",. c #8AA1BA",
-"'. c #8FA5BD",
-"). c #78899B",
-"!. c #8696A8",
-"~. c #A6B4C1",
-"{. c #AEBCC7",
-"]. c #B3BFCA",
-"^. c #B7C2CD",
-"/. c #C3CDD6",
-"(. c #A7AFB7",
-"_. c #B7C5D5",
-":. c #859DB7",
-"<. c #8AA0BA",
-"[. c #7D8EA3",
-"}. c #98ACC2",
-"|. c #B2C1D1",
-"1. c #7F98B4",
-"2. c #849CB7",
-"3. c #89A0B9",
-"4. c #8EA4BC",
-"5. c #93A8BF",
-"6. c #D9E0E7",
-"7. c #B1C0D1",
-"8. c #B4C3D3",
-"9. c #B7C5D4",
-"0. c #BCC9D7",
-"a. c #B3C2D2",
-" . . . . . . . . . . . . . . . ",
-" . + @ # $ % & * = - ; > , ' . ",
-" . ) ! ~ { ] ^ / ( _ : < [ } . ",
-" . / | 1 ~ { 2 3 / 4 5 6 7 8 . ",
-" . 9 0 | a b c d e f g 5 h i . ",
-" . j k l m n b o . . . p q r . ",
-" . s t u l v n w x . . y z A . ",
-" . B C D E F G H . I . J K L . ",
-" . ~ M N O P Q . R S T U V W . ",
-". . . . . . . . X Y Z ` T .... ",
-". +.@.#.$.%.. . &.*.Y =.-.B ;.. ",
-". >.,.'.).. !.. ~. .{.].^./.(.. ",
-". _.:.<.. [.}.. . . . . . . . . ",
-". |.1.2.3.4.5.. ",
-". 6.7.8.9.0.a.. ",
-". . . . . . . . "};
diff --git a/gui/mplayer/pixmaps/dvd.xpm b/gui/mplayer/pixmaps/dvd.xpm
deleted file mode 100644
index 7e3edbf8c4..0000000000
--- a/gui/mplayer/pixmaps/dvd.xpm
+++ /dev/null
@@ -1,129 +0,0 @@
-/* XPM */
-static const char * const dvd_xpm[] = {
-"16 16 110 2",
-" c None",
-". c #CACCD2",
-"+ c #D3D4D6",
-"@ c #D2D2D3",
-"# c #D1D1D2",
-"$ c #D1D1D3",
-"% c #B5B8BD",
-"& c #EDEDEC",
-"* c #FAFAFA",
-"= c #FBFBFB",
-"- c #FCFCFC",
-"; c #FFFFFF",
-"> c #D9D9D9",
-", c #AFB1B5",
-"' c #C6C6C7",
-") c #FDFDFD",
-"! c #F7F7F7",
-"~ c #F9F9F9",
-"{ c #F6F6F6",
-"] c #F8F8F8",
-"^ c #B8B9BD",
-"/ c #B2B4BA",
-"( c #EAE9E9",
-"_ c #DCDCDC",
-": c #F3F3F3",
-"< c #F4F4F4",
-"[ c #A8AAAF",
-"} c #CBCBCA",
-"| c #CCCCCC",
-"1 c #D7D7D7",
-"2 c #E1E1E1",
-"3 c #F5F5F5",
-"4 c #EFEFEF",
-"5 c #CCCDCE",
-"6 c #D2D2D2",
-"7 c #CDCDCD",
-"8 c #D6D6D6",
-"9 c #E0E0E0",
-"0 c #E7E7E7",
-"a c #E6E6E6",
-"b c #E5E5E5",
-"c c #EBEBEB",
-"d c #E3E3E3",
-"e c #ECECEC",
-"f c #9C9DA5",
-"g c #C4C5C9",
-"h c #C1C1C1",
-"i c #CECECE",
-"j c #E2E2E2",
-"k c #E8E8E8",
-"l c #D8D8D8",
-"m c #E4E4E3",
-"n c #DBDBDB",
-"o c #F2F2F2",
-"p c #DDDDDD",
-"q c #D4D4D4",
-"r c #A2A4AA",
-"s c #C9CACC",
-"t c #C4C4C4",
-"u c #CFCFCF",
-"v c #E4E4E4",
-"w c #DBDAD9",
-"x c #727789",
-"y c #DFDEDD",
-"z c #C8C8C8",
-"A c #BCBCBC",
-"B c #BFBFBF",
-"C c #9E9FA4",
-"D c #C6C7C9",
-"E c #E2E2E1",
-"F c #999CA6",
-"G c #C5C5C4",
-"H c #D3D3D3",
-"I c #C7C7C7",
-"J c #BBBBBB",
-"K c #BABABA",
-"L c #C4C4C3",
-"M c #95969A",
-"N c #C4C5C6",
-"O c #D8D8D7",
-"P c #CACACA",
-"Q c #C6C6C6",
-"R c #B9B9B9",
-"S c #CCCCCB",
-"T c #939395",
-"U c #A0A2A7",
-"V c #E5E5E4",
-"W c #FEFEFE",
-"X c #C5C5C5",
-"Y c #C2C2C2",
-"Z c #B8B8B8",
-"` c #BCBBBA",
-" . c #A3A6AD",
-".. c #9B9C9F",
-"+. c #F0F0F0",
-"@. c #C0C0C0",
-"#. c #7C7E84",
-"$. c #EAEAEA",
-"%. c #979798",
-"&. c #989BA2",
-"*. c #E9E9E9",
-"=. c #959596",
-"-. c #A6A8AD",
-";. c #B7B7B5",
-">. c #B4B4B3",
-",. c #8B8D92",
-"'. c #9B9DA0",
-"). c #B6B6B7",
-"!. c #B0B0B1",
-"~. c #929396",
-" . + @ # $ ",
-" % & * = = = - ; > , ",
-" ' ) ! ~ ~ ~ { ] * = ) ^ ",
-" / ( _ : ! ] ! < ! ] ) ) = [ ",
-" } | 1 2 { ] ! : 3 - - 3 4 5 ",
-" 6 7 8 9 0 ] a b ) = : c d e f ",
-"g h i 1 j k 6 l m n o 0 p q 2 r ",
-"s t u n v _ w x y p 8 z A B C ",
-"D 8 l 2 k d E F ^ G H I J K L M ",
-"N v j k e = _ O 6 P Q A R K S T ",
-"U V k c ; W 3 > ! 6 X Y R Z ` .",
-" ..+.; : : > : : : X X h @.#. ",
-" 1 = : > : : : : $.X I %. ",
-" &.Q a > : : +.v *.< =. ",
-" -.;.P j k p >.,. ",
-" '.).!.~. "};
diff --git a/gui/mplayer/pixmaps/empty.xpm b/gui/mplayer/pixmaps/empty.xpm
deleted file mode 100644
index 708f38a332..0000000000
--- a/gui/mplayer/pixmaps/empty.xpm
+++ /dev/null
@@ -1,20 +0,0 @@
-/* XPM */
-static const char * const empty_xpm[] = {
-"16 16 1 1",
-" c None",
-" ",
-" ",
-" ",
-" ",
-" ",
-" ",
-" ",
-" ",
-" ",
-" ",
-" ",
-" ",
-" ",
-" ",
-" ",
-" "};
diff --git a/gui/mplayer/pixmaps/empty1px.xpm b/gui/mplayer/pixmaps/empty1px.xpm
deleted file mode 100644
index f9ed29e98f..0000000000
--- a/gui/mplayer/pixmaps/empty1px.xpm
+++ /dev/null
@@ -1,5 +0,0 @@
-/* XPM */
-static const char * const empty1px_xpm[] = {
-"1 1 1 1",
-" c None",
-" "};
diff --git a/gui/mplayer/pixmaps/eq.xpm b/gui/mplayer/pixmaps/eq.xpm
deleted file mode 100644
index ea064a736f..0000000000
--- a/gui/mplayer/pixmaps/eq.xpm
+++ /dev/null
@@ -1,35 +0,0 @@
-/* XPM */
-static const char * const eq_xpm[] = {
-"16 16 16 1",
-" c None",
-". c #000000",
-"+ c #FE3700",
-"@ c #FE8200",
-"# c #FEB900",
-"$ c #FFBA00",
-"% c #FEF100",
-"& c #FFF100",
-"* c #E8FE00",
-"= c #E9FF00",
-"- c #95FE00",
-"; c #96FF00",
-"> c #48FE00",
-", c #49FF00",
-"' c #23FF00",
-") c #24FF00",
-" .............. ",
-"................",
-".....++.........",
-".....@@.@@@.....",
-".....@@.@@@.....",
-".##$.##.###.....",
-".###.##.###.....",
-".%%&.%%.%%%.....",
-".**=.**.***.**=.",
-".***.**.***.***.",
-".--;.--.---.--;.",
-".---.--.---.---.",
-".>>,.>>.>>>.>>,.",
-".'').''.'''.'').",
-".'''.''.'''.'''.",
-"................"};
diff --git a/gui/mplayer/pixmaps/error.xpm b/gui/mplayer/pixmaps/error.xpm
deleted file mode 100644
index 90f0850b54..0000000000
--- a/gui/mplayer/pixmaps/error.xpm
+++ /dev/null
@@ -1,544 +0,0 @@
-/* XPM */
-static const char * const error_xpm[] = {
-"48 47 494 2",
-" c None",
-". c #A56152",
-"+ c #8B5447",
-"@ c #7D4C41",
-"# c #77493F",
-"$ c #74473E",
-"% c #73443A",
-"& c #714238",
-"* c #704137",
-"= c #723F35",
-"- c #753D32",
-"; c #793D31",
-"> c #8D5A4D",
-", c #734E45",
-"' c #724C43",
-") c #915E52",
-"! c #AF6B5B",
-"~ c #C97765",
-"{ c #DD826F",
-"] c #E37E6A",
-"^ c #DE7A66",
-"/ c #D07361",
-"( c #B76353",
-"_ c #995244",
-": c #794035",
-"< c #64332A",
-"[ c #643026",
-"} c #8F5D51",
-"| c #6E4D45",
-"1 c #865C51",
-"2 c #C07D6C",
-"3 c #E98A75",
-"4 c #E57259",
-"5 c #E05C3F",
-"6 c #DD4D2E",
-"7 c #D94123",
-"8 c #D73B1B",
-"9 c #D5391A",
-"0 c #D4391A",
-"a c #D43C1F",
-"b c #D44227",
-"c c #D54B31",
-"d c #C74D38",
-"e c #914031",
-"f c #672B21",
-"g c #592219",
-"h c #A7695A",
-"i c #6F5048",
-"j c #7E564C",
-"k c #C5806F",
-"l c #EA866E",
-"m c #E25D3E",
-"n c #DC411F",
-"o c #DB3E1C",
-"p c #D93D1B",
-"q c #D83B1B",
-"r c #D73A1A",
-"s c #D43719",
-"t c #D23618",
-"u c #D13518",
-"v c #D03317",
-"w c #CE3217",
-"x c #CD3116",
-"y c #CB3015",
-"z c #C3361F",
-"A c #8A2A1C",
-"B c #581C12",
-"C c #551911",
-"D c #9B6559",
-"E c #6B4D46",
-"F c #A67367",
-"G c #E98A74",
-"H c #E35D3D",
-"I c #DD411D",
-"J c #DC3F1C",
-"K c #D63A1A",
-"L c #D53919",
-"M c #CE3216",
-"N c #CB2F15",
-"O c #CA2E15",
-"P c #C92D14",
-"Q c #C72B13",
-"R c #B22914",
-"S c #65190D",
-"T c #4E130A",
-"U c #98655A",
-"V c #6B4E47",
-"W c #BD8375",
-"X c #E7765B",
-"Y c #DF441F",
-"Z c #DD401D",
-"` c #D93C1B",
-" . c #CF3317",
-".. c #C82D14",
-"+. c #C62A13",
-"@. c #C42912",
-"#. c #B82411",
-"$. c #70160A",
-"%. c #480E07",
-"&. c #9B685C",
-"*. c #6B4F47",
-"=. c #C48A7C",
-"-. c #E56547",
-";. c #DF421D",
-">. c #DA3E1C",
-",. c #D53819",
-"'. c #D33719",
-"). c #D13418",
-"!. c #CC3116",
-"~. c #C32712",
-"{. c #C12611",
-"]. c #B6230F",
-"^. c #731509",
-"/. c #460C05",
-"(. c #A86E60",
-"_. c #6C504A",
-":. c #BE8578",
-"<. c #CC3016",
-"[. c #C82C14",
-"}. c #C52A13",
-"|. c #C02510",
-"1. c #BE2310",
-"2. c #B2200E",
-"3. c #6A1208",
-"4. c #440B05",
-"5. c #725952",
-"6. c #A87B70",
-"7. c #E66C50",
-"8. c #DE411D",
-"9. c #DA3D1C",
-"0. c #D73B1A",
-"a. c #D6391A",
-"b. c #D03417",
-"c. c #C92E14",
-"d. c #C42812",
-"e. c #C22711",
-"f. c #C02410",
-"g. c #BD220F",
-"h. c #BC210E",
-"i. c #A81C0C",
-"j. c #570E06",
-"k. c #93695F",
-"l. c #806059",
-"m. c #E77F67",
-"n. c #DB3F1C",
-"o. c #D43819",
-"p. c #D23518",
-"q. c #CE3116",
-"r. c #BB200E",
-"s. c #BA1F0E",
-"t. c #B91E0D",
-"u. c #94160A",
-"v. c #430904",
-"w. c #6F5853",
-"x. c #C78677",
-"y. c #DE4320",
-"z. c #C62B13",
-"A. c #C52913",
-"B. c #BF2410",
-"C. c #B81E0D",
-"D. c #B71C0D",
-"E. c #AE190B",
-"F. c #6A0F06",
-"G. c #896A63",
-"H. c #E4684B",
-"I. c #DA3D1B",
-"J. c #D83C1B",
-"K. c #CA2F15",
-"L. c #C12511",
-"M. c #BD210F",
-"N. c #B61B0C",
-"O. c #B41A0B",
-"P. c #961409",
-"Q. c #440803",
-"R. c #765F59",
-"S. c #C18173",
-"T. c #DC401D",
-"U. c #D33618",
-"V. c #CF3217",
-"W. c #CC3015",
-"X. c #C52912",
-"Y. c #C32812",
-"Z. c #BE230F",
-"`. c #BC210F",
-" + c #B81D0D",
-".+ c #B71C0C",
-"++ c #B51B0C",
-"@+ c #B4190B",
-"#+ c #B3180B",
-"$+ c #A71509",
-"%+ c #620C05",
-"&+ c #AC7063",
-"*+ c #755D58",
-"=+ c #E26B51",
-"-+ c #C72C14",
-";+ c #C02511",
-">+ c #B91F0E",
-",+ c #B1170A",
-"'+ c #B01509",
-")+ c #850F06",
-"!+ c #360602",
-"~+ c #91665C",
-"{+ c #94716A",
-"]+ c #DB4120",
-"^+ c #CB3618",
-"/+ c #B93015",
-"(+ c #BF3115",
-"_+ c #BE3015",
-":+ c #BE2F15",
-"<+ c #BC2D15",
-"[+ c #BB2C14",
-"}+ c #BA2B13",
-"|+ c #B82A13",
-"1+ c #B72912",
-"2+ c #B52812",
-"3+ c #B42611",
-"4+ c #B42510",
-"5+ c #B22410",
-"6+ c #B1220F",
-"7+ c #AF210F",
-"8+ c #AE200E",
-"9+ c #AD1F0D",
-"0+ c #AB1E0D",
-"a+ c #AA1D0C",
-"b+ c #A91B0C",
-"c+ c #A81A0B",
-"d+ c #A7190A",
-"e+ c #A92013",
-"f+ c #AF180A",
-"g+ c #B2180B",
-"h+ c #AE1409",
-"i+ c #930F06",
-"j+ c #430602",
-"k+ c #83615A",
-"l+ c #AF6E5F",
-"m+ c #C13216",
-"n+ c #C1C1C1",
-"o+ c #E7E7E7",
-"p+ c #E6E6E6",
-"q+ c #E5E5E5",
-"r+ c #E4E4E4",
-"s+ c #E3E3E3",
-"t+ c #E2E2E2",
-"u+ c #E1E1E1",
-"v+ c #E0E0E0",
-"w+ c #DFDFDF",
-"x+ c #DEDEDE",
-"y+ c #DDDDDD",
-"z+ c #DCDCDC",
-"A+ c #DBDBDB",
-"B+ c #B12318",
-"C+ c #B1160A",
-"D+ c #AF1509",
-"E+ c #AD1308",
-"F+ c #9C0E06",
-"G+ c #540703",
-"H+ c #7B5E57",
-"I+ c #C4634E",
-"J+ c #CB3417",
-"K+ c #FBFBFB",
-"L+ c #FAFAFA",
-"M+ c #F9F9F9",
-"N+ c #F8F8F8",
-"O+ c #F7F7F7",
-"P+ c #F6F6F6",
-"Q+ c #F5F5F5",
-"R+ c #F4F4F4",
-"S+ c #F3F3F3",
-"T+ c #F2F2F2",
-"U+ c #F1F1F1",
-"V+ c #F0F0F0",
-"W+ c #EFEFEF",
-"X+ c #C34E45",
-"Y+ c #AD1208",
-"Z+ c #AB1108",
-"`+ c #A20E05",
-" @ c #630703",
-".@ c #775A54",
-"+@ c #D2533A",
-"@@ c #CA3317",
-"#@ c #DADADA",
-"$@ c #EEEEEE",
-"%@ c #EDEDED",
-"&@ c #C65A52",
-"*@ c #AC1208",
-"=@ c #AB1107",
-"-@ c #AA1007",
-";@ c #A20D05",
-">@ c #6E0803",
-",@ c #785C56",
-"'@ c #D64628",
-")@ c #C83116",
-"!@ c #D8D8D8",
-"~@ c #ECECEC",
-"{@ c #EBEBEB",
-"]@ c #C65B54",
-"^@ c #A80E06",
-"/@ c #9F0C05",
-"(@ c #720802",
-"_@ c #765851",
-":@ c #CF391C",
-"<@ c #C73015",
-"[@ c #EAEAEA",
-"}@ c #C45851",
-"|@ c #A90F07",
-"1@ c #A50C05",
-"2@ c #970B04",
-"3@ c #6A0602",
-"4@ c #74514A",
-"5@ c #C52E15",
-"6@ c #D6D6D6",
-"7@ c #E9E9E9",
-"8@ c #C3574F",
-"9@ c #A70D06",
-"0@ c #A00A04",
-"a@ c #8F0702",
-"b@ c #5A0401",
-"c@ c #764F47",
-"d@ c #AA2D15",
-"e@ c #C83921",
-"f@ c #BA403A",
-"g@ c #A60D05",
-"h@ c #A50B05",
-"i@ c #9A0903",
-"j@ c #830602",
-"k@ c #480200",
-"l@ c #7A4A41",
-"m@ c #8F2A18",
-"n@ c #CB351D",
-"o@ c #D0523F",
-"p@ c #D66857",
-"q@ c #DB7A6C",
-"r@ c #D9786A",
-"s@ c #D87769",
-"t@ c #D87669",
-"u@ c #D67569",
-"v@ c #D6766A",
-"w@ c #D47165",
-"x@ c #D16B5F",
-"y@ c #D16A5F",
-"z@ c #CF695E",
-"A@ c #CF685E",
-"B@ c #CE675D",
-"C@ c #CD675D",
-"D@ c #CC655D",
-"E@ c #CB645B",
-"F@ c #C85E55",
-"G@ c #C75B54",
-"H@ c #C55A52",
-"I@ c #C3554E",
-"J@ c #C1514B",
-"K@ c #B73831",
-"L@ c #A80F07",
-"M@ c #A60C05",
-"N@ c #A30A04",
-"O@ c #900803",
-"P@ c #790401",
-"Q@ c #360100",
-"R@ c #7E473D",
-"S@ c #73281B",
-"T@ c #B0160A",
-"U@ c #AF1409",
-"V@ c #A10703",
-"W@ c #850502",
-"X@ c #6C0300",
-"Y@ c #230000",
-"Z@ c #60281E",
-"`@ c #BE2C13",
-" # c #A90F06",
-".# c #A70E06",
-"+# c #A20804",
-"@# c #940602",
-"## c #800300",
-"$# c #560100",
-"%# c #643128",
-"&# c #881F0E",
-"*# c #C22611",
-"=# c #A20803",
-"-# c #A00703",
-";# c #870501",
-"># c #740200",
-",# c #300000",
-"'# c #60160A",
-")# c #BE2A13",
-"!# c #BE220F",
-"~# c #B91E0E",
-"{# c #B51A0C",
-"]# c #A40B05",
-"^# c #A30904",
-"/# c #940401",
-"(# c #800200",
-"_# c #610100",
-":# c #160000",
-"<# c #571F16",
-"[# c #841C0C",
-"}# c #B61C0C",
-"|# c #A80F06",
-"1# c #A10803",
-"2# c #9E0401",
-"3# c #840301",
-"4# c #760100",
-"5# c #2F0000",
-"6# c #541107",
-"7# c #AF2310",
-"8# c #BF2310",
-"9# c #BA200E",
-"0# c #B3190B",
-"a# c #B2180A",
-"b# c #A40A04",
-"c# c #9F0502",
-"d# c #8B0301",
-"e# c #7E0100",
-"f# c #540000",
-"g# c #551B13",
-"h# c #631308",
-"i# c #B5220F",
-"j# c #A00603",
-"k# c #9E0502",
-"l# c #900300",
-"m# c #7E0000",
-"n# c #630000",
-"o# c #1D0000",
-"p# c #4A0E06",
-"q# c #6F1409",
-"r# c #B4200E",
-"s# c #B71D0D",
-"t# c #B2170A",
-"u# c #AE1309",
-"v# c #A91007",
-"w# c #7D0000",
-"x# c #670000",
-"y# c #260000",
-"z# c #470C05",
-"A# c #711308",
-"B# c #AF1D0D",
-"C# c #A20904",
-"D# c #8D0300",
-"E# c #7B0000",
-"F# c #650000",
-"G# c #290000",
-"H# c #450B05",
-"I# c #691107",
-"J# c #A5190B",
-"K# c #9F0602",
-"L# c #9C0401",
-"M# c #860200",
-"N# c #770000",
-"O# c #5D0000",
-"P# c #250000",
-"Q# c #410904",
-"R# c #560C05",
-"S# c #921508",
-"T# c #AB170A",
-"U# c #AB1007",
-"V# c #8F0401",
-"W# c #7C0100",
-"X# c #6B0000",
-"Y# c #4D0000",
-"Z# c #1C0000",
-"`# c #400803",
-" $ c #680D05",
-".$ c #931208",
-"+$ c #A61208",
-"@$ c #8F0501",
-"#$ c #7D0300",
-"$$ c #6A0100",
-"%$ c #580000",
-"&$ c #2C0000",
-"*$ c #0D0000",
-"=$ c #3E0602",
-"-$ c #5A0903",
-";$ c #7E0D05",
-">$ c #8E0C05",
-",$ c #990C05",
-"'$ c #A40B04",
-")$ c #980903",
-"!$ c #8D0602",
-"~$ c #7E0401",
-"{$ c #6A0300",
-"]$ c #620200",
-"^$ c #4F0000",
-"/$ c #2D0000",
-"($ c #150000",
-"_$ c #310401",
-":$ c #3A0401",
-"<$ c #430502",
-"[$ c #4E0401",
-"}$ c #570402",
-"|$ c #5A0502",
-"1$ c #560300",
-"2$ c #4D0200",
-"3$ c #400200",
-"4$ c #1F0000",
-"5$ c #030000",
-" ",
-" ",
-" ",
-" ",
-" . + @ # $ % & * = - ; ",
-" > , ' ) ! ~ { ] ^ / ( _ : < [ ",
-" } | 1 2 3 4 5 6 7 8 9 0 a b c d e f g ",
-" h i j k l m n o p q r 9 s t u v w x y z A B C ",
-" D E F G H I J o p q K L s t u v M x N O P Q R S T ",
-" U V W X Y Z J o ` q K L s t u .M x N O ..Q +.@.#.$.%. ",
-" &.*.=.-.;.Z J >.` q K ,.'.t ). .M !.N O ..Q +.@.~.{.].^./. ",
-" (._.:.-.;.Z J >.` q K ,.'.t ). .M <.N O [.Q }.@.~.{.|.1.2.3.4. ",
-" 5.6.7.8.Z J 9.` 0.a.,.'.t b. .M <.N c.[.Q }.d.e.{.f.1.g.h.i.j. ",
-" k.l.m.8.Z n.9.` 0.a.o.'.p.b. .q.<.N c.[.Q }.d.e.{.f.1.g.r.s.t.u.v. ",
-" w.x.y.Z n.9.` 0.a.o.'.p.b. .x <.N P [.z.A.d.e.{.B.1.g.r.s.C.D.E.F. ",
-" k.G.H.Z o I.J.r a.o.'.u b. .x <.K.P [.z.A.d.e.L.B.1.M.r.s.C.D.N.O.P.Q. ",
-" R.S.T.o I.J.r a.o.U.u b.V.x W.K.P [.z.X.Y.e.L.B.Z.`.r.s. +.+++@+#+$+%+ ",
-" &+*+=+o I.J.r 9 o.U.u b.w x W.O P -++.X.Y.e.;+B.Z.`.r.>+ +.+++@+#+,+'+)+!+ ",
-" ~+{+]+p q r ^+/+(+_+:+<+[+}+|+1+2+3+4+5+6+7+8+9+0+a+b+c+d+e+f+g+,+'+h+i+j+ ",
-" k+l+p q r L m+n+o+p+q+q+r+r+s+t+t+u+u+v+w+w+x+x+x+y+y+z+A+r+B+C+D+h+E+F+G+ ",
-" H+I+q K L s J+z+K+L+L+M+M+N+O+O+P+Q+Q+R+R+S+T+T+U+U+V+W+W+Q+X+D+h+Y+Z+`+ @ ",
-" .@+@K ,.s t @@#@M+M+N+O+O+P+P+Q+R+R+S+S+T+U+U+V+W+W+$@$@%@R+&@h+*@=@-@;@>@ ",
-" ,@'@,.'.t ).)@!@N+O+P+P+Q+Q+R+S+S+T+U+U+V+V+W+$@$@%@%@~@{@S+]@*@=@-@^@/@(@ ",
-" _@:@'.t b. .<@!@P+Q+Q+R+S+S+T+T+U+V+V+W+W+$@%@%@~@{@{@[@[@S+}@=@|@^@1@2@3@ ",
-" 4@m+p.b. .M 5@6@R+R+S+T+T+U+U+V+W+W+$@%@%@~@~@{@[@[@7@7@7@S+8@|@^@9@0@a@b@ ",
-" c@d@b. .x <.e@t+R+R+R+R+R+R+R+Q+Q+R+S+S+T+T+U+U+U+U+T+T+U+U+f@^@g@h@i@j@k@ ",
-" l@m@ .x <.N n@o@p@q@r@s@t@u@v@w@x@y@z@A@B@C@D@E@F@G@H@I@J@K@L@M@h@N@O@P@Q@ ",
-" R@S@x W.K.P [.z.A.Y.e.L.B.1.`.r.s. +D.++O.#+,+T@U@E+*@-@|@^@M@h@N@V@W@X@Y@ ",
-" Z@`@O P [.z.X.Y.e.L.B.Z.`.r.s. +.+++@+#+,+'+h+E+*@-@ #.#M@h@N@+#@###$# ",
-" %#&#P -++.X.Y.*#;+B.Z.`.r.>+ +.+++@+g+,+'+h+E+Z+-@ #9@M@h@N@=#-#;#>#,# ",
-" '#)#+.@.Y.*#;+B.!#`.r.~# +.+{#@+g+,+'+h+E+Z+-@ #9@M@]#^#=#-#/#(#_#:# ",
-" <#[#@.Y.*#;+B.g.`.r.~# +}#{#@+g+C+D+h+Y+Z+-@|#9@M@]#^#1#-#2#3#4#5# ",
-" 6#7#{.|.8#g.`.9#t. +}#{#0#a#C+D+h+Y+=@-@^@9@M@b#^#1#-#c#d#e#f# ",
-" g#h#i#8#g.`.s.t. +N.{#0#a#C+D+h+*@=@-@^@9@1@b#^#1#j#k#l#m#n#o# ",
-" p#q#r#`.s.t.s#N.{#0#t#T@D+u#*@=@v#^@9@1@b#^#1#j#k#l#w#x#y# ",
-" z#A#B#t.s#N.{#0#t#T@D+u#*@=@|@^@9@h@b#C#1#j#k#D#E#F#G# ",
-" H#I#J#N.O.#+t#T@D+E+*@=@|@^@g@h@b#C#V@K#L#M#N#O#P# ",
-" Q#R#S#T#,+T@U@E+*@U#|@^@g@h@b#C#V@K#V#W#X#Y#Z# ",
-" `# $.$+$E+*@-@|@^@M@h@N@+#K#@$#$$$%$&$*$ ",
-" =$-$;$>$,$;@'$0@)$!$~${$]$^$/$($ ",
-" _$:$<$[$}$|$1$2$3$,#4$5$ ",
-" ",
-" ",
-" ",
-" ",
-" ",
-" "};
diff --git a/gui/mplayer/pixmaps/exit.xpm b/gui/mplayer/pixmaps/exit.xpm
deleted file mode 100644
index 595377239b..0000000000
--- a/gui/mplayer/pixmaps/exit.xpm
+++ /dev/null
@@ -1,82 +0,0 @@
-/* XPM */
-static const char * const exit_xpm[] = {
-"16 16 63 1",
-" c None",
-". c #000000",
-"+ c #E2E2E0",
-"@ c #D3D3D0",
-"# c #C0C0BD",
-"$ c #ADADAB",
-"% c #929291",
-"& c #B7B7B5",
-"* c #9A9A98",
-"= c #E46245",
-"- c #DEDEDC",
-"; c #C1C1BE",
-"> c #B9B9B7",
-", c #9C9C9B",
-"' c #060806",
-") c #070907",
-"! c #E7755B",
-"~ c #B3533E",
-"{ c #D0D0CD",
-"] c #0E110C",
-"^ c #0F120D",
-"/ c #DF421E",
-"( c #B14D36",
-"_ c #BDBDBB",
-": c #A4A4A2",
-"< c #161C14",
-"[ c #191F16",
-"} c #B0160A",
-"| c #B11B10",
-"1 c #993929",
-"2 c #797977",
-"3 c #5B5B5A",
-"4 c #1D251B",
-"5 c #20281D",
-"6 c #990000",
-"7 c #880000",
-"8 c #AA3F2C",
-"9 c #6C6C6A",
-"0 c #273124",
-"a c #2A3526",
-"b c #C83E2B",
-"c c #A1100B",
-"d c #A3140E",
-"e c #2B3727",
-"f c #313D2C",
-"g c #D4D4D1",
-"h c #354331",
-"i c #B4B4B2",
-"j c #8D8D8B",
-"k c #2D3A29",
-"l c #3B4A35",
-"m c #E0E0DE",
-"n c #C9C9C7",
-"o c #939491",
-"p c #51544F",
-"q c #34412F",
-"r c #42543D",
-"s c #495D43",
-"t c #5C6059",
-"u c #495C42",
-"v c #4F6448",
-"w c #53684B",
-"x c #546A4D",
-" ",
-" .......... ",
-" .+@#$%.... ",
-" ...+@#&*.... ",
-" .=.-@;>,.'). ",
-"....!~.{;>,.]^. ",
-".====/(._:,.<[. ",
-".=}}}}|1.23.45. ",
-".=666678.9,.0a. ",
-".bcd778.;>,.ef. ",
-"....78.g;>,.ah. ",
-" .8.+g;ij.kl. ",
-" ...mnop.qrs. ",
-" .&t.luvwx. ",
-" .......... ",
-" "};
diff --git a/gui/mplayer/pixmaps/file.xpm b/gui/mplayer/pixmaps/file.xpm
deleted file mode 100644
index 80acca7a7c..0000000000
--- a/gui/mplayer/pixmaps/file.xpm
+++ /dev/null
@@ -1,26 +0,0 @@
-/* XPM */
-static const char * const file_xpm[] = {
-"16 16 7 1",
-" c None",
-". c #9A9A9A",
-"+ c #000000",
-"@ c #FFFFFF",
-"# c #010101",
-"$ c #FEFEFE",
-"% c #9B9B9B",
-" ",
-"................",
-"++++++++++++++++",
-"@++@++@++@++@++@",
-"++++#+++++++++++",
-"@@@+@@@$@@@@+@@@",
-"@@@+@@@@@@@@+@@@",
-"@@@+@@@@@@@@+@@@",
-"@@@+@@@@@@@@+@@@",
-"@@@+@$@@@@@@+@@@",
-"@@@+@@@$@@@@+@@@",
-"+++++++++++++++#",
-"@++@++@++@#+@++@",
-"+++++++##++++++#",
-"..........%.....",
-" "};
diff --git a/gui/mplayer/pixmaps/file2.xpm b/gui/mplayer/pixmaps/file2.xpm
deleted file mode 100644
index 5b7a6b9186..0000000000
--- a/gui/mplayer/pixmaps/file2.xpm
+++ /dev/null
@@ -1,27 +0,0 @@
-/* XPM */
-static const char * const file2_xpm[] = {
-"16 16 8 1",
-" c None",
-". c #000000",
-"+ c #FFFFFF",
-"@ c #D5D5D5",
-"# c #ABABAB",
-"$ c #808080",
-"% c #555555",
-"& c #2B2B2B",
-" ",
-" ",
-" ... ... ",
-" .............. ",
-" . .++++++++. . ",
-" . .+++++++@. . ",
-" ...+++++++@... ",
-" . .++++++@#. . ",
-" ...+++++@#$... ",
-" . .++++@#$%. . ",
-" . .++++@#$%. . ",
-" ...+++@#$%&... ",
-" . .+++@#$%&. . ",
-" .............. ",
-" ... ... ",
-" "};
diff --git a/gui/mplayer/pixmaps/fs.xpm b/gui/mplayer/pixmaps/fs.xpm
deleted file mode 100644
index 404d00fd51..0000000000
--- a/gui/mplayer/pixmaps/fs.xpm
+++ /dev/null
@@ -1,109 +0,0 @@
-/* XPM */
-static const char * const fs_xpm[] = {
-"16 16 90 1",
-" c None",
-". c #000000",
-"+ c #3D3B3B",
-"@ c #808F9B",
-"# c #86949F",
-"$ c #8C99A4",
-"% c #929EA8",
-"& c #98A3AC",
-"* c #9EA7B0",
-"= c #A4ACB4",
-"- c #AAB1B8",
-"; c #B0B6BC",
-"> c #B6BBC0",
-", c #BBC0C5",
-"' c #B7C4CD",
-") c #A7B7C9",
-"! c #ACBCCC",
-"~ c #B2C0CF",
-"{ c #B6C5D2",
-"] c #BCC9D5",
-"^ c #C1CDD8",
-"/ c #C6D2DA",
-"( c #CDD6DD",
-"_ c #BCC1C5",
-": c #B4C0CB",
-"< c #9DB0C4",
-"[ c #CED6DE",
-"} c #D2DAE1",
-"| c #B7BCC2",
-"1 c #AFBDC8",
-"2 c #99ACC1",
-"3 c #B2C1D2",
-"4 c #90A6BE",
-"5 c #95AAC1",
-"6 c #9AAEC3",
-"7 c #8493A4",
-"8 c #8696A8",
-"9 c #C9D3DC",
-"0 c #CFD7DF",
-"a c #B1B8BD",
-"b c #ACB9C5",
-"c c #94A9C0",
-"d c #BBC8D7",
-"e c #8AA1BA",
-"f c #8FA5BD",
-"g c #C5D0D9",
-"h c #CAD4DC",
-"i c #ACB3BA",
-"j c #90A6BD",
-"k c #B7C5D5",
-"l c #859DB7",
-"m c #8AA0BA",
-"n c #98ACC2",
-"o c #C0CCD7",
-"p c #C6D0DA",
-"q c #A6AFB6",
-"r c #8CA3BB",
-"s c #B2C1D1",
-"t c #7F98B4",
-"u c #849CB7",
-"v c #93A8BF",
-"w c #C2CDD8",
-"x c #A1ABB2",
-"y c #889FB9",
-"z c #D9E0E7",
-"A c #B1C0D1",
-"B c #B4C3D3",
-"C c #B7C5D4",
-"D c #BCC9D7",
-"E c #B3C2D2",
-"F c #B8C6D2",
-"G c #BDCAD5",
-"H c #9BA5AF",
-"I c #839BB6",
-"J c #B3C2D0",
-"K c #B9C6D2",
-"L c #96A1AB",
-"M c #8AA1B9",
-"N c #8FA5BC",
-"O c #94AABF",
-"P c #9AADC2",
-"Q c #9FB1C5",
-"R c #A4B5C9",
-"S c #A9BACB",
-"T c #919DA7",
-"U c #AAB8C4",
-"V c #AEBCC7",
-"W c #B3BFCA",
-"X c #B7C2CD",
-"Y c #C3CDD6",
-" ",
-"................",
-".+@@#$%&*=-;>,+.",
-".'++)!~{]^/(++_.",
-".:<<........[}|.",
-".122.345678.90a.",
-".bcc.defef8.ghi.",
-".bjj.klmlmn.opq.",
-".3rr.stutuv.]wx.",
-".dyy.zABCDE.FGH.",
-".kII........JKL.",
-".s++uMNOPQRS++T.",
-".+AABCDEUUVWXY+.",
-"................",
-" ",
-" "};
diff --git a/gui/mplayer/pixmaps/half.xpm b/gui/mplayer/pixmaps/half.xpm
deleted file mode 100644
index 71d166be39..0000000000
--- a/gui/mplayer/pixmaps/half.xpm
+++ /dev/null
@@ -1,144 +0,0 @@
-/* XPM */
-static const char * const half_xpm[] = {
-"16 16 125 2",
-" c None",
-". c #000000",
-"+ c #92A0AC",
-"@ c #808F9B",
-"# c #86949F",
-"$ c #8C99A4",
-"% c #929EA8",
-"& c #98A3AC",
-"* c #9EA7B0",
-"= c #A4ACB4",
-"- c #AAB1B8",
-"; c #B0B6BC",
-"> c #B6BBC0",
-", c #BBC0C5",
-"' c #909192",
-") c #B7C4CD",
-"! c #91A3B3",
-"~ c #98A9B8",
-"{ c #9FAFBD",
-"] c #A6B5C1",
-"^ c #ADBAC6",
-"/ c #B4C0CB",
-"( c #BAC6D0",
-"_ c #C1CCD4",
-": c #C8D1D9",
-"< c #CFD7DE",
-"[ c #D7DEE3",
-"} c #BCC1C5",
-"| c #8B9EAF",
-"1 c #92A4B3",
-"2 c #A6B5C2",
-"3 c #ADBBC6",
-"4 c #BBC6D0",
-"5 c #C2CCD5",
-"6 c #C9D2D9",
-"7 c #D1D8DF",
-"8 c #B7BCC2",
-"9 c #AFBDC8",
-"0 c #8499AA",
-"a c #92A4B4",
-"b c #99AAB9",
-"c c #A0B0BD",
-"d c #A7B5C2",
-"e c #AEBBC7",
-"f c #B5C1CC",
-"g c #BBC7D0",
-"h c #CAD3DA",
-"i c #B1B8BD",
-"j c #ACB9C5",
-"k c #7E93A6",
-"l c #8599AB",
-"m c #8C9FAF",
-"n c #93A5B4",
-"o c #A0B0BE",
-"p c #9AAEC3",
-"q c #8493A4",
-"r c #BCC7D1",
-"s c #C4CED6",
-"t c #ACB3BA",
-"u c #A8B6C3",
-"v c #778EA1",
-"w c #7E94A6",
-"x c #8C9FB0",
-"y c #9AABB9",
-"z c #78899B",
-"A c #8696A8",
-"B c #B6C2CC",
-"C c #BDC8D2",
-"D c #A6AFB6",
-"E c #A4B3C0",
-"F c #71899D",
-"G c #788EA2",
-"H c #7F94A7",
-"I c #869AAB",
-"J c #8DA0B0",
-"K c #7A8996",
-"L c #7D8EA3",
-"M c #98ACC2",
-"N c #AFBCC8",
-"O c #B7C3CD",
-"P c #A1ABB2",
-"Q c #5E7990",
-"R c #657E95",
-"S c #6C8499",
-"T c #728A9E",
-"U c #627584",
-"V c #7A8C9B",
-"W c #8EA1B1",
-"X c #95A7B6",
-"Y c #9CACBB",
-"Z c #B1BEC9",
-"` c #9BA5AF",
-" . c #6A7D8E",
-".. c #8196A8",
-"+. c #889BAD",
-"@. c #8FA1B1",
-"#. c #AAB8C4",
-"$. c #96A1AB",
-"%. c #B2C1D2",
-"&. c #90A6BE",
-"*. c #95AAC1",
-"=. c #738B9F",
-"-. c #7A90A3",
-";. c #889CAD",
-">. c #8FA2B2",
-",. c #919DA7",
-"'. c #BBC8D7",
-"). c #8AA1BA",
-"!. c #A6B4C1",
-"~. c #AEBCC7",
-"{. c #B3BFCA",
-"]. c #B7C2CD",
-"^. c #C3CDD6",
-"/. c #A7AFB7",
-"(. c #B7C5D5",
-"_. c #859DB7",
-":. c #B2C1D1",
-"<. c #7F98B4",
-"[. c #93A8BF",
-"}. c #D9E0E7",
-"|. c #B1C0D1",
-"1. c #B4C3D3",
-"2. c #B7C5D4",
-"3. c #BCC9D7",
-"4. c #B3C2D2",
-" . . . . . . . . . . . . . . . ",
-" . + @ # $ % & * = - ; > , ' . ",
-" . ) ! ~ { ] ^ / ( _ : < [ } . ",
-" . / | 1 ~ { 2 3 / 4 5 6 7 8 . ",
-" . 9 0 | a b c d e f g 5 h i . ",
-" . j k l m n b o p q . r s t . ",
-" . u v w l x n y z . A B C D . ",
-" . E F G H I J K . L M N O P . ",
-" . ~ Q R S T U . V W X Y Z ` . ",
-". . . . . . . . ...+.@.X #.$.. ",
-". %.&.*.p q . . =.-...;.>.E ,.. ",
-". '.).. z . A . !.#.~.{.].^./.. ",
-". (._.. . L M . . . . . . . . . ",
-". :.<.. . . [.. ",
-". }.|.1.2.3.4.. ",
-". . . . . . . . "};
diff --git a/gui/mplayer/pixmaps/icon.xpm b/gui/mplayer/pixmaps/icon.xpm
deleted file mode 100644
index f0df8e4528..0000000000
--- a/gui/mplayer/pixmaps/icon.xpm
+++ /dev/null
@@ -1,323 +0,0 @@
-/* XPM */
-static const char * const icon_xpm[] = {
-"64 64 256 2",
-" c None",
-". c #060606",
-"+ c #5A829E",
-"@ c #33485B",
-"# c #D18B61",
-"$ c #C08860",
-"% c #466680",
-"& c #B08460",
-"* c #968956",
-"= c #1A262E",
-"- c #726A4E",
-"; c #222E32",
-"> c #4A6A86",
-", c #86824A",
-"' c #3A5267",
-") c #DCB37D",
-"! c #7E868A",
-"~ c #6E6A4E",
-"{ c #393626",
-"] c #5C5743",
-"^ c #527691",
-"/ c #DAD250",
-"( c #AAAA56",
-"_ c #3AA66E",
-": c #BEB646",
-"< c #76828A",
-"[ c #4E5244",
-"} c #D3D1C1",
-"| c #95AD55",
-"1 c #696E6F",
-"2 c #626A5E",
-"3 c #B7BAB2",
-"4 c #A2AEAE",
-"5 c #96ABB3",
-"6 c #729E6E",
-"7 c #C5D764",
-"8 c #C66A46",
-"9 c #8AB25A",
-"0 c #7E3A23",
-"a c #868C5E",
-"b c #323E46",
-"c c #46627A",
-"d c #894933",
-"e c #ABD070",
-"f c #668BA8",
-"g c #965232",
-"h c #76322E",
-"i c #D4D07F",
-"j c #4A667F",
-"k c #BAD06C",
-"l c #98957B",
-"m c #7ECA96",
-"n c #A2663E",
-"o c #567A96",
-"p c #566266",
-"q c #6486A0",
-"r c #E1E2B7",
-"s c #6A3032",
-"t c #F8E082",
-"u c #C1B892",
-"v c #8A8A72",
-"w c #1F1A16",
-"x c #A8AFA1",
-"y c #7A9AAE",
-"z c #94DA9E",
-"A c #46463F",
-"B c #D2B2A2",
-"C c #D6E29A",
-"D c #4A2A28",
-"E c #7896AD",
-"F c #92603C",
-"G c #3F5A72",
-"H c #AEC061",
-"I c #7EAC78",
-"J c #A69062",
-"K c #899AA1",
-"L c #66665A",
-"M c #82865A",
-"N c #9A6A3E",
-"O c #364246",
-"P c #62382E",
-"Q c #4E6E8B",
-"R c #A5A593",
-"S c #60829D",
-"T c #BBC25D",
-"U c #BE966E",
-"V c #72A6BD",
-"W c #766656",
-"X c #DBA879",
-"Y c #CEBE42",
-"Z c #D1CEAE",
-"` c #8A6042",
-" . c #93978F",
-".. c #567E9C",
-"+. c #96C37F",
-"@. c #172026",
-"#. c #3C261E",
-"$. c #AFB190",
-"%. c #9AB25A",
-"&. c #F3F2DD",
-"*. c #A79D57",
-"=. c #D6C85C",
-"-. c #2E322A",
-";. c #B1C192",
-">. c #F1C27A",
-",. c #52D28A",
-"'. c #D4DB83",
-"). c #C2DB98",
-"!. c #6E6E62",
-"~. c #7E8E96",
-"{. c #584E38",
-"]. c #C5D2BA",
-"^. c #8A9E56",
-"/. c #4E5644",
-"(. c #6A767C",
-"_. c #B99D63",
-":. c #9DC55E",
-"<. c #F0E1B2",
-"[. c #7792A7",
-"}. c #D4C07A",
-"|. c #7C523C",
-"1. c #321E17",
-"2. c #90A25A",
-"3. c #84D08A",
-"4. c #C8C793",
-"5. c #5A82A6",
-"6. c #8FA6B4",
-"7. c #C8BE7B",
-"8. c #86AE86",
-"9. c #D2DECA",
-"0. c #7094AA",
-"a. c #0E1215",
-"b. c #A69C5E",
-"c. c #626A62",
-"d. c #DDD895",
-"e. c #F3EB89",
-"f. c #A2C5B6",
-"g. c #797567",
-"h. c #2E281A",
-"i. c #6FA2BA",
-"j. c #293948",
-"k. c #5A7EA2",
-"l. c #AAC486",
-"m. c #F0EEDA",
-"n. c #426278",
-"o. c #4E728E",
-"p. c #464232",
-"q. c #C0A88C",
-"r. c #6E7A7E",
-"s. c #92BA9A",
-"t. c #D6CA87",
-"u. c #B6B66E",
-"v. c #BCD183",
-"w. c #5C7E96",
-"x. c #88A2AF",
-"y. c #22221E",
-"z. c #B6C1C1",
-"A. c #52A672",
-"B. c #5E82A2",
-"C. c #989F99",
-"D. c #7A7642",
-"E. c #BDA868",
-"F. c #E7C99B",
-"G. c #3A4E66",
-"H. c #5E86A6",
-"I. c #536A7E",
-"J. c #E0C180",
-"K. c #AEAA7C",
-"L. c #CED472",
-"M. c #E8D8C0",
-"N. c #ADC866",
-"O. c #5E86AA",
-"P. c #757E84",
-"Q. c #675C44",
-"R. c #D2D672",
-"S. c #C2D87A",
-"T. c #B2D68B",
-"U. c #36322E",
-"V. c #323A3E",
-"W. c #D1C4AF",
-"X. c #2A281C",
-"Y. c #171A1B",
-"Z. c #DFCF8C",
-"`. c #E0DECB",
-" + c #8EBA5E",
-".+ c #627282",
-"++ c #A79C78",
-"@+ c #C7C65B",
-"#+ c #8A6E42",
-"$+ c #C0B45E",
-"%+ c #6E8DA5",
-"&+ c #463E2A",
-"*+ c #897C4F",
-"=+ c #565E56",
-"-+ c #E7E591",
-";+ c #7F7E70",
-">+ c #947A70",
-",+ c #D7D9C5",
-"'+ c #EED2A6",
-")+ c #ADA475",
-"!+ c #B7755D",
-"~+ c #868A76",
-"{+ c #C2C6B3",
-"]+ c #5E82A6",
-"^+ c #2E4254",
-"/+ c #90B6B6",
-"(+ c #364E62",
-"_+ c #424E4A",
-":+ c #ABB8B8",
-"<+ c #86AC57",
-"[+ c #D1C48E",
-"}+ c #C8D06D",
-"|+ c #C5B775",
-"1+ c #D29870",
-"2+ c #D4D098",
-"3+ c #DBD8AB",
-"4+ c #537697",
-"5+ c #E5E4CA",
-"6+ c #425E75",
-"7+ c #7E9AAA",
-"8+ c #B9CA69",
-"9+ c #9D7D56",
-"0+ c #567A9B",
-"a+ c #C5BF8F",
-"b+ c #E1E6A6",
-"c+ c #E2D456",
-"d+ c #AFDA6E",
-"e+ c #E7DB95",
-"f+ c #72C68A",
-"g+ c #C4C977",
-"h+ c #5A666E",
-"i+ c #B6AC82",
-"j+ c #99BB5E",
-"k+ c #5E625E",
-"l+ c #F0DD96",
-"m+ c #ADBF6F",
-"n+ c #3D566C",
-"o+ c #7E8A92",
-"p+ c #9EADAD",
-"q+ c #60B86E",
-"r+ c #94A6A4",
-"s+ c #E8E8DE",
-"t+ c #8AB28A",
-"u+ c #ACB45B",
-"v+ c #CB764B",
-"w+ c #26323A",
-"x+ c #5A82A2",
-"y+ c #4E4E46",
-"z+ c #868E8F",
-"A+ c #E2EEBE",
-"B+ c #6E9EB6",
-"C+ c #DFD36F",
-"D+ c #72828A",
-"E+ c #5A7E9D",
-"F+ c #A75F4D",
-"G+ c #527290",
-"n.n+6+Q Q > 6+n+' n+G 6+% j n.% o.Q Q j c % c o.o.> > > > > G+Q > > Q c n+6+c 6+c 4+^ G+k.x+0+k.....0+4+4+0+4+o.Q 4+4+Q Q o.4+> ",
-"E+6+% n.G G ' ' G c n.c c n.G c Q o.> % % j % G+4+4+^ Q > j o.^ o Q > 6+6+> o.> Q o.G+Q o.^ o + 0+Q Q o.^ ^ G+4+0+H.B...G+]+H.^ ",
-"0+(+@ 6+G G n+' G n+n+G G n+n+c Q > % 6+c > Q 0+o G+> c % > 4+4+^ o.> 6+6+c > > > o.^ 4+4+k.x+k.E+4+4+0+4+^ ^ ..]+H.]+0+4+5.O.4+",
-"^ j.j.x+B.x+x+H.5.H.x+]+H.x+E+]+]+H.5.5.H.H.x+B.x+5.+ x+x+5.H.x+5.x+x+o.0+B.H.x+o E+x+H.x+x+x+x+x++ H.x+E+x+]+x+H.5.x+....B.]+^ ",
-"o.j.j.5.O.5.x+H.5.5.5.k.]+5.5.H.5.]+B.5.5.5.x+]+x+k.k.]+H.5.O.O.5.5.k.o.4+5.O.O.0+..5.]+H.5.x+x+5.]+H.5.k.5.O.x+]+..x+x+x+x+5.G+",
-"> j.j.x+x+H.x+E+]+x+x+B.x+x+x+5.H.H.x+E+H.H.k.x+B.x++ 5.]+H.B.B.+ x++ ^ 4+E+E+5.5.o ^ ..5.H.]+x+B.+ x+B.H.H.x+]+x+E+B.x+x+E+G+> ",
-"> ^+j.5.5.]+5...]+]+O.5.5.]+]+]+5.O.O.x+5.5.5.O.H.5.x+H.5.O.H.]+O.5.k...x+0+^ ..5.]+0+0+]+H.]+5.5.k.5.x+5.H.5.O.....]+5...k.o o.",
-"% b j.x+x+x+E+..5.H.x++ E+H.x+x+]+x+x+x+B.x+x+x+5.5.B.x+H.H.5.H.x+E+o x+H.+ 0+4+E+x+o o x+x+..E+E+..E+5.H.]+H.5.0+x+H.]+]+..o.Q ",
-"> ^+^+]+]+H.x++ k.O.]+x+..H.H.H.O.O.]+O.x+B.5.H.H.H.5.5.5.O.O.]+5.5.k.5.5.]+x+0+5.x+0+k.0+O.O.5.4+0+H.]+H.5.H.5.0+0+x+x+x+E+4+o.",
-"> @ ^+x+x+..k...x+x+H.x+x+E+x+x+x+x+H.x+B.x+H.x+]+5.]+B.H.H.H.H.E+o x+B.x+..E+0+H.5.....0+x+x+..Q o 5.H.5.H.5.H.B.x+..x+x+4+^ Q ",
-"o.@ @ x+k.]+]+x+]+5.O.]+x+..5.]+5.5.O.O.5.x+]+5.H.H.O.5.5.5.O.5.k.4+5.]+O.O.x+0+H.]+5.x+0+0+....Q ..O.]+5.H.]+O.O.5.5.]+k.4+k.Q ",
-"G+@ @ ....H.H.x+x+B.]+H.x+k.x+x+B.H.x+x+x+x++ + E+x+x+H.x+x+5.H...^ H.x+E+..E+E+5.H.B.x+H.x+^ Q o ]++ H.B.k.x+H.x+x+H.H...o.+ Q ",
-"..@ (+x+x+5.]+5.x+x+5.5.5.]+5.5.k.5.5.B.k.5.5.5.5.5.5.]+E+x+5.O.k.0+5.5.H.H...x+5.H.O.]+]+k.> Q x+5.5.O.H.O.5.k.x+5.5.O.5.G+..Q ",
-"0+@ n+E+k.x+5.H.k.x+H.H.H.5.+ x+x+H.H.H.B.]+H.5.x+B.H.H.x+E++ x+....E+x+x+5.k.B.+ x+E+5.x+^ > 0+x+H.H.x+H.x+x++ 0+E+x++ H.^ 0+^ ",
-"x+n+6+H.5.]+5.H.5.]+5.H.H.]+x+]+x+]+5.O.H.5.H.H.5.k.5.]+5.]+5.]+x+5.O.]+5.5.5.]+]+5.E+x+0+^ ^ k.5.5.O.5...]+5.H.x+]+5.....4+0+0+",
-"o n+n+x++ H.B.x+H.5.H.]+H.x+x+H.x+x+H.x+x+B.5.B.H.+ B.x+x+H.B.x+]+H.x+x+B.x+x+H.H.x+..o ^ 4+0+x+B.x+H.O.E+H.]+k.....E+]+E+^ o 0+",
-"^ n+(+]+x+x+]+]+H.5.H.5.O.x+..5.O.5.5.5.5.H.O.5.5.5.5.H.5.]+H.5.5.]+5...H.5.5.5.H.k.5.4+o.0+0+..]+5.]+5.k.H.H.]+]+5...4+k.0+0+o ",
-"o.' ' 5.x+x+x+H.x+]+5.H.x+k.k.B.x+H.x+E+x+5.H.f O.f q H.f H.O.H.]+x+k.B.5.B.B.x+4++ x+..4+..E+4+x+x+H.E+x+H.5.H.+ B.]+0+o o.Q 4+",
-"0+n+G ]+O.O.5.H.H.H.5.x+]+H.k.O.O.H.H.H.f %+i.0.V V E B+E i.f S S + H.H.O.O.5.o.> ..]+H.k...B...0+5.O.5.5.H.5.O.x+H.H...0+% > 0+",
-"x+G c O.o x+x+k.E+x+B.k.+ + 5.5.f f f i.[.[.[.x.6.5 6.6.6.6.x.y B+B+0.f O.5.o Q o.k.5.x+....x+0+o.E+x+H.x+]+H.5...0+x+H...> > + ",
-"x+n+n.]+]+]+H.O.5.x+x+5.k.H.x+O.f i.E 7+5 p+r+r+x :+z.:+:+s.r+r+x.x.y y S 4+> Q x+H.]+H.k.k.5.0+Q 0+5.]+H.5.H.]+O.5.5.]+..> Q k.",
-"..' G O.5.O.0+5.0+5.o + x+x+q f 0.E x.:+4 3 4.g+i C+=.=.Z.W.,+Z {+;.5 0.S o G+G+G+0+o 5.o O.o Q % 5.o H.5.H.5.H.H.5.x++ ....Q ..",
-"0+(+n+O.5.x+]+H.]+]+k.]+5.O.f 0.x.5 4 ;.7.}.7.u 3 4.3+2+c+E.3+,+e+Y r+7+D+5.x+5.]+5.5.]+x+O.O.^ % ^ 4+E+5.]+5.5.]+x+4+G+4+0+4+0+",
-"4+(+n++ 5.0+..]+O.5.5.O.]+f q [.7+5 u.K.Z 5+2+4.9.`.`.<.3+: Z.c+7.u+ .7+i.B.k.x+H.]+5.O...E+x+k.0+4+4+0++ H.H.x+H.]+j c o ^ ^ o ",
-"Q (+n+^ ^ Q 0+o ^ E+o ..x+x+E+%+r+@+$.{+,+r Z.*.Z } r &.<.c+=.( Z.g+4 K %+q q f O.f 5.E+o 0+0+4+E++ E+^ x+x+H.o o o c 6+Q > Q > ",
-"a.Y.. = @.= w+= b ; ; ; Y.-.-.{ L M * )+J.e+@+|+[+t.l+e+C+/ $+d.i ,+,+{+ .5 p+6.r+%+D+h+G _+[ O O O -.b -.b b X.^+@.Y.@.. Y.a.a.",
-"a.; @.O b /.L ] (.g.~ !.A ] ] ] g.*+)+|+Z.i ( t.}.F.r d.'.@+: i d.Z } Z .z+R r+p+l .< ~+a ~.a a a !., g., ;+W g.] A [ w h.1.Y.",
-"w ] A h+;+a+a+)+u.K.)+l * *+U U X ) '+e+-+}+L.t e+'.}+T 7 u.C Z s+&.s+5+u R i+{+9.4.$.R {+9.&.m.s+r a+U >.F.F.) E.1+1+# 8 h 0 1.",
-"y.o+L a ++[+4.u 4.4.7.a+u U X X ) >.'+l+L.u+g+@+@+7.i 5+S.g+m+m.s+&.m.C L.5+].Z {+u+K.)+$+7.,+m.C S.T =.t e+R.u+J.X 1+v+8 0 d #.",
-"1.E !.l u }+H L.H T T '+'.T ) ) ) >.t -+u+|+|+}.J.t.l+-+7 %.Z.m.&.A+H m+N.k u b+H ( Z.l+S.7 N.k i }+u+e+d.T S.%.|+F.X # v+n F 1.",
-"w /.;+Z 8+g+j+| r 7 k k k :.$+) |+X |+7 ( |+J *+* u [+C j+4.<.b+S.%.3+s+k %.d.S.<+|+e+8+H d+k +H R.l+S.%.l+S.( }.) E.# # n F U.",
-"w /.Q.W.M.v.<+5+<.v.j+u+e+e T H : E.T <+$+U 9+#+] ++u 7 m+A+b+d+ +3+r e ).H d+:.m+8+:.R.e.d+:.%.C+l+).%.2+b+%.t.}.g+E.# !+d g 1.",
-"Y.O Q.q.3 <+$.M.t.e 2.$+4.:.<+b.b.b.e ^.J 9+F ` p.J z.).e '.%.T.:.).:.s+9. +m+m+<+u+e.e.C :.:.R.7 :.H l+e+S.k v.j+_.# v+n d h 1.",
-"w p.{.~ a M q.B ++++)+++* *+D.D.*+*+^.D.& N |.P #.~+i./+8.t+,+].<+;.s+s+} } Z.t.Z.Z.l+t d+N.'.:.H 7.$+X J.[+ +^.i+J & !+F+s s 1.",
-"a.X.U.y+[ ] 9+>+Q.c.g.~ ~ Q.Q.] Q.Q.Q.Q.] {.{.{.{.l 7+R C.p+:+;.z.:+:+p+C.R ++|+7.t.t C +j+7 :.T |+* * J J U J J 9+#+|.D D D w ",
-"a.Y.a.-.-.U.V.y.b U.X._+X.O { &+y+{.k+] ] =+;+(.P.R < 3 z+ .x C.R ~+;+(.L 1 ;+* )+}.T.3.%.J.q.++*+!.y+{.p.[ ] p.y+U.X.w+. Y.. a.",
-"; Y.= -.j.V.V.-.b j.; b b O O O A A /.=+=+=+=+1 .+< ~.< o+P.P.! .+(.L /.p k+;+++|++.T.q+7.u.l ;+c.] _+A ^+O A O A b j.V.; = @.= ",
-"6+b @ c c G 6+c 6+n+G.6+6+c n.6+n.> c 6+6+6+' n+c 6+6+6+c c 6+I.c c c j I.! C.3 +.).z 8.{+p+o+D+4+.+j j c c c j % 6+6+6+6+^+@ n+",
-"..G c E+E+H.S x+w.4+^ ^ + + H.+ w.+ O.O.k.k.o.4+0+k.O.S ]+]+k.]+O.x+B.w.%+6.z.T.s.).q+z.z.5 0.%+f O.B.o B.B.E++ ]+O.O.]+E+j 6+..",
-"5.c c + + x+H.H.E+o o 4+S B.E+x+H.O.5.O.k.4+Q 0+]+]+O.]+O.]+H.H.H.H.q ^ %+5 z.f+Z f+I Z p+x.q q B.B.x+G+5.H.4+4+O.]+O.]+]+> n+k.",
-"k.6+% 5.5.x+x++ + B.H...+ x+..0+E+H.5.O.4+G+0+k.5.]+O.]+5.5.O.B.x+H.H.w.[.r+f.m z A.:+:+7+7+x+H.x++ 5.G+5.]+0+4+5.]+O.5.]+% ' k.",
-"..6+Q B.B.]+k.x+B.x+B.+ x++ x+E+H.5.x+k.4+0+5.O.k.5.]+H.O.5.x+5.E+o G+G+0.5 f.,._ :+f.5 y f O.x+E+k.o o.0+5.5.0+..5.5.O.5.G ' ..",
-"5.j 4+H.x++ E+x++ x+B.x+k.x+....4+k.+ x+0+4+5.5.4+..5.5.H.]++ ....w.B.q E 7+5 /+6 :+6.E %+f H.5.E+]+x+x+5...5.5.5.5.k.O.O.6+' x+",
-"k.> o x+5.]+5.5.5.5.O.B.x+]+k.k...x+5.]+0+0+]+H.G+E+x+x+x+H.]+H.]+O.E+B.%+E 0.6.E E E %+E+H.B.E+x+H.E+B.x+]+]+]+x+B...+ ]+n+' E+",
-"0+> > H.x+x+H.B.E+E+5.5.x+x+H.B.]+x+..x+o ..5.O.o.k.k.5.5.5.5.H.H.x+]+..q 0.%+[.E %+q q w.5.H.x+..5.5.O.5...O.O.O.O.k.H.+ ' n+..",
-"^ % 6+5.H.H.H.5.0+0+x+H.k.5.5.O.H.]+O...Q x+E+H.Q ..x+E+B.H.]+5.5.5.5.....]+f f f S w.5.x+]+x+H.E+..B.H.H.E+x+B.x+x+x+k...' % 4+",
-"o.> G x+5.]+H.x+..G+k.x++ H.x+5.H.k.k...Q 5.k.O.> E+O.5.x+H.H.H.x+5.k.k.5.k.O...5.0+E+k.x+]+5.]+k.0+x+5.O.x+..]+]+....5.5.' 6+k.",
-"G+^ % 5.O.O.5.x+O.4+^ B.5.5.O.x+5.x+5.x+4+x+x+B.Q 0+E+E+k.x+5.5.O.H.5.O.O.5.5.O...o.4+..x+5.H.5.x+o.0++ x+]+B.5.x+0+x+]+x+n+G ..",
-"k.E+Q + H.H.x++ x+5...4+o + O.x+H.H.k.x+....5.5.o.4+0+o ^ E+B.x+B.]+5.5.5.5...]+0+> > E+H.5.H.5.O.x+]+5.x+..H.O.H.x+0+x+5.@ ' O.",
-"H.0+0+]+5.5.x+5.....O.B.4+k.H.]+O.H.x+..E+0++ + 0+o ..4+Q 4+0+]+5.H.]+]+5.k.5.O.^ % 4+5.E+]+x+H.x+5.x+E+0+> E+x+5.x+x+H.E+@ (+x+",
-"H.o ..H.H.B.x+O.]+B.k.B.o.k.H.+ H.]+5...5...O.H.5...H.H.o o.^ + 5.H.H.o ^ 0+5.]+o.j o 5.H.H.5.H.H.]+0+x+k.o.E+H.]+x+k.H...@ G.O.",
-"O.4+..H.]+5.k.H.H.O.x+5.G+x+5.k.5.+ B.]+B.0+E+x+o 4+0+0+....o.k.E+5.k.4+4+E+H.H.Q ^ 5.x+5.5.B.B.x++ B.5.o 4+0+5.H.]+x+x+E+@ (+H.",
-"H.4+k.H.H.H.x+5.H.H.H.o o.B.5.E+5.x+....]+5.k...0+^ 0+..0+x+..x+E+x+x+..x+5.5.x+Q ..5...E+..0+..5.H.E+4+k.H.0+k.H.H.5...0+@ (+O.",
-"O.G+x+5.5.k.x+H.5.O.5...G+5.5.5.]+5.5.k.+ H...4+^ 5.x+5.]+]+x+E+5.H.H.k.k.+ B.k.Q E+E+E+0+^ 4+G+5.E+4+..H.x+o + 5.5.H.E+0+(+(++ ",
-"..> ^ E+x+0+5.H.x+H.H.0+o H.+ H.H.]+5.5.5.x+x+% G+x+B.5.]+x+5.+ x+k.H.H.5.5.x+5.Q 5.5.5.k.x+..G+4+^ E+5...5.G+B.H.5.5.....@ n+..",
-"..Q j x+H.E+B.O.O.5.......5.5.x+x++ H.]+x+]+B.> 4+E+0+x+..O.H.k.]+x+0+..E+H...+ Q + ]+x+H.5.k.o o.Q x+B.x+G+o.5.5.H.H.H.x+(+G.0+",
-"x+0+> 4+x+x+o 5.o 5.k.E+]+o ]+5.5.5.x+5...O.5.Q 0+^ E+H.k.5.x++ x+H.x+5...]+]+..4++ 5.5.H.x+5.5.o.> o ]+5.Q 0+k.k.x+]+O.k.@ ' 0+",
-"5.0+> o.]+5.k.]+O.]+5.]+5.O.O.o H.w.O.]+]+5.B.4+0+> 0+5.+ H.x+5.O.k.k.H.]+x+H.O.....B.E+..o.E+E+0+> % x+x+0+x+H.x+B.5.x+H.(+(+0+",
-"E+..4+o.k.H...k.O.]+O.H.5.5.]+5.5.5.O.5.]+x+H.x+..c > 4+k.]+x+x+H...k.5.5...0+k.E+0+..k.x+..H.k.5.Q > 0+x+0+x+x+..O.5.k.x+(+(+0+",
-"..4+B.4+o 5.5.x+5.H.O.]+x+E+H.O.]+5.x+B.x+x+H...k.> > > o x+]+O.5.k...E+H.k...+ ..o.^ k.k...k.^ 5.Q > E+E+o x+x+0+..B.H.x+' ^+E+",
-"o ^ x+5.o.0+5.k...x+H.]+5.0+k.O.x+x+O.H.o ..]+x+..^ k.> > ..x+H.H...H.]++ Q Q > ..k.5.]+O.5.O.k.5.> o.5.G+Q k.x+0+....]+H.' @ 0+",
-"5...x+H.Q 4+B.x+k.x+O.x+x+....x+k.E+x+..0+G+> n.c 6+% > Q ..x+E+0+^ o.Q 6+G n.j > j 6+% j > c 6+' @ G c 6+G n.6+6+n.6+G G n+' H.",
-"H.]+..E+o o.x+E+0+x+x+]+]+k.0+E+x+x+5.k.0+Q c % > > % n.> 4+....0+0+0+4+6+j o.Q > Q n.% n.6+n+(+(+(+G G n+G c c 6+6+G G 6+% > O.",
-"> % ^ 4+Q G n+n+6+c % % % % n.% Q Q > > % > o.0+0+G+4+Q Q > > Q Q G n.' n+n.j j Q Q > Q k.5.^ O.5.G+> Q o.o.% % Q o.o.> Q ^ o Q "};
diff --git a/gui/mplayer/pixmaps/loadeaf.xpm b/gui/mplayer/pixmaps/loadeaf.xpm
deleted file mode 100644
index fb603a48a2..0000000000
--- a/gui/mplayer/pixmaps/loadeaf.xpm
+++ /dev/null
@@ -1,151 +0,0 @@
-/* XPM */
-static const char * const loadeaf_xpm[] = {
-"16 16 132 2",
-" c None",
-". c #5C5C5C",
-"+ c #656565",
-"@ c #6A6A6A",
-"# c #6A6A69",
-"$ c #6D6D6D",
-"% c #848484",
-"& c #818181",
-"* c #F9F9F9",
-"= c #FEFEFE",
-"- c #FFFFFF",
-"; c #FBFBFB",
-"> c #F4F4F4",
-", c #D2D2D1",
-"' c #E2E2E2",
-") c #B3B3B3",
-"! c #888888",
-"~ c #F8F8F8",
-"{ c #DCDCDC",
-"] c #F5F5F5",
-"^ c #FDFDFD",
-"/ c #FCFCFC",
-"( c #FBFBFA",
-"_ c #F4F4F3",
-": c #AFAFAE",
-"< c #707070",
-"[ c #5E5E5E",
-"} c #898989",
-"| c #E7E7E7",
-"1 c #B1B1B1",
-"2 c #ECECEC",
-"3 c #F5F5F4",
-"4 c #EFEFEE",
-"5 c #EEEEED",
-"6 c #EBEBEB",
-"7 c #CDCCCC",
-"8 c #9E9C9B",
-"9 c #7D7B7A",
-"0 c #484745",
-"a c #FCFCFB",
-"b c #D3D3D2",
-"c c #ECECEB",
-"d c #DADAD9",
-"e c #BCBCBB",
-"f c #BCBBBA",
-"g c #BAB9B8",
-"h c #C6C5C3",
-"i c #B8B6B3",
-"j c #504E4A",
-"k c #FAFAF9",
-"l c #EDEDEC",
-"m c #F3F2F1",
-"n c #E9E9E8",
-"o c #DFDFDE",
-"p c #E0DFDE",
-"q c #DFDFDD",
-"r c #DFDEDD",
-"s c #EBEBE9",
-"t c #E9E8E6",
-"u c #CDCAC6",
-"v c #595651",
-"w c #F7F7F6",
-"x c #F4F4F2",
-"y c #F4F3F2",
-"z c #F1F1EF",
-"A c #F0EFED",
-"B c #F0F0EE",
-"C c #EAEAE7",
-"D c #D4D1CC",
-"E c #625F5A",
-"F c #F1F0EF",
-"G c #E1E1DF",
-"H c #EFEEEC",
-"I c #EEEDEB",
-"J c #EAE9E6",
-"K c #BEBDBB",
-"L c #B9B9B6",
-"M c #CCCAC5",
-"N c #625F59",
-"O c #B3B2B0",
-"P c #E4E3E1",
-"Q c #DBDAD8",
-"R c #DAD9D7",
-"S c #D9D8D6",
-"T c #DEDDDA",
-"U c #171717",
-"V c #A6A49F",
-"W c #615F59",
-"X c #878787",
-"Y c #DDDDDC",
-"Z c #9F9E9D",
-"` c #000000",
-" . c #C5C4C2",
-".. c #C4C3C0",
-"+. c #D1D0CD",
-"@. c #8A8A88",
-"#. c #B7B5B0",
-"$. c #605D57",
-"%. c #E3E3E0",
-"&. c #C1BFBC",
-"*. c #CDCAC5",
-"=. c #615D57",
-"-. c #808080",
-";. c #E2E1DD",
-">. c #DFDEDA",
-",. c #DEDDD9",
-"'. c #D5D4D1",
-"). c #C5C3BF",
-"!. c #CBC8C2",
-"~. c #5F5C56",
-"{. c #CFCCC6",
-"]. c #CECCC5",
-"^. c #CECCC6",
-"/. c #CECBC5",
-"(. c #CCC9C3",
-"_. c #ADABA6",
-":. c #8F8D88",
-"<. c #A6A49E",
-"[. c #C4C0BA",
-"}. c #B9B6AE",
-"|. c #55534C",
-"1. c #4F4E4D",
-"2. c #4D4B47",
-"3. c #4E4C47",
-"4. c #4E4C46",
-"5. c #4D4B46",
-"6. c #4D4A46",
-"7. c #4D4A45",
-"8. c #4C4A45",
-"9. c #4B4944",
-"0. c #45433E",
-"a. c #3C3B38",
-" . + @ @ @ @ @ # $ @ % ",
-" & * = - = = = ; > , ' ) ",
-" ! ~ { ] ^ / / ( _ : < [ ",
-" } | 1 2 3 4 4 5 6 7 8 9 0 ",
-" } a b c d e e f g e h i j ",
-" ! k l m n o p q r s t u v ",
-" ! w x y z z z A B z C D E ",
-" ! F r G H H H I J K L M N ",
-" ! p : O P Q R S T U U V W ",
-" X Y Z ` Z . ...+.U @.#.$.",
-" X Z ` Z B B %.U U U &.*.=.",
-" -.` Z ;.>.,.'.U U U ).!.~.",
-"` ` Z {.].^./.(._.:.<.[.}.|.",
-"` ` ` 1.2.3.4.4.2.5.6.7.8.9.0.a.",
-"` ` ` ",
-"` ` ` ` "};
diff --git a/gui/mplayer/pixmaps/logo.xpm b/gui/mplayer/pixmaps/logo.xpm
deleted file mode 100644
index 495a7b55fe..0000000000
--- a/gui/mplayer/pixmaps/logo.xpm
+++ /dev/null
@@ -1,1227 +0,0 @@
-/* XPM */
-static const char * const logo_xpm[] = {
-"101 83 1141 2",
-" c None",
-". c #9094BB",
-"+ c #8488B5",
-"@ c #7A7FAF",
-"# c #7276AA",
-"$ c #6E72A7",
-"% c #7479A7",
-"& c #8E90AE",
-"* c #B7B8C1",
-"= c #CFCECE",
-"- c #D8D8D8",
-"; c #9094BA",
-"> c #8A8FB9",
-", c #8A8FB8",
-"' c #8186B4",
-") c #787EB0",
-"! c #747AAE",
-"~ c #7479AE",
-"{ c #7277AD",
-"] c #6E74AB",
-"^ c #696EA7",
-"/ c #5F64A1",
-"( c #515798",
-"_ c #42498F",
-": c #3D4485",
-"< c #3A417C",
-"[ c #555980",
-"} c #8F9098",
-"| c #BBBBBB",
-"1 c #D3D3D3",
-"2 c #9195BC",
-"3 c #8E92BB",
-"4 c #898EB8",
-"5 c #8286B5",
-"6 c #7B80B2",
-"7 c #757AAE",
-"8 c #7579AE",
-"9 c #7379AD",
-"0 c #7378AD",
-"a c #7176AC",
-"b c #6E73AA",
-"c c #686DA6",
-"d c #6066A1",
-"e c #545A9A",
-"f c #454D92",
-"g c #3E4588",
-"h c #393F7D",
-"i c #343971",
-"j c #323767",
-"k c #585A6B",
-"l c #929292",
-"m c #C2C3C2",
-"n c #969ABF",
-"o c #8F94BB",
-"p c #8A8EB9",
-"q c #8388B6",
-"r c #7C81B1",
-"s c #757AAD",
-"t c #7278AC",
-"u c #7177AC",
-"v c #7075AB",
-"w c #6F74AB",
-"x c #6D73AA",
-"y c #6C71A8",
-"z c #666BA5",
-"A c #6167A2",
-"B c #5B619E",
-"C c #53589A",
-"D c #474E94",
-"E c #3F468C",
-"F c #3C4181",
-"G c #353A74",
-"H c #2F3466",
-"I c #2A2F5B",
-"J c #404255",
-"K c #797978",
-"L c #B7B7B7",
-"M c #8C91BA",
-"N c #8A90B9",
-"O c #878BB8",
-"P c #7B81B2",
-"Q c #767CAF",
-"R c #737AAD",
-"S c #7076AC",
-"T c #6C72A9",
-"U c #6A70A8",
-"V c #686EA6",
-"W c #666CA5",
-"X c #6469A3",
-"Y c #5E64A0",
-"Z c #585E9C",
-"` c #4D5496",
-" . c #4A5094",
-".. c #454C91",
-"+. c #40478E",
-"@. c #3D4486",
-"#. c #383D79",
-"$. c #303569",
-"%. c #292E5A",
-"&. c #25294F",
-"*. c #3A3B45",
-"=. c #727272",
-"-. c #B9B9B9",
-";. c #8D92B9",
-">. c #888CB8",
-",. c #878CB7",
-"'. c #7E83B2",
-"). c #767BAF",
-"!. c #747AAD",
-"~. c #7278AD",
-"{. c #6F75AA",
-"]. c #6D72A9",
-"^. c #6B70A8",
-"/. c #696EA6",
-"(. c #676CA5",
-"_. c #646AA4",
-":. c #5F64A0",
-"<. c #5B629F",
-"[. c #585E9D",
-"}. c #555B9B",
-"|. c #525899",
-"1. c #4F5597",
-"2. c #4C5295",
-"3. c #495094",
-"4. c #474E93",
-"5. c #454C92",
-"6. c #444B91",
-"7. c #434A91",
-"8. c #424991",
-"9. c #41488E",
-"0. c #3F468A",
-"a. c #3B4180",
-"b. c #33386F",
-"c. c #2A2F5C",
-"d. c #24274E",
-"e. c #232645",
-"f. c #403F40",
-"g. c #7E7E7E",
-"h. c #C8C8C8",
-"i. c #8E92BA",
-"j. c #8287B5",
-"k. c #7277AC",
-"l. c #676CA6",
-"m. c #656AA4",
-"n. c #6168A2",
-"o. c #5F65A1",
-"p. c #5C629F",
-"q. c #595F9E",
-"r. c #565C9C",
-"s. c #4F5698",
-"t. c #4C5396",
-"u. c #4A5095",
-"v. c #464D93",
-"w. c #444B92",
-"x. c #434A92",
-"y. c #424990",
-"z. c #40478D",
-"A. c #3E4486",
-"B. c #363C77",
-"C. c #2C3161",
-"D. c #24284E",
-"E. c #212549",
-"F. c #282A37",
-"G. c #4F4F4F",
-"H. c #9C9C9C",
-"I. c #8F93BC",
-"J. c #8A8EB8",
-"K. c #868BB7",
-"L. c #8489B6",
-"M. c #797EB0",
-"N. c #6D72AA",
-"O. c #696FA7",
-"P. c #676DA6",
-"Q. c #656AA5",
-"R. c #6268A3",
-"S. c #5D62A0",
-"T. c #5A5F9E",
-"U. c #53599A",
-"V. c #505698",
-"W. c #4A5195",
-"X. c #484F93",
-"Y. c #464D92",
-"Z. c #444C92",
-"`. c #434A90",
-" + c #41488F",
-".+ c #3A407E",
-"++ c #303467",
-"@+ c #252A51",
-"#+ c #222540",
-"$+ c #353535",
-"%+ c #C7C7C7",
-"&+ c #9095BB",
-"*+ c #898EB9",
-"=+ c #858AB7",
-"-+ c #7075AC",
-";+ c #6F74AA",
-">+ c #6C71A9",
-",+ c #6A6FA8",
-"'+ c #656BA4",
-")+ c #6368A3",
-"!+ c #5C639F",
-"~+ c #59609E",
-"{+ c #565D9C",
-"]+ c #535A9A",
-"^+ c #505798",
-"/+ c #4D5497",
-"(+ c #3C4384",
-"_+ c #32376D",
-":+ c #272B55",
-"<+ c #222549",
-"[+ c #212547",
-"}+ c #2A2A2C",
-"|+ c #555555",
-"1+ c #ACACAC",
-"2+ c #9C9FBD",
-"3+ c #9296B9",
-"4+ c #868AB3",
-"5+ c #7D82B0",
-"6+ c #7B81AE",
-"7+ c #7C81AE",
-"8+ c #7C80AF",
-"9+ c #7B80AE",
-"0+ c #7A7FAE",
-"a+ c #797FAE",
-"b+ c #787EAD",
-"c+ c #787DAC",
-"d+ c #777CAB",
-"e+ c #757AAB",
-"f+ c #7479A9",
-"g+ c #7277A8",
-"h+ c #7175A7",
-"i+ c #6E73A5",
-"j+ c #6C71A4",
-"k+ c #6A6EA3",
-"l+ c #666BA1",
-"m+ c #63699F",
-"n+ c #60669D",
-"o+ c #5D639B",
-"p+ c #595E95",
-"q+ c #575B92",
-"r+ c #535990",
-"s+ c #51578F",
-"t+ c #4F558E",
-"u+ c #4E548D",
-"v+ c #4D538D",
-"w+ c #4C528C",
-"x+ c #4B518C",
-"y+ c #4B508C",
-"z+ c #4B518D",
-"A+ c #464D8D",
-"B+ c #505796",
-"C+ c #42488B",
-"D+ c #343A72",
-"E+ c #292D59",
-"F+ c #22264A",
-"G+ c #212548",
-"H+ c #25262D",
-"I+ c #434443",
-"J+ c #959595",
-"K+ c #D6D6D6",
-"L+ c #6BCCE6",
-"M+ c #79D0E7",
-"N+ c #8F91AA",
-"O+ c #3A3E66",
-"P+ c #22264B",
-"Q+ c #242531",
-"R+ c #393A39",
-"S+ c #828282",
-"T+ c #D0D0D0",
-"U+ c #86D6ED",
-"V+ c #6FD1EC",
-"W+ c #5ECDEA",
-"X+ c #69D0EB",
-"Y+ c #A7A7A9",
-"Z+ c #4E5167",
-"`+ c #232536",
-" @ c #333333",
-".@ c #747474",
-"+@ c #CACACA",
-"@@ c #A1E1F0",
-"#@ c #8CDBEF",
-"$@ c #7CD6EE",
-"%@ c #6CD1EC",
-"&@ c #7AD5ED",
-"*@ c #DBDBDB",
-"=@ c #B5B5B5",
-"-@ c #8D8D8E",
-";@ c #575968",
-">@ c #22253B",
-",@ c #2E2E2E",
-"'@ c #676767",
-")@ c #C2C2C2",
-"!@ c #A9E2F2",
-"~@ c #9BE0F1",
-"{@ c #8DDBF0",
-"]@ c #79D5EE",
-"^@ c #75D4ED",
-"/@ c #C0C0C0",
-"(@ c #818181",
-"_@ c #4B4C5A",
-":@ c #2A2A2A",
-"<@ c #5A5A5A",
-"[@ c #B6E7F4",
-"}@ c #A7E4F3",
-"|@ c #9BDFF2",
-"1@ c #84D8EF",
-"2@ c #CCCCCC",
-"3@ c #9F9F9F",
-"4@ c #838383",
-"5@ c #7C7B7C",
-"6@ c #303031",
-"7@ c #4D4D4D",
-"8@ c #A4A4A4",
-"9@ c #B1E6F4",
-"0@ c #A6E3F4",
-"a@ c #90DDF1",
-"b@ c #61CDEB",
-"c@ c #AAAAAA",
-"d@ c #888888",
-"e@ c #808080",
-"f@ c #535353",
-"g@ c #3E3E3E",
-"h@ c #898989",
-"i@ c #D2D2D2",
-"j@ c #BBE8F5",
-"k@ c #AEE6F4",
-"l@ c #9DE0F3",
-"m@ c #7AD6EE",
-"n@ c #49C6E9",
-"o@ c #8D8D8D",
-"p@ c #6F6F6F",
-"q@ c #313131",
-"r@ c #696969",
-"s@ c #C1C1C1",
-"t@ c #B3E7F5",
-"u@ c #A8E4F3",
-"v@ c #8EDCF0",
-"w@ c #2BBDE4",
-"x@ c #BEBEBE",
-"y@ c #7D7D7D",
-"z@ c #2D2D2D",
-"A@ c #515151",
-"B@ c #A8A8A8",
-"C@ c #B9E8F4",
-"D@ c #AEE5F4",
-"E@ c #9EE0F3",
-"F@ c #46C5E8",
-"G@ c #24BBE3",
-"H@ c #C5C5C5",
-"I@ c #979797",
-"J@ c #2F2F2F",
-"K@ c #444444",
-"L@ c #B3E6F4",
-"M@ c #93DDF1",
-"N@ c #6DD2ED",
-"O@ c #34C0E5",
-"P@ c #1DB9E3",
-"Q@ c #CBCBCB",
-"R@ c #9B9B9B",
-"S@ c #AAE4F4",
-"T@ c #9EE1F3",
-"U@ c #8ADAF0",
-"V@ c #63CEEB",
-"W@ c #19B7E2",
-"X@ c #A1A1A1",
-"Y@ c #80807F",
-"Z@ c #2F3537",
-"`@ c #3B3B3B",
-" # c #878787",
-".# c #A1E1F2",
-"+# c #97DFF2",
-"@# c #83D8EF",
-"## c #5ECDEB",
-"$# c #26BCE2",
-"%# c #18B7E1",
-"&# c #D5D5D5",
-"*# c #A7A7A7",
-"=# c #868686",
-"-# c #2A3E43",
-";# c #363636",
-"># c #7C7C7C",
-",# c #CFCFCF",
-"'# c #A0E0F0",
-")# c #92DDF2",
-"!# c #7FD7EF",
-"~# c #5CCCEB",
-"{# c #27BCE3",
-"]# c #21BAE3",
-"^# c #AEAEAE",
-"/# c #24464F",
-"(# c #6E6E6E",
-"_# c #9EDFF0",
-":# c #8EDCF1",
-"<# c #7ED6EE",
-"[# c #5DCCEB",
-"}# c #2BBEE4",
-"|# c #23BBE3",
-"1# c #DCDCDC",
-"2# c #B6B6B6",
-"3# c #1E4D5A",
-"4# c #2C2C2D",
-"5# c #606060",
-"6# c #BCBCBC",
-"7# c #A1DFF1",
-"8# c #8DDCF1",
-"9# c #7FD7EE",
-"0# c #61CEEB",
-"a# c #32C0E5",
-"b# c #26BBE4",
-"c# c #185667",
-"d# c #282929",
-"e# c #ADADAD",
-"f# c #80D7EE",
-"g# c #66CFEC",
-"h# c #39C2E6",
-"i# c #21BAE2",
-"j# c #C6C6C6",
-"k# c #989898",
-"l# c #165B6E",
-"m# c #242A2C",
-"n# c #494949",
-"o# c #9E9E9E",
-"p# c #82D9EF",
-"q# c #6AD1EC",
-"r# c #40C4E6",
-"s# c #13B6E1",
-"t# c #CECECE",
-"u# c #155B6E",
-"v# c #1E3137",
-"w# c #404040",
-"x# c #8F8F8F",
-"y# c #D4D4D4",
-"z# c #93DCF1",
-"A# c #85D9EF",
-"B# c #6FD2ED",
-"C# c #48C6E8",
-"D# c #1AB8E3",
-"E# c #A6A6A6",
-"F# c #858585",
-"G# c #155C6F",
-"H# c #173943",
-"I# c #383838",
-"J# c #7F7F7F",
-"K# c #96DDF0",
-"L# c #87D9F0",
-"M# c #73D3ED",
-"N# c #4FC8E9",
-"O# c #D7D7D7",
-"P# c #145E72",
-"Q# c #11414E",
-"R# c #707070",
-"S# c #C9C9C9",
-"T# c #99DEF0",
-"U# c #89DAF0",
-"V# c #77D5EE",
-"W# c #56CBE9",
-"X# c #31BFE4",
-"Y# c #8C8C8D",
-"Z# c #0B495A",
-"`# c #626262",
-" $ c #8ADBF0",
-".$ c #7BD6EE",
-"+$ c #5CCCEA",
-"@$ c #3BC2E6",
-"#$ c #BDBDBD",
-"$$ c #919291",
-"%$ c #145E73",
-"&$ c #055265",
-"*$ c #2A292A",
-"=$ c #565656",
-"-$ c #B0B0B0",
-";$ c #8BDBF0",
-">$ c #7ED7EF",
-",$ c #62CEEB",
-"'$ c #42C4E7",
-")$ c #146074",
-"!$ c #00586F",
-"~$ c #252A2B",
-"{$ c #4B4B4B",
-"]$ c #81D7EF",
-"^$ c #67D0EB",
-"/$ c #4BC7E8",
-"($ c #4E5498",
-"_$ c #565B9A",
-":$ c #515799",
-"<$ c #515899",
-"[$ c #434890",
-"}$ c #4A5196",
-"|$ c #4F4D4E",
-"1$ c #424041",
-"2$ c #3B393A",
-"3$ c #383637",
-"4$ c #9E9D9D",
-"5$ c #156175",
-"6$ c #005870",
-"7$ c #1F2F35",
-"8$ c #414141",
-"9$ c #919191",
-"0$ c #8FDCF1",
-"a$ c #5ACCEA",
-"b$ c #484F94",
-"c$ c #474F93",
-"d$ c #424890",
-"e$ c #464445",
-"f$ c #373536",
-"g$ c #413F40",
-"h$ c #A5A5A4",
-"i$ c #166276",
-"j$ c #18373F",
-"k$ c #39393A",
-"l$ c #93DDF0",
-"m$ c #71D2ED",
-"n$ c #60CEEA",
-"o$ c #555A9A",
-"p$ c #474D92",
-"q$ c #5B609E",
-"r$ c #474646",
-"s$ c #16647A",
-"t$ c #123F4C",
-"u$ c #737373",
-"v$ c #98DDF0",
-"w$ c #87DAF0",
-"x$ c #75D4EE",
-"y$ c #525898",
-"z$ c #555B9C",
-"A$ c #5A619F",
-"B$ c #DADADA",
-"C$ c #B3B3B3",
-"D$ c #17677D",
-"E$ c #0C4758",
-"F$ c #656565",
-"G$ c #70D3ED",
-"H$ c #5A609E",
-"I$ c #575D9D",
-"J$ c #4D4B4C",
-"K$ c #363435",
-"L$ c #454344",
-"M$ c #504E4F",
-"N$ c #4C4B4C",
-"O$ c #474546",
-"P$ c #504F50",
-"Q$ c #4B4A4B",
-"R$ c #434142",
-"S$ c #555454",
-"T$ c #4F4E4E",
-"U$ c #4E4C4D",
-"V$ c #565455",
-"W$ c #444243",
-"X$ c #555354",
-"Y$ c #545253",
-"Z$ c #4A4949",
-"`$ c #444343",
-" % c #186B82",
-".% c #005970",
-"+% c #065065",
-"@% c #2B2A2B",
-"#% c #585858",
-"$% c #9DDEEF",
-"%% c #7AD5EE",
-"&% c #585D9D",
-"*% c #5D62A1",
-"=% c #595F9D",
-"-% c #575D9C",
-";% c #484647",
-">% c #3E3C3D",
-",% c #484748",
-"'% c #363535",
-")% c #4B494A",
-"!% c #403E3F",
-"~% c #3A3839",
-"{% c #4F4E4F",
-"]% c #454445",
-"^% c #525152",
-"/% c #C3C3C3",
-"(% c #196F86",
-"_% c #005971",
-":% c #02576D",
-"<% c #26292A",
-"[% c #8CDBF0",
-"}% c #474D93",
-"|% c #494F93",
-"1% c #434990",
-"2% c #485094",
-"3% c #464546",
-"4% c #434243",
-"5% c #3C3A3B",
-"6% c #525051",
-"7% c #514F50",
-"8% c #1A748C",
-"9% c #015A72",
-"0% c #015870",
-"a% c #202E32",
-"b% c #424242",
-"c% c #949494",
-"d% c #8DDCF0",
-"e% c #82D8EF",
-"f% c #454C93",
-"g% c #5E63A0",
-"h% c #505799",
-"i% c #4B5095",
-"j% c #3D3B3C",
-"k% c #474647",
-"l% c #494748",
-"m% c #414040",
-"n% c #D1D1D1",
-"o% c #1C7993",
-"p% c #005B74",
-"q% c #19363E",
-"r% c #3B3A3A",
-"s% c #848484",
-"t% c #91DCF0",
-"u% c #84D9EF",
-"v% c #77D5ED",
-"w% c #494F94",
-"x% c #363536",
-"y% c #515050",
-"z% c #4C4A4B",
-"A% c #4C4B4B",
-"B% c #3F3D3E",
-"C% c #454444",
-"D% c #D6D6D5",
-"E% c #1D7F99",
-"F% c #005D76",
-"G% c #133E4A",
-"H% c #343434",
-"I% c #767676",
-"J% c #94DDEF",
-"K% c #86D9F0",
-"L% c #76D5EE",
-"M% c #4D5396",
-"N% c #575C9B",
-"O% c #4E5499",
-"P% c #393738",
-"Q% c #424142",
-"R% c #535252",
-"S% c #DBDADB",
-"T% c #1E849F",
-"U% c #005F79",
-"V% c #0D4656",
-"W% c #88DAEF",
-"X% c #7AD6EF",
-"Y% c #4F5697",
-"Z% c #DEDEDE",
-"`% c #1F8AA6",
-" & c #00637D",
-".& c #074E62",
-"+& c #2B2B2A",
-"@& c #98DDEF",
-"#& c #4E5497",
-"$& c #43488F",
-"%& c #414990",
-"&& c #4D4C4D",
-"*& c #5C5B5B",
-"=& c #383536",
-"-& c #5E5D5D",
-";& c #605E5F",
-">& c #535152",
-",& c #2090AD",
-"'& c #006782",
-")& c #03566C",
-"!& c #27292A",
-"~& c #8BDBF1",
-"{& c #88DAF0",
-"]& c #2295B4",
-"^& c #006B87",
-"/& c #02576F",
-"(& c #212D30",
-"_& c #D9D9D9",
-":& c #8DDBF1",
-"<& c #3D3C3D",
-"[& c #1F99BB",
-"}& c #00708D",
-"|& c #005B73",
-"1& c #1A343C",
-"2& c #3C3C3C",
-"3& c #8EDBF0",
-"4& c #403F3F",
-"5& c #595858",
-"6& c #159BBF",
-"7& c #007594",
-"8& c #143D49",
-"9& c #787878",
-"0& c #CDCDCD",
-"a& c #92DDF0",
-"b& c #92DDF1",
-"c& c #14A0C5",
-"d& c #007A9A",
-"e& c #0E4554",
-"f& c #C4C4C4",
-"g& c #98DEF2",
-"h& c #0CA1C9",
-"i& c #007FA1",
-"j& c #00627D",
-"k& c #084D60",
-"l& c #2B2B2B",
-"m& c #5C5C5C",
-"n& c #B8B8B8",
-"o& c #9ADEF0",
-"p& c #99DFF2",
-"q& c #0BA5CF",
-"r& c #0084A8",
-"s& c #006681",
-"t& c #03556B",
-"u& c #505050",
-"v& c #A9A9A9",
-"w& c #9DDEF0",
-"x& c #9ADFF1",
-"y& c #0CA9D4",
-"z& c #0089AE",
-"A& c #006985",
-"B& c #222C2F",
-"C& c #464646",
-"D& c #9A9A9A",
-"E& c #A0E2F3",
-"F& c #0BABD7",
-"G& c #008EB4",
-"H& c #006C8A",
-"I& c #005A72",
-"J& c #1C3339",
-"K& c #3D3D3D",
-"L& c #8A8A8A",
-"M& c #A2E2F2",
-"N& c #0CADD8",
-"O& c #0090B7",
-"P& c #006F8C",
-"Q& c #005A73",
-"R& c #01586F",
-"S& c #153B45",
-"T& c #7B7B7B",
-"U& c #A4E2F3",
-"V& c #0CAED9",
-"W& c #0091B8",
-"X& c #12404D",
-"Y& c #A6E2F0",
-"Z& c #5D639F",
-"`& c #515698",
-" * c #0BADD8",
-".* c #008FB5",
-"+* c #006C89",
-"@* c #11414D",
-"#* c #565C9B",
-"$* c #484E94",
-"%* c #5A609D",
-"&* c #0BA9D4",
-"** c #0189AE",
-"=* c #153B46",
-"-* c #666666",
-";* c #464C92",
-">* c #4D5495",
-",* c #535999",
-"'* c #4D5498",
-")* c #4B5196",
-"!* c #4E5496",
-"~* c #0BA2CA",
-"{* c #017FA1",
-"]* c #00607A",
-"^* c #1C3137",
-"/* c #303030",
-"(* c #5C61A0",
-"_* c #545A9B",
-":* c #1398BC",
-"<* c #00708E",
-"[* c #03546A",
-"}* c #242728",
-"|* c #393939",
-"1* c #5A5F9D",
-"2* c #1284A2",
-"3* c #00617B",
-"4* c #11404D",
-"5* c #282828",
-"6* c #4A4A4A",
-"7* c #9D9D9D",
-"8* c #474D94",
-"9* c #6065A2",
-"0* c #5B619F",
-"a* c #4C5294",
-"b* c #AFB9BB",
-"c* c #056883",
-"d* c #005972",
-"e* c #04546A",
-"f* c #22292B",
-"g* c #323232",
-"h* c #6A6A6A",
-"i* c #BFBFBF",
-"j* c #5C619D",
-"k* c #7A7EA7",
-"l* c #6C8991",
-"m* c #015A73",
-"n* c #02576E",
-"o* c #19353C",
-"p* c #2A2B2A",
-"q* c #4A4849",
-"r* c #474E8F",
-"s* c #3B4283",
-"t* c #3A3F78",
-"u* c #A1A2A8",
-"v* c #939393",
-"w* c #2A6777",
-"x* c #163943",
-"y* c #2A2929",
-"z* c #434991",
-"A* c #767AA7",
-"B* c #373D79",
-"C* c #2E3467",
-"D* c #57596F",
-"E* c #62777C",
-"F* c #035870",
-"G* c #045369",
-"H* c #1B353C",
-"I* c #2C2C2C",
-"J* c #797979",
-"K* c #A9ABCB",
-"L* c #444A90",
-"M* c #D7D7DB",
-"N* c #3A3F72",
-"O* c #282C57",
-"P* c #2B3150",
-"Q* c #155668",
-"R* c #133F4C",
-"S* c #272E30",
-"T* c #383837",
-"U* c #545454",
-"V* c #A9ACCC",
-"W* c #A5A8C9",
-"X* c #E0E0E0",
-"Y* c #DFDFDF",
-"Z* c #E1E1E1",
-"`* c #E3E3E3",
-" = c #DADAD9",
-".= c #5B5E7E",
-"+= c #242528",
-"@= c #474747",
-"#= c #AAACCB",
-"$= c #9EA2C6",
-"%= c #9699C0",
-"&= c #9396BF",
-"*= c #545A98",
-"== c #707386",
-"-= c #24252C",
-";= c #A8ABCC",
-">= c #999DC3",
-",= c #9195BD",
-"'= c #7E83B3",
-")= c #5C619E",
-"!= c #8386A4",
-"~= c #9698B0",
-"{= c #A0A1B5",
-"]= c #A6A6B8",
-"^= c #AAABB9",
-"/= c #A6A7B5",
-"(= c #A2A3B1",
-"_= c #9E9FAC",
-":= c #9A9BA8",
-"<= c #9697A3",
-"[= c #92929D",
-"}= c #8E8E99",
-"|= c #8A8B94",
-"1= c #868790",
-"2= c #83848D",
-"3= c #868791",
-"4= c #8F8F9A",
-"5= c #9C9DA8",
-"6= c #ACADBA",
-"7= c #545A95",
-"8= c #4B5396",
-"9= c #6C6B6B",
-"0= c #797B88",
-"a= c #242530",
-"b= c #9195BE",
-"c= c #8A8EBA",
-"d= c #7D82B3",
-"e= c #3F478C",
-"f= c #3F468B",
-"g= c #3E4689",
-"h= c #3E4487",
-"i= c #3D4385",
-"j= c #3C4282",
-"k= c #3A417F",
-"l= c #373E7A",
-"m= c #353B74",
-"n= c #32386E",
-"o= c #31366B",
-"p= c #303568",
-"q= c #2E3263",
-"r= c #2C3160",
-"s= c #2B305D",
-"t= c #282C56",
-"u= c #272B54",
-"v= c #262952",
-"w= c #252950",
-"x= c #24284F",
-"y= c #262A53",
-"z= c #2B2F5D",
-"A= c #31356A",
-"B= c #383D75",
-"C= c #434987",
-"D= c #585F9D",
-"E= c #777985",
-"F= c #353636",
-"G= c #8C90BB",
-"H= c #8084B3",
-"I= c #777BAF",
-"J= c #555C9B",
-"K= c #3F4589",
-"L= c #3E4587",
-"M= c #3D4386",
-"N= c #3C4283",
-"O= c #3A3F7E",
-"P= c #383E7B",
-"Q= c #373D77",
-"R= c #363B75",
-"S= c #333870",
-"T= c #31376C",
-"U= c #30356A",
-"V= c #2F3467",
-"W= c #2E3364",
-"X= c #2D3162",
-"Y= c #2C305F",
-"Z= c #2B2F5C",
-"`= c #2A2D5A",
-" - c #282C58",
-".- c #272B56",
-"+- c #252951",
-"@- c #23274D",
-"#- c #23274C",
-"$- c #222649",
-"%- c #232745",
-"&- c #262941",
-"*- c #292B3E",
-"=- c #30313F",
-"-- c #373841",
-";- c #3E3E42",
-">- c #454647",
-",- c #555777",
-"'- c #6B71A8",
-")- c #7378AC",
-"!- c #4D4C4C",
-"~- c #6E6F7D",
-"{- c #23252F",
-"]- c #999DC1",
-"^- c #6B70A7",
-"/- c #6067A2",
-"(- c #495095",
-"_- c #41488D",
-":- c #40478C",
-"<- c #3F478B",
-"[- c #3C4383",
-"}- c #3B4181",
-"|- c #3A407F",
-"1- c #393F7C",
-"2- c #363C76",
-"3- c #333970",
-"4- c #2F3468",
-"5- c #2E3365",
-"6- c #2D3262",
-"7- c #2C3060",
-"8- c #2A2E5B",
-"9- c #292D58",
-"0- c #272C55",
-"a- c #262A54",
-"b- c #252952",
-"c- c #24294F",
-"d- c #232649",
-"e- c #232646",
-"f- c #252842",
-"g- c #282A3F",
-"h- c #2D2F3E",
-"i- c #32343D",
-"j- c #3A3A3F",
-"k- c #424344",
-"l- c #4C4C4C",
-"m- c #575757",
-"n- c #8B8B8B",
-"o- c #999A99",
-"p- c #9496A9",
-"q- c #7E82B3",
-"r- c #595B6D",
-"s- c #24252B",
-"t- c #373637",
-"u- c #3E4589",
-"v- c #3C4385",
-"w- c #3B417F",
-"x- c #383E7A",
-"y- c #373C77",
-"z- c #343972",
-"A- c #31366C",
-"B- c #2B305E",
-"C- c #23264B",
-"D- c #232647",
-"E- c #252743",
-"F- c #272A40",
-"G- c #2B2D3C",
-"H- c #31323D",
-"I- c #37383D",
-"J- c #404041",
-"K- c #494948",
-"L- c #5E5E5E",
-"M- c #6B6B6B",
-"N- c #A3A3A3",
-"O- c #B1B1B1",
-"P- c #C5C6D5",
-"Q- c #888CB9",
-"R- c #ABABAB",
-"S- c #3A3D5A",
-"T- c #212448",
-"U- c #212546",
-"V- c #252527",
-"W- c #6A6FA4",
-"X- c #3B4282",
-"Y- c #363B76",
-"Z- c #30366A",
-"`- c #2D3161",
-" ; c #24284D",
-".; c #222648",
-"+; c #262841",
-"@; c #2A2C3E",
-"#; c #2F303D",
-"$; c #35353C",
-"%; c #3C3D3F",
-"&; c #4F504F",
-"*; c #5A5B5B",
-"=; c #676667",
-"-; c #909090",
-";; c #BABABA",
-">; c #979AC1",
-",; c #8D90BC",
-"'; c #8A8B91",
-"); c #22253D",
-"!; c #272726",
-"~; c #7579A5",
-"{; c #3E4485",
-"]; c #3B407E",
-"^; c #373D78",
-"/; c #31376D",
-"(; c #242950",
-"_; c #252841",
-":; c #292B3F",
-"<; c #2D2E3D",
-"[; c #3A3B3F",
-"}; c #434343",
-"|; c #9FA1C6",
-"1; c #898DBA",
-"2; c #8488B7",
-"3; c #4E4D4D",
-"4; c #DDDDDD",
-"5; c #B4B4B4",
-"6; c #4C4F66",
-"7; c #24252F",
-"8; c #A8AAB9",
-"9; c #595D87",
-"0; c #353A71",
-"a; c #262940",
-"b; c #2B2D3E",
-"c; c #38383D",
-"d; c #3F4042",
-"e; c #484949",
-"f; c #868AB7",
-"g; c #7D81B2",
-"h; c #787DAF",
-"i; c #E2E2E2",
-"j; c #7E7F88",
-"k; c #222749",
-"l; c #222542",
-"m; c #262626",
-"n; c #9FA0A5",
-"o; c #6B6C7D",
-"p; c #4C4E64",
-"q; c #3C3E56",
-"r; c #36384C",
-"s; c #353643",
-"t; c #37373F",
-"u; c #3D3E40",
-"v; c #464647",
-"w; c #9E9E9F",
-"x; c #9094BC",
-"y; c #6F74A9",
-"z; c #95959A",
-"A; c #2D3151",
-"B; c #24252E",
-"C; c #B2B2B2",
-"D; c #808081",
-"E; c #828283",
-"F; c #8C8C8C",
-"G; c #6166A2",
-"H; c #5B619D",
-"I; c #919199",
-"J; c #313455",
-"K; c #232539",
-"L; c #272727",
-"M; c #686DA4",
-"N; c #4E5597",
-"O; c #4A5093",
-"P; c #E1E2E2",
-"Q; c #B5B5B6",
-"R; c #6D6F80",
-"S; c #282C4F",
-"T; c #23253D",
-"U; c #6369A0",
-"V; c #595E94",
-"W; c #9C9EB9",
-"X; c #CACBD3",
-"Y; c #D9DADB",
-"Z; c #D6D6D7",
-"`; c #C3C3C4",
-" > c #A1A2AB",
-".> c #6E7085",
-"+> c #34385B",
-"@> c #21264A",
-"#> c #272728",
-"$> c #8185A8",
-"%> c #3F4684",
-"&> c #39407E",
-"*> c #343A73",
-"=> c #3B4173",
-"-> c #444876",
-";> c #40446F",
-">> c #313561",
-",> c #242634",
-"'> c #B0B1BC",
-")> c #60648A",
-"!> c #393E74",
-"~> c #2E3264",
-"{> c #222545",
-"]> c #242639",
-"^> c #292A2D",
-"/> c #A8A9AC",
-"(> c #707183",
-"_> c #4D506A",
-":> c #3A3D5E",
-"<> c #303354",
-"[> c #2B2E4C",
-"}> c #292C46",
-"|> c #2C2E40",
-"1> c #2F303A",
-"2> c #373739",
-"3> c #B7B7B8",
-"4> c #9B9B9A",
-"5> c #757575",
-"6> c #6D6D6D",
-"7> c #6C6C6C",
-"8> c #717171",
-" . + @ # $ % & * = - ",
-" ; > , ' ) ! ~ { ] ^ / ( _ : < [ } | 1 ",
-" 2 3 4 5 6 ! ! 7 8 7 ! ! 9 0 a b c d e f g h i j k l m ",
-" n o p q r s ! ! ! ! ! ! ! 9 0 t u v w x y ^ z A B C D E F G H I J K L ",
-" M N O P Q ! ! ! ! ! ! R 9 0 t u S w b T U V W X A Y B Z e ( ` ...+.@.#.$.%.&.*.=.-. ",
-" ;.>.,.'.).! ! ! ! !.! ! 9 9 ~.u a {.b ].^./.(._.A :.<.[.}.|.1.2.3.4.5.6.7.7.8._ 9.0.a.b.c.d.e.f.g.h. ",
-" i.M >.j.).!.! 7 !.7 ! ! 9 9 ~.k.a v b ].^.^ l.m.n.o.p.q.r.C s.t.u.4.v.w.x.7.8.8.8.8.y.8.8.8.y._ z.A.B.C.D.E.F.G.H.- ",
-" I.J.K.L.M.! 7 ! ! ! ! ! ! 9 ~.k.a v w N.^.O.P.Q.R.o.S.T.r.U.V.t.W.X.Y.Z.6.`.y.y._ 8.8.8.8.8.8.8.8.8.8.8.8.8._ +E .+++@+E.#+$+=.%+ ",
-" &+> *+=+P ! ! ! ! ! ! ! 9 9 ~.k.a -+;+].>+,+c '+)+d !+~+{+]+^+/+W.X.v.5.7.`.`.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.8.y.9.(+_+:+<+[+}+|+1+ ",
-" 2+3+4+5+6+6+7+6+6+7+8+9+9+0+a+b+c+d+e+f+g+h+i+j+k+l+m+n+o+p+q+r+s+t+u+v+w+w+x+y+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+x+z+A+B+C+D+E+F+G+H+I+J+K+ ",
-" L+M+ N+O+P+G+Q+R+S+T+ ",
-" U+V+W+X+ - Y+Z+G+`+ @.@+@ ",
-" @@#@$@%@&@ *@=@-@;@>@,@'@)@ ",
-" !@~@{@]@^@ /@J+(@_@:@<@=@ ",
-" [@}@|@1@%@ 2@3@4@5@6@7@8@ ",
-" 9@0@a@%@b@ K+c@d@e@f@g@h@i@ ",
-" j@k@l@m@n@ *@=@o@e@p@q@r@s@ ",
-" t@u@v@W+w@ x@l e@y@z@A@B@ ",
-"C@D@E@$@F@G@ H@I@(@e@J@K@I@ ",
-"L@0@M@N@O@P@ Q@R@S+e@,@g@o@K+ ",
-"S@T@U@V@w@W@ T+X@4@Y@Z@`@ #1 ",
-".#+#@###$#%# &#*#=#e@-#;#>#,# ",
-"'#)#!#~#{#]# - ^#h@e@/#6@(#h. ",
-"_#:#<#[#}#|# 1#2#o@e@3#4#5#6# ",
-"7#8#9#0#a#b# x@l e@c#d#f@e# ",
-" {@f#g#h#i# j#k#(@l#m#n#o# ",
-" :#p#q#r#s# t#3@4@u#v#w#x#y# ",
-" z#A#B#C#D# 1 E#F#G#H#I#J#T+ ",
-" K#L#M#N#]# O#e#d@P#Q#q@R#S# ",
-" T#U#V#W#X# *@=@Y#P#Z#z@`#x@ ",
-" _# $.$+$@$ #$$$%$&$*$=$-$ ",
-" ;$>$,$'$ H@I@)$!$~${$X@ ",
-" {@]$^$/$ ($8.8._$ :$8.8.<$ [$y.8.8.8.y.}$C |$1$2$3$ 2@4$5$6$7$8$9$O# ",
-" 0$@#%@a$ b$8.8.c$ 6.8.8.1. d$8.8.8.8.8.8.8.X. e$f$g$ i@h$i$6$j$k$S+T+ ",
-" l$A#m$n$ y.8.8.y. o$y.8.8.`. d$8.y.p$y.<$7.8.8.q$ 2$f$r$ K+1+s$6$t$ @u$+@ ",
-" v$w$x$^$ y.8.8.8.y$ }$8.8.8.y. d$8.8.($ z$8.8.A$ f$f$ B$C$D$6$E$,@F$/@ ",
-" v$U#]@G$ H$y.8.8.8.y. 8.8.8.8.8. d$8.y.($ I$8.8.B J$f$K$ L$M$N$O$P$Q$ O$R$|$ |$|$S$ T$U$V$R$|$ L$W$X$ Y$Z$`$ | %.%+%@%#%C$ ",
-" $% $$@%% U.y.8.&%y.8.*%^+8.8.=%8.8.-% d$8.8./+}.r.6.8.8.=% ;%f$>% ,%f$f. >%f$>% Z$f$'% f$K$)% !%2$ ~%f${% ]%f$f$^%J$f$K$ /%(%_%:%<%7@8@ ",
-" [%!#>$ V.8.y. }%8.|%1%8./+ 8.8.:$ d$8.8.8.8.8.8.y.2% g$f$3% f$f$ 4%f$e$ J$f$K$ f$f$ 1$K$U$ 5%f$6% 7%f$f$ 1$f$~% Q@8%9%0%a%b%c%- ",
-" d%e%e% f%8.w. |.8.8.8.y.g% y.8.h% d$8.8.y.y.y.Y.i% f$f$|$ R$f$1$ f$f$J$ )%f$j% U$f$f$ f$f$ )%'%k% l%f$m% j% n%o%p%6$q%r%s%i@ ",
-" t%u%v% y.8.w% y.8.8.Y. y.8.p$ d$8.y.]+ K$f$ x%f$O$ f$f$ j%f$O$ 4%f$!% U$f$f$y%z%A% B%f$C% D%E%F%6$G%H%I%+@ ",
-" J%K%L% 8.y.1. M%8.y.N% ..8.7. d$8.y.O% N$f$P% f$f$1$ J$f$5% f$f$l% Q%f$l% M$f$f$ f$f$R% S%T%U%6$V%,@'@)@ ",
-" v$W%X% e y.8.|. N%_ 7. Y%8.y. d$8.y.($ )%f$O$ ~%f$!% >%f$~% f$f$U$ J$f$f$U$ f$f$A% W$ f$f$ Z%`% &6$.&+&<@=@ ",
-" @& $9# s._ y.q. 5.1. #&y.y. $&y.%&#& &&f$K$W$*& M$f$f$2$U$7%=&f$1$-& 5%f$f$e$;&f$K$ >&P%f$!%!%1$ ;%f$5% ,&'&_%)&!&G.E# ",
-" ~&{& z%f$R$ ]&^&9%/&(&K@I@_& ",
-" :& $ <&2$ 5%3$ [&}&|&0%1&2& #1 ",
-" 3&{@ 5%f$4& e$5%5& 6&7&F%0%8&$+9&0& ",
-" a&b& J$5%g$z% c&d&U%6$e&J@r@f& ",
-" @&g& h&i&j&6$k&l&m&n& ",
-" o&p& q&r&s&_%t&d#u&v& ",
-" w&x& y&z&A&_%0%B&C&D& ",
-" E& F&G&H&I&0%J&K&L&y#",
-" M& N&O&P&Q&R&S&;#T&t#",
-" U& V&W&P&Q&!$X&q@(#h.",
-" Y& Z&`&3.y.y.y.y.` }. *.*+*I&0%@*,@'@/%",
-" #*5.y.8.8.8.8.8.8.8.8.8.$*%* &***'&_%0%=*,@-*/%",
-" 2%y.8.8.;*>*,*'*)*o$V.7.8.8.y.!* ~*{*]*6$6$^*/*(#S#",
-" 5.y.8.u.(* _*5.y.y.b$ :*<*|&6$[*}*|*(@n%",
-" 6.8.y.1* V.y.y.v. *@2*3*6$6$4*5*6*7* ",
-" 8*8.8.9* 0*8._ a* _&b*c*d*6$e*f*g*h*i* ",
-" V.y.8.j* x%K$;% V.9.0.k*y#L l*m*6$n*o*p*7@k#K+ ",
-" y.8.1. x%f$f$3$q* r*s*t*u*v*w*R&/&x*y*b%e@j# ",
-" 1.y.z* x%f$f$f$f$~%A% A*B*C*D*E*F*G*H*I*K@J*#$ ",
-" K* L*y.Y% x%f$f$f$f$f$f$>%q* M*N*O*P*Q*R*S*T*U*=#/@ ",
-" V*W* X*Y*Z*`* 9._ -% x%f$f$f$f$f$f$f$f$!% =.=D.[++=I*@=u$8@2@ ",
-" #=$=%=&= Z%*@_&y#,#+@j#j#2@K+`**=`.$* x%f$f$f$f$f$f$f$f$f$f$g$ 1 ==F+G+-=$+p@n&1# ",
-" ;=>=,='=(.)=%* !=~={=]=^=/=(=_=:=<=[=}=|=1=2=3=4=5=6=7=8=,* x%f$f$f$f$f$f$f$f$f$f$f$x%9=0&0=E.G+a=I#g.t# ",
-" b=c=d=W s.5.y.y.8.8.8.8.8.y.y.y.y.y.%&%&%&%& + ++.e=f=g=h=i=j=k=h l=B.m=i n=o=p=H q=r=s=I E+t=u=v=w=x=y=z=A=B=C=D=A x%f$f$f$f$f$f$f$f$f$f$!% S#E=E.G+a=F=T&t# ",
-" G=H=I=c J=b$6._ 8.8.8.8.8.8._ 9.9.9.z.f=K=L=M=N=a.O=P=Q=R=D+S=T=U=V=W=X=Y=Z=`= -.-y=+-x=@-#-P+$-%-&-*-=---;->-,-'-)- x%f$f$f$f$f$f$f$f$2$!- /%~-G+G+{-$+J*t# ",
-" ]-t ^-/-e (-6._ +9._-:-<-0.g @.[-}-|-1-B*2-G 3-_+o=4-5-6-7-z=8-9-0-a-b-c-D.@-P+d-e-f-g-h-i-j-k-l-m-`#p@>#n-o-p-q-5 x%f$f$f$f$f$f$f$,% Z*-.r-G+G+s-t-y@t# ",
-" H=!+U.X._ E u-@.v-j=w-h x-y-m=z-n=A-$.H q=C.B-c.E+O*:+y=w=x=@-C-F+D-E-F-G-H-I-J-K-f@L-M-9&=#J+N-O-i*h.0&&# =P-Q-c=,= x%f$f$f$f$f$L$ *@R-S-T-U-V-2&d@1 ",
-" W-;*:-@.X-.+#.Y-z-n=Z-V=W=`-Y=Z=%.O*:+y=+-D. ;#-P+.;e.+;@;#;$;%;C&&;*;=;.@S+-;3@e#;;H@2@1 _& >;G=,; x%f$f$f$2$6% 0&';F+[+);!;@=R@ ",
-" ~;{;];^;D+/;++X=z=%.t=a-+-(;d.#-P+$-e-_;:;<;i-[;};l-=$`#p@y@n-D&v&2#)@+@,#K+ |;1;2; x%f$t-3; 4;5;6;G+G+7;I*m&5; ",
-" 8;9;0;$.6-8-:+w=@-P+D-E-a;b;H-c;d;e;f@L-M-9&=#J+N-O-x@h.0&&# f;g;h; x%l% i;H@j;k;G+l;m;I#T&+@ ",
-" t#n;o;p;q;r;s;t;u;v;G.<@'@.@S+-;w;e#;;f&Q@i@_& x;k.y y; i;+@z;A;G+G+B;l&f@8@ ",
-" Q@C;D&h@D;E;F;D&B@2#/%S#,#K+ r G;q$H; 1#H@I;J;G+G+K;L;g@g.S# ",
-" &#,#,#y# M;N;4.O; P;*@0&Q;R;S;G+G+T;L;;#r@=@ ",
-" U;z.u-i=V;W;X;Y;Z;,#`; >.>+>@>G+G+>@#>$+`#B@O# ",
-" $>%>&>x-2-*>=>->;>>>:+@-E.G+U-,>:@2&'@*#&# ",
-" '>)>!>_+p=~>B-O*w=P+G+{>]>^>$+G.T&C$O# ",
-" n%/>(>_>:><>[>}>|>1>2>b%|+.@o#j# ",
-" 0&3>4>s%5>6>7>8>y@l 1+h.- ",
-" B$n%+@S#h.S#,#K+ "};
diff --git a/gui/mplayer/pixmaps/mplayer-desktop.xpm b/gui/mplayer/pixmaps/mplayer-desktop.xpm
deleted file mode 100644
index fef1876b4c..0000000000
--- a/gui/mplayer/pixmaps/mplayer-desktop.xpm
+++ /dev/null
@@ -1,149 +0,0 @@
-/* XPM */
-static const char * const mplayer_desktop_xpm[] = {
-"47 39 107 2",
-" c None",
-". c #6D619F",
-"+ c #6F64A0",
-"@ c #7C72A8",
-"# c #3D2D7F",
-"$ c #39297C",
-"% c #3A2A7D",
-"& c #948BB8",
-"* c #413282",
-"= c #38277B",
-"- c #4E408A",
-"; c #36267A",
-"> c #594C91",
-", c #342479",
-"' c #D7F1FB",
-") c #12B0E8",
-"! c #FEFEFE",
-"~ c #FFFFFF",
-"{ c #54468E",
-"] c #A5E1F6",
-"^ c #0AADE7",
-"/ c #48C2ED",
-"( c #B0E5F7",
-"_ c #9DDEF5",
-": c #FAFDFE",
-"< c #45C1ED",
-"[ c #03ABE7",
-"} c #09ADE7",
-"| c #0BAEE7",
-"1 c #17B1E9",
-"2 c #F7F7FA",
-"3 c #CECADF",
-"4 c #000000",
-"5 c #95DBF4",
-"6 c #6C619E",
-"7 c #F8F8F8",
-"8 c #5C4F93",
-"9 c #37277B",
-"0 c #332378",
-"a c #1A1A1A",
-"b c #020202",
-"c c #2E2E2E",
-"d c #E0E0E0",
-"e c #C9C9C9",
-"f c #F7F7F7",
-"g c #202020",
-"h c #38287B",
-"i c #352479",
-"j c #929292",
-"k c #4E4E4E",
-"l c #FAFAFA",
-"m c #EDEDED",
-"n c #9C9C9C",
-"o c #6ECEF1",
-"p c #E1E0EC",
-"q c #55488F",
-"r c #E3E3E3",
-"s c #515151",
-"t c #666666",
-"u c #5E5E5E",
-"v c #676767",
-"w c #0DAEE8",
-"x c #2C1B73",
-"y c #35257A",
-"z c #C1BCD6",
-"A c #322177",
-"B c #F7F6FA",
-"C c #CFCFCF",
-"D c #555555",
-"E c #05ACE7",
-"F c #DEDEDE",
-"G c #33BBEB",
-"H c #9FDFF6",
-"I c #645799",
-"J c #3C2D7E",
-"K c #5A4D92",
-"L c #13B0E8",
-"M c #332278",
-"N c #BAE8F8",
-"O c #4C3D88",
-"P c #D4D1E3",
-"Q c #3E2E7F",
-"R c #888888",
-"S c #9389B7",
-"T c #35BCEB",
-"U c #978EBA",
-"V c #E1E1E1",
-"W c #2E1D75",
-"X c #3ABDEC",
-"Y c #403080",
-"Z c #FCFCFC",
-"` c #DEDCEA",
-" . c #3E2F80",
-".. c #D8D5E4",
-"+. c #EBEAF2",
-"@. c #F8F8FA",
-"#. c #2F1E75",
-"$. c #695D9C",
-"%. c #FAF9FB",
-"&. c #EFEFEF",
-"*. c #453684",
-"=. c #36257A",
-"-. c #575757",
-";. c #2F1F76",
-">. c #584B91",
-",. c #F9F8FB",
-"'. c #3B2B7E",
-" . + ",
-" @ # $ $ $ $ $ $ $ $ % ",
-" & * = $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ ",
-" @ - ; $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ ",
-" @ > , $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ ",
-" ' ) ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ~ { $ ",
-" ] ^ / ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ~ ",
-"( ^ ^ ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ~ ",
-"^ ^ _ ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ",
-"^ ^ : ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ",
-"^ ^ ~ ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ",
-"^ ^ ~ ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ",
-"^ ^ ~ ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ",
-"^ ^ ~ ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! < ",
-"^ ^ ~ ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! [ ",
-"} ^ ~ ! ! ! ~ ~ ! ! ~ ~ ! ~ ~ ~ ~ ! ! ~ ~ ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! | ",
-"1 ^ ~ ! ! ! $ $ ~ ! $ $ ! 2 $ $ $ 3 ! ~ 4 ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ^ ",
-"5 ^ ~ ! ! ! $ $ 6 ~ $ $ ! 2 $ 3 ! $ ! 7 4 ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ^ ",
-" ^ ~ ! ! ! $ 8 $ 9 0 $ ~ 2 $ 3 ! $ ! a 4 ! b c d 4 ! e 4 ! 4 4 ! 4 4 4 f g g 4 4 ! ! ! ^ ",
-" ^ ~ ! ! ~ $ ~ $ $ ~ $ 3 2 $ h i 3 ! 4 j ~ 4 ! k 4 ! d 4 ! 4 l m 4 ~ 4 ! ~ 4 ! n ! ! ! ^ o ",
-" ^ ~ ! ! p $ ! = $ ! $ q 2 $ 3 ! ! ! 4 ~ r 4 ! 4 s ! d b ! 4 ~ t 4 u ! ! v 4 ! ! ! ! ! ^ w ",
-" ^ ~ ! ! x y ! ~ z ! y A B y 3 ! ! ! 4 ! ! 4 4 C 4 ~ D D 4 4 ! ! 4 4 u ! 4 g ! ! ! ! ! ^ ^ ",
-" E ~ ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! 4 ~ 4 F ! ! ! ! ! ! ! ! ! ! ! ! ! ^ ^ ",
-" G ~ ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ~ 4 ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ^ ^ ",
-" ' ~ ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ^ ^ ",
-" ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ^ ^ H ",
-" ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ~ I J K ~ ! ! ! ! ! ^ ^ L ",
-" ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ~ % $ % M % $ $ ~ ! ! ! ^ ^ N ",
-" ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ~ $ A ! ! ! ! ! O $ P ! ! ^ ^ ",
-" ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! $ Q ! a R ! ! ! ! S $ ~ ~ ^ T ",
-" ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! U $ ! ! a 4 4 V ! ! ! $ W [ X ",
-" , ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! $ Y ! ! a 4 4 4 4 Z ! ` $ ",
-" $ $ ...+.+.+.+.+.+.+.~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ $ @.! ! a 4 4 4 4 4 4 ~ $ ",
-" #.$ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ ; $. $ %.! ! a 4 4 4 4 &.! ~ $ ",
-" $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ = *.@ $ =.! ! a 4 4 -.! ! ! U $ ",
-" $ $ $ $ $ $ $ $ ;.@ $ ! ! a 4 ! ! ! ! ! % >. ",
-" $ % ! ~ ! ! ! ! ! $ $ ",
-" % $ ,.! ! ! ~ $ $ ",
-" '.$ $ $ $ $ 9 "};
diff --git a/gui/mplayer/pixmaps/next.xpm b/gui/mplayer/pixmaps/next.xpm
deleted file mode 100644
index 33ec588b9f..0000000000
--- a/gui/mplayer/pixmaps/next.xpm
+++ /dev/null
@@ -1,79 +0,0 @@
-/* XPM */
-static const char * const next_xpm[] = {
-"16 16 60 1",
-" c None",
-". c #000000",
-"+ c #FFFFFF",
-"@ c #737372",
-"# c #888887",
-"$ c #727170",
-"% c #7E7E7D",
-"& c #A4A4A3",
-"* c #7B7B7A",
-"= c #6C6B6A",
-"- c #8E8E8D",
-"; c #B5B4B3",
-"> c #7F7E7D",
-", c #999996",
-"' c #7D7C7B",
-") c #949392",
-"! c #C0BFBE",
-"~ c #828180",
-"{ c #9D9C9A",
-"] c #B0AFAC",
-"^ c #908F8D",
-"/ c #A4A3A2",
-"( c #CACAC8",
-"_ c #868583",
-": c #A1A09E",
-"< c #B4B3B1",
-"[ c #B6B4B2",
-"} c #A5A4A1",
-"| c #A1A09F",
-"1 c #D0CECD",
-"2 c #898886",
-"3 c #B9B7B4",
-"4 c #BAB9B6",
-"5 c #BCBAB7",
-"6 c #C3C2BF",
-"7 c #C2C2C2",
-"8 c #8C8B89",
-"9 c #A9A8A5",
-"0 c #BDBCB9",
-"a c #C5C3C0",
-"b c #D0CECC",
-"c c #8F8E8C",
-"d c #B5B3B1",
-"e c #C7C6C3",
-"f c #D2D1CE",
-"g c #AFAEAB",
-"h c #D2D1CF",
-"i c #B9B6B4",
-"j c #D8D7D5",
-"k c #B8B8B5",
-"l c #D4D3D2",
-"m c #A19F9D",
-"n c #C7C6C4",
-"o c #BBBAB7",
-"p c #D7D5D3",
-"q c #A7A6A3",
-"r c #BBB9B7",
-"s c #D9D8D6",
-"t c #B9B8B5",
-"u c #DEDDDB",
-" . ....+ ",
-" .. .@#.+ ",
-" .$. .%&.+ ",
-" .*=. .-;.+ ",
-" .>,'. .)!.+ ",
-" .~{]^. ./(.+ ",
-" ._:<[}. .|1.+ ",
-" .2}3456.7./(.+ ",
-" .890ab.+ .|1.+ ",
-" .cdef.+ .gh.+ ",
-" .{ij.+ .kl.+ ",
-" .mn.+ .op.+ ",
-" .q.+ .rs.+ ",
-" ..+ .tu.+ ",
-" .+ ....+ ",
-" + ++++ "};
diff --git a/gui/mplayer/pixmaps/normal.xpm b/gui/mplayer/pixmaps/normal.xpm
deleted file mode 100644
index 8fb6485bf8..0000000000
--- a/gui/mplayer/pixmaps/normal.xpm
+++ /dev/null
@@ -1,130 +0,0 @@
-/* XPM */
-static const char * const normal_xpm[] = {
-"16 16 111 2",
-" c None",
-". c #000000",
-"+ c #030304",
-"@ c #020303",
-"# c #030303",
-"$ c #030404",
-"% c #040404",
-"& c #A1B0BD",
-"* c #8898A5",
-"= c #909FAB",
-"- c #97A4B0",
-"; c #9EAAB4",
-"> c #A4AFB9",
-", c #ABB4BD",
-"' c #B2BAC2",
-") c #B8BFC6",
-"! c #BFC5CA",
-"~ c #C8CDD3",
-"{ c #A4A6A7",
-"] c #020203",
-"^ c #BFCDD7",
-"/ c #A2B5C8",
-"( c #A9B9CC",
-"_ c #AFBFCF",
-": c #B4C3D2",
-"< c #BAC8D5",
-"[ c #C0CCD8",
-"} c #C5D1DB",
-"| c #CCD6DD",
-"1 c #D2DAE1",
-"2 c #D9E0E6",
-"3 c #C8CDD2",
-"4 c #B8C6D2",
-"5 c #9BAEC3",
-"6 c #A2B4C7",
-"7 c #ADBCCD",
-"8 c #B3C2D0",
-"9 c #B9C7D3",
-"0 c #BFCAD6",
-"a c #C5CFD9",
-"b c #CBD4DC",
-"c c #BEC4CB",
-"d c #B3C2CE",
-"e c #96AAC0",
-"f c #A9B9CA",
-"g c #AEBECD",
-"h c #BAC7D3",
-"i c #C0CCD7",
-"j c #CED7DF",
-"k c #B8C0C6",
-"l c #B0BECC",
-"m c #91A7BE",
-"n c #98ACC2",
-"o c #A4B5C8",
-"p c #AABACA",
-"q c #B0BECE",
-"r c #B6C3D1",
-"s c #BBC8D4",
-"t c #C1CDD7",
-"u c #C9D3DC",
-"v c #B3C3D3",
-"w c #8CA3BB",
-"x c #94A8BF",
-"y c #9FB2C6",
-"z c #A5B6C8",
-"A c #ABBBCB",
-"B c #B1BFCE",
-"C c #B6C4D1",
-"D c #BCC9D5",
-"E c #C5CFDA",
-"F c #ACB6BE",
-"G c #BDCBDD",
-"H c #879EB8",
-"I c #8FA5BC",
-"J c #A1B3C6",
-"K c #ACBCCC",
-"L c #B2C0CF",
-"M c #B8C5D2",
-"N c #A6B0BA",
-"O c #BCCBDC",
-"P c #819AB5",
-"Q c #8BA2BA",
-"R c #9BAFC3",
-"S c #A8B8CA",
-"T c #ADBDCD",
-"U c #A0ABB6",
-"V c #B4C4D6",
-"W c #7993B0",
-"X c #839BB6",
-"Y c #89A0B8",
-"Z c #8EA5BB",
-"` c #95AAC0",
-" . c #9CAFC4",
-".. c #A2B3C7",
-"+. c #A7B8CA",
-"@. c #ADBDCC",
-"#. c #B5C4D2",
-"$. c #98A5B0",
-"%. c #E6EFF8",
-"&. c #B3C4D7",
-"*. c #B9C9DB",
-"=. c #BDCCDC",
-"-. c #BECDDE",
-";. c #B4C4D4",
-">. c #B0BFCC",
-",. c #B3C2CF",
-"'. c #B9C6D2",
-"). c #BDC9D5",
-"!. c #CBD6E0",
-"~. c #B6BFC8",
-"{. c #050505",
-" ",
-" ",
-" . + @ # # # # + + $ % % # # . ",
-" # & * = - ; > , ' ) ! ~ ~ { ] ",
-" + ^ / ( _ : < [ } | 1 2 2 3 # ",
-" # 4 5 6 + 7 8 9 0 a b + 1 c # ",
-" # d e + + f g + h i + + j k # ",
-" # l m n + o p q r s t + u ' # ",
-" # v w x + y z A B C D + E F # ",
-" + G H I + 5 J + K L M + [ N # ",
-" + O P Q + e R 6 S T 8 + s U @ ",
-" + V W X Y Z ` ...+.@.#.#.$.@ ",
-" % %.&.*.=.-.;.>.,.'.).!.!.~.# ",
-" . {.% % % % % $ $ % % % % % . ",
-" ",
-" "};
diff --git a/gui/mplayer/pixmaps/ok.xpm b/gui/mplayer/pixmaps/ok.xpm
deleted file mode 100644
index 5d8f3030dd..0000000000
--- a/gui/mplayer/pixmaps/ok.xpm
+++ /dev/null
@@ -1,24 +0,0 @@
-/* XPM */
-static const char * const ok_xpm[] = {
-"37 16 5 1",
-" c None",
-". c #3539EC",
-"+ c #6E71EA",
-"@ c #000000",
-"# c #1C1E7C",
-" ",
-" ",
-" ",
-" ... ",
-" .++. @@@@@ @@ ",
-" .........++. @@@ @@@ @@ ",
-" .+++++++...+. @@ @@@ @@ @@ ",
-" ............+. @@ @@ @@ @@ ",
-" ............... @@ @@ @@@@ ",
-" .............# @@ @@@ @@@@@ ",
-" ............# @@@ @@@ @@ @@ ",
-" #######....# @@@@@ @@ @@ ",
-" ...# ",
-" ### ",
-" ",
-" "};
diff --git a/gui/mplayer/pixmaps/open.xpm b/gui/mplayer/pixmaps/open.xpm
deleted file mode 100644
index a88064cdf0..0000000000
--- a/gui/mplayer/pixmaps/open.xpm
+++ /dev/null
@@ -1,83 +0,0 @@
-/* XPM */
-static const char * const open_xpm[] = {
-"16 16 64 1",
-" c None",
-". c #000000",
-"+ c #E4E5DF",
-"@ c #D5D6CB",
-"# c #D6D7CA",
-"$ c #A3A39D",
-"% c #F5F6F0",
-"& c #8D907B",
-"* c #92957E",
-"= c #90937D",
-"- c #979B84",
-"; c #6D705F",
-"> c #EAECDB",
-", c #8A8C7D",
-"' c #8E917B",
-") c #91947F",
-"! c #8B8E7A",
-"~ c #999B87",
-"{ c #919480",
-"] c #989B86",
-"^ c #B1B4A2",
-"/ c #A2A394",
-"( c #F7F7F7",
-"_ c #878A75",
-": c #666858",
-"< c #4B4D3F",
-"[ c #4D4F40",
-"} c #404135",
-"| c #424337",
-"1 c #434437",
-"2 c #404236",
-"3 c #3C3D32",
-"4 c #48493C",
-"5 c #1A1A16",
-"6 c #C6C6BE",
-"7 c #848672",
-"8 c #25261F",
-"9 c #F1F2E9",
-"0 c #DDE0C7",
-"a c #D6DABB",
-"b c #CDD2AC",
-"c c #C7CCA7",
-"d c #989C80",
-"e c #C6C7BE",
-"f c #5F6152",
-"g c #888980",
-"h c #A7AB8C",
-"i c #878A70",
-"j c #9FA19A",
-"k c #EFF0E5",
-"l c #9EA284",
-"m c #80817B",
-"n c #96968D",
-"o c #E3E5D1",
-"p c #83866D",
-"q c #97998D",
-"r c #EDEFE2",
-"s c #A2A688",
-"t c #767671",
-"u c #E7E9DA",
-"v c #D1D3BD",
-"w c #BBBF9D",
-"x c #989B80",
-"y c #6E715C",
-" ",
-" ",
-" .... ",
-" .+@#$. ",
-" .%&*=-;..... ",
-" .>,')!~{]{^/. ",
-" .(_:<[}||12345 ",
-" .67890abbbbbcd.",
-" .efg0bbbbbbbhi.",
-" .j8kabbbbbbbl. ",
-" .mnobbbbbbbbp. ",
-" .qrbbbbbbbbs. ",
-" .tuvwwwwwwxy. ",
-" ........... ",
-" ",
-" "};
diff --git a/gui/mplayer/pixmaps/pause.xpm b/gui/mplayer/pixmaps/pause.xpm
deleted file mode 100644
index b790fcfdce..0000000000
--- a/gui/mplayer/pixmaps/pause.xpm
+++ /dev/null
@@ -1,48 +0,0 @@
-/* XPM */
-static const char * const pause_xpm[] = {
-"16 16 29 1",
-" c None",
-". c #000000",
-"+ c #FFFFFF",
-"@ c #737372",
-"# c #848483",
-"$ c #888887",
-"% c #7E7E7D",
-"& c #A8A7A6",
-"* c #A4A4A3",
-"= c #A6A5A4",
-"- c #B5B4B3",
-"; c #858483",
-"> c #AAA9A7",
-", c #C0BFBE",
-"' c #91908E",
-") c #AFAEAC",
-"! c #CACAC8",
-"~ c #A6A5A2",
-"{ c #BBBAB7",
-"] c #D4D3D2",
-"^ c #AEADA9",
-"/ c #BFBDBA",
-"( c #D7D5D3",
-"_ c #B2B0AD",
-": c #C3C1BE",
-"< c #D9D8D6",
-"[ c #B5B3B0",
-"} c #D1CFCC",
-"| c #DEDDDB",
-" ",
-" .....+.....+ ",
-" .@#$.+.@#$.+ ",
-" .%&*.+.%&*.+ ",
-" .%=-.+.%=-.+ ",
-" .;>,.+.;>,.+ ",
-" .')!.+.')!.+ ",
-" .')!.+.')!.+ ",
-" .')!.+.')!.+ ",
-" .~{].+.~{].+ ",
-" .~{].+.~{].+ ",
-" .^/(.+.^/(.+ ",
-" ._:<.+._:<.+ ",
-" .[}|.+.[}|.+ ",
-" .....+.....+ ",
-" +++++ +++++ "};
diff --git a/gui/mplayer/pixmaps/pl.xpm b/gui/mplayer/pixmaps/pl.xpm
deleted file mode 100644
index fe301c1c83..0000000000
--- a/gui/mplayer/pixmaps/pl.xpm
+++ /dev/null
@@ -1,26 +0,0 @@
-/* XPM */
-static const char * const pl_xpm[] = {
-"16 16 7 1",
-" c None",
-". c #000000",
-"+ c #FEFEFE",
-"@ c #C1C1C1",
-"# c #C2C2C2",
-"$ c #A0A0A0",
-"% c #BBBBBB",
-" .. ",
-" .+@. .. ... .. ",
-" .#$. ",
-" .. ",
-" ",
-" ",
-" .. ",
-" .+@. ",
-" .#$. ..... ... ",
-" .. ",
-" ",
-" ",
-" .. ",
-" .+%. ..... ... ",
-" .#$. ",
-" .. "};
diff --git a/gui/mplayer/pixmaps/play.xpm b/gui/mplayer/pixmaps/play.xpm
deleted file mode 100644
index 34f8cac52a..0000000000
--- a/gui/mplayer/pixmaps/play.xpm
+++ /dev/null
@@ -1,56 +0,0 @@
-/* XPM */
-static const char * const play_xpm[] = {
-"16 16 37 1",
-" c None",
-". c #000000",
-"+ c #727170",
-"@ c #7B7B7A",
-"# c #6C6B6A",
-"$ c #7F7E7D",
-"% c #999996",
-"& c #7D7C7B",
-"* c #828180",
-"= c #9D9C9A",
-"- c #B0AFAC",
-"; c #908F8D",
-"> c #868583",
-", c #A1A09E",
-"' c #B4B3B1",
-") c #B6B4B2",
-"! c #A5A4A1",
-"~ c #898886",
-"{ c #B9B7B4",
-"] c #BAB9B6",
-"^ c #BCBAB7",
-"/ c #C3C2BF",
-"( c #FFFFFF",
-"_ c #8C8B89",
-": c #A9A8A5",
-"< c #BDBCB9",
-"[ c #C5C3C0",
-"} c #D0CECC",
-"| c #8F8E8C",
-"1 c #B5B3B1",
-"2 c #C7C6C3",
-"3 c #D2D1CE",
-"4 c #B9B6B4",
-"5 c #D8D7D5",
-"6 c #A19F9D",
-"7 c #C7C6C4",
-"8 c #A7A6A3",
-" . ",
-" .. ",
-" .+. ",
-" .@#. ",
-" .$%&. ",
-" .*=-;. ",
-" .>,')!. ",
-" .~!{]^/.( ",
-" ._:<[}.( ",
-" .|123.( ",
-" .=45.( ",
-" .67.( ",
-" .8.( ",
-" ..( ",
-" .( ",
-" ( "};
diff --git a/gui/mplayer/pixmaps/playdvd.xpm b/gui/mplayer/pixmaps/playdvd.xpm
deleted file mode 100644
index a453ff3890..0000000000
--- a/gui/mplayer/pixmaps/playdvd.xpm
+++ /dev/null
@@ -1,137 +0,0 @@
-/* XPM */
-static const char * const playdvd_xpm[] = {
-"16 16 118 2",
-" c None",
-". c #CACCD2",
-"+ c #D3D4D6",
-"@ c #D2D2D3",
-"# c #D1D1D2",
-"$ c #D1D1D3",
-"% c #B5B8BD",
-"& c #EDEDEC",
-"* c #FAFAFA",
-"= c #FBFBFB",
-"- c #FCFCFC",
-"; c #FFFFFF",
-"> c #D9D9D9",
-", c #AFB1B5",
-"' c #C6C6C7",
-") c #FDFDFD",
-"! c #F7F7F7",
-"~ c #F9F9F9",
-"{ c #F6F6F6",
-"] c #F8F8F8",
-"^ c #B8B9BD",
-"/ c #B2B4BA",
-"( c #EAE9E9",
-"_ c #DCDCDC",
-": c #F3F3F3",
-"< c #F4F4F4",
-"[ c #A8AAAF",
-"} c #CBCBCA",
-"| c #CCCCCC",
-"1 c #D7D7D7",
-"2 c #E1E1E1",
-"3 c #F5F5F5",
-"4 c #EFEFEF",
-"5 c #CCCDCE",
-"6 c #D2D2D2",
-"7 c #CDCDCD",
-"8 c #D6D6D6",
-"9 c #E0E0E0",
-"0 c #E7E7E7",
-"a c #E6E6E6",
-"b c #E5E5E5",
-"c c #EBEBEB",
-"d c #E3E3E3",
-"e c #ECECEC",
-"f c #9C9DA5",
-"g c #C4C5C9",
-"h c #C1C1C1",
-"i c #CECECE",
-"j c #E2E2E2",
-"k c #E8E8E8",
-"l c #D8D8D8",
-"m c #E4E4E3",
-"n c #DBDBDB",
-"o c #F2F2F2",
-"p c #404040",
-"q c #DDDDDD",
-"r c #D4D4D4",
-"s c #A2A4AA",
-"t c #C9CACC",
-"u c #C4C4C4",
-"v c #CFCFCF",
-"w c #E4E4E4",
-"x c #DBDAD9",
-"y c #727789",
-"z c #DFDEDD",
-"A c #292828",
-"B c #373737",
-"C c #BCBCBC",
-"D c #BFBFBF",
-"E c #9E9FA4",
-"F c #C6C7C9",
-"G c #E2E2E1",
-"H c #999CA6",
-"I c #C5C5C4",
-"J c #D3D3D3",
-"K c #313131",
-"L c #747472",
-"M c #5C5C5C",
-"N c #C4C4C3",
-"O c #95969A",
-"P c #C4C5C6",
-"Q c #D8D8D7",
-"R c #CACACA",
-"S c #C6C6C6",
-"T c #343333",
-"U c #A1A09E",
-"V c #939290",
-"W c #939395",
-"X c #A0A2A7",
-"Y c #E5E5E4",
-"Z c #FEFEFE",
-"` c #C5C5C5",
-" . c #363635",
-".. c #A7A6A3",
-"+. c #B8B7B4",
-"@. c #91908E",
-"#. c #9B9C9F",
-"$. c #F0F0F0",
-"%. c #383737",
-"&. c #B0AFAC",
-"*. c #C8C7C4",
-"=. c #5A5A59",
-"-. c #EAEAEA",
-";. c #3E3D3D",
-">. c #BEBCB9",
-",. c #151414",
-"'. c #989BA2",
-"). c #E9E9E9",
-"!. c #41403F",
-"~. c #696867",
-"{. c #A6A8AD",
-"]. c #B7B7B5",
-"^. c #B4B4B3",
-"/. c #0A0A0A",
-"(. c #9B9DA0",
-"_. c #B6B6B7",
-":. c #B0B0B1",
-"<. c #929396",
-" . + @ # $ ",
-" % & * = = = - ; > , ",
-" ' ) ! ~ ~ ~ { ] * = ) ^ ",
-" / ( _ : ! ] ! < ! ] ) ) = [ ",
-" } | 1 2 { ] ! : 3 - - 3 4 5 ",
-" 6 7 8 9 0 ] a b ) = : c d e f ",
-"g h i 1 j k 6 l m n o p q r 2 s ",
-"t u v n w _ x y z q A B C D E ",
-"F 8 l 2 k d G H ^ I J K L M N O ",
-"P w j k e = _ Q 6 R S T U V M W ",
-"X Y k c ; Z 3 > ! 6 ` ...+.@.M ",
-" #.$.; : : > : : : ` %.&.*.=. ",
-" 1 = : > : : : : -.;.>.,. ",
-" '.S a > : : $.w ).!.~.Z ",
-" {.].R j k q ^./.; ",
-" (._.:.<. D "};
diff --git a/gui/mplayer/pixmaps/playvcd.xpm b/gui/mplayer/pixmaps/playvcd.xpm
deleted file mode 100644
index db08f490fc..0000000000
--- a/gui/mplayer/pixmaps/playvcd.xpm
+++ /dev/null
@@ -1,201 +0,0 @@
-/* XPM */
-static const char * const playvcd_xpm[] = {
-"16 16 182 2",
-" c None",
-". c #CC9665",
-"+ c #E1C0A3",
-"@ c #EAD1BD",
-"# c #E9D2BB",
-"$ c #D7B597",
-"% c #9D7C5C",
-"& c #CE9E71",
-"* c #F6E9DE",
-"= c #FEF5EE",
-"- c #FFFAF6",
-"; c #FFFBF7",
-"> c #FDF9F5",
-", c #F2EBDD",
-"' c #FBF5E4",
-") c #F3E6D5",
-"! c #B19D8A",
-"~ c #D9AE89",
-"{ c #FFEFE3",
-"] c #FFF7F0",
-"^ c #FFF6EE",
-"/ c #FFF7EF",
-"( c #FFF6EB",
-"_ c #FFF1DD",
-": c #FFF6E3",
-"< c #FFFCE9",
-"[ c #FFFFF9",
-"} c #FFFFFA",
-"| c #BEA98F",
-"1 c #C08F68",
-"2 c #FFD5B2",
-"3 c #FFCAA8",
-"4 c #FFE2CC",
-"5 c #FFF3E9",
-"6 c #FFF4E9",
-"7 c #FFF3E1",
-"8 c #FFF0D0",
-"9 c #FFF9D9",
-"0 c #FFFEE7",
-"a c #FFFFF8",
-"b c #FFF8DA",
-"c c #B8A685",
-"d c #F2B788",
-"e c #FFB886",
-"f c #FFBD8B",
-"g c #FFCA9B",
-"h c #FFE7CF",
-"i c #FFF6EA",
-"j c #FFF4DB",
-"k c #FFF7CA",
-"l c #FFFFE1",
-"m c #FFFFF6",
-"n c #FFFBEE",
-"o c #FFF3D4",
-"p c #FFF3BB",
-"q c #DDC18E",
-"r c #805A34",
-"s c #FDB070",
-"t c #FFAD6E",
-"u c #FFBA7D",
-"v c #FFC78B",
-"w c #FFDAA3",
-"x c #FFEAC8",
-"y c #FFF6C9",
-"z c #FFF8C4",
-"A c #FFF8E8",
-"B c #FFFAEB",
-"C c #FFF0C7",
-"D c #FFE8A8",
-"E c #FFE188",
-"F c #FFDC86",
-"G c #B57841",
-"H c #FFA656",
-"I c #FFAC5F",
-"J c #FFBC73",
-"K c #FFCE89",
-"L c #FFDA91",
-"M c #FFE194",
-"N c #B2A177",
-"O c #C0B095",
-"P c #FFE6BB",
-"Q c #FFE9B3",
-"R c #473E28",
-"S c #FFD76C",
-"T c #FFCC3D",
-"U c #ECBB2F",
-"V c #966F30",
-"W c #BC7D42",
-"X c #FFAA52",
-"Y c #FFAF57",
-"Z c #FFC673",
-"` c #FFDE8E",
-" . c #FFE58D",
-".. c #FCE5A0",
-"+. c #FFDA8B",
-"@. c #FFD673",
-"#. c #292828",
-"$. c #5C5C5C",
-"%. c #FFBA00",
-"&. c #FEC417",
-"*. c #A77D2E",
-"=. c #A7713B",
-"-. c #FFBF69",
-";. c #FFC570",
-">. c #FFDB87",
-",. c #FFF3A1",
-"'. c #FFF9BF",
-"). c #FFE4BA",
-"!. c #DFC19C",
-"~. c #ECC48A",
-"{. c #FFCA5D",
-"]. c #FFCC45",
-"^. c #313131",
-"/. c #747472",
-"(. c #FEC21C",
-"_. c #A57927",
-":. c #FFCF7C",
-"<. c #FFDE8B",
-"[. c #FFFFCB",
-"}. c #FFFFF4",
-"|. c #FFECC6",
-"1. c #FFE4AA",
-"2. c #FFE8BA",
-"3. c #FFC21D",
-"4. c #343333",
-"5. c #A1A09E",
-"6. c #939290",
-"7. c #E5BC73",
-"8. c #FFFAA9",
-"9. c #FFFFCD",
-"0. c #FFFEF1",
-"a. c #FFF3D3",
-"b. c #FFE69F",
-"c. c #FFE9AB",
-"d. c #FFF0C5",
-"e. c #FFEBB4",
-"f. c #FFD465",
-"g. c #363635",
-"h. c #A7A6A3",
-"i. c #B8B7B4",
-"j. c #91908E",
-"k. c #A98E59",
-"l. c #FFF1B6",
-"m. c #FFE59F",
-"n. c #FFD86C",
-"o. c #FFE08B",
-"p. c #FFEAB1",
-"q. c #FFE5A3",
-"r. c #FFE7AB",
-"s. c #383737",
-"t. c #B0AFAC",
-"u. c #C8C7C4",
-"v. c #5A5A59",
-"w. c #CCB396",
-"x. c #FFE5B4",
-"y. c #FFECA5",
-"z. c #FFDB70",
-"A. c #FFCB3B",
-"B. c #FFD871",
-"C. c #FFE8AB",
-"D. c #FFE6A4",
-"E. c #FFE9AA",
-"F. c #3E3D3D",
-"G. c #BEBCB9",
-"H. c #C1A46F",
-"I. c #EABC6D",
-"J. c #FFC924",
-"K. c #FFDC6A",
-"L. c #FFEFAD",
-"M. c #FFEAA1",
-"N. c #FFDA8E",
-"O. c #41403F",
-"P. c #696867",
-"Q. c #FEFEFE",
-"R. c #A97B28",
-"S. c #C08D27",
-"T. c #C99C47",
-"U. c #CEA762",
-"V. c #C09A5A",
-"W. c #855F2F",
-"X. c #FFFFFF",
-"Y. c #BFBFBF",
-" . + @ # $ % ",
-" & * = - ; > , ' ) ! ",
-" ~ { ] ^ / ( _ : < [ } | ",
-" 1 2 3 4 5 6 7 8 9 0 a } b c ",
-" d e f g h i j k l m n o p q ",
-"r s t u v w x y z A B C D E F ",
-"G H I J K L M N O P Q R S T U V ",
-"W X Y Z ` ... +.@.#.$.%.&.*.",
-"=.-.;.>.,.'.).!.~.{.].^./.$.(._.",
-" :.<.,.[.}.|.1.2.<.3.4.5.6.$. ",
-" 7.8.9.0.a.b.c.d.e.f.g.h.i.j.$.",
-" k.l.[ a.m.n.o.p.q.r.s.t.u.v. ",
-" w.x.y.z.A.B.C.D.E.F.G.v. ",
-" H.I.].J.K.L.M.N.O.P.Q. ",
-" R.S.T.U.V.W.O.X. ",
-" Y. "};
diff --git a/gui/mplayer/pixmaps/prefs.xpm b/gui/mplayer/pixmaps/prefs.xpm
deleted file mode 100644
index 51197adeee..0000000000
--- a/gui/mplayer/pixmaps/prefs.xpm
+++ /dev/null
@@ -1,69 +0,0 @@
-/* XPM */
-static const char * const prefs_xpm[] = {
-"16 16 50 1",
-" c None",
-". c #000000",
-"+ c #CAC8C1",
-"@ c #B7B7B7",
-"# c #EBEBE8",
-"$ c #D8D8D8",
-"% c #F9F8F8",
-"& c #D3D1CD",
-"* c #F7F7F7",
-"= c #DEDBD6",
-"- c #D4D3D0",
-"; c #E3E2E1",
-"> c #DFDEDC",
-", c #DBDAD7",
-"' c #A4A19C",
-") c #686868",
-"! c #292929",
-"~ c #1F1F1F",
-"{ c #D2D1D0",
-"] c #50504F",
-"^ c #121212",
-"/ c #414141",
-"( c #494746",
-"_ c #363636",
-": c #C8C7C6",
-"< c #6C6967",
-"[ c #708295",
-"} c #CFD6DD",
-"| c #7C91A7",
-"1 c #D6D5D5",
-"2 c #8A8784",
-"3 c #7D8C9C",
-"4 c #788DA4",
-"5 c #7F99B3",
-"6 c #1F272F",
-"7 c #ECEBEA",
-"8 c #72706D",
-"9 c #8D99A5",
-"0 c #748AA2",
-"a c #849EB9",
-"b c #4D5F73",
-"c c #D5D4D3",
-"d c #6B6A69",
-"e c #7D91A7",
-"f c #849EBA",
-"g c #525252",
-"h c #7E7E7E",
-"i c #515151",
-"j c #66798F",
-"k c #7C7C7C",
-" ",
-" . . ",
-" .+. .@.",
-" .#. .$. ",
-" . .%. .. ",
-" .&..*=. . ",
-" .-;>,'.)! ",
-" .~..{].) ",
-" ^/(. ",
-" ..._.:<. ",
-" .[}|. .12. ",
-" .3}456 .78. ",
-" .9}0ab. .cd. ",
-" .}efb. .{gh",
-" iejb. ..k",
-" i.. "};
diff --git a/gui/mplayer/pixmaps/prev.xpm b/gui/mplayer/pixmaps/prev.xpm
deleted file mode 100644
index 1d38ad7bd6..0000000000
--- a/gui/mplayer/pixmaps/prev.xpm
+++ /dev/null
@@ -1,77 +0,0 @@
-/* XPM */
-static const char * const prev_xpm[] = {
-"16 16 58 1",
-" c None",
-". c #000000",
-"+ c #FFFFFF",
-"@ c #D9D9D9",
-"# c #737372",
-"$ c #888887",
-"% c #7E7E7D",
-"& c #A4A4A3",
-"* c #696867",
-"= c #8E8E8D",
-"- c #B5B4B3",
-"; c #5B5A59",
-"> c #9C9C9A",
-", c #949392",
-"' c #C0BFBE",
-") c #636261",
-"! c #908F8D",
-"~ c #C5C4C3",
-"{ c #A4A3A2",
-"] c #CACAC8",
-"^ c #6F6E6C",
-"/ c #959491",
-"( c #C0BFBD",
-"_ c #D3D3D1",
-": c #A1A09F",
-"< c #D0CECD",
-"[ c #636260",
-"} c #8D8C8B",
-"| c #B4B3B1",
-"1 c #757574",
-"2 c #868481",
-"3 c #BAB9B6",
-"4 c #B9B7B4",
-"5 c #C5C4C2",
-"6 c #D4D3D1",
-"7 c #A2A09F",
-"8 c #A6A4A2",
-"9 c #BDBCB9",
-"0 c #C6C5C3",
-"a c #D4D3D2",
-"b c #AFAEAB",
-"c c #D2D1CF",
-"d c #A3A2A0",
-"e c #B7B6B3",
-"f c #D0CFCD",
-"g c #D4D4D3",
-"h c #B8B8B5",
-"i c #A8A7A5",
-"j c #D5D5D3",
-"k c #DFDFDD",
-"l c #BBBAB7",
-"m c #D7D5D3",
-"n c #C4C4C2",
-"o c #DFDFDE",
-"p c #BBB9B7",
-"q c #D9D8D6",
-"r c #B9B8B5",
-"s c #DEDDDB",
-" ....+ .@",
-" .#$.+ ..+",
-" .%&.+ .*.+",
-" .=-.+ .;>.+",
-" .,'.+ .)!~.+",
-" .{].+ .^/(_.+",
-" .:<.+ .[}|(_.+",
-" .{].+.123456.+",
-" .:<.+ .7890a.+",
-" .bc.+ .defg.+",
-" .ha.+ .ijk.+",
-" .lm.+ .no.+",
-" .pq.+ .6.+",
-" .rs.+ ..+",
-" ....+ .+",
-" ++++ "};
diff --git a/gui/mplayer/pixmaps/question.xpm b/gui/mplayer/pixmaps/question.xpm
deleted file mode 100644
index 2195a1edf8..0000000000
--- a/gui/mplayer/pixmaps/question.xpm
+++ /dev/null
@@ -1,335 +0,0 @@
-/* XPM */
-static const char * const question_xpm[] = {
-"48 48 284 2",
-" c None",
-". c #9B4C3A",
-"+ c #9F4E3C",
-"@ c #9E4E3B",
-"# c #A7523E",
-"$ c #AA5440",
-"% c #9C4D3A",
-"& c #9D4E3B",
-"* c #A4513D",
-"= c #A5513E",
-"- c #9D4D3B",
-"; c #A9533F",
-"> c #A6523E",
-", c #A04F3C",
-"' c #984B39",
-") c #924836",
-"! c #914736",
-"~ c #934837",
-"{ c #944937",
-"] c #A7523F",
-"^ c #A8533F",
-"/ c #974A38",
-"( c #AB6F61",
-"_ c #B27F73",
-": c #C09D95",
-"< c #C9AFA9",
-"[ c #CDB3AC",
-"} c #D6CECC",
-"| c #DADADA",
-"1 c #D9D9D9",
-"2 c #CCB1AB",
-"3 c #D2B7B1",
-"4 c #DDC0BA",
-"5 c #C48B7D",
-"6 c #8E4635",
-"7 c #A86D5F",
-"8 c #B4948C",
-"9 c #C2B2AE",
-"0 c #D7D7D7",
-"a c #E1E1E1",
-"b c #EEEEEE",
-"c c #F3F3F3",
-"d c #F9F9F9",
-"e c #FAFAFA",
-"f c #F8F8F8",
-"g c #F7F7F7",
-"h c #EEE4E2",
-"i c #C38A7D",
-"j c #A14F3C",
-"k c #98594A",
-"l c #B1897F",
-"m c #C9C1BF",
-"n c #EBEBEB",
-"o c #F6F6F6",
-"p c #DCC0B9",
-"q c #BA7767",
-"r c #904736",
-"s c #8D4535",
-"t c #B3948D",
-"u c #BDBDBD",
-"v c #F4F4F4",
-"w c #F5F5F5",
-"x c #E3D0CB",
-"y c #73382A",
-"z c #A2503C",
-"A c #B6A7A4",
-"B c #D4D4D4",
-"C c #B26553",
-"D c #A2503D",
-"E c #823F30",
-"F c #A86D60",
-"G c #C1C1C1",
-"H c #EDEDED",
-"I c #AAAAAA",
-"J c #535353",
-"K c #232323",
-"L c #1B1B1B",
-"M c #1A1A1A",
-"N c #181818",
-"O c #2D2D2D",
-"P c #DFDFDF",
-"Q c #F2F2F2",
-"R c #C99A8E",
-"S c #7B3C2D",
-"T c #B48B81",
-"U c #DCDCDC",
-"V c #808080",
-"W c #1F1F1F",
-"X c #191919",
-"Y c #252525",
-"Z c #363636",
-"` c #2B2B2B",
-" . c #AFAFAF",
-".. c #F1F1F1",
-"+. c #D9BCB6",
-"@. c #A3503D",
-"#. c #7E3E2F",
-"$. c #C9B0A9",
-"%. c #E0E0E0",
-"&. c #A5A5A5",
-"*. c #373737",
-"=. c #303030",
-"-. c #5C5C5C",
-";. c #757575",
-">. c #646464",
-",. c #3D3D3D",
-"'. c #2A2A2A",
-"). c #E3E3E3",
-"!. c #DBC0BA",
-"~. c #793B2D",
-"{. c #964A38",
-"]. c #C3A199",
-"^. c #1C1C1C",
-"/. c #656565",
-"(. c #D2D2D2",
-"_. c #3F3F3F",
-":. c #1E1E1E",
-"<. c #F0F0F0",
-"[. c #CC9F95",
-"}. c #72382B",
-"|. c #B07F74",
-"1. c #606060",
-"2. c #1D1D1D",
-"3. c #767676",
-"4. c #616161",
-"5. c #EFEFEF",
-"6. c #C28A7D",
-"7. c #994B39",
-"8. c #73392B",
-"9. c #99594A",
-"0. c #5D5D5D",
-"a. c #383838",
-"b. c #171717",
-"c. c #737373",
-"d. c #623025",
-"e. c #CDC5C3",
-"f. c #4E4E4E",
-"g. c #565656",
-"h. c #CFCFCF",
-"i. c #505050",
-"j. c #818181",
-"k. c #DCC3BE",
-"l. c #894333",
-"m. c #552920",
-"n. c #BD9C94",
-"o. c #E7E7E7",
-"p. c #A3A3A3",
-"q. c #797979",
-"r. c #DBDBDB",
-"s. c #484848",
-"t. c #C5C5C5",
-"u. c #ECECEC",
-"v. c #C18A7D",
-"w. c #7C3D2E",
-"x. c #AA6E5F",
-"y. c #9A9A9A",
-"z. c #4F4F4F",
-"A. c #717171",
-"B. c #6B3428",
-"C. c #954A38",
-"D. c #C8C0BE",
-"E. c #D5D5D5",
-"F. c #585858",
-"G. c #525252",
-"H. c #EAEAEA",
-"I. c #DBC4BF",
-"J. c #874232",
-"K. c #4F271E",
-"L. c #B78D84",
-"M. c #323232",
-"N. c #D6D6D6",
-"O. c #BB7B6C",
-"P. c #6E3629",
-"Q. c #965748",
-"R. c #CACACA",
-"S. c #E9E9E9",
-"T. c #464646",
-"U. c #B0B0B0",
-"V. c #E5D7D4",
-"W. c #643126",
-"X. c #8B4434",
-"Y. c #C19F97",
-"Z. c #777777",
-"`. c #2C2C2C",
-" + c #515151",
-".+ c #BBBBBB",
-"++ c #E8E8E8",
-"@+ c #BB7C6D",
-"#+ c #70372A",
-"$+ c #411F18",
-"%+ c #9A594A",
-"&+ c #CBCBCB",
-"*+ c #DEDEDE",
-"=+ c #7F7F7F",
-"-+ c #202020",
-";+ c #B8B8B8",
-">+ c #E5D9D6",
-",+ c #924837",
-"'+ c #BD9D95",
-")+ c #313131",
-"!+ c #C9C9C9",
-"~+ c #BA7B6C",
-"{+ c #7F3E2F",
-"]+ c #401F17",
-"^+ c #9A5949",
-"/+ c #A0A0A0",
-"(+ c #A9A9A9",
-"_+ c #E6E6E6",
-":+ c #E3D5D2",
-"<+ c #9F4E3B",
-"[+ c #B38B82",
-"}+ c #DDDDDD",
-"|+ c #E5E5E5",
-"1+ c #B26755",
-"2+ c #884333",
-"3+ c #3D1E16",
-"4+ c #C4BCBB",
-"5+ c #4D4D4D",
-"6+ c #2F2F2F",
-"7+ c #CBA198",
-"8+ c #663226",
-"9+ c #A0685B",
-"0+ c #9F9F9F",
-"a+ c #161616",
-"b+ c #292929",
-"c+ c #686868",
-"d+ c #E4E4E4",
-"e+ c #E0D2CE",
-"f+ c #71382A",
-"g+ c #A4513E",
-"h+ c #B4948D",
-"i+ c #D1D1D1",
-"j+ c #9E9E9E",
-"k+ c #E6E0DE",
-"l+ c #B16654",
-"m+ c #552A20",
-"n+ c #B59F99",
-"o+ c #404040",
-"p+ c #919191",
-"q+ c #E2E2E2",
-"r+ c #BF887C",
-"s+ c #8C4534",
-"t+ c #9D5A4A",
-"u+ c #BEB6B5",
-"v+ c #BCBCBC",
-"w+ c #C69A90",
-"x+ c #6C3528",
-"y+ c #9B5949",
-"z+ c #BFB7B6",
-"A+ c #D2B9B3",
-"B+ c #7A3C2D",
-"C+ c #50261D",
-"D+ c #9C594A",
-"E+ c #BBACA8",
-"F+ c #BD8578",
-"G+ c #7D3D2F",
-"H+ c #572A20",
-"I+ c #B18E85",
-"J+ c #CECECE",
-"K+ c #DDD4D3",
-"L+ c #B57262",
-"M+ c #7A3C2E",
-"N+ c #9A4C39",
-"O+ c #97584A",
-"P+ c #B99A94",
-"Q+ c #D3D3D3",
-"R+ c #E1DAD8",
-"S+ c #C29388",
-"T+ c #693327",
-"U+ c #AA604E",
-"V+ c #BF9287",
-"W+ c #D4BCB7",
-"X+ c #D2B8B3",
-"Y+ c #773A2C",
-"Z+ c #643125",
-"`+ c #4C251C",
-" @ c #864232",
-".@ c #401F18",
-"+@ c #592C21",
-"@@ c #71372A",
-"#@ c #813F30",
-"$@ c #834031",
-"%@ c #6D3528",
-"&@ c #4E261D",
-" ",
-" ",
-" ",
-" ",
-" . + @ # $ $ $ $ $ $ $ $ $ % & @ ",
-" % * $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ = - ",
-" # $ $ $ $ $ $ $ $ $ ; ; ; ; ; ; $ $ $ ; > $ $ $ $ $ $ $ $ $ . ",
-" @ $ $ $ $ $ $ ; , ' ) ! ! ~ { { { { { { ' . . = $ $ $ $ $ $ $ $ $ $ $ , ",
-" ] $ $ $ $ ^ % / ! ~ % ( _ : < [ } | | | 1 | 2 3 4 5 5 $ $ $ $ $ $ $ $ $ $ $ ",
-" ] $ $ $ ; - 6 { 7 8 9 0 a b c d e e d d d d d f f f f f g h 4 i $ $ $ $ $ $ $ j ",
-" = $ $ $ * ) k l m n f e e e e d d d d d f f f f f g g g g g o o o o p q $ $ $ $ > r ",
-" $ $ $ , s t u v e e d d d d d f f f f f g g g g g g o o o o o w w w w w x q $ $ $ ' y ",
-" $ $ z s A B d d d d d f f f f f g g g g g o o o o o w w w w w v v v v v c c C $ $ D E ",
-" , $ $ ) F G d f f f f f g g g g g H I J K L M N O P w w v v v v v c c c c c Q R $ $ , S ",
-" + $ $ { T U f f g g g g g o o o v V W N X Y Z ` N L .v c c c c c Q Q Q Q Q ..+.$ $ @.#. ",
-" @ $ $ ~ $.%.g g g o o o o o w w &.*.N =.-.;.>.,.*.L '.).c Q Q Q Q Q ..........!.$ $ * ~. ",
-" @ $ $ {.].P o o o w w w w w v v >.^.^./.c c c (._.L :./.Q ..........<.<.<.<.v [.$ $ @ }. ",
-" @ $ $ , |.P w w w w v v v v v c 1.2.N 3.Q Q Q Q 4.L 2.-...<.<.<.<.<.5.5.5.5.v 6.$ $ 7.8. ",
-" ' $ $ > 9.U v v v v c c c c c Q 0.a.b.0.........c.L ^.>.<.<.5.5.5.5.5.b b <.Q $ $ $ r d. ",
-" $ $ $ ! e.Q c c c c Q Q Q Q Q u f.M g.<.<.<.h.i.N W j.5.5.5.b b b b b H ..k.$ $ $ l.m. ",
-" $ $ $ ' n.o.Q Q Q Q ..........<.p.q.r.<.5.5.;.'.N s.t.b b b H H H H H u.Q v.$ $ ^ w. ",
-" = $ $ % x.1 ........<.<.<.<.<.5.5.5.5.5.5.y.z.N :.A.H H H H H u.u.u.u.b ..$ $ $ % B. ",
-" C.$ $ * r D.b <.<.<.<.5.5.5.5.5.b b b b E.F.^.N G.n u.u.u.u.u.n n H.n <.I.$ $ $ J.K. ",
-" $ $ $ ~ L.U 5.5.5.5.5.b b b b b H H ).>.M.b.Z N.u.u.n n n n n H.H.H...O.$ $ ^ P. ",
-" = $ $ D Q.R.S.b b b b H H H H H u.u.I T.N M U.n n n H.H.H.H.H.S.S.H V.$ $ $ r W. ",
-" X.$ $ $ {.Y.h.H H H H H u.u.u.u.u.n Z.`.b. +.+H.H.H.S.S.S.S.S.++++5.@+$ ; > #+$+ ",
-" $ $ $ = %+&+*+u.u.u.u.n n n n n H.=+-+X b.;+S.S.S.S.++++++++++H.>+$ $ $ ,+B. ",
-" ~ $ $ $ ' '+R.n n n n n H.H.H.H.S.*+;.'.)+!+++++++++o.o.o.o.o.5.~+$ $ ; {+]+ ",
-" $ $ $ ; ^+!+U H.H.H.H.S.S.S.S.S.++t./+(+++o.o.o.o.o._+_+_+u.:+$ $ $ <+B. ",
-" ,+$ $ $ @ [+!+S.S.S.S.++++++++++o.o.!+}+o.o._+_+_+_+_+|+++b 1+$ $ $ 2+3+ ",
-" $ $ $ $ ) 4+}+++++++++o.o.o.o.o.5+6+5+G _+|+|+|+|+|+_+u.7+$ $ $ . 8+ ",
-" 2+$ $ $ * 9+R.|+o.o.o.o._+_+_+0+b.a+b+c+|+|+d+d+d+_+n e+$ $ $ ^ f+ ",
-" g+$ $ $ % h+i+_+_+_+_+|+|+|+j+a+a+M >.d+d+).).).H.k+l+$ $ ; #.m+ ",
-" $ $ $ $ / n+U |+|+|+|+d+d+d+-.Y o+p+).).).q+S.u.r+$ $ ; s+8+ ",
-" r $ $ $ $ t+u+r.d+d+d+).).).).t.v+q+q+q+q+++H.w+$ $ $ 7.x+ ",
-" / $ $ $ $ y+z+| ).).).q+q+q+q+q+a a ).n u.A+$ $ ^ , B+C+ ",
-" * $ $ $ ; D+E+E.a *+r.r.P %.a q+o.H S.F+$ $ ; D G+H+ ",
-" * $ $ $ $ { I+J+d+|+).q+).|+S.H.K+L+$ $ $ = M+8+ ",
-" @.$ $ $ ^ N+O+P+Q+).++++++R+S+$ $ $ $ > w.T+ ",
-" @.$ $ $ $ , ' U+V+W+X+F+$ $ $ $ $ > Y+Z+ ",
-" % $ $ $ $ $ $ $ $ $ $ $ $ $ $ % }.`+ ",
-" {+$ $ $ $ $ $ $ $ $ $ $ * @8+.@ ",
-" 2+$ $ $ $ $ $ ^ % s #++@ ",
-" @@#@{ { $@%@Z+&@ ",
-" ",
-" ",
-" ",
-" "};
diff --git a/gui/mplayer/pixmaps/skin.xpm b/gui/mplayer/pixmaps/skin.xpm
deleted file mode 100644
index 5f15c8b96b..0000000000
--- a/gui/mplayer/pixmaps/skin.xpm
+++ /dev/null
@@ -1,181 +0,0 @@
-/* XPM */
-static const char * const skin_xpm[] = {
-"16 16 162 2",
-" c None",
-". c #DBA97F",
-"+ c #C7A89B",
-"@ c #E1DFDD",
-"# c #BE9D76",
-"$ c #A35019",
-"% c #A8978C",
-"& c #D3D2D0",
-"* c #DAD8D7",
-"= c #D9D6D4",
-"- c #BEBCB9",
-"; c #BCAA95",
-"> c #D78236",
-", c #844A36",
-"' c #DADFE4",
-") c #E0E8E8",
-"! c #C8D2D3",
-"~ c #B5B7B7",
-"{ c #DCDAD7",
-"] c #BBB7B0",
-"^ c #CCCACB",
-"/ c #D2D0D3",
-"( c #EDAF6C",
-"_ c #953600",
-": c #28257E",
-"< c #A1B4F3",
-"[ c #F5B7AC",
-"} c #F4A296",
-"| c #E5E7EB",
-"1 c #ABB1B6",
-"2 c #C8C4C0",
-"3 c #CECBC5",
-"4 c #F7F7F9",
-"5 c #53548A",
-"6 c #967265",
-"7 c #DE741B",
-"8 c #6F3937",
-"9 c #4155C2",
-"0 c #A8BAEB",
-"a c #E65138",
-"b c #DD0C00",
-"c c #F1D2D5",
-"d c #BECFD8",
-"e c #B5BABE",
-"f c #C2BEB9",
-"g c #E9E7E5",
-"h c #FFFFFF",
-"i c #F9FBFF",
-"j c #71667C",
-"k c #E49146",
-"l c #9D3501",
-"m c #BFB7BD",
-"n c #E5F6FE",
-"o c #DCF0FF",
-"p c #D7B2BD",
-"q c #D18F98",
-"r c #D0DCF6",
-"s c #D8E5F1",
-"t c #9DA4A7",
-"u c #CECBC6",
-"v c #EAE8E6",
-"w c #9F9EA3",
-"x c #444349",
-"y c #C3C4C7",
-"z c #E7BD90",
-"A c #CD5A0B",
-"B c #946454",
-"C c #E7F9FF",
-"D c #DFF1FF",
-"E c #D8EAFF",
-"F c #AFE5E5",
-"G c #3ACB52",
-"H c #6BCE85",
-"I c #DBE7FB",
-"J c #9DA2A9",
-"K c #B9B4AF",
-"L c #636167",
-"M c #000004",
-"N c #8B7E74",
-"O c #EF9853",
-"P c #913710",
-"Q c #CDD6DF",
-"R c #E1F5FF",
-"S c #D2E9FF",
-"T c #CFE6FF",
-"U c #97D6CA",
-"V c #03B200",
-"W c #44C54A",
-"X c #CCDAEF",
-"Y c #9DA5AF",
-"Z c #BBB6B1",
-"` c #E7E7E8",
-" . c #BBC1CC",
-".. c #D3B59C",
-"+. c #AF4E1E",
-"@. c #B1A3A5",
-"#. c #E4FBFF",
-"$. c #D4ECFF",
-"%. c #CAE5FF",
-"&. c #C5E1F2",
-"*. c #B7DAE7",
-"=. c #86CCC7",
-"-. c #B3E3E5",
-";. c #A7B6C5",
-">. c #BAC1C8",
-",. c #BFBBB6",
-"'. c #E6E5E3",
-"). c #F5E9CC",
-"!. c #BC9877",
-"~. c #987977",
-"{. c #B3BDC4",
-"]. c #A8AEB3",
-"^. c #B0C0D0",
-"/. c #BCDAF3",
-"(. c #DCD443",
-"_. c #E5D620",
-":. c #BFDCF1",
-"<. c #C1D6F7",
-"[. c #A7B0B9",
-"}. c #C7C6C3",
-"|. c #ABA194",
-"1. c #CDA447",
-"2. c #8E4B00",
-"3. c #958685",
-"4. c #D9DADA",
-"5. c #E1E0E0",
-"6. c #A4A5A7",
-"7. c #8FA6BC",
-"8. c #D1CD44",
-"9. c #F3E538",
-"0. c #C6D9DB",
-"a. c #9DABBC",
-"b. c #B0A08A",
-"c. c #9C7A32",
-"d. c #6A380E",
-"e. c #989DA6",
-"f. c #8E9296",
-"g. c #8D9196",
-"h. c #92A7B9",
-"i. c #AFD5FC",
-"j. c #BFDFF2",
-"k. c #B0C3CA",
-"l. c #A1ADB7",
-"m. c #C9C1B8",
-"n. c #8D6841",
-"o. c #6C4C2C",
-"p. c #7E7267",
-"q. c #A1ACB7",
-"r. c #BFD5EA",
-"s. c #BEDBF5",
-"t. c #BEDDFA",
-"u. c #AFC6DA",
-"v. c #97A5B3",
-"w. c #BDC4C9",
-"x. c #D8D5D0",
-"y. c #BDB7AF",
-"z. c #DDDBD8",
-"A. c #BDC2C7",
-"B. c #A0A7AD",
-"C. c #9DA6AD",
-"D. c #A0A9B1",
-"E. c #C2C6CB",
-" ",
-" . + ",
-" @ # $ % & * ",
-" = - ; > , ' ) ! ~ ",
-" { ] ^ / ( _ : < [ } | 1 ",
-" 2 3 4 5 6 7 8 9 0 a b c d e ",
-" f g h i j k l m n o p q r s t ",
-"u v w x y z A B C D E F G H I J ",
-"K h L M N O P Q R S T U V W X Y ",
-"Z h ` ...+.@.#.$.%.&.*.=.-.;.>.",
-",.'.h ).!.~.{.].^./.(._.:.<.[. ",
-" }.|.1.2.3.4.5.6.7.8.9.0.a. ",
-" b.c.d.e.f.g.h.i.j.k.l. ",
-" m.n.o.p.q.r.s.t.u.v.w. ",
-" x.y.z. A.B.C.D.E. ",
-" "};
diff --git a/gui/mplayer/pixmaps/sound.xpm b/gui/mplayer/pixmaps/sound.xpm
deleted file mode 100644
index 644c016e2f..0000000000
--- a/gui/mplayer/pixmaps/sound.xpm
+++ /dev/null
@@ -1,140 +0,0 @@
-/* XPM */
-static const char * const sound_xpm[] = {
-"16 16 121 2",
-" c None",
-". c #939CA9",
-"+ c #89919F",
-"@ c #A6AEBA",
-"# c #99A0AC",
-"$ c #5B6576",
-"% c #1A202C",
-"& c #1E283A",
-"* c #141F32",
-"= c #9CA3AF",
-"- c #626C7C",
-"; c #505866",
-"> c #1A2029",
-", c #1D232B",
-"' c #1F2838",
-") c #263248",
-"! c #182233",
-"~ c #B9BFC8",
-"{ c #6D7585",
-"] c #181E26",
-"^ c #1D222B",
-"/ c #1D232C",
-"( c #26334B",
-"_ c #253149",
-": c #A0AAB8",
-"< c #888F9B",
-"[ c #131823",
-"} c #1C212A",
-"| c #1F242B",
-"1 c #1F242A",
-"2 c #233047",
-"3 c #293854",
-"4 c #4F5E77",
-"5 c #525C6A",
-"6 c #282F3B",
-"7 c #1A212A",
-"8 c #1E232B",
-"9 c #1F232A",
-"0 c #273040",
-"a c #4A5B77",
-"b c #293650",
-"c c #2F3F5E",
-"d c #53637E",
-"e c #151C28",
-"f c #1C2129",
-"g c #20242C",
-"h c #232830",
-"i c #7485A0",
-"j c #697C9B",
-"k c #43536E",
-"l c #314260",
-"m c #6F84A1",
-"n c #676E79",
-"o c #222B3B",
-"p c #222935",
-"q c #20252D",
-"r c #4B5B74",
-"s c #879AB3",
-"t c #596E92",
-"u c #354259",
-"v c #394A69",
-"w c #687EA2",
-"x c #4A5872",
-"y c #364153",
-"z c #303B51",
-"A c #344054",
-"B c #7F8DA4",
-"C c #5C7296",
-"D c #3E506F",
-"E c #4D5A6E",
-"F c #63799A",
-"G c #323A46",
-"H c #445573",
-"I c #36445C",
-"J c #36445B",
-"K c #37455D",
-"L c #425169",
-"M c #45526A",
-"N c #27354D",
-"O c #1D2433",
-"P c #A6B6CA",
-"Q c #5C6F8F",
-"R c #242B38",
-"S c #323F56",
-"T c #3F4F68",
-"U c #44536C",
-"V c #53617A",
-"W c #6C7A92",
-"X c #B0BBCC",
-"Y c #9EA7B8",
-"Z c #C5CDDA",
-"` c #6E809B",
-" . c #212935",
-".. c #151A23",
-"+. c #293344",
-"@. c #44526A",
-"#. c #617087",
-"$. c #8C98A9",
-"%. c #B0B8C4",
-"&. c #C9CED7",
-"*. c #C5CCD8",
-"=. c #79879E",
-"-. c #2B3648",
-";. c #121824",
-">. c #1F232C",
-",. c #626F87",
-"'. c #4D5B74",
-"). c #C0C6D1",
-"!. c #C7CBD0",
-"~. c #BAC3D0",
-"{. c #8592A6",
-"]. c #222830",
-"^. c #7B8495",
-"/. c #778195",
-"(. c #B2B8C2",
-"_. c #B3B8BF",
-":. c #49535F",
-"<. c #1D2229",
-"[. c #252B30",
-"}. c #1F252C",
-"|. c #1A1C20",
-" ",
-" . + @ # ",
-" $ % & * = - ",
-" ; > , ' ) ! ~ ",
-" { ] ^ , / ( _ : ",
-" < [ } | 1 ' 2 3 4 5 ",
-" 6 7 8 9 0 a b c d ",
-" 6 e f g h i j k l m ",
-" n o p q r s t u v w x ",
-" y z A A B C D E F G H ",
-" I J K L M N O P Q R S ",
-" T U V W X Y Z ` ...+. ",
-" @.#.$.%.&.*.=.-.;.>. ",
-" ,.'.).!.~.{.]. ",
-" ^./.(._.:.<. ",
-" [.}.|. "};
diff --git a/gui/mplayer/pixmaps/stop.xpm b/gui/mplayer/pixmaps/stop.xpm
deleted file mode 100644
index 498547bebd..0000000000
--- a/gui/mplayer/pixmaps/stop.xpm
+++ /dev/null
@@ -1,254 +0,0 @@
-/* XPM */
-static const char * const stop_xpm[] = {
-"48 48 203 2",
-" c None",
-". c #5A5A5A",
-"+ c #575757",
-"@ c #545454",
-"# c #535353",
-"$ c #565656",
-"% c #898989",
-"& c #6B6B6B",
-"* c #D5D5D5",
-"= c #FFFFFF",
-"- c #FEFEFE",
-"; c #FDFDFD",
-"> c #E4E4E4",
-", c #5B5B5B",
-"' c #7A7A7A",
-") c #666666",
-"! c #E6E6E6",
-"~ c #FCFCFC",
-"{ c #E3E3E3",
-"] c #5E5E5E",
-"^ c #7B7B7B",
-"/ c #6C6C6C",
-"( c #F8F8F8",
-"_ c #F7F7F7",
-": c #F6F6F6",
-"< c #FBFBFB",
-"[ c #EDEDED",
-"} c #D8D8D8",
-"| c #D3D3D3",
-"1 c #DADADA",
-"2 c #DEDEDE",
-"3 c #E0E0E0",
-"4 c #EAEAEA",
-"5 c #FAFAFA",
-"6 c #585858",
-"7 c #787878",
-"8 c #F5F5F5",
-"9 c #BC9999",
-"0 c #B40000",
-"a c #D47E7E",
-"b c #5C5C5C",
-"c c #838383",
-"d c #F4F4F4",
-"e c #AF8181",
-"f c #B30000",
-"g c #D47F7F",
-"h c #4F4F4F",
-"i c #686868",
-"j c #DFDFDF",
-"k c #AD7D7D",
-"l c #B10000",
-"m c #B20000",
-"n c #D28080",
-"o c #808080",
-"p c #6A6A6A",
-"q c #B18383",
-"r c #B00000",
-"s c #D17777",
-"t c #4E4E4E",
-"u c #878787",
-"v c #6F6F6F",
-"w c #B38585",
-"x c #AE0000",
-"y c #AF0000",
-"z c #D07C7C",
-"A c #515151",
-"B c #6E6E6E",
-"C c #AF7F7F",
-"D c #AC0000",
-"E c #AD0000",
-"F c #CE7B7B",
-"G c #555555",
-"H c #717171",
-"I c #AA0000",
-"J c #AB0000",
-"K c #CD7171",
-"L c #E1E1E1",
-"M c #D7D7D7",
-"N c #A80000",
-"O c #A90000",
-"P c #CD7878",
-"Q c #F9F9F9",
-"R c #353535",
-"S c #D0D0D0",
-"T c #B58282",
-"U c #A70000",
-"V c #CB7676",
-"W c #DCDCDC",
-"X c #3A3A3A",
-"Y c #A50000",
-"Z c #A60000",
-"` c #CB7575",
-" . c #F2F2F2",
-".. c #454545",
-"+. c #D4D4D4",
-"@. c #B48080",
-"#. c #A40000",
-"$. c #CA7B7B",
-"%. c #A10000",
-"&. c #A20000",
-"*. c #A30000",
-"=. c #A00000",
-"-. c #CC7777",
-";. c #DFAAAA",
-">. c #EDD0D0",
-",. c #C46060",
-"'. c #F1F1F1",
-"). c #9E0000",
-"!. c #9F0000",
-"~. c #D59191",
-"{. c #9D0000",
-"]. c #9B0000",
-"^. c #9C0000",
-"/. c #990000",
-"(. c #BB5757",
-"_. c #9A0000",
-":. c #C97777",
-"<. c #ECD0D0",
-"[. c #980000",
-"}. c #BF6161",
-"|. c #960000",
-"1. c #970000",
-"2. c #F0F0F0",
-"3. c #940000",
-"4. c #950000",
-"5. c #920000",
-"6. c #930000",
-"7. c #C57777",
-"8. c #910000",
-"9. c #DAAAAA",
-"0. c #C47777",
-"a. c #B65757",
-"b. c #B75757",
-"c. c #D9D9D9",
-"d. c #8F0000",
-"e. c #900000",
-"f. c #E9E9E9",
-"g. c #AA4747",
-"h. c #8D0000",
-"i. c #8E0000",
-"j. c #C16C6C",
-"k. c #E2E2E2",
-"l. c #A64444",
-"m. c #8C0000",
-"n. c #BC6363",
-"o. c #EFEFEF",
-"p. c #525252",
-"q. c #DDDDDD",
-"r. c #A54343",
-"s. c #8A0000",
-"t. c #8B0000",
-"u. c #B14B4B",
-"v. c #474747",
-"w. c #444444",
-"x. c #A84242",
-"y. c #890000",
-"z. c #B95E5E",
-"A. c #4C4C4C",
-"B. c #A34040",
-"C. c #870000",
-"D. c #880000",
-"E. c #AF4B4B",
-"F. c #343434",
-"G. c #505050",
-"H. c #A23E3E",
-"I. c #850000",
-"J. c #860000",
-"K. c #AE4C4C",
-"L. c #9F3D3D",
-"M. c #840000",
-"N. c #AD4A4A",
-"O. c #323232",
-"P. c #4D4D4D",
-"Q. c #A23D3D",
-"R. c #820000",
-"S. c #830000",
-"T. c #AC4949",
-"U. c #9F3B3B",
-"V. c #800000",
-"W. c #810000",
-"X. c #D2D2D2",
-"Y. c #393939",
-"Z. c #CACACA",
-"`. c #A13B3B",
-" + c #7F0000",
-".+ c #A94545",
-"++ c #A43B3B",
-"@+ c #7D0000",
-"#+ c #A53C3C",
-"$+ c #BCBCBC",
-"%+ c #333333",
-"&+ c #BBBBBB",
-"*+ c #C2C2C2",
-"=+ c #303030",
-"-+ c #A3A3A3",
-";+ c #A8A8A8",
-">+ c #A7A7A7",
-",+ c #AFAFAF",
-"'+ c #363636",
-")+ c #464646",
-"!+ c #272727",
-"~+ c #2E2E2E",
-"{+ c #2C2C2C",
-" ",
-" ",
-" . + @ @ # # # # # # # # # # # # # # $ % ",
-" & * = = - - - - - - - - ; ; ; ; ; ; ; > , ' ",
-" ) ! = = - - - - - - - - ; ; ; ; ; ; ; ; ~ { ] ^ ",
-" / ! = - - - ( _ _ _ _ : : : < < ; ; ; ; ~ ~ ~ ~ $ ^ ",
-" ) = = - - ( [ } | | | 1 2 2 2 2 3 4 4 [ ~ 5 ~ ~ ~ { 6 7 ",
-" ) = - - - 8 2 9 0 0 0 0 0 0 0 0 0 0 0 0 0 a ~ ~ ~ ~ ~ < b c ",
-" / = - - - d 3 e f f f f 0 0 0 0 0 0 0 0 0 0 0 g ~ ~ ~ < < < h c ",
-" i = - - - 8 j k l l l l l m m m m m m m m m m m m n < < < < < < 6 o ",
-" p - - - - 8 * q r r r r r r r r r r r r r r r r r r l s < < < < < < t u ",
-" v - - - - d 1 w x x x x x x x x x x x y y y y y y y y y y z < < < < 5 5 A o ",
-" B - - - - 8 1 C D D D D D D D D E E E E E E E E E E E E E E E F < 5 5 5 5 5 G u ",
-" H - - - - 8 * C I J J J J J J J J J J J J J J J J D D D D D D D D K 5 5 5 5 5 L t u ",
-" B - - - - d M w N O O O O O O O O O O O O O O O O O O O O O I I I I I P 5 5 5 5 5 Q h o ",
-" R - - - - 8 S T U U U U U U N N N N N N N N N N N N N N N N N N N N N N N V 5 5 Q Q Q W X ",
-" # - - - ( M T Y Y Y Y Y Y Y Y Y Y Y Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z Z U U U U ` Q Q Q Q ... ",
-" # - - 5 +.@.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.Y Y Y Y Y Y Y Y Y $.Q Q Q ... ",
-" # - - : } %.&.&.&.&.&.&.&.&.&.&.&.&.&.&.&.&.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.#.#.- Q Q ... ",
-" # - ; : } =.=.=.=.=.=.-.= = ;.=.= = = = = %.-.= = = -.%.%.= = = >.,.%.%.%.%.&.&.- Q Q '... ",
-" # ; ; : } ).).).).).!.= !.!.~.!.!.!.= !.!.!.= !.!.!.= =.=.= =.=.-.>.=.=.=.=.=.=.- Q ( '... ",
-" # ; ; : } {.{.{.{.{.{.= {.{.{.{.{.{.= {.{.{.= {.{.).= ).).= ).).).= ).).).).).).- ( ( '... ",
-" # ; ; : } ].].].].].].= ].^.^.^.^.^.= ^.^.^.= ^.^.^.= ^.^.= ^.^.^.= ^.^.^.{.{.{.- ( ( '... ",
-" # ; ; : } /./././././.(.= = (././._.= _._._.= _._._.= _._.= ].].:.<.].].].].].].- ( ( '... ",
-" # ; ; 8 M [.[.[.[.[.[.[.[.[.= [.[.[.= [.[./.= /././.= /./.= = = <.}././././././.- ( ( '... ",
-" # ; ~ 8 M |.|.|.|.|.|.|.|.|.= |.|.|.= |.|.1.= 1.1.1.= 1.1.= 1.1.1.[.[.[.[.[.[.[.- ( ( 2... ",
-" # ~ ~ 8 M 3.3.3.3.3.3.3.3.4.= 4.4.4.= 4.4.4.= 4.4.4.= 4.4.= 4.4.4.4.4.4.4.|.|.|.- ( _ 2... ",
-" # ~ ~ 8 M 5.5.5.6.6.6.7.6.6.= 6.6.6.= 6.6.6.= 6.6.3.= 3.3.= 3.3.3.3.3.3.3.3.3.3.- _ _ 2... ",
-" # ~ ~ : M 8.8.8.8.8.8.9.= = 0.8.8.8.= 8.8.8.a.= = = b.5.5.= 5.5.5.5.5.5.5.5.5.5.- _ _ 2... ",
-" # ~ ~ ~ c.d.d.d.d.d.d.d.e.e.e.e.e.e.e.e.e.e.e.e.e.e.e.e.e.e.e.e.8.8.8.8.8.8.8.8.- _ _ 2... ",
-" # ~ ~ < f.g.h.h.h.h.h.h.i.i.i.i.i.i.i.i.i.i.i.i.i.i.i.i.d.d.d.d.d.d.d.d.d.d.d.j.- _ _ 2... ",
-" # ~ < < Q k.l.m.m.m.m.m.m.m.m.m.m.m.m.m.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.h.n.~ _ _ _ o... ",
-" p.< < < < < q.r.s.s.s.s.s.s.s.s.t.t.t.t.t.t.t.t.t.t.t.t.t.t.t.t.m.m.m.m.m.u.; ; _ _ : o.v. ",
-" w.< < < < < < q.x.y.y.y.y.y.y.y.y.y.y.y.y.y.y.y.y.y.y.y.y.y.y.y.y.y.y.y.z.- ; _ : : : 2... ",
-" A.< < < < 5 ( W B.C.C.C.C.C.C.C.C.C.D.D.D.D.D.D.D.D.D.D.D.D.D.D.D.D.E.- ; _ : : : | F. ",
-" G.< 5 5 5 5 5 W H.I.I.I.I.I.I.I.I.I.I.I.I.J.J.J.J.J.J.J.J.J.J.J.K.- ; : : : : 4 X ",
-" t L 5 5 5 5 5 2 L.M.M.M.M.M.M.M.M.M.M.M.M.M.M.M.M.M.M.M.I.I.N.- ~ : : : : 4 O. ",
-" P.5 5 5 5 5 Q W Q.R.R.R.R.R.R.R.R.R.R.R.R.R.R.S.S.S.S.S.T.- - : : : : | O. ",
-" A.L 5 5 Q Q Q 1 U.V.V.V.V.V.W.W.W.W.W.W.W.W.W.W.W.W.g.- - : : : : X.Y. ",
-" A.Z.Q Q Q Q Q q.`. + + + + + + + + + + + + + + +.+- - : : : : X.O. ",
-" P.3 Q Q Q Q Q 4 ++@+@+@+@+@+@+@+@+@+@+@+@+@+#+- - : : : : $+%+ ",
-" h &+Q Q Q ( ( ( ; ; ; ; ; ; ; ; ; ; ; ; ; ; ~ : : : : *+=+ ",
-" t &+( ( ( ( ( ( ( ( _ _ _ _ _ _ _ _ _ : : : : : : *+F. ",
-" G -+( ( ( ( ( ( _ _ _ _ _ _ _ _ : : : : : : : ;+%+ ",
-" . >+'.'.'.'.2.2.2.2.2.2.2.2.o.o.o.o.o.o.2.,+'+ ",
-" )+=+!+!+!+!+!+!+!+!+!+!+!+!+!+!+!+!+!+~+{+ ",
-" ",
-" "};
diff --git a/gui/mplayer/pixmaps/stop2.xpm b/gui/mplayer/pixmaps/stop2.xpm
deleted file mode 100644
index cb017fec52..0000000000
--- a/gui/mplayer/pixmaps/stop2.xpm
+++ /dev/null
@@ -1,48 +0,0 @@
-/* XPM */
-static const char * const stop2_xpm[] = {
-"16 16 29 1",
-" c None",
-". c #000000",
-"+ c #FFFFFF",
-"@ c #737372",
-"# c #848483",
-"$ c #888887",
-"% c #7E7E7D",
-"& c #A8A7A6",
-"* c #A4A4A3",
-"= c #A6A5A4",
-"- c #B5B4B3",
-"; c #858483",
-"> c #AAA9A7",
-", c #C0BFBE",
-"' c #91908E",
-") c #AFAEAC",
-"! c #CACAC8",
-"~ c #A6A5A2",
-"{ c #BBBAB7",
-"] c #D4D3D2",
-"^ c #AEADA9",
-"/ c #BFBDBA",
-"( c #D7D5D3",
-"_ c #B2B0AD",
-": c #C3C1BE",
-"< c #D9D8D6",
-"[ c #B5B3B0",
-"} c #D1CFCC",
-"| c #DEDDDB",
-" ",
-" ",
-" .............+ ",
-" .@#$$$$$$$$$.+ ",
-" .%&*********.+ ",
-" .%=---------.+ ",
-" .;>,,,,,,,,,.+ ",
-" .')!!!!!!!!!.+ ",
-" .')!!!!!!!!!.+ ",
-" .~{]]]]]]]]].+ ",
-" .~{]]]]]]]]].+ ",
-" .^/(((((((((.+ ",
-" ._:<<<<<<<<<.+ ",
-" .[}|||||||||.+ ",
-" .............+ ",
-" +++++++++++++ "};
diff --git a/gui/mplayer/pixmaps/sub.xpm b/gui/mplayer/pixmaps/sub.xpm
deleted file mode 100644
index 5d79bdc2fd..0000000000
--- a/gui/mplayer/pixmaps/sub.xpm
+++ /dev/null
@@ -1,21 +0,0 @@
-/* XPM */
-static const char * const sub_xpm[] = {
-"16 16 2 1",
-" c None",
-". c #000000",
-" ",
-" ",
-" ",
-" ",
-" ... . . ... ",
-". . . . . ",
-". . . . . ",
-" .. . . ... ",
-" . . . . . ",
-" . . . . . ",
-"... ... ... ",
-" ",
-" ",
-" ",
-" ",
-" "};
diff --git a/gui/mplayer/pixmaps/title.xpm b/gui/mplayer/pixmaps/title.xpm
deleted file mode 100644
index 33b2b6c3eb..0000000000
--- a/gui/mplayer/pixmaps/title.xpm
+++ /dev/null
@@ -1,23 +0,0 @@
-/* XPM */
-static const char * const title_xpm[] = {
-"16 16 4 1",
-" c None",
-". c #000000",
-"+ c #CD0909",
-"@ c #FFFFFF",
-" .. ",
-" .++. ",
-".++++. ",
-".++++. . . ",
-" .++. .@. .@. ",
-" .. .@@@..@@@.",
-" .@. .@. ",
-" . . ",
-" .. ",
-" .++. ",
-".++++. ",
-".++++. . . ",
-" .++. .@. .@. ",
-" .. .@@@..@@@.",
-" .@. .@. ",
-" . . "};
diff --git a/gui/mplayer/pixmaps/tongue.xpm b/gui/mplayer/pixmaps/tongue.xpm
deleted file mode 100644
index aee4c4061b..0000000000
--- a/gui/mplayer/pixmaps/tongue.xpm
+++ /dev/null
@@ -1,169 +0,0 @@
-/* XPM */
-static const char * const tongue_xpm[] = {
-"16 16 150 2",
-" c None",
-". c #FC151B",
-"+ c #F31C35",
-"@ c #FD4344",
-"# c #FA8C99",
-"$ c #E9080F",
-"% c #DDAFA4",
-"& c #FDD8E0",
-"* c #F33A41",
-"= c #F00807",
-"- c #E6DFE0",
-"; c #ECF6F4",
-"> c #E0081D",
-", c #F10705",
-"' c #E4080E",
-") c #EE0512",
-"! c #F80C0B",
-"~ c #F70D0A",
-"{ c #EF1510",
-"] c #E60F0D",
-"^ c #DC4248",
-"/ c #E9383B",
-"( c #E91E18",
-"_ c #F48D94",
-": c #F3E2DA",
-"< c #E92B32",
-"[ c #EE0B15",
-"} c #F1726F",
-"| c #FC7680",
-"1 c #EE0409",
-"2 c #F10306",
-"3 c #DE5154",
-"4 c #7F0401",
-"5 c #170009",
-"6 c #535455",
-"7 c #DCD4D3",
-"8 c #F4F9F7",
-"9 c #EBEBEA",
-"0 c #EFFEFF",
-"a c #FEF1FA",
-"b c #F5CBCB",
-"c c #F4090A",
-"d c #E91F21",
-"e c #FEA7AB",
-"f c #EA0314",
-"g c #0A0203",
-"h c #430002",
-"i c #CC090F",
-"j c #F30407",
-"k c #390414",
-"l c #110501",
-"m c #4D3F3F",
-"n c #D60D16",
-"o c #E74746",
-"p c #850702",
-"q c #E60304",
-"r c #DC090B",
-"s c #E91B29",
-"t c #BD070E",
-"u c #FA0202",
-"v c #F76364",
-"w c #B90601",
-"x c #DA0307",
-"y c #FE060E",
-"z c #F30F09",
-"A c #F12F34",
-"B c #F80409",
-"C c #A90405",
-"D c #FD020B",
-"E c #FABDB8",
-"F c #E90700",
-"G c #F6A9A6",
-"H c #C71C09",
-"I c #CA0819",
-"J c #F80C06",
-"K c #EF0A13",
-"L c #FA8786",
-"M c #E62B35",
-"N c #C20502",
-"O c #FA0C12",
-"P c #E50100",
-"Q c #E8323C",
-"R c #F4B3A8",
-"S c #7F0C03",
-"T c #EF0908",
-"U c #F50111",
-"V c #F7192A",
-"W c #F8AAA5",
-"X c #DB0F11",
-"Y c #F71514",
-"Z c #DA6D61",
-"` c #EF887F",
-" . c #EE0704",
-".. c #EDFCF3",
-"+. c #F60212",
-"@. c #EB0307",
-"#. c #E9070B",
-"$. c #E70E0B",
-"%. c #F9DDD9",
-"&. c #F6060E",
-"*. c #B10A0E",
-"=. c #F00A09",
-"-. c #DE0600",
-";. c #F31113",
-">. c #FDDFE2",
-",. c #DC0909",
-"'. c #F10B12",
-"). c #F90306",
-"!. c #F9181F",
-"~. c #FCD0D1",
-"{. c #A9040F",
-"]. c #EA4754",
-"^. c #FA0908",
-"/. c #F41821",
-"(. c #FA757B",
-"_. c #F10905",
-":. c #EE090F",
-"<. c #ED0D06",
-"[. c #F7B7B3",
-"}. c #F76869",
-"|. c #850405",
-"1. c #F80A07",
-"2. c #EC0000",
-"3. c #F6090B",
-"4. c #F10208",
-"5. c #EE080A",
-"6. c #E90A0B",
-"7. c #E82322",
-"8. c #FBFAF8",
-"9. c #E10B0B",
-"0. c #D80507",
-"a. c #E58874",
-"b. c #E94149",
-"c. c #ED0A04",
-"d. c #EC0609",
-"e. c #F8070B",
-"f. c #F50A0E",
-"g. c #DD423D",
-"h. c #F47671",
-"i. c #7C302B",
-"j. c #E41D24",
-"k. c #F80C08",
-"l. c #EE0A0E",
-"m. c #ED070A",
-"n. c #FA050E",
-"o. c #A52B2E",
-"p. c #E96D74",
-"q. c #FB0015",
-"r. c #F40517",
-"s. c #B6787D",
-" . + @ # ",
-" $ % & * = - ; ",
-" > , ' ) ! ~ { ] ^ ",
-" / ( _ : < [ } | 1 2 ",
-" 3 4 5 6 7 8 9 0 a b c d ",
-" e f g h i j k l m n o p q r ",
-" s t u v w x y z A B C D ",
-" E F G H I J K L M N O ",
-" P Q R S T U V W X Y Z ",
-" ` ...+.@.#.$.%.&.*.=. ",
-" -.;.>.,.'.).!.~.{.&.]. ",
-" ^./.(._.:.<.[.}.|.1. ",
-" 2.3.4.5.6.7.8.9.0.a. ",
-" b.c.d.e.f.g.h.i. ",
-" j.k.l.m.n.o. ",
-" p.q.r.s. "};
diff --git a/gui/mplayer/pixmaps/tonguebla.xpm b/gui/mplayer/pixmaps/tonguebla.xpm
deleted file mode 100644
index 1e385cc7e0..0000000000
--- a/gui/mplayer/pixmaps/tonguebla.xpm
+++ /dev/null
@@ -1,156 +0,0 @@
-/* XPM */
-static const char * const tonguebla_xpm[] = {
-"16 16 137 2",
-" c None",
-". c #FC151B",
-"+ c #F31C35",
-"@ c #FD4344",
-"# c #FA8C99",
-"$ c #E9080F",
-"% c #DDAFA4",
-"& c #FDD8E0",
-"* c #F33A41",
-"= c #F00807",
-"- c #E6DFE0",
-"; c #ECF6F4",
-"> c #E0081D",
-", c #F10705",
-"' c #E4080E",
-") c #EE0512",
-"! c #F80C0B",
-"~ c #F70D0A",
-"{ c #EF1510",
-"] c #E60F0D",
-"^ c #DC4248",
-"/ c #E9383B",
-"( c #E91E18",
-"_ c #F48D94",
-": c #F3E2DA",
-"< c #E92B32",
-"[ c #EE0B15",
-"} c #F1726F",
-"| c #FC7680",
-"1 c #EE0409",
-"2 c #F10306",
-"3 c #DE5154",
-"4 c #7F0401",
-"5 c #170009",
-"6 c #535455",
-"7 c #DCD4D3",
-"8 c #F4F9F7",
-"9 c #EBEBEA",
-"0 c #EFFEFF",
-"a c #FEF1FA",
-"b c #F5CBCB",
-"c c #F4090A",
-"d c #E91F21",
-"e c #FEA7AB",
-"f c #EA0314",
-"g c #0A0203",
-"h c #430002",
-"i c #CC090F",
-"j c #F30407",
-"k c #390414",
-"l c #110501",
-"m c #4D3F3F",
-"n c #D60D16",
-"o c #E74746",
-"p c #850702",
-"q c #E60304",
-"r c #DC090B",
-"s c #E91B29",
-"t c #BD070E",
-"u c #FA0202",
-"v c #F76364",
-"w c #B90601",
-"x c #DA0307",
-"y c #FE060E",
-"z c #F30F09",
-"A c #F12F34",
-"B c #F80409",
-"C c #A90405",
-"D c #FD020B",
-"E c #FABDB8",
-"F c #E90700",
-"G c #F6A9A6",
-"H c #C71C09",
-"I c #CA0819",
-"J c #F80C06",
-"K c #EF0A13",
-"L c #FA8786",
-"M c #E62B35",
-"N c #C20502",
-"O c #FA0C12",
-"P c #E50100",
-"Q c #E8323C",
-"R c #F4B3A8",
-"S c #7F0C03",
-"T c #EF0908",
-"U c #F50111",
-"V c #F7192A",
-"W c #F8AAA5",
-"X c #DB0F11",
-"Y c #F71514",
-"Z c #DA6D61",
-"` c #EF887F",
-" . c #EE0704",
-".. c #EDFCF3",
-"+. c #F60212",
-"@. c #EB0307",
-"#. c #E9070B",
-"$. c #E70E0B",
-"%. c #F9DDD9",
-"&. c #F6060E",
-"*. c #B10A0E",
-"=. c #F00A09",
-"-. c #DE0600",
-";. c #F31113",
-">. c #FDDFE2",
-",. c #DC0909",
-"'. c #F10B12",
-"). c #F90306",
-"!. c #F9181F",
-"~. c #FCD0D1",
-"{. c #A9040F",
-"]. c #EA4754",
-"^. c #FA0908",
-"/. c #F41821",
-"(. c #000000",
-"_. c #EE090F",
-":. c #ED0D06",
-"<. c #F76869",
-"[. c #850405",
-"}. c #F80A07",
-"|. c #EC0000",
-"1. c #F6090B",
-"2. c #EE080A",
-"3. c #E82322",
-"4. c #E10B0B",
-"5. c #D80507",
-"6. c #E58874",
-"7. c #E94149",
-"8. c #ED0A04",
-"9. c #F50A0E",
-"0. c #DD423D",
-"a. c #7C302B",
-"b. c #E41D24",
-"c. c #EE0A0E",
-"d. c #FA050E",
-"e. c #F40517",
-"f. c #B6787D",
-" . + @ # ",
-" $ % & * = - ; ",
-" > , ' ) ! ~ { ] ^ ",
-" / ( _ : < [ } | 1 2 ",
-" 3 4 5 6 7 8 9 0 a b c d ",
-" e f g h i j k l m n o p q r ",
-" s t u v w x y z A B C D ",
-" E F G H I J K L M N O ",
-" P Q R S T U V W X Y Z ",
-" ` ...+.@.#.$.%.&.*.=. ",
-" -.;.>.,.'.).!.~.{.&.]. ",
-" ^./.(.(._.:.(.<.[.}. (. ",
-" |.1.(.2.(.3.(.4.5.6.(. (. ",
-" 7.8.(.(.9.0.(.a. (. (. ",
-" b.(.c.(.d.(. (.(.(. ",
-" (.(.e.f.(.(.(. (. (. "};
diff --git a/gui/mplayer/pixmaps/up.xpm b/gui/mplayer/pixmaps/up.xpm
deleted file mode 100644
index e18de7a973..0000000000
--- a/gui/mplayer/pixmaps/up.xpm
+++ /dev/null
@@ -1,112 +0,0 @@
-/* XPM */
-static const char * const up_xpm[] = {
-"16 16 93 2",
-" c None",
-". c #000000",
-"+ c #BDCCCD",
-"@ c #B6C6C8",
-"# c #8F9DA8",
-"$ c #9FB6C5",
-"% c #90AEB9",
-"& c #83A0A9",
-"* c #6E8E9D",
-"= c #83ABC2",
-"- c #99BBD4",
-"; c #8EB5D3",
-"> c #75A6CC",
-", c #6FA5C9",
-"' c #86A9BE",
-") c #87ACBB",
-"! c #82A4B0",
-"~ c #89A6B2",
-"{ c #BFD7E5",
-"] c #DDEDFB",
-"^ c #DEEEFC",
-"/ c #CCE5F5",
-"( c #B4D9ED",
-"_ c #84BEE6",
-": c #9DBBCD",
-"< c #E6F0F3",
-"[ c #EEF5F9",
-"} c #F1F7F8",
-"| c #F8FAF9",
-"1 c #FBFBFB",
-"2 c #FAFBFC",
-"3 c #DDEDF7",
-"4 c #B8DAEF",
-"5 c #7DB8E2",
-"6 c #9AB9CB",
-"7 c #EEF6F5",
-"8 c #FAFCFD",
-"9 c #F8FBFB",
-"0 c #F5F9F7",
-"a c #F4F7F7",
-"b c #F3F7F8",
-"c c #D0E6F3",
-"d c #A7D1EC",
-"e c #6BACDE",
-"f c #9CB8CC",
-"g c #EBF2F2",
-"h c #F3F7F7",
-"i c #EFF5F6",
-"j c #ECF3F2",
-"k c #E9F1F2",
-"l c #E7F1F4",
-"m c #BFDCEC",
-"n c #94C4E5",
-"o c #599ED6",
-"p c #98B4CA",
-"q c #D9E6E9",
-"r c #DEEBEB",
-"s c #DCEAEB",
-"t c #DAE8E9",
-"u c #D8E8E8",
-"v c #D7E6EA",
-"w c #A9CDE2",
-"x c #7AB2D9",
-"y c #448ECC",
-"z c #8EB0C6",
-"A c #BCD7DA",
-"B c #C4DDDC",
-"C c #C5DDDE",
-"D c #C5DDDD",
-"E c #C7DEDF",
-"F c #C6DCE0",
-"G c #94BFD7",
-"H c #62A3CB",
-"I c #3381C0",
-"J c #8AABC4",
-"K c #99BFC6",
-"L c #A0C4CA",
-"M c #A2C5CB",
-"N c #A4C7CC",
-"O c #A9CAD0",
-"P c #A9C8D1",
-"Q c #7AACC7",
-"R c #4D91BC",
-"S c #2573B1",
-"T c #2B688D",
-"U c #29648E",
-"V c #2A6590",
-"W c #2B6592",
-"X c #2C6893",
-"Y c #2D6594",
-"Z c #205A91",
-"` c #145190",
-" . c #084A8D",
-" . ",
-" . . ",
-" . . . . . . ",
-" . . . ",
-" . . ",
-" + @ # # ",
-" $ % & * = - ; > , ",
-" ' ) ! ~ { ] ^ / ( _ ",
-" : < [ } | 1 2 3 4 5 ",
-" 6 7 8 9 0 a b c d e ",
-" f g h i j k l m n o ",
-" p q r s t u v w x y ",
-" z A B C D E F G H I ",
-" J K L M N O P Q R S ",
-" T U V W X Y Z ` . ",
-" "};
diff --git a/gui/mplayer/pixmaps/url.xpm b/gui/mplayer/pixmaps/url.xpm
deleted file mode 100644
index 939261c341..0000000000
--- a/gui/mplayer/pixmaps/url.xpm
+++ /dev/null
@@ -1,21 +0,0 @@
-/* XPM */
-static const char * const url_xpm[] = {
-"16 16 2 1",
-" c None",
-". c #000000",
-" ",
-" ",
-" ",
-" ",
-" .. .. .. ",
-" .. .. .. ",
-" .. .. ",
-" .. .. ",
-" .. .. ",
-" .. .. ",
-" .. .. .. ",
-" .. .. .. ",
-" ",
-" ",
-" ",
-" "};
diff --git a/gui/mplayer/pixmaps/vcd.xpm b/gui/mplayer/pixmaps/vcd.xpm
deleted file mode 100644
index 3ce8c3e3c8..0000000000
--- a/gui/mplayer/pixmaps/vcd.xpm
+++ /dev/null
@@ -1,179 +0,0 @@
-/* XPM */
-static const char * const vcd_xpm[] = {
-"16 16 160 2",
-" c None",
-". c #CC9665",
-"+ c #E1C0A3",
-"@ c #EAD1BD",
-"# c #E9D2BB",
-"$ c #D7B597",
-"% c #9D7C5C",
-"& c #CE9E71",
-"* c #F6E9DE",
-"= c #FEF5EE",
-"- c #FFFAF6",
-"; c #FFFBF7",
-"> c #FDF9F5",
-", c #F2EBDD",
-"' c #FBF5E4",
-") c #F3E6D5",
-"! c #B19D8A",
-"~ c #D9AE89",
-"{ c #FFEFE3",
-"] c #FFF7F0",
-"^ c #FFF6EE",
-"/ c #FFF7EF",
-"( c #FFF6EB",
-"_ c #FFF1DD",
-": c #FFF6E3",
-"< c #FFFCE9",
-"[ c #FFFFF9",
-"} c #FFFFFA",
-"| c #BEA98F",
-"1 c #C08F68",
-"2 c #FFD5B2",
-"3 c #FFCAA8",
-"4 c #FFE2CC",
-"5 c #FFF3E9",
-"6 c #FFF4E9",
-"7 c #FFF3E1",
-"8 c #FFF0D0",
-"9 c #FFF9D9",
-"0 c #FFFEE7",
-"a c #FFFFF8",
-"b c #FFF8DA",
-"c c #B8A685",
-"d c #F2B788",
-"e c #FFB886",
-"f c #FFBD8B",
-"g c #FFCA9B",
-"h c #FFE7CF",
-"i c #FFF6EA",
-"j c #FFF4DB",
-"k c #FFF7CA",
-"l c #FFFFE1",
-"m c #FFFFF6",
-"n c #FFFBEE",
-"o c #FFF3D4",
-"p c #FFF3BB",
-"q c #DDC18E",
-"r c #805A34",
-"s c #FDB070",
-"t c #FFAD6E",
-"u c #FFBA7D",
-"v c #FFC78B",
-"w c #FFDAA3",
-"x c #FFEAC8",
-"y c #FFF6C9",
-"z c #FFF8C4",
-"A c #FFF8E8",
-"B c #FFFAEB",
-"C c #FFF0C7",
-"D c #FFE8A8",
-"E c #FFE188",
-"F c #FFDC86",
-"G c #B57841",
-"H c #FFA656",
-"I c #FFAC5F",
-"J c #FFBC73",
-"K c #FFCE89",
-"L c #FFDA91",
-"M c #FFE194",
-"N c #B2A177",
-"O c #C0B095",
-"P c #FFE6BB",
-"Q c #FFE9B3",
-"R c #FFD76C",
-"S c #FFCC3D",
-"T c #ECBB2F",
-"U c #966F30",
-"V c #BC7D42",
-"W c #FFAA52",
-"X c #FFAF57",
-"Y c #FFC673",
-"Z c #FFDE8E",
-"` c #FFE58D",
-" . c #FCE5A0",
-".. c #FFDA8B",
-"+. c #FFD673",
-"@. c #FFBA00",
-"#. c #FEC417",
-"$. c #A77D2E",
-"%. c #A7713B",
-"&. c #FFBF69",
-"*. c #FFC570",
-"=. c #FFDB87",
-"-. c #FFF3A1",
-";. c #FFF9BF",
-">. c #FFE4BA",
-",. c #DFC19C",
-"'. c #ECC48A",
-"). c #FFCA5D",
-"!. c #FFCC45",
-"~. c #FEC21C",
-"{. c #A57927",
-"]. c #FFCF7C",
-"^. c #FFDE8B",
-"/. c #FFFFCB",
-"(. c #FFFFF4",
-"_. c #FFECC6",
-":. c #FFE4AA",
-"<. c #FFE8BA",
-"[. c #FFC21D",
-"}. c #B58726",
-"|. c #E5BC73",
-"1. c #FFFAA9",
-"2. c #FFFFCD",
-"3. c #FFFEF1",
-"4. c #FFF3D3",
-"5. c #FFE69F",
-"6. c #FFE9AB",
-"7. c #FFF0C5",
-"8. c #FFEBB4",
-"9. c #FFD465",
-"0. c #A98E59",
-"a. c #FFF1B6",
-"b. c #FFE59F",
-"c. c #FFD86C",
-"d. c #FFE08B",
-"e. c #FFEAB1",
-"f. c #FFE5A3",
-"g. c #FFE7AB",
-"h. c #CCB396",
-"i. c #FFE5B4",
-"j. c #FFECA5",
-"k. c #FFDB70",
-"l. c #FFCB3B",
-"m. c #FFD871",
-"n. c #FFE8AB",
-"o. c #FFE6A4",
-"p. c #FFE9AA",
-"q. c #C1A46F",
-"r. c #EABC6D",
-"s. c #FFC924",
-"t. c #FFDC6A",
-"u. c #FFEFAD",
-"v. c #FFEAA1",
-"w. c #FFDA8E",
-"x. c #A97B28",
-"y. c #C08D27",
-"z. c #C99C47",
-"A. c #CEA762",
-"B. c #C09A5A",
-"C. c #855F2F",
-" . + @ # $ % ",
-" & * = - ; > , ' ) ! ",
-" ~ { ] ^ / ( _ : < [ } | ",
-" 1 2 3 4 5 6 7 8 9 0 a } b c ",
-" d e f g h i j k l m n o p q ",
-"r s t u v w x y z A B C D E F ",
-"G H I J K L M N O P Q D R S T U ",
-"V W X Y Z ` . ..+.R @.@.#.$.",
-"%.&.*.=.-.;.>.,.'.).!.!.R ~.~.{.",
-" ].^.-./.(._.:.<.^.[.!.!.R }. ",
-" |.1.2.3.4.5.6.7.8.9.).!.!.R ",
-" 0.a.[ 4.b.c.d.e.f.g.9.).!. ",
-" h.i.j.k.l.m.n.o.p.p.9. ",
-" q.r.!.s.t.u.v.w.p.p. ",
-" x.y.z.A.B.C. ",
-" "};
diff --git a/gui/mplayer/pixmaps/warning.xpm b/gui/mplayer/pixmaps/warning.xpm
deleted file mode 100644
index d2a45ed1f6..0000000000
--- a/gui/mplayer/pixmaps/warning.xpm
+++ /dev/null
@@ -1,314 +0,0 @@
-/* XPM */
-static const char * const warning_xpm[] = {
-"48 48 263 2",
-" c None",
-". c #6D0000",
-"+ c #700000",
-"@ c #6F0000",
-"# c #6C0000",
-"$ c #610000",
-"% c #4F0000",
-"& c #660000",
-"* c #5C0000",
-"= c #6E0000",
-"- c #6B0000",
-"; c #650000",
-"> c #6A0000",
-", c #5D0000",
-"' c #680000",
-") c #5E0000",
-"! c #681414",
-"~ c #834F4F",
-"{ c #987979",
-"] c #A28181",
-"^ c #934949",
-"/ c #710202",
-"( c #690000",
-"_ c #600000",
-": c #640000",
-"< c #611212",
-"[ c #8D6464",
-"} c #C1C1C1",
-"| c #D3D3D3",
-"1 c #DFDFDF",
-"2 c #E0E0E0",
-"3 c #D3C6C6",
-"4 c #A76E6E",
-"5 c #811F1F",
-"6 c #750909",
-"7 c #7B4B4B",
-"8 c #D9D9D9",
-"9 c #E1E1E1",
-"0 c #D7CBCB",
-"a c #994F4F",
-"b c #7E1919",
-"c c #5F0000",
-"d c #9C8888",
-"e c #CDCDCD",
-"f c #E2E2E2",
-"g c #A26060",
-"h c #812020",
-"i c #720505",
-"j c #530000",
-"k c #641313",
-"l c #ACA3A3",
-"m c #DBDBDB",
-"n c #E3E3E3",
-"o c #C3A2A2",
-"p c #7F1B1B",
-"q c #661414",
-"r c #ABA1A1",
-"s c #D4D4D4",
-"t c #E4E4E4",
-"u c #AE7878",
-"v c #791111",
-"w c #620000",
-"x c #927575",
-"y c #E5E5E5",
-"z c #A76868",
-"A c #740808",
-"B c #8C6565",
-"C c #CCCCCC",
-"D c #E6E6E6",
-"E c #7E7E7E",
-"F c #4C4C4C",
-"G c #464646",
-"H c #797979",
-"I c #E7E7E7",
-"J c #DBD0D0",
-"K c #903B3B",
-"L c #510000",
-"M c #670000",
-"N c #722929",
-"O c #C0C0C0",
-"P c #757575",
-"Q c #686868",
-"R c #505050",
-"S c #282828",
-"T c #090909",
-"U c #676767",
-"V c #E8E8E8",
-"W c #D1BBBB",
-"X c #801E1E",
-"Y c #700101",
-"Z c #B3A8A8",
-"` c #D5D5D5",
-" . c #4D4D4D",
-".. c #545454",
-"+. c #101010",
-"@. c #000000",
-"#. c #E9E9E9",
-"$. c #B07A7A",
-"%. c #7A1313",
-"&. c #875454",
-"*. c #5E5E5E",
-"=. c #323232",
-"-. c #EAEAEA",
-";. c #EBEBEB",
-">. c #8F3939",
-",. c #720404",
-"'. c #691515",
-"). c #C8C8C8",
-"!. c #5F5F5F",
-"~. c #2A2A2A",
-"{. c #D1D1D1",
-"]. c #D3BDBD",
-"^. c #5B0000",
-"/. c #976C6C",
-"(. c #D2D2D2",
-"_. c #EDEDED",
-":. c #565656",
-"<. c #202020",
-"[. c #ECECEC",
-"}. c #994C4C",
-"|. c #7B1414",
-"1. c #C7C7C7",
-"2. c #5C5C5C",
-"3. c #D3BBBB",
-"4. c #5A0000",
-"5. c #926969",
-"6. c #EEEEEE",
-"7. c #858585",
-"8. c #2C2C2C",
-"9. c #353535",
-"0. c #9C5252",
-"a. c #730707",
-"b. c #681515",
-"c. c #C4C4C4",
-"d. c #EFEFEF",
-"e. c #989898",
-"f. c #4E4E4E",
-"g. c #010101",
-"h. c #6A6A6A",
-"i. c #D6BFBF",
-"j. c #540000",
-"k. c #630000",
-"l. c #895656",
-"m. c #F0F0F0",
-"n. c #C5C5C5",
-"o. c #585858",
-"p. c #191919",
-"q. c #BBBBBB",
-"r. c #9D5353",
-"s. c #B8ADAD",
-"t. c #F1F1F1",
-"u. c #F2F2F2",
-"v. c #1B1B1B",
-"w. c #CAA8A8",
-"x. c #801D1D",
-"y. c #3D0000",
-"z. c #7A2D2D",
-"A. c #CECECE",
-"B. c #292929",
-"C. c #060606",
-"D. c #868686",
-"E. c #842525",
-"F. c #760B0B",
-"G. c #996F6F",
-"H. c #D6D6D6",
-"I. c #F3F3F3",
-"J. c #575757",
-"K. c #535353",
-"L. c #A45F5F",
-"M. c #C3B8B8",
-"N. c #F4F4F4",
-"O. c #F5F5F5",
-"P. c #C8A3A3",
-"Q. c #3C0000",
-"R. c #6A1515",
-"S. c #F6F6F6",
-"T. c #410000",
-"U. c #7F4242",
-"V. c #CFCFCF",
-"W. c #707070",
-"X. c #434343",
-"Y. c #515151",
-"Z. c #F7F7F7",
-"`. c #A56161",
-" + c #7C1717",
-".+ c #4E0000",
-"++ c #946C6C",
-"@+ c #1A1A1A",
-"#+ c #0C0C0C",
-"$+ c #3B3B3B",
-"%+ c #F8F8F8",
-"&+ c #B17676",
-"*+ c #4C0000",
-"=+ c #A58787",
-"-+ c #2D2D2D",
-";+ c #F9F9F9",
-">+ c #CCA9A9",
-",+ c #580000",
-"'+ c #8A5858",
-")+ c #494949",
-"!+ c #131313",
-"~+ c #FAFAFA",
-"{+ c #CDA9A9",
-"]+ c #832222",
-"^+ c #6C2929",
-"/+ c #3C3C3C",
-"(+ c #FBFBFB",
-"_+ c #822121",
-":+ c #560000",
-"<+ c #B5A0A0",
-"[+ c #FCFCFC",
-"}+ c #903A3A",
-"|+ c #4A0000",
-"1+ c #AA7D7D",
-"2+ c #FDFDFD",
-"3+ c #DEC7C7",
-"4+ c #9F5555",
-"5+ c #7D1818",
-"6+ c #3E0000",
-"7+ c #AE7070",
-"8+ c #ECE0E0",
-"9+ c #FEFEFE",
-"0+ c #CEA9A9",
-"a+ c #994949",
-"b+ c #862828",
-"c+ c #770D0D",
-"d+ c #170000",
-"e+ c #8F3737",
-"f+ c #BE8D8D",
-"g+ c #DFC8C8",
-"h+ c #FFFFFF",
-"i+ c #EEE2E2",
-"j+ c #D1AEAE",
-"k+ c #A66363",
-"l+ c #852626",
-"m+ c #310000",
-"n+ c #710303",
-"o+ c #7C1616",
-"p+ c #832323",
-"q+ c #9E5353",
-"r+ c #AC6D6D",
-"s+ c #C59999",
-"t+ c #D3B2B2",
-"u+ c #D2B1B1",
-"v+ c #EFE4E4",
-"w+ c #A76464",
-"x+ c #A86666",
-"y+ c #320000",
-"z+ c #520000",
-"A+ c #730606",
-"B+ c #780F0F",
-"C+ c #7B1515",
-"D+ c #7A1212",
-"E+ c #250000",
-"F+ c #450000",
-"G+ c #260000",
-"H+ c #290000",
-"I+ c #340000",
-"J+ c #280000",
-"K+ c #370000",
-"L+ c #590000",
-"M+ c #4D0000",
-"N+ c #360000",
-" ",
-" ",
-" ",
-" . + + + @ # ",
-" # + + + + + + + + + $ % ",
-" + + + + + + + + + + + @ & * ",
-" = + + + + - ; & # + + + + + + > , ",
-" @ + + + + ' ) ! ~ { ] ^ + / + + + ( ) _ ",
-" @ + + + @ : < [ } | 1 2 2 3 4 5 6 + + ' ) _ ",
-" @ + + + > * 7 } 8 9 9 9 9 9 9 9 0 a b / + ' ) c ",
-" @ + + + > < d e 2 f f f f f f f f f f g h i + ' c j ",
-" # + + + > k l m n n n n n n n n n n n n n o p + + ' _ ",
-" - + + + # q r s t t t t t t t t t t t t t t t u v + + w c ",
-" + + + @ _ x | y y y y y y y y y y y y y y y y y z A + . c w ",
-" @ + + + w B C D D D D D D D E F G H D D D D D D I J K i + > ) L ",
-" + + + M N O 2 I I I I I I P Q R S T U I I I V V V V W X Y + & w ",
-" + + + . , Z ` V V V V V V V ...+.@.@.@.V #.#.#.#.#.#.#.$.%.+ + _ c ",
-" ( + + + _ &.e #.#.#.#.#.#.#.#.*.=.@.@.@.@.-.-.-.-.-.-.-.-.;.>.,.+ M $ ",
-" + + + ( '.).n -.-.-.-.-.-.-.s !.~.@.@.@.@.{.;.;.;.;.;.;.;.;.].h Y @ _ ^. ",
-" ( + + + $ /.(.;.;.;.;.;.;.;.;._.:.<.@.@.@.@.[.[.[.[.[.[.[.[.[.[.}.|.+ > c ",
-" + + + # ! 1.y [.[.[.[.[.[.[.[._.2.<.@.@.@.@._._._._._._._._._._.3.5 + + w 4. ",
-" + + + ; 5.` _._._._._._._._.6.6.7.8.@.@.@.9.6.6.6.6.6.6.6.6.6.6.6.0.a.+ - ) ",
-" = + + # b.c.#.6.6.6.6.6.6.d.d.d.d.e.f.g.@.@.h.d.d.d.d.d.d.d.d.d.d.d.i.p + + $ j. ",
-" + + + k.l.{.d.d.d.d.d.m.m.m.m.m.m.n.o.p.@.@.q.m.m.m.m.m.m.m.m.m.m.m.m.r.a.+ - c ",
-" ' + + . ) s.t m.m.m.t.t.t.t.t.t.t.t.u. .<.@.v.t.t.t.t.t.t.t.t.t.t.t.t.t.w.x.+ + $ y. ",
-" = + + ' z.A.t.t.t.u.u.u.u.u.u.u.u.u.u.e.B.C.D.u.u.u.u.u.u.u.u.u.u.u.u.u.u.E.F.+ ; j ",
-" + + + $ G.H.u.I.I.I.I.I.I.I.I.I.I.I.I.I.J.K.I.I.I.I.I.I.I.I.I.I.I.I.I.I.I.L.5 + - _ ",
-" + + . c M.#.N.N.N.N.N.N.N.N.N.N.N.N.N.N.N.N.N.N.N.N.N.N.N.N.N.N.N.N.N.O.O.P.E./ + _ Q. ",
-" & + + ( R.(.O.O.O.O.O.O.O.O.O.O.O.O.O.O.O.O.O.O.O.O.O.O.O.O.O.O.O.O.S.S.S.S.S.x.%.+ & T. ",
-" ( + + ; U.1 S.S.S.S.S.S.S.S.S.S.S.S.S.V.W.X.Y.C S.S.S.S.S.S.S.S.Z.Z.Z.Z.Z.Z.Z.`. ++ > .+ ",
-" ' + + ; ++6.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.Z.U .@+#+$+Z.Z.Z.Z.Z.Z.%+%+%+%+%+%+%+%+%+&+b + # *+ ",
-" M + + $ =+Z.%+%+%+%+%+%+%+%+%+%+%+%+%+-+p.@.@.@.%+%+%+%+%+;+;+;+;+;+;+;+;+;+;+>+5 + @ ,+ ",
-" & + + $ '+;+;+;+;+;+;+;+;+;+;+;+;+;+;+)+!+@.@.$+;+;+;+~+~+~+~+~+~+~+~+~+~+~+~+{+]++ + $ ",
-" & + + ; ^+O.~+~+~+~+~+~+~+~+~+~+~+~+~+V./+@.$+V.~+(+(+(+(+(+(+(+(+(+(+(+(+(+(+&+_++ + j ",
-" * + + = :+<+~+(+(+(+(+(+(+(+(+(+(+(+(+(+(+(+(+[+[+[+[+[+[+[+[+[+[+[+[+[+[+[+[+}+%.+ > |+ ",
-" + + + ' j 1+[+[+[+[+[+[+[+[+[+[+[+[+[+[+2+2+2+2+2+2+2+2+2+2+2+2+2+2+2+2+3+4+5++ + w 6+ ",
-" M + + + = = p 7+8+2+2+2+2+2+2+2+2+2+9+9+9+9+9+9+9+9+9+9+9+9+9+9+9+9+0+a+b+c++ + # ) d+ ",
-" > + + + + + + + e+f+g+9+9+9+9+h+h+h+h+h+h+h+h+h+h+h+h+h+h+i+j+k+X l+X 6 + + ' , m+ ",
-" > + + + + + + + n+o+p+q+r+s+t+u+v+h+h+h+h+h+u+u+u+w+x+]+p+_+ +|./ + @ # _ c y+ ",
-" z++ + + + + + + + + + A+B+5+C+C+C+C+C+C+C+C+C+C+ +D+A Y + + + # ; c $ j.E+ ",
-" F+( + + + + + + + + + + + + + + + + + + + + + + @ # ' ; _ $ k.z+G+@. ",
-" H+% _ + + + + + + + + + + + + + = # > & ; ; c _ k.c z+I+@. ",
-" J+K+.+% |+L+$ $ $ $ $ $ c $ $ M+M+% y+N+@.@. ",
-" @.@.@.@.@.@.@.@.@. ",
-" ",
-" ",
-" ",
-" "};
diff --git a/gui/mplayer/play.c b/gui/mplayer/play.c
deleted file mode 100644
index b398f9f901..0000000000
--- a/gui/mplayer/play.c
+++ /dev/null
@@ -1,387 +0,0 @@
-/*
- * 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.
- */
-
-#include <inttypes.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-
-#include <unistd.h>
-#include <signal.h>
-
-#include "config.h"
-#include "help_mp.h"
-#include "libvo/x11_common.h"
-#include "libvo/video_out.h"
-#include "input/input.h"
-
-#include "gui/wm/ws.h"
-#include "gui/wm/wsxdnd.h"
-
-#include "gui/app.h"
-#include "gui/wm/wskeys.h"
-#include "gui/interface.h"
-
-#include "widgets.h"
-#include "gmplayer.h"
-#include "play.h"
-
-#include "gui/skin/skin.h"
-#include "gui/skin/font.h"
-
-#include "stream/stream.h"
-
-extern float rel_seek_secs;
-extern int abs_seek_pos;
-
-int mplGotoTheNext = 1;
-
-void mplFullScreen( void )
-{
- if ( guiIntfStruct.NoWindow && guiIntfStruct.Playing ) return;
-
- if ( ( guiIntfStruct.Playing )&&( appMPlayer.subWindow.isFullScreen ) )
- {
- appMPlayer.subWindow.OldWidth=guiIntfStruct.MovieWidth; appMPlayer.subWindow.OldHeight=guiIntfStruct.MovieHeight;
- switch ( appMPlayer.sub.x )
- {
- case -1: appMPlayer.subWindow.OldX=( wsMaxX / 2 ) - ( appMPlayer.subWindow.OldWidth / 2 ) + wsOrgX; break;
- case -2: appMPlayer.subWindow.OldX=wsMaxX - appMPlayer.subWindow.OldWidth + wsOrgX; break;
- default: appMPlayer.subWindow.OldX=appMPlayer.sub.x; break;
- }
- switch ( appMPlayer.sub.y )
- {
- case -1: appMPlayer.subWindow.OldY=( wsMaxY / 2 ) - ( appMPlayer.subWindow.OldHeight / 2 ) + wsOrgY; break;
- case -2: appMPlayer.subWindow.OldY=wsMaxY - appMPlayer.subWindow.OldHeight + wsOrgY; break;
- default: appMPlayer.subWindow.OldY=appMPlayer.sub.y; break;
- }
- }
- if ( guiIntfStruct.Playing || gtkShowVideoWindow ) wsFullScreen( &appMPlayer.subWindow );
- fullscreen=vo_fs=appMPlayer.subWindow.isFullScreen;
- wsSetLayer( wsDisplay,appMPlayer.mainWindow.WindowID,appMPlayer.subWindow.isFullScreen );
- if ( appMPlayer.menuIsPresent ) wsSetLayer( wsDisplay,appMPlayer.menuWindow.WindowID,appMPlayer.subWindow.isFullScreen );
-
- if ( guiIntfStruct.Playing ) wsSetBackgroundRGB( &appMPlayer.subWindow,0,0,0 );
- else wsSetBackgroundRGB( &appMPlayer.subWindow,appMPlayer.sub.R,appMPlayer.sub.G,appMPlayer.sub.B );
-}
-
-void mplEnd( void )
-{
- plItem * next;
-
- if ( !mplGotoTheNext && guiIntfStruct.Playing) { mplGotoTheNext=1; return; }
-
- if ( guiIntfStruct.Playing && (next=gtkSet( gtkGetNextPlItem,0,NULL )) && plLastPlayed != next )
- {
- plLastPlayed=next;
- guiSetDF( guiIntfStruct.Filename,next->path,next->name );
- guiIntfStruct.StreamType=STREAMTYPE_FILE;
- guiIntfStruct.FilenameChanged=guiIntfStruct.NewPlay=1;
- gfree( (void **)&guiIntfStruct.AudioFile );
- gfree( (void **)&guiIntfStruct.Subtitlename );
- }
- else
- {
- if ( guiIntfStruct.FilenameChanged || guiIntfStruct.NewPlay ) return;
-
- guiIntfStruct.TimeSec=0;
- guiIntfStruct.Position=0;
- guiIntfStruct.AudioType=0;
- guiIntfStruct.NoWindow=False;
-
-#ifdef CONFIG_DVDREAD
- guiIntfStruct.DVD.current_title=1;
- guiIntfStruct.DVD.current_chapter=1;
- guiIntfStruct.DVD.current_angle=1;
-#endif
-
- if ( !appMPlayer.subWindow.isFullScreen && gtkShowVideoWindow)
- {
- wsResizeWindow( &appMPlayer.subWindow,appMPlayer.sub.width,appMPlayer.sub.height );
- wsMoveWindow( &appMPlayer.subWindow,True,appMPlayer.sub.x,appMPlayer.sub.y );
- }
- else wsVisibleWindow( &appMPlayer.subWindow,wsHideWindow );
- guiGetEvent( guiCEvent,guiSetStop );
- mplSubRender=1;
- wsSetBackgroundRGB( &appMPlayer.subWindow,appMPlayer.sub.R,appMPlayer.sub.G,appMPlayer.sub.B );
- wsClearWindow( appMPlayer.subWindow );
- wsPostRedisplay( &appMPlayer.subWindow );
- }
-}
-
-void mplPlay( void )
-{
- if ( ( !guiIntfStruct.Filename )||
- ( guiIntfStruct.Filename[0] == 0 )||
- ( guiIntfStruct.Playing == 1 ) ) return;
- if ( guiIntfStruct.Playing == 2 ) { mplPause(); return; }
- guiGetEvent( guiCEvent,(void *)guiSetPlay );
- mplSubRender=0;
- wsSetBackgroundRGB( &appMPlayer.subWindow,0,0,0 );
- wsClearWindow( appMPlayer.subWindow );
-}
-
-void mplPause( void )
-{
- if ( !guiIntfStruct.Playing ) return;
- if ( guiIntfStruct.Playing == 1 )
- {
- mp_cmd_t * cmd = calloc( 1,sizeof( *cmd ) );
- cmd->id=MP_CMD_PAUSE;
- cmd->name=strdup("pause");
- mp_input_queue_cmd(cmd);
- } else guiIntfStruct.Playing=1;
-}
-
-void mplState( void )
-{
- if ( ( guiIntfStruct.Playing == 0 )||( guiIntfStruct.Playing == 2 ) )
- {
- btnModify( evPlaySwitchToPause,btnReleased );
- btnModify( evPauseSwitchToPlay,btnDisabled );
- }
- else
- {
- btnModify( evPlaySwitchToPause,btnDisabled );
- btnModify( evPauseSwitchToPlay,btnReleased );
- }
-}
-
-float mplGetPosition( void )
-{ // return 0.0 ... 100.0
- return guiIntfStruct.Position;
-}
-
-void mplRelSeek( float s )
-{ // -+s
- rel_seek_secs=s; abs_seek_pos=0;
-}
-
-void mplAbsSeek( float s )
-{ // 0.0 ... 100.0
- if ( guiIntfStruct.StreamType == STREAMTYPE_STREAM ) return;
- rel_seek_secs=0.01*s; abs_seek_pos=3;
-}
-
-listItems tmpList;
-
-void ChangeSkin( char * name )
-{
- int ret;
- int prev = appMPlayer.menuIsPresent;
- int bprev = appMPlayer.barIsPresent;
-
- mainVisible=0;
-
- appInitStruct( &tmpList );
- skinAppMPlayer=&tmpList;
- fntFreeFont();
- ret=skinRead( name );
-
- appInitStruct( &tmpList );
- skinAppMPlayer=&appMPlayer;
- appInitStruct( &appMPlayer );
- if ( ret ) name=skinName;
- if ( skinRead( name ) )
- {
- mainVisible=1;
- return;
- }
-
-// --- reload menu window
-
- if ( prev && appMPlayer.menuIsPresent )
- {
- if ( mplMenuDrawBuffer ) free( mplMenuDrawBuffer );
- if ( ( mplMenuDrawBuffer = calloc( 1,appMPlayer.menuBase.Bitmap.ImageSize ) ) == NULL )
- { mp_msg( MSGT_GPLAYER,MSGL_STATUS,MSGTR_NEMDB ); return; }
- wsResizeWindow( &appMPlayer.menuWindow,appMPlayer.menuBase.width,appMPlayer.menuBase.height );
- wsResizeImage( &appMPlayer.menuWindow,appMPlayer.menuBase.width,appMPlayer.menuBase.height );
- wsSetShape( &appMPlayer.menuWindow,appMPlayer.menuBase.Mask.Image );
- wsVisibleWindow( &appMPlayer.menuWindow,wsHideWindow );
- } else { mplMenuInit(); }
-
-// --- reload sub window
- if ( appMPlayer.sub.Bitmap.Image ) wsResizeImage( &appMPlayer.subWindow,appMPlayer.sub.Bitmap.Width,appMPlayer.sub.Bitmap.Height );
- if ( ( !appMPlayer.subWindow.isFullScreen )&&( !guiIntfStruct.Playing ) )
- {
- wsResizeWindow( &appMPlayer.subWindow,appMPlayer.sub.width,appMPlayer.sub.height );
- wsMoveWindow( &appMPlayer.subWindow,True,appMPlayer.sub.x,appMPlayer.sub.y );
- }
- if ( appMPlayer.sub.Bitmap.Image ) wsConvert( &appMPlayer.subWindow,appMPlayer.sub.Bitmap.Image,appMPlayer.sub.Bitmap.ImageSize );
- if ( !guiIntfStruct.Playing )
- {
- mplSubRender=1;
- wsSetBackgroundRGB( &appMPlayer.subWindow,appMPlayer.sub.R,appMPlayer.sub.G,appMPlayer.sub.B );
- wsClearWindow( appMPlayer.subWindow );
- wsPostRedisplay( &appMPlayer.subWindow );
- }
-
-// --- reload play bar
- if ( bprev ) wsDestroyWindow( &appMPlayer.barWindow );
- mplPBInit();
-
-// --- reload main window
- if ( mplDrawBuffer ) free( mplDrawBuffer );
- if ( ( mplDrawBuffer = calloc( 1,appMPlayer.main.Bitmap.ImageSize ) ) == NULL )
- { mp_msg( MSGT_GPLAYER,MSGL_STATUS,MSGTR_NEMDB ); return; }
-
- wsDestroyWindow( &appMPlayer.mainWindow );
-
- wsCreateWindow( &appMPlayer.mainWindow,
- appMPlayer.main.x,appMPlayer.main.y,appMPlayer.main.width,appMPlayer.main.height,
- wsNoBorder,wsShowMouseCursor|wsHandleMouseButton|wsHandleMouseMove,wsShowFrame|wsMaxSize|wsHideWindow,"MPlayer" );
- wsCreateImage( &appMPlayer.mainWindow,appMPlayer.main.Bitmap.Width,appMPlayer.main.Bitmap.Height );
- wsSetShape( &appMPlayer.mainWindow,appMPlayer.main.Mask.Image );
- wsSetIcon( wsDisplay,appMPlayer.mainWindow.WindowID,guiIcon,guiIconMask );
-
- appMPlayer.mainWindow.ReDraw=(void *)mplMainDraw;
- appMPlayer.mainWindow.MouseHandler=mplMainMouseHandle;
- appMPlayer.mainWindow.KeyHandler=mplMainKeyHandle;
- appMPlayer.mainWindow.DandDHandler=mplDandDHandler;
-
- wsXDNDMakeAwareness( &appMPlayer.mainWindow );
- if ( !appMPlayer.mainDecoration ) wsWindowDecoration( &appMPlayer.mainWindow,0 );
- wsVisibleWindow( &appMPlayer.mainWindow,wsShowWindow );
- mainVisible=1;
-// ---
-
- btnModify( evSetVolume,guiIntfStruct.Volume );
- btnModify( evSetBalance,guiIntfStruct.Balance );
- btnModify( evSetMoviePosition,guiIntfStruct.Position );
- btnModify( evFullScreen,!appMPlayer.subWindow.isFullScreen );
-
- wsSetLayer( wsDisplay,appMPlayer.mainWindow.WindowID,appMPlayer.subWindow.isFullScreen );
- wsSetLayer( wsDisplay,appMPlayer.menuWindow.WindowID,appMPlayer.subWindow.isFullScreen );
-
-}
-
-void mplSetFileName( char * dir,char * name,int type )
-{
- if ( !name ) return;
-
- if ( !dir ) guiSetFilename( guiIntfStruct.Filename,name )
- else guiSetDF( guiIntfStruct.Filename,dir,name );
-
-// filename=guiIntfStruct.Filename;
- guiIntfStruct.StreamType=type;
- gfree( (void **)&guiIntfStruct.AudioFile );
- gfree( (void **)&guiIntfStruct.Subtitlename );
-}
-
-void mplCurr( void )
-{
- plItem * curr;
- int stop = 0;
-
- if ( guiIntfStruct.Playing == 2 ) return;
- switch ( guiIntfStruct.StreamType )
- {
-#ifdef CONFIG_DVDREAD
- case STREAMTYPE_DVD:
- break;
-#endif
-#ifdef CONFIG_VCD
- case STREAMTYPE_VCD:
- break;
-#endif
- default:
- if ( (curr=gtkSet( gtkGetCurrPlItem,0,NULL)) )
- {
- mplSetFileName( curr->path,curr->name,STREAMTYPE_FILE );
- mplGotoTheNext=0;
- break;
- }
- return;
- }
- if ( stop ) mplEventHandling( evStop,0 );
- if ( guiIntfStruct.Playing == 1 ) mplEventHandling( evPlay,0 );
-}
-
-
-void mplPrev( void )
-{
- plItem * prev;
- int stop = 0;
-
- if ( guiIntfStruct.Playing == 2 ) return;
- switch ( guiIntfStruct.StreamType )
- {
-#ifdef CONFIG_DVDREAD
- case STREAMTYPE_DVD:
- if ( --guiIntfStruct.DVD.current_chapter == 0 )
- {
- guiIntfStruct.DVD.current_chapter=1;
- if ( --guiIntfStruct.DVD.current_title <= 0 ) { guiIntfStruct.DVD.current_title=1; stop=1; }
- }
- guiIntfStruct.Track=guiIntfStruct.DVD.current_title;
- break;
-#endif
-#ifdef CONFIG_VCD
- case STREAMTYPE_VCD:
- if ( --guiIntfStruct.Track == 0 ) { guiIntfStruct.Track=1; stop=1; }
- break;
-#endif
- default:
- if ( (prev=gtkSet( gtkGetPrevPlItem,0,NULL)) )
- {
- mplSetFileName( prev->path,prev->name,STREAMTYPE_FILE );
- mplGotoTheNext=0;
- break;
- }
- return;
- }
- if ( stop ) mplEventHandling( evStop,0 );
- if ( guiIntfStruct.Playing == 1 ) mplEventHandling( evPlay,0 );
-}
-
-void mplNext( void )
-{
- int stop = 0;
- plItem * next;
-
- if ( guiIntfStruct.Playing == 2 ) return;
- switch ( guiIntfStruct.StreamType )
- {
-#ifdef CONFIG_DVDREAD
- case STREAMTYPE_DVD:
- if ( guiIntfStruct.DVD.current_chapter++ == guiIntfStruct.DVD.chapters )
- {
- guiIntfStruct.DVD.current_chapter=1;
- if ( ++guiIntfStruct.DVD.current_title > guiIntfStruct.DVD.titles ) { guiIntfStruct.DVD.current_title=guiIntfStruct.DVD.titles; stop=1; }
- }
- guiIntfStruct.Track=guiIntfStruct.DVD.current_title;
- break;
-#endif
-#ifdef CONFIG_VCD
- case STREAMTYPE_VCD:
- if ( ++guiIntfStruct.Track > guiIntfStruct.VCDTracks ) { guiIntfStruct.Track=guiIntfStruct.VCDTracks; stop=1; }
- break;
-#endif
- default:
- if ( (next=gtkSet( gtkGetNextPlItem,0,NULL)) )
- {
- mplSetFileName( next->path,next->name,STREAMTYPE_FILE );
- mplGotoTheNext=0;
- break;
- }
- return;
- }
- if ( stop ) mplEventHandling( evStop,0 );
- if ( guiIntfStruct.Playing == 1 ) mplEventHandling( evPlay,0 );
-}
diff --git a/gui/mplayer/play.h b/gui/mplayer/play.h
deleted file mode 100644
index 9e100f32fc..0000000000
--- a/gui/mplayer/play.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * 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_GUI_PLAY_H
-#define MPLAYER_GUI_PLAY_H
-
-extern int mplGotoTheNext;
-
-void mplEnd( void );
-void mplFullScreen( void );
-void mplPlay( void );
-void mplPause( void );
-void mplState( void );
-void mplPrev( void );
-void mplNext( void );
-void mplCurr( void );
-
-void mplIncAudioBufDelay( void );
-void mplDecAudioBufDelay( void );
-
-void mplRelSeek( float s );
-void mplAbsSeek( float s );
-float mplGetPosition( void );
-
-void mplPlayFork( void );
-void mplSigHandler( int s );
-void mplPlayerThread( void );
-
-void ChangeSkin( char * name );
-void EventHandling( void );
-
-void mplSetFileName( char * dir, char * name, int type );
-
-#endif /* MPLAYER_GUI_PLAY_H */
diff --git a/gui/mplayer/sw.c b/gui/mplayer/sw.c
deleted file mode 100644
index 349847b5b8..0000000000
--- a/gui/mplayer/sw.c
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * sub window
- *
- * 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.
- */
-
-#include <inttypes.h>
-#include <string.h>
-
-#include "config.h"
-#include "libvo/x11_common.h"
-#include "help_mp.h"
-
-#include "gmplayer.h"
-#include "gui/app.h"
-#include "gui/interface.h"
-#include "widgets.h"
-
-int mplSubRender = 0;
-int SubVisible = 0;
-
-extern int boxMoved;
-extern int sx,sy;
-extern int i,pot;
-
-void mplSubDraw( void )
-{
- if ( appMPlayer.subWindow.State == wsWindowClosed ) exit_player( MSGTR_Exit_quit );
-
- if ( appMPlayer.subWindow.State == wsWindowFocusIn ) SubVisible++;
- if ( appMPlayer.subWindow.State == wsWindowFocusOut && metacity_hack != 3 ) SubVisible--;
-
- if ( !appMPlayer.subWindow.Mapped ||
- appMPlayer.subWindow.Visible == wsWindowNotVisible ) return;
-
- if ( guiIntfStruct.Playing ) mplSubRender=0;
-
- if ( mplSubRender && appMPlayer.subWindow.State == wsWindowExpose )
- {
- if ( appMPlayer.sub.Bitmap.Image ) wsPutImage( &appMPlayer.subWindow );
- }
- appMPlayer.subWindow.State=0;
-}
-
-void mplSubMouseHandle( int Button,int X,int Y,int RX,int RY )
-{
- static int mplSubMoved = 0;
- static int msButton = 0;
-
- mplPBShow( X,Y );
-
- switch( Button )
- {
- case wsRRMouseButton:
- gtkShow( evShowPopUpMenu,NULL );
- break;
- case wsPMMouseButton:
- gtkShow( evHidePopUpMenu,NULL );
- mplShowMenu( RX,RY );
- msButton=wsPMMouseButton;
- break;
- case wsRMMouseButton:
- mplHideMenu( RX,RY,1 );
- msButton=0;
- break;
-// ---
- case wsPLMouseButton:
- gtkShow( evHidePopUpMenu,NULL );
- sx=X; sy=Y;
- msButton=wsPLMouseButton;
- mplSubMoved=0;
- break;
- case wsMoveMouse:
- switch ( msButton )
- {
- case wsPLMouseButton:
- mplSubMoved=1;
- if ( !appMPlayer.subWindow.isFullScreen ) wsMoveWindow( &appMPlayer.subWindow,False,RX - sx,RY - sy );
- break;
- case wsPMMouseButton:
- mplMenuMouseHandle( X,Y,RX,RY );
- break;
- default: mplPBShow( X,Y ); break;
- }
- break;
- case wsRLMouseButton:
- if ( ( !mplSubMoved )&&( appMPlayer.subWindow.isFullScreen ) )
- {
- if( SubVisible++%2 ) wsMoveTopWindow( wsDisplay,appMPlayer.mainWindow.WindowID );
- else wsMoveTopWindow( wsDisplay,appMPlayer.subWindow.WindowID );
- }
- msButton=0;
- mplSubMoved=0;
- break;
- }
-}
diff --git a/gui/mplayer/widgets.c b/gui/mplayer/widgets.c
deleted file mode 100644
index d6b0442303..0000000000
--- a/gui/mplayer/widgets.c
+++ /dev/null
@@ -1,255 +0,0 @@
-/*
- * 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.
- */
-
-#include <stdlib.h>
-#include <stdio.h>
-
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/wait.h>
-#include <unistd.h>
-#include <string.h>
-#include <signal.h>
-
-#include <gdk/gdkprivate.h>
-#include <gdk/gdkkeysyms.h>
-#include <gdk/gdkx.h>
-#include <gdk/gdk.h>
-#include <gtk/gtk.h>
-
-#include "config.h"
-#include "help_mp.h"
-#include "mp_msg.h"
-
-#include "widgets.h"
-#include "gui/app.h"
-#include "gui/wm/ws.h"
-
-
-#include "gtk/menu.h"
-#include "play.h"
-#include "gtk/fs.h"
-
-GtkWidget * PopUpMenu = NULL;
-
-GtkWidget * WarningPixmap;
-GtkWidget * ErrorPixmap;
-
-int gtkPopupMenu = 0;
-int gtkPopupMenuParam = 0;
-int gtkInitialized = 0;
-
-#include "gtk/sb.h"
-#include "gtk/pl.h"
-#include "gtk/fs.h"
-#include "gtk/mb.h"
-#include "gtk/about.h"
-#include "gtk/opts.h"
-#include "gtk/menu.h"
-#include "gtk/gtk_url.h"
-#include "gtk/eq.h"
-
-#include "pixmaps/MPlayer_mini.xpm"
-
-// --- init & close gtk
-
-GdkPixmap * gtkIcon = NULL;
-GdkBitmap * gtkIconMask = NULL;
-Pixmap guiIcon;
-Pixmap guiIconMask;
-
-void gtkInit( void )
-{
- mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[widget] init GTK ...\n" );
-#ifdef CONFIG_GTK2
- gtk_disable_setlocale();
-#endif
- gtk_init( 0,NULL );
-// gdk_set_use_xshm( TRUE );
-
- {
- GtkWidget * win;
- win=gtk_window_new( GTK_WINDOW_TOPLEVEL );
-
- if ( !gtkIcon )
- gtkIcon=gdk_pixmap_colormap_create_from_xpm_d( win->window,gdk_colormap_get_system(),&gtkIconMask,&win->style->bg[GTK_STATE_NORMAL],MPlayer_mini_xpm );
-
- guiIcon=GDK_WINDOW_XWINDOW( gtkIcon );
- guiIconMask=GDK_WINDOW_XWINDOW( gtkIconMask );
-
- gtk_widget_destroy( win );
- }
-
- gtkInitialized=1;
-}
-
-void gtkAddIcon( GtkWidget * window )
-{ wsSetIcon( gdk_display,GDK_WINDOW_XWINDOW( window->window ),guiIcon,guiIconMask ); }
-
-void gtkClearList( GtkWidget * list )
-{ gtk_clist_clear( GTK_CLIST( list ) ); }
-
-int gtkFindCList( GtkWidget * list,char * item )
-{
- gint j,t;
- gchar * tmpstr;
- for( t=0,j=0;j<GTK_CLIST( list )->rows;j++ )
- {
- gtk_clist_get_text( GTK_CLIST( list ),j,0,&tmpstr );
- if ( !strcmp( tmpstr,item ) ) return j;
- }
- return -1;
-}
-
-void gtkSetDefaultToCList( GtkWidget * list,char * item )
-{
- gint i;
- if ( ( i=gtkFindCList( list,item ) ) > -1 ) gtk_clist_select_row( GTK_CLIST( list ),i,0 );
-}
-
-void gtkEventHandling( void )
-{
- int i;
- for( i=0;i < 25;i++ ) gtk_main_iteration_do( 0 );
-}
-
-// --- funcs
-
-void gtkMessageBox( int type,const gchar * str )
-{
- if ( !gtkInitialized ) return;
- ShowMessageBox( str );
- gtk_label_set_text( GTK_LABEL( gtkMessageBoxText ),str );
- /* enable linewrapping by alex */
-// GTK_LABEL(gtkMessageBoxText)->max_width = 80;
- if (strlen(str) > 80)
- gtk_label_set_line_wrap(GTK_LABEL(gtkMessageBoxText), TRUE);
- else
- gtk_label_set_line_wrap(GTK_LABEL(gtkMessageBoxText), FALSE);
- switch( type)
- {
- case GTK_MB_FATAL:
- gtk_window_set_title( GTK_WINDOW( MessageBox ),MSGTR_MSGBOX_LABEL_FatalError );
- gtk_widget_hide( WarningPixmap );
- gtk_widget_show( ErrorPixmap );
- break;
- case GTK_MB_ERROR:
- gtk_window_set_title( GTK_WINDOW( MessageBox ),MSGTR_MSGBOX_LABEL_Error );
- gtk_widget_hide( WarningPixmap );
- gtk_widget_show( ErrorPixmap );
- break;
- case GTK_MB_WARNING:
- gtk_window_set_title( GTK_WINDOW( MessageBox ),MSGTR_MSGBOX_LABEL_Warning );
- gtk_widget_show( WarningPixmap );
- gtk_widget_hide( ErrorPixmap );
- break;
- }
- gtk_widget_show( MessageBox );
- gtkSetLayer( MessageBox );
- if ( type == GTK_MB_FATAL )
- while ( MessageBox ) gtk_main_iteration_do( 0 );
-}
-
-void gtkSetLayer( GtkWidget * wdg )
-{
- wsSetLayer( gdk_display,GDK_WINDOW_XWINDOW( wdg->window ),appMPlayer.subWindow.isFullScreen );
- gtkActive( wdg );
-}
-
-void gtkActive( GtkWidget * wdg )
-{ wsMoveTopWindow( gdk_display,GDK_WINDOW_XWINDOW( wdg->window )); }
-
-void gtkShow( int type,char * param )
-{
- switch( type )
- {
- case evEqualizer:
- ShowEqualizer();
- gtkSetLayer( Equalizer );
- break;
- case evSkinBrowser:
- ShowSkinBrowser();
-// gtkClearList( SkinList );
- if ( gtkFillSkinList( sbMPlayerPrefixDir ) &&
- gtkFillSkinList( sbMPlayerPrefixDir_obsolete ) &&
- gtkFillSkinList( sbMPlayerDirInHome ) &&
- gtkFillSkinList( sbMPlayerDirInHome_obsolete ) )
- {
- gtkSetDefaultToCList( SkinList,param );
- gtk_clist_sort( GTK_CLIST( SkinList ) );
- gtk_widget_show( SkinBrowser );
- gtkSetLayer( SkinBrowser );
- }
- else
- {
- gtk_widget_destroy( SkinBrowser );
- gtkMessageBox( GTK_MB_ERROR,"Skin dirs not found ... Please install skins." );
- }
- break;
- case evPreferences:
- ShowPreferences();
- break;
- case evPlayList:
- ShowPlayList();
- gtkSetLayer( PlayList );
- break;
- case evLoad:
- ShowFileSelect( fsVideoSelector,0 );
- gtkSetLayer( fsFileSelect );
- break;
- case evFirstLoad:
- ShowFileSelect( fsVideoSelector,0 );
- gtkSetLayer( fsFileSelect );
- break;
- case evLoadSubtitle:
- ShowFileSelect( fsSubtitleSelector,0 );
- gtkSetLayer( fsFileSelect );
- break;
- case evLoadAudioFile:
- ShowFileSelect( fsAudioSelector,0 );
- gtkSetLayer( fsFileSelect );
- break;
- case evAbout:
- ShowAboutBox();
- gtkSetLayer( About );
- break;
- case evShowPopUpMenu:
- gtkPopupMenu=evNone;
- gtkPopupMenuParam=0;
- if ( PopUpMenu )
- {
- gtk_widget_hide( PopUpMenu );
- gtk_widget_destroy( PopUpMenu );
- }
- PopUpMenu=create_PopUpMenu();
- gtk_menu_popup( GTK_MENU( PopUpMenu ),NULL,NULL,NULL,NULL,0,0 );
- break;
- case evHidePopUpMenu:
- if ( PopUpMenu )
- {
- gtk_widget_hide( PopUpMenu );
- gtk_widget_destroy( PopUpMenu );
- PopUpMenu=NULL;
- }
- break;
- case evPlayNetwork:
- ShowURLDialogBox();
- gtkSetLayer( URL );
- break;
- }
-}
diff --git a/gui/mplayer/widgets.h b/gui/mplayer/widgets.h
deleted file mode 100644
index 4a6ee40dfe..0000000000
--- a/gui/mplayer/widgets.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * 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_GUI_WIDGETS_H
-#define MPLAYER_GUI_WIDGETS_H
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <gdk/gdkkeysyms.h>
-#include <gtk/gtk.h>
-
-#include "config.h"
-#include "osdep/shmem.h"
-#include "play.h"
-#include "mplayer.h"
-#include "gui/interface.h"
-#include "gui/wm/ws.h"
-
-#define GTK_MB_SIMPLE 0
-#define GTK_MB_MODAL 1
-#define GTK_MB_FATAL 2
-#define GTK_MB_ERROR 4
-#define GTK_MB_WARNING 8
-
-extern GtkWidget * PlayList;
-extern GtkWidget * Options;
-extern GtkWidget * PopUpMenu;
-
-extern GtkWidget * WarningPixmap;
-extern GtkWidget * ErrorPixmap;
-
-extern GtkWidget * SkinList;
-extern GtkWidget * gtkMessageBoxText;
-
-extern int gtkPopupMenu;
-extern int gtkPopupMenuParam;
-
-extern char * sbMPlayerDirInHome;
-extern char * sbMPlayerPrefixDir;
-extern char * sbMPlayerDirInHome_obsolete;
-extern char * sbMPlayerPrefixDir_obsolete;
-
-extern GdkPixmap * gtkIcon;
-extern GdkBitmap * gtkIconMask;
-extern Pixmap guiIcon;
-extern Pixmap guiIconMask;
-
-void widgetsCreate( void );
-
-void gtkInit( void );
-void gtkAddIcon( GtkWidget * window );
-
-int gtkFillSkinList( gchar * dir );
-void gtkClearList( GtkWidget * list );
-void gtkSetDefaultToCList( GtkWidget * list, char * item );
-int gtkFindCList( GtkWidget * list, char * item );
-
-void gtkEventHandling( void );
-
-void gtkShow( int type, char * param );
-void gtkMessageBox( int type, const gchar * str );
-void gtkSetLayer( GtkWidget * wdg );
-void gtkActive( GtkWidget * wdg );
-
-#endif /* MPLAYER_GUI_WIDGETS_H */
diff --git a/gui/skin/cut.c b/gui/skin/cut.c
deleted file mode 100644
index b05f238984..0000000000
--- a/gui/skin/cut.c
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * 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.
- */
-
-#include <string.h>
-#include <stdlib.h>
-
-void cutItem( char * in,char * out,char sep,int num )
-{
- int i,n,c;
- for ( c=0,n=0,i=0;i<strlen( in );i++ )
- {
- if ( in[i] == sep ) n++;
- if ( n >= num && in[i] != sep ) out[c++]=in[i];
- if ( n >= num && in[i+1] == sep ) { out[c]=0; return; }
- }
- out[c]=0;
-}
-
-int cutItemToInt( char * in,char sep,int num )
-{
- char tmp[512];
- cutItem( in,tmp,sep,num );
- return atoi( tmp );
-}
-
-float cutItemToFloat( char * in,char sep,int num )
-{
- char tmp[512];
- cutItem( in,tmp,sep,num );
- return atof( tmp );
-}
-
-void cutChunk( char * in,char * s1 )
-{
- cutItem( in,s1,'=',0 );
- memmove( in,strchr( in,'=' )+1,strlen( in ) - strlen( s1 ) );
-}
-
diff --git a/gui/skin/cut.h b/gui/skin/cut.h
deleted file mode 100644
index a468c7862e..0000000000
--- a/gui/skin/cut.h
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * 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_GUI_CUT_H
-#define MPLAYER_GUI_CUT_H
-
-void cutItem( char * in, char * out, char sep, int num );
-int cutItemToInt( char * in, char sep, int num );
-float cutItemToFloat( char * in, char sep, int num );
-void cutChunk( char * in, char * s1 );
-
-#endif /* MPLAYER_GUI_CUT_H */
diff --git a/gui/skin/font.c b/gui/skin/font.c
deleted file mode 100644
index 2da2148c41..0000000000
--- a/gui/skin/font.c
+++ /dev/null
@@ -1,269 +0,0 @@
-/*
- * 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.
- */
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <stdarg.h>
-#include <string.h>
-#include <inttypes.h>
-
-#include "gui/app.h"
-#include "skin.h"
-#include "font.h"
-#include "cut.h"
-#include "mp_msg.h"
-#include "libavutil/avstring.h"
-
-int items;
-
-bmpFont * Fonts[26] = { NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL };
-
-int fntAddNewFont( char * name )
-{
- int id;
- int i;
-
- for( id=0;id<26;id++ )
- if ( !Fonts[id] ) break;
-
- if ( id == 25 ) return -2;
-
- if ( ( Fonts[id]=calloc( 1,sizeof( bmpFont ) ) ) == NULL ) return -1;
-
- av_strlcpy( Fonts[id]->name,name,128 ); // FIXME: as defined in font.h
- for ( i=0;i<256;i++ )
- Fonts[id]->Fnt[i].x=Fonts[id]->Fnt[i].y=Fonts[id]->Fnt[i].sx=Fonts[id]->Fnt[i].sy=-1;
-
- return id;
-}
-
-void fntFreeFont( void )
-{
- int i;
- for( i=0;i < 25;i++ )
- {
- if ( Fonts[i] )
- {
- if ( Fonts[i]->Bitmap.Image ) free( Fonts[i]->Bitmap.Image );
- free( Fonts[i] );
- Fonts[i]=NULL;
- }
- }
-}
-
-int fntRead( char * path,char * fname )
-{
- FILE * f;
- unsigned char tmp[512];
- unsigned char * ptmp;
- unsigned char command[32];
- unsigned char param[256];
- int c,linenumber = 0;
- int id = fntAddNewFont( fname );
-
- if ( id < 0 ) return id;
-
- av_strlcpy( tmp,path,sizeof( tmp ) );
- av_strlcat( tmp,fname,sizeof( tmp ) ); av_strlcat( tmp,".fnt",sizeof( tmp ) );
- if ( ( f=fopen( tmp,"rt" ) ) == NULL )
- { free( Fonts[id] ); return -3; }
-
- while ( fgets( tmp,255,f ) )
- {
- linenumber++;
-
- // remove any kind of newline, if any
- tmp[strcspn(tmp, "\n\r")] = 0;
- for ( c=0;c < (int)strlen( tmp );c++ )
- if ( tmp[c] == ';' ) { tmp[c]=0; break; }
- if ( !tmp[0] ) continue;
- ptmp=trimleft( tmp );
- if ( !tmp[0] ) continue;
- ptmp=strswap( ptmp,'\t',' ' );
- ptmp=trim( ptmp );
- cutItem( ptmp,command,'=',0 ); cutItem( ptmp,param,'=',1 );
- if ( command[0] == '"' )
- {
- int i;
- cutItem( command,command,'"',1 );
- i=(int)command[0];
- cutItem( param,tmp,',',0 ); Fonts[id]->Fnt[i].x=atoi( tmp );
- cutItem( param,tmp,',',1 ); Fonts[id]->Fnt[i].y=atoi( tmp );
- cutItem( param,tmp,',',2 ); Fonts[id]->Fnt[i].sx=atoi( tmp );
- cutItem( param,tmp,',',3 ); Fonts[id]->Fnt[i].sy=atoi( tmp );
- mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[font] char: '%s' params: %d,%d %dx%d\n",command,Fonts[id]->Fnt[i].x,Fonts[id]->Fnt[i].y,Fonts[id]->Fnt[i].sx,Fonts[id]->Fnt[i].sy );
- }
- else
- {
- if ( !strcmp( command,"image" ) )
- {
- av_strlcpy( tmp,path,sizeof( tmp ) ); av_strlcat( tmp,param,sizeof( tmp ) );
- mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[font] font imagefile: %s\n",tmp );
- if ( skinBPRead( tmp,&Fonts[id]->Bitmap ) ) return -4;
- }
- }
- }
-
- return 0;
-}
-
-int fntFindID( char * name )
-{
- int i;
- for ( i=0;i < 25;i++ )
- if ( Fonts[i] )
- if ( !strcmp( name,Fonts[i]->name ) ) return i;
- return -1;
-}
-
-int fntTextWidth( int id,char * str )
-{
- int size = 0;
- int i;
-
- if ( ( !Fonts[id] )||( !str[0] ) ) return 0;
-
- for ( i=0;i < (int)strlen( str );i++ )
- {
- unsigned char c = (unsigned char)str[i];
- if ( Fonts[id]->Fnt[c].sx == -1 ) c = ' ';
- size+= Fonts[id]->Fnt[ c ].sx;
- }
- return size;
-}
-
-int fntTextHeight( int id,char * str )
-{
- int max = 0,i;
-
- if ( ( !Fonts[id] )||( !str[0] ) ) return 0;
-
- for ( i=0;i < (int)strlen( str );i++ )
- {
- int h;
- unsigned char c = (unsigned char)str[i];
- if ( Fonts[id]->Fnt[c].sx == -1 ) c = ' ';
- h = Fonts[id]->Fnt[c].sy;
- if ( h > max ) max=h;
- }
- return max;
-}
-
-txSample * fntRender( wItem * item,int px,const char * fmt,... )
-{
- va_list ap;
- unsigned char p[512];
- unsigned int c;
- int i, dx = 0, tw, fbw, iw, id, ofs;
- int x,y,fh,fw,fyc,yc;
- uint32_t * ibuf;
- uint32_t * obuf;
-
- va_start( ap,fmt );
- vsnprintf( p,512,fmt,ap );
- va_end( ap );
-
- iw=item->width;
- id=item->fontid;
-
- if ( ( !item )||
- ( !Fonts[id] )||
- ( !p[0] )||
- ( !fntTextWidth( id,p ) ) ) return NULL;
-
- tw=fntTextWidth( id,p );
- fbw=Fonts[id]->Bitmap.Width;
-
- if ( item->Bitmap.Image == NULL )
- {
- item->Bitmap.Height=item->height=fntTextHeight( id,p );
- item->Bitmap.Width=item->width=iw;
- item->Bitmap.ImageSize=item->height * iw * 4;
- if ( !item->Bitmap.ImageSize ) return NULL;
- item->Bitmap.BPP=32;
- item->Bitmap.Image=malloc( item->Bitmap.ImageSize );
- }
-
- obuf=(uint32_t *)item->Bitmap.Image;
- ibuf=(uint32_t *)Fonts[id]->Bitmap.Image;
-
- for ( i=0;i < item->Bitmap.ImageSize / 4;i++ ) obuf[i]=0xff00ff;
-
- if ( tw <= iw )
- {
- switch ( item->align )
- {
- default:
- case fntAlignLeft: dx=0; break;
- case fntAlignCenter: dx=( iw - fntTextWidth( id,p ) ) / 2; break;
- case fntAlignRight: dx=iw - fntTextWidth( id,p ); break;
- }
-
- } else dx+=px;
-
- ofs=dx;
-
- for ( i=0;i < (int)strlen( p );i++ )
- {
- c=(unsigned int)p[i];
- fw=Fonts[id]->Fnt[c].sx;
-
- if ( fw == -1 ) { c=32; fw=Fonts[id]->Fnt[c].sx; }
-
- fh=Fonts[id]->Fnt[c].sy;
- fyc=Fonts[id]->Fnt[c].y * fbw + Fonts[id]->Fnt[c].x;
- yc=dx;
-
- if ( dx >= 0 )
- for ( y=0;y < fh;y++ )
- {
- for ( x=0; x < fw;x++ )
- if ( dx + x >= 0 && dx + x < iw ) obuf[yc + x]=ibuf[ fyc + x ];
- fyc+=fbw;
- yc+=iw;
- }
- dx+=fw;
- }
-
- if ( ofs > 0 && tw > item->width )
- {
- dx=ofs;
- for ( i=(int)strlen( p );i > 0;i-- )
- {
- c=(unsigned int)p[i];
- fw=Fonts[id]->Fnt[c].sx;
-
- if ( fw == -1 ) { c=32; fw=Fonts[id]->Fnt[c].sx; }
-
- fh=Fonts[id]->Fnt[c].sy;
- fyc=Fonts[id]->Fnt[c].y * fbw + Fonts[id]->Fnt[c].x;
-
- dx-=fw; yc=dx;
- if ( dx >= 0 )
- for ( y=0;y < fh;y++ )
- {
- for ( x=fw - 1;x >= 0;x-- )
- if ( dx + x >= 0 && dx + x < iw ) obuf[yc + x]=ibuf[fyc + x];
- fyc+=fbw;
- yc+=iw;
- }
- }
- }
-
- return &item->Bitmap;
-}
diff --git a/gui/skin/font.h b/gui/skin/font.h
deleted file mode 100644
index 46c3b36acc..0000000000
--- a/gui/skin/font.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * 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_GUI_FONT_H
-#define MPLAYER_GUI_FONT_H
-
-#include "gui/bitmap.h"
-#include "gui/app.h"
-
-#define fntAlignLeft 0
-#define fntAlignCenter 1
-#define fntAlignRight 2
-
-typedef struct
-{
- int x,y; // location
- int sx,sy; // size
-} fntChar;
-
-typedef struct
-{
- fntChar Fnt[256];
- txSample Bitmap;
- char name[128];
-} bmpFont;
-
-extern txSample Bitmap;
-extern bmpFont * Fonts[26];
-
-int fntAddNewFont( char * name );
-void fntFreeFont( void );
-int fntFindID( char * name );
-int fntTextHeight( int id, char * str );
-int fntTextWidth( int id, char * str );
-
-int fntRead( char * path, char * fname );
-txSample * fntRender( wItem * item, int px, const char * fmt, ... );
-
-#endif /* MPLAYER_GUI_FONT_H */
diff --git a/gui/skin/skin.c b/gui/skin/skin.c
deleted file mode 100644
index fc0a5e40ab..0000000000
--- a/gui/skin/skin.c
+++ /dev/null
@@ -1,745 +0,0 @@
-/*
- * 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.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "cut.h"
-#include "font.h"
-#include "gui/app.h"
-
-#include "config.h"
-#include "mp_msg.h"
-#include "help_mp.h"
-#include "gui/mplayer/widgets.h"
-#include "libavutil/avstring.h"
-
-//#define MSGL_DBG2 MSGL_STATUS
-
-listItems * skinAppMPlayer = &appMPlayer;
-
-// ---
-
-static int linenumber;
-
-static unsigned char path[512],fn[512];
-
-static listItems * defList = NULL;
-static unsigned char window_name[32] = "";
-
-static wItem * currSection = NULL;
-static int * currSubItem = NULL;
-static wItem * currSubItems = NULL;
-
-#include <stdarg.h>
-
-void ERRORMESSAGE( const char * format, ... )
-{
- char p[512];
- char tmp[512];
- va_list ap;
- va_start( ap,format );
- vsnprintf( p,512,format,ap );
- va_end( ap );
- mp_msg( MSGT_GPLAYER,MSGL_STATUS,MSGTR_SKIN_ERRORMESSAGE,linenumber,p );
- snprintf( tmp,512,MSGTR_SKIN_ERRORMESSAGE,linenumber,p );
- gtkMessageBox( GTK_MB_FATAL,tmp );
-}
-
-#define CHECKDEFLIST( str ) \
-{ \
- if ( defList == NULL ) \
- { \
- mp_msg( MSGT_GPLAYER,MSGL_STATUS,MSGTR_SKIN_WARNING1,linenumber,str ); \
- return 1; \
- } \
-}
-
-#define CHECKWINLIST( str ) \
-{ \
- if ( !window_name[0] ) \
- { \
- mp_msg( MSGT_GPLAYER,MSGL_STATUS,MSGTR_SKIN_WARNING2,linenumber,str ); \
- return 1; \
- } \
-}
-
-#define CHECK( name ) \
-{ \
- if ( !strcmp( window_name,name ) ) \
- { \
- mp_msg( MSGT_GPLAYER,MSGL_STATUS,MSGTR_SKIN_WARNING3,linenumber,name ); \
- return 1; \
- } \
-}
-
-static char * strlower( char * in )
-{
- int i;
- for( i=0;i<(int)strlen( in );i++ ) in[i]=( in[i] >= 'A' ? ( in[i] <= 'Z' ? in[i]+='A' : in[i] ) : in[i] );
- return in;
-}
-
-int skinBPRead( char * fname, txSample * bf )
-{
- int i=bpRead( fname,bf );
- switch ( i )
- {
- case -1: ERRORMESSAGE( MSGTR_SKIN_BITMAP_16bit,fname ); break;
- case -2: ERRORMESSAGE( MSGTR_SKIN_BITMAP_FileNotFound,fname ); break;
- case -3: ERRORMESSAGE( MSGTR_SKIN_BITMAP_BMPReadError,fname ); break;
- case -4: ERRORMESSAGE( MSGTR_SKIN_BITMAP_TGAReadError,fname ); break;
- case -5: ERRORMESSAGE( MSGTR_SKIN_BITMAP_PNGReadError,fname ); break;
- case -6: ERRORMESSAGE( MSGTR_SKIN_BITMAP_RLENotSupported,fname ); break;
- case -7: ERRORMESSAGE( MSGTR_SKIN_BITMAP_UnknownFileType,fname ); break;
- case -8: ERRORMESSAGE( MSGTR_SKIN_BITMAP_ConversionError,fname ); break;
- }
- return i;
-}
-
-int cmd_section( char * in )
-{
- strlower( in );
- defList=NULL;
- if ( !strcmp( in,"movieplayer" ) ) defList=skinAppMPlayer;
- mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"\n[skin] sectionname: %s\n",in );
- return 0;
-}
-
-int cmd_end( char * in )
-{
- if ( strlen( window_name ) ) { window_name[0]=0; currSection=NULL; currSubItem=NULL; currSubItems=NULL; }
- else defList=NULL;
- mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"\n[skin] end section\n" );
- return 0;
-}
-
-int cmd_window( char * in )
-{
- CHECKDEFLIST( "window" );
-
- av_strlcpy( window_name,strlower( in ),sizeof( window_name ) );
- if ( !strncmp( in,"main",4 ) ) { currSection=&skinAppMPlayer->main; currSubItem=&skinAppMPlayer->NumberOfItems; currSubItems=skinAppMPlayer->Items; }
- else if ( !strncmp( in,"sub",3 ) ) currSection=&skinAppMPlayer->sub;
- else if ( !strncmp( in,"playbar",7 ) ) { currSection=&skinAppMPlayer->bar; currSubItem=&skinAppMPlayer->NumberOfBarItems; currSubItems=skinAppMPlayer->barItems; }
- else if ( !strncmp( in,"menu",4 ) ) { currSection=&skinAppMPlayer->menuBase; currSubItem=&skinAppMPlayer->NumberOfMenuItems; currSubItems=skinAppMPlayer->MenuItems; }
- else ERRORMESSAGE( MSGTR_UNKNOWNWINDOWTYPE );
- mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"\n[skin] window: %s\n",window_name );
- return 0;
-}
-
-int cmd_base( char * in )
-{
- unsigned char fname[512];
- unsigned char tmp[512];
- int x,y;
- int sx=0,sy=0;
-
- CHECKDEFLIST( "base" );
- CHECKWINLIST( "base" );
-
- cutItem( in,fname,',',0 );
- x=cutItemToInt( in,',',1 );
- y=cutItemToInt( in,',',2 );
- sx=cutItemToInt( in,',',3 );
- sy=cutItemToInt( in,',',4 );
- mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"\n[skin] base: %s x: %d y: %d ( %dx%d )\n",fname,x,y,sx,sy );
- if ( !strcmp( window_name,"main" ) )
- {
- defList->main.x=x;
- defList->main.y=y;
- defList->main.type=itBase;
- av_strlcpy(tmp, path, sizeof( tmp )); av_strlcat(tmp, fname, sizeof( tmp ));
- if ( skinBPRead( tmp,&defList->main.Bitmap ) ) return 1;
- defList->main.width=defList->main.Bitmap.Width;
- defList->main.height=defList->main.Bitmap.Height;
-#ifdef CONFIG_XSHAPE
- Convert32to1( &defList->main.Bitmap,&defList->main.Mask,0x00ff00ff );
- mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] mask: %dx%d\n",defList->main.Mask.Width,defList->main.Mask.Height );
-#else
- defList->main.Mask.Image=NULL;
-#endif
- mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] width: %d height: %d\n",defList->main.width,defList->main.height );
- }
- if ( !strcmp( window_name,"sub" ) )
- {
- defList->sub.type=itBase;
- av_strlcpy(tmp, path, sizeof( tmp )); av_strlcat(tmp, fname, sizeof( tmp ));
- if ( skinBPRead( tmp,&defList->sub.Bitmap ) ) return 1;
- defList->sub.x=x;
- defList->sub.y=y;
- defList->sub.width=defList->sub.Bitmap.Width;
- defList->sub.height=defList->sub.Bitmap.Height;
- if ( sx && sy )
- {
- defList->sub.width=sx;
- defList->sub.height=sy;
- }
- mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] %d,%d %dx%d\n",defList->sub.x,defList->sub.y,defList->sub.width,defList->sub.height );
- }
- if ( !strcmp( window_name,"menu" ) )
- {
- defList->menuIsPresent=1;
- defList->menuBase.type=itBase;
- av_strlcpy(tmp, path, sizeof( tmp )); av_strlcat(tmp, fname, sizeof( tmp ));
- if ( skinBPRead( tmp,&defList->menuBase.Bitmap ) ) return 1;
- defList->menuBase.width=defList->menuBase.Bitmap.Width;
- defList->menuBase.height=defList->menuBase.Bitmap.Height;
-#ifdef CONFIG_XSHAPE
- Convert32to1( &defList->menuBase.Bitmap,&defList->menuBase.Mask,0x00ff00ff );
- mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] mask: %dx%d\n",defList->menuBase.Mask.Width,defList->menuBase.Mask.Height );
-#else
- defList->menuBase.Mask.Image=NULL;
-#endif
- mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] width: %d height: %d\n",defList->menuBase.width,defList->menuBase.height );
- }
- if ( !strcmp( window_name,"playbar" ) )
- {
- defList->barIsPresent=1;
- defList->bar.x=x;
- defList->bar.y=y;
- defList->bar.type=itBase;
- av_strlcpy(tmp, path, sizeof( tmp )); av_strlcat(tmp, fname, sizeof( tmp ));
- if ( skinBPRead( tmp,&defList->bar.Bitmap ) ) return 1;
- defList->bar.width=defList->bar.Bitmap.Width;
- defList->bar.height=defList->bar.Bitmap.Height;
-#ifdef CONFIG_XSHAPE
- Convert32to1( &defList->bar.Bitmap,&defList->bar.Mask,0x00ff00ff );
- mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] mask: %dx%d\n",defList->bar.Mask.Width,defList->bar.Mask.Height );
-#else
- defList->bar.Mask.Image=NULL;
-#endif
- mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] width: %d height: %d\n",defList->bar.width,defList->bar.height );
- }
- return 0;
-}
-
-int cmd_background( char * in )
-{
- CHECKDEFLIST( "background" );
- CHECKWINLIST( "background" );
-
- CHECK( "menu" );
- CHECK( "main" );
-
- currSection->R=cutItemToInt( in,',',0 );
- currSection->G=cutItemToInt( in,',',1 );
- currSection->B=cutItemToInt( in,',',2 );
- mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"\n[skin] background color is #%x%x%x.\n",currSection->R,currSection->G,currSection->B );
-
- return 0;
-}
-
-int cmd_button( char * in )
-{
- unsigned char fname[512];
- unsigned char tmp[512];
- int x,y,sx,sy;
- char msg[32];
-
- CHECKDEFLIST( "button" );
- CHECKWINLIST( "button" );
-
- CHECK( "sub" );
- CHECK( "menu" );
-
- cutItem( in,fname,',',0 );
- x=cutItemToInt( in,',',1 );
- y=cutItemToInt( in,',',2 );
- sx=cutItemToInt( in,',',3 );
- sy=cutItemToInt( in,',',4 );
- cutItem( in,msg,',',5 );
-
- (*currSubItem)++;
- currSubItems[ *currSubItem ].type=itButton;
- currSubItems[ *currSubItem ].x=x;
- currSubItems[ *currSubItem ].y=y;
- currSubItems[ *currSubItem ].width=sx;
- currSubItems[ *currSubItem ].height=sy;
- mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"\n[skin] button: fname: %s\n",fname );
- mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] x: %d y: %d sx: %d sy: %d\n",x,y,sx,sy );
-
- if ( ( currSubItems[ *currSubItem ].msg=appFindMessage( msg ) ) == -1 )
- { ERRORMESSAGE( MSGTR_SKIN_BITMAP_UnknownMessage,msg ); return 0; }
- currSubItems[ *currSubItem ].pressed=btnReleased;
- if ( currSubItems[ *currSubItem ].msg == evPauseSwitchToPlay ) currSubItems[ *currSubItem ].pressed=btnDisabled;
- currSubItems[ *currSubItem ].tmp=1;
-
- mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] message: %d\n",currSubItems[ *currSubItem ].msg );
-
- currSubItems[ *currSubItem ].Bitmap.Image=NULL;
- if ( strcmp( fname,"NULL" ) )
- {
- av_strlcpy(tmp, path, sizeof( tmp )); av_strlcat(tmp, fname, sizeof( tmp ));
- if ( skinBPRead( tmp,&currSubItems[ *currSubItem ].Bitmap ) ) return 1;
- }
-
- return 0;
-}
-
-int cmd_selected( char * in )
-{
- unsigned char fname[512];
- unsigned char tmp[512];
-
- CHECKDEFLIST( "selected" );
- CHECKWINLIST( "selected" );
-
- CHECK( "main" );
- CHECK( "sub" );
- CHECK( "playbar" );
-
- cutItem( in,fname,',',0 );
- defList->menuSelected.type=itBase;
- av_strlcpy(tmp, path, sizeof( tmp )); av_strlcat(tmp, fname, sizeof( tmp ));
- mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"\n[skin] selected: %s\n",fname );
- if ( skinBPRead( tmp,&defList->menuSelected.Bitmap ) ) return 1;
- defList->menuSelected.width=defList->menuSelected.Bitmap.Width;
- defList->menuSelected.height=defList->menuSelected.Bitmap.Height;
- mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] width: %d height: %d\n",defList->menuSelected.width,defList->menuSelected.height );
- return 0;
-}
-
-int cmd_menu( char * in )
-{ // menu = number,x,y,sx,sy,msg
- int x,y,sx,sy,msg;
- unsigned char tmp[64];
-
- CHECKDEFLIST( "menu" );
- CHECKWINLIST( "menu" );
-
- CHECK( "main" );
- CHECK( "sub" );
- CHECK( "playbar" );
-
- x=cutItemToInt( in,',',0 );
- y=cutItemToInt( in,',',1 );
- sx=cutItemToInt( in,',',2 );
- sy=cutItemToInt( in,',',3 );
- cutItem( in,tmp,',',4 ); msg=appFindMessage( tmp );
-
- defList->NumberOfMenuItems++;
- defList->MenuItems[ defList->NumberOfMenuItems ].x=x;
- defList->MenuItems[ defList->NumberOfMenuItems ].y=y;
- defList->MenuItems[ defList->NumberOfMenuItems ].width=sx;
- defList->MenuItems[ defList->NumberOfMenuItems ].height=sy;
-
- mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"\n[skin] menuitem: %d\n",defList->NumberOfMenuItems );
- mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] x: %d y: %d sx: %d sy: %d\n",x,y,sx,sy );
-
- if ( ( defList->MenuItems[ defList->NumberOfMenuItems ].msg=msg ) == -1 )
- ERRORMESSAGE( MSGTR_SKIN_BITMAP_UnknownMessage,tmp );
-
- mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] message: %d\n",defList->Items[ defList->NumberOfItems ].msg );
-
- defList->MenuItems[ defList->NumberOfMenuItems ].Bitmap.Image=NULL;
- return 0;
-}
-
-int cmd_hpotmeter( char * in )
-{ // hpotmeter=buttonbitmaps,sx,sy,phasebitmaps,phases,default value,x,y,sx,sy,msg
- int x,y,psx,psy,ph,sx,sy,msg,d;
- unsigned char tmp[512];
- unsigned char pfname[512];
- unsigned char phfname[512];
- wItem * item;
-
- CHECKDEFLIST( "hpotmeter" );
- CHECKWINLIST( "hpotmeter" );
-
- CHECK( "sub" );
- CHECK( "menu" );
-
- cutItem( in,pfname,',',0 );
- psx=cutItemToInt( in,',',1 );
- psy=cutItemToInt( in,',',2 );
- cutItem( in,phfname,',',3 );
- ph=cutItemToInt( in,',',4 );
- d=cutItemToInt( in,',',5 );
- x=cutItemToInt( in,',',6 );
- y=cutItemToInt( in,',',7 );
- sx=cutItemToInt( in,',',8 );
- sy=cutItemToInt( in,',',9 );
- cutItem( in,tmp,',',10 ); msg=appFindMessage( tmp );
-
- mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"\n[skin] h/v potmeter: pointer filename: '%s'\n",pfname );
- mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] pointer size is %dx%d\n",psx,psy );
- mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] phasebitmaps filename: '%s'\n",phfname );
- mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] position: %d,%d %dx%d\n",x,y,sx,sy );
- mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] default value: %d\n",d );
- mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] message: %d\n",msg );
-
- (*currSubItem)++;
- item=&currSubItems[ *currSubItem ];
-
- item->type=itHPotmeter;
- item->x=x; item->y=y; item->width=sx; item->height=sy;
- item->phases=ph;
- item->psx=psx; item->psy=psy;
- item->msg=msg;
- item->value=(float)d;
- item->pressed=btnReleased;
-
- item->Bitmap.Image=NULL;
- if ( strcmp( phfname,"NULL" ) )
- {
- av_strlcpy(tmp, path, sizeof( tmp )); av_strlcat(tmp, phfname, sizeof( tmp ));
- if ( skinBPRead( tmp,&item->Bitmap ) ) return 1;
- }
-
- item->Mask.Image=NULL;
- if ( strcmp( pfname,"NULL" ) )
- {
- av_strlcpy(tmp, path, sizeof( tmp )); av_strlcat(tmp, pfname, sizeof( tmp ));
- if ( skinBPRead( tmp,&item->Mask ) ) return 1;
- }
- return 0;
-}
-
-int cmd_vpotmeter( char * in )
-{
- int r = cmd_hpotmeter( in );
- wItem * item;
-
- item=&currSubItems[ *currSubItem ];
- item->type=itVPotmeter;
- return r;
-}
-
-int cmd_potmeter( char * in )
-{ // potmeter=phasebitmaps,phases,default value,x,y,sx,sy,msg
- int x,y,ph,sx,sy,msg,d;
- unsigned char tmp[512];
- unsigned char phfname[512];
- wItem * item;
-
- CHECKDEFLIST( "potmeter" );
- CHECKWINLIST( "potmeter" );
-
- CHECK( "sub" );
- CHECK( "menu" );
-
- cutItem( in,phfname,',',0 );
- ph=cutItemToInt( in,',',1 );
- d=cutItemToInt( in,',',2 );
- x=cutItemToInt( in,',',3 );
- y=cutItemToInt( in,',',4 );
- sx=cutItemToInt( in,',',5 );
- sy=cutItemToInt( in,',',6 );
- cutItem( in,tmp,',',7 ); msg=appFindMessage( tmp );
-
- mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"\n[skin] potmeter: phases filename: '%s'\n",phfname );
- mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] position: %d,%d %dx%d\n",x,y,sx,sy );
- mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] phases: %d\n",ph );
- mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] default value: %d\n",d );
- mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] message: %d\n",msg );
-
- (*currSubItem)++;
- item=&currSubItems[ *currSubItem ];
-
- item->type=itPotmeter;
- item->x=x; item->y=y;
- item->width=sx; item->height=sy;
- item->phases=ph;
- item->msg=msg;
- item->value=(float)d;
-
- item->Bitmap.Image=NULL;
- if ( strcmp( phfname,"NULL" ) )
- {
- av_strlcpy(tmp, path, sizeof( tmp )); av_strlcat(tmp, phfname, sizeof( tmp ));
- if ( skinBPRead( tmp,&item->Bitmap ) ) return 1;
- }
- return 0;
-}
-
-int cmd_font( char * in )
-{ // font=fontname,fontid
- char name[512];
- char id[512];
- wItem * item;
-
- CHECKDEFLIST( "font" );
- CHECKWINLIST( "font" );
-
- CHECK( "sub" );
- CHECK( "menu" );
-
- cutItem( in,name,',',0 );
- cutItem( in,id,',',1 );
-
- mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"\n[skin] font\n" );
- mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] name: %s\n",name );
-
- (*currSubItem)++;
- item=&currSubItems[ *currSubItem ];
-
- item->type=itFont;
- item->fontid=fntRead( path,name );
- switch ( item->fontid )
- {
- case -1: ERRORMESSAGE( MSGTR_SKIN_FONT_NotEnoughtMemory ); return 1;
- case -2: ERRORMESSAGE( MSGTR_SKIN_FONT_TooManyFontsDeclared ); return 1;
- case -3: ERRORMESSAGE( MSGTR_SKIN_FONT_FontFileNotFound ); return 1;
- case -4: ERRORMESSAGE( MSGTR_SKIN_FONT_FontImageNotFound ); return 1;
- }
- return 0;
-}
-
-int cmd_slabel( char * in )
-{
- char tmp[512];
- char sid[63];
- int x,y,id;
- wItem * item;
-
- CHECKDEFLIST( "slabel" );
- CHECKWINLIST( "slabel" );
-
- CHECK( "sub" );
- CHECK( "menu" );
-
- mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"\n[skin] slabel\n" );
-
- x=cutItemToInt( in,',',0 );
- y=cutItemToInt( in,',',1 );
- cutItem( in,sid,',',2 ); id=fntFindID( sid );
- if ( id < 0 ) { ERRORMESSAGE( MSGTR_SKIN_FONT_NonExistentFontID,sid ); return 1; }
- cutItem( in,tmp,',',3 ); cutItem( tmp,tmp,'"',1 );
-
- mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] pos: %d,%d\n",x,y );
- mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] id: %s ( %d )\n",sid,id );
- mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] str: '%s'\n",tmp );
-
- (*currSubItem)++;
- item=&currSubItems[ *currSubItem ];
-
- item->type=itSLabel;
- item->fontid=id;
- item->x=x; item->y=y;
- item->width=-1; item->height=-1;
- if ( ( item->label=malloc( strlen( tmp ) + 1 ) ) == NULL ) { ERRORMESSAGE( MSGTR_SKIN_FONT_NotEnoughtMemory ); return 1; }
- strcpy( item->label,tmp );
-
- return 0;
-}
-
-int cmd_dlabel( char * in )
-{ // dlabel=x,y,sx,align,fontid,string ...
- char tmp[512];
- char sid[63];
- int x,y,sx,id,a;
- wItem * item;
-
- CHECKDEFLIST( "dlabel" );
- CHECKWINLIST( "dlabel" );
-
- CHECK( "sub" );
- CHECK( "menu" );
-
- mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"\n[skin] dlabel\n" );
-
- x=cutItemToInt( in,',',0 );
- y=cutItemToInt( in,',',1 );
- sx=cutItemToInt( in,',',2 );
- a=cutItemToInt( in,',',3 );
- cutItem( in,sid,',',4 ); id=fntFindID( sid );
- if ( id < 0 ) { ERRORMESSAGE( MSGTR_SKIN_FONT_NonExistentFontID,sid ); return 1; }
- cutItem( in,tmp,',',5 ); cutItem( tmp,tmp,'"',1 );
-
- mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] pos: %d,%d width: %d align: %d\n",x,y,sx,a );
- mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] id: %s ( %d )\n",sid,id );
- mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] str: '%s'\n",tmp );
-
- (*currSubItem)++;
- item=&currSubItems[ *currSubItem ];
-
- item->type=itDLabel;
- item->fontid=id; item->align=a;
- item->x=x; item->y=y;
- item->width=sx; item->height=-1;
- if ( ( item->label=malloc( strlen( tmp ) + 1 ) ) == NULL ) { ERRORMESSAGE( MSGTR_SKIN_FONT_NotEnoughtMemory ); return 1; }
- strcpy( item->label,tmp );
-
- return 0;
-}
-
-int cmd_decoration( char * in )
-{
- char tmp[512];
-
- CHECKDEFLIST( "decoration" );
- CHECKWINLIST( "decoration" );
-
- CHECK( "sub" );
- CHECK( "menu" );
- CHECK( "playbar" );
-
- mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"\n[skin] window decoration is %s\n",in );
- strlower( in );
- cutItem( in,tmp,',',0 );
- if ( strcmp( tmp,"enable" )&&strcmp( tmp,"disable" ) ) { ERRORMESSAGE( MSGTR_SKIN_UnknownParameter,tmp ); return 1; }
- if ( strcmp( tmp,"enable" ) ) defList->mainDecoration=0;
- else defList->mainDecoration=1;
-
- mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"\n[skin] window decoration is %s\n",(defList->mainDecoration?"enabled":"disabled") );
- return 0;
-}
-
-typedef struct
-{
- const char * name;
- int (*func)( char * in );
-} _item;
-
-_item skinItem[] =
- {
- { "section", cmd_section },
- { "end", cmd_end },
- { "window", cmd_window },
- { "base", cmd_base },
- { "button", cmd_button },
- { "selected", cmd_selected },
- { "background", cmd_background },
- { "vpotmeter", cmd_vpotmeter },
- { "hpotmeter", cmd_hpotmeter },
- { "potmeter", cmd_potmeter },
- { "font", cmd_font },
- { "slabel", cmd_slabel },
- { "dlabel", cmd_dlabel },
- { "decoration", cmd_decoration },
- { "menu", cmd_menu }
- };
-
-#define ITEMS (int)( sizeof( skinItem )/sizeof( _item ) )
-
-char * trimleft( char * in )
-{
- int c = 0;
- char * out;
- if ( strlen( in ) == 0 ) return NULL;
- while ( in[c] == ' ' ) c++;
- if ( c != 0 )
- {
- out=malloc( strlen( in ) - c + 1 );
- memcpy( out,&in[c],strlen( in ) - c + 1 );
- }
- else out=in;
- return out;
-}
-
-char * strswap( char * in,char what,char whereof )
-{
- int i;
- if ( strlen( in ) == 0 ) return NULL;
- for ( i=0;i<(int)strlen( in );i++ )
- if ( in[i] == what ) in[i]=whereof;
- return in;
-}
-
-char * trim( char * in )
-{
- int c = 0,i = 0,id = 0;
- if ( strlen( in ) == 0 ) return NULL;
- while ( c != (int)strlen( in ) )
- {
- if ( in[c] == '"' ) id=!id;
- if ( ( in[c] == ' ' )&&( !id ) )
- {
- for ( i=0;i<(int)strlen( in ) - c; i++ ) in[c+i]=in[c+i+1];
- continue;
- }
- c++;
- }
- return in;
-}
-
-FILE * skinFile;
-
-void setname( char * item1, char * item2 )
-{
- av_strlcpy(fn, item1, sizeof( fn ));
- av_strlcat(fn, "/", sizeof( fn )); av_strlcat(fn, item2, sizeof( fn ));
- av_strlcpy(path, fn, sizeof( path )); av_strlcat(path, "/", sizeof( path ));
- av_strlcat(fn, "/skin", sizeof( fn ));
-}
-
-int skinRead( char * dname )
-{
- unsigned char tmp[255];
- unsigned char * ptmp;
- unsigned char command[32];
- unsigned char param[256];
- int c,i;
-
- setname( skinDirInHome,dname );
- if ( ( skinFile = fopen( fn,"rt" ) ) == NULL )
- {
- setname( skinMPlayerDir,dname );
- if ( ( skinFile = fopen( fn,"rt" ) ) == NULL )
- {
- setname( skinDirInHome_obsolete,dname );
- if ( ( skinFile = fopen( fn,"rt" ) ) == NULL )
- {
- setname( skinMPlayerDir_obsolete,dname );
- if ( ( skinFile = fopen( fn,"rt" ) ) == NULL )
- {
- setname( skinMPlayerDir,dname );
- mp_msg( MSGT_GPLAYER,MSGL_STATUS,MSGTR_SKIN_SkinFileNotFound,fn );
- return -1;
- }
- }
- }
- }
-
- mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[skin] file: %s\n",fn );
-
- appInitStruct( skinAppMPlayer );
-
- linenumber=0;
- while (fgets(tmp, 255, skinFile))
- {
- linenumber++;
-
- // remove any kind of newline, if any
- tmp[strcspn(tmp, "\n\r")] = 0;
- for ( c=0;c<(int)strlen( tmp );c++ )
- if ( tmp[c] == ';' )
- {
- tmp[c]=0;
- break;
- }
- if ( strlen( tmp ) == 0 ) continue;
- ptmp=trimleft( tmp );
- if ( strlen( ptmp ) == 0 ) continue;
- ptmp=strswap( ptmp,'\t',' ' );
- ptmp=trim( ptmp );
-
- cutItem( ptmp,command,'=',0 ); cutItem( ptmp,param,'=',1 );
- strlower( command );
- for( i=0;i<ITEMS;i++ )
- if ( !strcmp( command,skinItem[i].name ) )
- if ( skinItem[i].func( param ) ) return -2;
- }
- if (linenumber == 0) {
- mp_msg(MSGT_GPLAYER, MSGL_FATAL, MSGTR_SKIN_SkinFileNotReadable, fn);
- return -1;
- }
- return 0;
-}
diff --git a/gui/skin/skin.h b/gui/skin/skin.h
deleted file mode 100644
index 20005f2ca8..0000000000
--- a/gui/skin/skin.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * 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_GUI_SKIN_H
-#define MPLAYER_GUI_SKIN_H
-
-#include "gui/app.h"
-
-extern listItems * skinAppMPlayer;
-
-int skinRead( char * dname );
-int skinBPRead( char * fname, txSample * bf );
-
-// ---
-
-char * trimleft( char * in );
-char * strswap( char * in, char what, char whereof );
-char * trim( char * in );
-
-#endif /* MPLAYER_GUI_SKIN_H */
diff --git a/gui/win32/Changelog b/gui/win32/Changelog
deleted file mode 100644
index 3d8f621048..0000000000
--- a/gui/win32/Changelog
+++ /dev/null
@@ -1,317 +0,0 @@
-HISTORY
-2006/06/30 - Erik Augustson <erik_27can@yahoo.com>
-- Fixed display of wrong aspect ratios.
-
-2006/06/13 - Erik Augustson <erik_27can@yahoo.com>
-- Minor bugfixes.
-- Updated to current SVN
-
-2006/04/14 - Erik Augustson <erik_27can@yahoo.com>
-- Fixed a crash bug.
-- Fixed a major fullscreen bug (WinID wasn't getting
- reset when FS switching).
-
-2006/04/13 - Erik Augustson <erik_27can@yahoo.com>
-- More minor fixups
-
-2006/04/07 - Erik Augustson <erik_27can@yahoo.com>
-- Minor fixups to openurl and openfile from dialogs.c
-
-2006/04/06 - Erik Augustson <erik_27can@yahoo.com>
-- Fixed IPC and drag&drop appending files to the
- playlist instead of opening them right away.
-- Updated dvdnav patch.
-
-2006/04/03 - Erik Augustson <erik_27can@yahoo.com>
-- Fixed a long pathnames issue with WM_COPYDATA.
-- Fixed a minor crash happening when rendering the
- codec name.
-- Some code cleanup.
-
-2006/04/01 - Erik Augustson <erik_27can@yahoo.com>
-- Added ability to enable/disable videos displaying
- in the sub window in preferences.
-- Small fix in update_subwindow() for coming out
- of fullscreen when the sub window was minimized.
-
-2006/03/27 - Erik Augustson <erik_27can@yahoo.com>
-- Updated to current CVS.
-- Debug console now shows the extensions mplayer
- was compiled with.
-
-2006/03/23 - Erik Augustson <erik_27can@yahoo.com>
-- Fixed using -playlist and -shuffle.
-
-2006/03/22 - Erik Augustson <erik_27can@yahoo.com>
-- Fixed a small bug with input events for dialogs.
-
-2006/03/16 - Erik Augustson <erik_27can@yahoo.com>
-- Fixed left button mouse event in dvdnav patch.
-- More aspect fixes.
-- Fixed double-click in the playlist.
-- Fixed some drag&drop functionality.
-
-2006/03/14 - Erik Augustson <erik_27can@yahoo.com>
-- Simplified title/chapter selection dialog.
-- Code cleanup.
-
-2006/03/14 - Erik Augustson <erik_27can@yahoo.com>
-
-- Fixed resetting aspect on file ending in mplEnd()
-
-2006/03/13 - Erik Augustson <erik_27can@yahoo.com>
-- Fixed double click events, forgot to add CS_DBLCLKS
- to sub window's window style.
-- Fixed window focusing with drag&drop files.
-- Re-arranged some menu items, and added support for
- runtime aspect switching. This adds 3 lines to
- mplayer.c but is well worth it IMO.
-
-2006/03/12 - Erik Augustson <erik_27can@yahoo.com>
-- Fixed window positioning for both windows.
-- Added more mouse button events.
-
-2006/03/10 - Erik Augustson <erik_27can@yahoo.com>
-- Fixed mouse and sub window vanishing after coming
- out of fullscreen by end of file.
-- Fixed sub window popping up when switching to
- fullscreen and *not* using directx.
-- Added codec name to widgets to properly render
- in some skins.
-- Middle and scroll wheel mouse event should work
- now on the sub window.
-- #ifdef'd USE_DVDREAD to allow for compilation
- when disabling mpdvdkit.
-- Updated license information.
-
-2006/03/08 - Erik Augustson <erik_27can@yahoo.com>
-- Removed unnecessary playerinfo struct
-- Fixed movies playing at wrong aspects
-- Minor bugfixes all around
-
-2006/03/07 - Erik Augustson <erik_27can@yahoo.com>
-- Fixed some skin labels not displaying properly
-
-2006/03/06 - Gianluigi Tiesi <sherpya@netfarm.it>
-- Temporaly fix crash if no vo_driver is specified
- (interface.c:877)
-
-2006/02/28 - Erik Augustson <erik_27can@yahoo.com>
-- Added sub window. The sub window is the WinID
- (-wid) when using the directx vo. The sub window
- hides when the file is audio only, and as well
- when the vo is not directx, and automatically
- adjusts and maintains video aspect ratios
-- Minor fixups
-- TODO: Get WinID working when using gl2, and add
- fix for both windows if going out of bounds on
- right and bottom of screen.
-
-2006/01/30 - Erik Augustson <erik_27can@yahoo.com>
-- Fixed playing movies from network drives.
-
-2006/01/27 - Erik Augustson <erik_27can@yahoo.com>
-- Fixed a small annoyance when playing a network file
- with file associations when mplayer wasn't running,
- using GetLongPathNameA()
-
-2006/01/15 - Erik Augustson <erik_27can@yahoo.com>
-- Added some CD functionality if using libcdio.
-
-2005/12/02 - Erik Augustson <erik_27can@yahoo.com>
-- Fix to disable gui if running in slave mode.
-
-2005/11/14 - Erik Augustson <erik_27can@yahoo.com>
-- Implemented IPC with WM_COPYDATA to open new
- files/playlists in the current running mplayer,
- rather than having a new mplayer process spawn.
-
-2005/11/12 - Erik Augustson <erik_27can@yahoo.com>
-- Modified evMute to mute/unmute
-- Mute button should show as pressed when muted
-- Added evDecVolume and evIncVolume
-
-2005/11/09 - Erik Augustson <erik_27can@yahoo.com>
-- Fixed screensaver issues
-
-2005/11/06 - Erik Augustson <erik_27can@yahoo.com>
-- Display fixes
-
-2005/09/18 - Erik Augustson <erik_27can@yahoo.com>
-- Playlist additions
-- Minor playlist bugfixes
-
-2005/09/16 - Gianluigi Tiesi <sherpya@netfarm.it>
-- Code cleanup
-
-2005/09/05 - Erik Augustson <erik_27can@yahoo.com>
-- Updated to apply to current CVS
-
-2005/07/27 - Erik Augustson <erik_27can@yahoo.com>
-- Added initial evEqualizer for brightness, contrast,
- hue and saturation of videos.
-
-2005/07/26 - Erik Augustson <erik_27can@yahoo.com>
-- Fixed double click on playlist
-- Added support for screenshot video filter, vf_screenshot patch
- is also needed
-
-2005/06/19 - Gianluigi Tiesi <sherpya@netfarm.it>
-- Removed -console switch, moved console stuff out of mplayer main,
- console option is handled in wincfg, it's switchable at runtime
- from the gui and the state is saved
-
-2005/06/15 - Erik Augustson <erik_27can@yahoo.com>
-- Fixed bugs with DVD chapter skipping
-- Title/chapter switching dialog works again :)
-- Fixed a bug with url's not working after playing a DVD
-- Removed fullscreen handling from mplayer.c. It's now
- handled in interface.c
-- Disabled loading/saving playlists, and adding files/urls
- while playing a DVD
-
-2005/06/12 - Gianluigi Tiesi <sherpya@netfarm.it>
-- Added -console cmd line option to bring up a dos console
- that displays mplayer messages
-
-2005/06/10 - Erik Augustson <erik_27can@yahoo.com>
-- Fixed a bug with the audio filters not loading
-- Fixed bugs with the audio delay and stereo sliders
-- Added a few safety checks
-
-2005/06/08 - Erik Augustson <erik_27can@yahoo.com>
-- Added initial evPreferences
-- Fixed a bug with the load subtitle dialog
-- Some code cleanup and minor fixes here and there
-
-2005/06/02 - Erik Augustson <erik_27can@yahoo.com>
-- Fixed a bug with pathnames in the open url dialog
-
-2005/05/26 - Erik Augustson <erik_27can@yahoo.com>
-- Added "Add file" and "Add url" menu to the playlist
-- Fixed file skipping when double-clicking playlist entries
-
-2005/05/19 - Erik Augustson <erik_27can@yahoo.com>
-- added simple url history
-
-2005/05/12 - Erik Augustson <erik_27can@yahoo.com>
-- added load and save playlists options
-- fixed opening remote m3u and pls files in open url
-- no problems so far with evprev and evnext :)
-
-2005/05/10 - Erik Augustson <erik_27can@yahoo.com>
-- more evNext and evPrev fixes
-
-2005/05/06 - Erik Augustson <erik_27can@yahoo.com>
-- implemented mplEnd() for proper looping fix
-- fixed bugs in evNext and evPrev
-- re-organized the menus
-
-2005/03/02 - Gianluigi Tiesi <sherpya@netfarm.it>
-- adapted subtitle patch from Raul <zomps@mail.astar.ee>
-- readapted endless loop fix to not touch mp_msg.c
-Erik Augustson <erik_27can@yahoo.com>
-- small fixes, orginal endless loop fix
-
-2005/02/25 - Gianluigi Tiesi <sherpya@netfarm.it>
-- Fixed exit stuff (I hope ;P)
-- Fixes to Erik's title/chapter selector
-Erik Augustson <erik_27can@yahoo.com>
-- Added additional gui events
-- Added evPrev and evNext dvd chapter switching
-
-2005/02/23 - Erik Augustson <erik_27can@yahoo.com>
-- added dvd title/chapter switching
-
-2005/02/20 - Gianluigi Tiesi <sherpya@netfarm.it>
-- fixed dvd stop and play
-Erik Augustson <erik_27can@yahoo.com>
-- imported some stuff from unix gui
-- fixed file play after dvd
-
-2005/02/18 - Erik Augustson <erik_27can@yahoo.com>
-- addons for dvd playing
-
-2005/02/16 - Gianluigi Tiesi <sherpya@netfarm.it>
-- renamed README to README.txt
-- retain window position even when switching the skin
-- converted all opendir calls to native win32 calls
-- adding filename as title without directory for all calls
-- more cleanups in skinloader/unloader
-- removed a lot of warnings
-- removed unused includes
-Erik Augustson <erik_27can@yahoo.com>
-- added online help menu
-
-2005/02/15 - Gianluigi Tiesi <sherpya@netfarm.it>
-- Disabled access to gui when gui->mainwindow doesn't match hwnd passed to windproc
-- Fixed save position for main window gui
-- Cleanups in skinloader/unloader
-Erik Augustson erik_27can@yahoo.com
-- Added saving main window position to gui config
-- Fixes on playlist for vcd
-
-2005/02/13 - Gianluigi Tiesi <sherpya@netfarm.it>
-- Fixed multithreaded (I hope ;P)
-- Skinbrowser window is closed when a skin is changed, this prevents crashes if multiple clicks
-- Playlist window is updated if files are added while playlist is visible
-- Removed patch on mplayer.rc, take icon using the included routine
-- SkinBrowser and Playlist dialogs can be opened/closed by clicking multiple times gui buttons
-- Added support for DVD, stop dvd + play is broken ;(
-- ifdef-ed a lot of debug stuff
-- Fixed systray icon removing
-- Added Erik and me to about dialog ;)
-Erik Augustson <erik_27can@yahoo.com>
-- Added key handling for the gui window
-- Small fixes on tray icon stuff
-
-2005/02/11 - Gianluigi Tiesi <sherpya@netfarm.it>
-- fixed sliders, balance is not 100% working, anyway dsound output driver doesn't support balanced audio
-- remade threaded
-- removed demuxer/avi patches, really needed ??
-- added a fake vo_init if opengl is not enabled
-Erik Augustson <erik_27can@yahoo.com>
-- fixes on traymenu play
-- added a base configuration reader/writer - only support for skin selection for now
-
-2005/02/10 - Gianluigi Tiesi <sherpya@netfarm.it>
-- fixed (workarounded) the NULL filename bug
-- moved add directory directly into gui.c
-- it starts to be usable :)
-Erik Augustson <erik_27can@yahoo.com>
-- Added systray support
-- Added skin browser option to menu (some skins don't show a skin browser button)
-
-2005/02/09 - Gianluigi Tiesi <sherpya@netfarm.it>
-- Fixed window disappearing bug
-- Made a patch compatible with current tree
-- Fixed icons in minor dialogs
-- Major cleanup and code reorganization
-
-2005/02/08 - Erik Augustson <erik_27can@yahoo.com>
-- Removed multi-threading, mplayer now runs in a single thread
-- Play directory now works as intended
-- Added a Skin browser, double-click skin names to switch skins
-- Still more things todo
-
-pre4
-- URL open
-- use windows native menus
-- GUI runs in a separate thread now because some controls interrupt playback :(
-
-pre 3
-- some of the previous features broken again
-- full font loading/display support
-- better integration into mplayer
-- seek bar, balance, volume control work
-
-pre 2
-- playlist
-- Drag 'N Drop support
-- fixed segfault when no skinfile found
-
-pre 1
-- initial revision
-- play/pause works
-- loads "blue" skin
-- still lot of things todo
diff --git a/gui/win32/README b/gui/win32/README
deleted file mode 100644
index 2d572a1913..0000000000
--- a/gui/win32/README
+++ /dev/null
@@ -1,21 +0,0 @@
-MPlayer Windows GUI (c)
-2003 Sascha Sommer - <saschasommer@freenet.de>
-2006 Erik Augustson - <erik_27can@yahoo.com>
-2006 Gianluigi Tiesi - <sherpya@netfarm.it>
-
-This beta GUI for Windows was originally written by Sascha Sommer and
-has since been heavily modified by myself (Erik Augustson) and Gianluigi
-Tiesi. It follows the same concept as the Linux GUI, and should be able
-to load all (or at least most) of the current skins available for the
-Linux GUI.
-
-To compile, quite simply pass --enable-gui to configure, and it is highly
-recommended to also pass --enable-static="-mwindows" to link mplayer as
-a Windows binary. NOTE: This will also link mencoder with -mwindows
-and thus link mencoder as a Windows binary as well.
-
-To enable use of the GUI, mplayer.exe must be renamed / copied to
-gmplayer.exe.
-
-Please send all bug reports/comments/requests/gripes to:
-<erik_27can@yahoo.com>
diff --git a/gui/win32/dialogs.c b/gui/win32/dialogs.c
deleted file mode 100644
index 60a8d8c759..0000000000
--- a/gui/win32/dialogs.c
+++ /dev/null
@@ -1,1122 +0,0 @@
-/*
- * MPlayer GUI for Win32
- * Copyright (C) 2003 Sascha Sommer <saschasommer@freenet.de>
- * Copyright (C) 2006 Erik Augustson <erik_27can@yahoo.com>
- * Copyright (C) 2006 Gianluigi Tiesi <sherpya@netfarm.it>
- *
- * 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
- */
-
-#include <windows.h>
-#include <commctrl.h>
-#include <get_path.h>
-#include "gui/interface.h"
-#include "mp_msg.h"
-#include "help_mp.h"
-#include "stream/stream.h"
-#include "libmpdemux/demuxer.h"
-#include "libmpdemux/stheader.h"
-#include "gui.h"
-#include "dialogs.h"
-#include "libvo/sub.h"
-
-WNDPROC OldUrlWndProc;
-LRESULT CALLBACK SubUrlWndProc(HWND, UINT, WPARAM, LPARAM);
-extern int vo_gamma_brightness;
-extern int vo_gamma_saturation;
-extern int vo_gamma_contrast;
-extern int vo_gamma_hue;
-int set_video_colors(sh_video_t *sh_video, const char *item, int value);
-int get_video_colors(sh_video_t *sh_video, const char *item, int *value);
-
-guiInterface_t guiIntfStruct;
-int addurl = 0;
-
-extern mp_osd_obj_t* vo_osd_list;
-extern char **sub_name;
-
-void guiLoadSubtitle(char *name)
-{
- if (!guiIntfStruct.Playing)
- {
- guiIntfStruct.SubtitleChanged = 1;
- return;
- }
- if (subdata)
- {
- mp_msg(MSGT_GPLAYER, MSGL_INFO, MSGTR_DeletingSubtitles);
- sub_free(subdata);
- subdata = NULL;
- vo_sub = NULL;
- if (vo_osd_list)
- {
- int len;
- mp_osd_obj_t *osd = vo_osd_list;
- while (osd)
- {
- if (osd->type == OSDTYPE_SUBTITLE) break;
- osd = osd->next;
- }
- if (osd && osd->flags & OSDFLAG_VISIBLE)
- {
- len = osd->stride * (osd->bbox.y2 - osd->bbox.y1);
- memset(osd->bitmap_buffer, 0, len);
- memset(osd->alpha_buffer, 0, len);
- }
- }
- }
-
- if (name)
- {
- mp_msg(MSGT_GPLAYER, MSGL_INFO, MSGTR_LoadingSubtitles, name);
- subdata = sub_read_file(strdup(name), guiIntfStruct.FPS);
- if (!subdata) mp_msg(MSGT_GPLAYER, MSGL_ERR, MSGTR_CantLoadSub,name);
- sub_name = (malloc(2 * sizeof(char*))); /* when mplayer will be restarted */
- sub_name[0] = strdup(name); /* sub_name[0] will be read */
- sub_name[1] = NULL;
- }
- update_set_of_subtitles();
-}
-
-int display_openfilewindow(gui_t *gui, int add)
-{
- OPENFILENAME fileopen;
- int result = 0;
- char filelist[MAXFILE];
- char filename[MAX_PATH];
- char directory[MAX_PATH];
- char *filespec = NULL;
- char *filepart = NULL;
-
- memset(&fileopen, 0, sizeof(OPENFILENAME));
- memset(filelist, 0, sizeof(filelist));
-
- fileopen.lStructSize = sizeof(OPENFILENAME);
- fileopen.hwndOwner = gui->mainwindow;
- fileopen.hInstance = GetModuleHandle(NULL);
- fileopen.lpstrFilter = "All Files (*.*)\0*.*\0"
- "Media Files (*.avi;*.asf;*.wmv;*.mpg;*.mpeg;*.m2v;*.mov;\
- *.rmvb;*.rm;*.ogm;*.mp3;*.wav;*.wma;*.ra;*.ogg)\0\
- *.avi;*.asf;*.wmv;*.mpg;*.mpeg;*.m2v;*.mov;\
- *.rmvb;*.rm;*.ogm;*.mp3;*.wav;*.wma;*.ra;*.ogg\0"
- "Video Files (*.avi;*.mpg;*.mpeg;*.mov)\0*.avi;*.mpg;*.mpeg;*.mov\0"
- "Avisynth Scripts (*.avs)\0*.avs\0"
- "Audio Files (*.mp3;*.wav;*.ra)\0*.mp3;*.wav;*.ra\000";
- fileopen.nFilterIndex = 0;
- fileopen.lpstrTitle = "Add file(s)...";
- fileopen.Flags = OFN_ALLOWMULTISELECT | OFN_FILEMUSTEXIST| OFN_LONGNAMES | OFN_EXPLORER| OFN_READONLY | OFN_HIDEREADONLY;
- fileopen.lpstrFile = filelist;
- fileopen.lpstrCustomFilter = NULL;
- fileopen.nMaxFile = MAXFILE;
-
- if(GetOpenFileName(&fileopen))
- {
- /* clear playlist */
- if(!add) gui->playlist->clear_playlist(gui->playlist);
-
- memcpy(directory, fileopen.lpstrFile, fileopen.nFileOffset - 1);
- directory[fileopen.nFileOffset - 1] = 0;
-
- do
- {
- filespec = &fileopen.lpstrFile[fileopen.nFileOffset];
- filename[0] = 0;
- strcat(filename, directory);
- strcat(filename, "\\");
- strcat(filename, filespec);
-
- if (GetFileAttributes(filename) & FILE_ATTRIBUTE_DIRECTORY)
- mp_msg(MSGT_GPLAYER, MSGL_V, "[GUI] %s is a directory, skipping...\n", filename);
- else
- {
- if (GetFullPathName(filename, MAX_PATH, filename, &filepart))
- {
- mplSetFileName(NULL, filename, STREAMTYPE_FILE);
- if(!parse_filename(filename, playtree, mconfig, 0))
- gui->playlist->add_track(gui->playlist, filename, NULL, filepart, 0);
- mp_msg(MSGT_GPLAYER, MSGL_V, "[GUI] Adding file: %s - path %s\n", filespec, filename);
- result++;
- }
- }
- fileopen.nFileOffset += strlen(filespec) + 1;
- } while (*filespec);
- }
- return result;
-}
-
-void display_opensubtitlewindow(gui_t *gui)
-{
- OPENFILENAME subtitleopen;
- char subtitlefile[MAX_PATH];
-
- /* Safety check */
- if (guiIntfStruct.Playing == 0 || !guiIntfStruct.sh_video) return;
-
- memset(&subtitleopen, 0, sizeof(OPENFILENAME));
- memset(subtitlefile, 0, sizeof(subtitlefile));
-
- subtitleopen.lStructSize = sizeof(OPENFILENAME);
- subtitleopen.hwndOwner = gui->mainwindow;
- subtitleopen.hInstance = GetModuleHandle(NULL);
- subtitleopen.lpstrFilter = "All Files (*.*)\0*.*\0"
- "Subtitle Files (*.srt;*.txt;*.vob)\0*.srt;*.txt;*.vob\0";
- subtitleopen.nFilterIndex = 0;
- subtitleopen.lpstrTitle = "Add Subtitle...";
- subtitleopen.Flags = OFN_FILEMUSTEXIST | OFN_LONGNAMES | OFN_EXPLORER | OFN_READONLY | OFN_HIDEREADONLY;
- subtitleopen.lpstrFile = subtitlefile;
- subtitleopen.lpstrCustomFilter = NULL;
- subtitleopen.nMaxFile = MAXFILE;
-
- if(GetOpenFileName(&subtitleopen))
- guiLoadSubtitle(subtitlefile);
-}
-
-void display_loadplaylistwindow(gui_t *gui)
-{
- OPENFILENAME playlistopen;
- char playlistfile[MAX_PATH];
-
- memset(&playlistopen, 0, sizeof(OPENFILENAME));
- memset(playlistfile, 0, sizeof(playlistfile));
-
- playlistopen.lStructSize = sizeof(OPENFILENAME);
- playlistopen.hwndOwner = gui->mainwindow;
- playlistopen.hInstance = GetModuleHandle(NULL);
- playlistopen.lpstrFilter = "All Files (*.*)\0*.*\0"
- "Playlist Files (*.m3u;*.pls;*.txt)\0*.m3u;*.pls;*.txt\0";
- playlistopen.nFilterIndex = 0;
- playlistopen.lpstrTitle = "Load Playlist...";
- playlistopen.Flags = OFN_FILEMUSTEXIST | OFN_LONGNAMES | OFN_EXPLORER | OFN_READONLY | OFN_HIDEREADONLY;
- playlistopen.lpstrFile = playlistfile;
- playlistopen.lpstrCustomFilter = NULL;
- playlistopen.nMaxFile = MAXFILE;
-
- if(GetOpenFileName(&playlistopen))
- {
- if(parse_filename(playlistfile, playtree, mconfig, 1))
- gui->startplay(gui);
- }
-}
-
-void display_saveplaylistwindow(gui_t* gui)
-{
- OPENFILENAME playlistsave;
- static FILE *playlist_file = NULL;
- char playlistname[MAX_PATH];
-
- memset(&playlistsave, 0, sizeof(OPENFILENAME));
- memset(playlistname, 0, sizeof(playlistname));
-
- playlistsave.lStructSize = sizeof(OPENFILENAME);
- playlistsave.hwndOwner = gui->mainwindow;
- playlistsave.hInstance = GetModuleHandle(NULL);
- playlistsave.lpstrFilter = "Playlist Files (*.pls)\0*.pls\0";
- playlistsave.nFilterIndex = 0;
- playlistsave.lpstrTitle = "Save Playlist...";
- playlistsave.Flags = OFN_LONGNAMES | OFN_EXPLORER | OFN_OVERWRITEPROMPT | OFN_HIDEREADONLY;
- playlistsave.lpstrFile = playlistname;
- playlistsave.lpstrCustomFilter = NULL;
- playlistsave.nMaxFile = MAXFILE;
-
- if(GetSaveFileName(&playlistsave))
- {
- int i=0;
- HANDLE my_playlist;
-
- if(!strstr(playlistname, ".pls")) strcat(playlistname, ".pls");
-
- my_playlist = CreateFile(playlistname,
- GENERIC_WRITE,
- 0,
- NULL,
- CREATE_ALWAYS,
- FILE_ATTRIBUTE_NORMAL | FILE_FLAG_OVERLAPPED,
- NULL);
-
- if(my_playlist != INVALID_HANDLE_VALUE)
- {
- CloseHandle(my_playlist); /* close the file first so we can write to it */
- playlist_file = fopen(playlistsave.lpstrFile, "w");
- fprintf(playlist_file, "[playlist]\n");
- fprintf(playlist_file, "numberofentries=%d\n", gui->playlist->trackcount);
-
- for(i=0; i<(gui->playlist->trackcount); i++)
- {
- fprintf(playlist_file, "File%i=%s\n", i + 1, gui->playlist->tracks[i]->filename);
- fprintf(playlist_file, "Length%i=-1\n", i + 1);
- }
- fclose(playlist_file);
- }
- }
-}
-
-static LRESULT CALLBACK OpenUrlWndProc(HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam)
-{
- static HWND url;
- HWND wdg;
- FILE *f;
- char *history = get_path("gui.url");
- gui_t *gui = (gui_t *) GetWindowLongPtr(hwnd, GWLP_USERDATA);
- switch (iMsg)
- {
- case WM_CREATE:
- wdg = CreateWindow("button", "Ok",
- WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,
- 4, 43, 80, 25, hwnd,
- (HMENU) ID_OK,
- ((LPCREATESTRUCT) lParam) -> hInstance,
- NULL);
- SendMessage(wdg, WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT), 0);
-
- wdg = CreateWindow("button", "Cancel",
- WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,
- 90, 43, 80, 25, hwnd,
- (HMENU) ID_CANCEL,
- ((LPCREATESTRUCT) lParam) -> hInstance,
- NULL);
- SendMessage(wdg, WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT), 0);
-
- url = wdg = CreateWindowEx(WS_EX_CLIENTEDGE,
- "edit", NULL,
- WS_CHILD | WS_VISIBLE | ES_LEFT | ES_AUTOHSCROLL,
- 4, 10, 300, 25, hwnd,
- (HMENU) ID_URL,
- ((LPCREATESTRUCT) lParam) -> hInstance,
- NULL);
- SendMessage(wdg, WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT), 0);
- SendMessage(wdg, EM_SETLIMITTEXT, MAX_PATH, 0);
-
- /*subclass the edit box to capture the VK_RETURN key*/
- OldUrlWndProc = (WNDPROC)SetWindowLongPtr(url, GWLP_WNDPROC, (LONG_PTR)SubUrlWndProc);
-
- if((f = fopen(history, "r")))
- {
- char lasturl[MAX_PATH];
- fgets(lasturl, MAX_PATH, f);
- SendMessage(url, WM_SETTEXT, 0, (LPARAM) lasturl);
- SendMessage(url, EM_SETSEL, 0, -1);
- fclose(f);
- }
- break;
- case WM_KEYDOWN:
- switch (LOWORD(wParam))
- {
- case VK_RETURN:
- SendMessage(hwnd, WM_COMMAND, (WPARAM) ID_OK, 0);
- break;
- }
- case WM_COMMAND:
- {
- switch (LOWORD(wParam))
- {
- case ID_CANCEL:
- DestroyWindow(hwnd);
- return 0;
- case ID_OK:
- {
- char file[MAX_PATH];
- SendMessage(url, WM_GETTEXT, MAX_PATH, (LPARAM) file);
- mplSetFileName(NULL, file, STREAMTYPE_STREAM);
- if((f = fopen(history, "wt+")))
- {
- fprintf(f, file);
- fclose(f);
- }
- if(!parse_filename(file, playtree, mconfig, addurl? 0 : 1))
- gui->playlist->add_track(gui->playlist, file, NULL, NULL, 0);
- if(!addurl)
- gui->startplay(gui);
- else update_playlistwindow();
- DestroyWindow(hwnd);
- }
- break;
- }
- }
- return 0;
- case WM_DESTROY:
- {
- addurl = 0;
- return 0;
- }
- }
- return DefWindowProc(hwnd, iMsg, wParam, lParam);
-}
-
-LRESULT CALLBACK SubUrlWndProc(HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam)
-{
- switch(iMsg)
- {
- case WM_KEYDOWN:
- switch (LOWORD(wParam))
- {
- case VK_RETURN:
- SendMessage(FindWindow(NULL, "MPlayer - Open URL..."), WM_COMMAND, (WPARAM) ID_OK, 0);
- break;
- }
- }
- return CallWindowProc(OldUrlWndProc, hwnd, iMsg, wParam, lParam);
-}
-
-void display_openurlwindow(gui_t *gui, int add)
-{
- HWND hWnd;
- HINSTANCE hInstance = GetModuleHandle(NULL);
- WNDCLASS wc;
- int x, y;
-
- if(add) addurl = 1;
- if(FindWindow(NULL, "MPlayer - Open URL...")) return;
- wc.style = CS_HREDRAW | CS_VREDRAW;
- wc.lpfnWndProc = OpenUrlWndProc;
- wc.cbClsExtra = 0;
- wc.cbWndExtra = 0;
- wc.hInstance = hInstance;
- wc.hCursor = LoadCursor(NULL,IDC_ARROW);
- wc.hIcon = gui->icon;
- wc.hbrBackground = SOLID_GREY2;
- wc.lpszClassName = "MPlayer - URL";
- wc.lpszMenuName = NULL;
- RegisterClass(&wc);
- x = (GetSystemMetrics(SM_CXSCREEN) / 2) - (320 / 2);
- y = (GetSystemMetrics(SM_CYSCREEN) / 2) - (100 / 2);
- hWnd = CreateWindow("MPlayer - URL",
- "MPlayer - Open URL...",
- WS_POPUPWINDOW | WS_CAPTION,
- x,
- y,
- 320,
- 100,
- NULL,
- NULL,
- hInstance,
- NULL);
- SetWindowLongPtr(hWnd, GWLP_USERDATA, (DWORD) gui);
- ShowWindow(hWnd, SW_SHOW);
- UpdateWindow(hWnd);
-}
-
-static void create_playlistmenu(gui_t *gui)
-{
- gui->playlistmenu = CreatePopupMenu();
- AppendMenu(gui->playlistmenu, MF_STRING, ID_ADDFILE, "Add File...");
- AppendMenu(gui->playlistmenu, MF_STRING, ID_ADDURL, "Add Url...");
- AppendMenu(gui->playlistmenu, MF_SEPARATOR, 0, 0);
- AppendMenu(gui->playlistmenu, MF_STRING, ID_REMOVE, "Remove Selected");
- AppendMenu(gui->playlistmenu, MF_STRING, ID_CLEAR, "Clear Playlist");
- AppendMenu(gui->playlistmenu, MF_SEPARATOR, 0, 0);
- AppendMenu(gui->playlistmenu, MF_STRING, ID_CLOSE, "Close");
-}
-
-static void updatetracklist(HWND hwnd)
-{
- int i=0;
- gui_t *gui = (gui_t *) GetWindowLongPtr(hwnd, GWLP_USERDATA);
- /* clear listbox */
- SendDlgItemMessage(hwnd, ID_TRACKLIST, LB_RESETCONTENT, 0, 0);
- for (i=0; i < gui->playlist->trackcount; i++)
- if (gui->playlist->tracks[i]->title)
- SendDlgItemMessage(hwnd, ID_TRACKLIST, LB_ADDSTRING, 0, (LPARAM)gui->playlist->tracks[i]->title);
- else
- SendDlgItemMessage(hwnd, ID_TRACKLIST, LB_ADDSTRING, 0, (LPARAM)gui->playlist->tracks[i]->filename);
-}
-
-static LRESULT CALLBACK PlayListWndProc(HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam)
-{
- HWND wdg;
- POINT cursor;
- gui_t *gui = (gui_t *) GetWindowLongPtr(hwnd, GWLP_USERDATA);
- playlist_t *pl = gui ? gui->playlist : NULL;
- switch (iMsg)
- {
- case WM_CREATE:
- {
- wdg = CreateWindow("button", "Play",
- WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,
- 4, 10, 80, 25, hwnd,
- (HMENU) ID_PLAY,
- ((LPCREATESTRUCT) lParam) -> hInstance,
- NULL);
- SendMessage(wdg, WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT), 0);
-
- wdg = CreateWindow ("button", "Up",
- WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,
- 4, 37, 80, 25, hwnd,
- (HMENU) ID_UP,
- ((LPCREATESTRUCT) lParam) -> hInstance,
- NULL);
- SendMessage(wdg, WM_SETFONT,(WPARAM) GetStockObject(DEFAULT_GUI_FONT), 0);
-
- wdg = CreateWindow ("button", "Down",
- WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,
- 4, 64, 80, 25, hwnd,
- (HMENU) ID_DOWN,
- ((LPCREATESTRUCT) lParam) -> hInstance,
- NULL);
- SendMessage(wdg, WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT),0);
-
- wdg = CreateWindow ("button", "Remove",
- WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,
- 4, 91, 80, 25, hwnd,
- (HMENU) ID_REMOVE,
- ((LPCREATESTRUCT) lParam) -> hInstance,
- NULL);
- SendMessage(wdg, WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT),0);
-
- wdg = CreateWindow ("button", "Load",
- WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,
- 4, 118, 80, 25, hwnd,
- (HMENU) ID_PLAYLISTLOAD,
- ((LPCREATESTRUCT) lParam) -> hInstance,
- NULL);
- SendMessage(wdg, WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT),0);
-
- wdg = CreateWindow ("button", "Save",
- WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,
- 4, 145, 80, 25, hwnd,
- (HMENU) ID_PLAYLISTSAVE,
- ((LPCREATESTRUCT) lParam) -> hInstance,
- NULL);
- SendMessage(wdg, WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT),0);
-
- wdg = CreateWindow ("button", "Close",
- WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,
- 4, 193, 80, 25, hwnd,
- (HMENU) ID_CLOSE,
- ((LPCREATESTRUCT) lParam) -> hInstance,
- NULL);
- SendMessage(wdg, WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT),0);
-
- wdg = CreateWindow ("listbox", "tracklist", WS_CHILD | WS_VISIBLE | LBS_NOTIFY | WS_VSCROLL |
- WS_HSCROLL | LBS_DISABLENOSCROLL, 92, 10, 300, 208, hwnd, (HMENU) ID_TRACKLIST,
- ((LPCREATESTRUCT) lParam) -> hInstance, NULL);
- SendMessage(wdg, WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT), 0);
- SendMessage(wdg, LB_SETHORIZONTALEXTENT, MAX_PATH*4, 0);
- break;
- }
- case WM_CONTEXTMENU:
- {
- GetCursorPos(&cursor);
- SetForegroundWindow(hwnd);
- TrackPopupMenu(gui->playlistmenu, 0, cursor.x, cursor.y, 0, hwnd, NULL);
- break;
- }
- case WM_COMMAND:
- {
- int selected = 0;
- int i;
- for (i=0; i<pl->trackcount; i++)
- if(0 < SendDlgItemMessage(hwnd, ID_TRACKLIST, LB_GETSEL, i, 0)) selected = i + 1;
- switch (LOWORD(wParam))
- {
- case ID_CLOSE:
- DestroyWindow(hwnd);
- return 0;
- case ID_TRACKLIST:
- if(HIWORD(wParam) == LBN_DBLCLK)
- {
- case ID_PLAY:
- if(selected) pl->current = selected - 1;
- mplSetFileName(NULL, pl->tracks[pl->current]->filename, STREAMTYPE_STREAM);
- gui->startplay(gui);
- }
- return 0;
- case ID_UP:
- {
- if(selected) pl->moveup_track(pl, selected);
- selected--;
- break;
- }
- case ID_DOWN:
- {
- if(selected) pl->movedown_track(pl, selected);
- selected++;
- break;
- }
- case ID_REMOVE:
- if(selected) pl->remove_track(pl, selected);
- break;
- case ID_ADDFILE:
- {
- if(guiIntfStruct.StreamType == STREAMTYPE_DVD ||
- guiIntfStruct.StreamType == STREAMTYPE_DVDNAV) return 0;
- display_openfilewindow(gui, 1);
- break;
- }
- case ID_ADDURL:
- {
- if(guiIntfStruct.StreamType == STREAMTYPE_DVD ||
- guiIntfStruct.StreamType == STREAMTYPE_DVDNAV) return 0;
- display_openurlwindow(gui, 1);
- break;
- }
- case ID_CLEAR:
- {
- if(!gui->playlist->trackcount) return 0;
- gui->playlist->clear_playlist(gui->playlist);
- break;
- }
- case ID_PLAYLISTLOAD:
- {
- if(guiIntfStruct.StreamType == STREAMTYPE_DVD ||
- guiIntfStruct.StreamType == STREAMTYPE_DVDNAV) return 0;
- display_loadplaylistwindow(gui);
- break;
- }
- case ID_PLAYLISTSAVE:
- {
- /* no point saving an empty playlist */
- if(!gui->playlist->trackcount ||
- guiIntfStruct.StreamType == STREAMTYPE_DVD ||
- guiIntfStruct.StreamType == STREAMTYPE_DVDNAV)
- return 0;
- display_saveplaylistwindow(gui);
- break;
- }
- }
- updatetracklist(hwnd);
- if(selected < 1) selected = 1;
- else if(selected>pl->trackcount) selected = pl->trackcount;
- SendDlgItemMessage(hwnd, ID_TRACKLIST, LB_SETCURSEL, selected - 1, 0);
- return 0;
- }
- case WM_DROPFILES:
- {
- char file[MAX_PATH];
- int filecount = DragQueryFile((HDROP) wParam, -1, file, MAX_PATH);
- int i;
- for (i=0; i<filecount; i++)
- {
- DragQueryFile((HDROP) wParam, i, file, MAX_PATH);
- if(!parse_filename(file, playtree, mconfig, 0))
- pl->add_track(pl, file, NULL, NULL, 0);
- }
- DragFinish((HDROP) wParam);
- updatetracklist(hwnd);
- }
- break;
- }
- return DefWindowProc(hwnd, iMsg, wParam, lParam);
-}
-
-void update_playlistwindow(void)
-{
- HWND hWnd = FindWindow(NULL, "MPlayer Playlist");
- if (hWnd) updatetracklist(hWnd);
-}
-
-void display_playlistwindow(gui_t *gui)
-{
- HWND hWnd = FindWindow(NULL, "MPlayer Playlist");
- HINSTANCE hInstance = GetModuleHandle(NULL);
- WNDCLASS wc;
- int x, y;
-
- if (hWnd)
- {
- SendMessage(hWnd, WM_CLOSE, 0, 0);
- return;
- }
-
- wc.style = CS_HREDRAW | CS_VREDRAW;
- wc.lpfnWndProc = PlayListWndProc;
- wc.cbClsExtra = 0;
- wc.cbWndExtra = 0;
- wc.hInstance = hInstance;
- wc.hCursor = LoadCursor(NULL,IDC_ARROW);
- wc.hIcon = gui->icon;
- wc.hbrBackground = SOLID_GREY2;
- wc.lpszClassName = "MPlayer - Playlist";
- wc.lpszMenuName = NULL;
- RegisterClass(&wc);
- create_playlistmenu(gui);
- x = (GetSystemMetrics(SM_CXSCREEN) / 2) - (400 / 2); /* Erik: center popup window on screen */
- y = (GetSystemMetrics(SM_CYSCREEN) / 2) - (254 / 2);
- hWnd = CreateWindow("MPlayer - Playlist",
- "MPlayer Playlist",
- WS_POPUPWINDOW | WS_CAPTION | WS_MINIMIZEBOX,
- x,
- y,
- 400,
- 254,
- NULL,
- NULL,
- hInstance,
- NULL);
- SetWindowLongPtr(hWnd, GWLP_USERDATA, (DWORD)gui);
- updatetracklist(hWnd);
- DragAcceptFiles(hWnd,TRUE);
- ShowWindow(hWnd, SW_SHOW);
- UpdateWindow(hWnd);
-}
-
-static LRESULT CALLBACK SkinBrowserWndProc(HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam)
-{
- static HWND listbox;
- static char skinspath[MAX_PATH];
- gui_t* gui = (gui_t*) GetWindowLongPtr(hwnd, GWLP_USERDATA);
- switch (iMsg)
- {
- case WM_CREATE:
- {
- HANDLE skinHandle = INVALID_HANDLE_VALUE;
- WIN32_FIND_DATA finddata;
-
- listbox = CreateWindow("listbox", NULL,
- WS_CHILD | WS_VISIBLE | LBS_NOTIFY | LBS_NOINTEGRALHEIGHT |
- LBS_DISABLENOSCROLL | WS_VSCROLL | WS_TABSTOP,
- 4, 5, 166, 60, hwnd,
- (HMENU) ID_DIR,
- ((LPCREATESTRUCT) lParam) -> hInstance,
- NULL);
- SendMessage(listbox, WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT), 0);
-
- /* This opens the skins directory, lists the directory names, and adds them to the listbox */
- sprintf(skinspath, "%s/*.", get_path("skins"));
-
- skinHandle = FindFirstFile(skinspath, &finddata);
- if (skinHandle != INVALID_HANDLE_VALUE)
- {
- do
- {
- if (finddata.cFileName[0] == '.') continue;
- /* populate the listbox */
- capitalize(finddata.cFileName);
- SendDlgItemMessage(hwnd, ID_DIR, LB_ADDSTRING, 0, (LPARAM) finddata.cFileName);
- } while (FindNextFile(skinHandle, &finddata));
- FindClose(skinHandle);
- }
- else
- mp_msg(MSGT_GPLAYER, MSGL_FATAL, "Error opening %s\n", get_path("skins"));
- break;
- }
- case WM_COMMAND:
- {
- if ((HWND) lParam == listbox)
- {
- if(HIWORD(wParam) == LBN_DBLCLK)
- {
- int index = SendMessage(listbox, LB_GETCURSEL, 0, 0);
- int len = SendMessage(listbox, LB_GETTEXTLEN, index, 0);
- if (len)
- {
- if (guiIntfStruct.Playing) guiGetEvent(guiCEvent, (void *) guiSetStop);
- if (skinName) free(skinName);
- skinName = (char *) malloc(len+1);
- SendMessage(listbox, LB_GETTEXT, (WPARAM) index, (LPARAM) skinName);
- /* fill out the full pathname to the skin */
- strcpy(skinspath, get_path("skins"));
- strcat(skinspath, "\\");
- strcat(skinspath, skinName);
- ShowWindow(hwnd, SW_HIDE);
- Shell_NotifyIcon(NIM_DELETE, &nid);
- destroy_window(gui);
- create_window(gui, skinspath);
- create_subwindow(gui, skinspath);
- SendMessage(hwnd, WM_CLOSE, 0, 0); /* Avoid crashing when switching skin */
- }
- }
- }
- }
- return 0;
- }
- return DefWindowProc(hwnd, iMsg, wParam, lParam);
-}
-
-void display_skinbrowser(gui_t* gui)
-{
- HWND hWnd = FindWindow(NULL, "Skin Browser");
- HINSTANCE hInstance = GetModuleHandle(NULL);
- WNDCLASS wc;
- int x, y;
-
- if (hWnd)
- {
- SendMessage(hWnd, WM_CLOSE, 0, 0);
- return;
- }
-
- wc.style = CS_HREDRAW | CS_VREDRAW;
- wc.lpfnWndProc = SkinBrowserWndProc;
- wc.cbClsExtra = 0;
- wc.cbWndExtra = 0;
- wc.hInstance = hInstance;
- wc.hCursor = LoadCursor(NULL, IDC_ARROW);
- wc.hIcon = gui->icon;
- wc.hbrBackground = SOLID_GREY2;
- wc.lpszClassName = "Skin Browser";
- wc.lpszMenuName = NULL;
- RegisterClass(&wc);
- x = (GetSystemMetrics(SM_CXSCREEN) / 2) - (180 / 2);
- y = (GetSystemMetrics(SM_CYSCREEN) / 2) - (102 / 2);
- hWnd = CreateWindow("Skin Browser",
- "Skin Browser",
- WS_POPUPWINDOW |WS_CAPTION,
- x,
- y,
- 180,
- 102,
- NULL,
- NULL,
- hInstance,
- NULL);
- SetWindowLongPtr(hWnd, GWLP_USERDATA, (DWORD) gui);
- ShowWindow(hWnd, SW_SHOW);
- UpdateWindow(hWnd);
-}
-
-#ifdef CONFIG_DVDREAD
-static LRESULT CALLBACK TitleChapterWndProc(HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam)
-{
- static HWND title;
- static HWND chapter;
- HWND wdg;
- int i=0, j=0;
- char titles[MAX_PATH] = "";
- char chapters[MAX_PATH] = "";
- gui_t *gui = (gui_t *) GetWindowLongPtr(hwnd, GWLP_USERDATA);
- switch (iMsg)
- {
- case WM_CREATE:
- wdg = CreateWindow("button", "Ok",
- WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,
- 4, 43, 80, 25, hwnd,
- (HMENU) ID_OK,
- ((LPCREATESTRUCT) lParam) -> hInstance,
- NULL);
- SendMessage(wdg, WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT), 0);
-
- wdg = CreateWindow("button", "Cancel",
- WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,
- 90, 43, 80, 25, hwnd,
- (HMENU) ID_CANCEL,
- ((LPCREATESTRUCT) lParam) -> hInstance,
- NULL);
- SendMessage(wdg, WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT), 0);
-
- title = CreateWindow("combobox", NULL,
- CBS_DROPDOWNLIST | CB_SHOWDROPDOWN | CBS_NOINTEGRALHEIGHT | CBS_HASSTRINGS |
- WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_TABSTOP,
- 4, 10, 80, 160, hwnd,
- (HMENU) ID_TITLESEL,
- ((LPCREATESTRUCT) lParam) -> hInstance,
- NULL);
-
- SendMessage(title, WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT), 0);
-
- chapter = CreateWindow("combobox", NULL,
- CBS_DROPDOWNLIST | CB_SHOWDROPDOWN | CBS_NOINTEGRALHEIGHT | CBS_HASSTRINGS |
- WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_TABSTOP,
- 90, 10, 80, 160, hwnd,
- (HMENU) ID_CHAPTERSEL,
- ((LPCREATESTRUCT) lParam) -> hInstance,
- NULL);
- SendMessage(chapter, WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT), 0);
-
- for (i=0; i<guiIntfStruct.DVD.titles; i++)
- {
- /* we have to reverse the order here because of the way CB_INSERTSTRING adds items */
- sprintf(&titles[i], "%d", guiIntfStruct.DVD.titles - i);
- SendDlgItemMessage(hwnd, ID_TITLESEL, CB_INSERTSTRING, 0, (LPARAM) &titles[i]);
- }
- SendDlgItemMessage(hwnd, ID_TITLESEL, CB_SETCURSEL, dvd_title, 0);
-
- for (j=0; j<guiIntfStruct.DVD.chapters; j++)
- {
- sprintf(&chapters[j], "%d", guiIntfStruct.DVD.chapters - j);
- SendDlgItemMessage(hwnd, ID_CHAPTERSEL, CB_INSERTSTRING, 0, (LPARAM) &chapters[j]);
- }
- SendDlgItemMessage(hwnd, ID_CHAPTERSEL, CB_SETCURSEL, dvd_chapter, 0);
-
- break;
- case WM_COMMAND:
- {
- switch (LOWORD(wParam))
- {
- case ID_CANCEL:
- DestroyWindow(hwnd);
- return 0;
- case ID_OK:
- {
- guiIntfStruct.DVD.current_title = SendMessage(title, CB_GETCURSEL, 0, 0) + 1;
- guiIntfStruct.DVD.current_chapter = SendMessage(chapter, CB_GETCURSEL, 0, 0) + 1;
-
- if((guiIntfStruct.DVD.current_title != 0 || guiIntfStruct.DVD.current_chapter != 0))
- {
- gui->startplay(gui);
- DestroyWindow(hwnd);
- }
- }
- break;
- }
- }
- return 0;
- }
- return DefWindowProc(hwnd, iMsg, wParam, lParam);
-}
-
-void display_chapterselwindow(gui_t *gui)
-{
- HWND hWnd;
- HINSTANCE hInstance = GetModuleHandle(NULL);
- WNDCLASS wc;
- int x, y;
-
- if (guiIntfStruct.StreamType != STREAMTYPE_DVD) return;
- if (FindWindow(NULL, "Select Title/Chapter...")) return;
-
- wc.style = CS_HREDRAW | CS_VREDRAW;
- wc.lpfnWndProc = TitleChapterWndProc;
- wc.cbClsExtra = 0;
- wc.cbWndExtra = 0;
- wc.hInstance = hInstance;
- wc.hCursor = LoadCursor(NULL,IDC_ARROW);
- wc.hIcon = gui->icon;
- wc.hbrBackground = SOLID_GREY2;
- wc.lpszClassName = "Select Title/Chapter...";
- wc.lpszMenuName = NULL;
- RegisterClass(&wc);
- x = (GetSystemMetrics(SM_CXSCREEN) / 2) - (180 / 2);
- y = (GetSystemMetrics(SM_CYSCREEN) / 2) - (100 / 2);
- hWnd = CreateWindow("Select Title/Chapter...",
- "Select Title/Chapter...",
- WS_POPUPWINDOW | WS_CAPTION,
- x,
- y,
- 180,
- 100,
- NULL,
- NULL,
- hInstance,
- NULL);
- SetWindowLongPtr(hWnd, GWLP_USERDATA, (DWORD) gui);
- ShowWindow(hWnd, SW_SHOW);
- UpdateWindow(hWnd);
-}
-#endif
-
-static LRESULT CALLBACK EqWndProc(HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam)
-{
- HWND btn, label, eq0, eq1, eq2, eq3;
-
- switch (iMsg)
- {
- case WM_CREATE:
- {
- btn = CreateWindow("button", "Reset",
- WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,
- 157, 143, 80, 25, hwnd,
- (HMENU) ID_DEFAULTS,
- ((LPCREATESTRUCT) lParam) -> hInstance,
- NULL);
- SendMessage(btn, WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT), 0);
-
- btn = CreateWindow("button", "Close",
- WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,
- 243, 143, 80, 25, hwnd,
- (HMENU) ID_CLOSE,
- ((LPCREATESTRUCT) lParam) -> hInstance,
- NULL);
- SendMessage(btn, WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT), 0);
-
- label = CreateWindow("static", "Brightness",
- WS_CHILD | WS_VISIBLE,
- 12, 122, 70, 15, hwnd,
- NULL,
- ((LPCREATESTRUCT) lParam) -> hInstance,
- NULL);
- SendMessage(label, WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT), 0);
-
- label = CreateWindow("static", "Contrast",
- WS_CHILD | WS_VISIBLE,
- 99, 122, 70, 15, hwnd,
- NULL,
- ((LPCREATESTRUCT) lParam) -> hInstance,
- NULL);
- SendMessage(label, WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT), 0);
-
- label = CreateWindow("static", "Hue",
- WS_CHILD | WS_VISIBLE,
- 191, 122, 70, 15, hwnd,
- NULL,
- ((LPCREATESTRUCT) lParam) -> hInstance, NULL);
- SendMessage(label, WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT), 0);
-
- label = CreateWindow("static", "Saturation",
- WS_CHILD | WS_VISIBLE,
- 260, 122, 70, 15, hwnd,
- NULL,
- ((LPCREATESTRUCT) lParam) -> hInstance,
- NULL);
- SendMessage(label, WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT), 0);
-
- eq0 = CreateWindow(TRACKBAR_CLASS, "brightness",
- WS_CHILD | WS_VISIBLE | WS_TABSTOP | WS_DISABLED |
- TBS_VERT | TBS_NOTICKS,
- 30, 0, 20, 120, hwnd,
- (HMENU) ID_EQ0,
- ((LPCREATESTRUCT) lParam) -> hInstance,
- NULL);
- SendDlgItemMessage(hwnd, ID_EQ0, TBM_SETRANGE, 1, MAKELONG(0, 200));
-
- eq1 = CreateWindow(TRACKBAR_CLASS, "contrast",
- WS_CHILD | WS_VISIBLE | WS_TABSTOP | WS_DISABLED |
- TBS_VERT | TBS_NOTICKS,
- 112, 0, 20, 120, hwnd,
- (HMENU) ID_EQ1,
- ((LPCREATESTRUCT) lParam) -> hInstance,
- NULL);
- SendDlgItemMessage(hwnd, ID_EQ1, TBM_SETRANGE, 1, MAKELONG(0, 200));
-
- eq2 = CreateWindow(TRACKBAR_CLASS, "hue",
- WS_CHILD | WS_VISIBLE | WS_TABSTOP | WS_DISABLED |
- TBS_VERT | TBS_NOTICKS,
- 194, 0, 20, 120, hwnd,
- (HMENU) ID_EQ2,
- ((LPCREATESTRUCT) lParam) -> hInstance,
- NULL);
- SendDlgItemMessage(hwnd, ID_EQ2, TBM_SETRANGE, 1, MAKELONG(0, 200));
-
- eq3 = CreateWindow(TRACKBAR_CLASS, "saturation",
- WS_CHILD | WS_VISIBLE | WS_TABSTOP | WS_DISABLED |
- TBS_VERT | TBS_NOTICKS,
- 276, 0, 20, 120, hwnd,
- (HMENU) ID_EQ3,
- ((LPCREATESTRUCT) lParam) -> hInstance, NULL);
- SendDlgItemMessage(hwnd, ID_EQ3, TBM_SETRANGE, 1, MAKELONG(0, 200));
-
- if(guiIntfStruct.sh_video && guiIntfStruct.Playing)
- {
- EnableWindow(eq0, 1); EnableWindow(eq1, 1); EnableWindow(eq2, 1); EnableWindow(eq3, 1);
- get_video_colors(guiIntfStruct.sh_video, "brightness", &vo_gamma_brightness);
- get_video_colors(guiIntfStruct.sh_video, "contrast", &vo_gamma_contrast);
- get_video_colors(guiIntfStruct.sh_video, "hue", &vo_gamma_hue);
- get_video_colors(guiIntfStruct.sh_video, "saturation", &vo_gamma_saturation);
- }
- SendDlgItemMessage(hwnd, ID_EQ0, TBM_SETPOS, 1, (LPARAM)100 - vo_gamma_brightness);
- SendDlgItemMessage(hwnd, ID_EQ1, TBM_SETPOS, 1, (LPARAM)100 - vo_gamma_contrast);
- SendDlgItemMessage(hwnd, ID_EQ2, TBM_SETPOS, 1, (LPARAM)100 - vo_gamma_hue);
- SendDlgItemMessage(hwnd, ID_EQ3, TBM_SETPOS, 1, (LPARAM)100 - vo_gamma_saturation);
- break;
- }
- case WM_VSCROLL:
- {
- switch (LOWORD(wParam))
- {
- case TB_THUMBTRACK:
- if(guiIntfStruct.sh_video && guiIntfStruct.Playing)
- {
- vo_gamma_brightness = 100 - SendDlgItemMessage(hwnd, ID_EQ0, TBM_GETPOS, 0, 0);
- set_video_colors(guiIntfStruct.sh_video, "brightness", vo_gamma_brightness);
-
- vo_gamma_contrast = 100 - SendDlgItemMessage(hwnd, ID_EQ1, TBM_GETPOS, 0, 0);
- set_video_colors(guiIntfStruct.sh_video, "contrast", vo_gamma_contrast);
-
- vo_gamma_hue = 100 - SendDlgItemMessage(hwnd, ID_EQ2, TBM_GETPOS, 0, 0);
- set_video_colors(guiIntfStruct.sh_video, "hue", vo_gamma_hue);
-
- vo_gamma_saturation = 100 - SendDlgItemMessage(hwnd, ID_EQ3, TBM_GETPOS, 0, 0);
- set_video_colors(guiIntfStruct.sh_video, "saturation", vo_gamma_saturation);
- }
- else
- {
- EnableWindow(GetDlgItem(hwnd, ID_EQ0), 0);
- EnableWindow(GetDlgItem(hwnd, ID_EQ1), 0);
- EnableWindow(GetDlgItem(hwnd, ID_EQ2), 0);
- EnableWindow(GetDlgItem(hwnd, ID_EQ3), 0);
- }
- break;
- }
- }
- case WM_CTLCOLORDLG:
- case WM_CTLCOLORSTATIC:
- {
- HDC hdc = (HDC)wParam;
- SetBkMode(hdc, TRANSPARENT);
- return (INT_PTR)SOLID_GREY2;
- }
- break;
- case WM_COMMAND:
- {
- switch (LOWORD(wParam))
- {
- case ID_CLOSE:
- DestroyWindow(hwnd);
- return 0;
- case ID_DEFAULTS:
- if(guiIntfStruct.sh_video && guiIntfStruct.Playing)
- {
- vo_gamma_brightness=0;
- SendDlgItemMessage(hwnd, ID_EQ0, TBM_SETPOS, 1, (LPARAM)100);
- set_video_colors(guiIntfStruct.sh_video, "brightness", vo_gamma_brightness);
-
- vo_gamma_contrast=0;
- SendDlgItemMessage(hwnd, ID_EQ1, TBM_SETPOS, 1, (LPARAM)100);
- set_video_colors(guiIntfStruct.sh_video, "contrast", vo_gamma_contrast);
-
- vo_gamma_hue=0;
- SendDlgItemMessage(hwnd, ID_EQ2, TBM_SETPOS, 1, (LPARAM)100);
- set_video_colors(guiIntfStruct.sh_video, "hue", vo_gamma_hue);
-
- vo_gamma_saturation=0;
- SendDlgItemMessage(hwnd, ID_EQ3, TBM_SETPOS, 1, (LPARAM)100);
- set_video_colors(guiIntfStruct.sh_video, "saturation", vo_gamma_saturation);
- }
- break;
- }
- }
- return 0;
- }
- return DefWindowProc(hwnd, iMsg, wParam, lParam);
-}
-
-void display_eqwindow(gui_t *gui)
-{
- HWND hWnd;
- HINSTANCE hInstance = GetModuleHandle(NULL);
- WNDCLASS wc;
- int x, y;
-
- if(!guiIntfStruct.sh_video) return;
- if(FindWindow(NULL, "MPlayer - Equalizer")) return;
- wc.style = CS_HREDRAW | CS_VREDRAW;
- wc.lpfnWndProc = EqWndProc;
- wc.cbClsExtra = 0;
- wc.cbWndExtra = 0;
- wc.hInstance = hInstance;
- wc.hCursor = LoadCursor(NULL,IDC_ARROW);
- wc.hIcon = gui->icon;
- wc.hbrBackground = SOLID_GREY2;
- wc.lpszClassName = "MPlayer - Equalizer";
- wc.lpszMenuName = NULL;
- RegisterClass(&wc);
- x = (GetSystemMetrics(SM_CXSCREEN) / 2) - (332 / 2);
- y = (GetSystemMetrics(SM_CYSCREEN) / 2) - (200 / 2);
- hWnd = CreateWindow("MPlayer - Equalizer",
- "MPlayer - Equalizer",
- WS_POPUPWINDOW | WS_CAPTION,
- x,
- y,
- 332,
- 200,
- NULL,
- NULL,
- hInstance,
- NULL);
- SetWindowLongPtr(hWnd, GWLP_USERDATA, (DWORD) gui);
- ShowWindow(hWnd, SW_SHOW);
- UpdateWindow(hWnd);
-}
diff --git a/gui/win32/dialogs.h b/gui/win32/dialogs.h
deleted file mode 100644
index 94026b0c44..0000000000
--- a/gui/win32/dialogs.h
+++ /dev/null
@@ -1,134 +0,0 @@
-/*
- * MPlayer GUI for Win32
- * Copyright (C) 2003 Sascha Sommer <saschasommer@freenet.de>
- * Copyright (C) 2006 Erik Augustson <erik_27can@yahoo.com>
- * Copyright (C) 2006 Gianluigi Tiesi <sherpya@netfarm.it>
- *
- * 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_GUI_DIALOGS_H
-#define MPLAYER_GUI_DIALOGS_H
-
-#define TBS_TOOLTIPS 0x0100
-#define WM_SYSTRAY (WM_USER+1)
-#define UDM_SETRANGE32 (WM_USER+111)
-#define UDM_GETRANGE32 (WM_USER+112)
-#define UDM_SETPOS32 (WM_USER+113)
-#define UDM_GETPOS32 (WM_USER+114)
-
-#define SOLID_GREY (HBRUSH) CreateSolidBrush(RGB(232, 232, 232))
-#define SOLID_GREY2 (HBRUSH) CreateSolidBrush(RGB(175, 175, 175))
-
-#define gfree free
-
-#define MAXFILE 1024
-
-#define COPYRIGHT " MPlayer GUI for Windows\n\n" \
- " Copyright (c) 2003 Sascha Sommer\n" \
- " Copyright (c) 2006 Erik Augustson\n" \
- " Copyright (c) 2006 Gianluigi Tiesi"
-
-#define ONLINE_HELP_URL "http://www.mplayerhq.hu/DOCS/HTML/en/index.html"
-
-#define ID_OK 12
-#define ID_APPLY 13
-#define ID_CANCEL 14
-#define ID_CLOSE 15
-#define ID_DEFAULTS 16
-#define ID_VO_DRIVER 17
-#define ID_AO_DRIVER 18
-#define ID_DOUBLE 19
-#define ID_DIRECT 20
-#define ID_FRAMEDROP 21
-#define ID_NORMALIZE 22
-#define ID_SOFTMIX 23
-#define ID_EXTRASTEREO 24
-#define ID_TRACKBAR1 25
-#define ID_TRACKBAR2 26
-#define ID_UPDOWN1 27
-#define ID_UPDOWN2 28
-#define ID_EDIT1 29
-#define ID_EDIT2 30
-#define ID_CACHE 31
-#define ID_AUTOSYNC 32
-#define ID_NONE 33
-#define ID_OSD1 34
-#define ID_OSD2 35
-#define ID_OSD3 36
-#define ID_DVDDEVICE 37
-#define ID_CDDEVICE 38
-#define ID_PRIO 39
-#define ID_URL 40
-#define ID_TITLESEL 41
-#define ID_UP 42
-#define ID_DOWN 43
-#define ID_REMOVE 44
-#define ID_ADDFILE 45
-#define ID_TRACKLIST 46
-#define ID_SUBTITLE 47
-#define ID_PLAYLISTLOAD 48
-#define ID_PLAYLISTSAVE 49
-#define ID_ADDURL 50
-#define ID_DIR 51
-#define ID_PLAY 52
-#define ID_STOP 53
-#define ID_SEEKF 54
-#define ID_SEEKB 55
-#define ID_NTRACK 56
-#define ID_PTRACK 57
-#define ID_PLAYLIST 58
-#define ID_CLEAR 59
-#define ID_SHOWHIDE 60
-#define ID_SKINBROWSER 61
-#define ID_KEYHELP 62
-#define ID_ONLINEHELP 63
-#define ID_CHAPTERSEL 64
-#define ID_PREFS 65
-#define TRAYMENU 66
-#define IDFILE_OPEN 67
-#define IDEXIT 68
-#define IDURL_OPEN 69
-#define IDDIR_OPEN 70
-#define IDFILE_NEW 71
-#define IDFILE_SAVE 72
-#define IDHELP_ABOUT 73
-#define IDSUBTITLE_OPEN 74
-#define IDPLAYDISK 75
-#define ID_CONSOLE 76
-#define ID_EQ0 77
-#define ID_EQ1 78
-#define ID_EQ2 79
-#define ID_EQ3 80
-#define IDSUB_TOGGLE 81
-#define IDSUB_CYCLE 82
-#define ID_ASPECT1 83
-#define ID_ASPECT2 84
-#define ID_ASPECT3 85
-#define ID_ASPECT4 86
-#define ID_SUBWINDOW 87
-#define ID_TIMER 88
-#define ID_MUTE 89
-#define ID_FULLSCREEN 90
-
-/* gtk emulation */
-#define GTK_MB_FATAL 0x1
-#define GTK_MB_ERROR 0x2
-#define GTK_MB_WARNING 0x4
-#define GTK_MB_SIMPLE 0x8
-
-#endif /* MPLAYER_GUI_DIALOGS_H */
diff --git a/gui/win32/gui.c b/gui/win32/gui.c
deleted file mode 100644
index d9d86f58a3..0000000000
--- a/gui/win32/gui.c
+++ /dev/null
@@ -1,1549 +0,0 @@
-/*
- * MPlayer GUI for Win32
- * Copyright (C) 2003 Sascha Sommer <saschasommer@freenet.de>
- * Copyright (C) 2006 Erik Augustson <erik_27can@yahoo.com>
- * Copyright (C) 2006 Gianluigi Tiesi <sherpya@netfarm.it>
- *
- * 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
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <ctype.h>
-#include <fcntl.h>
-#include <windows.h>
-#include <windowsx.h>
-#include <shlobj.h>
-
-#include "version.h"
-#include "mplayer.h"
-#include "mp_fifo.h"
-#include "mp_msg.h"
-#include "help_mp.h"
-#include "input/input.h"
-#include "input/mouse.h"
-#include "osdep/keycodes.h"
-#include "stream/stream.h"
-#include "libvo/video_out.h"
-#include "gui/interface.h"
-#include "gui.h"
-#include "dialogs.h"
-
-// HACK around bug in old mingw
-#undef INVALID_FILE_ATTRIBUTES
-#define INVALID_FILE_ATTRIBUTES ((DWORD)-1)
-
-#ifndef WM_XBUTTONDOWN
-# define WM_XBUTTONDOWN 0x020B
-# define WM_XBUTTONUP 0x020C
-# define WM_XBUTTONDBLCLK 0x020D
-#endif
-
-/* Globals / Externs */
-void renderinfobox(skin_t *skin, window_priv_t *priv);
-void renderwidget(skin_t *skin, image *dest, widget *item, int state);
-void print_version(void);
-float sub_aspect;
-
-DWORD oldtime;
-NOTIFYICONDATA nid;
-int console_state = 0;
-play_tree_t *playtree = NULL;
-
-static HBRUSH colorbrush = NULL; //Handle to colorkey brush
-static COLORREF windowcolor = RGB(255,0,255); //Windowcolor == colorkey
-
-void console_toggle(void)
-{
- if (console_state)
- {
- FreeConsole();
- console = 0;
- console_state = 0;
- }
- else
- {
- /* This code comes from: http://dslweb.nwnexus.com/~ast/dload/guicon.htm */
- CONSOLE_SCREEN_BUFFER_INFO coninfo;
- FILE *fp;
- HWND hwnd = NULL;
- console = 1;
- AllocConsole();
- SetConsoleTitle(MP_TITLE);
-
- /* disable the close button for now */
- while (!hwnd)
- {
- hwnd = FindWindow(NULL, MP_TITLE);
- Sleep(100);
- }
- DeleteMenu(GetSystemMenu(hwnd, 0), SC_CLOSE, MF_BYCOMMAND);
-
- GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE), &coninfo);
- coninfo.dwSize.Y = 1000;
- SetConsoleScreenBufferSize(GetStdHandle(STD_OUTPUT_HANDLE), coninfo.dwSize);
- fp = freopen("con", "w", stdout);
- *stdout = *fp;
- setvbuf(stdout, NULL, _IONBF, 0);
- fp = freopen("con", "r", stdin);
- *stdin = *fp;
- setvbuf(stdin, NULL, _IONBF, 0);
- fp = freopen("con", "w", stdout);
- *stderr = *fp;
- setvbuf(stderr, NULL, _IONBF, 0);
- print_version();
- console_state = 1;
- }
-}
-
-void capitalize(char *filename)
-{
- unsigned int i;
- BOOL cap = TRUE;
- for (i=0; i < strlen(filename); i++)
- {
- if (cap)
- {
- cap = FALSE;
- filename[i] = toupper(filename[i]);
- }
- else if (filename[i] == ' ')
- cap = TRUE;
- else
- filename[i] = tolower(filename[i]);
- }
-}
-
-static image *get_drawground(HWND hwnd)
-{
- gui_t * gui = (gui_t *) GetWindowLongPtr(hwnd, GWLP_USERDATA);
- unsigned int i;
- if(!gui) return NULL;
- for(i=0; i<gui->window_priv_count; i++)
- if(gui->window_priv[i]->hwnd==hwnd)
- return &gui->window_priv[i]->img;
- return NULL;
-}
-
-static HBITMAP get_bitmap(HWND hwnd)
-{
- gui_t *gui = (gui_t *) GetWindowLongPtr(hwnd, GWLP_USERDATA);
- unsigned int i;
- if(!gui) return NULL;
- for(i=0; i<gui->window_priv_count; i++)
- if(gui->window_priv[i]->hwnd == hwnd)
- return gui->window_priv[i]->bitmap;
- return NULL;
-}
-
-static int get_windowtype(HWND hwnd)
-{
- gui_t *gui = (gui_t *) GetWindowLongPtr(hwnd, GWLP_USERDATA);
- unsigned int i;
- if(!gui) return -1;
- for(i=0; i<gui->window_priv_count; i++)
- if(gui->window_priv[i]->hwnd == hwnd)
- return gui->window_priv[i]->type;
- return -1;
-}
-
-static void uninit(gui_t *gui)
-{
- if(gui->skin) destroy_window(gui);
- if(gui->playlist) gui->playlist->free_playlist(gui->playlist);
- gui->playlist = NULL;
-}
-
-/*
- the gui message handler
- tries to handle the incoming messages
- and passes them to the player's message handler if it can't handle them
-*/
-static void handlemsg(HWND hWnd, int msg)
-{
- gui_t *gui = (gui_t *) GetWindowLongPtr(hWnd, GWLP_USERDATA);
- if(msg == evNone) return;
-
- switch(msg)
- {
- case evLoadPlay:
- case evLoad:
- if(display_openfilewindow(gui, 0) && (msg == evLoadPlay))
- handlemsg(hWnd, evDropFile);
- return;
- case evLoadSubtitle:
- display_opensubtitlewindow(gui);
- break;
- case evPreferences:
- display_prefswindow(gui);
- return;
- case evPlayList:
- display_playlistwindow(gui);
- return;
- case evSkinBrowser:
- display_skinbrowser(gui);
- break;
- case evEqualizer:
- display_eqwindow(gui);
- break;
- case evAbout:
- MessageBox(hWnd, COPYRIGHT, "About", MB_OK);
- break;
- case evIconify:
- ShowWindow(hWnd, SW_MINIMIZE);
- break;
- case evIncVolume:
- mplayer_put_key(KEY_VOLUME_UP);
- break;
- case evDecVolume:
- mplayer_put_key(KEY_VOLUME_DOWN);
- break;
- default:
- mp_msg(MSGT_GPLAYER, MSGL_V, "[GUI] received msg %s (%i)\n", gui->skin->geteventname(msg), msg);
- break;
- }
- gui->playercontrol(msg);
-}
-
-static widget *clickedinsidewidget(gui_t *gui, int window, int x, int y)
-{
- unsigned int i;
- widget *item;
- for(i=0; i<gui->skin->widgetcount; i++)
- {
- item = gui->skin->widgets[i];
- if((item->window == window) && (item->x <= x) && (item->x + item->width >= x) &&
- (item->y <= y) && (item->y + item->height >= y))
- return item;
- }
- return NULL;
-}
-
-/* updates sliders and the display */
-static void updatedisplay(gui_t *gui, HWND hwnd)
-{
- unsigned int i;
- window_priv_t *priv = NULL;
- DWORD time = timeGetTime();
-
- if(!hwnd) return;
-
- /* load all potmeters hpotmeters */
- for(i=0; i<gui->skin->widgetcount; i++)
- {
- if(gui->skin->widgets[i]->type == tyHpotmeter || gui->skin->widgets[i]->type == tyPotmeter)
- {
- if(gui->skin->widgets[i]->msg == evSetVolume)
- gui->skin->widgets[i]->value = guiIntfStruct.Volume;
- else if(gui->skin->widgets[i]->msg == evSetMoviePosition)
- gui->skin->widgets[i]->value = guiIntfStruct.Position;
- else if(gui->skin->widgets[i]->msg == evSetBalance)
- gui->skin->widgets[i]->value = guiIntfStruct.Balance;
- if(gui->skin->widgets[i]->window == get_windowtype(hwnd))
- renderwidget(gui->skin, get_drawground(hwnd), gui->skin->widgets[i],
- gui->skin->widgets[i]->pressed ? 0 : 1);
- }
- /* update some buttons */
- if(gui->skin->widgets[i]->type == tyButton && gui->skin->widgets[i]->window == get_windowtype(hwnd))
- {
- if(gui->skin->widgets[i]->msg == evPlaySwitchToPause)
- {
- gui->skin->widgets[i]->value = guiIntfStruct.Playing;
- renderwidget(gui->skin, get_drawground(hwnd), gui->skin->widgets[i],
- guiIntfStruct.Playing == 1 ? 0 : 1);
- }
- if(gui->skin->widgets[i]->msg == evMute)
- {
- gui->skin->widgets[i]->value = guiIntfStruct.Volume;
- renderwidget(gui->skin, get_drawground(hwnd), gui->skin->widgets[i],
- guiIntfStruct.Volume == 0.0f ? 0 : 1);
- }
- }
- }
-
- /* updating the display once a 100.second is enough imo */
- if((time - oldtime) < 100) return;
- oldtime=time;
-
- /* suppress directx's fullscreen window when using the sub window */
- if(sub_window && &video_driver_list[0] && strstr("directx", video_driver_list[0]))
- {
- HWND hWndFS = NULL; //handle to directx's fullscreen window
- if(hWndFS == NULL)
- {
- hWndFS = FindWindow(NULL, "MPlayer Fullscreen");
- if(hWndFS != NULL) DestroyWindow(hWndFS); //sub window handles fullscreen
- }
- }
-
- for (i=0; i<gui->window_priv_count; i++)
- {
- if(gui->window_priv[i]->hwnd == hwnd)
- priv=gui->window_priv[i];
- }// Sherpya
- /* display the status msgs */
- renderinfobox(gui->skin, priv);
- RedrawWindow(hwnd, NULL, NULL, RDW_INVALIDATE);
-}
-
-static LRESULT CALLBACK SubProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
-{
- gui_t *gui = (gui_t *) GetWindowLongPtr(hWnd, GWLP_USERDATA);
- if (gui && (gui->subwindow != hWnd)) return FALSE;
-
- switch (message)
- {
- case WM_CLOSE:
- handlemsg(hWnd, evExit);
- return 0;
- case WM_DESTROY:
- PostQuitMessage(0);
- return 0;
- case WM_KEYDOWN:
- {
- switch(wParam)
- {
- case VK_LEFT:
- mplayer_put_key(KEY_LEFT);
- break;
- case VK_UP:
- mplayer_put_key(KEY_UP);
- break;
- case VK_RIGHT:
- mplayer_put_key(KEY_RIGHT);
- break;
- case VK_DOWN:
- mplayer_put_key(KEY_DOWN);
- break;
- case VK_TAB:
- mplayer_put_key(KEY_TAB);
- break;
- case VK_BACK:
- mplayer_put_key(KEY_BS);
- break;
- case VK_DELETE:
- mplayer_put_key(KEY_DELETE);
- break;
- case VK_INSERT:
- mplayer_put_key(KEY_INSERT);
- break;
- case VK_HOME:
- mplayer_put_key(KEY_HOME);
- break;
- case VK_END:
- mplayer_put_key(KEY_END);
- break;
- case VK_PRIOR:
- mplayer_put_key(KEY_PAGE_UP);
- break;
- case VK_NEXT:
- mplayer_put_key(KEY_PAGE_DOWN);
- break;
- case VK_ESCAPE:
- mplayer_put_key(KEY_ESC);
- break;
- }
- break;
- }
- case WM_COMMAND:
- {
- switch(LOWORD(wParam))
- {
- case IDEXIT:
- PostQuitMessage(0);
- handlemsg(hWnd, evExit);
- break;
- case IDFILE_OPEN:
- handlemsg(hWnd, evLoadPlay);
- break;
- case IDURL_OPEN:
- display_openurlwindow(gui, 0);
- break;
- case IDDIR_OPEN:
- {
- static char path[MAX_PATH];
- BROWSEINFO bi;
- LPITEMIDLIST pidl;
- memset(&bi, 0, sizeof(BROWSEINFO));
- bi.lpszTitle = "Choose a Directory...";
- pidl = SHBrowseForFolder(&bi);
- if (SHGetPathFromIDList(pidl, path))
- {
- gui->playlist->clear_playlist(gui->playlist);
- adddirtoplaylist(gui->playlist, path, TRUE);
- gui->startplay(gui);
- }
- break;
- }
- case ID_PTRACK:
- handlemsg(hWnd, evPrev);
- break;
- case ID_SEEKB:
- handlemsg(hWnd, evBackward10sec);
- break;
- case ID_PLAY:
- handlemsg(hWnd, evPlaySwitchToPause);
- break;
- case ID_STOP:
- handlemsg(hWnd, evStop);
- break;
- case ID_SEEKF:
- handlemsg(hWnd, evForward10sec);
- break;
- case ID_NTRACK:
- handlemsg(hWnd, evNext);
- break;
-#ifdef CONFIG_DVDREAD
- case ID_CHAPTERSEL:
- display_chapterselwindow(gui);
- break;
-#endif
- case ID_FULLSCREEN:
- mp_input_queue_cmd(mp_input_parse_cmd("vo_fullscreen"));
- break;
- case ID_MUTE:
- mp_input_queue_cmd(mp_input_parse_cmd("mute"));
- break;
- case ID_ASPECT1:
- mp_input_queue_cmd(mp_input_parse_cmd("switch_ratio 1.777777"));
- break;
- case ID_ASPECT2:
- mp_input_queue_cmd(mp_input_parse_cmd("switch_ratio 1.333333"));
- break;
- case ID_ASPECT3:
- mp_input_queue_cmd(mp_input_parse_cmd("switch_ratio 2.35"));
- break;
- case ID_ASPECT4:
- mp_input_queue_cmd(mp_input_parse_cmd("switch_ratio 0"));
- break;
- case IDSUB_TOGGLE:
- mp_input_queue_cmd(mp_input_parse_cmd("sub_visibility"));
- break;
- case IDSUB_CYCLE:
- mp_input_queue_cmd(mp_input_parse_cmd("sub_select"));
- break;
- }
- return 0;
- }
- case WM_CHAR:
- mplayer_put_key(wParam);
- break;
- case WM_DROPFILES:
- {
- if(!lParam)
- {
- char file[MAX_PATH];
- int filecount = DragQueryFile((HDROP) wParam, -1, file, MAX_PATH);
- int i;
- for(i=0; i<filecount; i++)
- {
- DragQueryFile((HDROP) wParam, i, file, MAX_PATH);
- mplSetFileName(NULL, file, STREAMTYPE_FILE);
- if(!parse_filename(file, playtree, mconfig, 1))
- gui->playlist->add_track(gui->playlist, file, NULL, NULL, 0);
- }
- DragFinish((HDROP) wParam);
- handlemsg(hWnd, evDropFile);
- }
- else
- {
- gui->playlist->clear_playlist(gui->playlist);
- gui->playlist->add_track(gui->playlist, (const char *) wParam, NULL, NULL, 0);
- handlemsg(hWnd, evDropFile);
- }
- SetForegroundWindow(gui->subwindow);
- return 0;
- }
- case WM_LBUTTONDOWN:
- {
- if(!vo_nomouse_input)
- mplayer_put_key(MOUSE_BTN0);
- break;
- }
- case WM_MBUTTONDOWN:
- {
- if(!vo_nomouse_input)
- mplayer_put_key(MOUSE_BTN1);
- break;
- }
- case WM_RBUTTONDOWN:
- {
- POINT point;
- point.x = GET_X_LPARAM(lParam);
- point.y = GET_Y_LPARAM(lParam);
- ClientToScreen(hWnd, &point);
- if(guiIntfStruct.StreamType == STREAMTYPE_DVD)
- EnableMenuItem(gui->dvdmenu, ID_CHAPTERSEL, MF_BYCOMMAND | MF_ENABLED);
- TrackPopupMenu(gui->submenu, 0, point.x, point.y, 0, hWnd, NULL);
- return 0;
- }
- case WM_LBUTTONDBLCLK:
- {
- if(!vo_nomouse_input)
- mplayer_put_key(MOUSE_BTN0_DBL);
- break;
- }
- case WM_MBUTTONDBLCLK:
- {
- if(!vo_nomouse_input)
- mplayer_put_key(MOUSE_BTN1_DBL);
- break;
- }
- case WM_RBUTTONDBLCLK:
- {
- if(!vo_nomouse_input)
- mplayer_put_key(MOUSE_BTN2_DBL);
- break;
- }
- case WM_MOUSEWHEEL:
- {
- int x = GET_WHEEL_DELTA_WPARAM(wParam);
- if(vo_nomouse_input)
- break;
- if (x > 0)
- mplayer_put_key(MOUSE_BTN3);
- else
- mplayer_put_key(MOUSE_BTN4);
- break;
- }
- case WM_XBUTTONDOWN:
- {
- if(vo_nomouse_input)
- break;
- if(HIWORD(wParam) == 1)
- mplayer_put_key(MOUSE_BTN5);
- else
- mplayer_put_key(MOUSE_BTN6);
- break;
- }
- case WM_XBUTTONDBLCLK:
- {
- if(vo_nomouse_input)
- break;
- if(HIWORD(wParam) == 1)
- mplayer_put_key(MOUSE_BTN5_DBL);
- else
- mplayer_put_key(MOUSE_BTN6_DBL);
- break;
- }
- case WM_TIMER:
- {
- if(fullscreen) while(ShowCursor(FALSE) >= 0){}
- KillTimer(hWnd, ID_TIMER);
- return 0;
- }
- case WM_MOUSEMOVE:
- {
- ShowCursor(TRUE);
- SetTimer(hWnd, ID_TIMER, 3000, (TIMERPROC) NULL);
- break;
- }
- case WM_WINDOWPOSCHANGED:
- {
- int tmpheight=0;
- static uint32_t rect_width;
- static uint32_t rect_height;
- RECT rd;
- POINT pt;
- pt.x = 0;
- pt.y = 0;
- GetClientRect(hWnd, &rd);
- ClientToScreen(hWnd, &pt);
-
- rect_width = rd.right - rd.left;
- rect_height = rd.bottom - rd.top;
-
- /* maintain our aspect ratio */
- tmpheight = ((float)rect_width/sub_aspect);
- tmpheight += tmpheight % 2;
- if(tmpheight > rect_height)
- {
- rect_width = ((float)rect_height*sub_aspect);
- rect_width += rect_width % 2;
- }
- else rect_height = tmpheight;
-
- rd.right = rd.left + rect_width;
- rd.bottom = rd.top + rect_height;
-
- AdjustWindowRect(&rd, WS_OVERLAPPEDWINDOW | WS_SIZEBOX, 0);
- SetWindowPos(hWnd, 0, fullscreen?0:pt.x+rd.left, fullscreen?0:pt.y+rd.top,
- fullscreen?vo_screenwidth:rd.right-rd.left, fullscreen?vo_screenheight:rd.bottom-rd.top, SWP_NOOWNERZORDER);
- SetForegroundWindow(hWnd);
- return 0;
- }
- case WM_SYSCOMMAND:
- {
- switch(wParam)
- {
- case SC_SCREENSAVE:
- case SC_MONITORPOWER:
- mp_msg(MSGT_VO, MSGL_V ,"<vo_directx><INFO>killing screensaver\n" );
- return 0;
- }
- break;
- }
- case WM_PAINT:
- {
- PAINTSTRUCT ps;
- RECT rect;
- HDC hdc = BeginPaint(hWnd, &ps);
- HDC hMemDC = CreateCompatibleDC(hdc);
- HBRUSH blackbrush = (HBRUSH)GetStockObject(BLACK_BRUSH);
- int width, height;
- GetClientRect(hWnd, &rect);
- width = rect.right - rect.left;
- height = rect.bottom - rect.top;
- if(guiIntfStruct.Playing == 0)
- {
- int i;
- window *desc = NULL;
-
- for (i=0; i<gui->skin->windowcount; i++)
- if(gui->skin->windows[i]->type == wiSub)
- desc = gui->skin->windows[i];
-
- SelectObject(hMemDC, get_bitmap(hWnd));
- StretchBlt(hdc, 0, 0, width, height, hMemDC, 0, 0, desc->base->bitmap[0]->width,
- desc->base->bitmap[0]->height, SRCCOPY);
- } else {
- FillRect(GetDC(hWnd), &rect, fullscreen?blackbrush:colorbrush);
- }
- DeleteDC(hMemDC);
- EndPaint(hWnd, &ps);
- return 0;
- }
- }
- return DefWindowProc(hWnd, message, wParam, lParam);
-}
-
-/* Window Proc for the gui Window */
-static LRESULT CALLBACK EventProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
-{
- gui_t *gui = (gui_t *) GetWindowLongPtr(hWnd, GWLP_USERDATA);
-
- /* Avoid processing when then window doesn't match gui mainwindow */
- if (gui && (gui->mainwindow != hWnd)) return FALSE;
-
- switch (message)
- {
- case WM_CLOSE:
- handlemsg(hWnd, evExit);
- return 0;
- case WM_DESTROY:
- PostQuitMessage(0);
- return 0;
- case WM_SYSTRAY:
- {
- switch(lParam)
- {
- POINT cursor;
- case WM_RBUTTONDOWN:
- {
- GetCursorPos(&cursor);
- SetForegroundWindow(hWnd);
- TrackPopupMenu(gui->traymenu, 0, cursor.x, cursor.y, 0, hWnd, NULL);
- break;
- }
- case WM_MBUTTONDBLCLK:
- case WM_LBUTTONDBLCLK:
- {
- if(IsWindowVisible(hWnd)) ShowWindow(hWnd, SW_HIDE);
- else { ShowWindow(hWnd, SW_SHOW); SetForegroundWindow(hWnd); }
- break;
- }
- }
- break;
- }
- case WM_KEYDOWN:
- {
- switch(wParam)
- {
- case VK_LEFT:
- mplayer_put_key(KEY_LEFT);
- break;
- case VK_UP:
- mplayer_put_key(KEY_UP);
- break;
- case VK_RIGHT:
- mplayer_put_key(KEY_RIGHT);
- break;
- case VK_DOWN:
- mplayer_put_key(KEY_DOWN);
- break;
- case VK_TAB:
- mplayer_put_key(KEY_TAB);
- break;
- case VK_BACK:
- mplayer_put_key(KEY_BS);
- break;
- case VK_DELETE:
- mplayer_put_key(KEY_DELETE);
- break;
- case VK_INSERT:
- mplayer_put_key(KEY_INSERT);
- break;
- case VK_HOME:
- mplayer_put_key(KEY_HOME);
- break;
- case VK_END:
- mplayer_put_key(KEY_END);
- break;
- case VK_PRIOR:
- mplayer_put_key(KEY_PAGE_UP);
- break;
- case VK_NEXT:
- mplayer_put_key(KEY_PAGE_DOWN);
- break;
- case VK_ESCAPE:
- mplayer_put_key(KEY_ESC);
- break;
- }
- break;
- }
- case WM_CHAR:
- mplayer_put_key(wParam);
- break;
- case WM_COPYDATA:
- {
- if(lParam)
- {
- PCOPYDATASTRUCT cdData;
- cdData = (PCOPYDATASTRUCT) lParam;
- mplSetFileName(NULL, cdData->lpData, STREAMTYPE_FILE);
- if(!parse_filename(cdData->lpData, playtree, mconfig, 1))
- gui->playlist->add_track(gui->playlist, cdData->lpData, NULL, NULL, 0);
- gui->startplay(gui);
- }
- break;
- }
- case WM_DROPFILES:
- {
- if(!lParam)
- {
- char file[MAX_PATH];
- int filecount = DragQueryFile((HDROP) wParam, -1, file, MAX_PATH);
- int i;
- for(i=0; i<filecount; i++)
- {
- DragQueryFile((HDROP) wParam, i, file, MAX_PATH);
- mplSetFileName(NULL, file, STREAMTYPE_FILE);
- if(!parse_filename(file, playtree, mconfig, 1))
- gui->playlist->add_track(gui->playlist, file, NULL, NULL, 0);
- }
- DragFinish((HDROP) wParam);
- handlemsg(hWnd, evDropFile);
- }
- else
- {
- gui->playlist->clear_playlist(gui->playlist);
- gui->playlist->add_track(gui->playlist, (const char *) wParam, NULL, NULL, 0);
- handlemsg(hWnd, evDropFile);
- }
- SetForegroundWindow(gui->mainwindow);
- return 0;
- }
- case WM_LBUTTONDOWN:
- {
- SetCapture(hWnd);
- gui->mousex = GET_X_LPARAM(lParam);
- gui->mousey = GET_Y_LPARAM(lParam);
- /* inside a widget */
- gui->activewidget = clickedinsidewidget(gui, get_windowtype(hWnd), gui->mousex, gui->mousey);
- if(gui->activewidget)
- {
- gui->activewidget->pressed = 1;
- gui->mousewx = gui->mousex - gui->activewidget->x;
- gui->mousewy = gui->mousey - gui->activewidget->y;
- renderwidget(gui->skin, get_drawground(hWnd), gui->activewidget, 0);
- RedrawWindow(hWnd, NULL, NULL, RDW_INVALIDATE);
- handlemsg(hWnd, gui->activewidget->msg);
- }
- break;
- }
- case WM_CAPTURECHANGED:
- {
- if(gui->activewidget)
- {
- gui->activewidget->pressed = 0;
- renderwidget(gui->skin, get_drawground(hWnd), gui->activewidget, 1);
- RedrawWindow(hWnd, NULL, NULL, RDW_INVALIDATE);
- gui->activewidget = NULL;
- }
- break;
- }
- case WM_LBUTTONUP:
- {
- ReleaseCapture();
- if(gui->activewidget)
- {
- gui->activewidget->pressed = 0;
- renderwidget(gui->skin, get_drawground(hWnd), gui->activewidget, 1);
- RedrawWindow(hWnd, NULL, NULL, RDW_INVALIDATE);
- gui->activewidget = NULL;
- }
- break;
- }
- case WM_RBUTTONDOWN:
- {
- POINT point;
- char device[MAX_PATH];
- char searchpath[MAX_PATH];
- char searchpath2[MAX_PATH];
-#ifdef CONFIG_LIBCDIO
- char searchpath3[MAX_PATH];
-#endif
- int len, pos = 0, cdromdrive = 0;
- UINT errmode;
- point.x = GET_X_LPARAM(lParam);
- point.y = GET_Y_LPARAM(lParam);
- ClientToScreen(hWnd, &point);
- errmode = SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOOPENFILEERRORBOX);
- while (GetMenuItemCount(gui->diskmenu) > 0)
- DeleteMenu(gui->diskmenu, 0, MF_BYPOSITION);
- len = GetLogicalDriveStrings(MAX_PATH, device);
- while(pos < len)
- {
- if(GetDriveType(device + pos) == DRIVE_CDROM)
- {
- char volname[MAX_PATH];
- char menuitem[MAX_PATH];
- int flags = MF_STRING;
- mp_msg(MSGT_GPLAYER, MSGL_V, "[GUI] checking %s for CD/VCD/SVCD/DVDs\n", device + pos);
- sprintf(searchpath, "%sVIDEO_TS", device + pos);
- sprintf(searchpath2, "%sMpegav", device + pos);
-#ifdef CONFIG_LIBCDIO
- sprintf(searchpath3, "%sTrack01.cda", device + pos);
-#endif
- if(GetFileAttributes(searchpath) != INVALID_FILE_ATTRIBUTES)
- flags |= MF_ENABLED;
- else if(GetFileAttributes(searchpath2) != INVALID_FILE_ATTRIBUTES)
- flags |= MF_ENABLED;
-#ifdef CONFIG_LIBCDIO
- else if(GetFileAttributes(searchpath3) != INVALID_FILE_ATTRIBUTES)
- flags |= MF_ENABLED;
-#endif
- else
- flags |= MF_GRAYED;
- volname[0] = 0;
- strcpy(menuitem, device + pos);
- menuitem[strlen(menuitem) - 1]=0;
- GetVolumeInformation(device + pos, volname, MAX_PATH, NULL, NULL, NULL, NULL, 0);
- if (strlen(volname))
- {
- capitalize(volname);
- strcat(menuitem, " - ");
- strcat(menuitem, volname);
- }
- AppendMenu(gui->diskmenu, flags, IDPLAYDISK + cdromdrive, menuitem);
- cdromdrive++;
- }
- pos += strlen(device + pos) + 1;
- }
- SetErrorMode(errmode);
- TrackPopupMenu(gui->menu, 0, point.x, point.y, 0, hWnd, NULL);
- return 0;
- }
- case WM_MOUSEMOVE:
- {
- if(wParam & MK_LBUTTON)
- {
- POINT point;
- RECT rect;
- if(gui->activewidget)
- {
- widget *item = gui->activewidget;
-
- if(item->type == tyHpotmeter)
- {
- item->x = GET_X_LPARAM(lParam) - gui->mousewx;
- item->value = (float)((float)((item->x - item->wx) * 100.0f) / (float)(item->wwidth - item->width));
- }
- if(item->type == tyPotmeter)
- {
- gui->mousewx = GET_X_LPARAM(lParam) - gui->activewidget->x;
- item->value = (float) (gui->mousewx * 100.0f) / (float) item->wwidth;
- }
-
- if((item->type == tyPotmeter) || (item->type == tyHpotmeter) || (item->type == tyVpotmeter))
- {
- /* Bound checks */
- if(item->value > 100.0f)
- item->value = 100.0f;
- else if(item->value < 0.0f)
- item->value = 0.0f;
-
- if(item->msg == evSetVolume)
- guiIntfStruct.Volume = (float) item->value;
- else if(item->msg == evSetMoviePosition)
- guiIntfStruct.Position = (float) item->value;
- else if(item->msg == evSetBalance)
- {
- /* make the range for 50% a bit bigger, because the sliders for balance usually suck */
- if((item->value - 50.0f < 1.5f) && (item->value - 50.0f > -1.5f))
- item->value = 50.0f;
- guiIntfStruct.Balance = (float) item->value;
- }
- updatedisplay(gui, hWnd);
- handlemsg(hWnd, item->msg);
- }
- break;
- }
- point.x = GET_X_LPARAM(lParam);
- point.y = GET_Y_LPARAM(lParam);
- ClientToScreen(hWnd, &point);
- GetWindowRect(hWnd, &rect);
- MoveWindow(hWnd, point.x - gui->mousex, point.y - gui->mousey,
- rect.right-rect.left,rect.bottom-rect.top,TRUE);
- break;
- }
- break;
- }
- case WM_COMMAND:
- {
- switch(LOWORD(wParam))
- {
- case IDEXIT:
- PostQuitMessage(0);
- handlemsg(hWnd, evExit);
- break;
- case IDFILE_OPEN:
- handlemsg(hWnd, evLoadPlay);
- break;
- case IDDIR_OPEN:
- {
- static char path[MAX_PATH];
- BROWSEINFO bi;
- LPITEMIDLIST pidl;
- memset(&bi, 0, sizeof(BROWSEINFO));
- bi.lpszTitle = "Choose a Directory...";
- pidl = SHBrowseForFolder(&bi);
- if (SHGetPathFromIDList(pidl, path))
- {
- gui->playlist->clear_playlist(gui->playlist);
- adddirtoplaylist(gui->playlist, path, TRUE);
- gui->startplay(gui);
- }
- break;
- }
- case ID_SKINBROWSER:
- handlemsg(hWnd, evSkinBrowser);
- break;
- case IDURL_OPEN:
- display_openurlwindow(gui, 0);
- break;
- case ID_MUTE:
- mp_input_queue_cmd(mp_input_parse_cmd("mute"));
- break;
- case IDSUBTITLE_OPEN:
- display_opensubtitlewindow(gui);
- break;
- case ID_PTRACK:
- handlemsg(hWnd, evPrev);
- break;
- case ID_SEEKB:
- handlemsg(hWnd, evBackward10sec);
- break;
- case ID_PLAY:
- handlemsg(hWnd, evPlaySwitchToPause);
- break;
- case ID_STOP:
- handlemsg(hWnd, evStop);
- break;
- case ID_SEEKF:
- handlemsg(hWnd, evForward10sec);
- break;
- case ID_NTRACK:
- handlemsg(hWnd, evNext);
- break;
- case ID_SHOWHIDE:
- {
- if(IsWindowVisible(hWnd)) ShowWindow(hWnd, SW_HIDE);
- else ShowWindow(hWnd, SW_SHOW);
- break;
- }
- case ID_PLAYLIST:
- handlemsg(hWnd, evPlayList);
- break;
- case ID_PREFS:
- handlemsg(hWnd, evPreferences);
- break;
- case ID_CONSOLE:
- console_toggle();
- break;
- case ID_ONLINEHELP:
- ShellExecute(NULL, "open", ONLINE_HELP_URL, NULL, NULL, SW_SHOWNORMAL);
- break;
- }
- if((IDPLAYDISK <= LOWORD(wParam)) && (LOWORD(wParam) < (IDPLAYDISK + 100)))
- {
- char device[MAX_PATH];
- char searchpath[MAX_PATH];
- char filename[MAX_PATH];
- int len, pos = 0, cdromdrive = 0;
- len = GetLogicalDriveStrings(MAX_PATH, device);
- while(pos < len)
- {
- if(GetDriveType(device + pos)==DRIVE_CDROM)
- {
- if(LOWORD(wParam) - IDPLAYDISK == cdromdrive)
- {
- sprintf(searchpath, "%sVIDEO_TS", device + pos);
- if(GetFileAttributes(searchpath) != INVALID_FILE_ATTRIBUTES)
- {
-#ifdef CONFIG_DVDREAD
- if (dvd_device) free(dvd_device);
- dvd_device = strdup(device + pos);
- dvd_title = dvd_chapter = dvd_angle = 1;
- handlemsg(hWnd, evPlayDVD);
-#endif
- }
- sprintf(searchpath, "%sTrack01.cda", device + pos);
- if(GetFileAttributes(searchpath) != INVALID_FILE_ATTRIBUTES)
- {
-#ifdef CONFIG_LIBCDIO
- if (cdrom_device) free(cdrom_device);
- cdrom_device = strdup(device + pos);
- /* mplayer doesn't seem to like the trailing \ after the device name */
- cdrom_device[2]=0;
- handlemsg(hWnd, evPlayCD);
-#endif
- } else {
- HANDLE searchhndl;
- WIN32_FIND_DATA finddata;
- sprintf(searchpath, "%smpegav\\*.dat", device + pos);
- if((searchhndl=FindFirstFile(searchpath, &finddata)) != INVALID_HANDLE_VALUE)
- {
- mp_msg(MSGT_GPLAYER,MSGL_V, "Opening VCD/SVCD\n");
- gui->playlist->clear_playlist(gui->playlist);
- do
- {
- sprintf(filename, "%smpegav\\%s", device + pos, finddata.cFileName);
- gui->playlist->add_track(gui->playlist, filename, NULL, NULL, 0);
- }
- while(FindNextFile(searchhndl, &finddata));
- FindClose(searchhndl);
- }
- gui->startplay(gui);
- }
- }
- cdromdrive++;
- }
- pos += strlen(device + pos) + 1;
- }
- }
- break;
- }
- case WM_PAINT:
- {
- PAINTSTRUCT ps;
- RECT rd;
- HDC hdc = BeginPaint(hWnd, &ps);
- HDC hMemDC = CreateCompatibleDC(hdc);
- int width, height;
- GetClientRect(hWnd, &rd);
- width = rd.right - rd.left;
- height = rd.bottom - rd.top;
- SelectObject(hMemDC, get_bitmap(hWnd));
- BitBlt(hdc, 0, 0, width, height, hMemDC, 0, 0, SRCCOPY);
- DeleteDC(hMemDC);
- EndPaint(hWnd, &ps);
- return 0;
- }
- return 0;
- }
- return DefWindowProc(hWnd, message, wParam, lParam);
-}
-
-static void startplay(gui_t *gui)
-{
- handlemsg(gui->mainwindow, evDropFile);
-}
-
-/* returns the bits per pixel of the desktop */
-/* the format is always in BGR byte order */
-static int GetDesktopBitsPerPixel(void)
-{
- HWND desktop=GetDesktopWindow();
- HDC dc=GetDC(desktop);
- int bpp=GetDeviceCaps(dc, BITSPIXEL);
- ReleaseDC(desktop, dc);
- return bpp;
-}
-
-/* unloads a skin and destroys its windows */
-int destroy_window(gui_t *gui)
-{
- RECT rd;
- unsigned int i;
-
- /* Save position: MSDN says don't pass workspace coordinates
- * to CreateWindow() or SetWindowPos(), as both of which expect
- * screen coordinates; resulting in the window appearing in the
- * wrong location.
- * -Erik
- */
-
- /* main window position */
- if(IsIconic(gui->mainwindow))
- ShowWindow(gui->mainwindow, SW_SHOWNORMAL);
- GetWindowRect(gui->mainwindow, &rd);
- gui_main_pos_x = rd.left;
- gui_main_pos_y = rd.top;
-
- /* sub window position */
- if(IsIconic(gui->subwindow))
- ShowWindow(gui->subwindow, SW_SHOWNORMAL);
- GetWindowRect(gui->subwindow, &rd);
- gui_sub_pos_x = rd.left;
- gui_sub_pos_y = rd.top;
-
- for(i=0; i<gui->window_priv_count; i++)
- {
- if(gui->window_priv[i]->bitmap)
- DeleteObject(gui->window_priv[i]->bitmap);
- free(gui->window_priv[i]);
- }
- free(gui->window_priv);
- gui->window_priv = NULL;
- gui->window_priv_count = 0;
-
- /* destroy the main window */
- if(gui->mainwindow)
- DestroyWindow(gui->mainwindow);
- gui->mainwindow = NULL;
-
- /* destroy the sub window */
- if(gui->subwindow)
- DestroyWindow(gui->subwindow);
- gui->subwindow = NULL;
-
- UnregisterClass(gui->classname, 0);
- DestroyIcon(gui->icon);
-
- gui->skin->freeskin(gui->skin);
- gui->skin = NULL;
- return 0;
-}
-
-static void create_menu(gui_t *gui)
-{
- gui->diskmenu = CreatePopupMenu();
- gui->menu=CreatePopupMenu();
- gui->trayplaymenu = CreatePopupMenu();
- AppendMenu(gui->menu, MF_STRING | MF_POPUP, (UINT) gui->trayplaymenu, "Open...");
- AppendMenu(gui->trayplaymenu, MF_STRING, IDFILE_OPEN, "File...");
- AppendMenu(gui->trayplaymenu, MF_STRING, IDURL_OPEN, "Url...");
- AppendMenu(gui->trayplaymenu, MF_STRING, IDDIR_OPEN, "Directory...");
- AppendMenu(gui->menu, MF_SEPARATOR, 0, 0);
- AppendMenu(gui->menu, MF_STRING | MF_POPUP, (UINT) gui->diskmenu, "Play &CD/DVD/VCD/SVCD");
- AppendMenu(gui->menu, MF_SEPARATOR, 0, 0);
- AppendMenu(gui->menu, MF_STRING, IDSUBTITLE_OPEN, "Open Subtitle");
- AppendMenu(gui->menu, MF_STRING, ID_SKINBROWSER, "Skin Browser");
- AppendMenu(gui->menu, MF_SEPARATOR, 0, 0);
- AppendMenu(gui->menu, MF_STRING, ID_PREFS, "Preferences");
- AppendMenu(gui->menu, MF_STRING, ID_CONSOLE, "Debug Console");
- AppendMenu(gui->menu, MF_STRING, ID_ONLINEHELP, "Online Help");
- AppendMenu(gui->menu, MF_SEPARATOR, 0, 0);
- AppendMenu(gui->menu, MF_STRING, IDEXIT, "&Exit");
-}
-
-static void create_traymenu(gui_t *gui)
-{
- gui->traymenu = CreatePopupMenu();
- gui->trayplaybackmenu = CreatePopupMenu();
- AppendMenu(gui->traymenu, MF_STRING | MF_POPUP, (UINT) gui->trayplaymenu, "Open...");
- AppendMenu(gui->traymenu, MF_SEPARATOR, 0, 0);
- AppendMenu(gui->traymenu, MF_STRING | MF_POPUP, (UINT) gui->trayplaybackmenu, "Playback");
- AppendMenu(gui->trayplaybackmenu, MF_STRING, ID_SEEKB, "Seek Backwards");
- AppendMenu(gui->trayplaybackmenu, MF_STRING, ID_PTRACK, "Previous Track");
- AppendMenu(gui->trayplaybackmenu, MF_STRING, ID_PLAY, "Play/Pause");
- AppendMenu(gui->trayplaybackmenu, MF_STRING, ID_STOP, "Stop");
- AppendMenu(gui->trayplaybackmenu, MF_STRING, ID_NTRACK, "Next Track");
- AppendMenu(gui->trayplaybackmenu, MF_STRING, ID_SEEKF, "Seek Forwards");
- AppendMenu(gui->traymenu, MF_SEPARATOR, 0, 0);
- AppendMenu(gui->traymenu, MF_STRING, ID_MUTE, "Toggle Mute");
- AppendMenu(gui->traymenu, MF_SEPARATOR, 0, 0);
- AppendMenu(gui->traymenu, MF_STRING, IDSUBTITLE_OPEN, "Open Subtitle");
- AppendMenu(gui->traymenu, MF_STRING, ID_PLAYLIST, "Playlist");
- AppendMenu(gui->traymenu, MF_SEPARATOR, 0, 0);
- AppendMenu(gui->traymenu, MF_STRING, ID_SHOWHIDE, "Show/Hide");
- AppendMenu(gui->traymenu, MF_SEPARATOR, 0, 0);
- AppendMenu(gui->traymenu, MF_STRING, ID_PREFS, "Preferences");
- AppendMenu(gui->traymenu, MF_STRING, ID_CONSOLE, "Debug Console");
- AppendMenu(gui->traymenu, MF_STRING, ID_ONLINEHELP, "Online Help");
- AppendMenu(gui->traymenu, MF_SEPARATOR, 0, 0);
- AppendMenu(gui->traymenu, MF_STRING, IDEXIT, "&Exit");
-}
-
-static void create_submenu(gui_t *gui)
-{
- gui->submenu = CreatePopupMenu();
- gui->dvdmenu = CreatePopupMenu();
- gui->aspectmenu = CreatePopupMenu();
- gui->subtitlemenu = CreatePopupMenu();
- AppendMenu(gui->submenu, MF_STRING | MF_POPUP, (UINT) gui->trayplaymenu, "Open...");
- AppendMenu(gui->submenu, MF_SEPARATOR, 0, 0);
- AppendMenu(gui->submenu, MF_STRING, ID_SEEKB, "Seek Backwards");
- AppendMenu(gui->submenu, MF_STRING, ID_PTRACK, "Previous Track");
- AppendMenu(gui->submenu, MF_STRING, ID_PLAY, "Play/Pause");
- AppendMenu(gui->submenu, MF_STRING, ID_STOP, "Stop");
- AppendMenu(gui->submenu, MF_STRING, ID_NTRACK, "Next Track");
- AppendMenu(gui->submenu, MF_STRING, ID_SEEKF, "Seek Forwards");
- AppendMenu(gui->submenu, MF_SEPARATOR, 0, 0);
- AppendMenu(gui->submenu, MF_STRING, ID_FULLSCREEN, "Toggle Fullscreen");
- AppendMenu(gui->submenu, MF_STRING, ID_MUTE, "Toggle Mute");
- AppendMenu(gui->submenu, MF_SEPARATOR, 0, 0);
- AppendMenu(gui->submenu, MF_STRING | MF_POPUP, (UINT) gui->aspectmenu, "Aspect Ratio");
- AppendMenu(gui->submenu, MF_STRING | MF_POPUP, (UINT) gui->subtitlemenu, "Subtitle Options");
- AppendMenu(gui->submenu, MF_STRING | MF_POPUP, (UINT) gui->dvdmenu, "DVD Options");
-#ifdef CONFIG_DVDREAD
- AppendMenu(gui->dvdmenu, MF_STRING | MF_GRAYED, ID_CHAPTERSEL, "Select Title/Chapter...");
-#endif
- AppendMenu(gui->subtitlemenu, MF_STRING, IDSUB_TOGGLE, "Subtitle Visibility On/Off");
- AppendMenu(gui->subtitlemenu, MF_STRING, IDSUB_CYCLE, "Cycle Subtitle Languages");
- AppendMenu(gui->aspectmenu, MF_STRING, ID_ASPECT1, "Set 16:9");
- AppendMenu(gui->aspectmenu, MF_STRING, ID_ASPECT2, "Set 4:3");
- AppendMenu(gui->aspectmenu, MF_STRING, ID_ASPECT3, "Set 2.35");
- AppendMenu(gui->aspectmenu, MF_SEPARATOR, 0, 0);
- AppendMenu(gui->aspectmenu, MF_STRING, ID_ASPECT4, "Original Aspect");
- AppendMenu(gui->submenu, MF_SEPARATOR, 0, 0);
- AppendMenu(gui->submenu, MF_STRING, IDEXIT, "&Exit");
-}
-
-static void maketransparent(HWND hwnd, COLORREF crTransparent)
-{
- HDC mdc = GetDC(hwnd);
- RECT rd;
- HRGN crRgnres, crRgn, crRgnTmp;
- int iX = 0, iY = 0, iLeftX = 0;
- int width, height;
- GetWindowRect(hwnd, &rd);
- width = rd.right - rd.left;
- height = rd.bottom - rd.top;
-
- /* create an empty region */
- crRgn = CreateRectRgn(0, 0, 0, 0);
-
- /* Create a region from a bitmap with transparency colour of Purple */
- for (iY = -1; iY < height; iY++)
- {
- do
- {
- /* skip over transparent pixels at start of lines */
- while (iX <= width && GetPixel(mdc,iX, iY) == crTransparent) iX++;
-
- /* remember this pixel */
- iLeftX = iX;
-
- /* now find first non transparent pixel */
- while (iX <= width && GetPixel(mdc,iX, iY) != crTransparent) ++iX;
-
- /* create a temp region on this info */
- crRgnTmp = CreateRectRgn(iLeftX, iY, iX, iY+1);
-
- /* combine into main region */
- crRgnres = crRgn;
- CombineRgn(crRgnres, crRgn, crRgnTmp, RGN_OR);
- crRgn = crRgnres;
-
- /* delete the temp region for next pass (otherwise you'll get an ASSERT) */
- DeleteObject(crRgnTmp);
- } while (iX < width);
- iX = 0;
- }
- SetWindowRgn(hwnd, crRgn, TRUE);
- DeleteObject(crRgn);
- ReleaseDC(hwnd,mdc);
-}
-
-static int window_render(gui_t *gui, HWND hWnd, HDC hdc, window_priv_t *priv, window *desc, BITMAPINFO binfo)
-{
- int i;
- SetWindowLongPtr(hWnd, GWLP_USERDATA, (DWORD) gui);
- (gui->window_priv_count)++;
- gui->window_priv = realloc(gui->window_priv, sizeof(window_priv_t *) * gui->window_priv_count);
- priv = gui->window_priv[gui->window_priv_count - 1] = calloc(1, sizeof(window_priv_t));
- priv->hwnd = hWnd;
- priv->type = desc->type;
- priv->background = desc->base->bitmap[0];
- memcpy(&priv->img, desc->base->bitmap[0], sizeof(image));
- hdc = GetDC(hWnd);
- binfo.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
- binfo.bmiHeader.biWidth = priv->img.width;
- binfo.bmiHeader.biHeight = -priv->img.height;
- binfo.bmiHeader.biPlanes = 1;
- binfo.bmiHeader.biSizeImage = priv->img.width * priv->img.height * (gui->screenbpp / 8);
- binfo.bmiHeader.biXPelsPerMeter = 0;
- binfo.bmiHeader.biYPelsPerMeter = 0;
- binfo.bmiHeader.biClrUsed = 0;
- binfo.bmiHeader.biClrImportant = 0;
- binfo.bmiHeader.biBitCount = gui->screenbpp;
- binfo.bmiHeader.biCompression = BI_RGB;
- priv->bitmap = CreateDIBSection(hdc, &binfo, DIB_RGB_COLORS, (void **) &priv->img.data, NULL, 0);
- if(!priv->bitmap)
- {
- mp_msg(MSGT_GPLAYER, MSGL_FATAL, "[GUI] unable to create bitmap for skinned window\n");
- return 0;
- }
- memcpy(priv->img.data, desc->base->bitmap[0]->data, binfo.bmiHeader.biSizeImage);
- ReleaseDC(hWnd,hdc);
-
- for (i=0; i<gui->skin->widgetcount; i++)
- if(gui->skin->widgets[i]->window == desc->type)
- renderwidget(gui->skin, &priv->img, gui->skin->widgets[i], 1);
-
- return 0;
-}
-
-/* creates the sub (AKA video) window,*/
-int create_subwindow(gui_t *gui, char *skindir)
-{
- HINSTANCE instance = GetModuleHandle(NULL);
- WNDCLASS wc;
- RECT rect;
- HWND hWnd;
- DWORD style = 0;
- HDC hdc = NULL;
- BITMAPINFO binfo;
- window_priv_t *priv = NULL;
- window *desc = NULL;
- int i, x = -1, y = -1;
- vo_colorkey = 0xff00ff;
-
- for (i=0; i<gui->skin->windowcount; i++)
- if(gui->skin->windows[i]->type == wiSub)
- desc = gui->skin->windows[i];
-
- if(!desc)
- {
- mp_msg(MSGT_GPLAYER, MSGL_FATAL, "[GUI] Invalid skin description\n");
- return 1;
- }
-
- windowcolor = vo_colorkey;
- colorbrush = CreateSolidBrush(windowcolor);
- wc.style = CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS;
- wc.lpfnWndProc = SubProc;
- wc.cbClsExtra = 0;
- wc.cbWndExtra = 0;
- wc.hInstance = instance;
- wc.hCursor = LoadCursor(NULL, IDC_ARROW);
- wc.hIcon = gui->icon;
- wc.hbrBackground = NULL; //WM_PAINT will handle background color switching;
- wc.lpszClassName = "MPlayer Sub for Windows";
- wc.lpszMenuName = NULL;
- RegisterClass(&wc);
-
- /* create the sub window menu */
- create_submenu(gui);
-
- rect.top = rect.left = 100;
- rect.bottom = rect.top+desc->base->bitmap[0]->height;
- rect.right = rect.left+desc->base->bitmap[0]->width;
-
- /* our window aspect */
- sub_aspect = (float)(rect.right-rect.left)/(rect.bottom-rect.top);
-
- style = fullscreen?WS_VISIBLE | WS_POPUP:WS_OVERLAPPEDWINDOW | WS_SYSMENU | WS_MINIMIZEBOX;
- AdjustWindowRect(&rect, style, 0);
-
- if (gui_sub_pos_x >= 0)
- x = gui_sub_pos_x;
- if (gui_sub_pos_y >= 0)
- y = gui_sub_pos_y;
-
- /* out of bounds check */
- if (x <= -1 || (x+(rect.right-rect.left) > GetSystemMetrics(SM_CXSCREEN)))
- x = CW_USEDEFAULT;
- if (y <= -1 || (y+(rect.bottom-rect.top) > GetSystemMetrics(SM_CYSCREEN)))
- y = x;
-
- hWnd = CreateWindowEx(0, "MPlayer Sub for Windows", "MPlayer for Windows", style,
- x, y, rect.right-rect.left, rect.bottom-rect.top,
- gui->subwindow, NULL, instance, NULL);
-
- /* load all the window images */
- window_render(gui, hWnd, hdc, priv, desc, binfo);
-
- /* enable drag and drop support */
- DragAcceptFiles(hWnd, TRUE);
-
- gui->subwindow = hWnd;
- if(sub_window)
- WinID = gui->subwindow;
- ShowWindow(gui->subwindow, SW_SHOW);
- UpdateWindow(gui->subwindow);
- return 0;
-}
-
-/* loads/updates a skin and creates windows for it */
-int create_window(gui_t *gui, char *skindir)
-{
- HINSTANCE instance = GetModuleHandle(NULL);
- WNDCLASS wc;
- RECT rect;
- DWORD style = 0;
- HWND hwnd;
- HDC hdc = NULL;
- BITMAPINFO binfo;
- window_priv_t *priv = NULL;
- window *desc = NULL;
- char dir[MAX_PATH];
- unsigned int i;
- int x = -1, y = -1;
-
- /* destroy the current main window */
- if(gui->skin) destroy_window(gui);
-
- /* get screenproperties */
- gui->screenbpp = GetDesktopBitsPerPixel();
- gui->screenw = GetSystemMetrics(SM_CXSCREEN);
- gui->screenh = GetSystemMetrics(SM_CYSCREEN);
-
- /* load the new skin */
- gui->skin = loadskin(skindir, gui->screenbpp);
- if(!gui->skin)
- {
- mp_msg(MSGT_GPLAYER, MSGL_FATAL, "[GUI] fatal error during skinload\n");
- /* Set default Skin */
- if (skinName) free(skinName);
- skinName = strdup("Blue");
- /* then force write conf */
- cfg_write();
- return 1;
- }
-
- /* find the description of the mainwindow */
- for (i=0; i<gui->skin->windowcount; i++)
- if(gui->skin->windows[i]->type == wiMain)
- desc = gui->skin->windows[i];
-
- if(!desc)
- {
- mp_msg(MSGT_GPLAYER, MSGL_FATAL, "[GUI] Invalid skin description\n");
- return 1;
- }
-
- /* load the icon from the executable */
- GetModuleFileName(NULL, dir, MAX_PATH);
- gui->icon = ExtractIcon(instance, dir, 0);
-
- /* create the window class */
- wc.style = CS_HREDRAW | CS_VREDRAW;
- wc.lpfnWndProc = EventProc;
- wc.cbClsExtra = 0;
- wc.cbWndExtra = 0;
- wc.hInstance = instance;
- wc.hCursor = LoadCursor(NULL, IDC_ARROW);
- wc.hIcon = gui->icon;
- wc.hbrBackground = CreateSolidBrush(RGB(0, 0, 0));
- wc.lpszClassName = gui->classname = "MPlayer GUI for Windows";
- wc.lpszMenuName = NULL;
- RegisterClass(&wc);
-
- /* create a context menu */
- create_menu(gui);
- /* create the systray menu */
- create_traymenu(gui);
-
- /* create the mainwindow */
- /* TODO implement aligning as described in skin.html */
- rect.top = rect.left = 100;
- rect.bottom = rect.top+desc->base->bitmap[0]->height;
- rect.right = rect.left+desc->base->bitmap[0]->width;
- if(desc->decoration) style = WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX;
- else style = WS_POPUP | WS_SYSMENU;
-
- AdjustWindowRect(&rect, style, 0);
-
- /* Check if out of screen */
- if (gui_main_pos_x >= 0)
- x = gui_main_pos_x;
- if (gui_main_pos_y >= 0)
- y = gui_main_pos_y;
-
- if (x <= -1 || (x+(rect.right-rect.left) > GetSystemMetrics(SM_CXFULLSCREEN)))
- {
- x = (GetSystemMetrics(SM_CXSCREEN) / 2) - ((rect.right-rect.left) / 2);
- gui_main_pos_x = x;
- }
- if (y <= -1 || (y+(rect.bottom-rect.top) > GetSystemMetrics(SM_CYFULLSCREEN)))
- {
- y = ((GetSystemMetrics(SM_CYSCREEN)-40) - (rect.bottom-rect.top));
- gui_main_pos_y = y;
- }
-
- hwnd = CreateWindowEx(0, gui->classname, "MPlayer for Windows", style,
- x, y, rect.right-rect.left, rect.bottom-rect.top,
- gui->mainwindow, NULL, instance, NULL);
-
- /* set the systray icon properties */
- nid.cbSize = sizeof(NOTIFYICONDATA);
- nid.hWnd = hwnd;
- nid.uID = 1;
- nid.uFlags = NIF_MESSAGE | NIF_ICON | NIF_TIP;
- nid.uCallbackMessage = WM_SYSTRAY;
- nid.hIcon = gui->icon;
- strcpy(nid.szTip, "MPlayer for Windows");
-
- /* register the systray icon */
- Shell_NotifyIcon(NIM_ADD, &nid);
-
- /* load all the window images */
- window_render(gui, hwnd, hdc, priv, desc, binfo);
-
- /* enable drag and drop support */
- DragAcceptFiles(hwnd, TRUE);
-
- updatedisplay(gui, hwnd);
- gui->mainwindow = hwnd;
-
- /* display */
- ShowWindow(gui->mainwindow, SW_SHOW);
- UpdateWindow(gui->mainwindow);
- maketransparent(gui->mainwindow, RGB(255, 0, 255));
- return 0;
-}
-
-gui_t *create_gui(char *skindir, char *skinName, void (*playercontrol)(int event))
-{
- gui_t *gui = calloc(1, sizeof(gui_t));
- char temp[MAX_PATH];
- HWND runningmplayer = FindWindow("MPlayer GUI for Windows", "MPlayer for Windows");
-
- if(runningmplayer)
- {
- free(gui);
- return NULL;
- }
-
- gui->startplay = startplay;
- gui->playercontrol = playercontrol;
- gui->uninit = uninit;
- gui->updatedisplay = updatedisplay;
-
- /* create playlist */
- gui->playlist = create_playlist();
-
- if(!skinName) skinName = strdup("Blue");
- sprintf(temp, "%s\\%s", skindir, skinName);
- if(create_window(gui, temp)) return NULL;
- if(create_subwindow(gui, temp)) return NULL;
- if(console) console_toggle();
- return gui;
-}
diff --git a/gui/win32/gui.h b/gui/win32/gui.h
deleted file mode 100644
index d8578dc96f..0000000000
--- a/gui/win32/gui.h
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- * MPlayer GUI for Win32
- * Copyright (C) 2003 Sascha Sommer <saschasommer@freenet.de>
- * Copyright (C) 2006 Erik Augustson <erik_27can@yahoo.com>
- * Copyright (C) 2006 Gianluigi Tiesi <sherpya@netfarm.it>
- *
- * 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_GUI_GUI_H
-#define MPLAYER_GUI_GUI_H
-
-#include "config.h"
-#include "mplayer.h"
-#include "playtree.h"
-#include "m_config.h"
-#include "skinload.h"
-#include "playlist.h"
-
-extern char *skinName;
-extern float sub_aspect;
-extern play_tree_t* playtree;
-extern m_config_t* mconfig;
-extern int sub_window;
-extern int console;
-extern NOTIFYICONDATA nid;
-
-typedef struct window_priv_t window_priv_t;
-struct window_priv_t
-{
- HWND hwnd;
- image img;
- image *background;
- HBITMAP bitmap;
- int type;
-};
-
-typedef struct gui_t gui_t;
-struct gui_t
-{
- /* screenproperties */
- int screenw, screenh, screenbpp;
- /* window related stuff */
- char *classname;
- HICON icon;
- unsigned int window_priv_count;
- window_priv_t **window_priv;
-
- HWND mainwindow;
- HWND subwindow;
-
- /* for event handling */
- widget *activewidget;
-
- int mousewx, mousewy; /* mousepos inside widget */
- int mousex, mousey;
-
- HMENU menu;
- HMENU diskmenu;
- HMENU traymenu;
- HMENU trayplaymenu;
- HMENU trayplaybackmenu;
- HMENU submenu;
- HMENU subtitlemenu;
- HMENU aspectmenu;
- HMENU dvdmenu;
- HMENU playlistmenu;
-
- int skinbrowserwindow;
- int playlistwindow;
- int aboutwindow;
-
- skin_t *skin;
- playlist_t *playlist;
-
- void (*startplay)(gui_t *gui);
- void (*updatedisplay)(gui_t *gui, HWND hwnd);
- void (*playercontrol)(int event); /* userdefine call back function */
- void (*uninit)(gui_t *gui);
-};
-
-#define wsShowWindow 8
-#define wsHideWindow 16
-#define wsShowFrame 1
-#define wsMovable 2
-#define wsSizeable 4
-
-gui_t *create_gui(char *skindir, char *skinName, void (*playercontrol)(int event));
-int destroy_window(gui_t *gui);
-int create_window(gui_t *gui, char *skindir);
-int create_subwindow(gui_t *gui, char *skindir);
-int parse_filename(char *file, play_tree_t *playtree, m_config_t *mconfig, int clear);
-void capitalize(char *filename);
-int import_playtree_playlist_into_gui(play_tree_t *my_playtree, m_config_t *config);
-
-/* Dialogs */
-void display_playlistwindow(gui_t *gui);
-void update_playlistwindow(void);
-int display_openfilewindow(gui_t *gui, int add);
-void display_openurlwindow(gui_t *gui, int add);
-void display_skinbrowser(gui_t *gui);
-void display_chapterselwindow(gui_t *gui);
-void display_eqwindow(gui_t *gui);
-void display_prefswindow(gui_t *gui);
-void display_opensubtitlewindow(gui_t *gui);
-
-#endif /* MPLAYER_GUI_GUI_H */
diff --git a/gui/win32/interface.c b/gui/win32/interface.c
deleted file mode 100644
index 209a1889d4..0000000000
--- a/gui/win32/interface.c
+++ /dev/null
@@ -1,948 +0,0 @@
-/*
- * MPlayer GUI for Win32
- * Copyright (C) 2003 Sascha Sommer <saschasommer@freenet.de>
- * Copyright (C) 2006 Erik Augustson <erik_27can@yahoo.com>
- * Copyright (C) 2006 Gianluigi Tiesi <sherpya@netfarm.it>
- *
- * 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
- */
-
-#include <windows.h>
-#include <get_path.h>
-#include "gui/interface.h"
-#include "m_option.h"
-#include "mixer.h"
-#include "mp_msg.h"
-#include "help_mp.h"
-#include "codec-cfg.h"
-#include "stream/stream.h"
-#include "libmpdemux/demuxer.h"
-#include "libmpdemux/stheader.h"
-#ifdef CONFIG_DVDREAD
-#include "stream/stream_dvd.h"
-#endif
-#include "input/input.h"
-#include "libvo/video_out.h"
-#include "libao2/audio_out.h"
-#include "access_mpcontext.h"
-#include "gui.h"
-#include "dialogs.h"
-#ifdef CONFIG_LIBCDIO
-#include <cdio/cdio.h>
-#endif
-
-extern int abs_seek_pos;
-extern float rel_seek_secs;
-extern int vcd_track;
-extern af_cfg_t af_cfg;
-int guiWinID = 0;
-
-char *skinName = NULL;
-char *codecname = NULL;
-int mplGotoTheNext = 1;
-static gui_t *mygui = NULL;
-static int update_subwindow(void);
-static RECT old_rect;
-static DWORD style;
-static HANDLE hThread;
-static unsigned threadId;
-const ao_functions_t *audio_out = NULL;
-const vo_functions_t *video_out = NULL;
-mixer_t *mixer = NULL;
-
-/* test for playlist files, no need to specify -playlist on the commandline.
- * add any conceivable playlist extensions here.
- * - Erik
- */
-int parse_filename(char *file, play_tree_t *playtree, m_config_t *mconfig, int clear)
-{
- if(clear)
- mygui->playlist->clear_playlist(mygui->playlist);
-
- if(strstr(file, ".m3u") || strstr(file, ".pls"))
- {
- playtree = parse_playlist_file(file);
- import_playtree_playlist_into_gui(playtree, mconfig);
- return 1;
- }
- return 0;
-}
-
-/**
- * \brief this actually creates a new list containing only one element...
- */
-void gaddlist( char ***list, const char *entry)
-{
- int i;
-
- if (*list)
- {
- for (i=0; (*list)[i]; i++) free((*list)[i]);
- free(*list);
- }
-
- *list = malloc(2 * sizeof(char **));
- (*list)[0] = gstrdup(entry);
- (*list)[1] = NULL;
-}
-
-char *gstrdup(const char *str)
-{
- if (!str) return NULL;
- return strdup(str);
-}
-
-/**
- * \brief this replaces a string starting with search by replace.
- * If not found, replace is appended.
- */
-void greplace(char ***list, char *search, char *replace)
-{
- int i = 0;
- int len = (search) ? strlen(search) : 0;
-
- if (*list)
- {
- for (i = 0; (*list)[i]; i++)
- {
- if (search && (!strncmp((*list)[i], search, len)))
- {
- free((*list)[i]);
- (*list)[i] = gstrdup(replace);
- return;
- }
- }
- *list = realloc(*list, (i + 2) * sizeof(char *));
- }
- else
- *list = malloc(2 * sizeof(char *));
-
- (*list)[i] = gstrdup(replace);
- (*list)[i + 1] = NULL;
-}
-
-/* this function gets called by the gui to update mplayer */
-static void guiSetEvent(int event)
-{
- if(guiIntfStruct.mpcontext)
- mixer = mpctx_get_mixer(guiIntfStruct.mpcontext);
-
- switch(event)
- {
- case evPlay:
- case evPlaySwitchToPause:
- case evPauseSwitchToPlay:
- mplPlay();
- break;
- case evPause:
- mplPause();
- break;
-#ifdef CONFIG_DVDREAD
- case evPlayDVD:
- {
- static char dvdname[MAX_PATH];
- guiIntfStruct.DVD.current_title = dvd_title;
- guiIntfStruct.DVD.current_chapter = dvd_chapter;
- guiIntfStruct.DVD.current_angle = dvd_angle;
- guiIntfStruct.DiskChanged = 1;
-
- mplSetFileName(NULL, dvd_device, STREAMTYPE_DVD);
- dvdname[0] = 0;
- strcat(dvdname, "DVD Movie");
- GetVolumeInformation(dvd_device, dvdname, MAX_PATH, NULL, NULL, NULL, NULL, 0);
- capitalize(dvdname);
- mp_msg(MSGT_GPLAYER, MSGL_V, "Opening DVD %s -> %s\n", dvd_device, dvdname);
- guiGetEvent(guiSetParameters, (char *) STREAMTYPE_DVD);
- mygui->playlist->clear_playlist(mygui->playlist);
- mygui->playlist->add_track(mygui->playlist, filename, NULL, dvdname, 0);
- mygui->startplay(mygui);
- break;
- }
-#endif
-#ifdef CONFIG_LIBCDIO
- case evPlayCD:
- {
- int i;
- char track[10];
- char trackname[10];
- CdIo_t *p_cdio = cdio_open(NULL, DRIVER_UNKNOWN);
- track_t i_tracks;
-
- if(p_cdio == NULL) printf("Couldn't find a driver.\n");
- i_tracks = cdio_get_num_tracks(p_cdio);
-
- mygui->playlist->clear_playlist(mygui->playlist);
- for(i=0;i<i_tracks;i++)
- {
- sprintf(track, "cdda://%d", i+1);
- sprintf(trackname, "Track %d", i+1);
- mygui->playlist->add_track(mygui->playlist, track, NULL, trackname, 0);
- }
- cdio_destroy(p_cdio);
- mygui->startplay(mygui);
- break;
- }
-#endif
- case evFullScreen:
- mp_input_queue_cmd(mp_input_parse_cmd("vo_fullscreen"));
- break;
- case evExit:
- {
- /* We are asking mplayer to exit, later it will ask us after uninit is made
- this should be the only safe way to quit */
- mygui->activewidget = NULL;
- mp_input_queue_cmd(mp_input_parse_cmd("quit"));
- break;
- }
- case evStop:
- if(guiIntfStruct.Playing)
- guiGetEvent(guiCEvent, (void *) guiSetStop);
- break;
- case evSetMoviePosition:
- {
- rel_seek_secs = guiIntfStruct.Position / 100.0f;
- abs_seek_pos = 3;
- break;
- }
- case evForward10sec:
- {
- rel_seek_secs = 10.0f;
- abs_seek_pos = 0;
- break;
- }
- case evBackward10sec:
- {
- rel_seek_secs = -10.0f;
- abs_seek_pos = 0;
- break;
- }
- case evSetBalance:
- case evSetVolume:
- {
- float l,r;
-
- if (guiIntfStruct.Playing == 0)
- break;
-
- if (guiIntfStruct.Balance == 50.0f)
- mixer_setvolume(mixer, guiIntfStruct.Volume, guiIntfStruct.Volume);
-
- l = guiIntfStruct.Volume * ((100.0f - guiIntfStruct.Balance) / 50.0f);
- r = guiIntfStruct.Volume * ((guiIntfStruct.Balance) / 50.0f);
-
- if (l > guiIntfStruct.Volume) l=guiIntfStruct.Volume;
- if (r > guiIntfStruct.Volume) r=guiIntfStruct.Volume;
- mixer_setvolume(mixer, l, r);
- /* Check for balance support on mixer - there is a better way ?? */
- if (r != l)
- {
- mixer_getvolume(mixer, &l, &r);
- if (r == l)
- {
- mp_msg(MSGT_GPLAYER, MSGL_V, "[GUI] Mixer doesn't support balanced audio\n");
- mixer_setvolume(mixer, guiIntfStruct.Volume, guiIntfStruct.Volume);
- guiIntfStruct.Balance = 50.0f;
- }
- }
- break;
- }
- case evMute:
- {
- mp_cmd_t * cmd = calloc(1, sizeof(*cmd));
- cmd->id=MP_CMD_MUTE;
- cmd->name=strdup("mute");
- mp_input_queue_cmd(cmd);
- break;
- }
- case evDropFile:
- case evLoadPlay:
- {
- switch(guiIntfStruct.StreamType)
- {
-#ifdef CONFIG_DVDREAD
- case STREAMTYPE_DVD:
- {
- guiIntfStruct.Title = guiIntfStruct.DVD.current_title;
- guiIntfStruct.Chapter = guiIntfStruct.DVD.current_chapter;
- guiIntfStruct.Angle = guiIntfStruct.DVD.current_angle;
- guiIntfStruct.DiskChanged = 1;
- guiGetEvent(guiCEvent, (void *) guiSetPlay);
- break;
- }
-#endif
- default:
- {
- guiIntfStruct.FilenameChanged = guiIntfStruct.NewPlay = 1;
- update_playlistwindow();
- mplGotoTheNext = guiIntfStruct.Playing? 0 : 1;
- guiGetEvent(guiCEvent, (void *) guiSetStop);
- guiGetEvent(guiCEvent, (void *) guiSetPlay);
- break;
- }
- }
- break;
- }
- case evNext:
- mplNext();
- break;
- case evPrev:
- mplPrev();
- break;
- }
-}
-
-void mplPlay( void )
-{
- if((!guiIntfStruct.Filename ) || (guiIntfStruct.Filename[0] == 0))
- return;
-
- if(guiIntfStruct.Playing > 0)
- {
- mplPause();
- return;
- }
- guiIntfStruct.NewPlay = 1;
- guiGetEvent(guiCEvent, (void *) guiSetPlay);
-}
-
-void mplPause( void )
-{
- if(!guiIntfStruct.Playing) return;
-
- if(guiIntfStruct.Playing == 1)
- {
- mp_cmd_t * cmd = calloc(1, sizeof(*cmd));
- cmd->id=MP_CMD_PAUSE;
- cmd->name=strdup("pause");
- mp_input_queue_cmd(cmd);
- } else guiIntfStruct.Playing = 1;
-}
-
-void mplNext(void)
-{
- if(guiIntfStruct.Playing == 2) return;
- switch(guiIntfStruct.StreamType)
- {
-#ifdef CONFIG_DVDREAD
- case STREAMTYPE_DVD:
- if(guiIntfStruct.DVD.current_chapter == (guiIntfStruct.DVD.chapters - 1))
- return;
- guiIntfStruct.DVD.current_chapter++;
- break;
-#endif
- default:
- if(mygui->playlist->current == (mygui->playlist->trackcount - 1))
- return;
- mplSetFileName(NULL, mygui->playlist->tracks[(mygui->playlist->current)++]->filename,
- STREAMTYPE_STREAM);
- break;
- }
- mygui->startplay(mygui);
-}
-
-void mplPrev(void)
-{
- if(guiIntfStruct.Playing == 2) return;
- switch(guiIntfStruct.StreamType)
- {
-#ifdef CONFIG_DVDREAD
- case STREAMTYPE_DVD:
- if(guiIntfStruct.DVD.current_chapter == 1)
- return;
- guiIntfStruct.DVD.current_chapter--;
- break;
-#endif
- default:
- if(mygui->playlist->current == 0)
- return;
- mplSetFileName(NULL, mygui->playlist->tracks[(mygui->playlist->current)--]->filename,
- STREAMTYPE_STREAM);
- break;
- }
- mygui->startplay(mygui);
-}
-
-void mplEnd( void )
-{
- if(!mplGotoTheNext && guiIntfStruct.Playing)
- {
- mplGotoTheNext = 1;
- return;
- }
-
- if(mplGotoTheNext && guiIntfStruct.Playing &&
- (mygui->playlist->current < (mygui->playlist->trackcount - 1)) &&
- guiIntfStruct.StreamType != STREAMTYPE_DVD &&
- guiIntfStruct.StreamType != STREAMTYPE_DVDNAV)
- {
- /* we've finished this file, reset the aspect */
- if(movie_aspect >= 0)
- movie_aspect = -1;
-
- mplGotoTheNext = guiIntfStruct.FilenameChanged = guiIntfStruct.NewPlay = 1;
- mplSetFileName(NULL, mygui->playlist->tracks[(mygui->playlist->current)++]->filename, STREAMTYPE_STREAM);
- //sprintf(guiIntfStruct.Filename, mygui->playlist->tracks[(mygui->playlist->current)++]->filename);
- }
-
- if(guiIntfStruct.FilenameChanged && guiIntfStruct.NewPlay)
- return;
-
- guiIntfStruct.TimeSec = 0;
- guiIntfStruct.Position = 0;
- guiIntfStruct.AudioType = 0;
-
-#ifdef CONFIG_DVDREAD
- guiIntfStruct.DVD.current_title = 1;
- guiIntfStruct.DVD.current_chapter = 1;
- guiIntfStruct.DVD.current_angle = 1;
-#endif
-
- if (mygui->playlist->current == (mygui->playlist->trackcount - 1))
- mygui->playlist->current = 0;
-
- fullscreen = 0;
- if(style == WS_VISIBLE | WS_POPUP)
- {
- style = WS_OVERLAPPEDWINDOW | WS_SIZEBOX;
- SetWindowLong(mygui->subwindow, GWL_STYLE, style);
- }
- guiGetEvent(guiCEvent, (void *) guiSetStop);
-}
-
-void mplSetFileName(char *dir, char *name, int type)
-{
- if(!name) return;
- if(!dir)
- guiSetFilename(guiIntfStruct.Filename, name)
- else
- guiSetDF(guiIntfStruct.Filename, dir, name);
-
- guiIntfStruct.StreamType = type;
- free((void **) &guiIntfStruct.AudioFile);
- free((void **) &guiIntfStruct.Subtitlename);
-}
-
-void mplFullScreen( void )
-{
- if(!guiIntfStruct.sh_video) return;
-
- if(sub_window)
- {
- if(!fullscreen && IsWindowVisible(mygui->subwindow) && !IsIconic(mygui->subwindow))
- GetWindowRect(mygui->subwindow, &old_rect);
-
- if(fullscreen)
- {
- fullscreen = 0;
- style = WS_OVERLAPPEDWINDOW | WS_SIZEBOX;
- } else {
- fullscreen = 1;
- style = WS_VISIBLE | WS_POPUP;
- }
- SetWindowLong(mygui->subwindow, GWL_STYLE, style);
- update_subwindow();
- }
- video_out->control(VOCTRL_FULLSCREEN, 0);
- if(sub_window) ShowWindow(mygui->subwindow, SW_SHOW);
-}
-
-static unsigned __stdcall GuiThread(void* param)
-{
- MSG msg;
-
- if(!skinName) skinName = strdup("Blue");
- if(!mygui) mygui = create_gui(get_path("skins"), skinName, guiSetEvent);
- if(!mygui) exit_player("Unable to load GUI.");
-
- if(autosync && autosync != gtkAutoSync)
- {
- gtkAutoSyncOn = 1;
- gtkAutoSync = autosync;
- }
-
- while(GetMessage(&msg, NULL, 0, 0))
- {
- TranslateMessage(&msg);
- DispatchMessage(&msg);
- }
- fprintf(stderr, "[GUI] GUI thread terminated.\n");
- fflush(stderr);
- return 0;
-}
-
-void guiInit(void)
-{
- memset(&guiIntfStruct, 0, sizeof(guiIntfStruct));
- /* Create The gui thread */
- if (!mygui)
- {
- hThread = _beginthreadex(NULL, 0, GuiThread, NULL, 0, &threadId);
- mp_msg(MSGT_GPLAYER, MSGL_V, "[GUI] Creating GUI Thread 0x%04x\n", threadId);
- }
-
- /* Wait until the gui is created */
- while(!mygui) Sleep(100);
- mp_msg(MSGT_GPLAYER, MSGL_V, "[GUI] GUI thread started.\n");
-}
-
-void guiDone(void)
-{
- if(mygui)
- {
- fprintf(stderr, "[GUI] Closed by main mplayer window\n");
- fflush(stderr);
- PostThreadMessage(threadId, WM_QUIT, 0, 0);
- WaitForSingleObject(hThread, INFINITE);
- CloseHandle(hThread);
- mygui->uninit(mygui);
- free(mygui);
- mygui = NULL;
- }
- /* Remove tray icon */
- Shell_NotifyIcon(NIM_DELETE, &nid);
- cfg_write();
-}
-
-/* this function gets called by mplayer to update the gui */
-int guiGetEvent(int type, char *arg)
-{
- stream_t *stream = (stream_t *) arg;
-#ifdef CONFIG_DVDREAD
- dvd_priv_t *dvdp = (dvd_priv_t *) arg;
-#endif
- if(!mygui || !mygui->skin) return 0;
-
- if(guiIntfStruct.mpcontext)
- {
- audio_out = mpctx_get_audio_out(guiIntfStruct.mpcontext);
- video_out = mpctx_get_video_out(guiIntfStruct.mpcontext);
- mixer = mpctx_get_mixer(guiIntfStruct.mpcontext);
- playtree = mpctx_get_playtree_iter(guiIntfStruct.mpcontext);
- }
-
- switch (type)
- {
- case guiSetFileFormat:
- guiIntfStruct.FileFormat = (int) arg;
- break;
- case guiSetParameters:
- {
- guiGetEvent(guiSetDefaults, NULL);
- guiIntfStruct.DiskChanged = 0;
- guiIntfStruct.FilenameChanged = 0;
- guiIntfStruct.NewPlay = 0;
- switch(guiIntfStruct.StreamType)
- {
- case STREAMTYPE_PLAYLIST:
- break;
-#ifdef CONFIG_DVDREAD
- case STREAMTYPE_DVD:
- {
- char tmp[512];
- dvd_title = guiIntfStruct.DVD.current_title;
- dvd_chapter = guiIntfStruct.DVD.current_chapter;
- dvd_angle = guiIntfStruct.DVD.current_angle;
- sprintf(tmp,"dvd://%d", guiIntfStruct.Title);
- guiSetFilename(guiIntfStruct.Filename, tmp);
- break;
- }
-#endif
- }
- if(guiIntfStruct.Filename)
- filename = strdup(guiIntfStruct.Filename);
- else if(filename)
- strcpy(guiIntfStruct.Filename, filename);
- break;
- }
- case guiSetAudioOnly:
- {
- guiIntfStruct.AudioOnly = (int) arg;
- if(IsWindowVisible(mygui->subwindow))
- ShowWindow(mygui->subwindow, SW_HIDE);
- break;
- }
- case guiSetContext:
- guiIntfStruct.mpcontext = (void *) arg;
- break;
- case guiSetDemuxer:
- guiIntfStruct.demuxer = (void *) arg;
- break;
- case guiSetValues:
- {
- guiIntfStruct.sh_video = arg;
- if (arg)
- {
- sh_video_t *sh = (sh_video_t *)arg;
- codecname = sh->codec->name;
- guiIntfStruct.FPS = sh->fps;
-
- /* we have video, show the subwindow */
- if(!IsWindowVisible(mygui->subwindow) || IsIconic(mygui->subwindow))
- ShowWindow(mygui->subwindow, SW_SHOWNORMAL);
- if(WinID == -1)
- update_subwindow();
-
- }
- break;
- }
- case guiSetShVideo:
- {
- guiIntfStruct.MovieWidth = vo_dwidth;
- guiIntfStruct.MovieHeight = vo_dheight;
-
- sub_aspect = (float)guiIntfStruct.MovieWidth/guiIntfStruct.MovieHeight;
- if(WinID != -1)
- update_subwindow();
- break;
- }
- case guiSetStream:
- {
- guiIntfStruct.StreamType = stream->type;
- switch(stream->type)
- {
-#ifdef CONFIG_DVDREAD
- case STREAMTYPE_DVD:
- guiGetEvent(guiSetDVD, (char *) stream->priv);
- break;
-#endif
- }
- break;
- }
-#ifdef CONFIG_DVDREAD
- case guiSetDVD:
- {
- guiIntfStruct.DVD.titles = dvdp->vmg_file->tt_srpt->nr_of_srpts;
- guiIntfStruct.DVD.chapters = dvdp->vmg_file->tt_srpt->title[dvd_title].nr_of_ptts;
- guiIntfStruct.DVD.angles = dvdp->vmg_file->tt_srpt->title[dvd_title].nr_of_angles;
- guiIntfStruct.DVD.nr_of_audio_channels = dvdp->nr_of_channels;
- memcpy(guiIntfStruct.DVD.audio_streams, dvdp->audio_streams, sizeof(dvdp->audio_streams));
- guiIntfStruct.DVD.nr_of_subtitles = dvdp->nr_of_subtitles;
- memcpy(guiIntfStruct.DVD.subtitles, dvdp->subtitles, sizeof(dvdp->subtitles));
- guiIntfStruct.DVD.current_title = dvd_title + 1;
- guiIntfStruct.DVD.current_chapter = dvd_chapter + 1;
- guiIntfStruct.DVD.current_angle = dvd_angle + 1;
- guiIntfStruct.Track = dvd_title + 1;
- break;
- }
-#endif
- case guiReDraw:
- mygui->updatedisplay(mygui, mygui->mainwindow);
- break;
- case guiSetAfilter:
- guiIntfStruct.afilter = (void *) arg;
- break;
- case guiCEvent:
- {
- guiIntfStruct.Playing = (int) arg;
- switch (guiIntfStruct.Playing)
- {
- case guiSetPlay:
- {
- guiIntfStruct.Playing = 1;
- break;
- }
- case guiSetStop:
- {
- guiIntfStruct.Playing = 0;
- if(movie_aspect >= 0)
- movie_aspect = -1;
- update_subwindow();
- break;
- }
- case guiSetPause:
- guiIntfStruct.Playing = 2;
- break;
- }
- break;
- }
- case guiIEvent:
- {
- mp_msg(MSGT_GPLAYER,MSGL_V, "cmd: %d\n", (int) arg);
- /* MPlayer asks us to quit */
- switch((int) arg)
- {
- case MP_CMD_GUI_FULLSCREEN:
- mplFullScreen();
- break;
- case MP_CMD_QUIT:
- {
- mygui->uninit(mygui);
- free(mygui);
- mygui = NULL;
- exit_player("Done");
- return 0;
- }
- case MP_CMD_GUI_STOP:
- guiGetEvent(guiCEvent, (void *) guiSetStop);
- break;
- case MP_CMD_GUI_PLAY:
- guiGetEvent(guiCEvent, (void *) guiSetPlay);
- break;
- case MP_CMD_GUI_SKINBROWSER:
- if(fullscreen) guiSetEvent(evFullScreen);
- PostMessage(mygui->mainwindow, WM_COMMAND, (WPARAM) ID_SKINBROWSER, 0);
- break;
- case MP_CMD_GUI_PLAYLIST:
- if(fullscreen) guiSetEvent(evFullScreen);
- PostMessage(mygui->mainwindow, WM_COMMAND, (WPARAM) ID_PLAYLIST, 0);
- break;
- case MP_CMD_GUI_PREFERENCES:
- if(fullscreen) guiSetEvent(evFullScreen);
- PostMessage(mygui->mainwindow, WM_COMMAND, (WPARAM) ID_PREFS, 0);
- break;
- case MP_CMD_GUI_LOADFILE:
- if(fullscreen) guiSetEvent(evFullScreen);
- PostMessage(mygui->mainwindow, WM_COMMAND, (WPARAM) IDFILE_OPEN, 0);
- break;
- case MP_CMD_GUI_LOADSUBTITLE:
- if(fullscreen) guiSetEvent(evFullScreen);
- PostMessage(mygui->mainwindow, WM_COMMAND, (WPARAM) IDSUBTITLE_OPEN, 0);
- break;
- default:
- break;
- }
- break;
- }
- case guiSetFileName:
- if (arg) guiIntfStruct.Filename = (char *) arg;
- break;
- case guiSetDefaults:
- {
- audio_id = -1;
- video_id = -1;
- dvdsub_id = -1;
- vobsub_id = -1;
- stream_cache_size = -1;
- autosync = 0;
- vcd_track = 0;
- dvd_title = 0;
- force_fps = 0;
- if(!mygui->playlist->tracks) return 0;
- filename = guiIntfStruct.Filename = mygui->playlist->tracks[mygui->playlist->current]->filename;
- guiIntfStruct.Track = mygui->playlist->current + 1;
- if(gtkAONorm) greplace(&af_cfg.list, "volnorm", "volnorm");
- if(gtkAOExtraStereo)
- {
- char *name = malloc(12 + 20 + 1);
- snprintf(name, 12 + 20, "extrastereo=%f", gtkAOExtraStereoMul);
- name[12 + 20] = 0;
- greplace(&af_cfg.list, "extrastereo", name);
- free(name);
- }
- if(gtkCacheOn) stream_cache_size = gtkCacheSize;
- if(gtkAutoSyncOn) autosync = gtkAutoSync;
- break;
- }
- case guiSetVolume:
- {
- if(audio_out)
- {
- /* Some audio_out drivers do not support balance e.g. dsound */
- /* FIXME this algo is not correct */
- float l, r;
- mixer_getvolume(mixer, &l, &r);
- guiIntfStruct.Volume = (r > l ? r : l); /* max(r,l) */
- if (r != l)
- guiIntfStruct.Balance = ((r-l) + 100.0f) * 0.5f;
- else
- guiIntfStruct.Balance = 50.0f;
- }
- break;
- }
- default:
- mp_msg(MSGT_GPLAYER, MSGL_ERR, "[GUI] GOT UNHANDLED EVENT %i\n", type);
- }
- return 0;
-}
-
-/* This function adds/inserts one file into the gui playlist */
-int import_file_into_gui(char *pathname, int insert)
-{
- char filename[MAX_PATH];
- char *filepart = filename;
-
- if (strstr(pathname, "://"))
- {
- mp_msg(MSGT_GPLAYER, MSGL_V, "[GUI] Adding special %s\n", pathname);
- mygui->playlist->add_track(mygui->playlist, pathname, NULL, NULL, 0);
- return 1;
- }
- if (GetFullPathName(pathname, MAX_PATH, filename, &filepart))
- {
- if (!(GetFileAttributes(filename) & FILE_ATTRIBUTE_DIRECTORY))
- {
- mp_msg(MSGT_GPLAYER, MSGL_V, "[GUI] Adding filename: %s - fullpath: %s\n", filepart, filename);
- mygui->playlist->add_track(mygui->playlist, filename, NULL, filepart, 0);
- return 1;
- }
- else
- mp_msg(MSGT_GPLAYER, MSGL_V, "[GUI] Cannot add %s\n", filename);
- }
-
- return 0;
-}
-
-/* This function imports the initial playtree (based on cmd-line files) into the gui playlist
- by either:
- - overwriting gui pl (enqueue=0) */
-
-int import_initial_playtree_into_gui(play_tree_t *my_playtree, m_config_t *config, int enqueue)
-{
- play_tree_iter_t *my_pt_iter = NULL;
- int result = 0;
-
- if(!mygui) guiInit();
-
- if((my_pt_iter = pt_iter_create(&my_playtree, config)))
- {
- while ((filename = pt_iter_get_next_file(my_pt_iter)) != NULL)
- {
- if (parse_filename(filename, my_playtree, config, 0))
- result = 1;
- else if (import_file_into_gui(filename, 0)) /* Add it to end of list */
- result = 1;
- }
- }
- mplGotoTheNext = 1;
-
- if (result)
- {
- mygui->playlist->current = 0;
- filename = mygui->playlist->tracks[0]->filename;
- }
- return result;
-}
-
-/* This function imports and inserts an playtree, that is created "on the fly", for example by
- parsing some MOV-Reference-File; or by loading an playlist with "File Open"
- The file which contained the playlist is thereby replaced with it's contents. */
-
-int import_playtree_playlist_into_gui(play_tree_t *my_playtree, m_config_t *config)
-{
- play_tree_iter_t *my_pt_iter = NULL;
- int result = 0;
-
- if((my_pt_iter = pt_iter_create(&my_playtree, config)))
- {
- while ((filename = pt_iter_get_next_file(my_pt_iter)) != NULL)
- if (import_file_into_gui(filename, 1)) /* insert it into the list and set plCurrent = new item */
- result = 1;
- pt_iter_destroy(&my_pt_iter);
- }
- filename = NULL;
- return result;
-}
-
-inline void gtkMessageBox(int type, const char *str)
-{
- if (type & GTK_MB_FATAL)
- MessageBox(NULL, str, "MPlayer GUI for Windows Error", MB_OK | MB_ICONERROR);
-
- fprintf(stderr, "[GUI] MessageBox: %s\n", str);
- fflush(stderr);
-}
-
-void guiMessageBox(int level, char *str)
-{
- switch(level)
- {
- case MSGL_FATAL:
- gtkMessageBox(GTK_MB_FATAL | GTK_MB_SIMPLE, str);
- break;
- case MSGL_ERR:
- gtkMessageBox(GTK_MB_ERROR | GTK_MB_SIMPLE, str);
- break;
- }
-}
-
-static int update_subwindow(void)
-{
- int x,y;
- RECT rd;
- WINDOWPOS wp;
-
- if(!sub_window)
- {
- WinID = -1; // so far only directx supports WinID in windows
-
- if(IsWindowVisible(mygui->subwindow) && guiIntfStruct.sh_video && guiIntfStruct.Playing)
- {
- ShowWindow(mygui->subwindow, SW_HIDE);
- return 0;
- }
- else if(guiIntfStruct.AudioOnly)
- return 0;
- else ShowWindow(mygui->subwindow, SW_SHOW);
- }
-
- /* we've come out of fullscreen at the end of file */
- if((!IsWindowVisible(mygui->subwindow) || IsIconic(mygui->subwindow)) && !guiIntfStruct.AudioOnly)
- ShowWindow(mygui->subwindow, SW_SHOWNORMAL);
-
- /* get our current window coordinates */
- GetWindowRect(mygui->subwindow, &rd);
-
- x = rd.left;
- y = rd.top;
-
- /* restore sub window position when coming out of fullscreen */
- if(x <= 0) x = old_rect.left;
- if(y <= 0) y = old_rect.top;
-
- if(!guiIntfStruct.Playing)
- {
- window *desc = NULL;
- int i;
-
- for (i=0; i<mygui->skin->windowcount; i++)
- if(mygui->skin->windows[i]->type == wiSub)
- desc = mygui->skin->windows[i];
-
- rd.right = rd.left+desc->base->bitmap[0]->width;
- rd.bottom = rd.top+desc->base->bitmap[0]->height;
- sub_aspect = (float)(rd.right-rd.left)/(rd.bottom-rd.top);
- }
- else
- {
- rd.right = rd.left+guiIntfStruct.MovieWidth;
- rd.bottom = rd.top+guiIntfStruct.MovieHeight;
-
- if (movie_aspect > 0.0) // forced aspect from the cmdline
- sub_aspect = movie_aspect;
- }
-
-
- AdjustWindowRect(&rd, WS_OVERLAPPEDWINDOW | WS_SIZEBOX, 0);
- SetWindowPos(mygui->subwindow, 0, x, y, rd.right-rd.left, rd.bottom-rd.top, SWP_NOOWNERZORDER);
-
- wp.hwnd = mygui->subwindow;
- wp.x = rd.left;
- wp.y = rd.top;
- wp.cx = rd.right-rd.left;
- wp.cy = rd.bottom-rd.top;
- wp.flags = SWP_NOOWNERZORDER | SWP_SHOWWINDOW;
-
- /* erase the bitmap image if there's video */
- if(guiIntfStruct.Playing != 0 && guiIntfStruct.sh_video)
- SendMessage(mygui->subwindow, WM_ERASEBKGND, (WPARAM)GetDC(mygui->subwindow), 0);
-
- /* reset the window aspect */
- SendMessage(mygui->subwindow, WM_WINDOWPOSCHANGED, 0, (LPARAM)&wp);
- return 0;
-}
-
-void guiEventHandling(void) {}
diff --git a/gui/win32/playlist.c b/gui/win32/playlist.c
deleted file mode 100644
index 344e99636e..0000000000
--- a/gui/win32/playlist.c
+++ /dev/null
@@ -1,158 +0,0 @@
-/*
- * MPlayer GUI for Win32
- * Copyright (C) 2003 Sascha Sommer <saschasommer@freenet.de>
- * Copyright (C) 2006 Erik Augustson <erik_27can@yahoo.com>
- * Copyright (C) 2006 Gianluigi Tiesi <sherpya@netfarm.it>
- *
- * 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
- */
-
-#include <windows.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include "mp_msg.h"
-#include "playlist.h"
-
-/* TODO: implement sort_playlist */
-
-BOOL adddirtoplaylist(playlist_t *playlist, const char *path, BOOL recursive)
-{
- HANDLE findHandle = INVALID_HANDLE_VALUE;
- WIN32_FIND_DATA finddata;
- char findpath[MAX_PATH], filename[MAX_PATH];
- char *filepart;
-
- sprintf(findpath, "%s\\*.*", path);
-
- findHandle = FindFirstFile(findpath, &finddata);
-
- if (findHandle == INVALID_HANDLE_VALUE) return FALSE;
- do
- {
- if (finddata.cFileName[0] == '.' || strstr(finddata.cFileName, "Thumbs.db")) continue;
- sprintf(findpath, "%s\\%s", path, finddata.cFileName);
-
- if (GetFileAttributes(findpath) & FILE_ATTRIBUTE_DIRECTORY)
- {
- if(recursive)
- adddirtoplaylist(playlist, findpath, recursive);
- }
- else
- {
- if (GetFullPathName(findpath, MAX_PATH, filename, &filepart))
- playlist->add_track(playlist, filename, NULL, filepart, 0);
- }
- } while (FindNextFile(findHandle, &finddata));
- FindClose(findHandle);
- return TRUE;
-}
-
-static void add_track(playlist_t *playlist, const char *filename, const char *artist, const char *title, int duration)
-{
- (playlist->trackcount)++;
- playlist->tracks = realloc(playlist->tracks, playlist->trackcount * sizeof(pl_track_t *));
- playlist->tracks[playlist->trackcount - 1] = calloc(1, sizeof(pl_track_t));
- if(filename) playlist->tracks[playlist->trackcount - 1]->filename = strdup(filename);
- if(artist) playlist->tracks[playlist->trackcount - 1]->artist = strdup(artist);
- if(title) playlist->tracks[playlist->trackcount - 1]->title = strdup(title);
- if(duration) playlist->tracks[playlist->trackcount - 1]->duration = duration;
-}
-
-static void remove_track(playlist_t *playlist, int number)
-{
- pl_track_t **tmp = calloc(1, playlist->trackcount * sizeof(pl_track_t *));
- int i, p = 0;
- memcpy(tmp, playlist->tracks, playlist->trackcount * sizeof(pl_track_t *));
- (playlist->trackcount)--;
- playlist->tracks = realloc(playlist->tracks, playlist->trackcount * sizeof(pl_track_t *));
- for(i=0; i<playlist->trackcount + 1; i++)
- {
- if(i != (number - 1))
- {
- playlist->tracks[p] = tmp[i];
- p++;
- }
- else
- {
- if(tmp[i]->filename) free(tmp[i]->filename);
- if(tmp[i]->artist) free(tmp[i]->artist);
- if(tmp[i]->title) free(tmp[i]->title);
- free(tmp[i]);
- }
- }
- free(tmp);
-}
-
-static void moveup_track(playlist_t *playlist, int number)
-{
- pl_track_t *tmp;
- if(number == 1) return; /* already first */
- tmp = playlist->tracks[number - 2];
- playlist->tracks[number - 2] = playlist->tracks[number - 1];
- playlist->tracks[number - 1] = tmp;
-}
-
-static void movedown_track(playlist_t *playlist, int number)
-{
- pl_track_t *tmp;
- if(number == playlist->trackcount) return; /* already latest */
- tmp = playlist->tracks[number];
- playlist->tracks[number] = playlist->tracks[number - 1];
- playlist->tracks[number - 1] = tmp;
-}
-
-static void sort_playlist(playlist_t *playlist, int opt) {}
-
-static void clear_playlist(playlist_t *playlist)
-{
- while(playlist->trackcount) playlist->remove_track(playlist, 1);
- playlist->tracks = NULL;
- playlist->current = 0;
-}
-
-static void free_playlist(playlist_t *playlist)
-{
- if(playlist->tracks) playlist->clear_playlist(playlist);
- free(playlist);
-}
-
-static void dump_playlist(playlist_t *playlist)
-{
- int i;
- for (i=0; i<playlist->trackcount; i++)
- {
- mp_msg(MSGT_GPLAYER, MSGL_V, "track %i %s ", i + 1, playlist->tracks[i]->filename);
- if(playlist->tracks[i]->artist) mp_msg(MSGT_GPLAYER, MSGL_V, "%s ", playlist->tracks[i]->artist);
- if(playlist->tracks[i]->title) mp_msg(MSGT_GPLAYER, MSGL_V, "- %s ", playlist->tracks[i]->title);
- if(playlist->tracks[i]->duration) mp_msg(MSGT_GPLAYER, MSGL_V, "%i ", playlist->tracks[i]->duration);
- mp_msg(MSGT_GPLAYER, MSGL_V, "\n");
- }
-}
-
-playlist_t *create_playlist(void)
-{
- playlist_t *playlist = calloc(1, sizeof(playlist_t));
- playlist->add_track = add_track;
- playlist->remove_track = remove_track;
- playlist->moveup_track = moveup_track;
- playlist->movedown_track = movedown_track;
- playlist->dump_playlist = dump_playlist;
- playlist->sort_playlist = sort_playlist;
- playlist->clear_playlist = clear_playlist;
- playlist->free_playlist = free_playlist;
- return playlist;
-}
diff --git a/gui/win32/playlist.h b/gui/win32/playlist.h
deleted file mode 100644
index 8a3fddd41c..0000000000
--- a/gui/win32/playlist.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * MPlayer GUI for Win32
- * Copyright (C) 2003 Sascha Sommer <saschasommer@freenet.de>
- * Copyright (C) 2006 Erik Augustson <erik_27can@yahoo.com>
- * Copyright (C) 2006 Gianluigi Tiesi <sherpya@netfarm.it>
- *
- * 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_GUI_PLAYLIST_H
-#define MPLAYER_GUI_PLAYLIST_H
-
-#include <windows.h>
-
-typedef struct
-{
- char *filename;
- char *artist;
- char *title;
- int duration;
-} pl_track_t;
-
-typedef struct playlist_t playlist_t;
-struct playlist_t
-{
- int current; /* currently used track */
- int trackcount; /* number of tracknumber */
- pl_track_t **tracks; /* tracklist */
- void (*add_track)(playlist_t* playlist, const char *filename, const char *artist, const char *title, int duration);
- void (*remove_track)(playlist_t* playlist, int number);
- void (*moveup_track)(playlist_t* playlist, int number);
- void (*movedown_track)(playlist_t* playlist, int number);
- void (*dump_playlist)(playlist_t* playlist);
- void (*sort_playlist)(playlist_t* playlist, int opt);
- void (*clear_playlist)(playlist_t* playlist);
- void (*free_playlist)(playlist_t* playlist);
-};
-
-#define SORT_BYFILENAME 1
-#define SORT_BYARTIST 2
-#define SORT_BYTITLE 3
-#define SORT_BYDURATION 4
-
-playlist_t *create_playlist(void);
-BOOL adddirtoplaylist(playlist_t *playlist, const char* path, BOOL recursive);
-
-#endif /* MPLAYER_GUI_PLAYLIST_H */
diff --git a/gui/win32/preferences.c b/gui/win32/preferences.c
deleted file mode 100644
index 2a98b2d807..0000000000
--- a/gui/win32/preferences.c
+++ /dev/null
@@ -1,714 +0,0 @@
-/*
- * MPlayer GUI for Win32
- * Copyright (C) 2003 Sascha Sommer <saschasommer@freenet.de>
- * Copyright (C) 2006 Erik Augustson <erik_27can@yahoo.com>
- * Copyright (C) 2006 Gianluigi Tiesi <sherpya@netfarm.it>
- *
- * 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
- */
-
-#include <windows.h>
-#include <commctrl.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "libvo/video_out.h"
-#include "libao2/audio_out.h"
-#include "mixer.h"
-#include "gui/interface.h"
-#include "gui.h"
-#include "mp_msg.h"
-#include "help_mp.h"
-#include "dialogs.h"
-
-extern char *proc_priority;
-
-static void set_defaults(void);
-
-static LRESULT CALLBACK PrefsWndProc(HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam)
-{
- HWND btn, label, edit1, edit2, edit3, updown1, updown2, track1, track2;
- static HWND vo_driver, ao_driver, prio;
- int i = 0, j = 0;
- char dvddevice[MAX_PATH];
- char cdromdevice[MAX_PATH];
- char procprio[11];
- float x = 10.0, y = 100.0, stereopos, delaypos;
- stereopos = gtkAOExtraStereoMul * x;
- delaypos = audio_delay * y;
-
- switch (iMsg)
- {
- case WM_CREATE:
- {
- /* video and audio drivers */
- label = CreateWindow("static", "Video Driver:",
- WS_CHILD | WS_VISIBLE,
- 10, 13, 70, 15, hwnd,
- NULL, ((LPCREATESTRUCT) lParam) -> hInstance,
- NULL);
- SendMessage(label, WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT), 0);
-
- label = CreateWindow("static", "Audio Driver:",
- WS_CHILD | WS_VISIBLE,
- 190, 13, 70, 15, hwnd,
- NULL, ((LPCREATESTRUCT) lParam) -> hInstance,
- NULL);
- SendMessage(label, WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT), 0);
-
- label = CreateWindow("static", "Extra stereo coefficient:",
- WS_CHILD | WS_VISIBLE,
- 10, 126, 115, 15, hwnd,
- NULL, ((LPCREATESTRUCT) lParam) -> hInstance,
- NULL);
- SendMessage(label, WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT), 0);
-
- label = CreateWindow("static", "Audio delay:",
- WS_CHILD | WS_VISIBLE,
- 36, 165, 115, 15, hwnd,
- NULL, ((LPCREATESTRUCT) lParam) -> hInstance,
- NULL);
- SendMessage(label, WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT), 0);
-
- label = CreateWindow("static", "OSD level:",
- WS_CHILD | WS_VISIBLE,
- 10, 264, 115, 15, hwnd,
- NULL, ((LPCREATESTRUCT) lParam) -> hInstance,
- NULL);
- SendMessage(label, WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT), 0);
-
- label = CreateWindow("static", "DVD device:",
- WS_CHILD | WS_VISIBLE,
- 80, 363, 115, 15, hwnd,
- NULL, ((LPCREATESTRUCT) lParam) -> hInstance,
- NULL);
- SendMessage(label, WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT), 0);
-
- label = CreateWindow("static", "CD device:",
- WS_CHILD | WS_VISIBLE,
- 202, 363, 115, 15, hwnd,
- NULL, ((LPCREATESTRUCT) lParam) -> hInstance,
- NULL);
- SendMessage(label, WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT), 0);
-
- label = CreateWindow("static", "Priority:",
- WS_CHILD | WS_VISIBLE,
- 217, 264, 115, 15, hwnd,
- NULL, ((LPCREATESTRUCT) lParam) -> hInstance,
- NULL);
- SendMessage(label, WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT), 0);
-
- vo_driver = CreateWindow("combobox", NULL,
- CBS_DROPDOWNLIST | CB_SHOWDROPDOWN |
- CBS_NOINTEGRALHEIGHT | CBS_HASSTRINGS |
- WS_CHILD | WS_VISIBLE |
- WS_VSCROLL | WS_TABSTOP,
- 80, 10, 100, 160, hwnd,
- (HMENU) ID_VO_DRIVER,
- ((LPCREATESTRUCT) lParam) -> hInstance,
- NULL);
-
- ao_driver = CreateWindow("combobox", NULL,
- CBS_DROPDOWNLIST | CB_SHOWDROPDOWN |
- CBS_NOINTEGRALHEIGHT | CBS_HASSTRINGS |
- WS_CHILD | WS_VISIBLE |
- WS_VSCROLL | WS_TABSTOP,
- 260, 10, 100, 160, hwnd,
- (HMENU) ID_AO_DRIVER,
- ((LPCREATESTRUCT) lParam) -> hInstance,
- NULL);
-
- prio = CreateWindow("combobox", NULL,
- CBS_DROPDOWNLIST | CB_SHOWDROPDOWN |
- CBS_NOINTEGRALHEIGHT | CBS_HASSTRINGS |
- WS_CHILD | WS_VISIBLE |
- WS_VSCROLL | WS_TABSTOP,
- 260, 260, 100, 160, hwnd,
- (HMENU) ID_PRIO,
- ((LPCREATESTRUCT) lParam) -> hInstance,
- NULL);
-
- /* checkboxes */
- btn = CreateWindow("button", "Enable double buffering",
- WS_CHILD | WS_VISIBLE | BS_AUTOCHECKBOX,
- 25, 35, 150, 25,
- hwnd, (HMENU) ID_DOUBLE,
- ((LPCREATESTRUCT) lParam) -> hInstance,
- NULL);
- SendMessage(btn, WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT), 0);
-
- btn = CreateWindow("button", "Enable direct rendering",
- WS_CHILD | WS_VISIBLE | BS_AUTOCHECKBOX,
- 25, 57, 150, 25,
- hwnd, (HMENU) ID_DIRECT,
- ((LPCREATESTRUCT) lParam) -> hInstance,
- NULL);
- SendMessage(btn, WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT), 0);
-
- btn = CreateWindow("button", "Enable framedropping",
- WS_CHILD | WS_VISIBLE | BS_AUTOCHECKBOX,
- 25, 79, 150, 25,
- hwnd, (HMENU) ID_FRAMEDROP,
- ((LPCREATESTRUCT) lParam) -> hInstance,
- NULL);
- SendMessage(btn, WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT), 0);
-
- btn = CreateWindow("button", "Normalize sound",
- WS_CHILD | WS_VISIBLE | BS_AUTOCHECKBOX,
- 205, 35, 150, 25,
- hwnd, (HMENU) ID_NORMALIZE,
- ((LPCREATESTRUCT) lParam) -> hInstance,
- NULL);
- SendMessage(btn, WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT), 0);
-
- btn = CreateWindow("button", "Enable software mixer",
- WS_CHILD | WS_VISIBLE | BS_AUTOCHECKBOX,
- 205, 57, 150, 25,
- hwnd, (HMENU) ID_SOFTMIX,
- ((LPCREATESTRUCT) lParam) -> hInstance,
- NULL);
- SendMessage(btn, WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT), 0);
-
- btn = CreateWindow("button", "Enable extra stereo",
- WS_CHILD | WS_VISIBLE | BS_AUTOCHECKBOX,
- 205, 79, 150, 25,
- hwnd, (HMENU) ID_EXTRASTEREO,
- ((LPCREATESTRUCT) lParam) -> hInstance,
- NULL);
- SendMessage(btn, WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT), 0);
-
- btn = CreateWindow("button", "Enable cache",
- WS_CHILD | WS_VISIBLE | BS_AUTOCHECKBOX,
- 10, 200, 90, 25,
- hwnd, (HMENU) ID_CACHE,
- ((LPCREATESTRUCT) lParam) -> hInstance,
- NULL);
- SendMessage(btn, WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT), 0);
-
- btn = CreateWindow("button", "Enable autosync",
- WS_CHILD | WS_VISIBLE | BS_AUTOCHECKBOX,
- 192, 200, 100, 25, hwnd,
- (HMENU) ID_AUTOSYNC,
- ((LPCREATESTRUCT) lParam) -> hInstance,
- NULL);
- SendMessage(btn, WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT), 0);
-
- btn = CreateWindow("button", "Display videos in the sub window",
- WS_CHILD | WS_VISIBLE | BS_AUTOCHECKBOX,
- 85, 227, 250, 25,
- hwnd, (HMENU) ID_SUBWINDOW,
- ((LPCREATESTRUCT) lParam) -> hInstance,
- NULL);
- SendMessage(btn, WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT), 0);
-
- /* osd level */
- btn = CreateWindow("button", "None",
- WS_CHILD | WS_VISIBLE | BS_AUTORADIOBUTTON,
- 95, 260, 100, 25, hwnd,
- (HMENU) ID_NONE,
- ((LPCREATESTRUCT) lParam) -> hInstance,
- NULL);
- SendMessage(btn, WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT), 0);
-
- btn = CreateWindow("button", "Timer and indicators",
- WS_CHILD | WS_VISIBLE | BS_AUTORADIOBUTTON,
- 95, 280, 180, 25, hwnd,
- (HMENU) ID_OSD1,
- ((LPCREATESTRUCT) lParam) -> hInstance,
- NULL);
- SendMessage(btn, WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT), 0);
-
- btn = CreateWindow("button", "Progress bar only",
- WS_CHILD | WS_VISIBLE | BS_AUTORADIOBUTTON,
- 95, 300, 180, 25, hwnd,
- (HMENU) ID_OSD2,
- ((LPCREATESTRUCT) lParam) -> hInstance,
- NULL);
- SendMessage(btn, WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT), 0);
-
- btn = CreateWindow("button", "Timer, percentage, and total time",
- WS_CHILD | WS_VISIBLE | BS_AUTORADIOBUTTON,
- 95, 320, 180, 25, hwnd,
- (HMENU) ID_OSD3,
- ((LPCREATESTRUCT) lParam) -> hInstance,
- NULL);
- SendMessage(btn, WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT), 0);
-
- btn = CreateWindow("button", "Apply",
- WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,
- 199, 395, 80, 25, hwnd,
- (HMENU) ID_APPLY,
- ((LPCREATESTRUCT) lParam) -> hInstance,
- NULL);
- SendMessage(btn, WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT), 0);
-
- btn = CreateWindow("button", "Cancel",
- WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,
- 285, 395, 80, 25, hwnd,
- (HMENU) ID_CANCEL,
- ((LPCREATESTRUCT) lParam) -> hInstance,
- NULL);
- SendMessage(btn, WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT), 0);
-
- btn = CreateWindow("button", "Defaults",
- WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,
- 4, 395, 80, 25, hwnd,
- (HMENU) ID_DEFAULTS,
- ((LPCREATESTRUCT) lParam) -> hInstance,
- NULL);
- SendMessage(btn, WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT), 0);
-
- /* extra stereo coefficient trackbar */
- track1 = CreateWindow(TRACKBAR_CLASS, "Coefficient",
- WS_CHILD | WS_VISIBLE | WS_TABSTOP |
- WS_DISABLED | TBS_HORZ |
- TBS_BOTTOM | TBS_NOTICKS,
- 120, 120, 245, 35, hwnd,
- (HMENU) ID_TRACKBAR1,
- ((LPCREATESTRUCT) lParam) -> hInstance,
- NULL);
- SendDlgItemMessage(hwnd, ID_TRACKBAR1, TBM_SETRANGE, 1, MAKELONG(-100, 100));
-
- /* audio delay */
- track2 = CreateWindow(TRACKBAR_CLASS, "Audio delay",
- WS_CHILD | WS_VISIBLE | WS_TABSTOP |
- WS_DISABLED | TBS_HORZ |
- TBS_BOTTOM | TBS_NOTICKS,
- 120, 160, 245, 35, hwnd,
- (HMENU) ID_TRACKBAR2,
- ((LPCREATESTRUCT) lParam) -> hInstance,
- NULL);
- SendDlgItemMessage(hwnd, ID_TRACKBAR2, TBM_SETRANGE, 1, MAKELONG(-1000, 1000));
-
- /* cache */
- edit1 = CreateWindowEx(WS_EX_CLIENTEDGE, "edit", "cache",
- WS_CHILD | WS_VISIBLE | WS_DISABLED |
- ES_LEFT | ES_AUTOHSCROLL,
- 105, 203, 40, 20, hwnd,
- (HMENU) ID_EDIT1,
- ((LPCREATESTRUCT) lParam) -> hInstance,
- NULL);
- SendMessage(edit1, WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT), 0);
-
- updown1 = CreateUpDownControl(WS_CHILD | WS_VISIBLE |
- WS_DISABLED | UDS_SETBUDDYINT |
- UDS_ARROWKEYS | UDS_NOTHOUSANDS,
- 145, 203, 20, 20, hwnd,
- ID_UPDOWN1,
- ((LPCREATESTRUCT) lParam) -> hInstance,
- (HWND)edit1, 0, 0, 0);
- SendDlgItemMessage(hwnd, ID_UPDOWN1, UDM_SETRANGE32, (WPARAM)0, (LPARAM)65535);
-
- /* autosync */
- edit2 = CreateWindowEx(WS_EX_CLIENTEDGE, "edit", "autosync",
- WS_CHILD | WS_VISIBLE | WS_DISABLED |
- ES_LEFT | ES_AUTOHSCROLL,
- 300, 203, 40, 20, hwnd,
- (HMENU) ID_EDIT2,
- ((LPCREATESTRUCT) lParam) -> hInstance,
- NULL);
- SendMessage(edit2, WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT), 0);
-
- updown2 = CreateUpDownControl(WS_CHILD | WS_VISIBLE |
- WS_DISABLED | UDS_SETBUDDYINT |
- UDS_ARROWKEYS | UDS_NOTHOUSANDS,
- 340, 203, 20, 20, hwnd,
- ID_UPDOWN2,
- ((LPCREATESTRUCT) lParam) -> hInstance,
- (HWND)edit2, 0, 0, 0);
- SendDlgItemMessage(hwnd, ID_UPDOWN2, UDM_SETRANGE32, (WPARAM)0, (LPARAM)10000);
-
- /* dvd and cd devices */
- edit3 = CreateWindowEx(WS_EX_CLIENTEDGE, "edit", NULL,
- WS_CHILD | WS_VISIBLE |
- ES_LEFT | ES_AUTOHSCROLL,
- 145, 360, 20, 20, hwnd,
- (HMENU) ID_DVDDEVICE,
- ((LPCREATESTRUCT) lParam) -> hInstance,
- NULL);
- SendMessage(edit3, WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT), 0);
-
- edit3 = CreateWindowEx(WS_EX_CLIENTEDGE, "edit", NULL,
- WS_CHILD | WS_VISIBLE |
- ES_LEFT| ES_AUTOHSCROLL,
- 260, 360, 20, 20, hwnd,
- (HMENU) ID_CDDEVICE,
- ((LPCREATESTRUCT) lParam) -> hInstance,
- NULL);
- SendMessage(edit3, WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT), 0);
-
- while(video_out_drivers[i])
- {
- const vo_info_t *info = video_out_drivers[i++]->info;
- if(!video_driver_list) gaddlist(&video_driver_list, (char *)info->short_name);
- SendDlgItemMessage(hwnd, ID_VO_DRIVER, CB_ADDSTRING, 0, (LPARAM) info->short_name);
- }
- /* Special case for directx:noaccel */
- SendDlgItemMessage(hwnd, ID_VO_DRIVER, CB_ADDSTRING, 0, (LPARAM) "directx:noaccel");
- SendMessage(vo_driver, WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT), 0);
-
- while(audio_out_drivers[j])
- {
- const ao_info_t *info = audio_out_drivers[j++]->info;
- if(!audio_driver_list)
- {
- // FIXME: default priority (i.e. order in audio_out_drivers) should be fixed instead
- // if win32 as default is really desirable
- gaddlist(&audio_driver_list, "win32"/*(char *)info->short_name*/);
- }
- SendDlgItemMessage(hwnd, ID_AO_DRIVER, CB_ADDSTRING, 0, (LPARAM) info->short_name);
- }
- SendMessage(ao_driver, WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT), 0);
-
- /* priority list, i'm leaving out realtime for safety's sake */
- SendDlgItemMessage(hwnd, ID_PRIO, CB_INSERTSTRING, 0, (LPARAM) "low");
- SendDlgItemMessage(hwnd, ID_PRIO, CB_INSERTSTRING, 0, (LPARAM) "belownormal");
- SendDlgItemMessage(hwnd, ID_PRIO, CB_INSERTSTRING, 0, (LPARAM) "normal");
- SendDlgItemMessage(hwnd, ID_PRIO, CB_INSERTSTRING, 0, (LPARAM) "abovenormal");
- SendDlgItemMessage(hwnd, ID_PRIO, CB_INSERTSTRING, 0, (LPARAM) "high");
- SendMessage(prio, WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT), 0);
-
- /* set our preferences on what we already have */
- if(video_driver_list)
- SendDlgItemMessage(hwnd, ID_VO_DRIVER, CB_SETCURSEL,
- (WPARAM)SendMessage(vo_driver, CB_FINDSTRING, -1,
- (LPARAM)video_driver_list[0]), 0);
-
- if(audio_driver_list)
- SendDlgItemMessage(hwnd, ID_AO_DRIVER, CB_SETCURSEL,
- (WPARAM)SendMessage(ao_driver, CB_FINDSTRING, -1,
- (LPARAM)audio_driver_list[0]), 0);
-
- if(vo_doublebuffering)
- SendDlgItemMessage(hwnd, ID_DOUBLE, BM_SETCHECK, 1, 0);
- if(vo_directrendering)
- SendDlgItemMessage(hwnd, ID_DIRECT, BM_SETCHECK, 1, 0);
- if(frame_dropping)
- SendDlgItemMessage(hwnd, ID_FRAMEDROP, BM_SETCHECK, 1, 0);
- if(gtkAONorm)
- SendDlgItemMessage(hwnd, ID_NORMALIZE, BM_SETCHECK, 1, 0);
- if(soft_vol)
- SendDlgItemMessage(hwnd, ID_SOFTMIX, BM_SETCHECK, 1, 0);
- if(gtkAOExtraStereo)
- {
- SendDlgItemMessage(hwnd, ID_EXTRASTEREO, BM_SETCHECK, 1, 0);
- if(!guiIntfStruct.Playing)
- {
- EnableWindow(track1, 1);
- EnableWindow(track2, 1);
- }
- }
- else gtkAOExtraStereoMul = 1.0;
- SendDlgItemMessage(hwnd, ID_TRACKBAR1, TBM_SETPOS, 1, (LPARAM)stereopos);
-
- if(audio_delay)
- SendDlgItemMessage(hwnd, ID_TRACKBAR2, TBM_SETPOS, 1, (LPARAM)delaypos);
-
- if(gtkCacheOn) {
- SendDlgItemMessage(hwnd, ID_CACHE, BM_SETCHECK, 1, 0);
- EnableWindow(edit1, 1);
- EnableWindow(updown1, 1);
- }
- else gtkCacheSize = 2048;
- SendDlgItemMessage(hwnd, ID_UPDOWN1, UDM_SETPOS32, 0, (LPARAM)gtkCacheSize);
-
- if(gtkAutoSyncOn) {
- SendDlgItemMessage(hwnd, ID_AUTOSYNC, BM_SETCHECK, 1, 0);
- EnableWindow(edit2, 1);
- EnableWindow(updown2, 1);
- }
- else gtkAutoSync = 0;
- SendDlgItemMessage(hwnd, ID_UPDOWN2, UDM_SETPOS32, 0, (LPARAM)gtkAutoSync);
-
- if(sub_window)
- SendDlgItemMessage(hwnd, ID_SUBWINDOW, BM_SETCHECK, 1, 0);
-
- if(!osd_level)
- SendDlgItemMessage(hwnd, ID_NONE, BM_SETCHECK, 1, 0);
- else if(osd_level == 1)
- SendDlgItemMessage(hwnd, ID_OSD1, BM_SETCHECK, 1, 0);
- else if(osd_level == 2)
- SendDlgItemMessage(hwnd, ID_OSD2, BM_SETCHECK, 1, 0);
- else if(osd_level == 3)
- SendDlgItemMessage(hwnd, ID_OSD3, BM_SETCHECK, 1, 0);
-
- if(dvd_device)
- SendDlgItemMessage(hwnd, ID_DVDDEVICE, WM_SETTEXT, 0, (LPARAM)dvd_device);
- else SendDlgItemMessage(hwnd, ID_DVDDEVICE, WM_SETTEXT, 0, (LPARAM)"D:");
-
- if(cdrom_device)
- SendDlgItemMessage(hwnd, ID_CDDEVICE, WM_SETTEXT, 0, (LPARAM)cdrom_device);
- else SendDlgItemMessage(hwnd, ID_CDDEVICE, WM_SETTEXT, 0, (LPARAM)"D:");
-
- if(proc_priority)
- SendDlgItemMessage(hwnd, ID_PRIO, CB_SETCURSEL,
- (WPARAM)SendMessage(prio, CB_FINDSTRING, -1,
- (LPARAM)proc_priority), 0);
-
- else SendDlgItemMessage(hwnd, ID_PRIO, CB_SETCURSEL, 2, 0);
-
- break;
- }
- case WM_CTLCOLORDLG:
- case WM_CTLCOLOREDIT:
- case WM_CTLCOLORBTN:
- case WM_CTLCOLORSTATIC:
- {
- HDC hdc = (HDC)wParam;
- SetBkMode(hdc, TRANSPARENT);
- return (INT_PTR)SOLID_GREY;
- }
- break;
- case WM_COMMAND:
- {
- switch (LOWORD(wParam))
- {
- case ID_EXTRASTEREO:
- {
- if(SendDlgItemMessage(hwnd, ID_EXTRASTEREO, BM_GETCHECK, 0, 0) == BST_CHECKED)
- {
- EnableWindow(GetDlgItem(hwnd, ID_TRACKBAR1), 1);
- EnableWindow(GetDlgItem(hwnd, ID_TRACKBAR2), 1);
- } else {
- EnableWindow(GetDlgItem(hwnd, ID_TRACKBAR1), 0);
- EnableWindow(GetDlgItem(hwnd, ID_TRACKBAR2), 0);
- SendDlgItemMessage(hwnd, ID_TRACKBAR1, TBM_SETPOS, 1, (LPARAM)10.0);
- SendDlgItemMessage(hwnd, ID_TRACKBAR2, TBM_SETPOS, 1, (LPARAM)0);
- }
- break;
- }
- case ID_CACHE:
- {
- if(SendDlgItemMessage(hwnd, ID_CACHE, BM_GETCHECK, 0, 0) == BST_CHECKED)
- {
- EnableWindow(GetDlgItem(hwnd, ID_EDIT1), 1);
- EnableWindow(GetDlgItem(hwnd, ID_UPDOWN1), 1);
- } else {
- EnableWindow(GetDlgItem(hwnd, ID_EDIT1), 0);
- EnableWindow(GetDlgItem(hwnd, ID_UPDOWN1), 0);
- SendDlgItemMessage(hwnd, ID_UPDOWN1, UDM_SETPOS32, 1, (LPARAM)2048);
- }
- break;
- }
- case ID_AUTOSYNC:
- {
- if(SendDlgItemMessage(hwnd, ID_AUTOSYNC, BM_GETCHECK, 0, 0) == BST_CHECKED)
- {
- EnableWindow(GetDlgItem(hwnd, ID_EDIT2), 1);
- EnableWindow(GetDlgItem(hwnd, ID_UPDOWN2), 1);
- } else {
- EnableWindow(GetDlgItem(hwnd, ID_EDIT2), 0);
- EnableWindow(GetDlgItem(hwnd, ID_UPDOWN2), 0);
- SendDlgItemMessage(hwnd, ID_UPDOWN2, UDM_SETPOS32, 1, (LPARAM)0);
- }
- break;
- }
- case ID_DEFAULTS:
- {
- set_defaults();
- SendDlgItemMessage(hwnd, ID_VO_DRIVER, CB_SETCURSEL,
- (WPARAM)SendMessage(vo_driver, CB_FINDSTRING, -1, (LPARAM)"directx"), 0);
-
- SendDlgItemMessage(hwnd, ID_AO_DRIVER, CB_SETCURSEL,
- (WPARAM)SendMessage(ao_driver, CB_FINDSTRING, -1, (LPARAM)"dsound"), 0);
-
- SendDlgItemMessage(hwnd, ID_PRIO, CB_SETCURSEL,
- (WPARAM)SendMessage(prio, CB_FINDSTRING, -1, (LPARAM)proc_priority), 0);
-
- SendDlgItemMessage(hwnd, ID_TRACKBAR1, TBM_SETPOS, 1, (LPARAM)10.0);
- SendDlgItemMessage(hwnd, ID_TRACKBAR2, TBM_SETPOS, 1, (LPARAM)0.0);
- SendDlgItemMessage(hwnd, ID_UPDOWN1, UDM_SETPOS32, 0, (LPARAM)gtkCacheSize);
- SendDlgItemMessage(hwnd, ID_UPDOWN2, UDM_SETPOS32, 0, (LPARAM)gtkAutoSync);
- SendDlgItemMessage(hwnd, ID_DOUBLE, BM_SETCHECK, 0, 0);
- SendDlgItemMessage(hwnd, ID_DIRECT, BM_SETCHECK, 0, 0);
- SendDlgItemMessage(hwnd, ID_FRAMEDROP, BM_SETCHECK, 0, 0);
- SendDlgItemMessage(hwnd, ID_NORMALIZE, BM_SETCHECK, 0, 0);
- SendDlgItemMessage(hwnd, ID_SOFTMIX, BM_SETCHECK, 0, 0);
- SendDlgItemMessage(hwnd, ID_EXTRASTEREO, BM_SETCHECK, 0, 0);
- SendDlgItemMessage(hwnd, ID_CACHE, BM_SETCHECK, 0, 0);
- SendDlgItemMessage(hwnd, ID_AUTOSYNC, BM_SETCHECK, 0, 0);
- SendDlgItemMessage(hwnd, ID_SUBWINDOW, BM_SETCHECK, 1, 0);
- SendDlgItemMessage(hwnd, ID_NONE, BM_SETCHECK, 0, 0);
- SendDlgItemMessage(hwnd, ID_OSD1, BM_SETCHECK, 1, 0);
- SendDlgItemMessage(hwnd, ID_OSD2, BM_SETCHECK, 0, 0);
- SendDlgItemMessage(hwnd, ID_OSD3, BM_SETCHECK, 0, 0);
- SendDlgItemMessage(hwnd, ID_DVDDEVICE, WM_SETTEXT, 0, (LPARAM)"D:");
- SendDlgItemMessage(hwnd, ID_CDDEVICE, WM_SETTEXT, 0, (LPARAM)"D:");
- SendMessage(hwnd, WM_COMMAND, (WPARAM)ID_APPLY, 0);
- break;
- }
- case ID_CANCEL:
- DestroyWindow(hwnd);
- return 0;
- case ID_APPLY:
- {
- int strl;
- if(guiIntfStruct.Playing) guiGetEvent(guiCEvent, (void *)guiSetStop);
-
- /* Set the video driver */
- gfree(video_driver_list[0]);
- strl = SendMessage(vo_driver, CB_GETCURSEL, 0, 0);
- video_driver_list[0] = malloc(strl);
- SendMessage(vo_driver, CB_GETLBTEXT, (WPARAM)strl,
- (LPARAM)video_driver_list[0]);
-
- /* Set the audio driver */
- gfree(audio_driver_list[0]);
- strl = SendMessage(ao_driver, CB_GETCURSEL, 0, 0);
- audio_driver_list[0] = malloc(strl);
- SendMessage(ao_driver, CB_GETLBTEXT, (WPARAM)strl,
- (LPARAM)audio_driver_list[0]);
-
- /* Set the priority level */
- SendMessage(prio, CB_GETLBTEXT, (WPARAM)SendMessage(prio, CB_GETCURSEL, 0, 0), (LPARAM)procprio);
- proc_priority = strdup(procprio);
-
- /* double buffering */
- if(SendDlgItemMessage(hwnd, ID_DOUBLE, BM_GETCHECK, 0, 0) == BST_CHECKED)
- vo_doublebuffering = 1;
- else vo_doublebuffering = 0;
-
- /* direct rendering */
- if(SendDlgItemMessage(hwnd, ID_DIRECT, BM_GETCHECK, 0, 0) == BST_CHECKED)
- vo_directrendering = 1;
- else vo_directrendering = 0;
-
- /* frame dropping */
- if(SendDlgItemMessage(hwnd, ID_FRAMEDROP, BM_GETCHECK, 0, 0) == BST_CHECKED)
- frame_dropping = 1;
- else frame_dropping = 0;
-
- /* normalize */
- if(SendDlgItemMessage(hwnd, ID_NORMALIZE, BM_GETCHECK, 0, 0) == BST_CHECKED)
- gtkAONorm = 1;
- else gtkAONorm = 0;
-
- /* software mixer */
- if(SendDlgItemMessage(hwnd, ID_SOFTMIX, BM_GETCHECK, 0, 0) == BST_CHECKED)
- soft_vol = 1;
- else soft_vol = 0;
-
- /* extra stereo */
- if(SendDlgItemMessage(hwnd, ID_EXTRASTEREO, BM_GETCHECK, 0, 0) == BST_CHECKED)
- gtkAOExtraStereo = 1;
- else {
- gtkAOExtraStereo = 0;
- gtkAOExtraStereoMul = 10.0;
- }
- gtkAOExtraStereoMul = SendDlgItemMessage(hwnd, ID_TRACKBAR1, TBM_GETPOS, 0, 0) / 10.0;
-
- /* audio delay */
- audio_delay = SendDlgItemMessage(hwnd, ID_TRACKBAR2, TBM_GETPOS, 0, 0) / 100.0;
-
- /* cache */
- if(SendDlgItemMessage(hwnd, ID_CACHE, BM_GETCHECK, 0, 0) == BST_CHECKED)
- gtkCacheOn = 1;
- else gtkCacheOn = 0;
- gtkCacheSize = SendDlgItemMessage(hwnd, ID_UPDOWN1, UDM_GETPOS32, 0, 0);
-
- /* autosync */
- if(SendDlgItemMessage(hwnd, ID_AUTOSYNC, BM_GETCHECK, 0, 0) == BST_CHECKED)
- gtkAutoSyncOn = 1;
- else gtkAutoSyncOn = 0;
- gtkAutoSync = SendDlgItemMessage(hwnd, ID_UPDOWN2, UDM_GETPOS32, 0, 0);
-
- /* sub window */
- if(SendDlgItemMessage(hwnd, ID_SUBWINDOW, BM_GETCHECK, 0, 0) == BST_CHECKED)
- sub_window = 1;
- else sub_window = 0;
-
- /* osd level */
- if(SendDlgItemMessage(hwnd, ID_NONE, BM_GETCHECK, 0, 0) == BST_CHECKED)
- osd_level = 0;
- else if(SendDlgItemMessage(hwnd, ID_OSD1, BM_GETCHECK, 0, 0) == BST_CHECKED)
- osd_level = 1;
- else if(SendDlgItemMessage(hwnd, ID_OSD2, BM_GETCHECK, 0, 0) == BST_CHECKED)
- osd_level = 2;
- else if(SendDlgItemMessage(hwnd, ID_OSD3, BM_GETCHECK, 0, 0) == BST_CHECKED)
- osd_level = 3;
-
- /* dvd and cd devices */
- SendDlgItemMessage(hwnd, ID_DVDDEVICE, WM_GETTEXT, MAX_PATH, (LPARAM)dvddevice);
- dvd_device = strdup(dvddevice);
- SendDlgItemMessage(hwnd, ID_CDDEVICE, WM_GETTEXT, MAX_PATH, (LPARAM)cdromdevice);
- cdrom_device = strdup(cdromdevice);
-
- MessageBox(hwnd, "You must restart MPlayer for the changes to take effect.", "MPlayer - Info:", MB_OK);
- DestroyWindow(hwnd);
- break;
- }
- }
- return 0;
- }
- }
- return DefWindowProc(hwnd, iMsg, wParam, lParam);
-}
-
-void display_prefswindow(gui_t *gui)
-{
- HWND hWnd;
- HINSTANCE hInstance = GetModuleHandle(NULL);
- WNDCLASS wc;
- int x, y;
- if(FindWindow(NULL, "MPlayer - Preferences")) return;
- wc.style = CS_HREDRAW | CS_VREDRAW;
- wc.lpfnWndProc = PrefsWndProc;
- wc.cbClsExtra = 0;
- wc.cbWndExtra = 0;
- wc.hInstance = hInstance;
- wc.hCursor = LoadCursor(NULL,IDC_ARROW);
- wc.hIcon = gui->icon;
- wc.hbrBackground = SOLID_GREY;
- wc.lpszClassName = "MPlayer - Preferences";
- wc.lpszMenuName = NULL;
- RegisterClass(&wc);
- x = (GetSystemMetrics(SM_CXSCREEN) / 2) - (375 / 2);
- y = (GetSystemMetrics(SM_CYSCREEN) / 2) - (452 / 2);
- hWnd = CreateWindow("MPlayer - Preferences",
- "MPlayer - Preferences",
- WS_POPUPWINDOW | WS_CAPTION,
- x,
- y,
- 375,
- 452,
- NULL,
- NULL,
- hInstance,
- NULL);
- SetWindowLongPtr(hWnd, GWLP_USERDATA, (DWORD) gui);
- ShowWindow(hWnd, SW_SHOW);
- UpdateWindow(hWnd);
-}
-
-static void set_defaults(void)
-{
- proc_priority = "normal";
- vo_doublebuffering = 1;
- vo_directrendering = 0;
- frame_dropping = 0;
- soft_vol = 0;
- gtkAONorm = 0;
- gtkAOExtraStereo = 0;
- gtkAOExtraStereoMul = 1.0;
- audio_delay = 0.0;
- sub_window = 1;
- gtkCacheOn = 0;
- gtkCacheSize = 2048;
- gtkAutoSyncOn = 0;
- gtkAutoSync = 0;
-}
diff --git a/gui/win32/skinload.c b/gui/win32/skinload.c
deleted file mode 100644
index 3c3c21234e..0000000000
--- a/gui/win32/skinload.c
+++ /dev/null
@@ -1,776 +0,0 @@
-/*
- * MPlayer GUI for Win32
- * Copyright (C) 2003 Sascha Sommer <saschasommer@freenet.de>
- * Copyright (C) 2006 Erik Augustson <erik_27can@yahoo.com>
- * Copyright (C) 2006 Gianluigi Tiesi <sherpya@netfarm.it>
- *
- * 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
- */
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <inttypes.h>
-#include <windows.h>
-
-#include "mp_msg.h"
-#include "cpudetect.h"
-#include "libswscale/rgb2rgb.h"
-#include "libswscale/swscale.h"
-#include "gui.h"
-#include "gui/bitmap.h"
-
-#define MAX_LINESIZE 256
-
-typedef struct
-{
- int msg;
- char *name;
-} evName;
-
-static const evName evNames[] =
-{
- { evNone, "evNone" },
- { evPlay, "evPlay" },
- { evDropFile, "evDropFile" },
- { evStop, "evStop" },
- { evPause, "evPause" },
- { evPrev, "evPrev" },
- { evNext, "evNext" },
- { evLoad, "evLoad" },
- { evEqualizer, "evEqualizer" },
- { evEqualizer, "evEqualeaser" },
- { evPlayList, "evPlaylist" },
- { evExit, "evExit" },
- { evIconify, "evIconify" },
- { evIncBalance, "evIncBalance" },
- { evDecBalance, "evDecBalance" },
- { evFullScreen, "evFullScreen" },
- { evFName, "evFName" },
- { evMovieTime, "evMovieTime" },
- { evAbout, "evAbout" },
- { evLoadPlay, "evLoadPlay" },
- { evPreferences, "evPreferences" },
- { evSkinBrowser, "evSkinBrowser" },
- { evBackward10sec, "evBackward10sec" },
- { evForward10sec, "evForward10sec" },
- { evBackward1min, "evBackward1min" },
- { evForward1min, "evForward1min" },
- { evBackward10min, "evBackward10min" },
- { evForward10min, "evForward10min" },
- { evIncVolume, "evIncVolume" },
- { evDecVolume, "evDecVolume" },
- { evMute, "evMute" },
- { evIncAudioBufDelay, "evIncAudioBufDelay" },
- { evDecAudioBufDelay, "evDecAudioBufDelay" },
- { evPlaySwitchToPause, "evPlaySwitchToPause" },
- { evPauseSwitchToPlay, "evPauseSwitchToPlay" },
- { evNormalSize, "evNormalSize" },
- { evDoubleSize, "evDoubleSize" },
- { evSetMoviePosition, "evSetMoviePosition" },
- { evSetVolume, "evSetVolume" },
- { evSetBalance, "evSetBalance" },
- { evHelp, "evHelp" },
- { evLoadSubtitle, "evLoadSubtitle" },
- { evPlayDVD, "evPlayDVD" },
- { evPlayVCD, "evPlayVCD" },
- { evSetURL, "evSetURL" },
- { evLoadAudioFile, "evLoadAudioFile" },
- { evDropSubtitle, "evDropSubtitle" },
- { evSetAspect, "evSetAspect" }
-};
-
-static const int evBoxs = sizeof(evNames) / sizeof(evName);
-
-static char *geteventname(int event)
-{
- int i;
- for(i=0; i<evBoxs; i++)
- if(evNames[i].msg == event)
- return evNames[i].name;
- return NULL;
-}
-
-static inline int get_sws_cpuflags(void)
-{
- return (gCpuCaps.hasMMX ? SWS_CPU_CAPS_MMX : 0) |
- (gCpuCaps.hasMMX2 ? SWS_CPU_CAPS_MMX2 : 0) |
- (gCpuCaps.has3DNow ? SWS_CPU_CAPS_3DNOW : 0);
-}
-
-/* reads a complete image as is into image buffer */
-static image *pngRead(skin_t *skin, unsigned char *fname)
-{
- int i;
- txSample bmp;
- image *bf;
- char *filename = NULL;
- FILE *fp;
-
- if(!stricmp(fname, "NULL")) return 0;
-
- /* find filename in order file file.png */
- if(!(fp = fopen(fname, "rb")))
- {
- filename = calloc(1, strlen(skin->skindir) + strlen(fname) + 6);
- sprintf(filename, "%s\\%s.png", skin->skindir, fname);
- if(!(fp = fopen(filename, "rb")))
- {
- mp_msg(MSGT_GPLAYER, MSGL_ERR, "[png] cannot find image %s\n", filename);
- free(filename);
- return 0;
- }
- }
- fclose(fp);
-
- for (i=0; i < skin->imagecount; i++)
- if(!strcmp(fname, skin->images[i]->name))
- {
-#ifdef DEBUG
- mp_msg(MSGT_GPLAYER, MSGL_DBG4, "[png] skinfile %s already exists\n", fname);
-#endif
- free(filename);
- return skin->images[i];
- }
- (skin->imagecount)++;
- skin->images = realloc(skin->images, sizeof(image *) * skin->imagecount);
- bf = skin->images[(skin->imagecount) - 1] = calloc(1, sizeof(image));
- bf->name = strdup(fname);
- bpRead(filename ? filename : fname, &bmp);
- free(filename);
- bf->width = bmp.Width; bf->height = bmp.Height;
-
-#ifdef DEBUG
- mp_msg(MSGT_GPLAYER, MSGL_DBG4, "[png] loaded image %s\n", fname);
- mp_msg(MSGT_GPLAYER, MSGL_DBG4, "[png] size: %dx%d bits: %d\n", bf->width, bf->height, BPP);
- mp_msg(MSGT_GPLAYER, MSGL_DBG4, "[png] imagesize: %u\n", imgsize);
-#endif
-
- bf->size = bf->width * bf->height * skin->desktopbpp / 8;
- if (skin->desktopbpp == 32)
- bf->data = bmp.Image;
- else {
- bf->data = malloc(bf->size);
- rgb32tobgr32(bmp.Image, bmp.Image, bmp.ImageSize);
- if(skin->desktopbpp == 16) rgb32tobgr15(bmp.Image, bf->data, bmp.ImageSize);
- else if(skin->desktopbpp == 24) rgb32tobgr24(bmp.Image, bf->data, bmp.ImageSize);
- free(bmp.Image);
- }
- return bf;
-}
-
-/* frees all skin images */
-static void freeimages(skin_t *skin)
-{
- unsigned int i;
- for (i=0; i<skin->imagecount; i++)
- {
- if(skin->images && skin->images[i])
- {
- if(skin->images[i]->data) free(skin->images[i]->data);
- if(skin->images[i]->name) free(skin->images[i]->name);
- free(skin->images[i]);
- }
- }
- free(skin->images);
-}
-
-#ifdef DEBUG
-void dumpwidgets(skin_t *skin)
-{
- unsigned int i;
- for (i=0; i<skin->widgetcount; i++)
- mp_msg(MSGT_GPLAYER, MSGL_V, "widget %p id %i\n", skin->widgets[i], skin->widgets[i]->id);
-}
-#endif
-
-static int counttonextchar(const char *s1, char c)
-{
- unsigned int i;
- for (i=0; i<strlen(s1); i++)
- if(s1[i] == c) return i;
- return 0;
-}
-
-static char *findnextstring(char *temp, const char *desc, int *base)
-{
- int len = counttonextchar(*base + desc, ',');
- memset(temp, 0, strlen(desc) + 1);
- if(!len) len = strlen(desc);
- memcpy(temp, *base + desc, len);
- *base += (len+1);
- return temp;
-}
-
-static void freeskin(skin_t *skin)
-{
- unsigned int i;
- if(skin->skindir)
- {
- free(skin->skindir);
- skin->skindir = NULL;
- }
-
- for (i=1; i<=skin->lastusedid; i++)
- skin->removewidget(skin, i);
-
- if(skin->widgets)
- {
- free(skin->widgets);
- skin->widgets = NULL;
- }
-
- freeimages(skin);
- for(i=0; i<skin->windowcount; i++)
- {
- if(skin->windows[i]->name)
- {
- free(skin->windows[i]->name);
- skin->windows[i]->name = NULL;
- }
- free(skin->windows[i]);
- }
-
- free(skin->windows);
- skin->windows = NULL;
-
- for (i=0; i<skin->fontcount; i++)
- {
- unsigned int x;
- if(skin->fonts[i]->name)
- {
- free(skin->fonts[i]->name);
- skin->fonts[i]->name = NULL;
- }
-
- if(skin->fonts[i]->id)
- {
- free(skin->fonts[i]->id);
- skin->fonts[i]->id = NULL;
- }
-
- for (x=0; x<skin->fonts[i]->charcount; x++)
- {
- free(skin->fonts[i]->chars[x]);
- skin->fonts[i]->chars[x] = NULL;
- }
-
- if(skin->fonts[i]->chars)
- {
- free(skin->fonts[i]->chars);
- skin->fonts[i]->chars = NULL;
- }
-
- free(skin->fonts[i]);
- skin->fonts[i] = NULL;
- }
- free(skin->fonts);
- skin->fonts = NULL;
-#ifdef DEBUG
- mp_msg(MSGT_GPLAYER, MSGL_DBG4, "[SKIN FREE] skin freed\n");
-#endif
- free(skin);
- skin = NULL;
-}
-
-static void removewidget(skin_t *skin, int id)
-{
- unsigned int i;
- unsigned int pos=0;
- widget **temp = calloc(skin->widgetcount - 1, sizeof(widget *));
-
- for (i=0; i<skin->widgetcount; i++)
- {
- if(skin->widgets[i]->id == id)
- {
- if(skin->widgets[i]->label)
- free(skin->widgets[i]->label);
- free(skin->widgets[i]);
- skin->widgets[i] = NULL;
- }
- else
- {
- temp[pos] = skin->widgets[i];
- pos++;
- }
- }
- if (pos != i)
- {
- (skin->widgetcount)--;
- free(skin->widgets);
- skin->widgets = temp;
-#ifdef DEBUG
- mp_msg(MSGT_GPLAYER, MSGL_DBG4, "removed widget %i\n", id);
-#endif
- return;
- }
- free(temp);
- mp_msg(MSGT_GPLAYER, MSGL_ERR, "widget %i not found\n", id);
-}
-
-static void addwidget(skin_t *skin, window *win, const char *desc)
-{
- widget *mywidget;
- char *temp = calloc(1, strlen(desc) + 1);
- (skin->widgetcount)++;
- (skin->lastusedid)++;
- skin->widgets = realloc(skin->widgets, sizeof(widget *) * skin->widgetcount);
- mywidget = skin->widgets[(skin->widgetcount) - 1] = calloc(1, sizeof(widget));
- mywidget->id = skin->lastusedid;
- mywidget->window = win->type;
- /* parse and fill widget specific info */
- if(!strncmp(desc, "base", 4))
- {
- int base = counttonextchar(desc, '=') + 1;
- mywidget->type = tyBase;
- mywidget->bitmap[0] = pngRead(skin, findnextstring(temp, desc, &base));
- mywidget->wx = mywidget->x = atoi(findnextstring(temp, desc, &base));
- mywidget->wy = mywidget->y = atoi(findnextstring(temp, desc, &base));
- mywidget->wwidth = mywidget->width = atoi(findnextstring(temp, desc, &base));
- mywidget->wheight = mywidget->height = atoi(findnextstring(temp, desc, &base));
- win->base = mywidget;
-#ifdef DEBUG
- mp_msg(MSGT_GPLAYER, MSGL_DBG4, "[SKIN] [ITEM] [BASE] %s %i %i %i %i\n",
- (mywidget->bitmap[0]) ? mywidget->bitmap[0]->name : NULL,
- mywidget->x, mywidget->y, mywidget->width, mywidget->height);
-#endif
- }
- else if(!strncmp(desc, "button", 6))
- {
- int base = counttonextchar(desc, '=') + 1;
- int i;
- mywidget->type = tyButton;
- mywidget->bitmap[0] = pngRead(skin, findnextstring(temp, desc, &base));
- mywidget->wx = mywidget->x = atoi(findnextstring(temp, desc, &base));
- mywidget->wy = mywidget->y = atoi(findnextstring(temp, desc, &base));
- mywidget->wwidth = mywidget->width = atoi(findnextstring(temp, desc, &base));
- mywidget->wheight = mywidget->height = atoi(findnextstring(temp, desc, &base));
- findnextstring(temp, desc, &base);
-
- /* Assign corresponding event to the widget */
- mywidget->msg = evNone;
- for (i=0; i<evBoxs; i++)
- {
- if(!strcmp(temp, evNames[i].name))
- {
- mywidget->msg = evNames[i].msg;
- break;
- }
- }
-
-#ifdef DEBUG
- mp_msg(MSGT_GPLAYER, MSGL_DBG4, "[SKIN] [ITEM] [BUTTON] %s %i %i %i %i msg %i\n",
- (mywidget->bitmap[0]) ? mywidget->bitmap[0]->name : NULL,
- mywidget->x, mywidget->y, mywidget->width, mywidget->height, mywidget->msg);
-#endif
- }
- else if(!strncmp(desc, "hpotmeter", 9) || !strncmp(desc, "vpotmeter", 9))
- {
- int base = counttonextchar(desc, '=') + 1;
- int i;
- /* hpotmeter = button, bwidth, bheight, phases, numphases, default, X, Y, width, height, message */
- if(!strncmp(desc, "hpotmeter", 9)) mywidget->type = tyHpotmeter;
- else mywidget->type = tyVpotmeter;
- mywidget->bitmap[0] = pngRead(skin, findnextstring(temp, desc, &base));
- mywidget->width = atoi(findnextstring(temp, desc, &base));
- mywidget->height = atoi(findnextstring(temp, desc, &base));
- mywidget->bitmap[1] = pngRead(skin, findnextstring(temp, desc, &base));
- mywidget->phases = atoi(findnextstring(temp, desc, &base));
- mywidget->value = atof(findnextstring(temp, desc, &base));
- mywidget->x = mywidget->wx = atoi(findnextstring(temp, desc, &base));
- mywidget->y = mywidget->wy = atoi(findnextstring(temp, desc, &base));
- mywidget->wwidth = atoi(findnextstring(temp, desc, &base));
- mywidget->wheight = atoi(findnextstring(temp, desc, &base));
- findnextstring(temp, desc, &base);
- mywidget->msg = evNone;
- for (i=0; i<evBoxs; i++)
- {
- if(!strcmp(temp, evNames[i].name))
- {
- mywidget->msg = evNames[i].msg;
- break;
- }
- }
-#ifdef DEBUG
- mp_msg(MSGT_GPLAYER, MSGL_DBG4, "[SKIN] [ITEM] %s %s %i %i %s %i %f %i %i %i %i msg %i\n",
- (mywidget->type == tyHpotmeter) ? "[HPOTMETER]" : "[VPOTMETER]",
- (mywidget->bitmap[0]) ? mywidget->bitmap[0]->name : NULL,
- mywidget->width, mywidget->height,
- (mywidget->bitmap[1]) ? mywidget->bitmap[1]->name : NULL,
- mywidget->phases, mywidget->value,
- mywidget->wx, mywidget->wy, mywidget->wwidth, mywidget->wwidth,
- mywidget->msg);
-#endif
- }
- else if(!strncmp(desc, "potmeter", 8))
- {
- int base = counttonextchar(desc, '=') + 1;
- int i;
- /* potmeter = phases, numphases, default, X, Y, width, height, message */
- mywidget->type = tyPotmeter;
- mywidget->bitmap[0] = pngRead(skin, findnextstring(temp, desc, &base));
- mywidget->phases = atoi(findnextstring(temp, desc, &base));
- mywidget->value = atof(findnextstring(temp, desc, &base));
- mywidget->wx = mywidget->x = atoi(findnextstring(temp, desc, &base));
- mywidget->wy = mywidget->y = atoi(findnextstring(temp, desc, &base));
- mywidget->wwidth = mywidget->width = atoi(findnextstring(temp, desc, &base));
- mywidget->wheight = mywidget->height = atoi(findnextstring(temp, desc, &base));
- findnextstring(temp, desc, &base);
- mywidget->msg = evNone;
- for (i=0; i<evBoxs; i++)
- {
- if(!strcmp(temp, evNames[i].name))
- {
- mywidget->msg=evNames[i].msg;
- break;
- }
- }
-#ifdef DEBUG
- mp_msg(MSGT_GPLAYER, MSGL_DBG4, "[SKIN] [ITEM] [POTMETER] %s %i %i %i %f %i %i msg %i\n",
- (mywidget->bitmap[0]) ? mywidget->bitmap[0]->name : NULL,
- mywidget->width, mywidget->height,
- mywidget->phases, mywidget->value,
- mywidget->x, mywidget->y,
- mywidget->msg);
-#endif
- }
- else if(!strncmp(desc, "menu", 4))
- {
- int base = counttonextchar(desc, '=') + 1;
- int i;
- mywidget->type = tyMenu;
- mywidget->wx=atoi(findnextstring(temp, desc, &base));
- mywidget->x=0;
- mywidget->wy=mywidget->y=atoi(findnextstring(temp, desc, &base));
- mywidget->wwidth=mywidget->width=atoi(findnextstring(temp, desc, &base));
- mywidget->wheight=mywidget->height=atoi(findnextstring(temp, desc, &base));
- findnextstring(temp, desc, &base);
- mywidget->msg = evNone;
- for (i=0; i<evBoxs; i++)
- {
- if(!strcmp(temp, evNames[i].name))
- {
- mywidget->msg = evNames[i].msg;
- break;
- }
- }
-#ifdef DEBUG
- mp_msg(MSGT_GPLAYER, MSGL_DBG4, "[SKIN] [ITEM] [MENU] %i %i %i %i msg %i\n",
- mywidget->x, mywidget->y, mywidget->width, mywidget->height, mywidget->msg);
-#endif
- }
- else if(!strncmp(desc, "selected", 8))
- {
- win->base->bitmap[1] = pngRead(skin, (char *) desc + 9);
-#ifdef DEBUG
- mp_msg(MSGT_GPLAYER, MSGL_DBG4, "[SKIN] [ITEM] [BASE] added image %s\n", win->base->bitmap[1]->name);
-#endif
- }
- else if(!strncmp(desc, "slabel",6))
- {
- int base = counttonextchar(desc, '=') + 1;
- unsigned int i;
- mywidget->type = tySlabel;
- mywidget->wx = mywidget->x = atoi(findnextstring(temp, desc, &base));
- mywidget->wy = mywidget->y = atoi(findnextstring(temp, desc, &base));
- findnextstring(temp, desc, &base);
- mywidget->font = NULL;
- for (i=0; i<skin->fontcount; i++)
- {
- if(!strcmp(temp, skin->fonts[i]->name))
- {
- mywidget->font = skin->fonts[i];
- break;
- }
- }
- mywidget->label = strdup(findnextstring(temp, desc, &base));
-#ifdef DEBUG
- mp_msg(MSGT_GPLAYER, MSGL_DBG4, "[SKIN] [ITEM] [SLABEL] %i %i %s %s\n",
- mywidget->x, mywidget->y, mywidget->font->name, mywidget->label);
-#endif
- }
- else if(!strncmp(desc, "dlabel", 6))
- {
- int base = counttonextchar(desc, '=') + 1;
- unsigned int i;
- mywidget->type = tyDlabel;
- mywidget->wx = mywidget->x = atoi(findnextstring(temp, desc, &base));
- mywidget->wy = mywidget->y = atoi(findnextstring(temp, desc, &base));
- mywidget->length = atoi(findnextstring(temp, desc, &base));
- mywidget->align = atoi(findnextstring(temp, desc, &base));
- findnextstring(temp, desc, &base);
- mywidget->font = NULL;
- for (i=0; i<skin->fontcount; i++)
- {
- if(!strcmp(temp, skin->fonts[i]->name))
- {
- mywidget->font=skin->fonts[i];
- break;
- }
- }
- mywidget->label=strdup(findnextstring(temp, desc, &base));
-#ifdef DEBUG
- mp_msg(MSGT_GPLAYER, MSGL_DBG4, "[SKIN] [ITEM] [DLABEL] %i %i %i %i %s \"%s\"\n",
- mywidget->x, mywidget->y, mywidget->length, mywidget->align, mywidget->font->name, mywidget->label);
-#endif
- }
- free(temp);
-}
-
-static void loadfonts(skin_t* skin)
-{
- unsigned int x;
- for (x=0; x<skin->fontcount; x++)
- {
- FILE *fp;
- int linenumber=0;
- char *filename;
- char *tmp = calloc(1, MAX_LINESIZE);
- char *desc = calloc(1, MAX_LINESIZE);
- filename = calloc(1, strlen(skin->skindir) + strlen(skin->fonts[x]->name) + 6);
- sprintf(filename, "%s\\%s.fnt", skin->skindir, skin->fonts[x]->name);
- if(!(fp = fopen(filename,"rb")))
- {
- mp_msg(MSGT_GPLAYER, MSGL_ERR, "[FONT LOAD] Font not found \"%s\"\n", skin->fonts[x]->name);
- return;
- }
- while(!feof(fp))
- {
- int pos = 0;
- unsigned int i;
- fgets(tmp, MAX_LINESIZE, fp);
- linenumber++;
- memset(desc, 0, MAX_LINESIZE);
- for (i=0; i<strlen(tmp); i++)
- {
- /* remove spaces and linebreaks */
- if((tmp[i] == ' ') || (tmp[i] == '\n') || (tmp[i] == '\r')) continue;
- /* remove comments */
- if((tmp[i] == ';') && ((i < 1) || (tmp[i-1] != '\"')))
- {
-#ifdef DEBUG
- mp_msg(MSGT_GPLAYER, MSGL_DBG4, "[FONT LOAD] Comment: %s", tmp + i + 1);
-#endif
- break;
- }
- desc[pos] = tmp[i];
- pos++;
- }
- if(!strlen(desc)) continue;
- /* now we have "readable" output -> parse it */
- if(!strncmp(desc, "image", 5))
- {
- skin->fonts[x]->image = pngRead(skin, desc + 6);
-#ifdef DEBUG
- mp_msg(MSGT_GPLAYER, MSGL_DBG4, "[FONT] [IMAGE] \"%s\"\n", desc + 6);
-#endif
- }
- else
- {
- int base = 4;
- if(*desc != '"') break;
- if(*(desc + 1) == 0) break;
- (skin->fonts[x]->charcount)++;
- skin->fonts[x]->chars = realloc(skin->fonts[x]->chars, sizeof(char_t *) *skin->fonts[x]->charcount);
- skin->fonts[x]->chars[skin->fonts[x]->charcount - 1]=calloc(1, sizeof(char_t));
- skin->fonts[x]->chars[skin->fonts[x]->charcount - 1]->c = ((*(desc + 1) == '"') && (*(desc + 2) != '"')) ? ' ': *(desc + 1);
- if((*(desc + 1) == '"') && (*(desc + 2) != '"')) base = 3;
- skin->fonts[x]->chars[skin->fonts[x]->charcount - 1]->x = atoi(findnextstring(tmp, desc, &base));
- skin->fonts[x]->chars[skin->fonts[x]->charcount - 1]->y = atoi(findnextstring(tmp, desc, &base));
- skin->fonts[x]->chars[skin->fonts[x]->charcount - 1]->width = atoi(findnextstring(tmp, desc, &base));
- skin->fonts[x]->chars[skin->fonts[x]->charcount - 1]->height = atoi(findnextstring(tmp, desc, &base));
-#ifdef DEBUG
- mp_msg(MSGT_GPLAYER, MSGL_DBG4, "[FONT] [CHAR] %c %i %i %i %i\n",
- skin->fonts[x]->chars[skin->fonts[x]->charcount - 1]->c,
- skin->fonts[x]->chars[skin->fonts[x]->charcount - 1]->x,
- skin->fonts[x]->chars[skin->fonts[x]->charcount - 1]->y,
- skin->fonts[x]->chars[skin->fonts[x]->charcount - 1]->width,
- skin->fonts[x]->chars[skin->fonts[x]->charcount - 1]->height);
-#endif
- }
- }
- free(desc);
- free(filename);
- free(tmp);
- fclose(fp);
- }
-}
-
-skin_t* loadskin(char* skindir, int desktopbpp)
-{
- FILE *fp;
- int reachedendofwindow = 0;
- int linenumber = 0;
- skin_t *skin = calloc(1, sizeof(skin_t));
- char *filename;
- char *tmp = calloc(1, MAX_LINESIZE);
- char *desc = calloc(1, MAX_LINESIZE);
- window* mywindow = NULL;
-
- /* init swscaler */
- sws_rgb2rgb_init(get_sws_cpuflags());
- /* setup funcs */
- skin->freeskin = freeskin;
- skin->pngRead = pngRead;
- skin->addwidget = addwidget;
- skin->removewidget = removewidget;
- skin->geteventname = geteventname;
- skin->desktopbpp = desktopbpp;
- skin->skindir = strdup(skindir);
-
- filename = calloc(1, strlen(skin->skindir) + strlen("skin") + 2);
- sprintf(filename, "%s\\skin", skin->skindir);
- if(!(fp = fopen(filename, "rb")))
- {
- mp_msg(MSGT_GPLAYER, MSGL_FATAL, "[SKIN LOAD] Skin \"%s\" not found\n", skindir);
- skin->freeskin(skin);
- return NULL;
- }
-
- while(!feof(fp))
- {
- int pos = 0;
- unsigned int i;
- int insidequote = 0;
- fgets(tmp, MAX_LINESIZE, fp);
- linenumber++;
- memset(desc, 0, MAX_LINESIZE);
- for (i=0; i<strlen(tmp); i++)
- {
- if((tmp[i] == '"') && !insidequote) { insidequote=1; continue; }
- else if((tmp[i] == '"') && insidequote) { insidequote=0 ; continue; }
- /* remove spaces and linebreaks */
- if((!insidequote && (tmp[i] == ' ')) || (tmp[i] == '\n') || (tmp[i] == '\r')) continue;
- /* remove comments */
- else if(tmp[i] == ';')
- {
-#ifdef DEBUG
- mp_msg(MSGT_GPLAYER, MSGL_DBG4, "[SKIN LOAD] Comment: %s", tmp + i + 1);
-#endif
- break;
- }
- desc[pos] = tmp[i];
- pos++;
- }
-
- if(!strlen(desc)) continue;
- /* now we have "readable" output -> parse it */
- /* parse window specific info */
- if(!strncmp(desc, "section", 7))
- {
-#ifdef DEBUG
- mp_msg(MSGT_GPLAYER, MSGL_DBG4, "[SKIN] [SECTION] \"%s\"\n", desc + 8);
-#endif
- }
- else if(!strncmp(desc, "window", 6))
- {
-#ifdef DEBUG
- mp_msg(MSGT_GPLAYER, MSGL_DBG4, "[SKIN] [WINDOW] \"%s\"\n", desc + 7);
-#endif
- reachedendofwindow = 0;
- (skin->windowcount)++;
- skin->windows = realloc(skin->windows, sizeof(window *) * skin->windowcount);
- mywindow = skin->windows[(skin->windowcount) - 1] = calloc(1, sizeof(window));
- mywindow->name = strdup(desc + 7);
- if(!strncmp(desc + 7, "main", 4)) mywindow->type = wiMain;
- else if(!strncmp(desc+7, "sub", 3))
- {
- mywindow->type = wiSub;
- mywindow->decoration = 1;
- }
- else if(!strncmp(desc + 7, "menu", 4)) mywindow->type = wiMenu;
- else if(!strncmp(desc + 7, "playbar", 7)) mywindow->type = wiPlaybar;
- else mp_msg(MSGT_GPLAYER, MSGL_V, "[SKIN] warning found unknown windowtype");
- }
- else if(!strncmp(desc, "decoration", 10) && !strncmp(desc + 11, "enable", 6))
- {
- mywindow->decoration = 1;
-#ifdef DEBUG
- mp_msg(MSGT_GPLAYER, MSGL_DBG4, "[SKIN] [DECORATION] enabled decoration for window \"%s\"\n", mywindow->name);
-#endif
- }
- else if(!strncmp(desc, "background", 10))
- {
- int base = counttonextchar(desc, '=') + 1;
- char temp[MAX_LINESIZE];
- mywindow->backgroundcolor[0] = atoi(findnextstring(temp, desc, &base));
- mywindow->backgroundcolor[1] = atoi(findnextstring(temp, desc, &base));
- mywindow->backgroundcolor[2] = atoi(findnextstring(temp, desc, &base));
-#ifdef DEBUG
- mp_msg(MSGT_GPLAYER, MSGL_DBG4, "[SKIN] [BACKGROUND] window \"%s\" has backgroundcolor (%i,%i,%i)\n", mywindow->name,
- mywindow->backgroundcolor[0],
- mywindow->backgroundcolor[1],
- mywindow->backgroundcolor[2]);
-#endif
- }
- else if(!strncmp(desc, "end", 3))
- {
- if(reachedendofwindow)
- {
-#ifdef DEBUG
- mp_msg(MSGT_GPLAYER, MSGL_DBG4, "[SKIN] [END] of section\n");
-#endif
- }
- else
- {
- reachedendofwindow = 1;
-#ifdef DEBUG
- mp_msg(MSGT_GPLAYER, MSGL_DBG4, "[SKIN] [END] of window \"%s\"\n", mywindow->name);
-#endif
- }
- }
- else if(!strncmp(desc, "font", 4))
- {
- unsigned int i;
- int id = 0;
- char temp[MAX_LINESIZE];
- int base = counttonextchar(desc, '=')+1;
- findnextstring(temp, desc, &base);
- findnextstring(temp, desc, &base);
- for (i=0; i<skin->fontcount; i++)
- if(!strcmp(skin->fonts[i]->id, temp))
- {
- id = i;
- break;
- }
- if(!id)
- {
- int base = counttonextchar(desc, '=') + 1;
- findnextstring(temp, desc, &base);
- id = skin->fontcount;
- (skin->fontcount)++;
- skin->fonts = realloc(skin->fonts, sizeof(font_t *) * skin->fontcount);
- skin->fonts[id]=calloc(1, sizeof(font_t));
- skin->fonts[id]->name = strdup(temp);
- skin->fonts[id]->id = strdup(findnextstring(temp, desc, &base));
- }
-#ifdef DEBUG
- mp_msg(MSGT_GPLAYER, MSGL_DBG4, "[SKIN] [FONT] id \"%s\" name \"%s\"\n", skin->fonts[id]->name, skin->fonts[id]->id);
-#endif
- }
- else
- skin->addwidget(skin, mywindow, desc);
- }
-
- free(desc);
- free(filename);
- free(tmp);
- fclose(fp);
- loadfonts(skin);
- mp_msg(MSGT_GPLAYER, MSGL_V, "[SKIN LOAD] loaded skin \"%s\"\n", skin->skindir);
- /* dumpwidgets(skin); */
- return skin;
-}
diff --git a/gui/win32/skinload.h b/gui/win32/skinload.h
deleted file mode 100644
index 69019d9638..0000000000
--- a/gui/win32/skinload.h
+++ /dev/null
@@ -1,215 +0,0 @@
-/*
- * MPlayer GUI for Win32
- * Copyright (C) 2003 Sascha Sommer <saschasommer@freenet.de>
- * Copyright (C) 2006 Erik Augustson <erik_27can@yahoo.com>
- * Copyright (C) 2006 Gianluigi Tiesi <sherpya@netfarm.it>
- *
- * 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_GUI_SKINLOAD_H
-#define MPLAYER_GUI_SKINLOAD_H
-
-typedef struct
-{
- char *name; /* image name */
- int size; /* image data size in bytes */
- int width; /* image width */
- int height; /* image height */
- char *data; /* pointer to image data */
-} image;
-
-typedef struct
-{
- char c;
- int x;
- int y;
- int width;
- int height;
-} char_t;
-
-typedef struct
-{
- char *name;
- char *id;
- image *image;
- unsigned int charcount;
- char_t **chars;
-} font_t;
-
-typedef struct
-{
- int id; /* widget id */
- int type; /* widget type */
- int window; /* the window it belongs to */
- // ---
- int x, y; /* x and y position the button */
- int wx, wy; /* x and y postion of the widget */
- int width, height; /* width and height of the button */
- int wwidth, wheight; /* width and height of the widget */
- // ---
- // ---
- int msg, msg2;
- int pressed, tmp;
- int key, key2;
- int phases;
- float value;
- image *bitmap[2]; /* Associated image(s) in imagepool */
- // ---
- font_t *font;
- int length;
- int align;
- char *label;
- // ---
- int event;
-} widget;
-
-typedef struct
-{
- char *name;
- int decoration;
- int type;
- widget *base;
- int backgroundcolor[3];
- void *priv;
-} window;
-
-typedef struct skin_t skin_t;
-struct skin_t
-{
- char *skindir;
- unsigned int widgetcount; /* number of widgets */
- unsigned int lastusedid; /* which widget id was used last */
- widget **widgets; /* widget handle */
- unsigned int imagecount; /* number of images */
- image **images; /* image handle */
- int desktopbpp; /* image format of those images */
- unsigned int fontcount;
- font_t **fonts;
-
- unsigned int windowcount; /* number of windows */
- window **windows;
- void (*freeskin)(skin_t* skin);
- void (*addwidget)(skin_t *skin, window *win, const char *desc);
- void (*removewidget)(skin_t *skin, int id);
- char *(*geteventname)(int event);
- image *(*pngRead)(skin_t *skin, unsigned char *fname);
-};
-
-skin_t *loadskin(char *skindir, int desktopbpp);
-
-// --- Widget types ---
-
-#define tyBase 1
-#define tyButton 2
-#define tyHpotmeter 3
-#define tyVpotmeter 4
-#define tyPotmeter 5
-#define tyMenu 6
-#define tySlabel 7
-#define tyDlabel 8
-
-// --- Window types ---
-
-#define wiMain 1
-#define wiSub 2
-#define wiMenu 3
-#define wiPlaybar 4
-
-// --- User events ------
-
-#define evNone 0
-#define evPlay 1
-#define evStop 2
-#define evPause 3
-#define evPrev 6
-#define evNext 7
-#define evLoad 8
-#define evEqualizer 9
-#define evPlayList 10
-#define evIconify 11
-#define evAbout 12
-#define evLoadPlay 13
-#define evPreferences 14
-#define evSkinBrowser 15
-#define evPlaySwitchToPause 16
-#define evPauseSwitchToPlay 17
-
-#define evBackward10sec 18
-#define evForward10sec 19
-#define evBackward1min 20
-#define evForward1min 21
-#define evBackward10min 22
-#define evForward10min 23
-
-#define evNormalSize 24
-#define evDoubleSize 25
-#define evFullScreen 26
-
-#define evSetMoviePosition 27
-#define evSetVolume 28
-#define evSetBalance 29
-#define evMute 30
-
-#define evIncVolume 31
-#define evDecVolume 32
-#define evIncAudioBufDelay 33
-#define evDecAudioBufDelay 34
-#define evIncBalance 35
-#define evDecBalance 36
-
-#define evHelp 37
-
-#define evLoadSubtitle 38
-#define evDropSubtitle 43
-#define evPlayDVD 39
-#define evPlayVCD 40
-#define evPlayNetwork 41
-#define evLoadAudioFile 42
-#define evSetAspect 44
-#define evSetAudio 45
-#define evSetVideo 46
-#define evDropFile 47
-#define evPlayCD 48
-
-#define evExit 1000
-
-// --- General events ---
-
-#define evFileLoaded 5000
-#define evHideMouseCursor 5001
-#define evMessageBox 5002
-#define evGeneralTimer 5003
-#define evGtkIsOk 5004
-#define evShowPopUpMenu 5005
-#define evHidePopUpMenu 5006
-#define evSetDVDAudio 5007
-#define evSetDVDSubtitle 5008
-#define evSetDVDTitle 5009
-#define evSetDVDChapter 5010
-#define evSubtitleLoaded 5011
-#define evSetVCDTrack 5012
-#define evSetURL 5013
-
-#define evFName 7000
-#define evMovieTime 7001
-#define evRedraw 7002
-#define evHideWindow 7003
-#define evShowWindow 7004
-#define evFirstLoad 7005
-
-#endif /* MPLAYER_GUI_SKINLOAD_H */
diff --git a/gui/win32/widgetrender.c b/gui/win32/widgetrender.c
deleted file mode 100644
index 0ac2e730ea..0000000000
--- a/gui/win32/widgetrender.c
+++ /dev/null
@@ -1,354 +0,0 @@
-/*
- * MPlayer GUI for Win32
- * Copyright (C) 2003 Sascha Sommer <saschasommer@freenet.de>
- * Copyright (C) 2006 Erik Augustson <erik_27can@yahoo.com>
- * Copyright (C) 2006 Gianluigi Tiesi <sherpya@netfarm.it>
- *
- * 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
- */
-
-#include <stdio.h>
-#include <ctype.h>
-#include <windows.h>
-
-#include "gui/interface.h"
-#include "gui.h"
-
-extern char *codecname;
-#define MAX_LABELSIZE 250
-
-static void render(int bitsperpixel, image *dst, image *src, int x, int y, int sx, int sy, int sw, int sh, int transparent)
-{
- int i;
- int bpp = bitsperpixel / 8;
- int offset = (dst->width * bpp * y) + (x * bpp);
- int soffset = (src->width * bpp * sy) + (sx * bpp);
-
- for(i=0; i<sh; i++)
- {
- int c;
- for(c=0; c < (sw * bpp); c += bpp)
- {
- if(bpp == 2)
- {
- if(!transparent || (((src->data + soffset + (i * src->width * bpp) + c)[0] != 0x1f)
- && ((src->data + soffset + (i * src->width * bpp) + c)[1] != 0x7c)))
- memcpy(dst->data + offset + c, src->data + soffset + (i * src->width * bpp) + c, bpp);
- }
- else if(bpp > 2)
- {
- if(!transparent || *((unsigned int *) (src->data + soffset + (i * src->width * bpp) + c)) != 0x00ff00ff)
- memcpy(dst->data + offset + c, src->data + soffset + (i * src->width * bpp) + c, bpp);
- }
- }
- offset += (dst->width * bpp);
- }
-}
-
-static image *find_background(skin_t *skin, widget *item)
-{
- unsigned int i;
- for (i=0; i < skin->windowcount; i++)
- if(skin->windows[i]->type == item->window)
- return skin->windows[i]->base->bitmap[0];
- return NULL;
-}
-
-/******************************************************************/
-/* FONT related functions */
-/******************************************************************/
-
-/* returns the pos of s2 inside s1 or -1 if s1 doesn't contain s2 */
-static int strpos(char *s1, const char* s2)
-{
- unsigned int i, x;
- for (i=0; i < strlen(s1); i++)
- {
- if(s1[i] == s2[0])
- {
- if(strlen(s1 + i) >= strlen(s2))
- {
- for (x=0; x <strlen(s2); x++)
- if(s1[i + x] != s2[x]) break;
- if(x == strlen(s2)) return i;
- }
- }
- }
- return -1;
-}
-
-/* replaces all occurences of what in dest with format */
-static void stringreplace(char *dest, const char *what, const char *format, ... )
-{
- char tmp[MAX_LABELSIZE];
- int offset=0;
- va_list va;
- va_start(va, format);
- vsnprintf(tmp, MAX_LABELSIZE, format, va);
- va_end(va);
- /* no search string == replace the entire string */
- if(!what)
- {
- memcpy(dest, tmp, strlen(tmp));
- dest[strlen(tmp)] = 0;
- return;
- }
- while((offset = strpos(dest, what)) != -1)
- {
- memmove(dest + offset + strlen(tmp), dest + offset + strlen(what), strlen(dest + offset + strlen(what)) + 1);
- memcpy(dest + offset, tmp, strlen(tmp));
- }
-}
-
-/* replaces the chars with special meaning with the associated data from the player info struct */
-static char *generatetextfromlabel(widget *item)
-{
- char *text = malloc(MAX_LABELSIZE);
- char tmp[MAX_LABELSIZE];
- unsigned int i;
- if(!item)
- {
- free(text);
- return NULL;
- }
- strcpy(text, item->label);
- if(item->type == tySlabel) return text;
- stringreplace(text, "$1", "%.2i:%.2i:%.2i", guiIntfStruct.TimeSec / 3600,
- (guiIntfStruct.TimeSec / 60) % 60, guiIntfStruct.TimeSec % 60);
- stringreplace(text, "$2", "%.4i:%.2i", guiIntfStruct.TimeSec / 60, guiIntfStruct.TimeSec % 60);
- stringreplace(text, "$3", "%.2i", guiIntfStruct.TimeSec / 3600);
- stringreplace(text, "$4", "%.2i", (guiIntfStruct.TimeSec / 60) % 60);
- stringreplace(text, "$5", "%.2i", guiIntfStruct.TimeSec % 60);
- stringreplace(text, "$6", "%.2i:%.2i:%.2i", guiIntfStruct.LengthInSec / 3600,
- (guiIntfStruct.LengthInSec / 60) % 60, guiIntfStruct.LengthInSec % 60);
- stringreplace(text, "$7", "%.4i:%.2i", guiIntfStruct.LengthInSec / 60, guiIntfStruct.LengthInSec % 60);
- stringreplace(text, "$8", "%i:%.2i:%.2i", guiIntfStruct.TimeSec / 3600,
- (guiIntfStruct.TimeSec / 60) % 60, guiIntfStruct.TimeSec % 60);
- stringreplace(text, "$v", "%3.2f", guiIntfStruct.Volume);
- stringreplace(text, "$V", "%3.1f", guiIntfStruct.Volume);
- stringreplace(text, "$b", "%3.2f", guiIntfStruct.Balance);
- stringreplace(text, "$B", "%3.1f", guiIntfStruct.Balance);
- stringreplace(text, "$t", "%.2i", guiIntfStruct.Track);
- stringreplace(text, "$o", "%s", guiIntfStruct.Filename);
- stringreplace(text, "$x", "%i", guiIntfStruct.MovieWidth);
- stringreplace(text, "$y", "%i", guiIntfStruct.MovieHeight);
- stringreplace(text, "$C", "%s", guiIntfStruct.sh_video ? codecname : "");
- stringreplace(text, "$$", "$");
-
- if(!strcmp(text, "$p") || !strcmp(text, "$s") || !strcmp(text, "$e"))
- {
- if(guiIntfStruct.Playing == 0) stringreplace(text, NULL, "s");
- else if(guiIntfStruct.Playing == 1) stringreplace(text, NULL, "p");
- else if(guiIntfStruct.Playing == 2) stringreplace(text, NULL, "e");
- }
-
- if(guiIntfStruct.AudioType == 0) stringreplace(text, "$a", "n");
- else if(guiIntfStruct.AudioType == 1) stringreplace(text, "$a", "m");
- else stringreplace(text, "$a", "t");
-
- if(guiIntfStruct.StreamType == 0)
- stringreplace(text, "$T", "f");
-#ifdef CONFIG_DVDREAD
- else if(guiIntfStruct.StreamType == STREAMTYPE_DVD || guiIntfStruct.StreamType == STREAMTYPE_DVDNAV)
- stringreplace(text, "$T", "d");
-#endif
- else stringreplace(text, "$T", "u");
-
- if(guiIntfStruct.Filename)
- {
- for (i=0; i<strlen(guiIntfStruct.Filename); i++)
- tmp[i] = tolower(guiIntfStruct.Filename[i]);
- stringreplace(text, "$f", tmp);
-
- for (i=0; i<strlen(guiIntfStruct.Filename); i++)
- tmp[i] = toupper(guiIntfStruct.Filename[i]);
- stringreplace(text, "$F", tmp);
- }
-
- return text;
-}
-
-/* cuts text to buflen scrolling from right to left */
-static void scrolltext(char *text, unsigned int buflen, float *value)
-{
- char *buffer = (char *) malloc(buflen + 1);
- unsigned int x,i;
- if(*value < buflen) x = 0;
- else x = *value - buflen;
- memset(buffer, ' ', buflen);
- for (i = (*value>=buflen) ? 0 : buflen - *value; i<buflen; i++)
- {
- if(x < strlen(text))
- buffer[i] = text[x];
- x++;
- }
- buffer[buflen] = 0;
- *value += 1.0f;
- if(*value >= strlen(text) + buflen) *value = 0.0f;
- strcpy(text, buffer);
- free(buffer);
-}
-
-/* updates all dlabels and slabels */
-void renderinfobox(skin_t *skin, window_priv_t *priv)
-{
- unsigned int i;
- if (!priv) return;
-
- /* repaint the area behind the text*/
- /* we have to do this for all labels here, because they may overlap in buggy skins ;( */
-
- for (i=0; i<skin->widgetcount; i++)
- if((skin->widgets[i]->type == tyDlabel) || (skin->widgets[i]->type == tySlabel))
- {
- if(skin->widgets[i]->window == priv->type)
- render(skin->desktopbpp,
- &priv->img,
- find_background(skin, skin->widgets[i]),
- skin->widgets[i]->x,
- skin->widgets[i]->y,
- skin->widgets[i]->x,
- skin->widgets[i]->y,
- skin->widgets[i]->length,
- skin->widgets[i]->font->chars[0]->height,
- 1);
- }
-
- /* load all slabels and dlabels */
- for (i=0; i<skin->widgetcount; i++)
- {
- widget *item = skin->widgets[i];
- if(item->window != priv->type) continue;
- if((i == skin->widgetcount) || (item->type == tyDlabel) || (item->type == tySlabel))
- {
- char *text = generatetextfromlabel(item);
- unsigned int current, c;
- int offset = 0;
- unsigned int textlen;
- if(!text) continue;
- textlen = strlen(text);
-
- /* render(win, win->background, gui->skin->widgets[i]->x, gui->skin->widgets[i]->y,
- gui->skin->widgets[i]->x, gui->skin->widgets[i]->y,
- gui->skin->widgets[i]->length, gui->skin->widgets[i]->font->chars[0]->height,1); */
-
- /* calculate text size */
- for (current=0; current<textlen; current++)
- {
- for (c=0; c<item->font->charcount; c++)
- if(item->font->chars[c]->c == text[current])
- {
- offset += item->font->chars[c]->width;
- break;
- }
- }
-
- /* labels can be scrolled if they are to big */
- if((item->type == tyDlabel) && (item->length < offset))
- {
- int tomuch = (offset - item->length) / (offset /textlen);
- scrolltext(text, textlen - tomuch - 1, &skin->widgets[i]->value);
- textlen = strlen(text);
- }
-
- /* align the text */
- if(item->align == 1)
- offset = (item->length-offset) / 2;
- else if(item->align == 2)
- offset = item->length-offset;
- else
- offset = 0;
-
- if(offset < 0) offset = 0;
-
- /* render the text */
- for (current=0; current<textlen; current++)
- {
- for (c=0; c<item->font->charcount; c++)
- {
- char_t *cchar = item->font->chars[c];
- if(cchar->c == *(text + current))
- {
- render(skin->desktopbpp,
- &priv->img,
- item->font->image,
- item->x + offset,
- item->y,
- cchar->x,
- cchar->y,
- (cchar->width + offset > item->length) ? item->length - offset : cchar->width,
- cchar->height,
- 1);
- offset += cchar->width;
- break;
- }
- }
- }
- free(text);
- }
- }
-}
-
-/******************************************************************/
-/* WIDGET related functions */
-/******************************************************************/
-
-void renderwidget(skin_t *skin, image *dest, widget *item, int state)
-{
- image *img = NULL;
- int height;
- int y;
-
- if(!dest) return;
- if((item->type == tyButton) || (item->type == tyHpotmeter) || (item->type == tyPotmeter))
- img = item->bitmap[0];
-
- if(!img) return;
-
- y = item->y;
- if(item->type == tyPotmeter)
- {
- height = img->height / item->phases;
- y = height * (int)(item->value * item->phases / 100);
- if(y > img->height-height)
- y = img->height - height;
- }
- else
- {
- height = img->height / 3;
- y = state * height;
- }
-
- /* redraw background */
- if(item->type == tyButton)
- render(skin->desktopbpp, dest, find_background(skin,item), item->x, item->y, item->x, item->y, img->width, height, 1);
-
- if((item->type == tyHpotmeter) || (item->type == tyPotmeter))
- {
- /* repaint the area behind the slider */
- render(skin->desktopbpp, dest, find_background(skin, item), item->wx, item->wy, item->wx, item->wy, item->wwidth, item->height, 1);
- item->x = item->value * (item->wwidth-item->width) / 100 + item->wx;
- if((item->x + item->width) > (item->wx + item->wwidth))
- item->x = item->wx + item->wwidth - item->width;
- if(item->x < item->wx)
- item->x = item->wx;
- /* workaround for blue */
- if(item->type == tyHpotmeter)
- height = (item->height < img->height / 3) ? item->height : img->height / 3;
- }
- render(skin->desktopbpp, dest, img, item->x, item->y, 0, y, img->width, height, 1);
-}
diff --git a/gui/win32/wincfg.c b/gui/win32/wincfg.c
deleted file mode 100644
index 245bbc0be2..0000000000
--- a/gui/win32/wincfg.c
+++ /dev/null
@@ -1,147 +0,0 @@
-/*
- * MPlayer GUI for Win32
- * Copyright (C) 2003 Sascha Sommer <saschasommer@freenet.de>
- * Copyright (C) 2006 Erik Augustson <erik_27can@yahoo.com>
- * Copyright (C) 2006 Gianluigi Tiesi <sherpya@netfarm.it>
- *
- * 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
- */
-
-#include <windows.h>
-#include <stdlib.h>
-#include <string.h>
-#include <get_path.h>
-#include "mplayer.h"
-#include "mp_msg.h"
-#include "help_mp.h"
-#include "m_config.h"
-#include "m_option.h"
-#include "libvo/video_out.h"
-#include "mixer.h"
-#include "gui/interface.h"
-#include "gui.h"
-
-/* params */
-int gtkAONorm = 0;
-int gtkAOExtraStereo = 0;
-float gtkAOExtraStereoMul = 1.0;
-int gtkCacheOn = 0;
-int gtkCacheSize = 2048;
-int gtkAutoSyncOn = 0;
-int gtkAutoSync = 0;
-
-int sub_window = 0;
-int console = 0;
-
-int gui_save_pos = 1;
-int gui_main_pos_x = -2;
-int gui_main_pos_y = -2;
-int gui_sub_pos_x = -1;
-int gui_sub_pos_y = -1;
-
-/* External functions */
-extern char *proc_priority;
-int m_config_parse_config_file(m_config_t *config, char *conffile);
-
-static m_config_t *gui_conf;
-static const m_option_t gui_opts[] =
-{
- { "priority", &proc_priority, CONF_TYPE_STRING, 0, 0, 0, NULL},
- { "vo_driver", &video_driver_list, CONF_TYPE_STRING_LIST, 0, 0, 0, NULL },
- { "v_framedrop", &frame_dropping, CONF_TYPE_INT, CONF_RANGE, 0, 2, NULL },
- { "vo_doublebuffering", &vo_doublebuffering, CONF_TYPE_FLAG, 0, 0, 1, NULL },
- { "vo_direct_render", &vo_directrendering, CONF_TYPE_FLAG, 0, 0, 1, NULL },
- { "ao_driver", &audio_driver_list, CONF_TYPE_STRING_LIST, 0, 0, 0, NULL },
- { "ao_volnorm", &gtkAONorm, CONF_TYPE_FLAG, 0, 0, 1, NULL },
- { "softvol", &soft_vol, CONF_TYPE_FLAG, 0, 0, 1, NULL },
- { "ao_extra_stereo", &gtkAOExtraStereo, CONF_TYPE_FLAG, 0, 0, 1, NULL },
- { "ao_extra_stereo_coefficient", &gtkAOExtraStereoMul, CONF_TYPE_FLOAT, CONF_RANGE, -10, 10, NULL },
- { "delay", &audio_delay, CONF_TYPE_FLOAT, CONF_RANGE, -100.0, 100.0, NULL},
- { "dvd_device", &dvd_device, CONF_TYPE_STRING, 0, 0, 0, NULL },
- { "cdrom_device", &cdrom_device, CONF_TYPE_STRING, 0, 0, 0, NULL },
- { "osd_level", &osd_level, CONF_TYPE_INT, CONF_RANGE, 0, 3, NULL },
- { "cache", &gtkCacheOn, CONF_TYPE_FLAG, 0, 0, 1, NULL },
- { "cache_size", &gtkCacheSize, CONF_TYPE_INT, CONF_RANGE, -1, 65535, NULL },
- { "autosync", &gtkAutoSyncOn, CONF_TYPE_FLAG, 0, 0, 1, NULL },
- { "autosync_size", &gtkAutoSync, CONF_TYPE_INT, CONF_RANGE, 0, 10000, NULL },
- { "gui_skin", &skinName, CONF_TYPE_STRING, 0, 0, 0, NULL },
- { "gui_main_pos_x", &gui_main_pos_x, CONF_TYPE_INT, 0, 0, 0, NULL },
- { "gui_main_pos_y", &gui_main_pos_y, CONF_TYPE_INT, 0, 0, 0, NULL },
- { "gui_sub_pos_x", &gui_sub_pos_x, CONF_TYPE_INT, 0, 0, 0, NULL },
- { "gui_sub_pos_y", &gui_sub_pos_y, CONF_TYPE_INT, 0, 0, 0, NULL },
- { "sub_window", &sub_window, CONF_TYPE_FLAG, 0, 0, 1, NULL},
- { "console", &console, CONF_TYPE_FLAG, 0, 0, 1, NULL},
- { NULL, NULL, 0, 0, 0, 0, NULL }
-};
-
-char *gfgets(char *str, int size, FILE *f)
-{
- char *s = fgets(str, size, f);
- char c;
- if(s)
- {
- c = s[strlen(s) - 1];
- if ((c == '\n') || (c == '\r'))
- s[strlen(s) - 1]=0;
- c = s[strlen(s) - 1];
- if ((c == '\n') || (c == '\r'))
- s[strlen(s) - 1]=0;
- }
- return s;
-}
-
-int cfg_read(void)
-{
- char *cfg = get_path("gui.conf");
-
- /* read configuration */
- mp_msg(MSGT_GPLAYER, MSGL_V, "[GUI] [cfg] reading config file: %s\n", cfg);
- gui_conf = m_config_new();
- m_config_register_options(gui_conf, gui_opts);
- if (m_config_parse_config_file(gui_conf, cfg) < 0)
- mp_msg(MSGT_GPLAYER, MSGL_FATAL, MSGTR_ConfigFileError);
- free(cfg);
- return 0;
-}
-
-int cfg_write(void)
-{
- char *cfg = get_path("gui.conf");
- FILE *f;
- int i;
-
- /* save configuration */
- if ((f = fopen(cfg, "wt+")))
- {
- for (i=0; gui_opts[i].name; i++)
- {
- char *v = m_option_print(&gui_opts[i], gui_opts[i].p);
- if(v == (char *)-1) {
- mp_msg(MSGT_GPLAYER, MSGL_WARN, MSGTR_UnableToSaveOption, gui_opts[i].name);
- v = NULL;
- }
- if(v)
- {
- fprintf(f, "%s = \"%s\"\n", gui_opts[i].name, v);
- free(v);
- }
- }
- fclose(f);
- }
- free(cfg);
- return 0;
-}
diff --git a/gui/wm/ws.c b/gui/wm/ws.c
deleted file mode 100644
index 27ca7ae411..0000000000
--- a/gui/wm/ws.c
+++ /dev/null
@@ -1,1312 +0,0 @@
-/*
- * AutoSpace Window System for Linux/Win32 v0.85
- * written by pontscho/fresh!mindworkz
- *
- * 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.
- */
-
-#include <X11/Xlib.h>
-#include <X11/Xproto.h>
-#include <X11/Xutil.h>
-#include <X11/keysym.h>
-#include <X11/Xatom.h>
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include <errno.h>
-
-#include <inttypes.h>
-
-#include "config.h"
-#include "libvo/x11_common.h"
-#include "libvo/video_out.h"
-#include "cpudetect.h"
-#include "libswscale/swscale.h"
-#include "libswscale/rgb2rgb.h"
-#include "libmpcodecs/vf_scale.h"
-#include "mp_msg.h"
-#include "help_mp.h"
-#include "mplayer.h"
-#include "mpbswap.h"
-#include "ws.h"
-#include "wsxdnd.h"
-
-#include <X11/extensions/XShm.h>
-#ifdef CONFIG_XSHAPE
-#include <X11/extensions/shape.h>
-#endif
-
-#ifdef CONFIG_XINERAMA
-#include <X11/extensions/Xinerama.h>
-#endif
-
-#ifdef CONFIG_XF86VM
-#include <X11/extensions/xf86vmode.h>
-#endif
-
-#include <sys/ipc.h>
-#include <sys/shm.h>
-
-#undef ENABLE_DPMS
-
-typedef struct
-{
- unsigned long flags;
- unsigned long functions;
- unsigned long decorations;
- long input_mode;
- unsigned long status;
-} MotifWmHints;
-
-Atom wsMotifHints;
-
-int wsMaxX = 0; // Screen width.
-int wsMaxY = 0; // Screen height.
-int wsOrgX = 0; // Screen origin x.
-int wsOrgY = 0; // Screen origin y.
-
-Display * wsDisplay;
-int wsScreen;
-Window wsRootWin;
-XEvent wsEvent;
-int wsWindowDepth;
-GC wsHGC;
-MotifWmHints wsMotifWmHints;
-Atom wsTextProperlyAtom = None;
-int wsLayer = 0;
-
-int wsDepthOnScreen = 0;
-int wsRedMask = 0;
-int wsGreenMask = 0;
-int wsBlueMask = 0;
-int wsOutMask = 0;
-int wsNonNativeOrder = 0;
-
-int wsTrue = True;
-
-#define wsWLCount 5
-wsTWindow * wsWindowList[wsWLCount] = { NULL,NULL,NULL,NULL,NULL };
-
-unsigned long wsKeyTable[512];
-
-int wsUseXShm = 1;
-int wsUseXShape = 1;
-
-inline int wsSearch( Window win );
-
-// ---
-
-#define PACK_RGB16(r,g,b,pixel) pixel=(b>>3);\
- pixel<<=6;\
- pixel|=(g>>2);\
- pixel<<=5;\
- pixel|=(r>>3)
-
-#define PACK_RGB15(r,g,b,pixel) pixel=(b>>3);\
- pixel<<=5;\
- pixel|=(g>>3);\
- pixel<<=5;\
- pixel|=(r>>3)
-
-typedef void(*wsTConvFunc)( const unsigned char * in_pixels, unsigned char * out_pixels, unsigned num_pixels );
-wsTConvFunc wsConvFunc = NULL;
-
-void rgb32torgb32( const unsigned char * src, unsigned char * dst,unsigned int src_size )
-{ memcpy( dst,src,src_size ); }
-
-// ---
-
-#define MWM_HINTS_FUNCTIONS (1L << 0)
-#define MWM_HINTS_DECORATIONS (1L << 1)
-#define MWM_HINTS_INPUT_MODE (1L << 2)
-#define MWM_HINTS_STATUS (1L << 3)
-
-#define MWM_FUNC_ALL (1L << 0)
-#define MWM_FUNC_RESIZE (1L << 1)
-#define MWM_FUNC_MOVE (1L << 2)
-#define MWM_FUNC_MINIMIZE (1L << 3)
-#define MWM_FUNC_MAXIMIZE (1L << 4)
-#define MWM_FUNC_CLOSE (1L << 5)
-
-#define MWM_DECOR_ALL (1L << 0)
-#define MWM_DECOR_BORDER (1L << 1)
-#define MWM_DECOR_RESIZEH (1L << 2)
-#define MWM_DECOR_TITLE (1L << 3)
-#define MWM_DECOR_MENU (1L << 4)
-#define MWM_DECOR_MINIMIZE (1L << 5)
-#define MWM_DECOR_MAXIMIZE (1L << 6)
-
-#define MWM_INPUT_MODELESS 0
-#define MWM_INPUT_PRIMARY_APPLICATION_MODAL 1
-#define MWM_INPUT_SYSTEM_MODAL 2
-#define MWM_INPUT_FULL_APPLICATION_MODAL 3
-#define MWM_INPUT_APPLICATION_MODAL MWM_INPUT_PRIMARY_APPLICATION_MODAL
-
-#define MWM_TEAROFF_WINDOW (1L<<0)
-
-void wsWindowDecoration( wsTWindow * win,long d )
-{
- wsMotifHints=XInternAtom( wsDisplay,"_MOTIF_WM_HINTS",0 );
- if ( wsMotifHints == None ) return;
-
- memset( &wsMotifWmHints,0,sizeof( MotifWmHints ) );
- wsMotifWmHints.flags=MWM_HINTS_FUNCTIONS | MWM_HINTS_DECORATIONS;
- if ( d )
- {
- wsMotifWmHints.functions=MWM_FUNC_MOVE | MWM_FUNC_CLOSE | MWM_FUNC_MINIMIZE | MWM_FUNC_MAXIMIZE | MWM_FUNC_RESIZE;
- wsMotifWmHints.decorations=MWM_DECOR_ALL;
- }
- XChangeProperty( wsDisplay,win->WindowID,wsMotifHints,wsMotifHints,32,
- PropModeReplace,(unsigned char *)&wsMotifWmHints,5 );
-}
-
-// ----------------------------------------------------------------------------------------------
-// Init X Window System.
-// ----------------------------------------------------------------------------------------------
-
-int wsIOErrorHandler( Display * dpy )
-{
- fprintf( stderr,"[ws] IO error in display.\n" );
- exit( 0 );
-}
-
-int wsErrorHandler( Display * dpy,XErrorEvent * Event )
-{
- char type[128];
- XGetErrorText( wsDisplay,Event->error_code,type,128 );
- fprintf(stderr,"[ws] Error in display.\n");
- fprintf(stderr,"[ws] Error code: %d ( %s )\n",Event->error_code,type );
- fprintf(stderr,"[ws] Request code: %d\n",Event->request_code );
- fprintf(stderr,"[ws] Minor code: %d\n",Event->minor_code );
- fprintf(stderr,"[ws] Modules: %s\n",current_module?current_module:"(NULL)" );
- exit( 0 );
-}
-
-void wsXInit( void* mDisplay )
-{
- int eventbase;
- int errorbase;
-
-if(mDisplay){
- wsDisplay=mDisplay;
-} else {
- char * DisplayName = ":0.0";
- if ( getenv( "DISPLAY" ) ) DisplayName=getenv( "DISPLAY" );
- wsDisplay=XOpenDisplay( DisplayName );
- if ( !wsDisplay )
- {
- mp_msg( MSGT_GPLAYER,MSGL_FATAL,MSGTR_WS_CouldNotOpenDisplay );
- exit( 0 );
- }
-}
-
-/* enable DND atoms */
-wsXDNDInitialize();
-
-{ /* on remote display XShm will be disabled - LGB */
- char *dispname=DisplayString(wsDisplay);
- int localdisp=1;
- if (dispname&&*dispname!=':') {
- localdisp=0;
- wsUseXShm=0;
- }
- mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[ws] display name: %s => %s display.\n",dispname,localdisp?"local":"REMOTE");
- if (!localdisp) mp_msg( MSGT_GPLAYER,MSGL_V,MSGTR_WS_RemoteDisplay );
-}
-
- if ( !XShmQueryExtension( wsDisplay ) )
- {
- mp_msg( MSGT_GPLAYER,MSGL_ERR,MSGTR_WS_NoXshm );
- wsUseXShm=0;
- }
-#ifdef CONFIG_XSHAPE
- if ( !XShapeQueryExtension( wsDisplay,&eventbase,&errorbase ) )
- {
- mp_msg( MSGT_GPLAYER,MSGL_ERR,MSGTR_WS_NoXshape );
- wsUseXShape=0;
- }
-#else
- wsUseXShape=0;
-#endif
-
- XSynchronize( wsDisplay,True );
-
- wsScreen=DefaultScreen( wsDisplay );
- wsRootWin=RootWindow( wsDisplay,wsScreen );
-#ifdef CONFIG_XF86VM
- {
- int clock;
- XF86VidModeModeLine modeline;
-
- XF86VidModeGetModeLine( wsDisplay,wsScreen,&clock ,&modeline );
- wsMaxX=modeline.hdisplay;
- wsMaxY=modeline.vdisplay;
- }
-#endif
- {
- wsOrgX = wsOrgY = 0;
- if ( !wsMaxX )
- wsMaxX=DisplayWidth( wsDisplay,wsScreen );
- if ( !wsMaxY )
- wsMaxY=DisplayHeight( wsDisplay,wsScreen );
- }
- vo_screenwidth = wsMaxX; vo_screenheight = wsMaxY;
- xinerama_x = wsOrgX; xinerama_y = wsOrgY;
- update_xinerama_info();
- wsMaxX = vo_screenwidth; wsMaxY = vo_screenheight;
- wsOrgX = xinerama_x; wsOrgY = xinerama_y;
-
- wsGetDepthOnScreen();
-#ifdef DEBUG
- {
- int minor,major,shp;
- mp_msg( MSGT_GPLAYER,MSGL_DBG2,"[ws] Screen depth: %d\n",wsDepthOnScreen );
- mp_msg( MSGT_GPLAYER,MSGL_DBG2,"[ws] size: %dx%d\n",wsMaxX,wsMaxY );
-#ifdef CONFIG_XINERAMA
- mp_msg( MSGT_GPLAYER,MSGL_DBG2,"[ws] origin: +%d+%d\n",wsOrgX,wsOrgY );
-#endif
- mp_msg( MSGT_GPLAYER,MSGL_DBG2,"[ws] red mask: 0x%x\n",wsRedMask );
- mp_msg( MSGT_GPLAYER,MSGL_DBG2,"[ws] green mask: 0x%x\n",wsGreenMask );
- mp_msg( MSGT_GPLAYER,MSGL_DBG2,"[ws] blue mask: 0x%x\n",wsBlueMask );
- if ( wsUseXShm )
- {
- XShmQueryVersion( wsDisplay,&major,&minor,&shp );
- mp_msg( MSGT_GPLAYER,MSGL_DBG2,"[ws] XShm version is %d.%d\n",major,minor );
- }
- #ifdef CONFIG_XSHAPE
- if ( wsUseXShape )
- {
- XShapeQueryVersion( wsDisplay,&major,&minor );
- mp_msg( MSGT_GPLAYER,MSGL_DBG2,"[ws] XShape version is %d.%d\n",major,minor );
- }
- #endif
- }
-#endif
- wsOutMask=wsGetOutMask();
- mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[ws] Initialized converter: " );
- sws_rgb2rgb_init(get_sws_cpuflags());
- switch ( wsOutMask )
- {
- case wsRGB32:
- mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"rgb32 to rgb32\n" );
- wsConvFunc=rgb32torgb32;
- break;
- case wsBGR32:
- mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"rgb32 to bgr32\n" );
- wsConvFunc=rgb32tobgr32;
- break;
- case wsRGB24:
- mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"rgb32 to rgb24\n" );
- wsConvFunc=rgb32to24;
- break;
- case wsBGR24:
- mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"rgb32 to bgr24\n" );
- wsConvFunc=rgb32tobgr24;
- break;
- case wsRGB16:
- mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"rgb32 to rgb16\n" );
- wsConvFunc=rgb32to16;
- break;
- case wsBGR16:
- mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"rgb32 to bgr16\n" );
- wsConvFunc=rgb32tobgr16;
- break;
- case wsRGB15:
- mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"rgb32 to rgb15\n" );
- wsConvFunc=rgb32to15;
- break;
- case wsBGR15:
- mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"rgb32 to bgr15\n" );
- wsConvFunc=rgb32tobgr15;
- break;
- }
- XSetErrorHandler( wsErrorHandler );
-}
-
-// ----------------------------------------------------------------------------------------------
-// Create window.
-// X,Y : window position
-// wX,wY : size of window
-// bW : border width
-// cV : visible mouse cursor on window
-// D : visible frame, title, etc.
-// sR : screen ratio
-// ----------------------------------------------------------------------------------------------
-
-XClassHint wsClassHint;
-XTextProperty wsTextProperty;
-Window LeaderWindow;
-
-void wsCreateWindow( wsTWindow * win,int X,int Y,int wX,int hY,int bW,int cV,unsigned char D,char * label )
-{
- int depth;
-
- win->Property=D;
- if ( D & wsShowFrame ) win->Decorations=1;
- wsHGC=DefaultGC( wsDisplay,wsScreen );
-// The window position and size.
- switch ( X )
- {
- case -1: win->X=( wsMaxX / 2 ) - ( wX / 2 ) + wsOrgX; break;
- case -2: win->X=wsMaxX - wX - 1 + wsOrgX; break;
- default: win->X=X; break;
- }
- switch ( Y )
- {
- case -1: win->Y=( wsMaxY / 2 ) - ( hY / 2 ) + wsOrgY; break;
- case -2: win->Y=wsMaxY - hY - 1 + wsOrgY; break;
- default: win->Y=Y; break;
- }
- win->Width=wX;
- win->Height=hY;
- win->OldX=win->X;
- win->OldY=win->Y;
- win->OldWidth=win->Width;
- win->OldHeight=win->Height;
-
-// Border size for window.
- win->BorderWidth=bW;
-// Hide Mouse Cursor
- win->wsCursor=None;
- win->wsMouseEventType=cV;
- win->wsCursorData[0]=0;
- win->wsCursorPixmap=XCreateBitmapFromData( wsDisplay,wsRootWin,win->wsCursorData,1,1 );
- if ( !(cV & wsShowMouseCursor) ) win->wsCursor=XCreatePixmapCursor( wsDisplay,win->wsCursorPixmap,win->wsCursorPixmap,&win->wsColor,&win->wsColor,0,0 );
-
- depth = vo_find_depth_from_visuals( wsDisplay,wsScreen,NULL );
- if ( depth < 15 )
- {
- mp_msg( MSGT_GPLAYER,MSGL_FATAL,MSGTR_WS_ColorDepthTooLow );
- exit( 0 );
- }
- XMatchVisualInfo( wsDisplay,wsScreen,depth,TrueColor,&win->VisualInfo );
-
-// ---
- win->AtomLeaderClient=XInternAtom( wsDisplay,"WM_CLIENT_LEADER",False );
- win->AtomDeleteWindow=XInternAtom( wsDisplay,"WM_DELETE_WINDOW",False );
- win->AtomTakeFocus=XInternAtom( wsDisplay,"WM_TAKE_FOCUS",False );
- win->AtomRolle=XInternAtom( wsDisplay,"WM_WINDOW_ROLE",False );
- win->AtomWMSizeHint=XInternAtom( wsDisplay,"WM_SIZE_HINT",False );
- win->AtomWMNormalHint=XInternAtom( wsDisplay,"WM_NORMAL_HINT",False );
- win->AtomProtocols=XInternAtom( wsDisplay,"WM_PROTOCOLS",False );
- win->AtomsProtocols[0]=win->AtomDeleteWindow;
- win->AtomsProtocols[1]=win->AtomTakeFocus;
- win->AtomsProtocols[2]=win->AtomRolle;
-// ---
-
- win->WindowAttrib.background_pixel=BlackPixel( wsDisplay,wsScreen );
- win->WindowAttrib.border_pixel=WhitePixel( wsDisplay,wsScreen );
- win->WindowAttrib.colormap=XCreateColormap( wsDisplay,wsRootWin,win->VisualInfo.visual,AllocNone );
- win->WindowAttrib.event_mask=StructureNotifyMask | FocusChangeMask |
- ExposureMask | PropertyChangeMask |
- EnterWindowMask | LeaveWindowMask |
- VisibilityChangeMask |
- KeyPressMask | KeyReleaseMask;
- if ( ( cV & wsHandleMouseButton ) ) win->WindowAttrib.event_mask|=ButtonPressMask | ButtonReleaseMask;
- if ( ( cV & wsHandleMouseMove ) ) win->WindowAttrib.event_mask|=PointerMotionMask;
- win->WindowAttrib.cursor=win->wsCursor;
- win->WindowAttrib.override_redirect=False;
- if ( D & wsOverredirect ) win->WindowAttrib.override_redirect=True;
-
- win->WindowMask=CWBackPixel | CWBorderPixel |
- CWColormap | CWEventMask | CWCursor |
- CWOverrideRedirect;
-
- win->WindowID=XCreateWindow( wsDisplay,
- (win->Parent != 0?win->Parent:wsRootWin),
- win->X,win->Y,win->Width,win->Height,win->BorderWidth,
- win->VisualInfo.depth,
- InputOutput,
- win->VisualInfo.visual,
- win->WindowMask,&win->WindowAttrib );
-
- wsClassHint.res_name="MPlayer";
-
- wsClassHint.res_class="MPlayer";
- XSetClassHint( wsDisplay,win->WindowID,&wsClassHint );
-
- win->SizeHint.flags=PPosition | PSize | PResizeInc | PWinGravity;// | PBaseSize;
- win->SizeHint.x=win->X;
- win->SizeHint.y=win->Y;
- win->SizeHint.width=win->Width;
- win->SizeHint.height=win->Height;
-
- if ( D & wsMinSize )
- {
- win->SizeHint.flags|=PMinSize;
- win->SizeHint.min_width=win->Width;
- win->SizeHint.min_height=win->Height;
- }
- if ( D & wsMaxSize )
- {
- win->SizeHint.flags|=PMaxSize;
- win->SizeHint.max_width=win->Width;
- win->SizeHint.max_height=win->Height;
- }
-
- win->SizeHint.height_inc=1;
- win->SizeHint.width_inc=1;
- win->SizeHint.base_width=win->Width;
- win->SizeHint.base_height=win->Height;
- win->SizeHint.win_gravity=StaticGravity;
- XSetWMNormalHints( wsDisplay,win->WindowID,&win->SizeHint );
-
- win->WMHints.flags=InputHint | StateHint;
- win->WMHints.input=True;
- win->WMHints.initial_state=NormalState;
- XSetWMHints( wsDisplay,win->WindowID,&win->WMHints );
-
- wsWindowDecoration( win,win->Decorations );
- XStoreName( wsDisplay,win->WindowID,label );
- XmbSetWMProperties( wsDisplay,win->WindowID,label,label,NULL,0,NULL,NULL,NULL );
-
- XSetWMProtocols( wsDisplay,win->WindowID,win->AtomsProtocols,3 );
- XChangeProperty( wsDisplay,win->WindowID,
- win->AtomLeaderClient,
- XA_WINDOW,32,PropModeReplace,
- (unsigned char *)&LeaderWindow,1 );
-
- wsTextProperty.value=label;
- wsTextProperty.encoding=XA_STRING;
- wsTextProperty.format=8;
- wsTextProperty.nitems=strlen( label );
- XSetWMIconName( wsDisplay,win->WindowID,&wsTextProperty );
-
- win->wGC=XCreateGC( wsDisplay,win->WindowID,
- GCForeground | GCBackground,
- &win->wGCV );
-
- win->Visible=0;
- win->Focused=0;
- win->Mapped=0;
- win->Rolled=0;
- if ( D & wsShowWindow ) XMapWindow( wsDisplay,win->WindowID );
-
- wsCreateImage( win,win->Width,win->Height );
-// --- End of creating --------------------------------------------------------------------------
-
- {
- int i;
- for ( i=0;i < wsWLCount;i++ )
- if ( wsWindowList[i] == NULL ) break;
- if ( i == wsWLCount )
- { mp_msg( MSGT_GPLAYER,MSGL_FATAL,MSGTR_WS_TooManyOpenWindows ); exit( 0 ); }
- wsWindowList[i]=win;
- }
-
- XFlush( wsDisplay );
- XSync( wsDisplay,False );
-
- win->ReDraw=NULL;
- win->ReSize=NULL;
- win->Idle=NULL;
- win->MouseHandler=NULL;
- win->KeyHandler=NULL;
- mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[ws] window is created. ( %s ).\n",label );
-}
-
-void wsDestroyWindow( wsTWindow * win )
-{
- int l;
- l=wsSearch( win->WindowID );
- wsWindowList[l]=NULL;
- if ( win->wsCursor != None )
- {
- XFreeCursor( wsDisplay,win->wsCursor );
- win->wsCursor=None;
- }
- XFreeGC( wsDisplay,win->wGC );
- XUnmapWindow( wsDisplay,win->WindowID );
- wsDestroyImage( win );
- XDestroyWindow( wsDisplay,win->WindowID );
-#if 0
- win->ReDraw=NULL;
- win->ReSize=NULL;
- win->Idle=NULL;
- win->MouseHandler=NULL;
- win->KeyHandler=NULL;
- win->Visible=0;
- win->Focused=0;
- win->Mapped=0;
- win->Rolled=0;
-#endif
-}
-
-// ----------------------------------------------------------------------------------------------
-// Handle events.
-// ----------------------------------------------------------------------------------------------
-
-inline int wsSearch( Window win )
-{
- int i;
- for ( i=0;i<wsWLCount;i++ ) if ( wsWindowList[i] && wsWindowList[i]->WindowID == win ) return i;
- return -1;
-}
-
-Bool wsEvents( Display * display,XEvent * Event,XPointer arg )
-{
- unsigned long i = 0;
- int l;
- int x,y;
- Window child_window = 0;
-
- l=wsSearch( Event->xany.window );
- if ( l == -1 ) return !wsTrue;
- wsWindowList[l]->State=0;
- switch( Event->type )
- {
- case ClientMessage:
- if ( Event->xclient.message_type == wsWindowList[l]->AtomProtocols )
- {
- if ( (Atom)Event->xclient.data.l[0] == wsWindowList[l]->AtomDeleteWindow )
- { i=wsWindowClosed; goto expose; }
- if ( (Atom)Event->xclient.data.l[0] == wsWindowList[l]->AtomTakeFocus )
- { i=wsWindowFocusIn; wsWindowList[l]->Focused=wsFocused; goto expose; }
- if ( (Atom)Event->xclient.data.l[0] == wsWindowList[l]->AtomRolle )
- { mp_msg( MSGT_GPLAYER,MSGL_V,"[ws] role set.\n" ); }
- } else {
- /* try to process DND events */
- wsXDNDProcessClientMessage(wsWindowList[l],&Event->xclient);
- }
- break;
-
- case MapNotify: i=wsWindowMapped; wsWindowList[l]->Mapped=wsMapped; goto expose;
- case UnmapNotify: i=wsWindowUnmapped; wsWindowList[l]->Mapped=wsNone; goto expose;
- case FocusIn:
- if ( wsWindowList[l]->Focused == wsFocused ) break;
- i=wsWindowFocusIn;
- wsWindowList[l]->Focused=wsFocused;
- goto expose;
- case FocusOut:
- if ( wsWindowList[l]->Focused == wsNone ) break;
- i=wsWindowFocusOut;
- wsWindowList[l]->Focused=wsNone;
- goto expose;
- case VisibilityNotify:
- switch( Event->xvisibility.state )
- {
- case VisibilityUnobscured: i=wsWindowVisible; wsWindowList[l]->Visible=wsVisible; goto expose;
- case VisibilityFullyObscured: i=wsWindowNotVisible; wsWindowList[l]->Visible=wsNotVisible; goto expose;
- case VisibilityPartiallyObscured: i=wsWindowPartialVisible; wsWindowList[l]->Visible=wsPVisible; goto expose;
- }
-expose:
- wsWindowList[l]->State=i;
- if ( wsWindowList[l]->ReDraw ) wsWindowList[l]->ReDraw();
- break;
-
- case Expose:
- wsWindowList[l]->State=wsWindowExpose;
- if ( ( wsWindowList[l]->ReDraw )&&( !Event->xexpose.count ) ) wsWindowList[l]->ReDraw();
- break;
-
- case ConfigureNotify:
- XTranslateCoordinates( wsDisplay,wsWindowList[l]->WindowID,wsRootWin,0,0,&x,&y,&child_window );
- if ( ( wsWindowList[l]->X != x )||( wsWindowList[l]->Y != y )||( wsWindowList[l]->Width != Event->xconfigure.width )||( wsWindowList[l]->Height != Event->xconfigure.height ) )
- {
- wsWindowList[l]->X=x; wsWindowList[l]->Y=y;
- wsWindowList[l]->Width=Event->xconfigure.width; wsWindowList[l]->Height=Event->xconfigure.height;
- if ( wsWindowList[l]->ReSize ) wsWindowList[l]->ReSize( wsWindowList[l]->X,wsWindowList[l]->Y,wsWindowList[l]->Width,wsWindowList[l]->Height );
- }
-
- wsWindowList[l]->Rolled=wsNone;
- if ( Event->xconfigure.y < 0 )
- { i=wsWindowRolled; wsWindowList[l]->Rolled=wsRolled; goto expose; }
-
- break;
-
- case KeyPress: i=wsKeyPressed; goto keypressed;
- case KeyRelease: i=wsKeyReleased;
-keypressed:
- wsWindowList[l]->Alt=0;
- wsWindowList[l]->Shift=0;
- wsWindowList[l]->NumLock=0;
- wsWindowList[l]->Control=0;
- wsWindowList[l]->CapsLock=0;
- if ( Event->xkey.state & Mod1Mask ) wsWindowList[l]->Alt=1;
- if ( Event->xkey.state & Mod2Mask ) wsWindowList[l]->NumLock=1;
- if ( Event->xkey.state & ControlMask ) wsWindowList[l]->Control=1;
- if ( Event->xkey.state & ShiftMask ) wsWindowList[l]->Shift=1;
- if ( Event->xkey.state & LockMask ) wsWindowList[l]->CapsLock=1;
-#if 0
- {
- KeySym keySym;
- keySym=XKeycodeToKeysym( wsDisplay,Event->xkey.keycode,0 );
- if ( keySym != NoSymbol )
- {
- keySym=( (keySym&0xff00) != 0?( (keySym&0x00ff) + 256 ):( keySym ) );
- wsKeyTable[ keySym ]=i;
- if ( wsWindowList[l]->KeyHandler )
- wsWindowList[l]->KeyHandler( Event->xkey.state,i,keySym );
- }
- }
-#else
- {
- int key;
- char buf[100];
- KeySym keySym;
- static XComposeStatus stat;
-
- XLookupString( &Event->xkey,buf,sizeof(buf),&keySym,&stat );
- key=( (keySym&0xff00) != 0?( (keySym&0x00ff) + 256 ):( keySym ) );
- wsKeyTable[ key ]=i;
- if ( wsWindowList[l]->KeyHandler ) wsWindowList[l]->KeyHandler( Event->xkey.keycode,i,key );
- }
-#endif
- break;
-
- case MotionNotify:
- i=wsMoveMouse;
- {
- /* pump all motion events from the display queue:
- this way it works faster when moving the window */
- static XEvent e;
- if ( Event->xmotion.state )
- {
- while(XCheckTypedWindowEvent(display,Event->xany.window,MotionNotify,&e)){
- /* FIXME: need to make sure we didn't release/press the button in between...*/
- /* FIXME: do we need some timeout here to make sure we don't spend too much time
- removing events from the queue? */
- Event = &e;
- }
- }
- }
- goto buttonreleased;
- case ButtonRelease: i=Event->xbutton.button + 128; goto buttonreleased;
- case ButtonPress: i=Event->xbutton.button; goto buttonreleased;
- case EnterNotify: i=wsEnterWindow; goto buttonreleased;
- case LeaveNotify: i=wsLeaveWindow;
-buttonreleased:
- if ( wsWindowList[l]->MouseHandler )
- wsWindowList[l]->MouseHandler( i,Event->xbutton.x,Event->xbutton.y,Event->xmotion.x_root,Event->xmotion.y_root );
- break;
-
- case SelectionNotify:
- /* Handle DandD */
- wsXDNDProcessSelection(wsWindowList[l],Event);
- break;
- }
- XFlush( wsDisplay );
- XSync( wsDisplay,False );
- return !wsTrue;
-}
-
-Bool wsDummyEvents( Display * display,XEvent * Event,XPointer arg )
-{ return True; }
-
-void wsHandleEvents( void ){
- // handle pending events
- while ( XPending(wsDisplay) ){
- XNextEvent( wsDisplay,&wsEvent );
-// printf("### X event: %d [%d]\n",wsEvent.type,delay);
- wsEvents( wsDisplay,&wsEvent,NULL );
- }
-}
-
-void wsMainLoop( void )
-{
- int delay=20;
- mp_msg( MSGT_GPLAYER,MSGL_V,"[ws] init threads: %d\n",XInitThreads() );
- XSynchronize( wsDisplay,False );
- XLockDisplay( wsDisplay );
-// XIfEvent( wsDisplay,&wsEvent,wsEvents,NULL );
-
-#if 1
-
-while(wsTrue){
- // handle pending events
- while ( XPending(wsDisplay) ){
- XNextEvent( wsDisplay,&wsEvent );
- wsEvents( wsDisplay,&wsEvent,NULL );
- delay=0;
- }
- usleep(delay*1000); // FIXME!
- if(delay<10*20) delay+=20; // pump up delay up to 0.2 sec (low activity)
-}
-
-#else
-
- while( wsTrue )
- {
- XIfEvent( wsDisplay,&wsEvent,wsDummyEvents,NULL );
- wsEvents( wsDisplay,&wsEvent,NULL );
- }
-#endif
-
- XUnlockDisplay( wsDisplay );
-}
-
-// ----------------------------------------------------------------------------------------------
-// Move window to selected layer
-// ----------------------------------------------------------------------------------------------
-
-#define WIN_LAYER_ONBOTTOM 2
-#define WIN_LAYER_NORMAL 4
-#define WIN_LAYER_ONTOP 10
-
-void wsSetLayer( Display * wsDisplay, Window win, int layer )
-{ vo_x11_setlayer( wsDisplay,win,layer ); }
-
-// ----------------------------------------------------------------------------------------------
-// Switch to fullscreen.
-// ----------------------------------------------------------------------------------------------
-void wsFullScreen( wsTWindow * win )
-{
- int decoration = 0;
-
- if ( win->isFullScreen )
- {
- vo_x11_ewmh_fullscreen( _NET_WM_STATE_REMOVE ); // removes fullscreen state if wm supports EWMH
- if ( ! (vo_fs_type & vo_wm_FULLSCREEN) ) // shouldn't be needed with EWMH fs
- {
- win->X=win->OldX;
- win->Y=win->OldY;
- win->Width=win->OldWidth;
- win->Height=win->OldHeight;
- decoration=win->Decorations;
- }
-
-#ifdef ENABLE_DPMS
- wsScreenSaverOn( wsDisplay );
-#endif
-
- win->isFullScreen=False;
- }
- else
- {
- if ( ! (vo_fs_type & vo_wm_FULLSCREEN) ) // shouldn't be needed with EWMH fs
- {
- win->OldX=win->X; win->OldY=win->Y;
- win->OldWidth=win->Width; win->OldHeight=win->Height;
- vo_dx = win->X; vo_dy = win->Y;
- vo_dwidth = win->Width; vo_dheight = win->Height;
- vo_screenwidth = wsMaxX; vo_screenheight = wsMaxY;
- xinerama_x = wsOrgX; xinerama_y = wsOrgY;
- update_xinerama_info();
- wsMaxX = vo_screenwidth; wsMaxY = vo_screenheight;
- wsOrgX = xinerama_x; wsOrgY = xinerama_y;
- win->X=wsOrgX; win->Y=wsOrgY;
- win->Width=wsMaxX; win->Height=wsMaxY;
- }
-
- win->isFullScreen=True;
-#ifdef ENABLE_DPMS
- wsScreenSaverOff( wsDisplay );
-#endif
-
- vo_x11_ewmh_fullscreen( _NET_WM_STATE_ADD ); // adds fullscreen state if wm supports EWMH
- }
-
- if ( ! (vo_fs_type & vo_wm_FULLSCREEN) ) // shouldn't be needed with EWMH fs
- {
- vo_x11_decoration( wsDisplay,win->WindowID,decoration );
- vo_x11_sizehint( win->X,win->Y,win->Width,win->Height,0 );
- vo_x11_setlayer( wsDisplay,win->WindowID,win->isFullScreen );
-
- if ((!(win->isFullScreen)) & vo_ontop) vo_x11_setlayer(wsDisplay, win->WindowID,1);
-
- XMoveResizeWindow( wsDisplay,win->WindowID,win->X,win->Y,win->Width,win->Height );
- }
-
- if ( vo_wm_type == 0 && !(vo_fsmode&16) )
- {
- XWithdrawWindow( wsDisplay,win->WindowID,wsScreen );
- }
-
-
- XMapRaised( wsDisplay,win->WindowID );
- XRaiseWindow( wsDisplay,win->WindowID );
- XFlush( wsDisplay );
-}
-
-// ----------------------------------------------------------------------------------------------
-// Redraw screen.
-// ----------------------------------------------------------------------------------------------
-void wsPostRedisplay( wsTWindow * win )
-{
- if ( win->ReDraw )
- {
- win->State=wsWindowExpose;
- win->ReDraw();
- XFlush( wsDisplay );
- }
-}
-
-// ----------------------------------------------------------------------------------------------
-// Do Exit.
-// ----------------------------------------------------------------------------------------------
-void wsDoExit( void )
-{ wsTrue=False; wsResizeWindow( wsWindowList[0],32,32 ); }
-
-// ----------------------------------------------------------------------------------------------
-// Put 'Image' to window.
-// ----------------------------------------------------------------------------------------------
-void wsConvert( wsTWindow * win,unsigned char * Image,unsigned int Size )
-{
- int i;
- if ( wsConvFunc )
- wsConvFunc( Image,win->ImageData,win->xImage->width * win->xImage->height * 4 );
- if (!wsNonNativeOrder) return;
- switch (win->xImage->bits_per_pixel) {
- case 32:
- {
- uint32_t *d = win->ImageData;
- for (i = 0; i < win->xImage->width * win->xImage->height; i++)
- d[i] = bswap_32(d[i]);
- break;
- }
- case 16:
- case 15:
- {
- uint16_t *d = win->ImageData;
- for (i = 0; i < win->xImage->width * win->xImage->height; i++)
- d[i] = bswap_16(d[i]);
- break;
- }
- }
-}
-
-void wsPutImage( wsTWindow * win )
-{
- if ( wsUseXShm )
- {
- XShmPutImage( wsDisplay,win->WindowID,win->wGC,win->xImage,
- 0,0,
- ( win->Width - win->xImage->width ) / 2,( win->Height - win->xImage->height ) / 2,
- win->xImage->width,win->xImage->height,0 );
- }
- else
- {
- XPutImage( wsDisplay,win->WindowID,win->wGC,win->xImage,
- 0,0,
- ( win->Width - win->xImage->width ) / 2,( win->Height - win->xImage->height ) / 2,
- win->xImage->width,win->xImage->height );
- }
-}
-
-// ----------------------------------------------------------------------------------------------
-// Move window to x, y.
-// ----------------------------------------------------------------------------------------------
-void wsMoveWindow( wsTWindow * win,int b,int x, int y )
-{
- if ( b )
- {
- switch ( x )
- {
- case -1: win->X=( wsMaxX / 2 ) - ( win->Width / 2 ) + wsOrgX; break;
- case -2: win->X=wsMaxX - win->Width + wsOrgX; break;
- default: win->X=x; break;
- }
- switch ( y )
- {
- case -1: win->Y=( wsMaxY / 2 ) - ( win->Height / 2 ) + wsOrgY; break;
- case -2: win->Y=wsMaxY - win->Height + wsOrgY; break;
- default: win->Y=y; break;
- }
- }
- else { win->X=x; win->Y=y; }
-
- win->SizeHint.flags=PPosition | PWinGravity;
- win->SizeHint.x=win->X;
- win->SizeHint.y=win->Y;
- win->SizeHint.win_gravity=StaticGravity;
- XSetWMNormalHints( wsDisplay,win->WindowID,&win->SizeHint );
-
- XMoveWindow( wsDisplay,win->WindowID,win->X,win->Y );
- if ( win->ReSize ) win->ReSize( win->X,win->Y,win->Width,win->Height );
-}
-
-// ----------------------------------------------------------------------------------------------
-// Resize window to sx, sy.
-// ----------------------------------------------------------------------------------------------
-void wsResizeWindow( wsTWindow * win,int sx, int sy )
-{
- win->Width=sx;
- win->Height=sy;
-
- win->SizeHint.flags=PPosition | PSize | PWinGravity;// | PBaseSize;
- win->SizeHint.x=win->X;
- win->SizeHint.y=win->Y;
- win->SizeHint.width=win->Width;
- win->SizeHint.height=win->Height;
-
- if ( win->Property & wsMinSize )
- {
- win->SizeHint.flags|=PMinSize;
- win->SizeHint.min_width=win->Width;
- win->SizeHint.min_height=win->Height;
- }
- if ( win->Property & wsMaxSize )
- {
- win->SizeHint.flags|=PMaxSize;
- win->SizeHint.max_width=win->Width;
- win->SizeHint.max_height=win->Height;
- }
-
- win->SizeHint.win_gravity=StaticGravity;
- win->SizeHint.base_width=sx; win->SizeHint.base_height=sy;
-
- if ( vo_wm_type == 0 ) XUnmapWindow( wsDisplay,win->WindowID );
-
- XSetWMNormalHints( wsDisplay,win->WindowID,&win->SizeHint );
- XResizeWindow( wsDisplay,win->WindowID,sx,sy );
- XMapRaised( wsDisplay,win->WindowID );
- if ( win->ReSize ) win->ReSize( win->X,win->Y,win->Width,win->Height );
-}
-
-// ----------------------------------------------------------------------------------------------
-// Iconify window.
-// ----------------------------------------------------------------------------------------------
-void wsIconify( wsTWindow win )
-{ XIconifyWindow( wsDisplay,win.WindowID,0 ); }
-
-// ----------------------------------------------------------------------------------------------
-// Move top the window.
-// ----------------------------------------------------------------------------------------------
-void wsMoveTopWindow( Display * wsDisplay,Window win )
-{
-// XUnmapWindow( wsDisplay,win );
-// XMapWindow( wsDisplay,win );
- XMapRaised( wsDisplay,win );
- XRaiseWindow( wsDisplay,win );
-}
-
-// ----------------------------------------------------------------------------------------------
-// Set window background to 'color'.
-// ----------------------------------------------------------------------------------------------
-void wsSetBackground( wsTWindow * win,int color )
-{ XSetWindowBackground( wsDisplay,win->WindowID,color ); }
-
-void wsSetBackgroundRGB( wsTWindow * win,int r,int g,int b )
-{
- int color = 0;
- switch ( wsOutMask )
- {
- case wsRGB32:
- case wsRGB24: color=( r << 16 ) + ( g << 8 ) + b; break;
- case wsBGR32:
- case wsBGR24: color=( b << 16 ) + ( g << 8 ) + r; break;
- case wsRGB16: PACK_RGB16( b,g,r,color ); break;
- case wsBGR16: PACK_RGB16( r,g,b,color ); break;
- case wsRGB15: PACK_RGB15( b,g,r,color ); break;
- case wsBGR15: PACK_RGB15( r,g,b,color ); break;
- }
- XSetWindowBackground( wsDisplay,win->WindowID,color );
-}
-
-void wsSetForegroundRGB( wsTWindow * win,int r,int g,int b )
-{
- int color = 0;
- switch ( wsOutMask )
- {
- case wsRGB32:
- case wsRGB24: color=( r << 16 ) + ( g << 8 ) + b; break;
- case wsBGR32:
- case wsBGR24: color=( b << 16 ) + ( g << 8 ) + r; break;
- case wsRGB16: PACK_RGB16( b,g,r,color ); break;
- case wsBGR16: PACK_RGB16( r,g,b,color ); break;
- case wsRGB15: PACK_RGB15( b,g,r,color ); break;
- case wsBGR15: PACK_RGB15( r,g,b,color ); break;
- }
- XSetForeground( wsDisplay,win->wGC,color );
-}
-
-// ----------------------------------------------------------------------------------------------
-// Draw string at x,y with fc ( foreground color ) and bc ( background color ).
-// ----------------------------------------------------------------------------------------------
-void wsDrawString( wsTWindow win,int x,int y,char * str,int fc,int bc )
-{
- XSetForeground( wsDisplay,win.wGC,bc );
- XFillRectangle( wsDisplay,win.WindowID,win.wGC,x,y,
- XTextWidth( win.Font,str,strlen( str ) ) + 20,
- win.FontHeight + 2 );
- XSetForeground( wsDisplay,win.wGC,fc );
- XDrawString( wsDisplay,win.WindowID,win.wGC,x + 10,y + 13,str,strlen( str ) );
-}
-
-// ----------------------------------------------------------------------------------------------
-// Calculation string width.
-// ----------------------------------------------------------------------------------------------
-int wsTextWidth( wsTWindow win,char * str )
-{ return XTextWidth( win.Font,str,strlen( str ) ) + 20; }
-
-// ----------------------------------------------------------------------------------------------
-// Show / hide mouse cursor.
-// ----------------------------------------------------------------------------------------------
-void wsVisibleMouse( wsTWindow * win,int m )
-{
- switch ( m )
- {
- case wsShowMouseCursor:
- if ( win->wsCursor != None )
- {
- XFreeCursor( wsDisplay,win->wsCursor );
- win->wsCursor=None;
- }
- XDefineCursor( wsDisplay,win->WindowID,0 );
- break;
- case wsHideMouseCursor:
- win->wsCursor=XCreatePixmapCursor( wsDisplay,win->wsCursorPixmap,win->wsCursorPixmap,&win->wsColor,&win->wsColor,0,0 );
- XDefineCursor( wsDisplay,win->WindowID,win->wsCursor );
- break;
- }
- XFlush( wsDisplay );
-}
-
-int wsGetDepthOnScreen( void )
-{
- int depth;
- XImage * mXImage;
- Visual * visual;
-
- if( (depth = vo_find_depth_from_visuals( wsDisplay,wsScreen,&visual )) > 0 )
- {
- mXImage = XCreateImage( wsDisplay,visual,depth,ZPixmap,0,NULL,
- 1,1,32,0 );
- wsDepthOnScreen = mXImage->bits_per_pixel;
- wsRedMask=mXImage->red_mask;
- wsGreenMask=mXImage->green_mask;
- wsBlueMask=mXImage->blue_mask;
-#if HAVE_BIGENDIAN
- wsNonNativeOrder = mXImage->byte_order == LSBFirst;
-#else
- wsNonNativeOrder = mXImage->byte_order == MSBFirst;
-#endif
- XDestroyImage( mXImage );
- }
- else
- {
- int bpp,ibpp;
- XWindowAttributes attribs;
-
- mXImage=XGetImage( wsDisplay,wsRootWin,0,0,1,1,AllPlanes,ZPixmap );
- bpp=mXImage->bits_per_pixel;
-
- XGetWindowAttributes( wsDisplay,wsRootWin,&attribs );
- ibpp=attribs.depth;
- mXImage=XGetImage( wsDisplay,wsRootWin,0,0,1,1,AllPlanes,ZPixmap );
- bpp=mXImage->bits_per_pixel;
- if ( ( ibpp + 7 ) / 8 != ( bpp + 7 ) / 8 ) ibpp=bpp;
- wsDepthOnScreen=ibpp;
- wsRedMask=mXImage->red_mask;
- wsGreenMask=mXImage->green_mask;
- wsBlueMask=mXImage->blue_mask;
- XDestroyImage( mXImage );
- }
- return wsDepthOnScreen;
-}
-
-void wsXDone( void )
-{
- XCloseDisplay( wsDisplay );
-}
-
-void wsVisibleWindow( wsTWindow * win,int show )
-{
- switch( show )
- {
- case wsShowWindow: XMapRaised( wsDisplay,win->WindowID ); break;
- case wsHideWindow: XUnmapWindow( wsDisplay,win->WindowID ); break;
- }
- XFlush( wsDisplay );
-}
-
-void wsDestroyImage( wsTWindow * win )
-{
- if ( win->xImage )
- {
- XDestroyImage( win->xImage );
- if ( wsUseXShm )
- {
- XShmDetach( wsDisplay,&win->Shminfo );
- shmdt( win->Shminfo.shmaddr );
- }
- }
- win->xImage=NULL;
-}
-
-void wsCreateImage( wsTWindow * win,int Width,int Height )
-{
- int CompletionType = -1;
- if ( wsUseXShm )
- {
- CompletionType=XShmGetEventBase( wsDisplay ) + ShmCompletion;
- win->xImage=XShmCreateImage( wsDisplay,win->VisualInfo.visual,
- win->VisualInfo.depth,ZPixmap,NULL,&win->Shminfo,Width,Height );
- if ( win->xImage == NULL )
- {
- mp_msg( MSGT_GPLAYER,MSGL_FATAL,MSGTR_WS_ShmError );
- exit( 0 );
- }
- win->Shminfo.shmid=shmget( IPC_PRIVATE,win->xImage->bytes_per_line * win->xImage->height,IPC_CREAT|0777 );
- if ( win->Shminfo.shmid < 0 )
- {
- XDestroyImage( win->xImage );
- mp_msg( MSGT_GPLAYER,MSGL_FATAL,MSGTR_WS_ShmError );
- exit( 0 );
- }
- win->Shminfo.shmaddr=(char *)shmat( win->Shminfo.shmid,0,0 );
-
- if ( win->Shminfo.shmaddr == ((char *) -1) )
- {
- XDestroyImage( win->xImage );
- if ( win->Shminfo.shmaddr != ((char *) -1) ) shmdt( win->Shminfo.shmaddr );
- mp_msg( MSGT_GPLAYER,MSGL_FATAL,MSGTR_WS_ShmError );
- exit( 0 );
- }
- win->xImage->data=win->Shminfo.shmaddr;
- win->Shminfo.readOnly=0;
- XShmAttach( wsDisplay,&win->Shminfo );
- XSync(wsDisplay, False);
- shmctl( win->Shminfo.shmid,IPC_RMID,0 );
- }
- else
- {
- win->xImage=XCreateImage( wsDisplay,win->VisualInfo.visual,win->VisualInfo.depth,
- ZPixmap,0,0,Width,Height,
- (wsDepthOnScreen == 3) ? 32 : wsDepthOnScreen,
- 0 );
- if ( ( win->xImage->data=malloc( win->xImage->bytes_per_line * win->xImage->height ) ) == NULL )
- {
- mp_msg( MSGT_GPLAYER,MSGL_FATAL,MSGTR_WS_NotEnoughMemoryDrawBuffer );
- exit( 0 );
- }
- }
- win->ImageData=(unsigned char *)win->xImage->data;
- win->ImageDataw=(unsigned short int *)win->xImage->data;
- win->ImageDatadw=(unsigned int *)win->xImage->data;
-}
-
-void wsResizeImage( wsTWindow * win,int Width,int Height )
-{ wsDestroyImage( win ); wsCreateImage( win,Width,Height ); }
-
-int wsGetOutMask( void )
-{
- if ( ( wsDepthOnScreen == 32 )&&( wsRedMask == 0xff0000 )&&( wsGreenMask == 0x00ff00 )&&( wsBlueMask == 0x0000ff ) ) return wsRGB32;
- if ( ( wsDepthOnScreen == 32 )&&( wsRedMask == 0x0000ff )&&( wsGreenMask == 0x00ff00 )&&( wsBlueMask == 0xff0000 ) ) return wsBGR32;
- if ( ( wsDepthOnScreen == 24 )&&( wsRedMask == 0xff0000 )&&( wsGreenMask == 0x00ff00 )&&( wsBlueMask == 0x0000ff ) ) return wsRGB24;
- if ( ( wsDepthOnScreen == 24 )&&( wsRedMask == 0x0000ff )&&( wsGreenMask == 0x00ff00 )&&( wsBlueMask == 0xff0000 ) ) return wsBGR24;
- if ( ( wsDepthOnScreen == 16 )&&( wsRedMask == 0xf800 )&&( wsGreenMask == 0x7e0 )&&( wsBlueMask == 0x1f ) ) return wsRGB16;
- if ( ( wsDepthOnScreen == 16 )&&( wsRedMask == 0x1f )&&( wsGreenMask == 0x7e0 )&&( wsBlueMask == 0xf800 ) ) return wsBGR16;
- if ( ( wsDepthOnScreen == 15 )&&( wsRedMask == 0x7c00 )&&( wsGreenMask == 0x3e0 )&&( wsBlueMask == 0x1f ) ) return wsRGB15;
- if ( ( wsDepthOnScreen == 15 )&&( wsRedMask == 0x1f )&&( wsGreenMask == 0x3e0 )&&( wsBlueMask == 0x7c00 ) ) return wsBGR15;
- return 0;
-}
-
-void wsSetTitle( wsTWindow * win,char * name )
-{ XStoreName( wsDisplay,win->WindowID,name ); }
-
-void wsSetMousePosition( wsTWindow * win,int x, int y )
-{ XWarpPointer( wsDisplay,wsRootWin,win->WindowID,0,0,0,0,x,y ); }
-
-#ifdef ENABLE_DPMS
-static int dpms_disabled=0;
-static int timeout_save=0;
-
-void wsScreenSaverOn( Display *mDisplay )
-{
- int nothing;
-#ifdef CONFIG_XDPMS
- if ( dpms_disabled )
- {
- if ( DPMSQueryExtension( mDisplay,&nothing,&nothing ) )
- {
- if ( !DPMSEnable( mDisplay ) ) mp_msg( MSGT_GPLAYER,MSGL_ERR,MSGTR_WS_DpmsUnavailable ); // restoring power saving settings
- else
- {
- // DPMS does not seem to be enabled unless we call DPMSInfo
- BOOL onoff;
- CARD16 state;
- DPMSInfo( mDisplay,&state,&onoff );
- if ( onoff ) mp_msg( MSGT_GPLAYER,MSGL_V,"Successfully enabled DPMS.\n" );
- else mp_msg( MSGT_GPLAYER,MSGL_STATUS,MSGTR_WS_DpmsNotEnabled );
- }
- }
- }
-#endif
- if ( timeout_save )
- {
- int dummy, interval, prefer_blank, allow_exp;
- XGetScreenSaver( mDisplay,&dummy,&interval,&prefer_blank,&allow_exp );
- XSetScreenSaver( mDisplay,timeout_save,interval,prefer_blank,allow_exp );
- XGetScreenSaver( mDisplay,&timeout_save,&interval,&prefer_blank,&allow_exp );
- }
-}
-
-void wsScreenSaverOff( Display * mDisplay )
-{
- int interval,prefer_blank,allow_exp,nothing;
-#ifdef CONFIG_XDPMS
- if ( DPMSQueryExtension( mDisplay,&nothing,&nothing ) )
- {
- BOOL onoff;
- CARD16 state;
- DPMSInfo( mDisplay,&state,&onoff );
- if ( onoff )
- {
- Status stat;
- mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"Disabling DPMS.\n" );
- dpms_disabled=1;
- stat=DPMSDisable( mDisplay ); // monitor powersave off
- mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"stat: %d.\n",stat );
- }
- }
-#endif
- XGetScreenSaver( mDisplay,&timeout_save,&interval,&prefer_blank,&allow_exp );
- if ( timeout_save ) XSetScreenSaver( mDisplay,0,interval,prefer_blank,allow_exp ); // turning off screensaver
-}
-#endif
-
-void wsSetShape( wsTWindow * win,char * data )
-{
-#ifdef CONFIG_XSHAPE
- if ( !wsUseXShape ) return;
- if ( data )
- {
- win->Mask=XCreateBitmapFromData( wsDisplay,win->WindowID,data,win->Width,win->Height );
- XShapeCombineMask( wsDisplay,win->WindowID,ShapeBounding,0,0,win->Mask,ShapeSet );
- XFreePixmap( wsDisplay,win->Mask );
- }
- else XShapeCombineMask( wsDisplay,win->WindowID,ShapeBounding,0,0,None,ShapeSet );
-#endif
-}
-
-void wsSetIcon( Display * dsp,Window win,Pixmap icon,Pixmap mask )
-{
- XWMHints * wm;
- long data[2];
- Atom iconatom;
-
- wm=XGetWMHints( dsp,win );
- if ( !wm ) wm=XAllocWMHints();
-
- wm->icon_pixmap=icon;
- wm->icon_mask=mask;
- wm->flags|=IconPixmapHint | IconMaskHint;
-
- XSetWMHints( dsp,win,wm );
-
- data[0]=icon;
- data[1]=mask;
- iconatom=XInternAtom( dsp,"KWM_WIN_ICON",0 );
- XChangeProperty( dsp,win,iconatom,iconatom,32,PropModeReplace,(unsigned char *)data,2 );
-
- XFree( wm );
-}
-
-#include "wsmkeys.h"
diff --git a/gui/wm/ws.h b/gui/wm/ws.h
deleted file mode 100644
index 93cc71244d..0000000000
--- a/gui/wm/ws.h
+++ /dev/null
@@ -1,275 +0,0 @@
-/*
- * AutoSpace Window System for Linux/Win32 v0.61
- * written by pontscho/fresh!mindworkz
- *
- * 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_GUI_WS_H
-#define MPLAYER_GUI_WS_H
-
-#include <X11/Xlib.h>
-#include <X11/Xutil.h>
-#include <X11/keysym.h>
-#include <X11/Xatom.h>
-#include <X11/extensions/XShm.h>
-#ifdef CONFIG_XDPMS
-#include <X11/extensions/dpms.h>
-#endif
-
-#define wsKeyReleased 0
-#define wsKeyPressed 1
-
-#define wsShift (1L<<0)
-#define wsLock (1L<<1)
-#define wsCtrl (1L<<2)
-#define wsAlt (1L<<3)
-
-#define wsPLMouseButton 1
-#define wsPMMouseButton 2
-#define wsPRMouseButton 3
-#define wsP4MouseButton 4
-#define wsP5MouseButton 5
-#define wsRLMouseButton (1 + 128)
-#define wsRMMouseButton (2 + 128)
-#define wsRRMouseButton (3 + 128)
-#define wsR4MouseButton (4 + 128)
-#define wsR5MouseButton (5 + 128)
-#define wsEnterWindow 253
-#define wsLeaveWindow 254
-#define wsMoveMouse 255
-
-#define wsShowMouseCursor 1
-#define wsMouse 1
-#define wsHideMouseCursor 0
-#define wsNoMouse 0
-#define wsHandleMouseButton 2
-#define wsHandleMouseMove 4
-
-#define wsHideFrame 0
-#define wsNoFrame 0
-#define wsShowFrame 1
-#define wsFrame 1
-#define wsMaxSize 2
-#define wsMinSize 4
-#define wsShowWindow 8
-#define wsHideWindow 16
-#define wsOverredirect 32
-
-#define wsNoBorder 0
-
-#define wsSysName "AutoSpace Window System LiTe"
-
-#define wsRGB32 1
-#define wsBGR32 2
-#define wsRGB24 3
-#define wsBGR24 4
-#define wsRGB16 5
-#define wsBGR16 6
-#define wsRGB15 7
-#define wsBGR15 8
-
-#define wsWindowVisible 1
-#define wsWindowPartialVisible 2
-#define wsWindowNotVisible 4
-#define wsWindowMapped 8
-#define wsWindowUnmapped 16
-#define wsWindowFocusIn 32
-#define wsWindowFocusOut 64
-#define wsWindowExpose 128
-#define wsWindowRolled 256
-#define wsWindowClosed 512
-
-#define wsNone 0
-#define wsMapped 1
-#define wsFocused 2
-#define wsVisible 3
-#define wsNotVisible 4
-#define wsPVisible 5
-#define wsRolled 6
-
-#define wsWMUnknown 0
-#define wsWMNetWM 1
-#define wsWMKDE 2
-#define wsWMIceWM 3
-#define wsWMWMaker 4
-
-typedef void (*wsTReDraw)( void );
-typedef void (*wsTReSize)( unsigned int X,unsigned int Y,unsigned int width,unsigned int height );
-typedef void (*wsTIdle)( void );
-typedef void (*wsTKeyHandler)( int KeyCode,int Type,int Key );
-typedef void (*wsTMouseHandler)( int Button,int X,int Y,int RX,int RY );
-typedef void (*wsTDNDHandler)( int num,char ** str );
-
-typedef struct
-{
- Window WindowID;
- Window Parent;
- int X,Y,Width,Height;
- int OldX,OldY,OldWidth,OldHeight;
- int MaxX,MaxY;
- int isFullScreen;
- int BorderWidth;
- int Property;
- unsigned char * bImage;
- XImage * xImage;
- Pixmap Mask;
- int Decorations;
-
- int State;
- int Visible;
- int Mapped;
- int Focused;
- int Rolled;
-
- wsTReDraw ReDraw;
- wsTReSize ReSize;
- wsTIdle Idle;
- wsTKeyHandler KeyHandler;
- wsTMouseHandler MouseHandler;
- wsTDNDHandler DandDHandler;
-
- int Alt;
- int Shift;
- int Control;
- int NumLock;
- int CapsLock;
-// --- Misc -------------------------------------------------------------------------------------
-
- Atom AtomDeleteWindow;
- Atom AtomTakeFocus;
- Atom AtomRolle;
- Atom AtomProtocols;
- Atom AtomsProtocols[3];
- Atom AtomLeaderClient;
- Atom AtomRemote;
- Atom AtomWMSizeHint;
- Atom AtomWMNormalHint;
-
- XShmSegmentInfo Shminfo;
- unsigned char * ImageData;
- unsigned short int * ImageDataw;
- unsigned int * ImageDatadw;
- GC wGC;
- XGCValues wGCV;
- unsigned long WindowMask;
- XVisualInfo VisualInfo;
- XSetWindowAttributes WindowAttrib;
- XSizeHints SizeHint;
- XWMHints WMHints;
-
- XFontStruct * Font;
- int FontHeight;
-
- Cursor wsCursor;
- char wsCursorData[1];
- Pixmap wsCursorPixmap;
- int wsMouseEventType;
- XColor wsColor;
-} wsTWindow;
-
-extern int wsMaxX;
-extern int wsMaxY;
-extern int wsOrgX;
-extern int wsOrgY;
-
-extern Display * wsDisplay;
-extern int wsScreen;
-extern Window wsRootWin;
-extern int wsLayer;
-
-extern unsigned char * wsImageData;
-
-extern XEvent wsEvent;
-
-extern int wsDepthOnScreen;
-extern int wsRedMask;
-extern int wsGreenMask;
-extern int wsBlueMask;
-
-extern int wsUseXShm;
-
-// ----------------------------------------------------------------------------------------------
-// wsKeyTable
-// ----------------------------------------------------------------------------------------------
-extern unsigned long wsKeyTable[512];
-
-void wsXDone( void );
-void wsXInit( void* disp );
-
-int wsGetDepthOnScreen( void );
-
-void wsDoExit( void );
-void wsMainLoop( void );
-Bool wsEvents( Display * display, XEvent * Event, XPointer arg );
-void wsHandleEvents( void );
-
-// ----------------------------------------------------------------------------------------------
-// wsCrateWindow: create a new window on the screen.
-// X,Y : window position
-// wX,hY : window size
-// bW : window frame size
-// cV : mouse cursor visible
-// D : "decoration", visible titlebar, etc ...
-// ----------------------------------------------------------------------------------------------
-void wsCreateWindow( wsTWindow * win, int X, int Y, int wX, int hY, int bW, int cV, unsigned char D, char * label );
-void wsDestroyWindow( wsTWindow * win );
-void wsMoveWindow( wsTWindow * win, int b, int x, int y );
-void wsResizeWindow( wsTWindow * win, int sx, int sy );
-void wsIconify( wsTWindow win );
-void wsMoveTopWindow( Display * wsDisplay, Window win );
-void wsSetBackground( wsTWindow * win, int color );
-void wsSetForegroundRGB( wsTWindow * win, int r, int g, int b );
-void wsSetBackgroundRGB( wsTWindow * win, int r, int g, int b );
-#define wsClearWindow( win ) XClearWindow( wsDisplay, win.WindowID )
-void wsSetTitle( wsTWindow * win, char * name );
-void wsVisibleWindow( wsTWindow * win, int show );
-void wsWindowDecoration( wsTWindow * win, long d );
-void wsSetLayer( Display * wsDisplay, Window win, int layer );
-void wsFullScreen( wsTWindow * win );
-void wsPostRedisplay( wsTWindow * win );
-void wsSetShape( wsTWindow * win, char * data );
-void wsSetIcon( Display * dsp, Window win, Pixmap icon, Pixmap mask );
-
-// ----------------------------------------------------------------------------------------------
-// Draw string at x,y with fc ( foreground color ) and bc ( background color ).
-// ----------------------------------------------------------------------------------------------
-void wsDrawString( wsTWindow win, int x, int y, char * str, int fc, int bc );
-int wsTextWidth( wsTWindow win, char * str );
-
-// ----------------------------------------------------------------------------------------------
-// Show / hide mouse cursor.
-// ----------------------------------------------------------------------------------------------
-void wsVisibleMouse( wsTWindow * win, int m );
-void wsSetMousePosition( wsTWindow * win, int x, int y );
-
-// ----------------------------------------------------------------------------------------------
-// Image handling
-// ----------------------------------------------------------------------------------------------
-void wsCreateImage( wsTWindow * win, int Width, int Height );
-void wsConvert( wsTWindow * win, unsigned char * Image, unsigned int Size );
-void wsPutImage( wsTWindow * win );
-void wsResizeImage( wsTWindow * win, int Width, int Height );
-void wsDestroyImage( wsTWindow * win );
-int wsGetOutMask( void );
-
-void wsScreenSaverOn( Display *mDisplay );
-void wsScreenSaverOff( Display * mDisplay );
-
-#define wgIsRect( X,Y,tX,tY,bX,bY ) ( ( (X) > (tX) )&&( (Y) > (tY) )&&( (X) < (bX) )&&( (Y) < (bY) ) )
-
-#endif /* MPLAYER_GUI_WS_H */
diff --git a/gui/wm/wskeys.h b/gui/wm/wskeys.h
deleted file mode 100644
index 4f4a5e50e2..0000000000
--- a/gui/wm/wskeys.h
+++ /dev/null
@@ -1,181 +0,0 @@
-/*
- * 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_GUI_WSKEYS_H
-#define MPLAYER_GUI_WSKEYS_H
-
-#define wsKeyNone -1
-
-#define wsosbrackets '['
-#define wscsbrackets ']'
-
-#define wsq 'q'
-#define wsa 'a'
-#define wsz 'z'
-#define wsw 'w'
-#define wss 's'
-#define wsx 'x'
-#define wse 'e'
-#define wsd 'd'
-#define wsr 'r'
-#define wsf 'f'
-#define wsv 'v'
-#define wst 't'
-#define wsg 'g'
-#define wsb 'b'
-#define wsy 'y'
-#define wsh 'h'
-#define wsn 'n'
-#define wsu 'u'
-#define wsj 'j'
-#define wsm 'm'
-#define wsi 'i'
-#define wsk 'k'
-#define wso 'o'
-#define wsl 'l'
-#define wsp 'p'
-#define wsc 'c'
-
-#define wsQ 'Q'
-#define wsA 'A'
-#define wsZ 'Z'
-#define wsW 'W'
-#define wsS 'S'
-#define wsX 'X'
-#define wsE 'E'
-#define wsD 'D'
-#define wsR 'R'
-#define wsF 'F'
-#define wsV 'V'
-#define wsT 'T'
-#define wsG 'G'
-#define wsB 'B'
-#define wsY 'Y'
-#define wsH 'H'
-#define wsN 'N'
-#define wsU 'U'
-#define wsJ 'J'
-#define wsM 'M'
-#define wsI 'I'
-#define wsK 'K'
-#define wsO 'O'
-#define wsL 'L'
-#define wsP 'P'
-#define wsC 'C'
-
-#define ws0 '0'
-#define ws1 '1'
-#define ws2 '2'
-#define ws3 '3'
-#define ws4 '4'
-#define ws5 '5'
-#define ws6 '6'
-#define ws7 '7'
-#define ws8 '8'
-#define ws9 '9'
-
-#define wsSpace ' '
-#define wsMinus '-'
-#define wsPlus '+'
-#define wsMul '*'
-#define wsDiv '/'
-#define wsLess '<'
-#define wsMore '>'
-
-#define wsUp 0x52 + 256
-#define wsDown 0x54 + 256
-#define wsLeft 0x51 + 256
-#define wsRight 0x53 + 256
-#define wsLeftCtrl 0xe3 + 256
-#define wsRightCtrl 0xe4 + 256
-#define wsLeftAlt 0xe9 + 256
-#define wsRightAlt 0x7e + 256
-#define wsLeftShift 0xe1 + 256
-#define wsRightShift 0xe2 + 256
-#define wsEnter 0x0d + 256
-#define wsBackSpace 0x08 + 256
-#define wsCapsLock 0xe5 + 256
-#define wsTab 0x09 + 256
-#define wsF1 0xbe + 256
-#define wsF2 0xbf + 256
-#define wsF3 0xc0 + 256
-#define wsF4 0xc1 + 256
-#define wsF5 0xc2 + 256
-#define wsF6 0xc3 + 256
-#define wsF7 0xc4 + 256
-#define wsF8 0xc5 + 256
-#define wsF9 0xc6 + 256
-#define wsF10 0xc7 + 256
-#define wsF11 0xc8 + 256
-#define wsF12 0xc9 + 256
-#define wsInsert 0x63 + 256
-#define wsDelete 0xff + 256
-#define wsHome 0x50 + 256
-#define wsEnd 0x57 + 256
-#define wsPageUp 0x55 + 256
-#define wsPageDown 0x56 + 256
-#define wsNumLock 0x7f + 256
-#define wsEscape 0x1b + 256
-#define wsGrayEnter 0x8d + 256
-#define wsGrayPlus 0xab + 256
-#define wsGrayMinus 0xad + 256
-#define wsGrayMul 0xaa + 256
-#define wsGrayDiv 0xaf + 256
-
-#define wsGrayInsert 0xb0 + 256
-#define wsGrayDelete 0xae + 256
-#define wsGrayEnd 0xb1 + 256
-#define wsGrayDown 0xb2 + 256
-#define wsGrayPageDown 0xb3 + 256
-#define wsGrayLeft 0xb4 + 256
-#define wsGray5 0xb5 + 256
-#define wsGrayRight 0xb6 + 256
-#define wsGrayHome 0xb7 + 256
-#define wsGrayUp 0xb8 + 256
-#define wsGrayPageUp 0xb9 + 256
-
-//Keys for multimedia keyboard
-
-#define wsXF86LowerVolume 0x11 + 256
-#define wsXF86RaiseVolume 0x13 + 256
-#define wsXF86Mute 0x12 + 256
-#define wsXF86Play 0x14 + 256
-#define wsXF86Stop 0x15 + 256
-#define wsXF86Prev 0x16 + 256
-#define wsXF86Next 0x17 + 256
-#define wsXF86Media 0x32 + 256
-
-#define wsXFMMPrev 0x98
-#define wsXFMMStop 0xb1
-#define wsXFMMPlay 0x95
-#define wsXFMMNext 0x93
-#define wsXFMMVolUp 0xad
-#define wsXFMMVolDown 0xa6
-#define wsXFMMMute 0x99
-
-#define wsKeyNumber 130
-
-typedef struct
-{
- int code;
- const char * name;
-} TwsKeyNames;
-
-extern const TwsKeyNames wsKeyNames[ wsKeyNumber ];
-
-#endif /* MPLAYER_GUI_WSKEYS_H */
diff --git a/gui/wm/wsmkeys.h b/gui/wm/wsmkeys.h
deleted file mode 100644
index 86bd731369..0000000000
--- a/gui/wm/wsmkeys.h
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * 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_GUI_WSMKEYS_H
-#define MPLAYER_GUI_WSMKEYS_H
-
-#include "wskeys.h"
-
-const TwsKeyNames wsKeyNames[ wsKeyNumber ] =
- {
- { wsq, "q" }, { wsa, "a" }, { wsz, "z" }, { wsw, "w" }, { wss, "s" }, { wsx, "x" },
- { wse, "e" }, { wsd, "d" }, { wsr, "r" }, { wsf, "f" }, { wsv, "v" }, { wst, "t" },
- { wsg, "g" }, { wsb, "b" }, { wsy, "y" }, { wsh, "h" }, { wsn, "n" }, { wsu, "u" },
- { wsj, "j" }, { wsm, "m" }, { wsi, "i" }, { wsk, "k" }, { wso, "o" }, { wsl, "l" },
- { wsp, "p" }, { wsc, "c" },
-
- { wsQ, "Q" }, { wsA, "A" }, { wsZ, "Z" }, { wsW, "W" }, { wsS, "S" }, { wsX, "X" },
- { wsE, "E" }, { wsD, "D" }, { wsR, "R" }, { wsF, "F" }, { wsV, "V" }, { wsT, "T" },
- { wsG, "G" }, { wsB, "B" }, { wsY, "Y" }, { wsH, "H" }, { wsN, "N" }, { wsU, "U" },
- { wsJ, "J" }, { wsM, "M" }, { wsI, "I" }, { wsK, "K" }, { wsO, "O" }, { wsL, "L" },
- { wsP, "P" }, { wsC, "C" },
-
- { wsUp, "Up" }, { wsDown, "Down" }, { wsLeft, "Left" },
- { wsRight, "Right" }, { wsPageUp, "PageUp" }, { wsPageDown, "PageDown" },
-
- { wsLeftCtrl, "LeftCtrl" }, { wsRightCtrl, "RightCtrl" }, { wsLeftAlt, "LeftAlt" },
- { wsRightAlt, "RightAlt" }, { wsLeftShift, "LeftShift" }, { wsRightShift, "RightShift" },
-
-
- { wsBackSpace, "BackSpace" },
- { wsCapsLock, "CapsLock" },
- { wsNumLock, "NumLock" },
-
- { wsF1, "F1" }, { wsF2, "F2" }, { wsF3, "F3" }, { wsF4, "F4" }, { wsF5, "F5" },
- { wsF6, "F6" }, { wsF7, "F7" }, { wsF8, "F8" }, { wsF9, "F9" }, { wsF10, "F10" },
- { wsF11, "F11" }, { wsF12, "F12" },
-
- { wsEnter, "Enter" }, { wsTab, "Tab" }, { wsSpace, "Space" },
- { wsInsert, "Insert" }, { wsDelete, "Delete" }, { wsHome, "Home" },
- { wsEnd, "End" }, { wsEscape, "Escape" },
-
- { wsosbrackets, "[" }, { wscsbrackets, "]" },
- { wsMore, "<" }, { wsLess, ">" },
- { wsMinus, "-" }, { wsPlus, "+" },
- { wsMul, "*" }, { wsDiv, "/" },
-
- { ws0, "0" }, { ws1, "1" }, { ws2, "2" }, { ws3, "3" }, { ws4, "4" },
- { ws5, "5" }, { ws6, "6" }, { ws7, "7" }, { ws8, "8" }, { ws9, "9" },
-
- { wsGrayEnter, "GrayEnter" }, { wsGrayPlus, "GrayPlus" },
- { wsGrayMinus, "GrayMinus" }, { wsGrayMul, "GrayMul" },
- { wsGrayDiv, "GrayDiv" }, { wsGrayInsert, "GrayInsert" },
- { wsGrayDelete, "GrayDelete" }, { wsGrayEnd, "GrayEnd" },
- { wsGrayDown, "GrayDown" }, { wsGrayPageDown, "GrayPageDown" },
- { wsGrayLeft, "GrayLeft" }, { wsGray5, "Gray5" },
- { wsGrayRight, "GrayRight" }, { wsGrayHome, "GrayHome" },
- { wsGrayUp, "GrayUp" }, { wsGrayPageUp, "GrayPageUp" },
-
- { wsXF86LowerVolume, "XF86LowerVolume" },
- { wsXF86RaiseVolume, "XF86RaiseVolume" },
- { wsXF86Mute, "XF86Mute" },
- { wsXF86Play, "XF86Play" },
- { wsXF86Stop, "XF86Stop" },
- { wsXF86Prev, "XF86Prev" },
- { wsXF86Next, "XF86Next" },
- { wsXF86Media, "XF86Media" },
-
- { wsKeyNone, "None" }
- };
-
-#endif /* MPLAYER_GUI_WSMKEYS_H */
diff --git a/gui/wm/wsxdnd.c b/gui/wm/wsxdnd.c
deleted file mode 100644
index d06e295b60..0000000000
--- a/gui/wm/wsxdnd.c
+++ /dev/null
@@ -1,259 +0,0 @@
-/*
- * WindowMaker implementation adopted for MPlayer
- *
- * 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.
- */
-
-#include <X11/Xlib.h>
-#include "ws.h"
-#include "wsxdnd.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include <X11/Xatom.h>
-
-#include "mp_msg.h"
-#include "help_mp.h"
-
-#define XDND_VERSION 3L
-
-Atom XA_XdndAware;
-Atom XA_XdndEnter;
-Atom XA_XdndLeave;
-Atom XA_XdndDrop;
-Atom XA_XdndPosition;
-Atom XA_XdndStatus;
-Atom XA_XdndActionCopy;
-Atom XA_XdndSelection;
-Atom XA_XdndFinished;
-Atom XA_XdndTypeList;
-
-Atom atom_support;
-
-void wsXDNDInitialize(void)
-{
-
- XA_XdndAware = XInternAtom(wsDisplay, "XdndAware", False);
- XA_XdndEnter = XInternAtom(wsDisplay, "XdndEnter", False);
- XA_XdndLeave = XInternAtom(wsDisplay, "XdndLeave", False);
- XA_XdndDrop = XInternAtom(wsDisplay, "XdndDrop", False);
- XA_XdndPosition = XInternAtom(wsDisplay, "XdndPosition", False);
- XA_XdndStatus = XInternAtom(wsDisplay, "XdndStatus", False);
- XA_XdndActionCopy = XInternAtom(wsDisplay, "XdndActionCopy", False);
- XA_XdndSelection = XInternAtom(wsDisplay, "XdndSelection", False);
- XA_XdndFinished = XInternAtom(wsDisplay, "XdndFinished", False);
- XA_XdndTypeList = XInternAtom(wsDisplay, "XdndTypeList", False);
-}
-
-void wsXDNDMakeAwareness(wsTWindow* window) {
- long int xdnd_version = XDND_VERSION;
- XChangeProperty (wsDisplay, window->WindowID, XA_XdndAware, XA_ATOM,
- 32, PropModeAppend, (char *)&xdnd_version, 1);
-}
-
-void wsXDNDClearAwareness(wsTWindow* window) {
- XDeleteProperty (wsDisplay, window->WindowID, XA_XdndAware);
-}
-
-#define MAX_DND_FILES 64
-Bool
-wsXDNDProcessSelection(wsTWindow* wnd, XEvent *event)
-{
- Atom ret_type;
- int ret_format;
- unsigned long ret_items;
- unsigned long remain_byte;
- char * delme;
- XEvent xevent;
-
- Window selowner = XGetSelectionOwner(wsDisplay,XA_XdndSelection);
-
- XGetWindowProperty(wsDisplay, event->xselection.requestor,
- event->xselection.property,
- 0, 65536, True, atom_support, &ret_type, &ret_format,
- &ret_items, &remain_byte, (unsigned char **)&delme);
-
- /*send finished*/
- memset (&xevent, 0, sizeof(xevent));
- xevent.xany.type = ClientMessage;
- xevent.xany.display = wsDisplay;
- xevent.xclient.window = selowner;
- xevent.xclient.message_type = XA_XdndFinished;
- xevent.xclient.format = 32;
- XDND_FINISHED_TARGET_WIN(&xevent) = wnd->WindowID;
- XSendEvent(wsDisplay, selowner, 0, 0, &xevent);
-
- if (!delme){
- mp_msg( MSGT_GPLAYER,MSGL_WARN,MSGTR_WS_DDNothing );
- return False;
- }
-
- {
- /* Handle dropped files */
- char * retain = delme;
- char * files[MAX_DND_FILES];
- int num = 0;
-
- while(retain < delme + ret_items) {
- if (!strncmp(retain,"file:",5)) {
- /* add more 2 chars while removing 5 is harmless */
- retain+=5;
- }
-
- /* add the "retain" to the list */
- files[num++]=retain;
-
-
- /* now check for special characters */
- {
- int newone = 0;
- while(retain < (delme + ret_items)){
- if(*retain == '\r' || *retain == '\n'){
- *retain=0;
- newone = 1;
- } else {
- if (newone)
- break;
- }
- retain++;
- }
- }
-
- if (num >= MAX_DND_FILES)
- break;
- }
-
- /* Handle the files */
- if(wnd->DandDHandler){
- wnd->DandDHandler(num,files);
- }
- }
-
- free(delme);
- return True;
-}
-
-Bool
-wsXDNDProcessClientMessage(wsTWindow* wnd, XClientMessageEvent *event)
-{
- /* test */
- /*{
- char * name = XGetAtomName(wsDisplay, event->message_type);
- printf("Got %s\n",name);
- XFree(name);
- }*/
-
- if (event->message_type == XA_XdndEnter) {
- Atom ok = XInternAtom(wsDisplay, "text/uri-list", False);
- atom_support = None;
- if ((event->data.l[1] & 1) == 0){
- int index;
- for(index = 0; index <= 2 ; index++){
- if (event->data.l[2+index] == ok) {
- atom_support = ok;
- }
- }
- if (atom_support == None) {
- mp_msg( MSGT_GPLAYER,MSGL_WARN,MSGTR_WS_NotAFile );
- }
- } else {
- /* need to check the whole list here */
- unsigned long ret_left = 1;
- int offset = 0;
- Atom* ret_buff;
- Atom ret_type;
- int ret_format;
- unsigned long ret_items;
-
- /* while there is data left...*/
- while(ret_left && atom_support == None){
- XGetWindowProperty(wsDisplay,event->data.l[0],XA_XdndTypeList,
- offset,256,False,XA_ATOM,&ret_type,
- &ret_format,&ret_items,&ret_left,
- (unsigned char**)&ret_buff);
-
- /* sanity checks...*/
- if(ret_buff == NULL || ret_type != XA_ATOM || ret_format != 8*sizeof(Atom)){
- XFree(ret_buff);
- break;
- }
- /* now chek what we've got */
- {
- int i;
- for(i=0; i<ret_items; i++){
- if(ret_buff[i] == ok){
- atom_support = ok;
- break;
- }
- }
- }
- /* maybe next time ... */
- XFree(ret_buff);
- offset += 256;
- }
- }
- return True;
- }
-
- if (event->message_type == XA_XdndLeave) {
- return True;
- }
-
- if (event->message_type == XA_XdndDrop) {
- if (event->data.l[0] != XGetSelectionOwner(wsDisplay, XA_XdndSelection)){
- puts("Wierd selection owner... QT?");
- }
- if (atom_support != None) {
- XConvertSelection(wsDisplay, XA_XdndSelection, atom_support,
- XA_XdndSelection, event->window,
- CurrentTime);
- }
- return True;
- }
-
- if (event->message_type == XA_XdndPosition) {
- Window srcwin = event->data.l[0];
- if (atom_support == None){
- return True;
- }
-
- /* send response */
- {
- XEvent xevent;
- memset (&xevent, 0, sizeof(xevent));
- xevent.xany.type = ClientMessage;
- xevent.xany.display = wsDisplay;
- xevent.xclient.window = srcwin;
- xevent.xclient.message_type = XA_XdndStatus;
- xevent.xclient.format = 32;
-
- XDND_STATUS_TARGET_WIN (&xevent) = event->window;
- XDND_STATUS_WILL_ACCEPT_SET (&xevent, True);
- XDND_STATUS_WANT_POSITION_SET(&xevent, True);
- /* actually need smth real here */
- XDND_STATUS_RECT_SET(&xevent, 0, 0, 1024,768);
- XDND_STATUS_ACTION(&xevent) = XA_XdndActionCopy;
-
- XSendEvent(wsDisplay, srcwin, 0, 0, &xevent);
- }
- return True;
- }
-
- return False;
-}
diff --git a/gui/wm/wsxdnd.h b/gui/wm/wsxdnd.h
deleted file mode 100644
index 9213c60a39..0000000000
--- a/gui/wm/wsxdnd.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * 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_GUI_WSXDND_H
-#define MPLAYER_GUI_WSXDND_H
-
-#include "ws.h"
-
-void wsXDNDInitialize(void);
-Bool wsXDNDProcessSelection(wsTWindow* wnd,XEvent *event);
-Bool wsXDNDProcessClientMessage(wsTWindow* wnd, XClientMessageEvent *event);
-void wsXDNDMakeAwareness(wsTWindow* window);
-void wsXDNDClearAwareness(wsTWindow* window);
-
-/* header was ripped from xdnd's example on its page */
-
-#define XDND_THREE 3
-#define XDND_ENTER_SOURCE_WIN(e) ((e)->xclient.data.l[0])
-#define XDND_ENTER_THREE_TYPES(e) (((e)->xclient.data.l[1] & 0x1UL) == 0)
-#define XDND_ENTER_THREE_TYPES_SET(e,b) (e)->xclient.data.l[1] = ((e)->xclient.data.l[1] & ~0x1UL) | (((b) == 0) ? 0 : 0x1UL)
-#define XDND_ENTER_VERSION(e) ((e)->xclient.data.l[1] >> 24)
-#define XDND_ENTER_VERSION_SET(e,v) (e)->xclient.data.l[1] = ((e)->xclient.data.l[1] & ~(0xFF << 24)) | ((v) << 24)
-#define XDND_ENTER_TYPE(e,i) ((e)->xclient.data.l[2 + (i)]) /* i => (0, 1, 2) */
-
-/* XdndPosition */
-#define XDND_POSITION_SOURCE_WIN(e) ((e)->xclient.data.l[0])
-#define XDND_POSITION_ROOT_X(e) ((e)->xclient.data.l[2] >> 16)
-#define XDND_POSITION_ROOT_Y(e) ((e)->xclient.data.l[2] & 0xFFFFUL)
-#define XDND_POSITION_ROOT_SET(e,x,y) (e)->xclient.data.l[2] = ((x) << 16) | ((y) & 0xFFFFUL)
-#define XDND_POSITION_TIME(e) ((e)->xclient.data.l[3])
-#define XDND_POSITION_ACTION(e) ((e)->xclient.data.l[4])
-
-/* XdndStatus */
-#define XDND_STATUS_TARGET_WIN(e) ((e)->xclient.data.l[0])
-#define XDND_STATUS_WILL_ACCEPT(e) ((e)->xclient.data.l[1] & 0x1L)
-#define XDND_STATUS_WILL_ACCEPT_SET(e,b) (e)->xclient.data.l[1] = ((e)->xclient.data.l[1] & ~0x1UL) | (((b) == 0) ? 0 : 0x1UL)
-#define XDND_STATUS_WANT_POSITION(e) ((e)->xclient.data.l[1] & 0x2UL)
-#define XDND_STATUS_WANT_POSITION_SET(e,b) (e)->xclient.data.l[1] = ((e)->xclient.data.l[1] & ~0x2UL) | (((b) == 0) ? 0 : 0x2UL)
-#define XDND_STATUS_RECT_X(e) ((e)->xclient.data.l[2] >> 16)
-#define XDND_STATUS_RECT_Y(e) ((e)->xclient.data.l[2] & 0xFFFFL)
-#define XDND_STATUS_RECT_WIDTH(e) ((e)->xclient.data.l[3] >> 16)
-#define XDND_STATUS_RECT_HEIGHT(e) ((e)->xclient.data.l[3] & 0xFFFFL)
-#define XDND_STATUS_RECT_SET(e,x,y,w,h) {(e)->xclient.data.l[2] = ((x) << 16) | ((y) & 0xFFFFUL); (e)->xclient.data.l[3] = ((w) << 16) | ((h) & 0xFFFFUL); }
-#define XDND_STATUS_ACTION(e) ((e)->xclient.data.l[4])
-
-/* XdndLeave */
-#define XDND_LEAVE_SOURCE_WIN(e) ((e)->xclient.data.l[0])
-
-/* XdndDrop */
-#define XDND_DROP_SOURCE_WIN(e) ((e)->xclient.data.l[0])
-#define XDND_DROP_TIME(e) ((e)->xclient.data.l[2])
-
-/* XdndFinished */
-#define XDND_FINISHED_TARGET_WIN(e) ((e)->xclient.data.l[0])
-
-#endif /* MPLAYER_GUI_WSXDND_H */
diff --git a/help/help_mp-en.h b/help/help_mp-en.h
index 5d9413fa33..2376bdefa7 100644
--- a/help/help_mp-en.h
+++ b/help/help_mp-en.h
@@ -1153,7 +1153,6 @@ static const char help_text[]=
// ======================= audio output drivers ========================
// audio_out.c
-#define MSGTR_AO_ALSA9_1x_Removed "audio_out: alsa9 and alsa1x modules were removed, use -ao alsa instead.\n"
#define MSGTR_AO_TryingPreferredAudioDriver "Trying preferred audio driver '%.*s', options '%s'\n"
#define MSGTR_AO_NoSuchDriver "No such audio driver '%.*s'\n"
#define MSGTR_AO_FailedInit "Failed to initialize audio driver '%s'\n"
diff --git a/help/help_mp-es.h b/help/help_mp-es.h
index 7cad6e12bd..59298c1e39 100644
--- a/help/help_mp-es.h
+++ b/help/help_mp-es.h
@@ -2128,4 +2128,3 @@ static const char help_text[]=
#define MSGTR_LIBASS_ErrorOpeningMemoryFont "[ass] Error abriendo la fuente en memoria: %s\n"
#define MSGTR_LIBASS_NoCharmaps "[ass] Este font face no tiene charmaps\n"
#define MSGTR_LIBASS_NoCharmapAutodetected "[ass] No se detectó un charmap automaticamente, probando con el primero\n"
-
diff --git a/help/help_mp-hu.h b/help/help_mp-hu.h
index 89112b9751..5a3735d188 100644
--- a/help/help_mp-hu.h
+++ b/help/help_mp-hu.h
@@ -2114,4 +2114,3 @@ static const char help_text[]=
// url.c
#define MSGTR_MPDEMUX_URL_StringAlreadyEscaped "A karakterlánc már escape-ltnek tűnik az url_escape-ben %c%c1%c2\n"
-
diff --git a/help/help_mp-pl.h b/help/help_mp-pl.h
index a0f291a676..3df81430c9 100644
--- a/help/help_mp-pl.h
+++ b/help/help_mp-pl.h
@@ -1837,4 +1837,3 @@ static const char help_text[]=
#define MSGTR_RADIO_DriverUnknownStr "[radio] Nieznana nazwa sterownika: %s\n"
#define MSGTR_RADIO_DriverV4L2 "[radio] Używam interfejsu radiowego V4Lv2.\n"
#define MSGTR_RADIO_DriverV4L "[radio] Używam interfejsu radiowego V4Lv1.\n"
-
diff --git a/help/help_mp-sk.h b/help/help_mp-sk.h
index c623232d13..2bf4891fee 100644
--- a/help/help_mp-sk.h
+++ b/help/help_mp-sk.h
@@ -910,4 +910,3 @@ static const char help_text[]=
#define MSGTR_MSGBOX_LABEL_Warning "Upozornenie!"
#endif
-
diff --git a/help/help_mp-sv.h b/help/help_mp-sv.h
index c870604d95..ca1fd239e2 100644
--- a/help/help_mp-sv.h
+++ b/help/help_mp-sv.h
@@ -952,4 +952,3 @@ static const char help_text[]=
// ao_plugin.c
#define MSGTR_AO_PLUGIN_InvalidPlugin "[AO PLUGIN] icke godkänd plugin: %s\n" // FIXME plugin - translate?
-
diff --git a/help/help_mp-uk.h b/help/help_mp-uk.h
index cc6f5caecc..afd3def1fe 100644
--- a/help/help_mp-uk.h
+++ b/help/help_mp-uk.h
@@ -1182,4 +1182,3 @@ static const char help_text[]=
#define MSGTR_CouldNotFindColorspace "Ðе можу підібрати підходÑщу Ñхему кольорів - повтор з -vf scale...\n"
#define MSGTR_MovieAspectIsSet "Ð’Ñ–Ð´Ð½Ð¾ÑˆÐµÐ½Ð½Ñ Ñторін %.2f:1 - маÑштабую аби Ñкоректувати.\n"
#define MSGTR_MovieAspectUndefined "Ð’Ñ–Ð´Ð½Ð¾ÑˆÐµÐ½Ð½Ñ Ñторін не вказано - маÑÑˆÑ‚Ð°Ð±ÑƒÐ²Ð°Ð½Ð½Ñ Ð½Ðµ викориÑтовуєтьÑÑ.\n"
-
diff --git a/input/appleir.c b/input/appleir.c
index 07a9c5b797..5e4bc148c6 100644
--- a/input/appleir.c
+++ b/input/appleir.c
@@ -79,12 +79,12 @@ int mp_input_appleir_init (char *dev)
if (dev)
{
- mp_msg (MSGT_INPUT, MSGL_V, MSGTR_INPUT_APPLE_IR_Init, dev);
+ mp_tmsg (MSGT_INPUT, MSGL_V, "Initializing Apple IR on %s\n", dev);
fd = open (dev, O_RDONLY | O_NONBLOCK);
if (fd < 0)
{
- mp_msg (MSGT_INPUT, MSGL_ERR,
- MSGTR_INPUT_APPLE_IR_CantOpen, strerror (errno));
+ mp_tmsg (MSGT_INPUT, MSGL_ERR,
+ "Can't open Apple IR device: %s\n", strerror (errno));
return -1;
}
@@ -108,20 +108,20 @@ int mp_input_appleir_init (char *dev)
id.vendor == USB_VENDOR_APPLE &&
(id.product == USB_DEV_APPLE_IR ||id.product == USB_DEV_APPLE_IR_2))
{
- mp_msg (MSGT_INPUT, MSGL_V, MSGTR_INPUT_APPLE_IR_Detect, file);
+ mp_tmsg (MSGT_INPUT, MSGL_V, "Detected Apple IR on %s\n", file);
return fd;
}
close (fd);
}
- mp_msg (MSGT_INPUT, MSGL_ERR,
- MSGTR_INPUT_APPLE_IR_CantOpen, strerror (errno));
+ mp_tmsg (MSGT_INPUT, MSGL_ERR,
+ "Can't open Apple IR device: %s\n", strerror (errno));
}
return -1;
}
-int mp_input_appleir_read (int fd)
+int mp_input_appleir_read(void *ctx, int fd)
{
struct input_event ev;
int i, r;
diff --git a/input/ar.c b/input/ar.c
index e64c64d45b..0827b8be83 100644
--- a/input/ar.c
+++ b/input/ar.c
@@ -321,7 +321,7 @@ int is_mplayer_front(void)
return 0;
}
-int mp_input_ar_read(int fd)
+int mp_input_ar_read(void *ctx, int fd)
{
int i, down = 0;
int ret = MP_INPUT_NOTHING;
@@ -445,7 +445,7 @@ int main(void)
}
while (1) {
- switch ((ret = mp_input_ar_read(0)) & ~MP_KEY_DOWN) {
+ switch ((ret = mp_input_ar_read(NULL, 0)) & ~MP_KEY_DOWN) {
case AR_PLAY: printf(" - AR_PLAY."); break;
case AR_PLAY_HOLD: printf(" - AR_PLAY_HOLD."); break;
case AR_NEXT: printf(" - AR_NEXT."); break;
diff --git a/input/ar.h b/input/ar.h
index 31bbd0ade9..12944f84e1 100644
--- a/input/ar.h
+++ b/input/ar.h
@@ -37,11 +37,11 @@
/* MacOSX Driver */
int mp_input_ar_init(void);
-int mp_input_ar_read(int fd);
+int mp_input_ar_read(void *ctx, int fd);
void mp_input_ar_close(int fd);
/* Linux Driver */
int mp_input_appleir_init(char* dev);
-int mp_input_appleir_read(int fd);
+int mp_input_appleir_read(void *ctx, int fd);
#endif /* MPLAYER_AR_H */
diff --git a/input/input.c b/input/input.c
index b8ccca308d..c5d93a5f17 100644
--- a/input/input.c
+++ b/input/input.c
@@ -21,6 +21,7 @@
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
+#include <stdbool.h>
#include <unistd.h>
#include <errno.h>
#include <sys/types.h>
@@ -35,7 +36,6 @@
#include <assert.h>
#endif
#include "mp_fifo.h"
-#include "osdep/getch2.h"
#include "osdep/keycodes.h"
#include "osdep/timer.h"
#include "libavutil/avstring.h"
@@ -44,6 +44,8 @@
#include "m_config.h"
#include "m_option.h"
#include "get_path.h"
+#include "talloc.h"
+#include "options.h"
#include "joystick.h"
@@ -57,6 +59,16 @@
#include "ar.h"
+typedef struct mp_cmd_bind {
+ int input[MP_MAX_KEY_DOWN+1];
+ char* cmd;
+} mp_cmd_bind_t;
+
+typedef struct mp_key_name {
+ int key;
+ char* name;
+} mp_key_name_t;
+
/// This array defines all known commands.
/// The first field is an id used to recognize the command without too many strcmp.
/// The second is obviously the command name.
@@ -175,17 +187,6 @@ static const mp_cmd_t mp_cmds[] = {
{ MP_CMD_TV_TELETEXT_ADD_DEC, "teletext_add_dec", 1, { {MP_CMD_ARG_STRING,{0}}, {-1,{0}} } },
{ MP_CMD_TV_TELETEXT_GO_LINK, "teletext_go_link", 1, { {MP_CMD_ARG_INT,{0}}, {-1,{0}} } },
-#ifdef CONFIG_GUI
- { MP_CMD_GUI_LOADFILE, "gui_loadfile", 0, { {-1,{0}} } },
- { MP_CMD_GUI_LOADSUBTITLE, "gui_loadsubtitle", 0, { {-1,{0}} } },
- { MP_CMD_GUI_ABOUT, "gui_about", 0, { {-1,{0}} } },
- { MP_CMD_GUI_PLAY, "gui_play", 0, { {-1,{0}} } },
- { MP_CMD_GUI_STOP, "gui_stop", 0, { {-1,{0}} } },
- { MP_CMD_GUI_PLAYLIST, "gui_playlist", 0, { {-1,{0}} } },
- { MP_CMD_GUI_PREFERENCES, "gui_preferences", 0, { {-1,{0}} } },
- { MP_CMD_GUI_SKINBROWSER, "gui_skinbrowser", 0, { {-1,{0}} } },
-#endif
-
#ifdef CONFIG_DVDNAV
{ MP_CMD_DVDNAV, "dvdnav", 1, { {MP_CMD_ARG_STRING, {0}}, {-1,{0}} } },
#endif
@@ -202,8 +203,10 @@ static const mp_cmd_t mp_cmds[] = {
{ MP_CMD_GET_SUB_VISIBILITY, "get_sub_visibility", 0, { {-1,{0}} } },
{ MP_CMD_KEYDOWN_EVENTS, "key_down_event", 1, { {MP_CMD_ARG_INT,{0}}, {-1,{0}} } },
{ MP_CMD_SET_PROPERTY, "set_property", 2, { {MP_CMD_ARG_STRING, {0}}, {MP_CMD_ARG_STRING, {0}}, {-1,{0}} } },
+ { MP_CMD_SET_PROPERTY_OSD, "set_property_osd", 2, { {MP_CMD_ARG_STRING, {0}}, {MP_CMD_ARG_STRING, {0}}, {-1,{0}} } },
{ MP_CMD_GET_PROPERTY, "get_property", 1, { {MP_CMD_ARG_STRING, {0}}, {-1,{0}} } },
{ MP_CMD_STEP_PROPERTY, "step_property", 1, { {MP_CMD_ARG_STRING, {0}}, {MP_CMD_ARG_FLOAT,{0}}, {MP_CMD_ARG_INT,{0}}, {-1,{0}} } },
+ { MP_CMD_STEP_PROPERTY_OSD, "step_property_osd", 1, { {MP_CMD_ARG_STRING, {0}}, {MP_CMD_ARG_FLOAT,{0}}, {MP_CMD_ARG_INT,{0}}, {-1,{0}} } },
{ MP_CMD_SEEK_CHAPTER, "seek_chapter", 1, { {MP_CMD_ARG_INT,{0}}, {MP_CMD_ARG_INT,{0}}, {-1,{0}} } },
{ MP_CMD_SET_MOUSE_POS, "set_mouse_pos", 2, { {MP_CMD_ARG_INT,{0}}, {MP_CMD_ARG_INT,{0}}, {-1,{0}} } },
@@ -420,7 +423,8 @@ static const mp_cmd_bind_t def_cmd_binds[] = {
{ { '7', 0 }, "saturation -1" },
{ { '8', 0 }, "saturation 1" },
{ { 'd', 0 }, "frame_drop" },
- { { 'D', 0 }, "step_property deinterlace" },
+ { { 'D', 0 }, "step_property_osd deinterlace" },
+ { { 'c', 0 }, "step_property_osd yuv_colorspace" },
{ { 'r', 0 }, "sub_pos -1" },
{ { 't', 0 }, "sub_pos +1" },
{ { 'a', 0 }, "sub_alignment" },
@@ -494,21 +498,6 @@ static const mp_cmd_bind_t def_cmd_binds[] = {
};
-#ifdef CONFIG_GUI
-static const mp_cmd_bind_t gui_def_cmd_binds[] = {
-
- { { 'l', 0 }, "gui_loadfile" },
- { { 't', 0 }, "gui_loadsubtitle" },
- { { KEY_ENTER, 0 }, "gui_play" },
- { { KEY_ESC, 0 }, "gui_stop" },
- { { 'p', 0 }, "gui_playlist" },
- { { 'r', 0 }, "gui_preferences" },
- { { 'c', 0 }, "gui_skinbrowser" },
-
- { { 0 }, NULL }
-};
-#endif
-
#ifndef MP_MAX_KEY_FD
#define MP_MAX_KEY_FD 10
#endif
@@ -521,40 +510,72 @@ static const mp_cmd_bind_t gui_def_cmd_binds[] = {
typedef struct mp_input_fd {
int fd;
- void* read_func;
+ union {
+ mp_key_func_t key;
+ mp_cmd_func_t cmd;
+ } read_func;
mp_close_func_t close_func;
+ void *ctx;
unsigned eof : 1;
unsigned drop : 1;
unsigned dead : 1;
unsigned got_cmd : 1;
unsigned no_select : 1;
- unsigned no_readfunc_retval : 1;
// These fields are for the cmd fds.
char* buffer;
int pos,size;
} mp_input_fd_t;
-typedef struct mp_cmd_filter_st mp_cmd_filter_t;
+typedef struct mp_cmd_filter mp_cmd_filter_t;
-struct mp_cmd_filter_st {
+struct mp_cmd_filter {
mp_input_cmd_filter filter;
void* ctx;
mp_cmd_filter_t* next;
};
-typedef struct mp_cmd_bind_section_st mp_cmd_bind_section_t;
+typedef struct mp_cmd_bind_section mp_cmd_bind_section_t;
-struct mp_cmd_bind_section_st {
+struct mp_cmd_bind_section {
mp_cmd_bind_t* cmd_binds;
char* section;
mp_cmd_bind_section_t* next;
};
-// These are the user defined binds
-static mp_cmd_bind_section_t* cmd_binds_section = NULL;
-static char* section = NULL;
-static mp_cmd_bind_t* cmd_binds = NULL;
-static mp_cmd_bind_t* cmd_binds_default = NULL;
+struct input_ctx {
+ // Autorepeat stuff
+ short ar_state;
+ mp_cmd_t *ar_cmd;
+ unsigned int last_ar;
+ // Autorepeat config
+ unsigned int ar_delay;
+ unsigned int ar_rate;
+
+ // these are the keys currently down
+ int key_down[MP_MAX_KEY_DOWN];
+ unsigned int num_key_down;
+ unsigned int last_key_down;
+
+ bool default_bindings;
+ // List of command binding sections
+ mp_cmd_bind_section_t *cmd_bind_sections;
+ // Name of currently used command section
+ char *section;
+ // The command binds of current section
+ mp_cmd_bind_t *cmd_binds;
+ mp_cmd_bind_t *cmd_binds_default;
+
+ mp_input_fd_t key_fds[MP_MAX_KEY_FD];
+ unsigned int num_key_fd;
+
+ mp_input_fd_t cmd_fds[MP_MAX_CMD_FD];
+ unsigned int num_cmd_fd;
+
+ mp_cmd_t *cmd_queue[CMD_QUEUE_SIZE];
+ unsigned int cmd_queue_length, cmd_queue_start, cmd_queue_end;
+};
+
+
static mp_cmd_filter_t* cmd_filters = NULL;
// Callback to allow the menu filter to grab the incoming keys
@@ -562,81 +583,47 @@ int (*mp_input_key_cb)(int code) = NULL;
int async_quit_request;
-static mp_input_fd_t key_fds[MP_MAX_KEY_FD];
-static unsigned int num_key_fd = 0;
-static mp_input_fd_t cmd_fds[MP_MAX_CMD_FD];
-static unsigned int num_cmd_fd = 0;
-static mp_cmd_t* cmd_queue[CMD_QUEUE_SIZE];
-static unsigned int cmd_queue_length = 0,cmd_queue_start = 0, cmd_queue_end = 0;
-
-// this is the key currently down
-static int key_down[MP_MAX_KEY_DOWN];
-static unsigned int num_key_down = 0, last_key_down = 0;
-
-// Autorepeat stuff
-static short ar_state = -1;
-static mp_cmd_t* ar_cmd = NULL;
-static unsigned int ar_delay = 100, ar_rate = 8, last_ar = 0;
-
-static int use_joystick = 1, use_lirc = 1, use_lircc = 1;
-static int default_bindings = 1;
-static char* config_file = "input.conf";
-
-/* Apple Remote */
-#ifdef CONFIG_APPLE_REMOTE
-static int use_ar = 1;
-#else
-static int use_ar = 0;
-#endif
-
-static char* js_dev = NULL;
-static char* ar_dev = NULL;
-
-static char* in_file = NULL;
-static int in_file_fd = -1;
-
-static int mp_input_print_key_list(m_option_t* cfg);
-static int mp_input_print_cmd_list(m_option_t* cfg);
+static int print_key_list(m_option_t* cfg);
+static int print_cmd_list(m_option_t* cfg);
// Our command line options
-static m_option_t input_conf[] = {
- { "conf", &config_file, CONF_TYPE_STRING, CONF_GLOBAL, 0, 0, NULL },
- { "ar-dev", &ar_dev, CONF_TYPE_STRING, CONF_GLOBAL, 0, 0, NULL },
- { "ar-delay", &ar_delay, CONF_TYPE_INT, CONF_GLOBAL, 0, 0, NULL },
- { "ar-rate", &ar_rate, CONF_TYPE_INT, CONF_GLOBAL, 0, 0, NULL },
- { "keylist", mp_input_print_key_list, CONF_TYPE_FUNC, CONF_GLOBAL, 0, 0, NULL },
- { "cmdlist", mp_input_print_cmd_list, CONF_TYPE_FUNC, CONF_GLOBAL, 0, 0, NULL },
- { "js-dev", &js_dev, CONF_TYPE_STRING, CONF_GLOBAL, 0, 0, NULL },
- { "file", &in_file, CONF_TYPE_STRING, CONF_GLOBAL, 0, 0, NULL },
- { "default-bindings", &default_bindings, CONF_TYPE_FLAG, CONF_GLOBAL, 0, 1, NULL },
- { "nodefault-bindings", &default_bindings, CONF_TYPE_FLAG, CONF_GLOBAL, 1, 0, NULL },
+static const m_option_t input_conf[] = {
+ OPT_STRING("conf", input.config_file, CONF_GLOBAL),
+ OPT_INT("ar-delay",input.ar_delay, CONF_GLOBAL),
+ OPT_INT("ar-rate", input.ar_rate, CONF_GLOBAL),
+ { "keylist", print_key_list, CONF_TYPE_FUNC, CONF_GLOBAL, 0, 0, NULL },
+ { "cmdlist", print_cmd_list, CONF_TYPE_FUNC, CONF_GLOBAL, 0, 0, NULL },
+ OPT_STRING("js-dev", input.js_dev, CONF_GLOBAL),
+ OPT_STRING("ar-dev", input.ar_dev, CONF_GLOBAL),
+ OPT_STRING("file", input.in_file, CONF_GLOBAL),
+ OPT_FLAG_ON("default-bindings", input.default_bindings, CONF_GLOBAL),
+ OPT_FLAG_OFF("nodefault-bindings", input.default_bindings, CONF_GLOBAL),
{ NULL, NULL, 0, 0, 0, 0, NULL}
};
-static m_option_t mp_input_opts[] = {
+static const m_option_t mp_input_opts[] = {
{ "input", &input_conf, CONF_TYPE_SUBCONFIG, 0, 0, 0, NULL},
- { "nojoystick", &use_joystick, CONF_TYPE_FLAG, CONF_GLOBAL, 1, 0, NULL },
- { "joystick", &use_joystick, CONF_TYPE_FLAG, CONF_GLOBAL, 0, 1, NULL },
- { "nolirc", &use_lirc, CONF_TYPE_FLAG, CONF_GLOBAL, 1, 0, NULL },
- { "lirc", &use_lirc, CONF_TYPE_FLAG, CONF_GLOBAL, 0, 1, NULL },
- { "nolircc", &use_lircc, CONF_TYPE_FLAG, CONF_GLOBAL, 1, 0, NULL },
- { "lircc", &use_lircc, CONF_TYPE_FLAG, CONF_GLOBAL, 0, 1, NULL },
- { "noar", &use_ar, CONF_TYPE_FLAG, CONF_GLOBAL, 1, 0, NULL },
- { "ar", &use_ar, CONF_TYPE_FLAG, CONF_GLOBAL, 0, 1, NULL },
+ OPT_FLAG_OFF("nojoystick", input.use_joystick, CONF_GLOBAL),
+ OPT_FLAG_ON("joystick", input.use_joystick, CONF_GLOBAL),
+ OPT_FLAG_OFF("nolirc", input.use_lirc, CONF_GLOBAL),
+ OPT_FLAG_ON("lirc", input.use_lirc, CONF_GLOBAL),
+ OPT_FLAG_OFF("nolircc", input.use_lircc, CONF_GLOBAL),
+ OPT_FLAG_ON("lircc", input.use_lircc, CONF_GLOBAL),
+ OPT_FLAG_OFF("noar", input.use_ar, CONF_GLOBAL),
+ OPT_FLAG_ON("ar", input.use_ar, CONF_GLOBAL),
{ NULL, NULL, 0, 0, 0, 0, NULL}
};
-static int
-mp_input_default_cmd_func(int fd,char* buf, int l);
+static int default_cmd_func(int fd,char* buf, int l);
-static char*
-mp_input_get_key_name(int key);
+static char *get_key_name(int key, char buffer[12]);
-int
-mp_input_add_cmd_fd(int fd, int select, mp_cmd_func_t read_func, mp_close_func_t close_func) {
- if(num_cmd_fd == MP_MAX_CMD_FD) {
- mp_msg(MSGT_INPUT,MSGL_ERR,MSGTR_INPUT_INPUT_ErrCantRegister2ManyCmdFds,fd);
+int mp_input_add_cmd_fd(struct input_ctx *ictx, int fd, int select,
+ mp_cmd_func_t read_func, mp_close_func_t close_func)
+{
+ if (ictx->num_cmd_fd == MP_MAX_CMD_FD) {
+ mp_tmsg(MSGT_INPUT,MSGL_ERR,"Too many command file descriptors, cannot register file descriptor %d.\n",fd);
return 0;
}
if (select && fd < 0) {
@@ -644,58 +631,65 @@ mp_input_add_cmd_fd(int fd, int select, mp_cmd_func_t read_func, mp_close_func_t
return 0;
}
- memset(&cmd_fds[num_cmd_fd],0,sizeof(mp_input_fd_t));
- cmd_fds[num_cmd_fd].fd = fd;
- cmd_fds[num_cmd_fd].read_func = read_func ? read_func : mp_input_default_cmd_func;
- cmd_fds[num_cmd_fd].close_func = close_func;
- cmd_fds[num_cmd_fd].no_select = !select;
- num_cmd_fd++;
+ ictx->cmd_fds[ictx->num_cmd_fd] = (struct mp_input_fd){
+ .fd = fd,
+ .read_func.cmd = read_func ? read_func : default_cmd_func,
+ .close_func = close_func,
+ .no_select = !select
+ };
+ ictx->num_cmd_fd++;
return 1;
}
-void
-mp_input_rm_cmd_fd(int fd) {
+void mp_input_rm_cmd_fd(struct input_ctx *ictx, int fd)
+{
+ struct mp_input_fd *cmd_fds = ictx->cmd_fds;
unsigned int i;
- for(i = 0; i < num_cmd_fd; i++) {
+ for (i = 0; i < ictx->num_cmd_fd; i++) {
if(cmd_fds[i].fd == fd)
break;
}
- if(i == num_cmd_fd)
+ if (i == ictx->num_cmd_fd)
return;
if(cmd_fds[i].close_func)
cmd_fds[i].close_func(cmd_fds[i].fd);
if(cmd_fds[i].buffer)
- free(cmd_fds[i].buffer);
+ talloc_free(cmd_fds[i].buffer);
- if(i + 1 < num_cmd_fd)
- memmove(&cmd_fds[i],&cmd_fds[i+1],(num_cmd_fd - i - 1)*sizeof(mp_input_fd_t));
- num_cmd_fd--;
+ if (i + 1 < ictx->num_cmd_fd)
+ memmove(&cmd_fds[i], &cmd_fds[i+1],
+ (ictx->num_cmd_fd - i - 1) * sizeof(mp_input_fd_t));
+ ictx->num_cmd_fd--;
}
-void
-mp_input_rm_key_fd(int fd) {
+void mp_input_rm_key_fd(struct input_ctx *ictx, int fd)
+{
+ struct mp_input_fd *key_fds = ictx->key_fds;
unsigned int i;
- for(i = 0; i < num_key_fd; i++) {
+ for (i = 0; i < ictx->num_key_fd; i++) {
if(key_fds[i].fd == fd)
break;
}
- if(i == num_key_fd)
+ if (i == ictx->num_key_fd)
return;
if(key_fds[i].close_func)
key_fds[i].close_func(key_fds[i].fd);
- if(i + 1 < num_key_fd)
- memmove(&key_fds[i],&key_fds[i+1],(num_key_fd - i - 1)*sizeof(mp_input_fd_t));
- num_key_fd--;
+ if(i + 1 < ictx->num_key_fd)
+ memmove(&key_fds[i], &key_fds[i+1],
+ (ictx->num_key_fd - i - 1) * sizeof(mp_input_fd_t));
+ ictx->num_key_fd--;
}
-int
-mp_input_add_key_fd(int fd, int select, mp_key_func_t read_func, mp_close_func_t close_func) {
- if(num_key_fd == MP_MAX_KEY_FD) {
- mp_msg(MSGT_INPUT,MSGL_ERR,MSGTR_INPUT_INPUT_ErrCantRegister2ManyKeyFds,fd);
+int mp_input_add_key_fd(struct input_ctx *ictx, int fd, int select,
+ mp_key_func_t read_func, mp_close_func_t close_func,
+ void *ctx)
+{
+ if (ictx->num_key_fd == MP_MAX_KEY_FD) {
+ mp_tmsg(MSGT_INPUT,MSGL_ERR,"Too many key file descriptors, cannot register file descriptor %d.\n",fd);
return 0;
}
if (select && fd < 0) {
@@ -703,44 +697,20 @@ mp_input_add_key_fd(int fd, int select, mp_key_func_t read_func, mp_close_func_t
return 0;
}
- memset(&key_fds[num_key_fd],0,sizeof(mp_input_fd_t));
- key_fds[num_key_fd].fd = fd;
- key_fds[num_key_fd].read_func = read_func;
- key_fds[num_key_fd].close_func = close_func;
- key_fds[num_key_fd].no_select = !select;
- num_key_fd++;
-
- return 1;
-}
-
-int
-mp_input_add_event_fd(int fd, void (*read_func)(void))
-{
- if(num_key_fd == MP_MAX_KEY_FD) {
- mp_msg(MSGT_INPUT,MSGL_ERR,MSGTR_INPUT_INPUT_ErrCantRegister2ManyKeyFds,fd);
- return 0;
- }
- if (fd < 0) {
- mp_msg(MSGT_INPUT, MSGL_ERR, "Invalid fd %i in mp_input_add_event_fd", fd);
- return 0;
- }
-
- memset(&key_fds[num_key_fd],0,sizeof(mp_input_fd_t));
- key_fds[num_key_fd].fd = fd;
- key_fds[num_key_fd].read_func = read_func;
- key_fds[num_key_fd].close_func = NULL;
- key_fds[num_key_fd].no_readfunc_retval = 1;
- num_key_fd++;
+ ictx->key_fds[ictx->num_key_fd] = (struct mp_input_fd){
+ .fd = fd,
+ .read_func.key = read_func,
+ .close_func = close_func,
+ .no_select = !select,
+ .ctx = ctx,
+ };
+ ictx->num_key_fd++;
return 1;
}
-void mp_input_rm_event_fd(int fd)
+int mp_input_parse_and_queue_cmds(struct input_ctx *ictx, const char *str)
{
- mp_input_rm_key_fd(fd);
-}
-
-int mp_input_parse_and_queue_cmds(const char *str) {
int cmd_num = 0;
while (*str == '\n' || *str == '\r' || *str == ' ')
@@ -748,17 +718,17 @@ int mp_input_parse_and_queue_cmds(const char *str) {
while (*str) {
mp_cmd_t *cmd;
size_t len = strcspn(str, "\r\n");
- char *cmdbuf = malloc(len+1);
+ char *cmdbuf = talloc_size(NULL, len+1);
av_strlcpy(cmdbuf, str, len+1);
cmd = mp_input_parse_cmd(cmdbuf);
if (cmd) {
- mp_input_queue_cmd(cmd);
+ mp_input_queue_cmd(ictx, cmd);
++cmd_num;
}
str += len;
while (*str == '\n' || *str == '\r' || *str == ' ')
++str;
- free(cmdbuf);
+ talloc_free(cmdbuf);
}
return cmd_num;
}
@@ -766,9 +736,8 @@ int mp_input_parse_and_queue_cmds(const char *str) {
mp_cmd_t*
mp_input_parse_cmd(char* str) {
int i,l;
- int pausing = -1;
+ int pausing = 0;
char *ptr,*e;
- mp_cmd_t *cmd;
const mp_cmd_t *cmd_def;
#ifdef MP_DEBUG
@@ -813,19 +782,12 @@ mp_input_parse_cmd(char* str) {
cmd_def = &mp_cmds[i];
- cmd = calloc(1, sizeof(mp_cmd_t));
- cmd->id = cmd_def->id;
- cmd->name = strdup(cmd_def->name);
- if (pausing == -1) {
- switch (cmd->id) {
- case MP_CMD_KEYDOWN_EVENTS:
- case MP_CMD_SET_MOUSE_POS:
- pausing = 4; break;
- default:
- pausing = 0; break;
- }
- }
- cmd->pausing = pausing;
+ mp_cmd_t *cmd = talloc_ptrtype(NULL, cmd);
+ *cmd = (mp_cmd_t){
+ .id = cmd_def->id,
+ .name = talloc_strdup(cmd, cmd_def->name),
+ .pausing = pausing,
+ };
ptr = str;
@@ -840,7 +802,7 @@ mp_input_parse_cmd(char* str) {
errno = 0;
cmd->args[i].v.i = atoi(ptr);
if(errno != 0) {
- mp_msg(MSGT_INPUT,MSGL_ERR,MSGTR_INPUT_INPUT_ErrArgMustBeInt,cmd_def->name,i+1);
+ mp_tmsg(MSGT_INPUT,MSGL_ERR,"Command %s: argument %d isn't an integer.\n",cmd_def->name,i+1);
ptr = NULL;
}
break;
@@ -848,7 +810,7 @@ mp_input_parse_cmd(char* str) {
errno = 0;
cmd->args[i].v.f = atof(ptr);
if(errno != 0) {
- mp_msg(MSGT_INPUT,MSGL_ERR,MSGTR_INPUT_INPUT_ErrArgMustBeFloat,cmd_def->name,i+1);
+ mp_tmsg(MSGT_INPUT,MSGL_ERR,"Command %s: argument %d isn't a float.\n",cmd_def->name,i+1);
ptr = NULL;
}
break;
@@ -870,7 +832,7 @@ mp_input_parse_cmd(char* str) {
}
if(term != ' ' && (!e || e[0] == '\0')) {
- mp_msg(MSGT_INPUT,MSGL_ERR,MSGTR_INPUT_INPUT_ErrUnterminatedArg,cmd_def->name,i+1);
+ mp_tmsg(MSGT_INPUT,MSGL_ERR,"Command %s: argument %d is unterminated.\n",cmd_def->name,i+1);
ptr = NULL;
break;
} else if(!e) e = ptr+strlen(ptr);
@@ -881,23 +843,21 @@ mp_input_parse_cmd(char* str) {
ptr2 = e + 1;
l--;
}
- cmd->args[i].v.s = malloc(l+1);
- strncpy(cmd->args[i].v.s,start,l);
- cmd->args[i].v.s[l] = '\0';
+ cmd->args[i].v.s = talloc_strndup(cmd, start, l);
if(term != ' ') ptr += l+2;
} break;
case -1:
ptr = NULL;
break;
default :
- mp_msg(MSGT_INPUT,MSGL_ERR,MSGTR_INPUT_INPUT_ErrUnknownArg,i);
+ mp_tmsg(MSGT_INPUT,MSGL_ERR,"Unknown argument %d\n",i);
}
}
cmd->nargs = i;
if(cmd_def->nargs > cmd->nargs) {
/* mp_msg(MSGT_INPUT,MSGL_ERR,"Got command '%s' but\n",str); */
- mp_msg(MSGT_INPUT,MSGL_ERR,MSGTR_INPUT_INPUT_Err2FewArgs,cmd_def->name,cmd_def->nargs,cmd->nargs);
+ mp_tmsg(MSGT_INPUT,MSGL_ERR,"Command %s requires at least %d arguments, we found only %d so far.\n",cmd_def->name,cmd_def->nargs,cmd->nargs);
mp_cmd_free(cmd);
return NULL;
}
@@ -905,7 +865,7 @@ mp_input_parse_cmd(char* str) {
for( ; i < MP_CMD_MAX_ARGS && cmd_def->args[i].type != -1 ; i++) {
memcpy(&cmd->args[i],&cmd_def->args[i],sizeof(mp_cmd_arg_t));
if(cmd_def->args[i].type == MP_CMD_ARG_STRING && cmd_def->args[i].v.s != NULL)
- cmd->args[i].v.s = strdup(cmd_def->args[i].v.s);
+ cmd->args[i].v.s = talloc_strdup(cmd, cmd_def->args[i].v.s);
}
if(i < MP_CMD_MAX_ARGS)
@@ -916,27 +876,28 @@ mp_input_parse_cmd(char* str) {
#define MP_CMD_MAX_SIZE 4096
-static int
-mp_input_read_cmd(mp_input_fd_t* mp_fd, char** ret) {
+static int read_cmd(mp_input_fd_t* mp_fd, char** ret)
+{
char* end;
(*ret) = NULL;
// Allocate the buffer if it doesn't exist
if(!mp_fd->buffer) {
- mp_fd->buffer = malloc(MP_CMD_MAX_SIZE);
+ mp_fd->buffer = talloc_size(NULL, MP_CMD_MAX_SIZE);
mp_fd->pos = 0;
mp_fd->size = MP_CMD_MAX_SIZE;
}
// Get some data if needed/possible
while (!mp_fd->got_cmd && !mp_fd->eof && (mp_fd->size - mp_fd->pos > 1) ) {
- int r = ((mp_cmd_func_t)mp_fd->read_func)(mp_fd->fd,mp_fd->buffer+mp_fd->pos,mp_fd->size - 1 - mp_fd->pos);
+ int r = mp_fd->read_func.cmd(mp_fd->fd, mp_fd->buffer+mp_fd->pos,
+ mp_fd->size - 1 - mp_fd->pos);
// Error ?
if(r < 0) {
switch(r) {
case MP_INPUT_ERROR:
case MP_INPUT_DEAD:
- mp_msg(MSGT_INPUT,MSGL_ERR,MSGTR_INPUT_INPUT_ErrReadingCmdFd,mp_fd->fd,strerror(errno));
+ mp_tmsg(MSGT_INPUT,MSGL_ERR,"Error while reading command file descriptor %d: %s\n",mp_fd->fd,strerror(errno));
case MP_INPUT_NOTHING:
return r;
case MP_INPUT_RETRY:
@@ -962,7 +923,7 @@ mp_input_read_cmd(mp_input_fd_t* mp_fd, char** ret) {
if(!end) {
// If buffer is full we must drop all until the next \n
if(mp_fd->size - mp_fd->pos <= 1) {
- mp_msg(MSGT_INPUT,MSGL_ERR,MSGTR_INPUT_INPUT_ErrCmdBufferFullDroppingContent,mp_fd->fd);
+ mp_tmsg(MSGT_INPUT,MSGL_ERR,"Command buffer of file descriptor %d is full: dropping content.\n",mp_fd->fd);
mp_fd->pos = 0;
mp_fd->drop = 1;
}
@@ -977,16 +938,12 @@ mp_input_read_cmd(mp_input_fd_t* mp_fd, char** ret) {
l = end - mp_fd->buffer;
// Not dropping : put the cmd in ret
- if (!mp_fd->drop) {
- (*ret) = malloc(l+1);
- strncpy((*ret),mp_fd->buffer,l);
- (*ret)[l] = '\0';
- } else { // Remove the dropping flag
+ if (!mp_fd->drop)
+ *ret = talloc_strndup(NULL, mp_fd->buffer, l);
+ else
mp_fd->drop = 0;
- }
- if( mp_fd->pos - (l+1) > 0)
- memmove(mp_fd->buffer,end+1,mp_fd->pos-(l+1));
mp_fd->pos -= l+1;
+ memmove(mp_fd->buffer, end+1, mp_fd->pos);
}
if(*ret)
@@ -995,9 +952,8 @@ mp_input_read_cmd(mp_input_fd_t* mp_fd, char** ret) {
return MP_INPUT_NOTHING;
}
-static int
-mp_input_default_cmd_func(int fd,char* buf, int l) {
-
+static int default_cmd_func(int fd,char* buf, int l)
+{
while(1) {
int r = read(fd,buf,l);
// Error ?
@@ -1017,7 +973,7 @@ mp_input_default_cmd_func(int fd,char* buf, int l) {
void
mp_input_add_cmd_filter(mp_input_cmd_filter func, void* ctx) {
- mp_cmd_filter_t* filter = malloc(sizeof(mp_cmd_filter_t))/*, *prev*/;
+ mp_cmd_filter_t *filter = talloc_ptrtype(NULL, filter);
filter->filter = func;
filter->ctx = ctx;
@@ -1026,8 +982,8 @@ mp_input_add_cmd_filter(mp_input_cmd_filter func, void* ctx) {
}
-static char*
-mp_input_find_bind_for_key(const mp_cmd_bind_t* binds, int n,int* keys) {
+static char *find_bind_for_key(const mp_cmd_bind_t* binds, int n,int* keys)
+{
int j;
if (n <= 0) return NULL;
@@ -1045,9 +1001,10 @@ mp_input_find_bind_for_key(const mp_cmd_bind_t* binds, int n,int* keys) {
return binds[j].cmd;
}
-static mp_cmd_bind_section_t*
-mp_input_get_bind_section(char *section) {
- mp_cmd_bind_section_t* bind_section = cmd_binds_section;
+static mp_cmd_bind_section_t *get_bind_section(struct input_ctx *ictx,
+ char *section)
+{
+ mp_cmd_bind_section_t *bind_section = ictx->cmd_bind_sections;
if (section==NULL) section="default";
while (bind_section) {
@@ -1056,36 +1013,39 @@ mp_input_get_bind_section(char *section) {
bind_section=bind_section->next;
}
if(bind_section) {
- bind_section->next=malloc(sizeof(mp_cmd_bind_section_t));
+ bind_section->next = talloc_ptrtype(ictx, bind_section->next);
bind_section=bind_section->next;
} else {
- cmd_binds_section=malloc(sizeof(mp_cmd_bind_section_t));
- bind_section=cmd_binds_section;
+ ictx->cmd_bind_sections = talloc_ptrtype(ictx, ictx->cmd_bind_sections);
+ bind_section = ictx->cmd_bind_sections;
}
bind_section->cmd_binds=NULL;
- bind_section->section=strdup(section);
+ bind_section->section = talloc_strdup(bind_section, section);
bind_section->next=NULL;
return bind_section;
}
-static mp_cmd_t*
-mp_input_get_cmd_from_keys(int n,int* keys, int paused) {
+static mp_cmd_t *get_cmd_from_keys(struct input_ctx *ictx, int n, int *keys,
+ int paused)
+{
char* cmd = NULL;
mp_cmd_t* ret;
+ char key_buf[12];
- if(cmd_binds)
- cmd = mp_input_find_bind_for_key(cmd_binds,n,keys);
- if(cmd_binds_default && cmd == NULL)
- cmd = mp_input_find_bind_for_key(cmd_binds_default,n,keys);
- if(default_bindings && cmd == NULL)
- cmd = mp_input_find_bind_for_key(def_cmd_binds,n,keys);
+ if (ictx->cmd_binds)
+ cmd = find_bind_for_key(ictx->cmd_binds, n, keys);
+ if (ictx->cmd_binds_default && cmd == NULL)
+ cmd = find_bind_for_key(ictx->cmd_binds_default, n, keys);
+ if (ictx->default_bindings && cmd == NULL)
+ cmd = find_bind_for_key(def_cmd_binds,n,keys);
if(cmd == NULL) {
- mp_msg(MSGT_INPUT,MSGL_WARN,MSGTR_NoBindFound,mp_input_get_key_name(keys[0]));
+ mp_tmsg(MSGT_INPUT,MSGL_WARN,"No bind found for key '%s'.", get_key_name(keys[0],
+ key_buf));
if(n > 1) {
int s;
for(s=1; s < n; s++)
- mp_msg(MSGT_INPUT,MSGL_WARN,"-%s",mp_input_get_key_name(keys[s]));
+ mp_msg(MSGT_INPUT,MSGL_WARN,"-%s", get_key_name(keys[s], key_buf));
}
mp_msg(MSGT_INPUT,MSGL_WARN," \n");
return NULL;
@@ -1093,11 +1053,13 @@ mp_input_get_cmd_from_keys(int n,int* keys, int paused) {
if (strcmp(cmd, "ignore") == 0) return NULL;
ret = mp_input_parse_cmd(cmd);
if(!ret) {
- mp_msg(MSGT_INPUT,MSGL_ERR,MSGTR_INPUT_INPUT_ErrInvalidCommandForKey,mp_input_get_key_name(key_down[0]));
- if( num_key_down > 1) {
+ mp_tmsg(MSGT_INPUT,MSGL_ERR,"Invalid command for bound key %s",
+ get_key_name(ictx->key_down[0], key_buf));
+ if (ictx->num_key_down > 1) {
unsigned int s;
- for(s=1; s < num_key_down; s++)
- mp_msg(MSGT_INPUT,MSGL_ERR,"-%s",mp_input_get_key_name(key_down[s]));
+ for(s=1; s < ictx->num_key_down; s++)
+ mp_msg(MSGT_INPUT,MSGL_ERR,"-%s", get_key_name(ictx->key_down[s],
+ key_buf));
}
mp_msg(MSGT_INPUT,MSGL_ERR," : %s \n",cmd);
}
@@ -1105,8 +1067,7 @@ mp_input_get_cmd_from_keys(int n,int* keys, int paused) {
}
-static mp_cmd_t*
-interpret_key(int code, int paused)
+static mp_cmd_t* interpret_key(struct input_ctx *ictx, int code, int paused)
{
unsigned int j;
mp_cmd_t* ret;
@@ -1120,105 +1081,111 @@ interpret_key(int code, int paused)
}
if(code & MP_KEY_DOWN) {
- if(num_key_down > MP_MAX_KEY_DOWN) {
- mp_msg(MSGT_INPUT,MSGL_ERR,MSGTR_INPUT_INPUT_Err2ManyKeyDowns);
+ if (ictx->num_key_down > MP_MAX_KEY_DOWN) {
+ mp_tmsg(MSGT_INPUT,MSGL_ERR,"Too many key down events at the same time\n");
return NULL;
}
code &= ~MP_KEY_DOWN;
// Check if we don't already have this key as pushed
- for(j = 0; j < num_key_down; j++) {
- if(key_down[j] == code)
+ for (j = 0; j < ictx->num_key_down; j++) {
+ if (ictx->key_down[j] == code)
break;
}
- if(j != num_key_down)
+ if (j != ictx->num_key_down)
return NULL;
- key_down[num_key_down] = code;
- num_key_down++;
- last_key_down = GetTimer();
- ar_state = 0;
+ ictx->key_down[ictx->num_key_down] = code;
+ ictx->num_key_down++;
+ ictx->last_key_down = GetTimer();
+ ictx->ar_state = 0;
return NULL;
}
// key released
// Check if the key is in the down key, driver which can't send push event
// send only release event
- for(j = 0; j < num_key_down; j++) {
- if(key_down[j] == code)
+ for (j = 0; j < ictx->num_key_down; j++) {
+ if (ictx->key_down[j] == code)
break;
}
- if(j == num_key_down) { // key was not in the down keys : add it
- if(num_key_down > MP_MAX_KEY_DOWN) {
- mp_msg(MSGT_INPUT,MSGL_ERR,MSGTR_INPUT_INPUT_Err2ManyKeyDowns);
+ if (j == ictx->num_key_down) { // key was not in the down keys : add it
+ if (ictx->num_key_down > MP_MAX_KEY_DOWN) {
+ mp_tmsg(MSGT_INPUT,MSGL_ERR,"Too many key down events at the same time\n");
return NULL;
}
- key_down[num_key_down] = code;
- num_key_down++;
- last_key_down = 1;
+ ictx->key_down[ictx->num_key_down] = code;
+ ictx->num_key_down++;
+ ictx->last_key_down = 1;
}
// We ignore key from last combination
- ret = last_key_down ? mp_input_get_cmd_from_keys(num_key_down,key_down,paused) : NULL;
+ ret = ictx->last_key_down ?
+ get_cmd_from_keys(ictx, ictx->num_key_down, ictx->key_down, paused)
+ : NULL;
// Remove the key
- if(j+1 < num_key_down)
- memmove(&key_down[j],&key_down[j+1],(num_key_down-(j+1))*sizeof(int));
- num_key_down--;
- last_key_down = 0;
- ar_state = -1;
- if(ar_cmd) {
- mp_cmd_free(ar_cmd);
- ar_cmd = NULL;
+ if (j+1 < ictx->num_key_down)
+ memmove(&ictx->key_down[j], &ictx->key_down[j+1],
+ (ictx->num_key_down-(j+1))*sizeof(int));
+ ictx->num_key_down--;
+ ictx->last_key_down = 0;
+ ictx->ar_state = -1;
+ if (ictx->ar_cmd) {
+ mp_cmd_free(ictx->ar_cmd);
+ ictx->ar_cmd = NULL;
}
return ret;
}
-static mp_cmd_t *check_autorepeat(int paused)
+static mp_cmd_t *check_autorepeat(struct input_ctx *ictx, int paused)
{
// No input : autorepeat ?
- if(ar_rate > 0 && ar_state >=0 && num_key_down > 0 && ! (key_down[num_key_down-1] & MP_NO_REPEAT_KEY)) {
+ if (ictx->ar_rate > 0 && ictx->ar_state >=0 && ictx->num_key_down > 0
+ && !(ictx->key_down[ictx->num_key_down-1] & MP_NO_REPEAT_KEY)) {
unsigned int t = GetTimer();
// First time : wait delay
- if(ar_state == 0 && (t - last_key_down) >= ar_delay*1000) {
- ar_cmd = mp_input_get_cmd_from_keys(num_key_down,key_down,paused);
- if(!ar_cmd) {
- ar_state = -1;
+ if (ictx->ar_state == 0
+ && (t - ictx->last_key_down) >= ictx->ar_delay*1000) {
+ ictx->ar_cmd = get_cmd_from_keys(ictx, ictx->num_key_down,
+ ictx->key_down, paused);
+ if (!ictx->ar_cmd) {
+ ictx->ar_state = -1;
return NULL;
}
- ar_state = 1;
- last_ar = t;
- return mp_cmd_clone(ar_cmd);
+ ictx->ar_state = 1;
+ ictx->last_ar = t;
+ return mp_cmd_clone(ictx->ar_cmd);
// Then send rate / sec event
- } else if(ar_state == 1 && (t -last_ar) >= 1000000/ar_rate) {
- last_ar = t;
- return mp_cmd_clone(ar_cmd);
+ } else if (ictx->ar_state == 1
+ && (t -ictx->last_ar) >= 1000000 / ictx->ar_rate) {
+ ictx->last_ar = t;
+ return mp_cmd_clone(ictx->ar_cmd);
}
}
return NULL;
}
-static mp_cmd_t *read_events(int time, int paused)
+static mp_cmd_t *read_events(struct input_ctx *ictx, int time, int paused)
{
int i;
int got_cmd = 0;
- mp_cmd_t *autorepeat_cmd;
-#ifdef HAVE_POSIX_SELECT
- fd_set fds;
-#endif
- for (i = 0; i < num_key_fd; i++)
+ struct mp_input_fd *key_fds = ictx->key_fds;
+ struct mp_input_fd *cmd_fds = ictx->cmd_fds;
+ for (i = 0; i < ictx->num_key_fd; i++)
if (key_fds[i].dead) {
- mp_input_rm_key_fd(key_fds[i].fd);
+ mp_input_rm_key_fd(ictx, key_fds[i].fd);
i--;
}
- for (i = 0; i < num_cmd_fd; i++)
+ for (i = 0; i < ictx->num_cmd_fd; i++)
if (cmd_fds[i].dead || cmd_fds[i].eof) {
- mp_input_rm_cmd_fd(cmd_fds[i].fd);
+ mp_input_rm_cmd_fd(ictx, cmd_fds[i].fd);
i--;
}
else if (cmd_fds[i].got_cmd)
got_cmd = 1;
#ifdef HAVE_POSIX_SELECT
+ fd_set fds;
FD_ZERO(&fds);
if (!got_cmd) {
int max_fd = 0, num_fd = 0;
- for (i = 0; i < num_key_fd; i++) {
+ for (i = 0; i < ictx->num_key_fd; i++) {
if (key_fds[i].no_select)
continue;
if (key_fds[i].fd > max_fd)
@@ -1226,7 +1193,7 @@ static mp_cmd_t *read_events(int time, int paused)
FD_SET(key_fds[i].fd, &fds);
num_fd++;
}
- for (i = 0; i < num_cmd_fd; i++) {
+ for (i = 0; i < ictx->num_cmd_fd; i++) {
if (cmd_fds[i].no_select)
continue;
if (cmd_fds[i].fd > max_fd)
@@ -1245,7 +1212,7 @@ static mp_cmd_t *read_events(int time, int paused)
time_val = NULL;
if (select(max_fd + 1, &fds, NULL, NULL, time_val) < 0) {
if (errno != EINTR)
- mp_msg(MSGT_INPUT, MSGL_ERR, MSGTR_INPUT_INPUT_ErrSelect,
+ mp_tmsg(MSGT_INPUT, MSGL_ERR, "Select error: %s\n",
strerror(errno));
FD_ZERO(&fds);
}
@@ -1257,58 +1224,47 @@ static mp_cmd_t *read_events(int time, int paused)
#endif
- for (i = 0; i < num_key_fd; i++) {
- int code;
+ for (i = 0; i < ictx->num_key_fd; i++) {
#ifdef HAVE_POSIX_SELECT
if (!key_fds[i].no_select && !FD_ISSET(key_fds[i].fd, &fds))
continue;
#endif
- if (key_fds[i].no_readfunc_retval) { // getch2 handler special-cased for now
- ((void (*)(void))key_fds[i].read_func)();
- if (cmd_queue_length)
- return NULL;
- code = mplayer_get_key(0);
- if (code < 0)
- code = MP_INPUT_NOTHING;
- }
- else
- code = ((mp_key_func_t)key_fds[i].read_func)(key_fds[i].fd);
+ int code = key_fds[i].read_func.key(key_fds[i].ctx, key_fds[i].fd);
if (code >= 0) {
- mp_cmd_t *ret = interpret_key(code, paused);
+ mp_cmd_t *ret = interpret_key(ictx, code, paused);
if (ret)
return ret;
}
else if (code == MP_INPUT_ERROR)
- mp_msg(MSGT_INPUT, MSGL_ERR, MSGTR_INPUT_INPUT_ErrOnKeyInFd,
+ mp_tmsg(MSGT_INPUT, MSGL_ERR, "Error on key input file descriptor %d\n",
key_fds[i].fd);
else if (code == MP_INPUT_DEAD) {
- mp_msg(MSGT_INPUT, MSGL_ERR, MSGTR_INPUT_INPUT_ErrDeadKeyOnFd,
+ mp_tmsg(MSGT_INPUT, MSGL_ERR, "Dead key input on file descriptor %d\n",
key_fds[i].fd);
key_fds[i].dead = 1;
}
}
- autorepeat_cmd = check_autorepeat(paused);
+ mp_cmd_t *autorepeat_cmd = check_autorepeat(ictx, paused);
if (autorepeat_cmd)
return autorepeat_cmd;
- for (i = 0; i < num_cmd_fd; i++) {
- char *cmd;
- int r;
+ for (i = 0; i < ictx->num_cmd_fd; i++) {
#ifdef HAVE_POSIX_SELECT
if (!cmd_fds[i].no_select && !FD_ISSET(cmd_fds[i].fd, &fds) &&
!cmd_fds[i].got_cmd)
continue;
#endif
- r = mp_input_read_cmd(&cmd_fds[i], &cmd);
+ char *cmd;
+ int r = read_cmd(&cmd_fds[i], &cmd);
if (r >= 0) {
mp_cmd_t *ret = mp_input_parse_cmd(cmd);
- free(cmd);
+ talloc_free(cmd);
if (ret)
return ret;
}
else if (r == MP_INPUT_ERROR)
- mp_msg(MSGT_INPUT, MSGL_ERR, MSGTR_INPUT_INPUT_ErrOnCmdFd,
+ mp_tmsg(MSGT_INPUT, MSGL_ERR, "Error on command file descriptor %d\n",
cmd_fds[i].fd);
else if (r == MP_INPUT_DEAD)
cmd_fds[i].dead = 1;
@@ -1318,28 +1274,28 @@ static mp_cmd_t *read_events(int time, int paused)
}
-int
-mp_input_queue_cmd(mp_cmd_t* cmd) {
- if(!cmd || cmd_queue_length >= CMD_QUEUE_SIZE)
+int mp_input_queue_cmd(struct input_ctx *ictx, mp_cmd_t* cmd)
+{
+ if (!cmd || ictx->cmd_queue_length >= CMD_QUEUE_SIZE)
return 0;
- cmd_queue[cmd_queue_end] = cmd;
- cmd_queue_end = (cmd_queue_end + 1) % CMD_QUEUE_SIZE;
- cmd_queue_length++;
+ ictx->cmd_queue[ictx->cmd_queue_end] = cmd;
+ ictx->cmd_queue_end = (ictx->cmd_queue_end + 1) % CMD_QUEUE_SIZE;
+ ictx->cmd_queue_length++;
return 1;
}
-static mp_cmd_t*
-mp_input_get_queued_cmd(int peek_only) {
+static mp_cmd_t *get_queued_cmd(struct input_ctx *ictx, int peek_only)
+{
mp_cmd_t* ret;
- if(cmd_queue_length == 0)
+ if (ictx->cmd_queue_length == 0)
return NULL;
- ret = cmd_queue[cmd_queue_start];
+ ret = ictx->cmd_queue[ictx->cmd_queue_start];
if (!peek_only) {
- cmd_queue_length--;
- cmd_queue_start = (cmd_queue_start + 1) % CMD_QUEUE_SIZE;
+ ictx->cmd_queue_length--;
+ ictx->cmd_queue_start = (ictx->cmd_queue_start + 1) % CMD_QUEUE_SIZE;
}
return ret;
@@ -1349,8 +1305,9 @@ mp_input_get_queued_cmd(int peek_only) {
* \param peek_only when set, the returned command stays in the queue.
* Do not free the returned cmd whe you set this!
*/
-mp_cmd_t*
-mp_input_get_cmd(int time, int paused, int peek_only) {
+mp_cmd_t *mp_input_get_cmd(struct input_ctx *ictx, int time, int paused,
+ int peek_only)
+{
mp_cmd_t* ret = NULL;
mp_cmd_filter_t* cf;
int from_queue;
@@ -1359,13 +1316,13 @@ mp_input_get_cmd(int time, int paused, int peek_only) {
return mp_input_parse_cmd("quit 1");
while(1) {
from_queue = 1;
- ret = mp_input_get_queued_cmd(peek_only);
+ ret = get_queued_cmd(ictx, peek_only);
if(ret) break;
from_queue = 0;
- ret = read_events(time, paused);
+ ret = read_events(ictx, time, paused);
if (!ret) {
from_queue = 1;
- ret = mp_input_get_queued_cmd(peek_only);
+ ret = get_queued_cmd(ictx, peek_only);
}
break;
}
@@ -1375,34 +1332,21 @@ mp_input_get_cmd(int time, int paused, int peek_only) {
if(cf->filter(ret,paused,cf->ctx)) {
if (peek_only && from_queue)
// The filter ate the cmd, so we remove it from queue
- ret = mp_input_get_queued_cmd(0);
+ ret = get_queued_cmd(ictx, 0);
mp_cmd_free(ret);
return NULL;
}
}
if (!from_queue && peek_only)
- mp_input_queue_cmd(ret);
+ mp_input_queue_cmd(ictx, ret);
return ret;
}
void
mp_cmd_free(mp_cmd_t* cmd) {
- int i;
-//#ifdef MP_DEBUG
-// assert(cmd != NULL);
-//#endif
- if ( !cmd ) return;
-
- if(cmd->name)
- free(cmd->name);
-
- for(i=0; i < MP_CMD_MAX_ARGS && cmd->args[i].type != -1; i++) {
- if(cmd->args[i].type == MP_CMD_ARG_STRING && cmd->args[i].v.s != NULL)
- free(cmd->args[i].v.s);
- }
- free(cmd);
+ talloc_free(cmd);
}
mp_cmd_t*
@@ -1413,22 +1357,18 @@ mp_cmd_clone(mp_cmd_t* cmd) {
assert(cmd != NULL);
#endif
- ret = malloc(sizeof(mp_cmd_t));
- memcpy(ret,cmd,sizeof(mp_cmd_t));
- if(cmd->name)
- ret->name = strdup(cmd->name);
+ ret = talloc_memdup(NULL, cmd, sizeof(mp_cmd_t));
+ ret->name = talloc_strdup(ret, cmd->name);
for(i = 0; i < MP_CMD_MAX_ARGS && cmd->args[i].type != -1; i++) {
if(cmd->args[i].type == MP_CMD_ARG_STRING && cmd->args[i].v.s != NULL)
- ret->args[i].v.s = strdup(cmd->args[i].v.s);
+ ret->args[i].v.s = talloc_strdup(ret, cmd->args[i].v.s);
}
return ret;
}
-static char key_str[12];
-
-static char*
-mp_input_get_key_name(int key) {
+static char *get_key_name(int key, char buffer[12])
+{
int i;
for(i = 0; key_names[i].name != NULL; i++) {
@@ -1437,13 +1377,13 @@ mp_input_get_key_name(int key) {
}
if(isascii(key)) {
- snprintf(key_str,12,"%c",(char)key);
- return key_str;
+ snprintf(buffer, 12, "%c",(char)key);
+ return buffer;
}
// Print the hex key code
- snprintf(key_str,12,"%#-8x",key);
- return key_str;
+ snprintf(buffer, 12, "%#-8x",key);
+ return buffer;
}
@@ -1464,8 +1404,7 @@ mp_input_get_key_from_name(const char *name) {
return -1;
}
-static int
-mp_input_get_input_from_name(char* name,int* keys) {
+static int get_input_from_name(char* name,int* keys) {
char *end,*ptr;
int n=0;
@@ -1494,8 +1433,9 @@ mp_input_get_input_from_name(char* name,int* keys) {
#define BS_MAX 256
#define SPACE_CHAR " \n\r\t"
-void
-mp_input_bind_keys(const int keys[MP_MAX_KEY_DOWN+1], char* cmd) {
+static void bind_keys(struct input_ctx *ictx,
+ const int keys[MP_MAX_KEY_DOWN+1], char *cmd)
+{
int i = 0,j;
mp_cmd_bind_t* bind = NULL;
mp_cmd_bind_section_t* bind_section = NULL;
@@ -1514,7 +1454,7 @@ mp_input_bind_keys(const int keys[MP_MAX_KEY_DOWN+1], char* cmd) {
for( ; cmd[0] != '\0' && strchr(SPACE_CHAR,cmd[0]) != NULL ; cmd++)
/* NOTHING */;
}
- bind_section=mp_input_get_bind_section(section);
+ bind_section = get_bind_section(ictx, section);
if(bind_section->cmd_binds) {
for(i = 0; bind_section->cmd_binds[i].cmd != NULL ; i++) {
@@ -1528,39 +1468,27 @@ mp_input_bind_keys(const int keys[MP_MAX_KEY_DOWN+1], char* cmd) {
}
if(!bind) {
- bind_section->cmd_binds = realloc(bind_section->cmd_binds,(i+2)*sizeof(mp_cmd_bind_t));
+ bind_section->cmd_binds = talloc_realloc(bind_section,
+ bind_section->cmd_binds,
+ mp_cmd_bind_t, i + 2);
memset(&bind_section->cmd_binds[i],0,2*sizeof(mp_cmd_bind_t));
bind = &bind_section->cmd_binds[i];
}
if(bind->cmd)
- free(bind->cmd);
- bind->cmd = strdup(cmd);
+ talloc_free(bind->cmd);
+ bind->cmd = talloc_strdup(bind_section->cmd_binds, cmd);
memcpy(bind->input,keys,(MP_MAX_KEY_DOWN+1)*sizeof(int));
}
-void
-mp_input_add_binds(const mp_cmd_bind_t* list) {
+static void add_binds(struct input_ctx *ictx, const mp_cmd_bind_t* list)
+{
int i;
for(i = 0 ; list[i].cmd ; i++)
- mp_input_bind_keys(list[i].input,list[i].cmd);
-}
-
-static void
-mp_input_free_binds(mp_cmd_bind_t* binds) {
- int i;
-
- if(!binds)
- return;
-
- for(i = 0; binds[i].cmd != NULL; i++)
- free(binds[i].cmd);
-
- free(binds);
-
+ bind_keys(ictx, list[i].input,list[i].cmd);
}
-static int
-mp_input_parse_config(char *file) {
+static int parse_config(struct input_ctx *ictx, char *file)
+{
int fd;
int bs = 0,r,eof = 0,comments = 0;
char *iter,*end;
@@ -1583,7 +1511,7 @@ mp_input_parse_config(char *file) {
if(r < 0) {
if(errno == EINTR)
continue;
- mp_msg(MSGT_INPUT,MSGL_ERR,MSGTR_INPUT_INPUT_ErrReadingInputConfig,file,strerror(errno));
+ mp_tmsg(MSGT_INPUT,MSGL_ERR,"Error while reading input config file %s: %s\n",file,strerror(errno));
close(fd);
return 0;
} else if(r == 0) {
@@ -1636,9 +1564,9 @@ mp_input_parse_config(char *file) {
if(end[0] == '\0') { // Key name doesn't fit in the buffer
if(buffer == iter) {
if(eof && (buffer-iter) == bs)
- mp_msg(MSGT_INPUT,MSGL_ERR,MSGTR_INPUT_INPUT_ErrUnfinishedBinding,iter);
+ mp_tmsg(MSGT_INPUT,MSGL_ERR,"Unfinished binding %s\n",iter);
else
- mp_msg(MSGT_INPUT,MSGL_ERR,MSGTR_INPUT_INPUT_ErrBuffer2SmallForKeyName,iter);
+ mp_tmsg(MSGT_INPUT,MSGL_ERR,"Buffer is too small for this key name: %s\n",iter);
return 0;
}
memmove(buffer,iter,end-iter);
@@ -1649,8 +1577,8 @@ mp_input_parse_config(char *file) {
char name[end-iter+1];
strncpy(name,iter,end-iter);
name[end-iter] = '\0';
- if(! mp_input_get_input_from_name(name,keys)) {
- mp_msg(MSGT_INPUT,MSGL_ERR,MSGTR_INPUT_INPUT_ErrUnknownKey,name);
+ if (!get_input_from_name(name,keys)) {
+ mp_tmsg(MSGT_INPUT,MSGL_ERR,"Unknown key '%s'\n",name);
close(fd);
return 0;
}
@@ -1664,10 +1592,11 @@ mp_input_parse_config(char *file) {
// Found new line
if(iter[0] == '\n' || iter[0] == '\r') {
int i;
- mp_msg(MSGT_INPUT,MSGL_ERR,MSGTR_INPUT_INPUT_ErrNoCmdForKey,mp_input_get_key_name(keys[0]));
+ char key_buf[12];
+ mp_tmsg(MSGT_INPUT,MSGL_ERR,"No command found for key %s", get_key_name(keys[0], key_buf));
for(i = 1; keys[i] != 0 ; i++)
- mp_msg(MSGT_INPUT,MSGL_ERR,"-%s",mp_input_get_key_name(keys[i]));
- mp_msg(MSGT_INPUT,MSGL_ERR,"\n");
+ mp_msg(MSGT_INPUT,MSGL_ERR,"-%s", get_key_name(keys[i], key_buf));
+ mp_msg(MSGT_INPUT,MSGL_ERR,"\n");
keys[0] = 0;
if(iter > buffer) {
memmove(buffer,iter,bs- (iter-buffer));
@@ -1679,7 +1608,7 @@ mp_input_parse_config(char *file) {
/* NOTHING */;
if(end[0] == '\0' && ! (eof && ((end+1) - buffer) == bs)) {
if(iter == buffer) {
- mp_msg(MSGT_INPUT,MSGL_ERR,MSGTR_INPUT_INPUT_ErrBuffer2SmallForCmd,buffer);
+ mp_tmsg(MSGT_INPUT,MSGL_ERR,"Buffer is too small for command %s\n",buffer);
close(fd);
return 0;
}
@@ -1692,7 +1621,7 @@ mp_input_parse_config(char *file) {
strncpy(cmd,iter,end-iter);
cmd[end-iter] = '\0';
//printf("Set bind %d => %s\n",keys[0],cmd);
- mp_input_bind_keys(keys,cmd);
+ bind_keys(ictx, keys,cmd);
n_binds++;
}
keys[0] = 0;
@@ -1704,46 +1633,54 @@ mp_input_parse_config(char *file) {
continue;
}
}
- mp_msg(MSGT_INPUT,MSGL_ERR,MSGTR_INPUT_INPUT_ErrWhyHere);
+ mp_tmsg(MSGT_INPUT,MSGL_ERR,"What are we doing here?\n");
close(fd);
- mp_input_set_section(NULL);
+ mp_input_set_section(ictx, NULL);
return 0;
}
-void
-mp_input_set_section(char *name) {
- mp_cmd_bind_section_t* bind_section = NULL;
-
- cmd_binds=NULL;
- cmd_binds_default=NULL;
- if(section) free(section);
- if(name) section=strdup(name); else section=strdup("default");
- if((bind_section=mp_input_get_bind_section(section)))
- cmd_binds=bind_section->cmd_binds;
- if(strcmp(section,"default")==0) return;
- if((bind_section=mp_input_get_bind_section(NULL)))
- cmd_binds_default=bind_section->cmd_binds;
+void mp_input_set_section(struct input_ctx *ictx, char *name)
+{
+ mp_cmd_bind_section_t* bind_section = NULL;
+
+ ictx->cmd_binds = NULL;
+ ictx->cmd_binds_default = NULL;
+ if (ictx->section)
+ talloc_free(ictx->section);
+ if (name)
+ ictx->section = talloc_strdup(ictx, name);
+ else
+ ictx->section = talloc_strdup(ictx, "default");
+ if ((bind_section = get_bind_section(ictx, ictx->section)))
+ ictx->cmd_binds = bind_section->cmd_binds;
+ if (strcmp(ictx->section, "default") == 0)
+ return;
+ if ((bind_section = get_bind_section(ictx, NULL)))
+ ictx->cmd_binds_default = bind_section->cmd_binds;
}
-char*
-mp_input_get_section(void) {
- return section;
+char *mp_input_get_section(struct input_ctx *ictx)
+{
+ return ictx->section;
}
-void
-mp_input_init(int use_gui) {
- char* file;
-
-#ifdef CONFIG_GUI
- if(use_gui)
- mp_input_add_binds(gui_def_cmd_binds);
-#endif
+struct input_ctx *mp_input_init(struct input_conf *input_conf)
+{
+ struct input_ctx *ictx = talloc_ptrtype(NULL, ictx);
+ *ictx = (struct input_ctx){
+ .ar_state = -1,
+ .ar_delay = input_conf->ar_delay,
+ .ar_rate = input_conf->ar_rate,
+ .default_bindings = input_conf->default_bindings,
+ };
+ char* file;
+ char *config_file = input_conf->config_file;
file = config_file[0] != '/' ? get_path(config_file) : config_file;
if(!file)
- return;
+ return ictx;
- if( !mp_input_parse_config(file)) {
+ if (!parse_config(ictx, file)) {
// free file if it was allocated by get_path(),
// before it gets overwritten
if( file != config_file)
@@ -1752,7 +1689,7 @@ mp_input_init(int use_gui) {
}
// Try global conf dir
file = MPLAYER_CONFDIR "/input.conf";
- if(! mp_input_parse_config(file))
+ if (!parse_config(ictx, file))
mp_msg(MSGT_INPUT,MSGL_V,"Falling back on default (hardcoded) input config\n");
}
else
@@ -1763,87 +1700,89 @@ mp_input_init(int use_gui) {
}
#ifdef CONFIG_JOYSTICK
- if(use_joystick) {
- int fd = mp_input_joystick_init(js_dev);
+ if (input_conf->use_joystick) {
+ int fd = mp_input_joystick_init(input_conf->js_dev);
if(fd < 0)
- mp_msg(MSGT_INPUT,MSGL_ERR,MSGTR_INPUT_INPUT_ErrCantInitJoystick);
+ mp_tmsg(MSGT_INPUT,MSGL_ERR,"Can't init input joystick\n");
else
- mp_input_add_key_fd(fd,1,mp_input_joystick_read,(mp_close_func_t)close);
+ mp_input_add_key_fd(ictx, fd, 1, mp_input_joystick_read,
+ (mp_close_func_t)close,NULL);
}
#endif
#ifdef CONFIG_LIRC
- if(use_lirc) {
+ if (input_conf->use_lirc) {
int fd = mp_input_lirc_init();
if(fd > 0)
- mp_input_add_cmd_fd(fd,0,mp_input_lirc_read,mp_input_lirc_close);
+ mp_input_add_cmd_fd(ictx, fd, 0, mp_input_lirc_read,
+ mp_input_lirc_close);
}
#endif
#ifdef CONFIG_LIRCC
- if(use_lircc) {
+ if (input_conf->use_lircc) {
int fd = lircc_init("mplayer", NULL);
if(fd >= 0)
- mp_input_add_cmd_fd(fd,1,NULL,(mp_close_func_t)lircc_cleanup);
+ mp_input_add_cmd_fd(ictx, fd, 1, NULL, (mp_close_func_t)lircc_cleanup);
}
#endif
#ifdef CONFIG_APPLE_REMOTE
- if(use_ar) {
+ if (input_conf->use_ar) {
if(mp_input_ar_init() < 0)
- mp_msg(MSGT_INPUT,MSGL_ERR,MSGTR_INPUT_INPUT_ErrCantInitAppleRemote);
+ mp_tmsg(MSGT_INPUT,MSGL_ERR,"Can't init Apple Remote.\n");
else
- mp_input_add_key_fd(-1,0,mp_input_ar_read,mp_input_ar_close);
+ mp_input_add_key_fd(ictx, -1, 0, mp_input_ar_read, mp_input_ar_close,
+ NULL);
}
#endif
#ifdef CONFIG_APPLE_IR
- if(use_ar) {
- int fd = mp_input_appleir_init(ar_dev);
+ if (input_conf->use_ar) {
+ int fd = mp_input_appleir_init(input_conf->ar_dev);
if(fd < 0)
- mp_msg(MSGT_INPUT,MSGL_ERR,MSGTR_INPUT_INPUT_ErrCantInitAppleRemote);
+ mp_tmsg(MSGT_INPUT,MSGL_ERR,"Can't init Apple Remote.\n");
else
- mp_input_add_key_fd(fd,1,mp_input_appleir_read,(mp_close_func_t)close);
+ mp_input_add_key_fd(ictx, fd, 1, mp_input_appleir_read,
+ (mp_close_func_t)close, NULL);
}
#endif
- if(in_file) {
+ if (input_conf->in_file) {
struct stat st;
- if(stat(in_file,&st))
- mp_msg(MSGT_INPUT,MSGL_ERR,MSGTR_INPUT_INPUT_ErrCantStatFile,in_file,strerror(errno));
+ if (stat(input_conf->in_file, &st))
+ mp_tmsg(MSGT_INPUT, MSGL_ERR, "Can't stat %s: %s\n", input_conf->in_file, strerror(errno));
else {
- in_file_fd = open(in_file,S_ISFIFO(st.st_mode) ? O_RDWR : O_RDONLY);
+ int in_file_fd = open(input_conf->in_file,
+ S_ISFIFO(st.st_mode) ? O_RDWR : O_RDONLY);
if(in_file_fd >= 0)
- mp_input_add_cmd_fd(in_file_fd,1,NULL,(mp_close_func_t)close);
+ mp_input_add_cmd_fd(ictx, in_file_fd, 1, NULL,
+ (mp_close_func_t)close);
else
- mp_msg(MSGT_INPUT,MSGL_ERR,MSGTR_INPUT_INPUT_ErrCantOpenFile,in_file,strerror(errno));
+ mp_tmsg(MSGT_INPUT, MSGL_ERR, "Can't open %s: %s\n",
+ input_conf->in_file, strerror(errno));
}
}
-
+ return ictx;
}
-void
-mp_input_uninit(void) {
+void mp_input_uninit(struct input_ctx *ictx)
+{
+ if (!ictx)
+ return;
+
unsigned int i;
- mp_cmd_bind_section_t* bind_section;
- for(i=0; i < num_key_fd; i++) {
- if(key_fds[i].close_func)
- key_fds[i].close_func(key_fds[i].fd);
+ for (i=0; i < ictx->num_key_fd; i++) {
+ if (ictx->key_fds[i].close_func)
+ ictx->key_fds[i].close_func(ictx->key_fds[i].fd);
}
- for(i=0; i < num_cmd_fd; i++) {
- if(cmd_fds[i].close_func)
- cmd_fds[i].close_func(cmd_fds[i].fd);
- }
- while (cmd_binds_section) {
- mp_input_free_binds(cmd_binds_section->cmd_binds);
- free(cmd_binds_section->section);
- bind_section=cmd_binds_section->next;
- free(cmd_binds_section);
- cmd_binds_section=bind_section;
+ for (i = 0; i < ictx->num_cmd_fd; i++) {
+ if (ictx->cmd_fds[i].close_func)
+ ictx->cmd_fds[i].close_func(ictx->cmd_fds[i].fd);
}
- cmd_binds_section=NULL;
+ talloc_free(ictx);
}
void
@@ -1851,7 +1790,8 @@ mp_input_register_options(m_config_t* cfg) {
m_config_register_options(cfg,mp_input_opts);
}
-static int mp_input_print_key_list(m_option_t* cfg) {
+static int print_key_list(m_option_t* cfg)
+{
int i;
printf("\n");
for(i= 0; key_names[i].name != NULL ; i++)
@@ -1859,7 +1799,8 @@ static int mp_input_print_key_list(m_option_t* cfg) {
exit(0);
}
-static int mp_input_print_cmd_list(m_option_t* cfg) {
+static int print_cmd_list(m_option_t* cfg)
+{
const mp_cmd_t *cmd;
int i,j;
const char* type;
@@ -1890,10 +1831,10 @@ static int mp_input_print_cmd_list(m_option_t* cfg) {
exit(0);
}
-int
-mp_input_check_interrupt(int time) {
+int mp_input_check_interrupt(struct input_ctx *ictx, int time)
+{
mp_cmd_t* cmd;
- if((cmd = mp_input_get_cmd(time,0,1)) == NULL)
+ if ((cmd = mp_input_get_cmd(ictx, time, 0, 1)) == NULL)
return 0;
switch(cmd->id) {
case MP_CMD_QUIT:
@@ -1904,7 +1845,7 @@ mp_input_check_interrupt(int time) {
return 1;
}
// remove the cmd from the queue
- cmd = mp_input_get_cmd(time,0,0);
+ cmd = mp_input_get_cmd(ictx, time, 0, 0);
mp_cmd_free(cmd);
return 0;
}
diff --git a/input/input.h b/input/input.h
index 12a56c8509..82718b9b29 100644
--- a/input/input.h
+++ b/input/input.h
@@ -90,6 +90,7 @@ typedef enum {
MP_CMD_KEYDOWN_EVENTS,
MP_CMD_VO_BORDER,
MP_CMD_SET_PROPERTY,
+ MP_CMD_SET_PROPERTY_OSD,
MP_CMD_GET_PROPERTY,
MP_CMD_OSD_SHOW_PROPERTY_TEXT,
MP_CMD_SEEK_CHAPTER,
@@ -113,6 +114,7 @@ typedef enum {
MP_CMD_RADIO_SET_FREQ,
MP_CMD_SET_MOUSE_POS,
MP_CMD_STEP_PROPERTY,
+ MP_CMD_STEP_PROPERTY_OSD,
MP_CMD_RADIO_STEP_FREQ,
MP_CMD_TV_STEP_FREQ,
MP_CMD_LOOP,
@@ -140,18 +142,6 @@ typedef enum {
MP_CMD_DVDNAV_PREVMENU,
MP_CMD_DVDNAV_MOUSECLICK,
- /// GUI commands
- MP_CMD_GUI_EVENTS = 5000,
- MP_CMD_GUI_LOADFILE,
- MP_CMD_GUI_LOADSUBTITLE,
- MP_CMD_GUI_ABOUT,
- MP_CMD_GUI_PLAY,
- MP_CMD_GUI_STOP,
- MP_CMD_GUI_PLAYLIST,
- MP_CMD_GUI_PREFERENCES,
- MP_CMD_GUI_FULLSCREEN,
- MP_CMD_GUI_SKINBROWSER,
-
/// DVB commands
MP_CMD_DVB_SET_CHANNEL = 5101,
@@ -193,6 +183,8 @@ typedef enum {
#define MP_MAX_KEY_DOWN 32
#endif
+struct input_ctx;
+
typedef union mp_cmd_arg_value {
int i;
float f;
@@ -214,21 +206,11 @@ typedef struct mp_cmd {
} mp_cmd_t;
-typedef struct mp_cmd_bind {
- int input[MP_MAX_KEY_DOWN+1];
- char* cmd;
-} mp_cmd_bind_t;
-
-typedef struct mp_key_name {
- int key;
- char* name;
-} mp_key_name_t;
-
// These typedefs are for the drivers. They are the functions used to retrieve
// the next key code or command.
// These functions should return the key code or one of the error codes
-typedef int (*mp_key_func_t)(int fd);
+typedef int (*mp_key_func_t)(void *ctx, int fd);
// These functions should act like read but they must use our error code (if needed ;-)
typedef int (*mp_cmd_func_t)(int fd,char* dest,int size);
// These are used to close the driver
@@ -246,25 +228,20 @@ typedef int (*mp_input_cmd_filter)(mp_cmd_t* cmd, int paused, void* ctx);
// fd will be used.
// The last arg can be NULL if nothing is needed to close the driver. The close
// function can be used
-int
-mp_input_add_cmd_fd(int fd, int select, mp_cmd_func_t read_func, mp_close_func_t close_func);
+int mp_input_add_cmd_fd(struct input_ctx *ictx, int fd, int select,
+ mp_cmd_func_t read_func, mp_close_func_t close_func);
// This removes a cmd driver, you usually don't need to use it.
-void
-mp_input_rm_cmd_fd(int fd);
+void mp_input_rm_cmd_fd(struct input_ctx *ictx, int fd);
// The args are the same as for the key's drivers. If you don't use any valid fd you MUST
// give a read_func.
-int
-mp_input_add_key_fd(int fd, int select, mp_key_func_t read_func, mp_close_func_t close_func);
+int mp_input_add_key_fd(struct input_ctx *ictx, int fd, int select,
+ mp_key_func_t read_func, mp_close_func_t close_func,
+ void *ctx);
// As for the cmd one you usually don't need this function.
-void
-mp_input_rm_key_fd(int fd);
-
-int mp_input_add_event_fd(int fd, void (*read_func)(void));
-
-void mp_input_rm_event_fd(int fd);
+void mp_input_rm_key_fd(struct input_ctx *ictx, int fd);
/// Get input key from its name.
int mp_input_get_key_from_name(const char *name);
@@ -272,13 +249,12 @@ int mp_input_get_key_from_name(const char *name);
// This function can be used to put a command in the system again. It's used by libmpdemux
// when it performs a blocking operation to resend the command it received to the main
// loop.
-int
-mp_input_queue_cmd(mp_cmd_t* cmd);
+int mp_input_queue_cmd(struct input_ctx *ictx, mp_cmd_t* cmd);
// This function retrieves the next available command waiting no more than time msec.
// If pause is true, the next input will always return a pause command.
mp_cmd_t*
-mp_input_get_cmd(int time, int paused, int peek_only);
+mp_input_get_cmd(struct input_ctx *ictx, int time, int paused, int peek_only);
mp_cmd_t*
mp_input_parse_cmd(char* str);
@@ -287,7 +263,7 @@ mp_input_parse_cmd(char* str);
* Parse and queue commands separated by '\n'.
* @return count of commands new queued.
*/
-int mp_input_parse_and_queue_cmds(const char *str);
+int mp_input_parse_and_queue_cmds(struct input_ctx *ictx, const char *str);
/// These filters allow you to process the command before MPlayer.
/// If a filter returns a true value mp_input_get_cmd will return NULL.
@@ -304,23 +280,23 @@ mp_cmd_t*
mp_cmd_clone(mp_cmd_t* cmd);
// Set current input section
-void
-mp_input_set_section(char *name);
+void mp_input_set_section(struct input_ctx *ictx, char *name);
// Get current input section
-char*
-mp_input_get_section(void);
+char *mp_input_get_section(struct input_ctx *ictx);
// When you create a new driver you should add it in these 2 functions.
-void
-mp_input_init(int use_gui);
+struct input_conf;
+struct input_ctx *mp_input_init(struct input_conf *input_conf);
-void
-mp_input_uninit(void);
+void mp_input_uninit(struct input_ctx *ictx);
+
+struct m_config;
+void mp_input_register_options(struct m_config *cfg);
// Interruptible usleep: (used by libmpdemux)
int
-mp_input_check_interrupt(int time);
+mp_input_check_interrupt(struct input_ctx *ictx, int time);
extern int async_quit_request;
diff --git a/input/joystick.c b/input/joystick.c
index 4549a1bd9c..4a63c14fae 100644
--- a/input/joystick.c
+++ b/input/joystick.c
@@ -51,11 +51,11 @@ int mp_input_joystick_init(char* dev) {
int initialized = 0;
struct js_event ev;
- mp_msg(MSGT_INPUT,MSGL_V,MSGTR_INPUT_JOYSTICK_Opening,dev ? dev : JS_DEV);
+ mp_tmsg(MSGT_INPUT,MSGL_V,"Opening joystick device %s\n",dev ? dev : JS_DEV);
fd = open( dev ? dev : JS_DEV , O_RDONLY | O_NONBLOCK );
if(fd < 0) {
- mp_msg(MSGT_INPUT,MSGL_ERR,MSGTR_INPUT_JOYSTICK_CantOpen,dev ? dev : JS_DEV,strerror(errno));
+ mp_tmsg(MSGT_INPUT,MSGL_ERR,"Can't open joystick device %s: %s\n",dev ? dev : JS_DEV,strerror(errno));
return -1;
}
@@ -70,7 +70,7 @@ int mp_input_joystick_init(char* dev) {
initialized = 1;
break;
}
- mp_msg(MSGT_INPUT,MSGL_ERR,MSGTR_INPUT_JOYSTICK_ErrReading,strerror(errno));
+ mp_tmsg(MSGT_INPUT,MSGL_ERR,"Error while reading joystick device: %s\n",strerror(errno));
close(fd);
return -1;
}
@@ -78,7 +78,7 @@ int mp_input_joystick_init(char* dev) {
}
if((unsigned int)l < sizeof(struct js_event)) {
if(l > 0)
- mp_msg(MSGT_INPUT,MSGL_WARN,MSGTR_INPUT_JOYSTICK_LoosingBytes,l);
+ mp_tmsg(MSGT_INPUT,MSGL_WARN,"Joystick: We lose %d bytes of data\n",l);
break;
}
if(ev.type == JS_EVENT_BUTTON)
@@ -90,7 +90,7 @@ int mp_input_joystick_init(char* dev) {
return fd;
}
-int mp_input_joystick_read(int fd) {
+int mp_input_joystick_read(void *ctx, int fd) {
struct js_event ev;
int l=0;
@@ -102,9 +102,9 @@ int mp_input_joystick_read(int fd) {
else if(errno == EAGAIN)
return MP_INPUT_NOTHING;
if( r < 0)
- mp_msg(MSGT_INPUT,MSGL_ERR,MSGTR_INPUT_JOYSTICK_ErrReading,strerror(errno));
+ mp_tmsg(MSGT_INPUT,MSGL_ERR,"Error while reading joystick device: %s\n",strerror(errno));
else
- mp_msg(MSGT_INPUT,MSGL_ERR,MSGTR_INPUT_JOYSTICK_ErrReading,"EOF");
+ mp_tmsg(MSGT_INPUT,MSGL_ERR,"Error while reading joystick device: %s\n","EOF");
return MP_INPUT_DEAD;
}
l += r;
@@ -112,12 +112,12 @@ int mp_input_joystick_read(int fd) {
if((unsigned int)l < sizeof(struct js_event)) {
if(l > 0)
- mp_msg(MSGT_INPUT,MSGL_WARN,MSGTR_INPUT_JOYSTICK_LoosingBytes,l);
+ mp_tmsg(MSGT_INPUT,MSGL_WARN,"Joystick: We lose %d bytes of data\n",l);
return MP_INPUT_NOTHING;
}
if(ev.type & JS_EVENT_INIT) {
- mp_msg(MSGT_INPUT,MSGL_WARN,MSGTR_INPUT_JOYSTICK_WarnLostSync);
+ mp_tmsg(MSGT_INPUT,MSGL_WARN,"Joystick: warning init event, we have lost sync with driver.\n");
ev.type &= ~JS_EVENT_INIT;
if(ev.type == JS_EVENT_BUTTON) {
int s = (btns >> ev.number) & 1;
@@ -154,7 +154,7 @@ int mp_input_joystick_read(int fd) {
} else
return MP_INPUT_NOTHING;
} else {
- mp_msg(MSGT_INPUT,MSGL_WARN,MSGTR_INPUT_JOYSTICK_WarnUnknownEvent,ev.type);
+ mp_tmsg(MSGT_INPUT,MSGL_WARN,"Joystick warning unknown event type %d\n",ev.type);
return MP_INPUT_ERROR;
}
diff --git a/input/joystick.h b/input/joystick.h
index dbb269035f..996f0fed21 100644
--- a/input/joystick.h
+++ b/input/joystick.h
@@ -55,6 +55,6 @@
int mp_input_joystick_init(char* dev);
-int mp_input_joystick_read(int fd);
+int mp_input_joystick_read(void *ctx, int fd);
#endif /* MPLAYER_JOYSTICK_H */
diff --git a/input/lirc.c b/input/lirc.c
index d7fb95d7f8..1e3708a3f4 100644
--- a/input/lirc.c
+++ b/input/lirc.c
@@ -40,9 +40,9 @@ mp_input_lirc_init(void) {
int lirc_sock;
int mode;
- mp_msg(MSGT_LIRC,MSGL_V,MSGTR_SettingUpLIRC);
+ mp_tmsg(MSGT_LIRC,MSGL_V,"Setting up LIRC support...\n");
if((lirc_sock=lirc_init("mplayer",1))==-1){
- mp_msg(MSGT_LIRC,MSGL_ERR,MSGTR_LIRCopenfailed);
+ mp_tmsg(MSGT_LIRC,MSGL_ERR,"Failed to open LIRC support. You will not be able to use your remote control.\n");
return -1;
}
@@ -55,7 +55,7 @@ mp_input_lirc_init(void) {
}
if(lirc_readconfig( lirc_configfile,&lirc_config,NULL )!=0 ){
- mp_msg(MSGT_LIRC,MSGL_ERR,MSGTR_LIRCcfgerr,
+ mp_tmsg(MSGT_LIRC,MSGL_ERR,"Failed to read LIRC config file %s.\n",
lirc_configfile == NULL ? "~/.lircrc" : lirc_configfile);
lirc_deinit();
return -1;
diff --git a/libaf/af.c b/libaf/af.c
index 1de8ee3154..2e55a52fe1 100644
--- a/libaf/af.c
+++ b/libaf/af.c
@@ -70,7 +70,7 @@ static af_info_t* filter_list[]={
#endif
&af_info_volnorm,
&af_info_extrastereo,
-#ifdef CONFIG_LIBAVCODEC_A
+#ifdef CONFIG_LIBAVCODEC_INTERNALS
&af_info_lavcac3enc,
#endif
#ifdef CONFIG_LIBAVCODEC
diff --git a/libaf/af.h b/libaf/af.h
index b6b546525e..fe146906e9 100644
--- a/libaf/af.h
+++ b/libaf/af.h
@@ -106,7 +106,7 @@ typedef struct af_cfg_s{
}af_cfg_t;
// Current audio stream
-typedef struct af_stream_s
+typedef struct af_stream
{
// The first and last filter in the list
af_instance_t* first;
diff --git a/libaf/af_delay.c b/libaf/af_delay.c
index 02327d0c53..84a76c470e 100644
--- a/libaf/af_delay.c
+++ b/libaf/af_delay.c
@@ -202,5 +202,3 @@ af_info_t af_info_delay = {
AF_FLAGS_REENTRANT,
af_open
};
-
-
diff --git a/libaf/af_equalizer.c b/libaf/af_equalizer.c
index cdc0011cb7..bd69fdec9d 100644
--- a/libaf/af_equalizer.c
+++ b/libaf/af_equalizer.c
@@ -248,10 +248,3 @@ af_info_t af_info_equalizer = {
AF_FLAGS_NOT_REENTRANT,
af_open
};
-
-
-
-
-
-
-
diff --git a/libaf/af_ladspa.c b/libaf/af_ladspa.c
index e343d1ded7..5c1392d543 100644
--- a/libaf/af_ladspa.c
+++ b/libaf/af_ladspa.c
@@ -213,7 +213,7 @@ static int af_ladspa_parse_plugin(af_ladspa_t *setup) {
if (setup->ninputs == 0) {
mp_msg(MSGT_AFILTER, MSGL_WARN, "%s: %s\n", setup->myname,
- MSGTR_AF_LADSPA_WarnNoInputs);
+ _("WARNING! This LADSPA plugin has no audio inputs.\n The incoming audio signal will be lost."));
} else if (setup->ninputs == 1) {
mp_msg(MSGT_AFILTER, MSGL_V, "%s: this is a mono effect\n", setup->myname);
} else if (setup->ninputs == 2) {
@@ -225,13 +225,13 @@ static int af_ladspa_parse_plugin(af_ladspa_t *setup) {
if (setup->noutputs == 0) {
mp_msg(MSGT_AFILTER, MSGL_ERR, "%s: %s\n", setup->myname,
- MSGTR_AF_LADSPA_ErrNoOutputs);
+ _("This LADSPA plugin has no audio outputs."));
return AF_ERROR;
}
if (setup->noutputs != setup->ninputs ) {
mp_msg(MSGT_AFILTER, MSGL_ERR, "%s: %s\n", setup->myname,
- MSGTR_AF_LADSPA_ErrInOutDiff);
+ _("The number of audio inputs and audio outputs of the LADSPA plugin differ."));
return AF_ERROR;
}
@@ -391,7 +391,7 @@ static int af_ladspa_load_plugin(af_ladspa_t *setup) {
if (!setup->libhandle) {
mp_msg(MSGT_AFILTER, MSGL_ERR, "%s: %s %s\n\t%s\n", setup->myname,
- MSGTR_AF_LADSPA_ErrFailedToLoad, setup->file, dlerror() );
+ _("failed to load"), setup->file, dlerror() );
return AF_ERROR;
}
@@ -404,7 +404,7 @@ static int af_ladspa_load_plugin(af_ladspa_t *setup) {
if (!descriptor_function) {
mp_msg(MSGT_AFILTER, MSGL_ERR, "%s: %s\n\t%s\n", setup->myname,
- MSGTR_AF_LADSPA_ErrNoDescriptor, dlerror());
+ _("Couldn't find ladspa_descriptor() function in the specified library file."), dlerror());
return AF_ERROR;
}
@@ -412,7 +412,7 @@ static int af_ladspa_load_plugin(af_ladspa_t *setup) {
if (strcmp(setup->label, "help") == 0) {
mp_msg(MSGT_AFILTER, MSGL_INFO, "%s: %s %s:\n", setup->myname,
- MSGTR_AF_LADSPA_AvailableLabels, setup->file);
+ _("available labels in"), setup->file);
for (i=0; ; i++) {
ladspa_descriptor = descriptor_function(i);
if (ladspa_descriptor == NULL) {
@@ -432,7 +432,7 @@ static int af_ladspa_load_plugin(af_ladspa_t *setup) {
ladspa_descriptor = descriptor_function(i);
if (ladspa_descriptor == NULL) {
mp_msg(MSGT_AFILTER, MSGL_ERR, "%s: %s\n", setup->myname,
- MSGTR_AF_LADSPA_ErrLabelNotFound);
+ _("Couldn't find label in plugin library."));
return AF_ERROR;
}
if (strcmp(ladspa_descriptor->Label, setup->label) == 0) {
@@ -458,7 +458,7 @@ static int af_ladspa_load_plugin(af_ladspa_t *setup) {
*/
static int af_ladspa_malloc_failed(char *myname) {
- mp_msg(MSGT_AFILTER, MSGL_ERR, "%s: %s", myname, MSGTR_MemAllocFailed);
+ mp_msg(MSGT_AFILTER, MSGL_ERR, "%s: %s", myname, "Memory allocation failed.\n");
return AF_ERROR;
}
@@ -520,7 +520,7 @@ static int control(struct af_instance_s *af, int cmd, void *arg) {
if (!arg) {
mp_msg(MSGT_AFILTER, MSGL_ERR, "%s: %s\n", setup->myname,
- MSGTR_AF_LADSPA_ErrNoSuboptions);
+ _("No suboptions specified."));
return AF_ERROR;
}
@@ -532,7 +532,7 @@ static int control(struct af_instance_s *af, int cmd, void *arg) {
sscanf(arg, "%[^:]", buf);
if (buf[0] == '\0') {
mp_msg(MSGT_AFILTER, MSGL_ERR, "%s: %s\n", setup->myname,
- MSGTR_AF_LADSPA_ErrNoLibFile);
+ _("No library file specified."));
free(buf);
return AF_ERROR;
}
@@ -548,7 +548,7 @@ static int control(struct af_instance_s *af, int cmd, void *arg) {
sscanf(arg, "%[^:]", buf);
if (buf[0] == '\0') {
mp_msg(MSGT_AFILTER, MSGL_ERR, "%s: %s\n", setup->myname,
- MSGTR_AF_LADSPA_ErrNoLabel);
+ _("No filter label specified."));
free(buf);
return AF_ERROR;
}
@@ -584,14 +584,14 @@ static int control(struct af_instance_s *af, int cmd, void *arg) {
for(i=0; i<setup->ninputcontrols; i++) {
if (!arg || (*(char*)arg != ':') ) {
mp_msg(MSGT_AFILTER, MSGL_ERR, "%s: %s\n", setup->myname,
- MSGTR_AF_LADSPA_ErrNotEnoughControls);
+ _("Not enough controls specified on the command line."));
return AF_ERROR;
}
arg++;
r = sscanf(arg, "%f", &val);
if (r!=1) {
mp_msg(MSGT_AFILTER, MSGL_ERR, "%s: %s\n", setup->myname,
- MSGTR_AF_LADSPA_ErrNotEnoughControls);
+ _("Not enough controls specified on the command line."));
return AF_ERROR;
}
setup->inputcontrols[setup->inputcontrolsmap[i]] = val;
@@ -617,13 +617,13 @@ static int control(struct af_instance_s *af, int cmd, void *arg) {
if (LADSPA_IS_HINT_BOUNDED_BELOW(hint.HintDescriptor) &&
val < hint.LowerBound) {
- mp_msg(MSGT_AFILTER, MSGL_ERR, MSGTR_AF_LADSPA_ErrControlBelow,
+ mp_tmsg(MSGT_AFILTER, MSGL_ERR, "%s: Input control #%d is below lower boundary of %0.4f.\n",
setup->myname, i, hint.LowerBound);
return AF_ERROR;
}
if (LADSPA_IS_HINT_BOUNDED_ABOVE(hint.HintDescriptor) &&
val > hint.UpperBound) {
- mp_msg(MSGT_AFILTER, MSGL_ERR, MSGTR_AF_LADSPA_ErrControlAbove,
+ mp_tmsg(MSGT_AFILTER, MSGL_ERR, "%s: Input control #%d is above upper boundary of %0.4f.\n",
setup->myname, i, hint.UpperBound);
return AF_ERROR;
}
diff --git a/libaf/af_lavcac3enc.c b/libaf/af_lavcac3enc.c
index 3d2d9e3b82..a86b7fbdbd 100644
--- a/libaf/af_lavcac3enc.c
+++ b/libaf/af_lavcac3enc.c
@@ -99,7 +99,7 @@ static int control(struct af_instance_s *af, int cmd, void *arg)
s->lavc_actx->bit_rate = bit_rate;
if(avcodec_open(s->lavc_actx, s->lavc_acodec) < 0) {
- mp_msg(MSGT_AFILTER, MSGL_ERR, MSGTR_CouldntOpenCodec, "ac3", bit_rate);
+ mp_tmsg(MSGT_AFILTER, MSGL_ERR, "Couldn't open codec %s, br=%d.\n", "ac3", bit_rate);
return AF_ERROR;
}
}
@@ -281,13 +281,13 @@ static int af_open(af_instance_t* af){
s->lavc_acodec = avcodec_find_encoder_by_name("ac3");
if (!s->lavc_acodec) {
- mp_msg(MSGT_AFILTER, MSGL_ERR, MSGTR_LavcAudioCodecNotFound, "ac3");
+ mp_tmsg(MSGT_AFILTER, MSGL_ERR, "Audio LAVC, couldn't find encoder for codec %s.\n", "ac3");
return AF_ERROR;
}
s->lavc_actx = avcodec_alloc_context();
if (!s->lavc_actx) {
- mp_msg(MSGT_AFILTER, MSGL_ERR, MSGTR_CouldntAllocateLavcContext);
+ mp_tmsg(MSGT_AFILTER, MSGL_ERR, "Audio LAVC, couldn't allocate context!\n");
return AF_ERROR;
}
diff --git a/libaf/af_resample.c b/libaf/af_resample.c
index ac39f36faf..5dd0e70329 100644
--- a/libaf/af_resample.c
+++ b/libaf/af_resample.c
@@ -393,4 +393,3 @@ af_info_t af_info_resample = {
AF_FLAGS_REENTRANT,
af_open
};
-
diff --git a/libaf/af_scaletempo.c b/libaf/af_scaletempo.c
index 8b39290efa..4c86744231 100644
--- a/libaf/af_scaletempo.c
+++ b/libaf/af_scaletempo.c
@@ -226,6 +226,7 @@ static af_data_t* play(struct af_instance_s* af, af_data_t* data)
int8_t* pout;
if (s->scale == 1.0) {
+ af->delay = 0;
return data;
}
@@ -470,27 +471,28 @@ static int control(struct af_instance_s* af, int cmd, void* arg)
return AF_ERROR;
}
if (s->scale_nominal <= 0) {
- mp_msg(MSGT_AFILTER, MSGL_ERR, "[scaletempo] "
- MSGTR_ErrorParsingCommandLine ": " MSGTR_AF_ValueOutOfRange
- ": scale > 0\n");
+ mp_msg(MSGT_AFILTER, MSGL_ERR, "[scaletempo] %s: %s: scale > 0\n",
+ mp_gtext("error parsing command line"),
+ mp_gtext("value out of range"));
return AF_ERROR;
}
if (s->ms_stride <= 0) {
- mp_msg(MSGT_AFILTER, MSGL_ERR, "[scaletempo] "
- MSGTR_ErrorParsingCommandLine ": " MSGTR_AF_ValueOutOfRange
- ": stride > 0\n");
+ mp_msg(MSGT_AFILTER, MSGL_ERR, "[scaletempo] %s: %s: stride > 0\n",
+ mp_gtext("error parsing command line"),
+ mp_gtext("value out of range"));
return AF_ERROR;
}
if (s->percent_overlap < 0 || s->percent_overlap > 1) {
- mp_msg(MSGT_AFILTER, MSGL_ERR, "[scaletempo] "
- MSGTR_ErrorParsingCommandLine ": " MSGTR_AF_ValueOutOfRange
- ": 0 <= overlap <= 1\n");
+ mp_msg(MSGT_AFILTER, MSGL_ERR,
+ "[scaletempo] %s: %s: 0 <= overlap <= 1\n",
+ mp_gtext("error parsing command line"),
+ mp_gtext("value out of range"));
return AF_ERROR;
}
if (s->ms_search < 0) {
- mp_msg(MSGT_AFILTER, MSGL_ERR, "[scaletempo] "
- MSGTR_ErrorParsingCommandLine ": " MSGTR_AF_ValueOutOfRange
- ": search >= 0\n");
+ mp_msg(MSGT_AFILTER, MSGL_ERR, "[scaletempo] %s: %s: search >= 0\n",
+ mp_gtext("error parsing command line"),
+ mp_gtext("value out of range"));
return AF_ERROR;
}
if (speed.len > 0) {
@@ -507,9 +509,10 @@ static int control(struct af_instance_s* af, int cmd, void* arg)
s->speed_tempo = 1;
s->speed_pitch = 1;
} else {
- mp_msg(MSGT_AFILTER, MSGL_ERR, "[scaletempo] "
- MSGTR_ErrorParsingCommandLine ": " MSGTR_AF_ValueOutOfRange
- ": speed=[pitch|tempo|none|both]\n");
+ mp_msg(MSGT_AFILTER, MSGL_ERR,
+ "[scaletempo] %s: %s: speed=[pitch|tempo|none|both]\n",
+ mp_gtext("error parsing command line"),
+ mp_gtext("value out of range"));
return AF_ERROR;
}
}
diff --git a/libaf/af_sweep.c b/libaf/af_sweep.c
index 782bf7ec46..e1890c6b3b 100644
--- a/libaf/af_sweep.c
+++ b/libaf/af_sweep.c
@@ -105,4 +105,3 @@ af_info_t af_info_sweep = {
AF_FLAGS_REENTRANT,
af_open
};
-
diff --git a/libaf/filter.c b/libaf/filter.c
index 9ea4359a32..c5ab039130 100644
--- a/libaf/filter.c
+++ b/libaf/filter.c
@@ -448,4 +448,3 @@ int af_filter_szxform(const FLOAT_TYPE* a, const FLOAT_TYPE* b, FLOAT_TYPE Q, FL
return 0;
}
-
diff --git a/libaf/format.c b/libaf/format.c
index 21494f43b4..8146899c7e 100644
--- a/libaf/format.c
+++ b/libaf/format.c
@@ -124,7 +124,7 @@ char* af_fmt2str(int format, char* str, int size)
case(AF_FORMAT_IMA_ADPCM):
i+=snprintf(&str[i],size-i,"IMA-ADPCM "); break;
default:
- i+=snprintf(&str[i],size-i,MSGTR_AF_FORMAT_UnknownFormat);
+ i+=snprintf(&str[i],size-i,mp_gtext("unknown format "));
}
}
else{
diff --git a/libaf/window.c b/libaf/window.c
index 2b2923afc9..a970bdcbea 100644
--- a/libaf/window.c
+++ b/libaf/window.c
@@ -211,4 +211,3 @@ void af_window_kaiser(int n, FLOAT_TYPE* w, FLOAT_TYPE b)
w[end-(1&(!k2))+i] = w[end-1-i] = k1 * besselizero(b*sqrt(1.0 - tmp*tmp));
}
}
-
diff --git a/libao2/ao_alsa.c b/libao2/ao_alsa.c
index 57f0bd07cb..6d30003187 100644
--- a/libao2/ao_alsa.c
+++ b/libao2/ao_alsa.c
@@ -72,9 +72,13 @@ static snd_pcm_format_t alsa_format;
static snd_pcm_hw_params_t *alsa_hwparams;
static snd_pcm_sw_params_t *alsa_swparams;
+#define BUFFER_TIME 500000 // 0.5 s
+#define FRAGCOUNT 16
+
static size_t bytes_per_sample;
static int alsa_can_pause;
+static snd_pcm_sframes_t prepause_frames;
#define ALSA_DEVICE_SIZE 256
@@ -134,8 +138,8 @@ static int control(int cmd, void *arg)
mix_index = strtol(test_mix_index, &test_mix_index, 0);
if (*test_mix_index){
- mp_msg(MSGT_AO,MSGL_ERR,
- MSGTR_AO_ALSA_InvalidMixerIndexDefaultingToZero);
+ mp_tmsg(MSGT_AO,MSGL_ERR,
+ "[AO_ALSA] Invalid mixer index. Defaulting to 0.\n");
mix_index = 0 ;
}
}
@@ -155,32 +159,32 @@ static int control(int cmd, void *arg)
}
if ((err = snd_mixer_open(&handle, 0)) < 0) {
- mp_msg(MSGT_AO,MSGL_ERR,MSGTR_AO_ALSA_MixerOpenError, snd_strerror(err));
+ mp_tmsg(MSGT_AO,MSGL_ERR,"[AO_ALSA] Mixer open error: %s\n", snd_strerror(err));
return CONTROL_ERROR;
}
if ((err = snd_mixer_attach(handle, card)) < 0) {
- mp_msg(MSGT_AO,MSGL_ERR,MSGTR_AO_ALSA_MixerAttachError,
+ mp_tmsg(MSGT_AO,MSGL_ERR,"[AO_ALSA] Mixer attach %s error: %s\n",
card, snd_strerror(err));
snd_mixer_close(handle);
return CONTROL_ERROR;
}
if ((err = snd_mixer_selem_register(handle, NULL, NULL)) < 0) {
- mp_msg(MSGT_AO,MSGL_ERR,MSGTR_AO_ALSA_MixerRegisterError, snd_strerror(err));
+ mp_tmsg(MSGT_AO,MSGL_ERR,"[AO_ALSA] Mixer register error: %s\n", snd_strerror(err));
snd_mixer_close(handle);
return CONTROL_ERROR;
}
err = snd_mixer_load(handle);
if (err < 0) {
- mp_msg(MSGT_AO,MSGL_ERR,MSGTR_AO_ALSA_MixerLoadError, snd_strerror(err));
+ mp_tmsg(MSGT_AO,MSGL_ERR,"[AO_ALSA] Mixer load error: %s\n", snd_strerror(err));
snd_mixer_close(handle);
return CONTROL_ERROR;
}
elem = snd_mixer_find_selem(handle, sid);
if (!elem) {
- mp_msg(MSGT_AO,MSGL_ERR,MSGTR_AO_ALSA_UnableToFindSimpleControl,
+ mp_tmsg(MSGT_AO,MSGL_ERR,"[AO_ALSA] Unable to find simple control '%s',%i.\n",
snd_mixer_selem_id_get_name(sid), snd_mixer_selem_id_get_index(sid));
snd_mixer_close(handle);
return CONTROL_ERROR;
@@ -195,7 +199,7 @@ static int control(int cmd, void *arg)
//setting channels
if ((err = snd_mixer_selem_set_playback_volume(elem, SND_MIXER_SCHN_FRONT_LEFT, set_vol)) < 0) {
- mp_msg(MSGT_AO,MSGL_ERR,MSGTR_AO_ALSA_ErrorSettingLeftChannel,
+ mp_tmsg(MSGT_AO,MSGL_ERR,"[AO_ALSA] Error setting left channel, %s\n",
snd_strerror(err));
snd_mixer_close(handle);
return CONTROL_ERROR;
@@ -205,7 +209,7 @@ static int control(int cmd, void *arg)
set_vol = vol->right / f_multi + pmin + 0.5;
if ((err = snd_mixer_selem_set_playback_volume(elem, SND_MIXER_SCHN_FRONT_RIGHT, set_vol)) < 0) {
- mp_msg(MSGT_AO,MSGL_ERR,MSGTR_AO_ALSA_ErrorSettingRightChannel,
+ mp_tmsg(MSGT_AO,MSGL_ERR,"[AO_ALSA] Error setting right channel, %s\n",
snd_strerror(err));
snd_mixer_close(handle);
return CONTROL_ERROR;
@@ -253,8 +257,15 @@ static void parse_device (char *dest, const char *src, int len)
static void print_help (void)
{
- mp_msg (MSGT_AO, MSGL_FATAL,
- MSGTR_AO_ALSA_CommandlineHelp);
+ mp_tmsg (MSGT_AO, MSGL_FATAL,
+ "\n[AO_ALSA] -ao alsa commandline help:\n"\
+ "[AO_ALSA] Example: mplayer -ao alsa:device=hw=0.3\n"\
+ "[AO_ALSA] Sets first card fourth hardware device.\n\n"\
+ "[AO_ALSA] Options:\n"\
+ "[AO_ALSA] noblock\n"\
+ "[AO_ALSA] Opens device in non-blocking mode.\n"\
+ "[AO_ALSA] device=<device-name>\n"\
+ "[AO_ALSA] Sets device (change , to . and : to =)\n");
}
static int str_maxlen(void *strp) {
@@ -313,8 +324,6 @@ static int try_open_device(const char *device, int open_mode, int try_ac3)
*/
static int init(int rate_hz, int channels, int format, int flags)
{
- unsigned int alsa_buffer_time = 500000; /* 0.5 s */
- unsigned int alsa_fragcount = 16;
int err;
int block;
strarg_t device;
@@ -340,6 +349,8 @@ static int init(int rate_hz, int channels, int format, int flags)
mp_msg(MSGT_AO,MSGL_V,"alsa-init: compiled for ALSA-%s\n", SND_LIB_VERSION_STR);
#endif
+ prepause_frames = 0;
+
snd_lib_error_set_handler(alsa_error_handler);
ao_data.samplerate = rate_hz;
@@ -457,7 +468,7 @@ static int init(int rate_hz, int channels, int format, int flags)
break;
default:
device.str = "default";
- mp_msg(MSGT_AO,MSGL_ERR,MSGTR_AO_ALSA_ChannelsNotSupported,channels);
+ mp_tmsg(MSGT_AO,MSGL_ERR,"[AO_ALSA] %d channels are not supported.\n",channels);
}
device.len = strlen(device.str);
if (subopt_parse(ao_subdevice, subopts) != 0) {
@@ -475,19 +486,19 @@ static int init(int rate_hz, int channels, int format, int flags)
if ((err = try_open_device(alsa_device, open_mode, isac3)) < 0)
{
if (err != -EBUSY && !block) {
- mp_msg(MSGT_AO,MSGL_INFO,MSGTR_AO_ALSA_OpenInNonblockModeFailed);
+ mp_tmsg(MSGT_AO,MSGL_INFO,"[AO_ALSA] Open in nonblock-mode failed, trying to open in block-mode.\n");
if ((err = try_open_device(alsa_device, 0, isac3)) < 0) {
- mp_msg(MSGT_AO,MSGL_ERR,MSGTR_AO_ALSA_PlaybackOpenError, snd_strerror(err));
+ mp_tmsg(MSGT_AO,MSGL_ERR,"[AO_ALSA] Playback open error: %s\n", snd_strerror(err));
return 0;
}
} else {
- mp_msg(MSGT_AO,MSGL_ERR,MSGTR_AO_ALSA_PlaybackOpenError, snd_strerror(err));
+ mp_tmsg(MSGT_AO,MSGL_ERR,"[AO_ALSA] Playback open error: %s\n", snd_strerror(err));
return 0;
}
}
if ((err = snd_pcm_nonblock(alsa_handler, 0)) < 0) {
- mp_msg(MSGT_AO,MSGL_ERR,MSGTR_AO_ALSA_ErrorSetBlockMode, snd_strerror(err));
+ mp_tmsg(MSGT_AO,MSGL_ERR,"[AL_ALSA] Error setting block-mode %s.\n", snd_strerror(err));
} else {
mp_msg(MSGT_AO,MSGL_V,"alsa-init: pcm opened in blocking mode\n");
}
@@ -498,7 +509,7 @@ static int init(int rate_hz, int channels, int format, int flags)
// setting hw-parameters
if ((err = snd_pcm_hw_params_any(alsa_handler, alsa_hwparams)) < 0)
{
- mp_msg(MSGT_AO,MSGL_ERR,MSGTR_AO_ALSA_UnableToGetInitialParameters,
+ mp_tmsg(MSGT_AO,MSGL_ERR,"[AO_ALSA] Unable to get initial parameters: %s\n",
snd_strerror(err));
return 0;
}
@@ -506,7 +517,7 @@ static int init(int rate_hz, int channels, int format, int flags)
err = snd_pcm_hw_params_set_access(alsa_handler, alsa_hwparams,
SND_PCM_ACCESS_RW_INTERLEAVED);
if (err < 0) {
- mp_msg(MSGT_AO,MSGL_ERR,MSGTR_AO_ALSA_UnableToSetAccessType,
+ mp_tmsg(MSGT_AO,MSGL_ERR,"[AO_ALSA] Unable to set access type: %s\n",
snd_strerror(err));
return 0;
}
@@ -516,8 +527,8 @@ static int init(int rate_hz, int channels, int format, int flags)
if ((err = snd_pcm_hw_params_test_format(alsa_handler, alsa_hwparams,
alsa_format)) < 0)
{
- mp_msg(MSGT_AO,MSGL_INFO,
- MSGTR_AO_ALSA_FormatNotSupportedByHardware, af_fmt2str_short(format));
+ mp_tmsg(MSGT_AO,MSGL_INFO,
+ "[AO_ALSA] Format %s is not supported by hardware, trying default.\n", af_fmt2str_short(format));
alsa_format = SND_PCM_FORMAT_S16_LE;
if (AF_FORMAT_IS_AC3(ao_data.format))
ao_data.format = AF_FORMAT_AC3_LE;
@@ -528,7 +539,7 @@ static int init(int rate_hz, int channels, int format, int flags)
if ((err = snd_pcm_hw_params_set_format(alsa_handler, alsa_hwparams,
alsa_format)) < 0)
{
- mp_msg(MSGT_AO,MSGL_ERR,MSGTR_AO_ALSA_UnableToSetFormat,
+ mp_tmsg(MSGT_AO,MSGL_ERR,"[AO_ALSA] Unable to set format: %s\n",
snd_strerror(err));
return 0;
}
@@ -536,7 +547,7 @@ static int init(int rate_hz, int channels, int format, int flags)
if ((err = snd_pcm_hw_params_set_channels_near(alsa_handler, alsa_hwparams,
&ao_data.channels)) < 0)
{
- mp_msg(MSGT_AO,MSGL_ERR,MSGTR_AO_ALSA_UnableToSetChannels,
+ mp_tmsg(MSGT_AO,MSGL_ERR,"[AO_ALSA] Unable to set channels: %s\n",
snd_strerror(err));
return 0;
}
@@ -548,7 +559,7 @@ static int init(int rate_hz, int channels, int format, int flags)
if ((err = snd_pcm_hw_params_set_rate_resample(alsa_handler, alsa_hwparams,
0)) < 0)
{
- mp_msg(MSGT_AO,MSGL_ERR,MSGTR_AO_ALSA_UnableToDisableResampling,
+ mp_tmsg(MSGT_AO,MSGL_ERR,"[AO_ALSA] Unable to disable resampling: %s\n",
snd_strerror(err));
return 0;
}
@@ -557,7 +568,7 @@ static int init(int rate_hz, int channels, int format, int flags)
if ((err = snd_pcm_hw_params_set_rate_near(alsa_handler, alsa_hwparams,
&ao_data.samplerate, NULL)) < 0)
{
- mp_msg(MSGT_AO,MSGL_ERR,MSGTR_AO_ALSA_UnableToSetSamplerate2,
+ mp_tmsg(MSGT_AO,MSGL_ERR,"[AO_ALSA] Unable to set samplerate-2: %s\n",
snd_strerror(err));
return 0;
}
@@ -567,16 +578,16 @@ static int init(int rate_hz, int channels, int format, int flags)
ao_data.bps = ao_data.samplerate * bytes_per_sample;
if ((err = snd_pcm_hw_params_set_buffer_time_near(alsa_handler, alsa_hwparams,
- &alsa_buffer_time, NULL)) < 0)
+ &(unsigned int){BUFFER_TIME}, NULL)) < 0)
{
- mp_msg(MSGT_AO,MSGL_ERR,MSGTR_AO_ALSA_UnableToSetBufferTimeNear,
+ mp_tmsg(MSGT_AO,MSGL_ERR,"[AO_ALSA] Unable to set buffer time near: %s\n",
snd_strerror(err));
return 0;
}
if ((err = snd_pcm_hw_params_set_periods_near(alsa_handler, alsa_hwparams,
- &alsa_fragcount, NULL)) < 0) {
- mp_msg(MSGT_AO,MSGL_ERR,MSGTR_AO_ALSA_UnableToSetPeriods,
+ &(unsigned int){FRAGCOUNT}, NULL)) < 0) {
+ mp_tmsg(MSGT_AO,MSGL_ERR,"[AO_ALSA] Unable to set periods: %s\n",
snd_strerror(err));
return 0;
}
@@ -584,7 +595,7 @@ static int init(int rate_hz, int channels, int format, int flags)
/* finally install hardware parameters */
if ((err = snd_pcm_hw_params(alsa_handler, alsa_hwparams)) < 0)
{
- mp_msg(MSGT_AO,MSGL_ERR,MSGTR_AO_ALSA_UnableToSetHwParameters,
+ mp_tmsg(MSGT_AO,MSGL_ERR,"[AO_ALSA] Unable to set hw-parameters: %s\n",
snd_strerror(err));
return 0;
}
@@ -594,7 +605,7 @@ static int init(int rate_hz, int channels, int format, int flags)
// gets buffersize for control
if ((err = snd_pcm_hw_params_get_buffer_size(alsa_hwparams, &bufsize)) < 0)
{
- mp_msg(MSGT_AO,MSGL_ERR,MSGTR_AO_ALSA_UnableToGetBufferSize, snd_strerror(err));
+ mp_tmsg(MSGT_AO,MSGL_ERR,"[AO_ALSA] Unable to get buffersize: %s\n", snd_strerror(err));
return 0;
}
else {
@@ -603,7 +614,7 @@ static int init(int rate_hz, int channels, int format, int flags)
}
if ((err = snd_pcm_hw_params_get_period_size(alsa_hwparams, &chunk_size, NULL)) < 0) {
- mp_msg(MSGT_AO,MSGL_ERR,MSGTR_AO_ALSA_UnableToGetPeriodSize, snd_strerror(err));
+ mp_tmsg(MSGT_AO,MSGL_ERR,"[AO ALSA] Unable to get period size: %s\n", snd_strerror(err));
return 0;
} else {
mp_msg(MSGT_AO,MSGL_V,"alsa-init: got period size %li\n", chunk_size);
@@ -612,13 +623,13 @@ static int init(int rate_hz, int channels, int format, int flags)
/* setting software parameters */
if ((err = snd_pcm_sw_params_current(alsa_handler, alsa_swparams)) < 0) {
- mp_msg(MSGT_AO,MSGL_ERR,MSGTR_AO_ALSA_UnableToGetSwParameters,
+ mp_tmsg(MSGT_AO,MSGL_ERR,"[AO_ALSA] Unable to get sw-parameters: %s\n",
snd_strerror(err));
return 0;
}
#if SND_LIB_VERSION >= 0x000901
if ((err = snd_pcm_sw_params_get_boundary(alsa_swparams, &boundary)) < 0) {
- mp_msg(MSGT_AO,MSGL_ERR,MSGTR_AO_ALSA_UnableToGetBoundary,
+ mp_tmsg(MSGT_AO,MSGL_ERR,"[AO_ALSA] Unable to get boundary: %s\n",
snd_strerror(err));
return 0;
}
@@ -627,26 +638,26 @@ static int init(int rate_hz, int channels, int format, int flags)
#endif
/* start playing when one period has been written */
if ((err = snd_pcm_sw_params_set_start_threshold(alsa_handler, alsa_swparams, chunk_size)) < 0) {
- mp_msg(MSGT_AO,MSGL_ERR,MSGTR_AO_ALSA_UnableToSetStartThreshold,
+ mp_tmsg(MSGT_AO,MSGL_ERR,"[AO_ALSA] Unable to set start threshold: %s\n",
snd_strerror(err));
return 0;
}
/* disable underrun reporting */
if ((err = snd_pcm_sw_params_set_stop_threshold(alsa_handler, alsa_swparams, boundary)) < 0) {
- mp_msg(MSGT_AO,MSGL_ERR,MSGTR_AO_ALSA_UnableToSetStopThreshold,
+ mp_tmsg(MSGT_AO,MSGL_ERR,"[AO_ALSA] Unable to set stop threshold: %s\n",
snd_strerror(err));
return 0;
}
#if SND_LIB_VERSION >= 0x000901
/* play silence when there is an underrun */
if ((err = snd_pcm_sw_params_set_silence_size(alsa_handler, alsa_swparams, boundary)) < 0) {
- mp_msg(MSGT_AO,MSGL_ERR,MSGTR_AO_ALSA_UnableToSetSilenceSize,
+ mp_tmsg(MSGT_AO,MSGL_ERR,"[AO_ALSA] Unable to set silence size: %s\n",
snd_strerror(err));
return 0;
}
#endif
if ((err = snd_pcm_sw_params(alsa_handler, alsa_swparams)) < 0) {
- mp_msg(MSGT_AO,MSGL_ERR,MSGTR_AO_ALSA_UnableToGetSwParameters,
+ mp_tmsg(MSGT_AO,MSGL_ERR,"[AO_ALSA] Unable to get sw-parameters: %s\n",
snd_strerror(err));
return 0;
}
@@ -674,7 +685,7 @@ static void uninit(int immed)
if ((err = snd_pcm_close(alsa_handler)) < 0)
{
- mp_msg(MSGT_AO,MSGL_ERR,MSGTR_AO_ALSA_PcmCloseError, snd_strerror(err));
+ mp_tmsg(MSGT_AO,MSGL_ERR,"[AO_ALSA] pcm close error: %s\n", snd_strerror(err));
return;
}
else {
@@ -683,7 +694,7 @@ static void uninit(int immed)
}
}
else {
- mp_msg(MSGT_AO,MSGL_ERR,MSGTR_AO_ALSA_NoHandlerDefined);
+ mp_tmsg(MSGT_AO,MSGL_ERR,"[AO_ALSA] No handler defined!\n");
}
}
@@ -694,14 +705,18 @@ static void audio_pause(void)
if (alsa_can_pause) {
if ((err = snd_pcm_pause(alsa_handler, 1)) < 0)
{
- mp_msg(MSGT_AO,MSGL_ERR,MSGTR_AO_ALSA_PcmPauseError, snd_strerror(err));
+ mp_tmsg(MSGT_AO,MSGL_ERR,"[AO_ALSA] pcm pause error: %s\n", snd_strerror(err));
return;
}
mp_msg(MSGT_AO,MSGL_V,"alsa-pause: pause supported by hardware\n");
} else {
+ if (snd_pcm_delay(alsa_handler, &prepause_frames) < 0
+ || prepause_frames < 0)
+ prepause_frames = 0;
+
if ((err = snd_pcm_drop(alsa_handler)) < 0)
{
- mp_msg(MSGT_AO,MSGL_ERR,MSGTR_AO_ALSA_PcmDropError, snd_strerror(err));
+ mp_tmsg(MSGT_AO,MSGL_ERR,"[AO_ALSA] pcm drop error: %s\n", snd_strerror(err));
return;
}
}
@@ -712,22 +727,27 @@ static void audio_resume(void)
int err;
if (snd_pcm_state(alsa_handler) == SND_PCM_STATE_SUSPENDED) {
- mp_msg(MSGT_AO,MSGL_INFO,MSGTR_AO_ALSA_PcmInSuspendModeTryingResume);
+ mp_tmsg(MSGT_AO,MSGL_INFO,"[AO_ALSA] Pcm in suspend mode, trying to resume.\n");
while ((err = snd_pcm_resume(alsa_handler)) == -EAGAIN) sleep(1);
}
if (alsa_can_pause) {
if ((err = snd_pcm_pause(alsa_handler, 0)) < 0)
{
- mp_msg(MSGT_AO,MSGL_ERR,MSGTR_AO_ALSA_PcmResumeError, snd_strerror(err));
+ mp_tmsg(MSGT_AO,MSGL_ERR,"[AO_ALSA] pcm resume error: %s\n", snd_strerror(err));
return;
}
mp_msg(MSGT_AO,MSGL_V,"alsa-resume: resume supported by hardware\n");
} else {
if ((err = snd_pcm_prepare(alsa_handler)) < 0)
{
- mp_msg(MSGT_AO,MSGL_ERR,MSGTR_AO_ALSA_PcmPrepareError, snd_strerror(err));
+ mp_tmsg(MSGT_AO,MSGL_ERR,"[AO_ALSA] pcm prepare error: %s\n", snd_strerror(err));
return;
}
+ if (prepause_frames) {
+ void *silence = calloc(prepause_frames, bytes_per_sample);
+ play(silence, prepause_frames * bytes_per_sample, 0);
+ free(silence);
+ }
}
}
@@ -736,14 +756,15 @@ static void reset(void)
{
int err;
+ prepause_frames = 0;
if ((err = snd_pcm_drop(alsa_handler)) < 0)
{
- mp_msg(MSGT_AO,MSGL_ERR,MSGTR_AO_ALSA_PcmPrepareError, snd_strerror(err));
+ mp_tmsg(MSGT_AO,MSGL_ERR,"[AO_ALSA] pcm prepare error: %s\n", snd_strerror(err));
return;
}
if ((err = snd_pcm_prepare(alsa_handler)) < 0)
{
- mp_msg(MSGT_AO,MSGL_ERR,MSGTR_AO_ALSA_PcmPrepareError, snd_strerror(err));
+ mp_tmsg(MSGT_AO,MSGL_ERR,"[AO_ALSA] pcm prepare error: %s\n", snd_strerror(err));
return;
}
return;
@@ -767,7 +788,7 @@ static int play(void* data, int len, int flags)
//mp_msg(MSGT_AO,MSGL_ERR,"alsa-play: frames=%i, len=%i\n",num_frames,len);
if (!alsa_handler) {
- mp_msg(MSGT_AO,MSGL_ERR,MSGTR_AO_ALSA_DeviceConfigurationError);
+ mp_tmsg(MSGT_AO,MSGL_ERR,"[AO_ALSA] Device configuration error.");
return 0;
}
@@ -782,15 +803,15 @@ static int play(void* data, int len, int flags)
res = 0;
}
else if (res == -ESTRPIPE) { /* suspend */
- mp_msg(MSGT_AO,MSGL_INFO,MSGTR_AO_ALSA_PcmInSuspendModeTryingResume);
+ mp_tmsg(MSGT_AO,MSGL_INFO,"[AO_ALSA] Pcm in suspend mode, trying to resume.\n");
while ((res = snd_pcm_resume(alsa_handler)) == -EAGAIN)
sleep(1);
}
if (res < 0) {
- mp_msg(MSGT_AO,MSGL_ERR,MSGTR_AO_ALSA_WriteError, snd_strerror(res));
- mp_msg(MSGT_AO,MSGL_INFO,MSGTR_AO_ALSA_TryingToResetSoundcard);
+ mp_tmsg(MSGT_AO,MSGL_ERR,"[AO_ALSA] Write error: %s\n", snd_strerror(res));
+ mp_tmsg(MSGT_AO,MSGL_INFO,"[AO_ALSA] Trying to reset soundcard.\n");
if ((res = snd_pcm_prepare(alsa_handler)) < 0) {
- mp_msg(MSGT_AO,MSGL_ERR,MSGTR_AO_ALSA_PcmPrepareError, snd_strerror(res));
+ mp_tmsg(MSGT_AO,MSGL_ERR,"[AO_ALSA] pcm prepare error: %s\n", snd_strerror(res));
return 0;
break;
}
@@ -810,14 +831,14 @@ static int get_space(void)
if ((ret = snd_pcm_status(alsa_handler, status)) < 0)
{
- mp_msg(MSGT_AO,MSGL_ERR,MSGTR_AO_ALSA_CannotGetPcmStatus, snd_strerror(ret));
+ mp_tmsg(MSGT_AO,MSGL_ERR,"[AO_ALSA] Cannot get pcm status: %s\n", snd_strerror(ret));
return 0;
}
- ret = snd_pcm_status_get_avail(status) * bytes_per_sample;
- if (ret > ao_data.buffersize) // Buffer underrun?
- ret = ao_data.buffersize;
- return ret;
+ unsigned space = snd_pcm_status_get_avail(status) * bytes_per_sample;
+ if (space > ao_data.buffersize) // Buffer underrun?
+ space = ao_data.buffersize;
+ return space;
}
/* delay in seconds between first and last sample in buffer */
diff --git a/libao2/ao_alsa5.c b/libao2/ao_alsa5.c
index a9b470e9d5..ad17f5895f 100644
--- a/libao2/ao_alsa5.c
+++ b/libao2/ao_alsa5.c
@@ -65,7 +65,7 @@ static int init(int rate_hz, int channels, int format, int flags)
snd_pcm_info_t info;
snd_pcm_channel_info_t chninfo;
- mp_msg(MSGT_AO, MSGL_INFO, MSGTR_AO_ALSA5_InitInfo, rate_hz,
+ mp_tmsg(MSGT_AO, MSGL_INFO, "[AO ALSA5] alsa-init: requested format: %d Hz, %d channels, %s\n", rate_hz,
channels, af_fmt2str_short(format));
alsa_handler = NULL;
@@ -75,7 +75,7 @@ static int init(int rate_hz, int channels, int format, int flags)
if ((cards = snd_cards()) < 0)
{
- mp_msg(MSGT_AO, MSGL_ERR, MSGTR_AO_ALSA5_SoundCardNotFound);
+ mp_tmsg(MSGT_AO, MSGL_ERR, "[AO ALSA5] alsa-init: no soundcards found.\n");
return 0;
}
@@ -121,7 +121,7 @@ static int init(int rate_hz, int channels, int format, int flags)
ao_data.bps *= 2;
break;
case -1:
- mp_msg(MSGT_AO, MSGL_ERR, MSGTR_AO_ALSA5_InvalidFormatReq,af_fmt2str_short(format));
+ mp_tmsg(MSGT_AO, MSGL_ERR, "[AO ALSA5] alsa-init: invalid format (%s) requested - output disabled.\n",af_fmt2str_short(format));
return 0;
default:
break;
@@ -173,17 +173,17 @@ static int init(int rate_hz, int channels, int format, int flags)
if ((err = snd_pcm_open(&alsa_handler, 0, 0, SND_PCM_OPEN_PLAYBACK)) < 0)
{
- mp_msg(MSGT_AO, MSGL_ERR, MSGTR_AO_ALSA5_PlayBackError, snd_strerror(err));
+ mp_tmsg(MSGT_AO, MSGL_ERR, "[AO ALSA5] alsa-init: playback open error: %s\n", snd_strerror(err));
return 0;
}
if ((err = snd_pcm_info(alsa_handler, &info)) < 0)
{
- mp_msg(MSGT_AO, MSGL_ERR, MSGTR_AO_ALSA5_PcmInfoError, snd_strerror(err));
+ mp_tmsg(MSGT_AO, MSGL_ERR, "[AO ALSA5] alsa-init: PCM info error: %s\n", snd_strerror(err));
return 0;
}
- mp_msg(MSGT_AO, MSGL_INFO, MSGTR_AO_ALSA5_SoundcardsFound,
+ mp_tmsg(MSGT_AO, MSGL_INFO, "[AO ALSA5] alsa-init: %d soundcard(s) found, using: %s\n",
cards, info.name);
if (info.flags & SND_PCM_INFO_PLAYBACK)
@@ -192,7 +192,7 @@ static int init(int rate_hz, int channels, int format, int flags)
chninfo.channel = SND_PCM_CHANNEL_PLAYBACK;
if ((err = snd_pcm_channel_info(alsa_handler, &chninfo)) < 0)
{
- mp_msg(MSGT_AO, MSGL_ERR, MSGTR_AO_ALSA5_PcmChanInfoError, snd_strerror(err));
+ mp_tmsg(MSGT_AO, MSGL_ERR, "[AO ALSA5] alsa-init: PCM channel info error: %s\n", snd_strerror(err));
return 0;
}
@@ -216,7 +216,7 @@ static int init(int rate_hz, int channels, int format, int flags)
if ((err = snd_pcm_channel_params(alsa_handler, &params)) < 0)
{
- mp_msg(MSGT_AO, MSGL_ERR, MSGTR_AO_ALSA5_CantSetParms, snd_strerror(err));
+ mp_tmsg(MSGT_AO, MSGL_ERR, "[AO ALSA5] alsa-init: error setting parameters: %s\n", snd_strerror(err));
return 0;
}
@@ -229,13 +229,13 @@ static int init(int rate_hz, int channels, int format, int flags)
if ((err = snd_pcm_channel_setup(alsa_handler, &setup)) < 0)
{
- mp_msg(MSGT_AO, MSGL_ERR, MSGTR_AO_ALSA5_CantSetChan, snd_strerror(err));
+ mp_tmsg(MSGT_AO, MSGL_ERR, "[AO ALSA5] alsa-init: error setting up channel: %s\n", snd_strerror(err));
return 0;
}
if ((err = snd_pcm_channel_prepare(alsa_handler, SND_PCM_CHANNEL_PLAYBACK)) < 0)
{
- mp_msg(MSGT_AO, MSGL_ERR, MSGTR_AO_ALSA5_ChanPrepareError, snd_strerror(err));
+ mp_tmsg(MSGT_AO, MSGL_ERR, "[AO ALSA5] alsa-init: channel prepare error: %s\n", snd_strerror(err));
return 0;
}
@@ -252,19 +252,19 @@ static void uninit(int immed)
if ((err = snd_pcm_playback_drain(alsa_handler)) < 0)
{
- mp_msg(MSGT_AO, MSGL_ERR, MSGTR_AO_ALSA5_DrainError, snd_strerror(err));
+ mp_tmsg(MSGT_AO, MSGL_ERR, "[AO ALSA5] alsa-uninit: playback drain error: %s\n", snd_strerror(err));
return;
}
if ((err = snd_pcm_channel_flush(alsa_handler, SND_PCM_CHANNEL_PLAYBACK)) < 0)
{
- mp_msg(MSGT_AO, MSGL_ERR, MSGTR_AO_ALSA5_FlushError, snd_strerror(err));
+ mp_tmsg(MSGT_AO, MSGL_ERR, "[AO ALSA5] alsa-uninit: playback flush error: %s\n", snd_strerror(err));
return;
}
if ((err = snd_pcm_close(alsa_handler)) < 0)
{
- mp_msg(MSGT_AO, MSGL_ERR, MSGTR_AO_ALSA5_PcmCloseError, snd_strerror(err));
+ mp_tmsg(MSGT_AO, MSGL_ERR, "[AO ALSA5] alsa-uninit: PCM close error: %s\n", snd_strerror(err));
return;
}
}
@@ -276,19 +276,19 @@ static void reset(void)
if ((err = snd_pcm_playback_drain(alsa_handler)) < 0)
{
- mp_msg(MSGT_AO, MSGL_ERR, MSGTR_AO_ALSA5_ResetDrainError, snd_strerror(err));
+ mp_tmsg(MSGT_AO, MSGL_ERR, "[AO ALSA5] alsa-reset: playback drain error: %s\n", snd_strerror(err));
return;
}
if ((err = snd_pcm_channel_flush(alsa_handler, SND_PCM_CHANNEL_PLAYBACK)) < 0)
{
- mp_msg(MSGT_AO, MSGL_ERR, MSGTR_AO_ALSA5_ResetFlushError, snd_strerror(err));
+ mp_tmsg(MSGT_AO, MSGL_ERR, "[AO ALSA5] alsa-reset: playback flush error: %s\n", snd_strerror(err));
return;
}
if ((err = snd_pcm_channel_prepare(alsa_handler, SND_PCM_CHANNEL_PLAYBACK)) < 0)
{
- mp_msg(MSGT_AO, MSGL_ERR, MSGTR_AO_ALSA5_ResetChanPrepareError, snd_strerror(err));
+ mp_tmsg(MSGT_AO, MSGL_ERR, "[AO ALSA5] alsa-reset: channel prepare error: %s\n", snd_strerror(err));
return;
}
}
@@ -300,13 +300,13 @@ static void audio_pause(void)
if ((err = snd_pcm_playback_drain(alsa_handler)) < 0)
{
- mp_msg(MSGT_AO, MSGL_ERR, MSGTR_AO_ALSA5_PauseDrainError, snd_strerror(err));
+ mp_tmsg(MSGT_AO, MSGL_ERR, "[AO ALSA5] alsa-pause: playback drain error: %s\n", snd_strerror(err));
return;
}
if ((err = snd_pcm_channel_flush(alsa_handler, SND_PCM_CHANNEL_PLAYBACK)) < 0)
{
- mp_msg(MSGT_AO, MSGL_ERR, MSGTR_AO_ALSA5_PauseFlushError, snd_strerror(err));
+ mp_tmsg(MSGT_AO, MSGL_ERR, "[AO ALSA5] alsa-pause: playback flush error: %s\n", snd_strerror(err));
return;
}
}
@@ -317,7 +317,7 @@ static void audio_resume(void)
int err;
if ((err = snd_pcm_channel_prepare(alsa_handler, SND_PCM_CHANNEL_PLAYBACK)) < 0)
{
- mp_msg(MSGT_AO, MSGL_ERR, MSGTR_AO_ALSA5_ResumePrepareError, snd_strerror(err));
+ mp_tmsg(MSGT_AO, MSGL_ERR, "[AO ALSA5] alsa-resume: channel prepare error: %s\n", snd_strerror(err));
return;
}
}
@@ -337,21 +337,21 @@ static int play(void* data, int len, int flags)
{
if (got_len == -EPIPE) /* underrun? */
{
- mp_msg(MSGT_AO, MSGL_ERR, MSGTR_AO_ALSA5_Underrun);
+ mp_tmsg(MSGT_AO, MSGL_ERR, "[AO ALSA5] alsa-play: alsa underrun, resetting stream.\n");
if ((got_len = snd_pcm_channel_prepare(alsa_handler, SND_PCM_CHANNEL_PLAYBACK)) < 0)
{
- mp_msg(MSGT_AO, MSGL_ERR, MSGTR_AO_ALSA5_PlaybackPrepareError, snd_strerror(got_len));
+ mp_tmsg(MSGT_AO, MSGL_ERR, "[AO ALSA5] alsa-play: playback prepare error: %s\n", snd_strerror(got_len));
return 0;
}
if ((got_len = snd_pcm_write(alsa_handler, data, len)) < 0)
{
- mp_msg(MSGT_AO, MSGL_ERR, MSGTR_AO_ALSA5_WriteErrorAfterReset,
+ mp_tmsg(MSGT_AO, MSGL_ERR, "[AO ALSA5] alsa-play: write error after reset: %s - giving up.\n",
snd_strerror(got_len));
return 0;
}
return got_len; /* 2nd write was ok */
}
- mp_msg(MSGT_AO, MSGL_ERR, MSGTR_AO_ALSA5_OutPutError, snd_strerror(got_len));
+ mp_tmsg(MSGT_AO, MSGL_ERR, "[AO ALSA5] alsa-play: output error: %s\n", snd_strerror(got_len));
return 0;
}
return got_len;
diff --git a/libao2/ao_arts.c b/libao2/ao_arts.c
index df44db4f02..5e55d6f6b7 100644
--- a/libao2/ao_arts.c
+++ b/libao2/ao_arts.c
@@ -59,10 +59,10 @@ static int init(int rate_hz, int channels, int format, int flags)
int frag_spec;
if( (err=arts_init()) ) {
- mp_msg(MSGT_AO, MSGL_ERR, MSGTR_AO_ARTS_CantInit, arts_error_text(err));
+ mp_tmsg(MSGT_AO, MSGL_ERR, "[AO ARTS] %s\n", arts_error_text(err));
return 0;
}
- mp_msg(MSGT_AO, MSGL_INFO, MSGTR_AO_ARTS_ServerConnect);
+ mp_tmsg(MSGT_AO, MSGL_INFO, "[AO ARTS] Connected to sound server.\n");
/*
* arts supports 8bit unsigned and 16bit signed sample formats
@@ -93,7 +93,7 @@ static int init(int rate_hz, int channels, int format, int flags)
stream=arts_play_stream(rate_hz, OBTAIN_BITRATE(format), channels, "MPlayer");
if(stream == NULL) {
- mp_msg(MSGT_AO, MSGL_ERR, MSGTR_AO_ARTS_CantOpenStream);
+ mp_tmsg(MSGT_AO, MSGL_ERR, "[AO ARTS] Unable to open a stream.\n");
arts_free();
return 0;
}
@@ -104,11 +104,11 @@ static int init(int rate_hz, int channels, int format, int flags)
frag_spec = ARTS_PACKET_SIZE_LOG2 | ARTS_PACKETS << 16;
arts_stream_set(stream, ARTS_P_PACKET_SETTINGS, frag_spec);
ao_data.buffersize = arts_stream_get(stream, ARTS_P_BUFFER_SIZE);
- mp_msg(MSGT_AO, MSGL_INFO, MSGTR_AO_ARTS_StreamOpen);
+ mp_tmsg(MSGT_AO, MSGL_INFO, "[AO ARTS] Stream opened.\n");
- mp_msg(MSGT_AO, MSGL_INFO, MSGTR_AO_ARTS_BufferSize,
+ mp_tmsg(MSGT_AO, MSGL_INFO, "[AO ARTS] buffer size: %d\n",
ao_data.buffersize);
- mp_msg(MSGT_AO, MSGL_INFO, MSGTR_AO_ARTS_BufferSize,
+ mp_tmsg(MSGT_AO, MSGL_INFO, "[AO ARTS] buffer size: %d\n",
arts_stream_get(stream, ARTS_P_PACKET_SIZE));
return 1;
@@ -147,4 +147,3 @@ static float get_delay(void)
return ((float) (ao_data.buffersize - arts_stream_get(stream,
ARTS_P_BUFFER_SPACE))) / ((float) ao_data.bps);
}
-
diff --git a/libao2/ao_dxr2.c b/libao2/ao_dxr2.c
index e2694c6189..f9e31836d5 100644
--- a/libao2/ao_dxr2.c
+++ b/libao2/ao_dxr2.c
@@ -73,7 +73,7 @@ static int control(int cmd,void *arg){
if(v.arg != volume) {
volume = v.arg;
if( ioctl(dxr2_fd,DXR2_IOC_SET_AUDIO_VOLUME,&v) < 0) {
- mp_msg(MSGT_AO,MSGL_ERR,MSGTR_AO_DXR2_SetVolFailed,volume);
+ mp_tmsg(MSGT_AO,MSGL_ERR,"[AO DXR2] Setting volume to %d failed.\n",volume);
return CONTROL_ERROR;
}
}
@@ -135,7 +135,7 @@ static int init(int rate,int channels,int format,int flags){
break;
#endif
default:
- mp_msg(MSGT_AO,MSGL_ERR,MSGTR_AO_DXR2_UnsupSamplerate,rate);
+ mp_tmsg(MSGT_AO,MSGL_ERR,"[AO DXR2] %d Hz not supported, try to resample.\n",rate);
return 0;
}
@@ -220,4 +220,3 @@ static float get_delay(void){
return 0.0;
}
-
diff --git a/libao2/ao_esd.c b/libao2/ao_esd.c
index 593d5a934a..28a0009b80 100644
--- a/libao2/ao_esd.c
+++ b/libao2/ao_esd.c
@@ -168,7 +168,7 @@ static int init(int rate_hz, int channels, int format, int flags)
if (esd_fd < 0) {
esd_fd = esd_open_sound(server);
if (esd_fd < 0) {
- mp_msg(MSGT_AO, MSGL_ERR, MSGTR_AO_ESD_CantOpenSound,
+ mp_tmsg(MSGT_AO, MSGL_ERR, "[AO ESD] esd_open_sound failed: %s\n",
strerror(errno));
return 0;
}
@@ -245,14 +245,14 @@ static int init(int rate_hz, int channels, int format, int flags)
lag_serv = (esd_latency * 4.0f) / (bytes_per_sample * rate_hz);
lag_seconds = lag_net + lag_serv;
audio_delay += lag_seconds;
- mp_msg(MSGT_AO, MSGL_INFO,MSGTR_AO_ESD_LatencyInfo,
+ mp_tmsg(MSGT_AO, MSGL_INFO,"[AO ESD] latency: [server: %0.2fs, net: %0.2fs] (adjust %0.2fs)\n",
lag_serv, lag_net, lag_seconds);
}
esd_play_fd = esd_play_stream_fallback(esd_fmt, rate_hz,
server, ESD_CLIENT_NAME);
if (esd_play_fd < 0) {
- mp_msg(MSGT_AO, MSGL_ERR, MSGTR_AO_ESD_CantOpenPBStream, strerror(errno));
+ mp_tmsg(MSGT_AO, MSGL_ERR, "[AO ESD] failed to open ESD playback stream: %s\n", strerror(errno));
return 0;
}
diff --git a/libao2/ao_ivtv.c b/libao2/ao_ivtv.c
index b09e5308bb..6b6bb8816c 100644
--- a/libao2/ao_ivtv.c
+++ b/libao2/ao_ivtv.c
@@ -86,7 +86,7 @@ init (int rate, int channels, int format, int flags)
/* check for supported audio rate */
if (rate != 32000 || rate != 41000 || rate != 48000)
{
- mp_msg (MSGT_AO, MSGL_ERR, MSGTR_AO_MPEGPES_UnsupSamplerate, rate);
+ mp_tmsg (MSGT_AO, MSGL_ERR, "[AO MPEGPES] %d Hz not supported, try to resample.\n", rate);
rate = 48000;
}
@@ -147,7 +147,7 @@ get_space (void)
static int
play (void *data, int len, int flags)
{
- int ivtv_write (unsigned char *data, int len);
+ int ivtv_write (const unsigned char *data, int len);
if (ao_data.format != AF_FORMAT_MPEG2)
return 0;
diff --git a/libao2/ao_jack.c b/libao2/ao_jack.c
index 7d22ca1676..0d2492c02b 100644
--- a/libao2/ao_jack.c
+++ b/libao2/ao_jack.c
@@ -360,4 +360,3 @@ static float get_delay(void) {
}
return (float)buffered / (float)ao_data.bps + in_jack;
}
-
diff --git a/libao2/ao_mpegpes.c b/libao2/ao_mpegpes.c
index c047fb304f..f6ab1c6aca 100644
--- a/libao2/ao_mpegpes.c
+++ b/libao2/ao_mpegpes.c
@@ -97,7 +97,7 @@ static int control(int cmd,void *arg){
if(dvb_mixer.volume_right>255) dvb_mixer.volume_right=255;
// printf("Setting DVB volume: %d ; %d \n",dvb_mixer.volume_left,dvb_mixer.volume_right);
if ( (ioctl(vo_mpegpes_fd2,AUDIO_SET_MIXER, &dvb_mixer) < 0)){
- mp_msg(MSGT_AO, MSGL_ERR, MSGTR_AO_MPEGPES_CantSetMixer,
+ mp_tmsg(MSGT_AO, MSGL_ERR, "[AO MPEGPES] DVB audio set mixer failed: %s.\n",
strerror(errno));
return CONTROL_ERROR;
}
@@ -208,7 +208,7 @@ static int preinit(const char *arg)
return vo_mpegpes_fd2;
}
-static int my_ao_write(unsigned char* data,int len){
+static int my_ao_write(const unsigned char* data,int len){
int orig_len = len;
#ifdef CONFIG_DVB
#define NFD 1
@@ -266,7 +266,7 @@ static int init(int rate,int channels,int format,int flags){
case 44100: freq_id=2;break;
case 32000: freq_id=3;break;
default:
- mp_msg(MSGT_AO, MSGL_ERR, MSGTR_AO_MPEGPES_UnsupSamplerate, rate);
+ mp_tmsg(MSGT_AO, MSGL_ERR, "[AO MPEGPES] %d Hz not supported, try to resample.\n", rate);
#if 0
if(rate>48000) rate=96000; else
if(rate>44100) rate=48000; else
@@ -306,8 +306,6 @@ static void audio_resume(void)
{
}
-void send_pes_packet(unsigned char* data,int len,int id,int timestamp);
-void send_lpcm_packet(unsigned char* data,int len,int id,int timestamp,int freq_id);
extern int vo_pts;
// return: how many bytes can be played without blocking
diff --git a/libao2/ao_openal.c b/libao2/ao_openal.c
index 55d5476288..030304007c 100644
--- a/libao2/ao_openal.c
+++ b/libao2/ao_openal.c
@@ -252,4 +252,3 @@ static float get_delay(void) {
alGetSourcei(sources[0], AL_BUFFERS_QUEUED, &queued);
return queued * CHUNK_SIZE / 2 / (float)ao_data.samplerate;
}
-
diff --git a/libao2/ao_oss.c b/libao2/ao_oss.c
index 6c23026e87..b7f01678e0 100644
--- a/libao2/ao_oss.c
+++ b/libao2/ao_oss.c
@@ -142,7 +142,7 @@ static int oss2format(int format)
case AFMT_AC3: return AF_FORMAT_AC3_NE;
#endif
}
- mp_msg(MSGT_GLOBAL,MSGL_ERR,MSGTR_AO_OSS_UnknownUnsupportedFormat, format);
+ mp_tmsg(MSGT_GLOBAL,MSGL_ERR,"[AO OSS] Unknown/Unsupported OSS format: %x.\n", format);
return -1;
}
@@ -154,6 +154,29 @@ static int prepause_space;
static const char *oss_mixer_device = PATH_DEV_MIXER;
static int oss_mixer_channel = SOUND_MIXER_PCM;
+#ifdef SNDCTL_DSP_GETPLAYVOL
+static int volume_oss4(ao_control_vol_t *vol, int cmd) {
+ int v;
+
+ if (audio_fd < 0)
+ return CONTROL_ERROR;
+
+ if (cmd == AOCONTROL_GET_VOLUME) {
+ if (ioctl(audio_fd, SNDCTL_DSP_GETPLAYVOL, &v) == -1)
+ return CONTROL_ERROR;
+ vol->right = (v & 0xff00) >> 8;
+ vol->left = v & 0x00ff;
+ return CONTROL_OK;
+ } else if (cmd == AOCONTROL_SET_VOLUME) {
+ v = ((int) vol->right << 8) | (int) vol->left;
+ if (ioctl(audio_fd, SNDCTL_DSP_SETPLAYVOL, &v) == -1)
+ return CONTROL_ERROR;
+ return CONTROL_OK;
+ } else
+ return CONTROL_UNKNOWN;
+}
+#endif
+
// to set/get/query special features/parameters
static int control(int cmd,void *arg){
switch(cmd){
@@ -179,6 +202,12 @@ static int control(int cmd,void *arg){
ao_control_vol_t *vol = (ao_control_vol_t *)arg;
int fd, v, devs;
+#ifdef SNDCTL_DSP_GETPLAYVOL
+ // Try OSS4 first
+ if (volume_oss4(vol, cmd) == CONTROL_OK)
+ return CONTROL_OK;
+#endif
+
if(AF_FORMAT_IS_AC3(ao_data.format))
return CONTROL_TRUE;
@@ -247,7 +276,7 @@ static int init(int rate,int channels,int format,int flags){
int fd, devs, i;
if ((fd = open(oss_mixer_device, O_RDONLY)) == -1){
- mp_msg(MSGT_AO,MSGL_ERR,MSGTR_AO_OSS_CantOpenMixer,
+ mp_tmsg(MSGT_AO,MSGL_ERR,"[AO OSS] audio_setup: Can't open mixer device %s: %s\n",
oss_mixer_device, strerror(errno));
}else{
ioctl(fd, SOUND_MIXER_READ_DEVMASK, &devs);
@@ -256,7 +285,7 @@ static int init(int rate,int channels,int format,int flags){
for (i=0; i<SOUND_MIXER_NRDEVICES; i++){
if(!strcasecmp(mixer_channels[i], mchan)){
if(!(devs & (1 << i))){
- mp_msg(MSGT_AO,MSGL_ERR,MSGTR_AO_OSS_ChanNotFound,mchan);
+ mp_tmsg(MSGT_AO,MSGL_ERR,"[AO OSS] audio_setup: Audio card mixer does not have channel '%s', using default.\n",mchan);
i = SOUND_MIXER_NRDEVICES+1;
break;
}
@@ -265,7 +294,7 @@ static int init(int rate,int channels,int format,int flags){
}
}
if(i==SOUND_MIXER_NRDEVICES){
- mp_msg(MSGT_AO,MSGL_ERR,MSGTR_AO_OSS_ChanNotFound,mchan);
+ mp_tmsg(MSGT_AO,MSGL_ERR,"[AO OSS] audio_setup: Audio card mixer does not have channel '%s', using default.\n",mchan);
}
}
} else
@@ -281,14 +310,14 @@ static int init(int rate,int channels,int format,int flags){
audio_fd=open(dsp, O_WRONLY);
#endif
if(audio_fd<0){
- mp_msg(MSGT_AO,MSGL_ERR,MSGTR_AO_OSS_CantOpenDev, dsp, strerror(errno));
+ mp_tmsg(MSGT_AO,MSGL_ERR,"[AO OSS] audio_setup: Can't open audio device %s: %s\n", dsp, strerror(errno));
return 0;
}
#ifdef __linux__
/* Remove the non-blocking flag */
if(fcntl(audio_fd, F_SETFL, 0) < 0) {
- mp_msg(MSGT_AO,MSGL_ERR,MSGTR_AO_OSS_CantMakeFd, strerror(errno));
+ mp_tmsg(MSGT_AO,MSGL_ERR,"[AO OSS] audio_setup: Can't make file descriptor blocking: %s\n", strerror(errno));
return 0;
}
#endif
@@ -317,7 +346,7 @@ ac3_retry:
}
if( ioctl(audio_fd, SNDCTL_DSP_SETFMT, &oss_format)<0 ||
oss_format != format2oss(format)) {
- mp_msg(MSGT_AO,MSGL_WARN, MSGTR_AO_OSS_CantSet, dsp,
+ mp_tmsg(MSGT_AO,MSGL_WARN, "[AO OSS] Can't set audio device %s to %s output, trying %s...\n", dsp,
af_fmt2str_short(format), af_fmt2str_short(AF_FORMAT_S16_NE) );
format=AF_FORMAT_S16_NE;
goto ac3_retry;
@@ -339,14 +368,14 @@ ac3_retry:
if (ao_data.channels > 2) {
if ( ioctl(audio_fd, SNDCTL_DSP_CHANNELS, &ao_data.channels) == -1 ||
ao_data.channels != channels ) {
- mp_msg(MSGT_AO,MSGL_ERR,MSGTR_AO_OSS_CantSetChans, channels);
+ mp_tmsg(MSGT_AO,MSGL_ERR,"[AO OSS] audio_setup: Failed to set audio device to %d channels.\n", channels);
return 0;
}
}
else {
int c = ao_data.channels-1;
if (ioctl (audio_fd, SNDCTL_DSP_STEREO, &c) == -1) {
- mp_msg(MSGT_AO,MSGL_ERR,MSGTR_AO_OSS_CantSetChans, ao_data.channels);
+ mp_tmsg(MSGT_AO,MSGL_ERR,"[AO OSS] audio_setup: Failed to set audio device to %d channels.\n", ao_data.channels);
return 0;
}
ao_data.channels=c+1;
@@ -360,7 +389,7 @@ ac3_retry:
if(ioctl(audio_fd, SNDCTL_DSP_GETOSPACE, &zz)==-1){
int r=0;
- mp_msg(MSGT_AO,MSGL_WARN,MSGTR_AO_OSS_CantUseGetospace);
+ mp_tmsg(MSGT_AO,MSGL_WARN,"[AO OSS] audio_setup: driver doesn't support SNDCTL_DSP_GETOSPACE :-(\n");
if(ioctl(audio_fd, SNDCTL_DSP_GETBLKSIZE, &r)==-1){
mp_msg(MSGT_AO,MSGL_V,"audio_setup: %d bytes/frag (config.h)\n",ao_data.outburst);
} else {
@@ -391,7 +420,7 @@ ac3_retry:
}
free(data);
if(ao_data.buffersize==0){
- mp_msg(MSGT_AO,MSGL_ERR,MSGTR_AO_OSS_CantUseSelect);
+ mp_tmsg(MSGT_AO,MSGL_ERR,"[AO OSS]\n *** Your audio driver DOES NOT support select() ***\n Recompile MPlayer with #undef HAVE_AUDIO_SELECT in config.h !\n\n");
return 0;
}
#endif
@@ -440,7 +469,7 @@ static void reset(void){
uninit(1);
audio_fd=open(dsp, O_WRONLY);
if(audio_fd < 0){
- mp_msg(MSGT_AO,MSGL_ERR,MSGTR_AO_OSS_CantReopen, strerror(errno));
+ mp_tmsg(MSGT_AO,MSGL_ERR,"[AO OSS]\nFatal error: *** CANNOT RE-OPEN / RESET AUDIO DEVICE *** %s\n", strerror(errno));
return;
}
@@ -492,8 +521,6 @@ static int get_space(void){
if(ioctl(audio_fd, SNDCTL_DSP_GETOSPACE, &zz)!=-1){
// calculate exact buffer space:
playsize = zz.fragments*zz.fragsize;
- if (playsize > MAX_OUTBURST)
- playsize = (MAX_OUTBURST / zz.fragsize) * zz.fragsize;
return playsize;
}
#endif
diff --git a/libao2/ao_pcm.c b/libao2/ao_pcm.c
index 2303c218db..a9fab6581e 100644
--- a/libao2/ao_pcm.c
+++ b/libao2/ao_pcm.c
@@ -154,10 +154,10 @@ static int init(int rate,int channels,int format,int flags){
wavhdr.data_length=le2me_32(0x7ffff000);
wavhdr.file_length = wavhdr.data_length + sizeof(wavhdr) - 8;
- mp_msg(MSGT_AO, MSGL_INFO, MSGTR_AO_PCM_FileInfo, ao_outputfilename,
+ mp_tmsg(MSGT_AO, MSGL_INFO, "[AO PCM] File: %s (%s)\nPCM: Samplerate: %iHz Channels: %s Format %s\n", ao_outputfilename,
(ao_pcm_waveheader?"WAVE":"RAW PCM"), rate,
(channels > 1) ? "Stereo" : "Mono", af_fmt2str_short(format));
- mp_msg(MSGT_AO, MSGL_INFO, MSGTR_AO_PCM_HintInfo);
+ mp_tmsg(MSGT_AO, MSGL_INFO, "[AO PCM] Info: Faster dumping is achieved with -vc null -vo null -ao pcm:fast\n[AO PCM] Info: To write WAVE files use -ao pcm:waveheader (default).\n");
fp = fopen(ao_outputfilename, "wb");
if(fp) {
@@ -166,7 +166,7 @@ static int init(int rate,int channels,int format,int flags){
}
return 1;
}
- mp_msg(MSGT_AO, MSGL_ERR, MSGTR_AO_PCM_CantOpenOutputFile,
+ mp_tmsg(MSGT_AO, MSGL_ERR, "[AO PCM] Failed to open %s for writing!\n",
ao_outputfilename);
return 0;
}
@@ -263,9 +263,3 @@ static float get_delay(void){
return 0.0;
}
-
-
-
-
-
-
diff --git a/libao2/ao_sdl.c b/libao2/ao_sdl.c
index 8df8c0ccf2..0cef28c913 100644
--- a/libao2/ao_sdl.c
+++ b/libao2/ao_sdl.c
@@ -120,7 +120,7 @@ static int control(int cmd,void *arg){
}
// SDL Callback function
-void outputaudio(void *unused, Uint8 *stream, int len) {
+static void outputaudio(void *unused, Uint8 *stream, int len) {
//SDL_MixAudio(stream, read_buffer(buffers, len), len, SDL_MIX_MAXVOLUME);
//if(!full_buffers) printf("SDL: Buffer underrun!\n");
@@ -138,11 +138,11 @@ static int init(int rate,int channels,int format,int flags){
/* Allocate ring-buffer memory */
buffer = av_fifo_alloc(BUFFSIZE);
- mp_msg(MSGT_AO,MSGL_INFO,MSGTR_AO_SDL_INFO, rate, (channels > 1) ? "Stereo" : "Mono", af_fmt2str_short(format));
+ mp_tmsg(MSGT_AO,MSGL_INFO,"[AO SDL] Samplerate: %iHz Channels: %s Format %s\n", rate, (channels > 1) ? "Stereo" : "Mono", af_fmt2str_short(format));
if(ao_subdevice) {
setenv("SDL_AUDIODRIVER", ao_subdevice, 1);
- mp_msg(MSGT_AO,MSGL_INFO,MSGTR_AO_SDL_DriverInfo, ao_subdevice);
+ mp_tmsg(MSGT_AO,MSGL_INFO,"[AO SDL] using %s audio driver.\n", ao_subdevice);
}
ao_data.channels=channels;
@@ -176,7 +176,7 @@ static int init(int rate,int channels,int format,int flags){
default:
aspec.format = AUDIO_S16LSB;
ao_data.format = AF_FORMAT_S16_LE;
- mp_msg(MSGT_AO,MSGL_WARN,MSGTR_AO_SDL_UnsupportedAudioFmt, format);
+ mp_tmsg(MSGT_AO,MSGL_WARN,"[AO SDL] Unsupported audio format: 0x%x.\n", format);
}
/* The desired audio frequency in samples-per-second. */
@@ -197,13 +197,13 @@ void callback(void *userdata, Uint8 *stream, int len); userdata is the pointer s
/* initialize the SDL Audio system */
if (SDL_Init (SDL_INIT_AUDIO/*|SDL_INIT_NOPARACHUTE*/)) {
- mp_msg(MSGT_AO,MSGL_ERR,MSGTR_AO_SDL_CantInit, SDL_GetError());
+ mp_tmsg(MSGT_AO,MSGL_ERR,"[AO SDL] SDL Audio initialization failed: %s\n", SDL_GetError());
return 0;
}
/* Open the audio device and start playing sound! */
if(SDL_OpenAudio(&aspec, &obtained) < 0) {
- mp_msg(MSGT_AO,MSGL_ERR,MSGTR_AO_SDL_CantOpenAudio, SDL_GetError());
+ mp_tmsg(MSGT_AO,MSGL_ERR,"[AO SDL] Unable to open audio: %s\n", SDL_GetError());
return 0;
}
@@ -231,7 +231,7 @@ void callback(void *userdata, Uint8 *stream, int len); userdata is the pointer s
ao_data.format = AF_FORMAT_U16_BE;
break;
default:
- mp_msg(MSGT_AO,MSGL_WARN,MSGTR_AO_SDL_UnsupportedAudioFmt, obtained.format);
+ mp_tmsg(MSGT_AO,MSGL_WARN,"[AO SDL] Unsupported audio format: 0x%x.\n", obtained.format);
return 0;
}
@@ -315,9 +315,3 @@ static float get_delay(void){
int buffered = av_fifo_size(buffer); // could be less
return (float)(buffered + ao_data.buffersize)/(float)ao_data.bps;
}
-
-
-
-
-
-
diff --git a/libao2/ao_sgi.c b/libao2/ao_sgi.c
index 9853b7e12d..0973f302ab 100644
--- a/libao2/ao_sgi.c
+++ b/libao2/ao_sgi.c
@@ -117,7 +117,7 @@ static int fmt2sgial(int *format, int *width) {
// to set/get/query special features/parameters
static int control(int cmd, void *arg){
- mp_msg(MSGT_AO, MSGL_INFO, MSGTR_AO_SGI_INFO);
+ mp_tmsg(MSGT_AO, MSGL_INFO, "[AO SGI] control.\n");
switch(cmd) {
case AOCONTROL_QUERY_FORMAT:
@@ -138,7 +138,7 @@ static int init(int rate, int channels, int format, int flags) {
smpfmt = fmt2sgial(&format, &smpwidth);
- mp_msg(MSGT_AO, MSGL_INFO, MSGTR_AO_SGI_InitInfo, rate, (channels > 1) ? "Stereo" : "Mono", af_fmt2str_short(format));
+ mp_tmsg(MSGT_AO, MSGL_INFO, "[AO SGI] init: Samplerate: %iHz Channels: %s Format %s\n", rate, (channels > 1) ? "Stereo" : "Mono", af_fmt2str_short(format));
{ /* from /usr/share/src/dmedia/audio/setrate.c */
@@ -148,7 +148,7 @@ static int init(int rate, int channels, int format, int flags) {
if(ao_subdevice) {
rv = alGetResourceByName(AL_SYSTEM, ao_subdevice, AL_OUTPUT_DEVICE_TYPE);
if (!rv) {
- mp_msg(MSGT_AO, MSGL_ERR, MSGTR_AO_SGI_InvalidDevice);
+ mp_tmsg(MSGT_AO, MSGL_ERR, "[AO SGI] play: invalid device.\n");
return 0;
}
}
@@ -161,20 +161,20 @@ static int init(int rate, int channels, int format, int flags) {
x[1].value.i = AL_CRYSTAL_MCLK_TYPE;
if (alSetParams(rv,x, 2)<0) {
- mp_msg(MSGT_AO, MSGL_WARN, MSGTR_AO_SGI_CantSetParms_Samplerate, alGetErrorString(oserror()));
+ mp_tmsg(MSGT_AO, MSGL_WARN, "[AO SGI] init: setparams failed: %s\nCould not set desired samplerate.\n", alGetErrorString(oserror()));
}
if (x[0].sizeOut < 0) {
- mp_msg(MSGT_AO, MSGL_WARN, MSGTR_AO_SGI_CantSetAlRate);
+ mp_tmsg(MSGT_AO, MSGL_WARN, "[AO SGI] init: AL_RATE was not accepted on the given resource.\n");
}
if (alGetParams(rv,x, 1)<0) {
- mp_msg(MSGT_AO, MSGL_WARN, MSGTR_AO_SGI_CantGetParms, alGetErrorString(oserror()));
+ mp_tmsg(MSGT_AO, MSGL_WARN, "[AO SGI] init: getparams failed: %s\n", alGetErrorString(oserror()));
}
realrate = alFixedToDouble(x[0].value.ll);
if (frate != realrate) {
- mp_msg(MSGT_AO, MSGL_INFO, MSGTR_AO_SGI_SampleRateInfo, realrate, frate);
+ mp_tmsg(MSGT_AO, MSGL_INFO, "[AO SGI] init: samplerate is now %f (desired rate is %f)\n", realrate, frate);
}
sample_rate = (int)realrate;
}
@@ -191,7 +191,7 @@ static int init(int rate, int channels, int format, int flags) {
ao_config = alNewConfig();
if (!ao_config) {
- mp_msg(MSGT_AO, MSGL_ERR, MSGTR_AO_SGI_InitConfigError, alGetErrorString(oserror()));
+ mp_tmsg(MSGT_AO, MSGL_ERR, "[AO SGI] init: %s\n", alGetErrorString(oserror()));
return 0;
}
@@ -200,14 +200,14 @@ static int init(int rate, int channels, int format, int flags) {
alSetSampFmt(ao_config, smpfmt) < 0 ||
alSetQueueSize(ao_config, sample_rate) < 0 ||
alSetDevice(ao_config, rv) < 0) {
- mp_msg(MSGT_AO, MSGL_ERR, MSGTR_AO_SGI_InitConfigError, alGetErrorString(oserror()));
+ mp_tmsg(MSGT_AO, MSGL_ERR, "[AO SGI] init: %s\n", alGetErrorString(oserror()));
return 0;
}
ao_port = alOpenPort("mplayer", "w", ao_config);
if (!ao_port) {
- mp_msg(MSGT_AO, MSGL_ERR, MSGTR_AO_SGI_InitOpenAudioFailed, alGetErrorString(oserror()));
+ mp_tmsg(MSGT_AO, MSGL_ERR, "[AO SGI] init: Unable to open audio channel: %s\n", alGetErrorString(oserror()));
return 0;
}
@@ -222,7 +222,7 @@ static void uninit(int immed) {
/* TODO: samplerate should be set back to the value before mplayer was started! */
- mp_msg(MSGT_AO, MSGL_INFO, MSGTR_AO_SGI_Uninit);
+ mp_tmsg(MSGT_AO, MSGL_INFO, "[AO SGI] uninit: ...\n");
if (ao_config) {
alFreeConfig(ao_config);
@@ -241,7 +241,7 @@ static void uninit(int immed) {
// stop playing and empty buffers (for seeking/pause)
static void reset(void) {
- mp_msg(MSGT_AO, MSGL_INFO, MSGTR_AO_SGI_Reset);
+ mp_tmsg(MSGT_AO, MSGL_INFO, "[AO SGI] reset: ...\n");
alDiscardFrames(ao_port, queue_size);
}
@@ -249,14 +249,14 @@ static void reset(void) {
// stop playing, keep buffers (for pause)
static void audio_pause(void) {
- mp_msg(MSGT_AO, MSGL_INFO, MSGTR_AO_SGI_PauseInfo);
+ mp_tmsg(MSGT_AO, MSGL_INFO, "[AO SGI] audio_pause: ...\n");
}
// resume playing, after audio_pause()
static void audio_resume(void) {
- mp_msg(MSGT_AO, MSGL_INFO, MSGTR_AO_SGI_ResumeInfo);
+ mp_tmsg(MSGT_AO, MSGL_INFO, "[AO SGI] audio_resume: ...\n");
}
@@ -307,9 +307,3 @@ static float get_delay(void){
return (float)((outstanding < 0) ? queue_size : outstanding) /
((float)sample_rate);
}
-
-
-
-
-
-
diff --git a/libao2/ao_sun.c b/libao2/ao_sun.c
index 7cea31d529..96104ef963 100644
--- a/libao2/ao_sun.c
+++ b/libao2/ao_sun.c
@@ -154,13 +154,13 @@ static int realtime_samplecounter_available(char *dev)
info.play.samples = 0;
if (ioctl(fd, AUDIO_SETINFO, &info)) {
if ( mp_msg_test(MSGT_AO,MSGL_V) )
- mp_msg(MSGT_AO, MSGL_ERR, MSGTR_AO_SUN_RtscSetinfoFailed);
+ mp_tmsg(MSGT_AO, MSGL_ERR, "[AO SUN] rtsc: SETINFO failed.\n");
goto error;
}
if (write(fd, silence, len) != len) {
if ( mp_msg_test(MSGT_AO,MSGL_V) )
- mp_msg(MSGT_AO, MSGL_ERR, MSGTR_AO_SUN_RtscWriteFailed);
+ mp_tmsg(MSGT_AO, MSGL_ERR, "[AO SUN] rtsc: write failed.\n");
goto error;
}
@@ -494,7 +494,7 @@ static int init(int rate,int channels,int format,int flags){
audio_fd=open(audio_dev, O_WRONLY);
if(audio_fd<0){
- mp_msg(MSGT_AO, MSGL_ERR, MSGTR_AO_SUN_CantOpenAudioDev, audio_dev, strerror(errno));
+ mp_tmsg(MSGT_AO, MSGL_ERR, "[AO SUN] Can't open audio device %s, %s -> nosound.\n", audio_dev, strerror(errno));
return 0;
}
@@ -572,7 +572,7 @@ static int init(int rate,int channels,int format,int flags){
if (!ok) {
char buf[128];
- mp_msg(MSGT_AO, MSGL_ERR, MSGTR_AO_SUN_UnsupSampleRate,
+ mp_tmsg(MSGT_AO, MSGL_ERR, "[AO SUN] audio_setup: your card doesn't support %d channel, %s, %d Hz samplerate.\n",
channels, af_fmt2str(format, buf, 128), rate);
return 0;
}
@@ -694,4 +694,3 @@ static float get_delay(void){
return (float)((queued_bursts - info.play.eof) * ao_data.outburst) / (float)byte_per_sec;
#endif
}
-
diff --git a/libao2/ao_v4l2.c b/libao2/ao_v4l2.c
index a9e386a448..82c53a226a 100644
--- a/libao2/ao_v4l2.c
+++ b/libao2/ao_v4l2.c
@@ -83,7 +83,7 @@ init (int rate, int channels, int format, int flags)
/* check for supported audio rate */
if (rate != 32000 || rate != 41000 || rate != 48000)
{
- mp_msg (MSGT_AO, MSGL_ERR, MSGTR_AO_MPEGPES_UnsupSamplerate, rate);
+ mp_tmsg (MSGT_AO, MSGL_ERR, "[AO MPEGPES] %d Hz not supported, try to resample.\n", rate);
rate = 48000;
}
@@ -144,7 +144,7 @@ get_space (void)
static int
play (void *data, int len, int flags)
{
- int v4l2_write (unsigned char *data, int len);
+ int v4l2_write (const unsigned char *data, int len);
if (ao_data.format != AF_FORMAT_MPEG2)
return 0;
diff --git a/libao2/audio_out.c b/libao2/audio_out.c
index fc41a73e57..5ceafff73f 100644
--- a/libao2/audio_out.c
+++ b/libao2/audio_out.c
@@ -25,7 +25,6 @@
#include "mp_msg.h"
#include "help_mp.h"
-#include "mplayer.h" /* for exit_player() */
// there are some globals:
ao_data_t ao_data={0,0,0,0,OUTBURST,-1,0};
@@ -125,7 +124,7 @@ const ao_functions_t* const audio_out_drivers[] =
void list_audio_out(void){
int i=0;
- mp_msg(MSGT_AO, MSGL_INFO, MSGTR_AvailableAudioOutputDrivers);
+ mp_tmsg(MSGT_AO, MSGL_INFO, "Available audio output drivers:\n");
mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_AUDIO_OUTPUTS\n");
while (audio_out_drivers[i]) {
const ao_info_t *info = audio_out_drivers[i++]->info;
@@ -141,10 +140,6 @@ const ao_functions_t* init_best_audio_out(char** ao_list,int use_plugin,int rate
while(ao_list[0][0]){
char* ao=ao_list[0];
int ao_len;
- if (strncmp(ao, "alsa9", 5) == 0 || strncmp(ao, "alsa1x", 6) == 0) {
- mp_msg(MSGT_AO, MSGL_FATAL, MSGTR_AO_ALSA9_1x_Removed);
- exit_player(NULL);
- }
if (ao_subdevice) {
free(ao_subdevice);
ao_subdevice = NULL;
@@ -157,7 +152,7 @@ const ao_functions_t* init_best_audio_out(char** ao_list,int use_plugin,int rate
else
ao_len = strlen(ao);
- mp_msg(MSGT_AO, MSGL_V, MSGTR_AO_TryingPreferredAudioDriver,
+ mp_tmsg(MSGT_AO, MSGL_V, "Trying preferred audio driver '%.*s', options '%s'\n",
ao_len, ao, ao_subdevice ? ao_subdevice : "[none]");
for(i=0;audio_out_drivers[i];i++){
@@ -167,12 +162,12 @@ const ao_functions_t* init_best_audio_out(char** ao_list,int use_plugin,int rate
if(audio_out->init(rate,channels,format,flags))
return audio_out; // success!
else
- mp_msg(MSGT_AO, MSGL_WARN, MSGTR_AO_FailedInit, ao);
+ mp_tmsg(MSGT_AO, MSGL_WARN, "Failed to initialize audio driver '%s'\n", ao);
break;
}
}
if (!audio_out_drivers[i]) // we searched through the entire list
- mp_msg(MSGT_AO, MSGL_WARN, MSGTR_AO_NoSuchDriver, ao_len, ao);
+ mp_tmsg(MSGT_AO, MSGL_WARN, "No such audio driver '%.*s'\n", ao_len, ao);
// continue...
++ao_list;
if(!(ao_list[0])) return NULL; // do NOT fallback to others
@@ -182,7 +177,7 @@ const ao_functions_t* init_best_audio_out(char** ao_list,int use_plugin,int rate
ao_subdevice = NULL;
}
- mp_msg(MSGT_AO, MSGL_V, MSGTR_AO_TryingEveryKnown);
+ mp_tmsg(MSGT_AO, MSGL_V, "Trying every known audio driver...\n");
// now try the rest...
for(i=0;audio_out_drivers[i];i++){
@@ -193,4 +188,3 @@ const ao_functions_t* init_best_audio_out(char** ao_list,int use_plugin,int rate
}
return NULL;
}
-
diff --git a/libao2/audio_out.h b/libao2/audio_out.h
index 049cfc5f21..e483a88422 100644
--- a/libao2/audio_out.h
+++ b/libao2/audio_out.h
@@ -47,8 +47,7 @@ typedef struct ao_functions_s
} ao_functions_t;
/* global data used by mplayer and plugins */
-typedef struct ao_data_s
-{
+typedef struct ao_data {
int samplerate;
int channels;
int format;
diff --git a/libass/ass.c b/libass/ass.c
deleted file mode 100644
index 6becb39e8e..0000000000
--- a/libass/ass.c
+++ /dev/null
@@ -1,1246 +0,0 @@
-/*
- * Copyright (C) 2006 Evgeniy Stepanov <eugeni.stepanov@gmail.com>
- *
- * This file is part of libass.
- *
- * libass 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.
- *
- * libass 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 libass; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#include "config.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <assert.h>
-#include <errno.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <unistd.h>
-#include <inttypes.h>
-
-#ifdef CONFIG_ICONV
-#include <iconv.h>
-#endif
-
-#include "ass.h"
-#include "ass_utils.h"
-#include "ass_library.h"
-
-typedef enum {
- PST_UNKNOWN = 0,
- PST_INFO,
- PST_STYLES,
- PST_EVENTS,
- PST_FONTS
-} ParserState;
-
-struct parser_priv {
- ParserState state;
- char *fontname;
- char *fontdata;
- int fontdata_size;
- int fontdata_used;
-};
-
-#define ASS_STYLES_ALLOC 20
-#define ASS_EVENTS_ALLOC 200
-
-void ass_free_track(ASS_Track *track)
-{
- int i;
-
- if (track->parser_priv) {
- if (track->parser_priv->fontname)
- free(track->parser_priv->fontname);
- if (track->parser_priv->fontdata)
- free(track->parser_priv->fontdata);
- free(track->parser_priv);
- }
- if (track->style_format)
- free(track->style_format);
- if (track->event_format)
- free(track->event_format);
- if (track->styles) {
- for (i = 0; i < track->n_styles; ++i)
- ass_free_style(track, i);
- free(track->styles);
- }
- if (track->events) {
- for (i = 0; i < track->n_events; ++i)
- ass_free_event(track, i);
- free(track->events);
- }
- free(track->name);
- free(track);
-}
-
-/// \brief Allocate a new style struct
-/// \param track track
-/// \return style id
-int ass_alloc_style(ASS_Track *track)
-{
- int sid;
-
- assert(track->n_styles <= track->max_styles);
-
- if (track->n_styles == track->max_styles) {
- track->max_styles += ASS_STYLES_ALLOC;
- track->styles =
- (ASS_Style *) realloc(track->styles,
- sizeof(ASS_Style) *
- track->max_styles);
- }
-
- sid = track->n_styles++;
- memset(track->styles + sid, 0, sizeof(ASS_Style));
- return sid;
-}
-
-/// \brief Allocate a new event struct
-/// \param track track
-/// \return event id
-int ass_alloc_event(ASS_Track *track)
-{
- int eid;
-
- assert(track->n_events <= track->max_events);
-
- if (track->n_events == track->max_events) {
- track->max_events += ASS_EVENTS_ALLOC;
- track->events =
- (ASS_Event *) realloc(track->events,
- sizeof(ASS_Event) *
- track->max_events);
- }
-
- eid = track->n_events++;
- memset(track->events + eid, 0, sizeof(ASS_Event));
- return eid;
-}
-
-void ass_free_event(ASS_Track *track, int eid)
-{
- ASS_Event *event = track->events + eid;
- if (event->Name)
- free(event->Name);
- if (event->Effect)
- free(event->Effect);
- if (event->Text)
- free(event->Text);
- if (event->render_priv)
- free(event->render_priv);
-}
-
-void ass_free_style(ASS_Track *track, int sid)
-{
- ASS_Style *style = track->styles + sid;
- if (style->Name)
- free(style->Name);
- if (style->FontName)
- free(style->FontName);
-}
-
-// ==============================================================================================
-
-static void skip_spaces(char **str)
-{
- char *p = *str;
- while ((*p == ' ') || (*p == '\t'))
- ++p;
- *str = p;
-}
-
-static void rskip_spaces(char **str, char *limit)
-{
- char *p = *str;
- while ((p >= limit) && ((*p == ' ') || (*p == '\t')))
- --p;
- *str = p;
-}
-
-/**
- * \brief find style by name
- * \param track track
- * \param name style name
- * \return index in track->styles
- * Returnes 0 if no styles found => expects at least 1 style.
- * Parsing code always adds "Default" style in the end.
- */
-static int lookup_style(ASS_Track *track, char *name)
-{
- int i;
- if (*name == '*')
- ++name; // FIXME: what does '*' really mean ?
- for (i = track->n_styles - 1; i >= 0; --i) {
- // FIXME: mb strcasecmp ?
- if (strcmp(track->styles[i].Name, name) == 0)
- return i;
- }
- i = track->default_style;
- ass_msg(track->library, MSGL_WARN,
- "[%p]: Warning: no style named '%s' found, using '%s'",
- track, name, track->styles[i].Name);
- return i; // use the first style
-}
-
-static uint32_t string2color(ASS_Library *library, char *p)
-{
- uint32_t tmp;
- (void) strtocolor(library, &p, &tmp, 0);
- return tmp;
-}
-
-static long long string2timecode(ASS_Library *library, char *p)
-{
- unsigned h, m, s, ms;
- long long tm;
- int res = sscanf(p, "%1d:%2d:%2d.%2d", &h, &m, &s, &ms);
- if (res < 4) {
- ass_msg(library, MSGL_WARN, "Bad timestamp");
- return 0;
- }
- tm = ((h * 60 + m) * 60 + s) * 1000 + ms * 10;
- return tm;
-}
-
-/**
- * \brief converts numpad-style align to align.
- */
-static int numpad2align(int val)
-{
- int res, v;
- v = (val - 1) / 3; // 0, 1 or 2 for vertical alignment
- if (v != 0)
- v = 3 - v;
- res = ((val - 1) % 3) + 1; // horizontal alignment
- res += v * 4;
- return res;
-}
-
-#define NEXT(str,token) \
- token = next_token(&str); \
- if (!token) break;
-
-#define ANYVAL(name,func) \
- } else if (strcasecmp(tname, #name) == 0) { \
- target->name = func(token); \
- ass_msg(track->library, MSGL_DBG2, "%s = %s", #name, token);
-
-#define STRVAL(name) \
- } else if (strcasecmp(tname, #name) == 0) { \
- if (target->name != NULL) free(target->name); \
- target->name = strdup(token); \
- ass_msg(track->library, MSGL_DBG2, "%s = %s", #name, token);
-
-#define COLORVAL(name) \
- } else if (strcasecmp(tname, #name) == 0) { \
- target->name = string2color(track->library, token); \
- ass_msg(track->library, MSGL_DBG2, "%s = %s", #name, token);
-
-#define INTVAL(name) ANYVAL(name,atoi)
-#define FPVAL(name) ANYVAL(name,atof)
-#define TIMEVAL(name) \
- } else if (strcasecmp(tname, #name) == 0) { \
- target->name = string2timecode(track->library, token); \
- ass_msg(track->library, MSGL_DBG2, "%s = %s", #name, token);
-
-#define STYLEVAL(name) \
- } else if (strcasecmp(tname, #name) == 0) { \
- target->name = lookup_style(track, token); \
- ass_msg(track->library, MSGL_DBG2, "%s = %s", #name, token);
-
-#define ALIAS(alias,name) \
- if (strcasecmp(tname, #alias) == 0) {tname = #name;}
-
-static char *next_token(char **str)
-{
- char *p = *str;
- char *start;
- skip_spaces(&p);
- if (*p == '\0') {
- *str = p;
- return 0;
- }
- start = p; // start of the token
- for (; (*p != '\0') && (*p != ','); ++p) {
- }
- if (*p == '\0') {
- *str = p; // eos found, str will point to '\0' at exit
- } else {
- *p = '\0';
- *str = p + 1; // ',' found, str will point to the next char (beginning of the next token)
- }
- --p; // end of current token
- rskip_spaces(&p, start);
- if (p < start)
- p = start; // empty token
- else
- ++p; // the first space character, or '\0'
- *p = '\0';
- return start;
-}
-
-/**
- * \brief Parse the tail of Dialogue line
- * \param track track
- * \param event parsed data goes here
- * \param str string to parse, zero-terminated
- * \param n_ignored number of format options to skip at the beginning
-*/
-static int process_event_tail(ASS_Track *track, ASS_Event *event,
- char *str, int n_ignored)
-{
- char *token;
- char *tname;
- char *p = str;
- int i;
- ASS_Event *target = event;
-
- char *format = strdup(track->event_format);
- char *q = format; // format scanning pointer
-
- if (track->n_styles == 0) {
- // add "Default" style to the end
- // will be used if track does not contain a default style (or even does not contain styles at all)
- int sid = ass_alloc_style(track);
- track->styles[sid].Name = strdup("Default");
- track->styles[sid].FontName = strdup("Arial");
- }
-
- for (i = 0; i < n_ignored; ++i) {
- NEXT(q, tname);
- }
-
- while (1) {
- NEXT(q, tname);
- if (strcasecmp(tname, "Text") == 0) {
- char *last;
- event->Text = strdup(p);
- if (*event->Text != 0) {
- last = event->Text + strlen(event->Text) - 1;
- if (last >= event->Text && *last == '\r')
- *last = 0;
- }
- ass_msg(track->library, MSGL_DBG2, "Text = %s", event->Text);
- event->Duration -= event->Start;
- free(format);
- return 0; // "Text" is always the last
- }
- NEXT(p, token);
-
- ALIAS(End, Duration) // temporarily store end timecode in event->Duration
- if (0) { // cool ;)
- INTVAL(Layer)
- STYLEVAL(Style)
- STRVAL(Name)
- STRVAL(Effect)
- INTVAL(MarginL)
- INTVAL(MarginR)
- INTVAL(MarginV)
- TIMEVAL(Start)
- TIMEVAL(Duration)
- }
- }
- free(format);
- return 1;
-}
-
-/**
- * \brief Parse command line style overrides (--ass-force-style option)
- * \param track track to apply overrides to
- * The format for overrides is [StyleName.]Field=Value
- */
-void ass_process_force_style(ASS_Track *track)
-{
- char **fs, *eq, *dt, *style, *tname, *token;
- ASS_Style *target;
- int sid;
- char **list = track->library->style_overrides;
-
- if (!list)
- return;
-
- for (fs = list; *fs; ++fs) {
- eq = strrchr(*fs, '=');
- if (!eq)
- continue;
- *eq = '\0';
- token = eq + 1;
-
- if (!strcasecmp(*fs, "PlayResX"))
- track->PlayResX = atoi(token);
- else if (!strcasecmp(*fs, "PlayResY"))
- track->PlayResY = atoi(token);
- else if (!strcasecmp(*fs, "Timer"))
- track->Timer = atof(token);
- else if (!strcasecmp(*fs, "WrapStyle"))
- track->WrapStyle = atoi(token);
- else if (!strcasecmp(*fs, "ScaledBorderAndShadow"))
- track->ScaledBorderAndShadow = parse_bool(token);
- else if (!strcasecmp(*fs, "Kerning"))
- track->Kerning = parse_bool(token);
-
- dt = strrchr(*fs, '.');
- if (dt) {
- *dt = '\0';
- style = *fs;
- tname = dt + 1;
- } else {
- style = NULL;
- tname = *fs;
- }
- for (sid = 0; sid < track->n_styles; ++sid) {
- if (style == NULL
- || strcasecmp(track->styles[sid].Name, style) == 0) {
- target = track->styles + sid;
- if (0) {
- STRVAL(FontName)
- COLORVAL(PrimaryColour)
- COLORVAL(SecondaryColour)
- COLORVAL(OutlineColour)
- COLORVAL(BackColour)
- FPVAL(FontSize)
- INTVAL(Bold)
- INTVAL(Italic)
- INTVAL(Underline)
- INTVAL(StrikeOut)
- FPVAL(Spacing)
- INTVAL(Angle)
- INTVAL(BorderStyle)
- INTVAL(Alignment)
- INTVAL(MarginL)
- INTVAL(MarginR)
- INTVAL(MarginV)
- INTVAL(Encoding)
- FPVAL(ScaleX)
- FPVAL(ScaleY)
- FPVAL(Outline)
- FPVAL(Shadow)
- }
- }
- }
- *eq = '=';
- if (dt)
- *dt = '.';
- }
-}
-
-/**
- * \brief Parse the Style line
- * \param track track
- * \param str string to parse, zero-terminated
- * Allocates a new style struct.
-*/
-static int process_style(ASS_Track *track, char *str)
-{
-
- char *token;
- char *tname;
- char *p = str;
- char *format;
- char *q; // format scanning pointer
- int sid;
- ASS_Style *style;
- ASS_Style *target;
-
- if (!track->style_format) {
- // no style format header
- // probably an ancient script version
- if (track->track_type == TRACK_TYPE_SSA)
- track->style_format =
- strdup
- ("Name, Fontname, Fontsize, PrimaryColour, SecondaryColour,"
- "TertiaryColour, BackColour, Bold, Italic, BorderStyle, Outline,"
- "Shadow, Alignment, MarginL, MarginR, MarginV, AlphaLevel, Encoding");
- else
- track->style_format =
- strdup
- ("Name, Fontname, Fontsize, PrimaryColour, SecondaryColour,"
- "OutlineColour, BackColour, Bold, Italic, Underline, StrikeOut,"
- "ScaleX, ScaleY, Spacing, Angle, BorderStyle, Outline, Shadow,"
- "Alignment, MarginL, MarginR, MarginV, Encoding");
- }
-
- q = format = strdup(track->style_format);
-
- ass_msg(track->library, MSGL_V, "[%p] Style: %s", track, str);
-
- sid = ass_alloc_style(track);
-
- style = track->styles + sid;
- target = style;
-
- // fill style with some default values
- style->ScaleX = 100.;
- style->ScaleY = 100.;
-
- while (1) {
- NEXT(q, tname);
- NEXT(p, token);
-
- if (0) { // cool ;)
- STRVAL(Name)
- if ((strcmp(target->Name, "Default") == 0)
- || (strcmp(target->Name, "*Default") == 0))
- track->default_style = sid;
- STRVAL(FontName)
- COLORVAL(PrimaryColour)
- COLORVAL(SecondaryColour)
- COLORVAL(OutlineColour) // TertiaryColor
- COLORVAL(BackColour)
- // SSA uses BackColour for both outline and shadow
- // this will destroy SSA's TertiaryColour, but i'm not going to use it anyway
- if (track->track_type == TRACK_TYPE_SSA)
- target->OutlineColour = target->BackColour;
- FPVAL(FontSize)
- INTVAL(Bold)
- INTVAL(Italic)
- INTVAL(Underline)
- INTVAL(StrikeOut)
- FPVAL(Spacing)
- INTVAL(Angle)
- INTVAL(BorderStyle)
- INTVAL(Alignment)
- if (track->track_type == TRACK_TYPE_ASS)
- target->Alignment = numpad2align(target->Alignment);
- INTVAL(MarginL)
- INTVAL(MarginR)
- INTVAL(MarginV)
- INTVAL(Encoding)
- FPVAL(ScaleX)
- FPVAL(ScaleY)
- FPVAL(Outline)
- FPVAL(Shadow)
- }
- }
- style->ScaleX /= 100.;
- style->ScaleY /= 100.;
- style->Bold = !!style->Bold;
- style->Italic = !!style->Italic;
- style->Underline = !!style->Underline;
- if (!style->Name)
- style->Name = strdup("Default");
- if (!style->FontName)
- style->FontName = strdup("Arial");
- // skip '@' at the start of the font name
- if (*style->FontName == '@') {
- p = style->FontName;
- style->FontName = strdup(p + 1);
- free(p);
- }
- free(format);
- return 0;
-
-}
-
-static int process_styles_line(ASS_Track *track, char *str)
-{
- if (!strncmp(str, "Format:", 7)) {
- char *p = str + 7;
- skip_spaces(&p);
- track->style_format = strdup(p);
- ass_msg(track->library, MSGL_DBG2, "Style format: %s",
- track->style_format);
- } else if (!strncmp(str, "Style:", 6)) {
- char *p = str + 6;
- skip_spaces(&p);
- process_style(track, p);
- }
- return 0;
-}
-
-static int process_info_line(ASS_Track *track, char *str)
-{
- if (!strncmp(str, "PlayResX:", 9)) {
- track->PlayResX = atoi(str + 9);
- } else if (!strncmp(str, "PlayResY:", 9)) {
- track->PlayResY = atoi(str + 9);
- } else if (!strncmp(str, "Timer:", 6)) {
- track->Timer = atof(str + 6);
- } else if (!strncmp(str, "WrapStyle:", 10)) {
- track->WrapStyle = atoi(str + 10);
- } else if (!strncmp(str, "ScaledBorderAndShadow:", 22)) {
- track->ScaledBorderAndShadow = parse_bool(str + 22);
- } else if (!strncmp(str, "Kerning:", 8)) {
- track->Kerning = parse_bool(str + 8);
- }
- return 0;
-}
-
-static void event_format_fallback(ASS_Track *track)
-{
- track->parser_priv->state = PST_EVENTS;
- if (track->track_type == TRACK_TYPE_SSA)
- track->event_format = strdup("Format: Marked, Start, End, Style, "
- "Name, MarginL, MarginR, MarginV, Effect, Text");
- else
- track->event_format = strdup("Format: Layer, Start, End, Style, "
- "Actor, MarginL, MarginR, MarginV, Effect, Text");
- ass_msg(track->library, MSGL_V,
- "No event format found, using fallback");
-}
-
-static int process_events_line(ASS_Track *track, char *str)
-{
- if (!strncmp(str, "Format:", 7)) {
- char *p = str + 7;
- skip_spaces(&p);
- track->event_format = strdup(p);
- ass_msg(track->library, MSGL_DBG2, "Event format: %s", track->event_format);
- } else if (!strncmp(str, "Dialogue:", 9)) {
- // This should never be reached for embedded subtitles.
- // They have slightly different format and are parsed in ass_process_chunk,
- // called directly from demuxer
- int eid;
- ASS_Event *event;
-
- str += 9;
- skip_spaces(&str);
-
- eid = ass_alloc_event(track);
- event = track->events + eid;
-
- // We can't parse events with event_format
- if (!track->event_format)
- event_format_fallback(track);
-
- process_event_tail(track, event, str, 0);
- } else {
- ass_msg(track->library, MSGL_V, "Not understood: '%s'", str);
- }
- return 0;
-}
-
-// Copied from mkvtoolnix
-static unsigned char *decode_chars(unsigned char c1, unsigned char c2,
- unsigned char c3, unsigned char c4,
- unsigned char *dst, int cnt)
-{
- uint32_t value;
- unsigned char bytes[3];
- int i;
-
- value =
- ((c1 - 33) << 18) + ((c2 - 33) << 12) + ((c3 - 33) << 6) + (c4 -
- 33);
- bytes[2] = value & 0xff;
- bytes[1] = (value & 0xff00) >> 8;
- bytes[0] = (value & 0xff0000) >> 16;
-
- for (i = 0; i < cnt; ++i)
- *dst++ = bytes[i];
- return dst;
-}
-
-static int decode_font(ASS_Track *track)
-{
- unsigned char *p;
- unsigned char *q;
- int i;
- int size; // original size
- int dsize; // decoded size
- unsigned char *buf = 0;
-
- ass_msg(track->library, MSGL_V, "Font: %d bytes encoded data",
- track->parser_priv->fontdata_used);
- size = track->parser_priv->fontdata_used;
- if (size % 4 == 1) {
- ass_msg(track->library, MSGL_ERR, "Bad encoded data size");
- goto error_decode_font;
- }
- buf = malloc(size / 4 * 3 + 2);
- q = buf;
- for (i = 0, p = (unsigned char *) track->parser_priv->fontdata;
- i < size / 4; i++, p += 4) {
- q = decode_chars(p[0], p[1], p[2], p[3], q, 3);
- }
- if (size % 4 == 2) {
- q = decode_chars(p[0], p[1], 0, 0, q, 1);
- } else if (size % 4 == 3) {
- q = decode_chars(p[0], p[1], p[2], 0, q, 2);
- }
- dsize = q - buf;
- assert(dsize <= size / 4 * 3 + 2);
-
- if (track->library->extract_fonts) {
- ass_add_font(track->library, track->parser_priv->fontname,
- (char *) buf, dsize);
- buf = 0;
- }
-
- error_decode_font:
- if (buf)
- free(buf);
- free(track->parser_priv->fontname);
- free(track->parser_priv->fontdata);
- track->parser_priv->fontname = 0;
- track->parser_priv->fontdata = 0;
- track->parser_priv->fontdata_size = 0;
- track->parser_priv->fontdata_used = 0;
- return 0;
-}
-
-static int process_fonts_line(ASS_Track *track, char *str)
-{
- int len;
-
- if (!strncmp(str, "fontname:", 9)) {
- char *p = str + 9;
- skip_spaces(&p);
- if (track->parser_priv->fontname) {
- decode_font(track);
- }
- track->parser_priv->fontname = strdup(p);
- ass_msg(track->library, MSGL_V, "Fontname: %s",
- track->parser_priv->fontname);
- return 0;
- }
-
- if (!track->parser_priv->fontname) {
- ass_msg(track->library, MSGL_V, "Not understood: '%s'", str);
- return 0;
- }
-
- len = strlen(str);
- if (len > 80) {
- ass_msg(track->library, MSGL_WARN, "Font line too long: %d, %s",
- len, str);
- return 0;
- }
- if (track->parser_priv->fontdata_used + len >
- track->parser_priv->fontdata_size) {
- track->parser_priv->fontdata_size += 100 * 1024;
- track->parser_priv->fontdata =
- realloc(track->parser_priv->fontdata,
- track->parser_priv->fontdata_size);
- }
- memcpy(track->parser_priv->fontdata + track->parser_priv->fontdata_used,
- str, len);
- track->parser_priv->fontdata_used += len;
-
- return 0;
-}
-
-/**
- * \brief Parse a header line
- * \param track track
- * \param str string to parse, zero-terminated
-*/
-static int process_line(ASS_Track *track, char *str)
-{
- if (!strncasecmp(str, "[Script Info]", 13)) {
- track->parser_priv->state = PST_INFO;
- } else if (!strncasecmp(str, "[V4 Styles]", 11)) {
- track->parser_priv->state = PST_STYLES;
- track->track_type = TRACK_TYPE_SSA;
- } else if (!strncasecmp(str, "[V4+ Styles]", 12)) {
- track->parser_priv->state = PST_STYLES;
- track->track_type = TRACK_TYPE_ASS;
- } else if (!strncasecmp(str, "[Events]", 8)) {
- track->parser_priv->state = PST_EVENTS;
- } else if (!strncasecmp(str, "[Fonts]", 7)) {
- track->parser_priv->state = PST_FONTS;
- } else {
- switch (track->parser_priv->state) {
- case PST_INFO:
- process_info_line(track, str);
- break;
- case PST_STYLES:
- process_styles_line(track, str);
- break;
- case PST_EVENTS:
- process_events_line(track, str);
- break;
- case PST_FONTS:
- process_fonts_line(track, str);
- break;
- default:
- break;
- }
- }
-
- // there is no explicit end-of-font marker in ssa/ass
- if ((track->parser_priv->state != PST_FONTS)
- && (track->parser_priv->fontname))
- decode_font(track);
-
- return 0;
-}
-
-static int process_text(ASS_Track *track, char *str)
-{
- char *p = str;
- while (1) {
- char *q;
- while (1) {
- if ((*p == '\r') || (*p == '\n'))
- ++p;
- else if (p[0] == '\xef' && p[1] == '\xbb' && p[2] == '\xbf')
- p += 3; // U+FFFE (BOM)
- else
- break;
- }
- for (q = p; ((*q != '\0') && (*q != '\r') && (*q != '\n')); ++q) {
- };
- if (q == p)
- break;
- if (*q != '\0')
- *(q++) = '\0';
- process_line(track, p);
- if (*q == '\0')
- break;
- p = q;
- }
- return 0;
-}
-
-/**
- * \brief Process a chunk of subtitle stream data.
- * \param track track
- * \param data string to parse
- * \param size length of data
-*/
-void ass_process_data(ASS_Track *track, char *data, int size)
-{
- char *str = malloc(size + 1);
-
- memcpy(str, data, size);
- str[size] = '\0';
-
- ass_msg(track->library, MSGL_V, "Event: %s", str);
- process_text(track, str);
- free(str);
-}
-
-/**
- * \brief Process CodecPrivate section of subtitle stream
- * \param track track
- * \param data string to parse
- * \param size length of data
- CodecPrivate section contains [Stream Info] and [V4+ Styles] ([V4 Styles] for SSA) sections
-*/
-void ass_process_codec_private(ASS_Track *track, char *data, int size)
-{
- ass_process_data(track, data, size);
-
- // probably an mkv produced by ancient mkvtoolnix
- // such files don't have [Events] and Format: headers
- if (!track->event_format)
- event_format_fallback(track);
-
- ass_process_force_style(track);
-}
-
-static int check_duplicate_event(ASS_Track *track, int ReadOrder)
-{
- int i;
- for (i = 0; i < track->n_events - 1; ++i) // ignoring last event, it is the one we are comparing with
- if (track->events[i].ReadOrder == ReadOrder)
- return 1;
- return 0;
-}
-
-/**
- * \brief Process a chunk of subtitle stream data. In Matroska, this contains exactly 1 event (or a commentary).
- * \param track track
- * \param data string to parse
- * \param size length of data
- * \param timecode starting time of the event (milliseconds)
- * \param duration duration of the event (milliseconds)
-*/
-void ass_process_chunk(ASS_Track *track, char *data, int size,
- long long timecode, long long duration)
-{
- char *str;
- int eid;
- char *p;
- char *token;
- ASS_Event *event;
-
- if (!track->event_format) {
- ass_msg(track->library, MSGL_WARN, "Event format header missing");
- return;
- }
-
- str = malloc(size + 1);
- memcpy(str, data, size);
- str[size] = '\0';
- ass_msg(track->library, MSGL_V, "Event at %" PRId64 ", +%" PRId64 ": %s",
- (int64_t) timecode, (int64_t) duration, str);
-
- eid = ass_alloc_event(track);
- event = track->events + eid;
-
- p = str;
-
- do {
- NEXT(p, token);
- event->ReadOrder = atoi(token);
- if (check_duplicate_event(track, event->ReadOrder))
- break;
-
- NEXT(p, token);
- event->Layer = atoi(token);
-
- process_event_tail(track, event, p, 3);
-
- event->Start = timecode;
- event->Duration = duration;
-
- free(str);
- return;
-// dump_events(tid);
- } while (0);
- // some error
- ass_free_event(track, eid);
- track->n_events--;
- free(str);
-}
-
-#ifdef CONFIG_ICONV
-/** \brief recode buffer to utf-8
- * constraint: codepage != 0
- * \param data pointer to text buffer
- * \param size buffer size
- * \return a pointer to recoded buffer, caller is responsible for freeing it
-**/
-static char *sub_recode(ASS_Library *library, char *data, size_t size,
- char *codepage)
-{
- iconv_t icdsc;
- char *tocp = "UTF-8";
- char *outbuf;
- assert(codepage);
-
- {
- const char *cp_tmp = codepage;
-#ifdef CONFIG_ENCA
- char enca_lang[3], enca_fallback[100];
- if (sscanf(codepage, "enca:%2s:%99s", enca_lang, enca_fallback) == 2
- || sscanf(codepage, "ENCA:%2s:%99s", enca_lang,
- enca_fallback) == 2) {
- cp_tmp =
- ass_guess_buffer_cp(library, (unsigned char *) data, size,
- enca_lang, enca_fallback);
- }
-#endif
- if ((icdsc = iconv_open(tocp, cp_tmp)) != (iconv_t) (-1)) {
- ass_msg(library, MSGL_V, "Opened iconv descriptor");
- } else
- ass_msg(library, MSGL_ERR, "Error opening iconv descriptor");
- }
-
- {
- size_t osize = size;
- size_t ileft = size;
- size_t oleft = size - 1;
- char *ip;
- char *op;
- size_t rc;
- int clear = 0;
-
- outbuf = malloc(osize);
- ip = data;
- op = outbuf;
-
- while (1) {
- if (ileft)
- rc = iconv(icdsc, &ip, &ileft, &op, &oleft);
- else { // clear the conversion state and leave
- clear = 1;
- rc = iconv(icdsc, NULL, NULL, &op, &oleft);
- }
- if (rc == (size_t) (-1)) {
- if (errno == E2BIG) {
- size_t offset = op - outbuf;
- outbuf = (char *) realloc(outbuf, osize + size);
- op = outbuf + offset;
- osize += size;
- oleft += size;
- } else {
- ass_msg(library, MSGL_WARN, "Error recoding file");
- return NULL;
- }
- } else if (clear)
- break;
- }
- outbuf[osize - oleft - 1] = 0;
- }
-
- if (icdsc != (iconv_t) (-1)) {
- (void) iconv_close(icdsc);
- icdsc = (iconv_t) (-1);
- ass_msg(library, MSGL_V, "Closed iconv descriptor");
- }
-
- return outbuf;
-}
-#endif // ICONV
-
-/**
- * \brief read file contents into newly allocated buffer
- * \param fname file name
- * \param bufsize out: file size
- * \return pointer to file contents. Caller is responsible for its deallocation.
- */
-static char *read_file(ASS_Library *library, char *fname, size_t *bufsize)
-{
- int res;
- long sz;
- long bytes_read;
- char *buf;
-
- FILE *fp = fopen(fname, "rb");
- if (!fp) {
- ass_msg(library, MSGL_WARN,
- "ass_read_file(%s): fopen failed", fname);
- return 0;
- }
- res = fseek(fp, 0, SEEK_END);
- if (res == -1) {
- ass_msg(library, MSGL_WARN,
- "ass_read_file(%s): fseek failed", fname);
- fclose(fp);
- return 0;
- }
-
- sz = ftell(fp);
- rewind(fp);
-
- if (sz > 10 * 1024 * 1024) {
- ass_msg(library, MSGL_INFO,
- "ass_read_file(%s): Refusing to load subtitles "
- "larger than 10MiB", fname);
- fclose(fp);
- return 0;
- }
-
- ass_msg(library, MSGL_V, "File size: %ld", sz);
-
- buf = malloc(sz + 1);
- assert(buf);
- bytes_read = 0;
- do {
- res = fread(buf + bytes_read, 1, sz - bytes_read, fp);
- if (res <= 0) {
- ass_msg(library, MSGL_INFO, "Read failed, %d: %s", errno,
- strerror(errno));
- fclose(fp);
- free(buf);
- return 0;
- }
- bytes_read += res;
- } while (sz - bytes_read > 0);
- buf[sz] = '\0';
- fclose(fp);
-
- if (bufsize)
- *bufsize = sz;
- return buf;
-}
-
-/*
- * \param buf pointer to subtitle text in utf-8
- */
-static ASS_Track *parse_memory(ASS_Library *library, char *buf)
-{
- ASS_Track *track;
- int i;
-
- track = ass_new_track(library);
-
- // process header
- process_text(track, buf);
-
- // external SSA/ASS subs does not have ReadOrder field
- for (i = 0; i < track->n_events; ++i)
- track->events[i].ReadOrder = i;
-
- // there is no explicit end-of-font marker in ssa/ass
- if (track->parser_priv->fontname)
- decode_font(track);
-
- if (track->track_type == TRACK_TYPE_UNKNOWN) {
- ass_free_track(track);
- return 0;
- }
-
- ass_process_force_style(track);
-
- return track;
-}
-
-/**
- * \brief Read subtitles from memory.
- * \param library libass library object
- * \param buf pointer to subtitles text
- * \param bufsize size of buffer
- * \param codepage recode buffer contents from given codepage
- * \return newly allocated track
-*/
-ASS_Track *ass_read_memory(ASS_Library *library, char *buf,
- size_t bufsize, char *codepage)
-{
- ASS_Track *track;
- int need_free = 0;
-
- if (!buf)
- return 0;
-
-#ifdef CONFIG_ICONV
- if (codepage) {
- buf = sub_recode(library, buf, bufsize, codepage);
- if (!buf)
- return 0;
- else
- need_free = 1;
- }
-#endif
- track = parse_memory(library, buf);
- if (need_free)
- free(buf);
- if (!track)
- return 0;
-
- ass_msg(library, MSGL_INFO, "Added subtitle file: "
- "<memory> (%d styles, %d events)",
- track->n_styles, track->n_events);
- return track;
-}
-
-static char *read_file_recode(ASS_Library *library, char *fname,
- char *codepage, size_t *size)
-{
- char *buf;
- size_t bufsize;
-
- buf = read_file(library, fname, &bufsize);
- if (!buf)
- return 0;
-#ifdef CONFIG_ICONV
- if (codepage) {
- char *tmpbuf = sub_recode(library, buf, bufsize, codepage);
- free(buf);
- buf = tmpbuf;
- }
- if (!buf)
- return 0;
-#endif
- *size = bufsize;
- return buf;
-}
-
-/**
- * \brief Read subtitles from file.
- * \param library libass library object
- * \param fname file name
- * \param codepage recode buffer contents from given codepage
- * \return newly allocated track
-*/
-ASS_Track *ass_read_file(ASS_Library *library, char *fname,
- char *codepage)
-{
- char *buf;
- ASS_Track *track;
- size_t bufsize;
-
- buf = read_file_recode(library, fname, codepage, &bufsize);
- if (!buf)
- return 0;
- track = parse_memory(library, buf);
- free(buf);
- if (!track)
- return 0;
-
- track->name = strdup(fname);
-
- ass_msg(library, MSGL_INFO,
- "Added subtitle file: '%s' (%d styles, %d events)",
- fname, track->n_styles, track->n_events);
-
- return track;
-}
-
-/**
- * \brief read styles from file into already initialized track
- */
-int ass_read_styles(ASS_Track *track, char *fname, char *codepage)
-{
- char *buf;
- ParserState old_state;
- size_t sz;
-
- buf = read_file(track->library, fname, &sz);
- if (!buf)
- return 1;
-#ifdef CONFIG_ICONV
- if (codepage) {
- char *tmpbuf;
- tmpbuf = sub_recode(track->library, buf, sz, codepage);
- free(buf);
- buf = tmpbuf;
- }
- if (!buf)
- return 0;
-#endif
-
- old_state = track->parser_priv->state;
- track->parser_priv->state = PST_STYLES;
- process_text(track, buf);
- track->parser_priv->state = old_state;
-
- return 0;
-}
-
-long long ass_step_sub(ASS_Track *track, long long now, int movement)
-{
- int i;
-
- if (movement == 0)
- return 0;
- if (track->n_events == 0)
- return 0;
-
- if (movement < 0)
- for (i = 0;
- (i < track->n_events)
- &&
- ((long long) (track->events[i].Start +
- track->events[i].Duration) <= now); ++i) {
- } else
- for (i = track->n_events - 1;
- (i >= 0) && ((long long) (track->events[i].Start) > now);
- --i) {
- }
-
- // -1 and n_events are ok
- assert(i >= -1);
- assert(i <= track->n_events);
- i += movement;
- if (i < 0)
- i = 0;
- if (i >= track->n_events)
- i = track->n_events - 1;
- return ((long long) track->events[i].Start) - now;
-}
-
-ASS_Track *ass_new_track(ASS_Library *library)
-{
- ASS_Track *track = calloc(1, sizeof(ASS_Track));
- track->library = library;
- track->ScaledBorderAndShadow = 1;
- track->parser_priv = calloc(1, sizeof(ASS_ParserPriv));
- return track;
-}
diff --git a/libass/ass.h b/libass/ass.h
deleted file mode 100644
index e7674a736c..0000000000
--- a/libass/ass.h
+++ /dev/null
@@ -1,374 +0,0 @@
-/*
- * Copyright (C) 2006 Evgeniy Stepanov <eugeni.stepanov@gmail.com>
- *
- * This file is part of libass.
- *
- * libass 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.
- *
- * libass 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 libass; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#ifndef LIBASS_ASS_H
-#define LIBASS_ASS_H
-
-#include <stdio.h>
-#include <stdarg.h>
-#include "ass_types.h"
-
-#define LIBASS_VERSION 0x00908000
-
-/*
- * A linked list of images produced by an ass renderer.
- *
- * These images have to be rendered in-order for the correct screen
- * composition. The libass renderer clips these bitmaps to the frame size.
- * w/h can be zero, in this case the bitmap should not be rendered at all.
- * The last bitmap row is not guaranteed to be padded up to stride size,
- * e.g. in the worst case a bitmap has the size stride * (h - 1) + w.
- */
-typedef struct ass_image {
- int w, h; // Bitmap width/height
- int stride; // Bitmap stride
- unsigned char *bitmap; // 1bpp stride*h alpha buffer
- // Note: the last row may not be padded to
- // bitmap stride!
- uint32_t color; // Bitmap color and alpha, RGBA
- int dst_x, dst_y; // Bitmap placement inside the video frame
-
- struct ass_image *next; // Next image, or NULL
-} ASS_Image;
-
-/*
- * Hinting type. (see ass_set_hinting below)
- *
- * FreeType's native hinter is still buggy sometimes and it is recommended
- * to use the light autohinter, ASS_HINTING_LIGHT, instead. For best
- * compatibility with problematic fonts, disable hinting.
- */
-typedef enum {
- ASS_HINTING_NONE = 0,
- ASS_HINTING_LIGHT,
- ASS_HINTING_NORMAL,
- ASS_HINTING_NATIVE
-} ASS_Hinting;
-
-/**
- * \brief Initialize the library.
- * \return library handle or NULL if failed
- */
-ASS_Library *ass_library_init(void);
-
-/**
- * \brief Finalize the library
- * \param priv library handle
- */
-void ass_library_done(ASS_Library *priv);
-
-/**
- * \brief Set private font directory.
- * It is used for saving embedded fonts and also in font lookup.
- *
- * \param priv library handle
- * \param fonts_dir private directory for font extraction
- */
-void ass_set_fonts_dir(ASS_Library *priv, const char *fonts_dir);
-
-/**
- * \brief Whether fonts should be extracted from track data.
- * \param priv library handle
- * \param extract whether to extract fonts
- */
-void ass_set_extract_fonts(ASS_Library *priv, int extract);
-
-/**
- * \brief Register style overrides with a library instance.
- * The overrides should have the form [Style.]Param=Value, e.g.
- * SomeStyle.Font=Arial
- * ScaledBorderAndShadow=yes
- *
- * \param priv library handle
- * \param list NULL-terminated list of strings
- */
-void ass_set_style_overrides(ASS_Library *priv, char **list);
-
-/**
- * \brief Explicitly process style overrides for a track.
- * \param track track handle
- */
-void ass_process_force_style(ASS_Track *track);
-
-/**
- * \brief Register a callback for debug/info messages.
- * If a callback is registered, it is called for every message emitted by
- * libass. The callback receives a format string and a list of arguments,
- * to be used for the printf family of functions. Additionally, a log level
- * from 0 (FATAL errors) to 7 (verbose DEBUG) is passed. Usually, level 5
- * should be used by applications.
- * If no callback is set, all messages level < 5 are printed to stderr,
- * prefixed with [ass].
- *
- * \param priv library handle
- * \param msg_cb pointer to callback function
- * \param data additional data, will be passed to callback
- */
-void ass_set_message_cb(ASS_Library *priv, void (*msg_cb)
- (int level, const char *fmt, va_list args, void *data),
- void *data);
-
-/**
- * \brief Initialize the renderer.
- * \param priv library handle
- * \return renderer handle or NULL if failed
- */
-ASS_Renderer *ass_renderer_init(ASS_Library *);
-
-/**
- * \brief Finalize the renderer.
- * \param priv renderer handle
- */
-void ass_renderer_done(ASS_Renderer *priv);
-
-/**
- * \brief Set the frame size in pixels, including margins.
- * \param priv renderer handle
- * \param w width
- * \param h height
- */
-void ass_set_frame_size(ASS_Renderer *priv, int w, int h);
-
-/**
- * \brief Set frame margins. These values may be negative if pan-and-scan
- * is used.
- * \param priv renderer handle
- * \param t top margin
- * \param b bottom margin
- * \param l left margin
- * \param r right margin
- */
-void ass_set_margins(ASS_Renderer *priv, int t, int b, int l, int r);
-
-/**
- * \brief Whether margins should be used for placing regular events.
- * \param priv renderer handle
- * \param use whether to use the margins
- */
-void ass_set_use_margins(ASS_Renderer *priv, int use);
-
-/**
- * \brief Set aspect ratio parameters.
- * \param priv renderer handle
- * \param dar display aspect ratio (DAR), prescaled for output PAR
- * \param sar storage aspect ratio (SAR)
- */
-void ass_set_aspect_ratio(ASS_Renderer *priv, double dar, double sar);
-
-/**
- * \brief Set a fixed font scaling factor.
- * \param priv renderer handle
- * \param font_scale scaling factor, default is 1.0
- */
-void ass_set_font_scale(ASS_Renderer *priv, double font_scale);
-
-/**
- * \brief Set font hinting method.
- * \param priv renderer handle
- * \param ht hinting method
- */
-void ass_set_hinting(ASS_Renderer *priv, ASS_Hinting ht);
-
-/**
- * \brief Set line spacing. Will not be scaled with frame size.
- * \param priv renderer handle
- * \param line_spacing line spacing in pixels
- */
-void ass_set_line_spacing(ASS_Renderer *priv, double line_spacing);
-
-/**
- * \brief Set font lookup defaults.
- * \param default_font path to default font to use. Must be supplied if
- * fontconfig is disabled or unavailable.
- * \param default_family fallback font family for fontconfig, or NULL
- * \param fc whether to use fontconfig
- * \param config path to fontconfig configuration file, or NULL. Only relevant
- * if fontconfig is used.
- * \param update whether fontconfig cache should be built/updated now. Only
- * relevant if fontconfig is used.
- */
-void ass_set_fonts(ASS_Renderer *priv, const char *default_font,
- const char *default_family, int fc, const char *config,
- int update);
-
-/**
- * \brief Update/build font cache. This needs to be called if it was
- * disabled when ass_set_fonts was set.
- *
- * \param priv renderer handle
- * \return success
- */
-int ass_fonts_update(ASS_Renderer *priv);
-
-/**
- * \brief Set hard cache limits. Do not set, or set to zero, for reasonable
- * defaults.
- *
- * \param priv renderer handle
- * \param glyph_max maximum number of cached glyphs
- * \param bitmap_max_size maximum bitmap cache size (in MB)
- */
-void ass_set_cache_limits(ASS_Renderer *priv, int glyph_max,
- int bitmap_max_size);
-
-/**
- * \brief Render a frame, producing a list of ASS_Image.
- * \param priv renderer handle
- * \param track subtitle track
- * \param now video timestamp in milliseconds
- * \param detect_change will be set to 1 if a change occured compared
- * to the last invocation
- */
-ASS_Image *ass_render_frame(ASS_Renderer *priv, ASS_Track *track,
- long long now, int *detect_change);
-
-
-/*
- * The following functions operate on track objects and do not need
- * an ass_renderer
- */
-
-/**
- * \brief Allocate a new empty track object.
- * \param library handle
- * \return pointer to empty track
- */
-ASS_Track *ass_new_track(ASS_Library *);
-
-/**
- * \brief Deallocate track and all its child objects (styles and events).
- * \param track track to deallocate
- */
-void ass_free_track(ASS_Track *track);
-
-/**
- * \brief Allocate new style.
- * \param track track
- * \return newly allocated style id
- */
-int ass_alloc_style(ASS_Track *track);
-
-/**
- * \brief Allocate new event.
- * \param track track
- * \return newly allocated event id
- */
-int ass_alloc_event(ASS_Track *track);
-
-/**
- * \brief Delete a style.
- * \param track track
- * \param sid style id
- * Deallocates style data. Does not modify track->n_styles.
- */
-void ass_free_style(ASS_Track *track, int sid);
-
-/**
- * \brief Delete an event.
- * \param track track
- * \param eid event id
- * Deallocates event data. Does not modify track->n_events.
- */
-void ass_free_event(ASS_Track *track, int eid);
-
-/**
- * \brief Parse a chunk of subtitle stream data.
- * \param track track
- * \param data string to parse
- * \param size length of data
- */
-void ass_process_data(ASS_Track *track, char *data, int size);
-
-/**
- * \brief Parse Codec Private section of subtitle stream.
- * \param track target track
- * \param data string to parse
- * \param size length of data
- */
-void ass_process_codec_private(ASS_Track *track, char *data, int size);
-
-/**
- * \brief Parse a chunk of subtitle stream data. In Matroska,
- * this contains exactly 1 event (or a commentary).
- * \param track track
- * \param data string to parse
- * \param size length of data
- * \param timecode starting time of the event (milliseconds)
- * \param duration duration of the event (milliseconds)
- */
-void ass_process_chunk(ASS_Track *track, char *data, int size,
- long long timecode, long long duration);
-
-/**
- * \brief Read subtitles from file.
- * \param library library handle
- * \param fname file name
- * \param codepage encoding (iconv format)
- * \return newly allocated track
-*/
-ASS_Track *ass_read_file(ASS_Library *library, char *fname,
- char *codepage);
-
-/**
- * \brief Read subtitles from memory.
- * \param library library handle
- * \param buf pointer to subtitles text
- * \param bufsize size of buffer
- * \param codepage encoding (iconv format)
- * \return newly allocated track
-*/
-ASS_Track *ass_read_memory(ASS_Library *library, char *buf,
- size_t bufsize, char *codepage);
-/**
- * \brief Read styles from file into already initialized track.
- * \param fname file name
- * \param codepage encoding (iconv format)
- * \return 0 on success
- */
-int ass_read_styles(ASS_Track *track, char *fname, char *codepage);
-
-/**
- * \brief Add a memory font.
- * \param library library handle
- * \param name attachment name
- * \param data binary font data
- * \param data_size data size
-*/
-void ass_add_font(ASS_Library *library, char *name, char *data,
- int data_size);
-
-/**
- * \brief Remove all fonts stored in an ass_library object.
- * \param library library handle
- */
-void ass_clear_fonts(ASS_Library *library);
-
-/**
- * \brief Calculates timeshift from now to the start of some other subtitle
- * event, depending on movement parameter.
- * \param track subtitle track
- * \param now current time in milliseconds
- * \param movement how many events to skip from the one currently displayed
- * +2 means "the one after the next", -1 means "previous"
- * \return timeshift in milliseconds
- */
-long long ass_step_sub(ASS_Track *track, long long now, int movement);
-
-#endif /* LIBASS_ASS_H */
diff --git a/libass/ass_bitmap.c b/libass/ass_bitmap.c
deleted file mode 100644
index c7c039ddd5..0000000000
--- a/libass/ass_bitmap.c
+++ /dev/null
@@ -1,537 +0,0 @@
-/*
- * Copyright (C) 2006 Evgeniy Stepanov <eugeni.stepanov@gmail.com>
- *
- * This file is part of libass.
- *
- * libass 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.
- *
- * libass 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 libass; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#include <stdlib.h>
-#include <string.h>
-#include <math.h>
-#include <assert.h>
-#include <ft2build.h>
-#include FT_GLYPH_H
-
-#include "ass_utils.h"
-#include "ass_bitmap.h"
-
-struct ass_synth_priv {
- int tmp_w, tmp_h;
- unsigned short *tmp;
-
- int g_r;
- int g_w;
-
- unsigned *g;
- unsigned *gt2;
-
- double radius;
-};
-
-static const unsigned int maxcolor = 255;
-static const unsigned base = 256;
-
-static int generate_tables(ASS_SynthPriv *priv, double radius)
-{
- double A = log(1.0 / base) / (radius * radius * 2);
- int mx, i;
- double volume_diff, volume_factor = 0;
- unsigned volume;
-
- if (priv->radius == radius)
- return 0;
- else
- priv->radius = radius;
-
- priv->g_r = ceil(radius);
- priv->g_w = 2 * priv->g_r + 1;
-
- if (priv->g_r) {
- priv->g = realloc(priv->g, priv->g_w * sizeof(unsigned));
- priv->gt2 = realloc(priv->gt2, 256 * priv->g_w * sizeof(unsigned));
- if (priv->g == NULL || priv->gt2 == NULL) {
- return -1;
- }
- }
-
- if (priv->g_r) {
- // gaussian curve with volume = 256
- for (volume_diff = 10000000; volume_diff > 0.0000001;
- volume_diff *= 0.5) {
- volume_factor += volume_diff;
- volume = 0;
- for (i = 0; i < priv->g_w; ++i) {
- priv->g[i] =
- (unsigned) (exp(A * (i - priv->g_r) * (i - priv->g_r)) *
- volume_factor + .5);
- volume += priv->g[i];
- }
- if (volume > 256)
- volume_factor -= volume_diff;
- }
- volume = 0;
- for (i = 0; i < priv->g_w; ++i) {
- priv->g[i] =
- (unsigned) (exp(A * (i - priv->g_r) * (i - priv->g_r)) *
- volume_factor + .5);
- volume += priv->g[i];
- }
-
- // gauss table:
- for (mx = 0; mx < priv->g_w; mx++) {
- for (i = 0; i < 256; i++) {
- priv->gt2[mx + i * priv->g_w] = i * priv->g[mx];
- }
- }
- }
-
- return 0;
-}
-
-static void resize_tmp(ASS_SynthPriv *priv, int w, int h)
-{
- if (priv->tmp_w >= w && priv->tmp_h >= h)
- return;
- if (priv->tmp_w == 0)
- priv->tmp_w = 64;
- if (priv->tmp_h == 0)
- priv->tmp_h = 64;
- while (priv->tmp_w < w)
- priv->tmp_w *= 2;
- while (priv->tmp_h < h)
- priv->tmp_h *= 2;
- if (priv->tmp)
- free(priv->tmp);
- priv->tmp = malloc((priv->tmp_w + 1) * priv->tmp_h * sizeof(short));
-}
-
-ASS_SynthPriv *ass_synth_init(double radius)
-{
- ASS_SynthPriv *priv = calloc(1, sizeof(ASS_SynthPriv));
- generate_tables(priv, radius);
- return priv;
-}
-
-void ass_synth_done(ASS_SynthPriv *priv)
-{
- if (priv->tmp)
- free(priv->tmp);
- if (priv->g)
- free(priv->g);
- if (priv->gt2)
- free(priv->gt2);
- free(priv);
-}
-
-static Bitmap *alloc_bitmap(int w, int h)
-{
- Bitmap *bm;
- bm = calloc(1, sizeof(Bitmap));
- bm->buffer = malloc(w * h);
- bm->w = w;
- bm->h = h;
- bm->left = bm->top = 0;
- return bm;
-}
-
-void ass_free_bitmap(Bitmap *bm)
-{
- if (bm) {
- if (bm->buffer)
- free(bm->buffer);
- free(bm);
- }
-}
-
-static Bitmap *copy_bitmap(const Bitmap *src)
-{
- Bitmap *dst = alloc_bitmap(src->w, src->h);
- dst->left = src->left;
- dst->top = src->top;
- memcpy(dst->buffer, src->buffer, src->w * src->h);
- return dst;
-}
-
-static int check_glyph_area(ASS_Library *library, FT_Glyph glyph)
-{
- FT_BBox bbox;
- long long dx, dy;
- FT_Glyph_Get_CBox(glyph, FT_GLYPH_BBOX_TRUNCATE, &bbox);
- dx = bbox.xMax - bbox.xMin;
- dy = bbox.yMax - bbox.yMin;
- if (dx * dy > 8000000) {
- ass_msg(library, MSGL_WARN, "Glyph bounding box too large: %dx%dpx",
- (int) dx, (int) dy);
- return 1;
- } else
- return 0;
-}
-
-static Bitmap *glyph_to_bitmap_internal(ASS_Library *library,
- FT_Glyph glyph, int bord)
-{
- FT_BitmapGlyph bg;
- FT_Bitmap *bit;
- Bitmap *bm;
- int w, h;
- unsigned char *src;
- unsigned char *dst;
- int i;
- int error;
-
- if (check_glyph_area(library, glyph))
- return 0;
- error = FT_Glyph_To_Bitmap(&glyph, FT_RENDER_MODE_NORMAL, 0, 0);
- if (error) {
- ass_msg(library, MSGL_WARN, "FT_Glyph_To_Bitmap error %d",
- error);
- return 0;
- }
-
- bg = (FT_BitmapGlyph) glyph;
- bit = &(bg->bitmap);
- if (bit->pixel_mode != FT_PIXEL_MODE_GRAY) {
- ass_msg(library, MSGL_WARN, "Unsupported pixel mode: %d",
- (int) (bit->pixel_mode));
- FT_Done_Glyph(glyph);
- return 0;
- }
-
- w = bit->width;
- h = bit->rows;
- bm = alloc_bitmap(w + 2 * bord, h + 2 * bord);
- memset(bm->buffer, 0, bm->w * bm->h);
- bm->left = bg->left - bord;
- bm->top = -bg->top - bord;
-
- src = bit->buffer;
- dst = bm->buffer + bord + bm->w * bord;
- for (i = 0; i < h; ++i) {
- memcpy(dst, src, w);
- src += bit->pitch;
- dst += bm->w;
- }
-
- FT_Done_Glyph(glyph);
- return bm;
-}
-
-/**
- * \brief fix outline bitmap
- *
- * The glyph bitmap is subtracted from outline bitmap. This way looks much
- * better in some cases.
- */
-static void fix_outline(Bitmap *bm_g, Bitmap *bm_o)
-{
- int x, y;
- const int l = bm_o->left > bm_g->left ? bm_o->left : bm_g->left;
- const int t = bm_o->top > bm_g->top ? bm_o->top : bm_g->top;
- const int r =
- bm_o->left + bm_o->w <
- bm_g->left + bm_g->w ? bm_o->left + bm_o->w : bm_g->left + bm_g->w;
- const int b =
- bm_o->top + bm_o->h <
- bm_g->top + bm_g->h ? bm_o->top + bm_o->h : bm_g->top + bm_g->h;
-
- unsigned char *g =
- bm_g->buffer + (t - bm_g->top) * bm_g->w + (l - bm_g->left);
- unsigned char *o =
- bm_o->buffer + (t - bm_o->top) * bm_o->w + (l - bm_o->left);
-
- for (y = 0; y < b - t; ++y) {
- for (x = 0; x < r - l; ++x) {
- unsigned char c_g, c_o;
- c_g = g[x];
- c_o = o[x];
- o[x] = (c_o > c_g) ? c_o - (c_g / 2) : 0;
- }
- g += bm_g->w;
- o += bm_o->w;
- }
-}
-
-/**
- * \brief Shift a bitmap by the fraction of a pixel in x and y direction
- * expressed in 26.6 fixed point
- */
-static void shift_bitmap(unsigned char *buf, int w, int h, int shift_x,
- int shift_y)
-{
- int x, y, b;
-
- // Shift in x direction
- if (shift_x > 0) {
- for (y = 0; y < h; y++) {
- for (x = w - 1; x > 0; x--) {
- b = (buf[x + y * w - 1] * shift_x) >> 6;
- buf[x + y * w - 1] -= b;
- buf[x + y * w] += b;
- }
- }
- } else if (shift_x < 0) {
- shift_x = -shift_x;
- for (y = 0; y < h; y++) {
- for (x = 0; x < w - 1; x++) {
- b = (buf[x + y * w + 1] * shift_x) >> 6;
- buf[x + y * w + 1] -= b;
- buf[x + y * w] += b;
- }
- }
- }
-
- // Shift in y direction
- if (shift_y > 0) {
- for (x = 0; x < w; x++) {
- for (y = h - 1; y > 0; y--) {
- b = (buf[x + (y - 1) * w] * shift_y) >> 6;
- buf[x + (y - 1) * w] -= b;
- buf[x + y * w] += b;
- }
- }
- } else if (shift_y < 0) {
- shift_y = -shift_y;
- for (x = 0; x < w; x++) {
- for (y = 0; y < h - 1; y++) {
- b = (buf[x + (y + 1) * w] * shift_y) >> 6;
- buf[x + (y + 1) * w] -= b;
- buf[x + y * w] += b;
- }
- }
- }
-}
-
-/*
- * Gaussian blur. An fast pure C implementation from MPlayer.
- */
-static void ass_gauss_blur(unsigned char *buffer, unsigned short *tmp2,
- int width, int height, int stride, int *m2,
- int r, int mwidth)
-{
-
- int x, y;
-
- unsigned char *s = buffer;
- unsigned short *t = tmp2 + 1;
- for (y = 0; y < height; y++) {
- memset(t - 1, 0, (width + 1) * sizeof(short));
-
- for (x = 0; x < r; x++) {
- const int src = s[x];
- if (src) {
- register unsigned short *dstp = t + x - r;
- int mx;
- unsigned *m3 = (unsigned *) (m2 + src * mwidth);
- for (mx = r - x; mx < mwidth; mx++) {
- dstp[mx] += m3[mx];
- }
- }
- }
-
- for (; x < width - r; x++) {
- const int src = s[x];
- if (src) {
- register unsigned short *dstp = t + x - r;
- int mx;
- unsigned *m3 = (unsigned *) (m2 + src * mwidth);
- for (mx = 0; mx < mwidth; mx++) {
- dstp[mx] += m3[mx];
- }
- }
- }
-
- for (; x < width; x++) {
- const int src = s[x];
- if (src) {
- register unsigned short *dstp = t + x - r;
- int mx;
- const int x2 = r + width - x;
- unsigned *m3 = (unsigned *) (m2 + src * mwidth);
- for (mx = 0; mx < x2; mx++) {
- dstp[mx] += m3[mx];
- }
- }
- }
-
- s += stride;
- t += width + 1;
- }
-
- t = tmp2;
- for (x = 0; x < width; x++) {
- for (y = 0; y < r; y++) {
- unsigned short *srcp = t + y * (width + 1) + 1;
- int src = *srcp;
- if (src) {
- register unsigned short *dstp = srcp - 1 + width + 1;
- const int src2 = (src + 128) >> 8;
- unsigned *m3 = (unsigned *) (m2 + src2 * mwidth);
-
- int mx;
- *srcp = 128;
- for (mx = r - 1; mx < mwidth; mx++) {
- *dstp += m3[mx];
- dstp += width + 1;
- }
- }
- }
- for (; y < height - r; y++) {
- unsigned short *srcp = t + y * (width + 1) + 1;
- int src = *srcp;
- if (src) {
- register unsigned short *dstp = srcp - 1 - r * (width + 1);
- const int src2 = (src + 128) >> 8;
- unsigned *m3 = (unsigned *) (m2 + src2 * mwidth);
-
- int mx;
- *srcp = 128;
- for (mx = 0; mx < mwidth; mx++) {
- *dstp += m3[mx];
- dstp += width + 1;
- }
- }
- }
- for (; y < height; y++) {
- unsigned short *srcp = t + y * (width + 1) + 1;
- int src = *srcp;
- if (src) {
- const int y2 = r + height - y;
- register unsigned short *dstp = srcp - 1 - r * (width + 1);
- const int src2 = (src + 128) >> 8;
- unsigned *m3 = (unsigned *) (m2 + src2 * mwidth);
-
- int mx;
- *srcp = 128;
- for (mx = 0; mx < y2; mx++) {
- *dstp += m3[mx];
- dstp += width + 1;
- }
- }
- }
- t++;
- }
-
- t = tmp2;
- s = buffer;
- for (y = 0; y < height; y++) {
- for (x = 0; x < width; x++) {
- s[x] = t[x] >> 8;
- }
- s += stride;
- t += width + 1;
- }
-}
-
-/**
- * \brief Blur with [[1,2,1]. [2,4,2], [1,2,1]] kernel
- * This blur is the same as the one employed by vsfilter.
- */
-static void be_blur(unsigned char *buf, int w, int h)
-{
- unsigned int x, y;
- unsigned int old_sum, new_sum;
-
- for (y = 0; y < h; y++) {
- old_sum = 2 * buf[y * w];
- for (x = 0; x < w - 1; x++) {
- new_sum = buf[y * w + x] + buf[y * w + x + 1];
- buf[y * w + x] = (old_sum + new_sum) >> 2;
- old_sum = new_sum;
- }
- }
-
- for (x = 0; x < w; x++) {
- old_sum = 2 * buf[x];
- for (y = 0; y < h - 1; y++) {
- new_sum = buf[y * w + x] + buf[(y + 1) * w + x];
- buf[y * w + x] = (old_sum + new_sum) >> 2;
- old_sum = new_sum;
- }
- }
-}
-
-int glyph_to_bitmap(ASS_Library *library, ASS_SynthPriv *priv_blur,
- FT_Glyph glyph, FT_Glyph outline_glyph,
- Bitmap **bm_g, Bitmap **bm_o, Bitmap **bm_s,
- int be, double blur_radius, FT_Vector shadow_offset,
- int border_style)
-{
- blur_radius *= 2;
- int bbord = be > 0 ? sqrt(2 * be) : 0;
- int gbord = blur_radius > 0.0 ? blur_radius + 1 : 0;
- int bord = FFMAX(bbord, gbord);
- if (bord == 0 && (shadow_offset.x || shadow_offset.y))
- bord = 1;
-
- assert(bm_g && bm_o && bm_s);
-
- *bm_g = *bm_o = *bm_s = 0;
-
- if (glyph)
- *bm_g = glyph_to_bitmap_internal(library, glyph, bord);
- if (!*bm_g)
- return 1;
-
- if (outline_glyph) {
- *bm_o = glyph_to_bitmap_internal(library, outline_glyph, bord);
- if (!*bm_o) {
- return 1;
- }
- }
-
- // Apply box blur (multiple passes, if requested)
- while (be--) {
- if (*bm_o)
- be_blur((*bm_o)->buffer, (*bm_o)->w, (*bm_o)->h);
- else
- be_blur((*bm_g)->buffer, (*bm_g)->w, (*bm_g)->h);
- }
-
- // Apply gaussian blur
- if (blur_radius > 0.0) {
- if (*bm_o)
- resize_tmp(priv_blur, (*bm_o)->w, (*bm_o)->h);
- else
- resize_tmp(priv_blur, (*bm_g)->w, (*bm_g)->h);
- generate_tables(priv_blur, blur_radius);
- if (*bm_o)
- ass_gauss_blur((*bm_o)->buffer, priv_blur->tmp,
- (*bm_o)->w, (*bm_o)->h, (*bm_o)->w,
- (int *) priv_blur->gt2, priv_blur->g_r,
- priv_blur->g_w);
- else
- ass_gauss_blur((*bm_g)->buffer, priv_blur->tmp,
- (*bm_g)->w, (*bm_g)->h, (*bm_g)->w,
- (int *) priv_blur->gt2, priv_blur->g_r,
- priv_blur->g_w);
- }
-
- // Create shadow and fix outline as needed
- if (*bm_o && border_style != 3) {
- *bm_s = copy_bitmap(*bm_o);
- fix_outline(*bm_g, *bm_o);
- } else if (*bm_o) {
- *bm_s = copy_bitmap(*bm_o);
- } else
- *bm_s = copy_bitmap(*bm_g);
-
- assert(bm_s);
-
- shift_bitmap((*bm_s)->buffer, (*bm_s)->w,(*bm_s)->h,
- shadow_offset.x, shadow_offset.y);
-
- return 0;
-}
diff --git a/libass/ass_bitmap.h b/libass/ass_bitmap.h
deleted file mode 100644
index 338db01193..0000000000
--- a/libass/ass_bitmap.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Copyright (C) 2006 Evgeniy Stepanov <eugeni.stepanov@gmail.com>
- *
- * This file is part of libass.
- *
- * libass 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.
- *
- * libass 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 libass; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#ifndef LIBASS_BITMAP_H
-#define LIBASS_BITMAP_H
-
-#include <ft2build.h>
-#include FT_GLYPH_H
-
-#include "ass.h"
-
-typedef struct ass_synth_priv ASS_SynthPriv;
-
-ASS_SynthPriv *ass_synth_init(double);
-void ass_synth_done(ASS_SynthPriv *priv);
-
-typedef struct {
- int left, top;
- int w, h; // width, height
- unsigned char *buffer; // w x h buffer
-} Bitmap;
-
-/**
- * \brief perform glyph rendering
- * \param glyph original glyph
- * \param outline_glyph "border" glyph, produced from original by FreeType's glyph stroker
- * \param bm_g out: pointer to the bitmap of original glyph is returned here
- * \param bm_o out: pointer to the bitmap of outline (border) glyph is returned here
- * \param bm_g out: pointer to the bitmap of glyph shadow is returned here
- * \param be 1 = produces blurred bitmaps, 0 = normal bitmaps
- */
-int glyph_to_bitmap(ASS_Library *library, ASS_SynthPriv *priv_blur,
- FT_Glyph glyph, FT_Glyph outline_glyph,
- Bitmap **bm_g, Bitmap **bm_o, Bitmap **bm_s,
- int be, double blur_radius, FT_Vector shadow_offset,
- int border_style);
-
-void ass_free_bitmap(Bitmap *bm);
-
-#endif /* LIBASS_BITMAP_H */
diff --git a/libass/ass_cache.c b/libass/ass_cache.c
deleted file mode 100644
index 643d9912ed..0000000000
--- a/libass/ass_cache.c
+++ /dev/null
@@ -1,380 +0,0 @@
-/*
- * Copyright (C) 2006 Evgeniy Stepanov <eugeni.stepanov@gmail.com>
- *
- * This file is part of libass.
- *
- * libass 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.
- *
- * libass 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 libass; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#include "config.h"
-
-#include <inttypes.h>
-#include <ft2build.h>
-#include FT_FREETYPE_H
-#include FT_GLYPH_H
-
-#include <assert.h>
-
-#include "ass_utils.h"
-#include "ass.h"
-#include "ass_fontconfig.h"
-#include "ass_font.h"
-#include "ass_bitmap.h"
-#include "ass_cache.h"
-
-static unsigned hashmap_hash(void *buf, size_t len)
-{
- return fnv_32a_buf(buf, len, FNV1_32A_INIT);
-}
-
-static int hashmap_key_compare(void *a, void *b, size_t size)
-{
- return memcmp(a, b, size) == 0;
-}
-
-static void hashmap_item_dtor(void *key, size_t key_size, void *value,
- size_t value_size)
-{
- free(key);
- free(value);
-}
-
-Hashmap *hashmap_init(ASS_Library *library, size_t key_size,
- size_t value_size, int nbuckets,
- HashmapItemDtor item_dtor,
- HashmapKeyCompare key_compare,
- HashmapHash hash)
-{
- Hashmap *map = calloc(1, sizeof(Hashmap));
- map->library = library;
- map->nbuckets = nbuckets;
- map->key_size = key_size;
- map->value_size = value_size;
- map->root = calloc(nbuckets, sizeof(hashmap_item_p));
- map->item_dtor = item_dtor ? item_dtor : hashmap_item_dtor;
- map->key_compare = key_compare ? key_compare : hashmap_key_compare;
- map->hash = hash ? hash : hashmap_hash;
- return map;
-}
-
-void hashmap_done(Hashmap *map)
-{
- int i;
- // print stats
- if (map->count > 0 || map->hit_count + map->miss_count > 0)
- ass_msg(map->library, MSGL_V,
- "cache statistics: \n total accesses: %d\n hits: %d\n "
- "misses: %d\n object count: %d",
- map->hit_count + map->miss_count, map->hit_count,
- map->miss_count, map->count);
-
- for (i = 0; i < map->nbuckets; ++i) {
- HashmapItem *item = map->root[i];
- while (item) {
- HashmapItem *next = item->next;
- map->item_dtor(item->key, map->key_size, item->value,
- map->value_size);
- free(item);
- item = next;
- }
- }
- free(map->root);
- free(map);
-}
-
-// does nothing if key already exists
-void *hashmap_insert(Hashmap *map, void *key, void *value)
-{
- unsigned hash = map->hash(key, map->key_size);
- HashmapItem **next = map->root + (hash % map->nbuckets);
- while (*next) {
- if (map->key_compare(key, (*next)->key, map->key_size))
- return (*next)->value;
- next = &((*next)->next);
- assert(next);
- }
- (*next) = malloc(sizeof(HashmapItem));
- (*next)->key = malloc(map->key_size);
- (*next)->value = malloc(map->value_size);
- memcpy((*next)->key, key, map->key_size);
- memcpy((*next)->value, value, map->value_size);
- (*next)->next = 0;
-
- map->count++;
- return (*next)->value;
-}
-
-void *hashmap_find(Hashmap *map, void *key)
-{
- unsigned hash = map->hash(key, map->key_size);
- HashmapItem *item = map->root[hash % map->nbuckets];
- while (item) {
- if (map->key_compare(key, item->key, map->key_size)) {
- map->hit_count++;
- return item->value;
- }
- item = item->next;
- }
- map->miss_count++;
- return 0;
-}
-
-//---------------------------------
-// font cache
-
-static unsigned font_desc_hash(void *buf, size_t len)
-{
- ASS_FontDesc *desc = buf;
- unsigned hval;
- hval = fnv_32a_str(desc->family, FNV1_32A_INIT);
- hval = fnv_32a_buf(&desc->bold, sizeof(desc->bold), hval);
- hval = fnv_32a_buf(&desc->italic, sizeof(desc->italic), hval);
- return hval;
-}
-
-static int font_compare(void *key1, void *key2, size_t key_size)
-{
- ASS_FontDesc *a = key1;
- ASS_FontDesc *b = key2;
- if (strcmp(a->family, b->family) != 0)
- return 0;
- if (a->bold != b->bold)
- return 0;
- if (a->italic != b->italic)
- return 0;
- if (a->treat_family_as_pattern != b->treat_family_as_pattern)
- return 0;
- return 1;
-}
-
-static void font_hash_dtor(void *key, size_t key_size, void *value,
- size_t value_size)
-{
- ass_font_free(value);
- free(key);
-}
-
-ASS_Font *ass_font_cache_find(Hashmap *font_cache,
- ASS_FontDesc *desc)
-{
- return hashmap_find(font_cache, desc);
-}
-
-/**
- * \brief Add a face struct to cache.
- * \param font font struct
-*/
-void *ass_font_cache_add(Hashmap *font_cache, ASS_Font *font)
-{
- return hashmap_insert(font_cache, &(font->desc), font);
-}
-
-Hashmap *ass_font_cache_init(ASS_Library *library)
-{
- Hashmap *font_cache;
- font_cache = hashmap_init(library, sizeof(ASS_FontDesc),
- sizeof(ASS_Font),
- 1000,
- font_hash_dtor, font_compare, font_desc_hash);
- return font_cache;
-}
-
-void ass_font_cache_done(Hashmap *font_cache)
-{
- hashmap_done(font_cache);
-}
-
-
-// Create hash/compare functions for bitmap and glyph
-#define CREATE_HASH_FUNCTIONS
-#include "ass_cache_template.h"
-#define CREATE_COMPARISON_FUNCTIONS
-#include "ass_cache_template.h"
-
-//---------------------------------
-// bitmap cache
-
-static void bitmap_hash_dtor(void *key, size_t key_size, void *value,
- size_t value_size)
-{
- BitmapHashValue *v = value;
- if (v->bm)
- ass_free_bitmap(v->bm);
- if (v->bm_o)
- ass_free_bitmap(v->bm_o);
- if (v->bm_s)
- ass_free_bitmap(v->bm_s);
- free(key);
- free(value);
-}
-
-void *cache_add_bitmap(Hashmap *bitmap_cache, BitmapHashKey *key,
- BitmapHashValue *val)
-{
- // Note: this is only an approximation
- if (val->bm_o)
- bitmap_cache->cache_size += val->bm_o->w * val->bm_o->h * 3;
- else if (val->bm)
- bitmap_cache->cache_size += val->bm->w * val->bm->h * 3;
-
- return hashmap_insert(bitmap_cache, key, val);
-}
-
-/**
- * \brief Get a bitmap from bitmap cache.
- * \param key hash key
- * \return requested hash val or 0 if not found
-*/
-BitmapHashValue *cache_find_bitmap(Hashmap *bitmap_cache,
- BitmapHashKey *key)
-{
- return hashmap_find(bitmap_cache, key);
-}
-
-Hashmap *ass_bitmap_cache_init(ASS_Library *library)
-{
- Hashmap *bitmap_cache;
- bitmap_cache = hashmap_init(library,
- sizeof(BitmapHashKey),
- sizeof(BitmapHashValue),
- 0xFFFF + 13,
- bitmap_hash_dtor, bitmap_compare,
- bitmap_hash);
- return bitmap_cache;
-}
-
-void ass_bitmap_cache_done(Hashmap *bitmap_cache)
-{
- hashmap_done(bitmap_cache);
-}
-
-Hashmap *ass_bitmap_cache_reset(Hashmap *bitmap_cache)
-{
- ASS_Library *lib = bitmap_cache->library;
-
- ass_bitmap_cache_done(bitmap_cache);
- return ass_bitmap_cache_init(lib);
-}
-
-//---------------------------------
-// glyph cache
-
-static void glyph_hash_dtor(void *key, size_t key_size, void *value,
- size_t value_size)
-{
- GlyphHashValue *v = value;
- if (v->glyph)
- FT_Done_Glyph(v->glyph);
- if (v->outline_glyph)
- FT_Done_Glyph(v->outline_glyph);
- free(key);
- free(value);
-}
-
-void *cache_add_glyph(Hashmap *glyph_cache, GlyphHashKey *key,
- GlyphHashValue *val)
-{
- return hashmap_insert(glyph_cache, key, val);
-}
-
-/**
- * \brief Get a glyph from glyph cache.
- * \param key hash key
- * \return requested hash val or 0 if not found
-*/
-GlyphHashValue *cache_find_glyph(Hashmap *glyph_cache,
- GlyphHashKey *key)
-{
- return hashmap_find(glyph_cache, key);
-}
-
-Hashmap *ass_glyph_cache_init(ASS_Library *library)
-{
- Hashmap *glyph_cache;
- glyph_cache = hashmap_init(library, sizeof(GlyphHashKey),
- sizeof(GlyphHashValue),
- 0xFFFF + 13,
- glyph_hash_dtor, glyph_compare, glyph_hash);
- return glyph_cache;
-}
-
-void ass_glyph_cache_done(Hashmap *glyph_cache)
-{
- hashmap_done(glyph_cache);
-}
-
-Hashmap *ass_glyph_cache_reset(Hashmap *glyph_cache)
-{
- ASS_Library *lib = glyph_cache->library;
-
- ass_glyph_cache_done(glyph_cache);
- return ass_glyph_cache_init(lib);
-}
-
-
-//---------------------------------
-// composite cache
-
-static void composite_hash_dtor(void *key, size_t key_size, void *value,
- size_t value_size)
-{
- CompositeHashValue *v = value;
- free(v->a);
- free(v->b);
- free(key);
- free(value);
-}
-
-void *cache_add_composite(Hashmap *composite_cache,
- CompositeHashKey *key,
- CompositeHashValue *val)
-{
- return hashmap_insert(composite_cache, key, val);
-}
-
-/**
- * \brief Get a composite bitmap from composite cache.
- * \param key hash key
- * \return requested hash val or 0 if not found
-*/
-CompositeHashValue *cache_find_composite(Hashmap *composite_cache,
- CompositeHashKey *key)
-{
- return hashmap_find(composite_cache, key);
-}
-
-Hashmap *ass_composite_cache_init(ASS_Library *library)
-{
- Hashmap *composite_cache;
- composite_cache = hashmap_init(library, sizeof(CompositeHashKey),
- sizeof(CompositeHashValue),
- 0xFFFF + 13,
- composite_hash_dtor, composite_compare,
- composite_hash);
- return composite_cache;
-}
-
-void ass_composite_cache_done(Hashmap *composite_cache)
-{
- hashmap_done(composite_cache);
-}
-
-Hashmap *ass_composite_cache_reset(Hashmap *composite_cache)
-{
- ASS_Library *lib = composite_cache->library;
-
- ass_composite_cache_done(composite_cache);
- return ass_composite_cache_init(lib);
-}
diff --git a/libass/ass_cache.h b/libass/ass_cache.h
deleted file mode 100644
index 5c9749f870..0000000000
--- a/libass/ass_cache.h
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
- * Copyright (C) 2006 Evgeniy Stepanov <eugeni.stepanov@gmail.com>
- *
- * This file is part of libass.
- *
- * libass 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.
- *
- * libass 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 libass; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#ifndef LIBASS_CACHE_H
-#define LIBASS_CACHE_H
-
-#include "ass.h"
-#include "ass_font.h"
-#include "ass_bitmap.h"
-
-typedef void (*HashmapItemDtor) (void *key, size_t key_size,
- void *value, size_t value_size);
-typedef int (*HashmapKeyCompare) (void *key1, void *key2,
- size_t key_size);
-typedef unsigned (*HashmapHash) (void *key, size_t key_size);
-
-typedef struct hashmap_item {
- void *key;
- void *value;
- struct hashmap_item *next;
-} HashmapItem;
-typedef HashmapItem *hashmap_item_p;
-
-typedef struct {
- int nbuckets;
- size_t key_size, value_size;
- hashmap_item_p *root;
- HashmapItemDtor item_dtor; // a destructor for hashmap key/value pairs
- HashmapKeyCompare key_compare;
- HashmapHash hash;
- size_t cache_size;
- // stats
- int hit_count;
- int miss_count;
- int count;
- ASS_Library *library;
-} Hashmap;
-
-Hashmap *hashmap_init(ASS_Library *library, size_t key_size,
- size_t value_size, int nbuckets,
- HashmapItemDtor item_dtor,
- HashmapKeyCompare key_compare,
- HashmapHash hash);
-void hashmap_done(Hashmap *map);
-void *hashmap_insert(Hashmap *map, void *key, void *value);
-void *hashmap_find(Hashmap *map, void *key);
-
-Hashmap *ass_font_cache_init(ASS_Library *library);
-ASS_Font *ass_font_cache_find(Hashmap *, ASS_FontDesc *desc);
-void *ass_font_cache_add(Hashmap *, ASS_Font *font);
-void ass_font_cache_done(Hashmap *);
-
-// Create definitions for bitmap_hash_key and glyph_hash_key
-#define CREATE_STRUCT_DEFINITIONS
-#include "ass_cache_template.h"
-
-typedef struct {
- Bitmap *bm; // the actual bitmaps
- Bitmap *bm_o;
- Bitmap *bm_s;
-} BitmapHashValue;
-
-Hashmap *ass_bitmap_cache_init(ASS_Library *library);
-void *cache_add_bitmap(Hashmap *, BitmapHashKey *key,
- BitmapHashValue *val);
-BitmapHashValue *cache_find_bitmap(Hashmap *bitmap_cache,
- BitmapHashKey *key);
-Hashmap *ass_bitmap_cache_reset(Hashmap *bitmap_cache);
-void ass_bitmap_cache_done(Hashmap *bitmap_cache);
-
-
-typedef struct {
- unsigned char *a;
- unsigned char *b;
-} CompositeHashValue;
-
-Hashmap *ass_composite_cache_init(ASS_Library *library);
-void *cache_add_composite(Hashmap *, CompositeHashKey *key,
- CompositeHashValue *val);
-CompositeHashValue *cache_find_composite(Hashmap *composite_cache,
- CompositeHashKey *key);
-Hashmap *ass_composite_cache_reset(Hashmap *composite_cache);
-void ass_composite_cache_done(Hashmap *composite_cache);
-
-
-typedef struct {
- FT_Glyph glyph;
- FT_Glyph outline_glyph;
- FT_BBox bbox_scaled; // bbox after scaling, but before rotation
- FT_Vector advance; // 26.6, advance distance to the next bitmap in line
- int asc, desc; // ascender/descender of a drawing
-} GlyphHashValue;
-
-Hashmap *ass_glyph_cache_init(ASS_Library *library);
-void *cache_add_glyph(Hashmap *, GlyphHashKey *key,
- GlyphHashValue *val);
-GlyphHashValue *cache_find_glyph(Hashmap *glyph_cache,
- GlyphHashKey *key);
-Hashmap *ass_glyph_cache_reset(Hashmap *glyph_cache);
-void ass_glyph_cache_done(Hashmap *glyph_cache);
-
-#endif /* LIBASS_CACHE_H */
diff --git a/libass/ass_cache_template.h b/libass/ass_cache_template.h
deleted file mode 100644
index f335c6b27a..0000000000
--- a/libass/ass_cache_template.h
+++ /dev/null
@@ -1,122 +0,0 @@
-#ifdef CREATE_STRUCT_DEFINITIONS
-#undef CREATE_STRUCT_DEFINITIONS
-#define START(funcname, structname) \
- typedef struct structname {
-#define GENERIC(type, member) \
- type member;
-#define FTVECTOR(member) \
- FT_Vector member;
-#define BITMAPHASHKEY(member) \
- BitmapHashKey member;
-#define END(typedefnamename) \
- } typedefnamename;
-
-#elif defined(CREATE_COMPARISON_FUNCTIONS)
-#undef CREATE_COMPARISON_FUNCTIONS
-#define START(funcname, structname) \
- static int funcname##_compare(void *key1, void *key2, size_t key_size) \
- { \
- struct structname *a = key1; \
- struct structname *b = key2; \
- return // conditions follow
-#define GENERIC(type, member) \
- a->member == b->member &&
-#define FTVECTOR(member) \
- a->member.x == b->member.x && a->member.y == b->member.y &&
-#define BITMAPHASHKEY(member) \
- bitmap_compare(&a->member, &b->member, sizeof(a->member)) &&
-#define END(typedefname) \
- 1; \
- }
-
-#elif defined(CREATE_HASH_FUNCTIONS)
-#undef CREATE_HASH_FUNCTIONS
-#define START(funcname, structname) \
- static unsigned funcname##_hash(void *buf, size_t len) \
- { \
- struct structname *p = buf; \
- unsigned hval = FNV1_32A_INIT;
-#define GENERIC(type, member) \
- hval = fnv_32a_buf(&p->member, sizeof(p->member), hval);
-#define FTVECTOR(member) GENERIC(, member.x); GENERIC(, member.y);
-#define BITMAPHASHKEY(member) { \
- unsigned temp = bitmap_hash(&p->member, sizeof(p->member)); \
- hval = fnv_32a_buf(&temp, sizeof(temp), hval); \
- }
-#define END(typedefname) \
- return hval; \
- }
-
-#else
-#error missing defines
-#endif
-
-
-
-// describes a bitmap; bitmaps with equivalents structs are considered identical
-START(bitmap, bitmap_hash_key)
- GENERIC(char, bitmap) // bool : true = bitmap, false = outline
- GENERIC(ASS_Font *, font)
- GENERIC(double, size) // font size
- GENERIC(uint32_t, ch) // character code
- FTVECTOR(outline) // border width, 16.16 fixed point value
- GENERIC(int, bold)
- GENERIC(int, italic)
- GENERIC(char, be) // blur edges
- GENERIC(double, blur) // gaussian blur
- GENERIC(unsigned, scale_x) // 16.16
- GENERIC(unsigned, scale_y) // 16.16
- GENERIC(int, frx) // signed 16.16
- GENERIC(int, fry) // signed 16.16
- GENERIC(int, frz) // signed 16.16
- GENERIC(int, fax) // signed 16.16
- GENERIC(int, fay) // signed 16.16
- // shift vector that was added to glyph before applying rotation
- // = 0, if frx = fry = frx = 0
- // = (glyph base point) - (rotation origin), otherwise
- GENERIC(int, shift_x)
- GENERIC(int, shift_y)
- FTVECTOR(advance) // subpixel shift vector
- FTVECTOR(shadow_offset) // shadow subpixel shift
- GENERIC(unsigned, drawing_hash) // hashcode of a drawing
- GENERIC(unsigned, flags) // glyph decoration
- GENERIC(unsigned, border_style)
-END(BitmapHashKey)
-
-// describes an outline glyph
-START(glyph, glyph_hash_key)
- GENERIC(ASS_Font *, font)
- GENERIC(double, size) // font size
- GENERIC(uint32_t, ch) // character code
- GENERIC(int, bold)
- GENERIC(int, italic)
- GENERIC(unsigned, scale_x) // 16.16
- GENERIC(unsigned, scale_y) // 16.16
- FTVECTOR(outline) // border width, 16.16
- GENERIC(unsigned, drawing_hash) // hashcode of a drawing
- GENERIC(unsigned, flags) // glyph decoration flags
- GENERIC(unsigned, border_style)
-END(GlyphHashKey)
-
-// Cache for composited bitmaps
-START(composite, composite_hash_key)
- GENERIC(int, aw)
- GENERIC(int, ah)
- GENERIC(int, bw)
- GENERIC(int, bh)
- GENERIC(int, ax)
- GENERIC(int, ay)
- GENERIC(int, bx)
- GENERIC(int, by)
- GENERIC(int, as)
- GENERIC(int, bs)
- GENERIC(unsigned char *, a)
- GENERIC(unsigned char *, b)
-END(CompositeHashKey)
-
-
-#undef START
-#undef GENERIC
-#undef FTVECTOR
-#undef BITMAPHASHKEY
-#undef END
diff --git a/libass/ass_drawing.c b/libass/ass_drawing.c
deleted file mode 100644
index a3207c7c3b..0000000000
--- a/libass/ass_drawing.c
+++ /dev/null
@@ -1,495 +0,0 @@
-/*
- * Copyright (C) 2009 Grigori Goronzy <greg@geekmind.org>
- *
- * This file is part of libass.
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-#include <ft2build.h>
-#include FT_GLYPH_H
-#include FT_OUTLINE_H
-#include FT_BBOX_H
-#include <math.h>
-
-#include "ass_utils.h"
-#include "ass_font.h"
-#include "ass_drawing.h"
-
-#define CURVE_ACCURACY 64.0
-#define GLYPH_INITIAL_POINTS 100
-#define GLYPH_INITIAL_CONTOURS 5
-
-/*
- * \brief Get and prepare a FreeType glyph
- */
-static void drawing_make_glyph(ASS_Drawing *drawing, void *fontconfig_priv,
- ASS_Font *font, ASS_Hinting hint)
-{
- FT_OutlineGlyph glyph;
-
- // This is hacky...
- glyph = (FT_OutlineGlyph) ass_font_get_glyph(fontconfig_priv, font,
- (uint32_t) ' ', hint, 0);
- if (glyph) {
- FT_Outline_Done(drawing->ftlibrary, &glyph->outline);
- FT_Outline_New(drawing->ftlibrary, GLYPH_INITIAL_POINTS,
- GLYPH_INITIAL_CONTOURS, &glyph->outline);
-
- glyph->outline.n_contours = 0;
- glyph->outline.n_points = 0;
- glyph->root.advance.x = glyph->root.advance.y = 0;
- }
- drawing->glyph = glyph;
-}
-
-/*
- * \brief Add a single point to a contour.
- */
-static inline void drawing_add_point(ASS_Drawing *drawing,
- FT_Vector *point)
-{
- FT_Outline *ol = &drawing->glyph->outline;
-
- if (ol->n_points >= drawing->max_points) {
- drawing->max_points *= 2;
- ol->points = realloc(ol->points, sizeof(FT_Vector) *
- drawing->max_points);
- ol->tags = realloc(ol->tags, drawing->max_points);
- }
-
- ol->points[ol->n_points].x = point->x;
- ol->points[ol->n_points].y = point->y;
- ol->tags[ol->n_points] = 1;
- ol->n_points++;
-}
-
-/*
- * \brief Close a contour and check glyph size overflow.
- */
-static inline void drawing_close_shape(ASS_Drawing *drawing)
-{
- FT_Outline *ol = &drawing->glyph->outline;
-
- if (ol->n_contours >= drawing->max_contours) {
- drawing->max_contours *= 2;
- ol->contours = realloc(ol->contours, sizeof(short) *
- drawing->max_contours);
- }
-
- if (ol->n_points) {
- ol->contours[ol->n_contours] = ol->n_points - 1;
- ol->n_contours++;
- }
-}
-
-/*
- * \brief Prepare drawing for parsing. This just sets a few parameters.
- */
-static void drawing_prepare(ASS_Drawing *drawing)
-{
- // Scaling parameters
- drawing->point_scale_x = drawing->scale_x *
- 64.0 / (1 << (drawing->scale - 1));
- drawing->point_scale_y = drawing->scale_y *
- 64.0 / (1 << (drawing->scale - 1));
-}
-
-/*
- * \brief Finish a drawing. This only sets the horizontal advance according
- * to the glyph's bbox at the moment.
- */
-static void drawing_finish(ASS_Drawing *drawing, int raw_mode)
-{
- int i, offset;
- FT_BBox bbox;
- FT_Outline *ol = &drawing->glyph->outline;
-
- // Close the last contour
- drawing_close_shape(drawing);
-
-#if 0
- // Dump points
- for (i = 0; i < ol->n_points; i++) {
- printf("point (%d, %d)\n", (int) ol->points[i].x,
- (int) ol->points[i].y);
- }
-
- // Dump contours
- for (i = 0; i < ol->n_contours; i++)
- printf("contour %d\n", ol->contours[i]);
-#endif
-
- ass_msg(drawing->library, MSGL_V,
- "Parsed drawing with %d points and %d contours", ol->n_points,
- ol->n_contours);
-
- if (raw_mode)
- return;
-
- FT_Outline_Get_CBox(&drawing->glyph->outline, &bbox);
- drawing->glyph->root.advance.x = d6_to_d16(bbox.xMax - bbox.xMin);
-
- drawing->desc = double_to_d6(-drawing->pbo * drawing->scale_y);
- drawing->asc = bbox.yMax - bbox.yMin + drawing->desc;
-
- // Place it onto the baseline
- offset = (bbox.yMax - bbox.yMin) + double_to_d6(-drawing->pbo *
- drawing->scale_y);
- for (i = 0; i < ol->n_points; i++)
- ol->points[i].y += offset;
-}
-
-/*
- * \brief Check whether a number of items on the list is available
- */
-static int token_check_values(ASS_DrawingToken *token, int i, int type)
-{
- int j;
- for (j = 0; j < i; j++) {
- if (!token || token->type != type) return 0;
- token = token->next;
- }
-
- return 1;
-}
-
-/*
- * \brief Tokenize a drawing string into a list of ASS_DrawingToken
- * This also expands points for closing b-splines
- */
-static ASS_DrawingToken *drawing_tokenize(char *str)
-{
- char *p = str;
- int i, val, type = -1, is_set = 0;
- FT_Vector point = {0, 0};
-
- ASS_DrawingToken *root = NULL, *tail = NULL, *spline_start = NULL;
-
- while (*p) {
- if (*p == 'c' && spline_start) {
- // Close b-splines: add the first three points of the b-spline
- // back to the end
- if (token_check_values(spline_start->next, 2, TOKEN_B_SPLINE)) {
- for (i = 0; i < 3; i++) {
- tail->next = calloc(1, sizeof(ASS_DrawingToken));
- tail->next->prev = tail;
- tail = tail->next;
- tail->type = TOKEN_B_SPLINE;
- tail->point = spline_start->point;
- spline_start = spline_start->next;
- }
- spline_start = NULL;
- }
- } else if (!is_set && mystrtoi(&p, &val)) {
- point.x = val;
- is_set = 1;
- p--;
- } else if (is_set == 1 && mystrtoi(&p, &val)) {
- point.y = val;
- is_set = 2;
- p--;
- } else if (*p == 'm')
- type = TOKEN_MOVE;
- else if (*p == 'n')
- type = TOKEN_MOVE_NC;
- else if (*p == 'l')
- type = TOKEN_LINE;
- else if (*p == 'b')
- type = TOKEN_CUBIC_BEZIER;
- else if (*p == 'q')
- type = TOKEN_CONIC_BEZIER;
- else if (*p == 's')
- type = TOKEN_B_SPLINE;
- // We're simply ignoring TOKEN_EXTEND_B_SPLINE here.
- // This is not harmful at all, since it can be ommitted with
- // similar result (the spline is extended anyway).
-
- if (type != -1 && is_set == 2) {
- if (root) {
- tail->next = calloc(1, sizeof(ASS_DrawingToken));
- tail->next->prev = tail;
- tail = tail->next;
- } else
- root = tail = calloc(1, sizeof(ASS_DrawingToken));
- tail->type = type;
- tail->point = point;
- is_set = 0;
- if (type == TOKEN_B_SPLINE && !spline_start)
- spline_start = tail->prev;
- }
- p++;
- }
-
-#if 0
- // Check tokens
- ASS_DrawingToken *t = root;
- while(t) {
- printf("token %d point (%d, %d)\n", t->type, t->point.x, t->point.y);
- t = t->next;
- }
-#endif
-
- return root;
-}
-
-/*
- * \brief Free a list of tokens
- */
-static void drawing_free_tokens(ASS_DrawingToken *token)
-{
- while (token) {
- ASS_DrawingToken *at = token;
- token = token->next;
- free(at);
- }
-}
-
-/*
- * \brief Translate and scale a point coordinate according to baseline
- * offset and scale.
- */
-static inline void translate_point(ASS_Drawing *drawing, FT_Vector *point)
-{
- point->x = drawing->point_scale_x * point->x;
- point->y = drawing->point_scale_y * -point->y;
-}
-
-/*
- * \brief Evaluate a curve into lines
- * This curve evaluator is also used in VSFilter (RTS.cpp); it's a simple
- * implementation of the De Casteljau algorithm.
- */
-static void drawing_evaluate_curve(ASS_Drawing *drawing,
- ASS_DrawingToken *token, char spline,
- int started)
-{
- double cx3, cx2, cx1, cx0, cy3, cy2, cy1, cy0;
- double t, h, max_accel, max_accel1, max_accel2;
- FT_Vector cur = {0, 0};
-
- cur = token->point;
- translate_point(drawing, &cur);
- int x0 = cur.x;
- int y0 = cur.y;
- token = token->next;
- cur = token->point;
- translate_point(drawing, &cur);
- int x1 = cur.x;
- int y1 = cur.y;
- token = token->next;
- cur = token->point;
- translate_point(drawing, &cur);
- int x2 = cur.x;
- int y2 = cur.y;
- token = token->next;
- cur = token->point;
- translate_point(drawing, &cur);
- int x3 = cur.x;
- int y3 = cur.y;
-
- if (spline) {
- // 1 [-1 +3 -3 +1]
- // - * [+3 -6 +3 0]
- // 6 [-3 0 +3 0]
- // [+1 +4 +1 0]
-
- double div6 = 1.0/6.0;
-
- cx3 = div6*(- x0+3*x1-3*x2+x3);
- cx2 = div6*( 3*x0-6*x1+3*x2);
- cx1 = div6*(-3*x0 +3*x2);
- cx0 = div6*( x0+4*x1+1*x2);
-
- cy3 = div6*(- y0+3*y1-3*y2+y3);
- cy2 = div6*( 3*y0-6*y1+3*y2);
- cy1 = div6*(-3*y0 +3*y2);
- cy0 = div6*( y0+4*y1+1*y2);
- } else {
- // [-1 +3 -3 +1]
- // [+3 -6 +3 0]
- // [-3 +3 0 0]
- // [+1 0 0 0]
-
- cx3 = - x0+3*x1-3*x2+x3;
- cx2 = 3*x0-6*x1+3*x2;
- cx1 = -3*x0+3*x1;
- cx0 = x0;
-
- cy3 = - y0+3*y1-3*y2+y3;
- cy2 = 3*y0-6*y1+3*y2;
- cy1 = -3*y0+3*y1;
- cy0 = y0;
- }
-
- max_accel1 = fabs(2 * cy2) + fabs(6 * cy3);
- max_accel2 = fabs(2 * cx2) + fabs(6 * cx3);
-
- max_accel = FFMAX(max_accel1, max_accel2);
- h = 1.0;
-
- if (max_accel > CURVE_ACCURACY)
- h = sqrt(CURVE_ACCURACY / max_accel);
-
- if (!started) {
- cur.x = cx0;
- cur.y = cy0;
- drawing_add_point(drawing, &cur);
- }
-
- for (t = 0; t < 1.0; t += h) {
- cur.x = cx0 + t * (cx1 + t * (cx2 + t * cx3));
- cur.y = cy0 + t * (cy1 + t * (cy2 + t * cy3));
- drawing_add_point(drawing, &cur);
- }
-
- cur.x = cx0 + cx1 + cx2 + cx3;
- cur.y = cy0 + cy1 + cy2 + cy3;
- drawing_add_point(drawing, &cur);
-}
-
-/*
- * \brief Create and initialize a new drawing and return it
- */
-ASS_Drawing *ass_drawing_new(void *fontconfig_priv, ASS_Font *font,
- ASS_Hinting hint, FT_Library lib)
-{
- ASS_Drawing *drawing;
-
- drawing = calloc(1, sizeof(*drawing));
- drawing->text = calloc(1, DRAWING_INITIAL_SIZE);
- drawing->size = DRAWING_INITIAL_SIZE;
-
- drawing->ftlibrary = lib;
- if (font) {
- drawing->library = font->library;
- drawing_make_glyph(drawing, fontconfig_priv, font, hint);
- }
-
- drawing->scale_x = 1.;
- drawing->scale_y = 1.;
- drawing->max_contours = GLYPH_INITIAL_CONTOURS;
- drawing->max_points = GLYPH_INITIAL_POINTS;
-
- return drawing;
-}
-
-/*
- * \brief Free a drawing
- */
-void ass_drawing_free(ASS_Drawing* drawing)
-{
- if (drawing) {
- if (drawing->glyph)
- FT_Done_Glyph((FT_Glyph) drawing->glyph);
- free(drawing->text);
- }
- free(drawing);
-}
-
-/*
- * \brief Add one ASCII character to the drawing text buffer
- */
-void ass_drawing_add_char(ASS_Drawing* drawing, char symbol)
-{
- drawing->text[drawing->i++] = symbol;
- drawing->text[drawing->i] = 0;
-
- if (drawing->i + 1 >= drawing->size) {
- drawing->size *= 2;
- drawing->text = realloc(drawing->text, drawing->size);
- }
-}
-
-/*
- * \brief Create a hashcode for the drawing
- * XXX: To avoid collisions a better hash algorithm might be useful.
- */
-void ass_drawing_hash(ASS_Drawing* drawing)
-{
- drawing->hash = fnv_32a_str(drawing->text, FNV1_32A_INIT);
-}
-
-/*
- * \brief Convert token list to outline. Calls the line and curve evaluators.
- */
-FT_OutlineGlyph *ass_drawing_parse(ASS_Drawing *drawing, int raw_mode)
-{
- int started = 0;
- ASS_DrawingToken *token;
- FT_Vector pen = {0, 0};
-
- if (!drawing->glyph)
- return NULL;
-
- drawing->tokens = drawing_tokenize(drawing->text);
- drawing_prepare(drawing);
-
- token = drawing->tokens;
- while (token) {
- // Draw something according to current command
- switch (token->type) {
- case TOKEN_MOVE_NC:
- pen = token->point;
- translate_point(drawing, &pen);
- token = token->next;
- break;
- case TOKEN_MOVE:
- pen = token->point;
- translate_point(drawing, &pen);
- if (started) {
- drawing_close_shape(drawing);
- started = 0;
- }
- token = token->next;
- break;
- case TOKEN_LINE: {
- FT_Vector to;
- to = token->point;
- translate_point(drawing, &to);
- if (!started) drawing_add_point(drawing, &pen);
- drawing_add_point(drawing, &to);
- started = 1;
- token = token->next;
- break;
- }
- case TOKEN_CUBIC_BEZIER:
- if (token_check_values(token, 3, TOKEN_CUBIC_BEZIER) &&
- token->prev) {
- drawing_evaluate_curve(drawing, token->prev, 0, started);
- token = token->next;
- token = token->next;
- token = token->next;
- started = 1;
- } else
- token = token->next;
- break;
- case TOKEN_B_SPLINE:
- if (token_check_values(token, 3, TOKEN_B_SPLINE) &&
- token->prev) {
- drawing_evaluate_curve(drawing, token->prev, 1, started);
- token = token->next;
- started = 1;
- } else
- token = token->next;
- break;
- default:
- token = token->next;
- break;
- }
- }
-
- drawing_finish(drawing, raw_mode);
- drawing_free_tokens(drawing->tokens);
- return &drawing->glyph;
-}
diff --git a/libass/ass_drawing.h b/libass/ass_drawing.h
deleted file mode 100644
index 913588e74d..0000000000
--- a/libass/ass_drawing.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * Copyright (C) 2009 Grigori Goronzy <greg@geekmind.org>
- *
- * This file is part of libass.
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-#ifndef LIBASS_DRAWING_H
-#define LIBASS_DRAWING_H
-
-#include <ft2build.h>
-#include FT_GLYPH_H
-
-#include "ass.h"
-
-#define DRAWING_INITIAL_SIZE 256
-
-typedef enum {
- TOKEN_MOVE,
- TOKEN_MOVE_NC,
- TOKEN_LINE,
- TOKEN_CUBIC_BEZIER,
- TOKEN_CONIC_BEZIER,
- TOKEN_B_SPLINE,
- TOKEN_EXTEND_SPLINE,
- TOKEN_CLOSE
-} ASS_TokenType;
-
-typedef struct ass_drawing_token {
- ASS_TokenType type;
- FT_Vector point;
- struct ass_drawing_token *next;
- struct ass_drawing_token *prev;
-} ASS_DrawingToken;
-
-typedef struct {
- char *text; // drawing string
- int i; // text index
- int scale; // scale (1-64) for subpixel accuracy
- double pbo; // drawing will be shifted in y direction by this amount
- double scale_x; // FontScaleX
- double scale_y; // FontScaleY
- int asc; // ascender
- int desc; // descender
- FT_OutlineGlyph glyph; // the "fake" glyph created for later rendering
- int hash; // hash value (for caching)
-
- // private
- FT_Library ftlibrary; // FT library instance, needed for font ops
- ASS_Library *library;
- int size; // current buffer size
- ASS_DrawingToken *tokens; // tokenized drawing
- int max_points; // current maximum size
- int max_contours;
- double point_scale_x;
- double point_scale_y;
-} ASS_Drawing;
-
-ASS_Drawing *ass_drawing_new(void *fontconfig_priv, ASS_Font *font,
- ASS_Hinting hint, FT_Library lib);
-void ass_drawing_free(ASS_Drawing* drawing);
-void ass_drawing_add_char(ASS_Drawing* drawing, char symbol);
-void ass_drawing_hash(ASS_Drawing* drawing);
-FT_OutlineGlyph *ass_drawing_parse(ASS_Drawing *drawing, int raw_mode);
-
-#endif /* LIBASS_DRAWING_H */
diff --git a/libass/ass_font.c b/libass/ass_font.c
deleted file mode 100644
index 7db1f076f7..0000000000
--- a/libass/ass_font.c
+++ /dev/null
@@ -1,532 +0,0 @@
-/*
- * Copyright (C) 2006 Evgeniy Stepanov <eugeni.stepanov@gmail.com>
- *
- * This file is part of libass.
- *
- * libass 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.
- *
- * libass 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 libass; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#include "config.h"
-
-#include <inttypes.h>
-#include <ft2build.h>
-#include FT_FREETYPE_H
-#include FT_SYNTHESIS_H
-#include FT_GLYPH_H
-#include FT_TRUETYPE_TABLES_H
-#include FT_OUTLINE_H
-
-#include "ass.h"
-#include "ass_library.h"
-#include "ass_font.h"
-#include "ass_bitmap.h"
-#include "ass_cache.h"
-#include "ass_fontconfig.h"
-#include "ass_utils.h"
-
-/**
- * Select Microfost Unicode CharMap, if the font has one.
- * Otherwise, let FreeType decide.
- */
-static void charmap_magic(ASS_Library *library, FT_Face face)
-{
- int i;
- for (i = 0; i < face->num_charmaps; ++i) {
- FT_CharMap cmap = face->charmaps[i];
- unsigned pid = cmap->platform_id;
- unsigned eid = cmap->encoding_id;
- if (pid == 3 /*microsoft */
- && (eid == 1 /*unicode bmp */
- || eid == 10 /*full unicode */ )) {
- FT_Set_Charmap(face, cmap);
- return;
- }
- }
-
- if (!face->charmap) {
- if (face->num_charmaps == 0) {
- ass_msg(library, MSGL_WARN, "Font face with no charmaps");
- return;
- }
- ass_msg(library, MSGL_WARN,
- "No charmap autodetected, trying the first one");
- FT_Set_Charmap(face, face->charmaps[0]);
- return;
- }
-}
-
-static void update_transform(ASS_Font *font)
-{
- int i;
- FT_Matrix m;
- m.xx = double_to_d16(font->scale_x);
- m.yy = double_to_d16(font->scale_y);
- m.xy = m.yx = 0;
- for (i = 0; i < font->n_faces; ++i)
- FT_Set_Transform(font->faces[i], &m, &font->v);
-}
-
-/**
- * \brief find a memory font by name
- */
-static int find_font(ASS_Library *library, char *name)
-{
- int i;
- for (i = 0; i < library->num_fontdata; ++i)
- if (strcasecmp(name, library->fontdata[i].name) == 0)
- return i;
- return -1;
-}
-
-static void face_set_size(FT_Face face, double size);
-
-static void buggy_font_workaround(FT_Face face)
-{
- // Some fonts have zero Ascender/Descender fields in 'hhea' table.
- // In this case, get the information from 'os2' table or, as
- // a last resort, from face.bbox.
- if (face->ascender + face->descender == 0 || face->height == 0) {
- TT_OS2 *os2 = FT_Get_Sfnt_Table(face, ft_sfnt_os2);
- if (os2) {
- face->ascender = os2->sTypoAscender;
- face->descender = os2->sTypoDescender;
- face->height = face->ascender - face->descender;
- } else {
- face->ascender = face->bbox.yMax;
- face->descender = face->bbox.yMin;
- face->height = face->ascender - face->descender;
- }
- }
-}
-
-/**
- * \brief Select a face with the given charcode and add it to ASS_Font
- * \return index of the new face in font->faces, -1 if failed
- */
-static int add_face(void *fc_priv, ASS_Font *font, uint32_t ch)
-{
- char *path;
- int index;
- FT_Face face;
- int error;
- int mem_idx;
-
- if (font->n_faces == ASS_FONT_MAX_FACES)
- return -1;
-
- path =
- fontconfig_select(font->library, fc_priv, font->desc.family,
- font->desc.treat_family_as_pattern,
- font->desc.bold, font->desc.italic, &index, ch);
- if (!path)
- return -1;
-
- mem_idx = find_font(font->library, path);
- if (mem_idx >= 0) {
- error =
- FT_New_Memory_Face(font->ftlibrary,
- (unsigned char *) font->library->
- fontdata[mem_idx].data,
- font->library->fontdata[mem_idx].size, 0,
- &face);
- if (error) {
- ass_msg(font->library, MSGL_WARN,
- "Error opening memory font: '%s'", path);
- free(path);
- return -1;
- }
- } else {
- error = FT_New_Face(font->ftlibrary, path, index, &face);
- if (error) {
- ass_msg(font->library, MSGL_WARN,
- "Error opening font: '%s', %d", path, index);
- free(path);
- return -1;
- }
- }
- charmap_magic(font->library, face);
- buggy_font_workaround(face);
-
- font->faces[font->n_faces++] = face;
- update_transform(font);
- face_set_size(face, font->size);
- free(path);
- return font->n_faces - 1;
-}
-
-/**
- * \brief Create a new ASS_Font according to "desc" argument
- */
-ASS_Font *ass_font_new(void *font_cache, ASS_Library *library,
- FT_Library ftlibrary, void *fc_priv,
- ASS_FontDesc *desc)
-{
- int error;
- ASS_Font *fontp;
- ASS_Font font;
-
- fontp = ass_font_cache_find((Hashmap *) font_cache, desc);
- if (fontp)
- return fontp;
-
- font.library = library;
- font.ftlibrary = ftlibrary;
- font.n_faces = 0;
- font.desc.family = strdup(desc->family);
- font.desc.treat_family_as_pattern = desc->treat_family_as_pattern;
- font.desc.bold = desc->bold;
- font.desc.italic = desc->italic;
-
- font.scale_x = font.scale_y = 1.;
- font.v.x = font.v.y = 0;
- font.size = 0.;
-
- error = add_face(fc_priv, &font, 0);
- if (error == -1) {
- free(font.desc.family);
- return 0;
- } else
- return ass_font_cache_add((Hashmap *) font_cache, &font);
-}
-
-/**
- * \brief Set font transformation matrix and shift vector
- **/
-void ass_font_set_transform(ASS_Font *font, double scale_x,
- double scale_y, FT_Vector *v)
-{
- font->scale_x = scale_x;
- font->scale_y = scale_y;
- if (v) {
- font->v.x = v->x;
- font->v.y = v->y;
- }
- update_transform(font);
-}
-
-static void face_set_size(FT_Face face, double size)
-{
- TT_HoriHeader *hori = FT_Get_Sfnt_Table(face, ft_sfnt_hhea);
- TT_OS2 *os2 = FT_Get_Sfnt_Table(face, ft_sfnt_os2);
- double mscale = 1.;
- FT_Size_RequestRec rq;
- FT_Size_Metrics *m = &face->size->metrics;
- // VSFilter uses metrics from TrueType OS/2 table
- // The idea was borrowed from asa (http://asa.diac24.net)
- if (hori && os2) {
- int hori_height = hori->Ascender - hori->Descender;
- int os2_height = os2->usWinAscent + os2->usWinDescent;
- if (hori_height && os2_height)
- mscale = (double) hori_height / os2_height;
- }
- memset(&rq, 0, sizeof(rq));
- rq.type = FT_SIZE_REQUEST_TYPE_REAL_DIM;
- rq.width = 0;
- rq.height = double_to_d6(size * mscale);
- rq.horiResolution = rq.vertResolution = 0;
- FT_Request_Size(face, &rq);
- m->ascender /= mscale;
- m->descender /= mscale;
- m->height /= mscale;
-}
-
-/**
- * \brief Set font size
- **/
-void ass_font_set_size(ASS_Font *font, double size)
-{
- int i;
- if (font->size != size) {
- font->size = size;
- for (i = 0; i < font->n_faces; ++i)
- face_set_size(font->faces[i], size);
- }
-}
-
-/**
- * \brief Get maximal font ascender and descender.
- * \param ch character code
- * The values are extracted from the font face that provides glyphs for the given character
- **/
-void ass_font_get_asc_desc(ASS_Font *font, uint32_t ch, int *asc,
- int *desc)
-{
- int i;
- for (i = 0; i < font->n_faces; ++i) {
- FT_Face face = font->faces[i];
- TT_OS2 *os2 = FT_Get_Sfnt_Table(face, ft_sfnt_os2);
- if (FT_Get_Char_Index(face, ch)) {
- int y_scale = face->size->metrics.y_scale;
- if (os2) {
- *asc = FT_MulFix(os2->usWinAscent, y_scale);
- *desc = FT_MulFix(os2->usWinDescent, y_scale);
- } else {
- *asc = FT_MulFix(face->ascender, y_scale);
- *desc = FT_MulFix(-face->descender, y_scale);
- }
- return;
- }
- }
-
- *asc = *desc = 0;
-}
-
-/*
- * Strike a glyph with a horizontal line; it's possible to underline it
- * and/or strike through it. For the line's position and size, truetype
- * tables are consulted. Obviously this relies on the data in the tables
- * being accurate.
- *
- */
-static int ass_strike_outline_glyph(FT_Face face, ASS_Font *font,
- FT_Glyph glyph, int under, int through)
-{
- TT_OS2 *os2 = FT_Get_Sfnt_Table(face, ft_sfnt_os2);
- TT_Postscript *ps = FT_Get_Sfnt_Table(face, ft_sfnt_post);
- FT_Outline *ol = &((FT_OutlineGlyph) glyph)->outline;
- int bear, advance, y_scale, i, dir;
-
- if (!under && !through)
- return 0;
-
- // Grow outline
- i = (under ? 4 : 0) + (through ? 4 : 0);
- ol->points = realloc(ol->points, sizeof(FT_Vector) *
- (ol->n_points + i));
- ol->tags = realloc(ol->tags, ol->n_points + i);
- i = !!under + !!through;
- ol->contours = realloc(ol->contours, sizeof(short) *
- (ol->n_contours + i));
-
- // If the bearing is negative, the glyph starts left of the current
- // pen position
- bear = FFMIN(face->glyph->metrics.horiBearingX, 0);
- // We're adding half a pixel to avoid small gaps
- advance = d16_to_d6(glyph->advance.x) + 32;
- y_scale = face->size->metrics.y_scale;
-
- // Reverse drawing direction for non-truetype fonts
- dir = FT_Outline_Get_Orientation(ol);
-
- // Add points to the outline
- if (under && ps) {
- int pos, size;
- pos = FT_MulFix(ps->underlinePosition, y_scale * font->scale_y);
- size = FT_MulFix(ps->underlineThickness,
- y_scale * font->scale_y / 2);
-
- if (pos > 0 || size <= 0)
- return 1;
-
- FT_Vector points[4] = {
- {.x = bear, .y = pos + size},
- {.x = advance, .y = pos + size},
- {.x = advance, .y = pos - size},
- {.x = bear, .y = pos - size},
- };
-
- if (dir == FT_ORIENTATION_TRUETYPE) {
- for (i = 0; i < 4; i++) {
- ol->points[ol->n_points] = points[i];
- ol->tags[ol->n_points++] = 1;
- }
- } else {
- for (i = 3; i >= 0; i--) {
- ol->points[ol->n_points] = points[i];
- ol->tags[ol->n_points++] = 1;
- }
- }
-
- ol->contours[ol->n_contours++] = ol->n_points - 1;
- }
-
- if (through && os2) {
- int pos, size;
- pos = FT_MulFix(os2->yStrikeoutPosition, y_scale * font->scale_y);
- size = FT_MulFix(os2->yStrikeoutSize, y_scale * font->scale_y / 2);
-
- if (pos < 0 || size <= 0)
- return 1;
-
- FT_Vector points[4] = {
- {.x = bear, .y = pos + size},
- {.x = advance, .y = pos + size},
- {.x = advance, .y = pos - size},
- {.x = bear, .y = pos - size},
- };
-
- if (dir == FT_ORIENTATION_TRUETYPE) {
- for (i = 0; i < 4; i++) {
- ol->points[ol->n_points] = points[i];
- ol->tags[ol->n_points++] = 1;
- }
- } else {
- for (i = 3; i >= 0; i--) {
- ol->points[ol->n_points] = points[i];
- ol->tags[ol->n_points++] = 1;
- }
- }
-
- ol->contours[ol->n_contours++] = ol->n_points - 1;
- }
-
- return 0;
-}
-
-/**
- * Slightly embold a glyph without touching its metrics
- */
-static void ass_glyph_embolden(FT_GlyphSlot slot)
-{
- int str;
-
- if (slot->format != FT_GLYPH_FORMAT_OUTLINE)
- return;
-
- str = FT_MulFix(slot->face->units_per_EM,
- slot->face->size->metrics.y_scale) / 64;
-
- FT_Outline_Embolden(&slot->outline, str);
-}
-
-/**
- * \brief Get a glyph
- * \param ch character code
- **/
-FT_Glyph ass_font_get_glyph(void *fontconfig_priv, ASS_Font *font,
- uint32_t ch, ASS_Hinting hinting, int deco)
-{
- int error;
- int index = 0;
- int i;
- FT_Glyph glyph;
- FT_Face face = 0;
- int flags = 0;
-
- if (ch < 0x20)
- return 0;
- // Handle NBSP like a regular space when rendering the glyph
- if (ch == 0xa0)
- ch = ' ';
- if (font->n_faces == 0)
- return 0;
-
- for (i = 0; i < font->n_faces; ++i) {
- face = font->faces[i];
- index = FT_Get_Char_Index(face, ch);
- if (index)
- break;
- }
-
-#ifdef CONFIG_FONTCONFIG
- if (index == 0) {
- int face_idx;
- ass_msg(font->library, MSGL_INFO,
- "Glyph 0x%X not found, selecting one more "
- "font for (%s, %d, %d)", ch, font->desc.family,
- font->desc.bold, font->desc.italic);
- face_idx = add_face(fontconfig_priv, font, ch);
- if (face_idx >= 0) {
- face = font->faces[face_idx];
- index = FT_Get_Char_Index(face, ch);
- if (index == 0) {
- ass_msg(font->library, MSGL_ERR,
- "Glyph 0x%X not found in font for (%s, %d, %d)",
- ch, font->desc.family, font->desc.bold,
- font->desc.italic);
- }
- }
- }
-#endif
-
- switch (hinting) {
- case ASS_HINTING_NONE:
- flags = FT_LOAD_NO_HINTING;
- break;
- case ASS_HINTING_LIGHT:
- flags = FT_LOAD_FORCE_AUTOHINT | FT_LOAD_TARGET_LIGHT;
- break;
- case ASS_HINTING_NORMAL:
- flags = FT_LOAD_FORCE_AUTOHINT;
- break;
- case ASS_HINTING_NATIVE:
- flags = 0;
- break;
- }
-
- error = FT_Load_Glyph(face, index, FT_LOAD_NO_BITMAP | flags);
- if (error) {
- ass_msg(font->library, MSGL_WARN, "Error loading glyph, index %d",
- index);
- return 0;
- }
- if (!(face->style_flags & FT_STYLE_FLAG_ITALIC) &&
- (font->desc.italic > 55)) {
- FT_GlyphSlot_Oblique(face->glyph);
- }
-
- if (!(face->style_flags & FT_STYLE_FLAG_BOLD) &&
- (font->desc.bold > 80)) {
- ass_glyph_embolden(face->glyph);
- }
- error = FT_Get_Glyph(face->glyph, &glyph);
- if (error) {
- ass_msg(font->library, MSGL_WARN, "Error loading glyph, index %d",
- index);
- return 0;
- }
-
- ass_strike_outline_glyph(face, font, glyph, deco & DECO_UNDERLINE,
- deco & DECO_STRIKETHROUGH);
-
- return glyph;
-}
-
-/**
- * \brief Get kerning for the pair of glyphs.
- **/
-FT_Vector ass_font_get_kerning(ASS_Font *font, uint32_t c1, uint32_t c2)
-{
- FT_Vector v = { 0, 0 };
- int i;
-
- for (i = 0; i < font->n_faces; ++i) {
- FT_Face face = font->faces[i];
- int i1 = FT_Get_Char_Index(face, c1);
- int i2 = FT_Get_Char_Index(face, c2);
- if (i1 && i2) {
- if (FT_HAS_KERNING(face))
- FT_Get_Kerning(face, i1, i2, FT_KERNING_DEFAULT, &v);
- return v;
- }
- if (i1 || i2) // these glyphs are from different font faces, no kerning information
- return v;
- }
- return v;
-}
-
-/**
- * \brief Deallocate ASS_Font
- **/
-void ass_font_free(ASS_Font *font)
-{
- int i;
- for (i = 0; i < font->n_faces; ++i)
- if (font->faces[i])
- FT_Done_Face(font->faces[i]);
- if (font->desc.family)
- free(font->desc.family);
- free(font);
-}
diff --git a/libass/ass_font.h b/libass/ass_font.h
deleted file mode 100644
index ca0c213a09..0000000000
--- a/libass/ass_font.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Copyright (C) 2006 Evgeniy Stepanov <eugeni.stepanov@gmail.com>
- *
- * This file is part of libass.
- *
- * libass 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.
- *
- * libass 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 libass; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#ifndef LIBASS_FONT_H
-#define LIBASS_FONT_H
-
-#include <stdint.h>
-#include <ft2build.h>
-#include FT_GLYPH_H
-#include "ass.h"
-#include "ass_types.h"
-
-#define ASS_FONT_MAX_FACES 10
-#define DECO_UNDERLINE 1
-#define DECO_STRIKETHROUGH 2
-
-typedef struct {
- char *family;
- unsigned bold;
- unsigned italic;
- int treat_family_as_pattern;
-} ASS_FontDesc;
-
-typedef struct {
- ASS_FontDesc desc;
- ASS_Library *library;
- FT_Library ftlibrary;
- FT_Face faces[ASS_FONT_MAX_FACES];
- int n_faces;
- double scale_x, scale_y; // current transform
- FT_Vector v; // current shift
- double size;
-} ASS_Font;
-
-// FIXME: passing the hashmap via a void pointer is very ugly.
-ASS_Font *ass_font_new(void *font_cache, ASS_Library *library,
- FT_Library ftlibrary, void *fc_priv,
- ASS_FontDesc *desc);
-void ass_font_set_transform(ASS_Font *font, double scale_x,
- double scale_y, FT_Vector *v);
-void ass_font_set_size(ASS_Font *font, double size);
-void ass_font_get_asc_desc(ASS_Font *font, uint32_t ch, int *asc,
- int *desc);
-FT_Glyph ass_font_get_glyph(void *fontconfig_priv, ASS_Font *font,
- uint32_t ch, ASS_Hinting hinting, int flags);
-FT_Vector ass_font_get_kerning(ASS_Font *font, uint32_t c1, uint32_t c2);
-void ass_font_free(ASS_Font *font);
-
-#endif /* LIBASS_FONT_H */
diff --git a/libass/ass_fontconfig.c b/libass/ass_fontconfig.c
deleted file mode 100644
index 2a43694f38..0000000000
--- a/libass/ass_fontconfig.c
+++ /dev/null
@@ -1,461 +0,0 @@
-/*
- * Copyright (C) 2006 Evgeniy Stepanov <eugeni.stepanov@gmail.com>
- *
- * This file is part of libass.
- *
- * libass 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.
- *
- * libass 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 libass; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#include "config.h"
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <assert.h>
-#include <string.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <inttypes.h>
-#include <ft2build.h>
-#include FT_FREETYPE_H
-
-#include "ass_utils.h"
-#include "ass.h"
-#include "ass_library.h"
-#include "ass_fontconfig.h"
-
-#ifdef CONFIG_FONTCONFIG
-#include <fontconfig/fontconfig.h>
-#include <fontconfig/fcfreetype.h>
-#endif
-
-struct fc_instance {
-#ifdef CONFIG_FONTCONFIG
- FcConfig *config;
-#endif
- char *family_default;
- char *path_default;
- int index_default;
-};
-
-#ifdef CONFIG_FONTCONFIG
-
-/**
- * \brief Low-level font selection.
- * \param priv private data
- * \param family font family
- * \param treat_family_as_pattern treat family as fontconfig pattern
- * \param bold font weight value
- * \param italic font slant value
- * \param index out: font index inside a file
- * \param code: the character that should be present in the font, can be 0
- * \return font file path
-*/
-static char *_select_font(ASS_Library *library, FCInstance *priv,
- const char *family, int treat_family_as_pattern,
- unsigned bold, unsigned italic, int *index,
- uint32_t code)
-{
- FcBool rc;
- FcResult result;
- FcPattern *pat = NULL, *rpat = NULL;
- int r_index, r_slant, r_weight;
- FcChar8 *r_family, *r_style, *r_file, *r_fullname;
- FcBool r_outline, r_embolden;
- FcCharSet *r_charset;
- FcFontSet *fset = NULL;
- int curf;
- char *retval = NULL;
- int family_cnt = 0;
-
- *index = 0;
-
- if (treat_family_as_pattern)
- pat = FcNameParse((const FcChar8 *) family);
- else
- pat = FcPatternCreate();
-
- if (!pat)
- goto error;
-
- if (!treat_family_as_pattern) {
- FcPatternAddString(pat, FC_FAMILY, (const FcChar8 *) family);
-
- // In SSA/ASS fonts are sometimes referenced by their "full name",
- // which is usually a concatenation of family name and font
- // style (ex. Ottawa Bold). Full name is available from
- // FontConfig pattern element FC_FULLNAME, but it is never
- // used for font matching.
- // Therefore, I'm removing words from the end of the name one
- // by one, and adding shortened names to the pattern. It seems
- // that the first value (full name in this case) has
- // precedence in matching.
- // An alternative approach could be to reimplement FcFontSort
- // using FC_FULLNAME instead of FC_FAMILY.
- family_cnt = 1;
- {
- char *s = strdup(family);
- char *p = s + strlen(s);
- while (--p > s)
- if (*p == ' ' || *p == '-') {
- *p = '\0';
- FcPatternAddString(pat, FC_FAMILY, (const FcChar8 *) s);
- ++family_cnt;
- }
- free(s);
- }
- }
- FcPatternAddBool(pat, FC_OUTLINE, FcTrue);
- FcPatternAddInteger(pat, FC_SLANT, italic);
- FcPatternAddInteger(pat, FC_WEIGHT, bold);
-
- FcDefaultSubstitute(pat);
-
- rc = FcConfigSubstitute(priv->config, pat, FcMatchPattern);
- if (!rc)
- goto error;
-
- fset = FcFontSort(priv->config, pat, FcTrue, NULL, &result);
- if (!fset)
- goto error;
-
- for (curf = 0; curf < fset->nfont; ++curf) {
- FcPattern *curp = fset->fonts[curf];
-
- result = FcPatternGetBool(curp, FC_OUTLINE, 0, &r_outline);
- if (result != FcResultMatch)
- continue;
- if (r_outline != FcTrue)
- continue;
- if (!code)
- break;
- result = FcPatternGetCharSet(curp, FC_CHARSET, 0, &r_charset);
- if (result != FcResultMatch)
- continue;
- if (FcCharSetHasChar(r_charset, code))
- break;
- }
-
- if (curf >= fset->nfont)
- goto error;
-
- if (!treat_family_as_pattern) {
- // Remove all extra family names from original pattern.
- // After this, FcFontRenderPrepare will select the most relevant family
- // name in case there are more than one of them.
- for (; family_cnt > 1; --family_cnt)
- FcPatternRemove(pat, FC_FAMILY, family_cnt - 1);
- }
-
- rpat = FcFontRenderPrepare(priv->config, pat, fset->fonts[curf]);
- if (!rpat)
- goto error;
-
- result = FcPatternGetInteger(rpat, FC_INDEX, 0, &r_index);
- if (result != FcResultMatch)
- goto error;
- *index = r_index;
-
- result = FcPatternGetString(rpat, FC_FILE, 0, &r_file);
- if (result != FcResultMatch)
- goto error;
- retval = strdup((const char *) r_file);
-
- result = FcPatternGetString(rpat, FC_FAMILY, 0, &r_family);
- if (result != FcResultMatch)
- r_family = NULL;
-
- result = FcPatternGetString(rpat, FC_FULLNAME, 0, &r_fullname);
- if (result != FcResultMatch)
- r_fullname = NULL;
-
- if (!treat_family_as_pattern &&
- !(r_family && strcasecmp((const char *) r_family, family) == 0) &&
- !(r_fullname && strcasecmp((const char *) r_fullname, family) == 0))
- ass_msg(library, MSGL_WARN,
- "fontconfig: Selected font is not the requested one: "
- "'%s' != '%s'",
- (const char *) (r_fullname ? r_fullname : r_family), family);
-
- result = FcPatternGetString(rpat, FC_STYLE, 0, &r_style);
- if (result != FcResultMatch)
- r_style = NULL;
-
- result = FcPatternGetInteger(rpat, FC_SLANT, 0, &r_slant);
- if (result != FcResultMatch)
- r_slant = 0;
-
- result = FcPatternGetInteger(rpat, FC_WEIGHT, 0, &r_weight);
- if (result != FcResultMatch)
- r_weight = 0;
-
- result = FcPatternGetBool(rpat, FC_EMBOLDEN, 0, &r_embolden);
- if (result != FcResultMatch)
- r_embolden = 0;
-
- ass_msg(library, MSGL_V,
- "Font info: family '%s', style '%s', fullname '%s',"
- " slant %d, weight %d%s", (const char *) r_family,
- (const char *) r_style, (const char *) r_fullname, r_slant,
- r_weight, r_embolden ? ", embolden" : "");
-
- error:
- if (pat)
- FcPatternDestroy(pat);
- if (rpat)
- FcPatternDestroy(rpat);
- if (fset)
- FcFontSetDestroy(fset);
- return retval;
-}
-
-/**
- * \brief Find a font. Use default family or path if necessary.
- * \param priv_ private data
- * \param family font family
- * \param treat_family_as_pattern treat family as fontconfig pattern
- * \param bold font weight value
- * \param italic font slant value
- * \param index out: font index inside a file
- * \param code: the character that should be present in the font, can be 0
- * \return font file path
-*/
-char *fontconfig_select(ASS_Library *library, FCInstance *priv,
- const char *family, int treat_family_as_pattern,
- unsigned bold, unsigned italic, int *index,
- uint32_t code)
-{
- char *res = 0;
- if (!priv->config) {
- *index = priv->index_default;
- res = priv->path_default ? strdup(priv->path_default) : 0;
- return res;
- }
- if (family && *family)
- res =
- _select_font(library, priv, family, treat_family_as_pattern,
- bold, italic, index, code);
- if (!res && priv->family_default) {
- res =
- _select_font(library, priv, priv->family_default, 0, bold,
- italic, index, code);
- if (res)
- ass_msg(library, MSGL_WARN, "fontconfig_select: Using default "
- "font family: (%s, %d, %d) -> %s, %d",
- family, bold, italic, res, *index);
- }
- if (!res && priv->path_default) {
- res = strdup(priv->path_default);
- *index = priv->index_default;
- ass_msg(library, MSGL_WARN, "fontconfig_select: Using default font: "
- "(%s, %d, %d) -> %s, %d", family, bold, italic,
- res, *index);
- }
- if (!res) {
- res = _select_font(library, priv, "Arial", 0, bold, italic,
- index, code);
- if (res)
- ass_msg(library, MSGL_WARN, "fontconfig_select: Using 'Arial' "
- "font family: (%s, %d, %d) -> %s, %d", family, bold,
- italic, res, *index);
- }
- if (res)
- ass_msg(library, MSGL_V,
- "fontconfig_select: (%s, %d, %d) -> %s, %d", family, bold,
- italic, res, *index);
- return res;
-}
-
-/**
- * \brief Process memory font.
- * \param priv private data
- * \param library library object
- * \param ftlibrary freetype library object
- * \param idx index of the processed font in library->fontdata
- * With FontConfig >= 2.4.2, builds a font pattern in memory via FT_New_Memory_Face/FcFreeTypeQueryFace.
- * With older FontConfig versions, save the font to ~/.mplayer/fonts.
-*/
-static void process_fontdata(FCInstance *priv, ASS_Library *library,
- FT_Library ftlibrary, int idx)
-{
- int rc;
- const char *name = library->fontdata[idx].name;
- const char *data = library->fontdata[idx].data;
- int data_size = library->fontdata[idx].size;
-
- FT_Face face;
- FcPattern *pattern;
- FcFontSet *fset;
- FcBool res;
- int face_index, num_faces = 1;
-
- for (face_index = 0; face_index < num_faces; ++face_index) {
- rc = FT_New_Memory_Face(ftlibrary, (unsigned char *) data,
- data_size, face_index, &face);
- if (rc) {
- ass_msg(library, MSGL_WARN, "Error opening memory font: %s",
- name);
- return;
- }
- num_faces = face->num_faces;
-
- pattern =
- FcFreeTypeQueryFace(face, (unsigned char *) name, 0,
- FcConfigGetBlanks(priv->config));
- if (!pattern) {
- ass_msg(library, MSGL_WARN, "%s failed", "FcFreeTypeQueryFace");
- FT_Done_Face(face);
- return;
- }
-
- fset = FcConfigGetFonts(priv->config, FcSetSystem); // somehow it failes when asked for FcSetApplication
- if (!fset) {
- ass_msg(library, MSGL_WARN, "%s failed", "FcConfigGetFonts");
- FT_Done_Face(face);
- return;
- }
-
- res = FcFontSetAdd(fset, pattern);
- if (!res) {
- ass_msg(library, MSGL_WARN, "%s failed", "FcFontSetAdd");
- FT_Done_Face(face);
- return;
- }
-
- FT_Done_Face(face);
- }
-}
-
-/**
- * \brief Init fontconfig.
- * \param library libass library object
- * \param ftlibrary freetype library object
- * \param family default font family
- * \param path default font path
- * \param fc whether fontconfig should be used
- * \param config path to a fontconfig configuration file, or NULL
- * \param update whether the fontconfig cache should be built/updated
- * \return pointer to fontconfig private data
-*/
-FCInstance *fontconfig_init(ASS_Library *library,
- FT_Library ftlibrary, const char *family,
- const char *path, int fc, const char *config,
- int update)
-{
- int rc;
- FCInstance *priv = calloc(1, sizeof(FCInstance));
- const char *dir = library->fonts_dir;
- int i;
-
- if (!fc) {
- ass_msg(library, MSGL_WARN,
- "Fontconfig disabled, only default font will be used.");
- goto exit;
- }
-
- priv->config = FcConfigCreate();
- rc = FcConfigParseAndLoad(priv->config, (unsigned char *) config, FcTrue);
- if (!rc) {
- ass_msg(library, MSGL_WARN, "No usable fontconfig configuration "
- "file found, using fallback.");
- FcConfigDestroy(priv->config);
- priv->config = FcInitLoadConfig();
- rc++;
- }
- if (rc && update) {
- FcConfigBuildFonts(priv->config);
- }
-
- if (!rc || !priv->config) {
- ass_msg(library, MSGL_FATAL,
- "No valid fontconfig configuration found!");
- FcConfigDestroy(priv->config);
- goto exit;
- }
-
- for (i = 0; i < library->num_fontdata; ++i)
- process_fontdata(priv, library, ftlibrary, i);
-
- if (dir) {
- ass_msg(library, MSGL_INFO, "Updating font cache");
-
- rc = FcConfigAppFontAddDir(priv->config, (const FcChar8 *) dir);
- if (!rc) {
- ass_msg(library, MSGL_WARN, "%s failed", "FcConfigAppFontAddDir");
- }
- }
-
- priv->family_default = family ? strdup(family) : NULL;
-exit:
- priv->path_default = path ? strdup(path) : NULL;
- priv->index_default = 0;
-
- return priv;
-}
-
-int fontconfig_update(FCInstance *priv)
-{
- return FcConfigBuildFonts(priv->config);
-}
-
-#else /* CONFIG_FONTCONFIG */
-
-char *fontconfig_select(ASS_Library *library, FCInstance *priv,
- const char *family, int treat_family_as_pattern,
- unsigned bold, unsigned italic, int *index,
- uint32_t code)
-{
- *index = priv->index_default;
- char* res = priv->path_default ? strdup(priv->path_default) : 0;
- return res;
-}
-
-FCInstance *fontconfig_init(ASS_Library *library,
- FT_Library ftlibrary, const char *family,
- const char *path, int fc, const char *config,
- int update)
-{
- FCInstance *priv;
-
- ass_msg(library, MSGL_WARN,
- "Fontconfig disabled, only default font will be used.");
-
- priv = calloc(1, sizeof(FCInstance));
-
- priv->path_default = path ? strdup(path) : 0;
- priv->index_default = 0;
- return priv;
-}
-
-int fontconfig_update(FCInstance *priv)
-{
- // Do nothing
- return 1;
-}
-
-#endif
-
-void fontconfig_done(FCInstance *priv)
-{
-#ifdef CONFIG_FONTCONFIG
- if (priv && priv->config)
- FcConfigDestroy(priv->config);
-#endif
- if (priv && priv->path_default)
- free(priv->path_default);
- if (priv && priv->family_default)
- free(priv->family_default);
- if (priv)
- free(priv);
-}
diff --git a/libass/ass_fontconfig.h b/libass/ass_fontconfig.h
deleted file mode 100644
index ad5b9f0e46..0000000000
--- a/libass/ass_fontconfig.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright (C) 2006 Evgeniy Stepanov <eugeni.stepanov@gmail.com>
- *
- * This file is part of libass.
- *
- * libass 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.
- *
- * libass 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 libass; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#ifndef LIBASS_FONTCONFIG_H
-#define LIBASS_FONTCONFIG_H
-
-#include <stdint.h>
-#include "ass_types.h"
-#include "ass.h"
-#include <ft2build.h>
-#include FT_FREETYPE_H
-
-#ifdef CONFIG_FONTCONFIG
-#include <fontconfig/fontconfig.h>
-#endif
-
-typedef struct fc_instance FCInstance;
-
-FCInstance *fontconfig_init(ASS_Library *library,
- FT_Library ftlibrary, const char *family,
- const char *path, int fc, const char *config,
- int update);
-char *fontconfig_select(ASS_Library *library, FCInstance *priv,
- const char *family, int treat_family_as_pattern,
- unsigned bold, unsigned italic, int *index,
- uint32_t code);
-void fontconfig_done(FCInstance *priv);
-int fontconfig_update(FCInstance *priv);
-
-#endif /* LIBASS_FONTCONFIG_H */
diff --git a/libass/ass_library.c b/libass/ass_library.c
deleted file mode 100644
index 53b91af169..0000000000
--- a/libass/ass_library.c
+++ /dev/null
@@ -1,147 +0,0 @@
-/*
- * Copyright (C) 2006 Evgeniy Stepanov <eugeni.stepanov@gmail.com>
- *
- * This file is part of libass.
- *
- * libass 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.
- *
- * libass 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 libass; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#include <inttypes.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <stdarg.h>
-
-#include "ass.h"
-#include "ass_library.h"
-#include "ass_utils.h"
-
-static void ass_msg_handler(int level, const char *fmt, va_list va, void *data)
-{
- if (level > MSGL_INFO)
- return;
- fprintf(stderr, "[ass] ");
- vfprintf(stderr, fmt, va);
- fprintf(stderr, "\n");
-}
-
-ASS_Library *ass_library_init(void)
-{
- ASS_Library* lib = calloc(1, sizeof(*lib));
- lib->msg_callback = ass_msg_handler;
-
- return lib;
-}
-
-void ass_library_done(ASS_Library *priv)
-{
- if (priv) {
- ass_set_fonts_dir(priv, NULL);
- ass_set_style_overrides(priv, NULL);
- ass_clear_fonts(priv);
- free(priv);
- }
-}
-
-void ass_set_fonts_dir(ASS_Library *priv, const char *fonts_dir)
-{
- if (priv->fonts_dir)
- free(priv->fonts_dir);
-
- priv->fonts_dir = fonts_dir ? strdup(fonts_dir) : 0;
-}
-
-void ass_set_extract_fonts(ASS_Library *priv, int extract)
-{
- priv->extract_fonts = !!extract;
-}
-
-void ass_set_style_overrides(ASS_Library *priv, char **list)
-{
- char **p;
- char **q;
- int cnt;
-
- if (priv->style_overrides) {
- for (p = priv->style_overrides; *p; ++p)
- free(*p);
- free(priv->style_overrides);
- }
-
- if (!list)
- return;
-
- for (p = list, cnt = 0; *p; ++p, ++cnt) {
- }
-
- priv->style_overrides = malloc((cnt + 1) * sizeof(char *));
- for (p = list, q = priv->style_overrides; *p; ++p, ++q)
- *q = strdup(*p);
- priv->style_overrides[cnt] = NULL;
-}
-
-static void grow_array(void **array, int nelem, size_t elsize)
-{
- if (!(nelem & 31))
- *array = realloc(*array, (nelem + 32) * elsize);
-}
-
-void ass_add_font(ASS_Library *priv, char *name, char *data, int size)
-{
- int idx = priv->num_fontdata;
- if (!name || !data || !size)
- return;
- grow_array((void **) &priv->fontdata, priv->num_fontdata,
- sizeof(*priv->fontdata));
-
- priv->fontdata[idx].name = strdup(name);
-
- priv->fontdata[idx].data = malloc(size);
- memcpy(priv->fontdata[idx].data, data, size);
-
- priv->fontdata[idx].size = size;
-
- priv->num_fontdata++;
-}
-
-void ass_clear_fonts(ASS_Library *priv)
-{
- int i;
- for (i = 0; i < priv->num_fontdata; ++i) {
- free(priv->fontdata[i].name);
- free(priv->fontdata[i].data);
- }
- free(priv->fontdata);
- priv->fontdata = NULL;
- priv->num_fontdata = 0;
-}
-
-/*
- * Register a message callback function with libass. Without setting one,
- * a default handler is used which prints everything with MSGL_INFO or
- * higher to the standard output.
- *
- * \param msg_cb the callback function
- * \param data additional data that will be passed to the callback
- */
-void ass_set_message_cb(ASS_Library *priv,
- void (*msg_cb)(int, const char *, va_list, void *),
- void *data)
-{
- if (msg_cb) {
- priv->msg_callback = msg_cb;
- priv->msg_callback_data = data;
- }
-}
diff --git a/libass/ass_library.h b/libass/ass_library.h
deleted file mode 100644
index e0db5c951f..0000000000
--- a/libass/ass_library.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright (C) 2006 Evgeniy Stepanov <eugeni.stepanov@gmail.com>
- *
- * This file is part of libass.
- *
- * libass 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.
- *
- * libass 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 libass; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#ifndef LIBASS_LIBRARY_H
-#define LIBASS_LIBRARY_H
-
-#include <stdarg.h>
-
-typedef struct {
- char *name;
- char *data;
- int size;
-} ASS_Fontdata;
-
-struct ass_library {
- char *fonts_dir;
- int extract_fonts;
- char **style_overrides;
-
- ASS_Fontdata *fontdata;
- int num_fontdata;
- void (*msg_callback)(int, const char *, va_list, void *);
- void *msg_callback_data;
-};
-
-#endif /* LIBASS_LIBRARY_H */
diff --git a/libass/ass_mp.c b/libass/ass_mp.c
deleted file mode 100644
index b5f55cc29a..0000000000
--- a/libass/ass_mp.c
+++ /dev/null
@@ -1,278 +0,0 @@
-// -*- c-basic-offset: 8; indent-tabs-mode: t -*-
-// vim:ts=8:sw=8:noet:ai:
-/*
- * Copyright (C) 2006 Evgeniy Stepanov <eugeni.stepanov@gmail.com>
- *
- * This file is part of libass.
- *
- * libass 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.
- *
- * libass 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 libass; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#include <inttypes.h>
-#include <string.h>
-#include <stdlib.h>
-
-#include "mp_msg.h"
-#include "get_path.h"
-
-#include "ass_mp.h"
-
-#ifdef CONFIG_FONTCONFIG
-#include <fontconfig/fontconfig.h>
-#endif
-
-// libass-related command line options
-ass_library_t* ass_library;
-int ass_enabled = 0;
-float ass_font_scale = 1.;
-float ass_line_spacing = 0.;
-int ass_top_margin = 0;
-int ass_bottom_margin = 0;
-#if defined(FC_VERSION) && (FC_VERSION >= 20402)
-int extract_embedded_fonts = 1;
-#else
-int extract_embedded_fonts = 0;
-#endif
-char **ass_force_style_list = NULL;
-int ass_use_margins = 0;
-char* ass_color = NULL;
-char* ass_border_color = NULL;
-char* ass_styles_file = NULL;
-int ass_hinting = ASS_HINTING_NATIVE + 4; // native hinting for unscaled osd
-
-#ifdef CONFIG_FONTCONFIG
-extern int font_fontconfig;
-#else
-static int font_fontconfig = -1;
-#endif
-extern char* font_name;
-extern char* sub_font_name;
-extern float text_font_scale_factor;
-extern int subtitle_autoscale;
-
-#ifdef CONFIG_ICONV
-extern char* sub_cp;
-#else
-static char* sub_cp = 0;
-#endif
-
-ass_track_t* ass_default_track(ass_library_t* library) {
- ass_track_t* track = ass_new_track(library);
-
- track->track_type = TRACK_TYPE_ASS;
- track->Timer = 100.;
- track->PlayResY = 288;
- track->WrapStyle = 0;
-
- if (ass_styles_file)
- ass_read_styles(track, ass_styles_file, sub_cp);
-
- if (track->n_styles == 0) {
- ass_style_t* style;
- int sid;
- double fs;
- uint32_t c1, c2;
-
- sid = ass_alloc_style(track);
- style = track->styles + sid;
- style->Name = strdup("Default");
- style->FontName = (font_fontconfig >= 0 && sub_font_name) ? strdup(sub_font_name) : (font_fontconfig >= 0 && font_name) ? strdup(font_name) : strdup("Sans");
- style->treat_fontname_as_pattern = 1;
-
- fs = track->PlayResY * text_font_scale_factor / 100.;
- // approximate autoscale coefficients
- if (subtitle_autoscale == 2)
- fs *= 1.3;
- else if (subtitle_autoscale == 3)
- fs *= 1.4;
- style->FontSize = fs;
-
- if (ass_color) c1 = strtoll(ass_color, NULL, 16);
- else c1 = 0xFFFF0000;
- if (ass_border_color) c2 = strtoll(ass_border_color, NULL, 16);
- else c2 = 0x00000000;
-
- style->PrimaryColour = c1;
- style->SecondaryColour = c1;
- style->OutlineColour = c2;
- style->BackColour = 0x00000000;
- style->BorderStyle = 1;
- style->Alignment = 2;
- style->Outline = 2;
- style->MarginL = 10;
- style->MarginR = 10;
- style->MarginV = 5;
- style->ScaleX = 1.;
- style->ScaleY = 1.;
- }
-
- process_force_style(track);
- return track;
-}
-
-static int check_duplicate_plaintext_event(ass_track_t* track)
-{
- int i;
- ass_event_t* evt = track->events + track->n_events - 1;
-
- for (i = 0; i<track->n_events - 1; ++i) // ignoring last event, it is the one we are comparing with
- if (track->events[i].Start == evt->Start &&
- track->events[i].Duration == evt->Duration &&
- strcmp(track->events[i].Text, evt->Text) == 0)
- return 1;
- return 0;
-}
-
-/**
- * \brief Convert subtitle to ass_event_t for the given track
- * \param ass_track_t track
- * \param sub subtitle to convert
- * \return event id
- * note: assumes that subtitle is _not_ fps-based; caller must manually correct
- * Start and Duration in other case.
- **/
-int ass_process_subtitle(ass_track_t* track, subtitle* sub)
-{
- int eid;
- ass_event_t* event;
- int len = 0, j;
- char* p;
- char* end;
-
- eid = ass_alloc_event(track);
- event = track->events + eid;
-
- event->Start = sub->start * 10;
- event->Duration = (sub->end - sub->start) * 10;
- event->Style = 0;
-
- for (j = 0; j < sub->lines; ++j)
- len += sub->text[j] ? strlen(sub->text[j]) : 0;
-
- len += 2 * sub->lines; // '\N', including the one after the last line
- len += 6; // {\anX}
- len += 1; // '\0'
-
- event->Text = malloc(len);
- end = event->Text + len;
- p = event->Text;
-
- if (sub->alignment)
- p += snprintf(p, end - p, "{\\an%d}", sub->alignment);
-
- for (j = 0; j < sub->lines; ++j)
- p += snprintf(p, end - p, "%s\\N", sub->text[j]);
-
- if (sub->lines > 0) p-=2; // remove last "\N"
- *p = 0;
-
- if (check_duplicate_plaintext_event(track)) {
- ass_free_event(track, eid);
- track->n_events--;
- return -1;
- }
-
- mp_msg(MSGT_ASS, MSGL_V, "plaintext event at %" PRId64 ", +%" PRId64 ": %s \n",
- (int64_t)event->Start, (int64_t)event->Duration, event->Text);
-
- return eid;
-}
-
-
-/**
- * \brief Convert subdata to ass_track
- * \param subdata subtitles struct from subreader
- * \param fps video framerate
- * \return newly allocated ass_track, filled with subtitles from subdata
- */
-ass_track_t* ass_read_subdata(ass_library_t* library, sub_data* subdata, double fps) {
- ass_track_t* track;
- int i;
-
- track = ass_default_track(library);
- track->name = subdata->filename ? strdup(subdata->filename) : 0;
-
- for (i = 0; i < subdata->sub_num; ++i) {
- int eid = ass_process_subtitle(track, subdata->subtitles + i);
- if (eid < 0)
- continue;
- if (!subdata->sub_uses_time) {
- track->events[eid].Start *= 100. / fps;
- track->events[eid].Duration *= 100. / fps;
- }
- }
- return track;
-}
-
-void ass_configure(ass_renderer_t* priv, int w, int h, int unscaled) {
- int hinting;
- ass_set_frame_size(priv, w, h);
- ass_set_margins(priv, ass_top_margin, ass_bottom_margin, 0, 0);
- ass_set_use_margins(priv, ass_use_margins);
- ass_set_font_scale(priv, ass_font_scale);
- if (!unscaled && (ass_hinting & 4))
- hinting = 0;
- else
- hinting = ass_hinting & 3;
- ass_set_hinting(priv, hinting);
- ass_set_line_spacing(priv, ass_line_spacing);
-}
-
-void ass_configure_fonts(ass_renderer_t* priv) {
- char *dir, *path, *family;
- dir = get_path("fonts");
- if (font_fontconfig < 0 && sub_font_name) path = strdup(sub_font_name);
- else if (font_fontconfig < 0 && font_name) path = strdup(font_name);
- else path = get_path("subfont.ttf");
- if (font_fontconfig >= 0 && sub_font_name) family = strdup(sub_font_name);
- else if (font_fontconfig >= 0 && font_name) family = strdup(font_name);
- else family = 0;
-
-#if defined(LIBASS_VERSION) && LIBASS_VERSION >= 0x00907010
- ass_set_fonts(priv, path, family, font_fontconfig, NULL, 1);
-#else
- if (font_fontconfig >= 0)
- ass_set_fonts(priv, path, family);
- else
- ass_set_fonts_nofc(priv, path, family);
-#endif
-
- free(dir);
- free(path);
- free(family);
-}
-
-ass_library_t* ass_init(void) {
- ass_library_t* priv;
- char* path = get_path("fonts");
- priv = ass_library_init();
- ass_set_fonts_dir(priv, path);
- ass_set_extract_fonts(priv, extract_embedded_fonts);
- ass_set_style_overrides(priv, ass_force_style_list);
- free(path);
- return priv;
-}
-
-int ass_force_reload = 0; // flag set if global ass-related settings were changed
-
-ass_image_t* ass_mp_render_frame(ass_renderer_t *priv, ass_track_t* track, long long now, int* detect_change) {
- if (ass_force_reload) {
- ass_set_margins(priv, ass_top_margin, ass_bottom_margin, 0, 0);
- ass_set_use_margins(priv, ass_use_margins);
- ass_set_font_scale(priv, ass_font_scale);
- ass_force_reload = 0;
- }
- return ass_render_frame(priv, track, now, detect_change);
-}
diff --git a/libass/ass_mp.h b/libass/ass_mp.h
deleted file mode 100644
index 1584145d1c..0000000000
--- a/libass/ass_mp.h
+++ /dev/null
@@ -1,75 +0,0 @@
-// -*- c-basic-offset: 8; indent-tabs-mode: t -*-
-// vim:ts=8:sw=8:noet:ai:
-/*
- * Copyright (C) 2006 Evgeniy Stepanov <eugeni.stepanov@gmail.com>
- *
- * This file is part of libass.
- *
- * libass 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.
- *
- * libass 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 libass; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#ifndef LIBASS_MP_H
-#define LIBASS_MP_H
-
-#include "subreader.h"
-#if defined(CONFIG_ASS_INTERNAL) || !defined(CONFIG_ASS)
-#include "ass.h"
-#else
-#include <ass/ass.h>
-#endif
-#if defined(LIBASS_VERSION) && LIBASS_VERSION >= 0x00907010
-#define ass_library_t ASS_Library
-#define ass_track_t ASS_Track
-#define ass_track_s ASS_Track
-#define ass_renderer_t ASS_Renderer
-#define ass_image_t ASS_Image
-#define ass_style_t ASS_Style
-#define ass_event_t ASS_Event
-#define process_force_style(t) ass_process_force_style(t)
-#else
-void process_force_style(ass_track_t* track);
-#endif
-
-extern ass_library_t* ass_library;
-extern int ass_enabled;
-extern float ass_font_scale;
-extern float ass_line_spacing;
-extern int ass_top_margin;
-extern int ass_bottom_margin;
-extern int extract_embedded_fonts;
-extern char **ass_force_style_list;
-extern int ass_use_margins;
-extern char* ass_color;
-extern char* ass_border_color;
-extern char* ass_styles_file;
-extern int ass_hinting;
-
-ass_track_t* ass_default_track(ass_library_t* library);
-int ass_process_subtitle(ass_track_t* track, subtitle* sub);
-ass_track_t* ass_read_subdata(ass_library_t* library, sub_data* subdata, double fps);
-
-void ass_configure(ass_renderer_t* priv, int w, int h, int hinting);
-void ass_configure_fonts(ass_renderer_t* priv);
-ass_library_t* ass_init(void);
-
-typedef struct {
- ass_image_t* imgs;
- int changed;
-} mp_eosd_images_t;
-
-extern int ass_force_reload;
-ass_image_t* ass_mp_render_frame(ass_renderer_t *priv, ass_track_t* track, long long now, int* detect_change);
-
-#endif /* LIBASS_MP_H */
diff --git a/libass/ass_parse.c b/libass/ass_parse.c
deleted file mode 100644
index 0ccb5a2b19..0000000000
--- a/libass/ass_parse.c
+++ /dev/null
@@ -1,926 +0,0 @@
-/*
- * Copyright (C) 2009 Grigori Goronzy <greg@geekmind.org>
- *
- * This file is part of libass.
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-#include "config.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <math.h>
-
-#include "ass_render.h"
-#include "ass_parse.h"
-
-#define MAX_BE 127
-#define NBSP 0xa0 // unicode non-breaking space character
-
-#define skip_to(x) while ((*p != (x)) && (*p != '}') && (*p != 0)) { ++p;}
-#define skip(x) if (*p == (x)) ++p; else { return p; }
-#define skipopt(x) if (*p == (x)) { ++p; }
-
-/**
- * \brief Check if starting part of (*p) matches sample.
- * If true, shift p to the first symbol after the matching part.
- */
-static inline int mystrcmp(char **p, const char *sample)
-{
- int len = strlen(sample);
- if (strncmp(*p, sample, len) == 0) {
- (*p) += len;
- return 1;
- } else
- return 0;
-}
-
-static void change_font_size(ASS_Renderer *render_priv, double sz)
-{
- double size = sz * render_priv->font_scale;
-
- if (size < 1)
- size = 1;
- else if (size > render_priv->height * 2)
- size = render_priv->height * 2;
-
- ass_font_set_size(render_priv->state.font, size);
-
- render_priv->state.font_size = sz;
-}
-
-/**
- * \brief Change current font, using setting from render_priv->state.
- */
-void update_font(ASS_Renderer *render_priv)
-{
- unsigned val;
- ASS_FontDesc desc;
- desc.family = strdup(render_priv->state.family);
- desc.treat_family_as_pattern =
- render_priv->state.treat_family_as_pattern;
-
- val = render_priv->state.bold;
- // 0 = normal, 1 = bold, >1 = exact weight
- if (val == 1 || val == -1)
- val = 200; // bold
- else if (val <= 0)
- val = 80; // normal
- desc.bold = val;
-
- val = render_priv->state.italic;
- if (val == 1 || val == -1)
- val = 110; // italic
- else if (val <= 0)
- val = 0; // normal
- desc.italic = val;
-
- render_priv->state.font =
- ass_font_new(render_priv->cache.font_cache, render_priv->library,
- render_priv->ftlibrary, render_priv->fontconfig_priv,
- &desc);
- free(desc.family);
-
- if (render_priv->state.font)
- change_font_size(render_priv, render_priv->state.font_size);
-}
-
-/**
- * \brief Change border width
- * negative value resets border to style value
- */
-void change_border(ASS_Renderer *render_priv, double border_x,
- double border_y)
-{
- int bord;
- if (!render_priv->state.font)
- return;
-
- if (border_x < 0 && border_y < 0) {
- if (render_priv->state.style->BorderStyle == 1 ||
- render_priv->state.style->BorderStyle == 3)
- border_x = border_y = render_priv->state.style->Outline;
- else
- border_x = border_y = 1.;
- }
-
- render_priv->state.border_x = border_x;
- render_priv->state.border_y = border_y;
-
- bord = 64 * border_x * render_priv->border_scale;
- if (bord > 0 && border_x == border_y) {
- if (!render_priv->state.stroker) {
- int error;
- error =
- FT_Stroker_New(render_priv->ftlibrary,
- &render_priv->state.stroker);
- if (error) {
- ass_msg(render_priv->library, MSGL_V,
- "failed to get stroker");
- render_priv->state.stroker = 0;
- }
- }
- if (render_priv->state.stroker)
- FT_Stroker_Set(render_priv->state.stroker, bord,
- FT_STROKER_LINECAP_ROUND,
- FT_STROKER_LINEJOIN_ROUND, 0);
- } else {
- FT_Stroker_Done(render_priv->state.stroker);
- render_priv->state.stroker = 0;
- }
-}
-
-/**
- * \brief Calculate a weighted average of two colors
- * calculates c1*(1-a) + c2*a, but separately for each component except alpha
- */
-static void change_color(uint32_t *var, uint32_t new, double pwr)
-{
- (*var) = ((uint32_t) (_r(*var) * (1 - pwr) + _r(new) * pwr) << 24) +
- ((uint32_t) (_g(*var) * (1 - pwr) + _g(new) * pwr) << 16) +
- ((uint32_t) (_b(*var) * (1 - pwr) + _b(new) * pwr) << 8) + _a(*var);
-}
-
-// like change_color, but for alpha component only
-inline void change_alpha(uint32_t *var, uint32_t new, double pwr)
-{
- *var =
- (_r(*var) << 24) + (_g(*var) << 16) + (_b(*var) << 8) +
- (uint32_t) (_a(*var) * (1 - pwr) + _a(new) * pwr);
-}
-
-/**
- * \brief Multiply two alpha values
- * \param a first value
- * \param b second value
- * \return result of multiplication
- * Parameters and result are limited by 0xFF.
- */
-inline uint32_t mult_alpha(uint32_t a, uint32_t b)
-{
- return 0xFF - (0xFF - a) * (0xFF - b) / 0xFF;
-}
-
-/**
- * \brief Calculate alpha value by piecewise linear function
- * Used for \fad, \fade implementation.
- */
-static unsigned
-interpolate_alpha(long long now, long long t1, long long t2, long long t3,
- long long t4, unsigned a1, unsigned a2, unsigned a3)
-{
- unsigned a;
- double cf;
- if (now <= t1) {
- a = a1;
- } else if (now >= t4) {
- a = a3;
- } else if (now < t2) { // and > t1
- cf = ((double) (now - t1)) / (t2 - t1);
- a = a1 * (1 - cf) + a2 * cf;
- } else if (now > t3) {
- cf = ((double) (now - t3)) / (t4 - t3);
- a = a2 * (1 - cf) + a3 * cf;
- } else { // t2 <= now <= t3
- a = a2;
- }
-
- return a;
-}
-
-/**
- * Parse a vector clip into an outline, using the proper scaling
- * parameters. Translate it to correct for screen borders, if needed.
- */
-static char *parse_vector_clip(ASS_Renderer *render_priv, char *p)
-{
- int scale = 1;
- int res = 0;
- ASS_Drawing *drawing;
-
- render_priv->state.clip_drawing = ass_drawing_new(
- render_priv->fontconfig_priv,
- render_priv->state.font,
- render_priv->settings.hinting,
- render_priv->ftlibrary);
- drawing = render_priv->state.clip_drawing;
- skipopt('(');
- res = mystrtoi(&p, &scale);
- skipopt(',')
- if (!res)
- scale = 1;
- drawing->scale = scale;
- drawing->scale_x = render_priv->font_scale_x * render_priv->font_scale;
- drawing->scale_y = render_priv->font_scale;
- while (*p != ')' && *p != '}' && p != 0)
- ass_drawing_add_char(drawing, *p++);
- skipopt(')');
- if (ass_drawing_parse(drawing, 1)) {
- // We need to translate the clip according to screen borders
- if (render_priv->settings.left_margin != 0 ||
- render_priv->settings.top_margin != 0) {
- FT_Vector trans = {
- .x = int_to_d6(render_priv->settings.left_margin),
- .y = -int_to_d6(render_priv->settings.top_margin),
- };
- FT_Outline_Translate(&drawing->glyph->outline, trans.x, trans.y);
- }
- ass_msg(render_priv->library, MSGL_DBG2,
- "Parsed vector clip: scale %d, scales (%f, %f) string [%s]\n",
- scale, drawing->scale_x, drawing->scale_y, drawing->text);
- }
-
- return p;
-}
-
-/**
- * \brief Parse style override tag.
- * \param p string to parse
- * \param pwr multiplier for some tag effects (comes from \t tags)
- */
-static char *parse_tag(ASS_Renderer *render_priv, char *p, double pwr)
-{
- skip_to('\\');
- skip('\\');
- if ((*p == '}') || (*p == 0))
- return p;
-
- // New tags introduced in vsfilter 2.39
- if (mystrcmp(&p, "xbord")) {
- double val;
- if (mystrtod(&p, &val))
- val = render_priv->state.border_x * (1 - pwr) + val * pwr;
- else
- val = -1.;
- change_border(render_priv, val, render_priv->state.border_y);
- } else if (mystrcmp(&p, "ybord")) {
- double val;
- if (mystrtod(&p, &val))
- val = render_priv->state.border_y * (1 - pwr) + val * pwr;
- else
- val = -1.;
- change_border(render_priv, render_priv->state.border_x, val);
- } else if (mystrcmp(&p, "xshad")) {
- double val;
- if (mystrtod(&p, &val))
- val = render_priv->state.shadow_x * (1 - pwr) + val * pwr;
- else
- val = 0.;
- render_priv->state.shadow_x = val;
- } else if (mystrcmp(&p, "yshad")) {
- double val;
- if (mystrtod(&p, &val))
- val = render_priv->state.shadow_y * (1 - pwr) + val * pwr;
- else
- val = 0.;
- render_priv->state.shadow_y = val;
- } else if (mystrcmp(&p, "fax")) {
- double val;
- if (mystrtod(&p, &val))
- render_priv->state.fax =
- val * pwr + render_priv->state.fax * (1 - pwr);
- else
- render_priv->state.fax = 0.;
- } else if (mystrcmp(&p, "fay")) {
- double val;
- if (mystrtod(&p, &val))
- render_priv->state.fay =
- val * pwr + render_priv->state.fay * (1 - pwr);
- else
- render_priv->state.fay = 0.;
- } else if (mystrcmp(&p, "iclip")) {
- int x0, y0, x1, y1;
- int res = 1;
- char *start = p;
- skipopt('(');
- res &= mystrtoi(&p, &x0);
- skipopt(',');
- res &= mystrtoi(&p, &y0);
- skipopt(',');
- res &= mystrtoi(&p, &x1);
- skipopt(',');
- res &= mystrtoi(&p, &y1);
- skipopt(')');
- if (res) {
- render_priv->state.clip_x0 =
- render_priv->state.clip_x0 * (1 - pwr) + x0 * pwr;
- render_priv->state.clip_x1 =
- render_priv->state.clip_x1 * (1 - pwr) + x1 * pwr;
- render_priv->state.clip_y0 =
- render_priv->state.clip_y0 * (1 - pwr) + y0 * pwr;
- render_priv->state.clip_y1 =
- render_priv->state.clip_y1 * (1 - pwr) + y1 * pwr;
- render_priv->state.clip_mode = 1;
- } else if (!render_priv->state.clip_drawing) {
- p = parse_vector_clip(render_priv, start);
- render_priv->state.clip_drawing_mode = 1;
- } else
- render_priv->state.clip_mode = 0;
- } else if (mystrcmp(&p, "blur")) {
- double val;
- if (mystrtod(&p, &val)) {
- val = render_priv->state.blur * (1 - pwr) + val * pwr;
- val = (val < 0) ? 0 : val;
- val = (val > BLUR_MAX_RADIUS) ? BLUR_MAX_RADIUS : val;
- render_priv->state.blur = val;
- } else
- render_priv->state.blur = 0.0;
- // ASS standard tags
- } else if (mystrcmp(&p, "fsc")) {
- char tp = *p++;
- double val;
- if (tp == 'x') {
- if (mystrtod(&p, &val)) {
- val /= 100;
- render_priv->state.scale_x =
- render_priv->state.scale_x * (1 - pwr) + val * pwr;
- } else
- render_priv->state.scale_x =
- render_priv->state.style->ScaleX;
- } else if (tp == 'y') {
- if (mystrtod(&p, &val)) {
- val /= 100;
- render_priv->state.scale_y =
- render_priv->state.scale_y * (1 - pwr) + val * pwr;
- } else
- render_priv->state.scale_y =
- render_priv->state.style->ScaleY;
- }
- } else if (mystrcmp(&p, "fsp")) {
- double val;
- if (mystrtod(&p, &val))
- render_priv->state.hspacing =
- render_priv->state.hspacing * (1 - pwr) + val * pwr;
- else
- render_priv->state.hspacing = render_priv->state.style->Spacing;
- } else if (mystrcmp(&p, "fs")) {
- double val;
- if (mystrtod(&p, &val))
- val = render_priv->state.font_size * (1 - pwr) + val * pwr;
- else
- val = render_priv->state.style->FontSize;
- if (render_priv->state.font)
- change_font_size(render_priv, val);
- } else if (mystrcmp(&p, "bord")) {
- double val;
- if (mystrtod(&p, &val)) {
- if (render_priv->state.border_x == render_priv->state.border_y)
- val = render_priv->state.border_x * (1 - pwr) + val * pwr;
- } else
- val = -1.; // reset to default
- change_border(render_priv, val, val);
- } else if (mystrcmp(&p, "move")) {
- double x1, x2, y1, y2;
- long long t1, t2, delta_t, t;
- double x, y;
- double k;
- skip('(');
- mystrtod(&p, &x1);
- skip(',');
- mystrtod(&p, &y1);
- skip(',');
- mystrtod(&p, &x2);
- skip(',');
- mystrtod(&p, &y2);
- if (*p == ',') {
- skip(',');
- mystrtoll(&p, &t1);
- skip(',');
- mystrtoll(&p, &t2);
- ass_msg(render_priv->library, MSGL_DBG2,
- "movement6: (%f, %f) -> (%f, %f), (%" PRId64 " .. %"
- PRId64 ")\n", x1, y1, x2, y2, (int64_t) t1,
- (int64_t) t2);
- } else {
- t1 = 0;
- t2 = render_priv->state.event->Duration;
- ass_msg(render_priv->library, MSGL_DBG2,
- "movement: (%f, %f) -> (%f, %f)", x1, y1, x2, y2);
- }
- skip(')');
- delta_t = t2 - t1;
- t = render_priv->time - render_priv->state.event->Start;
- if (t < t1)
- k = 0.;
- else if (t > t2)
- k = 1.;
- else
- k = ((double) (t - t1)) / delta_t;
- x = k * (x2 - x1) + x1;
- y = k * (y2 - y1) + y1;
- if (render_priv->state.evt_type != EVENT_POSITIONED) {
- render_priv->state.pos_x = x;
- render_priv->state.pos_y = y;
- render_priv->state.detect_collisions = 0;
- render_priv->state.evt_type = EVENT_POSITIONED;
- }
- } else if (mystrcmp(&p, "frx")) {
- double val;
- if (mystrtod(&p, &val)) {
- val *= M_PI / 180;
- render_priv->state.frx =
- val * pwr + render_priv->state.frx * (1 - pwr);
- } else
- render_priv->state.frx = 0.;
- } else if (mystrcmp(&p, "fry")) {
- double val;
- if (mystrtod(&p, &val)) {
- val *= M_PI / 180;
- render_priv->state.fry =
- val * pwr + render_priv->state.fry * (1 - pwr);
- } else
- render_priv->state.fry = 0.;
- } else if (mystrcmp(&p, "frz") || mystrcmp(&p, "fr")) {
- double val;
- if (mystrtod(&p, &val)) {
- val *= M_PI / 180;
- render_priv->state.frz =
- val * pwr + render_priv->state.frz * (1 - pwr);
- } else
- render_priv->state.frz =
- M_PI * render_priv->state.style->Angle / 180.;
- } else if (mystrcmp(&p, "fn")) {
- char *start = p;
- char *family;
- skip_to('\\');
- if (p > start) {
- family = malloc(p - start + 1);
- strncpy(family, start, p - start);
- family[p - start] = '\0';
- } else
- family = strdup(render_priv->state.style->FontName);
- if (render_priv->state.family)
- free(render_priv->state.family);
- render_priv->state.family = family;
- update_font(render_priv);
- } else if (mystrcmp(&p, "alpha")) {
- uint32_t val;
- int i;
- int hex = render_priv->track->track_type == TRACK_TYPE_ASS;
- if (strtocolor(render_priv->library, &p, &val, hex)) {
- unsigned char a = val >> 24;
- for (i = 0; i < 4; ++i)
- change_alpha(&render_priv->state.c[i], a, pwr);
- } else {
- change_alpha(&render_priv->state.c[0],
- render_priv->state.style->PrimaryColour, pwr);
- change_alpha(&render_priv->state.c[1],
- render_priv->state.style->SecondaryColour, pwr);
- change_alpha(&render_priv->state.c[2],
- render_priv->state.style->OutlineColour, pwr);
- change_alpha(&render_priv->state.c[3],
- render_priv->state.style->BackColour, pwr);
- }
- // FIXME: simplify
- } else if (mystrcmp(&p, "an")) {
- int val;
- if (mystrtoi(&p, &val) && val) {
- int v = (val - 1) / 3; // 0, 1 or 2 for vertical alignment
- ass_msg(render_priv->library, MSGL_DBG2, "an %d", val);
- if (v != 0)
- v = 3 - v;
- val = ((val - 1) % 3) + 1; // horizontal alignment
- val += v * 4;
- ass_msg(render_priv->library, MSGL_DBG2, "align %d", val);
- render_priv->state.alignment = val;
- } else
- render_priv->state.alignment =
- render_priv->state.style->Alignment;
- } else if (mystrcmp(&p, "a")) {
- int val;
- if (mystrtoi(&p, &val) && val)
- // take care of a vsfilter quirk: handle illegal \a8 like \a5
- render_priv->state.alignment = (val == 8) ? 5 : val;
- else
- render_priv->state.alignment =
- render_priv->state.style->Alignment;
- } else if (mystrcmp(&p, "pos")) {
- double v1, v2;
- skip('(');
- mystrtod(&p, &v1);
- skip(',');
- mystrtod(&p, &v2);
- skip(')');
- ass_msg(render_priv->library, MSGL_DBG2, "pos(%f, %f)", v1, v2);
- if (render_priv->state.evt_type == EVENT_POSITIONED) {
- ass_msg(render_priv->library, MSGL_V, "Subtitle has a new \\pos "
- "after \\move or \\pos, ignoring");
- } else {
- render_priv->state.evt_type = EVENT_POSITIONED;
- render_priv->state.detect_collisions = 0;
- render_priv->state.pos_x = v1;
- render_priv->state.pos_y = v2;
- }
- } else if (mystrcmp(&p, "fad")) {
- int a1, a2, a3;
- long long t1, t2, t3, t4;
- if (*p == 'e')
- ++p; // either \fad or \fade
- skip('(');
- mystrtoi(&p, &a1);
- skip(',');
- mystrtoi(&p, &a2);
- if (*p == ')') {
- // 2-argument version (\fad, according to specs)
- // a1 and a2 are fade-in and fade-out durations
- t1 = 0;
- t4 = render_priv->state.event->Duration;
- t2 = a1;
- t3 = t4 - a2;
- a1 = 0xFF;
- a2 = 0;
- a3 = 0xFF;
- } else {
- // 6-argument version (\fade)
- // a1 and a2 (and a3) are opacity values
- skip(',');
- mystrtoi(&p, &a3);
- skip(',');
- mystrtoll(&p, &t1);
- skip(',');
- mystrtoll(&p, &t2);
- skip(',');
- mystrtoll(&p, &t3);
- skip(',');
- mystrtoll(&p, &t4);
- }
- skip(')');
- render_priv->state.fade =
- interpolate_alpha(render_priv->time -
- render_priv->state.event->Start, t1, t2,
- t3, t4, a1, a2, a3);
- } else if (mystrcmp(&p, "org")) {
- int v1, v2;
- skip('(');
- mystrtoi(&p, &v1);
- skip(',');
- mystrtoi(&p, &v2);
- skip(')');
- ass_msg(render_priv->library, MSGL_DBG2, "org(%d, %d)", v1, v2);
- if (!render_priv->state.have_origin) {
- render_priv->state.org_x = v1;
- render_priv->state.org_y = v2;
- render_priv->state.have_origin = 1;
- render_priv->state.detect_collisions = 0;
- }
- } else if (mystrcmp(&p, "t")) {
- double v[3];
- int v1, v2;
- double v3;
- int cnt;
- long long t1, t2, t, delta_t;
- double k;
- skip('(');
- for (cnt = 0; cnt < 3; ++cnt) {
- if (*p == '\\')
- break;
- v[cnt] = strtod(p, &p);
- skip(',');
- }
- if (cnt == 3) {
- v1 = v[0];
- v2 = (v[1] < v1) ? render_priv->state.event->Duration : v[1];
- v3 = v[2];
- } else if (cnt == 2) {
- v1 = v[0];
- v2 = (v[1] < v1) ? render_priv->state.event->Duration : v[1];
- v3 = 1.;
- } else if (cnt == 1) {
- v1 = 0;
- v2 = render_priv->state.event->Duration;
- v3 = v[0];
- } else { // cnt == 0
- v1 = 0;
- v2 = render_priv->state.event->Duration;
- v3 = 1.;
- }
- render_priv->state.detect_collisions = 0;
- t1 = v1;
- t2 = v2;
- delta_t = v2 - v1;
- if (v3 < 0.)
- v3 = 0.;
- t = render_priv->time - render_priv->state.event->Start; // FIXME: move to render_context
- if (t <= t1)
- k = 0.;
- else if (t >= t2)
- k = 1.;
- else {
- assert(delta_t != 0.);
- k = pow(((double) (t - t1)) / delta_t, v3);
- }
- while (*p == '\\')
- p = parse_tag(render_priv, p, k); // maybe k*pwr ? no, specs forbid nested \t's
- skip_to(')'); // in case there is some unknown tag or a comment
- skip(')');
- } else if (mystrcmp(&p, "clip")) {
- char *start = p;
- int x0, y0, x1, y1;
- int res = 1;
- skipopt('(');
- res &= mystrtoi(&p, &x0);
- skipopt(',');
- res &= mystrtoi(&p, &y0);
- skipopt(',');
- res &= mystrtoi(&p, &x1);
- skipopt(',');
- res &= mystrtoi(&p, &y1);
- skipopt(')');
- if (res) {
- render_priv->state.clip_x0 =
- render_priv->state.clip_x0 * (1 - pwr) + x0 * pwr;
- render_priv->state.clip_x1 =
- render_priv->state.clip_x1 * (1 - pwr) + x1 * pwr;
- render_priv->state.clip_y0 =
- render_priv->state.clip_y0 * (1 - pwr) + y0 * pwr;
- render_priv->state.clip_y1 =
- render_priv->state.clip_y1 * (1 - pwr) + y1 * pwr;
- // Might be a vector clip
- } else if (!render_priv->state.clip_drawing) {
- p = parse_vector_clip(render_priv, start);
- render_priv->state.clip_drawing_mode = 0;
- } else {
- render_priv->state.clip_x0 = 0;
- render_priv->state.clip_y0 = 0;
- render_priv->state.clip_x1 = render_priv->track->PlayResX;
- render_priv->state.clip_y1 = render_priv->track->PlayResY;
- }
- } else if (mystrcmp(&p, "c")) {
- uint32_t val;
- int hex = render_priv->track->track_type == TRACK_TYPE_ASS;
- if (!strtocolor(render_priv->library, &p, &val, hex))
- val = render_priv->state.style->PrimaryColour;
- ass_msg(render_priv->library, MSGL_DBG2, "color: %X", val);
- change_color(&render_priv->state.c[0], val, pwr);
- } else if ((*p >= '1') && (*p <= '4') && (++p)
- && (mystrcmp(&p, "c") || mystrcmp(&p, "a"))) {
- char n = *(p - 2);
- int cidx = n - '1';
- char cmd = *(p - 1);
- uint32_t val;
- int hex = render_priv->track->track_type == TRACK_TYPE_ASS;
- assert((n >= '1') && (n <= '4'));
- if (!strtocolor(render_priv->library, &p, &val, hex))
- switch (n) {
- case '1':
- val = render_priv->state.style->PrimaryColour;
- break;
- case '2':
- val = render_priv->state.style->SecondaryColour;
- break;
- case '3':
- val = render_priv->state.style->OutlineColour;
- break;
- case '4':
- val = render_priv->state.style->BackColour;
- break;
- default:
- val = 0;
- break; // impossible due to assert; avoid compilation warning
- }
- switch (cmd) {
- case 'c':
- change_color(render_priv->state.c + cidx, val, pwr);
- break;
- case 'a':
- change_alpha(render_priv->state.c + cidx, val >> 24, pwr);
- break;
- default:
- ass_msg(render_priv->library, MSGL_WARN, "Bad command: %c%c",
- n, cmd);
- break;
- }
- ass_msg(render_priv->library, MSGL_DBG2, "single c/a at %f: %c%c = %X",
- pwr, n, cmd, render_priv->state.c[cidx]);
- } else if (mystrcmp(&p, "r")) {
- reset_render_context(render_priv);
- } else if (mystrcmp(&p, "be")) {
- int val;
- if (mystrtoi(&p, &val)) {
- // Clamp to a safe upper limit, since high values need excessive CPU
- val = (val < 0) ? 0 : val;
- val = (val > MAX_BE) ? MAX_BE : val;
- render_priv->state.be = val;
- } else
- render_priv->state.be = 0;
- } else if (mystrcmp(&p, "b")) {
- int b;
- if (mystrtoi(&p, &b)) {
- if (pwr >= .5)
- render_priv->state.bold = b;
- } else
- render_priv->state.bold = render_priv->state.style->Bold;
- update_font(render_priv);
- } else if (mystrcmp(&p, "i")) {
- int i;
- if (mystrtoi(&p, &i)) {
- if (pwr >= .5)
- render_priv->state.italic = i;
- } else
- render_priv->state.italic = render_priv->state.style->Italic;
- update_font(render_priv);
- } else if (mystrcmp(&p, "kf") || mystrcmp(&p, "K")) {
- int val = 0;
- mystrtoi(&p, &val);
- render_priv->state.effect_type = EF_KARAOKE_KF;
- if (render_priv->state.effect_timing)
- render_priv->state.effect_skip_timing +=
- render_priv->state.effect_timing;
- render_priv->state.effect_timing = val * 10;
- } else if (mystrcmp(&p, "ko")) {
- int val = 0;
- mystrtoi(&p, &val);
- render_priv->state.effect_type = EF_KARAOKE_KO;
- if (render_priv->state.effect_timing)
- render_priv->state.effect_skip_timing +=
- render_priv->state.effect_timing;
- render_priv->state.effect_timing = val * 10;
- } else if (mystrcmp(&p, "k")) {
- int val = 0;
- mystrtoi(&p, &val);
- render_priv->state.effect_type = EF_KARAOKE;
- if (render_priv->state.effect_timing)
- render_priv->state.effect_skip_timing +=
- render_priv->state.effect_timing;
- render_priv->state.effect_timing = val * 10;
- } else if (mystrcmp(&p, "shad")) {
- double val;
- if (mystrtod(&p, &val)) {
- if (render_priv->state.shadow_x == render_priv->state.shadow_y)
- val = render_priv->state.shadow_x * (1 - pwr) + val * pwr;
- } else
- val = 0.;
- render_priv->state.shadow_x = render_priv->state.shadow_y = val;
- } else if (mystrcmp(&p, "s")) {
- int val;
- if (mystrtoi(&p, &val) && val)
- render_priv->state.flags |= DECO_STRIKETHROUGH;
- else
- render_priv->state.flags &= ~DECO_STRIKETHROUGH;
- } else if (mystrcmp(&p, "u")) {
- int val;
- if (mystrtoi(&p, &val) && val)
- render_priv->state.flags |= DECO_UNDERLINE;
- else
- render_priv->state.flags &= ~DECO_UNDERLINE;
- } else if (mystrcmp(&p, "pbo")) {
- double val = 0;
- if (mystrtod(&p, &val))
- render_priv->state.drawing->pbo = val;
- } else if (mystrcmp(&p, "p")) {
- int val;
- if (!mystrtoi(&p, &val))
- val = 0;
- if (val)
- render_priv->state.drawing->scale = val;
- render_priv->state.drawing_mode = !!val;
- } else if (mystrcmp(&p, "q")) {
- int val;
- if (!mystrtoi(&p, &val))
- val = render_priv->track->WrapStyle;
- render_priv->state.wrap_style = val;
- }
-
- return p;
-}
-
-void apply_transition_effects(ASS_Renderer *render_priv, ASS_Event *event)
-{
- int v[4];
- int cnt;
- char *p = event->Effect;
-
- if (!p || !*p)
- return;
-
- cnt = 0;
- while (cnt < 4 && (p = strchr(p, ';'))) {
- v[cnt++] = atoi(++p);
- }
-
- if (strncmp(event->Effect, "Banner;", 7) == 0) {
- int delay;
- if (cnt < 1) {
- ass_msg(render_priv->library, MSGL_V,
- "Error parsing effect: '%s'", event->Effect);
- return;
- }
- if (cnt >= 2 && v[1] == 0) // right-to-left
- render_priv->state.scroll_direction = SCROLL_RL;
- else // left-to-right
- render_priv->state.scroll_direction = SCROLL_LR;
-
- delay = v[0];
- if (delay == 0)
- delay = 1; // ?
- render_priv->state.scroll_shift =
- (render_priv->time - render_priv->state.event->Start) / delay;
- render_priv->state.evt_type = EVENT_HSCROLL;
- return;
- }
-
- if (strncmp(event->Effect, "Scroll up;", 10) == 0) {
- render_priv->state.scroll_direction = SCROLL_BT;
- } else if (strncmp(event->Effect, "Scroll down;", 12) == 0) {
- render_priv->state.scroll_direction = SCROLL_TB;
- } else {
- ass_msg(render_priv->library, MSGL_V,
- "Unknown transition effect: '%s'", event->Effect);
- return;
- }
- // parse scroll up/down parameters
- {
- int delay;
- int y0, y1;
- if (cnt < 3) {
- ass_msg(render_priv->library, MSGL_V,
- "Error parsing effect: '%s'", event->Effect);
- return;
- }
- delay = v[2];
- if (delay == 0)
- delay = 1; // ?
- render_priv->state.scroll_shift =
- (render_priv->time - render_priv->state.event->Start) / delay;
- if (v[0] < v[1]) {
- y0 = v[0];
- y1 = v[1];
- } else {
- y0 = v[1];
- y1 = v[0];
- }
- if (y1 == 0)
- y1 = render_priv->track->PlayResY; // y0=y1=0 means fullscreen scrolling
- render_priv->state.clip_y0 = y0;
- render_priv->state.clip_y1 = y1;
- render_priv->state.evt_type = EVENT_VSCROLL;
- render_priv->state.detect_collisions = 0;
- }
-
-}
-
-/**
- * \brief Get next ucs4 char from string, parsing and executing style overrides
- * \param str string pointer
- * \return ucs4 code of the next char
- * On return str points to the unparsed part of the string
- */
-unsigned get_next_char(ASS_Renderer *render_priv, char **str)
-{
- char *p = *str;
- unsigned chr;
- if (*p == '{') { // '\0' goes here
- p++;
- while (1) {
- p = parse_tag(render_priv, p, 1.);
- if (*p == '}') { // end of tag
- p++;
- if (*p == '{') {
- p++;
- continue;
- } else
- break;
- } else if (*p != '\\')
- ass_msg(render_priv->library, MSGL_V,
- "Unable to parse: '%s'", p);
- if (*p == 0)
- break;
- }
- }
- if (*p == '\t') {
- ++p;
- *str = p;
- return ' ';
- }
- if (*p == '\\') {
- if ((p[1] == 'N') || ((p[1] == 'n') &&
- (render_priv->state.wrap_style == 2))) {
- p += 2;
- *str = p;
- return '\n';
- } else if (p[1] == 'n') {
- p += 2;
- *str = p;
- return ' ';
- } else if (p[1] == 'h') {
- p += 2;
- *str = p;
- return NBSP;
- }
- }
- chr = ass_utf8_get_char((char **) &p);
- *str = p;
- return chr;
-}
diff --git a/libass/ass_parse.h b/libass/ass_parse.h
deleted file mode 100644
index c65b565158..0000000000
--- a/libass/ass_parse.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Copyright (C) 2009 Grigori Goronzy <greg@geekmind.org>
- *
- * This file is part of libass.
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-#ifndef LIBASS_PARSE_H
-#define LIBASS_PARSE_H
-
-#define BLUR_MAX_RADIUS 100.0
-
-#define _r(c) ((c) >> 24)
-#define _g(c) (((c) >> 16) & 0xFF)
-#define _b(c) (((c) >> 8) & 0xFF)
-#define _a(c) ((c) & 0xFF)
-
-void update_font(ASS_Renderer *render_priv);
-void change_border(ASS_Renderer *render_priv, double border_x,
- double border_y);
-void apply_transition_effects(ASS_Renderer *render_priv, ASS_Event *event);
-unsigned get_next_char(ASS_Renderer *render_priv, char **str);
-extern void change_alpha(uint32_t *var, uint32_t new, double pwr);
-extern uint32_t mult_alpha(uint32_t a, uint32_t b);
-
-
-#endif /* LIBASS_PARSE_H */
diff --git a/libass/ass_render.c b/libass/ass_render.c
deleted file mode 100644
index 6bc0c61bae..0000000000
--- a/libass/ass_render.c
+++ /dev/null
@@ -1,2694 +0,0 @@
-/*
- * Copyright (C) 2006 Evgeniy Stepanov <eugeni.stepanov@gmail.com>
- *
- * This file is part of libass.
- *
- * libass 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.
- *
- * libass 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 libass; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#include "config.h"
-
-#include <assert.h>
-#include <math.h>
-#include <inttypes.h>
-#include <ft2build.h>
-#include FT_FREETYPE_H
-#include FT_STROKER_H
-#include FT_GLYPH_H
-#include FT_SYNTHESIS_H
-
-#include "ass.h"
-#include "ass_font.h"
-#include "ass_bitmap.h"
-#include "ass_cache.h"
-#include "ass_utils.h"
-#include "ass_fontconfig.h"
-#include "ass_library.h"
-#include "ass_drawing.h"
-#include "ass_render.h"
-#include "ass_parse.h"
-
-#define MAX_GLYPHS_INITIAL 1024
-#define MAX_LINES_INITIAL 64
-#define SUBPIXEL_MASK 63
-#define SUBPIXEL_ACCURACY 7 // d6 mask for subpixel accuracy adjustment
-#define GLYPH_CACHE_MAX 1000
-#define BITMAP_CACHE_MAX_SIZE 50 * 1048576
-
-static void ass_lazy_track_init(ASS_Renderer *render_priv)
-{
- ASS_Track *track = render_priv->track;
-
- if (track->PlayResX && track->PlayResY)
- return;
- if (!track->PlayResX && !track->PlayResY) {
- ass_msg(render_priv->library, MSGL_WARN,
- "Neither PlayResX nor PlayResY defined. Assuming 384x288");
- track->PlayResX = 384;
- track->PlayResY = 288;
- } else {
- if (!track->PlayResY && track->PlayResX == 1280) {
- track->PlayResY = 1024;
- ass_msg(render_priv->library, MSGL_WARN,
- "PlayResY undefined, setting to %d", track->PlayResY);
- } else if (!track->PlayResY) {
- track->PlayResY = track->PlayResX * 3 / 4;
- ass_msg(render_priv->library, MSGL_WARN,
- "PlayResY undefined, setting to %d", track->PlayResY);
- } else if (!track->PlayResX && track->PlayResY == 1024) {
- track->PlayResX = 1280;
- ass_msg(render_priv->library, MSGL_WARN,
- "PlayResX undefined, setting to %d", track->PlayResX);
- } else if (!track->PlayResX) {
- track->PlayResX = track->PlayResY * 4 / 3;
- ass_msg(render_priv->library, MSGL_WARN,
- "PlayResX undefined, setting to %d", track->PlayResX);
- }
- }
-}
-
-ASS_Renderer *ass_renderer_init(ASS_Library *library)
-{
- int error;
- FT_Library ft;
- ASS_Renderer *priv = 0;
- int vmajor, vminor, vpatch;
-
- error = FT_Init_FreeType(&ft);
- if (error) {
- ass_msg(library, MSGL_FATAL, "%s failed", "FT_Init_FreeType");
- goto ass_init_exit;
- }
-
- FT_Library_Version(ft, &vmajor, &vminor, &vpatch);
- ass_msg(library, MSGL_V, "FreeType library version: %d.%d.%d",
- vmajor, vminor, vpatch);
- ass_msg(library, MSGL_V, "FreeType headers version: %d.%d.%d",
- FREETYPE_MAJOR, FREETYPE_MINOR, FREETYPE_PATCH);
-
- priv = calloc(1, sizeof(ASS_Renderer));
- if (!priv) {
- FT_Done_FreeType(ft);
- goto ass_init_exit;
- }
-
- priv->synth_priv = ass_synth_init(BLUR_MAX_RADIUS);
-
- priv->library = library;
- priv->ftlibrary = ft;
- // images_root and related stuff is zero-filled in calloc
-
- priv->cache.font_cache = ass_font_cache_init(library);
- priv->cache.bitmap_cache = ass_bitmap_cache_init(library);
- priv->cache.composite_cache = ass_composite_cache_init(library);
- priv->cache.glyph_cache = ass_glyph_cache_init(library);
- priv->cache.glyph_max = GLYPH_CACHE_MAX;
- priv->cache.bitmap_max_size = BITMAP_CACHE_MAX_SIZE;
-
- priv->text_info.max_glyphs = MAX_GLYPHS_INITIAL;
- priv->text_info.max_lines = MAX_LINES_INITIAL;
- priv->text_info.glyphs =
- calloc(MAX_GLYPHS_INITIAL, sizeof(GlyphInfo));
- priv->text_info.lines = calloc(MAX_LINES_INITIAL, sizeof(LineInfo));
-
- ass_init_exit:
- if (priv)
- ass_msg(library, MSGL_INFO, "Init");
- else
- ass_msg(library, MSGL_ERR, "Init failed");
-
- return priv;
-}
-
-void ass_set_cache_limits(ASS_Renderer *render_priv, int glyph_max,
- int bitmap_max)
-{
- render_priv->cache.glyph_max = glyph_max ? glyph_max : GLYPH_CACHE_MAX;
- render_priv->cache.bitmap_max_size = bitmap_max ? 1048576 * bitmap_max :
- BITMAP_CACHE_MAX_SIZE;
-}
-
-static void free_list_clear(ASS_Renderer *render_priv)
-{
- if (render_priv->free_head) {
- FreeList *item = render_priv->free_head;
- while(item) {
- FreeList *oi = item;
- free(item->object);
- item = item->next;
- free(oi);
- }
- render_priv->free_head = NULL;
- }
-}
-
-static void ass_free_images(ASS_Image *img);
-
-void ass_renderer_done(ASS_Renderer *render_priv)
-{
- ass_font_cache_done(render_priv->cache.font_cache);
- ass_bitmap_cache_done(render_priv->cache.bitmap_cache);
- ass_composite_cache_done(render_priv->cache.composite_cache);
- ass_glyph_cache_done(render_priv->cache.glyph_cache);
-
- ass_free_images(render_priv->images_root);
- ass_free_images(render_priv->prev_images_root);
-
- if (render_priv->state.stroker) {
- FT_Stroker_Done(render_priv->state.stroker);
- render_priv->state.stroker = 0;
- }
- if (render_priv && render_priv->ftlibrary)
- FT_Done_FreeType(render_priv->ftlibrary);
- if (render_priv && render_priv->fontconfig_priv)
- fontconfig_done(render_priv->fontconfig_priv);
- if (render_priv && render_priv->synth_priv)
- ass_synth_done(render_priv->synth_priv);
- if (render_priv && render_priv->eimg)
- free(render_priv->eimg);
- free(render_priv->text_info.glyphs);
- free(render_priv->text_info.lines);
-
- free(render_priv->settings.default_font);
- free(render_priv->settings.default_family);
-
- free_list_clear(render_priv);
- free(render_priv);
-}
-
-/**
- * \brief Create a new ASS_Image
- * Parameters are the same as ASS_Image fields.
- */
-static ASS_Image *my_draw_bitmap(unsigned char *bitmap, int bitmap_w,
- int bitmap_h, int stride, int dst_x,
- int dst_y, uint32_t color)
-{
- ASS_Image *img = calloc(1, sizeof(ASS_Image));
-
- img->w = bitmap_w;
- img->h = bitmap_h;
- img->stride = stride;
- img->bitmap = bitmap;
- img->color = color;
- img->dst_x = dst_x;
- img->dst_y = dst_y;
-
- return img;
-}
-
-static double x2scr_pos(ASS_Renderer *render_priv, double x);
-static double y2scr_pos(ASS_Renderer *render_priv, double y);
-
-/*
- * \brief Convert bitmap glyphs into ASS_Image list with inverse clipping
- *
- * Inverse clipping with the following strategy:
- * - find rectangle from (x0, y0) to (cx0, y1)
- * - find rectangle from (cx0, y0) to (cx1, cy0)
- * - find rectangle from (cx0, cy1) to (cx1, y1)
- * - find rectangle from (cx1, y0) to (x1, y1)
- * These rectangles can be invalid and in this case are discarded.
- * Afterwards, they are clipped against the screen coordinates.
- * In an additional pass, the rectangles need to be split up left/right for
- * karaoke effects. This can result in a lot of bitmaps (6 to be exact).
- */
-static ASS_Image **render_glyph_i(ASS_Renderer *render_priv,
- Bitmap *bm, int dst_x, int dst_y,
- uint32_t color, uint32_t color2, int brk,
- ASS_Image **tail)
-{
- int i, j, x0, y0, x1, y1, cx0, cy0, cx1, cy1, sx, sy, zx, zy;
- Rect r[4];
- ASS_Image *img;
-
- dst_x += bm->left;
- dst_y += bm->top;
-
- // we still need to clip against screen boundaries
- zx = x2scr_pos(render_priv, 0);
- zy = y2scr_pos(render_priv, 0);
- sx = x2scr_pos(render_priv, render_priv->track->PlayResX);
- sy = y2scr_pos(render_priv, render_priv->track->PlayResY);
-
- x0 = 0;
- y0 = 0;
- x1 = bm->w;
- y1 = bm->h;
- cx0 = render_priv->state.clip_x0 - dst_x;
- cy0 = render_priv->state.clip_y0 - dst_y;
- cx1 = render_priv->state.clip_x1 - dst_x;
- cy1 = render_priv->state.clip_y1 - dst_y;
-
- // calculate rectangles and discard invalid ones while we're at it.
- i = 0;
- r[i].x0 = x0;
- r[i].y0 = y0;
- r[i].x1 = (cx0 > x1) ? x1 : cx0;
- r[i].y1 = y1;
- if (r[i].x1 > r[i].x0 && r[i].y1 > r[i].y0) i++;
- r[i].x0 = (cx0 < 0) ? x0 : cx0;
- r[i].y0 = y0;
- r[i].x1 = (cx1 > x1) ? x1 : cx1;
- r[i].y1 = (cy0 > y1) ? y1 : cy0;
- if (r[i].x1 > r[i].x0 && r[i].y1 > r[i].y0) i++;
- r[i].x0 = (cx0 < 0) ? x0 : cx0;
- r[i].y0 = (cy1 < 0) ? y0 : cy1;
- r[i].x1 = (cx1 > x1) ? x1 : cx1;
- r[i].y1 = y1;
- if (r[i].x1 > r[i].x0 && r[i].y1 > r[i].y0) i++;
- r[i].x0 = (cx1 < 0) ? x0 : cx1;
- r[i].y0 = y0;
- r[i].x1 = x1;
- r[i].y1 = y1;
- if (r[i].x1 > r[i].x0 && r[i].y1 > r[i].y0) i++;
-
- // clip each rectangle to screen coordinates
- for (j = 0; j < i; j++) {
- r[j].x0 = (r[j].x0 + dst_x < zx) ? zx - dst_x : r[j].x0;
- r[j].y0 = (r[j].y0 + dst_y < zy) ? zy - dst_y : r[j].y0;
- r[j].x1 = (r[j].x1 + dst_x > sx) ? sx - dst_x : r[j].x1;
- r[j].y1 = (r[j].y1 + dst_y > sy) ? sy - dst_y : r[j].y1;
- }
-
- // draw the rectangles
- for (j = 0; j < i; j++) {
- int lbrk = brk;
- // kick out rectangles that are invalid now
- if (r[j].x1 <= r[j].x0 || r[j].y1 <= r[j].y0)
- continue;
- // split up into left and right for karaoke, if needed
- if (lbrk > r[j].x0) {
- if (lbrk > r[j].x1) lbrk = r[j].x1;
- img = my_draw_bitmap(bm->buffer + r[j].y0 * bm->w + r[j].x0,
- lbrk - r[j].x0, r[j].y1 - r[j].y0,
- bm->w, dst_x + r[j].x0, dst_y + r[j].y0, color);
- *tail = img;
- tail = &img->next;
- }
- if (lbrk < r[j].x1) {
- if (lbrk < r[j].x0) lbrk = r[j].x0;
- img = my_draw_bitmap(bm->buffer + r[j].y0 * bm->w + lbrk,
- r[j].x1 - lbrk, r[j].y1 - r[j].y0,
- bm->w, dst_x + lbrk, dst_y + r[j].y0, color2);
- *tail = img;
- tail = &img->next;
- }
- }
-
- return tail;
-}
-
-/**
- * \brief convert bitmap glyph into ASS_Image struct(s)
- * \param bit freetype bitmap glyph, FT_PIXEL_MODE_GRAY
- * \param dst_x bitmap x coordinate in video frame
- * \param dst_y bitmap y coordinate in video frame
- * \param color first color, RGBA
- * \param color2 second color, RGBA
- * \param brk x coordinate relative to glyph origin, color is used to the left of brk, color2 - to the right
- * \param tail pointer to the last image's next field, head of the generated list should be stored here
- * \return pointer to the new list tail
- * Performs clipping. Uses my_draw_bitmap for actual bitmap convertion.
- */
-static ASS_Image **
-render_glyph(ASS_Renderer *render_priv, Bitmap *bm, int dst_x, int dst_y,
- uint32_t color, uint32_t color2, int brk, ASS_Image **tail)
-{
- // Inverse clipping in use?
- if (render_priv->state.clip_mode)
- return render_glyph_i(render_priv, bm, dst_x, dst_y, color, color2,
- brk, tail);
-
- // brk is relative to dst_x
- // color = color left of brk
- // color2 = color right of brk
- int b_x0, b_y0, b_x1, b_y1; // visible part of the bitmap
- int clip_x0, clip_y0, clip_x1, clip_y1;
- int tmp;
- ASS_Image *img;
-
- dst_x += bm->left;
- dst_y += bm->top;
- brk -= bm->left;
-
- // clipping
- clip_x0 = FFMINMAX(render_priv->state.clip_x0, 0, render_priv->width);
- clip_y0 = FFMINMAX(render_priv->state.clip_y0, 0, render_priv->height);
- clip_x1 = FFMINMAX(render_priv->state.clip_x1, 0, render_priv->width);
- clip_y1 = FFMINMAX(render_priv->state.clip_y1, 0, render_priv->height);
- b_x0 = 0;
- b_y0 = 0;
- b_x1 = bm->w;
- b_y1 = bm->h;
-
- tmp = dst_x - clip_x0;
- if (tmp < 0) {
- ass_msg(render_priv->library, MSGL_DBG2, "clip left");
- b_x0 = -tmp;
- }
- tmp = dst_y - clip_y0;
- if (tmp < 0) {
- ass_msg(render_priv->library, MSGL_DBG2, "clip top");
- b_y0 = -tmp;
- }
- tmp = clip_x1 - dst_x - bm->w;
- if (tmp < 0) {
- ass_msg(render_priv->library, MSGL_DBG2, "clip right");
- b_x1 = bm->w + tmp;
- }
- tmp = clip_y1 - dst_y - bm->h;
- if (tmp < 0) {
- ass_msg(render_priv->library, MSGL_DBG2, "clip bottom");
- b_y1 = bm->h + tmp;
- }
-
- if ((b_y0 >= b_y1) || (b_x0 >= b_x1))
- return tail;
-
- if (brk > b_x0) { // draw left part
- if (brk > b_x1)
- brk = b_x1;
- img = my_draw_bitmap(bm->buffer + bm->w * b_y0 + b_x0,
- brk - b_x0, b_y1 - b_y0, bm->w,
- dst_x + b_x0, dst_y + b_y0, color);
- *tail = img;
- tail = &img->next;
- }
- if (brk < b_x1) { // draw right part
- if (brk < b_x0)
- brk = b_x0;
- img = my_draw_bitmap(bm->buffer + bm->w * b_y0 + brk,
- b_x1 - brk, b_y1 - b_y0, bm->w,
- dst_x + brk, dst_y + b_y0, color2);
- *tail = img;
- tail = &img->next;
- }
- return tail;
-}
-
-/**
- * \brief Replace the bitmap buffer in ASS_Image with a copy
- * \param img ASS_Image to operate on
- * \return pointer to old bitmap buffer
- */
-static unsigned char *clone_bitmap_buffer(ASS_Image *img)
-{
- unsigned char *old_bitmap = img->bitmap;
- int size = img->stride * (img->h - 1) + img->w;
- img->bitmap = malloc(size);
- memcpy(img->bitmap, old_bitmap, size);
- return old_bitmap;
-}
-
-/**
- * \brief Calculate overlapping area of two consecutive bitmaps and in case they
- * overlap, blend them together
- * Mainly useful for translucent glyphs and especially borders, to avoid the
- * luminance adding up where they overlap (which looks ugly)
- */
-static void
-render_overlap(ASS_Renderer *render_priv, ASS_Image **last_tail,
- ASS_Image **tail)
-{
- int left, top, bottom, right;
- int old_left, old_top, w, h, cur_left, cur_top;
- int x, y, opos, cpos;
- char m;
- CompositeHashKey hk;
- CompositeHashValue *hv;
- CompositeHashValue chv;
- int ax = (*last_tail)->dst_x;
- int ay = (*last_tail)->dst_y;
- int aw = (*last_tail)->w;
- int as = (*last_tail)->stride;
- int ah = (*last_tail)->h;
- int bx = (*tail)->dst_x;
- int by = (*tail)->dst_y;
- int bw = (*tail)->w;
- int bs = (*tail)->stride;
- int bh = (*tail)->h;
- unsigned char *a;
- unsigned char *b;
-
- if ((*last_tail)->bitmap == (*tail)->bitmap)
- return;
-
- if ((*last_tail)->color != (*tail)->color)
- return;
-
- // Calculate overlap coordinates
- left = (ax > bx) ? ax : bx;
- top = (ay > by) ? ay : by;
- right = ((ax + aw) < (bx + bw)) ? (ax + aw) : (bx + bw);
- bottom = ((ay + ah) < (by + bh)) ? (ay + ah) : (by + bh);
- if ((right <= left) || (bottom <= top))
- return;
- old_left = left - ax;
- old_top = top - ay;
- w = right - left;
- h = bottom - top;
- cur_left = left - bx;
- cur_top = top - by;
-
- // Query cache
- memset(&hk, 0, sizeof(hk));
- hk.a = (*last_tail)->bitmap;
- hk.b = (*tail)->bitmap;
- hk.aw = aw;
- hk.ah = ah;
- hk.bw = bw;
- hk.bh = bh;
- hk.ax = ax;
- hk.ay = ay;
- hk.bx = bx;
- hk.by = by;
- hk.as = as;
- hk.bs = bs;
- hv = cache_find_composite(render_priv->cache.composite_cache, &hk);
- if (hv) {
- (*last_tail)->bitmap = hv->a;
- (*tail)->bitmap = hv->b;
- return;
- }
- // Allocate new bitmaps and copy over data
- a = clone_bitmap_buffer(*last_tail);
- b = clone_bitmap_buffer(*tail);
-
- // Blend overlapping area
- for (y = 0; y < h; y++)
- for (x = 0; x < w; x++) {
- opos = (old_top + y) * (as) + (old_left + x);
- cpos = (cur_top + y) * (bs) + (cur_left + x);
- m = FFMIN(a[opos] + b[cpos], 0xff);
- (*last_tail)->bitmap[opos] = 0;
- (*tail)->bitmap[cpos] = m;
- }
-
- // Insert bitmaps into the cache
- chv.a = (*last_tail)->bitmap;
- chv.b = (*tail)->bitmap;
- cache_add_composite(render_priv->cache.composite_cache, &hk, &chv);
-}
-
-static void free_list_add(ASS_Renderer *render_priv, void *object)
-{
- if (!render_priv->free_head) {
- render_priv->free_head = calloc(1, sizeof(FreeList));
- render_priv->free_head->object = object;
- render_priv->free_tail = render_priv->free_head;
- } else {
- FreeList *l = calloc(1, sizeof(FreeList));
- l->object = object;
- render_priv->free_tail->next = l;
- render_priv->free_tail = render_priv->free_tail->next;
- }
-}
-
-/**
- * Iterate through a list of bitmaps and blend with clip vector, if
- * applicable. The blended bitmaps are added to a free list which is freed
- * at the start of a new frame.
- */
-static void blend_vector_clip(ASS_Renderer *render_priv,
- ASS_Image *head)
-{
- FT_Glyph glyph;
- FT_BitmapGlyph clip_bm;
- ASS_Image *cur;
- ASS_Drawing *drawing = render_priv->state.clip_drawing;
- int error;
-
- if (!drawing)
- return;
-
- // Rasterize it
- FT_Glyph_Copy((FT_Glyph) drawing->glyph, &glyph);
- error = FT_Glyph_To_Bitmap(&glyph, FT_RENDER_MODE_NORMAL, 0, 1);
- if (error) {
- ass_msg(render_priv->library, MSGL_V,
- "Clip vector rasterization failed: %d. Skipping.", error);
- goto blend_vector_exit;
- }
- clip_bm = (FT_BitmapGlyph) glyph;
- clip_bm->top = -clip_bm->top;
-
- assert(clip_bm->bitmap.pitch >= 0);
-
- // Iterate through bitmaps and blend/clip them
- for (cur = head; cur; cur = cur->next) {
- int left, top, right, bottom, apos, bpos, y, x, w, h;
- int ax, ay, aw, ah, as;
- int bx, by, bw, bh, bs;
- int aleft, atop, bleft, btop;
- unsigned char *abuffer, *bbuffer, *nbuffer;
-
- abuffer = cur->bitmap;
- bbuffer = clip_bm->bitmap.buffer;
- ax = cur->dst_x;
- ay = cur->dst_y;
- aw = cur->w;
- ah = cur->h;
- as = cur->stride;
- bx = clip_bm->left;
- by = clip_bm->top;
- bw = clip_bm->bitmap.width;
- bh = clip_bm->bitmap.rows;
- bs = clip_bm->bitmap.pitch;
-
- // Calculate overlap coordinates
- left = (ax > bx) ? ax : bx;
- top = (ay > by) ? ay : by;
- right = ((ax + aw) < (bx + bw)) ? (ax + aw) : (bx + bw);
- bottom = ((ay + ah) < (by + bh)) ? (ay + ah) : (by + bh);
- aleft = left - ax;
- atop = top - ay;
- w = right - left;
- h = bottom - top;
- bleft = left - bx;
- btop = top - by;
-
- if (render_priv->state.clip_drawing_mode) {
- // Inverse clip
- if (ax + aw < bx || ay + ah < by || ax > bx + bw ||
- ay > by + bh) {
- continue;
- }
-
- // Allocate new buffer and add to free list
- nbuffer = malloc(as * ah);
- free_list_add(render_priv, nbuffer);
-
- // Blend together
- memcpy(nbuffer, abuffer, as * (ah - 1) + aw);
- for (y = 0; y < h; y++)
- for (x = 0; x < w; x++) {
- apos = (atop + y) * as + aleft + x;
- bpos = (btop + y) * bs + bleft + x;
- nbuffer[apos] = FFMAX(0, abuffer[apos] - bbuffer[bpos]);
- }
- } else {
- // Regular clip
- if (ax + aw < bx || ay + ah < by || ax > bx + bw ||
- ay > by + bh) {
- cur->w = cur->h = 0;
- continue;
- }
-
- // Allocate new buffer and add to free list
- nbuffer = calloc(as, ah);
- free_list_add(render_priv, nbuffer);
-
- // Blend together
- for (y = 0; y < h; y++)
- for (x = 0; x < w; x++) {
- apos = (atop + y) * as + aleft + x;
- bpos = (btop + y) * bs + bleft + x;
- nbuffer[apos] = (abuffer[apos] * bbuffer[bpos] + 255) >> 8;
- }
- }
- cur->bitmap = nbuffer;
- }
-
- // Free clip vector and its bitmap, we don't need it anymore
- FT_Done_Glyph(glyph);
-blend_vector_exit:
- ass_drawing_free(render_priv->state.clip_drawing);
- render_priv->state.clip_drawing = 0;
-}
-
-/**
- * \brief Convert TextInfo struct to ASS_Image list
- * Splits glyphs in halves when needed (for \kf karaoke).
- */
-static ASS_Image *render_text(ASS_Renderer *render_priv, int dst_x,
- int dst_y)
-{
- int pen_x, pen_y;
- int i;
- Bitmap *bm;
- ASS_Image *head;
- ASS_Image **tail = &head;
- ASS_Image **last_tail = 0;
- ASS_Image **here_tail = 0;
- TextInfo *text_info = &render_priv->text_info;
-
- for (i = 0; i < text_info->length; ++i) {
- GlyphInfo *info = text_info->glyphs + i;
- if ((info->symbol == 0) || (info->symbol == '\n') || !info->bm_s
- || (info->shadow_x == 0 && info->shadow_y == 0) || info->skip)
- continue;
-
- pen_x =
- dst_x + (info->pos.x >> 6) +
- (int) (info->shadow_x * render_priv->border_scale);
- pen_y =
- dst_y + (info->pos.y >> 6) +
- (int) (info->shadow_y * render_priv->border_scale);
- bm = info->bm_s;
-
- here_tail = tail;
- tail =
- render_glyph(render_priv, bm, pen_x, pen_y, info->c[3], 0,
- 1000000, tail);
- if (last_tail && tail != here_tail && ((info->c[3] & 0xff) > 0))
- render_overlap(render_priv, last_tail, here_tail);
-
- last_tail = here_tail;
- }
-
- last_tail = 0;
- for (i = 0; i < text_info->length; ++i) {
- GlyphInfo *info = text_info->glyphs + i;
- if ((info->symbol == 0) || (info->symbol == '\n') || !info->bm_o
- || info->skip)
- continue;
-
- pen_x = dst_x + (info->pos.x >> 6);
- pen_y = dst_y + (info->pos.y >> 6);
- bm = info->bm_o;
-
- if ((info->effect_type == EF_KARAOKE_KO)
- && (info->effect_timing <= (info->bbox.xMax >> 6))) {
- // do nothing
- } else {
- here_tail = tail;
- tail =
- render_glyph(render_priv, bm, pen_x, pen_y, info->c[2],
- 0, 1000000, tail);
- if (last_tail && tail != here_tail && ((info->c[2] & 0xff) > 0))
- render_overlap(render_priv, last_tail, here_tail);
-
- last_tail = here_tail;
- }
- }
-
- for (i = 0; i < text_info->length; ++i) {
- GlyphInfo *info = text_info->glyphs + i;
- if ((info->symbol == 0) || (info->symbol == '\n') || !info->bm
- || info->skip)
- continue;
-
- pen_x = dst_x + (info->pos.x >> 6);
- pen_y = dst_y + (info->pos.y >> 6);
- bm = info->bm;
-
- if ((info->effect_type == EF_KARAOKE)
- || (info->effect_type == EF_KARAOKE_KO)) {
- if (info->effect_timing > (info->bbox.xMax >> 6))
- tail =
- render_glyph(render_priv, bm, pen_x, pen_y,
- info->c[0], 0, 1000000, tail);
- else
- tail =
- render_glyph(render_priv, bm, pen_x, pen_y,
- info->c[1], 0, 1000000, tail);
- } else if (info->effect_type == EF_KARAOKE_KF) {
- tail =
- render_glyph(render_priv, bm, pen_x, pen_y, info->c[0],
- info->c[1], info->effect_timing, tail);
- } else
- tail =
- render_glyph(render_priv, bm, pen_x, pen_y, info->c[0],
- 0, 1000000, tail);
- }
-
- *tail = 0;
- blend_vector_clip(render_priv, head);
-
- return head;
-}
-
-/**
- * \brief Mapping between script and screen coordinates
- */
-static double x2scr(ASS_Renderer *render_priv, double x)
-{
- return x * render_priv->orig_width_nocrop /
- render_priv->track->PlayResX +
- FFMAX(render_priv->settings.left_margin, 0);
-}
-static double x2scr_pos(ASS_Renderer *render_priv, double x)
-{
- return x * render_priv->orig_width / render_priv->track->PlayResX +
- render_priv->settings.left_margin;
-}
-
-/**
- * \brief Mapping between script and screen coordinates
- */
-static double y2scr(ASS_Renderer *render_priv, double y)
-{
- return y * render_priv->orig_height_nocrop /
- render_priv->track->PlayResY +
- FFMAX(render_priv->settings.top_margin, 0);
-}
-static double y2scr_pos(ASS_Renderer *render_priv, double y)
-{
- return y * render_priv->orig_height / render_priv->track->PlayResY +
- render_priv->settings.top_margin;
-}
-
-// the same for toptitles
-static double y2scr_top(ASS_Renderer *render_priv, double y)
-{
- if (render_priv->settings.use_margins)
- return y * render_priv->orig_height_nocrop /
- render_priv->track->PlayResY;
- else
- return y * render_priv->orig_height_nocrop /
- render_priv->track->PlayResY +
- FFMAX(render_priv->settings.top_margin, 0);
-}
-
-// the same for subtitles
-static double y2scr_sub(ASS_Renderer *render_priv, double y)
-{
- if (render_priv->settings.use_margins)
- return y * render_priv->orig_height_nocrop /
- render_priv->track->PlayResY +
- FFMAX(render_priv->settings.top_margin,
- 0) + FFMAX(render_priv->settings.bottom_margin, 0);
- else
- return y * render_priv->orig_height_nocrop /
- render_priv->track->PlayResY +
- FFMAX(render_priv->settings.top_margin, 0);
-}
-
-static void compute_string_bbox(TextInfo *info, DBBox *bbox)
-{
- int i;
-
- if (info->length > 0) {
- bbox->xMin = 32000;
- bbox->xMax = -32000;
- bbox->yMin = -1 * info->lines[0].asc + d6_to_double(info->glyphs[0].pos.y);
- bbox->yMax = info->height - info->lines[0].asc +
- d6_to_double(info->glyphs[0].pos.y);
-
- for (i = 0; i < info->length; ++i) {
- if (info->glyphs[i].skip) continue;
- double s = d6_to_double(info->glyphs[i].pos.x);
- double e = s + d6_to_double(info->glyphs[i].advance.x);
- bbox->xMin = FFMIN(bbox->xMin, s);
- bbox->xMax = FFMAX(bbox->xMax, e);
- }
- } else
- bbox->xMin = bbox->xMax = bbox->yMin = bbox->yMax = 0.;
-}
-
-/**
- * \brief partially reset render_context to style values
- * Works like {\r}: resets some style overrides
- */
-void reset_render_context(ASS_Renderer *render_priv)
-{
- render_priv->state.c[0] = render_priv->state.style->PrimaryColour;
- render_priv->state.c[1] = render_priv->state.style->SecondaryColour;
- render_priv->state.c[2] = render_priv->state.style->OutlineColour;
- render_priv->state.c[3] = render_priv->state.style->BackColour;
- render_priv->state.flags =
- (render_priv->state.style->Underline ? DECO_UNDERLINE : 0) |
- (render_priv->state.style->StrikeOut ? DECO_STRIKETHROUGH : 0);
- render_priv->state.font_size = render_priv->state.style->FontSize;
-
- free(render_priv->state.family);
- render_priv->state.family = NULL;
- render_priv->state.family = strdup(render_priv->state.style->FontName);
- render_priv->state.treat_family_as_pattern =
- render_priv->state.style->treat_fontname_as_pattern;
- render_priv->state.bold = render_priv->state.style->Bold;
- render_priv->state.italic = render_priv->state.style->Italic;
- update_font(render_priv);
-
- change_border(render_priv, -1., -1.);
- render_priv->state.scale_x = render_priv->state.style->ScaleX;
- render_priv->state.scale_y = render_priv->state.style->ScaleY;
- render_priv->state.hspacing = render_priv->state.style->Spacing;
- render_priv->state.be = 0;
- render_priv->state.blur = 0.0;
- render_priv->state.shadow_x = render_priv->state.style->Shadow;
- render_priv->state.shadow_y = render_priv->state.style->Shadow;
- render_priv->state.frx = render_priv->state.fry = 0.;
- render_priv->state.frz = M_PI * render_priv->state.style->Angle / 180.;
- render_priv->state.fax = render_priv->state.fay = 0.;
- render_priv->state.wrap_style = render_priv->track->WrapStyle;
-
- // FIXME: does not reset unsupported attributes.
-}
-
-/**
- * \brief Start new event. Reset render_priv->state.
- */
-static void
-init_render_context(ASS_Renderer *render_priv, ASS_Event *event)
-{
- render_priv->state.event = event;
- render_priv->state.style = render_priv->track->styles + event->Style;
-
- reset_render_context(render_priv);
-
- render_priv->state.evt_type = EVENT_NORMAL;
- render_priv->state.alignment = render_priv->state.style->Alignment;
- render_priv->state.pos_x = 0;
- render_priv->state.pos_y = 0;
- render_priv->state.org_x = 0;
- render_priv->state.org_y = 0;
- render_priv->state.have_origin = 0;
- render_priv->state.clip_x0 = 0;
- render_priv->state.clip_y0 = 0;
- render_priv->state.clip_x1 = render_priv->track->PlayResX;
- render_priv->state.clip_y1 = render_priv->track->PlayResY;
- render_priv->state.clip_mode = 0;
- render_priv->state.detect_collisions = 1;
- render_priv->state.fade = 0;
- render_priv->state.drawing_mode = 0;
- render_priv->state.effect_type = EF_NONE;
- render_priv->state.effect_timing = 0;
- render_priv->state.effect_skip_timing = 0;
- render_priv->state.drawing =
- ass_drawing_new(render_priv->fontconfig_priv,
- render_priv->state.font,
- render_priv->settings.hinting,
- render_priv->ftlibrary);
-
- apply_transition_effects(render_priv, event);
-}
-
-static void free_render_context(ASS_Renderer *render_priv)
-{
- free(render_priv->state.family);
- ass_drawing_free(render_priv->state.drawing);
-
- render_priv->state.family = NULL;
- render_priv->state.drawing = NULL;
-}
-
-// Calculate the cbox of a series of points
-static void
-get_contour_cbox(FT_BBox *box, FT_Vector *points, int start, int end)
-{
- box->xMin = box->yMin = INT_MAX;
- box->xMax = box->yMax = INT_MIN;
- int i;
-
- for (i = start; i < end; i++) {
- box->xMin = (points[i].x < box->xMin) ? points[i].x : box->xMin;
- box->xMax = (points[i].x > box->xMax) ? points[i].x : box->xMax;
- box->yMin = (points[i].y < box->yMin) ? points[i].y : box->yMin;
- box->yMax = (points[i].y > box->yMax) ? points[i].y : box->yMax;
- }
-}
-
-/**
- * \brief Fix-up stroker result for huge borders by removing the contours from
- * the outline that are harmful.
-*/
-static void fix_freetype_stroker(FT_OutlineGlyph glyph, int border_x,
- int border_y)
-{
- int nc = glyph->outline.n_contours;
- int begin, stop;
- char modified = 0;
- char *valid_cont;
- int start = 0;
- int end = -1;
- FT_BBox *boxes = calloc(nc, sizeof(FT_BBox));
- int i, j;
-
- // Create a list of cboxes of the contours
- for (i = 0; i < nc; i++) {
- start = end + 1;
- end = glyph->outline.contours[i];
- get_contour_cbox(&boxes[i], glyph->outline.points, start, end);
- }
-
- // if a) contour's cbox is contained in another contours cbox
- // b) contour's height or width is smaller than the border*2
- // the contour can be safely removed.
- valid_cont = calloc(1, nc);
- for (i = 0; i < nc; i++) {
- valid_cont[i] = 1;
- for (j = 0; j < nc; j++) {
- if (i == j)
- continue;
- if (boxes[i].xMin >= boxes[j].xMin &&
- boxes[i].xMax <= boxes[j].xMax &&
- boxes[i].yMin >= boxes[j].yMin &&
- boxes[i].yMax <= boxes[j].yMax) {
- int width = boxes[i].xMax - boxes[i].xMin;
- int height = boxes[i].yMax - boxes[i].yMin;
- if (width < border_x * 2 || height < border_y * 2) {
- valid_cont[i] = 0;
- modified = 1;
- break;
- }
- }
- }
- }
-
- // Zero-out contours that can be removed; much simpler than copying
- if (modified) {
- for (i = 0; i < nc; i++) {
- if (valid_cont[i])
- continue;
- begin = (i == 0) ? 0 : glyph->outline.contours[i - 1] + 1;
- stop = glyph->outline.contours[i];
- for (j = begin; j <= stop; j++) {
- glyph->outline.points[j].x = 0;
- glyph->outline.points[j].y = 0;
- glyph->outline.tags[j] = 0;
- }
- }
- }
-
- free(boxes);
- free(valid_cont);
-}
-
-/*
- * Replace the outline of a glyph by a contour which makes up a simple
- * opaque rectangle.
- */
-static void draw_opaque_box(ASS_Renderer *render_priv, uint32_t ch,
- FT_Glyph glyph, int sx, int sy)
-{
- int asc = 0, desc = 0;
- int i;
- int adv = d16_to_d6(glyph->advance.x);
- double scale_y = render_priv->state.scale_y;
- double scale_x = render_priv->state.scale_x
- * render_priv->font_scale_x;
- FT_OutlineGlyph og = (FT_OutlineGlyph) glyph;
- FT_Outline *ol;
-
- // to avoid gaps
- sx = FFMAX(64, sx);
- sy = FFMAX(64, sy);
-
- if (ch == -1) {
- asc = render_priv->state.drawing->asc;
- desc = render_priv->state.drawing->desc;
- } else {
- ass_font_get_asc_desc(render_priv->state.font, ch, &asc, &desc);
- asc *= scale_y;
- desc *= scale_y;
- }
-
- // Emulate the WTFish behavior of VSFilter, i.e. double-scale
- // the sizes of the opaque box.
- adv += double_to_d6(render_priv->state.hspacing * render_priv->font_scale
- * scale_x);
- adv *= scale_x;
- sx *= scale_x;
- sy *= scale_y;
- desc *= scale_y;
- desc += asc * (scale_y - 1.0);
-
- FT_Vector points[4] = {
- { .x = -sx, .y = asc + sy },
- { .x = adv + sx, .y = asc + sy },
- { .x = adv + sx, .y = -desc - sy },
- { .x = -sx, .y = -desc - sy },
- };
-
- FT_Outline_Done(render_priv->ftlibrary, &og->outline);
- FT_Outline_New(render_priv->ftlibrary, 4, 1, &og->outline);
-
- ol = &og->outline;
- ol->n_points = ol->n_contours = 0;
- for (i = 0; i < 4; i++) {
- ol->points[ol->n_points] = points[i];
- ol->tags[ol->n_points++] = 1;
- }
- ol->contours[ol->n_contours++] = ol->n_points - 1;
-}
-
-/*
- * Stroke an outline glyph in x/y direction. Applies various fixups to get
- * around limitations of the FreeType stroker.
- */
-static void stroke_outline_glyph(ASS_Renderer *render_priv,
- FT_OutlineGlyph *glyph, int sx, int sy)
-{
- if (sx <= 0 && sy <= 0)
- return;
-
- fix_freetype_stroker(*glyph, sx, sy);
-
- // Borders are equal; use the regular stroker
- if (sx == sy && render_priv->state.stroker) {
- int error;
- error = FT_Glyph_StrokeBorder((FT_Glyph *) glyph,
- render_priv->state.stroker, 0, 1);
- if (error)
- ass_msg(render_priv->library, MSGL_WARN,
- "FT_Glyph_Stroke error: %d", error);
-
- // "Stroke" with the outline emboldener in two passes.
- // The outlines look uglier, but the emboldening never adds any points
- } else {
- int i;
- FT_Outline *ol = &(*glyph)->outline;
- FT_Outline nol;
- FT_Outline_New(render_priv->ftlibrary, ol->n_points,
- ol->n_contours, &nol);
- FT_Outline_Copy(ol, &nol);
-
- FT_Outline_Embolden(ol, sx * 2);
- FT_Outline_Translate(ol, -sx, -sx);
- FT_Outline_Embolden(&nol, sy * 2);
- FT_Outline_Translate(&nol, -sy, -sy);
-
- for (i = 0; i < ol->n_points; i++)
- ol->points[i].y = nol.points[i].y;
-
- FT_Outline_Done(render_priv->ftlibrary, &nol);
- }
-}
-
-/**
- * \brief Get normal and outline (border) glyphs
- * \param symbol ucs4 char
- * \param info out: struct filled with extracted data
- * Tries to get both glyphs from cache.
- * If they can't be found, gets a glyph from font face, generates outline with FT_Stroker,
- * and add them to cache.
- * The glyphs are returned in info->glyph and info->outline_glyph
- */
-static void
-get_outline_glyph(ASS_Renderer *render_priv, int symbol, GlyphInfo *info,
- ASS_Drawing *drawing)
-{
- GlyphHashValue *val;
- GlyphHashKey key;
- memset(&key, 0, sizeof(key));
-
- if (drawing->hash) {
- key.scale_x = double_to_d16(render_priv->state.scale_x);
- key.scale_y = double_to_d16(render_priv->state.scale_y);
- key.outline.x = render_priv->state.border_x * 0xFFFF;
- key.outline.y = render_priv->state.border_y * 0xFFFF;
- key.border_style = render_priv->state.style->BorderStyle;
- key.drawing_hash = drawing->hash;
- } else {
- key.font = render_priv->state.font;
- key.size = render_priv->state.font_size;
- key.ch = symbol;
- key.bold = render_priv->state.bold;
- key.italic = render_priv->state.italic;
- key.scale_x = double_to_d16(render_priv->state.scale_x);
- key.scale_y = double_to_d16(render_priv->state.scale_y);
- key.outline.x = render_priv->state.border_x * 0xFFFF;
- key.outline.y = render_priv->state.border_y * 0xFFFF;
- key.flags = render_priv->state.flags;
- key.border_style = render_priv->state.style->BorderStyle;
- }
- memset(info, 0, sizeof(GlyphInfo));
-
- val = cache_find_glyph(render_priv->cache.glyph_cache, &key);
- if (val) {
- FT_Glyph_Copy(val->glyph, &info->glyph);
- if (val->outline_glyph)
- FT_Glyph_Copy(val->outline_glyph, &info->outline_glyph);
- info->bbox = val->bbox_scaled;
- info->advance.x = val->advance.x;
- info->advance.y = val->advance.y;
- if (drawing->hash) {
- drawing->asc = val->asc;
- drawing->desc = val->desc;
- }
- } else {
- GlyphHashValue v;
- if (drawing->hash) {
- if(!ass_drawing_parse(drawing, 0))
- return;
- FT_Glyph_Copy((FT_Glyph) drawing->glyph, &info->glyph);
- } else {
- info->glyph =
- ass_font_get_glyph(render_priv->fontconfig_priv,
- render_priv->state.font, symbol,
- render_priv->settings.hinting,
- render_priv->state.flags);
- }
- if (!info->glyph)
- return;
- info->advance.x = d16_to_d6(info->glyph->advance.x);
- info->advance.y = d16_to_d6(info->glyph->advance.y);
- FT_Glyph_Get_CBox(info->glyph, FT_GLYPH_BBOX_SUBPIXELS, &info->bbox);
-
- if (render_priv->state.style->BorderStyle == 3 &&
- (render_priv->state.border_x > 0||
- render_priv->state.border_y > 0)) {
- FT_Glyph_Copy(info->glyph, &info->outline_glyph);
- draw_opaque_box(render_priv, symbol, info->outline_glyph,
- double_to_d6(render_priv->state.border_x *
- render_priv->border_scale),
- double_to_d6(render_priv->state.border_y *
- render_priv->border_scale));
- } else if (render_priv->state.border_x > 0 ||
- render_priv->state.border_y > 0) {
-
- FT_Glyph_Copy(info->glyph, &info->outline_glyph);
- stroke_outline_glyph(render_priv,
- (FT_OutlineGlyph *) &info->outline_glyph,
- double_to_d6(render_priv->state.border_x *
- render_priv->border_scale),
- double_to_d6(render_priv->state.border_y *
- render_priv->border_scale));
- }
-
- memset(&v, 0, sizeof(v));
- FT_Glyph_Copy(info->glyph, &v.glyph);
- if (info->outline_glyph)
- FT_Glyph_Copy(info->outline_glyph, &v.outline_glyph);
- v.advance = info->advance;
- v.bbox_scaled = info->bbox;
- if (drawing->hash) {
- v.asc = drawing->asc;
- v.desc = drawing->desc;
- }
- cache_add_glyph(render_priv->cache.glyph_cache, &key, &v);
- }
-}
-
-static void transform_3d(FT_Vector shift, FT_Glyph *glyph,
- FT_Glyph *glyph2, double frx, double fry,
- double frz, double fax, double fay, double scale,
- int yshift);
-
-/**
- * \brief Get bitmaps for a glyph
- * \param info glyph info
- * Tries to get glyph bitmaps from bitmap cache.
- * If they can't be found, they are generated by rotating and rendering the glyph.
- * After that, bitmaps are added to the cache.
- * They are returned in info->bm (glyph), info->bm_o (outline) and info->bm_s (shadow).
- */
-static void
-get_bitmap_glyph(ASS_Renderer *render_priv, GlyphInfo *info)
-{
- BitmapHashValue *val;
- BitmapHashKey *key = &info->hash_key;
-
- val = cache_find_bitmap(render_priv->cache.bitmap_cache, key);
-
- if (val) {
- info->bm = val->bm;
- info->bm_o = val->bm_o;
- info->bm_s = val->bm_s;
- } else {
- FT_Vector shift;
- BitmapHashValue hash_val;
- int error;
- double fax_scaled, fay_scaled;
- info->bm = info->bm_o = info->bm_s = 0;
- if (info->glyph && info->symbol != '\n' && info->symbol != 0
- && !info->skip) {
- // calculating rotation shift vector (from rotation origin to the glyph basepoint)
- shift.x = info->hash_key.shift_x;
- shift.y = info->hash_key.shift_y;
- fax_scaled = info->fax * render_priv->font_scale_x *
- render_priv->state.scale_x;
- fay_scaled = info->fay * render_priv->state.scale_y;
- // apply rotation
- transform_3d(shift, &info->glyph, &info->outline_glyph,
- info->frx, info->fry, info->frz, fax_scaled,
- fay_scaled, render_priv->font_scale, info->asc);
-
- // subpixel shift
- if (info->glyph)
- FT_Outline_Translate(
- &((FT_OutlineGlyph) info->glyph)->outline,
- info->hash_key.advance.x,
- -info->hash_key.advance.y);
- if (info->outline_glyph)
- FT_Outline_Translate(
- &((FT_OutlineGlyph) info->outline_glyph)->outline,
- info->hash_key.advance.x,
- -info->hash_key.advance.y);
-
- // render glyph
- error = glyph_to_bitmap(render_priv->library,
- render_priv->synth_priv,
- info->glyph, info->outline_glyph,
- &info->bm, &info->bm_o,
- &info->bm_s, info->be,
- info->blur * render_priv->border_scale,
- info->hash_key.shadow_offset,
- info->hash_key.border_style);
- if (error)
- info->symbol = 0;
-
- // add bitmaps to cache
- hash_val.bm_o = info->bm_o;
- hash_val.bm = info->bm;
- hash_val.bm_s = info->bm_s;
- cache_add_bitmap(render_priv->cache.bitmap_cache,
- &(info->hash_key), &hash_val);
- }
- }
- // deallocate glyphs
- if (info->glyph)
- FT_Done_Glyph(info->glyph);
- if (info->outline_glyph)
- FT_Done_Glyph(info->outline_glyph);
-}
-
-/**
- * This function goes through text_info and calculates text parameters.
- * The following text_info fields are filled:
- * height
- * lines[].height
- * lines[].asc
- * lines[].desc
- */
-static void measure_text(ASS_Renderer *render_priv)
-{
- TextInfo *text_info = &render_priv->text_info;
- int cur_line = 0;
- double max_asc = 0., max_desc = 0.;
- GlyphInfo *last = NULL;
- int i;
- int empty_line = 1;
- text_info->height = 0.;
- for (i = 0; i < text_info->length + 1; ++i) {
- if ((i == text_info->length) || text_info->glyphs[i].linebreak) {
- if (empty_line && cur_line > 0 && last && i < text_info->length) {
- max_asc = d6_to_double(last->asc) / 2.0;
- max_desc = d6_to_double(last->desc) / 2.0;
- }
- text_info->lines[cur_line].asc = max_asc;
- text_info->lines[cur_line].desc = max_desc;
- text_info->height += max_asc + max_desc;
- cur_line++;
- max_asc = max_desc = 0.;
- empty_line = 1;
- } else
- empty_line = 0;
- if (i < text_info->length) {
- GlyphInfo *cur = text_info->glyphs + i;
- if (d6_to_double(cur->asc) > max_asc)
- max_asc = d6_to_double(cur->asc);
- if (d6_to_double(cur->desc) > max_desc)
- max_desc = d6_to_double(cur->desc);
- if (cur->symbol != '\n' && cur->symbol != 0)
- last = cur;
- }
- }
- text_info->height +=
- (text_info->n_lines -
- 1) * render_priv->settings.line_spacing;
-}
-
-/**
- * Mark extra whitespace for later removal.
- */
-#define IS_WHITESPACE(x) ((x->symbol == ' ' || x->symbol == '\n') \
- && !x->linebreak)
-static void trim_whitespace(ASS_Renderer *render_priv)
-{
- int i, j;
- GlyphInfo *cur;
- TextInfo *ti = &render_priv->text_info;
-
- // Mark trailing spaces
- i = ti->length - 1;
- cur = ti->glyphs + i;
- while (i && IS_WHITESPACE(cur)) {
- cur->skip++;
- cur = ti->glyphs + --i;
- }
-
- // Mark leading whitespace
- i = 0;
- cur = ti->glyphs;
- while (i < ti->length && IS_WHITESPACE(cur)) {
- cur->skip++;
- cur = ti->glyphs + ++i;
- }
-
- // Mark all extraneous whitespace inbetween
- for (i = 0; i < ti->length; ++i) {
- cur = ti->glyphs + i;
- if (cur->linebreak) {
- // Mark whitespace before
- j = i - 1;
- cur = ti->glyphs + j;
- while (j && IS_WHITESPACE(cur)) {
- cur->skip++;
- cur = ti->glyphs + --j;
- }
- // A break itself can contain a whitespace, too
- cur = ti->glyphs + i;
- if (cur->symbol == ' ')
- cur->skip++;
- // Mark whitespace after
- j = i + 1;
- cur = ti->glyphs + j;
- while (j < ti->length && IS_WHITESPACE(cur)) {
- cur->skip++;
- cur = ti->glyphs + ++j;
- }
- i = j - 1;
- }
- }
-}
-#undef IS_WHITESPACE
-
-/**
- * \brief rearrange text between lines
- * \param max_text_width maximal text line width in pixels
- * The algo is similar to the one in libvo/sub.c:
- * 1. Place text, wrapping it when current line is full
- * 2. Try moving words from the end of a line to the beginning of the next one while it reduces
- * the difference in lengths between this two lines.
- * The result may not be optimal, but usually is good enough.
- *
- * FIXME: implement style 0 and 3 correctly, add support for style 1
- */
-static void
-wrap_lines_smart(ASS_Renderer *render_priv, double max_text_width)
-{
- int i;
- GlyphInfo *cur, *s1, *e1, *s2, *s3, *w;
- int last_space;
- int break_type;
- int exit;
- double pen_shift_x;
- double pen_shift_y;
- int cur_line;
- TextInfo *text_info = &render_priv->text_info;
-
- last_space = -1;
- text_info->n_lines = 1;
- break_type = 0;
- s1 = text_info->glyphs; // current line start
- for (i = 0; i < text_info->length; ++i) {
- int break_at;
- double s_offset, len;
- cur = text_info->glyphs + i;
- break_at = -1;
- s_offset = d6_to_double(s1->bbox.xMin + s1->pos.x);
- len = d6_to_double(cur->bbox.xMax + cur->pos.x) - s_offset;
-
- if (cur->symbol == '\n') {
- break_type = 2;
- break_at = i;
- ass_msg(render_priv->library, MSGL_DBG2,
- "forced line break at %d", break_at);
- }
-
- if ((len >= max_text_width)
- && (render_priv->state.wrap_style != 2)) {
- break_type = 1;
- break_at = last_space;
- if (break_at == -1)
- break_at = i - 1;
- if (break_at == -1)
- break_at = 0;
- ass_msg(render_priv->library, MSGL_DBG2, "overfill at %d", i);
- ass_msg(render_priv->library, MSGL_DBG2, "line break at %d",
- break_at);
- }
-
- if (break_at != -1) {
- // need to use one more line
- // marking break_at+1 as start of a new line
- int lead = break_at + 1; // the first symbol of the new line
- if (text_info->n_lines >= text_info->max_lines) {
- // Raise maximum number of lines
- text_info->max_lines *= 2;
- text_info->lines = realloc(text_info->lines,
- sizeof(LineInfo) *
- text_info->max_lines);
- }
- if (lead < text_info->length)
- text_info->glyphs[lead].linebreak = break_type;
- last_space = -1;
- s1 = text_info->glyphs + lead;
- s_offset = d6_to_double(s1->bbox.xMin + s1->pos.x);
- text_info->n_lines++;
- }
-
- if (cur->symbol == ' ')
- last_space = i;
-
- // make sure the hard linebreak is not forgotten when
- // there was a new soft linebreak just inserted
- if (cur->symbol == '\n' && break_type == 1)
- i--;
- }
-#define DIFF(x,y) (((x) < (y)) ? (y - x) : (x - y))
- exit = 0;
- while (!exit && render_priv->state.wrap_style != 1) {
- exit = 1;
- w = s3 = text_info->glyphs;
- s1 = s2 = 0;
- for (i = 0; i <= text_info->length; ++i) {
- cur = text_info->glyphs + i;
- if ((i == text_info->length) || cur->linebreak) {
- s1 = s2;
- s2 = s3;
- s3 = cur;
- if (s1 && (s2->linebreak == 1)) { // have at least 2 lines, and linebreak is 'soft'
- double l1, l2, l1_new, l2_new;
-
- w = s2;
- do {
- --w;
- } while ((w > s1) && (w->symbol == ' '));
- while ((w > s1) && (w->symbol != ' ')) {
- --w;
- }
- e1 = w;
- while ((e1 > s1) && (e1->symbol == ' ')) {
- --e1;
- }
- if (w->symbol == ' ')
- ++w;
-
- l1 = d6_to_double(((s2 - 1)->bbox.xMax + (s2 - 1)->pos.x) -
- (s1->bbox.xMin + s1->pos.x));
- l2 = d6_to_double(((s3 - 1)->bbox.xMax + (s3 - 1)->pos.x) -
- (s2->bbox.xMin + s2->pos.x));
- l1_new = d6_to_double(
- (e1->bbox.xMax + e1->pos.x) -
- (s1->bbox.xMin + s1->pos.x));
- l2_new = d6_to_double(
- ((s3 - 1)->bbox.xMax + (s3 - 1)->pos.x) -
- (w->bbox.xMin + w->pos.x));
-
- if (DIFF(l1_new, l2_new) < DIFF(l1, l2)) {
- w->linebreak = 1;
- s2->linebreak = 0;
- exit = 0;
- }
- }
- }
- if (i == text_info->length)
- break;
- }
-
- }
- assert(text_info->n_lines >= 1);
-#undef DIFF
-
- measure_text(render_priv);
- trim_whitespace(render_priv);
-
- pen_shift_x = 0.;
- pen_shift_y = 0.;
- cur_line = 1;
-
- i = 0;
- cur = text_info->glyphs + i;
- while (i < text_info->length && cur->skip)
- cur = text_info->glyphs + ++i;
- pen_shift_x = d6_to_double(-cur->pos.x);
-
- for (i = 0; i < text_info->length; ++i) {
- cur = text_info->glyphs + i;
- if (cur->linebreak) {
- while (i < text_info->length && cur->skip && cur->symbol != '\n')
- cur = text_info->glyphs + ++i;
- double height =
- text_info->lines[cur_line - 1].desc +
- text_info->lines[cur_line].asc;
- cur_line++;
- pen_shift_x = d6_to_double(-cur->pos.x);
- pen_shift_y += height + render_priv->settings.line_spacing;
- ass_msg(render_priv->library, MSGL_DBG2,
- "shifting from %d to %d by (%f, %f)", i,
- text_info->length - 1, pen_shift_x, pen_shift_y);
- }
- cur->pos.x += double_to_d6(pen_shift_x);
- cur->pos.y += double_to_d6(pen_shift_y);
- }
-}
-
-/**
- * \brief determine karaoke effects
- * Karaoke effects cannot be calculated during parse stage (get_next_char()),
- * so they are done in a separate step.
- * Parse stage: when karaoke style override is found, its parameters are stored in the next glyph's
- * (the first glyph of the karaoke word)'s effect_type and effect_timing.
- * This function:
- * 1. sets effect_type for all glyphs in the word (_karaoke_ word)
- * 2. sets effect_timing for all glyphs to x coordinate of the border line between the left and right karaoke parts
- * (left part is filled with PrimaryColour, right one - with SecondaryColour).
- */
-static void process_karaoke_effects(ASS_Renderer *render_priv)
-{
- GlyphInfo *cur, *cur2;
- GlyphInfo *s1, *e1; // start and end of the current word
- GlyphInfo *s2; // start of the next word
- int i;
- int timing; // current timing
- int tm_start, tm_end; // timings at start and end of the current word
- int tm_current;
- double dt;
- int x;
- int x_start, x_end;
-
- tm_current = render_priv->time - render_priv->state.event->Start;
- timing = 0;
- s1 = s2 = 0;
- for (i = 0; i <= render_priv->text_info.length; ++i) {
- cur = render_priv->text_info.glyphs + i;
- if ((i == render_priv->text_info.length)
- || (cur->effect_type != EF_NONE)) {
- s1 = s2;
- s2 = cur;
- if (s1) {
- e1 = s2 - 1;
- tm_start = timing + s1->effect_skip_timing;
- tm_end = tm_start + s1->effect_timing;
- timing = tm_end;
- x_start = 1000000;
- x_end = -1000000;
- for (cur2 = s1; cur2 <= e1; ++cur2) {
- x_start = FFMIN(x_start, d6_to_int(cur2->bbox.xMin + cur2->pos.x));
- x_end = FFMAX(x_end, d6_to_int(cur2->bbox.xMax + cur2->pos.x));
- }
-
- dt = (tm_current - tm_start);
- if ((s1->effect_type == EF_KARAOKE)
- || (s1->effect_type == EF_KARAOKE_KO)) {
- if (dt > 0)
- x = x_end + 1;
- else
- x = x_start;
- } else if (s1->effect_type == EF_KARAOKE_KF) {
- dt /= (tm_end - tm_start);
- x = x_start + (x_end - x_start) * dt;
- } else {
- ass_msg(render_priv->library, MSGL_ERR,
- "Unknown effect type");
- continue;
- }
-
- for (cur2 = s1; cur2 <= e1; ++cur2) {
- cur2->effect_type = s1->effect_type;
- cur2->effect_timing = x - d6_to_int(cur2->pos.x);
- }
- }
- }
- }
-}
-
-/**
- * \brief Calculate base point for positioning and rotation
- * \param bbox text bbox
- * \param alignment alignment
- * \param bx, by out: base point coordinates
- */
-static void get_base_point(DBBox *bbox, int alignment, double *bx, double *by)
-{
- const int halign = alignment & 3;
- const int valign = alignment & 12;
- if (bx)
- switch (halign) {
- case HALIGN_LEFT:
- *bx = bbox->xMin;
- break;
- case HALIGN_CENTER:
- *bx = (bbox->xMax + bbox->xMin) / 2.0;
- break;
- case HALIGN_RIGHT:
- *bx = bbox->xMax;
- break;
- }
- if (by)
- switch (valign) {
- case VALIGN_TOP:
- *by = bbox->yMin;
- break;
- case VALIGN_CENTER:
- *by = (bbox->yMax + bbox->yMin) / 2.0;
- break;
- case VALIGN_SUB:
- *by = bbox->yMax;
- break;
- }
-}
-
-/**
- * \brief Apply transformation to outline points of a glyph
- * Applies rotations given by frx, fry and frz and projects the points back
- * onto the screen plane.
- */
-static void
-transform_3d_points(FT_Vector shift, FT_Glyph glyph, double frx, double fry,
- double frz, double fax, double fay, double scale,
- int yshift)
-{
- double sx = sin(frx);
- double sy = sin(fry);
- double sz = sin(frz);
- double cx = cos(frx);
- double cy = cos(fry);
- double cz = cos(frz);
- FT_Outline *outline = &((FT_OutlineGlyph) glyph)->outline;
- FT_Vector *p = outline->points;
- double x, y, z, xx, yy, zz;
- int i, dist;
-
- dist = 20000 * scale;
- for (i = 0; i < outline->n_points; i++) {
- x = (double) p[i].x + shift.x + (fax * (yshift - p[i].y));
- y = (double) p[i].y + shift.y + (-fay * p[i].x);
- z = 0.;
-
- xx = x * cz + y * sz;
- yy = -(x * sz - y * cz);
- zz = z;
-
- x = xx;
- y = yy * cx + zz * sx;
- z = yy * sx - zz * cx;
-
- xx = x * cy + z * sy;
- yy = y;
- zz = x * sy - z * cy;
-
- zz = FFMAX(zz, 1000 - dist);
-
- x = (xx * dist) / (zz + dist);
- y = (yy * dist) / (zz + dist);
- p[i].x = x - shift.x + 0.5;
- p[i].y = y - shift.y + 0.5;
- }
-}
-
-/**
- * \brief Apply 3d transformation to several objects
- * \param shift FreeType vector
- * \param glyph FreeType glyph
- * \param glyph2 FreeType glyph
- * \param frx x-axis rotation angle
- * \param fry y-axis rotation angle
- * \param frz z-axis rotation angle
- * Rotates both glyphs by frx, fry and frz. Shift vector is added before rotation and subtracted after it.
- */
-static void
-transform_3d(FT_Vector shift, FT_Glyph *glyph, FT_Glyph *glyph2,
- double frx, double fry, double frz, double fax, double fay,
- double scale, int yshift)
-{
- frx = -frx;
- frz = -frz;
- if (frx != 0. || fry != 0. || frz != 0. || fax != 0. || fay != 0.) {
- if (glyph && *glyph)
- transform_3d_points(shift, *glyph, frx, fry, frz,
- fax, fay, scale, yshift);
-
- if (glyph2 && *glyph2)
- transform_3d_points(shift, *glyph2, frx, fry, frz,
- fax, fay, scale, yshift);
- }
-}
-
-
-/**
- * \brief Main ass rendering function, glues everything together
- * \param event event to render
- * \param event_images struct containing resulting images, will also be initialized
- * Process event, appending resulting ASS_Image's to images_root.
- */
-static int
-ass_render_event(ASS_Renderer *render_priv, ASS_Event *event,
- EventImages *event_images)
-{
- char *p;
- FT_UInt previous;
- FT_UInt num_glyphs;
- FT_Vector pen;
- unsigned code;
- DBBox bbox;
- int i, j;
- int MarginL, MarginR, MarginV;
- int last_break;
- int alignment, halign, valign;
- int kern = render_priv->track->Kerning;
- double device_x = 0;
- double device_y = 0;
- TextInfo *text_info = &render_priv->text_info;
- ASS_Drawing *drawing;
-
- if (event->Style >= render_priv->track->n_styles) {
- ass_msg(render_priv->library, MSGL_WARN, "No style found");
- return 1;
- }
- if (!event->Text) {
- ass_msg(render_priv->library, MSGL_WARN, "Empty event");
- return 1;
- }
-
- init_render_context(render_priv, event);
-
- drawing = render_priv->state.drawing;
- text_info->length = 0;
- pen.x = 0;
- pen.y = 0;
- previous = 0;
- num_glyphs = 0;
- p = event->Text;
- // Event parsing.
- while (1) {
- // get next char, executing style override
- // this affects render_context
- do {
- code = get_next_char(render_priv, &p);
- if (render_priv->state.drawing_mode && code)
- ass_drawing_add_char(drawing, (char) code);
- } while (code && render_priv->state.drawing_mode); // skip everything in drawing mode
-
- // Parse drawing
- if (drawing->i) {
- drawing->scale_x = render_priv->state.scale_x *
- render_priv->font_scale_x *
- render_priv->font_scale;
- drawing->scale_y = render_priv->state.scale_y *
- render_priv->font_scale;
- ass_drawing_hash(drawing);
- p--;
- code = -1;
- }
-
- // face could have been changed in get_next_char
- if (!render_priv->state.font) {
- free_render_context(render_priv);
- return 1;
- }
-
- if (code == 0)
- break;
-
- if (text_info->length >= text_info->max_glyphs) {
- // Raise maximum number of glyphs
- text_info->max_glyphs *= 2;
- text_info->glyphs =
- realloc(text_info->glyphs,
- sizeof(GlyphInfo) * text_info->max_glyphs);
- }
-
- // Add kerning to pen
- if (kern && previous && code && !drawing->hash) {
- FT_Vector delta;
- delta =
- ass_font_get_kerning(render_priv->state.font, previous,
- code);
- pen.x += delta.x * render_priv->state.scale_x
- * render_priv->font_scale_x;
- pen.y += delta.y * render_priv->state.scale_y
- * render_priv->font_scale_x;
- }
-
- ass_font_set_transform(render_priv->state.font,
- render_priv->state.scale_x *
- render_priv->font_scale_x,
- render_priv->state.scale_y, NULL);
-
- get_outline_glyph(render_priv, code,
- text_info->glyphs + text_info->length, drawing);
-
- // Add additional space after italic to non-italic style changes
- if (text_info->length &&
- text_info->glyphs[text_info->length - 1].hash_key.italic &&
- !render_priv->state.italic) {
- int back = text_info->length - 1;
- GlyphInfo *og = &text_info->glyphs[back];
- while (back && og->bbox.xMax - og->bbox.xMin == 0
- && og->hash_key.italic)
- og = &text_info->glyphs[--back];
- if (og->bbox.xMax > og->advance.x) {
- // The FreeType oblique slants by 6/16
- pen.x += og->bbox.yMax * 0.375;
- }
- }
-
- text_info->glyphs[text_info->length].pos.x = pen.x;
- text_info->glyphs[text_info->length].pos.y = pen.y;
-
- pen.x += text_info->glyphs[text_info->length].advance.x;
- pen.x += double_to_d6(render_priv->state.hspacing *
- render_priv->font_scale
- * render_priv->state.scale_x);
- pen.y += text_info->glyphs[text_info->length].advance.y;
- pen.y += (render_priv->state.fay * render_priv->state.scale_y) *
- text_info->glyphs[text_info->length].advance.x;
-
- previous = code;
-
- text_info->glyphs[text_info->length].symbol = code;
- text_info->glyphs[text_info->length].linebreak = 0;
- for (i = 0; i < 4; ++i) {
- uint32_t clr = render_priv->state.c[i];
- change_alpha(&clr,
- mult_alpha(_a(clr), render_priv->state.fade), 1.);
- text_info->glyphs[text_info->length].c[i] = clr;
- }
- text_info->glyphs[text_info->length].effect_type =
- render_priv->state.effect_type;
- text_info->glyphs[text_info->length].effect_timing =
- render_priv->state.effect_timing;
- text_info->glyphs[text_info->length].effect_skip_timing =
- render_priv->state.effect_skip_timing;
- text_info->glyphs[text_info->length].be = render_priv->state.be;
- text_info->glyphs[text_info->length].blur = render_priv->state.blur;
- text_info->glyphs[text_info->length].shadow_x =
- render_priv->state.shadow_x;
- text_info->glyphs[text_info->length].shadow_y =
- render_priv->state.shadow_y;
- text_info->glyphs[text_info->length].frx = render_priv->state.frx;
- text_info->glyphs[text_info->length].fry = render_priv->state.fry;
- text_info->glyphs[text_info->length].frz = render_priv->state.frz;
- text_info->glyphs[text_info->length].fax = render_priv->state.fax;
- text_info->glyphs[text_info->length].fay = render_priv->state.fay;
- if (drawing->hash) {
- text_info->glyphs[text_info->length].asc = drawing->asc;
- text_info->glyphs[text_info->length].desc = drawing->desc;
- } else {
- ass_font_get_asc_desc(render_priv->state.font, code,
- &text_info->glyphs[text_info->length].asc,
- &text_info->glyphs[text_info->length].desc);
-
- text_info->glyphs[text_info->length].asc *=
- render_priv->state.scale_y;
- text_info->glyphs[text_info->length].desc *=
- render_priv->state.scale_y;
- }
-
- // fill bitmap_hash_key
- if (!drawing->hash) {
- text_info->glyphs[text_info->length].hash_key.font =
- render_priv->state.font;
- text_info->glyphs[text_info->length].hash_key.size =
- render_priv->state.font_size;
- text_info->glyphs[text_info->length].hash_key.bold =
- render_priv->state.bold;
- text_info->glyphs[text_info->length].hash_key.italic =
- render_priv->state.italic;
- } else
- text_info->glyphs[text_info->length].hash_key.drawing_hash =
- drawing->hash;
- text_info->glyphs[text_info->length].hash_key.ch = code;
- text_info->glyphs[text_info->length].hash_key.outline.x =
- double_to_d16(render_priv->state.border_x);
- text_info->glyphs[text_info->length].hash_key.outline.y =
- double_to_d16(render_priv->state.border_y);
- text_info->glyphs[text_info->length].hash_key.scale_x =
- double_to_d16(render_priv->state.scale_x);
- text_info->glyphs[text_info->length].hash_key.scale_y =
- double_to_d16(render_priv->state.scale_y);
- text_info->glyphs[text_info->length].hash_key.frx =
- rot_key(render_priv->state.frx);
- text_info->glyphs[text_info->length].hash_key.fry =
- rot_key(render_priv->state.fry);
- text_info->glyphs[text_info->length].hash_key.frz =
- rot_key(render_priv->state.frz);
- text_info->glyphs[text_info->length].hash_key.fax =
- double_to_d16(render_priv->state.fax);
- text_info->glyphs[text_info->length].hash_key.fay =
- double_to_d16(render_priv->state.fay);
- text_info->glyphs[text_info->length].hash_key.advance.x = pen.x;
- text_info->glyphs[text_info->length].hash_key.advance.y = pen.y;
- text_info->glyphs[text_info->length].hash_key.be =
- render_priv->state.be;
- text_info->glyphs[text_info->length].hash_key.blur =
- render_priv->state.blur;
- text_info->glyphs[text_info->length].hash_key.border_style =
- render_priv->state.style->BorderStyle;
- text_info->glyphs[text_info->length].hash_key.shadow_offset.x =
- double_to_d6(
- render_priv->state.shadow_x * render_priv->border_scale -
- (int) (render_priv->state.shadow_x *
- render_priv->border_scale));
- text_info->glyphs[text_info->length].hash_key.shadow_offset.y =
- double_to_d6(
- render_priv->state.shadow_y * render_priv->border_scale -
- (int) (render_priv->state.shadow_y *
- render_priv->border_scale));
- text_info->glyphs[text_info->length].hash_key.flags =
- render_priv->state.flags;
-
- text_info->length++;
-
- render_priv->state.effect_type = EF_NONE;
- render_priv->state.effect_timing = 0;
- render_priv->state.effect_skip_timing = 0;
-
- if (drawing->hash) {
- ass_drawing_free(drawing);
- drawing = render_priv->state.drawing =
- ass_drawing_new(render_priv->fontconfig_priv,
- render_priv->state.font,
- render_priv->settings.hinting,
- render_priv->ftlibrary);
- }
- }
-
-
- if (text_info->length == 0) {
- // no valid symbols in the event; this can be smth like {comment}
- free_render_context(render_priv);
- return 1;
- }
- // depends on glyph x coordinates being monotonous, so it should be done before line wrap
- process_karaoke_effects(render_priv);
-
- // alignments
- alignment = render_priv->state.alignment;
- halign = alignment & 3;
- valign = alignment & 12;
-
- MarginL =
- (event->MarginL) ? event->MarginL : render_priv->state.style->
- MarginL;
- MarginR =
- (event->MarginR) ? event->MarginR : render_priv->state.style->
- MarginR;
- MarginV =
- (event->MarginV) ? event->MarginV : render_priv->state.style->
- MarginV;
-
- if (render_priv->state.evt_type != EVENT_HSCROLL) {
- double max_text_width;
-
- // calculate max length of a line
- max_text_width =
- x2scr(render_priv,
- render_priv->track->PlayResX - MarginR) -
- x2scr(render_priv, MarginL);
-
- // rearrange text in several lines
- wrap_lines_smart(render_priv, max_text_width);
-
- // align text
- last_break = -1;
- for (i = 1; i < text_info->length + 1; ++i) { // (text_info->length + 1) is the end of the last line
- if ((i == text_info->length)
- || text_info->glyphs[i].linebreak) {
- double width, shift = 0;
- GlyphInfo *first_glyph =
- text_info->glyphs + last_break + 1;
- GlyphInfo *last_glyph = text_info->glyphs + i - 1;
-
- while (first_glyph < last_glyph && first_glyph->skip)
- first_glyph++;
-
- while ((last_glyph > first_glyph)
- && ((last_glyph->symbol == '\n')
- || (last_glyph->symbol == 0)
- || (last_glyph->skip)))
- last_glyph--;
-
- width = d6_to_double(
- last_glyph->pos.x + last_glyph->advance.x -
- first_glyph->pos.x);
- if (halign == HALIGN_LEFT) { // left aligned, no action
- shift = 0;
- } else if (halign == HALIGN_RIGHT) { // right aligned
- shift = max_text_width - width;
- } else if (halign == HALIGN_CENTER) { // centered
- shift = (max_text_width - width) / 2.0;
- }
- for (j = last_break + 1; j < i; ++j) {
- text_info->glyphs[j].pos.x += double_to_d6(shift);
- }
- last_break = i - 1;
- }
- }
- } else { // render_priv->state.evt_type == EVENT_HSCROLL
- measure_text(render_priv);
- }
-
- // determing text bounding box
- compute_string_bbox(text_info, &bbox);
-
- // determine device coordinates for text
-
- // x coordinate for everything except positioned events
- if (render_priv->state.evt_type == EVENT_NORMAL ||
- render_priv->state.evt_type == EVENT_VSCROLL) {
- device_x = x2scr(render_priv, MarginL);
- } else if (render_priv->state.evt_type == EVENT_HSCROLL) {
- if (render_priv->state.scroll_direction == SCROLL_RL)
- device_x =
- x2scr(render_priv,
- render_priv->track->PlayResX -
- render_priv->state.scroll_shift);
- else if (render_priv->state.scroll_direction == SCROLL_LR)
- device_x =
- x2scr(render_priv,
- render_priv->state.scroll_shift) - (bbox.xMax -
- bbox.xMin);
- }
- // y coordinate for everything except positioned events
- if (render_priv->state.evt_type == EVENT_NORMAL ||
- render_priv->state.evt_type == EVENT_HSCROLL) {
- if (valign == VALIGN_TOP) { // toptitle
- device_y =
- y2scr_top(render_priv,
- MarginV) + text_info->lines[0].asc;
- } else if (valign == VALIGN_CENTER) { // midtitle
- double scr_y =
- y2scr(render_priv, render_priv->track->PlayResY / 2.0);
- device_y = scr_y - (bbox.yMax + bbox.yMin) / 2.0;
- } else { // subtitle
- double scr_y;
- if (valign != VALIGN_SUB)
- ass_msg(render_priv->library, MSGL_V,
- "Invalid valign, supposing 0 (subtitle)");
- scr_y =
- y2scr_sub(render_priv,
- render_priv->track->PlayResY - MarginV);
- device_y = scr_y;
- device_y -= text_info->height;
- device_y += text_info->lines[0].asc;
- }
- } else if (render_priv->state.evt_type == EVENT_VSCROLL) {
- if (render_priv->state.scroll_direction == SCROLL_TB)
- device_y =
- y2scr(render_priv,
- render_priv->state.clip_y0 +
- render_priv->state.scroll_shift) - (bbox.yMax -
- bbox.yMin);
- else if (render_priv->state.scroll_direction == SCROLL_BT)
- device_y =
- y2scr(render_priv,
- render_priv->state.clip_y1 -
- render_priv->state.scroll_shift);
- }
- // positioned events are totally different
- if (render_priv->state.evt_type == EVENT_POSITIONED) {
- double base_x = 0;
- double base_y = 0;
- ass_msg(render_priv->library, MSGL_DBG2, "positioned event at %f, %f",
- render_priv->state.pos_x, render_priv->state.pos_y);
- get_base_point(&bbox, alignment, &base_x, &base_y);
- device_x =
- x2scr_pos(render_priv, render_priv->state.pos_x) - base_x;
- device_y =
- y2scr_pos(render_priv, render_priv->state.pos_y) - base_y;
- }
- // fix clip coordinates (they depend on alignment)
- if (render_priv->state.evt_type == EVENT_NORMAL ||
- render_priv->state.evt_type == EVENT_HSCROLL ||
- render_priv->state.evt_type == EVENT_VSCROLL) {
- render_priv->state.clip_x0 =
- x2scr(render_priv, render_priv->state.clip_x0);
- render_priv->state.clip_x1 =
- x2scr(render_priv, render_priv->state.clip_x1);
- if (valign == VALIGN_TOP) {
- render_priv->state.clip_y0 =
- y2scr_top(render_priv, render_priv->state.clip_y0);
- render_priv->state.clip_y1 =
- y2scr_top(render_priv, render_priv->state.clip_y1);
- } else if (valign == VALIGN_CENTER) {
- render_priv->state.clip_y0 =
- y2scr(render_priv, render_priv->state.clip_y0);
- render_priv->state.clip_y1 =
- y2scr(render_priv, render_priv->state.clip_y1);
- } else if (valign == VALIGN_SUB) {
- render_priv->state.clip_y0 =
- y2scr_sub(render_priv, render_priv->state.clip_y0);
- render_priv->state.clip_y1 =
- y2scr_sub(render_priv, render_priv->state.clip_y1);
- }
- } else if (render_priv->state.evt_type == EVENT_POSITIONED) {
- render_priv->state.clip_x0 =
- x2scr_pos(render_priv, render_priv->state.clip_x0);
- render_priv->state.clip_x1 =
- x2scr_pos(render_priv, render_priv->state.clip_x1);
- render_priv->state.clip_y0 =
- y2scr_pos(render_priv, render_priv->state.clip_y0);
- render_priv->state.clip_y1 =
- y2scr_pos(render_priv, render_priv->state.clip_y1);
- }
- // calculate rotation parameters
- {
- DVector center;
-
- if (render_priv->state.have_origin) {
- center.x = x2scr(render_priv, render_priv->state.org_x);
- center.y = y2scr(render_priv, render_priv->state.org_y);
- } else {
- double bx = 0., by = 0.;
- get_base_point(&bbox, alignment, &bx, &by);
- center.x = device_x + bx;
- center.y = device_y + by;
- }
-
- for (i = 0; i < text_info->length; ++i) {
- GlyphInfo *info = text_info->glyphs + i;
-
- if (info->hash_key.frx || info->hash_key.fry
- || info->hash_key.frz || info->hash_key.fax
- || info->hash_key.fay) {
- info->hash_key.shift_x = info->pos.x + double_to_d6(device_x - center.x);
- info->hash_key.shift_y =
- -(info->pos.y + double_to_d6(device_y - center.y));
- } else {
- info->hash_key.shift_x = 0;
- info->hash_key.shift_y = 0;
- }
- }
- }
-
- // convert glyphs to bitmaps
- for (i = 0; i < text_info->length; ++i) {
- GlyphInfo *g = text_info->glyphs + i;
- g->hash_key.advance.x =
- double_to_d6(device_x - (int) device_x +
- d6_to_double(g->pos.x & SUBPIXEL_MASK)) & ~SUBPIXEL_ACCURACY;
- g->hash_key.advance.y =
- double_to_d6(device_y - (int) device_y +
- d6_to_double(g->pos.y & SUBPIXEL_MASK)) & ~SUBPIXEL_ACCURACY;
- get_bitmap_glyph(render_priv, text_info->glyphs + i);
- }
-
- memset(event_images, 0, sizeof(*event_images));
- event_images->top = device_y - text_info->lines[0].asc;
- event_images->height = text_info->height;
- event_images->left = device_x + bbox.xMin + 0.5;
- event_images->width = bbox.xMax - bbox.xMin + 0.5;
- event_images->detect_collisions = render_priv->state.detect_collisions;
- event_images->shift_direction = (valign == VALIGN_TOP) ? 1 : -1;
- event_images->event = event;
- event_images->imgs = render_text(render_priv, (int) device_x, (int) device_y);
-
- free_render_context(render_priv);
-
- return 0;
-}
-
-/**
- * \brief deallocate image list
- * \param img list pointer
- */
-static void ass_free_images(ASS_Image *img)
-{
- while (img) {
- ASS_Image *next = img->next;
- free(img);
- img = next;
- }
-}
-
-static void ass_reconfigure(ASS_Renderer *priv)
-{
- priv->render_id++;
- priv->cache.glyph_cache =
- ass_glyph_cache_reset(priv->cache.glyph_cache);
- priv->cache.bitmap_cache =
- ass_bitmap_cache_reset(priv->cache.bitmap_cache);
- priv->cache.composite_cache =
- ass_composite_cache_reset(priv->cache.composite_cache);
- ass_free_images(priv->prev_images_root);
- priv->prev_images_root = 0;
-}
-
-void ass_set_frame_size(ASS_Renderer *priv, int w, int h)
-{
- if (priv->settings.frame_width != w || priv->settings.frame_height != h) {
- priv->settings.frame_width = w;
- priv->settings.frame_height = h;
- if (priv->settings.aspect == 0.) {
- priv->settings.aspect = ((double) w) / h;
- priv->settings.storage_aspect = ((double) w) / h;
- }
- ass_reconfigure(priv);
- }
-}
-
-void ass_set_margins(ASS_Renderer *priv, int t, int b, int l, int r)
-{
- if (priv->settings.left_margin != l ||
- priv->settings.right_margin != r ||
- priv->settings.top_margin != t
- || priv->settings.bottom_margin != b) {
- priv->settings.left_margin = l;
- priv->settings.right_margin = r;
- priv->settings.top_margin = t;
- priv->settings.bottom_margin = b;
- ass_reconfigure(priv);
- }
-}
-
-void ass_set_use_margins(ASS_Renderer *priv, int use)
-{
- priv->settings.use_margins = use;
-}
-
-void ass_set_aspect_ratio(ASS_Renderer *priv, double dar, double sar)
-{
- if (priv->settings.aspect != dar || priv->settings.storage_aspect != sar) {
- priv->settings.aspect = dar;
- priv->settings.storage_aspect = sar;
- ass_reconfigure(priv);
- }
-}
-
-void ass_set_font_scale(ASS_Renderer *priv, double font_scale)
-{
- if (priv->settings.font_size_coeff != font_scale) {
- priv->settings.font_size_coeff = font_scale;
- ass_reconfigure(priv);
- }
-}
-
-void ass_set_hinting(ASS_Renderer *priv, ASS_Hinting ht)
-{
- if (priv->settings.hinting != ht) {
- priv->settings.hinting = ht;
- ass_reconfigure(priv);
- }
-}
-
-void ass_set_line_spacing(ASS_Renderer *priv, double line_spacing)
-{
- priv->settings.line_spacing = line_spacing;
-}
-
-void ass_set_fonts(ASS_Renderer *priv, const char *default_font,
- const char *default_family, int fc, const char *config,
- int update)
-{
- free(priv->settings.default_font);
- free(priv->settings.default_family);
- priv->settings.default_font = default_font ? strdup(default_font) : 0;
- priv->settings.default_family =
- default_family ? strdup(default_family) : 0;
-
- if (priv->fontconfig_priv)
- fontconfig_done(priv->fontconfig_priv);
- priv->fontconfig_priv =
- fontconfig_init(priv->library, priv->ftlibrary, default_family,
- default_font, fc, config, update);
-}
-
-int ass_fonts_update(ASS_Renderer *render_priv)
-{
- return fontconfig_update(render_priv->fontconfig_priv);
-}
-
-/**
- * \brief Start a new frame
- */
-static int
-ass_start_frame(ASS_Renderer *render_priv, ASS_Track *track,
- long long now)
-{
- ASS_Settings *settings_priv = &render_priv->settings;
- CacheStore *cache = &render_priv->cache;
-
- if (!render_priv->settings.frame_width
- && !render_priv->settings.frame_height)
- return 1; // library not initialized
-
- if (render_priv->library != track->library)
- return 1;
-
- free_list_clear(render_priv);
-
- if (track->n_events == 0)
- return 1; // nothing to do
-
- render_priv->width = settings_priv->frame_width;
- render_priv->height = settings_priv->frame_height;
- render_priv->orig_width =
- settings_priv->frame_width - settings_priv->left_margin -
- settings_priv->right_margin;
- render_priv->orig_height =
- settings_priv->frame_height - settings_priv->top_margin -
- settings_priv->bottom_margin;
- render_priv->orig_width_nocrop =
- settings_priv->frame_width - FFMAX(settings_priv->left_margin,
- 0) -
- FFMAX(settings_priv->right_margin, 0);
- render_priv->orig_height_nocrop =
- settings_priv->frame_height - FFMAX(settings_priv->top_margin,
- 0) -
- FFMAX(settings_priv->bottom_margin, 0);
- render_priv->track = track;
- render_priv->time = now;
-
- ass_lazy_track_init(render_priv);
-
- render_priv->font_scale = settings_priv->font_size_coeff *
- render_priv->orig_height / render_priv->track->PlayResY;
- if (render_priv->track->ScaledBorderAndShadow)
- render_priv->border_scale =
- ((double) render_priv->orig_height) /
- render_priv->track->PlayResY;
- else
- render_priv->border_scale = 1.;
-
- // PAR correction
- render_priv->font_scale_x = render_priv->settings.aspect /
- render_priv->settings.storage_aspect;
-
- render_priv->prev_images_root = render_priv->images_root;
- render_priv->images_root = 0;
-
- if (cache->bitmap_cache->cache_size > cache->bitmap_max_size) {
- ass_msg(render_priv->library, MSGL_V,
- "Hitting hard bitmap cache limit (was: %ld bytes), "
- "resetting.", (long) cache->bitmap_cache->cache_size);
- cache->bitmap_cache = ass_bitmap_cache_reset(cache->bitmap_cache);
- cache->composite_cache = ass_composite_cache_reset(
- cache->composite_cache);
- ass_free_images(render_priv->prev_images_root);
- render_priv->prev_images_root = 0;
- }
-
- if (cache->glyph_cache->count > cache->glyph_max) {
- ass_msg(render_priv->library, MSGL_V,
- "Hitting hard glyph cache limit (was: %ld glyphs), resetting.",
- (long) cache->glyph_cache->count);
- cache->glyph_cache = ass_glyph_cache_reset(cache->glyph_cache);
- }
-
- return 0;
-}
-
-static int cmp_event_layer(const void *p1, const void *p2)
-{
- ASS_Event *e1 = ((EventImages *) p1)->event;
- ASS_Event *e2 = ((EventImages *) p2)->event;
- if (e1->Layer < e2->Layer)
- return -1;
- if (e1->Layer > e2->Layer)
- return 1;
- if (e1->ReadOrder < e2->ReadOrder)
- return -1;
- if (e1->ReadOrder > e2->ReadOrder)
- return 1;
- return 0;
-}
-
-static ASS_RenderPriv *get_render_priv(ASS_Renderer *render_priv,
- ASS_Event *event)
-{
- if (!event->render_priv)
- event->render_priv = calloc(1, sizeof(ASS_RenderPriv));
- if (render_priv->render_id != event->render_priv->render_id) {
- memset(event->render_priv, 0, sizeof(ASS_RenderPriv));
- event->render_priv->render_id = render_priv->render_id;
- }
-
- return event->render_priv;
-}
-
-static int overlap(Segment *s1, Segment *s2)
-{
- if (s1->a >= s2->b || s2->a >= s1->b ||
- s1->ha >= s2->hb || s2->ha >= s1->hb)
- return 0;
- return 1;
-}
-
-static int cmp_segment(const void *p1, const void *p2)
-{
- return ((Segment *) p1)->a - ((Segment *) p2)->a;
-}
-
-static void
-shift_event(ASS_Renderer *render_priv, EventImages *ei, int shift)
-{
- ASS_Image *cur = ei->imgs;
- while (cur) {
- cur->dst_y += shift;
- // clip top and bottom
- if (cur->dst_y < 0) {
- int clip = -cur->dst_y;
- cur->h -= clip;
- cur->bitmap += clip * cur->stride;
- cur->dst_y = 0;
- }
- if (cur->dst_y + cur->h >= render_priv->height) {
- int clip = cur->dst_y + cur->h - render_priv->height;
- cur->h -= clip;
- }
- if (cur->h <= 0) {
- cur->h = 0;
- cur->dst_y = 0;
- }
- cur = cur->next;
- }
- ei->top += shift;
-}
-
-// dir: 1 - move down
-// -1 - move up
-static int fit_segment(Segment *s, Segment *fixed, int *cnt, int dir)
-{
- int i;
- int shift = 0;
-
- if (dir == 1) // move down
- for (i = 0; i < *cnt; ++i) {
- if (s->b + shift <= fixed[i].a || s->a + shift >= fixed[i].b ||
- s->hb <= fixed[i].ha || s->ha >= fixed[i].hb)
- continue;
- shift = fixed[i].b - s->a;
- } else // dir == -1, move up
- for (i = *cnt - 1; i >= 0; --i) {
- if (s->b + shift <= fixed[i].a || s->a + shift >= fixed[i].b ||
- s->hb <= fixed[i].ha || s->ha >= fixed[i].hb)
- continue;
- shift = fixed[i].a - s->b;
- }
-
- fixed[*cnt].a = s->a + shift;
- fixed[*cnt].b = s->b + shift;
- fixed[*cnt].ha = s->ha;
- fixed[*cnt].hb = s->hb;
- (*cnt)++;
- qsort(fixed, *cnt, sizeof(Segment), cmp_segment);
-
- return shift;
-}
-
-static void
-fix_collisions(ASS_Renderer *render_priv, EventImages *imgs, int cnt)
-{
- Segment *used = malloc(cnt * sizeof(*used));
- int cnt_used = 0;
- int i, j;
-
- // fill used[] with fixed events
- for (i = 0; i < cnt; ++i) {
- ASS_RenderPriv *priv;
- if (!imgs[i].detect_collisions)
- continue;
- priv = get_render_priv(render_priv, imgs[i].event);
- if (priv->height > 0) { // it's a fixed event
- Segment s;
- s.a = priv->top;
- s.b = priv->top + priv->height;
- s.ha = priv->left;
- s.hb = priv->left + priv->width;
- if (priv->height != imgs[i].height) { // no, it's not
- ass_msg(render_priv->library, MSGL_WARN,
- "Warning! Event height has changed");
- priv->top = 0;
- priv->height = 0;
- priv->left = 0;
- priv->width = 0;
- }
- for (j = 0; j < cnt_used; ++j)
- if (overlap(&s, used + j)) { // no, it's not
- priv->top = 0;
- priv->height = 0;
- priv->left = 0;
- priv->width = 0;
- }
- if (priv->height > 0) { // still a fixed event
- used[cnt_used].a = priv->top;
- used[cnt_used].b = priv->top + priv->height;
- used[cnt_used].ha = priv->left;
- used[cnt_used].hb = priv->left + priv->width;
- cnt_used++;
- shift_event(render_priv, imgs + i, priv->top - imgs[i].top);
- }
- }
- }
- qsort(used, cnt_used, sizeof(Segment), cmp_segment);
-
- // try to fit other events in free spaces
- for (i = 0; i < cnt; ++i) {
- ASS_RenderPriv *priv;
- if (!imgs[i].detect_collisions)
- continue;
- priv = get_render_priv(render_priv, imgs[i].event);
- if (priv->height == 0) { // not a fixed event
- int shift;
- Segment s;
- s.a = imgs[i].top;
- s.b = imgs[i].top + imgs[i].height;
- s.ha = imgs[i].left;
- s.hb = imgs[i].left + imgs[i].width;
- shift = fit_segment(&s, used, &cnt_used, imgs[i].shift_direction);
- if (shift)
- shift_event(render_priv, imgs + i, shift);
- // make it fixed
- priv->top = imgs[i].top;
- priv->height = imgs[i].height;
- priv->left = imgs[i].left;
- priv->width = imgs[i].width;
- }
-
- }
-
- free(used);
-}
-
-/**
- * \brief compare two images
- * \param i1 first image
- * \param i2 second image
- * \return 0 if identical, 1 if different positions, 2 if different content
- */
-static int ass_image_compare(ASS_Image *i1, ASS_Image *i2)
-{
- if (i1->w != i2->w)
- return 2;
- if (i1->h != i2->h)
- return 2;
- if (i1->stride != i2->stride)
- return 2;
- if (i1->color != i2->color)
- return 2;
- if (i1->bitmap != i2->bitmap)
- return 2;
- if (i1->dst_x != i2->dst_x)
- return 1;
- if (i1->dst_y != i2->dst_y)
- return 1;
- return 0;
-}
-
-/**
- * \brief compare current and previous image list
- * \param priv library handle
- * \return 0 if identical, 1 if different positions, 2 if different content
- */
-static int ass_detect_change(ASS_Renderer *priv)
-{
- ASS_Image *img, *img2;
- int diff;
-
- img = priv->prev_images_root;
- img2 = priv->images_root;
- diff = 0;
- while (img && diff < 2) {
- ASS_Image *next, *next2;
- next = img->next;
- if (img2) {
- int d = ass_image_compare(img, img2);
- if (d > diff)
- diff = d;
- next2 = img2->next;
- } else {
- // previous list is shorter
- diff = 2;
- break;
- }
- img = next;
- img2 = next2;
- }
-
- // is the previous list longer?
- if (img2)
- diff = 2;
-
- return diff;
-}
-
-/**
- * \brief render a frame
- * \param priv library handle
- * \param track track
- * \param now current video timestamp (ms)
- * \param detect_change a value describing how the new images differ from the previous ones will be written here:
- * 0 if identical, 1 if different positions, 2 if different content.
- * Can be NULL, in that case no detection is performed.
- */
-ASS_Image *ass_render_frame(ASS_Renderer *priv, ASS_Track *track,
- long long now, int *detect_change)
-{
- int i, cnt, rc;
- EventImages *last;
- ASS_Image **tail;
-
- // init frame
- rc = ass_start_frame(priv, track, now);
- if (rc != 0)
- return 0;
-
- // render events separately
- cnt = 0;
- for (i = 0; i < track->n_events; ++i) {
- ASS_Event *event = track->events + i;
- if ((event->Start <= now)
- && (now < (event->Start + event->Duration))) {
- if (cnt >= priv->eimg_size) {
- priv->eimg_size += 100;
- priv->eimg =
- realloc(priv->eimg,
- priv->eimg_size * sizeof(EventImages));
- }
- rc = ass_render_event(priv, event, priv->eimg + cnt);
- if (!rc)
- ++cnt;
- }
- }
-
- // sort by layer
- qsort(priv->eimg, cnt, sizeof(EventImages), cmp_event_layer);
-
- // call fix_collisions for each group of events with the same layer
- last = priv->eimg;
- for (i = 1; i < cnt; ++i)
- if (last->event->Layer != priv->eimg[i].event->Layer) {
- fix_collisions(priv, last, priv->eimg + i - last);
- last = priv->eimg + i;
- }
- if (cnt > 0)
- fix_collisions(priv, last, priv->eimg + cnt - last);
-
- // concat lists
- tail = &priv->images_root;
- for (i = 0; i < cnt; ++i) {
- ASS_Image *cur = priv->eimg[i].imgs;
- while (cur) {
- *tail = cur;
- tail = &cur->next;
- cur = cur->next;
- }
- }
-
- if (detect_change)
- *detect_change = ass_detect_change(priv);
-
- // free the previous image list
- ass_free_images(priv->prev_images_root);
- priv->prev_images_root = 0;
-
- return priv->images_root;
-}
diff --git a/libass/ass_render.h b/libass/ass_render.h
deleted file mode 100644
index 6d9db23fb1..0000000000
--- a/libass/ass_render.h
+++ /dev/null
@@ -1,262 +0,0 @@
-/*
- * Copyright (C) 2006 Evgeniy Stepanov <eugeni.stepanov@gmail.com>
- * Copyright (C) 2009 Grigori Goronzy <greg@geekmind.org>
- *
- * This file is part of libass.
- *
- * libass 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.
- *
- * libass 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 libass; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#ifndef LIBASS_RENDER_H
-#define LIBASS_RENDER_H
-
-#include <inttypes.h>
-#include <ft2build.h>
-#include FT_FREETYPE_H
-#include FT_STROKER_H
-#include FT_GLYPH_H
-#include FT_SYNTHESIS_H
-
-#include "ass.h"
-#include "ass_font.h"
-#include "ass_bitmap.h"
-#include "ass_cache.h"
-#include "ass_utils.h"
-#include "ass_fontconfig.h"
-#include "ass_library.h"
-#include "ass_drawing.h"
-
-typedef struct {
- double xMin;
- double xMax;
- double yMin;
- double yMax;
-} DBBox;
-
-typedef struct {
- double x;
- double y;
-} DVector;
-
-typedef struct free_list {
- void *object;
- struct free_list *next;
-} FreeList;
-
-typedef struct {
- int frame_width;
- int frame_height;
- double font_size_coeff; // font size multiplier
- double line_spacing; // additional line spacing (in frame pixels)
- int top_margin; // height of top margin. Everything except toptitles is shifted down by top_margin.
- int bottom_margin; // height of bottom margin. (frame_height - top_margin - bottom_margin) is original video height.
- int left_margin;
- int right_margin;
- int use_margins; // 0 - place all subtitles inside original frame
- // 1 - use margins for placing toptitles and subtitles
- double aspect; // frame aspect ratio, d_width / d_height.
- double storage_aspect; // pixel ratio of the source image
- ASS_Hinting hinting;
-
- char *default_font;
- char *default_family;
-} ASS_Settings;
-
-// a rendered event
-typedef struct {
- ASS_Image *imgs;
- int top, height, left, width;
- int detect_collisions;
- int shift_direction;
- ASS_Event *event;
-} EventImages;
-
-typedef enum {
- EF_NONE = 0,
- EF_KARAOKE,
- EF_KARAOKE_KF,
- EF_KARAOKE_KO
-} Effect;
-
-// describes a glyph
-// GlyphInfo and TextInfo are used for text centering and word-wrapping operations
-typedef struct {
- unsigned symbol;
- unsigned skip; // skip glyph when layouting text
- FT_Glyph glyph;
- FT_Glyph outline_glyph;
- Bitmap *bm; // glyph bitmap
- Bitmap *bm_o; // outline bitmap
- Bitmap *bm_s; // shadow bitmap
- FT_BBox bbox;
- FT_Vector pos;
- char linebreak; // the first (leading) glyph of some line ?
- uint32_t c[4]; // colors
- FT_Vector advance; // 26.6
- Effect effect_type;
- int effect_timing; // time duration of current karaoke word
- // after process_karaoke_effects: distance in pixels from the glyph origin.
- // part of the glyph to the left of it is displayed in a different color.
- int effect_skip_timing; // delay after the end of last karaoke word
- int asc, desc; // font max ascender and descender
- int be; // blur edges
- double blur; // gaussian blur
- double shadow_x;
- double shadow_y;
- double frx, fry, frz; // rotation
- double fax, fay; // text shearing
-
- BitmapHashKey hash_key;
-} GlyphInfo;
-
-typedef struct {
- double asc, desc;
-} LineInfo;
-
-typedef struct {
- GlyphInfo *glyphs;
- int length;
- LineInfo *lines;
- int n_lines;
- double height;
- int max_glyphs;
- int max_lines;
-} TextInfo;
-
-// Renderer state.
-// Values like current font face, color, screen position, clipping and so on are stored here.
-typedef struct {
- ASS_Event *event;
- ASS_Style *style;
-
- ASS_Font *font;
- char *font_path;
- double font_size;
- int flags; // decoration flags (underline/strike-through)
-
- FT_Stroker stroker;
- int alignment; // alignment overrides go here; if zero, style value will be used
- double frx, fry, frz;
- double fax, fay; // text shearing
- enum {
- EVENT_NORMAL, // "normal" top-, sub- or mid- title
- EVENT_POSITIONED, // happens after pos(,), margins are ignored
- EVENT_HSCROLL, // "Banner" transition effect, text_width is unlimited
- EVENT_VSCROLL // "Scroll up", "Scroll down" transition effects
- } evt_type;
- double pos_x, pos_y; // position
- double org_x, org_y; // origin
- char have_origin; // origin is explicitly defined; if 0, get_base_point() is used
- double scale_x, scale_y;
- double hspacing; // distance between letters, in pixels
- double border_x; // outline width
- double border_y;
- uint32_t c[4]; // colors(Primary, Secondary, so on) in RGBA
- int clip_x0, clip_y0, clip_x1, clip_y1;
- char clip_mode; // 1 = iclip
- char detect_collisions;
- uint32_t fade; // alpha from \fad
- char be; // blur edges
- double blur; // gaussian blur
- double shadow_x;
- double shadow_y;
- int drawing_mode; // not implemented; when != 0 text is discarded, except for style override tags
- ASS_Drawing *drawing; // current drawing
- ASS_Drawing *clip_drawing; // clip vector
- int clip_drawing_mode; // 0 = regular clip, 1 = inverse clip
-
- Effect effect_type;
- int effect_timing;
- int effect_skip_timing;
-
- enum {
- SCROLL_LR, // left-to-right
- SCROLL_RL,
- SCROLL_TB, // top-to-bottom
- SCROLL_BT
- } scroll_direction; // for EVENT_HSCROLL, EVENT_VSCROLL
- int scroll_shift;
-
- // face properties
- char *family;
- unsigned bold;
- unsigned italic;
- int treat_family_as_pattern;
- int wrap_style;
-} RenderContext;
-
-typedef struct {
- Hashmap *font_cache;
- Hashmap *glyph_cache;
- Hashmap *bitmap_cache;
- Hashmap *composite_cache;
- size_t glyph_max;
- size_t bitmap_max_size;
-} CacheStore;
-
-struct ass_renderer {
- ASS_Library *library;
- FT_Library ftlibrary;
- FCInstance *fontconfig_priv;
- ASS_Settings settings;
- int render_id;
- ASS_SynthPriv *synth_priv;
-
- ASS_Image *images_root; // rendering result is stored here
- ASS_Image *prev_images_root;
-
- EventImages *eimg; // temporary buffer for sorting rendered events
- int eimg_size; // allocated buffer size
-
- // frame-global data
- int width, height; // screen dimensions
- int orig_height; // frame height ( = screen height - margins )
- int orig_width; // frame width ( = screen width - margins )
- int orig_height_nocrop; // frame height ( = screen height - margins + cropheight)
- int orig_width_nocrop; // frame width ( = screen width - margins + cropwidth)
- ASS_Track *track;
- long long time; // frame's timestamp, ms
- double font_scale;
- double font_scale_x; // x scale applied to all glyphs to preserve text aspect ratio
- double border_scale;
-
- RenderContext state;
- TextInfo text_info;
- CacheStore cache;
-
- FreeList *free_head;
- FreeList *free_tail;
-};
-
-typedef struct render_priv {
- int top, height, left, width;
- int render_id;
-} RenderPriv;
-
-typedef struct {
- int x0;
- int y0;
- int x1;
- int y1;
-} Rect;
-
-typedef struct {
- int a, b; // top and height
- int ha, hb; // left and width
-} Segment;
-
-void reset_render_context(ASS_Renderer *render_priv);
-
-#endif /* LIBASS_RENDER_H */
diff --git a/libass/ass_strtod.c b/libass/ass_strtod.c
deleted file mode 100644
index 7b73630bc3..0000000000
--- a/libass/ass_strtod.c
+++ /dev/null
@@ -1,247 +0,0 @@
-/*
- * Copyright (c) 1988-1993 The Regents of the University of California.
- * Copyright (c) 1994 Sun Microsystems, Inc.
- *
- * Permission to use, copy, modify, and distribute this
- * software and its documentation for any purpose and without
- * fee is hereby granted, provided that the above copyright
- * notice appear in all copies. The University of California
- * makes no representations about the suitability of this
- * software for any purpose. It is provided "as is" without
- * express or implied warranty.
- *
- */
-
-#include <stdlib.h>
-#include <ctype.h>
-#include <errno.h>
-
-static int maxExponent = 511; /* Largest possible base 10 exponent. Any
- * exponent larger than this will already
- * produce underflow or overflow, so there's
- * no need to worry about additional digits.
- */
-
-static double powersOf10[] = { /* Table giving binary powers of 10. Entry */
- 10., /* is 10^2^i. Used to convert decimal */
- 100., /* exponents into floating-point numbers. */
- 1.0e4,
- 1.0e8,
- 1.0e16,
- 1.0e32,
- 1.0e64,
- 1.0e128,
- 1.0e256
-};
-
-/*
- *----------------------------------------------------------------------
- *
- * strtod --
- *
- * This procedure converts a floating-point number from an ASCII
- * decimal representation to internal double-precision format.
- *
- * Results:
- * The return value is the double-precision floating-point
- * representation of the characters in string. If endPtr isn't
- * NULL, then *endPtr is filled in with the address of the
- * next character after the last one that was part of the
- * floating-point number.
- *
- * Side effects:
- * None.
- *
- *----------------------------------------------------------------------
- */
-
-double
-ass_strtod(string, endPtr)
- const char *string; /* A decimal ASCII floating-point number,
- * optionally preceded by white space.
- * Must have form "-I.FE-X", where I is the
- * integer part of the mantissa, F is the
- * fractional part of the mantissa, and X
- * is the exponent. Either of the signs
- * may be "+", "-", or omitted. Either I
- * or F may be omitted, or both. The decimal
- * point isn't necessary unless F is present.
- * The "E" may actually be an "e". E and X
- * may both be omitted (but not just one).
- */
- char **endPtr; /* If non-NULL, store terminating character's
- * address here. */
-{
- int sign, expSign = 0;
- double fraction, dblExp, *d;
- register const char *p;
- register int c;
- int exp = 0; /* Exponent read from "EX" field. */
- int fracExp = 0; /* Exponent that derives from the fractional
- * part. Under normal circumstatnces, it is
- * the negative of the number of digits in F.
- * However, if I is very long, the last digits
- * of I get dropped (otherwise a long I with a
- * large negative exponent could cause an
- * unnecessary overflow on I alone). In this
- * case, fracExp is incremented one for each
- * dropped digit. */
- int mantSize; /* Number of digits in mantissa. */
- int decPt; /* Number of mantissa digits BEFORE decimal
- * point. */
- const char *pExp; /* Temporarily holds location of exponent
- * in string. */
-
- /*
- * Strip off leading blanks and check for a sign.
- */
-
- p = string;
- while (isspace(*p)) {
- p += 1;
- }
- if (*p == '-') {
- sign = 1;
- p += 1;
- } else {
- if (*p == '+') {
- p += 1;
- }
- sign = 0;
- }
-
- /*
- * Count the number of digits in the mantissa (including the decimal
- * point), and also locate the decimal point.
- */
-
- decPt = -1;
- for (mantSize = 0; ; mantSize += 1)
- {
- c = *p;
- if (!isdigit(c)) {
- if ((c != '.') || (decPt >= 0)) {
- break;
- }
- decPt = mantSize;
- }
- p += 1;
- }
-
- /*
- * Now suck up the digits in the mantissa. Use two integers to
- * collect 9 digits each (this is faster than using floating-point).
- * If the mantissa has more than 18 digits, ignore the extras, since
- * they can't affect the value anyway.
- */
-
- pExp = p;
- p -= mantSize;
- if (decPt < 0) {
- decPt = mantSize;
- } else {
- mantSize -= 1; /* One of the digits was the point. */
- }
- if (mantSize > 18) {
- fracExp = decPt - 18;
- mantSize = 18;
- } else {
- fracExp = decPt - mantSize;
- }
- if (mantSize == 0) {
- fraction = 0.0;
- p = string;
- goto done;
- } else {
- int frac1, frac2;
- frac1 = 0;
- for ( ; mantSize > 9; mantSize -= 1)
- {
- c = *p;
- p += 1;
- if (c == '.') {
- c = *p;
- p += 1;
- }
- frac1 = 10*frac1 + (c - '0');
- }
- frac2 = 0;
- for (; mantSize > 0; mantSize -= 1)
- {
- c = *p;
- p += 1;
- if (c == '.') {
- c = *p;
- p += 1;
- }
- frac2 = 10*frac2 + (c - '0');
- }
- fraction = (1.0e9 * frac1) + frac2;
- }
-
- /*
- * Skim off the exponent.
- */
-
- p = pExp;
- if ((*p == 'E') || (*p == 'e')) {
- p += 1;
- if (*p == '-') {
- expSign = 1;
- p += 1;
- } else {
- if (*p == '+') {
- p += 1;
- }
- expSign = 0;
- }
- while (isdigit(*p)) {
- exp = exp * 10 + (*p - '0');
- p += 1;
- }
- }
- if (expSign) {
- exp = fracExp - exp;
- } else {
- exp = fracExp + exp;
- }
-
- /*
- * Generate a floating-point number that represents the exponent.
- * Do this by processing the exponent one bit at a time to combine
- * many powers of 2 of 10. Then combine the exponent with the
- * fraction.
- */
-
- if (exp < 0) {
- expSign = 1;
- exp = -exp;
- } else {
- expSign = 0;
- }
- if (exp > maxExponent) {
- exp = maxExponent;
- errno = ERANGE;
- }
- dblExp = 1.0;
- for (d = powersOf10; exp != 0; exp >>= 1, d += 1) {
- if (exp & 01) {
- dblExp *= *d;
- }
- }
- if (expSign) {
- fraction /= dblExp;
- } else {
- fraction *= dblExp;
- }
-
-done:
- if (endPtr != NULL) {
- *endPtr = (char *) p;
- }
-
- if (sign) {
- return -fraction;
- }
- return fraction;
-}
diff --git a/libass/ass_types.h b/libass/ass_types.h
deleted file mode 100644
index 63bc36c402..0000000000
--- a/libass/ass_types.h
+++ /dev/null
@@ -1,125 +0,0 @@
-/*
- * Copyright (C) 2006 Evgeniy Stepanov <eugeni.stepanov@gmail.com>
- *
- * This file is part of libass.
- *
- * libass 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.
- *
- * libass 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 libass; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#ifndef LIBASS_TYPES_H
-#define LIBASS_TYPES_H
-
-#include <stdint.h>
-
-#define VALIGN_SUB 0
-#define VALIGN_CENTER 8
-#define VALIGN_TOP 4
-#define HALIGN_LEFT 1
-#define HALIGN_CENTER 2
-#define HALIGN_RIGHT 3
-
-/* Opaque objects internally used by libass. Contents are private. */
-typedef struct ass_renderer ASS_Renderer;
-typedef struct render_priv ASS_RenderPriv;
-typedef struct parser_priv ASS_ParserPriv;
-typedef struct ass_library ASS_Library;
-
-/* ASS Style: line */
-typedef struct ass_style {
- char *Name;
- char *FontName;
- double FontSize;
- uint32_t PrimaryColour;
- uint32_t SecondaryColour;
- uint32_t OutlineColour;
- uint32_t BackColour;
- int Bold;
- int Italic;
- int Underline;
- int StrikeOut;
- double ScaleX;
- double ScaleY;
- double Spacing;
- int Angle;
- int BorderStyle;
- double Outline;
- double Shadow;
- int Alignment;
- int MarginL;
- int MarginR;
- int MarginV;
- int Encoding;
- int treat_fontname_as_pattern;
-} ASS_Style;
-
-/*
- * ASS_Event corresponds to a single Dialogue line;
- * text is stored as-is, style overrides will be parsed later.
- */
-typedef struct ass_event {
- long long Start; // ms
- long long Duration; // ms
-
- int ReadOrder;
- int Layer;
- int Style;
- char *Name;
- int MarginL;
- int MarginR;
- int MarginV;
- char *Effect;
- char *Text;
-
- ASS_RenderPriv *render_priv;
-} ASS_Event;
-
-/*
- * ass track represent either an external script or a matroska subtitle stream
- * (no real difference between them); it can be used in rendering after the
- * headers are parsed (i.e. events format line read).
- */
-typedef struct ass_track {
- int n_styles; // amount used
- int max_styles; // amount allocated
- int n_events;
- int max_events;
- ASS_Style *styles; // array of styles, max_styles length, n_styles used
- ASS_Event *events; // the same as styles
-
- char *style_format; // style format line (everything after "Format: ")
- char *event_format; // event format line
-
- enum {
- TRACK_TYPE_UNKNOWN = 0,
- TRACK_TYPE_ASS,
- TRACK_TYPE_SSA
- } track_type;
-
- // Script header fields
- int PlayResX;
- int PlayResY;
- double Timer;
- int WrapStyle;
- int ScaledBorderAndShadow;
- int Kerning;
-
- int default_style; // index of default style
- char *name; // file name in case of external subs, 0 for streams
-
- ASS_Library *library;
- ASS_ParserPriv *parser_priv;
-} ASS_Track;
-
-#endif /* LIBASS_TYPES_H */
diff --git a/libass/ass_utils.c b/libass/ass_utils.c
deleted file mode 100644
index 59fdbdfb94..0000000000
--- a/libass/ass_utils.c
+++ /dev/null
@@ -1,207 +0,0 @@
-/*
- * Copyright (C) 2006 Evgeniy Stepanov <eugeni.stepanov@gmail.com>
- *
- * This file is part of libass.
- *
- * libass 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.
- *
- * libass 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 libass; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#include "config.h"
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <inttypes.h>
-#include <ft2build.h>
-#include FT_GLYPH_H
-
-#include "ass_library.h"
-#include "ass.h"
-#include "ass_utils.h"
-
-int mystrtoi(char **p, int *res)
-{
- double temp_res;
- char *start = *p;
- temp_res = ass_strtod(*p, p);
- *res = (int) (temp_res + (temp_res > 0 ? 0.5 : -0.5));
- if (*p != start)
- return 1;
- else
- return 0;
-}
-
-int mystrtoll(char **p, long long *res)
-{
- double temp_res;
- char *start = *p;
- temp_res = ass_strtod(*p, p);
- *res = (int) (temp_res + (temp_res > 0 ? 0.5 : -0.5));
- if (*p != start)
- return 1;
- else
- return 0;
-}
-
-int mystrtou32(char **p, int base, uint32_t *res)
-{
- char *start = *p;
- *res = strtoll(*p, p, base);
- if (*p != start)
- return 1;
- else
- return 0;
-}
-
-int mystrtod(char **p, double *res)
-{
- char *start = *p;
- *res = ass_strtod(*p, p);
- if (*p != start)
- return 1;
- else
- return 0;
-}
-
-int strtocolor(ASS_Library *library, char **q, uint32_t *res, int hex)
-{
- uint32_t color = 0;
- int result;
- char *p = *q;
- int base = hex ? 16 : 10;
-
- if (*p == '&')
- ++p;
- else
- ass_msg(library, MSGL_DBG2, "suspicious color format: \"%s\"\n", p);
-
- if (*p == 'H' || *p == 'h') {
- ++p;
- result = mystrtou32(&p, 16, &color);
- } else {
- result = mystrtou32(&p, base, &color);
- }
-
- {
- unsigned char *tmp = (unsigned char *) (&color);
- unsigned char b;
- b = tmp[0];
- tmp[0] = tmp[3];
- tmp[3] = b;
- b = tmp[1];
- tmp[1] = tmp[2];
- tmp[2] = b;
- }
- if (*p == '&')
- ++p;
- *q = p;
-
- *res = color;
- return result;
-}
-
-// Return a boolean value for a string
-char parse_bool(char *str)
-{
- while (*str == ' ' || *str == '\t')
- str++;
- if (!strncasecmp(str, "yes", 3))
- return 1;
- else if (strtol(str, NULL, 10) > 0)
- return 1;
- return 0;
-}
-
-void ass_msg(ASS_Library *priv, int lvl, char *fmt, ...)
-{
- va_list va;
- va_start(va, fmt);
- priv->msg_callback(lvl, fmt, va, priv->msg_callback_data);
- va_end(va);
-}
-
-unsigned ass_utf8_get_char(char **str)
-{
- uint8_t *strp = (uint8_t *) * str;
- unsigned c = *strp++;
- unsigned mask = 0x80;
- int len = -1;
- while (c & mask) {
- mask >>= 1;
- len++;
- }
- if (len <= 0 || len > 4)
- goto no_utf8;
- c &= mask - 1;
- while ((*strp & 0xc0) == 0x80) {
- if (len-- <= 0)
- goto no_utf8;
- c = (c << 6) | (*strp++ & 0x3f);
- }
- if (len)
- goto no_utf8;
- *str = (char *) strp;
- return c;
-
- no_utf8:
- strp = (uint8_t *) * str;
- c = *strp++;
- *str = (char *) strp;
- return c;
-}
-
-#ifdef CONFIG_ENCA
-void *ass_guess_buffer_cp(ASS_Library *library, unsigned char *buffer,
- int buflen, char *preferred_language,
- char *fallback)
-{
- const char **languages;
- size_t langcnt;
- EncaAnalyser analyser;
- EncaEncoding encoding;
- char *detected_sub_cp = NULL;
- int i;
-
- languages = enca_get_languages(&langcnt);
- ass_msg(library, MSGL_V, "ENCA supported languages");
- for (i = 0; i < langcnt; i++) {
- ass_msg(library, MSGL_V, "lang %s", languages[i]);
- }
-
- for (i = 0; i < langcnt; i++) {
- const char *tmp;
-
- if (strcasecmp(languages[i], preferred_language) != 0)
- continue;
- analyser = enca_analyser_alloc(languages[i]);
- encoding = enca_analyse_const(analyser, buffer, buflen);
- tmp = enca_charset_name(encoding.charset, ENCA_NAME_STYLE_ICONV);
- if (tmp && encoding.charset != ENCA_CS_UNKNOWN) {
- detected_sub_cp = strdup(tmp);
- ass_msg(library, MSGL_INFO, "ENCA detected charset: %s", tmp);
- }
- enca_analyser_free(analyser);
- }
-
- free(languages);
-
- if (!detected_sub_cp) {
- detected_sub_cp = strdup(fallback);
- ass_msg(library, MSGL_INFO,
- "ENCA detection failed: fallback to %s", fallback);
- }
-
- return detected_sub_cp;
-}
-#endif
diff --git a/libass/ass_utils.h b/libass/ass_utils.h
deleted file mode 100644
index ad8574c1d6..0000000000
--- a/libass/ass_utils.h
+++ /dev/null
@@ -1,147 +0,0 @@
-/*
- * Copyright (C) 2006 Evgeniy Stepanov <eugeni.stepanov@gmail.com>
- *
- * This file is part of libass.
- *
- * libass 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.
- *
- * libass 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 libass; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#ifndef LIBASS_UTILS_H
-#define LIBASS_UTILS_H
-
-#include <stdio.h>
-#include <stdarg.h>
-#include <stdint.h>
-#include <stdlib.h>
-#include <string.h>
-#include <assert.h>
-
-#ifdef CONFIG_ENCA
-#include <enca.h>
-#endif
-
-#include "ass.h"
-
-#define MSGL_FATAL 0
-#define MSGL_ERR 1
-#define MSGL_WARN 2
-#define MSGL_INFO 4
-#define MSGL_V 6
-#define MSGL_DBG2 7
-
-#define FFMAX(a,b) ((a) > (b) ? (a) : (b))
-#define FFMIN(a,b) ((a) > (b) ? (b) : (a))
-#define FFMINMAX(c,a,b) FFMIN(FFMAX(c, a), b)
-
-int mystrtoi(char **p, int *res);
-int mystrtoll(char **p, long long *res);
-int mystrtou32(char **p, int base, uint32_t *res);
-int mystrtod(char **p, double *res);
-int strtocolor(ASS_Library *library, char **q, uint32_t *res, int hex);
-char parse_bool(char *str);
-unsigned ass_utf8_get_char(char **str);
-void ass_msg(ASS_Library *priv, int lvl, char *fmt, ...);
-#ifdef CONFIG_ENCA
-void *ass_guess_buffer_cp(ASS_Library *library, unsigned char *buffer,
- int buflen, char *preferred_language,
- char *fallback);
-#endif
-
-/* defined in ass_strtod.c */
-double ass_strtod(const char *string, char **endPtr);
-
-static inline int d6_to_int(int x)
-{
- return (x + 32) >> 6;
-}
-static inline int d16_to_int(int x)
-{
- return (x + 32768) >> 16;
-}
-static inline int int_to_d6(int x)
-{
- return x << 6;
-}
-static inline int int_to_d16(int x)
-{
- return x << 16;
-}
-static inline int d16_to_d6(int x)
-{
- return (x + 512) >> 10;
-}
-static inline int d6_to_d16(int x)
-{
- return x << 10;
-}
-static inline double d6_to_double(int x)
-{
- return x / 64.;
-}
-static inline int double_to_d6(double x)
-{
- return (int) (x * 64);
-}
-static inline double d16_to_double(int x)
-{
- return ((double) x) / 0x10000;
-}
-static inline int double_to_d16(double x)
-{
- return (int) (x * 0x10000);
-}
-static inline double d22_to_double(int x)
-{
- return ((double) x) / 0x400000;
-}
-static inline int double_to_d22(double x)
-{
- return (int) (x * 0x400000);
-}
-
-// Calculate cache key for a rotational angle in degrees
-static inline int rot_key(double a)
-{
- const int m = double_to_d22(360.0);
- return double_to_d22(a) % m;
-}
-
-#define FNV1_32A_INIT (unsigned)0x811c9dc5
-
-static inline unsigned fnv_32a_buf(void *buf, size_t len, unsigned hval)
-{
- unsigned char *bp = buf;
- unsigned char *be = bp + len;
- while (bp < be) {
- hval ^= (unsigned) *bp++;
- hval +=
- (hval << 1) + (hval << 4) + (hval << 7) + (hval << 8) +
- (hval << 24);
- }
- return hval;
-}
-static inline unsigned fnv_32a_str(char *str, unsigned hval)
-{
- unsigned char *s = (unsigned char *) str;
- while (*s) {
- hval ^= (unsigned) *s++;
- hval +=
- (hval << 1) + (hval << 4) + (hval << 7) + (hval << 8) +
- (hval << 24);
- }
- return hval;
-}
-
-#endif /* LIBASS_UTILS_H */
diff --git a/libass/mputils.h b/libass/mputils.h
deleted file mode 100644
index cff269357f..0000000000
--- a/libass/mputils.h
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Copyright (C) 2006 Evgeniy Stepanov <eugeni.stepanov@gmail.com>
- *
- * This file is part of libass.
- *
- * libass 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.
- *
- * libass 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 libass; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#ifndef LIBASS_MPUTILS_H
-#define LIBASS_MPUTILS_H
-
-#include "mp_msg.h"
-#include "help_mp.h"
-#include "libvo/font_load.h" // for blur()
-#include "subreader.h" // for guess_buffer_cp
-#include "libvo/sub.h" // for utf8_get_char
-#include "libavutil/common.h"
-
-#endif /* LIBASS_MPUTILS_H */
diff --git a/libmenu/menu.c b/libmenu/menu.c
index c8cf349c94..3ba54be45c 100644
--- a/libmenu/menu.c
+++ b/libmenu/menu.c
@@ -88,13 +88,15 @@ double menu_mouse_y = -1.0;
int menu_mouse_pos_updated = 0;
static struct MPContext *menu_ctx = NULL;
+static struct m_config *menu_mconfig = NULL;
+static struct input_ctx *menu_input = NULL;
static menu_def_t* menu_list = NULL;
static int menu_count = 0;
static menu_cmd_bindings_t *cmd_bindings = NULL;
static int cmd_bindings_num = 0;
-menu_cmd_bindings_t *get_cmd_bindings(const char *name) {
+static menu_cmd_bindings_t *get_cmd_bindings(const char *name) {
int i;
for (i = 0; i < cmd_bindings_num; ++i)
if (!strcasecmp(cmd_bindings[i].name, name))
@@ -102,16 +104,17 @@ menu_cmd_bindings_t *get_cmd_bindings(const char *name) {
return NULL;
}
-static int menu_parse_config(char* buffer) {
+static int menu_parse_config(char* buffer, struct m_config *mconfig)
+{
char *element,*body, **attribs, *name;
menu_info_t* minfo = NULL;
int r,i;
- ASX_Parser_t* parser = asx_parser_new();
+ ASX_Parser_t* parser = asx_parser_new(mconfig);
while(1) {
r = asx_get_element(parser,&buffer,&element,&body,&attribs);
if(r < 0) {
- mp_msg(MSGT_GLOBAL,MSGL_WARN,MSGTR_LIBMENU_SyntaxErrorAtLine,parser->line);
+ mp_tmsg(MSGT_GLOBAL,MSGL_WARN,"[MENU] syntax error at line: %d\n",parser->line);
asx_parser_free(parser);
return 0;
} else if(r == 0) {
@@ -121,7 +124,7 @@ static int menu_parse_config(char* buffer) {
// Has it a name ?
name = asx_get_attrib("name",attribs);
if(!name) {
- mp_msg(MSGT_GLOBAL,MSGL_WARN,MSGTR_LIBMENU_MenuDefinitionsNeedANameAttrib,parser->line);
+ mp_tmsg(MSGT_GLOBAL,MSGL_WARN,"[MENU] Menu definitions need a name attribute (line %d).\n",parser->line);
free(element);
if(body) free(body);
asx_free_attribs(attribs);
@@ -153,7 +156,7 @@ static int menu_parse_config(char* buffer) {
for(;;) {
r = asx_get_element(parser,&bd,&element,&b,&attribs);
if(r < 0) {
- mp_msg(MSGT_GLOBAL,MSGL_WARN,MSGTR_LIBMENU_SyntaxErrorAtLine,
+ mp_tmsg(MSGT_GLOBAL,MSGL_WARN,"[MENU] syntax error at line: %d\n",
parser->line);
free(body);
asx_parser_free(parser);
@@ -206,13 +209,13 @@ static int menu_parse_config(char* buffer) {
for(i = 0 ; attribs[2*i] ; i++) {
if(strcasecmp(attribs[2*i],"name") == 0) continue;
if(!m_struct_set(&minfo->priv_st,menu_list[menu_count].cfg,attribs[2*i], attribs[2*i+1]))
- mp_msg(MSGT_GLOBAL,MSGL_WARN,MSGTR_LIBMENU_BadAttrib,attribs[2*i],attribs[2*i+1],
+ mp_tmsg(MSGT_GLOBAL,MSGL_WARN,"[MENU] bad attribute %s=%s in menu '%s' at line %d\n",attribs[2*i],attribs[2*i+1],
name,parser->line);
}
menu_count++;
memset(&menu_list[menu_count],0,sizeof(menu_def_t));
} else {
- mp_msg(MSGT_GLOBAL,MSGL_WARN,MSGTR_LIBMENU_UnknownMenuType,element,parser->line);
+ mp_tmsg(MSGT_GLOBAL,MSGL_WARN,"[MENU] unknown menu type '%s' at line %d\n",element,parser->line);
free(name);
if(body) free(body);
}
@@ -228,7 +231,9 @@ static int menu_parse_config(char* buffer) {
#define BUF_STEP 1024
#define BUF_MIN 128
#define BUF_MAX BUF_STEP*1024
-int menu_init(struct MPContext *mpctx, char* cfg_file) {
+int menu_init(struct MPContext *mpctx, struct m_config *mconfig,
+ struct input_ctx *input_ctx, char* cfg_file)
+{
char* buffer = NULL;
int bl = BUF_STEP, br = 0;
int f, fd;
@@ -238,7 +243,7 @@ int menu_init(struct MPContext *mpctx, char* cfg_file) {
#endif
fd = open(cfg_file, O_RDONLY);
if(fd < 0) {
- mp_msg(MSGT_GLOBAL,MSGL_WARN,MSGTR_LIBMENU_CantOpenConfigFile,cfg_file);
+ mp_tmsg(MSGT_GLOBAL,MSGL_WARN,"[MENU] Can't open menu config file: %s\n",cfg_file);
return 0;
}
buffer = malloc(bl);
@@ -246,7 +251,7 @@ int menu_init(struct MPContext *mpctx, char* cfg_file) {
int r;
if(bl - br < BUF_MIN) {
if(bl >= BUF_MAX) {
- mp_msg(MSGT_GLOBAL,MSGL_WARN,MSGTR_LIBMENU_ConfigFileIsTooBig,BUF_MAX/1024);
+ mp_tmsg(MSGT_GLOBAL,MSGL_WARN,"[MENU] Config file is too big (> %d KB)\n",BUF_MAX/1024);
close(fd);
free(buffer);
return 0;
@@ -259,7 +264,7 @@ int menu_init(struct MPContext *mpctx, char* cfg_file) {
br += r;
}
if(!br) {
- mp_msg(MSGT_GLOBAL,MSGL_WARN,MSGTR_LIBMENU_ConfigFileIsEmpty);
+ mp_tmsg(MSGT_GLOBAL,MSGL_WARN,"[MENU] Config file is empty.\n");
return 0;
}
buffer[br-1] = '\0';
@@ -267,7 +272,9 @@ int menu_init(struct MPContext *mpctx, char* cfg_file) {
close(fd);
menu_ctx = mpctx;
- f = menu_parse_config(buffer);
+ menu_mconfig = mconfig;
+ menu_input = input_ctx;
+ f = menu_parse_config(buffer, mconfig);
free(buffer);
return f;
}
@@ -303,7 +310,8 @@ int menu_dflt_read_key(menu_t* menu,int cmd) {
for (i = 0; i < bindings->binding_num; ++i) {
if (bindings->bindings[i].key == cmd) {
if (bindings->bindings[i].cmd)
- mp_input_parse_and_queue_cmds(bindings->bindings[i].cmd);
+ mp_input_parse_and_queue_cmds(menu->input_ctx,
+ bindings->bindings[i].cmd);
return 1;
}
}
@@ -321,20 +329,22 @@ menu_t* menu_open(char *name) {
break;
}
if(menu_list[i].name == NULL) {
- mp_msg(MSGT_GLOBAL,MSGL_WARN,MSGTR_LIBMENU_MenuNotFound,name);
+ mp_tmsg(MSGT_GLOBAL,MSGL_WARN,"[MENU] Menu %s not found.\n",name);
return NULL;
}
m = calloc(1,sizeof(menu_t));
m->priv_st = &(menu_list[i].type->priv_st);
m->priv = m_struct_copy(m->priv_st,menu_list[i].cfg);
m->ctx = menu_ctx;
+ m->mconfig = menu_mconfig;
+ m->input_ctx = menu_input;
m->type = &menu_list[i];
if(menu_list[i].type->open(m,menu_list[i].args))
return m;
if(m->priv)
m_struct_free(m->priv_st,m->priv);
free(m);
- mp_msg(MSGT_GLOBAL,MSGL_WARN,MSGTR_LIBMENU_MenuInitFailed,name);
+ mp_tmsg(MSGT_GLOBAL,MSGL_WARN,"[MENU] Menu '%s': Init failed.\n",name);
return NULL;
}
@@ -472,7 +482,7 @@ void menu_draw_text(mp_image_t* mpi,char* txt, int x, int y) {
int font;
if(!draw_alpha) {
- mp_msg(MSGT_GLOBAL,MSGL_WARN,MSGTR_LIBMENU_UnsupportedOutformat);
+ mp_tmsg(MSGT_GLOBAL,MSGL_WARN,"[MENU] Unsupported output format!!!!\n");
return;
}
@@ -506,7 +516,7 @@ void menu_draw_text_full(mp_image_t* mpi,char* txt,
draw_alpha_f draw_alpha = get_draw_alpha(mpi->imgfmt);
if(!draw_alpha) {
- mp_msg(MSGT_GLOBAL,MSGL_WARN,MSGTR_LIBMENU_UnsupportedOutformat);
+ mp_tmsg(MSGT_GLOBAL,MSGL_WARN,"[MENU] Unsupported output format!!!!\n");
return;
}
@@ -725,7 +735,7 @@ int menu_text_num_lines(char* txt, int max_width) {
return l;
}
-char* menu_text_get_next_line(char* txt, int max_width) {
+static char* menu_text_get_next_line(char* txt, int max_width) {
int i = 0;
render_txt(txt);
while (*txt) {
@@ -748,7 +758,7 @@ void menu_draw_box(mp_image_t* mpi,unsigned char grey,unsigned char alpha, int x
int g;
if(!draw_alpha) {
- mp_msg(MSGT_GLOBAL,MSGL_WARN,MSGTR_LIBMENU_UnsupportedOutformat);
+ mp_tmsg(MSGT_GLOBAL,MSGL_WARN,"[MENU] Unsupported output format!!!!\n");
return;
}
diff --git a/libmenu/menu.h b/libmenu/menu.h
index d29091a4ae..cc76b5b7a3 100644
--- a/libmenu/menu.h
+++ b/libmenu/menu.h
@@ -31,6 +31,8 @@ struct m_struct_st;
struct menu_s {
struct MPContext *ctx;
+ struct m_config *mconfig;
+ struct input_ctx *input_ctx;
void (*draw)(menu_t* menu,mp_image_t* mpi);
void (*read_cmd)(menu_t* menu,int cmd);
int (*read_key)(menu_t* menu,int cmd);
@@ -70,7 +72,8 @@ typedef struct menu_info_s {
#define MENU_CMD_CLICK 11
/// Global init/uninit
-int menu_init(struct MPContext *mpctx, char* cfg_file);
+int menu_init(struct MPContext *mpctx, struct m_config *mconfig,
+ struct input_ctx *input_ctx, char* cfg_file);
void menu_uninit(void);
/// Open a menu defined in the config file
diff --git a/libmenu/menu_chapsel.c b/libmenu/menu_chapsel.c
index 01fcd25550..f350655311 100644
--- a/libmenu/menu_chapsel.c
+++ b/libmenu/menu_chapsel.c
@@ -141,9 +141,9 @@ static void read_cmd (menu_t* menu, int cmd)
case MENU_CMD_OK: {
char cmdbuf[26];
sprintf(cmdbuf, "seek_chapter %d 1", menu->priv->p.current->cid);
- mp_input_queue_cmd(mp_input_parse_cmd(cmdbuf));
+ mp_input_queue_cmd(menu->input_ctx, mp_input_parse_cmd(cmdbuf));
if (menu->priv->auto_close)
- mp_input_queue_cmd(mp_input_parse_cmd("menu hide"));
+ mp_input_queue_cmd(menu->input_ctx, mp_input_parse_cmd("menu hide"));
break;
}
default:
diff --git a/libmenu/menu_cmdlist.c b/libmenu/menu_cmdlist.c
index e146a4e9db..60146e31f1 100644
--- a/libmenu/menu_cmdlist.c
+++ b/libmenu/menu_cmdlist.c
@@ -71,21 +71,21 @@ static void read_cmd(menu_t* menu,int cmd) {
switch(cmd) {
case MENU_CMD_RIGHT:
if(mpriv->p.current->right) {
- mp_input_parse_and_queue_cmds(mpriv->p.current->right);
+ mp_input_parse_and_queue_cmds(menu->input_ctx, mpriv->p.current->right);
break;
} // fallback on ok if right is not defined
case MENU_CMD_OK:
if (mpriv->p.current->ok)
- mp_input_parse_and_queue_cmds(mpriv->p.current->ok);
+ mp_input_parse_and_queue_cmds(menu->input_ctx, mpriv->p.current->ok);
break;
case MENU_CMD_LEFT:
if(mpriv->p.current->left) {
- mp_input_parse_and_queue_cmds(mpriv->p.current->left);
+ mp_input_parse_and_queue_cmds(menu->input_ctx, mpriv->p.current->left);
break;
} // fallback on cancel if left is not defined
case MENU_CMD_CANCEL:
if(mpriv->p.current->cancel) {
- mp_input_parse_and_queue_cmds(mpriv->p.current->cancel);
+ mp_input_parse_and_queue_cmds(menu->input_ctx, mpriv->p.current->cancel);
break;
}
default:
@@ -114,24 +114,24 @@ static int parse_args(menu_t* menu,char* args) {
char *element,*body, **attribs, *name;
list_entry_t* m = NULL;
int r;
- ASX_Parser_t* parser = asx_parser_new();
+ ASX_Parser_t* parser = asx_parser_new(menu->mconfig);
while(1) {
r = asx_get_element(parser,&args,&element,&body,&attribs);
if(r < 0) {
- mp_msg(MSGT_GLOBAL,MSGL_WARN,MSGTR_LIBMENU_SyntaxErrorAtLine,parser->line);
+ mp_tmsg(MSGT_GLOBAL,MSGL_WARN,"[MENU] syntax error at line: %d\n",parser->line);
asx_parser_free(parser);
return -1;
} else if(r == 0) {
asx_parser_free(parser);
if(!m)
- mp_msg(MSGT_GLOBAL,MSGL_WARN,MSGTR_LIBMENU_NoEntryFoundInTheMenuDefinition);
+ mp_tmsg(MSGT_GLOBAL,MSGL_WARN,"[MENU] No entry found in the menu definition.\n");
return m ? 1 : 0;
}
// Has it a name ?
name = asx_get_attrib("name",attribs);
if(!name) {
- mp_msg(MSGT_GLOBAL,MSGL_WARN,MSGTR_LIBMENU_ListMenuEntryDefinitionsNeedAName,parser->line);
+ mp_tmsg(MSGT_GLOBAL,MSGL_WARN,"[MENU] List menu entry definitions need a name (line %d).\n",parser->line);
free(element);
if(body) free(body);
asx_free_attribs(attribs);
@@ -157,7 +157,7 @@ static int open_cmdlist(menu_t* menu, char* args) {
menu->close = close_menu;
if(!args) {
- mp_msg(MSGT_GLOBAL,MSGL_WARN,MSGTR_LIBMENU_ListMenuNeedsAnArgument);
+ mp_tmsg(MSGT_GLOBAL,MSGL_WARN,"[MENU] List menu needs an argument.\n");
return 0;
}
diff --git a/libmenu/menu_console.c b/libmenu/menu_console.c
index db0ab2d7db..8070ff63a3 100644
--- a/libmenu/menu_console.c
+++ b/libmenu/menu_console.c
@@ -265,10 +265,10 @@ static void check_child(menu_t* menu) {
mpriv->prompt = mpriv->mp_prompt;
//add_line(mpriv,"Child process exited");
}
- else mp_msg(MSGT_GLOBAL,MSGL_ERR,MSGTR_LIBMENU_WaitPidError,strerror(errno));
+ else mp_tmsg(MSGT_GLOBAL,MSGL_ERR,"[MENU] Waitpid error: %s.\n",strerror(errno));
}
} else if(r < 0) {
- mp_msg(MSGT_GLOBAL,MSGL_ERR,MSGTR_LIBMENU_SelectError);
+ mp_tmsg(MSGT_GLOBAL,MSGL_ERR,"[MENU] Select error.\n");
return;
}
@@ -278,7 +278,7 @@ static void check_child(menu_t* menu) {
if(w) mpriv->add_line = 1;
r = read(mpriv->child_fd[i],buffer,255);
if(r < 0)
- mp_msg(MSGT_GLOBAL,MSGL_ERR,MSGTR_LIBMENU_ReadErrorOnChildFD, i == 1 ? "stdout":"stderr");
+ mp_tmsg(MSGT_GLOBAL,MSGL_ERR,"[MENU] Read error on child's file descriptor: %s.\n", i == 1 ? "stdout":"stderr");
else if(r>0) {
buffer[r] = '\0';
add_string(mpriv,buffer);
@@ -296,9 +296,9 @@ static int run_shell_cmd(menu_t* menu, char* cmd) {
#ifndef __MINGW32__
int in[2],out[2],err[2];
- mp_msg(MSGT_GLOBAL,MSGL_INFO,MSGTR_LIBMENU_ConsoleRun,cmd);
+ mp_tmsg(MSGT_GLOBAL,MSGL_INFO,"[MENU] Console run: %s ...\n",cmd);
if(mpriv->child) {
- mp_msg(MSGT_GLOBAL,MSGL_ERR,MSGTR_LIBMENU_AChildIsAlreadyRunning);
+ mp_tmsg(MSGT_GLOBAL,MSGL_ERR,"[MENU] A child is already running.\n");
return 0;
}
@@ -308,7 +308,7 @@ static int run_shell_cmd(menu_t* menu, char* cmd) {
mpriv->child = fork();
if(mpriv->child < 0) {
- mp_msg(MSGT_GLOBAL,MSGL_ERR,MSGTR_LIBMENU_ForkFailed);
+ mp_tmsg(MSGT_GLOBAL,MSGL_ERR,"[MENU] Fork failed !!!\n");
close_pipe(in);
close_pipe(out);
close_pipe(err);
@@ -382,14 +382,14 @@ static void read_cmd(menu_t* menu,int cmd) {
while(l > 0) {
int w = write(mpriv->child_fd[0],str,l);
if(w < 0) {
- mp_msg(MSGT_GLOBAL,MSGL_ERR,MSGTR_LIBMENU_WriteError);
+ mp_tmsg(MSGT_GLOBAL,MSGL_ERR,"[MENU] write error\n");
break;
}
l -= w;
str += w;
}
if(write(mpriv->child_fd[0],"\n",1) < 0)
- mp_msg(MSGT_GLOBAL,MSGL_ERR,MSGTR_LIBMENU_WriteError);
+ mp_tmsg(MSGT_GLOBAL,MSGL_ERR,"[MENU] write error\n");
enter_cmd(menu);
return;
}
@@ -420,7 +420,7 @@ static void read_cmd(menu_t* menu,int cmd) {
run_shell_cmd(menu,c->args[0].v.s);
break;
default: // Send the other commands to mplayer
- mp_input_queue_cmd(c);
+ mp_input_queue_cmd(menu->input_ctx, c);
}
}
return;
diff --git a/libmenu/menu_dvbin.c b/libmenu/menu_dvbin.c
index 0f84386f8c..e2b99a0f07 100644
--- a/libmenu/menu_dvbin.c
+++ b/libmenu/menu_dvbin.c
@@ -232,8 +232,8 @@ static void read_cmd(menu_t* menu, int cmd)
if(c)
{
if(mpriv->auto_close)
- mp_input_queue_cmd (mp_input_parse_cmd ("menu hide"));
- mp_input_queue_cmd(c);
+ mp_input_queue_cmd(menu->input_ctx, mp_input_parse_cmd ("menu hide"));
+ mp_input_queue_cmd(menu->input_ctx, c);
}
}
}
diff --git a/libmenu/menu_filesel.c b/libmenu/menu_filesel.c
index 1321702945..08507bec20 100644
--- a/libmenu/menu_filesel.c
+++ b/libmenu/menu_filesel.c
@@ -48,7 +48,6 @@
int menu_keepdir = 0;
char *menu_chroot = NULL;
-extern char *filename;
struct list_entry_s {
struct list_entry p;
@@ -250,7 +249,7 @@ static int open_dir(menu_t* menu,char* args) {
mpriv->p.title = replace_path(mpriv->title,mpriv->dir,0);
if ((dirp = opendir (mpriv->dir)) == NULL){
- mp_msg(MSGT_GLOBAL,MSGL_ERR,MSGTR_LIBMENU_OpendirError, strerror(errno));
+ mp_tmsg(MSGT_GLOBAL,MSGL_ERR,"[MENU] opendir error: %s\n", strerror(errno));
return 0;
}
@@ -292,7 +291,7 @@ static int open_dir(menu_t* menu,char* args) {
if(n%20 == 0){ // Get some more mem
if((tp = (char **) realloc(namelist, (n+20) * sizeof (char *)))
== NULL) {
- mp_msg(MSGT_GLOBAL,MSGL_ERR,MSGTR_LIBMENU_ReallocError, strerror(errno));
+ mp_tmsg(MSGT_GLOBAL,MSGL_ERR,"[MENU] realloc error: %s\n", strerror(errno));
n--;
goto bailout;
}
@@ -301,7 +300,7 @@ static int open_dir(menu_t* menu,char* args) {
namelist[n] = (char *) malloc(strlen(dp->d_name) + 2);
if(namelist[n] == NULL){
- mp_msg(MSGT_GLOBAL,MSGL_ERR,MSGTR_LIBMENU_MallocError, strerror(errno));
+ mp_tmsg(MSGT_GLOBAL,MSGL_ERR,"[MENU] memory allocation error: %s\n", strerror(errno));
n--;
goto bailout;
}
@@ -319,7 +318,7 @@ bailout:
qsort(namelist, n, sizeof(char *), (kill_warn)compare);
if (n < 0) {
- mp_msg(MSGT_GLOBAL,MSGL_ERR,MSGTR_LIBMENU_ReaddirError,strerror(errno));
+ mp_tmsg(MSGT_GLOBAL,MSGL_ERR,"[MENU] readdir error: %s\n",strerror(errno));
return 0;
}
while(n--) {
@@ -330,7 +329,7 @@ bailout:
e->d = 1;
menu_list_add_entry(menu,e);
}else{
- mp_msg(MSGT_GLOBAL,MSGL_ERR,MSGTR_LIBMENU_MallocError, strerror(errno));
+ mp_tmsg(MSGT_GLOBAL,MSGL_ERR,"[MENU] memory allocation error: %s\n", strerror(errno));
}
free(namelist[n]);
}
@@ -369,7 +368,7 @@ static void read_cmd(menu_t* menu,int cmd) {
}
menu_list_uninit(menu,free_entry);
if(!open_dir(menu,p)) {
- mp_msg(MSGT_GLOBAL,MSGL_ERR,MSGTR_LIBMENU_CantOpenDirectory,p);
+ mp_tmsg(MSGT_GLOBAL,MSGL_ERR,"[MENU] Can't open directory %s.\n",p);
menu->cl = 1;
}
free(p);
@@ -380,7 +379,7 @@ static void read_cmd(menu_t* menu,int cmd) {
char *action = mpriv->p.current->d ? mpriv->dir_action:mpriv->file_action;
sprintf(filename,"%s%s",mpriv->dir,mpriv->p.current->p.txt);
str = replace_path(action, filename,1);
- mp_input_parse_and_queue_cmds(str);
+ mp_input_parse_and_queue_cmds(menu->input_ctx, str);
if (str != action)
free(str);
}
@@ -391,7 +390,7 @@ static void read_cmd(menu_t* menu,int cmd) {
char *str;
sprintf(filename,"%s%s",mpriv->dir,mpriv->p.current->p.txt);
str = replace_path(action, filename,1);
- mp_input_parse_and_queue_cmds(str);
+ mp_input_parse_and_queue_cmds(menu->input_ctx, str);
if(str != action)
free(str);
} break;
diff --git a/libmenu/menu_list.c b/libmenu/menu_list.c
index 9264490b81..0fd6ffb2cf 100644
--- a/libmenu/menu_list.c
+++ b/libmenu/menu_list.c
@@ -332,4 +332,3 @@ void menu_list_uninit(menu_t* menu,free_entry_t free_func) {
mpriv->menu = mpriv->current = NULL;
}
-
diff --git a/libmenu/menu_param.c b/libmenu/menu_param.c
index 529cd49e2f..5052a26954 100644
--- a/libmenu/menu_param.c
+++ b/libmenu/menu_param.c
@@ -111,19 +111,19 @@ static int parse_args(menu_t* menu,char* args) {
list_entry_t* m = NULL;
int r;
m_option_t* opt;
- ASX_Parser_t* parser = asx_parser_new();
+ ASX_Parser_t* parser = asx_parser_new(menu->mconfig);
while(1) {
r = asx_get_element(parser,&args,&element,&body,&attribs);
if(r < 0) {
- mp_msg(MSGT_OSD_MENU,MSGL_ERR,MSGTR_LIBMENU_SyntaxErrorAtLine,parser->line);
+ mp_tmsg(MSGT_OSD_MENU,MSGL_ERR,"[MENU] syntax error at line: %d\n",parser->line);
asx_parser_free(parser);
return -1;
} else if(r == 0) {
asx_parser_free(parser);
if(!m)
- mp_msg(MSGT_OSD_MENU,MSGL_WARN,MSGTR_LIBMENU_NoEntryFoundInTheMenuDefinition);
+ mp_tmsg(MSGT_OSD_MENU,MSGL_WARN,"[MENU] No entry found in the menu definition.\n");
m = calloc(1,sizeof(struct list_entry_s));
m->p.txt = strdup("Back");
menu_list_add_entry(menu,m);
@@ -132,7 +132,7 @@ static int parse_args(menu_t* menu,char* args) {
if(!strcmp(element,"menu")) {
name = asx_get_attrib("menu",attribs);
if(!name) {
- mp_msg(MSGT_OSD_MENU,MSGL_WARN,MSGTR_LIBMENU_SubmenuDefinitionNeedAMenuAttribut);
+ mp_tmsg(MSGT_OSD_MENU,MSGL_WARN,"[MENU] Submenu definition needs a 'menu' attribute.\n");
goto next_element;
}
m = calloc(1,sizeof(struct list_entry_s));
@@ -147,13 +147,13 @@ static int parse_args(menu_t* menu,char* args) {
name = asx_get_attrib("property",attribs);
opt = NULL;
if(name && mp_property_do(name,M_PROPERTY_GET_TYPE,&opt,menu->ctx) <= 0) {
- mp_msg(MSGT_OSD_MENU,MSGL_WARN,MSGTR_LIBMENU_InvalidProperty,
+ mp_tmsg(MSGT_OSD_MENU,MSGL_WARN,"[MENU] Invalid property '%s' in pref menu entry. (line %d).\n",
name,parser->line);
goto next_element;
}
txt = asx_get_attrib("txt",attribs);
if(!(name || txt)) {
- mp_msg(MSGT_OSD_MENU,MSGL_WARN,MSGTR_LIBMENU_PrefMenuEntryDefinitionsNeed,parser->line);
+ mp_tmsg(MSGT_OSD_MENU,MSGL_WARN,"[MENU] Pref menu entry definitions need a valid 'property' or 'txt' attribute (line %d).\n",parser->line);
if(txt) free(txt), txt = NULL;
goto next_element;
}
@@ -236,7 +236,7 @@ static void read_cmd(menu_t* menu,int cmd) {
char* txt = malloc(10 + strlen(e->menu) + 1);
sprintf(txt,"set_menu %s",e->menu);
c = mp_input_parse_cmd(txt);
- if(c) mp_input_queue_cmd(c);
+ if(c) mp_input_queue_cmd(menu->input_ctx, c);
return;
}
}
@@ -278,7 +278,7 @@ static int openMenu(menu_t* menu, char* args) {
if(!args) {
- mp_msg(MSGT_OSD_MENU,MSGL_ERR,MSGTR_LIBMENU_PrefMenuNeedsAnArgument);
+ mp_tmsg(MSGT_OSD_MENU,MSGL_ERR,"[MENU] Pref menu needs an argument.\n");
return 0;
}
diff --git a/libmenu/menu_pt.c b/libmenu/menu_pt.c
index f5f9999492..a985b63176 100644
--- a/libmenu/menu_pt.c
+++ b/libmenu/menu_pt.c
@@ -98,7 +98,7 @@ static void read_cmd(menu_t* menu,int cmd) {
d--;
}
if(i == NULL) {
- mp_msg(MSGT_GLOBAL,MSGL_WARN,MSGTR_LIBMENU_CantfindTheTargetItem);
+ mp_tmsg(MSGT_GLOBAL,MSGL_WARN,"[MENU] Can't find the target item ????\n");
break;
}
}
@@ -107,11 +107,11 @@ static void read_cmd(menu_t* menu,int cmd) {
c = mp_input_parse_cmd(str);
if(c) {
if(mpriv->auto_close)
- mp_input_queue_cmd(mp_input_parse_cmd("menu hide"));
- mp_input_queue_cmd(c);
+ mp_input_queue_cmd(menu->input_ctx, mp_input_parse_cmd("menu hide"));
+ mp_input_queue_cmd(menu->input_ctx, c);
}
else
- mp_msg(MSGT_GLOBAL,MSGL_WARN,MSGTR_LIBMENU_FailedToBuildCommand,str);
+ mp_tmsg(MSGT_GLOBAL,MSGL_WARN,"[MENU] Failed to build command: %s.\n",str);
} break;
default:
menu_list_read_cmd(menu,cmd);
diff --git a/libmenu/menu_txt.c b/libmenu/menu_txt.c
index 30d0fcc98f..d7d2c874c5 100644
--- a/libmenu/menu_txt.c
+++ b/libmenu/menu_txt.c
@@ -141,13 +141,13 @@ static int open_txt(menu_t* menu, char* args) {
menu->read_cmd = read_cmd;
if(!mpriv->file) {
- mp_msg(MSGT_GLOBAL,MSGL_WARN,MSGTR_LIBMENU_MenuTxtNeedATxtFileName);
+ mp_tmsg(MSGT_GLOBAL,MSGL_WARN,"[MENU] Text menu needs a textfile name (parameter file).\n");
return 0;
}
fd = fopen(mpriv->file,"r");
if(!fd) {
- mp_msg(MSGT_GLOBAL,MSGL_WARN,MSGTR_LIBMENU_MenuTxtCantOpen,mpriv->file);
+ mp_tmsg(MSGT_GLOBAL,MSGL_WARN,"[MENU] Can't open %s.\n",mpriv->file);
return 0;
}
@@ -178,7 +178,7 @@ static int open_txt(menu_t* menu, char* args) {
mpriv->num_lines++;
}
if(pos >= BUF_SIZE-1) {
- mp_msg(MSGT_GLOBAL,MSGL_WARN,MSGTR_LIBMENU_WarningTooLongLineSplitting);
+ mp_tmsg(MSGT_GLOBAL,MSGL_WARN,"[MENU] Warning, line too long. Splitting it.\n");
mpriv->lines = realloc(mpriv->lines,(mpriv->num_lines + 1)*sizeof(char*));
mpriv->lines[mpriv->num_lines] = strdup(buf);
mpriv->num_lines++;
@@ -186,7 +186,7 @@ static int open_txt(menu_t* menu, char* args) {
}
}
- mp_msg(MSGT_GLOBAL,MSGL_INFO,MSGTR_LIBMENU_ParsedLines,mpriv->num_lines);
+ mp_tmsg(MSGT_GLOBAL,MSGL_INFO,"[MENU] Parsed %d lines.\n",mpriv->num_lines);
return 1;
}
diff --git a/libmenu/vf_menu.c b/libmenu/vf_menu.c
index 50c9ebfe1a..7f8ae84aca 100644
--- a/libmenu/vf_menu.c
+++ b/libmenu/vf_menu.c
@@ -54,15 +54,15 @@ struct vf_priv_s {
int passthrough;
};
-static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts);
+static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts);
-void vf_menu_pause_update(struct vf_instance_s* vf) {
- const vo_functions_t *video_out = mpctx_get_video_out(vf->priv->current->ctx);
+void vf_menu_pause_update(struct vf_instance* vf) {
+ const struct vo *video_out = mpctx_get_video_out(vf->priv->current->ctx);
if(pause_mpi) {
put_image(vf,pause_mpi, MP_NOPTS_VALUE);
// Don't draw the osd atm
//vf->control(vf,VFCTRL_DRAW_OSD,NULL);
- video_out->flip_page();
+ vo_flip_page(video_out, 0, -1);
}
}
@@ -99,7 +99,7 @@ static int cmd_filter(mp_cmd_t* cmd, int paused, struct vf_priv_s * priv) {
else if(strcmp(arg,"hide") == 0 || strcmp(arg,"toggle") == 0)
priv->current->show = 0;
else
- mp_msg(MSGT_GLOBAL,MSGL_WARN,MSGTR_LIBMENU_UnknownMenuCommand,arg);
+ mp_tmsg(MSGT_GLOBAL,MSGL_WARN,"[MENU] Unknown command: '%s'.\n",arg);
return 1;
}
case MP_CMD_SET_MENU : {
@@ -107,7 +107,7 @@ static int cmd_filter(mp_cmd_t* cmd, int paused, struct vf_priv_s * priv) {
menu_t* l = priv->current;
priv->current = menu_open(menu);
if(!priv->current) {
- mp_msg(MSGT_GLOBAL,MSGL_WARN,MSGTR_LIBMENU_FailedToOpenMenu,menu);
+ mp_tmsg(MSGT_GLOBAL,MSGL_WARN,"[MENU] Failed to open menu: '%s'.\n",menu);
priv->current = l;
priv->current->show = 0;
} else {
@@ -120,7 +120,7 @@ static int cmd_filter(mp_cmd_t* cmd, int paused, struct vf_priv_s * priv) {
return 0;
}
-static void get_image(struct vf_instance_s* vf, mp_image_t *mpi){
+static void get_image(struct vf_instance* vf, mp_image_t *mpi){
mp_image_t *dmpi;
if(mpi->type == MP_IMGTYPE_TEMP && (!(mpi->flags&MP_IMGFLAG_PRESERVE)) ) {
@@ -137,7 +137,7 @@ static int key_cb(int code) {
return menu_read_key(st_priv->current,code);
}
-static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
+static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts){
mp_image_t *dmpi = NULL;
if (vf->priv->passthrough) {
@@ -213,7 +213,7 @@ static void uninit(vf_instance_t *vf) {
}
}
-static int config(struct vf_instance_s* vf, int width, int height, int d_width, int d_height,
+static int config(struct vf_instance* vf, int width, int height, int d_width, int d_height,
unsigned int flags, unsigned int outfmt) {
#ifdef CONFIG_FREETYPE
// here is the right place to get screen dimensions
@@ -227,8 +227,8 @@ static int config(struct vf_instance_s* vf, int width, int height, int d_width,
return vf_next_config(vf,width,height,d_width,d_height,flags,outfmt);
}
-static int query_format(struct vf_instance_s* vf, unsigned int fmt){
- return vf_next_query_format(vf,fmt);
+static int query_format(struct vf_instance* vf, unsigned int fmt){
+ return vf_next_query_format(vf, fmt);
}
static int open_vf(vf_instance_t *vf, char* args){
@@ -264,6 +264,3 @@ vf_info_t vf_info_menu = {
open_vf,
NULL
};
-
-
-
diff --git a/libmpcodecs/ad.c b/libmpcodecs/ad.c
index 3b4fb87c1e..f81f11ef0f 100644
--- a/libmpcodecs/ad.c
+++ b/libmpcodecs/ad.c
@@ -32,34 +32,34 @@
/* Missed vorbis, mad, dshow */
//extern ad_functions_t mpcodecs_ad_null;
-extern ad_functions_t mpcodecs_ad_mp3lib;
-extern ad_functions_t mpcodecs_ad_ffmpeg;
-extern ad_functions_t mpcodecs_ad_liba52;
-extern ad_functions_t mpcodecs_ad_hwac3;
-extern ad_functions_t mpcodecs_ad_hwmpa;
-extern ad_functions_t mpcodecs_ad_pcm;
-extern ad_functions_t mpcodecs_ad_dvdpcm;
-extern ad_functions_t mpcodecs_ad_alaw;
-extern ad_functions_t mpcodecs_ad_imaadpcm;
-extern ad_functions_t mpcodecs_ad_msadpcm;
-extern ad_functions_t mpcodecs_ad_dk3adpcm;
-extern ad_functions_t mpcodecs_ad_dk4adpcm;
-extern ad_functions_t mpcodecs_ad_dshow;
-extern ad_functions_t mpcodecs_ad_dmo;
-extern ad_functions_t mpcodecs_ad_acm;
-extern ad_functions_t mpcodecs_ad_msgsm;
-extern ad_functions_t mpcodecs_ad_faad;
-extern ad_functions_t mpcodecs_ad_libvorbis;
-extern ad_functions_t mpcodecs_ad_speex;
-extern ad_functions_t mpcodecs_ad_libmad;
-extern ad_functions_t mpcodecs_ad_realaud;
-extern ad_functions_t mpcodecs_ad_libdv;
-extern ad_functions_t mpcodecs_ad_qtaudio;
-extern ad_functions_t mpcodecs_ad_twin;
-extern ad_functions_t mpcodecs_ad_libmusepack;
-extern ad_functions_t mpcodecs_ad_libdca;
+extern const ad_functions_t mpcodecs_ad_mp3lib;
+extern const ad_functions_t mpcodecs_ad_ffmpeg;
+extern const ad_functions_t mpcodecs_ad_liba52;
+extern const ad_functions_t mpcodecs_ad_hwac3;
+extern const ad_functions_t mpcodecs_ad_hwmpa;
+extern const ad_functions_t mpcodecs_ad_pcm;
+extern const ad_functions_t mpcodecs_ad_dvdpcm;
+extern const ad_functions_t mpcodecs_ad_alaw;
+extern const ad_functions_t mpcodecs_ad_imaadpcm;
+extern const ad_functions_t mpcodecs_ad_msadpcm;
+extern const ad_functions_t mpcodecs_ad_dk3adpcm;
+extern const ad_functions_t mpcodecs_ad_dk4adpcm;
+extern const ad_functions_t mpcodecs_ad_dshow;
+extern const ad_functions_t mpcodecs_ad_dmo;
+extern const ad_functions_t mpcodecs_ad_acm;
+extern const ad_functions_t mpcodecs_ad_msgsm;
+extern const ad_functions_t mpcodecs_ad_faad;
+extern const ad_functions_t mpcodecs_ad_libvorbis;
+extern const ad_functions_t mpcodecs_ad_speex;
+extern const ad_functions_t mpcodecs_ad_libmad;
+extern const ad_functions_t mpcodecs_ad_realaud;
+extern const ad_functions_t mpcodecs_ad_libdv;
+extern const ad_functions_t mpcodecs_ad_qtaudio;
+extern const ad_functions_t mpcodecs_ad_twin;
+extern const ad_functions_t mpcodecs_ad_libmusepack;
+extern const ad_functions_t mpcodecs_ad_libdca;
-ad_functions_t* mpcodecs_ad_drivers[] =
+const ad_functions_t * const mpcodecs_ad_drivers[] =
{
// &mpcodecs_ad_null,
#ifdef CONFIG_MP3LIB
diff --git a/libmpcodecs/ad.h b/libmpcodecs/ad.h
index ddf02a569a..9b1daf9e48 100644
--- a/libmpcodecs/ad.h
+++ b/libmpcodecs/ad.h
@@ -25,9 +25,9 @@
typedef mp_codec_info_t ad_info_t;
/* interface of video decoder drivers */
-typedef struct ad_functions_s
+typedef struct ad_functions
{
- ad_info_t *info;
+ const ad_info_t *info;
int (*preinit)(sh_audio_t *sh);
int (*init)(sh_audio_t *sh);
void (*uninit)(sh_audio_t *sh);
@@ -36,7 +36,7 @@ typedef struct ad_functions_s
} ad_functions_t;
// NULL terminated array of all drivers
-extern ad_functions_t* mpcodecs_ad_drivers[];
+extern const ad_functions_t * const mpcodecs_ad_drivers[];
// fallback if ADCTRL_RESYNC not implemented: sh_audio->a_in_buffer_len=0;
#define ADCTRL_RESYNC_STREAM 1 /* resync, called after seeking! */
diff --git a/libmpcodecs/ad_acm.c b/libmpcodecs/ad_acm.c
index 5fe4a13222..026f7c4550 100644
--- a/libmpcodecs/ad_acm.c
+++ b/libmpcodecs/ad_acm.c
@@ -29,7 +29,7 @@
#include "ad_internal.h"
#include "osdep/timer.h"
-static ad_info_t info =
+static const ad_info_t info =
{
"Win32/ACM decoders",
"acm",
@@ -77,7 +77,7 @@ static int preinit(sh_audio_t *sh_audio)
priv->o_wf = malloc(sizeof(WAVEFORMATEX));
if (!priv->o_wf)
{
- mp_msg(MSGT_DECAUDIO,MSGL_ERR,MSGTR_ACMiniterror);
+ mp_tmsg(MSGT_DECAUDIO,MSGL_ERR,"Could not load/initialize Win32/ACM audio codec (missing DLL file?).\n");
return 0;
}
@@ -108,7 +108,7 @@ static int preinit(sh_audio_t *sh_audio)
else
mp_msg(MSGT_WIN32, MSGL_ERR, "ACM_Decoder: acmStreamOpen error: %d\n",
(int)ret);
- mp_msg(MSGT_DECAUDIO,MSGL_ERR,MSGTR_ACMiniterror);
+ mp_tmsg(MSGT_DECAUDIO,MSGL_ERR,"Could not load/initialize Win32/ACM audio codec (missing DLL file?).\n");
return 0;
}
mp_msg(MSGT_WIN32, MSGL_V, "Audio codec opened OK! ;-)\n");
diff --git a/libmpcodecs/ad_alaw.c b/libmpcodecs/ad_alaw.c
index 88ebc601ae..4a8f3849cf 100644
--- a/libmpcodecs/ad_alaw.c
+++ b/libmpcodecs/ad_alaw.c
@@ -23,7 +23,7 @@
#include "config.h"
#include "ad_internal.h"
-static ad_info_t info =
+static const ad_info_t info =
{
"aLaw/uLaw audio decoder",
"alaw",
diff --git a/libmpcodecs/ad_dk3adpcm.c b/libmpcodecs/ad_dk3adpcm.c
index ddcfcce484..9ee168dc45 100644
--- a/libmpcodecs/ad_dk3adpcm.c
+++ b/libmpcodecs/ad_dk3adpcm.c
@@ -36,7 +36,7 @@
#include "mpbswap.h"
#include "ad_internal.h"
-static ad_info_t info =
+static const ad_info_t info =
{
"Duck Corp. DK3 ADPCM decoder",
"dk3adpcm",
diff --git a/libmpcodecs/ad_dmo.c b/libmpcodecs/ad_dmo.c
index e3f6ae9a96..c9835cf635 100644
--- a/libmpcodecs/ad_dmo.c
+++ b/libmpcodecs/ad_dmo.c
@@ -27,7 +27,7 @@
#include "ad_internal.h"
#include "libaf/reorder_ch.h"
-static ad_info_t info =
+static const ad_info_t info =
{
"Win32/DMO decoders",
"dmo",
@@ -52,7 +52,7 @@ static int preinit(sh_audio_t *sh_audio)
audio_output_channels : (sh_audio->wf->nChannels>=2 ? 2 : 1);
if(!(ds_adec=DMO_AudioDecoder_Open(sh_audio->codec->dll,&sh_audio->codec->guid,sh_audio->wf,chans)))
{
- mp_msg(MSGT_DECAUDIO,MSGL_ERR,MSGTR_MissingDLLcodec,sh_audio->codec->dll);
+ mp_tmsg(MSGT_DECAUDIO,MSGL_ERR,"ERROR: Could not open required DirectShow codec %s.\n",sh_audio->codec->dll);
return 0;
}
sh_audio->i_bps=sh_audio->wf->nAvgBytesPerSec;
diff --git a/libmpcodecs/ad_dshow.c b/libmpcodecs/ad_dshow.c
index 8365c90240..85d79cd52b 100644
--- a/libmpcodecs/ad_dshow.c
+++ b/libmpcodecs/ad_dshow.c
@@ -26,7 +26,7 @@
#include "ad_internal.h"
-static ad_info_t info =
+static const ad_info_t info =
{
"Win32/DirectShow decoders",
"dshow",
@@ -49,7 +49,7 @@ static int preinit(sh_audio_t *sh_audio)
DS_AudioDecoder* ds_adec;
if(!(ds_adec=DS_AudioDecoder_Open(sh_audio->codec->dll,&sh_audio->codec->guid,sh_audio->wf)))
{
- mp_msg(MSGT_DECAUDIO,MSGL_ERR,MSGTR_MissingDLLcodec,sh_audio->codec->dll);
+ mp_tmsg(MSGT_DECAUDIO,MSGL_ERR,"ERROR: Could not open required DirectShow codec %s.\n",sh_audio->codec->dll);
return 0;
}
sh_audio->i_bps=sh_audio->wf->nAvgBytesPerSec;
diff --git a/libmpcodecs/ad_dvdpcm.c b/libmpcodecs/ad_dvdpcm.c
index 671346d7a6..50593a8e70 100644
--- a/libmpcodecs/ad_dvdpcm.c
+++ b/libmpcodecs/ad_dvdpcm.c
@@ -25,7 +25,7 @@
#include "help_mp.h"
#include "ad_internal.h"
-static ad_info_t info =
+static const ad_info_t info =
{
"Uncompressed DVD/VOB LPCM audio decoder",
"dvdpcm",
@@ -56,7 +56,7 @@ static int init(sh_audio_t *sh)
sh->samplesize = 2;
break;
case 1:
- mp_msg(MSGT_DECAUDIO, MSGL_INFO, MSGTR_SamplesWanted);
+ mp_tmsg(MSGT_DECAUDIO, MSGL_INFO, "Samples of this format are needed to improve support. Please contact the developers.\n");
sh->i_bps = sh->channels * sh->samplerate * 5 / 2;
case 2:
sh->sample_format = AF_FORMAT_S24_BE;
diff --git a/libmpcodecs/ad_faad.c b/libmpcodecs/ad_faad.c
index b5d65d4883..f3795058ff 100644
--- a/libmpcodecs/ad_faad.c
+++ b/libmpcodecs/ad_faad.c
@@ -28,7 +28,7 @@
#include "ad_internal.h"
#include "libaf/reorder_ch.h"
-static ad_info_t info =
+static const ad_info_t info =
{
"AAC (MPEG2/4 Advanced Audio Coding)",
"faad",
@@ -174,7 +174,7 @@ static int init(sh_audio_t *sh)
sh->samplesize=2;
//sh->o_bps = sh->samplesize*faac_channels*faac_samplerate;
if(!sh->i_bps) {
- mp_msg(MSGT_DECAUDIO,MSGL_WARN,"FAAD: compressed input bitrate missing, assuming 128kbit/s!\n");
+ mp_msg(MSGT_DECAUDIO, MSGL_V, "FAAD: compressed input bitrate missing, assuming 128kbit/s!\n");
sh->i_bps = 128*1000/8; // XXX: HACK!!! ::atmos
} else
mp_msg(MSGT_DECAUDIO,MSGL_V,"FAAD: got %dkbit/s bitrate from MP4 header!\n",sh->i_bps*8/1000);
diff --git a/libmpcodecs/ad_ffmpeg.c b/libmpcodecs/ad_ffmpeg.c
index 147f635a29..9cf0567d6a 100644
--- a/libmpcodecs/ad_ffmpeg.c
+++ b/libmpcodecs/ad_ffmpeg.c
@@ -29,7 +29,7 @@
#include "mpbswap.h"
-static ad_info_t info =
+static const ad_info_t info =
{
"FFmpeg/libavcodec audio decoders",
"ffmpeg",
@@ -68,7 +68,7 @@ static int init(sh_audio_t *sh_audio)
lavc_codec = (AVCodec *)avcodec_find_decoder_by_name(sh_audio->codec->dll);
if(!lavc_codec){
- mp_msg(MSGT_DECAUDIO,MSGL_ERR,MSGTR_MissingLAVCcodec,sh_audio->codec->dll);
+ mp_tmsg(MSGT_DECAUDIO,MSGL_ERR,"Cannot find codec '%s' in libavcodec...\n",sh_audio->codec->dll);
return 0;
}
@@ -108,7 +108,7 @@ static int init(sh_audio_t *sh_audio)
/* open it */
if (avcodec_open(lavc_context, lavc_codec) < 0) {
- mp_msg(MSGT_DECAUDIO,MSGL_ERR, MSGTR_CantOpenCodec);
+ mp_tmsg(MSGT_DECAUDIO,MSGL_ERR, "Could not open codec.\n");
return 0;
}
mp_msg(MSGT_DECAUDIO,MSGL_V,"INFO: libavcodec \"%s\" init OK!\n", lavc_codec->name);
@@ -160,7 +160,7 @@ static void uninit(sh_audio_t *sh)
AVCodecContext *lavc_context = sh->context;
if (avcodec_close(lavc_context) < 0)
- mp_msg(MSGT_DECVIDEO, MSGL_ERR, MSGTR_CantCloseCodec);
+ mp_tmsg(MSGT_DECVIDEO, MSGL_ERR, "Could not close codec.\n");
av_freep(&lavc_context->extradata);
av_freep(&lavc_context);
}
diff --git a/libmpcodecs/ad_hwac3.c b/libmpcodecs/ad_hwac3.c
index ceeb61859a..45518f82c0 100644
--- a/libmpcodecs/ad_hwac3.c
+++ b/libmpcodecs/ad_hwac3.c
@@ -31,14 +31,14 @@
#include "help_mp.h"
#include "mpbswap.h"
#include "libavutil/common.h"
-#include "libavutil/intreadwrite.h"
+#include "ffmpeg_files/intreadwrite.h"
#include "ad_internal.h"
static int isdts = -1;
-static ad_info_t info =
+static const ad_info_t info =
{
"AC3/DTS pass-through S/PDIF",
"hwac3",
diff --git a/libmpcodecs/ad_hwmpa.c b/libmpcodecs/ad_hwmpa.c
index 506adbef42..fe804e1e13 100644
--- a/libmpcodecs/ad_hwmpa.c
+++ b/libmpcodecs/ad_hwmpa.c
@@ -33,7 +33,7 @@
//based on ad_hwac3.c and ad_libmad.c
-static ad_info_t info =
+static const ad_info_t info =
{
"MPEG audio pass-through (fake decoder)",
"hwmpa",
diff --git a/libmpcodecs/ad_imaadpcm.c b/libmpcodecs/ad_imaadpcm.c
index ef3e4b20c1..11a561315a 100644
--- a/libmpcodecs/ad_imaadpcm.c
+++ b/libmpcodecs/ad_imaadpcm.c
@@ -79,7 +79,7 @@ static const int8_t adpcm_index[8] =
// clamp a number above 16
#define CLAMP_ABOVE_16(x) if (x < 16) x = 16;
-static ad_info_t info =
+static const ad_info_t info =
{
"IMA ADPCM audio decoder",
"imaadpcm",
diff --git a/libmpcodecs/ad_internal.h b/libmpcodecs/ad_internal.h
index 928db50be6..2a5dbc43ea 100644
--- a/libmpcodecs/ad_internal.h
+++ b/libmpcodecs/ad_internal.h
@@ -35,7 +35,7 @@ static void uninit(sh_audio_t *sh);
static int control(sh_audio_t *sh,int cmd,void* arg, ...);
static int decode_audio(sh_audio_t *sh,unsigned char *buffer,int minlen,int maxlen);
-#define LIBAD_EXTERN(x) ad_functions_t mpcodecs_ad_##x = {\
+#define LIBAD_EXTERN(x) const ad_functions_t mpcodecs_ad_##x = {\
&info,\
preinit,\
init,\
diff --git a/libmpcodecs/ad_liba52.c b/libmpcodecs/ad_liba52.c
index b9d5171c61..29734ffc73 100644
--- a/libmpcodecs/ad_liba52.c
+++ b/libmpcodecs/ad_liba52.c
@@ -63,7 +63,7 @@ static sample_t a52_level = 1;
float a52_drc_level = 1.0;
static int a52_drc_action = DRC_NO_ACTION;
-static ad_info_t info =
+static const ad_info_t info =
{
"AC3 decoding with liba52",
"liba52",
@@ -74,7 +74,7 @@ static ad_info_t info =
LIBAD_EXTERN(liba52)
-int a52_fillbuff(sh_audio_t *sh_audio){
+static int a52_fillbuff(sh_audio_t *sh_audio){
int length=0;
int flags=0;
int sample_rate=0;
@@ -138,7 +138,7 @@ int channels=0;
return (flags&A52_LFE) ? (channels+1) : channels;
}
-sample_t dynrng_call (sample_t c, void *data) {
+static sample_t dynrng_call (sample_t c, void *data) {
// fprintf(stderr, "(%lf, %lf): %lf\n", (double)c, (double)a52_drc_level, (double)pow((double)c, a52_drc_level));
return pow((double)c, a52_drc_level);
}
diff --git a/libmpcodecs/ad_libdca.c b/libmpcodecs/ad_libdca.c
index 1514a9953a..c167c92490 100644
--- a/libmpcodecs/ad_libdca.c
+++ b/libmpcodecs/ad_libdca.c
@@ -32,7 +32,7 @@
#include <dts.h>
-static ad_info_t info =
+static const ad_info_t info =
{
"DTS decoding with libdca",
"libdca",
diff --git a/libmpcodecs/ad_libdv.c b/libmpcodecs/ad_libdv.c
index b3cc1163c7..384627462d 100644
--- a/libmpcodecs/ad_libdv.c
+++ b/libmpcodecs/ad_libdv.c
@@ -38,7 +38,7 @@
#include "ad_internal.h"
-static ad_info_t info =
+static const ad_info_t info =
{
"Raw DV Audio Decoder",
"libdv",
@@ -104,7 +104,7 @@ static int decode_audio(sh_audio_t *audio, unsigned char *buf, int minlen, int m
dv_parse_header(decoder, dv_audio_frame);
if(xx!=decoder->frame_size)
- mp_msg(MSGT_GLOBAL,MSGL_WARN,MSGTR_MPCODECS_AudioFramesizeDiffers,
+ mp_tmsg(MSGT_GLOBAL,MSGL_WARN,"[AD_LIBDV] Warning! Audio framesize differs! read=%d hdr=%d.\n",
xx, decoder->frame_size);
if (dv_decode_full_audio(decoder, dv_audio_frame,(int16_t**) audioBuffers))
diff --git a/libmpcodecs/ad_libmad.c b/libmpcodecs/ad_libmad.c
index 1f62fd49b1..ce10249595 100644
--- a/libmpcodecs/ad_libmad.c
+++ b/libmpcodecs/ad_libmad.c
@@ -24,7 +24,7 @@
#include "ad_internal.h"
-static ad_info_t info = {
+static const ad_info_t info = {
"libmad mpeg audio decoder",
"libmad",
"A'rpi",
diff --git a/libmpcodecs/ad_libvorbis.c b/libmpcodecs/ad_libvorbis.c
index c6948a3356..a768095187 100644
--- a/libmpcodecs/ad_libvorbis.c
+++ b/libmpcodecs/ad_libvorbis.c
@@ -26,7 +26,7 @@
#include "ad_internal.h"
#include "libaf/reorder_ch.h"
-static ad_info_t info =
+static const ad_info_t info =
{
"Ogg/Vorbis audio decoder",
#ifdef CONFIG_TREMOR
diff --git a/libmpcodecs/ad_mp3lib.c b/libmpcodecs/ad_mp3lib.c
index b213e17fde..5b50557c96 100644
--- a/libmpcodecs/ad_mp3lib.c
+++ b/libmpcodecs/ad_mp3lib.c
@@ -24,7 +24,7 @@
#include "ad_internal.h"
-static ad_info_t info =
+static const ad_info_t info =
{
"MPEG layer-2, layer-3",
"mp3lib",
diff --git a/libmpcodecs/ad_mpc.c b/libmpcodecs/ad_mpc.c
index a5d53e04de..33ed911f72 100644
--- a/libmpcodecs/ad_mpc.c
+++ b/libmpcodecs/ad_mpc.c
@@ -32,7 +32,7 @@
#include "libaf/af_format.h"
#include "libvo/fastmemcpy.h"
-static ad_info_t info =
+static const ad_info_t info =
{
"Musepack audio decoder",
"mpcdec",
@@ -231,4 +231,3 @@ static int control(sh_audio_t *sh, int cmd, void* arg, ...) {
}
return CONTROL_UNKNOWN;
}
-
diff --git a/libmpcodecs/ad_msadpcm.c b/libmpcodecs/ad_msadpcm.c
index 0ff705ba71..162c7c04d3 100644
--- a/libmpcodecs/ad_msadpcm.c
+++ b/libmpcodecs/ad_msadpcm.c
@@ -30,11 +30,11 @@
#include "config.h"
#include "libavutil/common.h"
-#include "libavutil/intreadwrite.h"
+#include "ffmpeg_files/intreadwrite.h"
#include "mpbswap.h"
#include "ad_internal.h"
-static ad_info_t info =
+static const ad_info_t info =
{
"MS ADPCM audio decoder",
"msadpcm",
diff --git a/libmpcodecs/ad_msgsm.c b/libmpcodecs/ad_msgsm.c
index 8c7151d1dc..d4b4a020fe 100644
--- a/libmpcodecs/ad_msgsm.c
+++ b/libmpcodecs/ad_msgsm.c
@@ -23,7 +23,7 @@
#include "config.h"
#include "ad_internal.h"
-static ad_info_t info =
+static const ad_info_t info =
{
"native GSM/MSGSM audio decoder",
"msgsm",
diff --git a/libmpcodecs/ad_pcm.c b/libmpcodecs/ad_pcm.c
index 8788a2e1cd..a5a17e1a49 100644
--- a/libmpcodecs/ad_pcm.c
+++ b/libmpcodecs/ad_pcm.c
@@ -20,12 +20,13 @@
#include <stdlib.h>
#include <unistd.h>
+#include "talloc.h"
#include "config.h"
#include "ad_internal.h"
#include "libaf/af_format.h"
#include "libaf/reorder_ch.h"
-static ad_info_t info =
+static const ad_info_t info =
{
"Uncompressed PCM audio decoder",
"pcm",
@@ -34,6 +35,11 @@ static ad_info_t info =
""
};
+struct ad_pcm_context {
+ unsigned char *packet_ptr;
+ int packet_len;
+};
+
LIBAD_EXTERN(pcm)
static int init(sh_audio_t *sh_audio)
@@ -111,6 +117,7 @@ static int init(sh_audio_t *sh_audio)
}
if (!sh_audio->samplesize) // this would cause MPlayer to hang later
sh_audio->samplesize = 2;
+ sh_audio->context = talloc_zero(NULL, struct ad_pcm_context);
return 1;
}
@@ -122,6 +129,7 @@ static int preinit(sh_audio_t *sh)
static void uninit(sh_audio_t *sh)
{
+ talloc_free(sh->context);
}
static int control(sh_audio_t *sh,int cmd,void* arg, ...)
@@ -141,12 +149,37 @@ static int control(sh_audio_t *sh,int cmd,void* arg, ...)
static int decode_audio(sh_audio_t *sh_audio,unsigned char *buf,int minlen,int maxlen)
{
unsigned len = sh_audio->channels*sh_audio->samplesize;
- len = (minlen + len - 1) / len * len;
- if (len > maxlen)
+ minlen = (minlen + len - 1) / len * len;
+ if (minlen > maxlen)
// if someone needs hundreds of channels adjust audio_out_minsize
// based on channels in preinit()
return -1;
- len=demux_read_data(sh_audio->ds,buf,len);
+
+ len = 0;
+ struct ad_pcm_context *ctx = sh_audio->context;
+ while (len < minlen) {
+ if (ctx->packet_len == 0) {
+ double pts;
+ int plen = ds_get_packet_pts(sh_audio->ds, &ctx->packet_ptr, &pts);
+ if (plen < 0)
+ break;
+ ctx->packet_len = plen;
+ if (pts != MP_NOPTS_VALUE) {
+ sh_audio->pts = pts;
+ sh_audio->pts_bytes = 0;
+ }
+ }
+ int from_stored = ctx->packet_len;
+ if (from_stored > minlen - len)
+ from_stored = minlen - len;
+ memcpy(buf + len, ctx->packet_ptr, from_stored);
+ ctx->packet_len -= from_stored;
+ ctx->packet_ptr += from_stored;
+ sh_audio->pts_bytes += from_stored;
+ len += from_stored;
+ }
+ if (len == 0)
+ len = -1; // The loop above only exits at error/EOF
if (len > 0 && sh_audio->channels >= 5) {
reorder_channel_nch(buf, AF_CHANNEL_LAYOUT_WAVEEX_DEFAULT,
AF_CHANNEL_LAYOUT_MPLAYER_DEFAULT,
diff --git a/libmpcodecs/ad_qtaudio.c b/libmpcodecs/ad_qtaudio.c
index 66481c80b5..4e785ca5bf 100644
--- a/libmpcodecs/ad_qtaudio.c
+++ b/libmpcodecs/ad_qtaudio.c
@@ -33,7 +33,7 @@
#include "loader/wine/windef.h"
#endif
-static ad_info_t info = {
+static const ad_info_t info = {
"QuickTime Audio Decoder",
"qtaudio",
"A'rpi",
diff --git a/libmpcodecs/ad_realaud.c b/libmpcodecs/ad_realaud.c
index 16ca8134ab..74cd5b7bb4 100644
--- a/libmpcodecs/ad_realaud.c
+++ b/libmpcodecs/ad_realaud.c
@@ -31,7 +31,7 @@
#include "ad_internal.h"
#include "loader/wine/windef.h"
-static ad_info_t info = {
+static const ad_info_t info = {
"RealAudio decoder",
"realaud",
"Alex Beregszaszi",
@@ -235,7 +235,7 @@ static int preinit(sh_audio_t *sh){
if (!load_syms_windows(sh->codec->dll))
#endif
{
- mp_msg(MSGT_DECVIDEO, MSGL_ERR, MSGTR_MissingDLLcodec, sh->codec->dll);
+ mp_tmsg(MSGT_DECVIDEO, MSGL_ERR, "ERROR: Could not open required DirectShow codec %s.\n", sh->codec->dll);
mp_msg(MSGT_DECVIDEO, MSGL_HINT, "Read the RealAudio section of the DOCS!\n");
free(path);
return 0;
diff --git a/libmpcodecs/ad_sample.c b/libmpcodecs/ad_sample.c
index 582007979a..69f4b20dfc 100644
--- a/libmpcodecs/ad_sample.c
+++ b/libmpcodecs/ad_sample.c
@@ -25,7 +25,7 @@
#include "config.h"
#include "ad_internal.h"
-static ad_info_t info = {
+static const ad_info_t info = {
"Sample audio decoder", // name of the driver
"sample", // driver name. should be the same as filename without ad_
"A'rpi", // writer/maintainer of _this_ file
diff --git a/libmpcodecs/ad_speex.c b/libmpcodecs/ad_speex.c
index 33526c2955..73655e5ac1 100644
--- a/libmpcodecs/ad_speex.c
+++ b/libmpcodecs/ad_speex.c
@@ -28,7 +28,7 @@
#include <speex/speex_header.h>
#include "ad_internal.h"
-static ad_info_t info = {
+static const ad_info_t info ={
"Speex audio decoder",
"speex",
"Reimar Döffinger",
@@ -135,4 +135,3 @@ static int decode_audio(sh_audio_t *sh, unsigned char *buf,
static int control(sh_audio_t *sh, int cmd, void *arg, ...) {
return CONTROL_UNKNOWN;
}
-
diff --git a/libmpcodecs/ad_twin.c b/libmpcodecs/ad_twin.c
index 34f8cdaa6d..f387821a5b 100644
--- a/libmpcodecs/ad_twin.c
+++ b/libmpcodecs/ad_twin.c
@@ -29,7 +29,7 @@
#include "help_mp.h"
-static ad_info_t info =
+static const ad_info_t info =
{
"TWinVQ decoder",
"vqf",
diff --git a/libmpcodecs/ae.c b/libmpcodecs/ae.c
index 4c4e65e5fe..acf16319a9 100644
--- a/libmpcodecs/ae.c
+++ b/libmpcodecs/ae.c
@@ -114,5 +114,3 @@ audio_encoder_t *new_audio_encoder(muxer_stream_t *stream, audio_encoding_params
encoder->codec = stream->codec;
return encoder;
}
-
-
diff --git a/libmpcodecs/ae_lame.c b/libmpcodecs/ae_lame.c
index db7fe3b32e..c7ca89b4fe 100644
--- a/libmpcodecs/ae_lame.c
+++ b/libmpcodecs/ae_lame.c
@@ -57,6 +57,55 @@ static char* lame_param_preset=NULL; // unset
static int lame_presets_set( lame_t gfp, int fast, int cbr, const char* preset_name );
#endif
+#define MEncoderMP3LameHelp _("\n\n"\
+" vbr=<0-4> variable bitrate method\n"\
+" 0: cbr (constant bitrate)\n"\
+" 1: mt (Mark Taylor VBR algorithm)\n"\
+" 2: rh (Robert Hegemann VBR algorithm - default)\n"\
+" 3: abr (average bitrate)\n"\
+" 4: mtrh (Mark Taylor Robert Hegemann VBR algorithm)\n"\
+"\n"\
+" abr average bitrate\n"\
+"\n"\
+" cbr constant bitrate\n"\
+" Also forces CBR mode encoding on subsequent ABR presets modes.\n"\
+"\n"\
+" br=<0-1024> specify bitrate in kBit (CBR and ABR only)\n"\
+"\n"\
+" q=<0-9> quality (0-highest, 9-lowest) (only for VBR)\n"\
+"\n"\
+" aq=<0-9> algorithmic quality (0-best/slowest, 9-worst/fastest)\n"\
+"\n"\
+" ratio=<1-100> compression ratio\n"\
+"\n"\
+" vol=<0-10> set audio input gain\n"\
+"\n"\
+" mode=<0-3> (default: auto)\n"\
+" 0: stereo\n"\
+" 1: joint-stereo\n"\
+" 2: dualchannel\n"\
+" 3: mono\n"\
+"\n"\
+" padding=<0-2>\n"\
+" 0: no\n"\
+" 1: all\n"\
+" 2: adjust\n"\
+"\n"\
+" fast Switch on faster encoding on subsequent VBR presets modes,\n"\
+" slightly lower quality and higher bitrates.\n"\
+"\n"\
+" preset=<value> Provide the highest possible quality settings.\n"\
+" medium: VBR encoding, good quality\n"\
+" (150-180 kbps bitrate range)\n"\
+" standard: VBR encoding, high quality\n"\
+" (170-210 kbps bitrate range)\n"\
+" extreme: VBR encoding, very high quality\n"\
+" (200-240 kbps bitrate range)\n"\
+" insane: CBR encoding, highest preset quality\n"\
+" (320 kbps bitrate)\n"\
+" <8-320>: ABR encoding at average given kbps bitrate.\n\n")
+
+
m_option_t lameopts_conf[]={
{"q", &lame_param_quality, CONF_TYPE_INT, CONF_RANGE, 0, 9, NULL},
@@ -82,18 +131,18 @@ m_option_t lameopts_conf[]={
{"fast", "MPlayer was built without -lameopts fast support (requires libmp3lame >=3.92).\n", CONF_TYPE_PRINT, CONF_NOCFG, 0, 0, NULL},
{"preset", "MPlayer was built without -lameopts preset support (requires libmp3lame >=3.92).\n", CONF_TYPE_PRINT, CONF_NOCFG, 0, 0, NULL},
#endif
- {"help", MSGTR_MEncoderMP3LameHelp, CONF_TYPE_PRINT, CONF_NOCFG, 0, 0, NULL},
+ {"help", MEncoderMP3LameHelp, CONF_TYPE_PRINT, CONF_NOCFG, 0, 0, NULL},
{NULL, NULL, 0, 0, 0, 0, NULL}
};
static int bind_lame(audio_encoder_t *encoder, muxer_stream_t *mux_a)
{
- mp_msg(MSGT_MENCODER, MSGL_INFO, MSGTR_MP3AudioSelected);
+ mp_tmsg(MSGT_MENCODER, MSGL_INFO, "MP3 audio selected.\n");
mux_a->h.dwSampleSize=0; // VBR
mux_a->h.dwRate=encoder->params.sample_rate;
mux_a->h.dwScale=encoder->params.samples_per_frame; // samples/frame
- if(sizeof(MPEGLAYER3WAVEFORMAT)!=30) mp_msg(MSGT_MENCODER,MSGL_WARN,MSGTR_MP3WaveFormatSizeNot30,sizeof(MPEGLAYER3WAVEFORMAT));
+ if(sizeof(MPEGLAYER3WAVEFORMAT)!=30) mp_tmsg(MSGT_MENCODER,MSGL_WARN,"sizeof(MPEGLAYER3WAVEFORMAT)==%d!=30, maybe broken C compiler?\n",sizeof(MPEGLAYER3WAVEFORMAT));
mux_a->wf=malloc(sizeof(MPEGLAYER3WAVEFORMAT)); // should be 30
mux_a->wf->wFormatTag=0x55; // MP3
mux_a->wf->nChannels= (lame_param_mode<0) ? encoder->params.channels : ((lame_param_mode==3) ? 1 : 2);
@@ -161,7 +210,7 @@ static void fixup(audio_encoder_t *encoder)
encoder->stream->h.dwRate=encoder->stream->wf->nAvgBytesPerSec;
encoder->stream->h.dwScale=1;
encoder->stream->wf->nBlockAlign=1;
- mp_msg(MSGT_MENCODER, MSGL_V, MSGTR_CBRAudioByterate,
+ mp_tmsg(MSGT_MENCODER, MSGL_V, "\n\nCBR audio: %d bytes/sec, %d bytes/block\n",
encoder->stream->h.dwRate,((MPEGLAYER3WAVEFORMAT*)(encoder->stream->wf))->nBlockSize);
}
}
@@ -192,20 +241,23 @@ int mpae_init_lame(audio_encoder_t *encoder)
if(lame_param_mode>=0) lame_set_mode(lame,lame_param_mode); // j-st
if(lame_param_ratio>0) lame_set_compression_ratio(lame,lame_param_ratio);
if(lame_param_scale>0) {
- mp_msg(MSGT_MENCODER, MSGL_V, MSGTR_SettingAudioInputGain, lame_param_scale);
+ mp_tmsg(MSGT_MENCODER, MSGL_V, "Setting audio input gain to %f.\n", lame_param_scale);
lame_set_scale(lame,lame_param_scale);
}
if(lame_param_lowpassfreq>=-1) lame_set_lowpassfreq(lame,lame_param_lowpassfreq);
if(lame_param_highpassfreq>=-1) lame_set_highpassfreq(lame,lame_param_highpassfreq);
#ifdef CONFIG_MP3LAME_PRESET
if(lame_param_preset != NULL) {
- mp_msg(MSGT_MENCODER, MSGL_V, MSGTR_LamePresetEquals,lame_param_preset);
+ mp_tmsg(MSGT_MENCODER, MSGL_V, "\npreset=%s\n\n",lame_param_preset);
if(lame_presets_set(lame,lame_param_fast, (lame_param_vbr==0), lame_param_preset) < 0)
return 0;
}
#endif
if(lame_init_params(lame) == -1) {
- mp_msg(MSGT_MENCODER, MSGL_FATAL, MSGTR_LameCantInit);
+ mp_tmsg(MSGT_MENCODER, MSGL_FATAL,
+ "Cannot set LAME options, check bitrate/samplerate, some very low bitrates\n"\
+ "(<32) need lower samplerates (i.e. -srate 8000).\n"\
+ "If everything else fails, try a preset.");
return 0;
}
if( mp_msg_test(MSGT_MENCODER,MSGL_V) ) {
@@ -229,8 +281,87 @@ static int lame_presets_set( lame_t gfp, int fast, int cbr, const char* preset_
int mono = 0;
if (strcmp(preset_name, "help") == 0) {
- mp_msg(MSGT_MENCODER, MSGL_FATAL, MSGTR_LameVersion, get_lame_version(), get_lame_url());
- mp_msg(MSGT_MENCODER, MSGL_FATAL, MSGTR_LamePresetsLongInfo);
+ mp_tmsg(MSGT_MENCODER, MSGL_FATAL, "LAME version %s (%s)\n\n", get_lame_version(), get_lame_url());
+
+#define LamePresetsLongInfo _("\n"\
+"The preset switches are designed to provide the highest possible quality.\n"\
+"\n"\
+"They have for the most part been subjected to and tuned via rigorous double\n"\
+"blind listening tests to verify and achieve this objective.\n"\
+"\n"\
+"These are continually updated to coincide with the latest developments that\n"\
+"occur and as a result should provide you with nearly the best quality\n"\
+"currently possible from LAME.\n"\
+"\n"\
+"To activate these presets:\n"\
+"\n"\
+" For VBR modes (generally highest quality):\n"\
+"\n"\
+" \"preset=standard\" This preset should generally be transparent\n"\
+" to most people on most music and is already\n"\
+" quite high in quality.\n"\
+"\n"\
+" \"preset=extreme\" If you have extremely good hearing and similar\n"\
+" equipment, this preset will generally provide\n"\
+" slightly higher quality than the \"standard\"\n"\
+" mode.\n"\
+"\n"\
+" For CBR 320kbps (highest quality possible from the preset switches):\n"\
+"\n"\
+" \"preset=insane\" This preset will usually be overkill for most\n"\
+" people and most situations, but if you must\n"\
+" have the absolute highest quality with no\n"\
+" regard to filesize, this is the way to go.\n"\
+"\n"\
+" For ABR modes (high quality per given bitrate but not as high as VBR):\n"\
+"\n"\
+" \"preset=<kbps>\" Using this preset will usually give you good\n"\
+" quality at a specified bitrate. Depending on the\n"\
+" bitrate entered, this preset will determine the\n"\
+" optimal settings for that particular situation.\n"\
+" While this approach works, it is not nearly as\n"\
+" flexible as VBR, and usually will not attain the\n"\
+" same level of quality as VBR at higher bitrates.\n"\
+"\n"\
+"The following options are also available for the corresponding profiles:\n"\
+"\n"\
+" <fast> standard\n"\
+" <fast> extreme\n"\
+" insane\n"\
+" <cbr> (ABR Mode) - The ABR Mode is implied. To use it,\n"\
+" simply specify a bitrate. For example:\n"\
+" \"preset=185\" activates this\n"\
+" preset and uses 185 as an average kbps.\n"\
+"\n"\
+" \"fast\" - Enables the new fast VBR for a particular profile. The\n"\
+" disadvantage to the speed switch is that often times the\n"\
+" bitrate will be slightly higher than with the normal mode\n"\
+" and quality may be slightly lower also.\n"\
+" Warning: with the current version fast presets might result in too\n"\
+" high bitrate compared to regular presets.\n"\
+"\n"\
+" \"cbr\" - If you use the ABR mode (read above) with a significant\n"\
+" bitrate such as 80, 96, 112, 128, 160, 192, 224, 256, 320,\n"\
+" you can use the \"cbr\" option to force CBR mode encoding\n"\
+" instead of the standard abr mode. ABR does provide higher\n"\
+" quality but CBR may be useful in situations such as when\n"\
+" streaming an MP3 over the internet may be important.\n"\
+"\n"\
+" For example:\n"\
+"\n"\
+" \"-lameopts fast:preset=standard \"\n"\
+" or \"-lameopts cbr:preset=192 \"\n"\
+" or \"-lameopts preset=172 \"\n"\
+" or \"-lameopts preset=extreme \"\n"\
+"\n"\
+"\n"\
+"A few aliases are available for ABR mode:\n"\
+"phone => 16kbps/mono phon+/lw/mw-eu/sw => 24kbps/mono\n"\
+"mw-us => 40kbps/mono voice => 56kbps/mono\n"\
+"fm/radio/tape => 112kbps hifi => 160kbps\n"\
+"cd => 192kbps studio => 256kbps")
+
+ mp_tmsg(MSGT_MENCODER, MSGL_FATAL, LamePresetsLongInfo);
return -1;
}
@@ -325,14 +456,39 @@ static int lame_presets_set( lame_t gfp, int fast, int cbr, const char* preset_
}
else {
- mp_msg(MSGT_MENCODER, MSGL_FATAL, MSGTR_LameVersion, get_lame_version(), get_lame_url());
- mp_msg(MSGT_MENCODER, MSGL_FATAL, MSGTR_InvalidBitrateForLamePreset);
+ mp_tmsg(MSGT_MENCODER, MSGL_FATAL, "LAME version %s (%s)\n\n", get_lame_version(), get_lame_url());
+ mp_tmsg(MSGT_MENCODER, MSGL_FATAL,
+ "Error: The bitrate specified is out of the valid range for this preset.\n"\
+ "\n"\
+ "When using this mode you must enter a value between \"8\" and \"320\".\n"\
+ "\n"\
+ "For further information try: \"-lameopts preset=help\"\n");
return -1;
}
}
- mp_msg(MSGT_MENCODER, MSGL_FATAL, MSGTR_LameVersion, get_lame_version(), get_lame_url());
- mp_msg(MSGT_MENCODER, MSGL_FATAL, MSGTR_InvalidLamePresetOptions);
+ mp_tmsg(MSGT_MENCODER, MSGL_FATAL, "LAME version %s (%s)\n\n", get_lame_version(), get_lame_url());
+#define InvalidLamePresetOptions _("Error: You did not enter a valid profile and/or options with preset.\n"\
+"\n"\
+"Available profiles are:\n"\
+"\n"\
+" <fast> standard\n"\
+" <fast> extreme\n"\
+" insane\n"\
+" <cbr> (ABR Mode) - The ABR Mode is implied. To use it,\n"\
+" simply specify a bitrate. For example:\n"\
+" \"preset=185\" activates this\n"\
+" preset and uses 185 as an average kbps.\n"\
+"\n"\
+" Some examples:\n"\
+"\n"\
+" \"-lameopts fast:preset=standard \"\n"\
+" or \"-lameopts cbr:preset=192 \"\n"\
+" or \"-lameopts preset=172 \"\n"\
+" or \"-lameopts preset=extreme \"\n"\
+"\n"\
+"For further information try: \"-lameopts preset=help\"\n")
+ mp_tmsg(MSGT_MENCODER, MSGL_FATAL, InvalidLamePresetOptions);
return -1;
}
#endif
diff --git a/libmpcodecs/ae_lavc.c b/libmpcodecs/ae_lavc.c
index 9c87205e11..2122535ee2 100644
--- a/libmpcodecs/ae_lavc.c
+++ b/libmpcodecs/ae_lavc.c
@@ -34,7 +34,7 @@
#include "libaf/af_format.h"
#include "libaf/reorder_ch.h"
#include "libavcodec/avcodec.h"
-#include "libavutil/intreadwrite.h"
+#include "ffmpeg_files/intreadwrite.h"
static AVCodec *lavc_acodec;
static AVCodecContext *lavc_actx;
@@ -44,10 +44,7 @@ extern int lavc_param_atag;
extern int lavc_param_audio_global_header;
extern int avcodec_initialized;
static int compressed_frame_size = 0;
-#ifdef CONFIG_LIBAVFORMAT
-#include "libavformat/avformat.h"
-extern const struct AVCodecTag *mp_wav_taglists[];
-#endif
+#include "libmpdemux/mp_taglists.h"
static int bind_lavc(audio_encoder_t *encoder, muxer_stream_t *mux_a)
{
@@ -151,32 +148,6 @@ static int get_frame_size(audio_encoder_t *encoder)
return sz;
}
-#ifndef CONFIG_LIBAVFORMAT
-static uint32_t lavc_find_atag(char *codec)
-{
- if(codec == NULL)
- return 0;
-
- if(! strcasecmp(codec, "mp2"))
- return 0x50;
-
- if(! strcasecmp(codec, "mp3"))
- return 0x55;
-
- if(! strcasecmp(codec, "ac3"))
- return 0x2000;
-
- if(! strcasecmp(codec, "adpcm_ima_wav"))
- return 0x11;
-
- if(! strncasecmp(codec, "bonk", 4))
- return 0x2048;
-
- return 0;
-}
-#endif
-
-
int mpae_init_lavc(audio_encoder_t *encoder)
{
encoder->params.samples_per_frame = encoder->params.sample_rate;
@@ -184,7 +155,7 @@ int mpae_init_lavc(audio_encoder_t *encoder)
if(!lavc_param_acodec)
{
- mp_msg(MSGT_MENCODER, MSGL_FATAL, MSGTR_NoLavcAudioCodecName);
+ mp_tmsg(MSGT_MENCODER, MSGL_FATAL, "Audio LAVC, Missing codec name!\n");
return 0;
}
@@ -197,16 +168,12 @@ int mpae_init_lavc(audio_encoder_t *encoder)
lavc_acodec = avcodec_find_encoder_by_name(lavc_param_acodec);
if (!lavc_acodec)
{
- mp_msg(MSGT_MENCODER, MSGL_FATAL, MSGTR_LavcAudioCodecNotFound, lavc_param_acodec);
+ mp_tmsg(MSGT_MENCODER, MSGL_FATAL, "Audio LAVC, couldn't find encoder for codec %s.\n", lavc_param_acodec);
return 0;
}
if(lavc_param_atag == 0)
{
-#ifdef CONFIG_LIBAVFORMAT
- lavc_param_atag = av_codec_get_tag(mp_wav_taglists, lavc_acodec->id);
-#else
- lavc_param_atag = lavc_find_atag(lavc_param_acodec);
-#endif
+ lavc_param_atag = mp_av_codec_get_tag(mp_wav_taglists, lavc_acodec->id);
if(!lavc_param_atag)
{
mp_msg(MSGT_MENCODER, MSGL_FATAL, "Couldn't find wav tag for specified codec, exit\n");
@@ -217,7 +184,7 @@ int mpae_init_lavc(audio_encoder_t *encoder)
lavc_actx = avcodec_alloc_context();
if(lavc_actx == NULL)
{
- mp_msg(MSGT_MENCODER, MSGL_FATAL, MSGTR_CouldntAllocateLavcContext);
+ mp_tmsg(MSGT_MENCODER, MSGL_FATAL, "Audio LAVC, couldn't allocate context!\n");
return 0;
}
@@ -258,7 +225,7 @@ int mpae_init_lavc(audio_encoder_t *encoder)
if(avcodec_open(lavc_actx, lavc_acodec) < 0)
{
- mp_msg(MSGT_MENCODER, MSGL_FATAL, MSGTR_CouldntOpenCodec, lavc_param_acodec, lavc_param_abitrate);
+ mp_tmsg(MSGT_MENCODER, MSGL_FATAL, "Couldn't open codec %s, br=%d.\n", lavc_param_acodec, lavc_param_abitrate);
return 0;
}
@@ -276,4 +243,3 @@ int mpae_init_lavc(audio_encoder_t *encoder)
return 1;
}
-
diff --git a/libmpcodecs/ae_pcm.c b/libmpcodecs/ae_pcm.c
index 12c4c0a85c..cbae42dc87 100644
--- a/libmpcodecs/ae_pcm.c
+++ b/libmpcodecs/ae_pcm.c
@@ -99,4 +99,3 @@ int mpae_init_pcm(audio_encoder_t *encoder)
return 1;
}
-
diff --git a/libmpcodecs/ae_toolame.c b/libmpcodecs/ae_toolame.c
index a498eb629d..7e64b2a41f 100644
--- a/libmpcodecs/ae_toolame.c
+++ b/libmpcodecs/ae_toolame.c
@@ -234,4 +234,3 @@ int mpae_init_toolame(audio_encoder_t *encoder)
return 1;
}
-
diff --git a/libmpcodecs/ae_twolame.c b/libmpcodecs/ae_twolame.c
index 6b63529496..7aa0398586 100644
--- a/libmpcodecs/ae_twolame.c
+++ b/libmpcodecs/ae_twolame.c
@@ -233,4 +233,3 @@ int mpae_init_twolame(audio_encoder_t *encoder)
return 1;
}
-
diff --git a/libmpcodecs/dec_audio.c b/libmpcodecs/dec_audio.c
index 4311380fbb..1c028dd6e7 100644
--- a/libmpcodecs/dec_audio.c
+++ b/libmpcodecs/dec_audio.c
@@ -52,7 +52,7 @@ af_cfg_t af_cfg = { 1, NULL }; // Configuration for audio filters
void afm_help(void)
{
int i;
- mp_msg(MSGT_DECAUDIO, MSGL_INFO, MSGTR_AvailableAudioFm);
+ mp_tmsg(MSGT_DECAUDIO, MSGL_INFO, "Available (compiled-in) audio codec families/drivers:\n");
mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_AUDIO_DRIVERS\n");
mp_msg(MSGT_DECAUDIO, MSGL_INFO, " afm: info: (comment)\n");
for (i = 0; mpcodecs_ad_drivers[i] != NULL; i++)
@@ -79,33 +79,35 @@ static int init_audio_codec(sh_audio_t *sh_audio)
}
}
if (!sh_audio->ad_driver->preinit(sh_audio)) {
- mp_msg(MSGT_DECAUDIO, MSGL_ERR, MSGTR_ADecoderPreinitFailed);
+ mp_tmsg(MSGT_DECAUDIO, MSGL_ERR, "ADecoder preinit failed :(\n");
return 0;
}
/* allocate audio in buffer: */
if (sh_audio->audio_in_minsize > 0) {
sh_audio->a_in_buffer_size = sh_audio->audio_in_minsize;
- mp_msg(MSGT_DECAUDIO, MSGL_V, MSGTR_AllocatingBytesForInputBuffer,
+ mp_tmsg(MSGT_DECAUDIO, MSGL_V, "dec_audio: Allocating %d bytes for input buffer.\n",
sh_audio->a_in_buffer_size);
sh_audio->a_in_buffer = av_mallocz(sh_audio->a_in_buffer_size);
sh_audio->a_in_buffer_len = 0;
}
- sh_audio->a_buffer_size = sh_audio->audio_out_minsize + MAX_OUTBURST;
+ const int base_size = 65536;
+ // At least 64 KiB plus rounding up to next decodable unit size
+ sh_audio->a_buffer_size = base_size + sh_audio->audio_out_minsize;
- mp_msg(MSGT_DECAUDIO, MSGL_V, MSGTR_AllocatingBytesForOutputBuffer,
- sh_audio->audio_out_minsize, MAX_OUTBURST, sh_audio->a_buffer_size);
+ mp_tmsg(MSGT_DECAUDIO, MSGL_V, "dec_audio: Allocating %d + %d = %d bytes for output buffer.\n",
+ sh_audio->audio_out_minsize, base_size, sh_audio->a_buffer_size);
sh_audio->a_buffer = av_mallocz(sh_audio->a_buffer_size);
if (!sh_audio->a_buffer) {
- mp_msg(MSGT_DECAUDIO, MSGL_ERR, MSGTR_CantAllocAudioBuf);
+ mp_tmsg(MSGT_DECAUDIO, MSGL_ERR, "Cannot allocate audio out buffer.\n");
return 0;
}
sh_audio->a_buffer_len = 0;
if (!sh_audio->ad_driver->init(sh_audio)) {
- mp_msg(MSGT_DECAUDIO, MSGL_WARN, MSGTR_ADecoderInitFailed);
+ mp_tmsg(MSGT_DECAUDIO, MSGL_WARN, "ADecoder init failed :(\n");
uninit_audio(sh_audio); // free buffers
return 0;
}
@@ -113,7 +115,7 @@ static int init_audio_codec(sh_audio_t *sh_audio)
sh_audio->initialized = 1;
if (!sh_audio->channels || !sh_audio->samplerate) {
- mp_msg(MSGT_DECAUDIO, MSGL_WARN, MSGTR_UnknownAudio);
+ mp_tmsg(MSGT_DECAUDIO, MSGL_WARN, "Unknown/missing audio format -> no sound\n");
uninit_audio(sh_audio); // free buffers
return 0;
}
@@ -216,18 +218,18 @@ static int init_audio(sh_audio_t *sh_audio, char *codecname, char *afm,
}
#endif
if (!mpadec) { // driver not available (==compiled in)
- mp_msg(MSGT_DECAUDIO, MSGL_ERR,
- MSGTR_AudioCodecFamilyNotAvailableStr,
+ mp_tmsg(MSGT_DECAUDIO, MSGL_ERR,
+ "Requested audio codec family [%s] (afm=%s) not available.\nEnable it at compilation.\n",
sh_audio->codec->name, sh_audio->codec->drv);
continue;
}
// it's available, let's try to init!
// init()
- mp_msg(MSGT_DECAUDIO, MSGL_INFO, MSGTR_OpeningAudioDecoder,
+ mp_tmsg(MSGT_DECAUDIO, MSGL_INFO, "Opening audio decoder: [%s] %s\n",
mpadec->info->short_name, mpadec->info->name);
sh_audio->ad_driver = mpadec;
if (!init_audio_codec(sh_audio)) {
- mp_msg(MSGT_DECAUDIO, MSGL_INFO, MSGTR_ADecoderInitFailed);
+ mp_tmsg(MSGT_DECAUDIO, MSGL_INFO, "ADecoder init failed :(\n");
continue; // try next...
}
// Yeah! We got it!
@@ -255,7 +257,7 @@ int init_best_audio_codec(sh_audio_t *sh_audio, char **audio_codec_list,
stringset_add(&selected, audio_codec + 1);
} else {
// forced codec by name:
- mp_msg(MSGT_DECAUDIO, MSGL_INFO, MSGTR_ForcedAudioCodec,
+ mp_tmsg(MSGT_DECAUDIO, MSGL_INFO, "Forced audio codec: %s\n",
audio_codec);
init_audio(sh_audio, audio_codec, NULL, -1, &selected);
}
@@ -268,7 +270,7 @@ int init_best_audio_codec(sh_audio_t *sh_audio, char **audio_codec_list,
// try first the preferred codec families:
while (!sh_audio->initialized && *fmlist) {
char *audio_fm = *(fmlist++);
- mp_msg(MSGT_DECAUDIO, MSGL_INFO, MSGTR_TryForceAudioFmtStr,
+ mp_tmsg(MSGT_DECAUDIO, MSGL_INFO, "Trying to force audio codec driver family %s...\n",
audio_fm);
for (status = CODECS_STATUS__MAX;
status >= CODECS_STATUS__MIN; --status)
@@ -286,12 +288,12 @@ int init_best_audio_codec(sh_audio_t *sh_audio, char **audio_codec_list,
stringset_free(&selected);
if (!sh_audio->initialized) {
- mp_msg(MSGT_DECAUDIO, MSGL_ERR, MSGTR_CantFindAudioCodec,
+ mp_tmsg(MSGT_DECAUDIO, MSGL_ERR, "Cannot find codec for audio format 0x%X.\n",
sh_audio->format);
return 0; // failed
}
- mp_msg(MSGT_DECAUDIO, MSGL_INFO, MSGTR_SelectedAudioCodec,
+ mp_tmsg(MSGT_DECAUDIO, MSGL_INFO, "Selected audio codec: [%s] afm: %s (%s)\n",
sh_audio->codec->name, sh_audio->codec->drv, sh_audio->codec->info);
return 1; // success
}
@@ -305,7 +307,7 @@ void uninit_audio(sh_audio_t *sh_audio)
sh_audio->afilter = NULL;
}
if (sh_audio->initialized) {
- mp_msg(MSGT_DECAUDIO, MSGL_V, MSGTR_UninitAudioStr,
+ mp_tmsg(MSGT_DECAUDIO, MSGL_V, "Uninit audio: %s\n",
sh_audio->codec->drv);
sh_audio->ad_driver->uninit(sh_audio);
#ifdef CONFIG_DYNAMIC_PLUGINS
@@ -345,7 +347,7 @@ int init_audio_filters(sh_audio_t *sh_audio, int in_samplerate,
// filter config:
memcpy(&afs->cfg, &af_cfg, sizeof(af_cfg_t));
- mp_msg(MSGT_DECAUDIO, MSGL_V, MSGTR_BuildingAudioFilterChain,
+ mp_tmsg(MSGT_DECAUDIO, MSGL_V, "Building audio filter chain for %dHz/%dch/%s -> %dHz/%dch/%s...\n",
afs->input.rate, afs->input.nch,
af_fmt2str_short(afs->input.format), afs->output.rate,
afs->output.nch, af_fmt2str_short(afs->output.format));
@@ -370,18 +372,10 @@ int init_audio_filters(sh_audio_t *sh_audio, int in_samplerate,
static int filter_n_bytes(sh_audio_t *sh, int len)
{
- int error = 0;
- // Filter
- af_data_t filter_input = {
- .audio = sh->a_buffer,
- .rate = sh->samplerate,
- .nch = sh->channels,
- .format = sh->sample_format
- };
- af_data_t *filter_output;
-
assert(len-1 + sh->audio_out_minsize <= sh->a_buffer_size);
+ int error = 0;
+
// Decode more bytes if needed
while (sh->a_buffer_len < len) {
unsigned char *buf = sh->a_buffer + sh->a_buffer_len;
@@ -396,9 +390,16 @@ static int filter_n_bytes(sh_audio_t *sh, int len)
sh->a_buffer_len += ret;
}
- filter_input.len = len;
+ // Filter
+ af_data_t filter_input = {
+ .audio = sh->a_buffer,
+ .len = len,
+ .rate = sh->samplerate,
+ .nch = sh->channels,
+ .format = sh->sample_format
+ };
af_fix_parameters(&filter_input);
- filter_output = af_play(sh->afilter, &filter_input);
+ af_data_t *filter_output = af_play(sh->afilter, &filter_input);
if (!filter_output)
return -1;
if (sh->a_out_buffer_size < sh->a_out_buffer_len + filter_output->len) {
@@ -473,8 +474,6 @@ int decode_audio(sh_audio_t *sh_audio, int minlen)
void resync_audio_stream(sh_audio_t *sh_audio)
{
- sh_audio->a_buffer_len = 0;
- sh_audio->a_out_buffer_len = 0;
sh_audio->a_in_buffer_len = 0; // clear audio input buffer
if (!sh_audio->initialized)
return;
diff --git a/libmpcodecs/dec_teletext.c b/libmpcodecs/dec_teletext.c
index 5be9812086..ac12b9aa4a 100644
--- a/libmpcodecs/dec_teletext.c
+++ b/libmpcodecs/dec_teletext.c
@@ -821,7 +821,7 @@ static void prepare_visible_page(priv_vbi_t* priv){
curr_pg=get_from_cache(priv,priv->curr_pagenum,
get_subpagenum_from_cache(priv,priv->curr_pagenum));
if (!pg && !curr_pg){
- p=MSGTR_TV_NoTeletext;
+ p=_("No teletext");
for(i=0;i<VBI_COLUMNS && *p;i++){
GET_UTF8(priv->display_page[i].unicode,*p++,break;);
}
@@ -1705,7 +1705,7 @@ int teletext_control(void* p, int cmd, void *arg)
priv->subpagenum=0x3f7f;
pll_reset(priv,fine_tune);
if(tt_param->lang==-1){
- mp_msg(MSGT_TELETEXT,MSGL_INFO,MSGTR_TV_TTSupportedLanguages);
+ mp_tmsg(MSGT_TELETEXT,MSGL_INFO,"Supported Teletext languages:\n");
for(i=0; tt_languages[i].lang_code; i++){
mp_msg(MSGT_TELETEXT,MSGL_INFO," %3d %s\n",
tt_languages[i].lang_code, tt_languages[i].lang_name);
@@ -1718,7 +1718,7 @@ int teletext_control(void* p, int cmd, void *arg)
break;
}
if (priv->primary_language!=tt_languages[i].lang_code){
- mp_msg(MSGT_TELETEXT,MSGL_INFO,MSGTR_TV_TTSelectedLanguage,
+ mp_tmsg(MSGT_TELETEXT,MSGL_INFO,"Selected default teletext language: %s\n",
tt_languages[i].lang_name);
priv->primary_language=tt_languages[i].lang_code;
}
diff --git a/libmpcodecs/dec_video.c b/libmpcodecs/dec_video.c
index 3572565556..5781698185 100644
--- a/libmpcodecs/dec_video.c
+++ b/libmpcodecs/dec_video.c
@@ -17,9 +17,11 @@
*/
#include "config.h"
+#include "options.h"
#include <stdio.h>
#include <stdlib.h>
+#include <stdbool.h>
#include <unistd.h>
#include "mp_msg.h"
@@ -53,337 +55,392 @@ extern double vout_time_usage;
#include "cpudetect.h"
-int field_dominance=-1;
+int field_dominance = -1;
-int divx_quality=0;
+int divx_quality = 0;
-vd_functions_t* mpvdec=NULL;
-
-int get_video_quality_max(sh_video_t *sh_video){
- vf_instance_t* vf=sh_video->vfilter;
- if(vf){
- int ret=vf->control(vf,VFCTRL_QUERY_MAX_PP_LEVEL,NULL);
- if(ret>0){
- mp_msg(MSGT_DECVIDEO,MSGL_INFO,MSGTR_UsingExternalPP,ret);
- return ret;
+int get_video_quality_max(sh_video_t *sh_video)
+{
+ vf_instance_t *vf = sh_video->vfilter;
+ if (vf) {
+ int ret = vf->control(vf, VFCTRL_QUERY_MAX_PP_LEVEL, NULL);
+ if (ret > 0) {
+ mp_tmsg(MSGT_DECVIDEO, MSGL_INFO, "[PP] Using external postprocessing filter, max q = %d.\n", ret);
+ return ret;
+ }
}
- }
- if(mpvdec){
- int ret=mpvdec->control(sh_video,VDCTRL_QUERY_MAX_PP_LEVEL,NULL);
- if(ret>0){
- mp_msg(MSGT_DECVIDEO,MSGL_INFO,MSGTR_UsingCodecPP,ret);
- return ret;
+ const struct vd_functions *vd = sh_video->vd_driver;
+ if (vd) {
+ int ret = vd->control(sh_video, VDCTRL_QUERY_MAX_PP_LEVEL, NULL);
+ if (ret > 0) {
+ mp_tmsg(MSGT_DECVIDEO, MSGL_INFO, "[PP] Using codec's postprocessing, max q = %d.\n", ret);
+ return ret;
+ }
}
- }
-// mp_msg(MSGT_DECVIDEO,MSGL_INFO,"[PP] Sorry, postprocessing is not available\n");
- return 0;
+ return 0;
}
-void set_video_quality(sh_video_t *sh_video,int quality){
- vf_instance_t* vf=sh_video->vfilter;
- if(vf){
- int ret=vf->control(vf,VFCTRL_SET_PP_LEVEL, (void*)(&quality));
- if(ret==CONTROL_TRUE) return; // success
- }
- if(mpvdec)
- mpvdec->control(sh_video,VDCTRL_SET_PP_LEVEL, (void*)(&quality));
+void set_video_quality(sh_video_t *sh_video, int quality)
+{
+ vf_instance_t *vf = sh_video->vfilter;
+ if (vf) {
+ int ret = vf->control(vf, VFCTRL_SET_PP_LEVEL, (void *) (&quality));
+ if (ret == CONTROL_TRUE)
+ return; // success
+ }
+ const struct vd_functions *vd = sh_video->vd_driver;
+ if (vd)
+ vd->control(sh_video, VDCTRL_SET_PP_LEVEL, (void *) (&quality));
}
-int set_video_colors(sh_video_t *sh_video,const char *item,int value)
+int set_video_colors(sh_video_t *sh_video, const char *item, int value)
{
- vf_instance_t* vf=sh_video->vfilter;
+ vf_instance_t *vf = sh_video->vfilter;
vf_equalizer_t data;
data.item = item;
data.value = value;
- mp_dbg(MSGT_DECVIDEO,MSGL_V,"set video colors %s=%d \n", item, value);
- if (vf)
- {
- int ret = vf->control(vf, VFCTRL_SET_EQUALIZER, &data);
- if (ret == CONTROL_TRUE)
- return 1;
+ mp_dbg(MSGT_DECVIDEO, MSGL_V, "set video colors %s=%d \n", item, value);
+ if (vf) {
+ int ret = vf->control(vf, VFCTRL_SET_EQUALIZER, &data);
+ if (ret == CONTROL_TRUE)
+ return 1;
}
/* try software control */
- if(mpvdec)
- if( mpvdec->control(sh_video,VDCTRL_SET_EQUALIZER, item, (int *)value)
- == CONTROL_OK) return 1;
- mp_msg(MSGT_DECVIDEO,MSGL_V,MSGTR_VideoAttributeNotSupportedByVO_VD,item);
+ const struct vd_functions *vd = sh_video->vd_driver;
+ if (vd &&
+ vd->control(sh_video, VDCTRL_SET_EQUALIZER, item, (int *) value)
+ == CONTROL_OK)
+ return 1;
+ mp_tmsg(MSGT_DECVIDEO, MSGL_V, "Video attribute '%s' is not supported by selected vo & vd.\n",
+ item);
return 0;
}
-int get_video_colors(sh_video_t *sh_video,const char *item,int *value)
+int get_video_colors(sh_video_t *sh_video, const char *item, int *value)
{
- vf_instance_t* vf=sh_video->vfilter;
+ vf_instance_t *vf = sh_video->vfilter;
vf_equalizer_t data;
data.item = item;
- mp_dbg(MSGT_DECVIDEO,MSGL_V,"get video colors %s \n", item);
- if (vf)
- {
+ mp_dbg(MSGT_DECVIDEO, MSGL_V, "get video colors %s \n", item);
+ if (vf) {
int ret = vf->control(vf, VFCTRL_GET_EQUALIZER, &data);
- if (ret == CONTROL_TRUE){
- *value = data.value;
- return 1;
- }
+ if (ret == CONTROL_TRUE) {
+ *value = data.value;
+ return 1;
+ }
}
/* try software control */
- if(mpvdec) return mpvdec->control(sh_video,VDCTRL_GET_EQUALIZER, item, value);
+ const struct vd_functions *vd = sh_video->vd_driver;
+ if (vd)
+ return vd->control(sh_video, VDCTRL_GET_EQUALIZER, item, value);
return 0;
}
-int set_rectangle(sh_video_t *sh_video,int param,int value)
+int set_rectangle(sh_video_t *sh_video, int param, int value)
{
- vf_instance_t* vf=sh_video->vfilter;
- int data[] = {param, value};
+ vf_instance_t *vf = sh_video->vfilter;
+ int data[] = { param, value };
- mp_dbg(MSGT_DECVIDEO,MSGL_V,"set rectangle \n");
- if (vf)
- {
+ mp_dbg(MSGT_DECVIDEO, MSGL_V, "set rectangle \n");
+ if (vf) {
int ret = vf->control(vf, VFCTRL_CHANGE_RECTANGLE, data);
- if (ret)
- return 1;
+ if (ret)
+ return 1;
}
return 0;
}
+int redraw_osd(struct sh_video *sh_video, struct osd_state *osd)
+{
+ struct vf_instance *vf = sh_video->vfilter;
+ if (vf->control(vf, VFCTRL_REDRAW_OSD, osd) == true)
+ return 0;
+ return -1;
+}
+
void resync_video_stream(sh_video_t *sh_video)
{
- sh_video->timer = 0;
- sh_video->next_frame_time = 0;
- sh_video->num_buffered_pts = 0;
- sh_video->last_pts = MP_NOPTS_VALUE;
- if(mpvdec) mpvdec->control(sh_video, VDCTRL_RESYNC_STREAM, NULL);
+ const struct vd_functions *vd = sh_video->vd_driver;
+ if (vd)
+ vd->control(sh_video, VDCTRL_RESYNC_STREAM, NULL);
+ sh_video->prev_codec_reordered_pts = MP_NOPTS_VALUE;
+ sh_video->prev_sorted_pts = MP_NOPTS_VALUE;
}
int get_current_video_decoder_lag(sh_video_t *sh_video)
{
- int ret;
-
- if (!mpvdec)
- return -1;
- ret = mpvdec->control(sh_video, VDCTRL_QUERY_UNSEEN_FRAMES, NULL);
+ const struct vd_functions *vd = sh_video->vd_driver;
+ if (!vd)
+ return -1;
+ int ret = vd->control(sh_video, VDCTRL_QUERY_UNSEEN_FRAMES, NULL);
if (ret >= 10)
- return ret-10;
+ return ret - 10;
return -1;
}
-void uninit_video(sh_video_t *sh_video){
- if(!sh_video->initialized) return;
- mp_msg(MSGT_DECVIDEO,MSGL_V,MSGTR_UninitVideoStr,sh_video->codec->drv);
- mpvdec->uninit(sh_video);
+void uninit_video(sh_video_t *sh_video)
+{
+ if (!sh_video->initialized)
+ return;
+ mp_tmsg(MSGT_DECVIDEO, MSGL_V, "Uninit video: %s\n", sh_video->codec->drv);
+ sh_video->vd_driver->uninit(sh_video);
#ifdef CONFIG_DYNAMIC_PLUGINS
if (sh_video->dec_handle)
- dlclose(sh_video->dec_handle);
+ dlclose(sh_video->dec_handle);
#endif
vf_uninit_filter_chain(sh_video->vfilter);
- sh_video->initialized=0;
+ sh_video->initialized = 0;
}
-void vfm_help(void){
+void vfm_help(void)
+{
int i;
- mp_msg(MSGT_DECVIDEO,MSGL_INFO,MSGTR_AvailableVideoFm);
+ mp_tmsg(MSGT_DECVIDEO, MSGL_INFO, "Available (compiled-in) video codec families/drivers:\n");
mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_VIDEO_DRIVERS\n");
- mp_msg(MSGT_DECVIDEO,MSGL_INFO," vfm: info: (comment)\n");
- for (i=0; mpcodecs_vd_drivers[i] != NULL; i++)
- mp_msg(MSGT_DECVIDEO,MSGL_INFO,"%8s %s (%s)\n",
- mpcodecs_vd_drivers[i]->info->short_name,
- mpcodecs_vd_drivers[i]->info->name,
- mpcodecs_vd_drivers[i]->info->comment);
+ mp_msg(MSGT_DECVIDEO, MSGL_INFO, " vfm: info: (comment)\n");
+ for (i = 0; mpcodecs_vd_drivers[i] != NULL; i++)
+ mp_msg(MSGT_DECVIDEO, MSGL_INFO, "%8s %s (%s)\n",
+ mpcodecs_vd_drivers[i]->info->short_name,
+ mpcodecs_vd_drivers[i]->info->name,
+ mpcodecs_vd_drivers[i]->info->comment);
}
-static int init_video(sh_video_t *sh_video,char* codecname,char* vfm,int status,
- stringset_t *selected){
+static int init_video(sh_video_t *sh_video, char *codecname, char *vfm,
+ int status, stringset_t *selected)
+{
int force = 0;
- unsigned int orig_fourcc=sh_video->bih?sh_video->bih->biCompression:0;
- sh_video->codec=NULL;
- sh_video->vf_initialized=0;
+ unsigned int orig_fourcc =
+ sh_video->bih ? sh_video->bih->biCompression : 0;
+ sh_video->codec = NULL;
+ sh_video->vf_initialized = 0;
if (codecname && codecname[0] == '+') {
- codecname = &codecname[1];
- force = 1;
+ codecname = &codecname[1];
+ force = 1;
}
- while(1){
- int i;
- int orig_w, orig_h;
- // restore original fourcc:
- if(sh_video->bih) sh_video->bih->biCompression=orig_fourcc;
- if(!(sh_video->codec=find_video_codec(sh_video->format,
- sh_video->bih?((unsigned int*) &sh_video->bih->biCompression):NULL,
- sh_video->codec,force) )) break;
- // ok we found one codec
- if(stringset_test(selected, sh_video->codec->name)) continue; // already tried & failed
- if(codecname && strcmp(sh_video->codec->name,codecname)) continue; // -vc
- if(vfm && strcmp(sh_video->codec->drv,vfm)) continue; // vfm doesn't match
- if(!force && sh_video->codec->status<status) continue; // too unstable
- stringset_add(selected, sh_video->codec->name); // tagging it
- // ok, it matches all rules, let's find the driver!
- for (i=0; mpcodecs_vd_drivers[i] != NULL; i++)
-// if(mpcodecs_vd_drivers[i]->info->id==sh_video->codec->driver) break;
- if(!strcmp(mpcodecs_vd_drivers[i]->info->short_name,sh_video->codec->drv)) break;
- mpvdec=mpcodecs_vd_drivers[i];
+ while (1) {
+ int i;
+ int orig_w, orig_h;
+ // restore original fourcc:
+ if (sh_video->bih)
+ sh_video->bih->biCompression = orig_fourcc;
+ if (!
+ (sh_video->codec =
+ find_video_codec(sh_video->format,
+ sh_video->bih ? ((unsigned int *) &sh_video->
+ bih->biCompression) : NULL,
+ sh_video->codec, force)))
+ break;
+ // ok we found one codec
+ if (stringset_test(selected, sh_video->codec->name))
+ continue; // already tried & failed
+ if (codecname && strcmp(sh_video->codec->name, codecname))
+ continue; // -vc
+ if (vfm && strcmp(sh_video->codec->drv, vfm))
+ continue; // vfm doesn't match
+ if (!force && sh_video->codec->status < status)
+ continue; // too unstable
+ stringset_add(selected, sh_video->codec->name); // tagging it
+ // ok, it matches all rules, let's find the driver!
+ for (i = 0; mpcodecs_vd_drivers[i] != NULL; i++)
+ if (!strcmp(mpcodecs_vd_drivers[i]->info->short_name,
+ sh_video->codec->drv))
+ break;
+ sh_video->vd_driver = mpcodecs_vd_drivers[i];
#ifdef CONFIG_DYNAMIC_PLUGINS
- if (!mpvdec)
- {
- /* try to open shared decoder plugin */
- int buf_len;
- char *buf;
- vd_functions_t *funcs_sym;
- vd_info_t *info_sym;
-
- buf_len = strlen(MPLAYER_LIBDIR)+strlen(sh_video->codec->drv)+16;
- buf = malloc(buf_len);
- if (!buf)
- break;
- snprintf(buf, buf_len, "%s/mplayer/vd_%s.so", MPLAYER_LIBDIR, sh_video->codec->drv);
- mp_msg(MSGT_DECVIDEO, MSGL_DBG2, "Trying to open external plugin: %s\n", buf);
- sh_video->dec_handle = dlopen(buf, RTLD_LAZY);
- if (!sh_video->dec_handle)
- break;
- snprintf(buf, buf_len, "mpcodecs_vd_%s", sh_video->codec->drv);
- funcs_sym = dlsym(sh_video->dec_handle, buf);
- if (!funcs_sym || !funcs_sym->info || !funcs_sym->init ||
- !funcs_sym->uninit || !funcs_sym->control || !funcs_sym->decode)
- break;
- info_sym = funcs_sym->info;
- if (strcmp(info_sym->short_name, sh_video->codec->drv))
- break;
- free(buf);
- mpvdec = funcs_sym;
- mp_msg(MSGT_DECVIDEO, MSGL_V, "Using external decoder plugin (%s/mplayer/vd_%s.so)!\n",
- MPLAYER_LIBDIR, sh_video->codec->drv);
- }
+ if (!sh_video->vd_driver) {
+ /* try to open shared decoder plugin */
+ int buf_len;
+ char *buf;
+ vd_functions_t *funcs_sym;
+ vd_info_t *info_sym;
+
+ buf_len =
+ strlen(MPLAYER_LIBDIR) + strlen(sh_video->codec->drv) + 16;
+ buf = malloc(buf_len);
+ if (!buf)
+ break;
+ snprintf(buf, buf_len, "%s/mplayer/vd_%s.so", MPLAYER_LIBDIR,
+ sh_video->codec->drv);
+ mp_msg(MSGT_DECVIDEO, MSGL_DBG2,
+ "Trying to open external plugin: %s\n", buf);
+ sh_video->dec_handle = dlopen(buf, RTLD_LAZY);
+ if (!sh_video->dec_handle)
+ break;
+ snprintf(buf, buf_len, "mpcodecs_vd_%s", sh_video->codec->drv);
+ funcs_sym = dlsym(sh_video->dec_handle, buf);
+ if (!funcs_sym || !funcs_sym->info || !funcs_sym->init
+ || !funcs_sym->uninit || !funcs_sym->control
+ || !funcs_sym->decode)
+ break;
+ info_sym = funcs_sym->info;
+ if (strcmp(info_sym->short_name, sh_video->codec->drv))
+ break;
+ free(buf);
+ sh_video->vd_driver = funcs_sym;
+ mp_msg(MSGT_DECVIDEO, MSGL_V,
+ "Using external decoder plugin (%s/mplayer/vd_%s.so)!\n",
+ MPLAYER_LIBDIR, sh_video->codec->drv);
+ }
#endif
- if(!mpvdec){ // driver not available (==compiled in)
- mp_msg(MSGT_DECVIDEO,MSGL_WARN,MSGTR_VideoCodecFamilyNotAvailableStr,
- sh_video->codec->name, sh_video->codec->drv);
- continue;
- }
- orig_w = sh_video->bih ? sh_video->bih->biWidth : sh_video->disp_w;
- orig_h = sh_video->bih ? sh_video->bih->biHeight : sh_video->disp_h;
- sh_video->disp_w = orig_w;
- sh_video->disp_h = orig_h;
- // it's available, let's try to init!
- if(sh_video->codec->flags & CODECS_FLAG_ALIGN16){
- // align width/height to n*16
- sh_video->disp_w=(sh_video->disp_w+15)&(~15);
- sh_video->disp_h=(sh_video->disp_h+15)&(~15);
- }
- if (sh_video->bih) {
- sh_video->bih->biWidth = sh_video->disp_w;
- sh_video->bih->biHeight = sh_video->disp_h;
- }
- // init()
- mp_msg(MSGT_DECVIDEO,MSGL_INFO,MSGTR_OpeningVideoDecoder,mpvdec->info->short_name,mpvdec->info->name);
- // clear vf init error, it is no longer relevant
- if (sh_video->vf_initialized < 0)
- sh_video->vf_initialized = 0;
- if(!mpvdec->init(sh_video)){
- mp_msg(MSGT_DECVIDEO,MSGL_INFO,MSGTR_VDecoderInitFailed);
- sh_video->disp_w=orig_w;
- sh_video->disp_h=orig_h;
- if (sh_video->bih) {
- sh_video->bih->biWidth = sh_video->disp_w;
- sh_video->bih->biHeight = sh_video->disp_h;
- }
- continue; // try next...
- }
- // Yeah! We got it!
- sh_video->initialized=1;
- return 1;
+ if (!sh_video->vd_driver) { // driver not available (==compiled in)
+ mp_tmsg(MSGT_DECVIDEO, MSGL_WARN,
+ _("Requested video codec family [%s] (vfm=%s) not available.\nEnable it at compilation.\n"),
+ sh_video->codec->name, sh_video->codec->drv);
+ continue;
+ }
+ orig_w = sh_video->bih ? sh_video->bih->biWidth : sh_video->disp_w;
+ orig_h = sh_video->bih ? sh_video->bih->biHeight : sh_video->disp_h;
+ sh_video->disp_w = orig_w;
+ sh_video->disp_h = orig_h;
+ // it's available, let's try to init!
+ if (sh_video->codec->flags & CODECS_FLAG_ALIGN16) {
+ // align width/height to n*16
+ sh_video->disp_w = (sh_video->disp_w + 15) & (~15);
+ sh_video->disp_h = (sh_video->disp_h + 15) & (~15);
+ }
+ if (sh_video->bih) {
+ sh_video->bih->biWidth = sh_video->disp_w;
+ sh_video->bih->biHeight = sh_video->disp_h;
+ }
+
+ // init()
+ const struct vd_functions *vd = sh_video->vd_driver;
+ mp_tmsg(MSGT_DECVIDEO, MSGL_INFO, "Opening video decoder: [%s] %s\n",
+ vd->info->short_name, vd->info->name);
+ // clear vf init error, it is no longer relevant
+ if (sh_video->vf_initialized < 0)
+ sh_video->vf_initialized = 0;
+ if (!vd->init(sh_video)) {
+ mp_tmsg(MSGT_DECVIDEO, MSGL_INFO, "VDecoder init failed :(\n");
+ sh_video->disp_w = orig_w;
+ sh_video->disp_h = orig_h;
+ if (sh_video->bih) {
+ sh_video->bih->biWidth = sh_video->disp_w;
+ sh_video->bih->biHeight = sh_video->disp_h;
+ }
+ continue; // try next...
+ }
+ // Yeah! We got it!
+ sh_video->initialized = 1;
+ sh_video->prev_codec_reordered_pts = MP_NOPTS_VALUE;
+ sh_video->prev_sorted_pts = MP_NOPTS_VALUE;
+ return 1;
}
return 0;
}
-int init_best_video_codec(sh_video_t *sh_video,char** video_codec_list,char** video_fm_list){
-char* vc_l_default[2]={"",(char*)NULL};
-stringset_t selected;
-// hack:
-if(!video_codec_list) video_codec_list=vc_l_default;
-// Go through the codec.conf and find the best codec...
-sh_video->initialized=0;
-stringset_init(&selected);
-while(!sh_video->initialized && *video_codec_list){
- char* video_codec=*(video_codec_list++);
- if(video_codec[0]){
- if(video_codec[0]=='-'){
- // disable this codec:
- stringset_add(&selected, video_codec+1);
- } else {
- // forced codec by name:
- mp_msg(MSGT_DECVIDEO,MSGL_INFO,MSGTR_ForcedVideoCodec,video_codec);
- init_video(sh_video,video_codec,NULL,-1, &selected);
- }
- } else {
- int status;
- // try in stability order: UNTESTED, WORKING, BUGGY. never try CRASHING.
- if(video_fm_list){
- char** fmlist=video_fm_list;
- // try first the preferred codec families:
- while(!sh_video->initialized && *fmlist){
- char* video_fm=*(fmlist++);
- mp_msg(MSGT_DECVIDEO,MSGL_INFO,MSGTR_TryForceVideoFmtStr,video_fm);
- for(status=CODECS_STATUS__MAX;status>=CODECS_STATUS__MIN;--status)
- if(init_video(sh_video,NULL,video_fm,status, &selected)) break;
- }
+int init_best_video_codec(sh_video_t *sh_video, char **video_codec_list,
+ char **video_fm_list)
+{
+ char *vc_l_default[2] = { "", (char *) NULL };
+ stringset_t selected;
+ // hack:
+ if (!video_codec_list)
+ video_codec_list = vc_l_default;
+ // Go through the codec.conf and find the best codec...
+ sh_video->initialized = 0;
+ stringset_init(&selected);
+ while (!sh_video->initialized && *video_codec_list) {
+ char *video_codec = *(video_codec_list++);
+ if (video_codec[0]) {
+ if (video_codec[0] == '-') {
+ // disable this codec:
+ stringset_add(&selected, video_codec + 1);
+ } else {
+ // forced codec by name:
+ mp_tmsg(MSGT_DECVIDEO, MSGL_INFO, "Forced video codec: %s\n",
+ video_codec);
+ init_video(sh_video, video_codec, NULL, -1, &selected);
+ }
+ } else {
+ int status;
+ // try in stability order: UNTESTED, WORKING, BUGGY. never try CRASHING.
+ if (video_fm_list) {
+ char **fmlist = video_fm_list;
+ // try first the preferred codec families:
+ while (!sh_video->initialized && *fmlist) {
+ char *video_fm = *(fmlist++);
+ mp_tmsg(MSGT_DECVIDEO, MSGL_INFO, "Trying to force video codec driver family %s...\n",
+ video_fm);
+ for (status = CODECS_STATUS__MAX;
+ status >= CODECS_STATUS__MIN; --status)
+ if (init_video
+ (sh_video, NULL, video_fm, status, &selected))
+ break;
+ }
+ }
+ if (!sh_video->initialized)
+ for (status = CODECS_STATUS__MAX; status >= CODECS_STATUS__MIN;
+ --status)
+ if (init_video(sh_video, NULL, NULL, status, &selected))
+ break;
+ }
}
- if(!sh_video->initialized)
- for(status=CODECS_STATUS__MAX;status>=CODECS_STATUS__MIN;--status)
- if(init_video(sh_video,NULL,NULL,status, &selected)) break;
- }
-}
-stringset_free(&selected);
+ stringset_free(&selected);
-if(!sh_video->initialized){
- mp_msg(MSGT_DECVIDEO,MSGL_ERR,MSGTR_CantFindVideoCodec,sh_video->format);
- return 0; // failed
-}
+ if (!sh_video->initialized) {
+ mp_tmsg(MSGT_DECVIDEO, MSGL_ERR, "Cannot find codec matching selected -vo and video format 0x%X.\n",
+ sh_video->format);
+ return 0; // failed
+ }
-mp_msg(MSGT_DECVIDEO,MSGL_INFO,MSGTR_SelectedVideoCodec,
- sh_video->codec->name,sh_video->codec->drv,sh_video->codec->info);
-return 1; // success
+ mp_tmsg(MSGT_DECVIDEO, MSGL_INFO, "Selected video codec: [%s] vfm: %s (%s)\n",
+ sh_video->codec->name, sh_video->codec->drv, sh_video->codec->info);
+ return 1; // success
}
void *decode_video(sh_video_t *sh_video, unsigned char *start, int in_size,
- int drop_frame, double pts)
+ int drop_frame, double pts)
{
mp_image_t *mpi = NULL;
unsigned int t = GetTimer();
unsigned int t2;
double tt;
+ struct MPOpts *opts = sh_video->opts;
- if (correct_pts && pts != MP_NOPTS_VALUE) {
- int delay = get_current_video_decoder_lag(sh_video);
- if (delay >= 0) {
- if (delay > sh_video->num_buffered_pts)
+ if (opts->correct_pts && pts != MP_NOPTS_VALUE) {
+ int delay = get_current_video_decoder_lag(sh_video);
+ if (delay >= 0) {
+ if (delay > sh_video->num_buffered_pts)
#if 0
- // this is disabled because vd_ffmpeg reports the same lag
- // after seek even when there are no buffered frames,
- // leading to incorrect error messages
- mp_msg(MSGT_DECVIDEO, MSGL_ERR, "Not enough buffered pts\n");
+ // this is disabled because vd_ffmpeg reports the same lag
+ // after seek even when there are no buffered frames,
+ // leading to incorrect error messages
+ mp_msg(MSGT_DECVIDEO, MSGL_ERR, "Not enough buffered pts\n");
#else
- ;
+ ;
#endif
- else
- sh_video->num_buffered_pts = delay;
- }
- if (sh_video->num_buffered_pts ==
- sizeof(sh_video->buffered_pts)/sizeof(double))
- mp_msg(MSGT_DECVIDEO, MSGL_ERR, "Too many buffered pts\n");
- else {
- int i, j;
- for (i = 0; i < sh_video->num_buffered_pts; i++)
- if (sh_video->buffered_pts[i] < pts)
- break;
- for (j = sh_video->num_buffered_pts; j > i; j--)
- sh_video->buffered_pts[j] = sh_video->buffered_pts[j-1];
- sh_video->buffered_pts[i] = pts;
- sh_video->num_buffered_pts++;
- }
+ else
+ sh_video->num_buffered_pts = delay;
+ }
+ if (sh_video->num_buffered_pts ==
+ sizeof(sh_video->buffered_pts) / sizeof(double))
+ mp_msg(MSGT_DECVIDEO, MSGL_ERR, "Too many buffered pts\n");
+ else {
+ int i, j;
+ for (i = 0; i < sh_video->num_buffered_pts; i++)
+ if (sh_video->buffered_pts[i] < pts)
+ break;
+ for (j = sh_video->num_buffered_pts; j > i; j--)
+ sh_video->buffered_pts[j] = sh_video->buffered_pts[j - 1];
+ sh_video->buffered_pts[i] = pts;
+ sh_video->num_buffered_pts++;
+ }
}
- mpi = mpvdec->decode(sh_video, start, in_size, drop_frame);
+ if (sh_video->vd_driver->decode2) {
+ mpi = sh_video->vd_driver->decode2(sh_video, start, in_size,
+ drop_frame, &pts);
+ } else {
+ mpi = sh_video->vd_driver->decode(sh_video, start, in_size,
+ drop_frame);
+ pts = MP_NOPTS_VALUE;
+ }
//------------------------ frame decoded. --------------------
@@ -391,36 +448,47 @@ void *decode_video(sh_video_t *sh_video, unsigned char *start, int in_size,
// some codecs are broken, and doesn't restore MMX state :(
// it happens usually with broken/damaged files.
if (gCpuCaps.has3DNow) {
- __asm__ volatile ("femms\n\t":::"memory");
- }
- else if (gCpuCaps.hasMMX) {
- __asm__ volatile ("emms\n\t":::"memory");
+ __asm__ volatile("femms\n\t":::"memory");
+ } else if (gCpuCaps.hasMMX) {
+ __asm__ volatile("emms\n\t":::"memory");
}
#endif
- t2 = GetTimer(); t = t2-t;
- tt = t*0.000001f;
+ t2 = GetTimer();
+ t = t2 - t;
+ tt = t * 0.000001f;
video_time_usage += tt;
if (!mpi || drop_frame)
- return NULL; // error / skipped frame
+ return NULL; // error / skipped frame
if (field_dominance == 0)
- mpi->fields |= MP_IMGFIELD_TOP_FIRST;
+ mpi->fields |= MP_IMGFIELD_TOP_FIRST;
else if (field_dominance == 1)
- mpi->fields &= ~MP_IMGFIELD_TOP_FIRST;
-
- if (correct_pts) {
- if (sh_video->num_buffered_pts) {
- sh_video->num_buffered_pts--;
- sh_video->pts = sh_video->buffered_pts[sh_video->num_buffered_pts];
- }
- else {
- mp_msg(MSGT_CPLAYER, MSGL_ERR, "No pts value from demuxer to "
- "use for frame!\n");
- sh_video->pts = MP_NOPTS_VALUE;
- }
+ mpi->fields &= ~MP_IMGFIELD_TOP_FIRST;
+
+ double prevpts = sh_video->codec_reordered_pts;
+ sh_video->prev_codec_reordered_pts = prevpts;
+ sh_video->codec_reordered_pts = pts;
+ if (prevpts != MP_NOPTS_VALUE && pts <= prevpts
+ || pts == MP_NOPTS_VALUE)
+ sh_video->num_reordered_pts_problems++;
+ prevpts = sh_video->sorted_pts;
+ if (opts->correct_pts) {
+ if (sh_video->num_buffered_pts) {
+ sh_video->num_buffered_pts--;
+ sh_video->sorted_pts =
+ sh_video->buffered_pts[sh_video->num_buffered_pts];
+ } else {
+ mp_msg(MSGT_CPLAYER, MSGL_ERR,
+ "No pts value from demuxer to " "use for frame!\n");
+ sh_video->sorted_pts = MP_NOPTS_VALUE;
+ }
}
+ pts = sh_video->sorted_pts;
+ if (prevpts != MP_NOPTS_VALUE && pts <= prevpts
+ || pts == MP_NOPTS_VALUE)
+ sh_video->num_sorted_pts_problems++;
return mpi;
}
@@ -431,18 +499,9 @@ int filter_video(sh_video_t *sh_video, void *frame, double pts)
vf_instance_t *vf = sh_video->vfilter;
// apply video filters and call the leaf vo/ve
int ret = vf->put_image(vf, mpi, pts);
- if (ret > 0) {
- // draw EOSD first so it ends up below the OSD.
- // Note that changing this is will not work right with vf_ass and the
- // vos currently always draw the EOSD first in paused mode.
-#ifdef CONFIG_ASS
- vf->control(vf, VFCTRL_DRAW_EOSD, NULL);
-#endif
- vf->control(vf, VFCTRL_DRAW_OSD, NULL);
- }
- t2 = GetTimer()-t2;
- vout_time_usage += t2*0.000001;
+ t2 = GetTimer() - t2;
+ vout_time_usage += t2 * 0.000001;
return ret;
}
diff --git a/libmpcodecs/dec_video.h b/libmpcodecs/dec_video.h
index 8b28202a19..f4b72a7d3f 100644
--- a/libmpcodecs/dec_video.h
+++ b/libmpcodecs/dec_video.h
@@ -21,6 +21,8 @@
#include "libmpdemux/stheader.h"
+struct osd_state;
+
// dec_video.c:
void vfm_help(void);
@@ -36,6 +38,7 @@ void set_video_quality(sh_video_t *sh_video, int quality);
int get_video_colors(sh_video_t *sh_video, const char *item, int *value);
int set_video_colors(sh_video_t *sh_video, const char *item, int value);
int set_rectangle(sh_video_t *sh_video, int param, int value);
+int redraw_osd(struct sh_video *sh_video, struct osd_state *osd);
void resync_video_stream(sh_video_t *sh_video);
int get_current_video_decoder_lag(sh_video_t *sh_video);
diff --git a/libmpcodecs/img_format.c b/libmpcodecs/img_format.c
index 5b858fa065..830180a55c 100644
--- a/libmpcodecs/img_format.c
+++ b/libmpcodecs/img_format.c
@@ -97,7 +97,7 @@ const char *vo_format_name(int format)
case IMGFMT_VDPAU_MPEG1: return "MPEG1 VDPAU acceleration";
case IMGFMT_VDPAU_MPEG2: return "MPEG2 VDPAU acceleration";
case IMGFMT_VDPAU_H264: return "H.264 VDPAU acceleration";
- case IMGFMT_VDPAU_MPEG4: return "MPEG-4 Part 2 VDPAU acceleration";
+ case IMGFMT_VDPAU_MPEG4: return "MPEG-4 Part 2 VDPAU acceleration";
case IMGFMT_VDPAU_WMV3: return "WMV3 VDPAU acceleration";
case IMGFMT_VDPAU_VC1: return "VC1 VDPAU acceleration";
}
diff --git a/libmpcodecs/mp_image.h b/libmpcodecs/mp_image.h
index ba69e720ef..38238db2a7 100644
--- a/libmpcodecs/mp_image.h
+++ b/libmpcodecs/mp_image.h
@@ -96,7 +96,7 @@
#define MP_IMGFIELD_BOTTOM 0x10
#define MP_IMGFIELD_INTERLACED 0x20
-typedef struct mp_image_s {
+typedef struct mp_image {
unsigned int flags;
unsigned char type;
int number;
diff --git a/libmpcodecs/native/xa_gsm.c b/libmpcodecs/native/xa_gsm.c
index 73bf31c3d8..2fc2357c13 100644
--- a/libmpcodecs/native/xa_gsm.c
+++ b/libmpcodecs/native/xa_gsm.c
@@ -258,7 +258,7 @@ register word * s;
}
/**** 4.3.2 */
-void Gsm_Long_Term_Synthesis_Filtering (S,Ncr,bcr,erp,drp)
+static void Gsm_Long_Term_Synthesis_Filtering (S,Ncr,bcr,erp,drp)
XA_GSM_STATE * S;
word Ncr;
word bcr;
diff --git a/libmpcodecs/pullup.c b/libmpcodecs/pullup.c
index 189d0cb24d..2675be6146 100644
--- a/libmpcodecs/pullup.c
+++ b/libmpcodecs/pullup.c
@@ -820,12 +820,3 @@ void pullup_free_context(struct pullup_context *c)
free(c->frame);
free(c);
}
-
-
-
-
-
-
-
-
-
diff --git a/libmpcodecs/vd.c b/libmpcodecs/vd.c
index 12b9b8c153..19ac82bf83 100644
--- a/libmpcodecs/vd.c
+++ b/libmpcodecs/vd.c
@@ -23,9 +23,9 @@
#include "config.h"
#include "mp_msg.h"
#include "help_mp.h"
+#include "options.h"
#include "codec-cfg.h"
-//#include "mp_image.h"
#include "img_format.h"
@@ -37,322 +37,320 @@
#include "vd.h"
#include "vf.h"
-//#include "vd_internal.h"
-
-extern vd_functions_t mpcodecs_vd_null;
-extern vd_functions_t mpcodecs_vd_ffmpeg;
-extern vd_functions_t mpcodecs_vd_theora;
-extern vd_functions_t mpcodecs_vd_dshow;
-extern vd_functions_t mpcodecs_vd_dmo;
-extern vd_functions_t mpcodecs_vd_vfw;
-extern vd_functions_t mpcodecs_vd_vfwex;
-extern vd_functions_t mpcodecs_vd_raw;
-extern vd_functions_t mpcodecs_vd_hmblck;
-extern vd_functions_t mpcodecs_vd_xanim;
-extern vd_functions_t mpcodecs_vd_mpng;
-extern vd_functions_t mpcodecs_vd_ijpg;
-extern vd_functions_t mpcodecs_vd_mtga;
-extern vd_functions_t mpcodecs_vd_sgi;
-extern vd_functions_t mpcodecs_vd_libmpeg2;
-extern vd_functions_t mpcodecs_vd_mpegpes;
-extern vd_functions_t mpcodecs_vd_zrmjpeg;
-extern vd_functions_t mpcodecs_vd_realvid;
-extern vd_functions_t mpcodecs_vd_xvid;
-extern vd_functions_t mpcodecs_vd_libdv;
-extern vd_functions_t mpcodecs_vd_lzo;
-extern vd_functions_t mpcodecs_vd_qtvideo;
+extern const vd_functions_t mpcodecs_vd_null;
+extern const vd_functions_t mpcodecs_vd_ffmpeg;
+extern const vd_functions_t mpcodecs_vd_theora;
+extern const vd_functions_t mpcodecs_vd_dshow;
+extern const vd_functions_t mpcodecs_vd_dmo;
+extern const vd_functions_t mpcodecs_vd_vfw;
+extern const vd_functions_t mpcodecs_vd_vfwex;
+extern const vd_functions_t mpcodecs_vd_raw;
+extern const vd_functions_t mpcodecs_vd_hmblck;
+extern const vd_functions_t mpcodecs_vd_xanim;
+extern const vd_functions_t mpcodecs_vd_mpng;
+extern const vd_functions_t mpcodecs_vd_ijpg;
+extern const vd_functions_t mpcodecs_vd_mtga;
+extern const vd_functions_t mpcodecs_vd_sgi;
+extern const vd_functions_t mpcodecs_vd_libmpeg2;
+extern const vd_functions_t mpcodecs_vd_mpegpes;
+extern const vd_functions_t mpcodecs_vd_zrmjpeg;
+extern const vd_functions_t mpcodecs_vd_realvid;
+extern const vd_functions_t mpcodecs_vd_xvid;
+extern const vd_functions_t mpcodecs_vd_libdv;
+extern const vd_functions_t mpcodecs_vd_lzo;
+extern const vd_functions_t mpcodecs_vd_qtvideo;
/* Please do not add any new decoders here. If you want to implement a new
* decoder, add it to libavcodec, except for wrappers around external
* libraries and decoders requiring binary support. */
const vd_functions_t * const mpcodecs_vd_drivers[] = {
- &mpcodecs_vd_null,
+ &mpcodecs_vd_null,
#ifdef CONFIG_LIBAVCODEC
- &mpcodecs_vd_ffmpeg,
+ &mpcodecs_vd_ffmpeg,
#endif
#ifdef CONFIG_OGGTHEORA
- &mpcodecs_vd_theora,
+ &mpcodecs_vd_theora,
#endif
#ifdef CONFIG_WIN32DLL
- &mpcodecs_vd_dshow,
- &mpcodecs_vd_dmo,
- &mpcodecs_vd_vfw,
- &mpcodecs_vd_vfwex,
+ &mpcodecs_vd_dshow,
+ &mpcodecs_vd_dmo,
+ &mpcodecs_vd_vfw,
+ &mpcodecs_vd_vfwex,
#endif
- &mpcodecs_vd_lzo,
- &mpcodecs_vd_raw,
- &mpcodecs_vd_hmblck,
+ &mpcodecs_vd_lzo,
+ &mpcodecs_vd_raw,
+ &mpcodecs_vd_hmblck,
#ifdef CONFIG_XANIM
- &mpcodecs_vd_xanim,
+ &mpcodecs_vd_xanim,
#endif
#ifdef CONFIG_PNG
- &mpcodecs_vd_mpng,
+ &mpcodecs_vd_mpng,
#endif
#ifdef CONFIG_JPEG
- &mpcodecs_vd_ijpg,
+ &mpcodecs_vd_ijpg,
#endif
- &mpcodecs_vd_mtga,
- &mpcodecs_vd_sgi,
+ &mpcodecs_vd_mtga,
+ &mpcodecs_vd_sgi,
#ifdef CONFIG_LIBMPEG2
- &mpcodecs_vd_libmpeg2,
+ &mpcodecs_vd_libmpeg2,
#endif
- &mpcodecs_vd_mpegpes,
+ &mpcodecs_vd_mpegpes,
#ifdef CONFIG_ZR
- &mpcodecs_vd_zrmjpeg,
+ &mpcodecs_vd_zrmjpeg,
#endif
#ifdef CONFIG_REALCODECS
- &mpcodecs_vd_realvid,
+ &mpcodecs_vd_realvid,
#endif
#ifdef CONFIG_XVID4
- &mpcodecs_vd_xvid,
+ &mpcodecs_vd_xvid,
#endif
#ifdef CONFIG_LIBDV095
- &mpcodecs_vd_libdv,
+ &mpcodecs_vd_libdv,
#endif
#ifdef CONFIG_QTX_CODECS
- &mpcodecs_vd_qtvideo,
+ &mpcodecs_vd_qtvideo,
#endif
/* Please do not add any new decoders here. If you want to implement a new
* decoder, add it to libavcodec, except for wrappers around external
* libraries and decoders requiring binary support. */
- NULL
+ NULL
};
#include "libvo/video_out.h"
-// libvo opts:
-int fullscreen=0;
-int vidmode=0;
-int softzoom=0;
-int flip=-1;
-int opt_screen_size_x=0;
-int opt_screen_size_y=0;
-float screen_size_xy=0;
-float movie_aspect=-1.0;
-int vo_flags=0;
-int vd_use_slices=1;
-
-/** global variables for gamma, brightness, contrast, saturation and hue
- modified by mplayer.c and gui/mplayer/gtk/eq.c:
- ranges -100 - 100
- 1000 if the vo default should be used
-*/
-int vo_gamma_gamma = 1000;
-int vo_gamma_brightness = 1000;
-int vo_gamma_contrast = 1000;
-int vo_gamma_saturation = 1000;
-int vo_gamma_hue = 1000;
-
-extern vd_functions_t* mpvdec; // FIXME!
-
-#define SCREEN_SIZE_X 1
-#define SCREEN_SIZE_Y 1
-
-int mpcodecs_config_vo(sh_video_t *sh, int w, int h, unsigned int preferred_outfmt){
- int i,j;
- unsigned int out_fmt=0;
- int screen_size_x=0;//SCREEN_SIZE_X;
- int screen_size_y=0;//SCREEN_SIZE_Y;
- vf_instance_t* vf=sh->vfilter,*sc=NULL;
- int palette=0;
- int vocfg_flags=0;
-
- if(w)
- sh->disp_w=w;
- if(h)
- sh->disp_h=h;
-
- if(!sh->disp_w || !sh->disp_h)
- return 0;
+int mpcodecs_config_vo(sh_video_t *sh, int w, int h,
+ unsigned int preferred_outfmt)
+{
+ struct MPOpts *opts = sh->opts;
+ int i, j;
+ unsigned int out_fmt = 0;
+ int screen_size_x = 0;
+ int screen_size_y = 0;
+ vf_instance_t *vf = sh->vfilter, *sc = NULL;
+ int palette = 0;
+ int vocfg_flags = 0;
+
+ if (w)
+ sh->disp_w = w;
+ if (h)
+ sh->disp_h = h;
+
+ if (!sh->disp_w || !sh->disp_h)
+ return 0;
mp_msg(MSGT_DECVIDEO, MSGL_V,
"VDec: vo config request - %d x %d (preferred colorspace: %s)\n",
w, h, vo_format_name(preferred_outfmt));
-// if(!vf) return 1; // temp hack
-
- if(get_video_quality_max(sh)<=0 && divx_quality){
- // user wants postprocess but no pp filter yet:
- sh->vfilter=vf=vf_open_filter(vf,"pp",NULL);
+ if (get_video_quality_max(sh) <= 0 && divx_quality) {
+ // user wants postprocess but no pp filter yet:
+ sh->vfilter = vf = vf_open_filter(opts, vf, "pp", NULL);
}
-
// check if libvo and codec has common outfmt (no conversion):
-csp_again:
-
- if( mp_msg_test(MSGT_DECVIDEO,MSGL_V) ){
- vf_instance_t* f=vf;
- mp_msg(MSGT_DECVIDEO,MSGL_V,"Trying filter chain:");
- for(f = vf ; f ; f = f->next)
- mp_msg(MSGT_DECVIDEO,MSGL_V," %s",f->info->name);
- mp_msg(MSGT_DECVIDEO,MSGL_V,"\n");
+ csp_again:
+
+ if (mp_msg_test(MSGT_DECVIDEO, MSGL_V)) {
+ vf_instance_t *f = vf;
+ mp_msg(MSGT_DECVIDEO, MSGL_V, "Trying filter chain:");
+ for (f = vf; f; f = f->next)
+ mp_msg(MSGT_DECVIDEO, MSGL_V, " %s", f->info->name);
+ mp_msg(MSGT_DECVIDEO, MSGL_V, "\n");
}
- j=-1;
- for(i=0;i<CODECS_MAX_OUTFMT;i++){
- int flags;
- out_fmt=sh->codec->outfmt[i];
- if(out_fmt==(unsigned int)0xFFFFFFFF) continue;
- flags=vf->query_format(vf,out_fmt);
- mp_msg(MSGT_CPLAYER,MSGL_DBG2,"vo_debug: query(%s) returned 0x%X (i=%d) \n",vo_format_name(out_fmt),flags,i);
- if((flags&VFCAP_CSP_SUPPORTED_BY_HW) || (flags&VFCAP_CSP_SUPPORTED && j<0)){
- // check (query) if codec really support this outfmt...
- sh->outfmtidx=j; // pass index to the control() function this way
- if(mpvdec->control(sh,VDCTRL_QUERY_FORMAT,&out_fmt)==CONTROL_FALSE){
- mp_msg(MSGT_CPLAYER,MSGL_DBG2,"vo_debug: codec query_format(%s) returned FALSE\n",vo_format_name(out_fmt));
- continue;
- }
- j=i; vo_flags=flags; if(flags&VFCAP_CSP_SUPPORTED_BY_HW) break;
- } else
- if(!palette && !(flags&(VFCAP_CSP_SUPPORTED_BY_HW|VFCAP_CSP_SUPPORTED)) && (out_fmt==IMGFMT_RGB8||out_fmt==IMGFMT_BGR8)){
- sh->outfmtidx=j; // pass index to the control() function this way
- if(mpvdec->control(sh,VDCTRL_QUERY_FORMAT,&out_fmt)!=CONTROL_FALSE)
- palette=1;
- }
+ j = -1;
+ for (i = 0; i < CODECS_MAX_OUTFMT; i++) {
+ int flags;
+ out_fmt = sh->codec->outfmt[i];
+ if (out_fmt == (unsigned int) 0xFFFFFFFF)
+ continue;
+ flags = vf->query_format(vf, out_fmt);
+ mp_msg(MSGT_CPLAYER, MSGL_DBG2,
+ "vo_debug: query(%s) returned 0x%X (i=%d) \n",
+ vo_format_name(out_fmt), flags, i);
+ if ((flags & VFCAP_CSP_SUPPORTED_BY_HW)
+ || (flags & VFCAP_CSP_SUPPORTED && j < 0)) {
+ // check (query) if codec really support this outfmt...
+ sh->outfmtidx = j; // pass index to the control() function this way
+ if (sh->vd_driver->control(sh, VDCTRL_QUERY_FORMAT, &out_fmt) ==
+ CONTROL_FALSE) {
+ mp_msg(MSGT_CPLAYER, MSGL_DBG2,
+ "vo_debug: codec query_format(%s) returned FALSE\n",
+ vo_format_name(out_fmt));
+ continue;
+ }
+ j = i;
+ sh->output_flags = flags;
+ if (flags & VFCAP_CSP_SUPPORTED_BY_HW)
+ break;
+ } else if (!palette
+ && !(flags &
+ (VFCAP_CSP_SUPPORTED_BY_HW | VFCAP_CSP_SUPPORTED))
+ && (out_fmt == IMGFMT_RGB8 || out_fmt == IMGFMT_BGR8)) {
+ sh->outfmtidx = j; // pass index to the control() function this way
+ if (sh->vd_driver->control(sh, VDCTRL_QUERY_FORMAT, &out_fmt) !=
+ CONTROL_FALSE)
+ palette = 1;
+ }
}
- if(j<0){
- // TODO: no match - we should use conversion...
- if(strcmp(vf->info->name,"scale") && palette!=-1){
- mp_msg(MSGT_DECVIDEO,MSGL_INFO,MSGTR_CouldNotFindColorspace);
- sc=vf=vf_open_filter(vf,"scale",NULL);
- goto csp_again;
- } else
- if(palette==1){
- mp_msg(MSGT_DECVIDEO,MSGL_V,"vd: Trying -vf palette...\n");
- palette=-1;
- vf=vf_open_filter(vf,"palette",NULL);
- goto csp_again;
- } else
- { // sws failed, if the last filter (vf_vo) support MPEGPES try to append vf_lavc
- vf_instance_t* vo, *vp = NULL, *ve, *vpp = NULL;
- // Remove the scale filter if we added it ourself
- if(vf == sc) {
- ve = vf;
- vf = vf->next;
- vf_uninit_filter(ve);
- }
- // Find the last filter (vf_vo)
- for(vo = vf ; vo->next ; vo = vo->next) {
- vpp = vp;
- vp = vo;
- }
- if(vo->query_format(vo,IMGFMT_MPEGPES) && (!vp || (vp && strcmp(vp->info->name,"lavc")))) {
- ve = vf_open_filter(vo,"lavc",NULL);
- if(vp) vp->next = ve;
- else vf = ve;
- goto csp_again;
- }
- if (vp && !strcmp(vp->info->name,"lavc")) {
- if (vpp) vpp->next = vo;
- else vf = vo;
+ if (j < 0) {
+ // TODO: no match - we should use conversion...
+ if (strcmp(vf->info->name, "scale") && palette != -1) {
+ mp_tmsg(MSGT_DECVIDEO, MSGL_INFO, "Could not find matching colorspace - retrying with -vf scale...\n");
+ sc = vf = vf_open_filter(opts, vf, "scale", NULL);
+ goto csp_again;
+ } else if (palette == 1) {
+ mp_msg(MSGT_DECVIDEO, MSGL_V, "vd: Trying -vf palette...\n");
+ palette = -1;
+ vf = vf_open_filter(opts, vf, "palette", NULL);
+ goto csp_again;
+ } else {
+ // sws failed, if the last filter (vf_vo) support MPEGPES try
+ // to append vf_lavc
+ vf_instance_t *vo, *vp = NULL, *ve, *vpp = NULL;
+ // Remove the scale filter if we added it ourselves
+ if (vf == sc) {
+ ve = vf;
+ vf = vf->next;
+ vf_uninit_filter(ve);
+ }
+ // Find the last filter (vf_vo)
+ for (vo = vf; vo->next; vo = vo->next) {
+ vpp = vp;
+ vp = vo;
+ }
+ if (vo->query_format(vo, IMGFMT_MPEGPES)
+ && (!vp || (vp && strcmp(vp->info->name, "lavc")))) {
+ ve = vf_open_filter(opts, vo, "lavc", NULL);
+ if (vp)
+ vp->next = ve;
+ else
+ vf = ve;
+ goto csp_again;
+ }
+ if (vp && !strcmp(vp->info->name,"lavc")) {
+ if (vpp)
+ vpp->next = vo;
+ else
+ vf = vo;
vf_uninit_filter(vp);
- }
- }
- mp_msg(MSGT_CPLAYER,MSGL_WARN,MSGTR_VOincompCodec);
- sh->vf_initialized=-1;
- return 0; // failed
+ }
+ }
+ mp_tmsg(MSGT_CPLAYER, MSGL_WARN,
+ "The selected video_out device is incompatible with this codec.\n"\
+ "Try appending the scale filter to your filter list,\n"\
+ "e.g. -vf spp,scale instead of -vf spp.\n");
+ sh->vf_initialized = -1;
+ return 0; // failed
}
- out_fmt=sh->codec->outfmt[j];
+ out_fmt = sh->codec->outfmt[j];
mp_msg(MSGT_CPLAYER, MSGL_V, "VDec: using %s as output csp (no %d)\n",
vo_format_name(out_fmt), j);
- sh->outfmtidx=j;
- sh->vfilter=vf;
+ sh->outfmtidx = j;
+ sh->vfilter = vf;
// autodetect flipping
- if(flip==-1){
- flip=0;
- if(sh->codec->outflags[j]&CODECS_FLAG_FLIP)
- if(!(sh->codec->outflags[j]&CODECS_FLAG_NOFLIP))
- flip=1;
+ if (opts->flip == -1) {
+ opts->flip = 0;
+ if (sh->codec->outflags[j] & CODECS_FLAG_FLIP)
+ if (!(sh->codec->outflags[j] & CODECS_FLAG_NOFLIP))
+ opts->flip = 1;
}
- if(vo_flags&VFCAP_FLIPPED) flip^=1;
- if(flip && !(vo_flags&VFCAP_FLIP)){
- // we need to flip, but no flipping filter avail.
- vf_add_before_vo(&vf, "flip", NULL);
- sh->vfilter = vf;
+ if (sh->output_flags & VFCAP_FLIPPED)
+ opts->flip ^= 1;
+ if (opts->flip && !(sh->output_flags & VFCAP_FLIP)) {
+ // we need to flip, but no flipping filter avail.
+ vf_add_before_vo(&vf, "flip", NULL);
+ sh->vfilter = vf;
}
-
// time to do aspect ratio corrections...
- if(movie_aspect>-1.0) sh->aspect = movie_aspect; // cmdline overrides autodetect
- else if(sh->stream_aspect!=0.0) sh->aspect = sh->stream_aspect;
-// if(!sh->aspect) sh->aspect=1.0;
-
- if(opt_screen_size_x||opt_screen_size_y){
- screen_size_x = opt_screen_size_x;
- screen_size_y = opt_screen_size_y;
- if(!vidmode){
- if(!screen_size_x) screen_size_x=SCREEN_SIZE_X;
- if(!screen_size_y) screen_size_y=SCREEN_SIZE_Y;
- if(screen_size_x<=8) screen_size_x*=sh->disp_w;
- if(screen_size_y<=8) screen_size_y*=sh->disp_h;
- }
- } else {
- // check source format aspect, calculate prescale ::atmos
- screen_size_x=sh->disp_w;
- screen_size_y=sh->disp_h;
- if(screen_size_xy>=0.001){
- if(screen_size_xy<=8){
- // -xy means x+y scale
- screen_size_x*=screen_size_xy;
- screen_size_y*=screen_size_xy;
- } else {
- // -xy means forced width while keeping correct aspect
- screen_size_x=screen_size_xy;
- screen_size_y=screen_size_xy*sh->disp_h/sh->disp_w;
- }
- }
- if(sh->aspect>0.01){
- int w;
- mp_msg(MSGT_CPLAYER,MSGL_INFO,MSGTR_MovieAspectIsSet,sh->aspect);
- mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_VIDEO_ASPECT=%1.4f\n", sh->aspect);
- w=(int)((float)screen_size_y*sh->aspect); w+=w%2; // round
- // we don't like horizontal downscale || user forced width:
- if(w<screen_size_x || screen_size_xy>8){
- screen_size_y=(int)((float)screen_size_x*(1.0/sh->aspect));
- screen_size_y+=screen_size_y%2; // round
- } else screen_size_x=w; // keep new width
+ if (opts->movie_aspect > -1.0)
+ sh->aspect = opts->movie_aspect; // cmdline overrides autodetect
+ else if (sh->stream_aspect != 0.0)
+ sh->aspect = sh->stream_aspect;
+
+ if (opts->screen_size_x || opts->screen_size_y) {
+ screen_size_x = opts->screen_size_x;
+ screen_size_y = opts->screen_size_y;
+ if (!opts->vidmode) {
+ if (!screen_size_x)
+ screen_size_x = 1;
+ if (!screen_size_y)
+ screen_size_y = 1;
+ if (screen_size_x <= 8)
+ screen_size_x *= sh->disp_w;
+ if (screen_size_y <= 8)
+ screen_size_y *= sh->disp_h;
+ }
} else {
- mp_msg(MSGT_CPLAYER,MSGL_INFO,MSGTR_MovieAspectUndefined);
+ // check source format aspect, calculate prescale ::atmos
+ screen_size_x = sh->disp_w;
+ screen_size_y = sh->disp_h;
+ if (opts->screen_size_xy >= 0.001) {
+ if (opts->screen_size_xy <= 8) {
+ // -xy means x+y scale
+ screen_size_x *= opts->screen_size_xy;
+ screen_size_y *= opts->screen_size_xy;
+ } else {
+ // -xy means forced width while keeping correct aspect
+ screen_size_x = opts->screen_size_xy;
+ screen_size_y = opts->screen_size_xy * sh->disp_h / sh->disp_w;
+ }
+ }
+ if (sh->aspect > 0.01) {
+ int w;
+ mp_tmsg(MSGT_CPLAYER, MSGL_INFO, "Movie-Aspect is %.2f:1 - prescaling to correct movie aspect.\n",
+ sh->aspect);
+ mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_VIDEO_ASPECT=%1.4f\n",
+ sh->aspect);
+ w = (int) ((float) screen_size_y * sh->aspect);
+ w += w % 2; // round
+ // we don't like horizontal downscale || user forced width:
+ if (w < screen_size_x || opts->screen_size_xy > 8) {
+ screen_size_y =
+ (int) ((float) screen_size_x * (1.0 / sh->aspect));
+ screen_size_y += screen_size_y % 2; // round
+ } else
+ screen_size_x = w; // keep new width
+ } else {
+ mp_tmsg(MSGT_CPLAYER, MSGL_INFO, "Movie-Aspect is undefined - no prescaling applied.\n");
+ }
}
- }
- vocfg_flags = (fullscreen ? VOFLAG_FULLSCREEN:0)
- | (vidmode ? VOFLAG_MODESWITCHING:0)
- | (softzoom ? VOFLAG_SWSCALE:0)
- | (flip ? VOFLAG_FLIPPING:0);
+ vocfg_flags = (opts->fullscreen ? VOFLAG_FULLSCREEN : 0)
+ | (opts->vidmode ? VOFLAG_MODESWITCHING : 0)
+ | (opts->softzoom ? VOFLAG_SWSCALE : 0)
+ | (opts->flip ? VOFLAG_FLIPPING : 0);
// Time to config libvo!
- mp_msg(MSGT_CPLAYER,MSGL_V,"VO Config (%dx%d->%dx%d,flags=%d,'%s',0x%X)\n",
- sh->disp_w,sh->disp_h,
- screen_size_x,screen_size_y,
- vocfg_flags,
- "MPlayer",out_fmt);
+ mp_msg(MSGT_CPLAYER, MSGL_V,
+ "VO Config (%dx%d->%dx%d,flags=%d,'%s',0x%X)\n", sh->disp_w,
+ sh->disp_h, screen_size_x, screen_size_y, vocfg_flags, "MPlayer",
+ out_fmt);
vf->w = sh->disp_w;
vf->h = sh->disp_h;
- if(vf_config_wrapper(vf,sh->disp_w,sh->disp_h,
- screen_size_x,screen_size_y,
- vocfg_flags,
- out_fmt)==0){
-// "MPlayer",out_fmt)){
- mp_msg(MSGT_CPLAYER,MSGL_WARN,MSGTR_CannotInitVO);
- sh->vf_initialized=-1;
- return 0;
+ if (vf_config_wrapper
+ (vf, sh->disp_w, sh->disp_h, screen_size_x, screen_size_y, vocfg_flags,
+ out_fmt) == 0) {
+ mp_tmsg(MSGT_CPLAYER, MSGL_WARN, "FATAL: Cannot initialize video driver.\n");
+ sh->vf_initialized = -1;
+ return 0;
}
- sh->vf_initialized=1;
+ sh->vf_initialized = 1;
- if (vo_gamma_gamma != 1000)
- set_video_colors(sh, "gamma", vo_gamma_gamma);
- if (vo_gamma_brightness != 1000)
- set_video_colors(sh, "brightness", vo_gamma_brightness);
- if (vo_gamma_contrast != 1000)
- set_video_colors(sh, "contrast", vo_gamma_contrast);
- if (vo_gamma_saturation != 1000)
- set_video_colors(sh, "saturation", vo_gamma_saturation);
- if (vo_gamma_hue != 1000)
- set_video_colors(sh, "hue", vo_gamma_hue);
+ if (opts->vo_gamma_gamma != 1000)
+ set_video_colors(sh, "gamma", opts->vo_gamma_gamma);
+ if (opts->vo_gamma_brightness != 1000)
+ set_video_colors(sh, "brightness", opts->vo_gamma_brightness);
+ if (opts->vo_gamma_contrast != 1000)
+ set_video_colors(sh, "contrast", opts->vo_gamma_contrast);
+ if (opts->vo_gamma_saturation != 1000)
+ set_video_colors(sh, "saturation", opts->vo_gamma_saturation);
+ if (opts->vo_gamma_hue != 1000)
+ set_video_colors(sh, "hue", opts->vo_gamma_hue);
return 1;
}
@@ -361,15 +359,22 @@ csp_again:
// mp_imgflag: buffer requirements (read/write, preserve, stride limits), see mp_image.h
// returns NULL or allocated mp_image_t*
// Note: buffer allocation may be moved to mpcodecs_config_vo() later...
-mp_image_t* mpcodecs_get_image(sh_video_t *sh, int mp_imgtype, int mp_imgflag, int w, int h){
- mp_image_t* mpi=vf_get_image(sh->vfilter,sh->codec->outfmt[sh->outfmtidx],mp_imgtype,mp_imgflag,w,h);
- if (mpi) mpi->x=mpi->y=0;
- return mpi;
+mp_image_t *mpcodecs_get_image(sh_video_t *sh, int mp_imgtype, int mp_imgflag,
+ int w, int h)
+{
+ mp_image_t *mpi =
+ vf_get_image(sh->vfilter, sh->codec->outfmt[sh->outfmtidx], mp_imgtype,
+ mp_imgflag, w, h);
+ if (mpi)
+ mpi->x = mpi->y = 0;
+ return mpi;
}
-void mpcodecs_draw_slice(sh_video_t *sh, unsigned char** src, int* stride, int w,int h, int x, int y) {
- struct vf_instance_s* vf = sh->vfilter;
+void mpcodecs_draw_slice(sh_video_t *sh, unsigned char **src, int *stride,
+ int w, int h, int x, int y)
+{
+ struct vf_instance *vf = sh->vfilter;
- if(vf->draw_slice)
- vf->draw_slice(vf,src,stride,w,h,x,y);
+ if (vf->draw_slice)
+ vf->draw_slice(vf, src, stride, w, h, x, y);
}
diff --git a/libmpcodecs/vd.h b/libmpcodecs/vd.h
index b033513664..4615a9dc6e 100644
--- a/libmpcodecs/vd.h
+++ b/libmpcodecs/vd.h
@@ -26,20 +26,20 @@
typedef mp_codec_info_t vd_info_t;
/* interface of video decoder drivers */
-typedef struct vd_functions_s
+typedef struct vd_functions
{
- vd_info_t *info;
+ const vd_info_t *info;
int (*init)(sh_video_t *sh);
void (*uninit)(sh_video_t *sh);
int (*control)(sh_video_t *sh,int cmd,void* arg, ...);
mp_image_t* (*decode)(sh_video_t *sh,void* data,int len,int flags);
+ struct mp_image *(*decode2)(struct sh_video *sh, void *data, int len,
+ int flags, double *reordered_pts);
} vd_functions_t;
// NULL terminated array of all drivers
extern const vd_functions_t * const mpcodecs_vd_drivers[];
-extern int vd_use_slices;
-
#define VDCTRL_QUERY_FORMAT 3 /* test for availabilty of a format */
#define VDCTRL_QUERY_MAX_PP_LEVEL 4 /* test for postprocessing support (max level) */
#define VDCTRL_SET_PP_LEVEL 5 /* set postprocessing level */
diff --git a/libmpcodecs/vd_dmo.c b/libmpcodecs/vd_dmo.c
index 830f304057..217fd05725 100644
--- a/libmpcodecs/vd_dmo.c
+++ b/libmpcodecs/vd_dmo.c
@@ -29,7 +29,7 @@
#include "loader/dmo/DMO_VideoDecoder.h"
-static vd_info_t info = {
+static const vd_info_t info = {
"DMO video codecs",
"dmo",
"A'rpi",
@@ -48,8 +48,8 @@ static int control(sh_video_t *sh,int cmd,void* arg,...){
static int init(sh_video_t *sh){
unsigned int out_fmt;
if(!(sh->context=DMO_VideoDecoder_Open(sh->codec->dll,&sh->codec->guid, sh->bih, 0, 0))){
- mp_msg(MSGT_DECVIDEO,MSGL_ERR,MSGTR_MissingDLLcodec,sh->codec->dll);
- mp_msg(MSGT_DECVIDEO,MSGL_HINT,MSGTR_DownloadCodecPackage);
+ mp_tmsg(MSGT_DECVIDEO,MSGL_ERR,"ERROR: Could not open required DirectShow codec %s.\n",sh->codec->dll);
+ mp_tmsg(MSGT_DECVIDEO,MSGL_HINT,"You need to upgrade/install the binary codecs package.\nGo to http://www.mplayerhq.hu/dload.html\n");
return 0;
}
if(!mpcodecs_config_vo(sh,sh->disp_w,sh->disp_h,IMGFMT_YUY2)) return 0;
@@ -68,7 +68,7 @@ static int init(sh_video_t *sh){
DMO_VideoDecoder_SetDestFmt(sh->context,out_fmt&255,0); // RGB/BGR
}
DMO_VideoDecoder_StartInternal(sh->context);
- mp_msg(MSGT_DECVIDEO,MSGL_V,MSGTR_DMOInitOK);
+ mp_tmsg(MSGT_DECVIDEO,MSGL_V,"INFO: Win32/DMO video codec init OK.\n");
return 1;
}
@@ -94,7 +94,7 @@ static mp_image_t* decode(sh_video_t *sh,void* data,int len,int flags){
sh->disp_w, sh->disp_h);
if(!mpi){ // temporary!
- mp_msg(MSGT_DECVIDEO,MSGL_WARN,MSGTR_MPCODECS_CouldntAllocateImageForCinepakCodec);
+ mp_tmsg(MSGT_DECVIDEO,MSGL_WARN,"[VD_DMO] Couldn't allocate image for cinepak codec.\n");
return NULL;
}
diff --git a/libmpcodecs/vd_dshow.c b/libmpcodecs/vd_dshow.c
index c50b0e7f80..f75294eecc 100644
--- a/libmpcodecs/vd_dshow.c
+++ b/libmpcodecs/vd_dshow.c
@@ -29,7 +29,7 @@
#include "loader/dshow/DS_VideoDecoder.h"
-static vd_info_t info = {
+static const vd_info_t info = {
"DirectShow video codecs",
"dshow",
"A'rpi",
@@ -76,8 +76,8 @@ static int init(sh_video_t *sh){
return 0;
if(!(sh->context=DS_VideoDecoder_Open(sh->codec->dll,&sh->codec->guid, sh->bih, 0, 0))){
- mp_msg(MSGT_DECVIDEO,MSGL_ERR,MSGTR_MissingDLLcodec,sh->codec->dll);
- mp_msg(MSGT_DECVIDEO,MSGL_HINT,MSGTR_DownloadCodecPackage);
+ mp_tmsg(MSGT_DECVIDEO,MSGL_ERR,"ERROR: Could not open required DirectShow codec %s.\n",sh->codec->dll);
+ mp_tmsg(MSGT_DECVIDEO,MSGL_HINT,"You need to upgrade/install the binary codecs package.\nGo to http://www.mplayerhq.hu/dload.html\n");
return 0;
}
if(!mpcodecs_config_vo(sh,sh->disp_w,sh->disp_h,IMGFMT_YUY2)) return 0;
@@ -97,7 +97,7 @@ static int init(sh_video_t *sh){
}
DS_SetAttr_DivX("Quality",divx_quality);
DS_VideoDecoder_StartInternal(sh->context);
- mp_msg(MSGT_DECVIDEO,MSGL_V,MSGTR_DShowInitOK);
+ mp_tmsg(MSGT_DECVIDEO,MSGL_V,"INFO: Win32/DShow video codec init OK.\n");
return 1;
}
@@ -123,7 +123,7 @@ static mp_image_t* decode(sh_video_t *sh,void* data,int len,int flags){
sh->disp_w, sh->disp_h);
if(!mpi){ // temporary!
- mp_msg(MSGT_DECVIDEO,MSGL_WARN,MSGTR_MPCODECS_CouldntAllocateImageForCinepakCodec);
+ mp_tmsg(MSGT_DECVIDEO,MSGL_WARN,"[VD_DMO] Couldn't allocate image for cinepak codec.\n");
return NULL;
}
diff --git a/libmpcodecs/vd_ffmpeg.c b/libmpcodecs/vd_ffmpeg.c
index 910dd447ae..83fe050051 100644
--- a/libmpcodecs/vd_ffmpeg.c
+++ b/libmpcodecs/vd_ffmpeg.c
@@ -20,20 +20,25 @@
#include <stdlib.h>
#include <assert.h>
#include <time.h>
+#include <stdbool.h>
#include "config.h"
#include "mp_msg.h"
#include "help_mp.h"
+#include "options.h"
#include "av_opts.h"
#include "libavutil/common.h"
-#include "libavutil/intreadwrite.h"
+#include "ffmpeg_files/intreadwrite.h"
#include "mpbswap.h"
#include "fmt-conversion.h"
-#include "vd_internal.h"
+#include "vd.h"
+#include "img_format.h"
+#include "libmpdemux/stheader.h"
+#include "codec-cfg.h"
-static vd_info_t info = {
+static const vd_info_t info = {
"FFmpeg's libavcodec codec family",
"ffmpeg",
"A'rpi",
@@ -41,8 +46,6 @@ static vd_info_t info = {
"native codecs"
};
-LIBVD_EXTERN(ffmpeg)
-
#include "libavcodec/avcodec.h"
#if AVPALETTE_SIZE > 1024
@@ -71,57 +74,39 @@ typedef struct {
int ip_count;
int b_count;
AVRational last_sample_aspect_ratio;
+ int lowres;
} vd_ffmpeg_ctx;
#include "m_option.h"
static int get_buffer(AVCodecContext *avctx, AVFrame *pic);
static void release_buffer(AVCodecContext *avctx, AVFrame *pic);
-static void draw_slice(struct AVCodecContext *s, const AVFrame *src, int offset[4],
- int y, int type, int height);
+static void draw_slice(struct AVCodecContext *s, const AVFrame *src,
+ int offset[4], int y, int type, int height);
static enum PixelFormat get_format(struct AVCodecContext *avctx,
const enum PixelFormat *pix_fmt);
-
-static int lavc_param_workaround_bugs= FF_BUG_AUTODETECT;
-static int lavc_param_error_resilience=2;
-static int lavc_param_error_concealment=3;
-static int lavc_param_gray=0;
-static int lavc_param_vstats=0;
-static int lavc_param_idct_algo=0;
-static int lavc_param_debug=0;
-static int lavc_param_vismv=0;
-static int lavc_param_skip_top=0;
-static int lavc_param_skip_bottom=0;
-static int lavc_param_fast=0;
-static int lavc_param_lowres=0;
-static char *lavc_param_lowres_str=NULL;
-static char *lavc_param_skip_loop_filter_str = NULL;
-static char *lavc_param_skip_idct_str = NULL;
-static char *lavc_param_skip_frame_str = NULL;
-static int lavc_param_threads=1;
-static int lavc_param_bitexact=0;
-static char *lavc_avopt = NULL;
+static void uninit(struct sh_video *sh);
const m_option_t lavc_decode_opts_conf[]={
- {"bug", &lavc_param_workaround_bugs, CONF_TYPE_INT, CONF_RANGE, -1, 999999, NULL},
- {"er", &lavc_param_error_resilience, CONF_TYPE_INT, CONF_RANGE, 0, 99, NULL},
- {"gray", &lavc_param_gray, CONF_TYPE_FLAG, 0, 0, CODEC_FLAG_PART, NULL},
- {"idct", &lavc_param_idct_algo, CONF_TYPE_INT, CONF_RANGE, 0, 99, NULL},
- {"ec", &lavc_param_error_concealment, CONF_TYPE_INT, CONF_RANGE, 0, 99, NULL},
- {"vstats", &lavc_param_vstats, CONF_TYPE_FLAG, 0, 0, 1, NULL},
- {"debug", &lavc_param_debug, CONF_TYPE_INT, CONF_RANGE, 0, 9999999, NULL},
- {"vismv", &lavc_param_vismv, CONF_TYPE_INT, CONF_RANGE, 0, 9999999, NULL},
- {"st", &lavc_param_skip_top, CONF_TYPE_INT, CONF_RANGE, 0, 999, NULL},
- {"sb", &lavc_param_skip_bottom, CONF_TYPE_INT, CONF_RANGE, 0, 999, NULL},
- {"fast", &lavc_param_fast, CONF_TYPE_FLAG, 0, 0, CODEC_FLAG2_FAST, NULL},
- {"lowres", &lavc_param_lowres_str, CONF_TYPE_STRING, 0, 0, 0, NULL},
- {"skiploopfilter", &lavc_param_skip_loop_filter_str, CONF_TYPE_STRING, 0, 0, 0, NULL},
- {"skipidct", &lavc_param_skip_idct_str, CONF_TYPE_STRING, 0, 0, 0, NULL},
- {"skipframe", &lavc_param_skip_frame_str, CONF_TYPE_STRING, 0, 0, 0, NULL},
- {"threads", &lavc_param_threads, CONF_TYPE_INT, CONF_RANGE, 1, 8, NULL},
- {"bitexact", &lavc_param_bitexact, CONF_TYPE_FLAG, 0, 0, CODEC_FLAG_BITEXACT, NULL},
- {"o", &lavc_avopt, CONF_TYPE_STRING, 0, 0, 0, NULL},
+ OPT_INTRANGE("bug", lavc_param.workaround_bugs, 0, -1, 999999),
+ OPT_INTRANGE("er", lavc_param.error_resilience, 0, 0, 99),
+ OPT_FLAG_ON("gray", lavc_param.gray, 0),
+ OPT_INTRANGE("idct", lavc_param.idct_algo, 0, 0, 99),
+ OPT_INTRANGE("ec", lavc_param.error_concealment, 0, 0, 99),
+ OPT_FLAG_ON("vstats", lavc_param.vstats, 0),
+ OPT_INTRANGE("debug", lavc_param.debug, 0, 0, 9999999),
+ OPT_INTRANGE("vismv", lavc_param.vismv, 0, 0, 9999999),
+ OPT_INTRANGE("st", lavc_param.skip_top, 0, 0, 999),
+ OPT_INTRANGE("sb", lavc_param.skip_bottom, 0, 0, 999),
+ OPT_FLAG_CONSTANTS("fast", lavc_param.fast, 0, 0, CODEC_FLAG2_FAST),
+ OPT_STRING("lowres", lavc_param.lowres_str, 0),
+ OPT_STRING("skiploopfilter", lavc_param.skip_loop_filter_str, 0),
+ OPT_STRING("skipidct", lavc_param.skip_idct_str, 0),
+ OPT_STRING("skipframe", lavc_param.skip_frame_str, 0),
+ OPT_INTRANGE("threads", lavc_param.threads, 0, 1, 8),
+ OPT_FLAG_CONSTANTS("bitexact", lavc_param.bitexact, 0, 0, CODEC_FLAG_BITEXACT),
+ OPT_STRING("o", lavc_param.avopt, 0),
{NULL, NULL, 0, 0, 0, 0, NULL}
};
@@ -166,96 +151,32 @@ static int control(sh_video_t *sh, int cmd, void *arg, ...){
case VDCTRL_RESYNC_STREAM:
avcodec_flush_buffers(avctx);
return CONTROL_TRUE;
- case VDCTRL_QUERY_UNSEEN_FRAMES:
- return avctx->has_b_frames + 10;
- }
- return CONTROL_UNKNOWN;
-}
-
-void mp_msp_av_log_callback(void *ptr, int level, const char *fmt, va_list vl)
-{
- static int print_prefix=1;
- AVClass *avc= ptr ? *(AVClass **)ptr : NULL;
- int type= MSGT_FIXME;
- int mp_level;
- char buf[256];
-
- switch(level){
- case AV_LOG_VERBOSE: mp_level = MSGL_V ; break;
- case AV_LOG_DEBUG: mp_level= MSGL_V ; break;
- case AV_LOG_INFO : mp_level= MSGL_INFO; break;
- case AV_LOG_ERROR: mp_level= MSGL_ERR ; break;
- default : mp_level= MSGL_ERR ; break;
- }
-
- if (!mp_msg_test(type, mp_level)) return;
-
- if(ptr){
- if(!strcmp(avc->class_name, "AVCodecContext")){
- AVCodecContext *s= ptr;
- if(s->codec){
- if(s->codec->type == CODEC_TYPE_AUDIO){
- if(s->codec->decode)
- type= MSGT_DECAUDIO;
- }else if(s->codec->type == CODEC_TYPE_VIDEO){
- if(s->codec->decode)
- type= MSGT_DECVIDEO;
- }
- //FIXME subtitles, encoders (what msgt for them? there is no appropriate ...)
- }
- }else if(!strcmp(avc->class_name, "AVFormatContext")){
-#if 0 //needs libavformat include FIXME iam too lazy to do this cleanly, probably the whole should be moved out of this file ...
- AVFormatContext *s= ptr;
- if(s->iformat)
- type= MSGT_DEMUXER;
- else if(s->oformat)
- type= MSGT_MUXER;
+ case VDCTRL_QUERY_UNSEEN_FRAMES:;
+ int delay = avctx->has_b_frames;
+#if defined(FF_THREAD_FRAME) && LIBAVCODEC_VERSION_MAJOR <= 52 && LIBAVCODEC_VERSION_MINOR < 49
+ // FFmpeg-mt has extra delay when using frame threading
+ // In newer versions that is included in has_b_frames
+ if (avctx->thread_type & FF_THREAD_FRAME)
+ delay += avctx->thread_count - 1;
#endif
- }
- }
-
- if(print_prefix && avc) {
- mp_msg(type, mp_level, "[%s @ %p]", avc->item_name(ptr), avc);
- }
-
- print_prefix= strchr(fmt, '\n') != NULL;
- vsnprintf(buf, sizeof(buf), fmt, vl);
- mp_msg(type, mp_level, buf);
-}
-
-static void set_format_params(struct AVCodecContext *avctx, enum PixelFormat fmt){
- int imgfmt;
- if (fmt == PIX_FMT_NONE)
- return;
- imgfmt = pixfmt2imgfmt(fmt);
- if (IMGFMT_IS_XVMC(imgfmt) || IMGFMT_IS_VDPAU(imgfmt)) {
- sh_video_t *sh = avctx->opaque;
- vd_ffmpeg_ctx *ctx = sh->context;
- ctx->do_dr1 = 1;
- ctx->do_slices = 1;
- avctx->thread_count = 1;
- avctx->get_buffer = get_buffer;
- avctx->release_buffer = release_buffer;
- avctx->reget_buffer = get_buffer;
- avctx->draw_horiz_band = draw_slice;
- mp_msg(MSGT_DECVIDEO, MSGL_INFO, MSGTR_MPCODECS_XVMCAcceleratedMPEG2);
- avctx->slice_flags = SLICE_FLAG_CODED_ORDER|SLICE_FLAG_ALLOW_FIELD;
+ return delay + 10;
}
+ return CONTROL_UNKNOWN;
}
// init driver
static int init(sh_video_t *sh){
+ struct lavc_param *lavc_param = &sh->opts->lavc_param;
AVCodecContext *avctx;
vd_ffmpeg_ctx *ctx;
AVCodec *lavc_codec;
int lowres_w=0;
- int do_vis_debug= lavc_param_vismv || (lavc_param_debug&(FF_DEBUG_VIS_MB_TYPE|FF_DEBUG_VIS_QP));
+ int do_vis_debug= lavc_param->vismv || (lavc_param->debug&(FF_DEBUG_VIS_MB_TYPE|FF_DEBUG_VIS_QP));
if(!avcodec_initialized){
avcodec_init();
avcodec_register_all();
avcodec_initialized=1;
- av_log_set_callback(mp_msp_av_log_callback);
}
ctx = sh->context = malloc(sizeof(vd_ffmpeg_ctx));
@@ -265,12 +186,12 @@ static int init(sh_video_t *sh){
lavc_codec = (AVCodec *)avcodec_find_decoder_by_name(sh->codec->dll);
if(!lavc_codec){
- mp_msg(MSGT_DECVIDEO, MSGL_ERR, MSGTR_MissingLAVCcodec, sh->codec->dll);
+ mp_tmsg(MSGT_DECVIDEO, MSGL_ERR, "Cannot find codec '%s' in libavcodec...\n", sh->codec->dll);
uninit(sh);
return 0;
}
- if(vd_use_slices && (lavc_codec->capabilities&CODEC_CAP_DRAW_HORIZ_BAND) && !do_vis_debug)
+ if(sh->opts->vd_use_slices && (lavc_codec->capabilities&CODEC_CAP_DRAW_HORIZ_BAND) && !do_vis_debug)
ctx->do_slices=1;
if(lavc_codec->capabilities&CODEC_CAP_DR1 && !do_vis_debug && lavc_codec->id != CODEC_ID_H264 && lavc_codec->id != CODEC_ID_INTERPLAY_VIDEO && lavc_codec->id != CODEC_ID_ROQ)
@@ -285,19 +206,32 @@ static int init(sh_video_t *sh){
avctx->codec_type = CODEC_TYPE_VIDEO;
avctx->codec_id = lavc_codec->id;
-#if CONFIG_VDPAU
- if(lavc_codec->capabilities & CODEC_CAP_HWACCEL_VDPAU){
- avctx->get_format = get_format;
+ if (lavc_codec->capabilities & CODEC_CAP_HWACCEL // XvMC
+ || lavc_codec->capabilities & CODEC_CAP_HWACCEL_VDPAU) {
+ ctx->do_dr1 = true;
+ ctx->do_slices = true;
+ lavc_param->threads = 1;
+ avctx->get_format = get_format;
+ avctx->get_buffer = get_buffer;
+ avctx->release_buffer = release_buffer;
+ avctx->reget_buffer = get_buffer;
+ avctx->draw_horiz_band = draw_slice;
+ if (lavc_codec->capabilities & CODEC_CAP_HWACCEL)
+ mp_msg(MSGT_DECVIDEO, MSGL_V, "[VD_FFMPEG] XVMC-accelerated "
+ "MPEG-2.\n");
+ if (lavc_codec->capabilities & CODEC_CAP_HWACCEL_VDPAU)
+ mp_msg(MSGT_DECVIDEO, MSGL_V, "[VD_FFMPEG] VDPAU hardware "
+ "decoding.\n");
+ avctx->slice_flags = SLICE_FLAG_CODED_ORDER|SLICE_FLAG_ALLOW_FIELD;
}
-#endif /* CONFIG_VDPAU */
-#if CONFIG_XVMC
- if(lavc_codec->capabilities & CODEC_CAP_HWACCEL){
- mp_msg(MSGT_DECVIDEO, MSGL_INFO, MSGTR_MPCODECS_XVMCAcceleratedCodec);
- avctx->get_format= get_format;//for now only this decoder will use it
- // HACK around badly placed checks in mpeg_mc_decode_init
- set_format_params(avctx, PIX_FMT_XVMC_MPEG2_IDCT);
+
+ /* Our get_buffer and draw_horiz_band callbacks are not safe to call
+ * from other threads. */
+ if (lavc_param->threads > 1) {
+ ctx->do_dr1 = false;
+ ctx->do_slices = false;
}
-#endif /* CONFIG_XVMC */
+
if(ctx->do_dr1){
avctx->flags|= CODEC_FLAG_EMU_EDGE;
avctx->get_buffer= get_buffer;
@@ -305,38 +239,38 @@ static int init(sh_video_t *sh){
avctx->reget_buffer= get_buffer;
}
- avctx->flags|= lavc_param_bitexact;
+ avctx->flags|= lavc_param->bitexact;
avctx->width = sh->disp_w;
avctx->height= sh->disp_h;
- avctx->workaround_bugs= lavc_param_workaround_bugs;
- avctx->error_recognition= lavc_param_error_resilience;
- if(lavc_param_gray) avctx->flags|= CODEC_FLAG_GRAY;
- avctx->flags2|= lavc_param_fast;
+ avctx->workaround_bugs= lavc_param->workaround_bugs;
+ avctx->error_recognition= lavc_param->error_resilience;
+ if(lavc_param->gray) avctx->flags|= CODEC_FLAG_GRAY;
+ avctx->flags2|= lavc_param->fast;
avctx->codec_tag= sh->format;
avctx->stream_codec_tag= sh->video.fccHandler;
- avctx->idct_algo= lavc_param_idct_algo;
- avctx->error_concealment= lavc_param_error_concealment;
- avctx->debug= lavc_param_debug;
- if (lavc_param_debug)
+ avctx->idct_algo= lavc_param->idct_algo;
+ avctx->error_concealment= lavc_param->error_concealment;
+ avctx->debug= lavc_param->debug;
+ if (lavc_param->debug)
av_log_set_level(AV_LOG_DEBUG);
- avctx->debug_mv= lavc_param_vismv;
- avctx->skip_top = lavc_param_skip_top;
- avctx->skip_bottom= lavc_param_skip_bottom;
- if(lavc_param_lowres_str != NULL)
+ avctx->debug_mv= lavc_param->vismv;
+ avctx->skip_top = lavc_param->skip_top;
+ avctx->skip_bottom= lavc_param->skip_bottom;
+ if(lavc_param->lowres_str != NULL)
{
- sscanf(lavc_param_lowres_str, "%d,%d", &lavc_param_lowres, &lowres_w);
- if(lavc_param_lowres < 1 || lavc_param_lowres > 16 || (lowres_w > 0 && avctx->width < lowres_w))
- lavc_param_lowres = 0;
- avctx->lowres = lavc_param_lowres;
- }
- avctx->skip_loop_filter = str2AVDiscard(lavc_param_skip_loop_filter_str);
- avctx->skip_idct = str2AVDiscard(lavc_param_skip_idct_str);
- avctx->skip_frame = str2AVDiscard(lavc_param_skip_frame_str);
-
- if(lavc_avopt){
- if(parse_avopts(avctx, lavc_avopt) < 0){
- mp_msg(MSGT_DECVIDEO, MSGL_ERR, "Your options /%s/ look like gibberish to me pal\n", lavc_avopt);
+ sscanf(lavc_param->lowres_str, "%d,%d", &ctx->lowres, &lowres_w);
+ if(ctx->lowres < 1 || ctx->lowres > 16 || (lowres_w > 0 && avctx->width < lowres_w))
+ ctx->lowres = 0;
+ avctx->lowres = ctx->lowres;
+ }
+ avctx->skip_loop_filter = str2AVDiscard(lavc_param->skip_loop_filter_str);
+ avctx->skip_idct = str2AVDiscard(lavc_param->skip_idct_str);
+ avctx->skip_frame = str2AVDiscard(lavc_param->skip_frame_str);
+
+ if(lavc_param->avopt){
+ if(parse_avopts(avctx, lavc_param->avopt) < 0){
+ mp_msg(MSGT_DECVIDEO, MSGL_ERR, "Your options /%s/ look like gibberish to me pal\n", lavc_param->avopt);
uninit(sh);
return 0;
}
@@ -428,17 +362,14 @@ static int init(sh_video_t *sh){
if(sh->bih)
avctx->bits_per_coded_sample= sh->bih->biBitCount;
- if(lavc_param_threads > 1)
- avcodec_thread_init(avctx, lavc_param_threads);
+ if(lavc_param->threads > 1)
+ avcodec_thread_init(avctx, lavc_param->threads);
/* open it */
if (avcodec_open(avctx, lavc_codec) < 0) {
- mp_msg(MSGT_DECVIDEO, MSGL_ERR, MSGTR_CantOpenCodec);
+ mp_tmsg(MSGT_DECVIDEO, MSGL_ERR, "Could not open codec.\n");
uninit(sh);
return 0;
}
- // this is necessary in case get_format was never called and init_vo is
- // too late e.g. for H.264 VDPAU
- set_format_params(avctx, avctx->pix_fmt);
mp_msg(MSGT_DECVIDEO, MSGL_V, "INFO: libavcodec init OK!\n");
return 1; //mpcodecs_config_vo(sh, sh->disp_w, sh->disp_h, IMGFMT_YV12);
}
@@ -448,12 +379,12 @@ static void uninit(sh_video_t *sh){
vd_ffmpeg_ctx *ctx = sh->context;
AVCodecContext *avctx = ctx->avctx;
- if(lavc_param_vstats){
+ if(sh->opts->lavc_param.vstats){
int i;
for(i=1; i<32; i++){
mp_msg(MSGT_DECVIDEO, MSGL_INFO, "QP: %d, count: %d\n", i, ctx->qp_stat[i]);
}
- mp_msg(MSGT_DECVIDEO, MSGL_INFO, MSGTR_MPCODECS_ArithmeticMeanOfQP,
+ mp_tmsg(MSGT_DECVIDEO, MSGL_INFO, "[VD_FFMPEG] Arithmetic mean of QP: %2.4f, Harmonic mean of QP: %2.4f\n",
ctx->qp_sum / avctx->coded_frame->coded_picture_number,
1.0/(ctx->inv_qp_sum / avctx->coded_frame->coded_picture_number)
);
@@ -461,7 +392,7 @@ static void uninit(sh_video_t *sh){
if (avctx) {
if (avctx->codec && avcodec_close(avctx) < 0)
- mp_msg(MSGT_DECVIDEO, MSGL_ERR, MSGTR_CantCloseCodec);
+ mp_tmsg(MSGT_DECVIDEO, MSGL_ERR, "Could not close codec.\n");
av_freep(&avctx->extradata);
av_freep(&avctx->palctrl);
@@ -475,14 +406,15 @@ static void uninit(sh_video_t *sh){
}
static void draw_slice(struct AVCodecContext *s,
- const AVFrame *src, int offset[4],
- int y, int type, int height){
+ const AVFrame *src, int offset[4],
+ int y, int type, int height){
sh_video_t *sh = s->opaque;
uint8_t *source[MP_MAX_PLANES]= {src->data[0] + offset[0], src->data[1] + offset[1], src->data[2] + offset[2]};
#if 0
int start=0, i;
int width= s->width;
- int skip_stride= ((width<<lavc_param_lowres)+15)>>4;
+ vd_ffmpeg_ctx *ctx = sh->context;
+ int skip_stride= ((width << ctx->lowres)+15)>>4;
uint8_t *skip= &s->coded_frame->mbskip_table[(y>>4)*skip_stride];
int threshold= s->coded_frame->age;
if(s->pict_type!=B_TYPE){
@@ -520,8 +452,8 @@ static int init_vo(sh_video_t *sh, enum PixelFormat pix_fmt){
// if sh->ImageDesc is non-NULL, it means we decode QuickTime(tm) video.
// use dimensions from BIH to avoid black borders at the right and bottom.
if (sh->bih && sh->ImageDesc) {
- width = sh->bih->biWidth>>lavc_param_lowres;
- height = sh->bih->biHeight>>lavc_param_lowres;
+ width = sh->bih->biWidth >> ctx->lowres;
+ height = sh->bih->biHeight >> ctx->lowres;
}
// it is possible another vo buffers to be used after vo config()
@@ -532,9 +464,6 @@ static int init_vo(sh_video_t *sh, enum PixelFormat pix_fmt){
pix_fmt != ctx->pix_fmt ||
!ctx->vo_initialized)
{
- // this is a special-case HACK for MPEG-1/2 VDPAU that uses neither get_format nor
- // sets the value correctly in avcodec_open.
- set_format_params(avctx, avctx->pix_fmt);
mp_msg(MSGT_DECVIDEO, MSGL_V, "[ffmpeg] aspect_ratio: %f\n", aspect);
if (sh->aspect == 0 ||
av_cmp_q(avctx->sample_aspect_ratio,
@@ -602,7 +531,7 @@ static int get_buffer(AVCodecContext *avctx, AVFrame *pic){
} else
if (!pic->buffer_hints) {
if(ctx->b_count>1 || ctx->ip_count>2){
- mp_msg(MSGT_DECVIDEO, MSGL_WARN, MSGTR_MPCODECS_DRIFailure);
+ mp_tmsg(MSGT_DECVIDEO, MSGL_WARN, "[VD_FFMPEG] DRI failure.\n");
ctx->do_dr1=0; //FIXME
avctx->get_buffer= avcodec_default_get_buffer;
@@ -637,13 +566,13 @@ static int get_buffer(AVCodecContext *avctx, AVFrame *pic){
struct xvmc_pix_fmt *render = mpi->priv; //same as data[2]
avctx->draw_horiz_band= draw_slice;
if(!avctx->xvmc_acceleration) {
- mp_msg(MSGT_DECVIDEO, MSGL_INFO, MSGTR_MPCODECS_McGetBufferShouldWorkOnlyWithXVMC);
+ mp_tmsg(MSGT_DECVIDEO, MSGL_INFO, "[VD_FFMPEG] The mc_get_buffer should work only with XVMC acceleration!!");
assert(0);
exit(1);
// return -1;//!!fixme check error conditions in ffmpeg
}
if(!(mpi->flags & MP_IMGFLAG_DIRECT)) {
- mp_msg(MSGT_DECVIDEO, MSGL_ERR, MSGTR_MPCODECS_OnlyBuffersAllocatedByVoXvmcAllowed);
+ mp_tmsg(MSGT_DECVIDEO, MSGL_ERR, "[VD_FFMPEG] Only buffers allocated by vo_xvmc allowed.\n");
assert(0);
exit(1);
// return -1;//!!fixme check error conditions in ffmpeg
@@ -710,6 +639,13 @@ else
ctx->b_age=1;
}
pic->type= FF_BUFFER_TYPE_USER;
+
+ /* The libavcodec reordered_opaque functionality is implemented by
+ * a similar copy in avcodec_default_get_buffer() and without a
+ * workaround like this it'd stop working when a custom buffer
+ * callback is used.
+ */
+ pic->reordered_opaque = avctx->reordered_opaque;
return 0;
}
@@ -766,7 +702,7 @@ typedef struct dp_hdr_s {
uint32_t chunktab; // offset to chunk offset array
} dp_hdr_t;
-void swap_palette(void *pal) {
+static void swap_palette(void *pal) {
int i;
uint32_t *p = pal;
for (i = 0; i < AVPALETTE_COUNT; i++)
@@ -774,12 +710,15 @@ void swap_palette(void *pal) {
}
// decode a frame
-static mp_image_t *decode(sh_video_t *sh, void *data, int len, int flags){
+static struct mp_image *decode(struct sh_video *sh, void *data, int len,
+ int flags, double *reordered_pts)
+{
int got_picture=0;
int ret;
vd_ffmpeg_ctx *ctx = sh->context;
AVFrame *pic= ctx->pic;
AVCodecContext *avctx = ctx->avctx;
+ struct lavc_param *lavc_param = &sh->opts->lavc_param;
mp_image_t *mpi=NULL;
int dr1= ctx->do_dr1;
AVPacket pkt;
@@ -808,13 +747,16 @@ static mp_image_t *decode(sh_video_t *sh, void *data, int len, int flags){
pkt.size = len;
// HACK: make PNGs decode normally instead of as CorePNG delta frames
pkt.flags = PKT_FLAG_KEY;
+ // The avcodec opaque field stupidly supports only int64_t type
+ *(double *)&avctx->reordered_opaque = *reordered_pts;
ret = avcodec_decode_video2(avctx, pic, &got_picture, &pkt);
+ *reordered_pts = *(double *)&pic->reordered_opaque;
dr1= ctx->do_dr1;
if(ret<0) mp_msg(MSGT_DECVIDEO, MSGL_WARN, "Error while decoding frame!\n");
//printf("repeat: %d\n", pic->repeat_pict);
//-- vstats generation
- while(lavc_param_vstats){ // always one time loop
+ while(lavc_param->vstats){ // always one time loop
static FILE *fvstats=NULL;
char filename[20];
static long long int all_len=0;
@@ -833,7 +775,7 @@ static mp_image_t *decode(sh_video_t *sh, void *data, int len, int flags){
fvstats = fopen(filename, "w");
if(!fvstats) {
perror("fopen");
- lavc_param_vstats=0; // disable block
+ lavc_param->vstats=0; // disable block
break;
/*exit(1);*/
}
@@ -842,8 +784,8 @@ static mp_image_t *decode(sh_video_t *sh, void *data, int len, int flags){
// average MB quantizer
{
int x, y;
- int w = ((avctx->width << lavc_param_lowres)+15) >> 4;
- int h = ((avctx->height << lavc_param_lowres)+15) >> 4;
+ int w = ((avctx->width << ctx->lowres)+15) >> 4;
+ int h = ((avctx->height << ctx->lowres)+15) >> 4;
int8_t *q = pic->qscale_table;
for(y = 0; y < h; y++) {
for(x = 0; x < w; x++)
@@ -898,7 +840,7 @@ static mp_image_t *decode(sh_video_t *sh, void *data, int len, int flags){
mpi=mpcodecs_get_image(sh, MP_IMGTYPE_EXPORT, MP_IMGFLAG_PRESERVE,
avctx->width, avctx->height);
if(!mpi){ // temporary!
- mp_msg(MSGT_DECVIDEO, MSGL_WARN, MSGTR_MPCODECS_CouldntAllocateImageForCodec);
+ mp_tmsg(MSGT_DECVIDEO, MSGL_WARN, "[VD_FFMPEG] Couldn't allocate image for codec.\n");
return NULL;
}
@@ -940,7 +882,6 @@ static mp_image_t *decode(sh_video_t *sh, void *data, int len, int flags){
return mpi;
}
-#if CONFIG_XVMC || CONFIG_VDPAU
static enum PixelFormat get_format(struct AVCodecContext *avctx,
const enum PixelFormat *fmt){
enum PixelFormat selected_format;
@@ -951,13 +892,19 @@ static enum PixelFormat get_format(struct AVCodecContext *avctx,
for(i=0;fmt[i]!=PIX_FMT_NONE;i++){
imgfmt = pixfmt2imgfmt(fmt[i]);
if(!IMGFMT_IS_XVMC(imgfmt) && !IMGFMT_IS_VDPAU(imgfmt)) continue;
- mp_msg(MSGT_DECVIDEO, MSGL_INFO, MSGTR_MPCODECS_TryingPixfmt, i);
+ mp_msg(MSGT_DECVIDEO, MSGL_V, "[VD_FFMPEG] Trying pixfmt=%d.\n", i);
if(init_vo(sh, fmt[i]) >= 0) {
break;
}
}
selected_format = fmt[i];
- set_format_params(avctx, selected_format);
return selected_format;
}
-#endif /* CONFIG_XVMC || CONFIG_VDPAU */
+
+const struct vd_functions mpcodecs_vd_ffmpeg = {
+ .info = &info,
+ .init = init,
+ .uninit = uninit,
+ .control = control,
+ .decode2 = decode
+};
diff --git a/libmpcodecs/vd_hmblck.c b/libmpcodecs/vd_hmblck.c
index e689daafe6..81b1c4373b 100644
--- a/libmpcodecs/vd_hmblck.c
+++ b/libmpcodecs/vd_hmblck.c
@@ -26,7 +26,7 @@
#define TEMP_BUF_SIZE (720*576)
-static vd_info_t info = {
+static const vd_info_t info = {
"Hauppauge Macroblock/NV12/NV21 Decoder",
"hmblck",
"Alex <d18c7db@hotmail.com>, A'rpi, Alex Beregszaszi",
diff --git a/libmpcodecs/vd_ijpg.c b/libmpcodecs/vd_ijpg.c
index f4214a36a6..e1b8766f7e 100644
--- a/libmpcodecs/vd_ijpg.c
+++ b/libmpcodecs/vd_ijpg.c
@@ -33,7 +33,7 @@
#include "vd_internal.h"
-static vd_info_t info = {
+static const vd_info_t info = {
"JPEG Images decoder",
"ijpg",
"Pontscho",
@@ -110,7 +110,7 @@ METHODDEF(void) skip_input_data (j_decompress_ptr cinfo, long num_bytes)
METHODDEF(void) term_source (j_decompress_ptr cinfo) { }
-GLOBAL(void) jpeg_buf_src ( j_decompress_ptr cinfo, char * inbuf,int bufsize )
+static void jpeg_buf_src ( j_decompress_ptr cinfo, char * inbuf,int bufsize )
{
my_src_ptr src;
if (cinfo->src == NULL) cinfo->src=malloc( sizeof( my_source_mgr ) );
diff --git a/libmpcodecs/vd_internal.h b/libmpcodecs/vd_internal.h
index 58693439c4..b4d74a6a48 100644
--- a/libmpcodecs/vd_internal.h
+++ b/libmpcodecs/vd_internal.h
@@ -37,7 +37,7 @@ static int init(sh_video_t *sh);
static void uninit(sh_video_t *sh);
static mp_image_t* decode(sh_video_t *sh,void* data,int len,int flags);
-#define LIBVD_EXTERN(x) vd_functions_t mpcodecs_vd_##x = {\
+#define LIBVD_EXTERN(x) const vd_functions_t mpcodecs_vd_##x = {\
&info,\
init,\
uninit,\
diff --git a/libmpcodecs/vd_libdv.c b/libmpcodecs/vd_libdv.c
index 13a9f01ea8..02d7e2fc54 100644
--- a/libmpcodecs/vd_libdv.c
+++ b/libmpcodecs/vd_libdv.c
@@ -36,7 +36,7 @@
#include "vd_internal.h"
-static vd_info_t info =
+static const vd_info_t info =
{
"Raw DV Video Decoder",
"libdv",
diff --git a/libmpcodecs/vd_libmpeg2.c b/libmpcodecs/vd_libmpeg2.c
index d7c009370b..2e9c0edf24 100644
--- a/libmpcodecs/vd_libmpeg2.c
+++ b/libmpcodecs/vd_libmpeg2.c
@@ -20,14 +20,14 @@
#include <stdlib.h>
#include "config.h"
-
+#include "options.h"
#include "mp_msg.h"
#include "vd_internal.h"
//#undef MPEG12_POSTPROC
-static vd_info_t info =
+static const vd_info_t info =
{
"libmpeg2 MPEG 1/2 Video decoder",
"libmpeg2",
@@ -237,7 +237,7 @@ static mp_image_t* decode(sh_video_t *sh,void* data,int len,int flags){
}
mpeg2_skip(mpeg2dec, 0); //mpeg2skip skips frames until set again to 0
- use_callback = (!framedrop && vd_use_slices &&
+ use_callback = (!framedrop && sh->opts->vd_use_slices &&
(info->current_picture->flags&PIC_FLAG_PROGRESSIVE_FRAME)) ?
MP_IMGFLAG_DRAW_CALLBACK:0;
diff --git a/libmpcodecs/vd_lzo.c b/libmpcodecs/vd_lzo.c
index 1948388746..e8521bfb43 100644
--- a/libmpcodecs/vd_lzo.c
+++ b/libmpcodecs/vd_lzo.c
@@ -27,7 +27,7 @@
#define MOD_NAME "DecLZO"
-static vd_info_t info = {
+static const vd_info_t info = {
"LZO compressed Video",
"lzo",
"Tilmann Bitterberg",
diff --git a/libmpcodecs/vd_mpegpes.c b/libmpcodecs/vd_mpegpes.c
index c6cca1a4f7..22060bfc60 100644
--- a/libmpcodecs/vd_mpegpes.c
+++ b/libmpcodecs/vd_mpegpes.c
@@ -25,7 +25,7 @@
#include "vd_internal.h"
-static vd_info_t info =
+static const vd_info_t info =
{
"MPEG 1/2 Video passthrough",
"mpegpes",
diff --git a/libmpcodecs/vd_mpng.c b/libmpcodecs/vd_mpng.c
index 3c0f233146..919364742e 100644
--- a/libmpcodecs/vd_mpng.c
+++ b/libmpcodecs/vd_mpng.c
@@ -30,7 +30,7 @@
#include "vd_internal.h"
-static vd_info_t info = {
+static const vd_info_t info = {
"PNG Images decoder",
"mpng",
"A'rpi",
diff --git a/libmpcodecs/vd_mtga.c b/libmpcodecs/vd_mtga.c
index 1b6c71636a..f6eee54cbe 100644
--- a/libmpcodecs/vd_mtga.c
+++ b/libmpcodecs/vd_mtga.c
@@ -34,7 +34,7 @@
#include "vd_internal.h"
-static vd_info_t info =
+static const vd_info_t info =
{
"TGA Images decoder",
"mtga",
@@ -249,4 +249,3 @@ static mp_image_t *decode(sh_video_t *sh, void *raw, int len, int flags)
return mpi;
}
-
diff --git a/libmpcodecs/vd_null.c b/libmpcodecs/vd_null.c
index 7b3246f43e..894585b42f 100644
--- a/libmpcodecs/vd_null.c
+++ b/libmpcodecs/vd_null.c
@@ -24,7 +24,7 @@
#include "vd_internal.h"
-static vd_info_t info =
+static const vd_info_t info =
{
"Null video decoder",
"null",
@@ -54,4 +54,3 @@ static void uninit(sh_video_t *sh){
static mp_image_t* decode(sh_video_t *sh,void* data,int len,int flags){
return NULL;
}
-
diff --git a/libmpcodecs/vd_qtvideo.c b/libmpcodecs/vd_qtvideo.c
index bf6ac9ee2c..5120f612b5 100644
--- a/libmpcodecs/vd_qtvideo.c
+++ b/libmpcodecs/vd_qtvideo.c
@@ -34,7 +34,7 @@
#include "loader/wine/windef.h"
#endif
-static vd_info_t info = {
+static const vd_info_t info = {
"Quicktime Video decoder",
"qtvideo",
"A'rpi",
diff --git a/libmpcodecs/vd_raw.c b/libmpcodecs/vd_raw.c
index d3da2008f3..4e8ccd1446 100644
--- a/libmpcodecs/vd_raw.c
+++ b/libmpcodecs/vd_raw.c
@@ -24,7 +24,7 @@
#include "vd_internal.h"
-static vd_info_t info = {
+static const vd_info_t info = {
"RAW Uncompressed Video",
"raw",
"A'rpi",
diff --git a/libmpcodecs/vd_realvid.c b/libmpcodecs/vd_realvid.c
index 1e3129df30..6a50c484c7 100644
--- a/libmpcodecs/vd_realvid.c
+++ b/libmpcodecs/vd_realvid.c
@@ -32,7 +32,7 @@
#include "vd_internal.h"
#include "loader/wine/windef.h"
-static vd_info_t info = {
+static const vd_info_t info = {
"RealVideo decoder",
"realvid",
"Alex Beregszaszi",
@@ -306,7 +306,7 @@ static int init(sh_video_t *sh){
if (!load_syms_windows(sh->codec->dll))
#endif
{
- mp_msg(MSGT_DECVIDEO,MSGL_ERR,MSGTR_MissingDLLcodec,sh->codec->dll);
+ mp_tmsg(MSGT_DECVIDEO,MSGL_ERR,"ERROR: Could not open required DirectShow codec %s.\n",sh->codec->dll);
mp_msg(MSGT_DECVIDEO,MSGL_HINT,"Read the RealVideo section of the DOCS!\n");
free(path);
return 0;
diff --git a/libmpcodecs/vd_sgi.c b/libmpcodecs/vd_sgi.c
index 3e31d471a4..07dd8ff60d 100644
--- a/libmpcodecs/vd_sgi.c
+++ b/libmpcodecs/vd_sgi.c
@@ -37,7 +37,7 @@
#define OUT_PIXEL_STRIDE 3 /* RGB */
-static vd_info_t info =
+static const vd_info_t info =
{
"SGI Image decoder",
"sgi",
@@ -341,4 +341,3 @@ mp_image_t *decode(sh_video_t *sh, void *raw, int len, int flags)
return mpi;
}
-
diff --git a/libmpcodecs/vd_theora.c b/libmpcodecs/vd_theora.c
index 1b87b9fdcd..df4968cd1f 100644
--- a/libmpcodecs/vd_theora.c
+++ b/libmpcodecs/vd_theora.c
@@ -27,7 +27,7 @@
#include "vd_internal.h"
-static vd_info_t info = {
+static const vd_info_t info = {
"Theora/VP3",
"theora",
"David Kuehling",
diff --git a/libmpcodecs/vd_vfw.c b/libmpcodecs/vd_vfw.c
index ebff457598..e9c5304dd8 100644
--- a/libmpcodecs/vd_vfw.c
+++ b/libmpcodecs/vd_vfw.c
@@ -28,7 +28,7 @@
#include "loader/wine/driver.h"
#include "loader/wine/vfw.h"
-static vd_info_t info = {
+static const vd_info_t info = {
#ifdef BUILD_VFWEX
"Win32/VfWex video codecs",
"vfwex",
@@ -322,7 +322,7 @@ static mp_image_t* decode(sh_video_t *sh,void* data,int len,int flags){
MP_IMGTYPE_STATIC : MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_WIDTH,
sh->disp_w, sh->disp_h);
if(!mpi){ // temporary!
- mp_msg(MSGT_DECVIDEO,MSGL_WARN,MSGTR_MPCODECS_CouldntAllocateImageForCinepakCodec);
+ mp_tmsg(MSGT_DECVIDEO,MSGL_WARN,"[VD_DMO] Couldn't allocate image for cinepak codec.\n");
return NULL;
}
diff --git a/libmpcodecs/vd_xanim.c b/libmpcodecs/vd_xanim.c
index a18f2b4d14..a7f98add49 100644
--- a/libmpcodecs/vd_xanim.c
+++ b/libmpcodecs/vd_xanim.c
@@ -34,7 +34,7 @@
#include "vd_internal.h"
-static vd_info_t info = {
+static const vd_info_t info = {
"XAnim codecs",
"xanim",
"A'rpi & Alex",
diff --git a/libmpcodecs/vd_xvid4.c b/libmpcodecs/vd_xvid4.c
index bf12ab12f0..62eab8c3ed 100644
--- a/libmpcodecs/vd_xvid4.c
+++ b/libmpcodecs/vd_xvid4.c
@@ -378,7 +378,7 @@ static float stats2aspect(xvid_dec_stats_t *stats)
* Module structure definition
****************************************************************************/
-static vd_info_t info =
+static const vd_info_t info =
{
"XviD 1.0 decoder",
"xvid",
diff --git a/libmpcodecs/vd_zrmjpeg.c b/libmpcodecs/vd_zrmjpeg.c
index ab5bc59053..8dd460ab5b 100644
--- a/libmpcodecs/vd_zrmjpeg.c
+++ b/libmpcodecs/vd_zrmjpeg.c
@@ -36,7 +36,7 @@
#include "vd_internal.h"
-static vd_info_t info =
+static const vd_info_t info =
{
"Zoran MJPEG Video passthrough",
"zrmjpeg",
diff --git a/libmpcodecs/ve.c b/libmpcodecs/ve.c
index 015b0aba91..d140559530 100644
--- a/libmpcodecs/ve.c
+++ b/libmpcodecs/ve.c
@@ -69,8 +69,7 @@ static vf_info_t* encoder_list[]={
NULL
};
-vf_instance_t* vf_open_encoder(vf_instance_t* next, const char *name, char *args){
+vf_instance_t* vf_open_encoder(struct MPOpts *opts, vf_instance_t* next, const char *name, char *args){
char* vf_args[] = { "_oldargs_", args, NULL };
- return vf_open_plugin(encoder_list,next,name,vf_args);
+ return vf_open_plugin(opts, encoder_list,next,name,vf_args);
}
-
diff --git a/libmpcodecs/ve_lavc.c b/libmpcodecs/ve_lavc.c
index b3e5244bab..6c8d6b3064 100644
--- a/libmpcodecs/ve_lavc.c
+++ b/libmpcodecs/ve_lavc.c
@@ -345,9 +345,9 @@ struct vf_priv_s {
#define mux_v (vf->priv->mux)
#define lavc_venc_context (vf->priv->context)
-static int encode_frame(struct vf_instance_s* vf, AVFrame *pic, double pts);
+static int encode_frame(struct vf_instance* vf, AVFrame *pic, double pts);
-static int config(struct vf_instance_s* vf,
+static int config(struct vf_instance* vf,
int width, int height, int d_width, int d_height,
unsigned int flags, unsigned int outfmt){
int size, i;
@@ -551,7 +551,7 @@ static int config(struct vf_instance_s* vf,
lavc_venc_context->flags = 0;
if (lavc_param_mb_decision)
{
- mp_msg(MSGT_MENCODER, MSGL_INFO, MSGTR_MPCODECS_HighQualityEncodingSelected);
+ mp_tmsg(MSGT_MENCODER, MSGL_INFO, "[VE_LAVC] High quality encoding selected (non-realtime)!\n");
lavc_venc_context->mb_decision= lavc_param_mb_decision;
}
@@ -682,7 +682,7 @@ static int config(struct vf_instance_s* vf,
/* fixed qscale :p */
if (lavc_param_vqscale >= 0.0)
{
- mp_msg(MSGT_MENCODER, MSGL_INFO, MSGTR_MPCODECS_UsingConstantQscale, lavc_param_vqscale);
+ mp_tmsg(MSGT_MENCODER, MSGL_INFO, "[VE_LAVC] Using constant qscale = %f (VBR).\n", lavc_param_vqscale);
lavc_venc_context->flags |= CODEC_FLAG_QSCALE;
lavc_venc_context->global_quality=
vf->priv->pic->quality = (int)(FF_QP2LAMBDA * lavc_param_vqscale + 0.5);
@@ -692,7 +692,7 @@ static int config(struct vf_instance_s* vf,
avcodec_thread_init(lavc_venc_context, lavc_param_threads);
if (avcodec_open(lavc_venc_context, vf->priv->codec) != 0) {
- mp_msg(MSGT_MENCODER,MSGL_ERR,MSGTR_CantOpenCodec);
+ mp_tmsg(MSGT_MENCODER,MSGL_ERR,"Could not open codec.\n");
return 0;
}
@@ -716,7 +716,7 @@ static int config(struct vf_instance_s* vf,
return 1;
}
-static int control(struct vf_instance_s* vf, int request, void* data){
+static int control(struct vf_instance* vf, int request, void* data){
switch(request){
case VFCTRL_FLUSH_FRAMES:
@@ -728,7 +728,7 @@ static int control(struct vf_instance_s* vf, int request, void* data){
}
}
-static int query_format(struct vf_instance_s* vf, unsigned int fmt){
+static int query_format(struct vf_instance* vf, unsigned int fmt){
switch(fmt){
case IMGFMT_YV12:
case IMGFMT_IYUV:
@@ -765,7 +765,7 @@ static double psnr(double d){
return -10.0*log(d)/log(10);
}
-static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
+static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts){
AVFrame *pic= vf->priv->pic;
pic->data[0]=mpi->planes[0];
@@ -788,7 +788,7 @@ static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
return encode_frame(vf, pic, pts) >= 0;
}
-static int encode_frame(struct vf_instance_s* vf, AVFrame *pic, double pts){
+static int encode_frame(struct vf_instance* vf, AVFrame *pic, double pts){
const char pict_type_char[5]= {'?', 'I', 'P', 'B', 'S'};
int out_size;
double dts;
@@ -893,7 +893,7 @@ static int encode_frame(struct vf_instance_s* vf, AVFrame *pic, double pts){
return out_size;
}
-static void uninit(struct vf_instance_s* vf){
+static void uninit(struct vf_instance* vf){
if(lavc_param_psnr){
double f= lavc_venc_context->width*lavc_venc_context->height*255.0*255.0;
@@ -1041,7 +1041,7 @@ static int vf_open(vf_instance_t *vf, char* args){
vf->priv->codec = (AVCodec *)avcodec_find_encoder_by_name(lavc_param_vcodec);
if (!vf->priv->codec) {
- mp_msg(MSGT_MENCODER,MSGL_ERR,MSGTR_MissingLAVCcodec, lavc_param_vcodec);
+ mp_tmsg(MSGT_MENCODER,MSGL_ERR,"Cannot find codec '%s' in libavcodec...\n", lavc_param_vcodec);
return 0;
}
diff --git a/libmpcodecs/ve_libdv.c b/libmpcodecs/ve_libdv.c
index b2d00aebd7..0e611fa7a0 100644
--- a/libmpcodecs/ve_libdv.c
+++ b/libmpcodecs/ve_libdv.c
@@ -55,7 +55,7 @@ struct vf_priv_s {
//===========================================================================//
-static int config(struct vf_instance_s* vf,
+static int config(struct vf_instance* vf,
int width, int height, int d_width, int d_height,
unsigned int flags, unsigned int outfmt){
@@ -77,18 +77,18 @@ static int config(struct vf_instance_s* vf,
return 1;
}
-static int control(struct vf_instance_s* vf, int request, void* data){
+static int control(struct vf_instance* vf, int request, void* data){
return CONTROL_UNKNOWN;
}
-static int query_format(struct vf_instance_s* vf, unsigned int fmt){
+static int query_format(struct vf_instance* vf, unsigned int fmt){
if(fmt==IMGFMT_YUY2) return VFCAP_CSP_SUPPORTED | VFCAP_CSP_SUPPORTED_BY_HW;
if(fmt==IMGFMT_RGB24) return VFCAP_CSP_SUPPORTED;
return 0;
}
-static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
+static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts){
dv_encode_full_frame(vf->priv->enc, mpi->planes,
(mpi->flags&MP_IMGFLAG_YUV) ? e_dv_color_yuv : e_dv_color_rgb,
diff --git a/libmpcodecs/ve_nuv.c b/libmpcodecs/ve_nuv.c
index ab774e97fe..5f4a0a2808 100644
--- a/libmpcodecs/ve_nuv.c
+++ b/libmpcodecs/ve_nuv.c
@@ -37,7 +37,7 @@
#include "mp_image.h"
#include "vf.h"
-#include "libavutil/intreadwrite.h"
+#include "ffmpeg_files/intreadwrite.h"
#include <lzo/lzo1x.h>
#include "native/rtjpegn.h"
@@ -88,7 +88,7 @@ m_option_t nuvopts_conf[]={
#define COMPDATASIZE (128*4)
#define FRAMEHEADERSIZE 12
-static int config(struct vf_instance_s* vf,
+static int config(struct vf_instance* vf,
int width, int height, int d_width, int d_height,
unsigned int flags, unsigned int outfmt){
@@ -110,17 +110,17 @@ static int config(struct vf_instance_s* vf,
return 1;
}
-static int control(struct vf_instance_s* vf, int request, void* data){
+static int control(struct vf_instance* vf, int request, void* data){
return CONTROL_UNKNOWN;
}
-static int query_format(struct vf_instance_s* vf, unsigned int fmt){
+static int query_format(struct vf_instance* vf, unsigned int fmt){
if(fmt==IMGFMT_I420) return VFCAP_CSP_SUPPORTED | VFCAP_CSP_SUPPORTED_BY_HW;
return 0;
}
-static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
+static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts){
uint8_t *header = vf->priv->buffer;
uint8_t* data = vf->priv->buffer + FRAMEHEADERSIZE;
uint8_t* zdata = vf->priv->zbuffer + FRAMEHEADERSIZE;
@@ -201,7 +201,7 @@ static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
return 1;
}
-static void uninit(struct vf_instance_s* vf) {
+static void uninit(struct vf_instance* vf) {
if(vf->priv->buffer)
free(vf->priv->buffer);
diff --git a/libmpcodecs/ve_qtvideo.c b/libmpcodecs/ve_qtvideo.c
index 88ceb45a64..92b76fb252 100644
--- a/libmpcodecs/ve_qtvideo.c
+++ b/libmpcodecs/ve_qtvideo.c
@@ -139,7 +139,7 @@ struct vf_priv_s {
//===========================================================================//
-static int config(struct vf_instance_s* vf,
+static int config(struct vf_instance* vf,
int width, int height, int d_width, int d_height,
unsigned int flags, unsigned int outfmt){
// OSErr cres;
@@ -177,19 +177,19 @@ static int config(struct vf_instance_s* vf,
return 1;
}
-static int control(struct vf_instance_s* vf, int request, void* data){
+static int control(struct vf_instance* vf, int request, void* data){
return CONTROL_UNKNOWN;
}
-static int query_format(struct vf_instance_s* vf, unsigned int fmt){
+static int query_format(struct vf_instance* vf, unsigned int fmt){
if(fmt==IMGFMT_YUY2) return VFCAP_CSP_SUPPORTED | VFCAP_CSP_SUPPORTED_BY_HW;
return 0;
}
static int codec_initialized = 0;
-static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
+static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts){
OSErr cres;
long framesizemax;
diff --git a/libmpcodecs/ve_raw.c b/libmpcodecs/ve_raw.c
index 91b87555b6..1a43eab0b8 100644
--- a/libmpcodecs/ve_raw.c
+++ b/libmpcodecs/ve_raw.c
@@ -44,7 +44,7 @@ struct vf_priv_s {
};
#define mux_v (vf->priv->mux)
-static int set_format(struct vf_instance_s *vf, unsigned int fmt) {
+static int set_format(struct vf_instance *vf, unsigned int fmt) {
if (!force_fourcc)
mux_v->bih->biCompression = fmt;
@@ -92,7 +92,7 @@ static int set_format(struct vf_instance_s *vf, unsigned int fmt) {
mux_v->bih->biBitCount = 8;
break;
default:
- mp_msg(MSGT_MENCODER, MSGL_INFO, MSGTR_MPCODECS_OutputWithFourccNotSupported, fmt);
+ mp_tmsg(MSGT_MENCODER, MSGL_INFO, "[VE_RAW] Raw output with FourCC [%x] not supported!\n", fmt);
mux_v->bih->biCompression = 0;
return 0;
}
@@ -100,7 +100,7 @@ static int set_format(struct vf_instance_s *vf, unsigned int fmt) {
}
-static int config(struct vf_instance_s *vf,
+static int config(struct vf_instance *vf,
int width, int height, int d_width, int d_height,
unsigned int flags, unsigned int outfmt)
{
@@ -115,11 +115,11 @@ static int config(struct vf_instance_s *vf,
return 1;
}
-static int control(struct vf_instance_s *vf, int request, void *data) {
+static int control(struct vf_instance *vf, int request, void *data) {
return CONTROL_UNKNOWN;
}
-static int query_format(struct vf_instance_s *vf, unsigned int fmt) {
+static int query_format(struct vf_instance *vf, unsigned int fmt) {
if (IMGFMT_IS_RGB(fmt) || IMGFMT_IS_BGR(fmt))
return VFCAP_CSP_SUPPORTED | VFCAP_CSP_SUPPORTED_BY_HW;
switch (fmt) {
@@ -140,7 +140,7 @@ static int query_format(struct vf_instance_s *vf, unsigned int fmt) {
return 0;
}
-static int put_image(struct vf_instance_s *vf, mp_image_t *mpi, double pts) {
+static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts) {
mux_v->buffer = mpi->planes[0];
muxer_write_chunk(mux_v, mpi->width*mpi->height*mux_v->bih->biBitCount/8, 0x10, pts, pts);
return 1;
diff --git a/libmpcodecs/ve_vfw.c b/libmpcodecs/ve_vfw.c
index 44e27025fd..c04c6936a8 100644
--- a/libmpcodecs/ve_vfw.c
+++ b/libmpcodecs/ve_vfw.c
@@ -102,16 +102,16 @@ static BITMAPINFOHEADER* vfw_open_encoder(char *dll_name, char *compdatafile, BI
ret = ICGetInfo(encoder_hic, &icinfo, sizeof(ICINFO));
mp_msg(MSGT_WIN32,MSGL_INFO,"%ld - %ld - %d\n", ret, icinfo.dwSize, sizeof(ICINFO));
- mp_msg(MSGT_WIN32,MSGL_INFO,MSGTR_MPCODECS_CompressorType, icinfo.fccType);
- mp_msg(MSGT_WIN32,MSGL_INFO,MSGTR_MPCODECS_CompressorSubtype, icinfo.fccHandler);
- mp_msg(MSGT_WIN32,MSGL_INFO,MSGTR_MPCODECS_CompressorFlags,
+ mp_tmsg(MSGT_WIN32,MSGL_INFO,"Compressor type: %.4lx\n", icinfo.fccType);
+ mp_tmsg(MSGT_WIN32,MSGL_INFO,"Compressor subtype: %.4lx\n", icinfo.fccHandler);
+ mp_tmsg(MSGT_WIN32,MSGL_INFO,"Compressor flags: %lu, version %lu, ICM version: %lu\n",
icinfo.dwFlags, icinfo.dwVersion, icinfo.dwVersionICM);
//printf("Compressor name: %s\n", icinfo.szName);
//printf("Compressor description: %s\n", icinfo.szDescription);
-mp_msg(MSGT_WIN32,MSGL_INFO,MSGTR_MPCODECS_Flags);
+mp_tmsg(MSGT_WIN32,MSGL_INFO,"Flags:");
if (icinfo.dwFlags & VIDCF_QUALITY)
- mp_msg(MSGT_WIN32,MSGL_INFO,MSGTR_MPCODECS_Quality);
+ mp_tmsg(MSGT_WIN32,MSGL_INFO," quality");
if (icinfo.dwFlags & VIDCF_FASTTEMPORALD)
mp_msg(MSGT_WIN32,MSGL_INFO," fast-decompr");
if (icinfo.dwFlags & VIDCF_QUALITYTIME)
@@ -277,7 +277,7 @@ static int vfw_encode_frame(BITMAPINFOHEADER* biOutput,void* OutBuf,
#define mux_v (vf->priv->mux)
#define vfw_bih (vf->priv->bih)
-static int config(struct vf_instance_s* vf,
+static int config(struct vf_instance* vf,
int width, int height, int d_width, int d_height,
unsigned int flags, unsigned int outfmt){
@@ -295,17 +295,17 @@ static int config(struct vf_instance_s* vf,
return 1;
}
-static int control(struct vf_instance_s* vf, int request, void* data){
+static int control(struct vf_instance* vf, int request, void* data){
return CONTROL_UNKNOWN;
}
-static int query_format(struct vf_instance_s* vf, unsigned int fmt){
+static int query_format(struct vf_instance* vf, unsigned int fmt){
if(fmt==IMGFMT_BGR24) return VFCAP_CSP_SUPPORTED | VFCAP_CSP_SUPPORTED_BY_HW | VFCAP_FLIPPED;
return 0;
}
-static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
+static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts){
long flags=0;
int ret;
// flip_upside_down(vo_image_ptr,vo_image_ptr,3*vo_w,vo_h); // dirty hack
@@ -316,7 +316,7 @@ static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
return 1;
}
-static void uninit(struct vf_instance_s* vf)
+static void uninit(struct vf_instance* vf)
{
HRESULT ret;
@@ -358,7 +358,7 @@ static int vf_open(vf_instance_t *vf, char* args){
if (!vfw_param_codec)
{
- mp_msg(MSGT_WIN32,MSGL_WARN, MSGTR_MPCODECS_NoVfwCodecSpecified);
+ mp_tmsg(MSGT_WIN32,MSGL_WARN, "[VE_RAW] Required VfW codec not specified!!\n");
return 0;
}
// mux_v->bih=vfw_open_encoder("divxc32.dll",vfw_bih,mmioFOURCC('D', 'I', 'V', '3'));
diff --git a/libmpcodecs/ve_x264.c b/libmpcodecs/ve_x264.c
index a3e51a08f1..303acdb6fe 100644
--- a/libmpcodecs/ve_x264.c
+++ b/libmpcodecs/ve_x264.c
@@ -59,8 +59,8 @@ static int turbo = 0;
static x264_param_t param;
static int parse_error = 0;
-static int put_image(struct vf_instance_s *vf, mp_image_t *mpi, double pts);
-static int encode_frame(struct vf_instance_s *vf, x264_picture_t *pic_in);
+static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts);
+static int encode_frame(struct vf_instance *vf, x264_picture_t *pic_in);
void x264enc_set_param(const m_option_t* opt, char* arg)
{
@@ -134,7 +134,7 @@ void x264enc_set_param(const m_option_t* opt, char* arg)
}
}
-static int config(struct vf_instance_s* vf, int width, int height, int d_width, int d_height, unsigned int flags, unsigned int outfmt) {
+static int config(struct vf_instance* vf, int width, int height, int d_width, int d_height, unsigned int flags, unsigned int outfmt) {
h264_module_t *mod=(h264_module_t*)vf->priv;
if(parse_error)
@@ -193,7 +193,7 @@ static int config(struct vf_instance_s* vf, int width, int height, int d_width,
return 1;
}
-static int control(struct vf_instance_s* vf, int request, void *data)
+static int control(struct vf_instance* vf, int request, void *data)
{
h264_module_t *mod=(h264_module_t*)vf->priv;
switch(request){
@@ -206,7 +206,7 @@ static int control(struct vf_instance_s* vf, int request, void *data)
}
}
-static int query_format(struct vf_instance_s* vf, unsigned int fmt)
+static int query_format(struct vf_instance* vf, unsigned int fmt)
{
switch(fmt) {
case IMGFMT_I420:
@@ -225,7 +225,7 @@ static int query_format(struct vf_instance_s* vf, unsigned int fmt)
return 0;
}
-static int put_image(struct vf_instance_s *vf, mp_image_t *mpi, double pts)
+static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts)
{
h264_module_t *mod=(h264_module_t*)vf->priv;
int i;
@@ -243,7 +243,7 @@ static int put_image(struct vf_instance_s *vf, mp_image_t *mpi, double pts)
return encode_frame(vf, &mod->pic) >= 0;
}
-static int encode_frame(struct vf_instance_s *vf, x264_picture_t *pic_in)
+static int encode_frame(struct vf_instance *vf, x264_picture_t *pic_in)
{
h264_module_t *mod=(h264_module_t*)vf->priv;
x264_picture_t pic_out;
@@ -271,7 +271,7 @@ static int encode_frame(struct vf_instance_s *vf, x264_picture_t *pic_in)
return i_size;
}
-static void uninit(struct vf_instance_s *vf)
+static void uninit(struct vf_instance *vf)
{
h264_module_t *mod=(h264_module_t*)vf->priv;
if (mod->x264)
diff --git a/libmpcodecs/ve_xvid4.c b/libmpcodecs/ve_xvid4.c
index c812e4c20a..858ca903f4 100644
--- a/libmpcodecs/ve_xvid4.c
+++ b/libmpcodecs/ve_xvid4.c
@@ -374,7 +374,7 @@ static const char *errorstring(int err);
*==========================================================================*/
static int
-config(struct vf_instance_s* vf,
+config(struct vf_instance* vf,
int width, int height, int d_width, int d_height,
unsigned int flags, unsigned int outfmt)
{
@@ -439,7 +439,7 @@ config(struct vf_instance_s* vf,
*==========================================================================*/
static void
-uninit(struct vf_instance_s* vf)
+uninit(struct vf_instance* vf)
{
xvid_mplayer_module_t *mod = (xvid_mplayer_module_t *)vf->priv;
@@ -477,7 +477,7 @@ uninit(struct vf_instance_s* vf)
*==========================================================================*/
static int
-control(struct vf_instance_s* vf, int request, void* data)
+control(struct vf_instance* vf, int request, void* data)
{
xvid_mplayer_module_t *mod = (xvid_mplayer_module_t *)vf->priv;
@@ -495,7 +495,7 @@ xvid_mplayer_module_t *mod = (xvid_mplayer_module_t *)vf->priv;
*==========================================================================*/
static int
-query_format(struct vf_instance_s* vf, unsigned int fmt)
+query_format(struct vf_instance* vf, unsigned int fmt)
{
switch(fmt){
case IMGFMT_YV12:
@@ -514,7 +514,7 @@ query_format(struct vf_instance_s* vf, unsigned int fmt)
*==========================================================================*/
static int
-put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts)
+put_image(struct vf_instance* vf, mp_image_t *mpi, double pts)
{
int size;
xvid_enc_stats_t stats;
diff --git a/libmpcodecs/vf.c b/libmpcodecs/vf.c
index e6611efeb8..873b950910 100644
--- a/libmpcodecs/vf.c
+++ b/libmpcodecs/vf.c
@@ -135,17 +135,24 @@ static const vf_info_t* const filter_list[]={
&vf_info_vo,
&vf_info_format,
&vf_info_noformat,
+#ifdef CONFIG_LIBSWSCALE_INTERNALS
&vf_info_yuy2,
+#endif
&vf_info_flip,
+#ifdef CONFIG_LIBSWSCALE_INTERNALS
&vf_info_rgb2bgr,
+#endif
&vf_info_rotate,
&vf_info_mirror,
+#ifdef CONFIG_LIBSWSCALE_INTERNALS
&vf_info_palette,
+#endif
&vf_info_pp7,
#ifdef CONFIG_LIBAVCODEC
&vf_info_lavc,
&vf_info_lavcdeint,
&vf_info_screenshot,
+ &vf_info_uspp,
#endif
#ifdef CONFIG_ZR
&vf_info_zrmjpeg,
@@ -158,7 +165,9 @@ static const vf_info_t* const filter_list[]={
&vf_info_eq,
&vf_info_eq2,
&vf_info_gradfun,
+#ifdef CONFIG_LIBSWSCALE_INTERNALS
&vf_info_halfpack,
+#endif
&vf_info_dint,
&vf_info_1bpp,
&vf_info_2xsai,
@@ -190,9 +199,8 @@ static const vf_info_t* const filter_list[]={
&vf_info_delogo,
&vf_info_remove_logo,
&vf_info_hue,
-#ifdef CONFIG_LIBAVCODEC_A
+#ifdef CONFIG_LIBAVCODEC_INTERNALS
&vf_info_spp,
- &vf_info_uspp,
&vf_info_fspp,
&vf_info_qp,
&vf_info_mcdeint,
@@ -215,7 +223,6 @@ static const vf_info_t* const filter_list[]={
};
// For the vf option
-m_obj_settings_t* vf_settings = NULL;
const m_obj_list_t vf_obj_list = {
(void**)filter_list,
M_ST_OFF(vf_info_t,name),
@@ -426,23 +433,27 @@ mp_image_t* vf_get_image(vf_instance_t* vf, unsigned int outfmt, int mp_imgtype,
//============================================================================
// By default vf doesn't accept MPEGPES
-static int vf_default_query_format(struct vf_instance_s* vf, unsigned int fmt){
+static int vf_default_query_format(struct vf_instance* vf, unsigned int fmt){
if(fmt == IMGFMT_MPEGPES) return 0;
return vf_next_query_format(vf,fmt);
}
-vf_instance_t* vf_open_plugin(const vf_info_t* const* filter_list, vf_instance_t* next, const char *name, char **args){
+struct vf_instance *vf_open_plugin_noerr(struct MPOpts *opts,
+ const vf_info_t * const *filter_list,
+ vf_instance_t *next, const char *name,
+ char **args, int *retcode)
+{
vf_instance_t* vf;
int i;
for(i=0;;i++){
if(!filter_list[i]){
- mp_msg(MSGT_VFILTER,MSGL_ERR,MSGTR_CouldNotFindVideoFilter,name);
+ mp_tmsg(MSGT_VFILTER,MSGL_ERR,"Couldn't find video filter '%s'.\n",name);
return NULL; // no such filter!
}
if(!strcmp(filter_list[i]->name,name)) break;
}
- vf=malloc(sizeof(vf_instance_t));
- memset(vf,0,sizeof(vf_instance_t));
+ vf = calloc(1, sizeof *vf);
+ vf->opts = opts;
vf->info=filter_list[i];
vf->next=next;
vf->config=vf_next_config;
@@ -464,13 +475,27 @@ vf_instance_t* vf_open_plugin(const vf_info_t* const* filter_list, vf_instance_t
args = (char**)args[1];
else
args = NULL;
- if(vf->info->open(vf,(char*)args)>0) return vf; // Success!
+ *retcode = vf->info->open(vf,(char*)args);
+ if (*retcode > 0)
+ return vf;
free(vf);
- mp_msg(MSGT_VFILTER,MSGL_ERR,MSGTR_CouldNotOpenVideoFilter,name);
return NULL;
}
-vf_instance_t* vf_open_filter(vf_instance_t* next, const char *name, char **args){
+struct vf_instance *vf_open_plugin(struct MPOpts *opts,
+ const vf_info_t * const *filter_list,
+ vf_instance_t *next, const char *name,
+ char **args)
+{
+ struct vf_instance *vf = vf_open_plugin_noerr(opts, filter_list, next,
+ name, args, &(int){0});
+ if (!vf)
+ mp_tmsg(MSGT_VFILTER, MSGL_ERR, "Couldn't open video filter '%s'.\n",
+ name);
+ return vf;
+}
+
+vf_instance_t* vf_open_filter(struct MPOpts *opts, vf_instance_t* next, const char *name, char **args){
if(args && strcmp(args[0],"_oldargs_")) {
int i,l = 0;
for(i = 0 ; args && args[2*i] ; i++)
@@ -482,17 +507,18 @@ vf_instance_t* vf_open_filter(vf_instance_t* next, const char *name, char **args
p += sprintf(str,"%s",name);
for(i = 0 ; args && args[2*i] ; i++)
p += sprintf(p," %s=%s",args[2*i],args[2*i+1]);
- mp_msg(MSGT_VFILTER,MSGL_INFO,MSGTR_OpeningVideoFilter "[%s]\n",str);
+ mp_msg(MSGT_VFILTER, MSGL_INFO, "%s[%s]\n",
+ mp_gtext("Opening video filter: "), str);
}
} else if(strcmp(name,"vo")) {
if(args && strcmp(args[0],"_oldargs_") == 0)
- mp_msg(MSGT_VFILTER,MSGL_INFO,MSGTR_OpeningVideoFilter
- "[%s=%s]\n", name,args[1]);
+ mp_msg(MSGT_VFILTER, MSGL_INFO, "%s[%s=%s]\n",
+ mp_gtext("Opening video filter: "), name, args[1]);
else
- mp_msg(MSGT_VFILTER,MSGL_INFO,MSGTR_OpeningVideoFilter
- "[%s]\n", name);
+ mp_msg(MSGT_VFILTER, MSGL_INFO, "%s[%s]\n",
+ mp_gtext("Opening video filter: "), name);
}
- return vf_open_plugin(filter_list,next,name,args);
+ return vf_open_plugin(opts, filter_list,next,name,args);
}
/**
@@ -503,11 +529,12 @@ vf_instance_t* vf_open_filter(vf_instance_t* next, const char *name, char **args
* \return pointer to the filter instance that was created.
*/
vf_instance_t* vf_add_before_vo(vf_instance_t **vf, char *name, char **args) {
+ struct MPOpts *opts = (*vf)->opts;
vf_instance_t *vo, *prev = NULL, *new;
// Find the last filter (should be vf_vo)
for (vo = *vf; vo->next; vo = vo->next)
prev = vo;
- new = vf_open_filter(vo, name, args);
+ new = vf_open_filter(opts, vo, name, args);
if (prev)
prev->next = new;
else
@@ -519,6 +546,7 @@ vf_instance_t* vf_add_before_vo(vf_instance_t **vf, char *name, char **args) {
unsigned int vf_match_csp(vf_instance_t** vfp,const unsigned int* list,unsigned int preferred){
vf_instance_t* vf=*vfp;
+ struct MPOpts *opts = vf->opts;
const unsigned int* p;
unsigned int best=0;
int ret;
@@ -532,7 +560,7 @@ unsigned int vf_match_csp(vf_instance_t** vfp,const unsigned int* list,unsigned
if(best) return best; // bingo, they have common csp!
// ok, then try with scale:
if(vf->info == &vf_info_scale) return 0; // avoid infinite recursion!
- vf=vf_open_filter(vf,"scale",NULL);
+ vf=vf_open_filter(opts, vf,"scale",NULL);
if(!vf) return 0; // failed to init "scale"
// try the preferred csp first:
if(preferred && vf->query_format(vf,preferred)) best=preferred; else
@@ -583,12 +611,6 @@ int vf_output_queued_frame(vf_instance_t *vf)
tmp = last->continue_buffered_image;
last->continue_buffered_image = NULL;
ret = tmp(last);
- if (ret > 0) {
- vf->control(vf, VFCTRL_DRAW_OSD, NULL);
-#ifdef CONFIG_ASS
- vf->control(vf, VFCTRL_DRAW_EOSD, NULL);
-#endif
- }
if (ret)
return ret;
}
@@ -607,7 +629,7 @@ int vf_output_queued_frame(vf_instance_t *vf)
* are unchanged, and returns either success or error.
*
*/
-int vf_config_wrapper(struct vf_instance_s* vf,
+int vf_config_wrapper(struct vf_instance* vf,
int width, int height, int d_width, int d_height,
unsigned int flags, unsigned int outfmt)
{
@@ -616,7 +638,7 @@ int vf_config_wrapper(struct vf_instance_s* vf,
if ((vf->fmt.orig_width != width)
|| (vf->fmt.orig_height != height)
|| (vf->fmt.orig_fmt != outfmt)) {
- mp_msg(MSGT_VFILTER,MSGL_ERR,MSGTR_ResolutionDoesntMatch);
+ mp_tmsg(MSGT_VFILTER,MSGL_ERR,"\nNew video file has different resolution or colorspace than the previous one.\n");
return 0;
}
return 1;
@@ -630,9 +652,10 @@ int vf_config_wrapper(struct vf_instance_s* vf,
return r;
}
-int vf_next_config(struct vf_instance_s* vf,
+int vf_next_config(struct vf_instance* vf,
int width, int height, int d_width, int d_height,
unsigned int voflags, unsigned int outfmt){
+ struct MPOpts *opts = vf->opts;
int miss;
int flags=vf->next->query_format(vf->next,outfmt);
if(!flags){
@@ -640,12 +663,12 @@ int vf_next_config(struct vf_instance_s* vf,
// let's insert the 'scale' filter, it does the job for us:
vf_instance_t* vf2;
if(vf->next->info==&vf_info_scale) return 0; // scale->scale
- vf2=vf_open_filter(vf->next,"scale",NULL);
+ vf2=vf_open_filter(opts, vf->next,"scale",NULL);
if(!vf2) return 0; // shouldn't happen!
vf->next=vf2;
flags=vf->next->query_format(vf->next,outfmt);
if(!flags){
- mp_msg(MSGT_VFILTER,MSGL_ERR,MSGTR_CannotFindColorspace);
+ mp_tmsg(MSGT_VFILTER,MSGL_ERR,"Cannot find matching colorspace, even by inserting 'scale' :(\n");
return 0; // FAIL
}
}
@@ -654,7 +677,7 @@ int vf_next_config(struct vf_instance_s* vf,
if(miss&VFCAP_ACCEPT_STRIDE){
// vf requires stride support but vf->next doesn't support it!
// let's insert the 'expand' filter, it does the job for us:
- vf_instance_t* vf2=vf_open_filter(vf->next,"expand",NULL);
+ vf_instance_t* vf2=vf_open_filter(opts, vf->next,"expand",NULL);
if(!vf2) return 0; // shouldn't happen!
vf->next=vf2;
}
@@ -662,29 +685,21 @@ int vf_next_config(struct vf_instance_s* vf,
return vf_config_wrapper(vf->next,width,height,d_width,d_height,voflags,outfmt);
}
-int vf_next_control(struct vf_instance_s* vf, int request, void* data){
+int vf_next_control(struct vf_instance* vf, int request, void* data){
return vf->next->control(vf->next,request,data);
}
-void vf_extra_flip(struct vf_instance_s* vf) {
- vf_next_control(vf, VFCTRL_DRAW_OSD, NULL);
-#ifdef CONFIG_ASS
- vf_next_control(vf, VFCTRL_DRAW_EOSD, NULL);
-#endif
- vf_next_control(vf, VFCTRL_FLIP_PAGE, NULL);
-}
-
-int vf_next_query_format(struct vf_instance_s* vf, unsigned int fmt){
+int vf_next_query_format(struct vf_instance* vf, unsigned int fmt){
int flags=vf->next->query_format(vf->next,fmt);
if(flags) flags|=vf->default_caps;
return flags;
}
-int vf_next_put_image(struct vf_instance_s* vf,mp_image_t *mpi, double pts){
+int vf_next_put_image(struct vf_instance* vf,mp_image_t *mpi, double pts){
return vf->next->put_image(vf->next,mpi, pts);
}
-void vf_next_draw_slice(struct vf_instance_s* vf,unsigned char** src, int * stride,int w, int h, int x, int y){
+void vf_next_draw_slice(struct vf_instance* vf,unsigned char** src, int * stride,int w, int h, int x, int y){
if (vf->next->draw_slice) {
vf->next->draw_slice(vf->next,src,stride,w,h,x,y);
return;
@@ -708,7 +723,10 @@ void vf_next_draw_slice(struct vf_instance_s* vf,unsigned char** src, int * stri
//============================================================================
-vf_instance_t* append_filters(vf_instance_t* last){
+vf_instance_t *append_filters(vf_instance_t* last,
+ struct m_obj_settings *vf_settings)
+{
+ struct MPOpts *opts = last->opts;
vf_instance_t* vf;
int i;
@@ -718,7 +736,7 @@ vf_instance_t* append_filters(vf_instance_t* last){
/* NOP */;
for(i-- ; i >= 0 ; i--) {
//printf("Open filter %s\n",vf_settings[i].name);
- vf = vf_open_filter(last,vf_settings[i].name,vf_settings[i].attribs);
+ vf = vf_open_filter(opts, last,vf_settings[i].name,vf_settings[i].attribs);
if(vf) last=vf;
}
}
@@ -733,6 +751,8 @@ void vf_uninit_filter(vf_instance_t* vf){
free_mp_image(vf->imgctx.static_images[1]);
free_mp_image(vf->imgctx.temp_images[0]);
free_mp_image(vf->imgctx.export_images[0]);
+ for (int i = 0; i < NUM_NUMBERED_MPI; i++)
+ free_mp_image(vf->imgctx.numbered_images[i]);
free(vf);
}
diff --git a/libmpcodecs/vf.h b/libmpcodecs/vf.h
index 91a57f2f9d..3d468d382a 100644
--- a/libmpcodecs/vf.h
+++ b/libmpcodecs/vf.h
@@ -21,7 +21,8 @@
#include "mp_image.h"
-struct vf_instance_s;
+struct MPOpts;
+struct vf_instance;
struct vf_priv_s;
typedef struct vf_info_s {
@@ -29,7 +30,7 @@ typedef struct vf_info_s {
const char *name;
const char *author;
const char *comment;
- int (*open)(struct vf_instance_s* vf,char* args);
+ int (*open)(struct vf_instance* vf,char* args);
// Ptr to a struct dscribing the options
const void* opts;
} vf_info_t;
@@ -49,27 +50,27 @@ typedef struct vf_format_context_t {
int orig_width, orig_height, orig_fmt;
} vf_format_context_t;
-typedef struct vf_instance_s {
+typedef struct vf_instance {
const vf_info_t* info;
// funcs:
- int (*config)(struct vf_instance_s* vf,
+ int (*config)(struct vf_instance* vf,
int width, int height, int d_width, int d_height,
unsigned int flags, unsigned int outfmt);
- int (*control)(struct vf_instance_s* vf,
+ int (*control)(struct vf_instance* vf,
int request, void* data);
- int (*query_format)(struct vf_instance_s* vf,
+ int (*query_format)(struct vf_instance* vf,
unsigned int fmt);
- void (*get_image)(struct vf_instance_s* vf,
+ void (*get_image)(struct vf_instance* vf,
mp_image_t *mpi);
- int (*put_image)(struct vf_instance_s* vf,
+ int (*put_image)(struct vf_instance* vf,
mp_image_t *mpi, double pts);
- void (*start_slice)(struct vf_instance_s* vf,
+ void (*start_slice)(struct vf_instance* vf,
mp_image_t *mpi);
- void (*draw_slice)(struct vf_instance_s* vf,
+ void (*draw_slice)(struct vf_instance* vf,
unsigned char** src, int* stride, int w,int h, int x, int y);
- void (*uninit)(struct vf_instance_s* vf);
+ void (*uninit)(struct vf_instance* vf);
- int (*continue_buffered_image)(struct vf_instance_s* vf);
+ int (*continue_buffered_image)(struct vf_instance* vf);
// caps:
unsigned int default_caps; // used by default query_format()
unsigned int default_reqs; // used by default config()
@@ -77,9 +78,10 @@ typedef struct vf_instance_s {
int w, h;
vf_image_context_t imgctx;
vf_format_context_t fmt;
- struct vf_instance_s* next;
+ struct vf_instance* next;
mp_image_t *dmpi;
struct vf_priv_s* priv;
+ struct MPOpts *opts;
} vf_instance_t;
// control codes:
@@ -97,16 +99,20 @@ typedef struct vf_seteq_s
#define VFCTRL_GET_EQUALIZER 8 /* gset color options (brightness,contrast etc) */
#define VFCTRL_DRAW_OSD 7
#define VFCTRL_CHANGE_RECTANGLE 9 /* Change the rectangle boundaries */
-#define VFCTRL_FLIP_PAGE 10 /* Tell the vo to flip pages */
#define VFCTRL_DUPLICATE_FRAME 11 /* For encoding - encode zero-change frame */
#define VFCTRL_SKIP_NEXT_FRAME 12 /* For encoding - drop the next frame that passes thru */
#define VFCTRL_FLUSH_FRAMES 13 /* For encoding - flush delayed frames */
#define VFCTRL_SCREENSHOT 14 /* Make a screenshot */
#define VFCTRL_INIT_EOSD 15 /* Select EOSD renderer */
#define VFCTRL_DRAW_EOSD 16 /* Render EOSD */
-#define VFCTRL_GET_PTS 17 /* Return last pts value that reached vf_vo*/
#define VFCTRL_SET_DEINTERLACE 18 /* Set deinterlacing status */
#define VFCTRL_GET_DEINTERLACE 19 /* Get deinterlacing status */
+/* Hack to make the OSD state object available to vf_expand which accesses
+ * the OSD state outside of normal OSD draw time. */
+#define VFCTRL_SET_OSD_OBJ 20
+#define VFCTRL_REDRAW_OSD 21 /* Change user-visible OSD immediately */
+#define VFCTRL_SET_YUV_COLORSPACE 22
+#define VFCTRL_GET_YUV_COLORSPACE 23
#include "vfcap.h"
@@ -118,10 +124,14 @@ typedef struct vf_seteq_s
void vf_mpi_clear(mp_image_t* mpi,int x0,int y0,int w,int h);
mp_image_t* vf_get_image(vf_instance_t* vf, unsigned int outfmt, int mp_imgtype, int mp_imgflag, int w, int h);
-vf_instance_t* vf_open_plugin(const vf_info_t* const* filter_list, vf_instance_t* next, const char *name, char **args);
-vf_instance_t* vf_open_filter(vf_instance_t* next, const char *name, char **args);
+vf_instance_t* vf_open_plugin(struct MPOpts *opts, const vf_info_t* const* filter_list, vf_instance_t* next, const char *name, char **args);
+struct vf_instance *vf_open_plugin_noerr(struct MPOpts *opts,
+ const vf_info_t * const *filter_list,
+ vf_instance_t *next, const char *name,
+ char **args, int *retcode);
+vf_instance_t* vf_open_filter(struct MPOpts *opts, vf_instance_t* next, const char *name, char **args);
vf_instance_t* vf_add_before_vo(vf_instance_t **vf, char *name, char **args);
-vf_instance_t* vf_open_encoder(vf_instance_t* next, const char *name, char *args);
+vf_instance_t* vf_open_encoder(struct MPOpts *opts, vf_instance_t* next, const char *name, char *args);
unsigned int vf_match_csp(vf_instance_t** vfp,const unsigned int* list,unsigned int preferred);
void vf_clone_mpi_attributes(mp_image_t* dst, mp_image_t* src);
@@ -129,21 +139,21 @@ void vf_queue_frame(vf_instance_t *vf, int (*)(vf_instance_t *));
int vf_output_queued_frame(vf_instance_t *vf);
// default wrappers:
-int vf_next_config(struct vf_instance_s* vf,
+int vf_next_config(struct vf_instance* vf,
int width, int height, int d_width, int d_height,
unsigned int flags, unsigned int outfmt);
-int vf_next_control(struct vf_instance_s* vf, int request, void* data);
-void vf_extra_flip(struct vf_instance_s* vf);
-int vf_next_query_format(struct vf_instance_s* vf, unsigned int fmt);
-int vf_next_put_image(struct vf_instance_s* vf,mp_image_t *mpi, double pts);
-void vf_next_draw_slice (struct vf_instance_s* vf, unsigned char** src, int* stride, int w,int h, int x, int y);
+int vf_next_control(struct vf_instance* vf, int request, void* data);
+int vf_next_query_format(struct vf_instance* vf, unsigned int fmt);
+int vf_next_put_image(struct vf_instance* vf,mp_image_t *mpi, double pts);
+void vf_next_draw_slice (struct vf_instance* vf, unsigned char** src, int* stride, int w,int h, int x, int y);
-vf_instance_t* append_filters(vf_instance_t* last);
+struct m_obj_settings;
+vf_instance_t* append_filters(vf_instance_t* last, struct m_obj_settings *vf_settings);
void vf_uninit_filter(vf_instance_t* vf);
void vf_uninit_filter_chain(vf_instance_t* vf);
-int vf_config_wrapper(struct vf_instance_s* vf,
+int vf_config_wrapper(struct vf_instance* vf,
int width, int height, int d_width, int d_height,
unsigned int flags, unsigned int outfmt);
diff --git a/libmpcodecs/vf_1bpp.c b/libmpcodecs/vf_1bpp.c
index 43c5677202..a9321f8924 100644
--- a/libmpcodecs/vf_1bpp.c
+++ b/libmpcodecs/vf_1bpp.c
@@ -58,7 +58,7 @@ static const unsigned int bgr_list[]={
0
};
-static unsigned int find_best(struct vf_instance_s* vf){
+static unsigned int find_best(struct vf_instance* vf){
unsigned int best=0;
int ret;
const unsigned int* p=bgr_list;
@@ -78,7 +78,7 @@ struct vf_priv_s {
unsigned int fmt;
};
-static int config(struct vf_instance_s* vf,
+static int config(struct vf_instance* vf,
int width, int height, int d_width, int d_height,
unsigned int flags, unsigned int outfmt){
if (!vf->priv->fmt)
@@ -121,7 +121,7 @@ static void convert(mp_image_t *mpi, mp_image_t *dmpi, int value0, int value1,in
}
}
-static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
+static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts){
mp_image_t *dmpi;
// hope we'll get DR buffer:
@@ -172,7 +172,7 @@ static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
//===========================================================================//
-static int query_format(struct vf_instance_s* vf, unsigned int fmt){
+static int query_format(struct vf_instance* vf, unsigned int fmt){
int best;
if(fmt!=IMGFMT_RGB1 && fmt!=IMGFMT_BGR1) return 0;
best=find_best(vf);
diff --git a/libmpcodecs/vf_2xsai.c b/libmpcodecs/vf_2xsai.c
index e28ada4818..26bbd58eb5 100644
--- a/libmpcodecs/vf_2xsai.c
+++ b/libmpcodecs/vf_2xsai.c
@@ -43,7 +43,7 @@ static int PixelsPerMask = 2;
#define makecol(r,g,b) (r+(g<<8)+(b<<16))
#define makecol_depth(d,r,g,b) (r+(g<<8)+(b<<16))
-int Init_2xSaI(int d)
+static int Init_2xSaI(int d)
{
int minr = 0, ming = 0, minb = 0;
@@ -95,7 +95,7 @@ int Init_2xSaI(int d)
+ ((((A & qlowpixelMask) + (B & qlowpixelMask) + (C & qlowpixelMask) + (D & qlowpixelMask)) >> 2) & qlowpixelMask)
-void Super2xSaI_ex(uint8_t *src, uint32_t src_pitch,
+static void Super2xSaI_ex(uint8_t *src, uint32_t src_pitch,
uint8_t *dst, uint32_t dst_pitch,
uint32_t width, uint32_t height, int sbpp) {
@@ -280,7 +280,7 @@ void Super2xSaI_ex(uint8_t *src, uint32_t src_pitch,
//===========================================================================//
-static int config(struct vf_instance_s* vf,
+static int config(struct vf_instance* vf,
int width, int height, int d_width, int d_height,
unsigned int flags, unsigned int outfmt){
@@ -289,7 +289,7 @@ static int config(struct vf_instance_s* vf,
return vf_next_config(vf,2*width,2*height,2*d_width,2*d_height,flags,outfmt);
}
-static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
+static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts){
mp_image_t *dmpi;
// hope we'll get DR buffer:
@@ -306,7 +306,7 @@ static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
//===========================================================================//
-static int query_format(struct vf_instance_s* vf, unsigned int fmt){
+static int query_format(struct vf_instance* vf, unsigned int fmt){
switch(fmt){
// case IMGFMT_BGR15:
// case IMGFMT_BGR16:
diff --git a/libmpcodecs/vf_ass.c b/libmpcodecs/vf_ass.c
index 3f5d6e352e..9076ed099e 100644
--- a/libmpcodecs/vf_ass.c
+++ b/libmpcodecs/vf_ass.c
@@ -31,6 +31,7 @@
#include "config.h"
#include "mp_msg.h"
#include "help_mp.h"
+#include "options.h"
#include "img_format.h"
#include "mp_image.h"
@@ -41,7 +42,7 @@
#include "m_option.h"
#include "m_struct.h"
-#include "libass/ass_mp.h"
+#include "ass_mp.h"
#define _r(c) ((c)>>24)
#define _g(c) (((c)>>16)&0xFF)
@@ -61,50 +62,47 @@ static const struct vf_priv_s {
// 0 = insert always
int auto_insert;
- ass_renderer_t* ass_priv;
+ ASS_Renderer* ass_priv;
unsigned char* planes[3];
- unsigned char* dirty_rows;
+ struct line_limits {
+ uint16_t start;
+ uint16_t end;
+ } *line_limits;
} vf_priv_dflt;
-extern int opt_screen_size_x;
-extern int opt_screen_size_y;
-
-extern ass_track_t* ass_track;
+extern ASS_Track *ass_track;
extern float sub_delay;
extern int sub_visibility;
-static int config(struct vf_instance_s* vf,
+static int config(struct vf_instance* vf,
int width, int height, int d_width, int d_height,
unsigned int flags, unsigned int outfmt)
{
+ struct MPOpts *opts = vf->opts;
if (outfmt == IMGFMT_IF09) return 0;
vf->priv->outh = height + ass_top_margin + ass_bottom_margin;
vf->priv->outw = width;
- if(!opt_screen_size_x && !opt_screen_size_y){
+ if (!opts->screen_size_x && !opts->screen_size_y) {
d_width = d_width * vf->priv->outw / width;
d_height = d_height * vf->priv->outh / height;
}
vf->priv->planes[1] = malloc(vf->priv->outw * vf->priv->outh);
vf->priv->planes[2] = malloc(vf->priv->outw * vf->priv->outh);
- vf->priv->dirty_rows = malloc(vf->priv->outh);
+ vf->priv->line_limits = malloc((vf->priv->outh + 1) / 2 * sizeof(*vf->priv->line_limits));
if (vf->priv->ass_priv) {
ass_configure(vf->priv->ass_priv, vf->priv->outw, vf->priv->outh, 0);
-#if defined(LIBASS_VERSION) && LIBASS_VERSION >= 0x00908000
- ass_set_aspect_ratio(vf->priv->ass_priv, ((double)d_width) / d_height, ((double)width) / height);
-#else
- ass_set_aspect_ratio(vf->priv->ass_priv, ((double)d_width) / d_height);
-#endif
+ ass_set_aspect_ratio(vf->priv->ass_priv, 1, 1);
}
return vf_next_config(vf, vf->priv->outw, vf->priv->outh, d_width, d_height, flags, outfmt);
}
-static void get_image(struct vf_instance_s* vf, mp_image_t *mpi)
+static void get_image(struct vf_instance* vf, mp_image_t *mpi)
{
if(mpi->type == MP_IMGTYPE_IPB) return;
if(mpi->flags & MP_IMGFLAG_PRESERVE) return;
@@ -118,7 +116,7 @@ static void get_image(struct vf_instance_s* vf, mp_image_t *mpi)
if((vf->dmpi->flags & MP_IMGFLAG_DRAW_CALLBACK) &&
!(vf->dmpi->flags & MP_IMGFLAG_DIRECT)){
- mp_msg(MSGT_ASS, MSGL_INFO, MSGTR_MPCODECS_FullDRNotPossible);
+ mp_tmsg(MSGT_ASS, MSGL_INFO, "Full DR not possible, trying SLICES instead!\n");
return;
}
@@ -163,11 +161,11 @@ static void blank(mp_image_t *mpi, int y1, int y2)
}
}
-static int prepare_image(struct vf_instance_s* vf, mp_image_t *mpi)
+static int prepare_image(struct vf_instance* vf, mp_image_t *mpi)
{
if(mpi->flags&MP_IMGFLAG_DIRECT || mpi->flags&MP_IMGFLAG_DRAW_CALLBACK){
vf->dmpi = mpi->priv;
- if (!vf->dmpi) { mp_msg(MSGT_ASS, MSGL_WARN, MSGTR_MPCODECS_FunWhydowegetNULL); return 0; }
+ if (!vf->dmpi) { mp_tmsg(MSGT_ASS, MSGL_WARN, "Why do we get NULL??\n"); return 0; }
mpi->priv = NULL;
// we've used DR, so we're ready...
if (ass_top_margin)
@@ -208,59 +206,58 @@ static int prepare_image(struct vf_instance_s* vf, mp_image_t *mpi)
return 0;
}
+static void update_limits(struct vf_instance *vf, int starty, int endy,
+ int startx, int endx)
+{
+ starty >>= 1;
+ endy = (endy + 1) >> 1;
+ startx >>= 1;
+ endx = (endx + 1) >> 1;
+ for (int i = starty; i < endy; i++) {
+ struct line_limits *ll = vf->priv->line_limits + i;
+ if (startx < ll->start)
+ ll->start = startx;
+ if (endx > ll->end)
+ ll->end = endx;
+ }
+}
+
/**
* \brief Copy specified rows from render_context.dmpi to render_context.planes, upsampling to 4:4:4
*/
-static void copy_from_image(struct vf_instance_s* vf, int first_row, int last_row)
+static void copy_from_image(struct vf_instance* vf)
{
int pl;
- int i, j, k;
- unsigned char val;
- int chroma_rows;
-
- first_row -= (first_row % 2);
- last_row += (last_row % 2);
- chroma_rows = (last_row - first_row) / 2;
-
- assert(first_row >= 0);
- assert(first_row <= last_row);
- assert(last_row <= vf->priv->outh);
for (pl = 1; pl < 3; ++pl) {
int dst_stride = vf->priv->outw;
int src_stride = vf->dmpi->stride[pl];
- unsigned char* src = vf->dmpi->planes[pl] + (first_row/2) * src_stride;
- unsigned char* dst = vf->priv->planes[pl] + first_row * dst_stride;
- unsigned char* dst_next = dst + dst_stride;
- for(i = 0; i < chroma_rows; ++i)
- {
- if ((vf->priv->dirty_rows[first_row + i*2] == 0) ||
- (vf->priv->dirty_rows[first_row + i*2 + 1] == 0)) {
- for (j = 0, k = 0; j < vf->dmpi->chroma_width; ++j, k+=2) {
- val = *(src + j);
- *(dst + k) = val;
- *(dst + k + 1) = val;
- *(dst_next + k) = val;
- *(dst_next + k + 1) = val;
- }
+ unsigned char* src = vf->dmpi->planes[pl];
+ unsigned char* dst = vf->priv->planes[pl];
+ for (int i = 0; i < (vf->priv->outh + 1) / 2; i++) {
+ struct line_limits *ll = vf->priv->line_limits + i;
+ unsigned char* dst_next = dst + dst_stride;
+ for (int j = ll->start; j < ll->end; j++) {
+ unsigned char val = src[j];
+ dst[j << 1] = val;
+ dst[(j << 1) + 1] = val;
+ dst_next[j << 1] = val;
+ dst_next[(j << 1) + 1] = val;
}
src += src_stride;
dst = dst_next + dst_stride;
- dst_next = dst + dst_stride;
}
}
- for (i = first_row; i < last_row; ++i)
- vf->priv->dirty_rows[i] = 1;
}
/**
* \brief Copy all previously copied rows back to render_context.dmpi
*/
-static void copy_to_image(struct vf_instance_s* vf)
+static void copy_to_image(struct vf_instance* vf)
{
int pl;
- int i, j, k;
+ int i, j;
for (pl = 1; pl < 3; ++pl) {
int dst_stride = vf->dmpi->stride[pl];
int src_stride = vf->priv->outw;
@@ -268,18 +265,14 @@ static void copy_to_image(struct vf_instance_s* vf)
unsigned char* dst = vf->dmpi->planes[pl];
unsigned char* src = vf->priv->planes[pl];
unsigned char* src_next = vf->priv->planes[pl] + src_stride;
- for(i = 0; i < vf->dmpi->chroma_height; ++i)
- {
- if ((vf->priv->dirty_rows[i*2] == 1)) {
- assert(vf->priv->dirty_rows[i*2 + 1] == 1);
- for (j = 0, k = 0; j < vf->dmpi->chroma_width; ++j, k+=2) {
- unsigned val = 0;
- val += *(src + k);
- val += *(src + k + 1);
- val += *(src_next + k);
- val += *(src_next + k + 1);
- *(dst + j) = val >> 2;
- }
+ for (i = 0; i < vf->dmpi->chroma_height; ++i) {
+ for (j = vf->priv->line_limits[i].start; j < vf->priv->line_limits[i].end; j++) {
+ unsigned val = 0;
+ val += src[j << 1];
+ val += src[(j << 1) + 1];
+ val += src_next[j << 1];
+ val += src_next[(j << 1) + 1];
+ dst[j] = val >> 2;
}
dst += dst_stride;
src = src_next + src_stride;
@@ -288,7 +281,7 @@ static void copy_to_image(struct vf_instance_s* vf)
}
}
-static void my_draw_bitmap(struct vf_instance_s* vf, unsigned char* bitmap, int bitmap_w, int bitmap_h, int stride, int dst_x, int dst_y, unsigned color)
+static void my_draw_bitmap(struct vf_instance* vf, unsigned char* bitmap, int bitmap_w, int bitmap_h, int stride, int dst_x, int dst_y, unsigned color)
{
unsigned char y = rgba2y(color);
unsigned char u = rgba2u(color);
@@ -304,10 +297,10 @@ static void my_draw_bitmap(struct vf_instance_s* vf, unsigned char* bitmap, int
dstv = vf->priv->planes[2] + dst_x + dst_y * vf->priv->outw;
for (i = 0; i < bitmap_h; ++i) {
for (j = 0; j < bitmap_w; ++j) {
- unsigned k = ((unsigned)src[j]) * opacity / 255;
- dsty[j] = (k*y + (255-k)*dsty[j]) / 255;
- dstu[j] = (k*u + (255-k)*dstu[j]) / 255;
- dstv[j] = (k*v + (255-k)*dstv[j]) / 255;
+ unsigned k = (src[j] * opacity + 255) >> 8;
+ dsty[j] = (k*y + (255-k)*dsty[j] + 255) >> 8;
+ dstu[j] = (k*u + (255-k)*dstu[j] + 255) >> 8;
+ dstv[j] = (k*v + (255-k)*dstv[j] + 255) >> 8;
}
src += stride;
dsty += dmpi->stride[0];
@@ -316,12 +309,15 @@ static void my_draw_bitmap(struct vf_instance_s* vf, unsigned char* bitmap, int
}
}
-static int render_frame(struct vf_instance_s* vf, mp_image_t *mpi, const ass_image_t* img)
+static int render_frame(struct vf_instance* vf, mp_image_t *mpi, const ASS_Image *img)
{
if (img) {
- memset(vf->priv->dirty_rows, 0, vf->priv->outh); // reset dirty rows
+ for (int i = 0; i < (vf->priv->outh + 1) / 2; i++)
+ vf->priv->line_limits[i] = (struct line_limits){65535, 0};
+ for (const ASS_Image *im = img; im; im = im->next)
+ update_limits(vf, im->dst_y, im->dst_y + im->h, im->dst_x, im->dst_x + im->w);
+ copy_from_image(vf);
while (img) {
- copy_from_image(vf, img->dst_y, img->dst_y + img->h);
my_draw_bitmap(vf, img->bitmap, img->w, img->h, img->stride,
img->dst_x, img->dst_y, img->color);
img = img->next;
@@ -331,9 +327,9 @@ static int render_frame(struct vf_instance_s* vf, mp_image_t *mpi, const ass_ima
return 0;
}
-static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts)
+static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts)
{
- ass_image_t* images = 0;
+ ASS_Image* images = 0;
if (sub_visibility && vf->priv->ass_priv && ass_track && (pts != MP_NOPTS_VALUE))
images = ass_mp_render_frame(vf->priv->ass_priv, ass_track, (pts+sub_delay) * 1000 + .5, NULL);
@@ -343,7 +339,7 @@ static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts)
return vf_next_put_image(vf, vf->dmpi, pts);
}
-static int query_format(struct vf_instance_s* vf, unsigned int fmt)
+static int query_format(struct vf_instance* vf, unsigned int fmt)
{
switch(fmt){
case IMGFMT_YV12:
@@ -358,7 +354,7 @@ static int control(vf_instance_t *vf, int request, void *data)
{
switch (request) {
case VFCTRL_INIT_EOSD:
- vf->priv->ass_priv = ass_renderer_init((ass_library_t*)data);
+ vf->priv->ass_priv = ass_renderer_init((ASS_Library*)data);
if (!vf->priv->ass_priv) return CONTROL_FALSE;
ass_configure_fonts(vf->priv->ass_priv);
return CONTROL_TRUE;
@@ -369,16 +365,14 @@ static int control(vf_instance_t *vf, int request, void *data)
return vf_next_control(vf, request, data);
}
-static void uninit(struct vf_instance_s* vf)
+static void uninit(struct vf_instance* vf)
{
if (vf->priv->ass_priv)
ass_renderer_done(vf->priv->ass_priv);
- if (vf->priv->planes[1])
- free(vf->priv->planes[1]);
- if (vf->priv->planes[2])
- free(vf->priv->planes[2]);
- if (vf->priv->dirty_rows)
- free(vf->priv->dirty_rows);
+ free(vf->priv->planes[1]);
+ free(vf->priv->planes[2]);
+ free(vf->priv->line_limits);
+ free(vf->priv);
}
static const unsigned int fmt_list[]={
@@ -394,10 +388,12 @@ static int open(vf_instance_t *vf, char* args)
vf->priv->outfmt = vf_match_csp(&vf->next,fmt_list,IMGFMT_YV12);
if (vf->priv->outfmt)
flags = vf_next_query_format(vf, vf->priv->outfmt);
- if (!vf->priv->outfmt || (vf->priv->auto_insert && flags&VFCAP_EOSD))
- {
+ if (!vf->priv->outfmt) {
uninit(vf);
return 0;
+ } else if (vf->priv->auto_insert && flags&VFCAP_EOSD) {
+ uninit(vf);
+ return -1;
}
if (vf->priv->auto_insert)
@@ -434,4 +430,3 @@ const vf_info_t vf_info_ass = {
open,
&vf_opts
};
-
diff --git a/libmpcodecs/vf_blackframe.c b/libmpcodecs/vf_blackframe.c
index dce13ea927..34d2f1f506 100644
--- a/libmpcodecs/vf_blackframe.c
+++ b/libmpcodecs/vf_blackframe.c
@@ -40,12 +40,12 @@ struct vf_priv_s {
unsigned int bamount, bthresh, frame, lastkeyframe;
};
-static int config(struct vf_instance_s* vf, int width, int height, int d_width,
+static int config(struct vf_instance* vf, int width, int height, int d_width,
int d_height, unsigned int flags, unsigned int outfmt) {
return vf_next_config(vf,width,height,d_width,d_height,flags,outfmt);
}
-static int query_format(struct vf_instance_s *vf, unsigned fmt) {
+static int query_format(struct vf_instance *vf, unsigned fmt) {
switch(fmt) {
case IMGFMT_YVU9:
case IMGFMT_IF09:
@@ -66,7 +66,7 @@ static int query_format(struct vf_instance_s *vf, unsigned fmt) {
return 0;
}
-static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
+static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts){
mp_image_t *dmpi;
int x, y;
int nblack=0, pblack=0;
@@ -110,11 +110,11 @@ static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
return vf_next_put_image(vf, dmpi, pts);
}
-static int control(struct vf_instance_s* vf, int request, void* data){
+static int control(struct vf_instance* vf, int request, void* data){
return vf_next_control(vf,request,data);
}
-static void uninit(struct vf_instance_s *vf) {
+static void uninit(struct vf_instance *vf) {
if (vf->priv) free(vf->priv);
}
diff --git a/libmpcodecs/vf_bmovl.c b/libmpcodecs/vf_bmovl.c
index ee4eb9a942..0277751527 100644
--- a/libmpcodecs/vf_bmovl.c
+++ b/libmpcodecs/vf_bmovl.c
@@ -125,14 +125,14 @@ struct vf_priv_s {
};
static int
-query_format(struct vf_instance_s* vf, unsigned int fmt){
+query_format(struct vf_instance* vf, unsigned int fmt){
if(fmt==IMGFMT_YV12) return VFCAP_CSP_SUPPORTED;
return 0;
}
static int
-config(struct vf_instance_s* vf,
+config(struct vf_instance* vf,
int width, int height, int d_width, int d_height,
unsigned int flags, unsigned int outfmt)
{
@@ -162,7 +162,7 @@ config(struct vf_instance_s* vf,
}
static void
-uninit(struct vf_instance_s *vf)
+uninit(struct vf_instance *vf)
{
if(vf->priv) {
free(vf->priv->bitmap.y);
@@ -214,7 +214,7 @@ _read_cmd(int fd, char *cmd, char *args) {
static int
-put_image(struct vf_instance_s* vf, mp_image_t* mpi, double pts){
+put_image(struct vf_instance* vf, mp_image_t* mpi, double pts){
int buf_x=0, buf_y=0, buf_pos=0;
int have, got, want;
int xpos=0, ypos=0, pos=0;
diff --git a/libmpcodecs/vf_boxblur.c b/libmpcodecs/vf_boxblur.c
index f8f2026566..e75f261375 100644
--- a/libmpcodecs/vf_boxblur.c
+++ b/libmpcodecs/vf_boxblur.c
@@ -46,7 +46,7 @@ struct vf_priv_s {
/***************************************************************************/
-static int config(struct vf_instance_s* vf,
+static int config(struct vf_instance* vf,
int width, int height, int d_width, int d_height,
unsigned int flags, unsigned int outfmt){
@@ -127,7 +127,7 @@ static void vBlur(uint8_t *dst, uint8_t *src, int w, int h, int dstStride, int s
}
}
-static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
+static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts){
int cw= mpi->w >> mpi->chroma_x_shift;
int ch= mpi->h >> mpi->chroma_y_shift;
@@ -156,7 +156,7 @@ static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
//===========================================================================//
-static int query_format(struct vf_instance_s* vf, unsigned int fmt){
+static int query_format(struct vf_instance* vf, unsigned int fmt){
switch(fmt)
{
case IMGFMT_YV12:
diff --git a/libmpcodecs/vf_crop.c b/libmpcodecs/vf_crop.c
index 58683e01b1..96a90f606b 100644
--- a/libmpcodecs/vf_crop.c
+++ b/libmpcodecs/vf_crop.c
@@ -23,6 +23,7 @@
#include "config.h"
#include "mp_msg.h"
#include "help_mp.h"
+#include "options.h"
#include "img_format.h"
#include "mp_image.h"
@@ -39,14 +40,12 @@ static const struct vf_priv_s {
-1,-1
};
-extern int opt_screen_size_x;
-extern int opt_screen_size_y;
-
//===========================================================================//
-static int config(struct vf_instance_s* vf,
+static int config(struct vf_instance* vf,
int width, int height, int d_width, int d_height,
unsigned int flags, unsigned int outfmt){
+ struct MPOpts *opts = vf->opts;
// calculate the missing parameters:
if(vf->priv->crop_w<=0 || vf->priv->crop_w>width) vf->priv->crop_w=width;
if(vf->priv->crop_h<=0 || vf->priv->crop_h>height) vf->priv->crop_h=height;
@@ -76,17 +75,17 @@ static int config(struct vf_instance_s* vf,
// check:
if(vf->priv->crop_w+vf->priv->crop_x>width ||
vf->priv->crop_h+vf->priv->crop_y>height){
- mp_msg(MSGT_VFILTER, MSGL_WARN, MSGTR_MPCODECS_CropBadPositionWidthHeight);
+ mp_tmsg(MSGT_VFILTER, MSGL_WARN, "[CROP] Bad position/width/height - cropped area outside of the original!\n");
return 0;
}
- if(!opt_screen_size_x && !opt_screen_size_y){
+ if(!opts->screen_size_x && !opts->screen_size_y){
d_width=d_width*vf->priv->crop_w/width;
d_height=d_height*vf->priv->crop_h/height;
}
return vf_next_config(vf,vf->priv->crop_w,vf->priv->crop_h,d_width,d_height,flags,outfmt);
}
-static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
+static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts){
mp_image_t *dmpi;
if (mpi->flags&MP_IMGFLAG_DRAW_CALLBACK)
return vf_next_put_image(vf,vf->dmpi, pts);
@@ -113,12 +112,12 @@ static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
return vf_next_put_image(vf,dmpi, pts);
}
-static void start_slice(struct vf_instance_s* vf, mp_image_t *mpi){
+static void start_slice(struct vf_instance* vf, mp_image_t *mpi){
vf->dmpi = vf_get_image(vf->next, mpi->imgfmt, mpi->type, mpi->flags,
vf->priv->crop_w, vf->priv->crop_h);
}
-static void draw_slice(struct vf_instance_s* vf,
+static void draw_slice(struct vf_instance* vf,
unsigned char** src, int* stride, int w,int h, int x, int y){
unsigned char *src2[3];
src2[0] = src[0];
diff --git a/libmpcodecs/vf_cropdetect.c b/libmpcodecs/vf_cropdetect.c
index 5aee04ada9..f777107a77 100644
--- a/libmpcodecs/vf_cropdetect.c
+++ b/libmpcodecs/vf_cropdetect.c
@@ -61,7 +61,7 @@ static int checkline(unsigned char* src,int stride,int len,int bpp){
//===========================================================================//
-static int config(struct vf_instance_s* vf,
+static int config(struct vf_instance* vf,
int width, int height, int d_width, int d_height,
unsigned int flags, unsigned int outfmt){
vf->priv->x1=width - 1;
@@ -72,7 +72,7 @@ static int config(struct vf_instance_s* vf,
return vf_next_config(vf,width,height,d_width,d_height,flags,outfmt);
}
-static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
+static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts){
mp_image_t *dmpi;
int bpp=mpi->bpp/8;
int w,h,x,y,shrink_by;
@@ -153,7 +153,7 @@ if(++vf->priv->fno>0){ // ignore first 2 frames - they may be empty
h -= shrink_by;
y += (shrink_by / 2 + 1) & ~1;
- mp_msg(MSGT_VFILTER, MSGL_INFO, MSGTR_MPCODECS_CropArea,
+ mp_tmsg(MSGT_VFILTER, MSGL_INFO, "[CROP] Crop area: X: %d..%d Y: %d..%d (-vf crop=%d:%d:%d:%d).\n",
vf->priv->x1,vf->priv->x2,
vf->priv->y1,vf->priv->y2,
w,h,x,y);
@@ -164,7 +164,7 @@ if(++vf->priv->fno>0){ // ignore first 2 frames - they may be empty
return vf_next_put_image(vf,dmpi, pts);
}
-static int query_format(struct vf_instance_s* vf, unsigned int fmt) {
+static int query_format(struct vf_instance* vf, unsigned int fmt) {
switch(fmt) {
// the default limit value works only right with YV12 right now.
case IMGFMT_YV12:
diff --git a/libmpcodecs/vf_decimate.c b/libmpcodecs/vf_decimate.c
index 8a58562190..2d8dcb7931 100644
--- a/libmpcodecs/vf_decimate.c
+++ b/libmpcodecs/vf_decimate.c
@@ -128,7 +128,7 @@ static int diff_to_drop(int hi, int lo, float frac, mp_image_t *old, mp_image_t
new->w*(new->bpp/8), new->h, old->stride[0], new->stride[0]);
}
-static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts)
+static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts)
{
mp_image_t *dmpi;
@@ -164,7 +164,7 @@ static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts)
return vf_next_put_image(vf, dmpi, pts);
}
-static void uninit(struct vf_instance_s* vf)
+static void uninit(struct vf_instance* vf)
{
free(vf->priv);
}
@@ -196,5 +196,3 @@ const vf_info_t vf_info_decimate = {
open,
NULL
};
-
-
diff --git a/libmpcodecs/vf_delogo.c b/libmpcodecs/vf_delogo.c
index b07fd4017e..2dd971fab9 100644
--- a/libmpcodecs/vf_delogo.c
+++ b/libmpcodecs/vf_delogo.c
@@ -117,7 +117,7 @@ static void delogo(uint8_t *dst, uint8_t *src, int dstStride, int srcStride, int
}
}
-static int config(struct vf_instance_s* vf,
+static int config(struct vf_instance* vf,
int width, int height, int d_width, int d_height,
unsigned int flags, unsigned int outfmt){
@@ -125,7 +125,7 @@ static int config(struct vf_instance_s* vf,
}
-static void get_image(struct vf_instance_s* vf, mp_image_t *mpi){
+static void get_image(struct vf_instance* vf, mp_image_t *mpi){
if(mpi->flags&MP_IMGFLAG_PRESERVE) return; // don't change
if(mpi->imgfmt!=vf->priv->outfmt) return; // colorspace differ
// ok, we can do pp in-place (or pp disabled):
@@ -143,7 +143,7 @@ static void get_image(struct vf_instance_s* vf, mp_image_t *mpi){
mpi->flags|=MP_IMGFLAG_DIRECT;
}
-static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
+static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts){
mp_image_t *dmpi;
if(!(mpi->flags&MP_IMGFLAG_DIRECT)){
@@ -169,7 +169,7 @@ static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
return vf_next_put_image(vf,dmpi, pts);
}
-static void uninit(struct vf_instance_s* vf){
+static void uninit(struct vf_instance* vf){
if(!vf->priv) return;
free(vf->priv);
@@ -178,7 +178,7 @@ static void uninit(struct vf_instance_s* vf){
//===========================================================================//
-static int query_format(struct vf_instance_s* vf, unsigned int fmt){
+static int query_format(struct vf_instance* vf, unsigned int fmt){
switch(fmt)
{
case IMGFMT_YV12:
@@ -189,7 +189,7 @@ static int query_format(struct vf_instance_s* vf, unsigned int fmt){
return 0;
}
-static unsigned int fmt_list[]={
+static const unsigned int fmt_list[]={
IMGFMT_YV12,
IMGFMT_I420,
IMGFMT_IYUV,
@@ -233,7 +233,7 @@ static int open(vf_instance_t *vf, char* args){
}
#define ST_OFF(f) M_ST_OFF(struct vf_priv_s,f)
-static m_option_t vf_opts_fields[] = {
+static const m_option_t vf_opts_fields[] = {
{ "x", ST_OFF(xoff), CONF_TYPE_INT, 0, 0, 0, NULL },
{ "y", ST_OFF(yoff), CONF_TYPE_INT, 0, 0, 0, NULL },
{ "w", ST_OFF(lw), CONF_TYPE_INT, 0, 0, 0, NULL },
@@ -243,7 +243,7 @@ static m_option_t vf_opts_fields[] = {
{ NULL, NULL, 0, 0, 0, 0, NULL }
};
-static m_struct_t vf_opts = {
+static const m_struct_t vf_opts = {
"delogo",
sizeof(struct vf_priv_s),
&vf_priv_dflt,
diff --git a/libmpcodecs/vf_denoise3d.c b/libmpcodecs/vf_denoise3d.c
index 0958305936..fc9924cbe9 100644
--- a/libmpcodecs/vf_denoise3d.c
+++ b/libmpcodecs/vf_denoise3d.c
@@ -45,7 +45,7 @@ struct vf_priv_s {
/***************************************************************************/
-static int config(struct vf_instance_s* vf,
+static int config(struct vf_instance* vf,
int width, int height, int d_width, int d_height,
unsigned int flags, unsigned int outfmt){
@@ -58,7 +58,7 @@ static int config(struct vf_instance_s* vf,
}
-static void uninit(struct vf_instance_s* vf)
+static void uninit(struct vf_instance* vf)
{
free(vf->priv->Line);
}
@@ -109,7 +109,7 @@ static void deNoise(unsigned char *Frame, // mpi->planes[x]
-static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
+static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts){
int cw= mpi->w >> mpi->chroma_x_shift;
int ch= mpi->h >> mpi->chroma_y_shift;
int W = mpi->w, H = mpi->h;
@@ -147,7 +147,7 @@ static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
//===========================================================================//
-static int query_format(struct vf_instance_s* vf, unsigned int fmt){
+static int query_format(struct vf_instance* vf, unsigned int fmt){
switch(fmt)
{
case IMGFMT_YV12:
diff --git a/libmpcodecs/vf_detc.c b/libmpcodecs/vf_detc.c
index 992ffcac66..73a70c40be 100644
--- a/libmpcodecs/vf_detc.c
+++ b/libmpcodecs/vf_detc.c
@@ -285,7 +285,7 @@ static void copy_image(mp_image_t *dmpi, mp_image_t *mpi, int field)
}
}
-static int do_put_image(struct vf_instance_s* vf, mp_image_t *dmpi)
+static int do_put_image(struct vf_instance* vf, mp_image_t *dmpi)
{
struct vf_priv_s *p = vf->priv;
int dropflag;
@@ -313,7 +313,7 @@ static int do_put_image(struct vf_instance_s* vf, mp_image_t *dmpi)
return vf_next_put_image(vf, dmpi, MP_NOPTS_VALUE);
}
-static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts)
+static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts)
{
int ret=0;
mp_image_t *dmpi;
@@ -357,7 +357,7 @@ static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts)
return ret;
}
-static int query_format(struct vf_instance_s* vf, unsigned int fmt)
+static int query_format(struct vf_instance* vf, unsigned int fmt)
{
/* FIXME - figure out which other formats work */
switch (fmt) {
@@ -369,14 +369,14 @@ static int query_format(struct vf_instance_s* vf, unsigned int fmt)
return 0;
}
-static int config(struct vf_instance_s* vf,
+static int config(struct vf_instance* vf,
int width, int height, int d_width, int d_height,
unsigned int flags, unsigned int outfmt)
{
return vf_next_config(vf,width,height,d_width,d_height,flags,outfmt);
}
-static void uninit(struct vf_instance_s* vf)
+static void uninit(struct vf_instance* vf)
{
free(vf->priv);
}
@@ -451,5 +451,3 @@ const vf_info_t vf_info_detc = {
open,
NULL
};
-
-
diff --git a/libmpcodecs/vf_dint.c b/libmpcodecs/vf_dint.c
index 1d10f773d6..7314346493 100644
--- a/libmpcodecs/vf_dint.c
+++ b/libmpcodecs/vf_dint.c
@@ -42,7 +42,7 @@ struct vf_priv_s {
#define MAXROWSIZE 1200
-static int config (struct vf_instance_s* vf,
+static int config (struct vf_instance* vf,
int width, int height, int d_width, int d_height,
unsigned int flags, unsigned int outfmt)
{
@@ -79,7 +79,7 @@ static int config (struct vf_instance_s* vf,
return vf_next_config(vf,width,height,d_width,d_height,flags,outfmt);
}
-static int put_image (struct vf_instance_s* vf, mp_image_t *mpi, double pts)
+static int put_image (struct vf_instance* vf, mp_image_t *mpi, double pts)
{
char rrow0[MAXROWSIZE];
char rrow1[MAXROWSIZE];
diff --git a/libmpcodecs/vf_divtc.c b/libmpcodecs/vf_divtc.c
index 7dbce06363..0fe9576251 100644
--- a/libmpcodecs/vf_divtc.c
+++ b/libmpcodecs/vf_divtc.c
@@ -224,7 +224,7 @@ static int imgop(int(*planeop)(unsigned char *, unsigned char *,
static int match(struct vf_priv_s *p, int *diffs,
int phase1, int phase2, double *strength)
{
- static const int pattern1[]={ -4, 1, 1, 1, 1 },
+ const int pattern1[]={ -4, 1, 1, 1, 1 },
pattern2[]={ -2, -3, 4, 4, -3 }, *pattern;
int f, m, n, t[5];
@@ -257,7 +257,7 @@ static int match(struct vf_priv_s *p, int *diffs,
return m;
}
-static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts)
+static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts)
{
mp_image_t *dmpi, *tmpi=0;
int n, m, f, newphase;
@@ -568,7 +568,7 @@ static int analyze(struct vf_priv_s *p)
return 1;
}
-static int query_format(struct vf_instance_s* vf, unsigned int fmt)
+static int query_format(struct vf_instance* vf, unsigned int fmt)
{
switch(fmt)
{
@@ -583,7 +583,7 @@ static int query_format(struct vf_instance_s* vf, unsigned int fmt)
return 0;
}
-static void uninit(struct vf_instance_s* vf)
+static void uninit(struct vf_instance* vf)
{
if(vf->priv)
{
diff --git a/libmpcodecs/vf_down3dright.c b/libmpcodecs/vf_down3dright.c
index 4f2021397f..2cfceda7f3 100644
--- a/libmpcodecs/vf_down3dright.c
+++ b/libmpcodecs/vf_down3dright.c
@@ -96,7 +96,7 @@ static void toright(unsigned char *dst[3], unsigned char *src[3],
}
}
-static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts)
+static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts)
{
mp_image_t *dmpi;
@@ -113,7 +113,7 @@ static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts)
return vf_next_put_image(vf,dmpi, pts);
}
-static int config(struct vf_instance_s* vf,
+static int config(struct vf_instance* vf,
int width, int height, int d_width, int d_height,
unsigned int flags, unsigned int outfmt)
{
@@ -123,7 +123,7 @@ static int config(struct vf_instance_s* vf,
}
-static int query_format(struct vf_instance_s* vf, unsigned int fmt)
+static int query_format(struct vf_instance* vf, unsigned int fmt)
{
/* FIXME - really any YUV 4:2:0 input format should work */
switch (fmt) {
@@ -135,7 +135,7 @@ static int query_format(struct vf_instance_s* vf, unsigned int fmt)
return 0;
}
-static void uninit(struct vf_instance_s* vf)
+static void uninit(struct vf_instance* vf)
{
free(vf->priv);
}
@@ -164,4 +164,3 @@ const vf_info_t vf_info_down3dright = {
open,
NULL
};
-
diff --git a/libmpcodecs/vf_dsize.c b/libmpcodecs/vf_dsize.c
index 9d4140db98..6e451d540b 100644
--- a/libmpcodecs/vf_dsize.c
+++ b/libmpcodecs/vf_dsize.c
@@ -35,7 +35,7 @@ struct vf_priv_s {
float aspect;
};
-static int config(struct vf_instance_s* vf,
+static int config(struct vf_instance* vf,
int width, int height, int d_width, int d_height,
unsigned int flags, unsigned int outfmt)
{
@@ -121,4 +121,3 @@ const vf_info_t vf_info_dsize = {
open,
NULL
};
-
diff --git a/libmpcodecs/vf_dvbscale.c b/libmpcodecs/vf_dvbscale.c
index d084ff61f5..e7ced30a34 100644
--- a/libmpcodecs/vf_dvbscale.c
+++ b/libmpcodecs/vf_dvbscale.c
@@ -34,7 +34,7 @@ struct vf_priv_s {
//===========================================================================//
-static int config(struct vf_instance_s* vf,
+static int config(struct vf_instance* vf,
int width, int height, int d_width, int d_height,
unsigned int flags, unsigned int outfmt){
diff --git a/libmpcodecs/vf_eq.c b/libmpcodecs/vf_eq.c
index 7e6e58e5d8..34f57d9311 100644
--- a/libmpcodecs/vf_eq.c
+++ b/libmpcodecs/vf_eq.c
@@ -132,7 +132,7 @@ static void (*process)(unsigned char *dest, int dstride, unsigned char *src, int
/* FIXME: add packed yuv version of process */
-static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts)
+static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts)
{
mp_image_t *dmpi;
@@ -161,7 +161,7 @@ static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts)
return vf_next_put_image(vf,dmpi, pts);
}
-static int control(struct vf_instance_s* vf, int request, void* data)
+static int control(struct vf_instance* vf, int request, void* data)
{
vf_equalizer_t *eq;
@@ -192,7 +192,7 @@ static int control(struct vf_instance_s* vf, int request, void* data)
return vf_next_control(vf, request, data);
}
-static int query_format(struct vf_instance_s* vf, unsigned int fmt)
+static int query_format(struct vf_instance* vf, unsigned int fmt)
{
switch (fmt) {
case IMGFMT_YVU9:
@@ -213,7 +213,7 @@ static int query_format(struct vf_instance_s* vf, unsigned int fmt)
return 0;
}
-static void uninit(struct vf_instance_s* vf)
+static void uninit(struct vf_instance* vf)
{
if (vf->priv->buf) free(vf->priv->buf);
free(vf->priv);
@@ -235,13 +235,13 @@ static int open(vf_instance_t *vf, char* args)
}
#define ST_OFF(f) M_ST_OFF(struct vf_priv_s,f)
-static m_option_t vf_opts_fields[] = {
+static const m_option_t vf_opts_fields[] = {
{"brightness", ST_OFF(brightness), CONF_TYPE_INT, M_OPT_RANGE,-100 ,100, NULL},
{"contrast", ST_OFF(contrast), CONF_TYPE_INT, M_OPT_RANGE,-100 ,100, NULL},
{ NULL, NULL, 0, 0, 0, 0, NULL }
};
-static m_struct_t vf_opts = {
+static const m_struct_t vf_opts = {
"eq",
sizeof(struct vf_priv_s),
&vf_priv_dflt,
@@ -256,4 +256,3 @@ const vf_info_t vf_info_eq = {
open,
&vf_opts
};
-
diff --git a/libmpcodecs/vf_expand.c b/libmpcodecs/vf_expand.c
index f8d21fb762..e39bbeda7f 100644
--- a/libmpcodecs/vf_expand.c
+++ b/libmpcodecs/vf_expand.c
@@ -21,10 +21,12 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <stdbool.h>
#include "config.h"
#include "mp_msg.h"
#include "help_mp.h"
+#include "options.h"
#include "img_format.h"
#include "mp_image.h"
@@ -51,12 +53,13 @@ static struct vf_priv_s {
int cfg_exp_x, cfg_exp_y;
int exp_w,exp_h;
int exp_x,exp_y;
- int osd;
+ int osd_enabled;
double aspect;
int round;
unsigned char* fb_ptr;
int passthrough;
int first_slice;
+ struct osd_state *osd;
} const vf_priv_dflt = {
-1,-1,
-1,-1,
@@ -70,13 +73,10 @@ static struct vf_priv_s {
0
};
-extern int opt_screen_size_x;
-extern int opt_screen_size_y;
-
//===========================================================================//
#ifdef OSD_SUPPORT
-static struct vf_instance_s* vf=NULL; // fixme (needs sub.c changes)
+static struct vf_instance* vf=NULL; // fixme (needs sub.c changes)
static int orig_w,orig_h;
static void remove_func_2(int x0,int y0, int w,int h){
@@ -122,7 +122,7 @@ static void remove_func(int x0,int y0, int w,int h){
}
}
-static void draw_func(int x0,int y0, int w,int h,unsigned char* src, unsigned char *srca, int stride){
+static void draw_func(void *ctx, int x0,int y0, int w,int h,unsigned char* src, unsigned char *srca, int stride){
unsigned char* dst;
if(!vo_osd_changed_flag && vf->dmpi->planes[0]==vf->priv->fb_ptr){
// ok, enough to update the area inside the video, leave the black bands
@@ -182,7 +182,7 @@ static void draw_func(int x0,int y0, int w,int h,unsigned char* src, unsigned ch
}
}
-static void draw_osd(struct vf_instance_s* vf_,int w,int h){
+static void draw_osd(struct vf_instance* vf_,int w,int h){
vf=vf_;orig_w=w;orig_h=h;
// printf("======================================\n");
if(vf->priv->exp_w!=w || vf->priv->exp_h!=h ||
@@ -200,10 +200,10 @@ static void draw_osd(struct vf_instance_s* vf_,int w,int h){
remove_func_2(vf->priv->exp_x+w,vf->priv->exp_y,vf->priv->exp_w-w-vf->priv->exp_x,h);
} else {
// partial clear:
- vo_remove_text(vf->priv->exp_w,vf->priv->exp_h,remove_func);
+ osd_remove_text(vf->priv->osd, vf->priv->exp_w,vf->priv->exp_h,remove_func);
}
}
- vo_draw_text(vf->priv->exp_w,vf->priv->exp_h,draw_func);
+ osd_draw_text(vf->priv->osd, vf->priv->exp_w,vf->priv->exp_h,draw_func, NULL);
// save buffer pointer for double buffering detection - yes, i know it's
// ugly method, but note that codecs with DR support does the same...
if(vf->dmpi)
@@ -213,9 +213,11 @@ static void draw_osd(struct vf_instance_s* vf_,int w,int h){
#endif
//===========================================================================//
-static int config(struct vf_instance_s* vf,
+static int config(struct vf_instance* vf,
int width, int height, int d_width, int d_height,
- unsigned int flags, unsigned int outfmt){
+ unsigned int flags, unsigned int outfmt)
+{
+ struct MPOpts *opts = vf->opts;
if(outfmt == IMGFMT_MPEGPES) {
vf->priv->passthrough = 1;
return vf_next_config(vf,width,height,d_width,d_height,flags,outfmt);
@@ -255,7 +257,7 @@ static int config(struct vf_instance_s* vf,
if(vf->priv->exp_y<0 || vf->priv->exp_y+height>vf->priv->exp_h) vf->priv->exp_y=(vf->priv->exp_h-height)/2;
vf->priv->fb_ptr=NULL;
- if(!opt_screen_size_x && !opt_screen_size_y){
+ if(!opts->screen_size_x && !opts->screen_size_y){
d_width=d_width*vf->priv->exp_w/width;
d_height=d_height*vf->priv->exp_h/height;
}
@@ -268,12 +270,12 @@ static int config(struct vf_instance_s* vf,
// codec -copy-> expand --DR--> vo
// codec -copy-> expand -copy-> vo (worst case)
-static void get_image(struct vf_instance_s* vf, mp_image_t *mpi){
+static void get_image(struct vf_instance* vf, mp_image_t *mpi){
// if(mpi->type==MP_IMGTYPE_IPB) return; // not yet working
#ifdef OSD_SUPPORT
- if(vf->priv->osd && (mpi->flags&MP_IMGFLAG_PRESERVE)){
+ if(vf->priv->osd_enabled && (mpi->flags&MP_IMGFLAG_PRESERVE)){
// check if we have to render osd!
- vo_update_osd(vf->priv->exp_w, vf->priv->exp_h);
+ osd_update(vf->priv->osd, vf->priv->exp_w, vf->priv->exp_h);
if(vo_osd_check_range_update(vf->priv->exp_x,vf->priv->exp_y,
vf->priv->exp_x+mpi->w,vf->priv->exp_y+mpi->h)) return;
}
@@ -288,7 +290,7 @@ static void get_image(struct vf_instance_s* vf, mp_image_t *mpi){
#if 1
if((vf->dmpi->flags & MP_IMGFLAG_DRAW_CALLBACK) &&
!(vf->dmpi->flags & MP_IMGFLAG_DIRECT)){
- mp_msg(MSGT_VFILTER, MSGL_INFO, MSGTR_MPCODECS_FullDRNotPossible);
+ mp_tmsg(MSGT_VFILTER, MSGL_INFO, "Full DR not possible, trying SLICES instead!\n");
return;
}
#endif
@@ -315,7 +317,7 @@ static void get_image(struct vf_instance_s* vf, mp_image_t *mpi){
}
}
-static void start_slice(struct vf_instance_s* vf, mp_image_t *mpi){
+static void start_slice(struct vf_instance* vf, mp_image_t *mpi){
// printf("start_slice called! flag=%d\n",mpi->flags&MP_IMGFLAG_DRAW_CALLBACK);
if(!vf->next->draw_slice){
mpi->flags&=~MP_IMGFLAG_DRAW_CALLBACK;
@@ -329,11 +331,11 @@ static void start_slice(struct vf_instance_s* vf, mp_image_t *mpi){
FFMAX(vf->priv->exp_w, mpi->width +vf->priv->exp_x),
FFMAX(vf->priv->exp_h, mpi->height+vf->priv->exp_y));
if(!(vf->dmpi->flags&MP_IMGFLAG_DRAW_CALLBACK))
- mp_msg(MSGT_VFILTER, MSGL_WARN, MSGTR_MPCODECS_WarnNextFilterDoesntSupportSlices); // shouldn't happen.
+ mp_tmsg(MSGT_VFILTER, MSGL_WARN, "WARNING! Next filter doesn't support SLICES, get ready for sig11...\n"); // shouldn't happen.
vf->priv->first_slice = 1;
}
-static void draw_top_blackbar_slice(struct vf_instance_s* vf,
+static void draw_top_blackbar_slice(struct vf_instance* vf,
unsigned char** src, int* stride, int w,int h, int x, int y){
if(vf->priv->exp_y>0 && y == 0) {
vf_next_draw_slice(vf, vf->dmpi->planes, vf->dmpi->stride,
@@ -342,7 +344,7 @@ static void draw_top_blackbar_slice(struct vf_instance_s* vf,
}
-static void draw_bottom_blackbar_slice(struct vf_instance_s* vf,
+static void draw_bottom_blackbar_slice(struct vf_instance* vf,
unsigned char** src, int* stride, int w,int h, int x, int y){
if(vf->priv->exp_y+vf->h<vf->dmpi->h && y+h == vf->h) {
unsigned char *src2[MP_MAX_PLANES];
@@ -362,7 +364,7 @@ static void draw_bottom_blackbar_slice(struct vf_instance_s* vf,
}
}
-static void draw_slice(struct vf_instance_s* vf,
+static void draw_slice(struct vf_instance* vf,
unsigned char** src, int* stride, int w,int h, int x, int y){
// printf("draw_slice() called %d at %d\n",h,y);
@@ -385,7 +387,7 @@ static void draw_slice(struct vf_instance_s* vf,
vf->priv->first_slice = 0;
}
-static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
+static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts){
if (vf->priv->passthrough) {
mp_image_t *dmpi = vf_get_image(vf->next, IMGFMT_MPEGPES,
MP_IMGTYPE_EXPORT, 0, mpi->w, mpi->h);
@@ -395,10 +397,10 @@ static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
if(mpi->flags&MP_IMGFLAG_DIRECT || mpi->flags&MP_IMGFLAG_DRAW_CALLBACK){
vf->dmpi=mpi->priv;
- if(!vf->dmpi) { mp_msg(MSGT_VFILTER, MSGL_WARN, MSGTR_MPCODECS_FunWhydowegetNULL); return 0; }
+ if(!vf->dmpi) { mp_tmsg(MSGT_VFILTER, MSGL_WARN, "Why do we get NULL??\n"); return 0; }
mpi->priv=NULL;
#ifdef OSD_SUPPORT
- if(vf->priv->osd) draw_osd(vf,mpi->w,mpi->h);
+ if(vf->priv->osd_enabled) draw_osd(vf,mpi->w,mpi->h);
#endif
// we've used DR, so we're ready...
if(!(mpi->flags&MP_IMGFLAG_PLANAR))
@@ -433,24 +435,32 @@ static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
vf->dmpi->planes[1] = mpi->planes[1]; // passthrough rgb8 palette
}
#ifdef OSD_SUPPORT
- if(vf->priv->osd) draw_osd(vf,mpi->w,mpi->h);
+ if(vf->priv->osd_enabled) draw_osd(vf,mpi->w,mpi->h);
#endif
return vf_next_put_image(vf,vf->dmpi, pts);
}
//===========================================================================//
-static int control(struct vf_instance_s* vf, int request, void* data){
+static int control(struct vf_instance* vf, int request, void* data){
#ifdef OSD_SUPPORT
switch(request){
+ case VFCTRL_SET_OSD_OBJ:
+ vf->priv->osd = data;
+ break;
case VFCTRL_DRAW_OSD:
- if(vf->priv->osd) return CONTROL_TRUE;
+ if(vf->priv->osd_enabled) return CONTROL_TRUE;
+ break;
+ case VFCTRL_REDRAW_OSD:
+ if (vf->priv->osd_enabled)
+ return false;
+ break;
}
#endif
return vf_next_control(vf,request,data);
}
-static int query_format(struct vf_instance_s* vf, unsigned int fmt){
+static int query_format(struct vf_instance* vf, unsigned int fmt){
return vf_next_query_format(vf,fmt);
}
@@ -467,7 +477,7 @@ static int open(vf_instance_t *vf, char* args){
vf->priv->cfg_exp_h,
vf->priv->cfg_exp_x,
vf->priv->cfg_exp_y,
- vf->priv->osd,
+ vf->priv->osd_enabled,
vf->priv->aspect,
vf->priv->round);
return 1;
@@ -479,13 +489,13 @@ static m_option_t vf_opts_fields[] = {
{"h", ST_OFF(cfg_exp_h), CONF_TYPE_INT, 0, 0 ,0, NULL},
{"x", ST_OFF(cfg_exp_x), CONF_TYPE_INT, M_OPT_MIN, -1, 0, NULL},
{"y", ST_OFF(cfg_exp_y), CONF_TYPE_INT, M_OPT_MIN, -1, 0, NULL},
- {"osd", ST_OFF(osd), CONF_TYPE_FLAG, 0 , 0, 1, NULL},
+ {"osd", ST_OFF(osd_enabled), CONF_TYPE_FLAG, 0 , 0, 1, NULL},
{"aspect", ST_OFF(aspect), CONF_TYPE_DOUBLE, M_OPT_MIN, 0, 0, NULL},
{"round", ST_OFF(round), CONF_TYPE_INT, M_OPT_MIN, 1, 0, NULL},
{ NULL, NULL, 0, 0, 0, 0, NULL }
};
-static m_struct_t vf_opts = {
+static const m_struct_t vf_opts = {
"expand",
sizeof(struct vf_priv_s),
&vf_priv_dflt,
diff --git a/libmpcodecs/vf_field.c b/libmpcodecs/vf_field.c
index 3db6c5eef2..3640da1073 100644
--- a/libmpcodecs/vf_field.c
+++ b/libmpcodecs/vf_field.c
@@ -32,13 +32,13 @@ struct vf_priv_s {
//===========================================================================//
-static int config(struct vf_instance_s* vf,
+static int config(struct vf_instance* vf,
int width, int height, int d_width, int d_height,
unsigned int flags, unsigned int outfmt){
return vf_next_config(vf,width,height/2,d_width,d_height,flags,outfmt);
}
-static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
+static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts){
vf->dmpi=vf_get_image(vf->next,mpi->imgfmt,
MP_IMGTYPE_EXPORT, MP_IMGFLAG_ACCEPT_STRIDE,
mpi->width, mpi->height/2);
@@ -61,7 +61,7 @@ static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
//===========================================================================//
-static void uninit(struct vf_instance_s* vf)
+static void uninit(struct vf_instance* vf)
{
free(vf->priv);
}
diff --git a/libmpcodecs/vf_fil.c b/libmpcodecs/vf_fil.c
index ed45e8e2fb..60bb28b6a7 100644
--- a/libmpcodecs/vf_fil.c
+++ b/libmpcodecs/vf_fil.c
@@ -35,7 +35,7 @@ struct vf_priv_s {
//===========================================================================//
-static int config(struct vf_instance_s* vf,
+static int config(struct vf_instance* vf,
int width, int height, int d_width, int d_height,
unsigned int flags, unsigned int outfmt){
int pixel_stride= (width+15)&~15; //FIXME this is ust a guess ... especially for non planar its somewhat bad one
@@ -63,7 +63,7 @@ static int config(struct vf_instance_s* vf,
(d_width*vf->priv->stridefactor)>>1, 2*d_height/vf->priv->stridefactor, flags, outfmt);
}
-static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
+static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts){
if(mpi->flags&MP_IMGFLAG_DIRECT){
// we've used DR, so we're ready...
return vf_next_put_image(vf,(mp_image_t*)mpi->priv, pts);
@@ -89,7 +89,7 @@ static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
//===========================================================================//
-static void uninit(struct vf_instance_s* vf)
+static void uninit(struct vf_instance* vf)
{
free(vf->priv);
}
diff --git a/libmpcodecs/vf_filmdint.c b/libmpcodecs/vf_filmdint.c
index 47285c8bd1..33fd868654 100644
--- a/libmpcodecs/vf_filmdint.c
+++ b/libmpcodecs/vf_filmdint.c
@@ -24,6 +24,7 @@
#include "config.h"
#include "mp_msg.h"
#include "cpudetect.h"
+#include "options.h"
#include "img_format.h"
#include "mp_image.h"
@@ -97,9 +98,6 @@ struct vf_priv_s {
static const struct frame_stats ppzs = {PPZ,PPZ,PPZ,PPZ,PPZ,PPZ,PPZ,0,0,9999};
static const struct frame_stats pprs = {PPR,PPR,PPR,PPR,PPR,PPR,PPR,0,0,9999};
-extern int opt_screen_size_x;
-extern int opt_screen_size_y;
-
#ifndef MIN
#define MIN(a,b) (((a)<(b))?(a):(b))
#endif
@@ -934,7 +932,7 @@ static inline double get_time(void)
return tv.tv_sec + tv.tv_usec * 1e-6;
}
-static void get_image(struct vf_instance_s* vf, mp_image_t *mpi)
+static void get_image(struct vf_instance* vf, mp_image_t *mpi)
{
struct vf_priv_s *p = vf->priv;
static unsigned char **planes, planes_idx;
@@ -1138,7 +1136,7 @@ find_breaks(struct vf_priv_s *p, struct frame_stats *s)
#define ITOC(X) (!(X) ? ' ' : (X) + ((X)>9 ? 'a'-10 : '0'))
-static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts)
+static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts)
{
mp_image_t *dmpi;
struct vf_priv_s *p = vf->priv;
@@ -1336,7 +1334,7 @@ static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts)
return show_fields ? vf_next_put_image(vf, dmpi, MP_NOPTS_VALUE) : 0;
}
-static int query_format(struct vf_instance_s* vf, unsigned int fmt)
+static int query_format(struct vf_instance* vf, unsigned int fmt)
{
/* FIXME - support more formats */
switch (fmt) {
@@ -1351,10 +1349,11 @@ static int query_format(struct vf_instance_s* vf, unsigned int fmt)
return 0;
}
-static int config(struct vf_instance_s* vf,
+static int config(struct vf_instance* vf,
int width, int height, int d_width, int d_height,
unsigned int flags, unsigned int outfmt)
{
+ struct MPOpts *opts = vf->opts;
unsigned long cxm = 0;
unsigned long cym = 0;
struct vf_priv_s *p = vf->priv;
@@ -1389,14 +1388,14 @@ static int config(struct vf_instance_s* vf,
if (p->crop_x + p->w > width ) p->crop_x = 0;
if (p->crop_y + p->h > height) p->crop_y = 0;
- if(!opt_screen_size_x && !opt_screen_size_y){
+ if(!opts->screen_size_x && !opts->screen_size_y){
d_width = d_width * p->w/width;
d_height = d_height * p->h/height;
}
return vf_next_config(vf, p->w, p->h, d_width, d_height, flags, outfmt);
}
-static void uninit(struct vf_instance_s* vf)
+static void uninit(struct vf_instance* vf)
{
struct vf_priv_s *p = vf->priv;
mp_msg(MSGT_VFILTER, MSGL_INFO, "diff_time: %.3f, merge_time: %.3f, "
diff --git a/libmpcodecs/vf_flip.c b/libmpcodecs/vf_flip.c
index 3a59450fcf..a6663600b9 100644
--- a/libmpcodecs/vf_flip.c
+++ b/libmpcodecs/vf_flip.c
@@ -30,14 +30,14 @@
//===========================================================================//
-static int config(struct vf_instance_s* vf,
+static int config(struct vf_instance* vf,
int width, int height, int d_width, int d_height,
unsigned int flags, unsigned int outfmt){
flags&=~VOFLAG_FLIPPING; // remove the FLIP flag
return vf_next_config(vf,width,height,d_width,d_height,flags,outfmt);
}
-static void get_image(struct vf_instance_s* vf, mp_image_t *mpi){
+static void get_image(struct vf_instance* vf, mp_image_t *mpi){
if(mpi->flags&MP_IMGFLAG_ACCEPT_STRIDE){
// try full DR !
vf->dmpi=vf_get_image(vf->next,mpi->imgfmt,
@@ -59,7 +59,7 @@ static void get_image(struct vf_instance_s* vf, mp_image_t *mpi){
}
}
-static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
+static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts){
if(mpi->flags&MP_IMGFLAG_DIRECT){
// we've used DR, so we're ready...
if(!(mpi->flags&MP_IMGFLAG_PLANAR))
diff --git a/libmpcodecs/vf_format.c b/libmpcodecs/vf_format.c
index a729016dc3..8711d2acef 100644
--- a/libmpcodecs/vf_format.c
+++ b/libmpcodecs/vf_format.c
@@ -40,7 +40,7 @@ static struct vf_priv_s {
//===========================================================================//
-static int query_format(struct vf_instance_s* vf, unsigned int fmt){
+static int query_format(struct vf_instance* vf, unsigned int fmt){
if(fmt==vf->priv->fmt)
return vf_next_query_format(vf,fmt);
return 0;
@@ -53,12 +53,12 @@ static int open(vf_instance_t *vf, char* args){
}
#define ST_OFF(f) M_ST_OFF(struct vf_priv_s,f)
-static m_option_t vf_opts_fields[] = {
+static const m_option_t vf_opts_fields[] = {
{"fmt", ST_OFF(fmt), CONF_TYPE_IMGFMT, 0,0 ,0, NULL},
{ NULL, NULL, 0, 0, 0, 0, NULL }
};
-static m_struct_t vf_opts = {
+static const m_struct_t vf_opts = {
"format",
sizeof(struct vf_priv_s),
&vf_priv_dflt,
diff --git a/libmpcodecs/vf_framestep.c b/libmpcodecs/vf_framestep.c
index ba24d07ec3..2c3d5ad2f9 100644
--- a/libmpcodecs/vf_framestep.c
+++ b/libmpcodecs/vf_framestep.c
@@ -89,7 +89,7 @@ struct vf_priv_s {
};
/* Filter handler */
-static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts)
+static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts)
{
mp_image_t *dmpi;
struct vf_priv_s *priv;
@@ -146,7 +146,7 @@ static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts)
return 0;
}
-static void uninit(struct vf_instance_s* vf)
+static void uninit(struct vf_instance* vf)
{
/* Free private data */
free(vf->priv);
@@ -186,7 +186,7 @@ static int open(vf_instance_t *vf, char* args)
if (*args != '\0') {
p->frame_step = atoi(args);
if (p->frame_step <= 0) {
- mp_msg(MSGT_VFILTER, MSGL_WARN, MSGTR_MPCODECS_ErrorParsingArgument);
+ mp_tmsg(MSGT_VFILTER, MSGL_WARN, "[VF_FRAMESTEP] Error parsing argument.\n");
return 0;
}
}
@@ -203,5 +203,3 @@ const vf_info_t vf_info_framestep = {
open,
NULL
};
-
-
diff --git a/libmpcodecs/vf_fspp.c b/libmpcodecs/vf_fspp.c
index 952dced086..a2507a22f0 100644
--- a/libmpcodecs/vf_fspp.c
+++ b/libmpcodecs/vf_fspp.c
@@ -485,7 +485,7 @@ static void filter(struct vf_priv_s *p, uint8_t *dst, uint8_t *src,
}
}
-static int config(struct vf_instance_s* vf,
+static int config(struct vf_instance* vf,
int width, int height, int d_width, int d_height,
unsigned int flags, unsigned int outfmt)
{
@@ -499,7 +499,7 @@ static int config(struct vf_instance_s* vf,
return vf_next_config(vf,width,height,d_width,d_height,flags,outfmt);
}
-static void get_image(struct vf_instance_s* vf, mp_image_t *mpi)
+static void get_image(struct vf_instance* vf, mp_image_t *mpi)
{
if(mpi->flags&MP_IMGFLAG_PRESERVE) return; // don't change
// ok, we can do pp in-place (or pp disabled):
@@ -517,7 +517,7 @@ static void get_image(struct vf_instance_s* vf, mp_image_t *mpi)
mpi->flags|=MP_IMGFLAG_DIRECT;
}
-static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts)
+static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts)
{
mp_image_t *dmpi;
if(!(mpi->flags&MP_IMGFLAG_DIRECT)){
@@ -571,7 +571,7 @@ static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts)
return vf_next_put_image(vf,dmpi, pts);
}
-static void uninit(struct vf_instance_s* vf)
+static void uninit(struct vf_instance* vf)
{
if(!vf->priv) return;
@@ -590,7 +590,7 @@ static void uninit(struct vf_instance_s* vf)
//===========================================================================//
-static int query_format(struct vf_instance_s* vf, unsigned int fmt)
+static int query_format(struct vf_instance* vf, unsigned int fmt)
{
switch(fmt){
case IMGFMT_YVU9:
@@ -609,7 +609,7 @@ static int query_format(struct vf_instance_s* vf, unsigned int fmt)
return 0;
}
-static int control(struct vf_instance_s* vf, int request, void* data)
+static int control(struct vf_instance* vf, int request, void* data)
{
switch(request){
case VFCTRL_QUERY_MAX_PP_LEVEL:
diff --git a/libmpcodecs/vf_geq.c b/libmpcodecs/vf_geq.c
index 21da7e2000..d2cbe6554b 100644
--- a/libmpcodecs/vf_geq.c
+++ b/libmpcodecs/vf_geq.c
@@ -42,13 +42,13 @@ struct vf_priv_s {
mp_image_t *mpi;
};
-static int config(struct vf_instance_s* vf,
+static int config(struct vf_instance* vf,
int width, int height, int d_width, int d_height,
unsigned int flags, unsigned int outfmt){
return vf_next_config(vf,width,height,d_width,d_height,flags,outfmt);
}
-static inline double getpix(struct vf_instance_s* vf, double x, double y, int plane){
+static inline double getpix(struct vf_instance* vf, double x, double y, int plane){
int xi, yi;
mp_image_t *mpi= vf->priv->mpi;
int stride= mpi->stride[plane];
@@ -66,19 +66,19 @@ static inline double getpix(struct vf_instance_s* vf, double x, double y, int pl
//FIXME cubic interpolate
//FIXME keep the last few frames
-static double lum(struct vf_instance_s* vf, double x, double y){
+static double lum(struct vf_instance* vf, double x, double y){
return getpix(vf, x, y, 0);
}
-static double cb(struct vf_instance_s* vf, double x, double y){
+static double cb(struct vf_instance* vf, double x, double y){
return getpix(vf, x, y, 1);
}
-static double cr(struct vf_instance_s* vf, double x, double y){
+static double cr(struct vf_instance* vf, double x, double y){
return getpix(vf, x, y, 2);
}
-static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
+static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts){
mp_image_t *dmpi;
int x,y, plane;
@@ -126,7 +126,7 @@ static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
return vf_next_put_image(vf,dmpi, pts);
}
-static void uninit(struct vf_instance_s* vf){
+static void uninit(struct vf_instance* vf){
if(!vf->priv) return;
av_free(vf->priv);
@@ -151,7 +151,7 @@ static int open(vf_instance_t *vf, char* args){
if (!eq[2][0]) strncpy(eq[2], eq[1], sizeof(eq[0])-1);
for(plane=0; plane<3; plane++){
- static const char *const_names[]={
+ const char * const const_names[]={
"PI",
"E",
"X",
@@ -163,7 +163,7 @@ static int open(vf_instance_t *vf, char* args){
"SH",
NULL
};
- static const char *func2_names[]={
+ const char * const func2_names[]={
"lum",
"cb",
"cr",
diff --git a/libmpcodecs/vf_gradfun.c b/libmpcodecs/vf_gradfun.c
index 7089af1b57..83ae6fb9d6 100644
--- a/libmpcodecs/vf_gradfun.c
+++ b/libmpcodecs/vf_gradfun.c
@@ -39,7 +39,7 @@
#include "vf.h"
#include "libvo/fastmemcpy.h"
#include "libavutil/avutil.h"
-#include "libavutil/x86_cpu.h"
+#include "ffmpeg_files/x86_cpu.h"
struct vf_priv_s {
int thresh;
@@ -273,7 +273,7 @@ static void filter(struct vf_priv_s *ctx, uint8_t *dst, uint8_t *src,
}
}
-static void get_image(struct vf_instance_s* vf, mp_image_t *mpi)
+static void get_image(struct vf_instance *vf, mp_image_t *mpi)
{
if (mpi->flags&MP_IMGFLAG_PRESERVE) return; // don't change
// ok, we can do pp in-place:
@@ -291,7 +291,7 @@ static void get_image(struct vf_instance_s* vf, mp_image_t *mpi)
mpi->flags |= MP_IMGFLAG_DIRECT;
}
-static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts)
+static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts)
{
mp_image_t *dmpi = vf->dmpi;
int p;
@@ -325,7 +325,7 @@ static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts)
return vf_next_put_image(vf, dmpi, pts);
}
-static int query_format(struct vf_instance_s* vf, unsigned int fmt)
+static int query_format(struct vf_instance *vf, unsigned int fmt)
{
switch (fmt){
case IMGFMT_YVU9:
@@ -347,7 +347,7 @@ static int query_format(struct vf_instance_s* vf, unsigned int fmt)
return 0;
}
-static int config(struct vf_instance_s* vf,
+static int config(struct vf_instance *vf,
int width, int height, int d_width, int d_height,
unsigned int flags, unsigned int outfmt)
{
@@ -356,7 +356,7 @@ static int config(struct vf_instance_s* vf,
return vf_next_config(vf,width,height,d_width,d_height,flags,outfmt);
}
-static void uninit(struct vf_instance_s* vf)
+static void uninit(struct vf_instance *vf)
{
if (!vf->priv) return;
av_free(vf->priv->buf);
diff --git a/libmpcodecs/vf_halfpack.c b/libmpcodecs/vf_halfpack.c
index 1c7bdcad28..3c8a6b580a 100644
--- a/libmpcodecs/vf_halfpack.c
+++ b/libmpcodecs/vf_halfpack.c
@@ -163,7 +163,7 @@ static void (*halfpack)(unsigned char *dst, unsigned char *src[3],
int dststride, int srcstride[3], int w, int h);
-static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts)
+static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts)
{
const uint8_t *src[MP_MAX_PLANES] = {
mpi->planes[0] + mpi->stride[0]*vf->priv->field,
@@ -190,7 +190,7 @@ static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts)
return vf_next_put_image(vf,dmpi, pts);
}
-static int config(struct vf_instance_s* vf,
+static int config(struct vf_instance* vf,
int width, int height, int d_width, int d_height,
unsigned int flags, unsigned int outfmt)
{
@@ -208,7 +208,7 @@ static int config(struct vf_instance_s* vf,
}
-static int query_format(struct vf_instance_s* vf, unsigned int fmt)
+static int query_format(struct vf_instance* vf, unsigned int fmt)
{
/* FIXME - really any YUV 4:2:0 input format should work */
switch (fmt) {
@@ -220,7 +220,7 @@ static int query_format(struct vf_instance_s* vf, unsigned int fmt)
return 0;
}
-static void uninit(struct vf_instance_s* vf)
+static void uninit(struct vf_instance* vf)
{
sws_freeContext(vf->priv->ctx);
free(vf->priv);
@@ -252,4 +252,3 @@ const vf_info_t vf_info_halfpack = {
open,
NULL
};
-
diff --git a/libmpcodecs/vf_harddup.c b/libmpcodecs/vf_harddup.c
index a276088288..07d47a1737 100644
--- a/libmpcodecs/vf_harddup.c
+++ b/libmpcodecs/vf_harddup.c
@@ -31,7 +31,7 @@ struct vf_priv_s {
mp_image_t *last_mpi;
};
-static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts)
+static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts)
{
mp_image_t *dmpi;
@@ -52,7 +52,7 @@ static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts)
return vf_next_put_image(vf, dmpi, pts);
}
-static int control(struct vf_instance_s* vf, int request, void* data)
+static int control(struct vf_instance* vf, int request, void* data)
{
switch (request) {
case VFCTRL_DUPLICATE_FRAME:
@@ -68,7 +68,7 @@ static int control(struct vf_instance_s* vf, int request, void* data)
return vf_next_control(vf, request, data);
}
-static void uninit(struct vf_instance_s* vf)
+static void uninit(struct vf_instance* vf)
{
free(vf->priv);
}
@@ -90,5 +90,3 @@ const vf_info_t vf_info_harddup = {
open,
NULL
};
-
-
diff --git a/libmpcodecs/vf_hqdn3d.c b/libmpcodecs/vf_hqdn3d.c
index 3e4246de91..a62854c2da 100644
--- a/libmpcodecs/vf_hqdn3d.c
+++ b/libmpcodecs/vf_hqdn3d.c
@@ -44,14 +44,14 @@ struct vf_priv_s {
/***************************************************************************/
-static void uninit(struct vf_instance_s* vf){
+static void uninit(struct vf_instance* vf){
if(vf->priv->Line){free(vf->priv->Line);vf->priv->Line=NULL;}
if(vf->priv->Frame[0]){free(vf->priv->Frame[0]);vf->priv->Frame[0]=NULL;}
if(vf->priv->Frame[1]){free(vf->priv->Frame[1]);vf->priv->Frame[1]=NULL;}
if(vf->priv->Frame[2]){free(vf->priv->Frame[2]);vf->priv->Frame[2]=NULL;}
}
-static int config(struct vf_instance_s* vf,
+static int config(struct vf_instance* vf,
int width, int height, int d_width, int d_height,
unsigned int flags, unsigned int outfmt){
@@ -202,7 +202,7 @@ static void deNoise(unsigned char *Frame, // mpi->planes[x]
}
-static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
+static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts){
int cw= mpi->w >> mpi->chroma_x_shift;
int ch= mpi->h >> mpi->chroma_y_shift;
int W = mpi->w, H = mpi->h;
@@ -237,7 +237,7 @@ static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
//===========================================================================//
-static int query_format(struct vf_instance_s* vf, unsigned int fmt){
+static int query_format(struct vf_instance* vf, unsigned int fmt){
switch(fmt)
{
case IMGFMT_YV12:
diff --git a/libmpcodecs/vf_hue.c b/libmpcodecs/vf_hue.c
index 2e8f04cf72..bc7ab21d34 100644
--- a/libmpcodecs/vf_hue.c
+++ b/libmpcodecs/vf_hue.c
@@ -76,7 +76,7 @@ static void (*process)(uint8_t *udst, uint8_t *vdst, uint8_t *usrc, uint8_t *vsr
/* FIXME: add packed yuv version of process */
-static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts)
+static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts)
{
mp_image_t *dmpi;
@@ -110,7 +110,7 @@ static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts)
return vf_next_put_image(vf,dmpi, pts);
}
-static int control(struct vf_instance_s* vf, int request, void* data)
+static int control(struct vf_instance* vf, int request, void* data)
{
vf_equalizer_t *eq;
@@ -139,7 +139,7 @@ static int control(struct vf_instance_s* vf, int request, void* data)
return vf_next_control(vf, request, data);
}
-static int query_format(struct vf_instance_s* vf, unsigned int fmt)
+static int query_format(struct vf_instance* vf, unsigned int fmt)
{
switch (fmt) {
case IMGFMT_YVU9:
@@ -156,7 +156,7 @@ static int query_format(struct vf_instance_s* vf, unsigned int fmt)
return 0;
}
-static void uninit(struct vf_instance_s* vf)
+static void uninit(struct vf_instance* vf)
{
if (vf->priv->buf[0]) free(vf->priv->buf[0]);
if (vf->priv->buf[1]) free(vf->priv->buf[1]);
@@ -177,13 +177,13 @@ static int open(vf_instance_t *vf, char* args)
}
#define ST_OFF(f) M_ST_OFF(struct vf_priv_s,f)
-static m_option_t vf_opts_fields[] = {
+static const m_option_t vf_opts_fields[] = {
{"hue", ST_OFF(hue), CONF_TYPE_FLOAT, M_OPT_RANGE,-180.0 ,180.0, NULL},
{"saturation", ST_OFF(saturation), CONF_TYPE_FLOAT, M_OPT_RANGE,-10.0 ,10.0, NULL},
{ NULL, NULL, 0, 0, 0, 0, NULL }
};
-static m_struct_t vf_opts = {
+static const m_struct_t vf_opts = {
"hue",
sizeof(struct vf_priv_s),
&vf_priv_dflt,
@@ -198,4 +198,3 @@ const vf_info_t vf_info_hue = {
open,
&vf_opts
};
-
diff --git a/libmpcodecs/vf_il.c b/libmpcodecs/vf_il.c
index cc70192fe1..724dedb2d0 100644
--- a/libmpcodecs/vf_il.c
+++ b/libmpcodecs/vf_il.c
@@ -73,7 +73,7 @@ static void interleave(uint8_t *dst, uint8_t *src, int w, int h, int dstStride,
}
}
-static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
+static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts){
int w;
FilterParam *luma = &vf->priv->lumaParam;
FilterParam *chroma= &vf->priv->chromaParam;
diff --git a/libmpcodecs/vf_ilpack.c b/libmpcodecs/vf_ilpack.c
index 917d337702..0e0e48aefc 100644
--- a/libmpcodecs/vf_ilpack.c
+++ b/libmpcodecs/vf_ilpack.c
@@ -369,7 +369,7 @@ static void ilpack(unsigned char *dst, unsigned char *src[3],
}
-static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts)
+static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts)
{
mp_image_t *dmpi;
@@ -383,7 +383,7 @@ static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts)
return vf_next_put_image(vf,dmpi, pts);
}
-static int config(struct vf_instance_s* vf,
+static int config(struct vf_instance* vf,
int width, int height, int d_width, int d_height,
unsigned int flags, unsigned int outfmt)
{
@@ -392,7 +392,7 @@ static int config(struct vf_instance_s* vf,
}
-static int query_format(struct vf_instance_s* vf, unsigned int fmt)
+static int query_format(struct vf_instance* vf, unsigned int fmt)
{
/* FIXME - really any YUV 4:2:0 input format should work */
switch (fmt) {
@@ -451,4 +451,3 @@ const vf_info_t vf_info_ilpack = {
open,
NULL
};
-
diff --git a/libmpcodecs/vf_ivtc.c b/libmpcodecs/vf_ivtc.c
index 1a004efc96..d8db3b006f 100644
--- a/libmpcodecs/vf_ivtc.c
+++ b/libmpcodecs/vf_ivtc.c
@@ -426,7 +426,7 @@ static void copy_image(mp_image_t *dmpi, mp_image_t *mpi, int field)
}
}
-static int do_put_image(struct vf_instance_s* vf, mp_image_t *dmpi)
+static int do_put_image(struct vf_instance* vf, mp_image_t *dmpi)
{
struct vf_priv_s *p = vf->priv;
int dropflag=0;
@@ -455,7 +455,7 @@ static int do_put_image(struct vf_instance_s* vf, mp_image_t *dmpi)
return vf_next_put_image(vf, dmpi, MP_NOPTS_VALUE);
}
-static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts)
+static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts)
{
int ret=0;
struct vf_priv_s *p = vf->priv;
@@ -506,7 +506,7 @@ static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts)
return ret;
}
-static int query_format(struct vf_instance_s* vf, unsigned int fmt)
+static int query_format(struct vf_instance* vf, unsigned int fmt)
{
switch (fmt) {
case IMGFMT_YV12:
@@ -517,7 +517,7 @@ static int query_format(struct vf_instance_s* vf, unsigned int fmt)
return 0;
}
-static void uninit(struct vf_instance_s* vf)
+static void uninit(struct vf_instance* vf)
{
free(vf->priv);
}
@@ -548,5 +548,3 @@ const vf_info_t vf_info_ivtc = {
open,
NULL
};
-
-
diff --git a/libmpcodecs/vf_kerndeint.c b/libmpcodecs/vf_kerndeint.c
index a2bc0ed0c0..359dfb9469 100644
--- a/libmpcodecs/vf_kerndeint.c
+++ b/libmpcodecs/vf_kerndeint.c
@@ -47,7 +47,7 @@ struct vf_priv_s {
/***************************************************************************/
-static int config(struct vf_instance_s* vf,
+static int config(struct vf_instance* vf,
int width, int height, int d_width, int d_height,
unsigned int flags, unsigned int outfmt){
@@ -55,7 +55,7 @@ static int config(struct vf_instance_s* vf,
}
-static void uninit(struct vf_instance_s* vf)
+static void uninit(struct vf_instance* vf)
{
free(vf->priv);
}
@@ -74,7 +74,7 @@ static inline int IsYUY2(mp_image_t *mpi)
#define PLANAR_U 1
#define PLANAR_V 2
-static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
+static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts){
int cw= mpi->w >> mpi->chroma_x_shift;
int ch= mpi->h >> mpi->chroma_y_shift;
int W = mpi->w, H = mpi->h;
@@ -278,7 +278,7 @@ static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
//===========================================================================//
-static int query_format(struct vf_instance_s* vf, unsigned int fmt){
+static int query_format(struct vf_instance* vf, unsigned int fmt){
switch(fmt)
{
case IMGFMT_YV12:
@@ -289,7 +289,7 @@ static int query_format(struct vf_instance_s* vf, unsigned int fmt){
return 0;
}
-static int control(struct vf_instance_s* vf, int request, void* data){
+static int control(struct vf_instance* vf, int request, void* data){
switch (request)
{
case VFCTRL_GET_DEINTERLACE:
diff --git a/libmpcodecs/vf_lavc.c b/libmpcodecs/vf_lavc.c
index 888ec1d86b..767aeda8f4 100644
--- a/libmpcodecs/vf_lavc.c
+++ b/libmpcodecs/vf_lavc.c
@@ -45,7 +45,7 @@ struct vf_priv_s {
//===========================================================================//
-static int config(struct vf_instance_s* vf,
+static int config(struct vf_instance* vf,
int width, int height, int d_width, int d_height,
unsigned int flags, unsigned int outfmt){
if(vf_next_query_format(vf,IMGFMT_MPEGPES)<=0) return 0;
@@ -75,7 +75,7 @@ static int config(struct vf_instance_s* vf,
vf->priv->outbuf = malloc(vf->priv->outbuf_size);
if (avcodec_open(&lavc_venc_context, vf->priv->codec) != 0) {
- mp_msg(MSGT_MENCODER,MSGL_ERR,MSGTR_CantOpenCodec);
+ mp_tmsg(MSGT_MENCODER,MSGL_ERR,"Could not open codec.\n");
return 0;
}
@@ -87,7 +87,7 @@ static int config(struct vf_instance_s* vf,
return vf_next_config(vf,width,height,d_width,d_height,flags,IMGFMT_MPEGPES);
}
-static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
+static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts){
mp_image_t* dmpi;
int out_size;
AVFrame *pic= vf->priv->pic;
@@ -120,7 +120,7 @@ static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
//===========================================================================//
-static int query_format(struct vf_instance_s* vf, unsigned int fmt){
+static int query_format(struct vf_instance* vf, unsigned int fmt){
switch(fmt){
case IMGFMT_YV12:
case IMGFMT_I420:
@@ -148,7 +148,7 @@ static int open(vf_instance_t *vf, char* args){
vf->priv->codec = (AVCodec *)avcodec_find_encoder_by_name("mpeg1video");
if (!vf->priv->codec) {
- mp_msg(MSGT_MENCODER,MSGL_ERR,MSGTR_MissingLAVCcodec, "mpeg1video");
+ mp_tmsg(MSGT_MENCODER,MSGL_ERR,"Cannot find codec '%s' in libavcodec...\n", "mpeg1video");
return 0;
}
diff --git a/libmpcodecs/vf_lavcdeint.c b/libmpcodecs/vf_lavcdeint.c
index 605ff2a35f..7f1d764b1c 100644
--- a/libmpcodecs/vf_lavcdeint.c
+++ b/libmpcodecs/vf_lavcdeint.c
@@ -88,7 +88,7 @@ imgfmt_to_pixfmt (int imgfmt)
static int
-config (struct vf_instance_s* vf,
+config (struct vf_instance* vf,
int width, int height, int d_width, int d_height,
unsigned int flags, unsigned int outfmt)
{
@@ -114,7 +114,7 @@ config (struct vf_instance_s* vf,
}
static int
-put_image (struct vf_instance_s* vf, mp_image_t *mpi, double pts)
+put_image (struct vf_instance* vf, mp_image_t *mpi, double pts)
{
struct vf_priv_s *priv = vf->priv;
mp_image_t* dmpi;
@@ -151,7 +151,7 @@ put_image (struct vf_instance_s* vf, mp_image_t *mpi, double pts)
static int
-query_format (struct vf_instance_s* vf, unsigned int fmt)
+query_format (struct vf_instance* vf, unsigned int fmt)
{
if(imgfmt_to_pixfmt(fmt) == -1)
return 0;
diff --git a/libmpcodecs/vf_mcdeint.c b/libmpcodecs/vf_mcdeint.c
index 2bd3c9da73..1dbe096349 100644
--- a/libmpcodecs/vf_mcdeint.c
+++ b/libmpcodecs/vf_mcdeint.c
@@ -54,15 +54,10 @@ Known Issues:
#include "mp_msg.h"
#include "cpudetect.h"
-#include "libavutil/internal.h"
#include "libavutil/intreadwrite.h"
#include "libavcodec/avcodec.h"
#include "libavcodec/dsputil.h"
-#undef fprintf
-#undef free
-#undef malloc
-
#include "img_format.h"
#include "mp_image.h"
#include "vf.h"
@@ -178,7 +173,7 @@ static void filter(struct vf_priv_s *p, uint8_t *dst[3], uint8_t *src[3], int ds
}
-static int config(struct vf_instance_s* vf,
+static int config(struct vf_instance* vf,
int width, int height, int d_width, int d_height,
unsigned int flags, unsigned int outfmt){
int i;
@@ -235,7 +230,7 @@ static int config(struct vf_instance_s* vf,
return vf_next_config(vf,width,height,d_width,d_height,flags,outfmt);
}
-static void get_image(struct vf_instance_s* vf, mp_image_t *mpi){
+static void get_image(struct vf_instance* vf, mp_image_t *mpi){
if(mpi->flags&MP_IMGFLAG_PRESERVE) return; // don't change
return; //caused problems, dunno why
// ok, we can do pp in-place (or pp disabled):
@@ -253,7 +248,7 @@ return; //caused problems, dunno why
mpi->flags|=MP_IMGFLAG_DIRECT;
}
-static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
+static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts){
mp_image_t *dmpi;
if(!(mpi->flags&MP_IMGFLAG_DIRECT)){
@@ -272,7 +267,7 @@ static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
return vf_next_put_image(vf,dmpi, pts);
}
-static void uninit(struct vf_instance_s* vf){
+static void uninit(struct vf_instance* vf){
if(!vf->priv) return;
#if 0
@@ -294,7 +289,7 @@ static void uninit(struct vf_instance_s* vf){
}
//===========================================================================//
-static int query_format(struct vf_instance_s* vf, unsigned int fmt){
+static int query_format(struct vf_instance* vf, unsigned int fmt){
switch(fmt){
case IMGFMT_YV12:
case IMGFMT_I420:
diff --git a/libmpcodecs/vf_mirror.c b/libmpcodecs/vf_mirror.c
index bb67643a7a..36441ddedb 100644
--- a/libmpcodecs/vf_mirror.c
+++ b/libmpcodecs/vf_mirror.c
@@ -83,7 +83,7 @@ static void mirror(unsigned char* dst,unsigned char* src,int dststride,int srcst
//===========================================================================//
-static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
+static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts){
mp_image_t *dmpi;
// hope we'll get DR buffer:
diff --git a/libmpcodecs/vf_noformat.c b/libmpcodecs/vf_noformat.c
index 8f4009189e..dfceb8c906 100644
--- a/libmpcodecs/vf_noformat.c
+++ b/libmpcodecs/vf_noformat.c
@@ -40,7 +40,7 @@ static struct vf_priv_s {
//===========================================================================//
-static int query_format(struct vf_instance_s* vf, unsigned int fmt){
+static int query_format(struct vf_instance* vf, unsigned int fmt){
if(fmt!=vf->priv->fmt)
return vf_next_query_format(vf,fmt);
return 0;
@@ -53,12 +53,12 @@ static int open(vf_instance_t *vf, char* args){
}
#define ST_OFF(f) M_ST_OFF(struct vf_priv_s,f)
-static m_option_t vf_opts_fields[] = {
+static const m_option_t vf_opts_fields[] = {
{"fmt", ST_OFF(fmt), CONF_TYPE_IMGFMT, 0,0 ,0, NULL},
{ NULL, NULL, 0, 0, 0, 0, NULL }
};
-static m_struct_t vf_opts = {
+static const m_struct_t vf_opts = {
"noformat",
sizeof(struct vf_priv_s),
&vf_priv_dflt,
diff --git a/libmpcodecs/vf_noise.c b/libmpcodecs/vf_noise.c
index 625fe67cc3..6fdc5e20c5 100644
--- a/libmpcodecs/vf_noise.c
+++ b/libmpcodecs/vf_noise.c
@@ -312,14 +312,14 @@ static void noise(uint8_t *dst, uint8_t *src, int dstStride, int srcStride, int
if (fp->shiftptr == 3) fp->shiftptr = 0;
}
-static int config(struct vf_instance_s* vf,
+static int config(struct vf_instance* vf,
int width, int height, int d_width, int d_height,
unsigned int flags, unsigned int outfmt){
return vf_next_config(vf,width,height,d_width,d_height,flags,outfmt);
}
-static void get_image(struct vf_instance_s* vf, mp_image_t *mpi){
+static void get_image(struct vf_instance* vf, mp_image_t *mpi){
if(mpi->flags&MP_IMGFLAG_PRESERVE) return; // don't change
if(mpi->imgfmt!=vf->priv->outfmt) return; // colorspace differ
// ok, we can do pp in-place (or pp disabled):
@@ -337,7 +337,7 @@ static void get_image(struct vf_instance_s* vf, mp_image_t *mpi){
mpi->flags|=MP_IMGFLAG_DIRECT;
}
-static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
+static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts){
mp_image_t *dmpi;
if(!(mpi->flags&MP_IMGFLAG_DIRECT)){
@@ -366,7 +366,7 @@ static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
return vf_next_put_image(vf,dmpi, pts);
}
-static void uninit(struct vf_instance_s* vf){
+static void uninit(struct vf_instance* vf){
if(!vf->priv) return;
if(vf->priv->chromaParam.noise) free(vf->priv->chromaParam.noise);
@@ -381,7 +381,7 @@ static void uninit(struct vf_instance_s* vf){
//===========================================================================//
-static int query_format(struct vf_instance_s* vf, unsigned int fmt){
+static int query_format(struct vf_instance* vf, unsigned int fmt){
switch(fmt)
{
case IMGFMT_YV12:
@@ -416,7 +416,7 @@ static void parse(FilterParam *fp, char* args){
if(fp->strength) initNoise(fp);
}
-static unsigned int fmt_list[]={
+static const unsigned int fmt_list[]={
IMGFMT_YV12,
IMGFMT_I420,
IMGFMT_IYUV,
diff --git a/libmpcodecs/vf_ow.c b/libmpcodecs/vf_ow.c
index 543d6c8289..16d6ccbc56 100644
--- a/libmpcodecs/vf_ow.c
+++ b/libmpcodecs/vf_ow.c
@@ -203,7 +203,7 @@ static void filter(struct vf_priv_s *p, uint8_t *dst, uint8_t *src, int dst_stri
// printf("%f\n", sum/height/width);
}
-static int config(struct vf_instance_s* vf, int width, int height, int d_width, int d_height, unsigned int flags, unsigned int outfmt){
+static int config(struct vf_instance* vf, int width, int height, int d_width, int d_height, unsigned int flags, unsigned int outfmt){
int h= (height+15)&(~15);
int i,j;
@@ -216,7 +216,7 @@ static int config(struct vf_instance_s* vf, int width, int height, int d_width,
return vf_next_config(vf,width,height,d_width,d_height,flags,outfmt);
}
-static void get_image(struct vf_instance_s* vf, mp_image_t *mpi){
+static void get_image(struct vf_instance* vf, mp_image_t *mpi){
if(mpi->flags&MP_IMGFLAG_PRESERVE) return; // don't change
// ok, we can do pp in-place (or pp disabled):
vf->dmpi=vf_get_image(vf->next,mpi->imgfmt,
@@ -233,7 +233,7 @@ static void get_image(struct vf_instance_s* vf, mp_image_t *mpi){
mpi->flags|=MP_IMGFLAG_DIRECT;
}
-static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
+static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts){
mp_image_t *dmpi;
if(!(mpi->flags&MP_IMGFLAG_DIRECT)){
@@ -254,7 +254,7 @@ static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
return vf_next_put_image(vf,dmpi, pts);
}
-static void uninit(struct vf_instance_s* vf){
+static void uninit(struct vf_instance* vf){
int i,j;
if(!vf->priv) return;
@@ -270,7 +270,7 @@ static void uninit(struct vf_instance_s* vf){
}
//===========================================================================//
-static int query_format(struct vf_instance_s* vf, unsigned int fmt){
+static int query_format(struct vf_instance* vf, unsigned int fmt){
switch(fmt){
case IMGFMT_YVU9:
case IMGFMT_IF09:
diff --git a/libmpcodecs/vf_palette.c b/libmpcodecs/vf_palette.c
index 92b5092d3b..52bf3ceefc 100644
--- a/libmpcodecs/vf_palette.c
+++ b/libmpcodecs/vf_palette.c
@@ -37,14 +37,14 @@
// routines are incorrrect. they assume the palette to be of the same
// depth as the output, which is incorrect. --Joey
-static unsigned int bgr_list[]={
+static const unsigned int bgr_list[]={
IMGFMT_BGR32,
IMGFMT_BGR24,
// IMGFMT_BGR16,
// IMGFMT_BGR15,
0
};
-static unsigned int rgb_list[]={
+static const unsigned int rgb_list[]={
IMGFMT_RGB32,
IMGFMT_RGB24,
// IMGFMT_RGB16,
@@ -54,10 +54,10 @@ static unsigned int rgb_list[]={
static unsigned int gray_pal[256];
-static unsigned int find_best(struct vf_instance_s* vf, unsigned int fmt){
+static unsigned int find_best(struct vf_instance* vf, unsigned int fmt){
unsigned int best=0;
int ret;
- unsigned int* p;
+ const unsigned int* p;
if(fmt==IMGFMT_BGR8) p=bgr_list;
else if(fmt==IMGFMT_RGB8) p=rgb_list;
else return 0;
@@ -78,7 +78,7 @@ struct vf_priv_s {
int pal_msg;
};
-static int config(struct vf_instance_s* vf,
+static int config(struct vf_instance* vf,
int width, int height, int d_width, int d_height,
unsigned int flags, unsigned int outfmt){
if (!vf->priv->fmt)
@@ -92,7 +92,7 @@ static int config(struct vf_instance_s* vf,
return vf_next_config(vf,width,height,d_width,d_height,flags,vf->priv->fmt);
}
-static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
+static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts){
mp_image_t *dmpi;
uint8_t *old_palette = mpi->planes[1];
@@ -178,7 +178,7 @@ static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
//===========================================================================//
-static int query_format(struct vf_instance_s* vf, unsigned int fmt){
+static int query_format(struct vf_instance* vf, unsigned int fmt){
int best=find_best(vf,fmt);
if(!best) return 0; // no match
return vf->next->query_format(vf->next,best);
@@ -208,7 +208,7 @@ static int open(vf_instance_t *vf, char* args){
if (!strcasecmp(args,"bgr24")) vf->priv->fmt=IMGFMT_BGR24; else
if (!strcasecmp(args,"bgr32")) vf->priv->fmt=IMGFMT_BGR32; else
{
- mp_msg(MSGT_VFILTER, MSGL_WARN, MSGTR_MPCODECS_UnknownFormatName, args);
+ mp_tmsg(MSGT_VFILTER, MSGL_WARN, "[VF_FORMAT] Unknown format name: '%s'.\n", args);
return 0;
}
}
diff --git a/libmpcodecs/vf_perspective.c b/libmpcodecs/vf_perspective.c
index 8cc3dc8e17..daba3cd2a9 100644
--- a/libmpcodecs/vf_perspective.c
+++ b/libmpcodecs/vf_perspective.c
@@ -102,7 +102,7 @@ static double getCoeff(double d){
return coeff;
}
-static int config(struct vf_instance_s* vf,
+static int config(struct vf_instance* vf,
int width, int height, int d_width, int d_height,
unsigned int flags, unsigned int outfmt){
int i, j;
@@ -129,7 +129,7 @@ static int config(struct vf_instance_s* vf,
return vf_next_config(vf,width,height,d_width,d_height,flags,outfmt);
}
-static void uninit(struct vf_instance_s* vf){
+static void uninit(struct vf_instance* vf){
if(!vf->priv) return;
if(vf->priv->pv) free(vf->priv->pv);
@@ -258,7 +258,7 @@ static inline void resampleLinear(uint8_t *dst, uint8_t *src, int w, int h, int
}
}
-static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
+static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts){
int cw= mpi->w >> mpi->chroma_x_shift;
int ch= mpi->h >> mpi->chroma_y_shift;
@@ -289,7 +289,7 @@ static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
//===========================================================================//
-static int query_format(struct vf_instance_s* vf, unsigned int fmt){
+static int query_format(struct vf_instance* vf, unsigned int fmt){
switch(fmt)
{
case IMGFMT_YV12:
diff --git a/libmpcodecs/vf_phase.c b/libmpcodecs/vf_phase.c
index 75b7293009..b299905373 100644
--- a/libmpcodecs/vf_phase.c
+++ b/libmpcodecs/vf_phase.c
@@ -196,7 +196,7 @@ static enum mode analyze_plane(unsigned char *old, unsigned char *new,
return mode;
}
-static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts)
+static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts)
{
mp_image_t *dmpi;
int w;
@@ -240,7 +240,7 @@ static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts)
return vf_next_put_image(vf, dmpi, MP_NOPTS_VALUE);
}
-static void uninit(struct vf_instance_s* vf)
+static void uninit(struct vf_instance* vf)
{
free(vf->priv->buf[0]);
free(vf->priv->buf[1]);
diff --git a/libmpcodecs/vf_pp.c b/libmpcodecs/vf_pp.c
index d0b5f0ada8..8ede366973 100644
--- a/libmpcodecs/vf_pp.c
+++ b/libmpcodecs/vf_pp.c
@@ -33,16 +33,8 @@
#include "img_format.h"
#include "mp_image.h"
#include "vf.h"
-#include "libavutil/internal.h"
#include "libpostproc/postprocess.h"
-#ifdef CONFIG_LIBPOSTPROC_A
-#define EMU_OLD
-#include "libpostproc/postprocess_internal.h"
-#endif
-
-#undef malloc
-
struct vf_priv_s {
int pp;
pp_mode_t *ppMode[PP_QUALITY_MAX+1];
@@ -52,7 +44,7 @@ struct vf_priv_s {
//===========================================================================//
-static int config(struct vf_instance_s* vf,
+static int config(struct vf_instance* vf,
int width, int height, int d_width, int d_height,
unsigned int voflags, unsigned int outfmt){
int flags=
@@ -73,7 +65,7 @@ static int config(struct vf_instance_s* vf,
return vf_next_config(vf,width,height,d_width,d_height,voflags,outfmt);
}
-static void uninit(struct vf_instance_s* vf){
+static void uninit(struct vf_instance* vf){
int i;
for(i=0; i<=PP_QUALITY_MAX; i++){
if(vf->priv->ppMode[i])
@@ -82,7 +74,7 @@ static void uninit(struct vf_instance_s* vf){
if(vf->priv->context) pp_free_context(vf->priv->context);
}
-static int query_format(struct vf_instance_s* vf, unsigned int fmt){
+static int query_format(struct vf_instance* vf, unsigned int fmt){
switch(fmt){
case IMGFMT_YV12:
case IMGFMT_I420:
@@ -95,7 +87,7 @@ static int query_format(struct vf_instance_s* vf, unsigned int fmt){
return 0;
}
-static int control(struct vf_instance_s* vf, int request, void* data){
+static int control(struct vf_instance* vf, int request, void* data){
switch(request){
case VFCTRL_QUERY_MAX_PP_LEVEL:
return PP_QUALITY_MAX;
@@ -106,7 +98,7 @@ static int control(struct vf_instance_s* vf, int request, void* data){
return vf_next_control(vf,request,data);
}
-static void get_image(struct vf_instance_s* vf, mp_image_t *mpi){
+static void get_image(struct vf_instance* vf, mp_image_t *mpi){
if(vf->priv->pp&0xFFFF) return; // non-local filters enabled
if((mpi->type==MP_IMGTYPE_IPB || vf->priv->pp) &&
mpi->flags&MP_IMGFLAG_PRESERVE) return; // don't change
@@ -127,7 +119,7 @@ static void get_image(struct vf_instance_s* vf, mp_image_t *mpi){
mpi->flags|=MP_IMGFLAG_DIRECT;
}
-static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
+static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts){
if(!(mpi->flags&MP_IMGFLAG_DIRECT)){
// no DR, so get a new image! hope we'll get DR buffer:
vf->dmpi=vf_get_image(vf->next,mpi->imgfmt,
@@ -159,7 +151,7 @@ static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
extern int divx_quality;
-static unsigned int fmt_list[]={
+static const unsigned int fmt_list[]={
IMGFMT_YV12,
IMGFMT_I420,
IMGFMT_IYUV,
@@ -198,35 +190,10 @@ static int open(vf_instance_t *vf, char* args){
name="de";
}
-#ifdef EMU_OLD
- if(name){
-#endif
for(i=0; i<=PP_QUALITY_MAX; i++){
vf->priv->ppMode[i]= pp_get_mode_by_name_and_quality(name, i);
if(vf->priv->ppMode[i]==NULL) return -1;
}
-#ifdef EMU_OLD
- }else{
- /* hex mode for compatibility */
- for(i=0; i<=PP_QUALITY_MAX; i++){
- PPMode *ppMode;
-
- ppMode= (PPMode*)memalign(8, sizeof(PPMode));
-
- ppMode->lumMode= hex_mode;
- ppMode->chromMode= ((hex_mode&0xFF)>>4) | (hex_mode&0xFFFFFF00);
- ppMode->maxTmpNoise[0]= 700;
- ppMode->maxTmpNoise[1]= 1500;
- ppMode->maxTmpNoise[2]= 3000;
- ppMode->maxAllowedY= 234;
- ppMode->minAllowedY= 16;
- ppMode->baseDcDiff= 256/4;
- ppMode->flatnessThreshold=40;
-
- vf->priv->ppMode[i]= ppMode;
- }
- }
-#endif
vf->priv->pp=PP_QUALITY_MAX;
return 1;
@@ -242,4 +209,3 @@ const vf_info_t vf_info_pp = {
};
//===========================================================================//
-
diff --git a/libmpcodecs/vf_pp7.c b/libmpcodecs/vf_pp7.c
index 78d2ba640d..56b196a3a3 100644
--- a/libmpcodecs/vf_pp7.c
+++ b/libmpcodecs/vf_pp7.c
@@ -344,7 +344,7 @@ static void filter(struct vf_priv_s *p, uint8_t *dst, uint8_t *src, int dst_stri
}
}
-static int config(struct vf_instance_s* vf,
+static int config(struct vf_instance* vf,
int width, int height, int d_width, int d_height,
unsigned int flags, unsigned int outfmt){
int h= (height+16+15)&(~15);
@@ -355,7 +355,7 @@ static int config(struct vf_instance_s* vf,
return vf_next_config(vf,width,height,d_width,d_height,flags,outfmt);
}
-static void get_image(struct vf_instance_s* vf, mp_image_t *mpi){
+static void get_image(struct vf_instance* vf, mp_image_t *mpi){
if(mpi->flags&MP_IMGFLAG_PRESERVE) return; // don't change
// ok, we can do pp in-place (or pp disabled):
vf->dmpi=vf_get_image(vf->next,mpi->imgfmt,
@@ -372,7 +372,7 @@ static void get_image(struct vf_instance_s* vf, mp_image_t *mpi){
mpi->flags|=MP_IMGFLAG_DIRECT;
}
-static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
+static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts){
mp_image_t *dmpi;
if(mpi->flags&MP_IMGFLAG_DIRECT){
@@ -407,7 +407,7 @@ static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
return vf_next_put_image(vf,dmpi, pts);
}
-static void uninit(struct vf_instance_s* vf){
+static void uninit(struct vf_instance* vf){
if(!vf->priv) return;
if(vf->priv->src) free(vf->priv->src);
@@ -418,7 +418,7 @@ static void uninit(struct vf_instance_s* vf){
}
//===========================================================================//
-static int query_format(struct vf_instance_s* vf, unsigned int fmt){
+static int query_format(struct vf_instance* vf, unsigned int fmt){
switch(fmt){
case IMGFMT_YVU9:
case IMGFMT_IF09:
@@ -436,7 +436,7 @@ static int query_format(struct vf_instance_s* vf, unsigned int fmt){
return 0;
}
-static int control(struct vf_instance_s* vf, int request, void* data){
+static int control(struct vf_instance* vf, int request, void* data){
return vf_next_control(vf,request,data);
}
diff --git a/libmpcodecs/vf_pullup.c b/libmpcodecs/vf_pullup.c
index 1961f5f066..fe84307458 100644
--- a/libmpcodecs/vf_pullup.c
+++ b/libmpcodecs/vf_pullup.c
@@ -42,7 +42,7 @@ struct vf_priv_s {
char *qbuf;
};
-static void init_pullup(struct vf_instance_s* vf, mp_image_t *mpi)
+static void init_pullup(struct vf_instance* vf, mp_image_t *mpi)
{
struct pullup_context *c = vf->priv->ctx;
@@ -78,7 +78,7 @@ static void init_pullup(struct vf_instance_s* vf, mp_image_t *mpi)
#if 0
-static void get_image(struct vf_instance_s* vf, mp_image_t *mpi)
+static void get_image(struct vf_instance* vf, mp_image_t *mpi)
{
struct pullup_context *c = vf->priv->ctx;
struct pullup_buffer *b;
@@ -104,7 +104,7 @@ static void get_image(struct vf_instance_s* vf, mp_image_t *mpi)
}
#endif
-static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts)
+static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts)
{
struct pullup_context *c = vf->priv->ctx;
struct pullup_buffer *b;
@@ -254,7 +254,7 @@ static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts)
return ret;
}
-static int query_format(struct vf_instance_s* vf, unsigned int fmt)
+static int query_format(struct vf_instance* vf, unsigned int fmt)
{
/* FIXME - support more formats */
switch (fmt) {
@@ -266,7 +266,7 @@ static int query_format(struct vf_instance_s* vf, unsigned int fmt)
return 0;
}
-static int config(struct vf_instance_s* vf,
+static int config(struct vf_instance* vf,
int width, int height, int d_width, int d_height,
unsigned int flags, unsigned int outfmt)
{
@@ -274,7 +274,7 @@ static int config(struct vf_instance_s* vf,
return vf_next_config(vf, width, height, d_width, d_height, flags, outfmt);
}
-static void uninit(struct vf_instance_s* vf)
+static void uninit(struct vf_instance* vf)
{
pullup_free_context(vf->priv->ctx);
free(vf->priv);
@@ -312,5 +312,3 @@ const vf_info_t vf_info_pullup = {
open,
NULL
};
-
-
diff --git a/libmpcodecs/vf_qp.c b/libmpcodecs/vf_qp.c
index 68449f62d0..ec0646265f 100644
--- a/libmpcodecs/vf_qp.c
+++ b/libmpcodecs/vf_qp.c
@@ -42,7 +42,7 @@ struct vf_priv_s {
int qp_stride;
};
-static int config(struct vf_instance_s* vf,
+static int config(struct vf_instance* vf,
int width, int height, int d_width, int d_height,
unsigned int flags, unsigned int outfmt){
int h= (height+15)>>4;
@@ -59,7 +59,7 @@ static int config(struct vf_instance_s* vf,
i,
0
};
- static const char *const_names[]={
+ const char * const const_names[]={
"PI",
"E",
"known",
@@ -76,7 +76,7 @@ static int config(struct vf_instance_s* vf,
return vf_next_config(vf,width,height,d_width,d_height,flags,outfmt);
}
-static void get_image(struct vf_instance_s* vf, mp_image_t *mpi){
+static void get_image(struct vf_instance* vf, mp_image_t *mpi){
if(mpi->flags&MP_IMGFLAG_PRESERVE) return; // don't change
// ok, we can do pp in-place (or pp disabled):
vf->dmpi=vf_get_image(vf->next,mpi->imgfmt,
@@ -93,7 +93,7 @@ static void get_image(struct vf_instance_s* vf, mp_image_t *mpi){
mpi->flags|=MP_IMGFLAG_DIRECT;
}
-static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
+static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts){
mp_image_t *dmpi;
int x,y;
@@ -136,7 +136,7 @@ static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
return vf_next_put_image(vf,dmpi, pts);
}
-static void uninit(struct vf_instance_s* vf){
+static void uninit(struct vf_instance* vf){
if(!vf->priv) return;
if(vf->priv->qp) av_free(vf->priv->qp);
diff --git a/libmpcodecs/vf_rectangle.c b/libmpcodecs/vf_rectangle.c
index c7d9980003..c80c3a0f39 100644
--- a/libmpcodecs/vf_rectangle.c
+++ b/libmpcodecs/vf_rectangle.c
@@ -31,7 +31,7 @@ struct vf_priv_s {
};
static int
-config(struct vf_instance_s* vf,
+config(struct vf_instance* vf,
int width, int height, int d_width, int d_height,
unsigned int flags, unsigned int outfmt)
{
@@ -52,7 +52,7 @@ config(struct vf_instance_s* vf,
}
static int
-control(struct vf_instance_s* vf, int request, void *data)
+control(struct vf_instance* vf, int request, void *data)
{
const int *const tmp = data;
switch(request){
@@ -83,7 +83,7 @@ control(struct vf_instance_s* vf, int request, void *data)
return 0;
}
static int
-put_image(struct vf_instance_s* vf, mp_image_t* mpi, double pts){
+put_image(struct vf_instance* vf, mp_image_t* mpi, double pts){
mp_image_t* dmpi;
unsigned int bpp = mpi->bpp / 8;
int x, y, w, h;
diff --git a/libmpcodecs/vf_remove_logo.c b/libmpcodecs/vf_remove_logo.c
index 7b9c66aeb1..8397ae53cf 100644
--- a/libmpcodecs/vf_remove_logo.c
+++ b/libmpcodecs/vf_remove_logo.c
@@ -670,7 +670,7 @@ static pgm_structure * generate_half_size_image(vf_instance_t * vf, pgm_structur
/**
* \brief Checks if YV12 is supported by the next filter.
*/
-static unsigned int find_best(struct vf_instance_s* vf){
+static unsigned int find_best(struct vf_instance* vf){
int is_format_okay = vf->next->query_format(vf->next, IMGFMT_YV12);
if ((is_format_okay & VFCAP_CSP_SUPPORTED_BY_HW) || (is_format_okay & VFCAP_CSP_SUPPORTED))
return IMGFMT_YV12;
@@ -683,7 +683,7 @@ static unsigned int find_best(struct vf_instance_s* vf){
/**
* \brief Configure the filter and call the next filter's config function.
*/
-static int config(struct vf_instance_s* vf, int width, int height, int d_width, int d_height, unsigned int flags, unsigned int outfmt)
+static int config(struct vf_instance* vf, int width, int height, int d_width, int d_height, unsigned int flags, unsigned int outfmt)
{
if(!(((vf_priv_s *)vf->priv)->fmt=find_best(vf)))
return 0;
@@ -764,7 +764,7 @@ static void convert_yv12(const vf_instance_t * const vf, const char * const sour
* filter, has the logo removed by the filter, and is then sent to the next
* filter.
*/
-static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
+static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts){
mp_image_t *dmpi;
dmpi=vf_get_image(vf->next,((vf_priv_s *)vf->priv)->fmt,
@@ -811,7 +811,7 @@ static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
/**
* \brief Checks to see if the next filter accepts YV12 images.
*/
-static int query_format(struct vf_instance_s * vf, unsigned int fmt)
+static int query_format(struct vf_instance * vf, unsigned int fmt)
{
if (fmt == IMGFMT_YV12)
return vf->next->query_format(vf->next, IMGFMT_YV12);
@@ -877,7 +877,7 @@ static int open(vf_instance_t * vf, char * args)
*
* This is called at exit-time.
*/
-void uninit(vf_instance_t * vf)
+static void uninit(vf_instance_t * vf)
{
/* Destroy our masks and images. */
destroy_pgm(((vf_priv_s *)vf->priv)->filter);
diff --git a/libmpcodecs/vf_rgb2bgr.c b/libmpcodecs/vf_rgb2bgr.c
index a32dd40995..b1fa17d098 100644
--- a/libmpcodecs/vf_rgb2bgr.c
+++ b/libmpcodecs/vf_rgb2bgr.c
@@ -54,14 +54,14 @@ static unsigned int getfmt(unsigned int outfmt,int forced){
return 0;
}
-static int config(struct vf_instance_s* vf,
+static int config(struct vf_instance* vf,
int width, int height, int d_width, int d_height,
unsigned int flags, unsigned int outfmt){
vf->priv->fmt=getfmt(outfmt,vf->priv->forced);
return vf_next_config(vf,width,height,d_width,d_height,flags,vf->priv->fmt);
}
-static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
+static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts){
mp_image_t *dmpi;
// hope we'll get DR buffer:
@@ -94,7 +94,7 @@ static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
//===========================================================================//
-static int query_format(struct vf_instance_s* vf, unsigned int outfmt){
+static int query_format(struct vf_instance* vf, unsigned int outfmt){
unsigned int fmt=getfmt(outfmt,vf->priv->forced);
if(!fmt) return 0;
return vf_next_query_format(vf,fmt) & (~VFCAP_CSP_SUPPORTED_BY_HW);
diff --git a/libmpcodecs/vf_rgbtest.c b/libmpcodecs/vf_rgbtest.c
index d19315b63f..1252b4018a 100644
--- a/libmpcodecs/vf_rgbtest.c
+++ b/libmpcodecs/vf_rgbtest.c
@@ -95,7 +95,7 @@ static void put_pixel(uint8_t *buf, int x, int y, int stride, int r, int g, int
}
}
-static int config(struct vf_instance_s* vf,
+static int config(struct vf_instance* vf,
int width, int height, int d_width, int d_height,
unsigned int flags, unsigned int outfmt){
if (vf->priv->w > 0) { d_width = width = vf->priv->w; }
@@ -105,7 +105,7 @@ static int config(struct vf_instance_s* vf,
return vf_next_config(vf,width,height,d_width,d_height,flags,vf->priv->fmt);
}
-static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
+static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts){
mp_image_t *dmpi;
int x, y;
int w = vf->priv->w > 0 ? vf->priv->w : mpi->w;
@@ -134,7 +134,7 @@ static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
//===========================================================================//
-static int query_format(struct vf_instance_s* vf, unsigned int outfmt){
+static int query_format(struct vf_instance* vf, unsigned int outfmt){
unsigned int fmt=getfmt(outfmt);
if(!fmt) return 0;
return vf_next_query_format(vf,fmt) & (~VFCAP_CSP_SUPPORTED_BY_HW);
diff --git a/libmpcodecs/vf_rotate.c b/libmpcodecs/vf_rotate.c
index 04095da5f5..6a4672aa84 100644
--- a/libmpcodecs/vf_rotate.c
+++ b/libmpcodecs/vf_rotate.c
@@ -68,7 +68,7 @@ static void rotate(unsigned char* dst,unsigned char* src,int dststride,int srcst
//===========================================================================//
-static int config(struct vf_instance_s* vf,
+static int config(struct vf_instance* vf,
int width, int height, int d_width, int d_height,
unsigned int flags, unsigned int outfmt){
if (vf->priv->direction & 4) {
@@ -84,7 +84,7 @@ static int config(struct vf_instance_s* vf,
return vf_next_config(vf,height,width,d_height,d_width,flags,outfmt);
}
-static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
+static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts){
mp_image_t *dmpi;
// hope we'll get DR buffer:
@@ -114,7 +114,7 @@ static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
//===========================================================================//
-static int query_format(struct vf_instance_s* vf, unsigned int fmt){
+static int query_format(struct vf_instance* vf, unsigned int fmt){
if(IMGFMT_IS_RGB(fmt) || IMGFMT_IS_BGR(fmt)) return vf_next_query_format(vf, fmt);
// we can support only symmetric (chroma_x_shift==chroma_y_shift) YUV formats:
switch(fmt) {
diff --git a/libmpcodecs/vf_sab.c b/libmpcodecs/vf_sab.c
index 1616f1eba1..839392d9e0 100644
--- a/libmpcodecs/vf_sab.c
+++ b/libmpcodecs/vf_sab.c
@@ -135,7 +135,7 @@ static int allocStuff(FilterParam *f, int width, int height){
return 0;
}
-static int config(struct vf_instance_s* vf,
+static int config(struct vf_instance* vf,
int width, int height, int d_width, int d_height,
unsigned int flags, unsigned int outfmt){
@@ -160,7 +160,7 @@ static void freeBuffers(FilterParam *f){
f->distCoeff=NULL;
}
-static void uninit(struct vf_instance_s* vf){
+static void uninit(struct vf_instance* vf){
if(!vf->priv) return;
freeBuffers(&vf->priv->luma);
@@ -238,7 +238,7 @@ if((x/32)&1){
}
}
-static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
+static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts){
int cw= mpi->w >> mpi->chroma_x_shift;
int ch= mpi->h >> mpi->chroma_y_shift;
@@ -257,7 +257,7 @@ static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
//===========================================================================//
-static int query_format(struct vf_instance_s* vf, unsigned int fmt){
+static int query_format(struct vf_instance* vf, unsigned int fmt){
switch(fmt)
{
case IMGFMT_YV12:
diff --git a/libmpcodecs/vf_scale.c b/libmpcodecs/vf_scale.c
index 9f96ad84d9..208136e812 100644
--- a/libmpcodecs/vf_scale.c
+++ b/libmpcodecs/vf_scale.c
@@ -24,6 +24,7 @@
#include "config.h"
#include "mp_msg.h"
#include "cpudetect.h"
+#include "options.h"
#include "img_format.h"
#include "mp_image.h"
@@ -58,15 +59,11 @@ static struct vf_priv_s {
NULL
};
-extern int opt_screen_size_x;
-extern int opt_screen_size_y;
-extern float screen_size_xy;
-
//===========================================================================//
void sws_getFlagsAndFilterFromCmdLine(int *flags, SwsFilter **srcFilterParam, SwsFilter **dstFilterParam);
-static unsigned int outfmt_list[]={
+static const unsigned int outfmt_list[]={
// YUV:
IMGFMT_444P,
IMGFMT_444P16_LE,
@@ -166,9 +163,10 @@ static unsigned int find_best_out(vf_instance_t *vf, int in_format){
return best;
}
-static int config(struct vf_instance_s* vf,
+static int config(struct vf_instance* vf,
int width, int height, int d_width, int d_height,
unsigned int flags, unsigned int outfmt){
+ struct MPOpts *opts = vf->opts;
unsigned int best=find_best_out(vf, outfmt);
int vo_flags;
int int_sws_flags=0;
@@ -350,7 +348,8 @@ static int config(struct vf_instance_s* vf,
break; }
}
- if(!opt_screen_size_x && !opt_screen_size_y && !(screen_size_xy >= 0.001)){
+ if (!opts->screen_size_x && !opts->screen_size_y
+ && !(opts->screen_size_xy >= 0.001)) {
// Compute new d_width and d_height, preserving aspect
// while ensuring that both are >= output size in pixels.
if (vf->priv->h * d_width > vf->priv->w * d_height) {
@@ -366,7 +365,7 @@ static int config(struct vf_instance_s* vf,
return vf_next_config(vf,vf->priv->w,vf->priv->h,d_width,d_height,flags,best);
}
-static void start_slice(struct vf_instance_s* vf, mp_image_t *mpi){
+static void start_slice(struct vf_instance* vf, mp_image_t *mpi){
// printf("start_slice called! flag=%d\n",mpi->flags&MP_IMGFLAG_DRAW_CALLBACK);
if(!(mpi->flags&MP_IMGFLAG_DRAW_CALLBACK)) return; // shouldn't happen
// they want slices!!! allocate the buffer.
@@ -406,7 +405,7 @@ static void scale(struct SwsContext *sws1, struct SwsContext *sws2, uint8_t *src
}
}
-static void draw_slice(struct vf_instance_s* vf,
+static void draw_slice(struct vf_instance* vf,
unsigned char** src, int* stride, int w,int h, int x, int y){
mp_image_t *dmpi=vf->dmpi;
if(!dmpi){
@@ -417,7 +416,7 @@ static void draw_slice(struct vf_instance_s* vf,
scale(vf->priv->ctx, vf->priv->ctx2, src, stride, y, h, dmpi->planes, dmpi->stride, vf->priv->interlaced);
}
-static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
+static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts){
mp_image_t *dmpi=mpi->priv;
// printf("vf_scale::put_image(): processing whole frame! dmpi=%p flag=%d\n",
@@ -444,7 +443,7 @@ static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
return vf_next_put_image(vf,dmpi, pts);
}
-static int control(struct vf_instance_s* vf, int request, void* data){
+static int control(struct vf_instance* vf, int request, void* data){
int *table;
int *inv_table;
int r;
@@ -507,7 +506,7 @@ static int control(struct vf_instance_s* vf, int request, void* data){
// supported Input formats: YV12, I420, IYUV, YUY2, UYVY, BGR32, BGR24, BGR16, BGR15, RGB32, RGB24, Y8, Y800
-static int query_format(struct vf_instance_s* vf, unsigned int fmt){
+static int query_format(struct vf_instance* vf, unsigned int fmt){
switch(fmt){
case IMGFMT_YV12:
case IMGFMT_I420:
@@ -556,7 +555,7 @@ static int query_format(struct vf_instance_s* vf, unsigned int fmt){
return 0; // nomatching in-fmt
}
-static void uninit(struct vf_instance_s *vf){
+static void uninit(struct vf_instance *vf){
if(vf->priv->ctx) sws_freeContext(vf->priv->ctx);
if(vf->priv->ctx2) sws_freeContext(vf->priv->ctx2);
if(vf->priv->palette) free(vf->priv->palette);
@@ -658,7 +657,7 @@ struct SwsContext *sws_getContextFromCmdLine(int srcW, int srcH, int srcFormat,
}
/// An example of presets usage
-static struct size_preset {
+static const struct size_preset {
char* name;
int w, h;
} vf_size_presets_defs[] = {
@@ -673,21 +672,21 @@ static struct size_preset {
};
#define ST_OFF(f) M_ST_OFF(struct size_preset,f)
-static m_option_t vf_size_preset_fields[] = {
+static const m_option_t vf_size_preset_fields[] = {
{"w", ST_OFF(w), CONF_TYPE_INT, M_OPT_MIN,1 ,0, NULL},
{"h", ST_OFF(h), CONF_TYPE_INT, M_OPT_MIN,1 ,0, NULL},
{ NULL, NULL, 0, 0, 0, 0, NULL }
};
-static m_struct_t vf_size_preset = {
+static const m_struct_t vf_size_preset = {
"scale_size_preset",
sizeof(struct size_preset),
NULL,
vf_size_preset_fields
};
-static m_struct_t vf_opts;
-static m_obj_presets_t size_preset = {
+static const m_struct_t vf_opts;
+static const m_obj_presets_t size_preset = {
&vf_size_preset, // Input struct desc
&vf_opts, // Output struct desc
vf_size_presets_defs, // The list of presets
@@ -697,7 +696,7 @@ static m_obj_presets_t size_preset = {
/// Now the options
#undef ST_OFF
#define ST_OFF(f) M_ST_OFF(struct vf_priv_s,f)
-static m_option_t vf_opts_fields[] = {
+static const m_option_t vf_opts_fields[] = {
{"w", ST_OFF(w), CONF_TYPE_INT, M_OPT_MIN,-11,0, NULL},
{"h", ST_OFF(h), CONF_TYPE_INT, M_OPT_MIN,-11,0, NULL},
{"interlaced", ST_OFF(interlaced), CONF_TYPE_INT, M_OPT_RANGE, 0, 1, NULL},
@@ -712,7 +711,7 @@ static m_option_t vf_opts_fields[] = {
{ NULL, NULL, 0, 0, 0, 0, NULL }
};
-static m_struct_t vf_opts = {
+static const m_struct_t vf_opts = {
"scale",
sizeof(struct vf_priv_s),
&vf_priv_dflt,
diff --git a/libmpcodecs/vf_screenshot.c b/libmpcodecs/vf_screenshot.c
index c75a83be7f..a661ada3ab 100644
--- a/libmpcodecs/vf_screenshot.c
+++ b/libmpcodecs/vf_screenshot.c
@@ -58,7 +58,7 @@ struct vf_priv_s {
//===========================================================================//
-static int config(struct vf_instance_s* vf,
+static int config(struct vf_instance* vf,
int width, int height, int d_width, int d_height,
unsigned int flags, unsigned int outfmt)
{
@@ -137,7 +137,7 @@ static void scale_image(struct vf_priv_s* priv, mp_image_t *mpi)
sws_scale(priv->ctx, mpi->planes, mpi->stride, 0, priv->dh, dst, dst_stride);
}
-static void start_slice(struct vf_instance_s* vf, mp_image_t *mpi)
+static void start_slice(struct vf_instance* vf, mp_image_t *mpi)
{
vf->dmpi=vf_get_image(vf->next,mpi->imgfmt,
mpi->type, mpi->flags, mpi->width, mpi->height);
@@ -149,7 +149,7 @@ static void start_slice(struct vf_instance_s* vf, mp_image_t *mpi)
}
-static void draw_slice(struct vf_instance_s* vf, unsigned char** src,
+static void draw_slice(struct vf_instance* vf, unsigned char** src,
int* stride, int w,int h, int x, int y)
{
if (vf->priv->store_slices) {
@@ -162,7 +162,7 @@ static void draw_slice(struct vf_instance_s* vf, unsigned char** src,
vf_next_draw_slice(vf,src,stride,w,h,x,y);
}
-static void get_image(struct vf_instance_s* vf, mp_image_t *mpi)
+static void get_image(struct vf_instance* vf, mp_image_t *mpi)
{
// FIXME: should vf.c really call get_image when using slices??
if (mpi->flags & MP_IMGFLAG_DRAW_CALLBACK)
@@ -185,7 +185,7 @@ static void get_image(struct vf_instance_s* vf, mp_image_t *mpi)
mpi->priv=(void*)vf->dmpi;
}
-static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts)
+static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts)
{
mp_image_t *dmpi = (mp_image_t *)mpi->priv;
@@ -246,7 +246,7 @@ static int control (vf_instance_t *vf, int request, void *data)
//===========================================================================//
-static int query_format(struct vf_instance_s* vf, unsigned int fmt)
+static int query_format(struct vf_instance* vf, unsigned int fmt)
{
switch(fmt){
case IMGFMT_YV12:
diff --git a/libmpcodecs/vf_smartblur.c b/libmpcodecs/vf_smartblur.c
index a5a1265111..92aeece529 100644
--- a/libmpcodecs/vf_smartblur.c
+++ b/libmpcodecs/vf_smartblur.c
@@ -94,7 +94,7 @@ static int allocStuff(FilterParam *f, int width, int height){
return 0;
}
-static int config(struct vf_instance_s* vf,
+static int config(struct vf_instance* vf,
int width, int height, int d_width, int d_height,
unsigned int flags, unsigned int outfmt){
@@ -113,7 +113,7 @@ static void freeBuffers(FilterParam *f){
f->filterContext=NULL;
}
-static void uninit(struct vf_instance_s* vf){
+static void uninit(struct vf_instance* vf){
if(!vf->priv) return;
freeBuffers(&vf->priv->luma);
@@ -180,7 +180,7 @@ static inline void blur(uint8_t *dst, uint8_t *src, int w, int h, int dstStride,
}
}
-static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
+static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts){
int cw= mpi->w >> mpi->chroma_x_shift;
int ch= mpi->h >> mpi->chroma_y_shift;
FilterParam *f= &vf->priv;
@@ -201,7 +201,7 @@ static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
//===========================================================================//
-static int query_format(struct vf_instance_s* vf, unsigned int fmt){
+static int query_format(struct vf_instance* vf, unsigned int fmt){
switch(fmt)
{
case IMGFMT_YV12:
diff --git a/libmpcodecs/vf_softpulldown.c b/libmpcodecs/vf_softpulldown.c
index 3bbf02944d..f9b32b8194 100644
--- a/libmpcodecs/vf_softpulldown.c
+++ b/libmpcodecs/vf_softpulldown.c
@@ -35,7 +35,7 @@ struct vf_priv_s {
long long out;
};
-static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts)
+static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts)
{
mp_image_t *dmpi;
int ret = 0;
@@ -129,14 +129,14 @@ static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts)
return ret;
}
-static int config(struct vf_instance_s* vf,
+static int config(struct vf_instance* vf,
int width, int height, int d_width, int d_height,
unsigned int flags, unsigned int outfmt)
{
return vf_next_config(vf,width,height,d_width,d_height,flags,outfmt);
}
-static void uninit(struct vf_instance_s* vf)
+static void uninit(struct vf_instance* vf)
{
mp_msg(MSGT_VFILTER, MSGL_INFO, "softpulldown: %lld frames in, %lld frames out\n", vf->priv->in, vf->priv->out);
free(vf->priv);
diff --git a/libmpcodecs/vf_softskip.c b/libmpcodecs/vf_softskip.c
index 1e735d989e..664a862d9a 100644
--- a/libmpcodecs/vf_softskip.c
+++ b/libmpcodecs/vf_softskip.c
@@ -31,7 +31,7 @@ struct vf_priv_s {
int skipflag;
};
-static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts)
+static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts)
{
mp_image_t *dmpi;
@@ -54,7 +54,7 @@ static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts)
return vf_next_put_image(vf, dmpi, pts);
}
-static int control(struct vf_instance_s* vf, int request, void* data)
+static int control(struct vf_instance* vf, int request, void* data)
{
switch (request) {
case VFCTRL_SKIP_NEXT_FRAME:
@@ -65,7 +65,7 @@ static int control(struct vf_instance_s* vf, int request, void* data)
}
#if 0
-static int query_format(struct vf_instance_s* vf, unsigned int fmt)
+static int query_format(struct vf_instance* vf, unsigned int fmt)
{
/* FIXME - figure out which other formats work */
switch (fmt) {
@@ -78,7 +78,7 @@ static int query_format(struct vf_instance_s* vf, unsigned int fmt)
}
#endif
-static void uninit(struct vf_instance_s* vf)
+static void uninit(struct vf_instance* vf)
{
free(vf->priv);
}
@@ -100,5 +100,3 @@ const vf_info_t vf_info_softskip = {
open,
NULL
};
-
-
diff --git a/libmpcodecs/vf_spp.c b/libmpcodecs/vf_spp.c
index 0fcee9d665..c04e3b1e1f 100644
--- a/libmpcodecs/vf_spp.c
+++ b/libmpcodecs/vf_spp.c
@@ -37,15 +37,10 @@
#include "mp_msg.h"
#include "cpudetect.h"
-#include "libavutil/internal.h"
#include "libavutil/intreadwrite.h"
#include "libavcodec/avcodec.h"
#include "libavcodec/dsputil.h"
-#undef fprintf
-#undef free
-#undef malloc
-
#include "img_format.h"
#include "mp_image.h"
#include "vf.h"
@@ -435,7 +430,7 @@ static void filter(struct vf_priv_s *p, uint8_t *dst, uint8_t *src, int dst_stri
//FIXME reorder for better caching
}
-static int config(struct vf_instance_s* vf,
+static int config(struct vf_instance* vf,
int width, int height, int d_width, int d_height,
unsigned int flags, unsigned int outfmt){
int h= (height+16+15)&(~15);
@@ -447,7 +442,7 @@ static int config(struct vf_instance_s* vf,
return vf_next_config(vf,width,height,d_width,d_height,flags,outfmt);
}
-static void get_image(struct vf_instance_s* vf, mp_image_t *mpi){
+static void get_image(struct vf_instance* vf, mp_image_t *mpi){
if(mpi->flags&MP_IMGFLAG_PRESERVE) return; // don't change
// ok, we can do pp in-place (or pp disabled):
vf->dmpi=vf_get_image(vf->next,mpi->imgfmt,
@@ -464,7 +459,7 @@ static void get_image(struct vf_instance_s* vf, mp_image_t *mpi){
mpi->flags|=MP_IMGFLAG_DIRECT;
}
-static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
+static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts){
mp_image_t *dmpi;
if(!(mpi->flags&MP_IMGFLAG_DIRECT)){
@@ -516,7 +511,7 @@ static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
return vf_next_put_image(vf,dmpi, pts);
}
-static void uninit(struct vf_instance_s* vf){
+static void uninit(struct vf_instance* vf){
if(!vf->priv) return;
if(vf->priv->temp) free(vf->priv->temp);
@@ -533,7 +528,7 @@ static void uninit(struct vf_instance_s* vf){
}
//===========================================================================//
-static int query_format(struct vf_instance_s* vf, unsigned int fmt){
+static int query_format(struct vf_instance* vf, unsigned int fmt){
switch(fmt){
case IMGFMT_YVU9:
case IMGFMT_IF09:
@@ -551,7 +546,7 @@ static int query_format(struct vf_instance_s* vf, unsigned int fmt){
return 0;
}
-static int control(struct vf_instance_s* vf, int request, void* data){
+static int control(struct vf_instance* vf, int request, void* data){
switch(request){
case VFCTRL_QUERY_MAX_PP_LEVEL:
return 6;
diff --git a/libmpcodecs/vf_swapuv.c b/libmpcodecs/vf_swapuv.c
index 1800e583fd..5276c752f4 100644
--- a/libmpcodecs/vf_swapuv.c
+++ b/libmpcodecs/vf_swapuv.c
@@ -32,7 +32,7 @@
//===========================================================================//
-static void get_image(struct vf_instance_s* vf, mp_image_t *mpi){
+static void get_image(struct vf_instance* vf, mp_image_t *mpi){
mp_image_t *dmpi= vf_get_image(vf->next, mpi->imgfmt,
mpi->type, mpi->flags, mpi->w, mpi->h);
@@ -48,7 +48,7 @@ static void get_image(struct vf_instance_s* vf, mp_image_t *mpi){
mpi->priv=(void*)dmpi;
}
-static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
+static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts){
mp_image_t *dmpi;
if(mpi->flags&MP_IMGFLAG_DIRECT){
@@ -72,7 +72,7 @@ static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
//===========================================================================//
-static int query_format(struct vf_instance_s* vf, unsigned int fmt){
+static int query_format(struct vf_instance* vf, unsigned int fmt){
switch(fmt)
{
case IMGFMT_YV12:
diff --git a/libmpcodecs/vf_telecine.c b/libmpcodecs/vf_telecine.c
index 4a372ddaf0..b08a455486 100644
--- a/libmpcodecs/vf_telecine.c
+++ b/libmpcodecs/vf_telecine.c
@@ -33,7 +33,7 @@ struct vf_priv_s {
int frame;
};
-static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts)
+static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts)
{
mp_image_t *dmpi;
int ret;
@@ -106,7 +106,7 @@ static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts)
}
#if 0
-static int query_format(struct vf_instance_s* vf, unsigned int fmt)
+static int query_format(struct vf_instance* vf, unsigned int fmt)
{
/* FIXME - figure out which other formats work */
switch (fmt) {
@@ -118,7 +118,7 @@ static int query_format(struct vf_instance_s* vf, unsigned int fmt)
return 0;
}
-static int config(struct vf_instance_s* vf,
+static int config(struct vf_instance* vf,
int width, int height, int d_width, int d_height,
unsigned int flags, unsigned int outfmt)
{
@@ -126,7 +126,7 @@ static int config(struct vf_instance_s* vf,
}
#endif
-static void uninit(struct vf_instance_s* vf)
+static void uninit(struct vf_instance* vf)
{
free(vf->priv);
}
@@ -153,5 +153,3 @@ const vf_info_t vf_info_telecine = {
open,
NULL
};
-
-
diff --git a/libmpcodecs/vf_test.c b/libmpcodecs/vf_test.c
index 1f51011e57..a59f5c37b2 100644
--- a/libmpcodecs/vf_test.c
+++ b/libmpcodecs/vf_test.c
@@ -47,12 +47,12 @@ struct vf_priv_s {
int frame_num;
};
-static int config(struct vf_instance_s* vf,
+static int config(struct vf_instance* vf,
int width, int height, int d_width, int d_height,
unsigned int flags, unsigned int outfmt){
if(vf_next_query_format(vf,IMGFMT_YV12)<=0){
- mp_msg(MSGT_VFILTER, MSGL_WARN, MSGTR_MPCODECS_WarnNextFilterDoesntSupport, "YV12");
+ mp_tmsg(MSGT_VFILTER, MSGL_WARN, "%s not supported by next filter/vo :(\n", "YV12");
return 0;
}
@@ -269,7 +269,7 @@ static void ring2Test(uint8_t *dst, int stride, int off)
}
}
-static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
+static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts){
mp_image_t *dmpi;
int frame= vf->priv->frame_num;
@@ -307,7 +307,7 @@ static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
//===========================================================================//
-static int query_format(struct vf_instance_s* vf, unsigned int fmt){
+static int query_format(struct vf_instance* vf, unsigned int fmt){
return vf_next_query_format(vf,IMGFMT_YV12) & (~VFCAP_CSP_SUPPORTED_BY_HW);
}
diff --git a/libmpcodecs/vf_tfields.c b/libmpcodecs/vf_tfields.c
index 851d3f24da..1261936293 100644
--- a/libmpcodecs/vf_tfields.c
+++ b/libmpcodecs/vf_tfields.c
@@ -21,6 +21,7 @@
#include <string.h>
#include "config.h"
+#include "options.h"
#include "mp_msg.h"
#include "cpudetect.h"
@@ -319,10 +320,9 @@ static void qpel_4tap_C(unsigned char *d, unsigned char *s, int w, int h, int ds
static void (*qpel_li)(unsigned char *d, unsigned char *s, int w, int h, int ds, int ss, int up);
static void (*qpel_4tap)(unsigned char *d, unsigned char *s, int w, int h, int ds, int ss, int up);
-static int continue_buffered_image(struct vf_instance_s *);
-extern int correct_pts;
+static int continue_buffered_image(struct vf_instance *);
-static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts)
+static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts)
{
vf->priv->buffered_mpi = mpi;
vf->priv->buffered_pts = pts;
@@ -330,7 +330,9 @@ static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts)
return continue_buffered_image(vf);
}
-static int continue_buffered_image(struct vf_instance_s *vf)
+extern const int under_mencoder;
+
+static int continue_buffered_image(struct vf_instance *vf)
{
int i=vf->priv->buffered_i;
double pts = vf->priv->buffered_pts;
@@ -382,10 +384,8 @@ static int continue_buffered_image(struct vf_instance_s *vf)
dmpi->stride[2] = 2*mpi->stride[2];
}
ret |= vf_next_put_image(vf, dmpi, pts);
- if (correct_pts)
+ if (!under_mencoder)
break;
- else
- if (!i) vf_extra_flip(vf);
}
break;
case 1:
@@ -412,10 +412,8 @@ static int continue_buffered_image(struct vf_instance_s *vf)
mpi->chroma_width, mpi->chroma_height, (i^!tff));
}
ret |= vf_next_put_image(vf, dmpi, pts);
- if (correct_pts)
+ if (!under_mencoder)
break;
- else
- if (!i) vf_extra_flip(vf);
}
break;
case 2:
@@ -438,10 +436,8 @@ static int continue_buffered_image(struct vf_instance_s *vf)
dmpi->stride[2], mpi->stride[2]*2, (i^!tff));
}
ret |= vf_next_put_image(vf, dmpi, pts);
- if (correct_pts)
+ if (!under_mencoder)
break;
- else
- if (!i) vf_extra_flip(vf);
}
break;
}
@@ -450,7 +446,7 @@ static int continue_buffered_image(struct vf_instance_s *vf)
}
#if 0
-static int query_format(struct vf_instance_s* vf, unsigned int fmt)
+static int query_format(struct vf_instance* vf, unsigned int fmt)
{
/* FIXME - figure out which other formats work */
switch (fmt) {
@@ -463,7 +459,7 @@ static int query_format(struct vf_instance_s* vf, unsigned int fmt)
}
#endif
-static int config(struct vf_instance_s* vf,
+static int config(struct vf_instance* vf,
int width, int height, int d_width, int d_height,
unsigned int flags, unsigned int outfmt)
{
@@ -479,7 +475,7 @@ static int config(struct vf_instance_s* vf,
return 0;
}
-static void uninit(struct vf_instance_s* vf)
+static void uninit(struct vf_instance* vf)
{
free(vf->priv);
}
@@ -521,5 +517,3 @@ const vf_info_t vf_info_tfields = {
open,
NULL
};
-
-
diff --git a/libmpcodecs/vf_tile.c b/libmpcodecs/vf_tile.c
index bfbf030697..8e9cc7e650 100644
--- a/libmpcodecs/vf_tile.c
+++ b/libmpcodecs/vf_tile.c
@@ -84,7 +84,7 @@ struct vf_priv_s {
};
-static int config(struct vf_instance_s* vf,
+static int config(struct vf_instance* vf,
int width, int height, int d_width, int d_height,
unsigned int flags, unsigned int outfmt){
@@ -107,7 +107,7 @@ static int config(struct vf_instance_s* vf,
}
/* Filter handler */
-static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts)
+static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts)
{
mp_image_t *dmpi;
struct vf_priv_s *priv;
@@ -192,14 +192,14 @@ static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts)
}
}
-static void uninit(struct vf_instance_s* vf)
+static void uninit(struct vf_instance* vf)
{
/* free local data */
free(vf->priv);
}
/* rgb/bgr 15->32 supported & some Yxxx */
-static int query_format(struct vf_instance_s* vf, unsigned int fmt)
+static int query_format(struct vf_instance* vf, unsigned int fmt)
{
switch (fmt) {
/* rgb 15 -> 32 bit */
@@ -295,7 +295,7 @@ static int open(vf_instance_t *vf, char* args)
// er |= parse_int( &args, &p->bkgSet, 0 );
if (er) {
- mp_msg(MSGT_VFILTER, MSGL_ERR, MSGTR_MPCODECS_ErrorParsingArgument);
+ mp_tmsg(MSGT_VFILTER, MSGL_ERR, "[VF_FRAMESTEP] Error parsing argument.\n");
return 0;
}
/* Load some default */
diff --git a/libmpcodecs/vf_tinterlace.c b/libmpcodecs/vf_tinterlace.c
index 988e55d8d0..fa69986856 100644
--- a/libmpcodecs/vf_tinterlace.c
+++ b/libmpcodecs/vf_tinterlace.c
@@ -37,7 +37,7 @@ struct vf_priv_s {
mp_image_t *dmpi;
};
-static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts)
+static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts)
{
int ret = 0;
mp_image_t *dmpi;
@@ -176,7 +176,7 @@ static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts)
return ret;
}
-static int query_format(struct vf_instance_s* vf, unsigned int fmt)
+static int query_format(struct vf_instance* vf, unsigned int fmt)
{
/* FIXME - figure out which other formats work */
switch (fmt) {
@@ -188,7 +188,7 @@ static int query_format(struct vf_instance_s* vf, unsigned int fmt)
return 0;
}
-static int config(struct vf_instance_s* vf,
+static int config(struct vf_instance* vf,
int width, int height, int d_width, int d_height,
unsigned int flags, unsigned int outfmt)
{
@@ -204,7 +204,7 @@ static int config(struct vf_instance_s* vf,
return 0;
}
-static void uninit(struct vf_instance_s* vf)
+static void uninit(struct vf_instance* vf)
{
free(vf->priv);
}
diff --git a/libmpcodecs/vf_unsharp.c b/libmpcodecs/vf_unsharp.c
index 1f7e16bc61..09d276d3d7 100644
--- a/libmpcodecs/vf_unsharp.c
+++ b/libmpcodecs/vf_unsharp.c
@@ -126,7 +126,7 @@ static void unsharp( uint8_t *dst, uint8_t *src, int dstStride, int srcStride, i
//===========================================================================//
-static int config( struct vf_instance_s* vf,
+static int config( struct vf_instance* vf,
int width, int height, int d_width, int d_height,
unsigned int flags, unsigned int outfmt ) {
@@ -159,7 +159,7 @@ static int config( struct vf_instance_s* vf,
//===========================================================================//
-static void get_image( struct vf_instance_s* vf, mp_image_t *mpi ) {
+static void get_image( struct vf_instance* vf, mp_image_t *mpi ) {
if( mpi->flags & MP_IMGFLAG_PRESERVE )
return; // don't change
if( mpi->imgfmt!=vf->priv->outfmt )
@@ -178,7 +178,7 @@ static void get_image( struct vf_instance_s* vf, mp_image_t *mpi ) {
mpi->flags |= MP_IMGFLAG_DIRECT;
}
-static int put_image( struct vf_instance_s* vf, mp_image_t *mpi, double pts) {
+static int put_image( struct vf_instance* vf, mp_image_t *mpi, double pts) {
mp_image_t *dmpi;
if( !(mpi->flags & MP_IMGFLAG_DIRECT) )
@@ -204,7 +204,7 @@ static int put_image( struct vf_instance_s* vf, mp_image_t *mpi, double pts) {
return vf_next_put_image( vf, dmpi, pts);
}
-static void uninit( struct vf_instance_s* vf ) {
+static void uninit( struct vf_instance* vf ) {
unsigned int z;
FilterParam *fp;
@@ -227,7 +227,7 @@ static void uninit( struct vf_instance_s* vf ) {
//===========================================================================//
-static int query_format( struct vf_instance_s* vf, unsigned int fmt ) {
+static int query_format( struct vf_instance* vf, unsigned int fmt ) {
switch(fmt) {
case IMGFMT_YV12:
case IMGFMT_I420:
@@ -263,7 +263,7 @@ static void parse( FilterParam *fp, char* args ) {
//===========================================================================//
-static unsigned int fmt_list[] = {
+static const unsigned int fmt_list[] = {
IMGFMT_YV12,
IMGFMT_I420,
IMGFMT_IYUV,
diff --git a/libmpcodecs/vf_uspp.c b/libmpcodecs/vf_uspp.c
index 19bdc67123..8ff3413422 100644
--- a/libmpcodecs/vf_uspp.c
+++ b/libmpcodecs/vf_uspp.c
@@ -204,7 +204,7 @@ static void filter(struct vf_priv_s *p, uint8_t *dst[3], uint8_t *src[3], int ds
}
}
-static int config(struct vf_instance_s* vf,
+static int config(struct vf_instance* vf,
int width, int height, int d_width, int d_height,
unsigned int flags, unsigned int outfmt){
int i;
@@ -245,7 +245,7 @@ static int config(struct vf_instance_s* vf,
return vf_next_config(vf,width,height,d_width,d_height,flags,outfmt);
}
-static void get_image(struct vf_instance_s* vf, mp_image_t *mpi){
+static void get_image(struct vf_instance* vf, mp_image_t *mpi){
if(mpi->flags&MP_IMGFLAG_PRESERVE) return; // don't change
// ok, we can do pp in-place (or pp disabled):
vf->dmpi=vf_get_image(vf->next,mpi->imgfmt,
@@ -262,7 +262,7 @@ static void get_image(struct vf_instance_s* vf, mp_image_t *mpi){
mpi->flags|=MP_IMGFLAG_DIRECT;
}
-static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
+static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts){
mp_image_t *dmpi;
if(!(mpi->flags&MP_IMGFLAG_DIRECT)){
@@ -297,7 +297,7 @@ static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
return vf_next_put_image(vf,dmpi, pts);
}
-static void uninit(struct vf_instance_s* vf){
+static void uninit(struct vf_instance* vf){
int i;
if(!vf->priv) return;
@@ -316,7 +316,7 @@ static void uninit(struct vf_instance_s* vf){
}
//===========================================================================//
-static int query_format(struct vf_instance_s* vf, unsigned int fmt){
+static int query_format(struct vf_instance* vf, unsigned int fmt){
switch(fmt){
case IMGFMT_YV12:
case IMGFMT_I420:
@@ -328,7 +328,7 @@ static int query_format(struct vf_instance_s* vf, unsigned int fmt){
return 0;
}
-static int control(struct vf_instance_s* vf, int request, void* data){
+static int control(struct vf_instance* vf, int request, void* data){
switch(request){
case VFCTRL_QUERY_MAX_PP_LEVEL:
return 8;
diff --git a/libmpcodecs/vf_vo.c b/libmpcodecs/vf_vo.c
index 96cbee6b8c..597d787e52 100644
--- a/libmpcodecs/vf_vo.c
+++ b/libmpcodecs/vf_vo.c
@@ -19,6 +19,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <stdbool.h>
#include "config.h"
#include "mp_msg.h"
@@ -29,8 +30,8 @@
#include "libvo/video_out.h"
#ifdef CONFIG_ASS
-#include "libass/ass_mp.h"
-extern ass_track_t* ass_track;
+#include "ass_mp.h"
+extern ASS_Track *ass_track;
#endif
//===========================================================================//
@@ -39,19 +40,19 @@ extern int sub_visibility;
extern float sub_delay;
struct vf_priv_s {
- double pts;
- const vo_functions_t *vo;
+ struct vo *vo;
#ifdef CONFIG_ASS
- ass_renderer_t* ass_priv;
+ ASS_Renderer *ass_priv;
int prev_visibility;
+ double scale_ratio;
#endif
};
#define video_out (vf->priv->vo)
-static int query_format(struct vf_instance_s* vf, unsigned int fmt); /* forward declaration */
-static void draw_slice(struct vf_instance_s* vf, unsigned char** src, int* stride, int w,int h, int x, int y);
+static int query_format(struct vf_instance* vf, unsigned int fmt); /* forward declaration */
+static void draw_slice(struct vf_instance *vf, unsigned char **src, int *stride, int w,int h, int x, int y);
-static int config(struct vf_instance_s* vf,
+static int config(struct vf_instance* vf,
int width, int height, int d_width, int d_height,
unsigned int flags, unsigned int outfmt){
@@ -61,8 +62,7 @@ static int config(struct vf_instance_s* vf,
return 0;
}
- if(video_out->info)
- { const vo_info_t *info = video_out->info;
+ const vo_info_t *info = video_out->driver->info;
mp_msg(MSGT_CPLAYER,MSGL_INFO,"VO: [%s] %dx%d => %dx%d %s %s%s%s%s\n",info->short_name,
width, height,
d_width, d_height,
@@ -75,65 +75,65 @@ static int config(struct vf_instance_s* vf,
mp_msg(MSGT_CPLAYER,MSGL_V,"VO: Author: %s\n", info->author);
if(info->comment && strlen(info->comment) > 0)
mp_msg(MSGT_CPLAYER,MSGL_V,"VO: Comment: %s\n", info->comment);
- }
// save vo's stride capability for the wanted colorspace:
vf->default_caps=query_format(vf,outfmt);
vf->draw_slice = (vf->default_caps & VOCAP_NOSLICES) ? NULL : draw_slice;
- if(config_video_out(video_out,width,height,d_width,d_height,flags,"MPlayer",outfmt))
+ if (vo_config(video_out, width, height, d_width, d_height, flags, "MPlayer", outfmt))
return 0;
#ifdef CONFIG_ASS
+ vf->priv->scale_ratio = (double) d_width / d_height * height / width;
+
if (vf->priv->ass_priv)
ass_configure(vf->priv->ass_priv, width, height, !!(vf->default_caps & VFCAP_EOSD_UNSCALED));
#endif
- ++vo_config_count;
return 1;
}
-static int control(struct vf_instance_s* vf, int request, void* data)
+static int control(struct vf_instance* vf, int request, void* data)
{
switch(request){
case VFCTRL_GET_DEINTERLACE:
{
if(!video_out) return CONTROL_FALSE; // vo not configured?
- return(video_out->control(VOCTRL_GET_DEINTERLACE, data)
- == VO_TRUE) ? CONTROL_TRUE : CONTROL_FALSE;
+ return vo_control(video_out, VOCTRL_GET_DEINTERLACE, data) == VO_TRUE;
}
case VFCTRL_SET_DEINTERLACE:
{
if(!video_out) return CONTROL_FALSE; // vo not configured?
- return(video_out->control(VOCTRL_SET_DEINTERLACE, data)
- == VO_TRUE) ? CONTROL_TRUE : CONTROL_FALSE;
+ return vo_control(video_out, VOCTRL_SET_DEINTERLACE, data) == VO_TRUE;
}
+ case VFCTRL_GET_YUV_COLORSPACE:
+ return vo_control(video_out, VOCTRL_GET_YUV_COLORSPACE, data) == true;
+ case VFCTRL_SET_YUV_COLORSPACE:
+ return vo_control(video_out, VOCTRL_SET_YUV_COLORSPACE, data) == true;
case VFCTRL_DRAW_OSD:
- if(!vo_config_count) return CONTROL_FALSE; // vo not configured?
- video_out->draw_osd();
+ if(!video_out->config_ok) return CONTROL_FALSE; // vo not configured?
+ vo_draw_osd(video_out, data);
return CONTROL_TRUE;
- case VFCTRL_FLIP_PAGE:
- {
- if(!vo_config_count) return CONTROL_FALSE; // vo not configured?
- video_out->flip_page();
- return CONTROL_TRUE;
- }
+ case VFCTRL_REDRAW_OSD:
+ return vo_control(video_out, VOCTRL_REDRAW_OSD, data) == true;
case VFCTRL_SET_EQUALIZER:
{
vf_equalizer_t *eq=data;
- if(!vo_config_count) return CONTROL_FALSE; // vo not configured?
- return (video_out->control(VOCTRL_SET_EQUALIZER, eq->item, eq->value) == VO_TRUE) ? CONTROL_TRUE : CONTROL_FALSE;
+ if(!video_out->config_ok) return CONTROL_FALSE; // vo not configured?
+ struct voctrl_set_equalizer_args param = {eq->item, eq->value};
+ return vo_control(video_out, VOCTRL_SET_EQUALIZER, &param) == VO_TRUE;
}
case VFCTRL_GET_EQUALIZER:
{
vf_equalizer_t *eq=data;
- if(!vo_config_count) return CONTROL_FALSE; // vo not configured?
- return (video_out->control(VOCTRL_GET_EQUALIZER, eq->item, &eq->value) == VO_TRUE) ? CONTROL_TRUE : CONTROL_FALSE;
+ if(!video_out->config_ok) return CONTROL_FALSE; // vo not configured?
+ struct voctrl_get_equalizer_args param = {eq->item, &eq->value};
+ return vo_control(video_out, VOCTRL_GET_EQUALIZER, &param) == VO_TRUE;
}
#ifdef CONFIG_ASS
case VFCTRL_INIT_EOSD:
{
- vf->priv->ass_priv = ass_renderer_init((ass_library_t*)data);
+ vf->priv->ass_priv = ass_renderer_init((ASS_Library*)data);
if (!vf->priv->ass_priv) return CONTROL_FALSE;
ass_configure_fonts(vf->priv->ass_priv);
vf->priv->prev_visibility = 0;
@@ -142,19 +142,15 @@ static int control(struct vf_instance_s* vf, int request, void* data)
case VFCTRL_DRAW_EOSD:
{
mp_eosd_images_t images = {NULL, 2};
- double pts = vf->priv->pts;
- if (!vo_config_count || !vf->priv->ass_priv) return CONTROL_FALSE;
+ double pts = video_out->next_pts;
+ if (!video_out->config_ok || !vf->priv->ass_priv) return CONTROL_FALSE;
if (sub_visibility && vf->priv->ass_priv && ass_track && (pts != MP_NOPTS_VALUE)) {
mp_eosd_res_t res;
memset(&res, 0, sizeof(res));
- if (video_out->control(VOCTRL_GET_EOSD_RES, &res) == VO_TRUE) {
+ if (vo_control(video_out, VOCTRL_GET_EOSD_RES, &res) == VO_TRUE) {
ass_set_frame_size(vf->priv->ass_priv, res.w, res.h);
ass_set_margins(vf->priv->ass_priv, res.mt, res.mb, res.ml, res.mr);
-#if defined(LIBASS_VERSION) && LIBASS_VERSION >= 0x00908000
- ass_set_aspect_ratio(vf->priv->ass_priv, (double)res.w / res.h, (double)res.srcw/res.srch);
-#else
- ass_set_aspect_ratio(vf->priv->ass_priv, (double)res.w / res.h);
-#endif
+ ass_set_aspect_ratio(vf->priv->ass_priv, vf->priv->scale_ratio, 1);
}
images.imgs = ass_mp_render_frame(vf->priv->ass_priv, ass_track, (pts+sub_delay) * 1000 + .5, &images.changed);
@@ -164,21 +160,15 @@ static int control(struct vf_instance_s* vf, int request, void* data)
} else
vf->priv->prev_visibility = 0;
vf->priv->prev_visibility = sub_visibility;
- return (video_out->control(VOCTRL_DRAW_EOSD, &images) == VO_TRUE) ? CONTROL_TRUE : CONTROL_FALSE;
+ return vo_control(video_out, VOCTRL_DRAW_EOSD, &images) == VO_TRUE;
}
#endif
- case VFCTRL_GET_PTS:
- {
- *(double *)data = vf->priv->pts;
- return CONTROL_TRUE;
- }
}
- // return video_out->control(request,data);
return CONTROL_UNKNOWN;
}
-static int query_format(struct vf_instance_s* vf, unsigned int fmt){
- int flags=video_out->control(VOCTRL_QUERY_FORMAT,&fmt);
+static int query_format(struct vf_instance* vf, unsigned int fmt){
+ int flags = vo_control(video_out, VOCTRL_QUERY_FORMAT, &fmt);
// draw_slice() accepts stride, draw_frame() doesn't:
if(flags)
if(fmt==IMGFMT_YV12 || fmt==IMGFMT_I420 || fmt==IMGFMT_IYUV)
@@ -186,49 +176,52 @@ static int query_format(struct vf_instance_s* vf, unsigned int fmt){
return flags;
}
-static void get_image(struct vf_instance_s* vf,
+static void get_image(struct vf_instance* vf,
mp_image_t *mpi){
- if(!vo_config_count) return;
+ if (!video_out->config_ok)
+ return;
// GET_IMAGE is required for hardware-accelerated formats
if(vo_directrendering ||
IMGFMT_IS_XVMC(mpi->imgfmt) || IMGFMT_IS_VDPAU(mpi->imgfmt))
- video_out->control(VOCTRL_GET_IMAGE,mpi);
+ vo_control(video_out, VOCTRL_GET_IMAGE, mpi);
}
-static int put_image(struct vf_instance_s* vf,
+static int put_image(struct vf_instance* vf,
mp_image_t *mpi, double pts){
- if(!vo_config_count) return 0; // vo not configured?
- // record pts (potentially modified by filters) for main loop
- vf->priv->pts = pts;
+ if(!video_out->config_ok) return 0; // vo not configured?
// first check, maybe the vo/vf plugin implements draw_image using mpi:
- if(video_out->control(VOCTRL_DRAW_IMAGE,mpi)==VO_TRUE) return 1; // done.
+ if (vo_draw_image(video_out, mpi, pts) >= 0)
+ return 1;
// nope, fallback to old draw_frame/draw_slice:
if(!(mpi->flags&(MP_IMGFLAG_DIRECT|MP_IMGFLAG_DRAW_CALLBACK))){
// blit frame:
// if(mpi->flags&MP_IMGFLAG_PLANAR)
if(vf->default_caps&VFCAP_ACCEPT_STRIDE)
- video_out->draw_slice(mpi->planes,mpi->stride,mpi->w,mpi->h,mpi->x,mpi->y);
+ vo_draw_slice(video_out, mpi->planes,mpi->stride,mpi->w,mpi->h,mpi->x,mpi->y);
else
- video_out->draw_frame(mpi->planes);
+ vo_draw_frame(video_out, mpi->planes);
}
return 1;
}
-static void start_slice(struct vf_instance_s* vf,
+static void start_slice(struct vf_instance* vf,
mp_image_t *mpi) {
- if(!vo_config_count) return; // vo not configured?
- video_out->control(VOCTRL_START_SLICE,mpi);
+ if(!video_out->config_ok) return; // vo not configured?
+ vo_control(video_out, VOCTRL_START_SLICE,mpi);
}
-static void draw_slice(struct vf_instance_s* vf,
+static void draw_slice(struct vf_instance* vf,
unsigned char** src, int* stride, int w,int h, int x, int y){
- if(!vo_config_count) return; // vo not configured?
- video_out->draw_slice(src,stride,w,h,x,y);
+ if(!video_out->config_ok) return; // vo not configured?
+ vo_draw_slice(video_out, src,stride,w,h,x,y);
}
-static void uninit(struct vf_instance_s* vf)
+static void uninit(struct vf_instance* vf)
{
if (vf->priv) {
+ /* Allow VO (which may live on to work with another instance of vf_vo)
+ * to get rid of numbered-mpi references that will now be invalid. */
+ vo_seek_reset(video_out);
#ifdef CONFIG_ASS
if (vf->priv->ass_priv)
ass_renderer_done(vf->priv->ass_priv);
@@ -248,9 +241,8 @@ static int open(vf_instance_t *vf, char* args){
vf->start_slice=start_slice;
vf->uninit=uninit;
vf->priv=calloc(1, sizeof(struct vf_priv_s));
- vf->priv->vo = (const vo_functions_t *)args;
+ vf->priv->vo = (struct vo *)args;
if(!video_out) return 0; // no vo ?
-// if(video_out->preinit(args)) return 0; // preinit failed
return 1;
}
diff --git a/libmpcodecs/vf_yadif.c b/libmpcodecs/vf_yadif.c
index 4b408a2e21..477ea03c9b 100644
--- a/libmpcodecs/vf_yadif.c
+++ b/libmpcodecs/vf_yadif.c
@@ -26,6 +26,7 @@
#include "config.h"
#include "cpudetect.h"
+#include "options.h"
#include "mp_msg.h"
#include "img_format.h"
@@ -363,7 +364,7 @@ static void filter(struct vf_priv_s *p, uint8_t *dst[3], int dst_stride[3], int
#endif
}
-static int config(struct vf_instance_s* vf,
+static int config(struct vf_instance* vf,
int width, int height, int d_width, int d_height,
unsigned int flags, unsigned int outfmt){
int i, j;
@@ -381,10 +382,9 @@ static int config(struct vf_instance_s* vf,
return vf_next_config(vf,width,height,d_width,d_height,flags,outfmt);
}
-static int continue_buffered_image(struct vf_instance_s *vf);
-extern int correct_pts;
+static int continue_buffered_image(struct vf_instance *vf);
-static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
+static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts){
int tff;
if(vf->priv->parity < 0) {
@@ -411,7 +411,9 @@ static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
return continue_buffered_image(vf);
}
-static int continue_buffered_image(struct vf_instance_s *vf)
+extern const int under_mencoder;
+
+static int continue_buffered_image(struct vf_instance *vf)
{
mp_image_t *mpi = vf->priv->buffered_mpi;
int tff = vf->priv->buffered_tff;
@@ -429,19 +431,17 @@ static int continue_buffered_image(struct vf_instance_s *vf)
mpi->width,mpi->height);
vf_clone_mpi_attributes(dmpi, mpi);
filter(vf->priv, dmpi->planes, dmpi->stride, mpi->w, mpi->h, i ^ tff ^ 1, tff);
- if (correct_pts && i < (vf->priv->mode & 1))
+ if (i < (vf->priv->mode & 1) && !under_mencoder)
vf_queue_frame(vf, continue_buffered_image);
ret |= vf_next_put_image(vf, dmpi, pts /*FIXME*/);
- if (correct_pts)
+ if (!under_mencoder)
break;
- if(i<(vf->priv->mode&1))
- vf_extra_flip(vf);
}
vf->priv->buffered_i = 1;
return ret;
}
-static void uninit(struct vf_instance_s* vf){
+static void uninit(struct vf_instance* vf){
int i;
if(!vf->priv) return;
@@ -455,7 +455,7 @@ static void uninit(struct vf_instance_s* vf){
}
//===========================================================================//
-static int query_format(struct vf_instance_s* vf, unsigned int fmt){
+static int query_format(struct vf_instance* vf, unsigned int fmt){
switch(fmt){
case IMGFMT_YV12:
case IMGFMT_I420:
@@ -467,7 +467,7 @@ static int query_format(struct vf_instance_s* vf, unsigned int fmt){
return 0;
}
-static int control(struct vf_instance_s* vf, int request, void* data){
+static int control(struct vf_instance* vf, int request, void* data){
switch (request){
case VFCTRL_GET_DEINTERLACE:
*(int*)data = vf->priv->do_deinterlace;
diff --git a/libmpcodecs/vf_yuvcsp.c b/libmpcodecs/vf_yuvcsp.c
index 0f3db68741..7fe176b00e 100644
--- a/libmpcodecs/vf_yuvcsp.c
+++ b/libmpcodecs/vf_yuvcsp.c
@@ -34,7 +34,7 @@ struct vf_priv_s {
//===========================================================================//
-static int config(struct vf_instance_s* vf,
+static int config(struct vf_instance* vf,
int width, int height, int d_width, int d_height,
unsigned int flags, unsigned int outfmt){
return vf_next_config(vf, width, height, d_width, d_height, flags, outfmt);
@@ -48,7 +48,7 @@ static inline int clamp_c(int x){
return (x > 240) ? 240 : (x < 16) ? 16 : x;
}
-static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
+static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts){
int i,j;
uint8_t *y_in, *cb_in, *cr_in;
uint8_t *y_out, *cb_out, *cr_out;
@@ -82,12 +82,12 @@ static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
//===========================================================================//
/*
-static void uninit(struct vf_instance_s* vf){
+static void uninit(struct vf_instance* vf){
free(vf->priv);
}
*/
-static int query_format(struct vf_instance_s* vf, unsigned int fmt){
+static int query_format(struct vf_instance* vf, unsigned int fmt){
switch(fmt){
case IMGFMT_YV12:
case IMGFMT_I420:
diff --git a/libmpcodecs/vf_yuy2.c b/libmpcodecs/vf_yuy2.c
index 36337e3a9c..8e1b6f0c8c 100644
--- a/libmpcodecs/vf_yuy2.c
+++ b/libmpcodecs/vf_yuy2.c
@@ -34,21 +34,21 @@
//===========================================================================//
-static int config(struct vf_instance_s* vf,
+static int config(struct vf_instance* vf,
int width, int height, int d_width, int d_height,
unsigned int flags, unsigned int outfmt){
sws_rgb2rgb_init(get_sws_cpuflags());
if(vf_next_query_format(vf,IMGFMT_YUY2)<=0){
- mp_msg(MSGT_VFILTER, MSGL_WARN, MSGTR_MPCODECS_WarnNextFilterDoesntSupport, "YUY2");
+ mp_tmsg(MSGT_VFILTER, MSGL_WARN, "%s not supported by next filter/vo :(\n", "YUY2");
return 0;
}
return vf_next_config(vf,width,height,d_width,d_height,flags,IMGFMT_YUY2);
}
-static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
+static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts){
mp_image_t *dmpi;
// hope we'll get DR buffer:
@@ -70,7 +70,7 @@ static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
//===========================================================================//
-static int query_format(struct vf_instance_s* vf, unsigned int fmt){
+static int query_format(struct vf_instance* vf, unsigned int fmt){
switch(fmt){
case IMGFMT_YV12:
case IMGFMT_I420:
diff --git a/libmpcodecs/vf_yvu9.c b/libmpcodecs/vf_yvu9.c
index a3027a85e3..bbae017ef8 100644
--- a/libmpcodecs/vf_yvu9.c
+++ b/libmpcodecs/vf_yvu9.c
@@ -33,19 +33,19 @@
//===========================================================================//
-static int config(struct vf_instance_s* vf,
+static int config(struct vf_instance* vf,
int width, int height, int d_width, int d_height,
unsigned int flags, unsigned int outfmt){
if(vf_next_query_format(vf,IMGFMT_YV12)<=0){
- mp_msg(MSGT_VFILTER, MSGL_WARN, MSGTR_MPCODECS_WarnNextFilterDoesntSupport, "YVU9");
+ mp_tmsg(MSGT_VFILTER, MSGL_WARN, "%s not supported by next filter/vo :(\n", "YVU9");
return 0;
}
return vf_next_config(vf,width,height,d_width,d_height,flags,IMGFMT_YV12);
}
-static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
+static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts){
mp_image_t *dmpi;
int y,w,h;
@@ -80,7 +80,7 @@ static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
//===========================================================================//
-static int query_format(struct vf_instance_s* vf, unsigned int fmt){
+static int query_format(struct vf_instance* vf, unsigned int fmt){
if (fmt == IMGFMT_YVU9 || fmt == IMGFMT_IF09)
return vf_next_query_format(vf,IMGFMT_YV12) & (~VFCAP_CSP_SUPPORTED_BY_HW);
return 0;
diff --git a/libmpcodecs/vf_zrmjpeg.c b/libmpcodecs/vf_zrmjpeg.c
index 6b4c9a7c64..87c50351d9 100644
--- a/libmpcodecs/vf_zrmjpeg.c
+++ b/libmpcodecs/vf_zrmjpeg.c
@@ -668,7 +668,7 @@ struct vf_priv_s {
* arrange to dispatch to the config() entry pointer for the one
* selected.
*/
-static int config(struct vf_instance_s* vf, int width, int height, int d_width,
+static int config(struct vf_instance* vf, int width, int height, int d_width,
int d_height, unsigned int flags, unsigned int outfmt){
struct vf_priv_s *priv = vf->priv;
float aspect_decision;
@@ -828,7 +828,7 @@ static int config(struct vf_instance_s* vf, int width, int height, int d_width,
* \param mpi pointer to mp_image_t structure
* \param pts
*/
-static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
+static int put_image(struct vf_instance* vf, mp_image_t *mpi, double pts){
struct vf_priv_s *priv = vf->priv;
int size = 0;
int i;
@@ -857,7 +857,7 @@ static int put_image(struct vf_instance_s* vf, mp_image_t *mpi, double pts){
* Given the image format specified by \a fmt, this routine is called
* to ask if the format is supported or not.
*/
-static int query_format(struct vf_instance_s* vf, unsigned int fmt){
+static int query_format(struct vf_instance* vf, unsigned int fmt){
VERBOSE("query_format() called\n");
switch (fmt) {
@@ -1066,4 +1066,3 @@ const vf_info_t vf_info_zrmjpeg = {
open,
NULL
};
-
diff --git a/libmpdemux/asfheader.c b/libmpdemux/asfheader.c
index d0532f1e3d..95d5f18e7f 100644
--- a/libmpdemux/asfheader.c
+++ b/libmpdemux/asfheader.c
@@ -24,7 +24,7 @@
#include "config.h"
#include "libavutil/common.h"
-#include "libavutil/intreadwrite.h"
+#include "ffmpeg_files/intreadwrite.h"
#include "mp_msg.h"
#include "help_mp.h"
@@ -54,7 +54,7 @@ static char* get_ucs2str(const uint16_t* inbuf, uint16_t inlen)
int i;
if (!outbuf) {
- mp_msg(MSGT_HEADER, MSGL_ERR, MSGTR_MemAllocFailed);
+ mp_tmsg(MSGT_HEADER, MSGL_ERR, "Memory allocation failed.\n");
return NULL;
}
q = outbuf;
@@ -286,7 +286,7 @@ static int get_meta(char *buf, int buf_len, int this_stream_num,
if (record_entry.stream_num && record_entry.stream_num != this_stream_num)
continue;
if (!(name = get_ucs2str(record_entry.name, record_entry.name_length))) {
- mp_msg(MSGT_HEADER, MSGL_ERR, MSGTR_MemAllocFailed);
+ mp_tmsg(MSGT_HEADER, MSGL_ERR, "Memory allocation failed.\n");
continue;
}
if (strcmp(name, "AspectRatioX") == 0)
@@ -339,7 +339,7 @@ static int is_drm(char* buf, int buf_len)
buf += 4;
buf[url_len - 1] = '\0';
- mp_msg(MSGT_HEADER, MSGL_INFO, MSGTR_MPDEMUX_ASFHDR_DRMLicenseURL, buf);
+ mp_tmsg(MSGT_HEADER, MSGL_INFO, "DRM License URL: %s\n", buf);
return 1;
}
@@ -402,14 +402,14 @@ int read_asf_header(demuxer_t *demuxer,struct asf_priv* asf){
}
if (hdr_len > 1024 * 1024) {
- mp_msg(MSGT_HEADER, MSGL_ERR, MSGTR_MPDEMUX_ASFHDR_HeaderSizeOver1MB,
+ mp_tmsg(MSGT_HEADER, MSGL_ERR, "FATAL: header size bigger than 1 MB (%d)!\nPlease contact MPlayer authors, and upload/send this file.\n",
hdr_len);
hdr_skip = hdr_len - 1024 * 1024;
hdr_len = 1024 * 1024;
}
hdr = malloc(hdr_len);
if (!hdr) {
- mp_msg(MSGT_HEADER, MSGL_FATAL, MSGTR_MPDEMUX_ASFHDR_HeaderMallocFailed,
+ mp_tmsg(MSGT_HEADER, MSGL_FATAL, "Could not allocate %d bytes for header.\n",
hdr_len);
return 0;
}
@@ -417,12 +417,12 @@ int read_asf_header(demuxer_t *demuxer,struct asf_priv* asf){
if (hdr_skip)
stream_skip(demuxer->stream, hdr_skip);
if (stream_eof(demuxer->stream)) {
- mp_msg(MSGT_HEADER, MSGL_FATAL, MSGTR_MPDEMUX_ASFHDR_EOFWhileReadingHeader);
+ mp_tmsg(MSGT_HEADER, MSGL_FATAL, "EOF while reading ASF header, broken/incomplete file?\n");
goto err_out;
}
if (is_drm(hdr, hdr_len))
- mp_msg(MSGT_HEADER, MSGL_FATAL, MSGTR_MPDEMUX_ASFHDR_DRMProtected);
+ mp_tmsg(MSGT_HEADER, MSGL_FATAL, "This file has been encumbered with DRM encryption, it will not play in MPlayer!\n");
if ((pos = find_asf_guid(hdr, asf_ext_stream_audio, 0, hdr_len)) >= 0)
{
@@ -445,7 +445,7 @@ int read_asf_header(demuxer_t *demuxer,struct asf_priv* asf){
buffer = &hdr[audio_pos];
sh_audio=new_sh_audio(demuxer,streamh->stream_no & 0x7F);
sh_audio->needs_parsing = 1;
- mp_msg(MSGT_DEMUX, MSGL_INFO, MSGTR_AudioID, "asfheader", streamh->stream_no & 0x7F);
+ mp_tmsg(MSGT_DEMUX, MSGL_INFO, "[%s] Audio stream found, -aid %d\n", "asfheader", streamh->stream_no & 0x7F);
++audio_streams;
if (!asf_init_audio_stream(demuxer, asf, sh_audio, streamh, &audio_pos, &buffer, hdr, hdr_len))
goto len_err_out;
@@ -482,7 +482,7 @@ int read_asf_header(demuxer_t *demuxer,struct asf_priv* asf){
switch(ASF_LOAD_GUID_PREFIX(streamh->type)){
case ASF_GUID_PREFIX_audio_stream: {
sh_audio_t* sh_audio=new_sh_audio(demuxer,streamh->stream_no & 0x7F);
- mp_msg(MSGT_DEMUX, MSGL_INFO, MSGTR_AudioID, "asfheader", streamh->stream_no & 0x7F);
+ mp_tmsg(MSGT_DEMUX, MSGL_INFO, "[%s] Audio stream found, -aid %d\n", "asfheader", streamh->stream_no & 0x7F);
++audio_streams;
if (!asf_init_audio_stream(demuxer, asf, sh_audio, streamh, &pos, &buffer, hdr, hdr_len))
goto len_err_out;
@@ -493,7 +493,7 @@ int read_asf_header(demuxer_t *demuxer,struct asf_priv* asf){
unsigned int len;
float asp_ratio;
sh_video_t* sh_video=new_sh_video(demuxer,streamh->stream_no & 0x7F);
- mp_msg(MSGT_DEMUX, MSGL_INFO, MSGTR_VideoID, "asfheader", streamh->stream_no & 0x7F);
+ mp_tmsg(MSGT_DEMUX, MSGL_INFO, "[%s] Video stream found, -vid %d\n", "asfheader", streamh->stream_no & 0x7F);
len=streamh->type_size-(4+4+1+2);
++video_streams;
// sh_video->bih=malloc(chunksize); memset(sh_video->bih,0,chunksize);
@@ -503,7 +503,7 @@ int read_asf_header(demuxer_t *demuxer,struct asf_priv* asf){
if (sh_video->bih->biSize > len && sh_video->bih->biSize > sizeof(BITMAPINFOHEADER))
sh_video->bih->biSize = len;
if (sh_video->bih->biCompression == mmioFOURCC('D', 'V', 'R', ' ')) {
- //mp_msg(MSGT_DEMUXER, MSGL_WARN, MSGTR_MPDEMUX_ASFHDR_DVRWantsLibavformat);
+ //mp_tmsg(MSGT_DEMUXER, MSGL_WARN, "DVR will probably only work with libavformat, try -demuxer 35 if you have problems\n");
//sh_video->fps=(float)sh_video->video.dwRate/(float)sh_video->video.dwScale;
//sh_video->frametime=(float)sh_video->video.dwScale/(float)sh_video->video.dwRate;
asf->asf_frame_state=-1;
@@ -649,7 +649,7 @@ int read_asf_header(demuxer_t *demuxer,struct asf_priv* asf){
start = stream_tell(demuxer->stream); // start of first data chunk
stream_read(demuxer->stream, guid_buffer, 16);
if (memcmp(guid_buffer, asf_data_chunk_guid, 16) != 0) {
- mp_msg(MSGT_HEADER, MSGL_FATAL, MSGTR_MPDEMUX_ASFHDR_NoDataChunkAfterHeader);
+ mp_tmsg(MSGT_HEADER, MSGL_FATAL, "No data chunk following header!\n");
free(streams);
streams = NULL;
return 0;
@@ -696,7 +696,7 @@ if(!audio_streams) demuxer->audio->id=-2; // nosound
else if(best_audio > 0 && demuxer->audio->id == -1) demuxer->audio->id=best_audio;
if(!video_streams){
if(!audio_streams){
- mp_msg(MSGT_HEADER,MSGL_ERR,MSGTR_MPDEMUX_ASFHDR_AudioVideoHeaderNotFound);
+ mp_tmsg(MSGT_HEADER,MSGL_ERR,"ASF: no audio or video headers found - broken file?\n");
return 0;
}
demuxer->video->id=-2; // audio-only
@@ -713,7 +713,7 @@ if( mp_msg_test(MSGT_HEADER,MSGL_V) ){
return 1;
len_err_out:
- mp_msg(MSGT_HEADER, MSGL_FATAL, MSGTR_MPDEMUX_ASFHDR_InvalidLengthInASFHeader);
+ mp_tmsg(MSGT_HEADER, MSGL_FATAL, "Invalid length in ASF header!\n");
err_out:
if (hdr) free(hdr);
if (streams) free(streams);
diff --git a/libmpdemux/aviheader.c b/libmpdemux/aviheader.c
index 8435fa3c4f..6cfd668051 100644
--- a/libmpdemux/aviheader.c
+++ b/libmpdemux/aviheader.c
@@ -59,7 +59,7 @@ static int odml_get_vstream_id(int id, unsigned char res[])
return 0;
}
-int avi_idx_cmp(const void *elem1,const void *elem2) {
+static int avi_idx_cmp(const void *elem1,const void *elem2) {
register off_t a = AVI_IDX_OFFSET((AVIINDEXENTRY *)elem1);
register off_t b = AVI_IDX_OFFSET((AVIINDEXENTRY *)elem2);
return (a > b) - (b > a);
@@ -97,7 +97,7 @@ while(1){
len -= 4;
list_end=stream_tell(demuxer->stream)+((len+1)&(~1));
} else {
- mp_msg(MSGT_HEADER,MSGL_WARN,MSGTR_MPDEMUX_AVIHDR_EmptyList);
+ mp_tmsg(MSGT_HEADER,MSGL_WARN,"** empty list?!\n");
list_end = 0;
}
mp_msg(MSGT_HEADER,MSGL_V,"list_end=0x%X\n",(int)list_end);
@@ -105,7 +105,7 @@ while(1){
// found MOVI header
if(!demuxer->movi_start) demuxer->movi_start=stream_tell(demuxer->stream);
demuxer->movi_end=stream_tell(demuxer->stream)+len;
- mp_msg(MSGT_HEADER,MSGL_V,MSGTR_MPDEMUX_AVIHDR_FoundMovieAt,(int)demuxer->movi_start,(int)demuxer->movi_end);
+ mp_tmsg(MSGT_HEADER,MSGL_V,"Found movie at 0x%X - 0x%X\n",(int)demuxer->movi_start,(int)demuxer->movi_end);
if(demuxer->stream->end_pos>demuxer->movi_end) demuxer->movi_end=demuxer->stream->end_pos;
if(index_mode==-2 || index_mode==2 || index_mode==0)
break; // reading from non-seekable source (stdin) or forced index or no index forced
@@ -210,13 +210,13 @@ while(1){
++stream_id;
if(h.fccType==streamtypeVIDEO){
sh_video=new_sh_video(demuxer,stream_id);
- mp_msg(MSGT_DEMUX, MSGL_INFO, MSGTR_VideoID, "aviheader", stream_id);
+ mp_tmsg(MSGT_DEMUX, MSGL_INFO, "[%s] Video stream found, -vid %d\n", "aviheader", stream_id);
memcpy(&sh_video->video,&h,sizeof(h));
sh_video->stream_delay = (float)sh_video->video.dwStart * sh_video->video.dwScale/sh_video->video.dwRate;
} else
if(h.fccType==streamtypeAUDIO){
sh_audio=new_sh_audio(demuxer,stream_id);
- mp_msg(MSGT_DEMUX, MSGL_INFO, MSGTR_AudioID, "aviheader", stream_id);
+ mp_tmsg(MSGT_DEMUX, MSGL_INFO, "[%s] Audio stream found, -aid %d\n", "aviheader", stream_id);
memcpy(&sh_audio->audio,&h,sizeof(h));
sh_audio->stream_delay = (float)sh_audio->audio.dwStart * sh_audio->audio.dwScale/sh_audio->audio.dwRate;
sh_audio->needs_parsing = 1;
@@ -280,7 +280,7 @@ while(1){
if(last_fccType==streamtypeVIDEO){
sh_video->bih=calloc(FFMAX(chunksize, sizeof(BITMAPINFOHEADER)), 1);
// sh_video->bih=malloc(chunksize); memset(sh_video->bih,0,chunksize);
- mp_msg(MSGT_HEADER,MSGL_V,MSGTR_MPDEMUX_AVIHDR_FoundBitmapInfoHeader,chunksize,sizeof(BITMAPINFOHEADER));
+ mp_tmsg(MSGT_HEADER,MSGL_V,"Found 'bih', %u bytes of %d\n",chunksize,sizeof(BITMAPINFOHEADER));
stream_read(demuxer->stream,(char*) sh_video->bih,chunksize);
le2me_BITMAPINFOHEADER(sh_video->bih); // swap to machine endian
if (sh_video->bih->biSize > chunksize && sh_video->bih->biSize > sizeof(BITMAPINFOHEADER))
@@ -301,7 +301,7 @@ while(1){
case mmioFOURCC('m', 'p', 'g', '4'):
case mmioFOURCC('D', 'I', 'V', '1'):
idxfix_divx=3; // set index recovery mpeg4 flavour: msmpeg4v1
- mp_msg(MSGT_HEADER,MSGL_V,MSGTR_MPDEMUX_AVIHDR_RegeneratingKeyfTableForMPG4V1);
+ mp_tmsg(MSGT_HEADER,MSGL_V,"Regenerating keyframe table for M$ mpg4v1 video.\n");
break;
case mmioFOURCC('D', 'I', 'V', '3'):
case mmioFOURCC('d', 'i', 'v', '3'):
@@ -318,7 +318,7 @@ while(1){
case mmioFOURCC('D', 'I', 'V', '2'):
case mmioFOURCC('A', 'P', '4', '1'):
idxfix_divx=1; // set index recovery mpeg4 flavour: msmpeg4v3
- mp_msg(MSGT_HEADER,MSGL_V,MSGTR_MPDEMUX_AVIHDR_RegeneratingKeyfTableForDIVX3);
+ mp_tmsg(MSGT_HEADER,MSGL_V,"Regenerating keyframe table for DIVX3 video.\n");
break;
case mmioFOURCC('D', 'I', 'V', 'X'):
case mmioFOURCC('d', 'i', 'v', 'x'):
@@ -328,7 +328,7 @@ while(1){
case mmioFOURCC('F', 'M', 'P', '4'):
case mmioFOURCC('f', 'm', 'p', '4'):
idxfix_divx=2; // set index recovery mpeg4 flavour: generic mpeg4
- mp_msg(MSGT_HEADER,MSGL_V,MSGTR_MPDEMUX_AVIHDR_RegeneratingKeyfTableForMPEG4);
+ mp_tmsg(MSGT_HEADER,MSGL_V,"Regenerating keyframe table for MPEG-4 video.\n");
break;
}
} else
@@ -336,7 +336,7 @@ while(1){
unsigned wf_size = chunksize<sizeof(WAVEFORMATEX)?sizeof(WAVEFORMATEX):chunksize;
sh_audio->wf=calloc(wf_size,1);
// sh_audio->wf=malloc(chunksize); memset(sh_audio->wf,0,chunksize);
- mp_msg(MSGT_HEADER,MSGL_V,MSGTR_MPDEMUX_AVIHDR_FoundWaveFmt,chunksize,sizeof(WAVEFORMATEX));
+ mp_tmsg(MSGT_HEADER,MSGL_V,"Found 'wf', %d bytes of %d\n",chunksize,sizeof(WAVEFORMATEX));
stream_read(demuxer->stream,(char*) sh_audio->wf,chunksize);
le2me_WAVEFORMATEX(sh_audio->wf);
if (sh_audio->wf->cbSize != 0 &&
@@ -379,7 +379,7 @@ while(1){
case mmioFOURCC('d', 'm', 'l', 'h'): {
// dmlh 00 00 00 04 frms
unsigned int total_frames = stream_read_dword_le(demuxer->stream);
- mp_msg(MSGT_HEADER,MSGL_V,MSGTR_MPDEMUX_AVIHDR_FoundAVIV2Header, chunksize, total_frames);
+ mp_tmsg(MSGT_HEADER,MSGL_V,"AVI: dmlh found (size=%d) (total_frames=%d)\n", chunksize, total_frames);
stream_skip(demuxer->stream, chunksize-4);
chunksize = 0;
}
@@ -390,7 +390,7 @@ while(1){
if(index_mode && !priv->isodml){
int i;
priv->idx_size=size2>>4;
- mp_msg(MSGT_HEADER,MSGL_V,MSGTR_MPDEMUX_AVIHDR_ReadingIndexBlockChunksForFrames,
+ mp_tmsg(MSGT_HEADER,MSGL_V,"Reading INDEX block, %d chunks for %d frames (fpos=%"PRId64").\n",
priv->idx_size,avih.dwTotalFrames, (int64_t)stream_tell(demuxer->stream));
priv->idx=malloc(priv->idx_size<<4);
// printf("\nindex to %p !!!!! (priv=%p)\n",priv->idx,priv);
@@ -413,10 +413,10 @@ while(1){
case mmioFOURCC('R','I','F','F'): {
char riff_type[4];
- mp_msg(MSGT_HEADER, MSGL_V, MSGTR_MPDEMUX_AVIHDR_AdditionalRIFFHdr);
+ mp_tmsg(MSGT_HEADER, MSGL_V, "Additional RIFF header...\n");
stream_read(demuxer->stream, riff_type, sizeof riff_type);
if (strncmp(riff_type, "AVIX", sizeof riff_type))
- mp_msg(MSGT_HEADER, MSGL_WARN, MSGTR_MPDEMUX_AVIHDR_WarnNotExtendedAVIHdr);
+ mp_tmsg(MSGT_HEADER, MSGL_WARN, "** Warning: this is no extended AVI header..\n");
else {
/*
* We got an extended AVI header, so we need to switch to
@@ -454,7 +454,7 @@ while(1){
if(list_end>0 &&
chunksize+stream_tell(demuxer->stream) == list_end) list_end=0;
if(list_end>0 && chunksize+stream_tell(demuxer->stream)>list_end){
- mp_msg(MSGT_HEADER,MSGL_V,MSGTR_MPDEMUX_AVIHDR_BrokenChunk,chunksize,(char *) &id);
+ mp_tmsg(MSGT_HEADER,MSGL_V,"Broken chunk? chunksize=%d (id=%.4s)\n",chunksize,(char *) &id);
stream_seek(demuxer->stream,list_end);
list_end=0;
} else
@@ -482,7 +482,7 @@ if (priv->isodml && (index_mode==-1 || index_mode==0 || index_mode==1)) {
priv->idx_offset = 0;
priv->idx = NULL;
- mp_msg(MSGT_HEADER, MSGL_INFO, MSGTR_MPDEMUX_AVIHDR_BuildingODMLidx, priv->suidx_size);
+ mp_tmsg(MSGT_HEADER, MSGL_INFO, "AVI: ODML: Building ODML index (%d superindexchunks).\n", priv->suidx_size);
// read the standard indices
for (cx = &priv->suidx[0], i=0; i<priv->suidx_size; cx++, i++) {
@@ -497,7 +497,7 @@ if (priv->isodml && (index_mode==-1 || index_mode==0 || index_mode==1)) {
// gen_index routine handle this
priv->isodml = 0;
priv->idx_size = 0;
- mp_msg(MSGT_HEADER, MSGL_WARN, MSGTR_MPDEMUX_AVIHDR_BrokenODMLfile);
+ mp_tmsg(MSGT_HEADER, MSGL_WARN, "AVI: ODML: Broken (incomplete?) file detected. Will use traditional index.\n");
goto freeout;
}
@@ -601,18 +601,18 @@ if (index_file_load) {
unsigned int i;
if ((fp = fopen(index_file_load, "r")) == NULL) {
- mp_msg(MSGT_HEADER,MSGL_ERR, MSGTR_MPDEMUX_AVIHDR_CantReadIdxFile, index_file_load, strerror(errno));
+ mp_tmsg(MSGT_HEADER,MSGL_ERR, "Can't read index file %s: %s\n", index_file_load, strerror(errno));
goto gen_index;
}
fread(&magic, 6, 1, fp);
if (strncmp(magic, "MPIDX1", 6)) {
- mp_msg(MSGT_HEADER,MSGL_ERR, MSGTR_MPDEMUX_AVIHDR_NotValidMPidxFile, index_file_load);
+ mp_tmsg(MSGT_HEADER,MSGL_ERR, "%s is not a valid MPlayer index file.\n", index_file_load);
goto gen_index;
}
fread(&priv->idx_size, sizeof(priv->idx_size), 1, fp);
priv->idx=malloc(priv->idx_size*sizeof(AVIINDEXENTRY));
if (!priv->idx) {
- mp_msg(MSGT_HEADER,MSGL_ERR, MSGTR_MPDEMUX_AVIHDR_FailedMallocForIdxFile, index_file_load);
+ mp_tmsg(MSGT_HEADER,MSGL_ERR, "Could not allocate memory for index data from %s.\n", index_file_load);
priv->idx_size = 0;
goto gen_index;
}
@@ -622,14 +622,14 @@ if (index_file_load) {
idx=&((AVIINDEXENTRY *)priv->idx)[i];
fread(idx, sizeof(AVIINDEXENTRY), 1, fp);
if (feof(fp)) {
- mp_msg(MSGT_HEADER,MSGL_ERR, MSGTR_MPDEMUX_AVIHDR_PrematureEOF, index_file_load);
+ mp_tmsg(MSGT_HEADER,MSGL_ERR, "premature end of index file %s\n", index_file_load);
free(priv->idx);
priv->idx_size = 0;
goto gen_index;
}
}
fclose(fp);
- mp_msg(MSGT_HEADER,MSGL_INFO, MSGTR_MPDEMUX_AVIHDR_IdxFileLoaded, index_file_load);
+ mp_tmsg(MSGT_HEADER,MSGL_INFO, "Loaded index file: %s\n", index_file_load);
}
gen_index:
if(index_mode>=2 || (priv->idx_size==0 && index_mode==1)){
@@ -696,7 +696,7 @@ if(index_mode>=2 || (priv->idx_size==0 && index_mode==1)){
}
if(pos!=lastpos){
lastpos=pos;
- mp_msg(MSGT_HEADER,MSGL_STATUS,MSGTR_MPDEMUX_AVIHDR_GeneratingIdx,
+ mp_tmsg(MSGT_HEADER,MSGL_STATUS, "Generating Index: %3lu %s \r",
(unsigned long)pos, len?"%":"MB");
}
}
@@ -715,7 +715,7 @@ skip_chunk:
stream_seek(demuxer->stream,8+demuxer->filepos+skip);
}
priv->idx_size=idx_pos;
- mp_msg(MSGT_HEADER,MSGL_INFO,MSGTR_MPDEMUX_AVIHDR_IdxGeneratedForHowManyChunks,priv->idx_size);
+ mp_tmsg(MSGT_HEADER,MSGL_INFO,"AVI: Generated index table for %d chunks!\n",priv->idx_size);
if( mp_msg_test(MSGT_HEADER,MSGL_DBG2) ) print_index(priv->idx,priv->idx_size,MSGL_DBG2);
/* Write generated index to a file */
@@ -724,7 +724,7 @@ skip_chunk:
unsigned int i;
if ((fp=fopen(index_file_save, "w")) == NULL) {
- mp_msg(MSGT_HEADER,MSGL_ERR, MSGTR_MPDEMUX_AVIHDR_Failed2WriteIdxFile, index_file_save, strerror(errno));
+ mp_tmsg(MSGT_HEADER,MSGL_ERR, "Couldn't write index file %s: %s\n", index_file_save, strerror(errno));
return;
}
fwrite("MPIDX1", 6, 1, fp);
@@ -734,8 +734,7 @@ skip_chunk:
fwrite(idx, sizeof(AVIINDEXENTRY), 1, fp);
}
fclose(fp);
- mp_msg(MSGT_HEADER,MSGL_INFO, MSGTR_MPDEMUX_AVIHDR_IdxFileSaved, index_file_save);
+ mp_tmsg(MSGT_HEADER,MSGL_INFO, "Saved index file: %s\n", index_file_save);
}
}
}
-
diff --git a/libmpdemux/aviprint.c b/libmpdemux/aviprint.c
index f12451a6b4..af90251424 100644
--- a/libmpdemux/aviprint.c
+++ b/libmpdemux/aviprint.c
@@ -188,4 +188,3 @@ void print_avisuperindex_chunk(avisuperindex_chunk *h, int verbose_level){
h->dwReserved[0], h->dwReserved[1], h->dwReserved[2]);
mp_msg (MSGT_HEADER, verbose_level, "===========================\n");
}
-
diff --git a/libmpdemux/demux_asf.c b/libmpdemux/demux_asf.c
index 30856486b4..4d7490e7f8 100644
--- a/libmpdemux/demux_asf.c
+++ b/libmpdemux/demux_asf.c
@@ -33,7 +33,7 @@
#include "demuxer.h"
#include "libvo/fastmemcpy.h"
-#include "libavutil/intreadwrite.h"
+#include "ffmpeg_files/intreadwrite.h"
// defined at asfheader.c:
@@ -642,7 +642,8 @@ static demuxer_t* demux_open_asf(demuxer_t* demuxer)
// demuxer->endpos=avi_header.movi_end;
if(demuxer->video->id != -2) {
if(!ds_fill_buffer(demuxer->video)){
- mp_msg(MSGT_DEMUXER,MSGL_WARN,"ASF: " MSGTR_MissingVideoStream);
+ mp_msg(MSGT_DEMUXER, MSGL_WARN, "ASF: %s",
+ mp_gtext("No video stream found.\n"));
demuxer->video->sh=NULL;
//printf("ASF: missing video stream!? contact the author, it may be a bug :(\n");
} else {
@@ -657,9 +658,10 @@ static demuxer_t* demux_open_asf(demuxer_t* demuxer)
}
if(demuxer->audio->id!=-2){
- mp_msg(MSGT_DEMUXER,MSGL_V,MSGTR_ASFSearchingForAudioStream,demuxer->audio->id);
+ mp_tmsg(MSGT_DEMUXER,MSGL_V,"ASF: Searching for audio stream (id:%d).\n",demuxer->audio->id);
if(!ds_fill_buffer(demuxer->audio)){
- mp_msg(MSGT_DEMUXER,MSGL_INFO,"ASF: " MSGTR_MissingAudioStream);
+ mp_msg(MSGT_DEMUXER, MSGL_INFO, "ASF: %s",
+ mp_gtext("No audio stream found -> no sound.\n"));
demuxer->audio->sh=NULL;
} else {
sh_audio=demuxer->audio->sh;sh_audio->ds=demuxer->audio;
diff --git a/libmpdemux/demux_audio.c b/libmpdemux/demux_audio.c
index 5b38fae206..43ee3113ce 100644
--- a/libmpdemux/demux_audio.c
+++ b/libmpdemux/demux_audio.c
@@ -27,7 +27,7 @@
#include "stheader.h"
#include "genres.h"
#include "mp3_hdr.h"
-#include "libavutil/intreadwrite.h"
+#include "ffmpeg_files/intreadwrite.h"
#include <string.h>
@@ -588,7 +588,7 @@ static int demux_audio_fill_buffer(demuxer_t *demux, demux_stream_t *ds) {
break;
}
default:
- mp_msg(MSGT_DEMUXER,MSGL_WARN,MSGTR_MPDEMUX_AUDIO_UnknownFormat,priv->frmt);
+ mp_tmsg(MSGT_DEMUXER,MSGL_WARN,"Audio demuxer: unknown format %d.\n",priv->frmt);
return 0;
}
diff --git a/libmpdemux/demux_avi.c b/libmpdemux/demux_avi.c
index 2024f8aa62..12b04b3e01 100644
--- a/libmpdemux/demux_avi.c
+++ b/libmpdemux/demux_avi.c
@@ -43,7 +43,9 @@ extern const demuxer_desc_t demuxer_desc_avi_nini;
int pts_from_bps=1;
// Select ds from ID
-demux_stream_t* demux_avi_select_stream(demuxer_t *demux,unsigned int id){
+static demux_stream_t* demux_avi_select_stream(demuxer_t *demux,
+ unsigned int id)
+{
int stream_id=avi_stream_id(id);
@@ -73,7 +75,7 @@ demux_stream_t* demux_avi_select_stream(demuxer_t *demux,unsigned int id){
// workaround old mencoder's bug:
if(sh->audio.dwSampleSize==1 && sh->audio.dwScale==1 &&
(sh->wf->nBlockAlign==1152 || sh->wf->nBlockAlign==576)){
- mp_msg(MSGT_DEMUX,MSGL_WARN,MSGTR_WorkAroundBlockAlignHeaderBug);
+ mp_tmsg(MSGT_DEMUX,MSGL_WARN,"AVI: Working around CBR-MP3 nBlockAlign header bug!\n");
priv->audio_block_size=1;
}
}
@@ -280,7 +282,7 @@ do{
if(ds)
if(ds->packs+1>=MAX_PACKS || ds->bytes+len>=MAX_PACK_BYTES){
// this packet will cause a buffer overflow, switch to -ni mode!!!
- mp_msg(MSGT_DEMUX,MSGL_WARN,MSGTR_SwitchToNi);
+ mp_tmsg(MSGT_DEMUX,MSGL_WARN,"\nBadly interleaved AVI file detected - switching to -ni mode...\n");
if(priv->idx_size>0){
// has index
demux->type=DEMUXER_TYPE_AVI_NI;
@@ -306,7 +308,7 @@ do{
// return value:
// 0 = EOF or no stream found
// 1 = successfully read a packet
-int demux_avi_fill_buffer_ni(demuxer_t *demux,demux_stream_t* ds){
+static int demux_avi_fill_buffer_ni(demuxer_t *demux,demux_stream_t* ds){
avi_priv_t *priv=demux->priv;
unsigned int id=0;
unsigned int len;
@@ -374,7 +376,7 @@ do{
// return value:
// 0 = EOF or no stream found
// 1 = successfully read a packet
-int demux_avi_fill_buffer_nini(demuxer_t *demux,demux_stream_t* ds){
+static int demux_avi_fill_buffer_nini(demuxer_t *demux,demux_stream_t* ds){
avi_priv_t *priv=demux->priv;
unsigned int id=0;
unsigned int len;
@@ -445,11 +447,11 @@ static demuxer_t* demux_open_avi(demuxer_t* demuxer){
read_avi_header(demuxer,(demuxer->stream->flags & MP_STREAM_SEEK_BW)?index_mode:-2);
if(demuxer->audio->id>=0 && !demuxer->a_streams[demuxer->audio->id]){
- mp_msg(MSGT_DEMUX,MSGL_WARN,MSGTR_InvalidAudioStreamNosound,demuxer->audio->id);
+ mp_tmsg(MSGT_DEMUX,MSGL_WARN,"AVI: invalid audio stream ID: %d - ignoring (nosound)\n",demuxer->audio->id);
demuxer->audio->id=-2; // disabled
}
if(demuxer->video->id>=0 && !demuxer->v_streams[demuxer->video->id]){
- mp_msg(MSGT_DEMUX,MSGL_WARN,MSGTR_InvalidAudioStreamUsingDefault,demuxer->video->id);
+ mp_tmsg(MSGT_DEMUX,MSGL_WARN,"AVI: invalid video stream ID: %d - ignoring (using default)\n",demuxer->video->id);
demuxer->video->id=-1; // autodetect
}
@@ -490,14 +492,15 @@ static demuxer_t* demux_open_avi(demuxer_t* demuxer){
}
}
if(v_pos==-1){
- mp_msg(MSGT_DEMUX,MSGL_ERR,"AVI_NI: " MSGTR_MissingVideoStream);
+ mp_msg(MSGT_DEMUX, MSGL_ERR, "AVI_NI: %s",
+ mp_gtext("No video stream found.\n"));
return NULL;
}
if(a_pos==-1){
d_audio->sh=sh_audio=NULL;
} else {
if(force_ni || abs(a_pos-v_pos)>0x100000){ // distance > 1MB
- mp_msg(MSGT_DEMUX,MSGL_INFO,MSGTR_NI_Message,force_ni?MSGTR_NI_Forced:MSGTR_NI_Detected);
+ mp_tmsg(MSGT_DEMUX,MSGL_INFO,"%s NON-INTERLEAVED AVI file format.\n",force_ni?"Forced":"Detected");
demuxer->type=DEMUXER_TYPE_AVI_NI; // HACK!!!!
demuxer->desc=&demuxer_desc_avi_ni; // HACK!!!!
pts_from_bps=1; // force BPS sync!
@@ -506,7 +509,7 @@ static demuxer_t* demux_open_avi(demuxer_t* demuxer){
} else {
// no index
if(force_ni){
- mp_msg(MSGT_DEMUX,MSGL_INFO,MSGTR_UsingNINI);
+ mp_tmsg(MSGT_DEMUX,MSGL_INFO,"Using NON-INTERLEAVED broken AVI file format.\n");
demuxer->type=DEMUXER_TYPE_AVI_NINI; // HACK!!!!
demuxer->desc=&demuxer_desc_avi_nini; // HACK!!!!
priv->idx_pos_a=
@@ -516,14 +519,17 @@ static demuxer_t* demux_open_avi(demuxer_t* demuxer){
demuxer->seekable=0;
}
if(!ds_fill_buffer(d_video)){
- mp_msg(MSGT_DEMUX,MSGL_ERR,"AVI: " MSGTR_MissingVideoStreamBug);
+ mp_msg(MSGT_DEMUX, MSGL_ERR, "AVI: %s",
+ mp_gtext("Missing video stream!? Contact the author, "
+ "it may be a bug :(\n"));
return NULL;
}
sh_video=d_video->sh;sh_video->ds=d_video;
if(d_audio->id!=-2){
mp_msg(MSGT_DEMUX,MSGL_V,"AVI: Searching for audio stream (id:%d)\n",d_audio->id);
if(!priv->audio_streams || !ds_fill_buffer(d_audio)){
- mp_msg(MSGT_DEMUX,MSGL_INFO,"AVI: " MSGTR_MissingAudioStream);
+ mp_msg(MSGT_DEMUX, MSGL_INFO, "AVI: %s",
+ mp_gtext("No audio stream found -> no sound.\n"));
d_audio->sh=sh_audio=NULL;
} else {
sh_audio=d_audio->sh;sh_audio->ds=d_audio;
@@ -563,7 +569,7 @@ static demuxer_t* demux_open_avi(demuxer_t* demuxer){
// bad video header, try to get number of frames from audio
if(sh_audio && sh_audio->wf->nAvgBytesPerSec) priv->numberofframes=sh_video->fps*sh_audio->audio.dwLength/sh_audio->audio.dwRate*sh_audio->audio.dwScale;
if(priv->numberofframes<=1){
- mp_msg(MSGT_SEEK,MSGL_WARN,MSGTR_CouldntDetFNo);
+ mp_tmsg(MSGT_SEEK,MSGL_WARN,"Could not determine number of frames (for absolute seek).\n");
priv->numberofframes=0;
}
@@ -585,7 +591,7 @@ static demuxer_t* demux_open_avi(demuxer_t* demuxer){
}
-void demux_seek_avi(demuxer_t *demuxer,float rel_seek_secs,float audio_delay,int flags){
+static void demux_seek_avi(demuxer_t *demuxer,float rel_seek_secs,float audio_delay,int flags){
avi_priv_t *priv=demuxer->priv;
demux_stream_t *d_audio=demuxer->audio;
demux_stream_t *d_video=demuxer->video;
@@ -758,7 +764,7 @@ void demux_seek_avi(demuxer_t *demuxer,float rel_seek_secs,float audio_delay,int
}
-void demux_close_avi(demuxer_t *demuxer) {
+static void demux_close_avi(demuxer_t *demuxer) {
avi_priv_t* priv=demuxer->priv;
if(!priv)
@@ -839,7 +845,7 @@ static int avi_check_file(demuxer_t *demuxer)
if(id==mmioFOURCC('A','V','I',0x19))
return DEMUXER_TYPE_AVI;
if(id==mmioFOURCC('O','N','2','f')){
- mp_msg(MSGT_DEMUXER,MSGL_INFO,MSGTR_ON2AviFormat);
+ mp_tmsg(MSGT_DEMUXER,MSGL_INFO,"ON2 AVI format");
return DEMUXER_TYPE_AVI;
}
}
@@ -850,6 +856,7 @@ static int avi_check_file(demuxer_t *demuxer)
static demuxer_t* demux_open_hack_avi(demuxer_t *demuxer)
{
+ struct MPOpts *opts = demuxer->opts;
sh_audio_t* sh_a;
demuxer = demux_open_avi(demuxer);
@@ -864,9 +871,9 @@ static demuxer_t* demux_open_hack_avi(demuxer_t *demuxer)
stream_t* s;
demuxer_t *od;
s = new_ds_stream(demuxer->audio);
- od = new_demuxer(s,DEMUXER_TYPE_OGG,-1,-2,-2,NULL);
+ od = new_demuxer(opts, s,DEMUXER_TYPE_OGG,-1,-2,-2,NULL);
if(!demux_ogg_open(od)) {
- mp_msg( MSGT_DEMUXER,MSGL_ERR,MSGTR_ErrorOpeningOGGDemuxer);
+ mp_tmsg( MSGT_DEMUXER,MSGL_ERR,"Unable to open the Ogg demuxer.\n");
free_stream(s);
demuxer->audio->id = -2;
} else
diff --git a/libmpdemux/demux_avs.c b/libmpdemux/demux_avs.c
index e52afea4dd..d8bdad6676 100644
--- a/libmpdemux/demux_avs.c
+++ b/libmpdemux/demux_avs.c
@@ -85,7 +85,7 @@ typedef struct tagAVS
imp_avs_get_audio avs_get_audio;
} AVS_T;
-AVS_T *initAVS(const char *filename)
+static AVS_T *initAVS(const char *filename)
{
AVS_T *AVS = malloc (sizeof(AVS_T));
AVS_Value arg0 = avs_new_value_string(filename);
diff --git a/libmpdemux/demux_demuxers.c b/libmpdemux/demux_demuxers.c
index 9c13ed7304..14a05d65a3 100644
--- a/libmpdemux/demux_demuxers.c
+++ b/libmpdemux/demux_demuxers.c
@@ -25,6 +25,7 @@
#include "stream/stream.h"
#include "demuxer.h"
#include "stheader.h"
+#include "talloc.h"
typedef struct dd_priv {
demuxer_t* vd;
@@ -38,7 +39,7 @@ demuxer_t* new_demuxers_demuxer(demuxer_t* vd, demuxer_t* ad, demuxer_t* sd) {
demuxer_t* ret;
dd_priv_t* priv;
- ret = calloc(1,sizeof(demuxer_t));
+ ret = talloc_zero(NULL, struct demuxer);
priv = malloc(sizeof(dd_priv_t));
priv->vd = vd;
@@ -90,7 +91,7 @@ static int demux_demuxers_fill_buffer(demuxer_t *demux,demux_stream_t *ds) {
else if(priv->sd && priv->sd->sub == ds)
return demux_fill_buffer(priv->sd,ds);
- mp_msg(MSGT_DEMUX,MSGL_WARN,MSGTR_MPDEMUX_DEMUXERS_FillBufferError);
+ mp_tmsg(MSGT_DEMUX,MSGL_WARN,"fill_buffer error: bad demuxer: not vd, ad or sd.\n");
return 0;
}
diff --git a/libmpdemux/demux_lavf.c b/libmpdemux/demux_lavf.c
index fe6aac4273..ad958889ed 100644
--- a/libmpdemux/demux_lavf.c
+++ b/libmpdemux/demux_lavf.c
@@ -22,8 +22,10 @@
#include <stdlib.h>
// #include <unistd.h>
#include <limits.h>
+#include <stdbool.h>
#include "config.h"
+#include "options.h"
#include "mp_msg.h"
#include "help_mp.h"
#include "av_opts.h"
@@ -43,9 +45,6 @@
#define PROBE_BUF_SIZE (32*1024)
-extern char *audio_lang;
-extern char *dvdsub_lang;
-extern int dvdsub_id;
static unsigned int opt_probesize = 0;
static unsigned int opt_analyzeduration = 0;
static char *opt_format;
@@ -223,8 +222,8 @@ static void handle_stream(demuxer_t *demuxer, AVFormatContext *avfc, int i) {
AVStream *st= avfc->streams[i];
AVCodecContext *codec= st->codec;
AVMetadataTag *lang = av_metadata_get(st->metadata, "language", NULL, 0);
- int g, override_tag = av_codec_get_tag(mp_codecid_override_taglists,
- codec->codec_id);
+ int g, override_tag = mp_av_codec_get_tag(mp_codecid_override_taglists,
+ codec->codec_id);
// For some formats (like PCM) always trust CODEC_ID_* more than codec_tag
if (override_tag)
codec->codec_tag = override_tag;
@@ -234,7 +233,7 @@ static void handle_stream(demuxer_t *demuxer, AVFormatContext *avfc, int i) {
WAVEFORMATEX *wf;
sh_audio_t* sh_audio;
sh_audio=new_sh_audio(demuxer, i);
- mp_msg(MSGT_DEMUX, MSGL_INFO, MSGTR_AudioID, "lavf", i);
+ mp_tmsg(MSGT_DEMUX, MSGL_INFO, "[%s] Audio stream found, -aid %d\n", "lavf", i);
if(!sh_audio)
break;
priv->astreams[priv->audio_streams] = i;
@@ -244,7 +243,7 @@ static void handle_stream(demuxer_t *demuxer, AVFormatContext *avfc, int i) {
if(codec->codec_tag == MKTAG('m', 'p', '4', 'a'))
codec->codec_tag= 0;
if(!codec->codec_tag)
- codec->codec_tag= av_codec_get_tag(mp_wav_taglists, codec->codec_id);
+ codec->codec_tag= mp_av_codec_get_tag(mp_wav_taglists, codec->codec_id);
wf->wFormatTag= codec->codec_tag;
wf->nChannels= codec->channels;
wf->nSamplesPerSec= codec->sample_rate;
@@ -309,7 +308,7 @@ static void handle_stream(demuxer_t *demuxer, AVFormatContext *avfc, int i) {
sh_video_t* sh_video;
BITMAPINFOHEADER *bih;
sh_video=new_sh_video(demuxer, i);
- mp_msg(MSGT_DEMUX, MSGL_INFO, MSGTR_VideoID, "lavf", i);
+ mp_tmsg(MSGT_DEMUX, MSGL_INFO, "[%s] Video stream found, -vid %d\n", "lavf", i);
if(!sh_video) break;
priv->vstreams[priv->video_streams] = i;
priv->video_streams++;
@@ -322,7 +321,7 @@ static void handle_stream(demuxer_t *demuxer, AVFormatContext *avfc, int i) {
}
}
if(!codec->codec_tag)
- codec->codec_tag= av_codec_get_tag(mp_bmp_taglists, codec->codec_id);
+ codec->codec_tag= mp_av_codec_get_tag(mp_bmp_taglists, codec->codec_id);
bih->biSize= sizeof(BITMAPINFOHEADER) + codec->extradata_size;
bih->biWidth= codec->width;
bih->biHeight= codec->height;
@@ -389,7 +388,7 @@ static void handle_stream(demuxer_t *demuxer, AVFormatContext *avfc, int i) {
else
break;
sh_sub = new_sh_sub_sid(demuxer, i, priv->sub_streams);
- mp_msg(MSGT_DEMUX, MSGL_INFO, MSGTR_SubtitleID, "lavf", priv->sub_streams);
+ mp_tmsg(MSGT_DEMUX, MSGL_INFO, "[%s] Subtitle stream found, -sid %d\n", "lavf", priv->sub_streams);
if(!sh_sub) break;
priv->sstreams[priv->sub_streams] = i;
sh_sub->type = type;
@@ -409,8 +408,8 @@ static void handle_stream(demuxer_t *demuxer, AVFormatContext *avfc, int i) {
}
case CODEC_TYPE_ATTACHMENT:{
if (st->codec->codec_id == CODEC_ID_TTF)
- demuxer_add_attachment(demuxer, st->filename,
- "application/x-truetype-font",
+ demuxer_add_attachment(demuxer, st->filename, INT_MAX,
+ "application/x-truetype-font", INT_MAX,
codec->extradata, codec->extradata_size);
break;
}
@@ -420,6 +419,7 @@ static void handle_stream(demuxer_t *demuxer, AVFormatContext *avfc, int i) {
}
static demuxer_t* demux_open_lavf(demuxer_t *demuxer){
+ struct MPOpts *opts = demuxer->opts;
AVFormatContext *avfc;
AVFormatParameters ap;
const AVOption *opt;
@@ -436,7 +436,7 @@ static demuxer_t* demux_open_lavf(demuxer_t *demuxer){
if (opt_cryptokey)
parse_cryptokey(avfc, opt_cryptokey);
- if (user_correct_pts != 0)
+ if (opts->user_correct_pts != 0)
avfc->flags |= AVFMT_FLAG_GENPTS;
if (index_mode == 0)
avfc->flags |= AVFMT_FLAG_IGNIDX;
@@ -489,7 +489,7 @@ static demuxer_t* demux_open_lavf(demuxer_t *demuxer){
uint64_t start = av_rescale_q(c->start, c->time_base, (AVRational){1,1000});
uint64_t end = av_rescale_q(c->end, c->time_base, (AVRational){1,1000});
t = av_metadata_get(c->metadata, "title", NULL, 0);
- demuxer_add_chapter(demuxer, t ? t->value : NULL, start, end);
+ demuxer_add_chapter(demuxer, t ? t->value : NULL, INT_MAX, start, end);
}
for(i=0; i<avfc->nb_streams; i++)
@@ -515,6 +515,8 @@ static demuxer_t* demux_open_lavf(demuxer_t *demuxer){
demuxer->video->id=-2; // audio-only
} //else if (best_video > 0 && demuxer->video->id == -1) demuxer->video->id = best_video;
+ demuxer->accurate_seek = true;
+
return demuxer;
}
@@ -590,10 +592,14 @@ static void demux_seek_lavf(demuxer_t *demuxer, float rel_seek_secs, float audio
mp_msg(MSGT_DEMUX,MSGL_DBG2,"demux_seek_lavf(%p, %f, %f, %d)\n", demuxer, rel_seek_secs, audio_delay, flags);
if (flags & SEEK_ABSOLUTE) {
- priv->last_pts = priv->avfc->start_time;
+ priv->last_pts = 0;
} else {
if (rel_seek_secs < 0) avsflags = AVSEEK_FLAG_BACKWARD;
}
+ if (flags & SEEK_FORWARD)
+ avsflags = 0;
+ else if (flags & SEEK_BACKWARD)
+ avsflags = AVSEEK_FLAG_BACKWARD;
if (flags & SEEK_FACTOR) {
if (priv->avfc->duration == 0 || priv->avfc->duration == AV_NOPTS_VALUE)
return;
@@ -613,9 +619,6 @@ static int demux_lavf_control(demuxer_t *demuxer, int cmd, void *arg)
switch (cmd) {
case DEMUXER_CTRL_CORRECT_PTS:
- if (!strcmp("matroska", priv->avif->name) ||
- !strcmp("mpegts", priv->avif->name))
- return DEMUXER_CTRL_NOTIMPL;
return DEMUXER_CTRL_OK;
case DEMUXER_CTRL_GET_TIME_LENGTH:
if (priv->avfc->duration == 0 || priv->avfc->duration == AV_NOPTS_VALUE)
diff --git a/libmpdemux/demux_lmlm4.c b/libmpdemux/demux_lmlm4.c
index 9657db2f1a..e221a5b893 100644
--- a/libmpdemux/demux_lmlm4.c
+++ b/libmpdemux/demux_lmlm4.c
@@ -344,14 +344,16 @@ static demuxer_t* demux_open_lmlm4(demuxer_t* demuxer){
demuxer->seekable = 0;
if(!ds_fill_buffer(demuxer->video)){
- mp_msg(MSGT_DEMUXER,MSGL_INFO,"LMLM4: " MSGTR_MissingVideoStream);
+ mp_msg(MSGT_DEMUXER, MSGL_INFO, "LMLM4: %s",
+ mp_gtext("No video stream found.\n"));
demuxer->video->sh=NULL;
} else {
sh_video=demuxer->video->sh;sh_video->ds=demuxer->video;
}
if(demuxer->audio->id!=-2) {
if(!ds_fill_buffer(demuxer->audio)){
- mp_msg(MSGT_DEMUXER,MSGL_INFO,"LMLM4: " MSGTR_MissingAudioStream);
+ mp_msg(MSGT_DEMUXER, MSGL_INFO, "LMLM4: %s",
+ mp_gtext("No audio stream found -> no sound.\n"));
demuxer->audio->sh=NULL;
} else {
sh_audio=demuxer->audio->sh;sh_audio->ds=demuxer->audio;
diff --git a/libmpdemux/demux_mkv.c b/libmpdemux/demux_mkv.c
index d2ee9be643..67e26a0730 100644
--- a/libmpdemux/demux_mkv.c
+++ b/libmpdemux/demux_mkv.c
@@ -27,7 +27,10 @@
#include <stdio.h>
#include <ctype.h>
#include <inttypes.h>
+#include <stdbool.h>
+#include "talloc.h"
+#include "options.h"
#include "stream/stream.h"
#include "demuxer.h"
#include "stheader.h"
@@ -41,7 +44,7 @@
#include "subreader.h"
#include "libvo/sub.h"
-#include "libass/ass_mp.h"
+#include "ass_mp.h"
#include "libavutil/common.h"
@@ -54,141 +57,143 @@
#endif
#include "libavutil/lzo.h"
-#include "libavutil/intreadwrite.h"
+#include "ffmpeg_files/intreadwrite.h"
#include "libavutil/avstring.h"
-static const unsigned char sipr_swaps[38][2]={
+static const unsigned char sipr_swaps[38][2] = {
{0,63},{1,22},{2,44},{3,90},{5,81},{7,31},{8,86},{9,58},{10,36},{12,68},
{13,39},{14,73},{15,53},{16,69},{17,57},{19,88},{20,34},{21,71},{24,46},
{25,94},{26,54},{28,75},{29,50},{32,70},{33,92},{35,74},{38,85},{40,56},
{42,87},{43,65},{45,59},{48,79},{49,93},{51,89},{55,95},{61,76},{67,83},
- {77,80} };
+ {77,80}
+};
// Map flavour to bytes per second
#define SIPR_FLAVORS 4
#define ATRC_FLAVORS 8
#define COOK_FLAVORS 34
-static const int sipr_fl2bps[SIPR_FLAVORS] = {813, 1062, 625, 2000};
+static const int sipr_fl2bps[SIPR_FLAVORS] = { 813, 1062, 625, 2000 };
static const int atrc_fl2bps[ATRC_FLAVORS] =
- {8269, 11714, 13092, 16538, 18260, 22050, 33075, 44100};
-static const int cook_fl2bps[COOK_FLAVORS] =
- { 1000, 1378, 2024, 2584, 4005, 5513, 8010, 4005, 750, 2498,
- 4048, 5513, 8010, 11973, 8010, 2584, 4005, 2067, 2584, 2584,
- 4005, 4005, 5513, 5513, 8010, 12059, 1550, 8010, 12059, 5513,
- 12016, 16408, 22911, 33506};
-
-typedef struct
-{
- uint32_t order, type, scope;
- uint32_t comp_algo;
- uint8_t *comp_settings;
- int comp_settings_len;
+ { 8269, 11714, 13092, 16538, 18260, 22050, 33075, 44100 };
+static const int cook_fl2bps[COOK_FLAVORS] = {
+ 1000, 1378, 2024, 2584, 4005, 5513, 8010, 4005, 750, 2498,
+ 4048, 5513, 8010, 11973, 8010, 2584, 4005, 2067, 2584, 2584,
+ 4005, 4005, 5513, 5513, 8010, 12059, 1550, 8010, 12059, 5513,
+ 12016, 16408, 22911, 33506
+};
+
+typedef struct mkv_content_encoding {
+ uint64_t order, type, scope;
+ uint64_t comp_algo;
+ uint8_t *comp_settings;
+ int comp_settings_len;
} mkv_content_encoding_t;
-typedef struct mkv_track
-{
- int tnum;
- char *name;
+typedef struct mkv_track {
+ int tnum;
+ char *name;
- char *codec_id;
- int ms_compat;
- char *language;
+ char *codec_id;
+ int ms_compat;
+ char *language;
- int type;
+ int type;
- uint32_t v_width, v_height, v_dwidth, v_dheight;
- float v_frate;
+ uint32_t v_width, v_height, v_dwidth, v_dheight;
+ double v_frate;
- uint32_t a_formattag;
- uint32_t a_channels, a_bps;
- float a_sfreq;
+ uint32_t a_formattag;
+ uint32_t a_channels, a_bps;
+ float a_sfreq;
- float default_duration;
+ double default_duration;
- int default_track;
+ int default_track;
- void *private_data;
- unsigned int private_size;
+ unsigned char *private_data;
+ unsigned int private_size;
- /* stuff for realmedia */
- int realmedia;
- int64_t rv_kf_base;
- int rv_kf_pts;
- float rv_pts; /* previous video timestamp */
- float ra_pts; /* previous audio timestamp */
+ /* stuff for realmedia */
+ int realmedia;
+ int64_t rv_kf_base;
+ int rv_kf_pts;
+ double rv_pts; /* previous video timestamp */
+ double ra_pts; /* previous audio timestamp */
/** realaudio descrambling */
- int sub_packet_size; ///< sub packet size, per stream
- int sub_packet_h; ///< number of coded frames per block
- int coded_framesize; ///< coded frame size, per stream
- int audiopk_size; ///< audio packet size
- unsigned char *audio_buf; ///< place to store reordered audio data
- float *audio_timestamp; ///< timestamp for each audio packet
- int sub_packet_cnt; ///< number of subpacket already received
- int audio_filepos; ///< file position of first audio packet in block
-
- /* stuff for quicktime */
- int fix_i_bps;
- float qt_last_a_pts;
-
- int subtitle_type;
-
- /* The timecodes of video frames might have to be reordered if they're
- in display order (the timecodes, not the frames themselves!). In this
- case demux packets have to be cached with the help of these variables. */
- int reorder_timecodes;
- demux_packet_t **cached_dps;
- int num_cached_dps, num_allocated_dps;
- float max_pts;
-
- /* generic content encoding support */
- mkv_content_encoding_t *encodings;
- int num_encodings;
-
- /* For VobSubs and SSA/ASS */
- sh_sub_t *sh_sub;
+ int sub_packet_size; ///< sub packet size, per stream
+ int sub_packet_h; ///< number of coded frames per block
+ int coded_framesize; ///< coded frame size, per stream
+ int audiopk_size; ///< audio packet size
+ unsigned char *audio_buf; ///< place to store reordered audio data
+ double *audio_timestamp; ///< timestamp for each audio packet
+ int sub_packet_cnt; ///< number of subpacket already received
+ int audio_filepos; ///< file position of first audio packet in block
+
+ /* stuff for quicktime */
+ int fix_i_bps;
+ double qt_last_a_pts;
+
+ int subtitle_type;
+
+ /* The timecodes of video frames might have to be reordered if they're
+ in display order (the timecodes, not the frames themselves!). In this
+ case demux packets have to be cached with the help of these variables. */
+ int reorder_timecodes;
+ demux_packet_t **cached_dps;
+ int num_cached_dps, num_allocated_dps;
+ double max_pts;
+
+ /* generic content encoding support */
+ mkv_content_encoding_t *encodings;
+ int num_encodings;
+
+ /* For VobSubs and SSA/ASS */
+ sh_sub_t *sh_sub;
} mkv_track_t;
-typedef struct mkv_index
-{
- int tnum;
- uint64_t timecode, filepos;
+typedef struct mkv_index {
+ int tnum;
+ uint64_t timecode, filepos;
} mkv_index_t;
-typedef struct mkv_demuxer
-{
- off_t segment_start;
+typedef struct mkv_demuxer {
+ off_t segment_start;
- float duration, last_pts;
- uint64_t last_filepos;
+ double duration, last_pts;
+ uint64_t last_filepos;
- mkv_track_t **tracks;
- int num_tracks;
+ mkv_track_t **tracks;
+ int num_tracks;
- uint64_t tc_scale, cluster_tc, first_tc;
- int has_first_tc;
+ uint64_t tc_scale, cluster_tc;
- uint64_t cluster_size;
- uint64_t blockgroup_size;
+ uint64_t cluster_start;
+ uint64_t cluster_size;
+ uint64_t blockgroup_size;
- mkv_index_t *indexes;
- int num_indexes;
+ mkv_index_t *indexes;
+ int num_indexes;
- off_t *parsed_cues;
- int parsed_cues_num;
- off_t *parsed_seekhead;
- int parsed_seekhead_num;
+ off_t *parsed_pos;
+ int num_parsed_pos;
+ bool parsed_info;
+ bool parsed_tracks;
+ bool parsed_tags;
+ bool parsed_chapters;
+ bool parsed_attachments;
- uint64_t *cluster_positions;
- int num_cluster_pos;
+ struct cluster_pos {
+ uint64_t filepos;
+ uint64_t timecode;
+ } *cluster_positions;
+ int num_cluster_pos;
- int64_t skip_to_timecode;
- int v_skip_to_keyframe, a_skip_to_keyframe;
+ int64_t skip_to_timecode;
+ int v_skip_to_keyframe, a_skip_to_keyframe;
- int64_t stop_timecode;
-
- int last_aid;
- int audio_tracks[MAX_A_STREAMS];
+ int last_aid;
+ int audio_tracks[MAX_A_STREAMS];
} mkv_demuxer_t;
#define REALHEADER_SIZE 16
@@ -196,70 +201,86 @@ typedef struct mkv_demuxer
#define RAPROPERTIES4_SIZE 56
#define RAPROPERTIES5_SIZE 70
-/* for e.g. "-slang ger" */
-extern char *dvdsub_lang;
-extern char *audio_lang;
-extern int dvdsub_id;
-
/**
* \brief ensures there is space for at least one additional element
- * \param arrayp array to grow
+ * \param array array to grow
* \param nelem current number of elements in array
* \param elsize size of one array element
*/
-static void av_noinline grow_array(void *arrayp, int nelem, size_t elsize) {
- void **array = arrayp;
- void *oldp = *array;
- if (nelem & 31)
- return;
- if (nelem > UINT_MAX / elsize - 32)
- *array = NULL;
- else
- *array = realloc(*array, (nelem + 32) * elsize);
- if (!*array)
- free(oldp);
+static void *grow_array(void *array, int nelem, size_t elsize)
+{
+ if (!(nelem & 31))
+ array = realloc(array, (nelem + 32) * elsize);
+ return array;
}
-static mkv_track_t *
-demux_mkv_find_track_by_num (mkv_demuxer_t *d, int n, int type)
+static bool is_parsed_header(struct mkv_demuxer *mkv_d, off_t pos)
{
- int i, id;
+ int low = 0;
+ int high = mkv_d->num_parsed_pos;
+ while (high > low + 1) {
+ int mid = high + low >> 1;
+ if (mkv_d->parsed_pos[mid] > pos)
+ high = mid;
+ else
+ low = mid;
+ }
+ if (mkv_d->num_parsed_pos && mkv_d->parsed_pos[low] == pos)
+ return true;
+ if (!(mkv_d->num_parsed_pos & 31))
+ mkv_d->parsed_pos = talloc_realloc(mkv_d, mkv_d->parsed_pos, off_t,
+ mkv_d->num_parsed_pos + 32);
+ mkv_d->num_parsed_pos++;
+ for (int i = mkv_d->num_parsed_pos - 1; i > low; i--)
+ mkv_d->parsed_pos[i] = mkv_d->parsed_pos[i - 1];
+ mkv_d->parsed_pos[low] = pos;
+ return false;
+}
- for (i=0, id=0; i < d->num_tracks; i++)
- if (d->tracks[i] != NULL && d->tracks[i]->type == type)
- if (id++ == n)
- return d->tracks[i];
+static mkv_track_t *demux_mkv_find_track_by_num(mkv_demuxer_t *d, int n,
+ int type)
+{
+ int i, id;
- return NULL;
+ for (i = 0, id = 0; i < d->num_tracks; i++)
+ if (d->tracks[i] != NULL && d->tracks[i]->type == type)
+ if (id++ == n)
+ return d->tracks[i];
+
+ return NULL;
}
-static void
-add_cluster_position (mkv_demuxer_t *mkv_d, uint64_t position)
+static void add_cluster_position(mkv_demuxer_t *mkv_d, uint64_t filepos,
+ uint64_t timecode)
{
- int i = mkv_d->num_cluster_pos;
-
- while (i--)
- if (mkv_d->cluster_positions[i] == position)
- return;
-
- grow_array(&mkv_d->cluster_positions, mkv_d->num_cluster_pos,
- sizeof(uint64_t));
- if (!mkv_d->cluster_positions) {
- mkv_d->num_cluster_pos = 0;
- return;
- }
- mkv_d->cluster_positions[mkv_d->num_cluster_pos++] = position;
+ if (mkv_d->indexes)
+ return;
+
+ int n = mkv_d->num_cluster_pos;
+ if (n > 0 && mkv_d->cluster_positions[n-1].filepos >= filepos)
+ return;
+
+ mkv_d->cluster_positions =
+ grow_array(mkv_d->cluster_positions, mkv_d->num_cluster_pos,
+ sizeof(*mkv_d->cluster_positions));
+ mkv_d->cluster_positions[mkv_d->num_cluster_pos++] = (struct cluster_pos){
+ .filepos = filepos,
+ .timecode = timecode,
+ };
}
#define AAC_SYNC_EXTENSION_TYPE 0x02b7
-static int
-aac_get_sample_rate_index (uint32_t sample_rate)
+static int aac_get_sample_rate_index(uint32_t sample_rate)
{
- static const int srates[] = {92017, 75132, 55426, 46009, 37566, 27713, 23004, 18783, 13856, 11502, 9391, 0};
- int i = 0;
- while (sample_rate < srates[i]) i++;
- return i;
+ static const int srates[] = {
+ 92017, 75132, 55426, 46009, 37566, 27713,
+ 23004, 18783, 13856, 11502, 9391, 0
+ };
+ int i = 0;
+ while (sample_rate < srates[i])
+ i++;
+ return i;
}
/** \brief Free cached demux packets
@@ -270,2252 +291,1736 @@ aac_get_sample_rate_index (uint32_t sample_rate)
*
* \param demuxer The demuxer for which the cache is to be freed.
*/
-static void
-free_cached_dps (demuxer_t *demuxer)
+static void free_cached_dps(demuxer_t *demuxer)
{
- mkv_demuxer_t *mkv_d = (mkv_demuxer_t *) demuxer->priv;
- mkv_track_t *track;
- int i, k;
-
- for (k = 0; k < mkv_d->num_tracks; k++)
- {
- track = mkv_d->tracks[k];
- for (i = 0; i < track->num_cached_dps; i++)
- free_demux_packet (track->cached_dps[i]);
- free(track->cached_dps);
- track->cached_dps = NULL;
- track->num_cached_dps = 0;
- track->num_allocated_dps = 0;
- track->max_pts = 0;
+ mkv_demuxer_t *mkv_d = (mkv_demuxer_t *) demuxer->priv;
+ mkv_track_t *track;
+ int i, k;
+
+ for (k = 0; k < mkv_d->num_tracks; k++) {
+ track = mkv_d->tracks[k];
+ for (i = 0; i < track->num_cached_dps; i++)
+ free_demux_packet(track->cached_dps[i]);
+ free(track->cached_dps);
+ track->cached_dps = NULL;
+ track->num_cached_dps = 0;
+ track->num_allocated_dps = 0;
+ track->max_pts = 0;
}
}
-static int
-demux_mkv_decode (mkv_track_t *track, uint8_t *src, uint8_t **dest,
- uint32_t *size, uint32_t type)
+static void demux_mkv_decode(mkv_track_t *track, uint8_t *src,
+ uint8_t **dest, uint32_t *size, uint32_t type)
{
- int i, result;
- int modified = 0;
+ uint8_t *orig_src = src;
- *dest = src;
- if (track->num_encodings <= 0)
- return 0;
+ *dest = src;
- for (i=0; i<track->num_encodings; i++)
- {
- if (!(track->encodings[i].scope & type))
- continue;
+ for (int i = 0; i < track->num_encodings; i++) {
+ struct mkv_content_encoding *enc = track->encodings + i;
+ if (!(enc->scope & type))
+ continue;
+ if (src != *dest && src != orig_src)
+ free(src);
+ src = *dest; // output from last iteration is new source
+
+ if (enc->comp_algo == 0) {
#if CONFIG_ZLIB
- if (track->encodings[i].comp_algo == 0)
- {
- /* zlib encoded track */
- z_stream zstream;
-
- zstream.zalloc = (alloc_func) 0;
- zstream.zfree = (free_func) 0;
- zstream.opaque = (voidpf) 0;
- if (inflateInit (&zstream) != Z_OK)
- {
- mp_msg (MSGT_DEMUX, MSGL_WARN,
- MSGTR_MPDEMUX_MKV_ZlibInitializationFailed);
- return modified;
+ /* zlib encoded track */
+
+ if (*size == 0)
+ continue;
+
+ z_stream zstream;
+
+ zstream.zalloc = (alloc_func) 0;
+ zstream.zfree = (free_func) 0;
+ zstream.opaque = (voidpf) 0;
+ if (inflateInit(&zstream) != Z_OK) {
+ mp_tmsg(MSGT_DEMUX, MSGL_WARN,
+ "[mkv] zlib initialization failed.\n");
+ goto error;
}
- zstream.next_in = (Bytef *) src;
- zstream.avail_in = *size;
-
- modified = 1;
- *dest = NULL;
- zstream.avail_out = *size;
- do {
- *size += 4000;
- *dest = realloc (*dest, *size);
- zstream.next_out = (Bytef *) (*dest + zstream.total_out);
- result = inflate (&zstream, Z_NO_FLUSH);
- if (result != Z_OK && result != Z_STREAM_END)
- {
- mp_msg (MSGT_DEMUX, MSGL_WARN,
- MSGTR_MPDEMUX_MKV_ZlibDecompressionFailed);
- free(*dest);
- *dest = NULL;
- inflateEnd (&zstream);
- return modified;
- }
- zstream.avail_out += 4000;
- } while (zstream.avail_out == 4000 &&
- zstream.avail_in != 0 && result != Z_STREAM_END);
-
- *size = zstream.total_out;
- inflateEnd (&zstream);
- }
+ zstream.next_in = (Bytef *) src;
+ zstream.avail_in = *size;
+
+ *dest = NULL;
+ zstream.avail_out = *size;
+ int result;
+ do {
+ *size += 4000;
+ *dest = realloc(*dest, *size);
+ zstream.next_out = (Bytef *) (*dest + zstream.total_out);
+ result = inflate(&zstream, Z_NO_FLUSH);
+ if (result != Z_OK && result != Z_STREAM_END) {
+ mp_tmsg(MSGT_DEMUX, MSGL_WARN,
+ "[mkv] zlib decompression failed.\n");
+ free(*dest);
+ *dest = NULL;
+ inflateEnd(&zstream);
+ goto error;
+ }
+ zstream.avail_out += 4000;
+ } while (zstream.avail_out == 4000 && zstream.avail_in != 0
+ && result != Z_STREAM_END);
+
+ *size = zstream.total_out;
+ inflateEnd(&zstream);
#endif
- if (track->encodings[i].comp_algo == 2)
- {
- /* lzo encoded track */
- int dstlen = *size * 3;
-
- *dest = NULL;
- while (1)
- {
- int srclen = *size;
- if (dstlen > SIZE_MAX - AV_LZO_OUTPUT_PADDING) goto lzo_fail;
- *dest = realloc (*dest, dstlen + AV_LZO_OUTPUT_PADDING);
- result = av_lzo1x_decode (*dest, &dstlen, src, &srclen);
- if (result == 0)
- break;
- if (!(result & AV_LZO_OUTPUT_FULL))
- {
-lzo_fail:
- mp_msg (MSGT_DEMUX, MSGL_WARN,
- MSGTR_MPDEMUX_MKV_LzoDecompressionFailed);
- free(*dest);
- *dest = NULL;
- return modified;
+ } else if (enc->comp_algo == 2) {
+ /* lzo encoded track */
+ int dstlen = *size * 3;
+
+ *dest = NULL;
+ while (1) {
+ int srclen = *size;
+ if (dstlen > SIZE_MAX - AV_LZO_OUTPUT_PADDING)
+ goto lzo_fail;
+ *dest = realloc(*dest, dstlen + AV_LZO_OUTPUT_PADDING);
+ int result = av_lzo1x_decode(*dest, &dstlen, src, &srclen);
+ if (result == 0)
+ break;
+ if (!(result & AV_LZO_OUTPUT_FULL)) {
+ lzo_fail:
+ mp_tmsg(MSGT_DEMUX, MSGL_WARN,
+ "[mkv] lzo decompression failed.\n");
+ free(*dest);
+ *dest = NULL;
+ goto error;
}
- mp_msg (MSGT_DEMUX, MSGL_DBG2,
- "[mkv] lzo decompression buffer too small.\n");
- dstlen *= 2;
+ mp_msg(MSGT_DEMUX, MSGL_DBG2,
+ "[mkv] lzo decompression buffer too small.\n");
+ dstlen *= 2;
}
- *size = dstlen;
+ *size = dstlen;
+ } else if (enc->comp_algo == 3) {
+ *dest = malloc(*size + enc->comp_settings_len);
+ memcpy(*dest, enc->comp_settings, enc->comp_settings_len);
+ memcpy(*dest + enc->comp_settings_len, src, *size);
+ *size += enc->comp_settings_len;
}
}
- return modified;
+ error:
+ if (src != *dest && src != orig_src)
+ free(src);
}
-static int
-demux_mkv_read_info (demuxer_t *demuxer)
+static int demux_mkv_read_info(demuxer_t *demuxer)
{
- mkv_demuxer_t *mkv_d = (mkv_demuxer_t *) demuxer->priv;
- stream_t *s = demuxer->stream;
- uint64_t length, l;
- int il;
- uint64_t tc_scale = 1000000;
- long double duration = 0.;
-
- length = ebml_read_length (s, NULL);
- while (length > 0)
- {
- switch (ebml_read_id (s, &il))
- {
- case MATROSKA_ID_TIMECODESCALE:
- {
- uint64_t num = ebml_read_uint (s, &l);
- if (num == EBML_UINT_INVALID)
- return 1;
- tc_scale = num;
- mp_msg (MSGT_DEMUX, MSGL_V, "[mkv] | + timecode scale: %"PRIu64"\n",
- tc_scale);
- break;
- }
-
- case MATROSKA_ID_DURATION:
- {
- long double num = ebml_read_float (s, &l);
- if (num == EBML_FLOAT_INVALID)
- return 1;
- duration = num;
- mp_msg (MSGT_DEMUX, MSGL_V, "[mkv] | + duration: %.3Lfs\n",
- duration * tc_scale / 1000000000.0);
- break;
- }
+ mkv_demuxer_t *mkv_d = demuxer->priv;
+ stream_t *s = demuxer->stream;
- default:
- ebml_read_skip (s, &l);
- break;
+ mkv_d->tc_scale = 1000000;
+ mkv_d->duration = 0;
+
+ struct ebml_info info = {};
+ struct ebml_parse_ctx parse_ctx = {};
+ if (ebml_read_element(s, &parse_ctx, &info, &ebml_info_desc) < 0)
+ return 1;
+ if (info.n_timecode_scale) {
+ mkv_d->tc_scale = info.timecode_scale;
+ mp_msg(MSGT_DEMUX, MSGL_V,
+ "[mkv] | + timecode scale: %" PRIu64 "\n", mkv_d->tc_scale);
+ }
+ if (info.n_duration) {
+ mkv_d->duration = info.duration * mkv_d->tc_scale / 1e9;
+ mp_msg(MSGT_DEMUX, MSGL_V, "[mkv] | + duration: %.3fs\n",
+ mkv_d->duration);
+ }
+ if (info.n_segment_uid) {
+ int len = info.segment_uid.len;
+ if (len != sizeof(demuxer->matroska_data.segment_uid)) {
+ mp_msg(MSGT_DEMUX, MSGL_INFO,
+ "[mkv] segment uid invalid length %d\n", len);
+ } else {
+ memcpy(demuxer->matroska_data.segment_uid, info.segment_uid.start,
+ len);
+ mp_msg(MSGT_DEMUX, MSGL_V, "[mkv] | + segment uid");
+ for (int i = 0; i < len; i++)
+ mp_msg(MSGT_DEMUX, MSGL_V, " %02x",
+ demuxer->matroska_data.segment_uid[i]);
+ mp_msg(MSGT_DEMUX, MSGL_V, "\n");
}
- length -= l + il;
}
- mkv_d->tc_scale = tc_scale;
- mkv_d->duration = duration * tc_scale / 1000000000.0;
- return 0;
-}
-
-/**
- * \brief free array of kv_content_encoding_t
- * \param encodings pointer to array
- * \param numencodings number of encodings in array
- */
-static void
-demux_mkv_free_encodings(mkv_content_encoding_t *encodings, int numencodings)
-{
- while (numencodings-- > 0)
- free(encodings[numencodings].comp_settings);
- free(encodings);
+ talloc_free(parse_ctx.talloc_ctx);
+ return 0;
}
-static int
-demux_mkv_read_trackencodings (demuxer_t *demuxer, mkv_track_t *track)
+static void parse_trackencodings(struct demuxer *demuxer,
+ struct mkv_track *track,
+ struct ebml_content_encodings *encodings)
{
- stream_t *s = demuxer->stream;
- mkv_content_encoding_t *ce, e;
- uint64_t len, length, l;
- int il, n;
-
- ce = malloc (sizeof (*ce));
- n = 0;
-
- len = length = ebml_read_length (s, &il);
- len += il;
- while (length > 0)
- {
- switch (ebml_read_id (s, &il))
- {
- case MATROSKA_ID_CONTENTENCODING:
- {
- uint64_t len;
- int i;
-
- memset (&e, 0, sizeof (e));
+ // initial allocation to be a non-NULL context before realloc
+ mkv_content_encoding_t *ce = talloc_size(track, 1);
+
+ for (int n_enc = 0; n_enc < encodings->n_content_encoding; n_enc++) {
+ struct ebml_content_encoding *enc = encodings->content_encoding + n_enc;
+ struct mkv_content_encoding e = {};
+ e.order = enc->content_encoding_order;
+ if (enc->n_content_encoding_scope)
+ e.scope = enc->content_encoding_scope;
+ else
e.scope = 1;
+ e.type = enc->content_encoding_type;
+
+ if (enc->n_content_compression) {
+ struct ebml_content_compression *z = &enc->content_compression;
+ e.comp_algo = z->content_comp_algo;
+ if (z->n_content_comp_settings) {
+ int sz = z->content_comp_settings.len;
+ e.comp_settings = talloc_size(ce, sz);
+ memcpy(e.comp_settings, z->content_comp_settings.start, sz);
+ e.comp_settings_len = sz;
+ }
+ }
- len = ebml_read_length (s, &i);
- l = len + i;
-
- while (len > 0)
- {
- uint64_t num, l;
- int il;
-
- switch (ebml_read_id (s, &il))
- {
- case MATROSKA_ID_CONTENTENCODINGORDER:
- num = ebml_read_uint (s, &l);
- if (num == EBML_UINT_INVALID)
- goto err_out;
- e.order = num;
- break;
-
- case MATROSKA_ID_CONTENTENCODINGSCOPE:
- num = ebml_read_uint (s, &l);
- if (num == EBML_UINT_INVALID)
- goto err_out;
- e.scope = num;
- break;
-
- case MATROSKA_ID_CONTENTENCODINGTYPE:
- num = ebml_read_uint (s, &l);
- if (num == EBML_UINT_INVALID)
- goto err_out;
- e.type = num;
- break;
-
- case MATROSKA_ID_CONTENTCOMPRESSION:
- {
- uint64_t le;
-
- le = ebml_read_length (s, &i);
- l = le + i;
-
- while (le > 0)
- {
- uint64_t l;
- int il;
-
- switch (ebml_read_id (s, &il))
- {
- case MATROSKA_ID_CONTENTCOMPALGO:
- num = ebml_read_uint (s, &l);
- if (num == EBML_UINT_INVALID)
- goto err_out;
- e.comp_algo = num;
- break;
-
- case MATROSKA_ID_CONTENTCOMPSETTINGS:
- l = ebml_read_length (s, &i);
- e.comp_settings = malloc (l);
- stream_read (s, e.comp_settings, l);
- e.comp_settings_len = l;
- l += i;
- break;
-
- default:
- ebml_read_skip (s, &l);
- break;
- }
- le -= l + il;
- }
-
- if (e.type == 1)
- {
- mp_msg(MSGT_DEMUX, MSGL_WARN,
- MSGTR_MPDEMUX_MKV_TrackEncrypted, track->tnum);
- }
- else if (e.type != 0)
- {
- mp_msg(MSGT_DEMUX, MSGL_WARN,
- MSGTR_MPDEMUX_MKV_UnknownContentEncoding, track->tnum);
- }
-
- if (e.comp_algo != 0 && e.comp_algo != 2)
- {
- mp_msg (MSGT_DEMUX, MSGL_WARN,
- MSGTR_MPDEMUX_MKV_UnknownCompression,
- track->tnum, e.comp_algo);
- }
+ if (e.type == 1) {
+ mp_tmsg(MSGT_DEMUX, MSGL_WARN, "[mkv] Track "
+ "number %u has been encrypted and "
+ "decryption has not yet been\n"
+ "[mkv] implemented. Skipping track.\n",
+ track->tnum);
+ } else if (e.type != 0) {
+ mp_tmsg(MSGT_DEMUX, MSGL_WARN,
+ "[mkv] Unknown content encoding type for "
+ "track %u. Skipping track.\n",
+ track->tnum);
+ } else if (e.comp_algo != 0 && e.comp_algo != 2 && e.comp_algo != 3) {
+ mp_tmsg(MSGT_DEMUX, MSGL_WARN,
+ "[mkv] Track %u has been compressed with "
+ "an unknown/unsupported compression\n"
+ "[mkv] algorithm (%" PRIu64 "). Skipping track.\n",
+ track->tnum, e.comp_algo);
+ }
#if !CONFIG_ZLIB
- else if (e.comp_algo == 0)
- {
- mp_msg (MSGT_DEMUX, MSGL_WARN,
- MSGTR_MPDEMUX_MKV_ZlibCompressionUnsupported,
- track->tnum);
- }
+ else if (e.comp_algo == 0) {
+ mp_tmsg(MSGT_DEMUX, MSGL_WARN,
+ "[mkv] Track %u was compressed with zlib "
+ "but mplayer has not been compiled\n"
+ "[mkv] with support for zlib compression. "
+ "Skipping track.\n",
+ track->tnum);
+ }
#endif
-
- break;
- }
-
- default:
- ebml_read_skip (s, &l);
- break;
- }
- len -= l + il;
- }
- for (i=0; i<n; i++)
- if (e.order <= ce[i].order)
+ int i;
+ for (i = 0; i < n_enc; i++)
+ if (e.order >= ce[i].order)
break;
- ce = realloc (ce, (n+1) *sizeof (*ce));
- memmove (ce+i+1, ce+i, (n-i) * sizeof (*ce));
- memcpy (ce+i, &e, sizeof (e));
- n++;
- break;
- }
-
- default:
- ebml_read_skip (s, &l);
- break;
- }
-
- length -= l + il;
+ ce = talloc_realloc_size(track, ce, (n_enc + 1) * sizeof(*ce));
+ memmove(ce + i + 1, ce + i, (n_enc - i) * sizeof(*ce));
+ memcpy(ce + i, &e, sizeof(e));
}
- track->encodings = ce;
- track->num_encodings = n;
- return len;
-
-err_out:
- demux_mkv_free_encodings(ce, n);
- return 0;
+ track->encodings = ce;
+ track->num_encodings = encodings->n_content_encoding;
}
-static int
-demux_mkv_read_trackaudio (demuxer_t *demuxer, mkv_track_t *track)
+static void parse_trackaudio(struct demuxer *demuxer, struct mkv_track *track,
+ struct ebml_audio *audio)
{
- stream_t *s = demuxer->stream;
- uint64_t len, length, l;
- int il;
-
- track->a_sfreq = 8000.0;
- track->a_channels = 1;
-
- len = length = ebml_read_length (s, &il);
- len += il;
- while (length > 0)
- {
- switch (ebml_read_id (s, &il))
- {
- case MATROSKA_ID_AUDIOSAMPLINGFREQ:
- {
- long double num = ebml_read_float (s, &l);
- if (num == EBML_FLOAT_INVALID)
- return 0;
- track->a_sfreq = num;
- mp_msg (MSGT_DEMUX, MSGL_V, "[mkv] | + Sampling frequency: %f\n",
- track->a_sfreq);
- break;
- }
-
- case MATROSKA_ID_AUDIOBITDEPTH:
- {
- uint64_t num = ebml_read_uint (s, &l);
- if (num == EBML_UINT_INVALID)
- return 0;
- track->a_bps = num;
- mp_msg (MSGT_DEMUX, MSGL_V, "[mkv] | + Bit depth: %u\n",
- track->a_bps);
- break;
- }
-
- case MATROSKA_ID_AUDIOCHANNELS:
- {
- uint64_t num = ebml_read_uint (s, &l);
- if (num == EBML_UINT_INVALID)
- return 0;
- track->a_channels = num;
- mp_msg (MSGT_DEMUX, MSGL_V, "[mkv] | + Channels: %u\n",
- track->a_channels);
- break;
- }
-
- default:
- ebml_read_skip (s, &l);
- break;
- }
- length -= l + il;
+ if (audio->n_sampling_frequency) {
+ track->a_sfreq = audio->sampling_frequency;
+ mp_msg(MSGT_DEMUX, MSGL_V,
+ "[mkv] | + Sampling frequency: %f\n", track->a_sfreq);
+ } else
+ track->a_sfreq = 8000;
+ if (audio->n_bit_depth) {
+ track->a_bps = audio->bit_depth;
+ mp_msg(MSGT_DEMUX, MSGL_V, "[mkv] | + Bit depth: %u\n",
+ track->a_bps);
}
- return len;
+ if (audio->n_channels) {
+ track->a_channels = audio->channels;
+ mp_msg(MSGT_DEMUX, MSGL_V, "[mkv] | + Channels: %u\n",
+ track->a_channels);
+ } else
+ track->a_channels = 1;
}
-static int
-demux_mkv_read_trackvideo (demuxer_t *demuxer, mkv_track_t *track)
+static void parse_trackvideo(struct demuxer *demuxer, struct mkv_track *track,
+ struct ebml_video *video)
{
- stream_t *s = demuxer->stream;
- uint64_t len, length, l;
- int il;
-
- len = length = ebml_read_length (s, &il);
- len += il;
- while (length > 0)
- {
- switch (ebml_read_id (s, &il))
- {
- case MATROSKA_ID_VIDEOFRAMERATE:
- {
- long double num = ebml_read_float (s, &l);
- if (num == EBML_FLOAT_INVALID)
- return 0;
- track->v_frate = num;
- mp_msg (MSGT_DEMUX, MSGL_V, "[mkv] | + Frame rate: %f\n",
- track->v_frate);
- if (track->v_frate > 0)
- track->default_duration = 1 / track->v_frate;
- break;
- }
-
- case MATROSKA_ID_VIDEODISPLAYWIDTH:
- {
- uint64_t num = ebml_read_uint (s, &l);
- if (num == EBML_UINT_INVALID)
- return 0;
- track->v_dwidth = num;
- mp_msg (MSGT_DEMUX, MSGL_V, "[mkv] | + Display width: %u\n",
- track->v_dwidth);
- break;
- }
-
- case MATROSKA_ID_VIDEODISPLAYHEIGHT:
- {
- uint64_t num = ebml_read_uint (s, &l);
- if (num == EBML_UINT_INVALID)
- return 0;
- track->v_dheight = num;
- mp_msg (MSGT_DEMUX, MSGL_V, "[mkv] | + Display height: %u\n",
- track->v_dheight);
- break;
- }
-
- case MATROSKA_ID_VIDEOPIXELWIDTH:
- {
- uint64_t num = ebml_read_uint (s, &l);
- if (num == EBML_UINT_INVALID)
- return 0;
- track->v_width = num;
- mp_msg (MSGT_DEMUX, MSGL_V, "[mkv] | + Pixel width: %u\n",
- track->v_width);
- break;
- }
-
- case MATROSKA_ID_VIDEOPIXELHEIGHT:
- {
- uint64_t num = ebml_read_uint (s, &l);
- if (num == EBML_UINT_INVALID)
- return 0;
- track->v_height = num;
- mp_msg (MSGT_DEMUX, MSGL_V, "[mkv] | + Pixel height: %u\n",
- track->v_height);
- break;
- }
-
- default:
- ebml_read_skip (s, &l);
- break;
- }
- length -= l + il;
+ if (video->n_frame_rate) {
+ track->v_frate = video->frame_rate;
+ mp_msg(MSGT_DEMUX, MSGL_V, "[mkv] | + Frame rate: %f\n",
+ track->v_frate);
+ if (track->v_frate > 0)
+ track->default_duration = 1 / track->v_frate;
+ }
+ if (video->n_display_width) {
+ track->v_dwidth = video->display_width;
+ mp_msg(MSGT_DEMUX, MSGL_V, "[mkv] | + Display width: %u\n",
+ track->v_dwidth);
+ }
+ if (video->n_display_height) {
+ track->v_dheight = video->display_height;
+ mp_msg(MSGT_DEMUX, MSGL_V, "[mkv] | + Display height: %u\n",
+ track->v_dheight);
+ }
+ if (video->n_pixel_width) {
+ track->v_width = video->pixel_width;
+ mp_msg(MSGT_DEMUX, MSGL_V, "[mkv] | + Pixel width: %u\n",
+ track->v_width);
+ }
+ if (video->n_pixel_height) {
+ track->v_height = video->pixel_height;
+ mp_msg(MSGT_DEMUX, MSGL_V, "[mkv] | + Pixel height: %u\n",
+ track->v_height);
}
- return len;
}
/**
* \brief free any data associated with given track
* \param track track of which to free data
*/
-static void
-demux_mkv_free_trackentry(mkv_track_t *track) {
- free (track->name);
- free (track->codec_id);
- free (track->language);
- free (track->private_data);
- free (track->audio_buf);
- free (track->audio_timestamp);
- demux_mkv_free_encodings(track->encodings, track->num_encodings);
- free(track);
+static void demux_mkv_free_trackentry(mkv_track_t *track)
+{
+ free(track->audio_buf);
+ free(track->audio_timestamp);
+ talloc_free(track);
}
-static int
-demux_mkv_read_trackentry (demuxer_t *demuxer)
+static void parse_trackentry(struct demuxer *demuxer,
+ struct ebml_track_entry *entry)
{
- mkv_demuxer_t *mkv_d = (mkv_demuxer_t *) demuxer->priv;
- stream_t *s = demuxer->stream;
- mkv_track_t *track;
- uint64_t len, length, l;
- int il;
-
- track = calloc (1, sizeof (*track));
- /* set default values */
- track->default_track = 1;
- track->name = 0;
- track->language = strdup("eng");
-
- len = length = ebml_read_length (s, &il);
- len += il;
- while (length > 0)
- {
- switch (ebml_read_id (s, &il))
- {
- case MATROSKA_ID_TRACKNUMBER:
- {
- uint64_t num = ebml_read_uint (s, &l);
- if (num == EBML_UINT_INVALID)
- goto err_out;
- track->tnum = num;
- mp_msg (MSGT_DEMUX, MSGL_V, "[mkv] | + Track number: %u\n",
- track->tnum);
- break;
- }
-
- case MATROSKA_ID_TRACKNAME:
- {
- track->name = ebml_read_utf8 (s, &l);
- if (track->name == NULL)
- goto err_out;
- mp_msg (MSGT_DEMUX, MSGL_V, "[mkv] | + Name: %s\n",
- track->name);
- break;
- }
-
- case MATROSKA_ID_TRACKTYPE:
- {
- uint64_t num = ebml_read_uint (s, &l);
- if (num == EBML_UINT_INVALID)
- return 0;
- track->type = num;
- mp_msg (MSGT_DEMUX, MSGL_V, "[mkv] | + Track type: ");
- switch (track->type)
- {
- case MATROSKA_TRACK_AUDIO:
- mp_msg (MSGT_DEMUX, MSGL_V, "Audio\n");
- break;
- case MATROSKA_TRACK_VIDEO:
- mp_msg (MSGT_DEMUX, MSGL_V, "Video\n");
- break;
- case MATROSKA_TRACK_SUBTITLE:
- mp_msg (MSGT_DEMUX, MSGL_V, "Subtitle\n");
- break;
- default:
- mp_msg (MSGT_DEMUX, MSGL_V, "unknown\n");
- break;
- }
- break;
- }
-
- case MATROSKA_ID_TRACKAUDIO:
- mp_msg (MSGT_DEMUX, MSGL_V, "[mkv] | + Audio track\n");
- l = demux_mkv_read_trackaudio (demuxer, track);
- if (l == 0)
- goto err_out;
- break;
-
- case MATROSKA_ID_TRACKVIDEO:
- mp_msg (MSGT_DEMUX, MSGL_V, "[mkv] | + Video track\n");
- l = demux_mkv_read_trackvideo (demuxer, track);
- if (l == 0)
- goto err_out;
- break;
-
- case MATROSKA_ID_CODECID:
- track->codec_id = ebml_read_ascii (s, &l);
- if (track->codec_id == NULL)
- goto err_out;
- if (!strcmp (track->codec_id, MKV_V_MSCOMP) ||
- !strcmp (track->codec_id, MKV_A_ACM))
+ mkv_demuxer_t *mkv_d = (mkv_demuxer_t *) demuxer->priv;
+ struct mkv_track *track = talloc_zero_size(NULL, sizeof(*track));
+
+ track->tnum = entry->track_number;
+ if (track->tnum)
+ mp_msg(MSGT_DEMUX, MSGL_V, "[mkv] | + Track number: %u\n",
+ track->tnum);
+ else
+ mp_msg(MSGT_DEMUX, MSGL_ERR, "[mkv] Missing track number!\n");
+
+ if (entry->n_name) {
+ track->name = talloc_strndup(track, entry->name.start,
+ entry->name.len);
+ mp_msg(MSGT_DEMUX, MSGL_V, "[mkv] | + Name: %s\n",
+ track->name);
+ }
+
+ track->type = entry->track_type;
+ mp_msg(MSGT_DEMUX, MSGL_V, "[mkv] | + Track type: ");
+ switch (track->type) {
+ case MATROSKA_TRACK_AUDIO:
+ mp_msg(MSGT_DEMUX, MSGL_V, "Audio\n");
+ break;
+ case MATROSKA_TRACK_VIDEO:
+ mp_msg(MSGT_DEMUX, MSGL_V, "Video\n");
+ break;
+ case MATROSKA_TRACK_SUBTITLE:
+ mp_msg(MSGT_DEMUX, MSGL_V, "Subtitle\n");
+ break;
+ default:
+ mp_msg(MSGT_DEMUX, MSGL_V, "unknown\n");
+ break;
+ }
+
+ if (entry->n_audio) {
+ mp_msg(MSGT_DEMUX, MSGL_V, "[mkv] | + Audio track\n");
+ parse_trackaudio(demuxer, track, &entry->audio);
+ }
+
+ if (entry->n_video) {
+ mp_msg(MSGT_DEMUX, MSGL_V, "[mkv] | + Video track\n");
+ parse_trackvideo(demuxer, track, &entry->video);
+ }
+
+ if (entry->n_codec_id) {
+ track->codec_id = talloc_strndup(track, entry->codec_id.start,
+ entry->codec_id.len);
+ if (!strcmp(track->codec_id, MKV_V_MSCOMP)
+ || !strcmp(track->codec_id, MKV_A_ACM))
track->ms_compat = 1;
- else if (!strcmp (track->codec_id, MKV_S_VOBSUB))
+ else if (!strcmp(track->codec_id, MKV_S_VOBSUB))
track->subtitle_type = MATROSKA_SUBTYPE_VOBSUB;
- else if (!strcmp (track->codec_id, MKV_S_TEXTSSA)
- || !strcmp (track->codec_id, MKV_S_TEXTASS)
- || !strcmp (track->codec_id, MKV_S_SSA)
- || !strcmp (track->codec_id, MKV_S_ASS))
- {
- track->subtitle_type = MATROSKA_SUBTYPE_SSA;
- }
- else if (!strcmp (track->codec_id, MKV_S_TEXTASCII))
+ else if (!strcmp(track->codec_id, MKV_S_TEXTSSA)
+ || !strcmp(track->codec_id, MKV_S_TEXTASS)
+ || !strcmp(track->codec_id, MKV_S_SSA)
+ || !strcmp(track->codec_id, MKV_S_ASS)) {
+ track->subtitle_type = MATROSKA_SUBTYPE_SSA;
+ } else if (!strcmp(track->codec_id, MKV_S_TEXTASCII))
track->subtitle_type = MATROSKA_SUBTYPE_TEXT;
- if (!strcmp (track->codec_id, MKV_S_TEXTUTF8))
- {
- track->subtitle_type = MATROSKA_SUBTYPE_TEXT;
- }
- mp_msg (MSGT_DEMUX, MSGL_V, "[mkv] | + Codec ID: %s\n",
- track->codec_id);
- break;
-
- case MATROSKA_ID_CODECPRIVATE:
- {
- int x;
- uint64_t num = ebml_read_length (s, &x);
- // audit: cheap guard against overflows later..
- if (num > SIZE_MAX - 1000) return 0;
- l = x + num;
- track->private_data = malloc (num + AV_LZO_INPUT_PADDING);
- if (stream_read(s, track->private_data, num) != (int) num)
- goto err_out;
- track->private_size = num;
- mp_msg (MSGT_DEMUX, MSGL_V, "[mkv] | + CodecPrivate, length "
- "%u\n", track->private_size);
- break;
- }
-
- case MATROSKA_ID_TRACKLANGUAGE:
- free(track->language);
- track->language = ebml_read_utf8 (s, &l);
- if (track->language == NULL)
- goto err_out;
- mp_msg (MSGT_DEMUX, MSGL_V, "[mkv] | + Language: %s\n",
- track->language);
- break;
-
- case MATROSKA_ID_TRACKFLAGDEFAULT:
- {
- uint64_t num = ebml_read_uint (s, &l);
- if (num == EBML_UINT_INVALID)
- goto err_out;
- track->default_track = num;
- mp_msg (MSGT_DEMUX, MSGL_V, "[mkv] | + Default flag: %u\n",
- track->default_track);
- break;
- }
-
- case MATROSKA_ID_TRACKDEFAULTDURATION:
- {
- uint64_t num = ebml_read_uint (s, &l);
- if (num == EBML_UINT_INVALID)
- goto err_out;
- if (num == 0)
- mp_msg (MSGT_DEMUX, MSGL_V, "[mkv] | + Default duration: 0");
- else
- {
- track->v_frate = 1000000000.0 / num;
- track->default_duration = num / 1000000000.0;
- mp_msg (MSGT_DEMUX, MSGL_V, "[mkv] | + Default duration: "
- "%.3fms ( = %.3f fps)\n",num/1000000.0,track->v_frate);
- }
- break;
- }
-
- case MATROSKA_ID_TRACKENCODINGS:
- l = demux_mkv_read_trackencodings (demuxer, track);
- if (l == 0)
- goto err_out;
- break;
+ if (!strcmp(track->codec_id, MKV_S_TEXTUTF8)) {
+ track->subtitle_type = MATROSKA_SUBTYPE_TEXT;
+ }
+ mp_msg(MSGT_DEMUX, MSGL_V, "[mkv] | + Codec ID: %s\n",
+ track->codec_id);
+ } else
+ mp_msg(MSGT_DEMUX, MSGL_ERR, "[mkv] Missing codec ID!\n");
+
+ if (entry->n_codec_private) {
+ int len = entry->codec_private.len;
+ track->private_data = talloc_size(track, len + AV_LZO_INPUT_PADDING);
+ memcpy(track->private_data, entry->codec_private.start, len);
+ track->private_size = len;
+ mp_msg(MSGT_DEMUX, MSGL_V, "[mkv] | + CodecPrivate, length %u\n",
+ track->private_size);
+ }
- default:
- ebml_read_skip (s, &l);
- break;
+ if (entry->n_language) {
+ track->language = talloc_strndup(track, entry->language.start,
+ entry->language.len);
+ mp_msg(MSGT_DEMUX, MSGL_V, "[mkv] | + Language: %s\n",
+ track->language);
+ } else
+ track->language = talloc_strdup(track, "eng");
+
+ if (entry->n_flag_default) {
+ track->default_track = entry->flag_default;
+ mp_msg(MSGT_DEMUX, MSGL_V, "[mkv] | + Default flag: %u\n",
+ track->default_track);
+ } else
+ track->default_track = 1;
+
+ if (entry->n_default_duration) {
+ track->default_duration = entry->default_duration / 1e9;
+ if (entry->default_duration == 0)
+ mp_msg(MSGT_DEMUX, MSGL_V, "[mkv] | + Default duration: 0");
+ else {
+ if (!track->v_frate)
+ track->v_frate = 1e9 / entry->default_duration;
+ mp_msg(MSGT_DEMUX, MSGL_V,
+ "[mkv] | + Default duration: %.3fms ( = %.3f fps)\n",
+ entry->default_duration / 1000000.0, track->v_frate);
}
- length -= l + il;
}
- mkv_d->tracks[mkv_d->num_tracks++] = track;
- return len;
+ if (entry->n_content_encodings)
+ parse_trackencodings(demuxer, track, &entry->content_encodings);
-err_out:
- demux_mkv_free_trackentry(track);
- return 0;
+ mkv_d->tracks[mkv_d->num_tracks++] = track;
}
-static int
-demux_mkv_read_tracks (demuxer_t *demuxer)
+static int demux_mkv_read_tracks(demuxer_t *demuxer)
{
- mkv_demuxer_t *mkv_d = (mkv_demuxer_t *) demuxer->priv;
- stream_t *s = demuxer->stream;
- uint64_t length, l;
- int il;
-
- mkv_d->tracks = malloc (sizeof (*mkv_d->tracks));
- mkv_d->num_tracks = 0;
-
- length = ebml_read_length (s, NULL);
- while (length > 0)
- {
- switch (ebml_read_id (s, &il))
- {
- case MATROSKA_ID_TRACKENTRY:
- mp_msg (MSGT_DEMUX, MSGL_V, "[mkv] | + a track...\n");
- mkv_d->tracks = realloc (mkv_d->tracks,
- (mkv_d->num_tracks+1)
- *sizeof (*mkv_d->tracks));
- l = demux_mkv_read_trackentry (demuxer);
- if (l == 0)
- return 1;
- break;
+ mkv_demuxer_t *mkv_d = (mkv_demuxer_t *) demuxer->priv;
+ stream_t *s = demuxer->stream;
- default:
- ebml_read_skip (s, &l);
- break;
- }
- length -= l + il;
+ struct ebml_tracks tracks = {};
+ struct ebml_parse_ctx parse_ctx = {};
+ if (ebml_read_element(s, &parse_ctx, &tracks, &ebml_tracks_desc) < 0)
+ return 1;
+
+ mkv_d->tracks = talloc_size(mkv_d,
+ tracks.n_track_entry * sizeof(*mkv_d->tracks));
+ for (int i = 0; i < tracks.n_track_entry; i++) {
+ mp_msg(MSGT_DEMUX, MSGL_V, "[mkv] | + a track...\n");
+ parse_trackentry(demuxer, &tracks.track_entry[i]);
}
- return 0;
+ talloc_free(parse_ctx.talloc_ctx);
+ return 0;
}
-static int
-demux_mkv_read_cues (demuxer_t *demuxer)
+static int demux_mkv_read_cues(demuxer_t *demuxer)
{
- mkv_demuxer_t *mkv_d = (mkv_demuxer_t *) demuxer->priv;
- stream_t *s = demuxer->stream;
- uint64_t length, l, time, track, pos;
- off_t off;
- int i, il;
-
- if (index_mode == 0) {
- ebml_read_skip (s, NULL);
- return 0;
- }
- off = stream_tell (s);
- for (i=0; i<mkv_d->parsed_cues_num; i++)
- if (mkv_d->parsed_cues[i] == off)
- {
- ebml_read_skip (s, NULL);
- return 0;
- }
- mkv_d->parsed_cues = realloc (mkv_d->parsed_cues,
- (mkv_d->parsed_cues_num+1)
- * sizeof (off_t));
- mkv_d->parsed_cues[mkv_d->parsed_cues_num++] = off;
-
- mp_msg (MSGT_DEMUX, MSGL_V, "[mkv] /---- [ parsing cues ] -----------\n");
- length = ebml_read_length (s, NULL);
-
- while (length > 0)
- {
- time = track = pos = EBML_UINT_INVALID;
-
- switch (ebml_read_id (s, &il))
- {
- case MATROSKA_ID_POINTENTRY:
- {
- uint64_t len;
-
- len = ebml_read_length (s, &i);
- l = len + i;
-
- while (len > 0)
- {
- uint64_t l;
- int il;
-
- switch (ebml_read_id (s, &il))
- {
- case MATROSKA_ID_CUETIME:
- time = ebml_read_uint (s, &l);
- break;
-
- case MATROSKA_ID_CUETRACKPOSITION:
- {
- uint64_t le;
+ mkv_demuxer_t *mkv_d = (mkv_demuxer_t *) demuxer->priv;
+ stream_t *s = demuxer->stream;
- le = ebml_read_length (s, &i);
- l = le + i;
-
- while (le > 0)
- {
- uint64_t l;
- int il;
-
- switch (ebml_read_id (s, &il))
- {
- case MATROSKA_ID_CUETRACK:
- track = ebml_read_uint (s, &l);
- break;
-
- case MATROSKA_ID_CUECLUSTERPOSITION:
- pos = ebml_read_uint (s, &l);
- break;
-
- default:
- ebml_read_skip (s, &l);
- break;
- }
- le -= l + il;
- }
- break;
- }
-
- default:
- ebml_read_skip (s, &l);
- break;
- }
- len -= l + il;
- }
- break;
- }
+ if (index_mode == 0 || index_mode == 2) {
+ ebml_read_skip(s, NULL);
+ return 0;
+ }
- default:
- ebml_read_skip (s, &l);
- break;
+ mp_msg(MSGT_DEMUX, MSGL_V, "[mkv] /---- [ parsing cues ] -----------\n");
+ struct ebml_cues cues = {};
+ struct ebml_parse_ctx parse_ctx = {};
+ if (ebml_read_element(s, &parse_ctx, &cues, &ebml_cues_desc) < 0)
+ goto out;
+ for (int i = 0; i < cues.n_cue_point; i++) {
+ struct ebml_cue_point *cuepoint = &cues.cue_point[i];
+ if (cuepoint->n_cue_time != 1 || !cuepoint->n_cue_track_positions) {
+ mp_msg(MSGT_DEMUX, MSGL_WARN, "[mkv] Malformed CuePoint element\n");
+ continue;
}
-
- length -= l + il;
-
- if (time != EBML_UINT_INVALID && track != EBML_UINT_INVALID
- && pos != EBML_UINT_INVALID)
- {
- grow_array(&mkv_d->indexes, mkv_d->num_indexes, sizeof(mkv_index_t));
- if (!mkv_d->indexes) {
- mkv_d->num_indexes = 0;
- break;
- }
- mkv_d->indexes[mkv_d->num_indexes].tnum = track;
- mkv_d->indexes[mkv_d->num_indexes].timecode = time;
- mkv_d->indexes[mkv_d->num_indexes].filepos =mkv_d->segment_start+pos;
- mp_msg (MSGT_DEMUX, MSGL_DBG2, "[mkv] |+ found cue point "
- "for track %"PRIu64": timecode %"PRIu64", filepos: %"PRIu64"\n",
- track, time, mkv_d->segment_start + pos);
- mkv_d->num_indexes++;
+ uint64_t time = cuepoint->cue_time;
+ for (int i = 0; i < cuepoint->n_cue_track_positions; i++) {
+ struct ebml_cue_track_positions *trackpos =
+ &cuepoint->cue_track_positions[i];
+ uint64_t track = trackpos->cue_track;
+ uint64_t pos = trackpos->cue_cluster_position;
+ mkv_d->indexes =
+ grow_array(mkv_d->indexes, mkv_d->num_indexes,
+ sizeof(mkv_index_t));
+ mkv_d->indexes[mkv_d->num_indexes].tnum = track;
+ mkv_d->indexes[mkv_d->num_indexes].timecode = time;
+ mkv_d->indexes[mkv_d->num_indexes].filepos =
+ mkv_d->segment_start + pos;
+ mp_msg(MSGT_DEMUX, MSGL_DBG2,
+ "[mkv] |+ found cue point for track %" PRIu64
+ ": timecode %" PRIu64 ", filepos: %" PRIu64 "\n", track,
+ time, mkv_d->segment_start + pos);
+ mkv_d->num_indexes++;
}
}
- mp_msg (MSGT_DEMUX, MSGL_V, "[mkv] \\---- [ parsing cues ] -----------\n");
- return 0;
+ out:
+ mp_msg(MSGT_DEMUX, MSGL_V, "[mkv] \\---- [ parsing cues ] -----------\n");
+ talloc_free(parse_ctx.talloc_ctx);
+ return 0;
}
-static int
-demux_mkv_read_chapters (demuxer_t *demuxer)
+static int demux_mkv_read_chapters(struct demuxer *demuxer)
{
- stream_t *s = demuxer->stream;
- uint64_t length, l;
- int il;
-
- if (demuxer->chapters)
- {
- ebml_read_skip (s, NULL);
- return 0;
+ struct MPOpts *opts = demuxer->opts;
+ stream_t *s = demuxer->stream;
+
+ mp_msg(MSGT_DEMUX, MSGL_V, "[mkv] /---- [ parsing chapters ] ---------\n");
+ struct ebml_chapters file_chapters = {};
+ struct ebml_parse_ctx parse_ctx = {};
+ if (ebml_read_element(s, &parse_ctx, &file_chapters,
+ &ebml_chapters_desc) < 0)
+ goto out;
+
+ int selected_edition = 0;
+ int num_editions = file_chapters.n_edition_entry;
+ struct ebml_edition_entry *editions = file_chapters.edition_entry;
+ if (opts->edition_id >= 0 && opts->edition_id < num_editions) {
+ selected_edition = opts->edition_id;
+ mp_msg(MSGT_DEMUX, MSGL_V, "[mkv] User-specified edition: %d\n",
+ selected_edition);
+ } else
+ for (int i = 0; i < num_editions; i++)
+ if (editions[i].edition_flag_default) {
+ selected_edition = i;
+ mp_msg(MSGT_DEMUX, MSGL_V, "[mkv] Default edition: %d\n", i);
+ break;
+ }
+ struct matroska_chapter *m_chapters = NULL;
+ if (editions[selected_edition].edition_flag_ordered) {
+ int count = editions[selected_edition].n_chapter_atom;
+ m_chapters = talloc_array_ptrtype(demuxer, m_chapters, count);
+ demuxer->matroska_data.ordered_chapters = m_chapters;
+ demuxer->matroska_data.num_ordered_chapters = count;
}
- mp_msg(MSGT_DEMUX, MSGL_V, "[mkv] /---- [ parsing chapters ] ---------\n");
- length = ebml_read_length (s, NULL);
-
- while (length > 0)
- {
- switch (ebml_read_id (s, &il))
- {
- case MATROSKA_ID_EDITIONENTRY:
- {
- uint64_t len;
- int i;
-
- len = ebml_read_length (s, &i);
- l = len + i;
-
- while (len > 0)
- {
- uint64_t l;
- int il;
-
- switch (ebml_read_id (s, &il))
- {
- case MATROSKA_ID_CHAPTERATOM:
- {
- uint64_t len, start=0, end=0;
- char* name = 0;
- int i;
- int cid;
-
- len = ebml_read_length (s, &i);
- l = len + i;
-
- while (len > 0)
- {
- uint64_t l;
- int il;
-
- switch (ebml_read_id (s, &il))
- {
- case MATROSKA_ID_CHAPTERTIMESTART:
- start = ebml_read_uint (s, &l) / 1000000;
- break;
-
- case MATROSKA_ID_CHAPTERTIMEEND:
- end = ebml_read_uint (s, &l) / 1000000;
- break;
-
- case MATROSKA_ID_CHAPTERDISPLAY:
- {
- uint64_t len;
- int i;
-
- len = ebml_read_length (s, &i);
- l = len + i;
- while (len > 0)
- {
- uint64_t l;
- int il;
-
- switch (ebml_read_id (s, &il))
- {
- case MATROSKA_ID_CHAPSTRING:
- name = ebml_read_utf8 (s, &l);
- break;
- default:
- ebml_read_skip (s, &l);
- break;
- }
- len -= l + il;
- }
- }
- break;
-
- default:
- ebml_read_skip (s, &l);
- break;
- }
- len -= l + il;
- }
-
- if (!name)
- name = strdup("(unnamed)");
-
- cid = demuxer_add_chapter(demuxer, name, start, end);
-
- mp_msg(MSGT_DEMUX, MSGL_V,
- "[mkv] Chapter %u from %02d:%02d:%02d."
- "%03d to %02d:%02d:%02d.%03d, %s\n",
- cid,
- (int) (start / 60 / 60 / 1000),
- (int) ((start / 60 / 1000) % 60),
- (int) ((start / 1000) % 60),
- (int) (start % 1000),
- (int) (end / 60 / 60 / 1000),
- (int) ((end / 60 / 1000) % 60),
- (int) ((end / 1000) % 60),
- (int) (end % 1000), name);
-
- free(name);
- break;
- }
+ for (int idx = 0; idx < num_editions; idx++) {
+ mp_msg(MSGT_DEMUX, MSGL_V, "[mkv] New edition %d\n", idx);
+ int warn_level = idx == selected_edition ? MSGL_WARN : MSGL_V;
+ if (editions[idx].n_edition_flag_default)
+ mp_msg(MSGT_DEMUX, MSGL_V, "[mkv] Default edition flag: %"PRIu64
+ "\n", editions[idx].edition_flag_default);
+ if (editions[idx].n_edition_flag_ordered)
+ mp_msg(MSGT_DEMUX, MSGL_V, "[mkv] Ordered chapter flag: %"PRIu64
+ "\n", editions[idx].edition_flag_ordered);
+ for (int i = 0; i < editions[idx].n_chapter_atom; i++) {
+ struct ebml_chapter_atom *ca = editions[idx].chapter_atom + i;
+ struct matroska_chapter chapter = { };
+ struct bstr name = { "(unnamed)", 9 };
+
+ if (!ca->n_chapter_time_start)
+ mp_msg(MSGT_DEMUX, warn_level,
+ "[mkv] Chapter lacks start time\n");
+ chapter.start = ca->chapter_time_start / 1000000;
+ chapter.end = ca->chapter_time_end / 1000000;
+
+ if (ca->n_chapter_display) {
+ if (ca->n_chapter_display > 1)
+ mp_msg(MSGT_DEMUX, warn_level, "[mkv] Multiple chapter "
+ "names not supported, picking first\n");
+ if (!ca->chapter_display[0].n_chap_string)
+ mp_msg(MSGT_DEMUX, warn_level, "[mkv] Malformed chapter "
+ "name entry\n");
+ else
+ name = ca->chapter_display[0].chap_string;
+ }
- default:
- ebml_read_skip (s, &l);
- break;
- }
- len -= l + il;
- }
- break;
- }
+ if (ca->n_chapter_segment_uid) {
+ chapter.has_segment_uid = true;
+ int len = ca->chapter_segment_uid.len;
+ if (len != sizeof(chapter.segment_uid))
+ mp_msg(MSGT_DEMUX, warn_level,
+ "[mkv] Chapter segment uid bad length %d\n", len);
+ else if (ca->n_chapter_segment_edition_uid) {
+ mp_tmsg(MSGT_DEMUX, warn_level, "[mkv] Warning: "
+ "unsupported edition recursion in chapter; "
+ "will skip on playback!\n");
+ } else {
+ memcpy(chapter.segment_uid, ca->chapter_segment_uid.start,
+ len);
+ mp_msg(MSGT_DEMUX, MSGL_V, "[mkv] Chapter segment uid ");
+ for (int i = 0; i < len; i++)
+ mp_msg(MSGT_DEMUX, MSGL_V, "%02x ",
+ chapter.segment_uid[i]);
+ mp_msg(MSGT_DEMUX, MSGL_V, "\n");
+ }
+ }
- default:
- ebml_read_skip (s, &l);
- break;
+ mp_msg(MSGT_DEMUX, MSGL_V,
+ "[mkv] Chapter %u from %02d:%02d:%02d.%03d "
+ "to %02d:%02d:%02d.%03d, %.*s\n", idx,
+ (int) (chapter.start / 60 / 60 / 1000),
+ (int) ((chapter.start / 60 / 1000) % 60),
+ (int) ((chapter.start / 1000) % 60),
+ (int) (chapter.start % 1000),
+ (int) (chapter.end / 60 / 60 / 1000),
+ (int) ((chapter.end / 60 / 1000) % 60),
+ (int) ((chapter.end / 1000) % 60),
+ (int) (chapter.end % 1000),
+ name.len, name.start);
+
+ if (idx == selected_edition){
+ demuxer_add_chapter(demuxer, name.start, name.len,
+ chapter.start, chapter.end);
+ if (editions[idx].edition_flag_ordered) {
+ chapter.name = talloc_strndup(m_chapters, name.start,
+ name.len);
+ m_chapters[i] = chapter;
+ }
+ }
}
-
- length -= l + il;
}
-
- mp_msg(MSGT_DEMUX, MSGL_V, "[mkv] \\---- [ parsing chapters ] ---------\n");
- return 0;
+ if (num_editions > 1)
+ mp_msg(MSGT_DEMUX, MSGL_INFO,
+ "[mkv] Found %d editions, will play #%d (first is 0).\n",
+ num_editions, selected_edition);
+
+ out:
+ talloc_free(parse_ctx.talloc_ctx);
+ mp_msg(MSGT_DEMUX, MSGL_V,
+ "[mkv] \\---- [ parsing chapters ] ---------\n");
+ return 0;
}
-static int
-demux_mkv_read_tags (demuxer_t *demuxer)
+static int demux_mkv_read_tags(demuxer_t *demuxer)
{
- ebml_read_skip (demuxer->stream, NULL);
- return 0;
+ ebml_read_skip(demuxer->stream, NULL);
+ return 0;
}
-static int
-demux_mkv_read_attachments (demuxer_t *demuxer)
+static int demux_mkv_read_attachments(demuxer_t *demuxer)
{
- stream_t *s = demuxer->stream;
- uint64_t length, l;
- int il;
-
- mp_msg(MSGT_DEMUX, MSGL_V, "[mkv] /---- [ parsing attachments ] ---------\n");
- length = ebml_read_length (s, NULL);
-
- while (length > 0)
- {
- switch (ebml_read_id (s, &il))
- {
- case MATROSKA_ID_ATTACHEDFILE:
- {
- uint64_t len;
- int i;
- char* name = NULL;
- char* mime = NULL;
- char* data = NULL;
- int data_size = 0;
-
- len = ebml_read_length (s, &i);
- l = len + i;
-
- mp_msg (MSGT_DEMUX, MSGL_V, "[mkv] | + an attachment...\n");
-
- while (len > 0)
- {
- uint64_t l;
- int il;
-
- switch (ebml_read_id (s, &il))
- {
- case MATROSKA_ID_FILENAME:
- name = ebml_read_utf8 (s, &l);
- if (name == NULL)
- return 0;
- mp_msg (MSGT_DEMUX, MSGL_V, "[mkv] | + FileName: %s\n",
- name);
- break;
+ stream_t *s = demuxer->stream;
+
+ mp_msg(MSGT_DEMUX, MSGL_V,
+ "[mkv] /---- [ parsing attachments ] ---------\n");
+
+ struct ebml_attachments attachments = {};
+ struct ebml_parse_ctx parse_ctx = {};
+ if (ebml_read_element(s, &parse_ctx, &attachments,
+ &ebml_attachments_desc) < 0)
+ goto out;
+
+ for (int i = 0; i < attachments.n_attached_file; i++) {
+ struct ebml_attached_file *attachment = &attachments.attached_file[i];
+ if (!attachment->n_file_name || !attachment->n_file_mime_type
+ || !attachment->n_file_data) {
+ mp_msg(MSGT_DEMUX, MSGL_WARN, "[mkv] Malformed attachment\n");
+ continue;
+ }
+ struct bstr name = attachment->file_name;
+ struct bstr mime = attachment->file_mime_type;
+ char *data = attachment->file_data.start;
+ int data_size = attachment->file_data.len;
+ demuxer_add_attachment(demuxer, name.start, name.len, mime.start,
+ mime.len, data, data_size);
+ mp_msg(MSGT_DEMUX, MSGL_V, "[mkv] Attachment: %.*s, %.*s, %u bytes\n",
+ name.len, name.start, mime.len, mime.start, data_size);
+ }
- case MATROSKA_ID_FILEMIMETYPE:
- mime = ebml_read_ascii (s, &l);
- if (mime == NULL)
- return 0;
- mp_msg (MSGT_DEMUX, MSGL_V, "[mkv] | + FileMimeType: %s\n",
- mime);
- break;
-
- case MATROSKA_ID_FILEDATA:
- {
- int x;
- uint64_t num = ebml_read_length (s, &x);
- l = x + num;
- free(data);
- data = malloc (num);
- if (stream_read(s, data, num) != (int) num)
- {
- free(data);
- return 0;
- }
- data_size = num;
- mp_msg (MSGT_DEMUX, MSGL_V, "[mkv] | + FileData, length "
- "%u\n", data_size);
- break;
- }
-
- default:
- ebml_read_skip (s, &l);
- break;
- }
- len -= l + il;
- }
+ out:
+ talloc_free(parse_ctx.talloc_ctx);
+ mp_msg(MSGT_DEMUX, MSGL_V,
+ "[mkv] \\---- [ parsing attachments ] ---------\n");
+ return 0;
+}
- demuxer_add_attachment(demuxer, name, mime, data, data_size);
- mp_msg(MSGT_DEMUX, MSGL_V,
- "[mkv] Attachment: %s, %s, %u bytes\n",
- name, mime, data_size);
- break;
- }
+static int read_header_element(struct demuxer *demuxer, uint32_t id,
+ off_t at_filepos);
- default:
- ebml_read_skip (s, &l);
- break;
+static int demux_mkv_read_seekhead(demuxer_t *demuxer)
+{
+ struct mkv_demuxer *mkv_d = demuxer->priv;
+ struct stream *s = demuxer->stream;
+ int res = 0;
+ struct ebml_seek_head seekhead = {};
+ struct ebml_parse_ctx parse_ctx = {};
+
+ mp_msg(MSGT_DEMUX, MSGL_V,
+ "[mkv] /---- [ parsing seek head ] ---------\n");
+ if (ebml_read_element(s, &parse_ctx, &seekhead, &ebml_seek_head_desc) < 0) {
+ res = 1;
+ goto out;
+ }
+ /* off now holds the position of the next element after the seek head. */
+ off_t off = stream_tell(s);
+ for (int i = 0; i < seekhead.n_seek; i++) {
+ struct ebml_seek *seek = &seekhead.seek[i];
+ if (seek->n_seek_id != 1 || seek->n_seek_position != 1) {
+ mp_msg(MSGT_DEMUX, MSGL_WARN, "[mkv] Invalid SeekHead entry\n");
+ continue;
+ }
+ uint64_t pos = seek->seek_position + mkv_d->segment_start;
+ if (pos >= demuxer->movi_end) {
+ mp_msg(MSGT_DEMUX, MSGL_WARN, "[mkv] SeekHead position beyond "
+ "end of file - incomplete file?\n");
+ continue;
}
- length -= l + il;
+ read_header_element(demuxer, seek->seek_id, pos);
}
-
- mp_msg(MSGT_DEMUX, MSGL_V, "[mkv] \\---- [ parsing attachments ] ---------\n");
- return 0;
+ if (!stream_seek(s, off)) {
+ mp_msg(MSGT_DEMUX, MSGL_ERR, "[mkv] Couldn't seek back after "
+ "SeekHead??\n");
+ res = 1;
+ }
+ out:
+ mp_msg(MSGT_DEMUX, MSGL_V,
+ "[mkv] \\---- [ parsing seek head ] ---------\n");
+ talloc_free(parse_ctx.talloc_ctx);
+ return res;
}
-static int
-demux_mkv_read_seekhead (demuxer_t *demuxer)
+static bool seek_pos_id(struct stream *s, off_t pos, uint32_t id)
{
- mkv_demuxer_t *mkv_d = (mkv_demuxer_t *) demuxer->priv;
- stream_t *s = demuxer->stream;
- uint64_t length, l, seek_pos, saved_pos, num;
- uint32_t seek_id;
- int i, il, res = 0;
- off_t off;
-
- off = stream_tell (s);
- for (i=0; i<mkv_d->parsed_seekhead_num; i++)
- if (mkv_d->parsed_seekhead[i] == off)
- {
- ebml_read_skip (s, NULL);
- return 0;
- }
- mkv_d->parsed_seekhead = realloc (mkv_d->parsed_seekhead,
- (mkv_d->parsed_seekhead_num+1)
- * sizeof (off_t));
- mkv_d->parsed_seekhead[mkv_d->parsed_seekhead_num++] = off;
-
- mp_msg(MSGT_DEMUX, MSGL_V, "[mkv] /---- [ parsing seek head ] ---------\n");
- length = ebml_read_length (s, NULL);
- /* off now holds the position of the next element after the seek head. */
- off = stream_tell (s) + length;
- while (length > 0 && !res)
- {
-
- seek_id = 0;
- seek_pos = EBML_UINT_INVALID;
-
- switch (ebml_read_id (s, &il))
- {
- case MATROSKA_ID_SEEKENTRY:
- {
- uint64_t len;
-
- len = ebml_read_length (s, &i);
- l = len + i;
-
- while (len > 0)
- {
- uint64_t l;
- int il;
-
- switch (ebml_read_id (s, &il))
- {
- case MATROSKA_ID_SEEKID:
- num = ebml_read_uint (s, &l);
- if (num != EBML_UINT_INVALID)
- seek_id = num;
- break;
-
- case MATROSKA_ID_SEEKPOSITION:
- seek_pos = ebml_read_uint (s, &l);
- break;
+ if (!stream_seek(s, pos)) {
+ mp_msg(MSGT_DEMUX, MSGL_WARN, "[mkv] Failed to seek in file\n");
+ return false;
+ }
+ if (ebml_read_id(s, NULL) != id) {
+ mp_msg(MSGT_DEMUX, MSGL_WARN, "[mkv] Expected element not found\n");
+ return false;
+ }
+ return true;
+}
- default:
- ebml_read_skip (s, &l);
- break;
- }
- len -= l + il;
- }
+static int read_header_element(struct demuxer *demuxer, uint32_t id,
+ off_t at_filepos)
+{
+ struct mkv_demuxer *mkv_d = demuxer->priv;
+ stream_t *s = demuxer->stream;
+ off_t pos = stream_tell(s) - 4;
+ switch(id) {
+ case MATROSKA_ID_INFO:
+ if (mkv_d->parsed_info)
break;
- }
-
- default:
- ebml_read_skip (s, &l);
+ if (at_filepos && !seek_pos_id(s, at_filepos, id))
+ return -1;
+ mp_msg(MSGT_DEMUX, MSGL_V, "[mkv] |+ segment information...\n");
+ mkv_d->parsed_info = true;
+ return demux_mkv_read_info(demuxer) ? -1 : 1;
+
+ case MATROSKA_ID_TRACKS:
+ if (mkv_d->parsed_tracks)
break;
- }
- length -= l + il;
-
- if (seek_id == 0 || seek_id == MATROSKA_ID_CLUSTER
- || seek_pos == EBML_UINT_INVALID ||
- ((mkv_d->segment_start + seek_pos) >= (uint64_t)demuxer->movi_end))
- continue;
+ if (at_filepos && !seek_pos_id(s, at_filepos, id))
+ return -1;
+ mkv_d->parsed_tracks = true;
+ mp_msg(MSGT_DEMUX, MSGL_V, "[mkv] |+ segment tracks...\n");
+ return demux_mkv_read_tracks(demuxer) ? -1 : 1;
+
+ case MATROSKA_ID_CUES:
+ if (is_parsed_header(mkv_d, pos))
+ break;
+ if (at_filepos && !seek_pos_id(s, at_filepos, id))
+ return -1;
+ return demux_mkv_read_cues(demuxer) ? -1 : 1;
- saved_pos = stream_tell (s);
- if (!stream_seek (s, mkv_d->segment_start + seek_pos))
- res = 1;
- else
- {
- if (ebml_read_id (s, &il) != seek_id)
- res = 1;
- else
- switch (seek_id)
- {
- case MATROSKA_ID_CUES:
- if (demux_mkv_read_cues (demuxer))
- res = 1;
- break;
+ case MATROSKA_ID_TAGS:
+ if (mkv_d->parsed_tags)
+ break;
+ if (at_filepos && !seek_pos_id(s, at_filepos, id))
+ return -1;
+ mkv_d->parsed_tags = true;
+ return demux_mkv_read_tags(demuxer) ? -1 : 1;
- case MATROSKA_ID_TAGS:
- if (demux_mkv_read_tags (demuxer))
- res = 1;
- break;
+ case MATROSKA_ID_SEEKHEAD:
+ if (is_parsed_header(mkv_d, pos))
+ break;
+ if (at_filepos && !seek_pos_id(s, at_filepos, id))
+ return -1;
+ return demux_mkv_read_seekhead(demuxer) ? -1 : 1;
- case MATROSKA_ID_SEEKHEAD:
- if (demux_mkv_read_seekhead (demuxer))
- res = 1;
- break;
+ case MATROSKA_ID_CHAPTERS:
+ if (mkv_d->parsed_chapters)
+ break;
+ if (at_filepos && !seek_pos_id(s, at_filepos, id))
+ return -1;
+ mkv_d->parsed_chapters = true;
+ return demux_mkv_read_chapters(demuxer) ? -1 : 1;
- case MATROSKA_ID_CHAPTERS:
- if (demux_mkv_read_chapters (demuxer))
- res = 1;
- break;
- }
- }
+ case MATROSKA_ID_ATTACHMENTS:
+ if (mkv_d->parsed_attachments)
+ break;
+ if (at_filepos && !seek_pos_id(s, at_filepos, id))
+ return -1;
+ mkv_d->parsed_attachments = true;
+ return demux_mkv_read_attachments(demuxer) ? -1 : 1;
- stream_seek (s, saved_pos);
- }
- if (res)
- {
- /* If there was an error then try to skip this seek head. */
- if (stream_seek (s, off))
- res = 0;
+ default:
+ if (!at_filepos)
+ ebml_read_skip(s, NULL);
+ return 0;
}
- else
- if (length > 0)
- stream_seek (s, stream_tell (s) + length);
- mp_msg(MSGT_DEMUX, MSGL_V, "[mkv] \\---- [ parsing seek head ] ---------\n");
- return res;
+ if (!at_filepos)
+ ebml_read_skip(s, NULL);
+ return 1;
}
-static int
-demux_mkv_open_video (demuxer_t *demuxer, mkv_track_t *track, int vid);
-static int
-demux_mkv_open_audio (demuxer_t *demuxer, mkv_track_t *track, int aid);
-static int
-demux_mkv_open_sub (demuxer_t *demuxer, mkv_track_t *track, int sid);
-static void
-display_create_tracks (demuxer_t *demuxer)
+
+static int demux_mkv_open_video(demuxer_t *demuxer, mkv_track_t *track,
+ int vid);
+static int demux_mkv_open_audio(demuxer_t *demuxer, mkv_track_t *track,
+ int aid);
+static int demux_mkv_open_sub(demuxer_t *demuxer, mkv_track_t *track,
+ int sid);
+
+static void display_create_tracks(demuxer_t *demuxer)
{
- mkv_demuxer_t *mkv_d = (mkv_demuxer_t *)demuxer->priv;
- int i, vid=0, aid=0, sid=0;
-
- for (i=0; i<mkv_d->num_tracks; i++)
- {
- char *type = "unknown", str[32];
- *str = '\0';
- switch (mkv_d->tracks[i]->type)
- {
+ mkv_demuxer_t *mkv_d = (mkv_demuxer_t *) demuxer->priv;
+ int i, vid = 0, aid = 0, sid = 0;
+
+ for (i = 0; i < mkv_d->num_tracks; i++) {
+ char *type = "unknown", str[32];
+ *str = '\0';
+ switch (mkv_d->tracks[i]->type) {
case MATROSKA_TRACK_VIDEO:
- type = "video";
- demux_mkv_open_video(demuxer, mkv_d->tracks[i], vid);
- if (mkv_d->tracks[i]->name)
- mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_VID_%d_NAME=%s\n", vid, mkv_d->tracks[i]->name);
- sprintf (str, "-vid %u", vid++);
- break;
+ type = "video";
+ demux_mkv_open_video(demuxer, mkv_d->tracks[i], vid);
+ if (mkv_d->tracks[i]->name)
+ mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_VID_%d_NAME=%s\n", vid,
+ mkv_d->tracks[i]->name);
+ sprintf(str, "-vid %u", vid++);
+ break;
case MATROSKA_TRACK_AUDIO:
- type = "audio";
- demux_mkv_open_audio(demuxer, mkv_d->tracks[i], aid);
- if (mkv_d->tracks[i]->name)
- mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_AID_%d_NAME=%s\n", aid, mkv_d->tracks[i]->name);
- mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_AID_%d_LANG=%s\n", aid, mkv_d->tracks[i]->language);
- sprintf (str, "-aid %u, -alang %.5s",aid++,mkv_d->tracks[i]->language);
- break;
+ type = "audio";
+ demux_mkv_open_audio(demuxer, mkv_d->tracks[i], aid);
+ if (mkv_d->tracks[i]->name)
+ mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_AID_%d_NAME=%s\n", aid,
+ mkv_d->tracks[i]->name);
+ mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_AID_%d_LANG=%s\n", aid,
+ mkv_d->tracks[i]->language);
+ sprintf(str, "-aid %u, -alang %.5s", aid++,
+ mkv_d->tracks[i]->language);
+ break;
case MATROSKA_TRACK_SUBTITLE:
- type = "subtitles";
- demux_mkv_open_sub(demuxer, mkv_d->tracks[i], sid);
- if (mkv_d->tracks[i]->name)
- mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_SID_%d_NAME=%s\n", sid, mkv_d->tracks[i]->name);
- mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_SID_%d_LANG=%s\n", sid, mkv_d->tracks[i]->language);
- sprintf (str, "-sid %u, -slang %.5s",sid++,mkv_d->tracks[i]->language);
- break;
+ type = "subtitles";
+ demux_mkv_open_sub(demuxer, mkv_d->tracks[i], sid);
+ if (mkv_d->tracks[i]->name)
+ mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_SID_%d_NAME=%s\n", sid,
+ mkv_d->tracks[i]->name);
+ mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_SID_%d_LANG=%s\n", sid,
+ mkv_d->tracks[i]->language);
+ sprintf(str, "-sid %u, -slang %.5s", sid++,
+ mkv_d->tracks[i]->language);
+ break;
}
- if (mkv_d->tracks[i]->name)
- mp_msg(MSGT_DEMUX, MSGL_INFO, MSGTR_MPDEMUX_MKV_TrackIDName,
- mkv_d->tracks[i]->tnum, type, mkv_d->tracks[i]->codec_id, mkv_d->tracks[i]->name, str);
- else
- mp_msg(MSGT_DEMUX, MSGL_INFO, MSGTR_MPDEMUX_MKV_TrackID,
- mkv_d->tracks[i]->tnum, type, mkv_d->tracks[i]->codec_id, str);
+ if (mkv_d->tracks[i]->name)
+ mp_tmsg(MSGT_DEMUX, MSGL_INFO,
+ "[mkv] Track ID %u: %s (%s) \"%s\", %s\n",
+ mkv_d->tracks[i]->tnum, type, mkv_d->tracks[i]->codec_id,
+ mkv_d->tracks[i]->name, str);
+ else
+ mp_tmsg(MSGT_DEMUX, MSGL_INFO, "[mkv] Track ID %u: %s (%s), %s\n",
+ mkv_d->tracks[i]->tnum, type, mkv_d->tracks[i]->codec_id,
+ str);
}
}
typedef struct {
- char *id;
- int fourcc;
- int extradata;
+ char *id;
+ int fourcc;
+ int extradata;
} videocodec_info_t;
static const videocodec_info_t vinfo[] = {
- { MKV_V_MPEG1, mmioFOURCC('m', 'p', 'g', '1'), 0 },
- { MKV_V_MPEG2, mmioFOURCC('m', 'p', 'g', '2'), 0 },
- { MKV_V_MPEG4_SP, mmioFOURCC('m', 'p', '4', 'v'), 1 },
- { MKV_V_MPEG4_ASP, mmioFOURCC('m', 'p', '4', 'v'), 1 },
- { MKV_V_MPEG4_AP, mmioFOURCC('m', 'p', '4', 'v'), 1 },
- { MKV_V_MPEG4_AVC, mmioFOURCC('a', 'v', 'c', '1'), 1 },
- { MKV_V_THEORA, mmioFOURCC('t', 'h', 'e', 'o'), 1 },
- { NULL, 0, 0 }
+ {MKV_V_MPEG1, mmioFOURCC('m', 'p', 'g', '1'), 0},
+ {MKV_V_MPEG2, mmioFOURCC('m', 'p', 'g', '2'), 0},
+ {MKV_V_MPEG4_SP, mmioFOURCC('m', 'p', '4', 'v'), 1},
+ {MKV_V_MPEG4_ASP, mmioFOURCC('m', 'p', '4', 'v'), 1},
+ {MKV_V_MPEG4_AP, mmioFOURCC('m', 'p', '4', 'v'), 1},
+ {MKV_V_MPEG4_AVC, mmioFOURCC('a', 'v', 'c', '1'), 1},
+ {MKV_V_THEORA, mmioFOURCC('t', 'h', 'e', 'o'), 1},
+ {NULL, 0, 0}
};
-static int
-demux_mkv_open_video (demuxer_t *demuxer, mkv_track_t *track, int vid)
+static int demux_mkv_open_video(demuxer_t *demuxer, mkv_track_t *track,
+ int vid)
{
- BITMAPINFOHEADER *bih;
- void *ImageDesc = NULL;
- sh_video_t *sh_v;
+ struct MPOpts *opts = demuxer->opts;
+ BITMAPINFOHEADER *bih;
+ void *ImageDesc = NULL;
+ sh_video_t *sh_v;
- if (track->ms_compat) /* MS compatibility mode */
- {
- BITMAPINFOHEADER *src;
+ if (track->ms_compat) { /* MS compatibility mode */
+ BITMAPINFOHEADER *src;
- if (track->private_data == NULL
- || track->private_size < sizeof (BITMAPINFOHEADER))
- return 1;
+ if (track->private_data == NULL
+ || track->private_size < sizeof(BITMAPINFOHEADER))
+ return 1;
- src = (BITMAPINFOHEADER *) track->private_data;
- bih = calloc (1, track->private_size);
- bih->biSize = le2me_32 (src->biSize);
- bih->biWidth = le2me_32 (src->biWidth);
- bih->biHeight = le2me_32 (src->biHeight);
- bih->biPlanes = le2me_16 (src->biPlanes);
- bih->biBitCount = le2me_16 (src->biBitCount);
- bih->biCompression = le2me_32 (src->biCompression);
- bih->biSizeImage = le2me_32 (src->biSizeImage);
- bih->biXPelsPerMeter = le2me_32 (src->biXPelsPerMeter);
- bih->biYPelsPerMeter = le2me_32 (src->biYPelsPerMeter);
- bih->biClrUsed = le2me_32 (src->biClrUsed);
- bih->biClrImportant = le2me_32 (src->biClrImportant);
- memcpy((char *) bih + sizeof (BITMAPINFOHEADER),
- (char *) src + sizeof (BITMAPINFOHEADER),
- track->private_size - sizeof (BITMAPINFOHEADER));
-
- if (track->v_width == 0)
- track->v_width = bih->biWidth;
- if (track->v_height == 0)
- track->v_height = bih->biHeight;
- }
- else
- {
- bih = calloc (1, sizeof (BITMAPINFOHEADER));
- bih->biSize = sizeof (BITMAPINFOHEADER);
- bih->biWidth = track->v_width;
- bih->biHeight = track->v_height;
- bih->biBitCount = 24;
- bih->biSizeImage = bih->biWidth * bih->biHeight * bih->biBitCount/8;
-
- if (track->private_size >= RVPROPERTIES_SIZE
- && (!strcmp (track->codec_id, MKV_V_REALV10)
- || !strcmp (track->codec_id, MKV_V_REALV20)
- || !strcmp (track->codec_id, MKV_V_REALV30)
- || !strcmp (track->codec_id, MKV_V_REALV40)))
- {
- unsigned char *dst, *src;
- uint32_t type2;
- unsigned int cnt;
-
- src = (uint8_t *)track->private_data + RVPROPERTIES_SIZE;
-
- cnt = track->private_size - RVPROPERTIES_SIZE;
- bih = realloc(bih, sizeof (BITMAPINFOHEADER)+8+cnt);
- bih->biSize = 48+cnt;
- bih->biPlanes = 1;
- type2 = AV_RB32(src - 4);
- if (type2 == 0x10003000 || type2 == 0x10003001)
- bih->biCompression=mmioFOURCC('R','V','1','3');
- else
- bih->biCompression=mmioFOURCC('R','V',track->codec_id[9],'0');
- dst = (unsigned char *) (bih + 1);
- // copy type1 and type2 info from rv properties
- memcpy(dst, src - 8, 8);
- stream_read(demuxer->stream, dst+8, cnt);
- track->realmedia = 1;
+ src = (BITMAPINFOHEADER *) track->private_data;
+ bih = calloc(1, track->private_size);
+ bih->biSize = le2me_32(src->biSize);
+ bih->biWidth = le2me_32(src->biWidth);
+ bih->biHeight = le2me_32(src->biHeight);
+ bih->biPlanes = le2me_16(src->biPlanes);
+ bih->biBitCount = le2me_16(src->biBitCount);
+ bih->biCompression = le2me_32(src->biCompression);
+ bih->biSizeImage = le2me_32(src->biSizeImage);
+ bih->biXPelsPerMeter = le2me_32(src->biXPelsPerMeter);
+ bih->biYPelsPerMeter = le2me_32(src->biYPelsPerMeter);
+ bih->biClrUsed = le2me_32(src->biClrUsed);
+ bih->biClrImportant = le2me_32(src->biClrImportant);
+ memcpy((char *) bih + sizeof(BITMAPINFOHEADER),
+ (char *) src + sizeof(BITMAPINFOHEADER),
+ track->private_size - sizeof(BITMAPINFOHEADER));
+
+ if (track->v_width == 0)
+ track->v_width = bih->biWidth;
+ if (track->v_height == 0)
+ track->v_height = bih->biHeight;
+ } else {
+ bih = calloc(1, sizeof(BITMAPINFOHEADER));
+ bih->biSize = sizeof(BITMAPINFOHEADER);
+ bih->biWidth = track->v_width;
+ bih->biHeight = track->v_height;
+ bih->biBitCount = 24;
+ bih->biSizeImage = bih->biWidth * bih->biHeight * bih->biBitCount / 8;
+
+ if (track->private_size >= RVPROPERTIES_SIZE
+ && (!strcmp(track->codec_id, MKV_V_REALV10)
+ || !strcmp(track->codec_id, MKV_V_REALV20)
+ || !strcmp(track->codec_id, MKV_V_REALV30)
+ || !strcmp(track->codec_id, MKV_V_REALV40))) {
+ unsigned char *dst, *src;
+ uint32_t type2;
+ unsigned int cnt;
+
+ src = (uint8_t *) track->private_data + RVPROPERTIES_SIZE;
+
+ cnt = track->private_size - RVPROPERTIES_SIZE;
+ bih = realloc(bih, sizeof(BITMAPINFOHEADER) + 8 + cnt);
+ bih->biSize = 48 + cnt;
+ bih->biPlanes = 1;
+ type2 = AV_RB32(src - 4);
+ if (type2 == 0x10003000 || type2 == 0x10003001)
+ bih->biCompression = mmioFOURCC('R', 'V', '1', '3');
+ else
+ bih->biCompression =
+ mmioFOURCC('R', 'V', track->codec_id[9], '0');
+ dst = (unsigned char *) (bih + 1);
+ // copy type1 and type2 info from rv properties
+ memcpy(dst, src - 8, 8);
+ stream_read(demuxer->stream, dst + 8, cnt);
+ track->realmedia = 1;
#ifdef CONFIG_QTX_CODECS
- }
- else if (track->private_size >= sizeof (ImageDescription)
- && !strcmp(track->codec_id, MKV_V_QUICKTIME))
- {
- ImageDescriptionPtr idesc;
-
- idesc = (ImageDescriptionPtr) track->private_data;
- idesc->idSize = be2me_32 (idesc->idSize);
- idesc->cType = be2me_32 (idesc->cType);
- idesc->version = be2me_16 (idesc->version);
- idesc->revisionLevel = be2me_16 (idesc->revisionLevel);
- idesc->vendor = be2me_32 (idesc->vendor);
- idesc->temporalQuality = be2me_32 (idesc->temporalQuality);
- idesc->spatialQuality = be2me_32 (idesc->spatialQuality);
- idesc->width = be2me_16 (idesc->width);
- idesc->height = be2me_16 (idesc->height);
- idesc->hRes = be2me_32 (idesc->hRes);
- idesc->vRes = be2me_32 (idesc->vRes);
- idesc->dataSize = be2me_32 (idesc->dataSize);
- idesc->frameCount = be2me_16 (idesc->frameCount);
- idesc->depth = be2me_16 (idesc->depth);
- idesc->clutID = be2me_16 (idesc->clutID);
- bih->biPlanes = 1;
- bih->biCompression = idesc->cType;
- ImageDesc = idesc;
-#endif /* CONFIG_QTX_CODECS */
-
- }
- else
- {
- const videocodec_info_t *vi = vinfo;
- while (vi->id && strcmp(vi->id, track->codec_id)) vi++;
- bih->biCompression = vi->fourcc;
- if (vi->extradata && track->private_data && (track->private_size > 0))
- {
- bih->biSize += track->private_size;
- bih = realloc (bih, bih->biSize);
- memcpy (bih + 1, track->private_data, track->private_size);
+ } else if (track->private_size >= sizeof(ImageDescription)
+ && !strcmp(track->codec_id, MKV_V_QUICKTIME)) {
+ ImageDescriptionPtr idesc;
+
+ idesc = (ImageDescriptionPtr) track->private_data;
+ idesc->idSize = be2me_32(idesc->idSize);
+ idesc->cType = be2me_32(idesc->cType);
+ idesc->version = be2me_16(idesc->version);
+ idesc->revisionLevel = be2me_16(idesc->revisionLevel);
+ idesc->vendor = be2me_32(idesc->vendor);
+ idesc->temporalQuality = be2me_32(idesc->temporalQuality);
+ idesc->spatialQuality = be2me_32(idesc->spatialQuality);
+ idesc->width = be2me_16(idesc->width);
+ idesc->height = be2me_16(idesc->height);
+ idesc->hRes = be2me_32(idesc->hRes);
+ idesc->vRes = be2me_32(idesc->vRes);
+ idesc->dataSize = be2me_32(idesc->dataSize);
+ idesc->frameCount = be2me_16(idesc->frameCount);
+ idesc->depth = be2me_16(idesc->depth);
+ idesc->clutID = be2me_16(idesc->clutID);
+ bih->biPlanes = 1;
+ bih->biCompression = idesc->cType;
+ ImageDesc = idesc;
+#endif /* CONFIG_QTX_CODECS */
+
+ } else {
+ const videocodec_info_t *vi = vinfo;
+ while (vi->id && strcmp(vi->id, track->codec_id))
+ vi++;
+ bih->biCompression = vi->fourcc;
+ if (vi->extradata && track->private_data
+ && (track->private_size > 0)) {
+ bih->biSize += track->private_size;
+ bih = realloc(bih, bih->biSize);
+ memcpy(bih + 1, track->private_data, track->private_size);
+ }
+ track->reorder_timecodes = opts->user_correct_pts == 0;
+ if (!vi->id) {
+ mp_tmsg(MSGT_DEMUX, MSGL_WARN, "[mkv] Unknown/unsupported "
+ "CodecID (%s) or missing/bad CodecPrivate\n"
+ "[mkv] data (track %u).\n",
+ track->codec_id, track->tnum);
+ free(bih);
+ return 1;
}
- track->reorder_timecodes = user_correct_pts == 0;
- if (!vi->id) {
- mp_msg (MSGT_DEMUX,MSGL_WARN, MSGTR_MPDEMUX_MKV_UnknownCodecID,
- track->codec_id, track->tnum);
- free(bih);
- return 1;
- }
}
}
- sh_v = new_sh_video_vid (demuxer, track->tnum, vid);
- sh_v->bih = bih;
- sh_v->format = sh_v->bih->biCompression;
- if (track->v_frate == 0.0)
- track->v_frate = 25.0;
- sh_v->fps = track->v_frate;
- sh_v->frametime = 1 / track->v_frate;
- sh_v->aspect = 0;
- if (!track->realmedia)
- {
- sh_v->disp_w = track->v_width;
- sh_v->disp_h = track->v_height;
- if (track->v_dheight)
- sh_v->aspect = (float)track->v_dwidth / (float)track->v_dheight;
- }
- else
- {
- // vd_realvid.c will set aspect to disp_w/disp_h and rederive
- // disp_w and disp_h from the RealVideo stream contents returned
- // by the Real DLLs. If DisplayWidth/DisplayHeight was not set in
- // the Matroska file then it has already been set to PixelWidth/Height
- // by check_track_information.
- sh_v->disp_w = track->v_dwidth;
- sh_v->disp_h = track->v_dheight;
+ sh_v = new_sh_video_vid(demuxer, track->tnum, vid);
+ sh_v->bih = bih;
+ sh_v->format = sh_v->bih->biCompression;
+ if (track->v_frate == 0.0)
+ track->v_frate = 25.0;
+ sh_v->fps = track->v_frate;
+ sh_v->frametime = 1 / track->v_frate;
+ sh_v->aspect = 0;
+ if (!track->realmedia) {
+ sh_v->disp_w = track->v_width;
+ sh_v->disp_h = track->v_height;
+ if (track->v_dheight)
+ sh_v->aspect = (double) track->v_dwidth / track->v_dheight;
+ } else {
+ // vd_realvid.c will set aspect to disp_w/disp_h and rederive
+ // disp_w and disp_h from the RealVideo stream contents returned
+ // by the Real DLLs. If DisplayWidth/DisplayHeight was not set in
+ // the Matroska file then it has already been set to PixelWidth/Height
+ // by check_track_information.
+ sh_v->disp_w = track->v_dwidth;
+ sh_v->disp_h = track->v_dheight;
}
- sh_v->ImageDesc = ImageDesc;
- mp_msg (MSGT_DEMUX, MSGL_V, "[mkv] Aspect: %f\n", sh_v->aspect);
+ sh_v->ImageDesc = ImageDesc;
+ mp_msg(MSGT_DEMUX, MSGL_V, "[mkv] Aspect: %f\n", sh_v->aspect);
- sh_v->ds = demuxer->video;
- return 0;
+ sh_v->ds = demuxer->video;
+ return 0;
}
-static int
-demux_mkv_open_audio (demuxer_t *demuxer, mkv_track_t *track, int aid)
+static int demux_mkv_open_audio(demuxer_t *demuxer, mkv_track_t *track,
+ int aid)
{
- mkv_demuxer_t *mkv_d = (mkv_demuxer_t *) demuxer->priv;
- sh_audio_t *sh_a = new_sh_audio_aid(demuxer, track->tnum, aid);
- demux_packet_t *dp;
- if(!sh_a) return 1;
- mkv_d->audio_tracks[mkv_d->last_aid] = track->tnum;
-
- if (track->language && (strcmp(track->language, "und") != 0))
- sh_a->lang = strdup(track->language);
- sh_a->default_track = track->default_track;
- sh_a->ds = demuxer->audio;
- sh_a->wf = malloc (sizeof (WAVEFORMATEX));
- if (track->ms_compat && (track->private_size >= sizeof(WAVEFORMATEX)))
- {
- WAVEFORMATEX *wf = (WAVEFORMATEX *)track->private_data;
- sh_a->wf = realloc(sh_a->wf, track->private_size);
- sh_a->wf->wFormatTag = le2me_16 (wf->wFormatTag);
- sh_a->wf->nChannels = le2me_16 (wf->nChannels);
- sh_a->wf->nSamplesPerSec = le2me_32 (wf->nSamplesPerSec);
- sh_a->wf->nAvgBytesPerSec = le2me_32 (wf->nAvgBytesPerSec);
- sh_a->wf->nBlockAlign = le2me_16 (wf->nBlockAlign);
- sh_a->wf->wBitsPerSample = le2me_16 (wf->wBitsPerSample);
- sh_a->wf->cbSize = track->private_size - sizeof(WAVEFORMATEX);
- memcpy(sh_a->wf + 1, wf + 1, track->private_size - sizeof(WAVEFORMATEX));
- if (track->a_sfreq == 0.0)
- track->a_sfreq = sh_a->wf->nSamplesPerSec;
- if (track->a_channels == 0)
- track->a_channels = sh_a->wf->nChannels;
- if (track->a_bps == 0)
- track->a_bps = sh_a->wf->wBitsPerSample;
- track->a_formattag = sh_a->wf->wFormatTag;
- }
- else
- {
- memset(sh_a->wf, 0, sizeof (WAVEFORMATEX));
- if (!strcmp(track->codec_id, MKV_A_MP3) ||
- !strcmp(track->codec_id, MKV_A_MP2))
- track->a_formattag = 0x0055;
- else if (!strncmp(track->codec_id, MKV_A_AC3, strlen(MKV_A_AC3)))
- track->a_formattag = 0x2000;
- else if (!strcmp(track->codec_id, MKV_A_DTS))
- track->a_formattag = 0x2001;
- else if (!strcmp(track->codec_id, MKV_A_PCM) ||
- !strcmp(track->codec_id, MKV_A_PCM_BE))
- track->a_formattag = 0x0001;
- else if (!strcmp(track->codec_id, MKV_A_AAC_2MAIN) ||
- !strncmp(track->codec_id, MKV_A_AAC_2LC,
- strlen(MKV_A_AAC_2LC)) ||
- !strcmp(track->codec_id, MKV_A_AAC_2SSR) ||
- !strcmp(track->codec_id, MKV_A_AAC_4MAIN) ||
- !strncmp(track->codec_id, MKV_A_AAC_4LC,
- strlen(MKV_A_AAC_4LC)) ||
- !strcmp(track->codec_id, MKV_A_AAC_4SSR) ||
- !strcmp(track->codec_id, MKV_A_AAC_4LTP) ||
- !strcmp(track->codec_id, MKV_A_AAC))
- track->a_formattag = mmioFOURCC('M', 'P', '4', 'A');
- else if (!strcmp(track->codec_id, MKV_A_VORBIS))
- {
- if (track->private_data == NULL)
- return 1;
- track->a_formattag = mmioFOURCC('v', 'r', 'b', 's');
- }
- else if (!strcmp(track->codec_id, MKV_A_QDMC))
- track->a_formattag = mmioFOURCC('Q', 'D', 'M', 'C');
- else if (!strcmp(track->codec_id, MKV_A_QDMC2))
- track->a_formattag = mmioFOURCC('Q', 'D', 'M', '2');
- else if (!strcmp(track->codec_id, MKV_A_WAVPACK))
- track->a_formattag = mmioFOURCC('W', 'V', 'P', 'K');
- else if (!strcmp(track->codec_id, MKV_A_TRUEHD))
- track->a_formattag = mmioFOURCC('T', 'R', 'H', 'D');
- else if (!strcmp(track->codec_id, MKV_A_FLAC))
- {
- if (track->private_data == NULL || track->private_size == 0)
- {
- mp_msg (MSGT_DEMUX, MSGL_WARN,
- MSGTR_MPDEMUX_MKV_FlacTrackDoesNotContainValidHeaders);
- return 1;
+ mkv_demuxer_t *mkv_d = (mkv_demuxer_t *) demuxer->priv;
+ sh_audio_t *sh_a = new_sh_audio_aid(demuxer, track->tnum, aid);
+ if (!sh_a)
+ return 1;
+ mkv_d->audio_tracks[mkv_d->last_aid] = track->tnum;
+
+ if (track->language && (strcmp(track->language, "und") != 0))
+ sh_a->lang = strdup(track->language);
+ sh_a->default_track = track->default_track;
+ sh_a->ds = demuxer->audio;
+ sh_a->wf = malloc(sizeof(WAVEFORMATEX));
+ if (track->ms_compat && (track->private_size >= sizeof(WAVEFORMATEX))) {
+ WAVEFORMATEX *wf = (WAVEFORMATEX *) track->private_data;
+ sh_a->wf = realloc(sh_a->wf, track->private_size);
+ sh_a->wf->wFormatTag = le2me_16(wf->wFormatTag);
+ sh_a->wf->nChannels = le2me_16(wf->nChannels);
+ sh_a->wf->nSamplesPerSec = le2me_32(wf->nSamplesPerSec);
+ sh_a->wf->nAvgBytesPerSec = le2me_32(wf->nAvgBytesPerSec);
+ sh_a->wf->nBlockAlign = le2me_16(wf->nBlockAlign);
+ sh_a->wf->wBitsPerSample = le2me_16(wf->wBitsPerSample);
+ sh_a->wf->cbSize = track->private_size - sizeof(WAVEFORMATEX);
+ memcpy(sh_a->wf + 1, wf + 1,
+ track->private_size - sizeof(WAVEFORMATEX));
+ if (track->a_sfreq == 0.0)
+ track->a_sfreq = sh_a->wf->nSamplesPerSec;
+ if (track->a_channels == 0)
+ track->a_channels = sh_a->wf->nChannels;
+ if (track->a_bps == 0)
+ track->a_bps = sh_a->wf->wBitsPerSample;
+ track->a_formattag = sh_a->wf->wFormatTag;
+ } else {
+ memset(sh_a->wf, 0, sizeof(WAVEFORMATEX));
+ if (!strcmp(track->codec_id, MKV_A_MP3)
+ || !strcmp(track->codec_id, MKV_A_MP2))
+ track->a_formattag = 0x0055;
+ else if (!strncmp(track->codec_id, MKV_A_AC3, strlen(MKV_A_AC3)))
+ track->a_formattag = 0x2000;
+ else if (!strcmp(track->codec_id, MKV_A_DTS))
+ track->a_formattag = 0x2001;
+ else if (!strcmp(track->codec_id, MKV_A_PCM)
+ || !strcmp(track->codec_id, MKV_A_PCM_BE))
+ track->a_formattag = 0x0001;
+ else if (!strcmp(track->codec_id, MKV_A_AAC_2MAIN)
+ || !strncmp(track->codec_id, MKV_A_AAC_2LC,
+ strlen(MKV_A_AAC_2LC))
+ || !strcmp(track->codec_id, MKV_A_AAC_2SSR)
+ || !strcmp(track->codec_id, MKV_A_AAC_4MAIN)
+ || !strncmp(track->codec_id, MKV_A_AAC_4LC,
+ strlen(MKV_A_AAC_4LC))
+ || !strcmp(track->codec_id, MKV_A_AAC_4SSR)
+ || !strcmp(track->codec_id, MKV_A_AAC_4LTP)
+ || !strcmp(track->codec_id, MKV_A_AAC))
+ track->a_formattag = mmioFOURCC('M', 'P', '4', 'A');
+ else if (!strcmp(track->codec_id, MKV_A_VORBIS)) {
+ if (track->private_data == NULL)
+ return 1;
+ track->a_formattag = mmioFOURCC('v', 'r', 'b', 's');
+ } else if (!strcmp(track->codec_id, MKV_A_QDMC))
+ track->a_formattag = mmioFOURCC('Q', 'D', 'M', 'C');
+ else if (!strcmp(track->codec_id, MKV_A_QDMC2))
+ track->a_formattag = mmioFOURCC('Q', 'D', 'M', '2');
+ else if (!strcmp(track->codec_id, MKV_A_WAVPACK))
+ track->a_formattag = mmioFOURCC('W', 'V', 'P', 'K');
+ else if (!strcmp(track->codec_id, MKV_A_TRUEHD))
+ track->a_formattag = mmioFOURCC('T', 'R', 'H', 'D');
+ else if (!strcmp(track->codec_id, MKV_A_FLAC)) {
+ if (track->private_data == NULL || track->private_size == 0) {
+ mp_tmsg(MSGT_DEMUX, MSGL_WARN,
+ "[mkv] FLAC track does not contain valid headers.\n");
+ return 1;
}
- track->a_formattag = mmioFOURCC ('f', 'L', 'a', 'C');
- }
- else if (track->private_size >= RAPROPERTIES4_SIZE)
- {
- if (!strcmp(track->codec_id, MKV_A_REAL28))
- track->a_formattag = mmioFOURCC('2', '8', '_', '8');
- else if (!strcmp(track->codec_id, MKV_A_REALATRC))
- track->a_formattag = mmioFOURCC('a', 't', 'r', 'c');
- else if (!strcmp(track->codec_id, MKV_A_REALCOOK))
- track->a_formattag = mmioFOURCC('c', 'o', 'o', 'k');
- else if (!strcmp(track->codec_id, MKV_A_REALDNET))
- track->a_formattag = mmioFOURCC('d', 'n', 'e', 't');
- else if (!strcmp(track->codec_id, MKV_A_REALSIPR))
- track->a_formattag = mmioFOURCC('s', 'i', 'p', 'r');
- }
- else
- {
- mp_msg (MSGT_DEMUX, MSGL_WARN, MSGTR_MPDEMUX_MKV_UnknownAudioCodec,
- track->codec_id, track->tnum);
- free_sh_audio(demuxer, track->tnum);
- return 1;
+ track->a_formattag = mmioFOURCC('f', 'L', 'a', 'C');
+ } else if (track->private_size >= RAPROPERTIES4_SIZE) {
+ if (!strcmp(track->codec_id, MKV_A_REAL28))
+ track->a_formattag = mmioFOURCC('2', '8', '_', '8');
+ else if (!strcmp(track->codec_id, MKV_A_REALATRC))
+ track->a_formattag = mmioFOURCC('a', 't', 'r', 'c');
+ else if (!strcmp(track->codec_id, MKV_A_REALCOOK))
+ track->a_formattag = mmioFOURCC('c', 'o', 'o', 'k');
+ else if (!strcmp(track->codec_id, MKV_A_REALDNET))
+ track->a_formattag = mmioFOURCC('d', 'n', 'e', 't');
+ else if (!strcmp(track->codec_id, MKV_A_REALSIPR))
+ track->a_formattag = mmioFOURCC('s', 'i', 'p', 'r');
+ } else {
+ mp_tmsg(MSGT_DEMUX, MSGL_WARN, "[mkv] Unknown/unsupported audio "
+ "codec ID '%s' for track %u or missing/faulty\n[mkv] "
+ "private codec data.\n", track->codec_id, track->tnum);
+ free_sh_audio(demuxer, track->tnum);
+ return 1;
}
}
- sh_a->format = track->a_formattag;
- sh_a->wf->wFormatTag = track->a_formattag;
- sh_a->channels = track->a_channels;
- sh_a->wf->nChannels = track->a_channels;
- sh_a->samplerate = (uint32_t) track->a_sfreq;
- sh_a->wf->nSamplesPerSec = (uint32_t) track->a_sfreq;
- if (track->a_bps == 0)
- {
- sh_a->samplesize = 2;
- sh_a->wf->wBitsPerSample = 16;
+ sh_a->format = track->a_formattag;
+ sh_a->wf->wFormatTag = track->a_formattag;
+ sh_a->channels = track->a_channels;
+ sh_a->wf->nChannels = track->a_channels;
+ sh_a->samplerate = (uint32_t) track->a_sfreq;
+ sh_a->wf->nSamplesPerSec = (uint32_t) track->a_sfreq;
+ if (track->a_bps == 0) {
+ sh_a->samplesize = 2;
+ sh_a->wf->wBitsPerSample = 16;
+ } else {
+ sh_a->samplesize = track->a_bps / 8;
+ sh_a->wf->wBitsPerSample = track->a_bps;
}
- else
- {
- sh_a->samplesize = track->a_bps / 8;
- sh_a->wf->wBitsPerSample = track->a_bps;
- }
- if (track->a_formattag == 0x0055) /* MP3 || MP2 */
- {
- sh_a->wf->nAvgBytesPerSec = 16000;
- sh_a->wf->nBlockAlign = 1152;
- }
- else if ((track->a_formattag == 0x2000) || /* AC3 */
- (track->a_formattag == 0x2001)) /* DTS */
- {
- free(sh_a->wf);
- sh_a->wf = NULL;
- }
- else if (track->a_formattag == 0x0001) /* PCM || PCM_BE */
- {
- sh_a->wf->nAvgBytesPerSec = sh_a->channels * sh_a->samplerate*2;
- sh_a->wf->nBlockAlign = sh_a->wf->nAvgBytesPerSec;
- if (!strcmp(track->codec_id, MKV_A_PCM_BE))
- sh_a->format = mmioFOURCC('t', 'w', 'o', 's');
- }
- else if (!strcmp(track->codec_id, MKV_A_QDMC) ||
- !strcmp(track->codec_id, MKV_A_QDMC2))
- {
- sh_a->wf->nAvgBytesPerSec = 16000;
- sh_a->wf->nBlockAlign = 1486;
- track->fix_i_bps = 1;
- track->qt_last_a_pts = 0.0;
- if (track->private_data != NULL)
- {
- sh_a->codecdata=malloc(track->private_size);
- memcpy (sh_a->codecdata, track->private_data,
- track->private_size);
- sh_a->codecdata_len = track->private_size;
+ if (track->a_formattag == 0x0055) { /* MP3 || MP2 */
+ sh_a->wf->nAvgBytesPerSec = 16000;
+ sh_a->wf->nBlockAlign = 1152;
+ } else if ((track->a_formattag == 0x2000) /* AC3 */
+ || (track->a_formattag == 0x2001)) { /* DTS */
+ free(sh_a->wf);
+ sh_a->wf = NULL;
+ } else if (track->a_formattag == 0x0001) { /* PCM || PCM_BE */
+ sh_a->wf->nAvgBytesPerSec = sh_a->channels * sh_a->samplerate * 2;
+ sh_a->wf->nBlockAlign = sh_a->wf->nAvgBytesPerSec;
+ if (!strcmp(track->codec_id, MKV_A_PCM_BE))
+ sh_a->format = mmioFOURCC('t', 'w', 'o', 's');
+ } else if (!strcmp(track->codec_id, MKV_A_QDMC)
+ || !strcmp(track->codec_id, MKV_A_QDMC2)) {
+ sh_a->wf->nAvgBytesPerSec = 16000;
+ sh_a->wf->nBlockAlign = 1486;
+ track->fix_i_bps = 1;
+ track->qt_last_a_pts = 0.0;
+ if (track->private_data != NULL) {
+ sh_a->codecdata = malloc(track->private_size);
+ memcpy(sh_a->codecdata, track->private_data, track->private_size);
+ sh_a->codecdata_len = track->private_size;
}
- }
- else if (track->a_formattag == mmioFOURCC('M', 'P', '4', 'A'))
- {
- int profile, srate_idx;
-
- sh_a->wf->nAvgBytesPerSec = 16000;
- sh_a->wf->nBlockAlign = 1024;
-
- if (!strcmp (track->codec_id, MKV_A_AAC) &&
- (NULL != track->private_data))
- {
- sh_a->codecdata=malloc(track->private_size);
- memcpy (sh_a->codecdata, track->private_data,
- track->private_size);
- sh_a->codecdata_len = track->private_size;
- return 0;
+ } else if (track->a_formattag == mmioFOURCC('M', 'P', '4', 'A')) {
+ int profile, srate_idx;
+
+ sh_a->wf->nAvgBytesPerSec = 16000;
+ sh_a->wf->nBlockAlign = 1024;
+
+ if (!strcmp(track->codec_id, MKV_A_AAC)
+ && (NULL != track->private_data)) {
+ sh_a->codecdata = malloc(track->private_size);
+ memcpy(sh_a->codecdata, track->private_data, track->private_size);
+ sh_a->codecdata_len = track->private_size;
+ return 0;
}
- /* Recreate the 'private data' */
- /* which faad2 uses in its initialization */
- srate_idx = aac_get_sample_rate_index (sh_a->samplerate);
- if (!strncmp (&track->codec_id[12], "MAIN", 4))
- profile = 0;
- else if (!strncmp (&track->codec_id[12], "LC", 2))
- profile = 1;
- else if (!strncmp (&track->codec_id[12], "SSR", 3))
- profile = 2;
- else
- profile = 3;
- sh_a->codecdata = malloc (5);
- sh_a->codecdata[0] = ((profile+1) << 3) | ((srate_idx&0xE) >> 1);
- sh_a->codecdata[1] = ((srate_idx&0x1)<<7)|(track->a_channels<<3);
-
- if (strstr(track->codec_id, "SBR") != NULL)
- {
- /* HE-AAC (aka SBR AAC) */
- sh_a->codecdata_len = 5;
-
- sh_a->samplerate *= 2;
- sh_a->wf->nSamplesPerSec *= 2;
- srate_idx = aac_get_sample_rate_index(sh_a->samplerate);
- sh_a->codecdata[2] = AAC_SYNC_EXTENSION_TYPE >> 3;
- sh_a->codecdata[3] = ((AAC_SYNC_EXTENSION_TYPE&0x07)<<5) | 5;
- sh_a->codecdata[4] = (1 << 7) | (srate_idx << 3);
- track->default_duration = 1024.0 / (sh_a->samplerate / 2);
- }
- else
- {
- sh_a->codecdata_len = 2;
- track->default_duration = 1024.0 / (float)sh_a->samplerate;
+ /* Recreate the 'private data' */
+ /* which faad2 uses in its initialization */
+ srate_idx = aac_get_sample_rate_index(sh_a->samplerate);
+ if (!strncmp(&track->codec_id[12], "MAIN", 4))
+ profile = 0;
+ else if (!strncmp(&track->codec_id[12], "LC", 2))
+ profile = 1;
+ else if (!strncmp(&track->codec_id[12], "SSR", 3))
+ profile = 2;
+ else
+ profile = 3;
+ sh_a->codecdata = malloc(5);
+ sh_a->codecdata[0] = ((profile + 1) << 3) | ((srate_idx & 0xE) >> 1);
+ sh_a->codecdata[1] =
+ ((srate_idx & 0x1) << 7) | (track->a_channels << 3);
+
+ if (strstr(track->codec_id, "SBR") != NULL) {
+ /* HE-AAC (aka SBR AAC) */
+ sh_a->codecdata_len = 5;
+
+ sh_a->samplerate *= 2;
+ sh_a->wf->nSamplesPerSec *= 2;
+ srate_idx = aac_get_sample_rate_index(sh_a->samplerate);
+ sh_a->codecdata[2] = AAC_SYNC_EXTENSION_TYPE >> 3;
+ sh_a->codecdata[3] = ((AAC_SYNC_EXTENSION_TYPE & 0x07) << 5) | 5;
+ sh_a->codecdata[4] = (1 << 7) | (srate_idx << 3);
+ track->default_duration = 1024.0 / (sh_a->samplerate / 2);
+ } else {
+ sh_a->codecdata_len = 2;
+ track->default_duration = 1024.0 / sh_a->samplerate;
}
- }
- else if (track->a_formattag == mmioFOURCC('v', 'r', 'b', 's')) /* VORBIS */
- {
- sh_a->wf->cbSize = track->private_size;
- sh_a->wf = realloc(sh_a->wf, sizeof(WAVEFORMATEX) + sh_a->wf->cbSize);
- memcpy((unsigned char *) (sh_a->wf+1), track->private_data, sh_a->wf->cbSize);
- }
- else if (track->private_size >= RAPROPERTIES4_SIZE
- && !strncmp (track->codec_id, MKV_A_REALATRC, 7))
- {
- /* Common initialization for all RealAudio codecs */
- unsigned char *src = track->private_data;
- int codecdata_length, version;
- int flavor;
-
- sh_a->wf->nAvgBytesPerSec = 0; /* FIXME !? */
-
- version = AV_RB16(src + 4);
- flavor = AV_RB16(src + 22);
- track->coded_framesize = AV_RB32(src + 24);
- track->sub_packet_h = AV_RB16(src + 40);
- sh_a->wf->nBlockAlign =
- track->audiopk_size = AV_RB16(src + 42);
- track->sub_packet_size = AV_RB16(src + 44);
- if (version == 4)
- {
- src += RAPROPERTIES4_SIZE;
- src += src[0] + 1;
- src += src[0] + 1;
- }
- else
- src += RAPROPERTIES5_SIZE;
-
- src += 3;
- if (version == 5)
- src++;
- codecdata_length = AV_RB32(src);
- src += 4;
- sh_a->wf->cbSize = codecdata_length;
- sh_a->wf = realloc (sh_a->wf,
- sizeof (WAVEFORMATEX) +
- sh_a->wf->cbSize);
- memcpy(((char *)(sh_a->wf + 1)), src, codecdata_length);
-
- switch (track->a_formattag) {
+ } else if (track->a_formattag == mmioFOURCC('v', 'r', 'b', 's')) { /* VORBIS */
+ sh_a->wf->cbSize = track->private_size;
+ sh_a->wf = realloc(sh_a->wf, sizeof(WAVEFORMATEX) + sh_a->wf->cbSize);
+ memcpy((unsigned char *) (sh_a->wf + 1), track->private_data,
+ sh_a->wf->cbSize);
+ } else if (track->private_size >= RAPROPERTIES4_SIZE
+ && !strncmp(track->codec_id, MKV_A_REALATRC, 7)) {
+ /* Common initialization for all RealAudio codecs */
+ unsigned char *src = track->private_data;
+ int codecdata_length, version;
+ int flavor;
+
+ sh_a->wf->nAvgBytesPerSec = 0; /* FIXME !? */
+
+ version = AV_RB16(src + 4);
+ flavor = AV_RB16(src + 22);
+ track->coded_framesize = AV_RB32(src + 24);
+ track->sub_packet_h = AV_RB16(src + 40);
+ sh_a->wf->nBlockAlign = track->audiopk_size = AV_RB16(src + 42);
+ track->sub_packet_size = AV_RB16(src + 44);
+ if (version == 4) {
+ src += RAPROPERTIES4_SIZE;
+ src += src[0] + 1;
+ src += src[0] + 1;
+ } else
+ src += RAPROPERTIES5_SIZE;
+
+ src += 3;
+ if (version == 5)
+ src++;
+ codecdata_length = AV_RB32(src);
+ src += 4;
+ sh_a->wf->cbSize = codecdata_length;
+ sh_a->wf = realloc(sh_a->wf, sizeof(WAVEFORMATEX) + sh_a->wf->cbSize);
+ memcpy(((char *) (sh_a->wf + 1)), src, codecdata_length);
+
+ switch (track->a_formattag) {
case mmioFOURCC('a', 't', 'r', 'c'):
- sh_a->wf->nAvgBytesPerSec = atrc_fl2bps[flavor];
- sh_a->wf->nBlockAlign = track->sub_packet_size;
- track->audio_buf = malloc(track->sub_packet_h * track->audiopk_size);
- track->audio_timestamp = malloc(track->sub_packet_h * sizeof(float));
- break;
+ sh_a->wf->nAvgBytesPerSec = atrc_fl2bps[flavor];
+ sh_a->wf->nBlockAlign = track->sub_packet_size;
+ track->audio_buf =
+ malloc(track->sub_packet_h * track->audiopk_size);
+ track->audio_timestamp =
+ malloc(track->sub_packet_h * sizeof(double));
+ break;
case mmioFOURCC('c', 'o', 'o', 'k'):
- sh_a->wf->nAvgBytesPerSec = cook_fl2bps[flavor];
- sh_a->wf->nBlockAlign = track->sub_packet_size;
- track->audio_buf = malloc(track->sub_packet_h * track->audiopk_size);
- track->audio_timestamp = malloc(track->sub_packet_h * sizeof(float));
- break;
+ sh_a->wf->nAvgBytesPerSec = cook_fl2bps[flavor];
+ sh_a->wf->nBlockAlign = track->sub_packet_size;
+ track->audio_buf =
+ malloc(track->sub_packet_h * track->audiopk_size);
+ track->audio_timestamp =
+ malloc(track->sub_packet_h * sizeof(double));
+ break;
case mmioFOURCC('s', 'i', 'p', 'r'):
- sh_a->wf->nAvgBytesPerSec = sipr_fl2bps[flavor];
- sh_a->wf->nBlockAlign = track->coded_framesize;
- track->audio_buf = malloc(track->sub_packet_h * track->audiopk_size);
- track->audio_timestamp = malloc(track->sub_packet_h * sizeof(float));
- break;
+ sh_a->wf->nAvgBytesPerSec = sipr_fl2bps[flavor];
+ sh_a->wf->nBlockAlign = track->coded_framesize;
+ track->audio_buf =
+ malloc(track->sub_packet_h * track->audiopk_size);
+ track->audio_timestamp =
+ malloc(track->sub_packet_h * sizeof(double));
+ break;
case mmioFOURCC('2', '8', '_', '8'):
- sh_a->wf->nAvgBytesPerSec = 3600;
- sh_a->wf->nBlockAlign = track->coded_framesize;
- track->audio_buf = malloc(track->sub_packet_h * track->audiopk_size);
- track->audio_timestamp = malloc(track->sub_packet_h * sizeof(float));
- break;
- }
-
- track->realmedia = 1;
- }
- else if (!strcmp(track->codec_id, MKV_A_FLAC) ||
- (track->a_formattag == 0xf1ac))
- {
- unsigned char *ptr;
- int size;
- free(sh_a->wf);
- sh_a->wf = NULL;
-
- if (track->a_formattag == mmioFOURCC('f', 'L', 'a', 'C'))
- {
- ptr = (unsigned char *)track->private_data;
- size = track->private_size;
- }
- else
- {
- sh_a->format = mmioFOURCC('f', 'L', 'a', 'C');
- ptr = (unsigned char *) track->private_data
- + sizeof (WAVEFORMATEX);
- size = track->private_size - sizeof (WAVEFORMATEX);
+ sh_a->wf->nAvgBytesPerSec = 3600;
+ sh_a->wf->nBlockAlign = track->coded_framesize;
+ track->audio_buf =
+ malloc(track->sub_packet_h * track->audiopk_size);
+ track->audio_timestamp =
+ malloc(track->sub_packet_h * sizeof(double));
+ break;
}
- if (size < 4 || ptr[0] != 'f' || ptr[1] != 'L' ||
- ptr[2] != 'a' || ptr[3] != 'C')
- {
- dp = new_demux_packet (4);
- memcpy (dp->buffer, "fLaC", 4);
+
+ track->realmedia = 1;
+ } else if (!strcmp(track->codec_id, MKV_A_FLAC)
+ || (track->a_formattag == 0xf1ac)) {
+ unsigned char *ptr;
+ int size;
+ free(sh_a->wf);
+ sh_a->wf = NULL;
+
+ if (track->a_formattag == mmioFOURCC('f', 'L', 'a', 'C')) {
+ ptr = track->private_data;
+ size = track->private_size;
+ } else {
+ sh_a->format = mmioFOURCC('f', 'L', 'a', 'C');
+ ptr = track->private_data + sizeof(WAVEFORMATEX);
+ size = track->private_size - sizeof(WAVEFORMATEX);
}
- else
- {
- dp = new_demux_packet (size);
- memcpy (dp->buffer, ptr, size);
+ if (size < 4 || ptr[0] != 'f' || ptr[1] != 'L' || ptr[2] != 'a'
+ || ptr[3] != 'C') {
+ sh_a->codecdata = malloc(4);
+ sh_a->codecdata_len = 4;
+ memcpy(sh_a->codecdata, "fLaC", 4);
+ } else {
+ sh_a->codecdata = malloc(size);
+ sh_a->codecdata_len = size;
+ memcpy(sh_a->codecdata, ptr, size);
}
- dp->pts = 0;
- dp->flags = 0;
- ds_add_packet (demuxer->audio, dp);
- }
- else if (track->a_formattag == mmioFOURCC('W', 'V', 'P', 'K') ||
- track->a_formattag == mmioFOURCC('T', 'R', 'H', 'D'))
- { /* do nothing, still works */ }
- else if (!track->ms_compat || (track->private_size < sizeof(WAVEFORMATEX)))
- {
- free_sh_audio(demuxer, track->tnum);
- return 1;
+ } else if (track->a_formattag == mmioFOURCC('W', 'V', 'P', 'K') || track->a_formattag == mmioFOURCC('T', 'R', 'H', 'D')) { /* do nothing, still works */
+ } else if (!track->ms_compat
+ || (track->private_size < sizeof(WAVEFORMATEX))) {
+ free_sh_audio(demuxer, track->tnum);
+ return 1;
}
- return 0;
+ return 0;
}
-static int
-demux_mkv_open_sub (demuxer_t *demuxer, mkv_track_t *track, int sid)
+static int demux_mkv_open_sub(demuxer_t *demuxer, mkv_track_t *track,
+ int sid)
{
- if (track->subtitle_type != MATROSKA_SUBTYPE_UNKNOWN)
- {
- int size, m;
- uint8_t *buffer;
- sh_sub_t *sh = new_sh_sub_sid(demuxer, track->tnum, sid);
- track->sh_sub = sh;
- sh->type = 't';
- if (track->subtitle_type == MATROSKA_SUBTYPE_VOBSUB)
- sh->type = 'v';
- if (track->subtitle_type == MATROSKA_SUBTYPE_SSA)
- sh->type = 'a';
- size = track->private_size;
- m = demux_mkv_decode (track,track->private_data,&buffer,&size,2);
- if (buffer && m)
- {
- free (track->private_data);
- track->private_data = buffer;
- track->private_size = size;
+ if (track->subtitle_type != MATROSKA_SUBTYPE_UNKNOWN) {
+ int size;
+ uint8_t *buffer;
+ sh_sub_t *sh = new_sh_sub_sid(demuxer, track->tnum, sid);
+ track->sh_sub = sh;
+ sh->type = 't';
+ if (track->subtitle_type == MATROSKA_SUBTYPE_VOBSUB)
+ sh->type = 'v';
+ if (track->subtitle_type == MATROSKA_SUBTYPE_SSA)
+ sh->type = 'a';
+ size = track->private_size;
+ demux_mkv_decode(track, track->private_data, &buffer, &size, 2);
+ if (buffer && buffer != track->private_data) {
+ free(track->private_data);
+ track->private_data = buffer;
+ track->private_size = size;
}
- sh->extradata=malloc(track->private_size);
- memcpy (sh->extradata, track->private_data,
- track->private_size);
- sh->extradata_len = track->private_size;
- if (track->language && (strcmp(track->language, "und") != 0))
- sh->lang = strdup(track->language);
- sh->default_track = track->default_track;
- }
- else
- {
- mp_msg (MSGT_DEMUX, MSGL_ERR, MSGTR_MPDEMUX_MKV_SubtitleTypeNotSupported,
- track->codec_id);
- return 1;
+ sh->extradata = malloc(track->private_size);
+ memcpy(sh->extradata, track->private_data, track->private_size);
+ sh->extradata_len = track->private_size;
+ if (track->language && (strcmp(track->language, "und") != 0))
+ sh->lang = strdup(track->language);
+ sh->default_track = track->default_track;
+ } else {
+ mp_tmsg(MSGT_DEMUX, MSGL_ERR,
+ "[mkv] Subtitle type '%s' is not supported.\n",
+ track->codec_id);
+ return 1;
}
- return 0;
+ return 0;
}
-static void demux_mkv_seek (demuxer_t *demuxer, float rel_seek_secs, float audio_delay, int flags);
-
-static int
-demux_mkv_open (demuxer_t *demuxer)
+static int demux_mkv_open(demuxer_t *demuxer)
{
- stream_t *s = demuxer->stream;
- mkv_demuxer_t *mkv_d;
- mkv_track_t *track;
- int i, version, cont = 0;
- char *str;
-
- stream_seek(s, s->start_pos);
- str = ebml_read_header (s, &version);
- if (str == NULL || strcmp (str, "matroska") || version > 2)
- {
- mp_msg (MSGT_DEMUX, MSGL_DBG2, "[mkv] no head found\n");
- return 0;
+ stream_t *s = demuxer->stream;
+ mkv_demuxer_t *mkv_d;
+ mkv_track_t *track;
+ int i, cont = 0;
+
+ stream_seek(s, s->start_pos);
+ if (ebml_read_id(s, NULL) != EBML_ID_EBML)
+ return 0;
+ struct ebml_ebml ebml_master = {};
+ struct ebml_parse_ctx parse_ctx = { .no_error_messages = true };
+ if (ebml_read_element(s, &parse_ctx, &ebml_master, &ebml_ebml_desc) < 0)
+ return 0;
+ if (ebml_master.doc_type.len != 8 || strncmp(ebml_master.doc_type.start,
+ "matroska", 8)) {
+ mp_msg(MSGT_DEMUX, MSGL_DBG2, "[mkv] no head found\n");
+ talloc_free(parse_ctx.talloc_ctx);
+ return 0;
+ }
+ if (ebml_master.doc_type_read_version > 2) {
+ mp_msg(MSGT_DEMUX, MSGL_WARN, "[mkv] This looks like a Matroska file, "
+ "but we don't support format version %"PRIu64"\n",
+ ebml_master.doc_type_read_version);
+ talloc_free(parse_ctx.talloc_ctx);
+ return 0;
+ }
+ if ((ebml_master.n_ebml_read_version
+ && ebml_master.ebml_read_version != EBML_VERSION)
+ || (ebml_master.n_ebml_max_size_length
+ && ebml_master.ebml_max_size_length > 8)
+ || (ebml_master.n_ebml_max_id_length
+ && ebml_master.ebml_max_id_length != 4)) {
+ mp_msg(MSGT_DEMUX, MSGL_WARN, "[mkv] This looks like a Matroska file, "
+ "but the header has bad parameters\n");
+ talloc_free(parse_ctx.talloc_ctx);
+ return 0;
}
- free (str);
+ talloc_free(parse_ctx.talloc_ctx);
- mp_msg (MSGT_DEMUX, MSGL_V, "[mkv] Found the head...\n");
+ mp_msg(MSGT_DEMUX, MSGL_V, "[mkv] Found the head...\n");
- if (ebml_read_id (s, NULL) != MATROSKA_ID_SEGMENT)
- {
- mp_msg (MSGT_DEMUX, MSGL_V, "[mkv] but no segment :(\n");
- return 0;
+ if (ebml_read_id(s, NULL) != MATROSKA_ID_SEGMENT) {
+ mp_msg(MSGT_DEMUX, MSGL_V, "[mkv] but no segment :(\n");
+ return 0;
}
- ebml_read_length (s, NULL); /* return bytes number until EOF */
-
- mp_msg (MSGT_DEMUX, MSGL_V, "[mkv] + a segment...\n");
-
- mkv_d = calloc (1, sizeof (mkv_demuxer_t));
- demuxer->priv = mkv_d;
- mkv_d->tc_scale = 1000000;
- mkv_d->segment_start = stream_tell (s);
- mkv_d->parsed_cues = malloc (sizeof (off_t));
- mkv_d->parsed_seekhead = malloc (sizeof (off_t));
-
- while (!cont)
- {
- switch (ebml_read_id (s, NULL))
- {
- case MATROSKA_ID_INFO:
- mp_msg (MSGT_DEMUX, MSGL_V, "[mkv] |+ segment information...\n");
- cont = demux_mkv_read_info (demuxer);
- break;
-
- case MATROSKA_ID_TRACKS:
- mp_msg (MSGT_DEMUX, MSGL_V, "[mkv] |+ segment tracks...\n");
- cont = demux_mkv_read_tracks (demuxer);
- break;
-
- case MATROSKA_ID_CUES:
- cont = demux_mkv_read_cues (demuxer);
- break;
-
- case MATROSKA_ID_TAGS:
- cont = demux_mkv_read_tags (demuxer);
- break;
-
- case MATROSKA_ID_SEEKHEAD:
- cont = demux_mkv_read_seekhead (demuxer);
- break;
-
- case MATROSKA_ID_CHAPTERS:
- cont = demux_mkv_read_chapters (demuxer);
- break;
-
- case MATROSKA_ID_ATTACHMENTS:
- cont = demux_mkv_read_attachments (demuxer);
- break;
+ ebml_read_length(s, NULL); /* return bytes number until EOF */
+
+ mp_msg(MSGT_DEMUX, MSGL_V, "[mkv] + a segment...\n");
+ mkv_d = talloc_zero(demuxer, struct mkv_demuxer);
+ demuxer->priv = mkv_d;
+ mkv_d->tc_scale = 1000000;
+ mkv_d->segment_start = stream_tell(s);
+
+ while (!cont) {
+ uint32_t id = ebml_read_id(s, NULL);
+ switch (id) {
case MATROSKA_ID_CLUSTER:
- {
- int p, l;
- mp_msg (MSGT_DEMUX, MSGL_V, "[mkv] |+ found cluster, headers are "
- "parsed completely :)\n");
- /* get the first cluster timecode */
- p = stream_tell(s);
- l = ebml_read_length (s, NULL);
- while (ebml_read_id (s, NULL) != MATROSKA_ID_CLUSTERTIMECODE)
- {
- ebml_read_skip (s, NULL);
- if (stream_tell (s) >= p + l)
- break;
- }
- if (stream_tell (s) < p + l)
- {
- uint64_t num = ebml_read_uint (s, NULL);
- if (num == EBML_UINT_INVALID)
- return 0;
- mkv_d->first_tc = num * mkv_d->tc_scale / 1000000.0;
- mkv_d->has_first_tc = 1;
- }
- stream_seek (s, p - 4);
+ mp_msg(MSGT_DEMUX, MSGL_V,
+ "[mkv] |+ found cluster, headers are "
+ "parsed completely :)\n");
+ stream_seek(s, stream_tell(s) - 4);
cont = 1;
break;
- }
default:
- cont = 1;
+ cont = read_header_element(demuxer, id, 0) < 1;
+ break;
case EBML_ID_VOID:
- ebml_read_skip (s, NULL);
- break;
+ ebml_read_skip(s, NULL);
+ break;
}
}
- display_create_tracks (demuxer);
-
- /* select video track */
- track = NULL;
- if (demuxer->video->id == -1) /* automatically select a video track */
- {
- /* search for a video track that has the 'default' flag set */
- for (i=0; i<mkv_d->num_tracks; i++)
- if (mkv_d->tracks[i]->type == MATROSKA_TRACK_VIDEO
- && mkv_d->tracks[i]->default_track)
- {
- track = mkv_d->tracks[i];
- break;
- }
+ display_create_tracks(demuxer);
- if (track == NULL)
- /* no track has the 'default' flag set */
- /* let's take the first video track */
- for (i=0; i<mkv_d->num_tracks; i++)
- if (mkv_d->tracks[i]->type == MATROSKA_TRACK_VIDEO)
- {
- track = mkv_d->tracks[i];
- break;
+ /* select video track */
+ track = NULL;
+ if (demuxer->video->id == -1) { /* automatically select a video track */
+ /* search for a video track that has the 'default' flag set */
+ for (i = 0; i < mkv_d->num_tracks; i++)
+ if (mkv_d->tracks[i]->type == MATROSKA_TRACK_VIDEO
+ && mkv_d->tracks[i]->default_track) {
+ track = mkv_d->tracks[i];
+ break;
}
- }
- else if (demuxer->video->id != -2) /* -2 = no video at all */
- track = demux_mkv_find_track_by_num (mkv_d, demuxer->video->id,
- MATROSKA_TRACK_VIDEO);
-
- if (track && demuxer->v_streams[track->tnum])
- {
- mp_msg (MSGT_DEMUX, MSGL_INFO,
- MSGTR_MPDEMUX_MKV_WillPlayVideoTrack, track->tnum);
- demuxer->video->id = track->tnum;
- demuxer->video->sh = demuxer->v_streams[track->tnum];
- }
- else
- {
- mp_msg (MSGT_DEMUX, MSGL_INFO, MSGTR_MPDEMUX_MKV_NoVideoTrackFound);
- demuxer->video->id = -2;
+
+ if (track == NULL)
+ /* no track has the 'default' flag set */
+ /* let's take the first video track */
+ for (i = 0; i < mkv_d->num_tracks; i++)
+ if (mkv_d->tracks[i]->type == MATROSKA_TRACK_VIDEO) {
+ track = mkv_d->tracks[i];
+ break;
+ }
+ } else if (demuxer->video->id != -2) /* -2 = no video at all */
+ track =
+ demux_mkv_find_track_by_num(mkv_d, demuxer->video->id,
+ MATROSKA_TRACK_VIDEO);
+
+ if (track && demuxer->v_streams[track->tnum]) {
+ mp_tmsg(MSGT_DEMUX, MSGL_INFO, "[mkv] Will play video track %u.\n",
+ track->tnum);
+ demuxer->video->id = track->tnum;
+ demuxer->video->sh = demuxer->v_streams[track->tnum];
+ } else {
+ mp_tmsg(MSGT_DEMUX, MSGL_INFO, "[mkv] No video track found/wanted.\n");
+ demuxer->video->id = -2;
}
- /* select audio track */
- track = NULL;
- if (track == NULL)
- /* search for an audio track that has the 'default' flag set */
- for (i=0; i < mkv_d->num_tracks; i++)
- if (mkv_d->tracks[i]->type == MATROSKA_TRACK_AUDIO
- && mkv_d->tracks[i]->default_track)
- {
- track = mkv_d->tracks[i];
- break;
- }
+ /* select audio track */
+ track = NULL;
+ if (track == NULL)
+ /* search for an audio track that has the 'default' flag set */
+ for (i = 0; i < mkv_d->num_tracks; i++)
+ if (mkv_d->tracks[i]->type == MATROSKA_TRACK_AUDIO
+ && mkv_d->tracks[i]->default_track) {
+ track = mkv_d->tracks[i];
+ break;
+ }
- if (track == NULL)
- /* no track has the 'default' flag set */
- /* let's take the first audio track */
- for (i=0; i < mkv_d->num_tracks; i++)
- if (mkv_d->tracks[i]->type == MATROSKA_TRACK_AUDIO)
- {
- track = mkv_d->tracks[i];
- break;
- }
+ if (track == NULL)
+ /* no track has the 'default' flag set */
+ /* let's take the first audio track */
+ for (i = 0; i < mkv_d->num_tracks; i++)
+ if (mkv_d->tracks[i]->type == MATROSKA_TRACK_AUDIO) {
+ track = mkv_d->tracks[i];
+ break;
+ }
- if (track && demuxer->a_streams[track->tnum])
- {
- demuxer->audio->id = track->tnum;
- demuxer->audio->sh = demuxer->a_streams[track->tnum];
- }
- else
- {
- mp_msg (MSGT_DEMUX, MSGL_INFO, MSGTR_MPDEMUX_MKV_NoAudioTrackFound);
- demuxer->audio->id = -2;
+ if (track && demuxer->a_streams[track->tnum]) {
+ demuxer->audio->id = track->tnum;
+ demuxer->audio->sh = demuxer->a_streams[track->tnum];
+ } else {
+ mp_tmsg(MSGT_DEMUX, MSGL_INFO, "[mkv] No audio track found/wanted.\n");
+ demuxer->audio->id = -2;
}
- if(demuxer->audio->id != -2)
- for (i=0; i < mkv_d->num_tracks; i++)
- {
- if(mkv_d->tracks[i]->type != MATROSKA_TRACK_AUDIO)
- continue;
- if(demuxer->a_streams[track->tnum])
- {
- mkv_d->last_aid++;
- if(mkv_d->last_aid == MAX_A_STREAMS)
- break;
+ if (demuxer->audio->id != -2)
+ for (i = 0; i < mkv_d->num_tracks; i++) {
+ if (mkv_d->tracks[i]->type != MATROSKA_TRACK_AUDIO)
+ continue;
+ if (demuxer->a_streams[track->tnum]) {
+ mkv_d->last_aid++;
+ if (mkv_d->last_aid == MAX_A_STREAMS)
+ break;
+ }
}
- }
- if (demuxer->chapters)
- {
- for (i=0; i < (int)demuxer->num_chapters; i++)
- {
- demuxer->chapters[i].start -= mkv_d->first_tc;
- demuxer->chapters[i].end -= mkv_d->first_tc;
- }
- if (dvd_last_chapter > 0 && dvd_last_chapter <= demuxer->num_chapters)
- {
- if (demuxer->chapters[dvd_last_chapter-1].end != 0)
- mkv_d->stop_timecode = demuxer->chapters[dvd_last_chapter-1].end;
- else if (dvd_last_chapter + 1 <= demuxer->num_chapters)
- mkv_d->stop_timecode = demuxer->chapters[dvd_last_chapter].start;
- }
+ if (s->end_pos == 0 || (mkv_d->indexes == NULL && index_mode < 0))
+ demuxer->seekable = 0;
+ else {
+ demuxer->movi_start = s->start_pos;
+ demuxer->movi_end = s->end_pos;
+ demuxer->seekable = 1;
}
- if (s->end_pos == 0 || (mkv_d->indexes == NULL && index_mode < 0))
- demuxer->seekable = 0;
- else
- {
- demuxer->movi_start = s->start_pos;
- demuxer->movi_end = s->end_pos;
- demuxer->seekable = 1;
- }
+ demuxer->accurate_seek = true;
- return DEMUXER_TYPE_MATROSKA;
+ return DEMUXER_TYPE_MATROSKA;
}
-static void
-demux_close_mkv (demuxer_t *demuxer)
+static void demux_close_mkv(demuxer_t *demuxer)
{
- mkv_demuxer_t *mkv_d = (mkv_demuxer_t *) demuxer->priv;
-
- if (mkv_d)
- {
- int i;
- free_cached_dps (demuxer);
- if (mkv_d->tracks)
- {
- for (i=0; i<mkv_d->num_tracks; i++)
- demux_mkv_free_trackentry(mkv_d->tracks[i]);
- free (mkv_d->tracks);
+ mkv_demuxer_t *mkv_d = (mkv_demuxer_t *) demuxer->priv;
+
+ if (mkv_d) {
+ int i;
+ free_cached_dps(demuxer);
+ if (mkv_d->tracks) {
+ for (i = 0; i < mkv_d->num_tracks; i++)
+ demux_mkv_free_trackentry(mkv_d->tracks[i]);
}
- free (mkv_d->indexes);
- free (mkv_d->cluster_positions);
- free (mkv_d->parsed_cues);
- free (mkv_d->parsed_seekhead);
- free (mkv_d);
+ free(mkv_d->indexes);
+ free(mkv_d->cluster_positions);
}
}
-static int
-demux_mkv_read_block_lacing (uint8_t *buffer, uint64_t *size,
- uint8_t *laces, uint32_t **all_lace_sizes)
+static int demux_mkv_read_block_lacing(uint8_t *buffer, uint64_t *size,
+ uint8_t *laces,
+ uint32_t **all_lace_sizes)
{
- uint32_t total = 0, *lace_size;
- uint8_t flags;
- int i;
-
- *all_lace_sizes = NULL;
- lace_size = NULL;
- /* lacing flags */
- flags = *buffer++;
- (*size)--;
-
- switch ((flags & 0x06) >> 1)
- {
- case 0: /* no lacing */
- *laces = 1;
- lace_size = calloc(*laces, sizeof(uint32_t));
- lace_size[0] = *size;
- break;
-
- case 1: /* xiph lacing */
- case 2: /* fixed-size lacing */
- case 3: /* EBML lacing */
- *laces = *buffer++;
- (*size)--;
- (*laces)++;
- lace_size = calloc(*laces, sizeof(uint32_t));
-
- switch ((flags & 0x06) >> 1)
- {
- case 1: /* xiph lacing */
- for (i=0; i < *laces-1; i++)
- {
- lace_size[i] = 0;
- do
- {
- lace_size[i] += *buffer;
- (*size)--;
+ uint32_t total = 0, *lace_size;
+ uint8_t flags;
+ int i;
+
+ *all_lace_sizes = NULL;
+ lace_size = NULL;
+ /* lacing flags */
+ flags = *buffer++;
+ (*size)--;
+
+ switch ((flags & 0x06) >> 1) {
+ case 0: /* no lacing */
+ *laces = 1;
+ lace_size = calloc(*laces, sizeof(uint32_t));
+ lace_size[0] = *size;
+ break;
+
+ case 1: /* xiph lacing */
+ case 2: /* fixed-size lacing */
+ case 3: /* EBML lacing */
+ *laces = *buffer++;
+ (*size)--;
+ (*laces)++;
+ lace_size = calloc(*laces, sizeof(uint32_t));
+
+ switch ((flags & 0x06) >> 1) {
+ case 1: /* xiph lacing */
+ for (i = 0; i < *laces - 1; i++) {
+ lace_size[i] = 0;
+ do {
+ lace_size[i] += *buffer;
+ (*size)--;
} while (*buffer++ == 0xFF);
- total += lace_size[i];
+ total += lace_size[i];
}
- lace_size[i] = *size - total;
- break;
+ lace_size[i] = *size - total;
+ break;
- case 2: /* fixed-size lacing */
- for (i=0; i < *laces; i++)
- lace_size[i] = *size / *laces;
- break;
+ case 2: /* fixed-size lacing */
+ for (i = 0; i < *laces; i++)
+ lace_size[i] = *size / *laces;
+ break;
- case 3: /* EBML lacing */
- {
+ case 3:; /* EBML lacing */
int l;
- uint64_t num = ebml_read_vlen_uint (buffer, &l);
+ uint64_t num = ebml_read_vlen_uint(buffer, &l);
if (num == EBML_UINT_INVALID) {
- free(lace_size);
- return 1;
+ free(lace_size);
+ return 1;
}
buffer += l;
*size -= l;
total = lace_size[0] = num;
- for (i=1; i < *laces-1; i++)
- {
+ for (i = 1; i < *laces - 1; i++) {
int64_t snum;
- snum = ebml_read_vlen_int (buffer, &l);
+ snum = ebml_read_vlen_int(buffer, &l);
if (snum == EBML_INT_INVALID) {
- free(lace_size);
- return 1;
+ free(lace_size);
+ return 1;
}
buffer += l;
*size -= l;
- lace_size[i] = lace_size[i-1] + snum;
+ lace_size[i] = lace_size[i - 1] + snum;
total += lace_size[i];
- }
+ }
lace_size[i] = *size - total;
break;
- }
}
- break;
+ break;
}
- *all_lace_sizes = lace_size;
- return 0;
+ *all_lace_sizes = lace_size;
+ return 0;
}
-static void
-handle_subtitles(demuxer_t *demuxer, mkv_track_t *track, char *block,
- int64_t size, uint64_t block_duration, uint64_t timecode)
+static void handle_subtitles(demuxer_t *demuxer, mkv_track_t *track,
+ char *block, int64_t size,
+ uint64_t block_duration, uint64_t timecode)
{
- demux_packet_t *dp;
+ demux_packet_t *dp;
- if (block_duration == 0)
- {
- mp_msg (MSGT_DEMUX, MSGL_WARN,
- MSGTR_MPDEMUX_MKV_NoBlockDurationForSubtitleTrackFound);
- return;
+ if (block_duration == 0) {
+ mp_msg(MSGT_DEMUX, MSGL_WARN,
+ "[mkv] Warning: No BlockDuration for subtitle track found.\n");
+ return;
}
- sub_utf8 = 1;
- dp = new_demux_packet(size);
- memcpy(dp->buffer, block, size);
- dp->pts = timecode / 1000.0f;
- dp->endpts = (timecode + block_duration) / 1000.0f;
- ds_add_packet(demuxer->sub, dp);
+ sub_utf8 = 1;
+ dp = new_demux_packet(size);
+ memcpy(dp->buffer, block, size);
+ dp->pts = timecode / 1000.0;
+ dp->endpts = (timecode + block_duration) / 1000.0;
+ ds_add_packet(demuxer->sub, dp);
}
-double real_fix_timestamp(unsigned char *buf, unsigned int timestamp, unsigned int format, int64_t *kf_base, int *kf_pts, double *pts);
+double real_fix_timestamp(unsigned char *buf, unsigned int timestamp,
+ unsigned int format, int64_t *kf_base, int *kf_pts,
+ double *pts);
-static void
-handle_realvideo (demuxer_t *demuxer, mkv_track_t *track, uint8_t *buffer,
- uint32_t size, int block_bref)
+static void handle_realvideo(demuxer_t *demuxer, mkv_track_t *track,
+ uint8_t *buffer, uint32_t size, int block_bref)
{
- mkv_demuxer_t *mkv_d = (mkv_demuxer_t *) demuxer->priv;
- demux_packet_t *dp;
- uint32_t timestamp = mkv_d->last_pts * 1000;
-
- dp = new_demux_packet (size);
- memcpy (dp->buffer, buffer, size);
-
- if (mkv_d->v_skip_to_keyframe)
- {
- dp->pts = mkv_d->last_pts;
- track->rv_kf_base = 0;
- track->rv_kf_pts = timestamp;
- }
- else
- dp->pts = real_fix_timestamp (dp->buffer, timestamp,
- ((sh_video_t*)demuxer->video->sh)->bih->biCompression,
- &track->rv_kf_base, &track->rv_kf_pts, NULL);
- dp->pos = demuxer->filepos;
- dp->flags = block_bref ? 0 : 0x10;
-
- ds_add_packet(demuxer->video, dp);
+ mkv_demuxer_t *mkv_d = (mkv_demuxer_t *) demuxer->priv;
+ demux_packet_t *dp;
+ uint32_t timestamp = mkv_d->last_pts * 1000;
+
+ dp = new_demux_packet(size);
+ memcpy(dp->buffer, buffer, size);
+
+ if (mkv_d->v_skip_to_keyframe) {
+ dp->pts = mkv_d->last_pts;
+ track->rv_kf_base = 0;
+ track->rv_kf_pts = timestamp;
+ } else
+ dp->pts =
+ real_fix_timestamp(dp->buffer, timestamp,
+ ((sh_video_t *) demuxer->video->sh)->bih->
+ biCompression, &track->rv_kf_base,
+ &track->rv_kf_pts, NULL);
+ dp->pos = demuxer->filepos;
+ dp->flags = block_bref ? 0 : 0x10;
+
+ ds_add_packet(demuxer->video, dp);
}
-static void
-handle_realaudio (demuxer_t *demuxer, mkv_track_t *track, uint8_t *buffer,
- uint32_t size, int block_bref)
+static void handle_realaudio(demuxer_t *demuxer, mkv_track_t *track,
+ uint8_t *buffer, uint32_t size, int block_bref)
{
- mkv_demuxer_t *mkv_d = (mkv_demuxer_t *) demuxer->priv;
- int sps = track->sub_packet_size;
- int sph = track->sub_packet_h;
- int cfs = track->coded_framesize;
- int w = track->audiopk_size;
- int spc = track->sub_packet_cnt;
- demux_packet_t *dp;
- int x;
-
- if ((track->a_formattag == mmioFOURCC('2', '8', '_', '8')) ||
- (track->a_formattag == mmioFOURCC('c', 'o', 'o', 'k')) ||
- (track->a_formattag == mmioFOURCC('a', 't', 'r', 'c')) ||
- (track->a_formattag == mmioFOURCC('s', 'i', 'p', 'r')))
- {
+ mkv_demuxer_t *mkv_d = (mkv_demuxer_t *) demuxer->priv;
+ int sps = track->sub_packet_size;
+ int sph = track->sub_packet_h;
+ int cfs = track->coded_framesize;
+ int w = track->audiopk_size;
+ int spc = track->sub_packet_cnt;
+ demux_packet_t *dp;
+ int x;
+
+ if ((track->a_formattag == mmioFOURCC('2', '8', '_', '8'))
+ || (track->a_formattag == mmioFOURCC('c', 'o', 'o', 'k'))
+ || (track->a_formattag == mmioFOURCC('a', 't', 'r', 'c'))
+ || (track->a_formattag == mmioFOURCC('s', 'i', 'p', 'r'))) {
// if(!block_bref)
// spc = track->sub_packet_cnt = 0;
- switch (track->a_formattag) {
+ switch (track->a_formattag) {
case mmioFOURCC('2', '8', '_', '8'):
- for (x = 0; x < sph / 2; x++)
- memcpy(track->audio_buf + x * 2 * w + spc * cfs, buffer + cfs * x, cfs);
- break;
+ for (x = 0; x < sph / 2; x++)
+ memcpy(track->audio_buf + x * 2 * w + spc * cfs,
+ buffer + cfs * x, cfs);
+ break;
case mmioFOURCC('c', 'o', 'o', 'k'):
case mmioFOURCC('a', 't', 'r', 'c'):
- for (x = 0; x < w / sps; x++)
- memcpy(track->audio_buf + sps * (sph * x + ((sph + 1) / 2) * (spc & 1) + (spc >> 1)), buffer + sps * x, sps);
- break;
+ for (x = 0; x < w / sps; x++)
+ memcpy(track->audio_buf +
+ sps * (sph * x + ((sph + 1) / 2) * (spc & 1) +
+ (spc >> 1)), buffer + sps * x, sps);
+ break;
case mmioFOURCC('s', 'i', 'p', 'r'):
- memcpy(track->audio_buf + spc * w, buffer, w);
- if (spc == sph - 1)
- {
- int n;
- int bs = sph * w * 2 / 96; // nibbles per subpacket
- // Perform reordering
- for(n=0; n < 38; n++)
- {
- int j;
- int i = bs * sipr_swaps[n][0];
- int o = bs * sipr_swaps[n][1];
- // swap nibbles of block 'i' with 'o' TODO: optimize
- for(j = 0;j < bs; j++)
- {
- int x = (i & 1) ? (track->audio_buf[i >> 1] >> 4) : (track->audio_buf[i >> 1] & 0x0F);
- int y = (o & 1) ? (track->audio_buf[o >> 1] >> 4) : (track->audio_buf[o >> 1] & 0x0F);
- if(o & 1)
- track->audio_buf[o >> 1] = (track->audio_buf[o >> 1] & 0x0F) | (x << 4);
- else
- track->audio_buf[o >> 1] = (track->audio_buf[o >> 1] & 0xF0) | x;
- if(i & 1)
- track->audio_buf[i >> 1] = (track->audio_buf[i >> 1] & 0x0F) | (y << 4);
- else
- track->audio_buf[i >> 1] = (track->audio_buf[i >> 1] & 0xF0) | y;
- ++i; ++o;
+ memcpy(track->audio_buf + spc * w, buffer, w);
+ if (spc == sph - 1) {
+ int n;
+ int bs = sph * w * 2 / 96; // nibbles per subpacket
+ // Perform reordering
+ for (n = 0; n < 38; n++) {
+ int j;
+ int i = bs * sipr_swaps[n][0];
+ int o = bs * sipr_swaps[n][1];
+ // swap nibbles of block 'i' with 'o' TODO: optimize
+ for (j = 0; j < bs; j++) {
+ int x = (i & 1) ?
+ (track->audio_buf[i >> 1] >> 4) :
+ (track->audio_buf[i >> 1] & 0x0F);
+ int y = (o & 1) ?
+ (track->audio_buf[o >> 1] >> 4) :
+ (track->audio_buf[o >> 1] & 0x0F);
+ if (o & 1)
+ track->audio_buf[o >> 1] =
+ (track->audio_buf[o >> 1] & 0x0F) | (x << 4);
+ else
+ track->audio_buf[o >> 1] =
+ (track->audio_buf[o >> 1] & 0xF0) | x;
+ if (i & 1)
+ track->audio_buf[i >> 1] =
+ (track->audio_buf[i >> 1] & 0x0F) | (y << 4);
+ else
+ track->audio_buf[i >> 1] =
+ (track->audio_buf[i >> 1] & 0xF0) | y;
+ ++i;
+ ++o;
}
}
}
- break;
- }
- track->audio_timestamp[track->sub_packet_cnt] = (track->ra_pts == mkv_d->last_pts) ? 0 : (mkv_d->last_pts);
- track->ra_pts = mkv_d->last_pts;
- if (track->sub_packet_cnt == 0)
- track->audio_filepos = demuxer->filepos;
- if (++(track->sub_packet_cnt) == sph)
- {
- int apk_usize = ((WAVEFORMATEX*)((sh_audio_t*)demuxer->audio->sh)->wf)->nBlockAlign;
- track->sub_packet_cnt = 0;
- // Release all the audio packets
- for (x = 0; x < sph*w/apk_usize; x++)
- {
- dp = new_demux_packet(apk_usize);
- memcpy(dp->buffer, track->audio_buf + x * apk_usize, apk_usize);
- /* Put timestamp only on packets that correspond to original audio packets in file */
- dp->pts = (x * apk_usize % w) ? 0 : track->audio_timestamp[x * apk_usize / w];
- dp->pos = track->audio_filepos; // all equal
- dp->flags = x ? 0 : 0x10; // Mark first packet as keyframe
- ds_add_packet(demuxer->audio, dp);
- }
+ break;
}
- } else { // Not a codec that require reordering
- dp = new_demux_packet (size);
- memcpy(dp->buffer, buffer, size);
- if (track->ra_pts == mkv_d->last_pts && !mkv_d->a_skip_to_keyframe)
- dp->pts = 0;
- else
- dp->pts = mkv_d->last_pts;
- track->ra_pts = mkv_d->last_pts;
-
- dp->pos = demuxer->filepos;
- dp->flags = block_bref ? 0 : 0x10;
- ds_add_packet (demuxer->audio, dp);
- }
+ track->audio_timestamp[track->sub_packet_cnt] =
+ (track->ra_pts == mkv_d->last_pts) ? 0 : (mkv_d->last_pts);
+ track->ra_pts = mkv_d->last_pts;
+ if (track->sub_packet_cnt == 0)
+ track->audio_filepos = demuxer->filepos;
+ if (++(track->sub_packet_cnt) == sph) {
+ int apk_usize =
+ ((WAVEFORMATEX *) ((sh_audio_t *) demuxer->audio->sh)->wf)->
+ nBlockAlign;
+ track->sub_packet_cnt = 0;
+ // Release all the audio packets
+ for (x = 0; x < sph * w / apk_usize; x++) {
+ dp = new_demux_packet(apk_usize);
+ memcpy(dp->buffer, track->audio_buf + x * apk_usize,
+ apk_usize);
+ /* Put timestamp only on packets that correspond to original
+ * audio packets in file */
+ dp->pts = (x * apk_usize % w) ? 0 :
+ track->audio_timestamp[x * apk_usize / w];
+ dp->pos = track->audio_filepos; // all equal
+ dp->flags = x ? 0 : 0x10; // Mark first packet as keyframe
+ ds_add_packet(demuxer->audio, dp);
+ }
+ }
+ } else { // Not a codec that require reordering
+ dp = new_demux_packet(size);
+ memcpy(dp->buffer, buffer, size);
+ if (track->ra_pts == mkv_d->last_pts && !mkv_d->a_skip_to_keyframe)
+ dp->pts = 0;
+ else
+ dp->pts = mkv_d->last_pts;
+ track->ra_pts = mkv_d->last_pts;
+
+ dp->pos = demuxer->filepos;
+ dp->flags = block_bref ? 0 : 0x10;
+ ds_add_packet(demuxer->audio, dp);
+ }
}
/** Reorder timecodes and add cached demux packets to the queues.
@@ -2536,28 +2041,27 @@ handle_realaudio (demuxer_t *demuxer, mkv_track_t *track, uint8_t *buffer,
* \param demuxer The Matroska demuxer struct for this instance.
* \param track The track structure whose cache should be handled.
*/
-static void
-flush_cached_dps (demuxer_t *demuxer, mkv_track_t *track)
+static void flush_cached_dps(demuxer_t *demuxer, mkv_track_t *track)
{
- int i, ok;
-
- if (track->num_cached_dps == 0)
- return;
-
- do {
- ok = 1;
- for (i = 1; i < track->num_cached_dps; i++)
- if (track->cached_dps[i - 1]->pts > track->cached_dps[i]->pts) {
- float tmp_pts = track->cached_dps[i - 1]->pts;
- track->cached_dps[i - 1]->pts = track->cached_dps[i]->pts;
- track->cached_dps[i]->pts = tmp_pts;
- ok = 0;
- }
- } while (!ok);
-
- for (i = 0; i < track->num_cached_dps; i++)
- ds_add_packet (demuxer->video, track->cached_dps[i]);
- track->num_cached_dps = 0;
+ int i, ok;
+
+ if (track->num_cached_dps == 0)
+ return;
+
+ do {
+ ok = 1;
+ for (i = 1; i < track->num_cached_dps; i++)
+ if (track->cached_dps[i - 1]->pts > track->cached_dps[i]->pts) {
+ double tmp_pts = track->cached_dps[i - 1]->pts;
+ track->cached_dps[i - 1]->pts = track->cached_dps[i]->pts;
+ track->cached_dps[i]->pts = tmp_pts;
+ ok = 0;
+ }
+ } while (!ok);
+
+ for (i = 0; i < track->num_cached_dps; i++)
+ ds_add_packet(demuxer->video, track->cached_dps[i]);
+ track->num_cached_dps = 0;
}
/** Cache video frames if timecodes have to be reordered.
@@ -2580,574 +2084,552 @@ flush_cached_dps (demuxer_t *demuxer, mkv_track_t *track)
* then the frame is either an I frame or a P frame depending on the value
* of \a block_bref. Otherwise it's a B frame.
*/
-static void
-handle_video_bframes (demuxer_t *demuxer, mkv_track_t *track, uint8_t *buffer,
- uint32_t size, int block_bref, int block_fref)
+static void handle_video_bframes(demuxer_t *demuxer, mkv_track_t *track,
+ uint8_t *buffer, uint32_t size,
+ int block_bref, int block_fref)
{
- mkv_demuxer_t *mkv_d = (mkv_demuxer_t *) demuxer->priv;
- demux_packet_t *dp;
-
- dp = new_demux_packet (size);
- memcpy(dp->buffer, buffer, size);
- dp->pos = demuxer->filepos;
- dp->pts = mkv_d->last_pts;
- if ((track->num_cached_dps > 0) && (dp->pts < track->max_pts))
- block_fref = 1;
- if (block_fref == 0) /* I or P frame */
- flush_cached_dps (demuxer, track);
- if (block_bref != 0) /* I frame, don't cache it */
- dp->flags = 0x10;
- if ((track->num_cached_dps + 1) > track->num_allocated_dps)
- {
- track->cached_dps = (demux_packet_t **)
- realloc(track->cached_dps, (track->num_cached_dps + 10) *
- sizeof(demux_packet_t *));
- track->num_allocated_dps += 10;
+ mkv_demuxer_t *mkv_d = (mkv_demuxer_t *) demuxer->priv;
+ demux_packet_t *dp;
+
+ dp = new_demux_packet(size);
+ memcpy(dp->buffer, buffer, size);
+ dp->pos = demuxer->filepos;
+ dp->pts = mkv_d->last_pts;
+ if ((track->num_cached_dps > 0) && (dp->pts < track->max_pts))
+ block_fref = 1;
+ if (block_fref == 0) /* I or P frame */
+ flush_cached_dps(demuxer, track);
+ if (block_bref != 0) /* I frame, don't cache it */
+ dp->flags = 0x10;
+ if ((track->num_cached_dps + 1) > track->num_allocated_dps) {
+ track->cached_dps = (demux_packet_t **)
+ realloc(track->cached_dps,
+ (track->num_cached_dps + 10) * sizeof(demux_packet_t *));
+ track->num_allocated_dps += 10;
}
- track->cached_dps[track->num_cached_dps] = dp;
- track->num_cached_dps++;
- if (dp->pts > track->max_pts)
- track->max_pts = dp->pts;
+ track->cached_dps[track->num_cached_dps] = dp;
+ track->num_cached_dps++;
+ if (dp->pts > track->max_pts)
+ track->max_pts = dp->pts;
}
-static int
-handle_block (demuxer_t *demuxer, uint8_t *block, uint64_t length,
- uint64_t block_duration, int64_t block_bref, int64_t block_fref, uint8_t simpleblock)
+static int handle_block(demuxer_t *demuxer, uint8_t *block, uint64_t length,
+ uint64_t block_duration, int64_t block_bref,
+ int64_t block_fref, uint8_t simpleblock)
{
- mkv_demuxer_t *mkv_d = (mkv_demuxer_t *) demuxer->priv;
- mkv_track_t *track = NULL;
- demux_stream_t *ds = NULL;
- uint64_t old_length;
- int64_t tc;
- uint32_t *lace_size;
- uint8_t laces, flags;
- int i, num, tmp, use_this_block = 1;
- float current_pts;
- int16_t time;
-
- /* first byte(s): track num */
- num = ebml_read_vlen_uint (block, &tmp);
- block += tmp;
- /* time (relative to cluster time) */
- time = block[0] << 8 | block[1];
- block += 2;
- length -= tmp + 2;
- old_length = length;
- flags = block[0];
- if (demux_mkv_read_block_lacing (block, &length, &laces, &lace_size))
- return 0;
- block += old_length - length;
+ mkv_demuxer_t *mkv_d = (mkv_demuxer_t *) demuxer->priv;
+ mkv_track_t *track = NULL;
+ demux_stream_t *ds = NULL;
+ uint64_t old_length;
+ int64_t tc;
+ uint32_t *lace_size;
+ uint8_t laces, flags;
+ int i, num, tmp, use_this_block = 1;
+ double current_pts;
+ int16_t time;
+
+ /* first byte(s): track num */
+ num = ebml_read_vlen_uint(block, &tmp);
+ block += tmp;
+ /* time (relative to cluster time) */
+ time = block[0] << 8 | block[1];
+ block += 2;
+ length -= tmp + 2;
+ old_length = length;
+ flags = block[0];
+ if (demux_mkv_read_block_lacing(block, &length, &laces, &lace_size))
+ return 0;
+ block += old_length - length;
- tc = ((time*mkv_d->tc_scale+mkv_d->cluster_tc) /1000000.0 - mkv_d->first_tc);
- if (tc < 0)
- tc = 0;
- if (mkv_d->stop_timecode > 0 && tc > mkv_d->stop_timecode) {
- free(lace_size);
- return -1;
- }
- current_pts = tc / 1000.0;
-
- for (i=0; i<mkv_d->num_tracks; i++)
- if (mkv_d->tracks[i]->tnum == num) {
- track = mkv_d->tracks[i];
- break;
- }
- if (track == NULL)
- {
- free(lace_size);
- return 1;
+ tc = (time * mkv_d->tc_scale + mkv_d->cluster_tc) / 1000000.0 + 0.5;
+ if (tc < 0)
+ tc = 0;
+ current_pts = tc / 1000.0;
+
+ for (i = 0; i < mkv_d->num_tracks; i++)
+ if (mkv_d->tracks[i]->tnum == num) {
+ track = mkv_d->tracks[i];
+ break;
+ }
+ if (track == NULL) {
+ free(lace_size);
+ return 1;
}
- if (num == demuxer->audio->id)
- {
- ds = demuxer->audio;
-
- if (mkv_d->a_skip_to_keyframe)
- {
- if (simpleblock)
- {
- if (!(flags&0x80)) /*current frame isn't a keyframe*/
- use_this_block = 0;
- }
- else if (block_bref != 0)
+ if (num == demuxer->audio->id) {
+ ds = demuxer->audio;
+
+ if (mkv_d->a_skip_to_keyframe) {
+ if (simpleblock) {
+ if (!(flags & 0x80)) /*current frame isn't a keyframe */
+ use_this_block = 0;
+ } else if (block_bref != 0)
+ use_this_block = 0;
+ } else if (mkv_d->v_skip_to_keyframe)
use_this_block = 0;
- }
- else if (mkv_d->v_skip_to_keyframe)
- use_this_block = 0;
-
- if (track->fix_i_bps && use_this_block)
- {
- sh_audio_t *sh = (sh_audio_t *) ds->sh;
- if (block_duration != 0)
- {
- sh->i_bps = length * 1000 / block_duration;
- track->fix_i_bps = 0;
- }
- else if (track->qt_last_a_pts == 0.0)
- track->qt_last_a_pts = current_pts;
- else if(track->qt_last_a_pts != current_pts)
- {
- sh->i_bps = length / (current_pts - track->qt_last_a_pts);
- track->fix_i_bps = 0;
+ if (track->fix_i_bps && use_this_block) {
+ sh_audio_t *sh = (sh_audio_t *) ds->sh;
+
+ if (block_duration != 0) {
+ sh->i_bps = length * 1000 / block_duration;
+ track->fix_i_bps = 0;
+ } else if (track->qt_last_a_pts == 0.0)
+ track->qt_last_a_pts = current_pts;
+ else if (track->qt_last_a_pts != current_pts) {
+ sh->i_bps = length / (current_pts - track->qt_last_a_pts);
+ track->fix_i_bps = 0;
}
}
- }
- else if (tc < mkv_d->skip_to_timecode)
- use_this_block = 0;
- else if (num == demuxer->video->id)
- {
- ds = demuxer->video;
- if (mkv_d->v_skip_to_keyframe)
- {
- if (simpleblock)
- {
- if (!(flags&0x80)) /*current frame isn't a keyframe*/
+ } else if (tc < mkv_d->skip_to_timecode)
+ use_this_block = 0;
+ else if (num == demuxer->video->id) {
+ ds = demuxer->video;
+ if (mkv_d->v_skip_to_keyframe) {
+ if (simpleblock) {
+ if (!(flags & 0x80)) /*current frame isn't a keyframe */
+ use_this_block = 0;
+ } else if (block_bref != 0 || block_fref != 0)
use_this_block = 0;
- }
- else if (block_bref != 0 || block_fref != 0)
- use_this_block = 0;
}
- }
- else if (num == demuxer->sub->id)
- {
- ds = demuxer->sub;
- if (track->subtitle_type != MATROSKA_SUBTYPE_VOBSUB)
- {
- if (!mkv_d->v_skip_to_keyframe)
- handle_subtitles (demuxer, track, block, length,
- block_duration, tc);
- use_this_block = 0;
+ } else if (num == demuxer->sub->id) {
+ ds = demuxer->sub;
+ if (track->subtitle_type != MATROSKA_SUBTYPE_VOBSUB) {
+ uint8_t *buffer;
+ int size = length;
+ demux_mkv_decode(track, block, &buffer, &size, 1);
+ handle_subtitles(demuxer, track, buffer, size, block_duration, tc);
+ if (buffer != block)
+ free(buffer);
+ use_this_block = 0;
}
- }
- else
- use_this_block = 0;
-
- if (use_this_block)
- {
- mkv_d->last_pts = current_pts;
- mkv_d->last_filepos = demuxer->filepos;
-
- for (i=0; i < laces; i++)
- {
- if (ds == demuxer->video && track->realmedia)
- handle_realvideo (demuxer, track, block, lace_size[i], block_bref);
- else if (ds == demuxer->audio && track->realmedia)
- handle_realaudio (demuxer, track, block, lace_size[i], block_bref);
- else if (ds == demuxer->video && track->reorder_timecodes)
- handle_video_bframes (demuxer, track, block, lace_size[i],
- block_bref, block_fref);
- else
- {
- int modified, size = lace_size[i];
- demux_packet_t *dp;
- uint8_t *buffer;
- modified = demux_mkv_decode (track, block, &buffer, &size, 1);
- if (buffer)
- {
- dp = new_demux_packet (size);
- memcpy (dp->buffer, buffer, size);
- if (modified)
- free (buffer);
- dp->flags = (block_bref == 0 && block_fref == 0) ? 0x10 : 0;
- /* If default_duration is 0, assume no pts value is known
- * for packets after the first one (rather than all pts
- * values being the same) */
- if (i == 0 || track->default_duration)
- dp->pts = mkv_d->last_pts + i * track->default_duration;
- ds_add_packet (ds, dp);
+ } else
+ use_this_block = 0;
+
+ if (use_this_block) {
+ mkv_d->last_pts = current_pts;
+ mkv_d->last_filepos = demuxer->filepos;
+
+ for (i = 0; i < laces; i++) {
+ if (ds == demuxer->video && track->realmedia)
+ handle_realvideo(demuxer, track, block, lace_size[i],
+ block_bref);
+ else if (ds == demuxer->audio && track->realmedia)
+ handle_realaudio(demuxer, track, block, lace_size[i],
+ block_bref);
+ else if (ds == demuxer->video && track->reorder_timecodes)
+ handle_video_bframes(demuxer, track, block, lace_size[i],
+ block_bref, block_fref);
+ else {
+ int size = lace_size[i];
+ demux_packet_t *dp;
+ uint8_t *buffer;
+ demux_mkv_decode(track, block, &buffer, &size, 1);
+ if (buffer) {
+ dp = new_demux_packet(size);
+ memcpy(dp->buffer, buffer, size);
+ if (buffer != block)
+ free(buffer);
+ dp->flags = (block_bref == 0
+ && block_fref == 0) ? 0x10 : 0;
+ /* If default_duration is 0, assume no pts value is known
+ * for packets after the first one (rather than all pts
+ * values being the same) */
+ if (i == 0 || track->default_duration)
+ dp->pts =
+ mkv_d->last_pts + i * track->default_duration;
+ ds_add_packet(ds, dp);
}
}
- block += lace_size[i];
+ block += lace_size[i];
}
- if (ds == demuxer->video)
- {
- mkv_d->v_skip_to_keyframe = 0;
- mkv_d->skip_to_timecode = 0;
- }
- else if (ds == demuxer->audio)
- mkv_d->a_skip_to_keyframe = 0;
+ if (ds == demuxer->video) {
+ mkv_d->v_skip_to_keyframe = 0;
+ mkv_d->skip_to_timecode = 0;
+ } else if (ds == demuxer->audio)
+ mkv_d->a_skip_to_keyframe = 0;
- free(lace_size);
- return 1;
+ free(lace_size);
+ return 1;
}
- free(lace_size);
- return 0;
+ free(lace_size);
+ return 0;
}
-static int
-demux_mkv_fill_buffer (demuxer_t *demuxer, demux_stream_t *ds)
+static int demux_mkv_fill_buffer(demuxer_t *demuxer, demux_stream_t *ds)
{
- mkv_demuxer_t *mkv_d = (mkv_demuxer_t *) demuxer->priv;
- stream_t *s = demuxer->stream;
- uint64_t l;
- int il, tmp;
-
- while (1)
- {
- while (mkv_d->cluster_size > 0)
- {
- uint64_t block_duration = 0, block_length = 0;
- int64_t block_bref = 0, block_fref = 0;
- uint8_t *block = NULL;
-
- while (mkv_d->blockgroup_size > 0)
- {
- switch (ebml_read_id (s, &il))
- {
+ mkv_demuxer_t *mkv_d = (mkv_demuxer_t *) demuxer->priv;
+ stream_t *s = demuxer->stream;
+ uint64_t l;
+ int il, tmp;
+
+ while (1) {
+ while (mkv_d->cluster_size > 0) {
+ uint64_t block_duration = 0, block_length = 0;
+ int64_t block_bref = 0, block_fref = 0;
+ uint8_t *block = NULL;
+
+ while (mkv_d->blockgroup_size > 0) {
+ switch (ebml_read_id(s, &il)) {
case MATROSKA_ID_BLOCKDURATION:
- {
- block_duration = ebml_read_uint (s, &l);
+ block_duration = ebml_read_uint(s, &l);
if (block_duration == EBML_UINT_INVALID) {
- free(block);
- return 0;
+ free(block);
+ return 0;
}
- block_duration *= mkv_d->tc_scale / 1000000.0;
+ block_duration =
+ block_duration * mkv_d->tc_scale / 1000000.0 + 0.5;
break;
- }
case MATROSKA_ID_BLOCK:
- block_length = ebml_read_length (s, &tmp);
- free(block);
- if (block_length > SIZE_MAX - AV_LZO_INPUT_PADDING) return 0;
- block = malloc (block_length + AV_LZO_INPUT_PADDING);
- demuxer->filepos = stream_tell (s);
- if (stream_read (s,block,block_length) != (int) block_length)
- {
+ block_length = ebml_read_length(s, &tmp);
free(block);
- return 0;
- }
- l = tmp + block_length;
- break;
+ if (block_length > SIZE_MAX - AV_LZO_INPUT_PADDING)
+ return 0;
+ block = malloc(block_length + AV_LZO_INPUT_PADDING);
+ demuxer->filepos = stream_tell(s);
+ if (stream_read(s, block, block_length) !=
+ (int) block_length) {
+ free(block);
+ return 0;
+ }
+ l = tmp + block_length;
+ break;
- case MATROSKA_ID_REFERENCEBLOCK:
- {
- int64_t num = ebml_read_int (s, &l);
+ case MATROSKA_ID_REFERENCEBLOCK:;
+ int64_t num = ebml_read_int(s, &l);
if (num == EBML_INT_INVALID) {
- free(block);
- return 0;
+ free(block);
+ return 0;
}
if (num <= 0)
- block_bref = num;
+ block_bref = num;
else
- block_fref = num;
+ block_fref = num;
break;
- }
case EBML_ID_INVALID:
- free(block);
- return 0;
+ free(block);
+ return 0;
default:
- ebml_read_skip (s, &l);
- break;
+ ebml_read_skip(s, &l);
+ break;
}
- mkv_d->blockgroup_size -= l + il;
- mkv_d->cluster_size -= l + il;
+ mkv_d->blockgroup_size -= l + il;
+ mkv_d->cluster_size -= l + il;
}
- if (block)
- {
- int res = handle_block (demuxer, block, block_length,
- block_duration, block_bref, block_fref, 0);
- free (block);
- if (res < 0)
- return 0;
- if (res)
- return 1;
+ if (block) {
+ int res = handle_block(demuxer, block, block_length,
+ block_duration, block_bref, block_fref,
+ 0);
+ free(block);
+ if (res < 0)
+ return 0;
+ if (res)
+ return 1;
}
- if (mkv_d->cluster_size > 0)
- {
- switch (ebml_read_id (s, &il))
- {
- case MATROSKA_ID_CLUSTERTIMECODE:
- {
- uint64_t num = ebml_read_uint (s, &l);
+ if (mkv_d->cluster_size > 0) {
+ switch (ebml_read_id(s, &il)) {
+ case MATROSKA_ID_TIMECODE:;
+ uint64_t num = ebml_read_uint(s, &l);
if (num == EBML_UINT_INVALID)
- return 0;
- if (!mkv_d->has_first_tc)
- {
- mkv_d->first_tc = num * mkv_d->tc_scale / 1000000.0;
- mkv_d->has_first_tc = 1;
- }
+ return 0;
mkv_d->cluster_tc = num * mkv_d->tc_scale;
+ add_cluster_position(mkv_d, mkv_d->cluster_start,
+ mkv_d->cluster_tc);
break;
- }
case MATROSKA_ID_BLOCKGROUP:
- mkv_d->blockgroup_size = ebml_read_length (s, &tmp);
- l = tmp;
- break;
+ mkv_d->blockgroup_size = ebml_read_length(s, &tmp);
+ l = tmp;
+ break;
- case MATROSKA_ID_SIMPLEBLOCK:
- {
+ case MATROSKA_ID_SIMPLEBLOCK:;
int res;
- block_length = ebml_read_length (s, &tmp);
- block = malloc (block_length);
- demuxer->filepos = stream_tell (s);
- if (stream_read (s,block,block_length) != (int) block_length)
- {
- free(block);
- return 0;
+ block_length = ebml_read_length(s, &tmp);
+ block = malloc(block_length);
+ demuxer->filepos = stream_tell(s);
+ if (stream_read(s, block, block_length) !=
+ (int) block_length) {
+ free(block);
+ return 0;
}
l = tmp + block_length;
- res = handle_block (demuxer, block, block_length,
- block_duration, block_bref, block_fref, 1);
- free (block);
+ res = handle_block(demuxer, block, block_length,
+ block_duration, block_bref,
+ block_fref, 1);
+ free(block);
mkv_d->cluster_size -= l + il;
if (res < 0)
- return 0;
+ return 0;
else if (res)
- return 1;
- else mkv_d->cluster_size += l + il;
+ return 1;
+ else
+ mkv_d->cluster_size += l + il;
break;
- }
+
case EBML_ID_INVALID:
- return 0;
+ return 0;
default:
- ebml_read_skip (s, &l);
- break;
+ ebml_read_skip(s, &l);
+ break;
}
- mkv_d->cluster_size -= l + il;
+ mkv_d->cluster_size -= l + il;
}
}
- if (ebml_read_id (s, &il) != MATROSKA_ID_CLUSTER)
- return 0;
- add_cluster_position(mkv_d, stream_tell(s)-il);
- mkv_d->cluster_size = ebml_read_length (s, NULL);
+ while (ebml_read_id(s, &il) != MATROSKA_ID_CLUSTER) {
+ ebml_read_skip(s, NULL);
+ if (s->eof)
+ return 0;
+ }
+ mkv_d->cluster_start = stream_tell(s) - il;
+ mkv_d->cluster_size = ebml_read_length(s, NULL);
}
- return 0;
+ return 0;
}
-static void
-demux_mkv_seek (demuxer_t *demuxer, float rel_seek_secs, float audio_delay, int flags)
+static void demux_mkv_seek(demuxer_t *demuxer, float rel_seek_secs,
+ float audio_delay, int flags)
{
- free_cached_dps (demuxer);
- if (!(flags & SEEK_FACTOR)) /* time in secs */
- {
- mkv_demuxer_t *mkv_d = (mkv_demuxer_t *) demuxer->priv;
- stream_t *s = demuxer->stream;
- int64_t target_timecode = 0, diff, min_diff=0xFFFFFFFFFFFFFFFLL;
- int i;
-
- if (!(flags & SEEK_ABSOLUTE)) /* relative seek */
- target_timecode = (int64_t) (mkv_d->last_pts * 1000.0);
- target_timecode += (int64_t)(rel_seek_secs * 1000.0);
- if (target_timecode < 0)
- target_timecode = 0;
-
- if (mkv_d->indexes == NULL) /* no index was found */
- {
- uint64_t target_filepos, cluster_pos, max_pos;
-
- target_filepos = (uint64_t) (target_timecode * mkv_d->last_filepos
- / (mkv_d->last_pts * 1000.0));
-
- max_pos = mkv_d->num_cluster_pos ? mkv_d->cluster_positions[mkv_d->num_cluster_pos-1] : 0;
- if (target_filepos > max_pos)
- {
- if ((off_t) max_pos > stream_tell (s))
- stream_seek (s, max_pos);
- else
- stream_seek (s, stream_tell (s) + mkv_d->cluster_size);
- /* parse all the clusters upto target_filepos */
- while (!s->eof && stream_tell(s) < (off_t) target_filepos)
- {
- switch (ebml_read_id (s, &i))
- {
- case MATROSKA_ID_CLUSTER:
- add_cluster_position(mkv_d, (uint64_t) stream_tell(s)-i);
- break;
-
- case MATROSKA_ID_CUES:
- demux_mkv_read_cues (demuxer);
- break;
- }
- ebml_read_skip (s, NULL);
- }
- if (s->eof)
- stream_reset(s);
+ if (!(flags & (SEEK_BACKWARD | SEEK_FORWARD))) {
+ if (flags & SEEK_ABSOLUTE || rel_seek_secs < 0)
+ flags |= SEEK_BACKWARD;
+ else
+ flags |= SEEK_FORWARD;
+ }
+ // Adjust the target a little bit to catch cases where the target position
+ // specifies a keyframe with high, but not perfect, precision.
+ rel_seek_secs += flags & SEEK_FORWARD ? -0.005 : 0.005;
+
+ free_cached_dps(demuxer);
+ if (!(flags & SEEK_FACTOR)) { /* time in secs */
+ mkv_index_t *index = NULL;
+ mkv_demuxer_t *mkv_d = (mkv_demuxer_t *) demuxer->priv;
+ stream_t *s = demuxer->stream;
+ int64_t target_timecode = 0, diff, min_diff = 0xFFFFFFFFFFFFFFFLL;
+ int i;
+
+ if (!(flags & SEEK_ABSOLUTE)) /* relative seek */
+ target_timecode = (int64_t) (mkv_d->last_pts * 1000.0);
+ target_timecode += (int64_t) (rel_seek_secs * 1000.0);
+ if (target_timecode < 0)
+ target_timecode = 0;
+
+ if (mkv_d->indexes == NULL) { /* no index was found */
+ int64_t target_tc_ns = (int64_t) (rel_seek_secs * 1e9);
+ if (target_tc_ns < 0)
+ target_tc_ns = 0;
+ uint64_t max_filepos = 0;
+ int64_t max_tc = -1;
+ int n = mkv_d->num_cluster_pos;
+ if (n > 0) {
+ max_filepos = mkv_d->cluster_positions[n - 1].filepos;
+ max_tc = mkv_d->cluster_positions[n - 1].timecode;
}
- if (mkv_d->indexes == NULL)
- {
- cluster_pos = mkv_d->cluster_positions[0];
- /* Let's find the nearest cluster */
- for (i=0; i < mkv_d->num_cluster_pos; i++)
- {
- diff = mkv_d->cluster_positions[i] - target_filepos;
- if (rel_seek_secs < 0 && diff < 0 && -diff < min_diff)
- {
- cluster_pos = mkv_d->cluster_positions[i];
- min_diff = -diff;
- }
- else if (rel_seek_secs > 0
- && (diff < 0 ? -1 * diff : diff) < min_diff)
- {
- cluster_pos = mkv_d->cluster_positions[i];
- min_diff = diff < 0 ? -1 * diff : diff;
+ if (target_tc_ns > max_tc) {
+ if ((off_t) max_filepos > stream_tell(s))
+ stream_seek(s, max_filepos);
+ else
+ stream_seek(s, stream_tell(s) + mkv_d->cluster_size);
+ /* parse all the clusters upto target_filepos */
+ while (!s->eof) {
+ uint64_t start = stream_tell(s);
+ uint32_t type = ebml_read_id(s, NULL);
+ uint64_t len = ebml_read_length(s, NULL);
+ uint64_t end = stream_tell(s) + len;
+ if (type == MATROSKA_ID_CLUSTER) {
+ while (!s->eof && stream_tell(s) < end) {
+ if (ebml_read_id(s, NULL)
+ == MATROSKA_ID_TIMECODE) {
+ uint64_t tc = ebml_read_uint(s, NULL);
+ tc *= mkv_d->tc_scale;
+ add_cluster_position(mkv_d, start, tc);
+ if (tc >= target_tc_ns)
+ goto enough_index;
+ break;
+ }
+ }
}
+ stream_seek(s, end);
}
- mkv_d->cluster_size = mkv_d->blockgroup_size = 0;
- stream_seek (s, cluster_pos);
+ enough_index:
+ if (s->eof)
+ stream_reset(s);
}
- }
- else
- {
- mkv_index_t *index = NULL;
- int seek_id = (demuxer->video->id < 0) ? demuxer->audio->id : demuxer->video->id;
-
- /* let's find the entry in the indexes with the smallest */
- /* difference to the wanted timecode. */
- for (i=0; i < mkv_d->num_indexes; i++)
- if (mkv_d->indexes[i].tnum == seek_id)
- {
- diff = target_timecode + mkv_d->first_tc -
- (int64_t) mkv_d->indexes[i].timecode * mkv_d->tc_scale / 1000000.0;
-
- if ((flags & SEEK_ABSOLUTE || target_timecode <= mkv_d->last_pts*1000)) {
- // Absolute seek or seek backward: find the last index
- // position before target time
- if (diff < 0 || diff >= min_diff)
- continue;
+ if (!mkv_d->num_cluster_pos) {
+ mp_msg(MSGT_DEMUX, MSGL_V, "[mkv] no target for seek found\n");
+ return;
+ }
+ uint64_t cluster_pos = mkv_d->cluster_positions[0].filepos;
+ /* Let's find the nearest cluster */
+ for (i = 0; i < mkv_d->num_cluster_pos; i++) {
+ diff = mkv_d->cluster_positions[i].timecode - target_tc_ns;
+ if (flags & SEEK_BACKWARD && diff < 0 && -diff < min_diff) {
+ cluster_pos = mkv_d->cluster_positions[i].filepos;
+ min_diff = -diff;
+ } else if (flags & SEEK_FORWARD
+ && (diff < 0 ? -1 * diff : diff) < min_diff) {
+ cluster_pos = mkv_d->cluster_positions[i].filepos;
+ min_diff = diff < 0 ? -1 * diff : diff;
}
- else {
- // Relative seek forward: find the first index position
- // after target time. If no such index exists, find last
- // position between current position and target time.
- if (diff <= 0) {
- if (min_diff <= 0 && diff <= min_diff)
+ }
+ mkv_d->cluster_size = mkv_d->blockgroup_size = 0;
+ stream_seek(s, cluster_pos);
+ } else {
+ int seek_id = (demuxer->video->id < 0) ?
+ demuxer->audio->id : demuxer->video->id;
+
+ /* let's find the entry in the indexes with the smallest */
+ /* difference to the wanted timecode. */
+ for (i = 0; i < mkv_d->num_indexes; i++)
+ if (mkv_d->indexes[i].tnum == seek_id) {
+ diff =
+ target_timecode -
+ (int64_t) (mkv_d->indexes[i].timecode *
+ mkv_d->tc_scale / 1000000.0 + 0.5);
+
+ if (flags & SEEK_BACKWARD) {
+ // Seek backward: find the last index position
+ // before target time
+ if (diff < 0 || diff >= min_diff)
+ continue;
+ } else {
+ // Seek forward: find the first index position
+ // after target time. If no such index exists, find last
+ // position between current position and target time.
+ if (diff <= 0) {
+ if (min_diff <= 0 && diff <= min_diff)
+ continue;
+ } else if (diff >=
+ FFMIN(target_timecode - mkv_d->last_pts,
+ min_diff))
continue;
}
- else if (diff >= FFMIN(target_timecode - mkv_d->last_pts,
- min_diff))
- continue;
+ min_diff = diff;
+ index = mkv_d->indexes + i;
}
- min_diff = diff;
- index = mkv_d->indexes + i;
- }
-
- if (index) /* We've found an entry. */
- {
- mkv_d->cluster_size = mkv_d->blockgroup_size = 0;
- stream_seek (s, index->filepos);
+
+ if (index) { /* We've found an entry. */
+ mkv_d->cluster_size = mkv_d->blockgroup_size = 0;
+ stream_seek(s, index->filepos);
}
}
- if (demuxer->video->id >= 0)
- mkv_d->v_skip_to_keyframe = 1;
- if (rel_seek_secs > 0.0)
- mkv_d->skip_to_timecode = target_timecode;
- mkv_d->a_skip_to_keyframe = 1;
-
- demux_mkv_fill_buffer(demuxer, NULL);
- }
- else if ((demuxer->movi_end <= 0) || !(flags & SEEK_ABSOLUTE))
- mp_msg (MSGT_DEMUX, MSGL_V, "[mkv] seek unsupported flags\n");
- else
- {
- mkv_demuxer_t *mkv_d = (mkv_demuxer_t *) demuxer->priv;
- stream_t *s = demuxer->stream;
- uint64_t target_filepos;
- mkv_index_t *index = NULL;
- int i;
-
- if (mkv_d->indexes == NULL) /* no index was found */
- { /* I'm lazy... */
- mp_msg (MSGT_DEMUX, MSGL_V, "[mkv] seek unsupported flags\n");
- return;
+ if (demuxer->video->id >= 0)
+ mkv_d->v_skip_to_keyframe = 1;
+ if (flags & SEEK_FORWARD)
+ mkv_d->skip_to_timecode = target_timecode;
+ else
+ mkv_d->skip_to_timecode = index ? index->timecode : 0;
+ mkv_d->a_skip_to_keyframe = 1;
+
+ demux_mkv_fill_buffer(demuxer, NULL);
+ } else if ((demuxer->movi_end <= 0) || !(flags & SEEK_ABSOLUTE))
+ mp_msg(MSGT_DEMUX, MSGL_V, "[mkv] seek unsupported flags\n");
+ else {
+ mkv_demuxer_t *mkv_d = (mkv_demuxer_t *) demuxer->priv;
+ stream_t *s = demuxer->stream;
+ uint64_t target_filepos;
+ mkv_index_t *index = NULL;
+ int i;
+
+ if (mkv_d->indexes == NULL) { /* not implemented without index */
+ mp_msg(MSGT_DEMUX, MSGL_V, "[mkv] seek unsupported flags\n");
+ return;
}
- target_filepos = (uint64_t)(demuxer->movi_end * rel_seek_secs);
- for (i=0; i < mkv_d->num_indexes; i++)
- if (mkv_d->indexes[i].tnum == demuxer->video->id)
- if ((index == NULL) ||
- ((mkv_d->indexes[i].filepos >= target_filepos) &&
- ((index->filepos < target_filepos) ||
- (mkv_d->indexes[i].filepos < index->filepos))))
- index = &mkv_d->indexes[i];
+ target_filepos = (uint64_t) (demuxer->movi_end * rel_seek_secs);
+ for (i = 0; i < mkv_d->num_indexes; i++)
+ if (mkv_d->indexes[i].tnum == demuxer->video->id)
+ if ((index == NULL)
+ || ((mkv_d->indexes[i].filepos >= target_filepos)
+ && ((index->filepos < target_filepos)
+ || (mkv_d->indexes[i].filepos < index->filepos))))
+ index = &mkv_d->indexes[i];
- if (!index)
- return;
+ if (!index)
+ return;
- mkv_d->cluster_size = mkv_d->blockgroup_size = 0;
- stream_seek (s, index->filepos);
+ mkv_d->cluster_size = mkv_d->blockgroup_size = 0;
+ stream_seek(s, index->filepos);
- if (demuxer->video->id >= 0)
- mkv_d->v_skip_to_keyframe = 1;
- mkv_d->skip_to_timecode = index->timecode;
- mkv_d->a_skip_to_keyframe = 1;
+ if (demuxer->video->id >= 0)
+ mkv_d->v_skip_to_keyframe = 1;
+ mkv_d->skip_to_timecode = index->timecode;
+ mkv_d->a_skip_to_keyframe = 1;
- demux_mkv_fill_buffer(demuxer, NULL);
+ demux_mkv_fill_buffer(demuxer, NULL);
}
}
-static int
-demux_mkv_control (demuxer_t *demuxer, int cmd, void *arg)
+static int demux_mkv_control(demuxer_t *demuxer, int cmd, void *arg)
{
- mkv_demuxer_t *mkv_d = (mkv_demuxer_t *) demuxer->priv;
+ mkv_demuxer_t *mkv_d = (mkv_demuxer_t *) demuxer->priv;
- switch (cmd)
- {
+ switch (cmd) {
case DEMUXER_CTRL_CORRECT_PTS:
- return DEMUXER_CTRL_OK;
+ return DEMUXER_CTRL_OK;
case DEMUXER_CTRL_GET_TIME_LENGTH:
- if (mkv_d->duration == 0)
- return DEMUXER_CTRL_DONTKNOW;
+ if (mkv_d->duration == 0)
+ return DEMUXER_CTRL_DONTKNOW;
- *((double *)arg) = (double)mkv_d->duration;
- return DEMUXER_CTRL_OK;
+ *((double *) arg) = (double) mkv_d->duration;
+ return DEMUXER_CTRL_OK;
case DEMUXER_CTRL_GET_PERCENT_POS:
- if (mkv_d->duration == 0)
- {
+ if (mkv_d->duration == 0) {
return DEMUXER_CTRL_DONTKNOW;
}
- *((int *) arg) = (int) (100 * mkv_d->last_pts / mkv_d->duration);
- return DEMUXER_CTRL_OK;
+ *((int *) arg) = (int) (100 * mkv_d->last_pts / mkv_d->duration);
+ return DEMUXER_CTRL_OK;
case DEMUXER_CTRL_SWITCH_AUDIO:
- if (demuxer->audio && demuxer->audio->sh) {
- sh_audio_t *sh = demuxer->a_streams[demuxer->audio->id];
- int aid = *(int*)arg;
- if (aid < 0)
- aid = (sh->aid + 1) % mkv_d->last_aid;
- if (aid != sh->aid) {
- mkv_track_t *track = demux_mkv_find_track_by_num (mkv_d, aid, MATROSKA_TRACK_AUDIO);
- if (track) {
- demuxer->audio->id = track->tnum;
- sh = demuxer->a_streams[demuxer->audio->id];
- ds_free_packs(demuxer->audio);
- }
- }
- *(int*)arg = sh->aid;
- } else
- *(int*)arg = -2;
- return DEMUXER_CTRL_OK;
+ if (demuxer->audio && demuxer->audio->sh) {
+ sh_audio_t *sh = demuxer->a_streams[demuxer->audio->id];
+ int aid = *(int *) arg;
+ if (aid < 0)
+ aid = (sh->aid + 1) % mkv_d->last_aid;
+ if (aid != sh->aid) {
+ mkv_track_t *track =
+ demux_mkv_find_track_by_num(mkv_d, aid,
+ MATROSKA_TRACK_AUDIO);
+ if (track) {
+ demuxer->audio->id = track->tnum;
+ sh = demuxer->a_streams[demuxer->audio->id];
+ ds_free_packs(demuxer->audio);
+ }
+ }
+ *(int *) arg = sh->aid;
+ } else
+ *(int *) arg = -2;
+ return DEMUXER_CTRL_OK;
default:
- return DEMUXER_CTRL_NOTIMPL;
+ return DEMUXER_CTRL_NOTIMPL;
}
}
const demuxer_desc_t demuxer_desc_matroska = {
- "Matroska demuxer",
- "mkv",
- "Matroska",
- "Aurelien Jacobs",
- "",
- DEMUXER_TYPE_MATROSKA,
- 1, // safe autodetect
- demux_mkv_open,
- demux_mkv_fill_buffer,
- NULL,
- demux_close_mkv,
- demux_mkv_seek,
- demux_mkv_control
+ "Matroska demuxer",
+ "mkv",
+ "Matroska",
+ "Aurelien Jacobs",
+ "",
+ DEMUXER_TYPE_MATROSKA,
+ 1, // safe autodetect
+ demux_mkv_open,
+ demux_mkv_fill_buffer,
+ NULL,
+ demux_close_mkv,
+ demux_mkv_seek,
+ demux_mkv_control
};
diff --git a/libmpdemux/demux_mng.c b/libmpdemux/demux_mng.c
index 9d6005f44e..bab7430962 100644
--- a/libmpdemux/demux_mng.c
+++ b/libmpdemux/demux_mng.c
@@ -622,4 +622,3 @@ const demuxer_desc_t demuxer_desc_mng = {
demux_mng_seek,
demux_mng_control
};
-
diff --git a/libmpdemux/demux_mov.c b/libmpdemux/demux_mov.c
index a1a250c05f..97eae374e9 100644
--- a/libmpdemux/demux_mov.c
+++ b/libmpdemux/demux_mov.c
@@ -63,7 +63,7 @@
#include "libmpcodecs/img_format.h"
#include "libavutil/common.h"
-#include "libavutil/intreadwrite.h"
+#include "ffmpeg_files/intreadwrite.h"
#include "libvo/sub.h"
@@ -165,7 +165,7 @@ typedef struct {
void* desc; // image/sound/etc description (pointer to ImageDescription etc)
} mov_track_t;
-void mov_build_index(mov_track_t* trak,int timescale){
+static void mov_build_index(mov_track_t* trak,int timescale){
int i,j,s;
int last=trak->chunks_size;
unsigned int pts=0;
@@ -1324,7 +1324,7 @@ static void lschunks(demuxer_t* demuxer,int level,off_t endpos,mov_track_t* trak
case MOV_FOURCC('t','r','a','k'): {
// if(trak) printf("MOV: Warning! trak in trak?\n");
if(priv->track_db>=MOV_MAX_TRACKS){
- mp_msg(MSGT_DEMUX,MSGL_WARN,MSGTR_MOVtooManyTrk);
+ mp_tmsg(MSGT_DEMUX,MSGL_WARN,"MOV: WARNING: too many tracks");
return;
}
if(!priv->track_db) mp_msg(MSGT_DEMUX, MSGL_V, "--------------\n");
@@ -1338,13 +1338,13 @@ static void lschunks(demuxer_t* demuxer,int level,off_t endpos,mov_track_t* trak
switch(trak->type){
case MOV_TRAK_AUDIO: {
sh_audio_t* sh=new_sh_audio(demuxer,priv->track_db);
- mp_msg(MSGT_DEMUX, MSGL_INFO, MSGTR_AudioID, "mov", priv->track_db);
+ mp_tmsg(MSGT_DEMUX, MSGL_INFO, "[%s] Audio stream found, -aid %d\n", "mov", priv->track_db);
gen_sh_audio(sh, trak, priv->timescale);
break;
}
case MOV_TRAK_VIDEO: {
sh_video_t* sh=new_sh_video(demuxer,priv->track_db);
- mp_msg(MSGT_DEMUX, MSGL_INFO, MSGTR_VideoID, "mov", priv->track_db);
+ mp_tmsg(MSGT_DEMUX, MSGL_INFO, "[%s] Video stream found, -vid %d\n", "mov", priv->track_db);
gen_sh_video(sh, trak, priv->timescale);
break;
}
@@ -1353,7 +1353,7 @@ static void lschunks(demuxer_t* demuxer,int level,off_t endpos,mov_track_t* trak
trak->fourcc == mmioFOURCC('t','x','3','g') ||
trak->fourcc == mmioFOURCC('t','e','x','t')) {
sh_sub_t *sh = new_sh_sub(demuxer, priv->track_db);
- mp_msg(MSGT_DEMUX, MSGL_INFO, MSGTR_SubtitleID, "mov", priv->track_db);
+ mp_tmsg(MSGT_DEMUX, MSGL_INFO, "[%s] Subtitle stream found, -sid %d\n", "mov", priv->track_db);
if (trak->fourcc == mmioFOURCC('m','p','4','s'))
init_vobsub(sh, trak);
else {
@@ -1419,13 +1419,13 @@ static void lschunks(demuxer_t* demuxer,int level,off_t endpos,mov_track_t* trak
}
#if !CONFIG_ZLIB
case MOV_FOURCC('c','m','o','v'): {
- mp_msg(MSGT_DEMUX,MSGL_ERR,MSGTR_MOVcomprhdr);
+ mp_tmsg(MSGT_DEMUX,MSGL_ERR,"MOV: Compressed headers support requires ZLIB!\n");
return;
}
#else
case MOV_FOURCC('m','o','o','v'):
case MOV_FOURCC('c','m','o','v'): {
-// mp_msg(MSGT_DEMUX,MSGL_ERR,MSGTR_MOVcomprhdr);
+// mp_tmsg(MSGT_DEMUX,MSGL_ERR,"MOV: Compressed headers support requires ZLIB!\n");
lschunks(demuxer,level+1,pos+len,NULL);
break;
}
@@ -1749,7 +1749,7 @@ static int lschunks_intrak(demuxer_t* demuxer, int level, unsigned int id,
"MOV: %*s desc #%d: %.4s (%"PRId64" bytes)\n", level, "",
i, (char *)&fourcc, (int64_t)len - 16);
if (fourcc != trak->fourcc && i)
- mp_msg(MSGT_DEMUX, MSGL_WARN, MSGTR_MOVvariableFourCC);
+ mp_tmsg(MSGT_DEMUX, MSGL_WARN, "MOV: WARNING: Variable FourCC detected!?\n");
// if(!i)
{
trak->fourcc = fourcc;
@@ -1938,6 +1938,7 @@ static int lschunks_intrak(demuxer_t* demuxer, int level, unsigned int id,
}
static demuxer_t* mov_read_header(demuxer_t* demuxer){
+ struct MPOpts *opts = demuxer->opts;
mov_priv_t* priv=demuxer->priv;
int t_no;
int best_a_id=-1, best_a_len=0;
@@ -2013,7 +2014,7 @@ static demuxer_t* mov_read_header(demuxer_t* demuxer){
demuxer->video->id = t_no;
s = new_ds_stream(demuxer->video);
- od = demux_open(s, DEMUXER_TYPE_MPEG_PS, -1, -1, -1, NULL);
+ od = demux_open(opts, s, DEMUXER_TYPE_MPEG_PS, -1, -1, -1, NULL);
if(od) return new_demuxers_demuxer(od, od, od);
demuxer->video->id = -2; //new linked demuxer couldn't be allocated
break;
diff --git a/libmpdemux/demux_mpg.c b/libmpdemux/demux_mpg.c
index 72ab2a9b27..1e994afa41 100644
--- a/libmpdemux/demux_mpg.c
+++ b/libmpdemux/demux_mpg.c
@@ -726,9 +726,10 @@ static int demux_mpg_probe(demuxer_t *demuxer) {
} else
{
if(demuxer->synced==2)
- mp_msg(MSGT_DEMUXER,MSGL_ERR,"MPEG: " MSGTR_MissingVideoStreamBug);
+ mp_msg(MSGT_DEMUXER, MSGL_ERR, "MPEG: %s",
+ mp_gtext("Missing video stream!? Contact the author, it may be a bug :(\n"));
else
- mp_msg(MSGT_DEMUXER,MSGL_V,MSGTR_NotSystemStream);
+ mp_tmsg(MSGT_DEMUXER,MSGL_V,"Not MPEG System Stream format... (maybe Transport Stream?)\n");
}
}
//FIXME this shouldn't be necessary
@@ -814,7 +815,7 @@ static int demux_mpg_gxf_fill_buffer(demuxer_t *demux, demux_stream_t *ds) {
return 1;
}
-int demux_mpg_fill_buffer(demuxer_t *demux, demux_stream_t *ds){
+static int demux_mpg_fill_buffer(demuxer_t *demux, demux_stream_t *ds){
unsigned int head=0;
int skipped=0;
int max_packs=256; // 512kbyte
@@ -867,7 +868,7 @@ do{
if(!ret)
if(--max_packs==0){
demux->stream->eof=1;
- mp_msg(MSGT_DEMUX,MSGL_ERR,MSGTR_DoesntContainSelectedStream);
+ mp_tmsg(MSGT_DEMUX,MSGL_ERR,"demux: File doesn't contain the selected audio or video stream.\n");
return 0;
}
if(demux->synced==3) demux->synced=(ret==1)?2:0; // PES detect
@@ -901,7 +902,7 @@ do{
void skip_audio_frame(sh_audio_t *sh_audio);
-void demux_seek_mpg(demuxer_t *demuxer,float rel_seek_secs,float audio_delay, int flags){
+static void demux_seek_mpg(demuxer_t *demuxer,float rel_seek_secs,float audio_delay, int flags){
demux_stream_t *d_audio=demuxer->audio;
demux_stream_t *d_video=demuxer->video;
sh_audio_t *sh_audio=d_audio->sh;
@@ -1007,13 +1008,13 @@ void demux_seek_mpg(demuxer_t *demuxer,float rel_seek_secs,float audio_delay, in
}
}
-int demux_mpg_control(demuxer_t *demuxer,int cmd, void *arg){
+static int demux_mpg_control(demuxer_t *demuxer,int cmd, void *arg){
mpg_demuxer_t *mpg_d=(mpg_demuxer_t*)demuxer->priv;
switch(cmd) {
case DEMUXER_CTRL_GET_TIME_LENGTH:
if(stream_control(demuxer->stream, STREAM_CTRL_GET_TIME_LENGTH, arg) != STREAM_UNSUPPORTED) {
- mp_msg(MSGT_DEMUXER,MSGL_DBG2,"\r\nDEMUX_MPG_CTRL, (%.3lf)\r\n", *((double*)arg));
+ mp_msg(MSGT_DEMUXER,MSGL_DBG2,"\r\nDEMUX_MPG_CTRL, (%.3f)\r\n", *((double*)arg));
return DEMUXER_CTRL_GUESS;
}
if (mpg_d && mpg_d->has_valid_timestamps) {
@@ -1102,7 +1103,8 @@ static demuxer_t* demux_mpg_ps_open(demuxer_t* demuxer)
if(demuxer->audio->id!=-2) {
if(!ds_fill_buffer(demuxer->audio)){
- mp_msg(MSGT_DEMUXER,MSGL_INFO,"MPEG: " MSGTR_MissingAudioStream);
+ mp_msg(MSGT_DEMUXER, MSGL_INFO, "MPEG: %s",
+ mp_gtext("No audio stream found -> no sound.\n"));
demuxer->audio->sh=NULL;
} else {
sh_audio=demuxer->audio->sh;sh_audio->ds=demuxer->audio;
diff --git a/libmpdemux/demux_nemesi.c b/libmpdemux/demux_nemesi.c
index a252c8c984..704c31e4b1 100644
--- a/libmpdemux/demux_nemesi.c
+++ b/libmpdemux/demux_nemesi.c
@@ -455,7 +455,7 @@ static void demux_seek_rtp(demuxer_t *demuxer, float rel_seek_secs,
mp_msg(MSGT_DEMUX, MSGL_ERR, "Unsupported seek type\n");
}
-static int demux_rtp_control(struct demuxer_st *demuxer, int cmd, void *arg)
+static int demux_rtp_control(struct demuxer *demuxer, int cmd, void *arg)
{
Nemesi_DemuxerStreamData * ndsd = demuxer->priv;
rtsp_ctrl * ctl = ndsd->rtsp;
diff --git a/libmpdemux/demux_nut.c b/libmpdemux/demux_nut.c
index 559d839653..7054b0d054 100644
--- a/libmpdemux/demux_nut.c
+++ b/libmpdemux/demux_nut.c
@@ -115,7 +115,7 @@ static demuxer_t * demux_open_nut(demuxer_t * demuxer) {
s[i].codec_specific_len, 1);
sh_audio_t* sh_audio = new_sh_audio(demuxer, i);
int j;
- mp_msg(MSGT_DEMUX, MSGL_INFO, MSGTR_AudioID, "nut", i);
+ mp_tmsg(MSGT_DEMUX, MSGL_INFO, "[%s] Audio stream found, -aid %d\n", "nut", i);
sh_audio->wf= wf; sh_audio->ds = demuxer->audio;
sh_audio->audio.dwSampleSize = 0; // FIXME
@@ -151,7 +151,7 @@ static demuxer_t * demux_open_nut(demuxer_t * demuxer) {
s[i].codec_specific_len, 1);
sh_video_t * sh_video = new_sh_video(demuxer, i);
int j;
- mp_msg(MSGT_DEMUX, MSGL_INFO, MSGTR_VideoID, "nut", i);
+ mp_tmsg(MSGT_DEMUX, MSGL_INFO, "[%s] Video stream found, -vid %d\n", "nut", i);
sh_video->bih = bih;
sh_video->ds = demuxer->video;
diff --git a/libmpdemux/demux_ogg.c b/libmpdemux/demux_ogg.c
index 3af4866926..2bd6781cf2 100644
--- a/libmpdemux/demux_ogg.c
+++ b/libmpdemux/demux_ogg.c
@@ -25,12 +25,13 @@
#include <math.h>
#include <inttypes.h>
+#include "options.h"
#include "mp_msg.h"
#include "help_mp.h"
#include "stream/stream.h"
#include "demuxer.h"
#include "stheader.h"
-#include "libavutil/intreadwrite.h"
+#include "ffmpeg_files/intreadwrite.h"
#define FOURCC_VORBIS mmioFOURCC('v', 'r', 'b', 's')
#define FOURCC_SPEEX mmioFOURCC('s', 'p', 'x', ' ')
@@ -165,7 +166,6 @@ typedef struct ogg_demuxer {
#define PACKET_IS_SYNCPOINT 0x08
extern char *dvdsub_lang, *audio_lang;
-extern int dvdsub_id;
//-------- subtitle support - should be moved to decoder layer, and queue
// - subtitles up in demuxer buffer...
@@ -177,7 +177,7 @@ extern int dvdsub_id;
static subtitle ogg_sub;
//FILE* subout;
-void demux_ogg_add_sub (ogg_stream_t* os,ogg_packet* pack) {
+static void demux_ogg_add_sub (ogg_stream_t* os,ogg_packet* pack) {
int lcv;
char *packet = pack->packet;
@@ -417,7 +417,7 @@ static void demux_ogg_check_comments(demuxer_t *d, ogg_stream_t *os, int id, vor
if (os->text && d->sub->id < 0 && demux_ogg_check_lang(val, dvdsub_lang))
{
d->sub->id = index;
- dvdsub_id = index;
+ d->opts->sub_id = index;
mp_msg(MSGT_DEMUX, MSGL_V, "Ogg demuxer: Displaying subtitle stream id %d which matched -slang %s\n", id, val);
}
else
@@ -513,7 +513,7 @@ static int demux_ogg_add_packet(demux_stream_t* ds,ogg_stream_t* os,int id,ogg_p
/// if -forceidx build a table of all syncpoints to make seeking easier
/// otherwise try to get at least the final_granulepos
-void demux_ogg_scan_stream(demuxer_t* demuxer) {
+static void demux_ogg_scan_stream(demuxer_t* demuxer) {
ogg_demuxer_t* ogg_d = demuxer->priv;
stream_t *s = demuxer->stream;
ogg_sync_state* sync = &ogg_d->sync;
@@ -1248,6 +1248,7 @@ static int demux_ogg_fill_buffer(demuxer_t *d, demux_stream_t *dsds) {
/// For avi with Ogg audio stream we have to create an ogg demuxer for this
// stream, then we join the avi and ogg demuxer with a demuxers demuxer
demuxer_t* init_avi_with_ogg(demuxer_t* demuxer) {
+ struct MPOpts *opts = demuxer->opts;
demuxer_t *od;
ogg_demuxer_t *ogg_d;
stream_t* s;
@@ -1309,7 +1310,7 @@ demuxer_t* init_avi_with_ogg(demuxer_t* demuxer) {
// Create the ds_stream and the ogg demuxer
s = new_ds_stream(demuxer->audio);
- od = new_demuxer(s,DEMUXER_TYPE_OGG,0,-2,-2,NULL);
+ od = new_demuxer(opts, s,DEMUXER_TYPE_OGG,0,-2,-2,NULL);
/// Add the header packets in the ogg demuxer audio stream
for (i = 0; i < 3; i++) {
diff --git a/libmpdemux/demux_pva.c b/libmpdemux/demux_pva.c
index 835fba2961..39fad12184 100644
--- a/libmpdemux/demux_pva.c
+++ b/libmpdemux/demux_pva.c
@@ -73,7 +73,7 @@ typedef struct {
-int pva_sync(demuxer_t * demuxer)
+static int pva_sync(demuxer_t * demuxer)
{
uint8_t buffer[5]={0,0,0,0,0};
int count;
diff --git a/libmpdemux/demux_real.c b/libmpdemux/demux_real.c
index de6ff785ee..8f3a46d56c 100644
--- a/libmpdemux/demux_real.c
+++ b/libmpdemux/demux_real.c
@@ -1280,7 +1280,7 @@ static demuxer_t* demux_open_real(demuxer_t* demuxer)
int i;
char *buft;
int hdr_size;
- mp_msg(MSGT_DEMUX, MSGL_INFO, MSGTR_AudioID, "real", stream_id);
+ mp_tmsg(MSGT_DEMUX, MSGL_INFO, "[%s] Audio stream found, -aid %d\n", "real", stream_id);
mp_msg(MSGT_DEMUX,MSGL_V,"Found audio stream!\n");
version = stream_read_word(demuxer->stream);
mp_msg(MSGT_DEMUX,MSGL_V,"version: %d\n", version);
@@ -1481,7 +1481,7 @@ static demuxer_t* demux_open_real(demuxer_t* demuxer)
}
} else if (strstr(mimet,"X-MP3-draft-00")) {
sh_audio_t *sh = new_sh_audio(demuxer, stream_id);
- mp_msg(MSGT_DEMUX, MSGL_INFO, MSGTR_AudioID, "real", stream_id);
+ mp_tmsg(MSGT_DEMUX, MSGL_INFO, "[%s] Audio stream found, -aid %d\n", "real", stream_id);
/* Emulate WAVEFORMATEX struct: */
sh->wf = malloc(sizeof(WAVEFORMATEX));
@@ -1517,7 +1517,7 @@ static demuxer_t* demux_open_real(demuxer_t* demuxer)
} else {
/* video header */
sh_video_t *sh = new_sh_video(demuxer, stream_id);
- mp_msg(MSGT_DEMUX, MSGL_INFO, MSGTR_VideoID, "real", stream_id);
+ mp_tmsg(MSGT_DEMUX, MSGL_INFO, "[%s] Video stream found, -vid %d\n", "real", stream_id);
sh->format = stream_read_dword_le(demuxer->stream); /* fourcc */
mp_msg(MSGT_DEMUX,MSGL_V,"video fourcc: %.4s (%x)\n", (char *)&sh->format, sh->format);
@@ -1740,13 +1740,15 @@ header_end:
if(demuxer->video->id==-1 && v_streams>0){
// find the valid video stream:
if(!ds_fill_buffer(demuxer->video)){
- mp_msg(MSGT_DEMUXER,MSGL_INFO,"RM: " MSGTR_MissingVideoStream);
+ mp_msg(MSGT_DEMUXER, MSGL_INFO, "RM: %s",
+ mp_gtext("No video stream found.\n"));
}
}
if(demuxer->audio->id==-1 && a_streams>0){
// find the valid audio stream:
if(!ds_fill_buffer(demuxer->audio)){
- mp_msg(MSGT_DEMUXER,MSGL_INFO,"RM: " MSGTR_MissingAudioStream);
+ mp_msg(MSGT_DEMUXER, MSGL_INFO, "RM: %s",
+ mp_gtext("No audio stream found -> no sound.\n"));
}
}
diff --git a/libmpdemux/demux_rtp.cpp b/libmpdemux/demux_rtp.cpp
index 43d38806f0..8a5cfb8460 100644
--- a/libmpdemux/demux_rtp.cpp
+++ b/libmpdemux/demux_rtp.cpp
@@ -26,6 +26,7 @@ extern "C" {
#endif
#include "demux_rtp.h"
#include "stheader.h"
+#include "options.h"
}
#include "demux_rtp_internal.h"
@@ -121,8 +122,8 @@ extern int rtsp_port;
extern AVCodecContext *avcctx;
#endif
-extern "C" int audio_id, video_id, dvdsub_id;
extern "C" demuxer_t* demux_open_rtp(demuxer_t* demuxer) {
+ struct MPOpts *opts = demuxer->opts;
Boolean success = False;
do {
TaskScheduler* scheduler = BasicTaskScheduler::createNew();
@@ -282,8 +283,9 @@ extern "C" demuxer_t* demux_open_rtp(demuxer_t* demuxer) {
// code to recognize this:
if (demux_is_multiplexed_rtp_stream(demuxer)) {
stream_t* s = new_ds_stream(demuxer->video);
- demuxer_t* od = demux_open(s, DEMUXER_TYPE_UNKNOWN,
- audio_id, video_id, dvdsub_id, NULL);
+ demuxer_t* od = demux_open(opts, s, DEMUXER_TYPE_UNKNOWN,
+ opts->audio_id, opts->video_id, opts->sub_id,
+ NULL);
demuxer = new_demuxers_demuxer(od, od, od);
}
@@ -666,7 +668,7 @@ demux_packet_t* ReadBufferQueue::getPendingBuffer() {
return dp;
}
-static int demux_rtp_control(struct demuxer_st *demuxer, int cmd, void *arg) {
+static int demux_rtp_control(struct demuxer *demuxer, int cmd, void *arg) {
double endpts = ((RTPState*)demuxer->priv)->mediaSession->playEndTime();
switch(cmd) {
diff --git a/libmpdemux/demux_ty.c b/libmpdemux/demux_ty.c
index b784715e2f..5f6dcdb59a 100644
--- a/libmpdemux/demux_ty.c
+++ b/libmpdemux/demux_ty.c
@@ -45,7 +45,7 @@
#include "stheader.h"
#include "sub_cc.h"
#include "libavutil/avstring.h"
-#include "libavutil/intreadwrite.h"
+#include "ffmpeg_files/intreadwrite.h"
void skip_audio_frame( sh_audio_t *sh_audio );
extern int sub_justify;
@@ -871,7 +871,8 @@ static demuxer_t* demux_open_ty(demuxer_t* demuxer)
if(demuxer->audio->id!=-2) {
if(!ds_fill_buffer(demuxer->audio)){
- mp_msg(MSGT_DEMUXER,MSGL_INFO,"MPEG: " MSGTR_MissingAudioStream);
+ mp_msg(MSGT_DEMUXER, MSGL_INFO, "MPEG: %s",
+ mp_gtext("No audio stream found -> no sound.\n"));
demuxer->audio->sh=NULL;
} else {
sh_audio=demuxer->audio->sh;sh_audio->ds=demuxer->audio;
diff --git a/libmpdemux/demux_ty_osd.c b/libmpdemux/demux_ty_osd.c
index 9ae04ece5d..0fb35c2d61 100644
--- a/libmpdemux/demux_ty_osd.c
+++ b/libmpdemux/demux_ty_osd.c
@@ -909,6 +909,3 @@ void ty_processuserdata( unsigned char* buf, int len )
}
}
}
-
-
-
diff --git a/libmpdemux/demux_viv.c b/libmpdemux/demux_viv.c
index b642ee761f..77e6200dac 100644
--- a/libmpdemux/demux_viv.c
+++ b/libmpdemux/demux_viv.c
@@ -562,7 +562,8 @@ static demuxer_t* demux_open_vivo(demuxer_t* demuxer){
vivo_priv_t* priv=demuxer->priv;
if(!ds_fill_buffer(demuxer->video)){
- mp_msg(MSGT_DEMUX,MSGL_ERR,"VIVO: " MSGTR_MissingVideoStreamBug);
+ mp_msg(MSGT_DEMUX, MSGL_ERR, "VIVO: %s",
+ mp_gtext("Missing video stream!? Contact the author, it may be a bug :(\n"));
return NULL;
}
@@ -645,7 +646,8 @@ static demuxer_t* demux_open_vivo(demuxer_t* demuxer){
/* AUDIO init */
if (demuxer->audio->id >= -1){
if(!ds_fill_buffer(demuxer->audio)){
- mp_msg(MSGT_DEMUX,MSGL_ERR,"VIVO: " MSGTR_MissingAudioStream);
+ mp_msg(MSGT_DEMUX, MSGL_ERR, "VIVO: %s",
+ mp_gtext("No audio stream found -> no sound.\n"));
} else
{ sh_audio_t* sh=new_sh_audio(demuxer,1);
diff --git a/libmpdemux/demux_vqf.c b/libmpdemux/demux_vqf.c
index 4ec8865a10..9a90f33fb3 100644
--- a/libmpdemux/demux_vqf.c
+++ b/libmpdemux/demux_vqf.c
@@ -21,7 +21,7 @@
#include <stdlib.h>
#include <stdio.h>
#include "libavutil/common.h"
-#include "libavutil/intreadwrite.h"
+#include "ffmpeg_files/intreadwrite.h"
#include "mpbswap.h"
#include "stream/stream.h"
diff --git a/libmpdemux/demux_xmms.c b/libmpdemux/demux_xmms.c
index 8edbc2fe28..a370824119 100644
--- a/libmpdemux/demux_xmms.c
+++ b/libmpdemux/demux_xmms.c
@@ -195,7 +195,7 @@ static void init_plugins_from_dir(const char *plugin_dir){
gpi=dlsym(handle, "get_iplugin_info");
if(gpi){
InputPlugin *p=gpi();
- mp_msg(MSGT_DEMUX, MSGL_INFO, MSGTR_MPDEMUX_XMMS_FoundPlugin,
+ mp_tmsg(MSGT_DEMUX, MSGL_INFO, "Found plugin: %s (%s).\n",
ent->d_name,p->description);
p->handle = handle;
p->filename = strdup(filename);
@@ -230,7 +230,7 @@ static void init_plugins(void) {
static void cleanup_plugins(void) {
while(no_plugins>0){
--no_plugins;
- mp_msg(MSGT_DEMUX, MSGL_INFO, MSGTR_MPDEMUX_XMMS_ClosingPlugin,
+ mp_tmsg(MSGT_DEMUX, MSGL_INFO, "Closing plugin: %s.\n",
input_plugins[no_plugins]->filename);
if(input_plugins[no_plugins]->cleanup)
input_plugins[no_plugins]->cleanup();
@@ -284,7 +284,7 @@ static int demux_xmms_open(demuxer_t* demuxer) {
ip->get_song_info(demuxer->stream->url,&xmms_title,&xmms_length);
if (xmms_length<=0) demuxer->seekable=0;
- mp_msg(MSGT_DEMUX,MSGL_INFO,MSGTR_MPDEMUX_XMMS_WaitForStart,
+ mp_tmsg(MSGT_DEMUX,MSGL_INFO,"Waiting for the XMMS plugin to start playback of '%s'...\n",
demuxer->stream->url);
while (xmms_channels==0) {
usleep(10000);
diff --git a/libmpdemux/demuxer.c b/libmpdemux/demuxer.c
index 5d4798470a..5ec705af32 100644
--- a/libmpdemux/demuxer.c
+++ b/libmpdemux/demuxer.c
@@ -27,6 +27,8 @@
#include <sys/stat.h>
#include "config.h"
+#include "options.h"
+#include "talloc.h"
#include "mp_msg.h"
#include "help_mp.h"
#include "m_config.h"
@@ -41,10 +43,7 @@
#include "libaf/af_format.h"
#include "libmpcodecs/dec_teletext.h"
-#ifdef CONFIG_ASS
-#include "libass/ass.h"
-#include "libass/ass_mp.h"
-#endif
+#include "ass_mp.h"
#ifdef CONFIG_LIBAVCODEC
#include "libavcodec/avcodec.h"
@@ -193,7 +192,7 @@ void free_demuxer_stream(demux_stream_t *ds)
free(ds);
}
-demux_stream_t *new_demuxer_stream(struct demuxer_st *demuxer, int id)
+demux_stream_t *new_demuxer_stream(struct demuxer *demuxer, int id)
{
demux_stream_t *ds = malloc(sizeof(demux_stream_t));
*ds = (demux_stream_t){
@@ -223,11 +222,10 @@ static const demuxer_desc_t *get_demuxer_desc_from_type(int file_format)
}
-demuxer_t *new_demuxer(stream_t *stream, int type, int a_id, int v_id,
- int s_id, char *filename)
+demuxer_t *new_demuxer(struct MPOpts *opts, stream_t *stream, int type,
+ int a_id, int v_id, int s_id, char *filename)
{
- demuxer_t *d = malloc(sizeof(demuxer_t));
- memset(d, 0, sizeof(demuxer_t));
+ struct demuxer *d = talloc_zero(NULL, struct demuxer);
d->stream = stream;
d->stream_pts = MP_NOPTS_VALUE;
d->reference_clock = MP_NOPTS_VALUE;
@@ -240,6 +238,7 @@ demuxer_t *new_demuxer(stream_t *stream, int type, int a_id, int v_id,
d->video = new_demuxer_stream(d, v_id);
d->sub = new_demuxer_stream(d, s_id);
d->type = type;
+ d->opts = opts;
if (type)
if (!(d->desc = get_demuxer_desc_from_type(type)))
mp_msg(MSGT_DEMUXER, MSGL_ERR,
@@ -252,8 +251,6 @@ demuxer_t *new_demuxer(stream_t *stream, int type, int a_id, int v_id,
return d;
}
-extern int dvdsub_id;
-
sh_sub_t *new_sh_sub_sid(demuxer_t *demuxer, int id, int sid)
{
if (id > MAX_S_STREAMS - 1 || id < 0) {
@@ -268,16 +265,17 @@ sh_sub_t *new_sh_sub_sid(demuxer_t *demuxer, int id, int sid)
sh_sub_t *sh = calloc(1, sizeof(sh_sub_t));
demuxer->s_streams[id] = sh;
sh->sid = sid;
+ sh->opts = demuxer->opts;
mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_SUBTITLE_ID=%d\n", sid);
}
- if (sid == dvdsub_id) {
+ if (sid == demuxer->opts->sub_id) {
demuxer->sub->id = id;
demuxer->sub->sh = demuxer->s_streams[id];
}
return demuxer->s_streams[id];
}
-void free_sh_sub(sh_sub_t *sh)
+static void free_sh_sub(sh_sub_t *sh)
{
mp_msg(MSGT_DEMUXER, MSGL_DBG2, "DEMUXER: freeing sh_sub at %p\n", sh);
free(sh->extradata);
@@ -300,11 +298,11 @@ sh_audio_t *new_sh_audio_aid(demuxer_t *demuxer, int id, int aid)
MAX_A_STREAMS);
return NULL;
}
- if (demuxer->a_streams[id])
- mp_msg(MSGT_DEMUXER, MSGL_WARN, MSGTR_AudioStreamRedefined, id);
- else {
+ if (demuxer->a_streams[id]) {
+ mp_tmsg(MSGT_DEMUXER, MSGL_WARN, "WARNING: Audio stream header %d redefined.\n", id);
+ } else {
+ mp_tmsg(MSGT_DEMUXER, MSGL_V, "==> Found audio stream: %d\n", id);
sh_audio_t *sh = calloc(1, sizeof(sh_audio_t));
- mp_msg(MSGT_DEMUXER, MSGL_V, MSGTR_FoundAudioStream, id);
demuxer->a_streams[id] = sh;
sh->aid = aid;
sh->ds = demuxer->audio;
@@ -313,6 +311,7 @@ sh_audio_t *new_sh_audio_aid(demuxer_t *demuxer, int id, int aid)
sh->sample_format = AF_FORMAT_S16_NE;
sh->audio_out_minsize = 8192; /* default size, maybe not enough for Win32/ACM */
sh->pts = MP_NOPTS_VALUE;
+ sh->opts = demuxer->opts;
mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_AUDIO_ID=%d\n", aid);
}
return demuxer->a_streams[id];
@@ -341,13 +340,14 @@ sh_video_t *new_sh_video_vid(demuxer_t *demuxer, int id, int vid)
return NULL;
}
if (demuxer->v_streams[id])
- mp_msg(MSGT_DEMUXER, MSGL_WARN, MSGTR_VideoStreamRedefined, id);
+ mp_tmsg(MSGT_DEMUXER, MSGL_WARN, "WARNING: Video stream header %d redefined.\n", id);
else {
- sh_video_t *sh = calloc(1, sizeof(sh_video_t));
- mp_msg(MSGT_DEMUXER, MSGL_V, MSGTR_FoundVideoStream, id);
+ mp_tmsg(MSGT_DEMUXER, MSGL_V, "==> Found video stream: %d\n", id);
+ sh_video_t *sh = calloc(1, sizeof *sh);
demuxer->v_streams[id] = sh;
sh->vid = vid;
sh->ds = demuxer->video;
+ sh->opts = demuxer->opts;
mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_VIDEO_ID=%d\n", vid);
}
return demuxer->v_streams[id];
@@ -394,22 +394,9 @@ void free_demuxer(demuxer_t *demuxer)
free(demuxer->info);
}
free(demuxer->filename);
- if (demuxer->chapters) {
- for (i = 0; i < demuxer->num_chapters; i++)
- free(demuxer->chapters[i].name);
- free(demuxer->chapters);
- }
- if (demuxer->attachments) {
- for (i = 0; i < demuxer->num_attachments; i++) {
- free(demuxer->attachments[i].name);
- free(demuxer->attachments[i].type);
- free(demuxer->attachments[i].data);
- }
- free(demuxer->attachments);
- }
if (demuxer->teletext)
teletext_control(demuxer->teletext, TV_VBI_CONTROL_STOP, NULL);
- free(demuxer);
+ talloc_free(demuxer);
}
@@ -637,20 +624,32 @@ int ds_fill_buffer(demux_stream_t *ds)
if (!ds->first)
ds->last = NULL;
--ds->packs;
+ /* The code below can set ds->eof to 1 when another stream runs
+ * out of buffer space. That makes sense because in that situation
+ * the calling code should not count on being able to demux more
+ * packets from this stream.
+ * If however the situation improves and we're called again
+ * despite the eof flag then it's better to clear it to avoid
+ * weird behavior. */
+ ds->eof = 0;
return 1;
}
+
+#define MaybeNI _("Maybe you are playing a non-interleaved stream/file or the codec failed?\n" \
+ "For AVI files, try to force non-interleaved mode with the -ni option.\n")
+
if (demux->audio->packs >= MAX_PACKS
|| demux->audio->bytes >= MAX_PACK_BYTES) {
- mp_msg(MSGT_DEMUXER, MSGL_ERR, MSGTR_TooManyAudioInBuffer,
+ mp_tmsg(MSGT_DEMUXER, MSGL_ERR, "\nToo many audio packets in the buffer: (%d in %d bytes).\n",
demux->audio->packs, demux->audio->bytes);
- mp_msg(MSGT_DEMUXER, MSGL_HINT, MSGTR_MaybeNI);
+ mp_tmsg(MSGT_DEMUXER, MSGL_HINT, MaybeNI);
break;
}
if (demux->video->packs >= MAX_PACKS
|| demux->video->bytes >= MAX_PACK_BYTES) {
- mp_msg(MSGT_DEMUXER, MSGL_ERR, MSGTR_TooManyVideoInBuffer,
+ mp_tmsg(MSGT_DEMUXER, MSGL_ERR, "\nToo many video packets in the buffer: (%d in %d bytes).\n",
demux->video->packs, demux->video->bytes);
- mp_msg(MSGT_DEMUXER, MSGL_HINT, MSGTR_MaybeNI);
+ mp_tmsg(MSGT_DEMUXER, MSGL_HINT, MaybeNI);
break;
}
if (!demux_fill_buffer(demux, ds)) {
@@ -816,16 +815,16 @@ double ds_get_next_pts(demux_stream_t *ds)
while (!ds->first) {
if (demux->audio->packs >= MAX_PACKS
|| demux->audio->bytes >= MAX_PACK_BYTES) {
- mp_msg(MSGT_DEMUXER, MSGL_ERR, MSGTR_TooManyAudioInBuffer,
+ mp_tmsg(MSGT_DEMUXER, MSGL_ERR, "\nToo many audio packets in the buffer: (%d in %d bytes).\n",
demux->audio->packs, demux->audio->bytes);
- mp_msg(MSGT_DEMUXER, MSGL_HINT, MSGTR_MaybeNI);
+ mp_tmsg(MSGT_DEMUXER, MSGL_HINT, MaybeNI);
return MP_NOPTS_VALUE;
}
if (demux->video->packs >= MAX_PACKS
|| demux->video->bytes >= MAX_PACK_BYTES) {
- mp_msg(MSGT_DEMUXER, MSGL_ERR, MSGTR_TooManyVideoInBuffer,
+ mp_tmsg(MSGT_DEMUXER, MSGL_ERR, "\nToo many video packets in the buffer: (%d in %d bytes).\n",
demux->video->packs, demux->video->bytes);
- mp_msg(MSGT_DEMUXER, MSGL_HINT, MSGTR_MaybeNI);
+ mp_tmsg(MSGT_DEMUXER, MSGL_HINT, MaybeNI);
return MP_NOPTS_VALUE;
}
if (!demux_fill_buffer(demux, ds))
@@ -897,9 +896,6 @@ int get_demuxer_type_from_name(char *demuxer_name, int *force)
int extension_parsing = 1; // 0=off 1=mixed (used only for unstable formats)
-int correct_pts = 0;
-int user_correct_pts = -1;
-
/*
NOTE : Several demuxers may be opened at the same time so
demuxers should NEVER rely on an external var to enable them
@@ -913,9 +909,10 @@ int user_correct_pts = -1;
(ex: tv,mf).
*/
-static demuxer_t *demux_open_stream(stream_t *stream, int file_format,
- int force, int audio_id, int video_id,
- int dvdsub_id, char *filename)
+static demuxer_t *demux_open_stream(struct MPOpts *opts, stream_t *stream,
+ int file_format, int force, int audio_id,
+ int video_id, int dvdsub_id,
+ char *filename)
{
demuxer_t *demuxer = NULL;
@@ -928,7 +925,7 @@ static demuxer_t *demux_open_stream(stream_t *stream, int file_format,
// If somebody requested a demuxer check it
if (file_format) {
if ((demuxer_desc = get_demuxer_desc_from_type(file_format))) {
- demuxer = new_demuxer(stream, demuxer_desc->type, audio_id,
+ demuxer = new_demuxer(opts, stream, demuxer_desc->type, audio_id,
video_id, dvdsub_id, filename);
if (demuxer_desc->check_file)
fformat = demuxer_desc->check_file(demuxer);
@@ -938,8 +935,8 @@ static demuxer_t *demux_open_stream(stream_t *stream, int file_format,
if (fformat == demuxer_desc->type) {
demuxer_t *demux2 = demuxer;
// Move messages to demuxer detection code?
- mp_msg(MSGT_DEMUXER, MSGL_INFO,
- MSGTR_Detected_XXX_FileFormat,
+ mp_tmsg(MSGT_DEMUXER, MSGL_INFO,
+ "%s file format detected.\n",
demuxer_desc->shortdesc);
file_format = fformat;
if (!demuxer->desc->open
@@ -950,8 +947,9 @@ static demuxer_t *demux_open_stream(stream_t *stream, int file_format,
} else {
// Format changed after check, recurse
free_demuxer(demuxer);
- return demux_open_stream(stream, fformat, force, audio_id,
- video_id, dvdsub_id, filename);
+ return demux_open_stream(opts, stream, fformat, force,
+ audio_id, video_id, dvdsub_id,
+ filename);
}
}
// Check failed for forced demuxer, quit
@@ -962,13 +960,13 @@ static demuxer_t *demux_open_stream(stream_t *stream, int file_format,
// Test demuxers with safe file checks
for (i = 0; (demuxer_desc = demuxer_list[i]); i++) {
if (demuxer_desc->safe_check) {
- demuxer = new_demuxer(stream, demuxer_desc->type, audio_id,
+ demuxer = new_demuxer(opts, stream, demuxer_desc->type, audio_id,
video_id, dvdsub_id, filename);
if ((fformat = demuxer_desc->check_file(demuxer)) != 0) {
if (fformat == demuxer_desc->type) {
demuxer_t *demux2 = demuxer;
- mp_msg(MSGT_DEMUXER, MSGL_INFO,
- MSGTR_Detected_XXX_FileFormat,
+ mp_tmsg(MSGT_DEMUXER, MSGL_INFO,
+ "%s file format detected.\n",
demuxer_desc->shortdesc);
file_format = fformat;
if (!demuxer->desc->open
@@ -981,7 +979,7 @@ static demuxer_t *demux_open_stream(stream_t *stream, int file_format,
return demuxer; // handled in mplayer.c
// Format changed after check, recurse
free_demuxer(demuxer);
- demuxer = demux_open_stream(stream, fformat, force,
+ demuxer = demux_open_stream(opts, stream, fformat, force,
audio_id, video_id,
dvdsub_id, filename);
if (demuxer)
@@ -1003,8 +1001,9 @@ static demuxer_t *demux_open_stream(stream_t *stream, int file_format,
file_format = demuxer_type_by_filename(filename);
if (file_format != DEMUXER_TYPE_UNKNOWN) {
// we like recursion :)
- demuxer = demux_open_stream(stream, file_format, force, audio_id,
- video_id, dvdsub_id, filename);
+ demuxer = demux_open_stream(opts, stream, file_format, force,
+ audio_id, video_id, dvdsub_id,
+ filename);
if (demuxer)
return demuxer; // done!
file_format = DEMUXER_TYPE_UNKNOWN; // continue fuzzy guessing...
@@ -1015,13 +1014,13 @@ static demuxer_t *demux_open_stream(stream_t *stream, int file_format,
// Try detection for all other demuxers
for (i = 0; (demuxer_desc = demuxer_list[i]); i++) {
if (!demuxer_desc->safe_check && demuxer_desc->check_file) {
- demuxer = new_demuxer(stream, demuxer_desc->type, audio_id,
+ demuxer = new_demuxer(opts, stream, demuxer_desc->type, audio_id,
video_id, dvdsub_id, filename);
if ((fformat = demuxer_desc->check_file(demuxer)) != 0) {
if (fformat == demuxer_desc->type) {
demuxer_t *demux2 = demuxer;
- mp_msg(MSGT_DEMUXER, MSGL_INFO,
- MSGTR_Detected_XXX_FileFormat,
+ mp_tmsg(MSGT_DEMUXER, MSGL_INFO,
+ "%s file format detected.\n",
demuxer_desc->shortdesc);
file_format = fformat;
if (!demuxer->desc->open
@@ -1034,7 +1033,7 @@ static demuxer_t *demux_open_stream(stream_t *stream, int file_format,
return demuxer; // handled in mplayer.c
// Format changed after check, recurse
free_demuxer(demuxer);
- demuxer = demux_open_stream(stream, fformat, force,
+ demuxer = demux_open_stream(opts, stream, fformat, force,
audio_id, video_id,
dvdsub_id, filename);
if (demuxer)
@@ -1063,7 +1062,7 @@ static demuxer_t *demux_open_stream(stream_t *stream, int file_format,
sh_video->i_bps / 1024.0f);
}
#ifdef CONFIG_ASS
- if (ass_enabled && ass_library) {
+ if (opts->ass_enabled && ass_library) {
for (i = 0; i < MAX_S_STREAMS; ++i) {
sh_sub_t *sh = demuxer->s_streams[i];
if (sh && sh->type == 'a') {
@@ -1092,8 +1091,9 @@ extern int hr_mp3_seek;
extern float stream_cache_min_percent;
extern float stream_cache_seek_min_percent;
-demuxer_t *demux_open(stream_t *vs, int file_format, int audio_id,
- int video_id, int dvdsub_id, char *filename)
+demuxer_t *demux_open(struct MPOpts *opts, stream_t *vs, int file_format,
+ int audio_id, int video_id, int dvdsub_id,
+ char *filename)
{
stream_t *as = NULL, *ss = NULL;
demuxer_t *vd, *ad = NULL, *sd = NULL;
@@ -1124,7 +1124,7 @@ demuxer_t *demux_open(stream_t *vs, int file_format, int audio_id,
if (audio_stream) {
as = open_stream(audio_stream, 0, &afmt);
if (!as) {
- mp_msg(MSGT_DEMUXER, MSGL_ERR, MSGTR_CannotOpenAudioStream,
+ mp_tmsg(MSGT_DEMUXER, MSGL_ERR, "Cannot open audio stream: %s\n",
audio_stream);
return NULL;
}
@@ -1145,13 +1145,13 @@ demuxer_t *demux_open(stream_t *vs, int file_format, int audio_id,
if (sub_stream) {
ss = open_stream(sub_stream, 0, &sfmt);
if (!ss) {
- mp_msg(MSGT_DEMUXER, MSGL_ERR, MSGTR_CannotOpenSubtitlesStream,
+ mp_tmsg(MSGT_DEMUXER, MSGL_ERR, "Cannot open subtitle stream: %s\n",
sub_stream);
return NULL;
}
}
- vd = demux_open_stream(vs, demuxer_type ? demuxer_type : file_format,
+ vd = demux_open_stream(opts, vs, demuxer_type ? demuxer_type : file_format,
demuxer_force, audio_stream ? -2 : audio_id,
video_id, sub_stream ? -2 : dvdsub_id, filename);
if (!vd) {
@@ -1162,12 +1162,12 @@ demuxer_t *demux_open(stream_t *vs, int file_format, int audio_id,
return NULL;
}
if (as) {
- ad = demux_open_stream(as,
+ ad = demux_open_stream(opts, as,
audio_demuxer_type ? audio_demuxer_type : afmt,
audio_demuxer_force, audio_id, -2, -2,
audio_stream);
if (!ad) {
- mp_msg(MSGT_DEMUXER, MSGL_WARN, MSGTR_OpeningAudioDemuxerFailed,
+ mp_tmsg(MSGT_DEMUXER, MSGL_WARN, "Failed to open audio demuxer: %s\n",
audio_stream);
free_stream(as);
} else if (ad->audio->sh
@@ -1175,12 +1175,13 @@ demuxer_t *demux_open(stream_t *vs, int file_format, int audio_id,
hr_mp3_seek = 1; // Enable high res seeking
}
if (ss) {
- sd = demux_open_stream(ss, sub_demuxer_type ? sub_demuxer_type : sfmt,
+ sd = demux_open_stream(opts, ss,
+ sub_demuxer_type ? sub_demuxer_type : sfmt,
sub_demuxer_force, -2, -2, dvdsub_id,
sub_stream);
if (!sd) {
- mp_msg(MSGT_DEMUXER, MSGL_WARN,
- MSGTR_OpeningSubtitlesDemuxerFailed, sub_stream);
+ mp_tmsg(MSGT_DEMUXER, MSGL_WARN,
+ "Failed to open subtitle demuxer: %s\n", sub_stream);
free_stream(ss);
}
}
@@ -1194,30 +1195,14 @@ demuxer_t *demux_open(stream_t *vs, int file_format, int audio_id,
else
res = vd;
- correct_pts = user_correct_pts;
- if (correct_pts < 0)
- correct_pts = demux_control(res, DEMUXER_CTRL_CORRECT_PTS, NULL)
- == DEMUXER_CTRL_OK;
+ opts->correct_pts = opts->user_correct_pts;
+ if (opts->correct_pts < 0)
+ opts->correct_pts =
+ demux_control(res, DEMUXER_CTRL_CORRECT_PTS,
+ NULL) == DEMUXER_CTRL_OK;
return res;
}
-/**
- * Do necessary reinitialization after e.g. a seek.
- * Do _not_ call ds_fill_buffer between the seek and this, it breaks at least
- * seeking with ASF demuxer.
- */
-static void demux_resync(demuxer_t *demuxer)
-{
- sh_video_t *sh_video = demuxer->video->sh;
- sh_audio_t *sh_audio = demuxer->audio->sh;
- demux_control(demuxer, DEMUXER_CTRL_RESYNC, NULL);
- if (sh_video) {
- resync_video_stream(sh_video);
- }
- if (sh_audio) {
- resync_audio_stream(sh_audio);
- }
-}
void demux_flush(demuxer_t *demuxer)
{
@@ -1234,27 +1219,36 @@ void demux_flush(demuxer_t *demuxer)
int demux_seek(demuxer_t *demuxer, float rel_seek_secs, float audio_delay,
int flags)
{
+ demux_stream_t *d_audio = demuxer->audio;
+ demux_stream_t *d_video = demuxer->video;
+ sh_audio_t *sh_audio = d_audio->sh;
+ sh_video_t *sh_video = d_video->sh;
double tmp = 0;
double pts;
if (!demuxer->seekable) {
if (demuxer->file_format == DEMUXER_TYPE_AVI)
- mp_msg(MSGT_SEEK, MSGL_WARN, MSGTR_CantSeekRawAVI);
+ mp_tmsg(MSGT_SEEK, MSGL_WARN, "Cannot seek in raw AVI streams. (Index required, try with the -idx switch.)\n");
#ifdef CONFIG_TV
else if (demuxer->file_format == DEMUXER_TYPE_TV)
- mp_msg(MSGT_SEEK, MSGL_WARN, MSGTR_TVInputNotSeekable);
+ mp_tmsg(MSGT_SEEK, MSGL_WARN, "TV input is not seekable! (Seeking will probably be for changing channels ;)\n");
#endif
else
- mp_msg(MSGT_SEEK, MSGL_WARN, MSGTR_CantSeekFile);
+ mp_tmsg(MSGT_SEEK, MSGL_WARN, "Cannot seek in this file.\n");
return 0;
}
-
+ // clear demux buffers:
demux_flush(demuxer);
+ if (sh_audio)
+ sh_audio->a_buffer_len = 0;
demuxer->stream->eof = 0;
demuxer->video->eof = 0;
demuxer->audio->eof = 0;
+ if (sh_video)
+ sh_video->timer = 0; // !!!!!!
+
if (flags & SEEK_ABSOLUTE)
pts = 0.0f;
else {
@@ -1273,7 +1267,7 @@ int demux_seek(demuxer_t *demuxer, float rel_seek_secs, float audio_delay,
if (stream_control(demuxer->stream, STREAM_CTRL_SEEK_TO_TIME, &pts) !=
STREAM_UNSUPPORTED) {
- demux_resync(demuxer);
+ demux_control(demuxer, DEMUXER_CTRL_RESYNC, NULL);
return 1;
}
@@ -1281,7 +1275,8 @@ int demux_seek(demuxer_t *demuxer, float rel_seek_secs, float audio_delay,
if (demuxer->desc->seek)
demuxer->desc->seek(demuxer, rel_seek_secs, audio_delay, flags);
- demux_resync(demuxer);
+ if (sh_audio)
+ resync_audio_stream(sh_audio);
return 1;
}
@@ -1298,7 +1293,7 @@ int demux_info_add(demuxer_t *demuxer, const char *opt, const char *param)
mp_msg(MSGT_DEMUX, MSGL_V, "Demuxer info %s set to unchanged value %s\n", opt, param);
return 0;
}
- mp_msg(MSGT_DEMUX, MSGL_INFO, MSGTR_DemuxerInfoChanged, opt,
+ mp_tmsg(MSGT_DEMUX, MSGL_INFO, "Demuxer info %s changed to %s\n", opt,
param);
free(info[2 * n + 1]);
info[2 * n + 1] = strdup(param);
@@ -1306,8 +1301,8 @@ int demux_info_add(demuxer_t *demuxer, const char *opt, const char *param)
}
}
- info = demuxer->info = (char **) realloc(info,
- (2 * (n + 2)) * sizeof(char *));
+ info = demuxer->info =
+ (char **) realloc(info, (2 * (n + 2)) * sizeof(char *));
info[2 * n] = strdup(opt);
info[2 * n + 1] = strdup(param);
memset(&info[2 * (n + 1)], 0, 2 * sizeof(char *));
@@ -1323,7 +1318,7 @@ int demux_info_print(demuxer_t *demuxer)
if (!info)
return 0;
- mp_msg(MSGT_DEMUX, MSGL_INFO, MSGTR_ClipInfo);
+ mp_tmsg(MSGT_DEMUX, MSGL_INFO, "Clip info:\n");
for (n = 0; info[2 * n] != NULL; n++) {
mp_msg(MSGT_DEMUX, MSGL_INFO, " %s: %s\n", info[2 * n],
info[2 * n + 1]);
@@ -1447,41 +1442,45 @@ int demuxer_switch_video(demuxer_t *demuxer, int index)
}
int demuxer_add_attachment(demuxer_t *demuxer, const char *name,
- const char *type, const void *data, size_t size)
+ int name_maxlen, const char *type, int type_maxlen,
+ const void *data, size_t size)
{
- if (!(demuxer->num_attachments & 31))
- demuxer->attachments = realloc(demuxer->attachments,
- (demuxer->num_attachments + 32) * sizeof(demux_attachment_t));
-
- demuxer->attachments[demuxer->num_attachments].name = strdup(name);
- demuxer->attachments[demuxer->num_attachments].type = strdup(type);
- demuxer->attachments[demuxer->num_attachments].data = malloc(size);
- memcpy(demuxer->attachments[demuxer->num_attachments].data, data, size);
- demuxer->attachments[demuxer->num_attachments].data_size = size;
+ if (!(demuxer->num_attachments % 32))
+ demuxer->attachments = talloc_realloc(demuxer, demuxer->attachments,
+ struct demux_attachment,
+ demuxer->num_attachments + 32);
+
+ struct demux_attachment *att =
+ demuxer->attachments + demuxer->num_attachments;
+ att->name = talloc_strndup(demuxer->attachments, name, name_maxlen);
+ att->type = talloc_strndup(demuxer->attachments, type, type_maxlen);
+ att->data = talloc_size(demuxer->attachments, size);
+ memcpy(att->data, data, size);
+ att->data_size = size;
return demuxer->num_attachments++;
}
-int demuxer_add_chapter(demuxer_t *demuxer, const char *name, uint64_t start,
- uint64_t end)
+int demuxer_add_chapter(demuxer_t *demuxer, const char *name, int name_maxlen,
+ uint64_t start, uint64_t end)
{
- if (demuxer->chapters == NULL)
- demuxer->chapters = malloc(32 * sizeof(*demuxer->chapters));
- else if (!(demuxer->num_chapters % 32))
- demuxer->chapters = realloc(demuxer->chapters,
- (demuxer->num_chapters + 32) *
- sizeof(*demuxer->chapters));
+ if (!(demuxer->num_chapters % 32))
+ demuxer->chapters = talloc_realloc(demuxer, demuxer->chapters,
+ struct demux_chapter,
+ demuxer->num_chapters + 32);
demuxer->chapters[demuxer->num_chapters].start = start;
demuxer->chapters[demuxer->num_chapters].end = end;
- demuxer->chapters[demuxer->num_chapters].name = strdup(name ? name : MSGTR_Unknown);
+ demuxer->chapters[demuxer->num_chapters].name = name ?
+ talloc_strndup(demuxer->chapters, name, name_maxlen) :
+ talloc_strdup(demuxer->chapters, mp_gtext("unknown"));
mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_CHAPTER_ID=%d\n", demuxer->num_chapters);
mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_CHAPTER_%d_START=%"PRIu64"\n", demuxer->num_chapters, start);
if (end)
mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_CHAPTER_%d_END=%"PRIu64"\n", demuxer->num_chapters, end);
if (name)
- mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_CHAPTER_%d_NAME=%s\n", demuxer->num_chapters, name);
+ mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_CHAPTER_%d_NAME=%.*s\n", demuxer->num_chapters, name_maxlen, name);
return demuxer->num_chapters++;
}
@@ -1491,97 +1490,63 @@ int demuxer_add_chapter(demuxer_t *demuxer, const char *name, uint64_t start,
* either using the demuxer->chapters structure set by the demuxer
* or asking help to the stream layer (e.g. dvd)
* \param chapter - chapter number wished - 0-based
- * \param mode 0: relative to current main pts, 1: absolute
* \param seek_pts set by the function to the pts to seek to (if demuxer->chapters is set)
- * \param num_chapters number of chapters present (set by this function is param is not null)
* \param chapter_name name of chapter found (set by this function is param is not null)
* \return -1 on error, current chapter if successful
*/
-int demuxer_seek_chapter(demuxer_t *demuxer, int chapter, int mode,
- float *seek_pts, int *num_chapters,
+int demuxer_seek_chapter(demuxer_t *demuxer, int chapter, double *seek_pts,
char **chapter_name)
{
int ris;
- int current, total;
+ sh_video_t *sh_video = demuxer->video->sh;
+ sh_audio_t *sh_audio = demuxer->audio->sh;
if (!demuxer->num_chapters || !demuxer->chapters) {
- if (!mode) {
- ris = stream_control(demuxer->stream,
- STREAM_CTRL_GET_CURRENT_CHAPTER, &current);
- if (ris == STREAM_UNSUPPORTED)
- return -1;
- chapter += current;
- }
-
demux_flush(demuxer);
ris = stream_control(demuxer->stream, STREAM_CTRL_SEEK_TO_CHAPTER,
&chapter);
+ if (ris != STREAM_UNSUPPORTED)
+ demux_control(demuxer, DEMUXER_CTRL_RESYNC, NULL);
+ if (sh_video) {
+ ds_fill_buffer(demuxer->video);
+ resync_video_stream(sh_video);
+ }
- demux_resync(demuxer);
-
+ if (sh_audio) {
+ ds_fill_buffer(demuxer->audio);
+ resync_audio_stream(sh_audio);
+ }
// exit status may be ok, but main() doesn't have to seek itself
// (because e.g. dvds depend on sectors, not on pts)
*seek_pts = -1.0;
- if (num_chapters) {
- if (stream_control(demuxer->stream, STREAM_CTRL_GET_NUM_CHAPTERS,
- num_chapters) == STREAM_UNSUPPORTED)
- *num_chapters = 0;
- }
-
if (chapter_name) {
*chapter_name = NULL;
- if (num_chapters && *num_chapters) {
- char *tmp = malloc(16);
- if (tmp) {
- sprintf(tmp, " of %3d", *num_chapters);
- *chapter_name = tmp;
- }
+ int num_chapters;
+ if (stream_control(demuxer->stream, STREAM_CTRL_GET_NUM_CHAPTERS,
+ &num_chapters) == STREAM_UNSUPPORTED)
+ num_chapters = 0;
+ if (num_chapters) {
+ *chapter_name = talloc_size(NULL, 16);
+ sprintf(*chapter_name, " of %3d", num_chapters);
}
}
return ris != STREAM_UNSUPPORTED ? chapter : -1;
} else { // chapters structure is set in the demuxer
- sh_video_t *sh_video = demuxer->video->sh;
- sh_audio_t *sh_audio = demuxer->audio->sh;
-
- total = demuxer->num_chapters;
-
- if (mode == 1) //absolute seeking
- current = chapter;
- else { //relative seeking
- uint64_t now;
- now = (sh_video ? sh_video->pts : (sh_audio ? sh_audio->pts : 0.))
- * 1000 + .5;
-
- for (current = total - 1; current >= 0; --current) {
- demux_chapter_t *chapter = demuxer->chapters + current;
- if (chapter->start <= now)
- break;
- }
- current += chapter;
- }
-
- if (current >= total)
+ if (chapter >= demuxer->num_chapters)
return -1;
- if (current < 0)
- current = 0;
+ if (chapter < 0)
+ chapter = 0;
- *seek_pts = demuxer->chapters[current].start / 1000.0;
+ *seek_pts = demuxer->chapters[chapter].start / 1000.0;
- if (num_chapters)
- *num_chapters = demuxer->num_chapters;
-
- if (chapter_name) {
- if (demuxer->chapters[current].name)
- *chapter_name = strdup(demuxer->chapters[current].name);
- else
- *chapter_name = NULL;
- }
+ if (chapter_name)
+ *chapter_name = talloc_strdup(NULL, demuxer->chapters[chapter].name);
- return current;
+ return chapter;
}
}
@@ -1681,6 +1646,8 @@ int demuxer_get_current_angle(demuxer_t *demuxer)
int demuxer_set_angle(demuxer_t *demuxer, int angle)
{
int ris, angles = -1;
+ sh_video_t *sh_video = demuxer->video->sh;
+ sh_audio_t *sh_audio = demuxer->audio->sh;
angles = demuxer_angles_count(demuxer);
if ((angles < 1) || (angle > angles))
@@ -1692,7 +1659,16 @@ int demuxer_set_angle(demuxer_t *demuxer, int angle)
if (ris == STREAM_UNSUPPORTED)
return -1;
- demux_resync(demuxer);
+ demux_control(demuxer, DEMUXER_CTRL_RESYNC, NULL);
+ if (sh_video) {
+ ds_fill_buffer(demuxer->video);
+ resync_video_stream(sh_video);
+ }
+
+ if (sh_audio) {
+ ds_fill_buffer(demuxer->audio);
+ resync_audio_stream(sh_audio);
+ }
return angle;
}
diff --git a/libmpdemux/demuxer.h b/libmpdemux/demuxer.h
index a9fc58dea8..6aaa7c8b79 100644
--- a/libmpdemux/demuxer.h
+++ b/libmpdemux/demuxer.h
@@ -23,11 +23,11 @@
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
+#include <stdbool.h>
#include "stream/stream.h"
-#ifdef CONFIG_ASS
-#include "libass/ass_mp.h"
-#endif
+
+struct MPOpts;
#ifdef HAVE_BUILTIN_EXPECT
#define likely(x) __builtin_expect ((x) != 0, 1)
@@ -38,7 +38,7 @@
#endif
#define MAX_PACKS 4096
-#define MAX_PACK_BYTES 0x2000000
+#define MAX_PACK_BYTES 0x8000000 // 128 MiB
#define DEMUXER_TYPE_UNKNOWN 0
#define DEMUXER_TYPE_MPEG_ES 1
@@ -114,11 +114,13 @@
#define SEEK_ABSOLUTE (1 << 0)
#define SEEK_FACTOR (1 << 1)
+#define SEEK_FORWARD (1 << 2)
+#define SEEK_BACKWARD (1 << 3)
-#define MP_INPUT_BUFFER_PADDING_SIZE 8
+#define MP_INPUT_BUFFER_PADDING_SIZE 64
// Holds one packet/frame/whatever
-typedef struct demux_packet_st {
+typedef struct demux_packet {
int len;
double pts;
double endpts;
@@ -127,11 +129,11 @@ typedef struct demux_packet_st {
unsigned char* buffer;
int flags; // keyframe, etc
int refcount; //refcounter for the master packet, if 0, buffer can be free()d
- struct demux_packet_st* master; //pointer to the master packet if this one is a cloned one
- struct demux_packet_st* next;
+ struct demux_packet *master; //pointer to the master packet if this one is a cloned one
+ struct demux_packet *next;
} demux_packet_t;
-typedef struct {
+typedef struct demux_stream {
int buffer_pos; // current buffer position
int buffer_size; // current buffer size
unsigned char* buffer; // current buffer, never free() it, always use free_demux_packet(buffer_ref);
@@ -151,7 +153,7 @@ typedef struct {
demux_packet_t *last; // append new packets from input stream to here
demux_packet_t *current;// needed for refcounting of the buffer
int id; // stream ID (for multiple audio/video streams)
- struct demuxer_st *demuxer; // parent demuxer structure (stream handler)
+ struct demuxer *demuxer; // parent demuxer structure (stream handler)
// ---- asf -----
demux_packet_t *asf_packet; // read asf fragments here
int asf_seq;
@@ -161,7 +163,7 @@ typedef struct {
void* sh;
} demux_stream_t;
-typedef struct demuxer_info_st {
+typedef struct demuxer_info {
char *name;
char *author;
char *encoder;
@@ -173,15 +175,12 @@ typedef struct demuxer_info_st {
#define MAX_V_STREAMS 256
#define MAX_S_STREAMS 256
-struct demuxer_st;
-
-extern int correct_pts;
-extern int user_correct_pts;
+struct demuxer;
/**
* Demuxer description structure
*/
-typedef struct demuxers_desc_st {
+typedef struct demuxer_desc {
const char *info; ///< What is it (long name and/or description)
const char *name; ///< Demuxer name, used with -demuxer switch
const char *shortdesc; ///< Description printed at demuxer detection
@@ -192,26 +191,39 @@ typedef struct demuxers_desc_st {
int safe_check; ///< If 1 detection is safe and fast, do it before file extension check
/// Check if can demux the file, return DEMUXER_TYPE_xxx on success
- int (*check_file)(struct demuxer_st *demuxer); ///< Mandatory if safe_check == 1, else optional
+ int (*check_file)(struct demuxer *demuxer); ///< Mandatory if safe_check == 1, else optional
/// Get packets from file, return 0 on eof
- int (*fill_buffer)(struct demuxer_st *demuxer, demux_stream_t *ds); ///< Mandatory
+ int (*fill_buffer)(struct demuxer *demuxer, demux_stream_t *ds); ///< Mandatory
/// Open the demuxer, return demuxer on success, NULL on failure
- struct demuxer_st* (*open)(struct demuxer_st *demuxer); ///< Optional
+ struct demuxer* (*open)(struct demuxer *demuxer); ///< Optional
/// Close the demuxer
- void (*close)(struct demuxer_st *demuxer); ///< Optional
+ void (*close)(struct demuxer *demuxer); ///< Optional
// Seek
- void (*seek)(struct demuxer_st *demuxer, float rel_seek_secs, float audio_delay, int flags); ///< Optional
+ void (*seek)(struct demuxer *demuxer, float rel_seek_secs, float audio_delay, int flags); ///< Optional
// Control
- int (*control)(struct demuxer_st *demuxer, int cmd, void *arg); ///< Optional
+ int (*control)(struct demuxer *demuxer, int cmd, void *arg); ///< Optional
} demuxer_desc_t;
-typedef struct demux_chapter_s
+typedef struct demux_chapter
{
uint64_t start, end;
char* name;
} demux_chapter_t;
-typedef struct demux_attachment_s
+struct matroska_data {
+ unsigned char segment_uid[16];
+ // Ordered chapter information if any
+ struct matroska_chapter {
+ uint64_t start;
+ uint64_t end;
+ bool has_segment_uid;
+ unsigned char segment_uid[16];
+ char *name;
+ } *ordered_chapters;
+ int num_ordered_chapters;
+};
+
+typedef struct demux_attachment
{
char* name;
char* type;
@@ -219,7 +231,7 @@ typedef struct demux_attachment_s
unsigned int data_size;
} demux_attachment_t;
-typedef struct demuxer_st {
+typedef struct demuxer {
const demuxer_desc_t *desc; ///< Demuxer description structure
off_t filepos; // input stream current pos.
off_t movi_start;
@@ -232,15 +244,18 @@ typedef struct demuxer_st {
int type; // demuxer type: mpeg PS, mpeg ES, avi, avi-ni, avi-nini, asf
int file_format; // file format: mpeg/avi/asf
int seekable; // flag
+ /* Set if using absolute seeks for small movements is OK (no pts resets
+ * that would make pts ambigious, preferably supports back/forward flags */
+ bool accurate_seek;
//
demux_stream_t *audio; // audio buffer/demuxer
demux_stream_t *video; // video buffer/demuxer
demux_stream_t *sub; // dvd subtitle buffer/demuxer
// stream headers:
- void* a_streams[MAX_A_STREAMS]; // audio streams (sh_audio_t)
- void* v_streams[MAX_V_STREAMS]; // video sterams (sh_video_t)
- void *s_streams[MAX_S_STREAMS]; // dvd subtitles (flag)
+ struct sh_audio *a_streams[MAX_A_STREAMS];
+ struct sh_video *v_streams[MAX_V_STREAMS];
+ struct sh_sub *s_streams[MAX_S_STREAMS];
// pointer to teletext decoder private data, if demuxer stream contains teletext
void *teletext;
@@ -251,8 +266,11 @@ typedef struct demuxer_st {
demux_attachment_t* attachments;
int num_attachments;
+ struct matroska_data matroska_data;
+
void* priv; // fileformat-dependent data
char** info;
+ struct MPOpts *opts;
} demuxer_t;
typedef struct {
@@ -334,8 +352,8 @@ static inline void *realloc_struct(void *ptr, size_t nmemb, size_t size) {
return realloc(ptr, nmemb * size);
}
-demux_stream_t* new_demuxer_stream(struct demuxer_st *demuxer,int id);
-demuxer_t* new_demuxer(stream_t *stream,int type,int a_id,int v_id,int s_id,char *filename);
+demux_stream_t* new_demuxer_stream(struct demuxer *demuxer,int id);
+demuxer_t* new_demuxer(struct MPOpts *opts, stream_t *stream,int type,int a_id,int v_id,int s_id,char *filename);
void free_demuxer_stream(demux_stream_t *ds);
void free_demuxer(demuxer_t *demuxer);
@@ -400,7 +418,7 @@ static inline int avi_stream_id(unsigned int id){
return a*10+b;
}
-demuxer_t* demux_open(stream_t *stream,int file_format,int aid,int vid,int sid,char* filename);
+demuxer_t* demux_open(struct MPOpts *opts, stream_t *stream,int file_format,int aid,int vid,int sid,char* filename);
void demux_flush(demuxer_t *demuxer);
int demux_seek(demuxer_t *demuxer,float rel_seek_secs,float audio_delay,int flags);
demuxer_t* new_demuxers_demuxer(demuxer_t* vd, demuxer_t* ad, demuxer_t* sd);
@@ -435,11 +453,13 @@ int demuxer_type_by_filename(char* filename);
void demuxer_help(void);
int get_demuxer_type_from_name(char *demuxer_name, int *force);
-int demuxer_add_attachment(demuxer_t* demuxer, const char* name,
- const char* type, const void* data, size_t size);
-
-int demuxer_add_chapter(demuxer_t* demuxer, const char* name, uint64_t start, uint64_t end);
-int demuxer_seek_chapter(demuxer_t *demuxer, int chapter, int mode, float *seek_pts, int *num_chapters, char **chapter_name);
+int demuxer_add_attachment(demuxer_t *demuxer, const char *name,
+ int name_maxlen, const char *type, int type_maxlen,
+ const void *data, size_t size);
+int demuxer_add_chapter(demuxer_t *demuxer, const char *name, int name_maxlen,
+ uint64_t start, uint64_t end);
+int demuxer_seek_chapter(demuxer_t *demuxer, int chapter, double *seek_pts,
+ char **chapter_name);
/// Get current chapter index if available.
int demuxer_get_current_chapter(demuxer_t *demuxer);
diff --git a/libmpdemux/ebml.c b/libmpdemux/ebml.c
index a007bd4ad4..ab35237a44 100644
--- a/libmpdemux/ebml.c
+++ b/libmpdemux/ebml.c
@@ -1,5 +1,6 @@
/*
* native ebml reader for the Matroska demuxer
+ * new parser copyright (c) 2010 Uoti Urpala
* copyright (c) 2004 Aurelien Jacobs <aurel@gnuage.org>
* based on the one written by Ronald Bultje for gstreamer
*
@@ -23,13 +24,18 @@
#include "config.h"
#include <stdlib.h>
-
-#include "stream/stream.h"
+#include <stdbool.h>
+#include <inttypes.h>
+#include <stddef.h>
+#include <assert.h>
+
+#include <libavutil/intfloat_readwrite.h>
+#include <libavutil/common.h>
+#include "talloc.h"
#include "ebml.h"
-#include "libavutil/common.h"
+#include "stream/stream.h"
#include "mpbswap.h"
-#include "libavutil/intfloat_readwrite.h"
-
+#include "mp_msg.h"
#ifndef SIZE_MAX
#define SIZE_MAX ((size_t)-1)
@@ -39,161 +45,151 @@
* Read: the element content data ID.
* Return: the ID.
*/
-uint32_t
-ebml_read_id (stream_t *s, int *length)
+uint32_t ebml_read_id(stream_t *s, int *length)
{
- int i, len_mask = 0x80;
- uint32_t id;
-
- for (i=0, id=stream_read_char (s); i<4 && !(id & len_mask); i++)
- len_mask >>= 1;
- if (i >= 4)
- return EBML_ID_INVALID;
- if (length)
- *length = i + 1;
- while (i--)
- id = (id << 8) | stream_read_char (s);
- return id;
+ int i, len_mask = 0x80;
+ uint32_t id;
+
+ for (i = 0, id = stream_read_char(s); i < 4 && !(id & len_mask); i++)
+ len_mask >>= 1;
+ if (i >= 4)
+ return EBML_ID_INVALID;
+ if (length)
+ *length = i + 1;
+ while (i--)
+ id = (id << 8) | stream_read_char(s);
+ return id;
}
/*
* Read a variable length unsigned int.
*/
-uint64_t
-ebml_read_vlen_uint (uint8_t *buffer, int *length)
+uint64_t ebml_read_vlen_uint(uint8_t *buffer, int *length)
{
- int i, j, num_ffs = 0, len_mask = 0x80;
- uint64_t num;
-
- for (i=0, num=*buffer++; i<8 && !(num & len_mask); i++)
- len_mask >>= 1;
- if (i >= 8)
- return EBML_UINT_INVALID;
- j = i+1;
- if (length)
- *length = j;
- if ((int)(num &= (len_mask - 1)) == len_mask - 1)
- num_ffs++;
- while (i--)
- {
- num = (num << 8) | *buffer++;
- if ((num & 0xFF) == 0xFF)
+ int i, j, num_ffs = 0, len_mask = 0x80;
+ uint64_t num;
+
+ for (i = 0, num = *buffer++; i < 8 && !(num & len_mask); i++)
+ len_mask >>= 1;
+ if (i >= 8)
+ return EBML_UINT_INVALID;
+ j = i + 1;
+ if (length)
+ *length = j;
+ if ((int) (num &= (len_mask - 1)) == len_mask - 1)
num_ffs++;
+ while (i--) {
+ num = (num << 8) | *buffer++;
+ if ((num & 0xFF) == 0xFF)
+ num_ffs++;
}
- if (j == num_ffs)
- return EBML_UINT_INVALID;
- return num;
+ if (j == num_ffs)
+ return EBML_UINT_INVALID;
+ return num;
}
/*
* Read a variable length signed int.
*/
-int64_t
-ebml_read_vlen_int (uint8_t *buffer, int *length)
+int64_t ebml_read_vlen_int(uint8_t *buffer, int *length)
{
- uint64_t unum;
- int l;
+ uint64_t unum;
+ int l;
- /* read as unsigned number first */
- unum = ebml_read_vlen_uint (buffer, &l);
- if (unum == EBML_UINT_INVALID)
- return EBML_INT_INVALID;
- if (length)
- *length = l;
+ /* read as unsigned number first */
+ unum = ebml_read_vlen_uint(buffer, &l);
+ if (unum == EBML_UINT_INVALID)
+ return EBML_INT_INVALID;
+ if (length)
+ *length = l;
- return unum - ((1 << ((7 * l) - 1)) - 1);
+ return unum - ((1 << ((7 * l) - 1)) - 1);
}
/*
* Read: element content length.
*/
-uint64_t
-ebml_read_length (stream_t *s, int *length)
+uint64_t ebml_read_length(stream_t *s, int *length)
{
- int i, j, num_ffs = 0, len_mask = 0x80;
- uint64_t len;
-
- for (i=0, len=stream_read_char (s); i<8 && !(len & len_mask); i++)
- len_mask >>= 1;
- if (i >= 8)
- return EBML_UINT_INVALID;
- j = i+1;
- if (length)
- *length = j;
- if ((int)(len &= (len_mask - 1)) == len_mask - 1)
- num_ffs++;
- while (i--)
- {
- len = (len << 8) | stream_read_char (s);
- if ((len & 0xFF) == 0xFF)
+ int i, j, num_ffs = 0, len_mask = 0x80;
+ uint64_t len;
+
+ for (i = 0, len = stream_read_char(s); i < 8 && !(len & len_mask); i++)
+ len_mask >>= 1;
+ if (i >= 8)
+ return EBML_UINT_INVALID;
+ j = i + 1;
+ if (length)
+ *length = j;
+ if ((int) (len &= (len_mask - 1)) == len_mask - 1)
num_ffs++;
+ while (i--) {
+ len = (len << 8) | stream_read_char(s);
+ if ((len & 0xFF) == 0xFF)
+ num_ffs++;
}
- if (j == num_ffs)
- return EBML_UINT_INVALID;
- return len;
+ if (j == num_ffs)
+ return EBML_UINT_INVALID;
+ return len;
}
/*
* Read the next element as an unsigned int.
*/
-uint64_t
-ebml_read_uint (stream_t *s, uint64_t *length)
+uint64_t ebml_read_uint(stream_t *s, uint64_t *length)
{
- uint64_t len, value = 0;
- int l;
+ uint64_t len, value = 0;
+ int l;
- len = ebml_read_length (s, &l);
- if (len == EBML_UINT_INVALID || len < 1 || len > 8)
- return EBML_UINT_INVALID;
- if (length)
- *length = len + l;
+ len = ebml_read_length(s, &l);
+ if (len == EBML_UINT_INVALID || len < 1 || len > 8)
+ return EBML_UINT_INVALID;
+ if (length)
+ *length = len + l;
- while (len--)
- value = (value << 8) | stream_read_char (s);
+ while (len--)
+ value = (value << 8) | stream_read_char(s);
- return value;
+ return value;
}
/*
* Read the next element as a signed int.
*/
-int64_t
-ebml_read_int (stream_t *s, uint64_t *length)
+int64_t ebml_read_int(stream_t *s, uint64_t *length)
{
- int64_t value = 0;
- uint64_t len;
- int l;
-
- len = ebml_read_length (s, &l);
- if (len == EBML_UINT_INVALID || len < 1 || len > 8)
- return EBML_INT_INVALID;
- if (length)
- *length = len + l;
-
- len--;
- l = stream_read_char (s);
- if (l & 0x80)
- value = -1;
- value = (value << 8) | l;
- while (len--)
- value = (value << 8) | stream_read_char (s);
-
- return value;
+ int64_t value = 0;
+ uint64_t len;
+ int l;
+
+ len = ebml_read_length(s, &l);
+ if (len == EBML_UINT_INVALID || len < 1 || len > 8)
+ return EBML_INT_INVALID;
+ if (length)
+ *length = len + l;
+
+ len--;
+ l = stream_read_char(s);
+ if (l & 0x80)
+ value = -1;
+ value = (value << 8) | l;
+ while (len--)
+ value = (value << 8) | stream_read_char(s);
+
+ return value;
}
/*
* Read the next element as a float.
*/
-long double
-ebml_read_float (stream_t *s, uint64_t *length)
+double ebml_read_float(stream_t *s, uint64_t *length)
{
- long double value;
- uint64_t len;
- int l;
+ double value;
+ uint64_t len;
+ int l;
- len = ebml_read_length (s, &l);
- switch (len)
- {
+ len = ebml_read_length(s, &l);
+ switch (len) {
case 4:
value = av_int2flt(stream_read_dword(s));
break;
@@ -203,168 +199,470 @@ ebml_read_float (stream_t *s, uint64_t *length)
break;
default:
- return EBML_FLOAT_INVALID;
+ return EBML_FLOAT_INVALID;
}
- if (length)
- *length = len + l;
+ if (length)
+ *length = len + l;
- return value;
+ return value;
}
/*
* Read the next element as an ASCII string.
*/
-char *
-ebml_read_ascii (stream_t *s, uint64_t *length)
+char *ebml_read_ascii(stream_t *s, uint64_t *length)
{
- uint64_t len;
- char *str;
- int l;
-
- len = ebml_read_length (s, &l);
- if (len == EBML_UINT_INVALID)
- return NULL;
- if (len > SIZE_MAX - 1)
- return NULL;
- if (length)
- *length = len + l;
-
- str = (char *) malloc (len+1);
- if (stream_read(s, str, len) != (int) len)
- {
- free (str);
- return NULL;
+ uint64_t len;
+ char *str;
+ int l;
+
+ len = ebml_read_length(s, &l);
+ if (len == EBML_UINT_INVALID)
+ return NULL;
+ if (len > SIZE_MAX - 1)
+ return NULL;
+ if (length)
+ *length = len + l;
+
+ str = (char *) malloc(len + 1);
+ if (stream_read(s, str, len) != (int) len) {
+ free(str);
+ return NULL;
}
- str[len] = '\0';
+ str[len] = '\0';
- return str;
+ return str;
}
/*
* Read the next element as a UTF-8 string.
*/
-char *
-ebml_read_utf8 (stream_t *s, uint64_t *length)
+char *ebml_read_utf8(stream_t *s, uint64_t *length)
{
- return ebml_read_ascii (s, length);
+ return ebml_read_ascii(s, length);
}
/*
* Skip the next element.
*/
-int
-ebml_read_skip (stream_t *s, uint64_t *length)
+int ebml_read_skip(stream_t *s, uint64_t *length)
{
- uint64_t len;
- int l;
+ uint64_t len;
+ int l;
- len = ebml_read_length (s, &l);
- if (len == EBML_UINT_INVALID)
- return 1;
- if (length)
- *length = len + l;
+ len = ebml_read_length(s, &l);
+ if (len == EBML_UINT_INVALID)
+ return 1;
+ if (length)
+ *length = len + l;
- stream_skip(s, len);
+ stream_skip(s, len);
- return 0;
+ return 0;
}
/*
* Read the next element, but only the header. The contents
* are supposed to be sub-elements which can be read separately.
*/
-uint32_t
-ebml_read_master (stream_t *s, uint64_t *length)
+uint32_t ebml_read_master(stream_t *s, uint64_t *length)
{
- uint64_t len;
- uint32_t id;
+ uint64_t len;
+ uint32_t id;
+
+ id = ebml_read_id(s, NULL);
+ if (id == EBML_ID_INVALID)
+ return id;
+
+ len = ebml_read_length(s, NULL);
+ if (len == EBML_UINT_INVALID)
+ return EBML_ID_INVALID;
+ if (length)
+ *length = len;
- id = ebml_read_id (s, NULL);
- if (id == EBML_ID_INVALID)
return id;
+}
+
+
- len = ebml_read_length (s, NULL);
- if (len == EBML_UINT_INVALID)
- return EBML_ID_INVALID;
- if (length)
+#define EVALARGS(F, ...) F(__VA_ARGS__)
+#define E(str, N, type) const struct ebml_elem_desc ebml_ ## N ## _desc = { str, type };
+#define E_SN(str, count, N) const struct ebml_elem_desc ebml_ ## N ## _desc = { str, EBML_TYPE_SUBELEMENTS, sizeof(struct ebml_ ## N), count, (const struct ebml_field_desc[]){
+#define E_S(str, count) EVALARGS(E_SN, str, count, N)
+#define FN(id, name, multiple, N) { id, multiple, offsetof(struct ebml_ ## N, name), offsetof(struct ebml_ ## N, n_ ## name), &ebml_##name##_desc},
+#define F(id, name, multiple) EVALARGS(FN, id, name, multiple, N)
+#include "ebml_defs.c"
+#undef EVALARGS
+#undef SN
+#undef S
+#undef FN
+#undef F
+
+// Used to read/write pointers to different struct types
+struct generic;
+#define generic_struct struct generic
+
+static uint32_t ebml_parse_id(uint8_t *data, int *length)
+{
+ int len = 1;
+ uint32_t id = *data++;
+ for (int len_mask = 0x80; !(id & len_mask); len_mask >>= 1) {
+ len++;
+ if (len > 4) {
+ *length = -1;
+ return EBML_ID_INVALID;
+ }
+ }
*length = len;
+ while (--len)
+ id = (id << 8) | *data++;
+ return id;
+}
- return id;
+static uint64_t parse_vlen(uint8_t *data, int *length, bool is_length)
+{
+ uint64_t r = *data++;
+ int len = 1;
+ int len_mask;
+ for (len_mask = 0x80; !(r & len_mask); len_mask >>= 1) {
+ len++;
+ if (len > 8) {
+ *length = -1;
+ return -1;
+ }
+ }
+ r &= len_mask - 1;
+
+ int num_allones = 0;
+ if (r == len_mask - 1)
+ num_allones++;
+ for (int i = 1; i < len; i++) {
+ if (*data == 255)
+ num_allones++;
+ r = (r << 8) | *data++;
+ }
+ if (is_length && num_allones == len) {
+ // According to Matroska specs this means "unknown length"
+ // Could be supported if there are any actual files using it
+ *length = -1;
+ return -1;
+ }
+ *length = len;
+ return r;
}
+static uint64_t ebml_parse_length(uint8_t *data, int *length)
+{
+ return parse_vlen(data, length, true);
+}
-/*
- * Read an EBML header.
- */
-char *
-ebml_read_header (stream_t *s, int *version)
+static uint64_t ebml_parse_uint(uint8_t *data, int length)
{
- uint64_t length, l, num;
- uint32_t id;
- char *str = NULL;
+ assert(length >= 1 && length <= 8);
+ uint64_t r = 0;
+ while (length--)
+ r = (r << 8) + *data++;
+ return r;
+}
- if (ebml_read_master (s, &length) != EBML_ID_HEADER)
- return 0;
+static int64_t ebml_parse_sint(uint8_t *data, int length)
+{
+ assert(length >=1 && length <= 8);
+ int64_t r = 0;
+ if (*data & 0x80)
+ r = -1;
+ while (length--)
+ r = (r << 8) | *data++;
+ return r;
+}
- if (version)
- *version = 1;
+static double ebml_parse_float(uint8_t *data, int length)
+{
+ assert(length == 4 || length == 8);
+ uint64_t i = ebml_parse_uint(data, length);
+ if (length == 4)
+ return av_int2flt(i);
+ else
+ return av_int2dbl(i);
+}
- while (length > 0)
- {
- id = ebml_read_id (s, NULL);
- if (id == EBML_ID_INVALID)
- return NULL;
- length -= 2;
-
- switch (id)
- {
- /* is our read version uptodate? */
- case EBML_ID_EBMLREADVERSION:
- num = ebml_read_uint (s, &l);
- if (num != EBML_VERSION)
- return NULL;
- break;
-
- /* we only handle 8 byte lengths at max */
- case EBML_ID_EBMLMAXSIZELENGTH:
- num = ebml_read_uint (s, &l);
- if (num != sizeof (uint64_t))
- return NULL;
- break;
-
- /* we handle 4 byte IDs at max */
- case EBML_ID_EBMLMAXIDLENGTH:
- num = ebml_read_uint (s, &l);
- if (num != sizeof (uint32_t))
- return NULL;
- break;
-
- case EBML_ID_DOCTYPE:
- str = ebml_read_ascii (s, &l);
- if (str == NULL)
- return NULL;
- break;
-
- case EBML_ID_DOCTYPEREADVERSION:
- num = ebml_read_uint (s, &l);
- if (num == EBML_UINT_INVALID)
- return NULL;
- if (version)
- *version = num;
- break;
-
- /* we ignore these two, they don't tell us anything we care about */
- case EBML_ID_VOID:
- case EBML_ID_EBMLVERSION:
- case EBML_ID_DOCTYPEVERSION:
+
+// target must be initialized to zero
+static void ebml_parse_element(struct ebml_parse_ctx *ctx, void *target,
+ uint8_t *data, int size,
+ const struct ebml_elem_desc *type, int level)
+{
+ assert(type->type == EBML_TYPE_SUBELEMENTS);
+ assert(level < 8);
+ mp_msg(MSGT_DEMUX, MSGL_DBG2, "%.*s[mkv] Parsing element %s\n",
+ level, " ", type->name);
+
+ char *s = target;
+ int len;
+ uint8_t *end = data + size;
+ uint8_t *p = data;
+ int num_elems[MAX_EBML_SUBELEMENTS] = {};
+ while (p < end) {
+ uint8_t *startp = p;
+ uint32_t id = ebml_parse_id(p, &len);
+ if (len > end - p)
+ goto past_end_error;
+ if (len < 0) {
+ mp_msg(MSGT_DEMUX, MSGL_DBG2, "[mkv] Error parsing subelement "
+ "id\n");
+ goto other_error;
+ }
+ p += len;
+ uint64_t length = ebml_parse_length(p, &len);
+ if (len > end - p)
+ goto past_end_error;
+ if (len < 0) {
+ mp_msg(MSGT_DEMUX, MSGL_DBG2, "[mkv] Error parsing subelement "
+ "length\n");
+ goto other_error;
+ }
+ p += len;
+
+ int field_idx = -1;
+ for (int i = 0; i < type->field_count; i++)
+ if (type->fields[i].id == id) {
+ field_idx = i;
+ num_elems[i]++;
+ break;
+ }
+
+ if (length > end - p) {
+ if (field_idx >= 0 && type->fields[field_idx].desc->type
+ != EBML_TYPE_SUBELEMENTS) {
+ mp_msg(MSGT_DEMUX, MSGL_DBG2, "[mkv] Subelement content goes "
+ "past end of containing element\n");
+ goto other_error;
+ }
+ // Try to parse what is possible from inside this partial element
+ ctx->has_errors = true;
+ length = end - p;
+ }
+ p += length;
+
+ continue;
+
+ past_end_error:
+ mp_msg(MSGT_DEMUX, MSGL_DBG2, "[mkv] Subelement headers go "
+ "past end of containing element\n");
+ other_error:
+ ctx->has_errors = true;
+ end = startp;
+ break;
+ }
+
+ for (int i = 0; i < type->field_count; i++)
+ if (num_elems[i] && type->fields[i].multiple) {
+ char *ptr = s + type->fields[i].offset;
+ switch (type->fields[i].desc->type) {
+ case EBML_TYPE_SUBELEMENTS:
+ num_elems[i] = FFMIN(num_elems[i],
+ 1000000000 / type->fields[i].desc->size);
+ int size = num_elems[i] * type->fields[i].desc->size;
+ *(generic_struct **) ptr = talloc_zero_size(ctx->talloc_ctx,
+ size);
+ break;
+ case EBML_TYPE_UINT:
+ *(uint64_t **) ptr = talloc_zero_array(ctx->talloc_ctx,
+ uint64_t, num_elems[i]);
+ break;
+ case EBML_TYPE_SINT:
+ *(int64_t **) ptr = talloc_zero_array(ctx->talloc_ctx,
+ int64_t, num_elems[i]);
+ break;
+ case EBML_TYPE_FLOAT:
+ *(double **) ptr = talloc_zero_array(ctx->talloc_ctx,
+ double, num_elems[i]);
+ break;
+ case EBML_TYPE_STR:
+ case EBML_TYPE_BINARY:
+ *(struct bstr **) ptr = talloc_zero_array(ctx->talloc_ctx,
+ struct bstr,
+ num_elems[i]);
+ break;
+ case EBML_TYPE_EBML_ID:
+ *(int32_t **) ptr = talloc_zero_array(ctx->talloc_ctx,
+ uint32_t, num_elems[i]);
+ break;
+ default:
+ abort();
+ }
+ }
+
+ while (data < end) {
+ int len;
+ uint32_t id = ebml_parse_id(data, &len);
+ assert(len >= 0 && len <= end - data);
+ data += len;
+ uint64_t length = ebml_parse_length(data, &len);
+ assert(len >= 0 && len <= end - data);
+ data += len;
+ if (length > end - data) {
+ // Try to parse what is possible from inside this partial element
+ length = end - data;
+ mp_msg(MSGT_DEMUX, MSGL_DBG2, "[mkv] Next subelement content goes "
+ "past end of containing element, will be truncated\n");
+ }
+ int field_idx = -1;
+ for (int i = 0; i < type->field_count; i++)
+ if (type->fields[i].id == id) {
+ field_idx = i;
+ break;
+ }
+ if (field_idx < 0) {
+ if (id == 0xec)
+ mp_msg(MSGT_DEMUX, MSGL_DBG2, "%.*s[mkv] Ignoring Void element "
+ "size: %"PRIu64"\n", level+1, " ", length);
+ else if (id == 0xbf)
+ mp_msg(MSGT_DEMUX, MSGL_DBG2, "%.*s[mkv] Ignoring CRC-32 "
+ "element size: %"PRIu64"\n", level+1, " ",
+ length);
+ else
+ mp_msg(MSGT_DEMUX, MSGL_DBG2, "[mkv] Ignoring unrecognized "
+ "subelement. ID: %x size: %"PRIu64"\n", id, length);
+ data += length;
+ continue;
+ }
+ const struct ebml_field_desc *fd = &type->fields[field_idx];
+ const struct ebml_elem_desc *ed = fd->desc;
+ bool multiple = fd->multiple;
+ int *countptr = (int *) (s + fd->count_offset);
+ if (*countptr >= num_elems[field_idx]) {
+ // Shouldn't happen with on any sane file without bugs
+ mp_msg(MSGT_DEMUX, MSGL_ERR, "[mkv] Too many subelems?\n");
+ ctx->has_errors = true;
+ data += length;
+ continue;
+ }
+ if (*countptr > 0 && !multiple) {
+ mp_msg(MSGT_DEMUX, MSGL_DBG2, "[mkv] Another subelement of type "
+ "%x %s (size: %"PRIu64"). Only one allowed. Ignoring.\n",
+ id, ed->name, length);
+ ctx->has_errors = true;
+ data += length;
+ continue;
+ }
+ mp_msg(MSGT_DEMUX, MSGL_DBG2, "%.*s[mkv] Parsing %x %s size: %"PRIu64
+ " value: ", level+1, " ", id, ed->name, length);
+
+ char *fieldptr = s + fd->offset;
+ switch (ed->type) {
+ case EBML_TYPE_SUBELEMENTS:
+ mp_msg(MSGT_DEMUX, MSGL_DBG2, "subelements\n");
+ char *subelptr;
+ if (multiple) {
+ char *array_start = (char *) *(generic_struct **) fieldptr;
+ subelptr = array_start + *countptr * ed->size;
+ } else
+ subelptr = fieldptr;
+ ebml_parse_element(ctx, subelptr, data, length, ed, level + 1);
+ break;
+
+ case EBML_TYPE_UINT:;
+ uint64_t *uintptr;
+#define GETPTR(subelptr, fieldtype) \
+ if (multiple) \
+ subelptr = *(fieldtype **) fieldptr + *countptr; \
+ else \
+ subelptr = (fieldtype *) fieldptr
+ GETPTR(uintptr, uint64_t);
+ if (length < 1 || length > 8) {
+ mp_msg(MSGT_DEMUX, MSGL_DBG2, "uint invalid length %"PRIu64
+ "\n", length);
+ goto error;
+ }
+ *uintptr = ebml_parse_uint(data, length);
+ mp_msg(MSGT_DEMUX, MSGL_DBG2, "uint %"PRIu64"\n", *uintptr);
+ break;
+
+ case EBML_TYPE_SINT:;
+ int64_t *sintptr;
+ GETPTR(sintptr, int64_t);
+ if (length < 1 || length > 8) {
+ mp_msg(MSGT_DEMUX, MSGL_DBG2, "sint invalid length %"PRIu64
+ "\n", length);
+ goto error;
+ }
+ *sintptr = ebml_parse_sint(data, length);
+ mp_msg(MSGT_DEMUX, MSGL_DBG2, "sint %"PRId64"\n", *sintptr);
+ break;
+
+ case EBML_TYPE_FLOAT:;
+ double *floatptr;
+ GETPTR(floatptr, double);
+ if (length != 4 && length != 8) {
+ mp_msg(MSGT_DEMUX, MSGL_DBG2, "float invalid length %"PRIu64
+ "\n", length);
+ goto error;
+ }
+ *floatptr = ebml_parse_float(data, length);
+ mp_msg(MSGT_DEMUX, MSGL_DBG2, "float %f\n", *floatptr);
+ break;
+
+ case EBML_TYPE_STR:
+ case EBML_TYPE_BINARY:;
+ struct bstr *strptr;
+ GETPTR(strptr, struct bstr);
+ strptr->start = data;
+ strptr->len = length;
+ if (ed->type == EBML_TYPE_STR)
+ mp_msg(MSGT_DEMUX, MSGL_DBG2, "string \"%.*s\"\n",
+ strptr->len, strptr->start);
+ else
+ mp_msg(MSGT_DEMUX, MSGL_DBG2, "binary %d bytes\n",
+ strptr->len);
+ break;
+
+ case EBML_TYPE_EBML_ID:;
+ uint32_t *idptr;
+ GETPTR(idptr, uint32_t);
+ *idptr = ebml_parse_id(data, &len);
+ if (len != length) {
+ mp_msg(MSGT_DEMUX, MSGL_DBG2, "ebml_id broken value\n");
+ goto error;
+ }
+ mp_msg(MSGT_DEMUX, MSGL_DBG2, "ebml_id %x\n", (unsigned)*idptr);
+ break;
default:
- if (ebml_read_skip (s, &l))
- return NULL;
- break;
+ abort();
}
- length -= l;
+ *countptr += 1;
+ error:
+ data += length;
}
+}
- return str;
+// target must be initialized to zero
+int ebml_read_element(struct stream *s, struct ebml_parse_ctx *ctx,
+ void *target, const struct ebml_elem_desc *desc)
+{
+ ctx->has_errors = false;
+ int msglevel = ctx->no_error_messages ? MSGL_DBG2 : MSGL_WARN;
+ uint64_t length = ebml_read_length(s, &ctx->bytes_read);
+ if (s->eof) {
+ mp_msg(MSGT_DEMUX, msglevel, "[mkv] Unexpected end of file "
+ "- partial or corrupt file?\n");
+ return -1;
+ }
+ if (length > 1000000000) {
+ mp_msg(MSGT_DEMUX, msglevel, "[mkv] Refusing to read element over "
+ "100 MB in size\n");
+ return -1;
+ }
+ ctx->talloc_ctx = talloc_size(NULL, length + 8);
+ int read_len = stream_read(s, ctx->talloc_ctx, length);
+ ctx->bytes_read += read_len;
+ if (read_len < length)
+ mp_msg(MSGT_DEMUX, msglevel, "[mkv] Unexpected end of file "
+ "- partial or corrupt file?\n");
+ ebml_parse_element(ctx, target, ctx->talloc_ctx, read_len, desc, 0);
+ if (ctx->has_errors)
+ mp_msg(MSGT_DEMUX, msglevel, "[mkv] Error parsing element %s\n",
+ desc->name);
+ return 0;
}
diff --git a/libmpdemux/ebml.h b/libmpdemux/ebml.h
index fb44faa43c..b2fed46fb9 100644
--- a/libmpdemux/ebml.h
+++ b/libmpdemux/ebml.h
@@ -20,152 +20,57 @@
#define MPLAYER_EBML_H
#include <inttypes.h>
+#include <stddef.h>
+#include <stdbool.h>
+
#include "stream/stream.h"
/* EBML version supported */
#define EBML_VERSION 1
-/*
- * EBML element IDs. max. 32-bit.
- */
-
-/* top-level master-IDs */
-#define EBML_ID_HEADER 0x1A45DFA3
-
-/* IDs in the HEADER master */
-#define EBML_ID_EBMLVERSION 0x4286
-#define EBML_ID_EBMLREADVERSION 0x42F7
-#define EBML_ID_EBMLMAXIDLENGTH 0x42F2
-#define EBML_ID_EBMLMAXSIZELENGTH 0x42F3
-#define EBML_ID_DOCTYPE 0x4282
-#define EBML_ID_DOCTYPEVERSION 0x4287
-#define EBML_ID_DOCTYPEREADVERSION 0x4285
-
-/* general EBML types */
-#define EBML_ID_VOID 0xEC
+enum ebml_elemtype {
+ EBML_TYPE_SUBELEMENTS,
+ EBML_TYPE_UINT,
+ EBML_TYPE_SINT,
+ EBML_TYPE_FLOAT,
+ EBML_TYPE_STR,
+ EBML_TYPE_BINARY,
+ EBML_TYPE_EBML_ID,
+};
+
+struct ebml_field_desc {
+ uint32_t id;
+ bool multiple;
+ int offset;
+ int count_offset;
+ const struct ebml_elem_desc *desc;
+};
+
+struct ebml_elem_desc {
+ char *name;
+ enum ebml_elemtype type;
+ int size;
+ int field_count;
+ const struct ebml_field_desc *fields;
+};
+
+struct ebml_parse_ctx {
+ void *talloc_ctx;
+ int bytes_read;
+ bool has_errors;
+ bool no_error_messages;
+};
+
+struct bstr {
+ uint8_t *start;
+ int len;
+};
+
+#include "ebml_types.h"
+
+#define EBML_ID_INVALID 0xffffffff
-/* ID returned in error cases */
-#define EBML_ID_INVALID 0xFFFFFFFF
-
-
-/*
- * Matroska element IDs. max. 32-bit.
- */
-
-/* toplevel segment */
-#define MATROSKA_ID_SEGMENT 0x18538067
-
-/* matroska top-level master IDs */
-#define MATROSKA_ID_INFO 0x1549A966
-#define MATROSKA_ID_TRACKS 0x1654AE6B
-#define MATROSKA_ID_CUES 0x1C53BB6B
-#define MATROSKA_ID_TAGS 0x1254C367
-#define MATROSKA_ID_SEEKHEAD 0x114D9B74
-#define MATROSKA_ID_ATTACHMENTS 0x1941A469
-#define MATROSKA_ID_CHAPTERS 0x1043A770
-#define MATROSKA_ID_CLUSTER 0x1F43B675
-
-/* IDs in the info master */
-#define MATROSKA_ID_TIMECODESCALE 0x2AD7B1
-#define MATROSKA_ID_DURATION 0x4489
-#define MATROSKA_ID_WRITINGAPP 0x5741
-#define MATROSKA_ID_MUXINGAPP 0x4D80
-#define MATROSKA_ID_DATEUTC 0x4461
-
-/* ID in the tracks master */
-#define MATROSKA_ID_TRACKENTRY 0xAE
-
-/* IDs in the trackentry master */
-#define MATROSKA_ID_TRACKNUMBER 0xD7
-#define MATROSKA_ID_TRACKUID 0x73C5
-#define MATROSKA_ID_TRACKTYPE 0x83
-#define MATROSKA_ID_TRACKAUDIO 0xE1
-#define MATROSKA_ID_TRACKVIDEO 0xE0
-#define MATROSKA_ID_CODECID 0x86
-#define MATROSKA_ID_CODECPRIVATE 0x63A2
-#define MATROSKA_ID_CODECNAME 0x258688
-#define MATROSKA_ID_CODECINFOURL 0x3B4040
-#define MATROSKA_ID_CODECDOWNLOADURL 0x26B240
-#define MATROSKA_ID_TRACKNAME 0x536E
-#define MATROSKA_ID_TRACKLANGUAGE 0x22B59C
-#define MATROSKA_ID_TRACKFLAGENABLED 0xB9
-#define MATROSKA_ID_TRACKFLAGDEFAULT 0x88
-#define MATROSKA_ID_TRACKFLAGLACING 0x9C
-#define MATROSKA_ID_TRACKMINCACHE 0x6DE7
-#define MATROSKA_ID_TRACKMAXCACHE 0x6DF8
-#define MATROSKA_ID_TRACKDEFAULTDURATION 0x23E383
-#define MATROSKA_ID_TRACKENCODINGS 0x6D80
-
-/* IDs in the trackaudio master */
-#define MATROSKA_ID_AUDIOSAMPLINGFREQ 0xB5
-#define MATROSKA_ID_AUDIOBITDEPTH 0x6264
-#define MATROSKA_ID_AUDIOCHANNELS 0x9F
-
-/* IDs in the trackvideo master */
-#define MATROSKA_ID_VIDEOFRAMERATE 0x2383E3
-#define MATROSKA_ID_VIDEODISPLAYWIDTH 0x54B0
-#define MATROSKA_ID_VIDEODISPLAYHEIGHT 0x54BA
-#define MATROSKA_ID_VIDEOPIXELWIDTH 0xB0
-#define MATROSKA_ID_VIDEOPIXELHEIGHT 0xBA
-#define MATROSKA_ID_VIDEOFLAGINTERLACED 0x9A
-#define MATROSKA_ID_VIDEOSTEREOMODE 0x53B9
-#define MATROSKA_ID_VIDEODISPLAYUNIT 0x54B2
-#define MATROSKA_ID_VIDEOASPECTRATIO 0x54B3
-#define MATROSKA_ID_VIDEOCOLOURSPACE 0x2EB524
-#define MATROSKA_ID_VIDEOGAMMA 0x2FB523
-
-/* IDs in the trackencodings master */
-#define MATROSKA_ID_CONTENTENCODING 0x6240
-#define MATROSKA_ID_CONTENTENCODINGORDER 0x5031
-#define MATROSKA_ID_CONTENTENCODINGSCOPE 0x5032
-#define MATROSKA_ID_CONTENTENCODINGTYPE 0x5033
-#define MATROSKA_ID_CONTENTCOMPRESSION 0x5034
-#define MATROSKA_ID_CONTENTCOMPALGO 0x4254
-#define MATROSKA_ID_CONTENTCOMPSETTINGS 0x4255
-
-/* ID in the cues master */
-#define MATROSKA_ID_POINTENTRY 0xBB
-
-/* IDs in the pointentry master */
-#define MATROSKA_ID_CUETIME 0xB3
-#define MATROSKA_ID_CUETRACKPOSITION 0xB7
-
-/* IDs in the cuetrackposition master */
-#define MATROSKA_ID_CUETRACK 0xF7
-#define MATROSKA_ID_CUECLUSTERPOSITION 0xF1
-
-/* IDs in the seekhead master */
-#define MATROSKA_ID_SEEKENTRY 0x4DBB
-
-/* IDs in the seekpoint master */
-#define MATROSKA_ID_SEEKID 0x53AB
-#define MATROSKA_ID_SEEKPOSITION 0x53AC
-
-/* IDs in the chapters master */
-#define MATROSKA_ID_EDITIONENTRY 0x45B9
-#define MATROSKA_ID_CHAPTERATOM 0xB6
-#define MATROSKA_ID_CHAPTERTIMESTART 0x91
-#define MATROSKA_ID_CHAPTERTIMEEND 0x92
-#define MATROSKA_ID_CHAPTERDISPLAY 0x80
-#define MATROSKA_ID_CHAPSTRING 0x85
-
-/* IDs in the cluster master */
-#define MATROSKA_ID_CLUSTERTIMECODE 0xE7
-#define MATROSKA_ID_BLOCKGROUP 0xA0
-
-/* IDs in the blockgroup master */
-#define MATROSKA_ID_BLOCKDURATION 0x9B
-#define MATROSKA_ID_BLOCK 0xA1
-#define MATROSKA_ID_SIMPLEBLOCK 0xA3
-#define MATROSKA_ID_REFERENCEBLOCK 0xFB
-
-/* IDs in the attachments master */
-#define MATROSKA_ID_ATTACHEDFILE 0x61A7
-#define MATROSKA_ID_FILENAME 0x466E
-#define MATROSKA_ID_FILEMIMETYPE 0x4660
-#define MATROSKA_ID_FILEDATA 0x465C
-#define MATROSKA_ID_FILEUID 0x46AE
/* matroska track types */
#define MATROSKA_TRACK_VIDEO 0x01 /* rectangle-shaped pictures aka video */
@@ -200,11 +105,13 @@ int64_t ebml_read_vlen_int (uint8_t *buffer, int *length);
uint64_t ebml_read_length (stream_t *s, int *length);
uint64_t ebml_read_uint (stream_t *s, uint64_t *length);
int64_t ebml_read_int (stream_t *s, uint64_t *length);
-long double ebml_read_float (stream_t *s, uint64_t *length);
+double ebml_read_float (stream_t *s, uint64_t *length);
char *ebml_read_ascii (stream_t *s, uint64_t *length);
char *ebml_read_utf8 (stream_t *s, uint64_t *length);
int ebml_read_skip (stream_t *s, uint64_t *length);
uint32_t ebml_read_master (stream_t *s, uint64_t *length);
-char *ebml_read_header (stream_t *s, int *version);
+
+int ebml_read_element(struct stream *s, struct ebml_parse_ctx *ctx,
+ void *target, const struct ebml_elem_desc *desc);
#endif /* MPLAYER_EBML_H */
diff --git a/libmpdemux/ebml_defs.c b/libmpdemux/ebml_defs.c
new file mode 100644
index 0000000000..f0296a3d62
--- /dev/null
+++ b/libmpdemux/ebml_defs.c
@@ -0,0 +1,382 @@
+// Generated by TOOLS/matroska.py, do not edit manually
+
+
+E("TargetTypeValue", target_type_value, EBML_TYPE_UINT)
+
+#define N targets
+E_S("Targets", 1)
+F(MATROSKA_ID_TARGETTYPEVALUE, target_type_value, 0)
+}};
+#undef N
+
+#define N tag
+E_S("Tag", 1)
+F(MATROSKA_ID_TARGETS, targets, 0)
+}};
+#undef N
+
+#define N tags
+E_S("Tags", 1)
+F(MATROSKA_ID_TAG, tag, 1)
+}};
+#undef N
+
+E("ChapLanguage", chap_language, EBML_TYPE_STR)
+
+E("ChapString", chap_string, EBML_TYPE_STR)
+
+#define N chapter_display
+E_S("ChapterDisplay", 2)
+F(MATROSKA_ID_CHAPSTRING, chap_string, 0)
+F(MATROSKA_ID_CHAPLANGUAGE, chap_language, 1)
+}};
+#undef N
+
+E("ChapterSegmentEditionUID", chapter_segment_edition_uid, EBML_TYPE_UINT)
+
+E("ChapterSegmentUID", chapter_segment_uid, EBML_TYPE_BINARY)
+
+E("ChapterFlagEnabled", chapter_flag_enabled, EBML_TYPE_UINT)
+
+E("ChapterFlagHidden", chapter_flag_hidden, EBML_TYPE_UINT)
+
+E("ChapterTimeEnd", chapter_time_end, EBML_TYPE_UINT)
+
+E("ChapterTimeStart", chapter_time_start, EBML_TYPE_UINT)
+
+E("ChapterUID", chapter_uid, EBML_TYPE_UINT)
+
+#define N chapter_atom
+E_S("ChapterAtom", 8)
+F(MATROSKA_ID_CHAPTERUID, chapter_uid, 0)
+F(MATROSKA_ID_CHAPTERTIMESTART, chapter_time_start, 0)
+F(MATROSKA_ID_CHAPTERTIMEEND, chapter_time_end, 0)
+F(MATROSKA_ID_CHAPTERFLAGHIDDEN, chapter_flag_hidden, 0)
+F(MATROSKA_ID_CHAPTERFLAGENABLED, chapter_flag_enabled, 0)
+F(MATROSKA_ID_CHAPTERSEGMENTUID, chapter_segment_uid, 0)
+F(MATROSKA_ID_CHAPTERSEGMENTEDITIONUID, chapter_segment_edition_uid, 0)
+F(MATROSKA_ID_CHAPTERDISPLAY, chapter_display, 1)
+}};
+#undef N
+
+E("EditionFlagOrdered", edition_flag_ordered, EBML_TYPE_UINT)
+
+E("EditionFlagDefault", edition_flag_default, EBML_TYPE_UINT)
+
+E("EditionFlagHidden", edition_flag_hidden, EBML_TYPE_UINT)
+
+E("EditionUID", edition_uid, EBML_TYPE_UINT)
+
+#define N edition_entry
+E_S("EditionEntry", 5)
+F(MATROSKA_ID_EDITIONUID, edition_uid, 0)
+F(MATROSKA_ID_EDITIONFLAGHIDDEN, edition_flag_hidden, 0)
+F(MATROSKA_ID_EDITIONFLAGDEFAULT, edition_flag_default, 0)
+F(MATROSKA_ID_EDITIONFLAGORDERED, edition_flag_ordered, 0)
+F(MATROSKA_ID_CHAPTERATOM, chapter_atom, 1)
+}};
+#undef N
+
+#define N chapters
+E_S("Chapters", 1)
+F(MATROSKA_ID_EDITIONENTRY, edition_entry, 1)
+}};
+#undef N
+
+E("FileUID", file_uid, EBML_TYPE_UINT)
+
+E("FileData", file_data, EBML_TYPE_BINARY)
+
+E("FileMimeType", file_mime_type, EBML_TYPE_STR)
+
+E("FileName", file_name, EBML_TYPE_STR)
+
+#define N attached_file
+E_S("AttachedFile", 4)
+F(MATROSKA_ID_FILENAME, file_name, 0)
+F(MATROSKA_ID_FILEMIMETYPE, file_mime_type, 0)
+F(MATROSKA_ID_FILEDATA, file_data, 0)
+F(MATROSKA_ID_FILEUID, file_uid, 0)
+}};
+#undef N
+
+#define N attachments
+E_S("Attachments", 1)
+F(MATROSKA_ID_ATTACHEDFILE, attached_file, 1)
+}};
+#undef N
+
+E("CueClusterPosition", cue_cluster_position, EBML_TYPE_UINT)
+
+E("CueTrack", cue_track, EBML_TYPE_UINT)
+
+#define N cue_track_positions
+E_S("CueTrackPositions", 2)
+F(MATROSKA_ID_CUETRACK, cue_track, 0)
+F(MATROSKA_ID_CUECLUSTERPOSITION, cue_cluster_position, 0)
+}};
+#undef N
+
+E("CueTime", cue_time, EBML_TYPE_UINT)
+
+#define N cue_point
+E_S("CuePoint", 2)
+F(MATROSKA_ID_CUETIME, cue_time, 0)
+F(MATROSKA_ID_CUETRACKPOSITIONS, cue_track_positions, 1)
+}};
+#undef N
+
+#define N cues
+E_S("Cues", 1)
+F(MATROSKA_ID_CUEPOINT, cue_point, 1)
+}};
+#undef N
+
+E("ContentCompSettings", content_comp_settings, EBML_TYPE_BINARY)
+
+E("ContentCompAlgo", content_comp_algo, EBML_TYPE_UINT)
+
+#define N content_compression
+E_S("ContentCompression", 2)
+F(MATROSKA_ID_CONTENTCOMPALGO, content_comp_algo, 0)
+F(MATROSKA_ID_CONTENTCOMPSETTINGS, content_comp_settings, 0)
+}};
+#undef N
+
+E("ContentEncodingType", content_encoding_type, EBML_TYPE_UINT)
+
+E("ContentEncodingScope", content_encoding_scope, EBML_TYPE_UINT)
+
+E("ContentEncodingOrder", content_encoding_order, EBML_TYPE_UINT)
+
+#define N content_encoding
+E_S("ContentEncoding", 4)
+F(MATROSKA_ID_CONTENTENCODINGORDER, content_encoding_order, 0)
+F(MATROSKA_ID_CONTENTENCODINGSCOPE, content_encoding_scope, 0)
+F(MATROSKA_ID_CONTENTENCODINGTYPE, content_encoding_type, 0)
+F(MATROSKA_ID_CONTENTCOMPRESSION, content_compression, 0)
+}};
+#undef N
+
+#define N content_encodings
+E_S("ContentEncodings", 1)
+F(MATROSKA_ID_CONTENTENCODING, content_encoding, 1)
+}};
+#undef N
+
+E("BitDepth", bit_depth, EBML_TYPE_UINT)
+
+E("Channels", channels, EBML_TYPE_UINT)
+
+E("SamplingFrequency", sampling_frequency, EBML_TYPE_FLOAT)
+
+#define N audio
+E_S("Audio", 3)
+F(MATROSKA_ID_SAMPLINGFREQUENCY, sampling_frequency, 0)
+F(MATROSKA_ID_CHANNELS, channels, 0)
+F(MATROSKA_ID_BITDEPTH, bit_depth, 0)
+}};
+#undef N
+
+E("FrameRate", frame_rate, EBML_TYPE_FLOAT)
+
+E("DisplayHeight", display_height, EBML_TYPE_UINT)
+
+E("DisplayWidth", display_width, EBML_TYPE_UINT)
+
+E("PixelHeight", pixel_height, EBML_TYPE_UINT)
+
+E("PixelWidth", pixel_width, EBML_TYPE_UINT)
+
+E("FlagInterlaced", flag_interlaced, EBML_TYPE_UINT)
+
+#define N video
+E_S("Video", 6)
+F(MATROSKA_ID_FLAGINTERLACED, flag_interlaced, 0)
+F(MATROSKA_ID_PIXELWIDTH, pixel_width, 0)
+F(MATROSKA_ID_PIXELHEIGHT, pixel_height, 0)
+F(MATROSKA_ID_DISPLAYWIDTH, display_width, 0)
+F(MATROSKA_ID_DISPLAYHEIGHT, display_height, 0)
+F(MATROSKA_ID_FRAMERATE, frame_rate, 0)
+}};
+#undef N
+
+E("CodecDecodeAll", codec_decode_all, EBML_TYPE_UINT)
+
+E("CodecPrivate", codec_private, EBML_TYPE_BINARY)
+
+E("CodecID", codec_id, EBML_TYPE_STR)
+
+E("Language", language, EBML_TYPE_STR)
+
+E("Name", name, EBML_TYPE_STR)
+
+E("MaxBlockAdditionID", max_block_addition_id, EBML_TYPE_UINT)
+
+E("TrackTimecodeScale", track_timecode_scale, EBML_TYPE_FLOAT)
+
+E("DefaultDuration", default_duration, EBML_TYPE_UINT)
+
+E("MinCache", min_cache, EBML_TYPE_UINT)
+
+E("FlagLacing", flag_lacing, EBML_TYPE_UINT)
+
+E("FlagForced", flag_forced, EBML_TYPE_UINT)
+
+E("FlagDefault", flag_default, EBML_TYPE_UINT)
+
+E("FlagEnabled", flag_enabled, EBML_TYPE_UINT)
+
+E("TrackType", track_type, EBML_TYPE_UINT)
+
+E("TrackUID", track_uid, EBML_TYPE_UINT)
+
+E("TrackNumber", track_number, EBML_TYPE_UINT)
+
+#define N track_entry
+E_S("TrackEntry", 19)
+F(MATROSKA_ID_TRACKNUMBER, track_number, 0)
+F(MATROSKA_ID_TRACKUID, track_uid, 0)
+F(MATROSKA_ID_TRACKTYPE, track_type, 0)
+F(MATROSKA_ID_FLAGENABLED, flag_enabled, 0)
+F(MATROSKA_ID_FLAGDEFAULT, flag_default, 0)
+F(MATROSKA_ID_FLAGFORCED, flag_forced, 0)
+F(MATROSKA_ID_FLAGLACING, flag_lacing, 0)
+F(MATROSKA_ID_MINCACHE, min_cache, 0)
+F(MATROSKA_ID_DEFAULTDURATION, default_duration, 0)
+F(MATROSKA_ID_TRACKTIMECODESCALE, track_timecode_scale, 0)
+F(MATROSKA_ID_MAXBLOCKADDITIONID, max_block_addition_id, 0)
+F(MATROSKA_ID_NAME, name, 0)
+F(MATROSKA_ID_LANGUAGE, language, 0)
+F(MATROSKA_ID_CODECID, codec_id, 0)
+F(MATROSKA_ID_CODECPRIVATE, codec_private, 0)
+F(MATROSKA_ID_CODECDECODEALL, codec_decode_all, 0)
+F(MATROSKA_ID_VIDEO, video, 0)
+F(MATROSKA_ID_AUDIO, audio, 0)
+F(MATROSKA_ID_CONTENTENCODINGS, content_encodings, 0)
+}};
+#undef N
+
+#define N tracks
+E_S("Tracks", 1)
+F(MATROSKA_ID_TRACKENTRY, track_entry, 1)
+}};
+#undef N
+
+E("SimpleBlock", simple_block, EBML_TYPE_BINARY)
+
+E("ReferenceBlock", reference_block, EBML_TYPE_SINT)
+
+E("BlockDuration", block_duration, EBML_TYPE_UINT)
+
+E("Block", block, EBML_TYPE_BINARY)
+
+#define N block_group
+E_S("BlockGroup", 3)
+F(MATROSKA_ID_BLOCK, block, 0)
+F(MATROSKA_ID_BLOCKDURATION, block_duration, 0)
+F(MATROSKA_ID_REFERENCEBLOCK, reference_block, 1)
+}};
+#undef N
+
+E("Timecode", timecode, EBML_TYPE_UINT)
+
+#define N cluster
+E_S("Cluster", 3)
+F(MATROSKA_ID_TIMECODE, timecode, 0)
+F(MATROSKA_ID_BLOCKGROUP, block_group, 1)
+F(MATROSKA_ID_SIMPLEBLOCK, simple_block, 1)
+}};
+#undef N
+
+E("Duration", duration, EBML_TYPE_FLOAT)
+
+E("WritingApp", writing_app, EBML_TYPE_STR)
+
+E("MuxingApp", muxing_app, EBML_TYPE_STR)
+
+E("Title", title, EBML_TYPE_STR)
+
+E("DateUTC", date_utc, EBML_TYPE_SINT)
+
+E("TimecodeScale", timecode_scale, EBML_TYPE_UINT)
+
+E("NextUID", next_uid, EBML_TYPE_BINARY)
+
+E("PrevUID", prev_uid, EBML_TYPE_BINARY)
+
+E("SegmentUID", segment_uid, EBML_TYPE_BINARY)
+
+#define N info
+E_S("Info", 9)
+F(MATROSKA_ID_SEGMENTUID, segment_uid, 0)
+F(MATROSKA_ID_PREVUID, prev_uid, 0)
+F(MATROSKA_ID_NEXTUID, next_uid, 0)
+F(MATROSKA_ID_TIMECODESCALE, timecode_scale, 0)
+F(MATROSKA_ID_DATEUTC, date_utc, 0)
+F(MATROSKA_ID_TITLE, title, 0)
+F(MATROSKA_ID_MUXINGAPP, muxing_app, 0)
+F(MATROSKA_ID_WRITINGAPP, writing_app, 0)
+F(MATROSKA_ID_DURATION, duration, 0)
+}};
+#undef N
+
+E("SeekPosition", seek_position, EBML_TYPE_UINT)
+
+E("SeekID", seek_id, EBML_TYPE_EBML_ID)
+
+#define N seek
+E_S("Seek", 2)
+F(MATROSKA_ID_SEEKID, seek_id, 0)
+F(MATROSKA_ID_SEEKPOSITION, seek_position, 0)
+}};
+#undef N
+
+#define N seek_head
+E_S("SeekHead", 1)
+F(MATROSKA_ID_SEEK, seek, 1)
+}};
+#undef N
+
+#define N segment
+E_S("Segment", 8)
+F(MATROSKA_ID_SEEKHEAD, seek_head, 1)
+F(MATROSKA_ID_INFO, info, 1)
+F(MATROSKA_ID_CLUSTER, cluster, 1)
+F(MATROSKA_ID_TRACKS, tracks, 1)
+F(MATROSKA_ID_CUES, cues, 0)
+F(MATROSKA_ID_ATTACHMENTS, attachments, 0)
+F(MATROSKA_ID_CHAPTERS, chapters, 0)
+F(MATROSKA_ID_TAGS, tags, 1)
+}};
+#undef N
+
+E("Void", void, EBML_TYPE_BINARY)
+
+E("CRC32", crc32, EBML_TYPE_BINARY)
+
+E("DocTypeReadVersion", doc_type_read_version, EBML_TYPE_UINT)
+
+E("DocTypeVersion", doc_type_version, EBML_TYPE_UINT)
+
+E("DocType", doc_type, EBML_TYPE_STR)
+
+E("EBMLMaxSizeLength", ebml_max_size_length, EBML_TYPE_UINT)
+
+E("EBMLMaxIDLength", ebml_max_id_length, EBML_TYPE_UINT)
+
+E("EBMLReadVersion", ebml_read_version, EBML_TYPE_UINT)
+
+E("EBMLVersion", ebml_version, EBML_TYPE_UINT)
+
+#define N ebml
+E_S("EBML", 7)
+F(EBML_ID_EBMLVERSION, ebml_version, 0)
+F(EBML_ID_EBMLREADVERSION, ebml_read_version, 0)
+F(EBML_ID_EBMLMAXIDLENGTH, ebml_max_id_length, 0)
+F(EBML_ID_EBMLMAXSIZELENGTH, ebml_max_size_length, 0)
+F(EBML_ID_DOCTYPE, doc_type, 0)
+F(EBML_ID_DOCTYPEVERSION, doc_type_version, 0)
+F(EBML_ID_DOCTYPEREADVERSION, doc_type_read_version, 0)
+}};
+#undef N
diff --git a/libmpdemux/ebml_types.h b/libmpdemux/ebml_types.h
new file mode 100644
index 0000000000..45b274731b
--- /dev/null
+++ b/libmpdemux/ebml_types.h
@@ -0,0 +1,433 @@
+// Generated by TOOLS/matroska.py, do not edit manually
+
+#define EBML_ID_EBML 0x1a45dfa3
+#define EBML_ID_EBMLVERSION 0x4286
+#define EBML_ID_EBMLREADVERSION 0x42f7
+#define EBML_ID_EBMLMAXIDLENGTH 0x42f2
+#define EBML_ID_EBMLMAXSIZELENGTH 0x42f3
+#define EBML_ID_DOCTYPE 0x4282
+#define EBML_ID_DOCTYPEVERSION 0x4287
+#define EBML_ID_DOCTYPEREADVERSION 0x4285
+#define EBML_ID_CRC32 0xbf
+#define EBML_ID_VOID 0xec
+#define MATROSKA_ID_SEGMENT 0x18538067
+#define MATROSKA_ID_SEEKHEAD 0x114d9b74
+#define MATROSKA_ID_SEEK 0x4dbb
+#define MATROSKA_ID_SEEKID 0x53ab
+#define MATROSKA_ID_SEEKPOSITION 0x53ac
+#define MATROSKA_ID_INFO 0x1549a966
+#define MATROSKA_ID_SEGMENTUID 0x73a4
+#define MATROSKA_ID_PREVUID 0x3cb923
+#define MATROSKA_ID_NEXTUID 0x3eb923
+#define MATROSKA_ID_TIMECODESCALE 0x2ad7b1
+#define MATROSKA_ID_DATEUTC 0x4461
+#define MATROSKA_ID_TITLE 0x7ba9
+#define MATROSKA_ID_MUXINGAPP 0x4d80
+#define MATROSKA_ID_WRITINGAPP 0x5741
+#define MATROSKA_ID_DURATION 0x4489
+#define MATROSKA_ID_CLUSTER 0x1f43b675
+#define MATROSKA_ID_TIMECODE 0xe7
+#define MATROSKA_ID_BLOCKGROUP 0xa0
+#define MATROSKA_ID_BLOCK 0xa1
+#define MATROSKA_ID_BLOCKDURATION 0x9b
+#define MATROSKA_ID_REFERENCEBLOCK 0xfb
+#define MATROSKA_ID_SIMPLEBLOCK 0xa3
+#define MATROSKA_ID_TRACKS 0x1654ae6b
+#define MATROSKA_ID_TRACKENTRY 0xae
+#define MATROSKA_ID_TRACKNUMBER 0xd7
+#define MATROSKA_ID_TRACKUID 0x73c5
+#define MATROSKA_ID_TRACKTYPE 0x83
+#define MATROSKA_ID_FLAGENABLED 0xb9
+#define MATROSKA_ID_FLAGDEFAULT 0x88
+#define MATROSKA_ID_FLAGFORCED 0x55aa
+#define MATROSKA_ID_FLAGLACING 0x9c
+#define MATROSKA_ID_MINCACHE 0x6de7
+#define MATROSKA_ID_DEFAULTDURATION 0x23e383
+#define MATROSKA_ID_TRACKTIMECODESCALE 0x23314f
+#define MATROSKA_ID_MAXBLOCKADDITIONID 0x55ee
+#define MATROSKA_ID_NAME 0x536e
+#define MATROSKA_ID_LANGUAGE 0x22b59c
+#define MATROSKA_ID_CODECID 0x86
+#define MATROSKA_ID_CODECPRIVATE 0x63a2
+#define MATROSKA_ID_CODECDECODEALL 0xaa
+#define MATROSKA_ID_VIDEO 0xe0
+#define MATROSKA_ID_FLAGINTERLACED 0x9a
+#define MATROSKA_ID_PIXELWIDTH 0xb0
+#define MATROSKA_ID_PIXELHEIGHT 0xba
+#define MATROSKA_ID_DISPLAYWIDTH 0x54b0
+#define MATROSKA_ID_DISPLAYHEIGHT 0x54ba
+#define MATROSKA_ID_FRAMERATE 0x2383e3
+#define MATROSKA_ID_AUDIO 0xe1
+#define MATROSKA_ID_SAMPLINGFREQUENCY 0xb5
+#define MATROSKA_ID_CHANNELS 0x9f
+#define MATROSKA_ID_BITDEPTH 0x6264
+#define MATROSKA_ID_CONTENTENCODINGS 0x6d80
+#define MATROSKA_ID_CONTENTENCODING 0x6240
+#define MATROSKA_ID_CONTENTENCODINGORDER 0x5031
+#define MATROSKA_ID_CONTENTENCODINGSCOPE 0x5032
+#define MATROSKA_ID_CONTENTENCODINGTYPE 0x5033
+#define MATROSKA_ID_CONTENTCOMPRESSION 0x5034
+#define MATROSKA_ID_CONTENTCOMPALGO 0x4254
+#define MATROSKA_ID_CONTENTCOMPSETTINGS 0x4255
+#define MATROSKA_ID_CUES 0x1c53bb6b
+#define MATROSKA_ID_CUEPOINT 0xbb
+#define MATROSKA_ID_CUETIME 0xb3
+#define MATROSKA_ID_CUETRACKPOSITIONS 0xb7
+#define MATROSKA_ID_CUETRACK 0xf7
+#define MATROSKA_ID_CUECLUSTERPOSITION 0xf1
+#define MATROSKA_ID_ATTACHMENTS 0x1941a469
+#define MATROSKA_ID_ATTACHEDFILE 0x61a7
+#define MATROSKA_ID_FILENAME 0x466e
+#define MATROSKA_ID_FILEMIMETYPE 0x4660
+#define MATROSKA_ID_FILEDATA 0x465c
+#define MATROSKA_ID_FILEUID 0x46ae
+#define MATROSKA_ID_CHAPTERS 0x1043a770
+#define MATROSKA_ID_EDITIONENTRY 0x45b9
+#define MATROSKA_ID_EDITIONUID 0x45bc
+#define MATROSKA_ID_EDITIONFLAGHIDDEN 0x45bd
+#define MATROSKA_ID_EDITIONFLAGDEFAULT 0x45db
+#define MATROSKA_ID_EDITIONFLAGORDERED 0x45dd
+#define MATROSKA_ID_CHAPTERATOM 0xb6
+#define MATROSKA_ID_CHAPTERUID 0x73c4
+#define MATROSKA_ID_CHAPTERTIMESTART 0x91
+#define MATROSKA_ID_CHAPTERTIMEEND 0x92
+#define MATROSKA_ID_CHAPTERFLAGHIDDEN 0x98
+#define MATROSKA_ID_CHAPTERFLAGENABLED 0x4598
+#define MATROSKA_ID_CHAPTERSEGMENTUID 0x6e67
+#define MATROSKA_ID_CHAPTERSEGMENTEDITIONUID 0x6ebc
+#define MATROSKA_ID_CHAPTERDISPLAY 0x80
+#define MATROSKA_ID_CHAPSTRING 0x85
+#define MATROSKA_ID_CHAPLANGUAGE 0x437c
+#define MATROSKA_ID_TAGS 0x1254c367
+#define MATROSKA_ID_TAG 0x7373
+#define MATROSKA_ID_TARGETS 0x63c0
+#define MATROSKA_ID_TARGETTYPEVALUE 0x68ca
+
+
+struct ebml_targets {
+ uint64_t target_type_value;
+
+ int n_target_type_value;
+};
+
+struct ebml_tag {
+ struct ebml_targets targets;
+
+ int n_targets;
+};
+
+struct ebml_tags {
+ struct ebml_tag *tag;
+
+ int n_tag;
+};
+
+struct ebml_chapter_display {
+ struct bstr chap_string;
+ struct bstr *chap_language;
+
+ int n_chap_string;
+ int n_chap_language;
+};
+
+struct ebml_chapter_atom {
+ uint64_t chapter_uid;
+ uint64_t chapter_time_start;
+ uint64_t chapter_time_end;
+ uint64_t chapter_flag_hidden;
+ uint64_t chapter_flag_enabled;
+ struct bstr chapter_segment_uid;
+ uint64_t chapter_segment_edition_uid;
+ struct ebml_chapter_display *chapter_display;
+
+ int n_chapter_uid;
+ int n_chapter_time_start;
+ int n_chapter_time_end;
+ int n_chapter_flag_hidden;
+ int n_chapter_flag_enabled;
+ int n_chapter_segment_uid;
+ int n_chapter_segment_edition_uid;
+ int n_chapter_display;
+};
+
+struct ebml_edition_entry {
+ uint64_t edition_uid;
+ uint64_t edition_flag_hidden;
+ uint64_t edition_flag_default;
+ uint64_t edition_flag_ordered;
+ struct ebml_chapter_atom *chapter_atom;
+
+ int n_edition_uid;
+ int n_edition_flag_hidden;
+ int n_edition_flag_default;
+ int n_edition_flag_ordered;
+ int n_chapter_atom;
+};
+
+struct ebml_chapters {
+ struct ebml_edition_entry *edition_entry;
+
+ int n_edition_entry;
+};
+
+struct ebml_attached_file {
+ struct bstr file_name;
+ struct bstr file_mime_type;
+ struct bstr file_data;
+ uint64_t file_uid;
+
+ int n_file_name;
+ int n_file_mime_type;
+ int n_file_data;
+ int n_file_uid;
+};
+
+struct ebml_attachments {
+ struct ebml_attached_file *attached_file;
+
+ int n_attached_file;
+};
+
+struct ebml_cue_track_positions {
+ uint64_t cue_track;
+ uint64_t cue_cluster_position;
+
+ int n_cue_track;
+ int n_cue_cluster_position;
+};
+
+struct ebml_cue_point {
+ uint64_t cue_time;
+ struct ebml_cue_track_positions *cue_track_positions;
+
+ int n_cue_time;
+ int n_cue_track_positions;
+};
+
+struct ebml_cues {
+ struct ebml_cue_point *cue_point;
+
+ int n_cue_point;
+};
+
+struct ebml_content_compression {
+ uint64_t content_comp_algo;
+ struct bstr content_comp_settings;
+
+ int n_content_comp_algo;
+ int n_content_comp_settings;
+};
+
+struct ebml_content_encoding {
+ uint64_t content_encoding_order;
+ uint64_t content_encoding_scope;
+ uint64_t content_encoding_type;
+ struct ebml_content_compression content_compression;
+
+ int n_content_encoding_order;
+ int n_content_encoding_scope;
+ int n_content_encoding_type;
+ int n_content_compression;
+};
+
+struct ebml_content_encodings {
+ struct ebml_content_encoding *content_encoding;
+
+ int n_content_encoding;
+};
+
+struct ebml_audio {
+ double sampling_frequency;
+ uint64_t channels;
+ uint64_t bit_depth;
+
+ int n_sampling_frequency;
+ int n_channels;
+ int n_bit_depth;
+};
+
+struct ebml_video {
+ uint64_t flag_interlaced;
+ uint64_t pixel_width;
+ uint64_t pixel_height;
+ uint64_t display_width;
+ uint64_t display_height;
+ double frame_rate;
+
+ int n_flag_interlaced;
+ int n_pixel_width;
+ int n_pixel_height;
+ int n_display_width;
+ int n_display_height;
+ int n_frame_rate;
+};
+
+struct ebml_track_entry {
+ uint64_t track_number;
+ uint64_t track_uid;
+ uint64_t track_type;
+ uint64_t flag_enabled;
+ uint64_t flag_default;
+ uint64_t flag_forced;
+ uint64_t flag_lacing;
+ uint64_t min_cache;
+ uint64_t default_duration;
+ double track_timecode_scale;
+ uint64_t max_block_addition_id;
+ struct bstr name;
+ struct bstr language;
+ struct bstr codec_id;
+ struct bstr codec_private;
+ uint64_t codec_decode_all;
+ struct ebml_video video;
+ struct ebml_audio audio;
+ struct ebml_content_encodings content_encodings;
+
+ int n_track_number;
+ int n_track_uid;
+ int n_track_type;
+ int n_flag_enabled;
+ int n_flag_default;
+ int n_flag_forced;
+ int n_flag_lacing;
+ int n_min_cache;
+ int n_default_duration;
+ int n_track_timecode_scale;
+ int n_max_block_addition_id;
+ int n_name;
+ int n_language;
+ int n_codec_id;
+ int n_codec_private;
+ int n_codec_decode_all;
+ int n_video;
+ int n_audio;
+ int n_content_encodings;
+};
+
+struct ebml_tracks {
+ struct ebml_track_entry *track_entry;
+
+ int n_track_entry;
+};
+
+struct ebml_block_group {
+ struct bstr block;
+ uint64_t block_duration;
+ int64_t *reference_block;
+
+ int n_block;
+ int n_block_duration;
+ int n_reference_block;
+};
+
+struct ebml_cluster {
+ uint64_t timecode;
+ struct ebml_block_group *block_group;
+ struct bstr *simple_block;
+
+ int n_timecode;
+ int n_block_group;
+ int n_simple_block;
+};
+
+struct ebml_info {
+ struct bstr segment_uid;
+ struct bstr prev_uid;
+ struct bstr next_uid;
+ uint64_t timecode_scale;
+ int64_t date_utc;
+ struct bstr title;
+ struct bstr muxing_app;
+ struct bstr writing_app;
+ double duration;
+
+ int n_segment_uid;
+ int n_prev_uid;
+ int n_next_uid;
+ int n_timecode_scale;
+ int n_date_utc;
+ int n_title;
+ int n_muxing_app;
+ int n_writing_app;
+ int n_duration;
+};
+
+struct ebml_seek {
+ uint32_t seek_id;
+ uint64_t seek_position;
+
+ int n_seek_id;
+ int n_seek_position;
+};
+
+struct ebml_seek_head {
+ struct ebml_seek *seek;
+
+ int n_seek;
+};
+
+struct ebml_segment {
+ struct ebml_seek_head *seek_head;
+ struct ebml_info *info;
+ struct ebml_cluster *cluster;
+ struct ebml_tracks *tracks;
+ struct ebml_cues cues;
+ struct ebml_attachments attachments;
+ struct ebml_chapters chapters;
+ struct ebml_tags *tags;
+
+ int n_seek_head;
+ int n_info;
+ int n_cluster;
+ int n_tracks;
+ int n_cues;
+ int n_attachments;
+ int n_chapters;
+ int n_tags;
+};
+
+struct ebml_ebml {
+ uint64_t ebml_version;
+ uint64_t ebml_read_version;
+ uint64_t ebml_max_id_length;
+ uint64_t ebml_max_size_length;
+ struct bstr doc_type;
+ uint64_t doc_type_version;
+ uint64_t doc_type_read_version;
+
+ int n_ebml_version;
+ int n_ebml_read_version;
+ int n_ebml_max_id_length;
+ int n_ebml_max_size_length;
+ int n_doc_type;
+ int n_doc_type_version;
+ int n_doc_type_read_version;
+};
+extern const struct ebml_elem_desc ebml_ebml_desc;
+extern const struct ebml_elem_desc ebml_segment_desc;
+extern const struct ebml_elem_desc ebml_seek_head_desc;
+extern const struct ebml_elem_desc ebml_seek_desc;
+extern const struct ebml_elem_desc ebml_info_desc;
+extern const struct ebml_elem_desc ebml_cluster_desc;
+extern const struct ebml_elem_desc ebml_block_group_desc;
+extern const struct ebml_elem_desc ebml_tracks_desc;
+extern const struct ebml_elem_desc ebml_track_entry_desc;
+extern const struct ebml_elem_desc ebml_video_desc;
+extern const struct ebml_elem_desc ebml_audio_desc;
+extern const struct ebml_elem_desc ebml_content_encodings_desc;
+extern const struct ebml_elem_desc ebml_content_encoding_desc;
+extern const struct ebml_elem_desc ebml_content_compression_desc;
+extern const struct ebml_elem_desc ebml_cues_desc;
+extern const struct ebml_elem_desc ebml_cue_point_desc;
+extern const struct ebml_elem_desc ebml_cue_track_positions_desc;
+extern const struct ebml_elem_desc ebml_attachments_desc;
+extern const struct ebml_elem_desc ebml_attached_file_desc;
+extern const struct ebml_elem_desc ebml_chapters_desc;
+extern const struct ebml_elem_desc ebml_edition_entry_desc;
+extern const struct ebml_elem_desc ebml_chapter_atom_desc;
+extern const struct ebml_elem_desc ebml_chapter_display_desc;
+extern const struct ebml_elem_desc ebml_tags_desc;
+extern const struct ebml_elem_desc ebml_tag_desc;
+extern const struct ebml_elem_desc ebml_targets_desc;
+
+#define MAX_EBML_SUBELEMENTS 19
diff --git a/libmpdemux/extension.c b/libmpdemux/extension.c
index 76d319008c..1d2ffb832e 100644
--- a/libmpdemux/extension.c
+++ b/libmpdemux/extension.c
@@ -107,4 +107,3 @@ int demuxer_type_by_filename(char* filename){
}
return DEMUXER_TYPE_UNKNOWN;
}
-
diff --git a/libmpdemux/mf.c b/libmpdemux/mf.c
index c4732206ae..53c4296bfa 100644
--- a/libmpdemux/mf.c
+++ b/libmpdemux/mf.c
@@ -168,4 +168,3 @@ exit_mf:
return 0;
#endif
}
-
diff --git a/libmpdemux/mp3_hdr.c b/libmpdemux/mp3_hdr.c
index 9c649d7e1b..7095efeb78 100644
--- a/libmpdemux/mp3_hdr.c
+++ b/libmpdemux/mp3_hdr.c
@@ -19,6 +19,7 @@
#include <stdio.h>
#include "config.h"
+#include "mp3_hdr.h"
#include "mp_msg.h"
//----------------------- mp3 audio frame header parser -----------------------
@@ -37,7 +38,7 @@ static long freqs[9] = { 44100, 48000, 32000, // MPEG 1.0
22050, 24000, 16000, // MPEG 2.0
11025, 12000, 8000}; // MPEG 2.5
-int mp_mp3_get_lsf(unsigned char* hbuf){
+static int mp_mp3_get_lsf(unsigned char* hbuf){
unsigned long newhead =
hbuf[0] << 24 |
hbuf[1] << 16 |
@@ -155,4 +156,3 @@ int mp_get_mp3_header(unsigned char* hbuf,int* chans, int* srate, int* spf, int*
return framesize;
}
-
diff --git a/libmpdemux/mp_taglists.c b/libmpdemux/mp_taglists.c
index 50b87e8377..4b7c8ed331 100644
--- a/libmpdemux/mp_taglists.c
+++ b/libmpdemux/mp_taglists.c
@@ -18,11 +18,14 @@
#include "config.h"
-#include "mp_taglists.h"
#include "libavformat/avformat.h"
-#include "libavformat/riff.h"
+#include <libavcodec/avcodec.h>
+
+#include "mp_taglists.h"
-static const AVCodecTag mp_wav_tags[] = {
+#include "ffmpeg_files/taglists.c"
+
+static const struct mp_AVCodecTag mp_wav_tags[] = {
{ CODEC_ID_ADPCM_4XM, MKTAG('4', 'X', 'M', 'A')},
{ CODEC_ID_ADPCM_EA, MKTAG('A', 'D', 'E', 'A')},
{ CODEC_ID_ADPCM_EA_MAXIS_XA, MKTAG('A', 'D', 'X', 'A')},
@@ -54,9 +57,9 @@ static const AVCodecTag mp_wav_tags[] = {
{ 0, 0 },
};
-const struct AVCodecTag * const mp_wav_taglists[] = {ff_codec_wav_tags, mp_wav_tags, 0};
+const struct mp_AVCodecTag * const mp_wav_taglists[] = {mp_ff_codec_wav_tags, mp_wav_tags, 0};
-static const AVCodecTag mp_codecid_override_tags[] = {
+static const struct mp_AVCodecTag mp_codecid_override_tags[] = {
{ CODEC_ID_AAC, MKTAG('M', 'P', '4', 'A')},
{ CODEC_ID_AC3, 0x2000},
{ CODEC_ID_ADPCM_IMA_AMV, MKTAG('A', 'M', 'V', 'A')},
@@ -79,10 +82,9 @@ static const AVCodecTag mp_codecid_override_tags[] = {
{ 0, 0 },
};
-const struct AVCodecTag * const mp_codecid_override_taglists[] =
- {mp_codecid_override_tags, 0};
+const struct mp_AVCodecTag * const mp_codecid_override_taglists[] = {mp_codecid_override_tags, 0};
-static const AVCodecTag mp_bmp_tags[] = {
+static const struct mp_AVCodecTag mp_bmp_tags[] = {
{ CODEC_ID_AMV, MKTAG('A', 'M', 'V', 'V')},
{ CODEC_ID_BETHSOFTVID, MKTAG('B', 'E', 'T', 'H')},
{ CODEC_ID_BFI, MKTAG('B', 'F', 'I', 'V')},
@@ -114,5 +116,4 @@ static const AVCodecTag mp_bmp_tags[] = {
{ 0, 0 },
};
-const struct AVCodecTag * const mp_bmp_taglists[] = {ff_codec_bmp_tags, mp_bmp_tags, 0};
-
+const struct mp_AVCodecTag * const mp_bmp_taglists[] = {mp_ff_codec_bmp_tags, mp_bmp_tags, 0};
diff --git a/libmpdemux/mp_taglists.h b/libmpdemux/mp_taglists.h
index 6ace1213d3..381b77a8db 100644
--- a/libmpdemux/mp_taglists.h
+++ b/libmpdemux/mp_taglists.h
@@ -19,10 +19,14 @@
#ifndef MPLAYER_MP_TAGLISTS_H
#define MPLAYER_MP_TAGLISTS_H
-extern const struct AVCodecTag * const mp_wav_taglists[];
+#include <libavcodec/avcodec.h>
-extern const struct AVCodecTag * const mp_codecid_override_taglists[];
+#include "ffmpeg_files/taglists.h"
-extern const struct AVCodecTag * const mp_bmp_taglists[];
+extern const struct mp_AVCodecTag * const mp_wav_taglists[];
+
+extern const struct mp_AVCodecTag * const mp_codecid_override_taglists[];
+
+extern const struct mp_AVCodecTag * const mp_bmp_taglists[];
#endif /* MPLAYER_MP_TAGLISTS_H */
diff --git a/libmpdemux/muxer.c b/libmpdemux/muxer.c
index 62537085d8..39cbb94fab 100644
--- a/libmpdemux/muxer.c
+++ b/libmpdemux/muxer.c
@@ -85,7 +85,7 @@ void muxer_write_chunk(muxer_stream_t *s, size_t len, unsigned int flags, double
tmp = realloc_struct(s->muxer->muxbuf, (num+1), sizeof(muxbuf_t));
if(!tmp) {
- mp_msg(MSGT_MUXER, MSGL_FATAL, MSGTR_MuxbufReallocErr);
+ mp_tmsg(MSGT_MUXER, MSGL_FATAL, "Muxer frame buffer cannot reallocate memory!\n");
return;
}
s->muxer->muxbuf = tmp;
@@ -99,7 +99,7 @@ void muxer_write_chunk(muxer_stream_t *s, size_t len, unsigned int flags, double
buf->flags = flags;
buf->buffer = malloc(len);
if (!buf->buffer) {
- mp_msg(MSGT_MUXER, MSGL_FATAL, MSGTR_MuxbufMallocErr);
+ mp_tmsg(MSGT_MUXER, MSGL_FATAL, "Muxer frame buffer cannot allocate memory!\n");
return;
}
memcpy(buf->buffer, s->buffer, buf->len);
@@ -113,7 +113,7 @@ void muxer_write_chunk(muxer_stream_t *s, size_t len, unsigned int flags, double
/* see if we can flush buffer now */
if (s->muxer->muxbuf_skip_buffer) {
- mp_msg(MSGT_MUXER, MSGL_V, MSGTR_MuxbufSending, s->muxer->muxbuf_num);
+ mp_tmsg(MSGT_MUXER, MSGL_V, "Muxer frame buffer sending %d frame(s) to the muxer.\n", s->muxer->muxbuf_num);
/* fix parameters for all streams */
for (num = 0; s->muxer->streams[num]; ++num) {
@@ -156,7 +156,7 @@ void muxer_write_chunk(muxer_stream_t *s, size_t len, unsigned int flags, double
if(s->h.dwSampleSize){
// CBR
s->h.dwLength+=len/s->h.dwSampleSize;
- if(len%s->h.dwSampleSize) mp_msg(MSGT_MUXER, MSGL_WARN, MSGTR_WarningLenIsntDivisible);
+ if(len%s->h.dwSampleSize) mp_tmsg(MSGT_MUXER, MSGL_WARN, "Warning, len isn't divisible by samplesize!\n");
} else {
// VBR
s->h.dwLength++;
@@ -166,4 +166,3 @@ void muxer_write_chunk(muxer_stream_t *s, size_t len, unsigned int flags, double
return;
}
-
diff --git a/libmpdemux/muxer_avi.c b/libmpdemux/muxer_avi.c
index 5d7e267756..f8531ac868 100644
--- a/libmpdemux/muxer_avi.c
+++ b/libmpdemux/muxer_avi.c
@@ -291,7 +291,7 @@ static void avifile_write_header(muxer_t *muxer){
struct avi_stream_info *vsi = muxer->def_v->priv;
int isodml = vsi->riffofspos > 0;
- mp_msg(MSGT_MUXER, MSGL_INFO, MSGTR_WritingHeader);
+ mp_tmsg(MSGT_MUXER, MSGL_INFO, "Writing header...\n");
if (aspect == 0) {
mp_msg(MSGT_MUXER, MSGL_INFO, "ODML: Aspect information not (yet?) available or unspecified, not writing vprp header.\n");
} else {
@@ -303,11 +303,11 @@ static void avifile_write_header(muxer_t *muxer){
muxer_stream_t *s = muxer->streams[i];
if (s->type == MUXER_TYPE_AUDIO && muxer->audio_delay_fix > 0.0) {
s->h.dwStart = muxer->audio_delay_fix * s->h.dwRate/s->h.dwScale + 0.5;
- mp_msg(MSGT_MUXER, MSGL_INFO, MSGTR_SettingAudioDelay, (float)s->h.dwStart * s->h.dwScale/s->h.dwRate);
+ mp_tmsg(MSGT_MUXER, MSGL_INFO, "Setting audio delay to %5.3fs.\n", (float)s->h.dwStart * s->h.dwScale/s->h.dwRate);
}
if (s->type == MUXER_TYPE_VIDEO && muxer->audio_delay_fix < 0.0) {
s->h.dwStart = -muxer->audio_delay_fix * s->h.dwRate/s->h.dwScale + 0.5;
- mp_msg(MSGT_MUXER, MSGL_INFO, MSGTR_SettingVideoDelay, (float)s->h.dwStart * s->h.dwScale/s->h.dwRate);
+ mp_tmsg(MSGT_MUXER, MSGL_INFO, "Setting video delay to %5.3fs.\n", (float)s->h.dwStart * s->h.dwScale/s->h.dwRate);
}
}
@@ -670,7 +670,7 @@ static void avifile_write_standard_index(muxer_t *muxer){
static void avifile_write_index(muxer_t *muxer){
struct avi_stream_info *vsi = muxer->def_v->priv;
- mp_msg(MSGT_MUXER, MSGL_INFO, MSGTR_WritingTrailer);
+ mp_tmsg(MSGT_MUXER, MSGL_INFO, "Writing index...\n");
if (vsi->riffofspos > 0){
avifile_odml_write_index(muxer);
} else {
diff --git a/libmpdemux/muxer_lavf.c b/libmpdemux/muxer_lavf.c
index f531423979..ed6025317d 100644
--- a/libmpdemux/muxer_lavf.c
+++ b/libmpdemux/muxer_lavf.c
@@ -197,7 +197,7 @@ static void fix_parameters(muxer_stream_t *stream)
if(stream->type == MUXER_TYPE_AUDIO)
{
- ctx->codec_id = av_codec_get_id(mp_wav_taglists, stream->wf->wFormatTag);
+ ctx->codec_id = mp_av_codec_get_id(mp_wav_taglists, stream->wf->wFormatTag);
#if 0 //breaks aac in mov at least
ctx->codec_tag = codec_get_wav_tag(ctx->codec_id);
#endif
@@ -226,7 +226,7 @@ static void fix_parameters(muxer_stream_t *stream)
}
else if(stream->type == MUXER_TYPE_VIDEO)
{
- ctx->codec_id = av_codec_get_id(mp_bmp_taglists, stream->bih->biCompression);
+ ctx->codec_id = mp_av_codec_get_id(mp_bmp_taglists, stream->bih->biCompression);
if(ctx->codec_id <= 0 || force_fourcc)
ctx->codec_tag= stream->bih->biCompression;
mp_msg(MSGT_MUXER, MSGL_INFO, "VIDEO CODEC ID: %d\n", ctx->codec_id);
@@ -290,7 +290,7 @@ static void write_header(muxer_t *muxer)
{
muxer_priv_t *priv = (muxer_priv_t *) muxer->priv;
- mp_msg(MSGT_MUXER, MSGL_INFO, MSGTR_WritingHeader);
+ mp_tmsg(MSGT_MUXER, MSGL_INFO, "Writing header...\n");
av_write_header(priv->oc);
muxer->cont_write_header = NULL;
}
@@ -301,7 +301,7 @@ static void write_trailer(muxer_t *muxer)
int i;
muxer_priv_t *priv = (muxer_priv_t *) muxer->priv;
- mp_msg(MSGT_MUXER, MSGL_INFO, MSGTR_WritingTrailer);
+ mp_tmsg(MSGT_MUXER, MSGL_INFO, "Writing index...\n");
av_write_trailer(priv->oc);
for(i = 0; i < priv->oc->nb_streams; i++)
{
diff --git a/libmpdemux/muxer_mpeg.c b/libmpdemux/muxer_mpeg.c
index 20b552a96e..35ee3fed36 100644
--- a/libmpdemux/muxer_mpeg.c
+++ b/libmpdemux/muxer_mpeg.c
@@ -1218,9 +1218,9 @@ static int fill_packet(muxer_t *muxer, muxer_stream_t *s, int finalize)
if(spriv->dts || spriv->pts)
{
if((spriv->dts && priv->scr >= spriv->dts) || priv->scr >= spriv->pts)
- mp_msg(MSGT_MUXER, MSGL_ERR, "\r\nERROR: scr %.3lf, dts %.3lf, pts %.3lf\r\n", (double) priv->scr/27000000.0, (double) spriv->dts/27000000.0, (double) spriv->pts/27000000.0);
+ mp_msg(MSGT_MUXER, MSGL_ERR, "\r\nERROR: scr %.3f, dts %.3f, pts %.3f\r\n", (double) priv->scr/27000000.0, (double) spriv->dts/27000000.0, (double) spriv->pts/27000000.0);
else if(priv->scr + 63000*300 < spriv->dts)
- mp_msg(MSGT_MUXER, MSGL_INFO, "\r\nWARNING>: scr %.3lf, dts %.3lf, pts %.3lf, diff %.3lf, piff %.3lf\r\n", (double) priv->scr/27000000.0, (double) spriv->dts/27000000.0, (double) spriv->pts/27000000.0, (double)(spriv->dts - priv->scr)/27000000.0, (double)(spriv->pts - priv->scr)/27000000.0);
+ mp_msg(MSGT_MUXER, MSGL_INFO, "\r\nWARNING>: scr %.3f, dts %.3f, pts %.3f, diff %.3f, piff %.3f\r\n", (double) priv->scr/27000000.0, (double) spriv->dts/27000000.0, (double) spriv->pts/27000000.0, (double)(spriv->dts - priv->scr)/27000000.0, (double)(spriv->pts - priv->scr)/27000000.0);
}
n = 0;
@@ -1415,7 +1415,7 @@ static void update_scr(muxer_t *muxer)
mindts = spriv->framebuf[0].dts;
}
- mp_msg(MSGT_MUXER, MSGL_DBG2, "UPDATE SCR TO %"PRIu64" (%.3lf)\n", priv->scr, (double) (priv->scr/27000000.0));
+ mp_msg(MSGT_MUXER, MSGL_DBG2, "UPDATE SCR TO %"PRIu64" (%.3f)\n", priv->scr, (double) (priv->scr/27000000.0));
for(i = 0; i < muxer->avih.dwStreams; i++)
{
@@ -1463,9 +1463,9 @@ static int calc_frames_to_flush(muxer_headers_t *vpriv)
mp_msg(MSGT_MUXER, MSGL_DBG2, "\n");
while(n < vpriv->framebuf_used)
{
- mp_msg(MSGT_MUXER, MSGL_DBG2, "CALC_FRAMES, n=%d, type=%c, pts=%.3lf\n", n, FTYPE(vpriv->framebuf[n].type), (double)vpriv->framebuf[n].pts/27000000.0f);
+ mp_msg(MSGT_MUXER, MSGL_DBG2, "CALC_FRAMES, n=%d, type=%c, pts=%.3f\n", n, FTYPE(vpriv->framebuf[n].type), (double)vpriv->framebuf[n].pts/27000000.0f);
if(n+1 < vpriv->framebuf_used)
- mp_msg(MSGT_MUXER, MSGL_DBG2, "n+1=%d, type=%c, pts=%.3lf\n", n+1, FTYPE(vpriv->framebuf[n+1].type), (double)vpriv->framebuf[n+1].pts/27000000.0f);
+ mp_msg(MSGT_MUXER, MSGL_DBG2, "n+1=%d, type=%c, pts=%.3f\n", n+1, FTYPE(vpriv->framebuf[n+1].type), (double)vpriv->framebuf[n+1].pts/27000000.0f);
if(vpriv->framebuf[n].type == I_FRAME)
{
@@ -1563,7 +1563,7 @@ static int flush_buffers(muxer_t *muxer, int finalize)
apriv->framebuf[i].dts += init_delay;
}
apriv->last_pts += init_delay;
- mp_msg(MSGT_MUXER, MSGL_DBG2, "\r\nINITIAL VIDEO DELAY: %.3lf, currAPTS: %.3lf\r\n", (double) init_delay/27000000.0f, (double) apriv->last_pts/27000000.0f);
+ mp_msg(MSGT_MUXER, MSGL_DBG2, "\r\nINITIAL VIDEO DELAY: %.3f, currAPTS: %.3f\r\n", (double) init_delay/27000000.0f, (double) apriv->last_pts/27000000.0f);
}
if((priv->is_xvcd || priv->is_xsvcd) && (vpriv->size == 0))
@@ -1680,7 +1680,7 @@ static size_t parse_mpeg12_video(muxer_stream_t *s, muxer_priv_t *priv, muxer_he
//the 2 lines below are needed to handle non-standard frame rates (such as 18)
if(! spriv->delta_pts)
spriv->delta_pts = spriv->nom_delta_pts = (uint64_t) ((double)27000000.0 * spriv->delta_clock );
- mp_msg(MSGT_MUXER, MSGL_DBG2, "\nFPS: %.3f, FRAMETIME: %.3lf\n", fps, (double)1/fps);
+ mp_msg(MSGT_MUXER, MSGL_DBG2, "\nFPS: %.3f, FRAMETIME: %.3f\n", fps, (double)1/fps);
if(priv->patch_seq)
patch_seq(priv, &(s->buffer[i]));
}
@@ -1778,7 +1778,7 @@ static size_t parse_mpeg12_video(muxer_stream_t *s, muxer_priv_t *priv, muxer_he
mp_msg(MSGT_MUXER, MSGL_FATAL, "\r\nPARSE_MPEG12: add_frames(%d) failed, exit\r\n", len);
return 0;
}
- mp_msg(MSGT_MUXER, MSGL_DBG2, "\r\nVIDEO FRAME, PT: %C, tr: %d, diff: %d, dts: %.3lf, pts: %.3lf, pdt: %u, gop_reset: %d\r\n",
+ mp_msg(MSGT_MUXER, MSGL_DBG2, "\r\nVIDEO FRAME, PT: %C, tr: %d, diff: %d, dts: %.3f, pts: %.3f, pdt: %u, gop_reset: %d\r\n",
ftypes[pt], temp_ref, frames_diff, ((double) spriv->last_dts/27000000.0f),
((double) spriv->last_pts/27000000.0f), spriv->picture.display_time, gop_reset);
@@ -1799,7 +1799,7 @@ static size_t parse_mpeg12_video(muxer_stream_t *s, muxer_priv_t *priv, muxer_he
adj++;
}
}
- mp_msg(MSGT_MUXER, MSGL_V, "\r\nResynced B-frame by %d units, DIFF: %"PRId64" (%.3lf),[pd]ts=%.3lf\r\n",
+ mp_msg(MSGT_MUXER, MSGL_V, "\r\nResynced B-frame by %d units, DIFF: %"PRId64" (%.3f),[pd]ts=%.3f\r\n",
n, diff, (double) diff/27000000.0f, (double) spriv->last_pts/27000000.0f);
spriv->last_pts = spriv->last_dts;
}
@@ -1844,7 +1844,7 @@ static uint64_t fix_mp4_frame_duration(muxer_headers_t *vpriv)
{
vpriv->framebuf[i].pts += diff;
vpriv->framebuf[i].dts += i * diff;
- mp_msg(MSGT_MUXER, MSGL_DBG2, "FIXED_PTS: %.3lf, FIXED_DTS: %.3lf\n",
+ mp_msg(MSGT_MUXER, MSGL_DBG2, "FIXED_PTS: %.3f, FIXED_DTS: %.3f\n",
(double) (vpriv->framebuf[i].pts/27000000.0), (double) (vpriv->framebuf[i].dts/27000000.0));
}
return diff;
@@ -1900,7 +1900,7 @@ static size_t parse_mpeg4_video(muxer_stream_t *s, muxer_priv_t *priv, muxer_hea
//warning, it seems that packed bops can lead to delta == 0
pt = vpriv->picture.picture_type + 1;
- mp_msg(MSGT_MUXER, MSGL_DBG2, "\nTYPE: %c, RESOLUTION: %d, TEMP: %d, delta: %d, delta_pts: %"PRId64" = %.3lf, delta2: %.3lf\n",
+ mp_msg(MSGT_MUXER, MSGL_DBG2, "\nTYPE: %c, RESOLUTION: %d, TEMP: %d, delta: %d, delta_pts: %"PRId64" = %.3f, delta2: %.3f\n",
FTYPE(pt), vpriv->picture.timeinc_resolution, vpriv->picture.timeinc_unit, delta, delta_pts, (double) (delta_pts/27000000.0),
(double) delta / (double) vpriv->picture.timeinc_resolution);
@@ -1933,13 +1933,13 @@ static size_t parse_mpeg4_video(muxer_stream_t *s, muxer_priv_t *priv, muxer_hea
vpriv->last_pts += vpriv->frame_duration;
vpriv->last_dts = vpriv->framebuf[vpriv->framebuf_used-1].dts;
vpriv->delta_clock = ((double) vpriv->frame_duration)/27000000.0;
- mp_msg(MSGT_MUXER, MSGL_INFO, "FRAME DURATION: %"PRIu64" %.3lf\n",
+ mp_msg(MSGT_MUXER, MSGL_INFO, "FRAME DURATION: %"PRIu64" %.3f\n",
vpriv->frame_duration, (double) (vpriv->frame_duration/27000000.0));
vpriv->is_ready = 1;
}
}
- mp_msg(MSGT_MUXER, MSGL_DBG2, "LAST_PTS: %.3lf, LAST_DTS: %.3lf\n",
+ mp_msg(MSGT_MUXER, MSGL_DBG2, "LAST_PTS: %.3f, LAST_DTS: %.3f\n",
(double) (vpriv->last_pts/27000000.0), (double) (vpriv->last_dts/27000000.0));
vpriv->vframes++;
@@ -2305,7 +2305,7 @@ static void mpegfile_write_chunk(muxer_stream_t *s,size_t len,unsigned int flags
if(! spriv->vframes)
{
spriv->last_dts = spriv->last_pts - (uint64_t)(27000000.0f/fps);
- mp_msg(MSGT_MUXER, MSGL_INFO,"INITV: %.3lf, %.3lf, fps: %.3f\r\n", (double) spriv->last_pts/27000000.0f, (double) spriv->last_dts/27000000.0f, fps);
+ mp_msg(MSGT_MUXER, MSGL_INFO,"INITV: %.3f, %.3f, fps: %.3f\r\n", (double) spriv->last_pts/27000000.0f, (double) spriv->last_dts/27000000.0f, fps);
}
if(is_mpeg1(stream_format) || is_mpeg2(stream_format))
@@ -2379,7 +2379,7 @@ static void mpegfile_write_chunk(muxer_stream_t *s,size_t len,unsigned int flags
parse_audio(s, 0, &nf, &fake_timer, priv->init_adelay, priv->drop);
spriv->vframes += nf;
if(! spriv->vframes)
- mp_msg(MSGT_MUXER, MSGL_INFO, "AINIT: %.3lf\r\n", (double) spriv->last_pts/27000000.0f);
+ mp_msg(MSGT_MUXER, MSGL_INFO, "AINIT: %.3f\r\n", (double) spriv->last_pts/27000000.0f);
}
}
@@ -2393,7 +2393,7 @@ static void mpegfile_write_index(muxer_t *muxer)
double fake_timer;
muxer_priv_t *priv = (muxer_priv_t *) muxer->priv;
- mp_msg(MSGT_MUXER, MSGL_INFO, MSGTR_WritingTrailer);
+ mp_tmsg(MSGT_MUXER, MSGL_INFO, "Writing index...\n");
for(i = 0; i < muxer->avih.dwStreams; i++)
{
@@ -2408,14 +2408,14 @@ static void mpegfile_write_index(muxer_t *muxer)
write_mpeg_pack(muxer, NULL, muxer->stream, 1); //insert fake Nav Packet
}
- mp_msg(MSGT_MUXER, MSGL_INFO, "\nOverhead: %.3lf%% (%"PRIu64" / %"PRIu64")\n", 100.0 * (double)priv->headers_size / (double)priv->data_size, priv->headers_size, priv->data_size);
+ mp_msg(MSGT_MUXER, MSGL_INFO, "\nOverhead: %.3f%% (%"PRIu64" / %"PRIu64")\n", 100.0 * (double)priv->headers_size / (double)priv->data_size, priv->headers_size, priv->data_size);
}
static void mpegfile_write_header(muxer_t *muxer)
{
muxer_priv_t *priv = (muxer_priv_t*) muxer->priv;
- mp_msg(MSGT_MUXER, MSGL_INFO, MSGTR_WritingHeader);
+ mp_tmsg(MSGT_MUXER, MSGL_INFO, "Writing header...\n");
priv->headers_cnt++;
@@ -2733,4 +2733,3 @@ int muxer_init_muxer_mpeg(muxer_t *muxer)
muxer->fix_stream_parameters = &fix_parameters;
return 1;
}
-
diff --git a/libmpdemux/muxer_rawaudio.c b/libmpdemux/muxer_rawaudio.c
index 8c86d467d5..24cef1c562 100644
--- a/libmpdemux/muxer_rawaudio.c
+++ b/libmpdemux/muxer_rawaudio.c
@@ -34,7 +34,8 @@ static muxer_stream_t* rawaudiofile_new_stream(muxer_t *muxer,int type){
muxer_stream_t* s;
if (!muxer) return NULL;
if(type==MUXER_TYPE_AUDIO && muxer->avih.dwStreams>=1){
- mp_msg(MSGT_MUXER,MSGL_ERR,MSGTR_TooManyStreams" "MSGTR_RawMuxerOnlyOneStream);
+ mp_msg(MSGT_MUXER, MSGL_ERR, "%s %s", mp_gtext("Too many streams!"),
+ mp_gtext("Rawaudio muxer supports only one audio stream!\n"));
return NULL;
}
s=malloc(sizeof(muxer_stream_t));
@@ -53,12 +54,12 @@ static muxer_stream_t* rawaudiofile_new_stream(muxer_t *muxer,int type){
muxer->avih.dwStreams++;
break;
case MUXER_TYPE_VIDEO:
- mp_msg(MSGT_MUXER,MSGL_WARN,MSGTR_IgnoringVideoStream);
+ mp_tmsg(MSGT_MUXER,MSGL_WARN,"Ignoring video stream!\n");
s->ckid=mmioFOURCC(('0'+s->id/10),('0'+(s->id%10)),'d','c');
s->h.fccType=streamtypeAUDIO;
break;
default:
- mp_msg(MSGT_MUXER,MSGL_ERR,MSGTR_UnknownStreamType,type);
+ mp_tmsg(MSGT_MUXER,MSGL_ERR,"Warning, unknown stream type: %d\n",type);
return NULL;
}
return s;
diff --git a/libmpdemux/parse_mp4.c b/libmpdemux/parse_mp4.c
index bdae91a0fe..2a5ee3a4af 100644
--- a/libmpdemux/parse_mp4.c
+++ b/libmpdemux/parse_mp4.c
@@ -33,7 +33,7 @@
#define MP4_DL MSGL_V
#define freereturn(a,b) free(a); return b
-int mp4_read_descr_len(stream_t *s) {
+static int mp4_read_descr_len(stream_t *s) {
uint8_t b;
uint8_t numBytes = 0;
uint32_t length = 0;
@@ -170,4 +170,3 @@ void mp4_free_esds(esds_t *esds) {
#undef freereturn
#undef MP4_DL
-
diff --git a/libmpdemux/parse_mp4.h b/libmpdemux/parse_mp4.h
index 3b81fef99b..27d4d44d7d 100644
--- a/libmpdemux/parse_mp4.h
+++ b/libmpdemux/parse_mp4.h
@@ -125,4 +125,3 @@ int mp4_parse_esds(unsigned char *data, int datalen, esds_t *esds);
void mp4_free_esds(esds_t *esds);
#endif /* MPLAYER_PARSE_MP4_H */
-
diff --git a/libmpdemux/stheader.h b/libmpdemux/stheader.h
index 99ae63ad0d..b11b886ce1 100644
--- a/libmpdemux/stheader.h
+++ b/libmpdemux/stheader.h
@@ -19,15 +19,17 @@
#ifndef MPLAYER_STHEADER_H
#define MPLAYER_STHEADER_H
-#include "demuxer.h"
#include "aviheader.h"
#include "ms_hdr.h"
+struct MPOpts;
+struct demuxer;
// Stream headers:
#define SH_COMMON \
- demux_stream_t *ds; \
- struct codecs_st *codec; \
+ struct MPOpts *opts; \
+ struct demux_stream *ds; \
+ struct codecs *codec; \
unsigned int format; \
int initialized; \
float stream_delay; /* number of seconds stream should be delayed (according to dwStart or similar) */ \
@@ -43,11 +45,11 @@
char* lang; /* track language */ \
int default_track; \
-typedef struct {
+typedef struct sh_common {
SH_COMMON
} sh_common_t;
-typedef struct {
+typedef struct sh_audio {
SH_COMMON
int aid;
// output format:
@@ -72,8 +74,8 @@ typedef struct {
int a_out_buffer_len;
int a_out_buffer_size;
// void* audio_out; // the audio_out handle, used for this audio stream
- struct af_stream_s *afilter; // the audio filter stream
- struct ad_functions_s* ad_driver;
+ struct af_stream *afilter; // the audio filter stream
+ struct ad_functions *ad_driver;
#ifdef CONFIG_DYNAMIC_PLUGINS
void *dec_handle;
#endif
@@ -86,7 +88,7 @@ typedef struct {
int pts_bytes; // bytes output by decoder after last known pts
} sh_audio_t;
-typedef struct {
+typedef struct sh_video {
SH_COMMON
int vid;
float timer; // absolute time in video stream, since last start/seek
@@ -99,6 +101,13 @@ typedef struct {
double last_pts;
double buffered_pts[20];
int num_buffered_pts;
+ double codec_reordered_pts;
+ double prev_codec_reordered_pts;
+ int num_reordered_pts_problems;
+ double sorted_pts;
+ double prev_sorted_pts;
+ int num_sorted_pts_problems;
+ int pts_assoc_mode;
// output format: (set by demuxer)
float fps; // frames per second (set only if constant fps)
float frametime; // 1/fps
@@ -108,7 +117,9 @@ typedef struct {
int disp_w,disp_h; // display size (filled by fileformat parser)
// output driver/filters: (set by libmpcodecs core)
unsigned int outfmtidx;
- struct vf_instance_s *vfilter; // the video filter chain, used for this video stream
+ struct vf_instance *vfilter; // the video filter chain, used for this video stream
+ int output_flags; // query_format() results for output filters+vo
+ const struct vd_functions *vd_driver;
int vf_initialized;
#ifdef CONFIG_DYNAMIC_PLUGINS
void *dec_handle;
@@ -119,25 +130,23 @@ typedef struct {
void* ImageDesc; // for quicktime codecs
} sh_video_t;
-typedef struct {
+typedef struct sh_sub {
SH_COMMON
int sid;
char type; // t = text, v = VobSub, a = SSA/ASS
unsigned char* extradata; // extra header data passed from demuxer
int extradata_len;
-#ifdef CONFIG_ASS
- ass_track_t* ass_track; // for SSA/ASS streams (type == 'a')
-#endif
+ struct ass_track *ass_track; // for SSA/ASS streams (type == 'a')
} sh_sub_t;
// demuxer.c:
#define new_sh_audio(d, i) new_sh_audio_aid(d, i, i)
-sh_audio_t* new_sh_audio_aid(demuxer_t *demuxer,int id,int aid);
+sh_audio_t* new_sh_audio_aid(struct demuxer *demuxer,int id,int aid);
#define new_sh_video(d, i) new_sh_video_vid(d, i, i)
-sh_video_t* new_sh_video_vid(demuxer_t *demuxer,int id,int vid);
+sh_video_t* new_sh_video_vid(struct demuxer *demuxer,int id,int vid);
#define new_sh_sub(d, i) new_sh_sub_sid(d, i, i)
-sh_sub_t *new_sh_sub_sid(demuxer_t *demuxer, int id, int sid);
-void free_sh_audio(demuxer_t *demuxer, int id);
+sh_sub_t *new_sh_sub_sid(struct demuxer *demuxer, int id, int sid);
+void free_sh_audio(struct demuxer *demuxer, int id);
void free_sh_video(sh_video_t *sh);
// video.c:
diff --git a/libmpdemux/video.c b/libmpdemux/video.c
index 6b507b0d57..ff6bbd0bc9 100644
--- a/libmpdemux/video.c
+++ b/libmpdemux/video.c
@@ -132,7 +132,7 @@ switch(video_codec){
videobuffer=(char*)memalign(8,VIDEOBUFFER_SIZE + MP_INPUT_BUFFER_PADDING_SIZE);
if (videobuffer) memset(videobuffer+VIDEOBUFFER_SIZE, 0, MP_INPUT_BUFFER_PADDING_SIZE);
else {
- mp_msg(MSGT_DECVIDEO,MSGL_ERR,MSGTR_ShMemAllocFail);
+ mp_tmsg(MSGT_DECVIDEO,MSGL_ERR,"Cannot allocate shared memory.\n");
return 0;
}
}
@@ -225,7 +225,7 @@ switch(video_codec){
videobuffer=(char*)memalign(8,VIDEOBUFFER_SIZE + MP_INPUT_BUFFER_PADDING_SIZE);
if (videobuffer) memset(videobuffer+VIDEOBUFFER_SIZE, 0, MP_INPUT_BUFFER_PADDING_SIZE);
else {
- mp_msg(MSGT_DECVIDEO,MSGL_ERR,MSGTR_ShMemAllocFail);
+ mp_tmsg(MSGT_DECVIDEO,MSGL_ERR,"Cannot allocate shared memory.\n");
return 0;
}
}
@@ -280,7 +280,7 @@ mpeg_header_parser:
if(i==0x1B3) break; // found it!
if(!i || !skip_video_packet(d_video)){
if( mp_msg_test(MSGT_DECVIDEO,MSGL_V) ) mp_msg(MSGT_DECVIDEO,MSGL_V,"NONE :(\n");
- mp_msg(MSGT_DECVIDEO,MSGL_ERR,MSGTR_MpegNoSequHdr);
+ mp_tmsg(MSGT_DECVIDEO,MSGL_ERR,"MPEG: FATAL: EOF while searching for sequence header.\n");
return 0;
}
}
@@ -290,27 +290,27 @@ mpeg_header_parser:
videobuffer=(char*)memalign(8,VIDEOBUFFER_SIZE + MP_INPUT_BUFFER_PADDING_SIZE);
if (videobuffer) memset(videobuffer+VIDEOBUFFER_SIZE, 0, MP_INPUT_BUFFER_PADDING_SIZE);
else {
- mp_msg(MSGT_DECVIDEO,MSGL_ERR,MSGTR_ShMemAllocFail);
+ mp_tmsg(MSGT_DECVIDEO,MSGL_ERR,"Cannot allocate shared memory.\n");
return 0;
}
}
if(!read_video_packet(d_video)){
- mp_msg(MSGT_DECVIDEO,MSGL_ERR,MSGTR_CannotReadMpegSequHdr);
+ mp_tmsg(MSGT_DECVIDEO,MSGL_ERR,"FATAL: Cannot read sequence header.\n");
return 0;
}
if(mp_header_process_sequence_header (&picture, &videobuffer[4])) {
- mp_msg(MSGT_DECVIDEO,MSGL_ERR,MSGTR_BadMpegSequHdr);
+ mp_tmsg(MSGT_DECVIDEO,MSGL_ERR,"MPEG: bad sequence header\n");
goto mpeg_header_parser;
}
if(sync_video_packet(d_video)==0x1B5){ // next packet is seq. ext.
int pos=videobuf_len;
if(!read_video_packet(d_video)){
- mp_msg(MSGT_DECVIDEO,MSGL_ERR,MSGTR_CannotReadMpegSequHdrEx);
+ mp_tmsg(MSGT_DECVIDEO,MSGL_ERR,"FATAL: Cannot read sequence header extension.\n");
return 0;
}
if(mp_header_process_extension (&picture, &videobuffer[pos+4])) {
- mp_msg(MSGT_DECVIDEO,MSGL_ERR,MSGTR_BadMpegSequHdrEx);
+ mp_tmsg(MSGT_DECVIDEO,MSGL_ERR,"MPEG: bad sequence header extension\n");
return 0;
}
}
@@ -358,7 +358,7 @@ mpeg_header_parser:
videobuffer=(char*)memalign(8,VIDEOBUFFER_SIZE + MP_INPUT_BUFFER_PADDING_SIZE);
if (videobuffer) memset(videobuffer+VIDEOBUFFER_SIZE, 0, MP_INPUT_BUFFER_PADDING_SIZE);
else {
- mp_msg(MSGT_DECVIDEO,MSGL_ERR,MSGTR_ShMemAllocFail);
+ mp_tmsg(MSGT_DECVIDEO,MSGL_ERR,"Cannot allocate shared memory.\n");
return 0;
}
}
@@ -492,14 +492,14 @@ int video_read_frame(sh_video_t* sh_video,float* frame_time_ptr,unsigned char**
if(telecine){
frame_time=1;
if(telecine_cnt<-1.5 || telecine_cnt>1.5){
- mp_msg(MSGT_DECVIDEO,MSGL_INFO,MSGTR_LeaveTelecineMode);
+ mp_tmsg(MSGT_DECVIDEO,MSGL_INFO,"\ndemux_mpg: 30000/1001fps NTSC content detected, switching framerate.\n");
telecine=0;
}
} else
if(telecine_cnt>-0.5 && telecine_cnt<0.5 && !force_fps){
sh_video->fps=sh_video->fps*4/5;
sh_video->frametime=sh_video->frametime*5/4;
- mp_msg(MSGT_DECVIDEO,MSGL_INFO,MSGTR_EnterTelecineMode);
+ mp_tmsg(MSGT_DECVIDEO,MSGL_INFO,"\ndemux_mpg: 24000/1001fps progressive NTSC content detected, switching framerate.\n");
telecine=1;
}
} else if(video_codec == VIDEO_MPEG4){
@@ -646,4 +646,3 @@ int video_read_frame(sh_video_t* sh_video,float* frame_time_ptr,unsigned char**
if(frame_time_ptr) *frame_time_ptr=frame_time;
return in_size;
}
-
diff --git a/libmpdemux/yuv4mpeg.c b/libmpdemux/yuv4mpeg.c
index cb78176ea6..efee4e18bf 100644
--- a/libmpdemux/yuv4mpeg.c
+++ b/libmpdemux/yuv4mpeg.c
@@ -764,5 +764,3 @@ const char *y4m_strerr(int err)
return "unknown error code";
}
}
-
-
diff --git a/libmpdemux/yuv4mpeg.h b/libmpdemux/yuv4mpeg.h
index fd4dba805a..6e97662111 100644
--- a/libmpdemux/yuv4mpeg.h
+++ b/libmpdemux/yuv4mpeg.h
@@ -450,5 +450,3 @@ int y4m_allow_unknown_tags(int yn);
************************************************************************/
#endif /* MPLAYER_YUV4MPEG_H */
-
-
diff --git a/libmpdemux/yuv4mpeg_ratio.c b/libmpdemux/yuv4mpeg_ratio.c
index a9169fa4de..be5475c1b1 100644
--- a/libmpdemux/yuv4mpeg_ratio.c
+++ b/libmpdemux/yuv4mpeg_ratio.c
@@ -110,4 +110,3 @@ int y4m_parse_ratio(y4m_ratio_t *r, const char *s)
y4m_ratio_reduce(r);
return Y4M_OK;
}
-
diff --git a/libswscale/Makefile b/libswscale/Makefile
deleted file mode 100644
index 9ae28e07ef..0000000000
--- a/libswscale/Makefile
+++ /dev/null
@@ -1,23 +0,0 @@
-include $(SUBDIR)../config.mak
-
-NAME = swscale
-FFLIBS = avutil
-
-HEADERS = swscale.h
-
-OBJS = options.o rgb2rgb.o swscale.o utils.o yuv2rgb.o
-
-OBJS-$(ARCH_BFIN) += bfin/internal_bfin.o \
- bfin/swscale_bfin.o \
- bfin/yuv2rgb_bfin.o
-OBJS-$(CONFIG_MLIB) += mlib/yuv2rgb_mlib.o
-OBJS-$(HAVE_ALTIVEC) += ppc/yuv2rgb_altivec.o
-OBJS-$(HAVE_VIS) += sparc/yuv2rgb_vis.o
-
-MMX-OBJS-$(CONFIG_GPL) += x86/yuv2rgb_mmx.o \
-
-TESTPROGS = colorspace swscale
-
-DIRS = bfin mlib ppc sparc x86
-
-include $(SUBDIR)../subdir.mak
diff --git a/libswscale/bfin/internal_bfin.S b/libswscale/bfin/internal_bfin.S
deleted file mode 100644
index 98f69ef53f..0000000000
--- a/libswscale/bfin/internal_bfin.S
+++ /dev/null
@@ -1,606 +0,0 @@
-/*
- * Copyright (C) 2007 Marc Hoffman <marc.hoffman@analog.com>
- * April 20, 2007
- *
- * Blackfin video color space converter operations
- * convert I420 YV12 to RGB in various formats
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * FFmpeg 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-
-/*
-YUV420 to RGB565 conversion. This routine takes a YUV 420 planar macroblock
-and converts it to RGB565. R:5 bits, G:6 bits, B:5 bits.. packed into shorts.
-
-
-The following calculation is used for the conversion:
-
- r = clipz((y-oy)*cy + crv*(v-128))
- g = clipz((y-oy)*cy + cgv*(v-128) + cgu*(u-128))
- b = clipz((y-oy)*cy + cbu*(u-128))
-
-y,u,v are prescaled by a factor of 4 i.e. left-shifted to gain precision.
-
-
-New factorization to eliminate the truncation error which was
-occurring due to the byteop3p.
-
-
-1) Use the bytop16m to subtract quad bytes we use this in U8 this
- then so the offsets need to be renormalized to 8bits.
-
-2) Scale operands up by a factor of 4 not 8 because Blackfin
- multiplies include a shift.
-
-3) Compute into the accumulators cy*yx0, cy*yx1.
-
-4) Compute each of the linear equations:
- r = clipz((y - oy) * cy + crv * (v - 128))
-
- g = clipz((y - oy) * cy + cgv * (v - 128) + cgu * (u - 128))
-
- b = clipz((y - oy) * cy + cbu * (u - 128))
-
- Reuse of the accumulators requires that we actually multiply
- twice once with addition and the second time with a subtraction.
-
- Because of this we need to compute the equations in the order R B
- then G saving the writes for B in the case of 24/32 bit color
- formats.
-
- API: yuv2rgb_kind (uint8_t *Y, uint8_t *U, uint8_t *V, int *out,
- int dW, uint32_t *coeffs);
-
- A B
- --- ---
- i2 = cb i3 = cr
- i1 = coeff i0 = y
-
-Where coeffs have the following layout in memory.
-
-uint32_t oy,oc,zero,cy,crv,rmask,cbu,bmask,cgu,cgv;
-
-coeffs is a pointer to oy.
-
-The {rgb} masks are only utilized by the 565 packing algorithm. Note the data
-replication is used to simplify the internal algorithms for the dual Mac
-architecture of BlackFin.
-
-All routines are exported with _ff_bfin_ as a symbol prefix.
-
-Rough performance gain compared against -O3:
-
-2779809/1484290 187.28%
-
-which translates to ~33c/pel to ~57c/pel for the reference vs 17.5
-c/pel for the optimized implementations. Not sure why there is such a
-huge variation on the reference codes on Blackfin I guess it must have
-to do with the memory system.
-*/
-
-#define mL3 .text
-#if defined(__FDPIC__) && CONFIG_SRAM
-#define mL1 .l1.text
-#else
-#define mL1 mL3
-#endif
-#define MEM mL1
-
-#define DEFUN(fname,where,interface) \
- .section where; \
- .global _ff_bfin_ ## fname; \
- .type _ff_bfin_ ## fname, STT_FUNC; \
- .align 8; \
- _ff_bfin_ ## fname
-
-#define DEFUN_END(fname) \
- .size _ff_bfin_ ## fname, . - _ff_bfin_ ## fname
-
-
-.text
-
-#define COEFF_LEN 11*4
-#define COEFF_REL_CY_OFF 4*4
-
-#define ARG_OUT 20
-#define ARG_W 24
-#define ARG_COEFF 28
-
-DEFUN(yuv2rgb565_line,MEM,
- (uint8_t *Y, uint8_t *U, uint8_t *V, int *out, int dW, uint32_t *coeffs)):
- link 0;
- [--sp] = (r7:4);
- p1 = [fp+ARG_OUT];
- r3 = [fp+ARG_W];
-
- i0 = r0;
- i2 = r1;
- i3 = r2;
-
- r0 = [fp+ARG_COEFF];
- i1 = r0;
- b1 = i1;
- l1 = COEFF_LEN;
- m0 = COEFF_REL_CY_OFF;
- p0 = r3;
-
- r0 = [i0++]; // 2Y
- r1.l = w[i2++]; // 2u
- r1.h = w[i3++]; // 2v
- p0 = p0>>2;
-
- lsetup (.L0565, .L1565) lc0 = p0;
-
- /*
- uint32_t oy,oc,zero,cy,crv,rmask,cbu,bmask,cgu,cgv
- r0 -- used to load 4ys
- r1 -- used to load 2us,2vs
- r4 -- y3,y2
- r5 -- y1,y0
- r6 -- u1,u0
- r7 -- v1,v0
- */
- r2=[i1++]; // oy
-.L0565:
- /*
- rrrrrrrr gggggggg bbbbbbbb
- 5432109876543210
- bbbbb >>3
- gggggggg <<3
- rrrrrrrr <<8
- rrrrrggggggbbbbb
- */
- (r4,r5) = byteop16m (r1:0, r3:2) || r3=[i1++]; // oc
- (r7,r6) = byteop16m (r1:0, r3:2) (r);
- r5 = r5 << 2 (v); // y1,y0
- r4 = r4 << 2 (v); // y3,y2
- r6 = r6 << 2 (v) || r0=[i1++]; // u1,u0, r0=zero
- r7 = r7 << 2 (v) || r1=[i1++]; // v1,v0 r1=cy
- /* Y' = y*cy */
- a1 = r1.h*r5.h, a0 = r1.l*r5.l || r1=[i1++]; // crv
-
- /* R = Y+ crv*(Cr-128) */
- r2.h = (a1 += r1.h*r7.l), r2.l = (a0 += r1.l*r7.l);
- a1 -= r1.h*r7.l, a0 -= r1.l*r7.l || r5=[i1++]; // rmask
- r2 = byteop3p(r3:2, r1:0)(LO) || r1=[i1++]; // cbu
- r2 = r2 >> 3 (v);
- r3 = r2 & r5;
-
- /* B = Y+ cbu*(Cb-128) */
- r2.h = (a1 += r1.h*r6.l), r2.l = (a0 += r1.l*r6.l);
- a1 -= r1.h*r6.l, a0 -= r1.l*r6.l || r5=[i1++]; // bmask
- r2 = byteop3p(r3:2, r1:0)(LO) || r1=[i1++]; // cgu
- r2 = r2 << 8 (v);
- r2 = r2 & r5;
- r3 = r3 | r2;
-
- /* G = Y+ cgu*(Cb-128)+cgv*(Cr-128) */
- a1 += r1.h*r6.l, a0 += r1.l*r6.l || r1=[i1++]; // cgv
- r2.h = (a1 += r1.h*r7.l), r2.l = (a0 += r1.l*r7.l);
- r2 = byteop3p(r3:2, r1:0)(LO) || r5=[i1++m0]; // gmask
- r2 = r2 << 3 (v);
- r2 = r2 & r5;
- r3 = r3 | r2;
- [p1++]=r3 || r1=[i1++]; // cy
-
- /* Y' = y*cy */
-
- a1 = r1.h*r4.h, a0 = r1.l*r4.l || r1=[i1++]; // crv
-
- /* R = Y+ crv*(Cr-128) */
- r2.h = (a1 += r1.h*r7.h), r2.l = (a0 += r1.l*r7.h);
- a1 -= r1.h*r7.h, a0 -= r1.l*r7.h || r5=[i1++]; // rmask
- r2 = byteop3p(r3:2, r1:0)(LO) || r1=[i1++]; // cbu
- r2 = r2 >> 3 (v);
- r3 = r2 & r5;
-
- /* B = Y+ cbu*(Cb-128) */
- r2.h = (a1 += r1.h*r6.h), r2.l = (a0 += r1.l*r6.h);
- a1 -= r1.h*r6.h, a0 -= r1.l*r6.h || r5=[i1++]; // bmask
- r2 = byteop3p(r3:2, r1:0)(LO) || r1=[i1++]; // cgu
- r2 = r2 << 8 (v);
- r2 = r2 & r5;
- r3 = r3 | r2;
-
- /* G = Y+ cgu*(Cb-128)+cgv*(Cr-128) */
- a1 += r1.h*r6.h, a0 += r1.l*r6.h || r1=[i1++]; // cgv
- r2.h = (a1 += r1.h*r7.h), r2.l = (a0 += r1.l*r7.h) || r5=[i1++]; // gmask
- r2 = byteop3p(r3:2, r1:0)(LO) || r0 = [i0++]; // 2Y
- r2 = r2 << 3 (v) || r1.l = w[i2++]; // 2u
- r2 = r2 & r5;
- r3 = r3 | r2;
- [p1++]=r3 || r1.h = w[i3++]; // 2v
-.L1565: r2=[i1++]; // oy
-
- l1 = 0;
-
- (r7:4) = [sp++];
- unlink;
- rts;
-DEFUN_END(yuv2rgb565_line)
-
-DEFUN(yuv2rgb555_line,MEM,
- (uint8_t *Y, uint8_t *U, uint8_t *V, int *out, int dW, uint32_t *coeffs)):
- link 0;
- [--sp] = (r7:4);
- p1 = [fp+ARG_OUT];
- r3 = [fp+ARG_W];
-
- i0 = r0;
- i2 = r1;
- i3 = r2;
-
- r0 = [fp+ARG_COEFF];
- i1 = r0;
- b1 = i1;
- l1 = COEFF_LEN;
- m0 = COEFF_REL_CY_OFF;
- p0 = r3;
-
- r0 = [i0++]; // 2Y
- r1.l = w[i2++]; // 2u
- r1.h = w[i3++]; // 2v
- p0 = p0>>2;
-
- lsetup (.L0555, .L1555) lc0 = p0;
-
- /*
- uint32_t oy,oc,zero,cy,crv,rmask,cbu,bmask,cgu,cgv
- r0 -- used to load 4ys
- r1 -- used to load 2us,2vs
- r4 -- y3,y2
- r5 -- y1,y0
- r6 -- u1,u0
- r7 -- v1,v0
- */
- r2=[i1++]; // oy
-.L0555:
- /*
- rrrrrrrr gggggggg bbbbbbbb
- 5432109876543210
- bbbbb >>3
- gggggggg <<2
- rrrrrrrr <<7
- xrrrrrgggggbbbbb
- */
-
- (r4,r5) = byteop16m (r1:0, r3:2) || r3=[i1++]; // oc
- (r7,r6) = byteop16m (r1:0, r3:2) (r);
- r5 = r5 << 2 (v); // y1,y0
- r4 = r4 << 2 (v); // y3,y2
- r6 = r6 << 2 (v) || r0=[i1++]; // u1,u0, r0=zero
- r7 = r7 << 2 (v) || r1=[i1++]; // v1,v0 r1=cy
- /* Y' = y*cy */
- a1 = r1.h*r5.h, a0 = r1.l*r5.l || r1=[i1++]; // crv
-
- /* R = Y+ crv*(Cr-128) */
- r2.h = (a1 += r1.h*r7.l), r2.l = (a0 += r1.l*r7.l);
- a1 -= r1.h*r7.l, a0 -= r1.l*r7.l || r5=[i1++]; // rmask
- r2 = byteop3p(r3:2, r1:0)(LO) || r1=[i1++]; // cbu
- r2 = r2 >> 3 (v);
- r3 = r2 & r5;
-
- /* B = Y+ cbu*(Cb-128) */
- r2.h = (a1 += r1.h*r6.l), r2.l = (a0 += r1.l*r6.l);
- a1 -= r1.h*r6.l, a0 -= r1.l*r6.l || r5=[i1++]; // bmask
- r2 = byteop3p(r3:2, r1:0)(LO) || r1=[i1++]; // cgu
- r2 = r2 << 7 (v);
- r2 = r2 & r5;
- r3 = r3 | r2;
-
- /* G = Y+ cgu*(Cb-128)+cgv*(Cr-128) */
- a1 += r1.h*r6.l, a0 += r1.l*r6.l || r1=[i1++]; // cgv
- r2.h = (a1 += r1.h*r7.l), r2.l = (a0 += r1.l*r7.l);
- r2 = byteop3p(r3:2, r1:0)(LO) || r5=[i1++m0]; // gmask
- r2 = r2 << 2 (v);
- r2 = r2 & r5;
- r3 = r3 | r2;
- [p1++]=r3 || r1=[i1++]; // cy
-
- /* Y' = y*cy */
-
- a1 = r1.h*r4.h, a0 = r1.l*r4.l || r1=[i1++]; // crv
-
- /* R = Y+ crv*(Cr-128) */
- r2.h = (a1 += r1.h*r7.h), r2.l = (a0 += r1.l*r7.h);
- a1 -= r1.h*r7.h, a0 -= r1.l*r7.h || r5=[i1++]; // rmask
- r2 = byteop3p(r3:2, r1:0)(LO) || r1=[i1++]; // cbu
- r2 = r2 >> 3 (v);
- r3 = r2 & r5;
-
- /* B = Y+ cbu*(Cb-128) */
- r2.h = (a1 += r1.h*r6.h), r2.l = (a0 += r1.l*r6.h);
- a1 -= r1.h*r6.h, a0 -= r1.l*r6.h || r5=[i1++]; // bmask
- r2 = byteop3p(r3:2, r1:0)(LO) || r1=[i1++]; // cgu
- r2 = r2 << 7 (v);
- r2 = r2 & r5;
- r3 = r3 | r2;
-
- /* G = Y+ cgu*(Cb-128)+cgv*(Cr-128) */
- a1 += r1.h*r6.h, a0 += r1.l*r6.h || r1=[i1++]; // cgv
- r2.h = (a1 += r1.h*r7.h), r2.l = (a0 += r1.l*r7.h) || r5=[i1++]; // gmask
- r2 = byteop3p(r3:2, r1:0)(LO) || r0=[i0++]; // 4Y
- r2 = r2 << 2 (v) || r1.l=w[i2++]; // 2u
- r2 = r2 & r5;
- r3 = r3 | r2;
- [p1++]=r3 || r1.h=w[i3++]; // 2v
-
-.L1555: r2=[i1++]; // oy
-
- l1 = 0;
-
- (r7:4) = [sp++];
- unlink;
- rts;
-DEFUN_END(yuv2rgb555_line)
-
-DEFUN(yuv2rgb24_line,MEM,
- (uint8_t *Y, uint8_t *U, uint8_t *V, int *out, int dW, uint32_t *coeffs)):
- link 0;
- [--sp] = (r7:4);
- p1 = [fp+ARG_OUT];
- r3 = [fp+ARG_W];
- p2 = p1;
- p2 += 3;
-
- i0 = r0;
- i2 = r1;
- i3 = r2;
-
- r0 = [fp+ARG_COEFF]; // coeff buffer
- i1 = r0;
- b1 = i1;
- l1 = COEFF_LEN;
- m0 = COEFF_REL_CY_OFF;
- p0 = r3;
-
- r0 = [i0++]; // 2Y
- r1.l = w[i2++]; // 2u
- r1.h = w[i3++]; // 2v
- p0 = p0>>2;
-
- lsetup (.L0888, .L1888) lc0 = p0;
-
- /*
- uint32_t oy,oc,zero,cy,crv,rmask,cbu,bmask,cgu,cgv
- r0 -- used to load 4ys
- r1 -- used to load 2us,2vs
- r4 -- y3,y2
- r5 -- y1,y0
- r6 -- u1,u0
- r7 -- v1,v0
- */
- r2=[i1++]; // oy
-.L0888:
- (r4,r5) = byteop16m (r1:0, r3:2) || r3=[i1++]; // oc
- (r7,r6) = byteop16m (r1:0, r3:2) (r);
- r5 = r5 << 2 (v); // y1,y0
- r4 = r4 << 2 (v); // y3,y2
- r6 = r6 << 2 (v) || r0=[i1++]; // u1,u0, r0=zero
- r7 = r7 << 2 (v) || r1=[i1++]; // v1,v0 r1=cy
-
- /* Y' = y*cy */
- a1 = r1.h*r5.h, a0 = r1.l*r5.l || r1=[i1++]; // crv
-
- /* R = Y+ crv*(Cr-128) */
- r2.h = (a1 += r1.h*r7.l), r2.l = (a0 += r1.l*r7.l);
- a1 -= r1.h*r7.l, a0 -= r1.l*r7.l || r5=[i1++]; // rmask
- r2 = byteop3p(r3:2, r1:0)(LO) || r1=[i1++]; // cbu
- r2=r2>>16 || B[p1++]=r2;
- B[p2++]=r2;
-
- /* B = Y+ cbu*(Cb-128) */
- r2.h = (a1 += r1.h*r6.l), r2.l = (a0 += r1.l*r6.l);
- a1 -= r1.h*r6.l, a0 -= r1.l*r6.l || r5=[i1++]; // bmask
- r3 = byteop3p(r3:2, r1:0)(LO) || r1=[i1++]; // cgu
-
- /* G = Y+ cgu*(Cb-128)+cgv*(Cr-128) */
- a1 += r1.h*r6.l, a0 += r1.l*r6.l || r1=[i1++]; // cgv
- r2.h = (a1 += r1.h*r7.l), r2.l = (a0 += r1.l*r7.l);
- r2 = byteop3p(r3:2, r1:0)(LO) || r5=[i1++m0]; // gmask, oy,cy,zero
-
- r2=r2>>16 || B[p1++]=r2;
- B[p2++]=r2;
-
- r3=r3>>16 || B[p1++]=r3;
- B[p2++]=r3 || r1=[i1++]; // cy
-
- p1+=3;
- p2+=3;
- /* Y' = y*cy */
- a1 = r1.h*r4.h, a0 = r1.l*r4.l || r1=[i1++]; // crv
-
- /* R = Y+ crv*(Cr-128) */
- r2.h = (a1 += r1.h*r7.h), r2.l = (a0 += r1.l*r7.h);
- a1 -= r1.h*r7.h, a0 -= r1.l*r7.h || r5=[i1++]; // rmask
- r2 = byteop3p(r3:2, r1:0)(LO) || r1=[i1++]; // cbu
- r2=r2>>16 || B[p1++]=r2;
- B[p2++]=r2;
-
- /* B = Y+ cbu*(Cb-128) */
- r2.h = (a1 += r1.h*r6.h), r2.l = (a0 += r1.l*r6.h);
- a1 -= r1.h*r6.h, a0 -= r1.l*r6.h || r5=[i1++]; // bmask
- r3 = byteop3p(r3:2, r1:0)(LO) || r1=[i1++]; // cgu
-
- /* G = Y+ cgu*(Cb-128)+cgv*(Cr-128) */
- a1 += r1.h*r6.h, a0 += r1.l*r6.h || r1=[i1++]; // cgv
- r2.h = (a1 += r1.h*r7.h), r2.l = (a0 += r1.l*r7.h);
- r2 = byteop3p(r3:2, r1:0)(LO) || r5=[i1++]; // gmask
- r2=r2>>16 || B[p1++]=r2 || r0 = [i0++]; // 4y
- B[p2++]=r2 || r1.l = w[i2++]; // 2u
- r3=r3>>16 || B[p1++]=r3 || r1.h = w[i3++]; // 2v
- B[p2++]=r3 || r2=[i1++]; // oy
-
- p1+=3;
-.L1888: p2+=3;
-
- l1 = 0;
-
- (r7:4) = [sp++];
- unlink;
- rts;
-DEFUN_END(yuv2rgb24_line)
-
-
-
-#define ARG_vdst 20
-#define ARG_width 24
-#define ARG_height 28
-#define ARG_lumStride 32
-#define ARG_chromStride 36
-#define ARG_srcStride 40
-
-DEFUN(uyvytoyv12, mL3, (const uint8_t *src, uint8_t *ydst, uint8_t *udst, uint8_t *vdst,
- long width, long height,
- long lumStride, long chromStride, long srcStride)):
- link 0;
- [--sp] = (r7:4,p5:4);
-
- p0 = r1; // Y top even
-
- i2 = r2; // *u
- r2 = [fp + ARG_vdst];
- i3 = r2; // *v
-
- r1 = [fp + ARG_srcStride];
- r2 = r0 + r1;
- r1 += -8; // i0,i1 is pre read need to correct
- m0 = r1;
-
- i0 = r0; // uyvy_T even
- i1 = r2; // uyvy_B odd
-
- p2 = [fp + ARG_lumStride];
- p1 = p0 + p2; // Y bot odd
-
- p5 = [fp + ARG_width];
- p4 = [fp + ARG_height];
- r0 = p5;
- p4 = p4 >> 1;
- p5 = p5 >> 2;
-
- r2 = [fp + ARG_chromStride];
- r0 = r0 >> 1;
- r2 = r2 - r0;
- m1 = r2;
-
- /* I0,I1 - src input line pointers
- * p0,p1 - luma output line pointers
- * I2 - dstU
- * I3 - dstV
- */
-
- lsetup (0f, 1f) lc1 = p4; // H/2
-0: r0 = [i0++] || r2 = [i1++];
- r1 = [i0++] || r3 = [i1++];
- r4 = byteop1p(r1:0, r3:2);
- r5 = byteop1p(r1:0, r3:2) (r);
- lsetup (2f, 3f) lc0 = p5; // W/4
-2: r0 = r0 >> 8(v);
- r1 = r1 >> 8(v);
- r2 = r2 >> 8(v);
- r3 = r3 >> 8(v);
- r0 = bytepack(r0, r1);
- r2 = bytepack(r2, r3) || [p0++] = r0; // yyyy
- r6 = pack(r5.l, r4.l) || [p1++] = r2; // yyyy
- r7 = pack(r5.h, r4.h) || r0 = [i0++] || r2 = [i1++];
- r6 = bytepack(r6, r7) || r1 = [i0++] || r3 = [i1++];
- r4 = byteop1p(r1:0, r3:2) || w[i2++] = r6.l; // uu
-3: r5 = byteop1p(r1:0, r3:2) (r) || w[i3++] = r6.h; // vv
-
- i0 += m0;
- i1 += m0;
- i2 += m1;
- i3 += m1;
- p0 = p0 + p2;
-1: p1 = p1 + p2;
-
- (r7:4,p5:4) = [sp++];
- unlink;
- rts;
-DEFUN_END(uyvytoyv12)
-
-DEFUN(yuyvtoyv12, mL3, (const uint8_t *src, uint8_t *ydst, uint8_t *udst, uint8_t *vdst,
- long width, long height,
- long lumStride, long chromStride, long srcStride)):
- link 0;
- [--sp] = (r7:4,p5:4);
-
- p0 = r1; // Y top even
-
- i2 = r2; // *u
- r2 = [fp + ARG_vdst];
- i3 = r2; // *v
-
- r1 = [fp + ARG_srcStride];
- r2 = r0 + r1;
- r1 += -8; // i0,i1 is pre read need to correct
- m0 = r1;
-
- i0 = r0; // uyvy_T even
- i1 = r2; // uyvy_B odd
-
- p2 = [fp + ARG_lumStride];
- p1 = p0 + p2; // Y bot odd
-
- p5 = [fp + ARG_width];
- p4 = [fp + ARG_height];
- r0 = p5;
- p4 = p4 >> 1;
- p5 = p5 >> 2;
-
- r2 = [fp + ARG_chromStride];
- r0 = r0 >> 1;
- r2 = r2 - r0;
- m1 = r2;
-
- /* I0,I1 - src input line pointers
- * p0,p1 - luma output line pointers
- * I2 - dstU
- * I3 - dstV
- */
-
- lsetup (0f, 1f) lc1 = p4; // H/2
-0: r0 = [i0++] || r2 = [i1++];
- r1 = [i0++] || r3 = [i1++];
- r4 = bytepack(r0, r1);
- r5 = bytepack(r2, r3);
- lsetup (2f, 3f) lc0 = p5; // W/4
-2: r0 = r0 >> 8(v) || [p0++] = r4; // yyyy-even
- r1 = r1 >> 8(v) || [p1++] = r5; // yyyy-odd
- r2 = r2 >> 8(v);
- r3 = r3 >> 8(v);
- r4 = byteop1p(r1:0, r3:2);
- r5 = byteop1p(r1:0, r3:2) (r);
- r6 = pack(r5.l, r4.l);
- r7 = pack(r5.h, r4.h) || r0 = [i0++] || r2 = [i1++];
- r6 = bytepack(r6, r7) || r1 = [i0++] || r3 = [i1++];
- r4 = bytepack(r0, r1) || w[i2++] = r6.l; // uu
-3: r5 = bytepack(r2, r3) || w[i3++] = r6.h; // vv
-
- i0 += m0;
- i1 += m0;
- i2 += m1;
- i3 += m1;
- p0 = p0 + p2;
-1: p1 = p1 + p2;
-
- (r7:4,p5:4) = [sp++];
- unlink;
- rts;
-DEFUN_END(yuyvtoyv12)
diff --git a/libswscale/bfin/swscale_bfin.c b/libswscale/bfin/swscale_bfin.c
deleted file mode 100644
index ce2f1720dd..0000000000
--- a/libswscale/bfin/swscale_bfin.c
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * Copyright (C) 2007 Marc Hoffman <marc.hoffman@analog.com>
- *
- * Blackfin software video scaler operations
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * FFmpeg 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <inttypes.h>
-#include <assert.h>
-#include "config.h"
-#include <unistd.h>
-#include "libswscale/rgb2rgb.h"
-#include "libswscale/swscale.h"
-#include "libswscale/swscale_internal.h"
-
-#if defined (__FDPIC__) && CONFIG_SRAM
-#define L1CODE __attribute__ ((l1_text))
-#else
-#define L1CODE
-#endif
-
-int ff_bfin_uyvytoyv12(const uint8_t *src, uint8_t *ydst, uint8_t *udst, uint8_t *vdst,
- long width, long height,
- long lumStride, long chromStride, long srcStride) L1CODE;
-
-int ff_bfin_yuyvtoyv12(const uint8_t *src, uint8_t *ydst, uint8_t *udst, uint8_t *vdst,
- long width, long height,
- long lumStride, long chromStride, long srcStride) L1CODE;
-
-static int uyvytoyv12_unscaled(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY,
- int srcSliceH, uint8_t* dst[], int dstStride[])
-{
- uint8_t *dsty = dst[0] + dstStride[0]*srcSliceY;
- uint8_t *dstu = dst[1] + dstStride[1]*srcSliceY/2;
- uint8_t *dstv = dst[2] + dstStride[2]*srcSliceY/2;
- uint8_t *ip = src[0] + srcStride[0]*srcSliceY;
- int w = dstStride[0];
-
- ff_bfin_uyvytoyv12(ip, dsty, dstu, dstv, w, srcSliceH,
- dstStride[0], dstStride[1], srcStride[0]);
-
- return srcSliceH;
-}
-
-static int yuyvtoyv12_unscaled(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY,
- int srcSliceH, uint8_t* dst[], int dstStride[])
-{
- uint8_t *dsty = dst[0] + dstStride[0]*srcSliceY;
- uint8_t *dstu = dst[1] + dstStride[1]*srcSliceY/2;
- uint8_t *dstv = dst[2] + dstStride[2]*srcSliceY/2;
- uint8_t *ip = src[0] + srcStride[0]*srcSliceY;
- int w = dstStride[0];
-
- ff_bfin_yuyvtoyv12(ip, dsty, dstu, dstv, w, srcSliceH,
- dstStride[0], dstStride[1], srcStride[0]);
-
- return srcSliceH;
-}
-
-
-void ff_bfin_get_unscaled_swscale(SwsContext *c)
-{
- SwsFunc swScale = c->swScale;
- if (c->flags & SWS_CPU_CAPS_BFIN)
- if (c->dstFormat == PIX_FMT_YUV420P)
- if (c->srcFormat == PIX_FMT_UYVY422) {
- av_log (NULL, AV_LOG_VERBOSE, "selecting Blackfin optimized uyvytoyv12_unscaled\n");
- c->swScale = uyvytoyv12_unscaled;
- }
- if (c->dstFormat == PIX_FMT_YUV420P)
- if (c->srcFormat == PIX_FMT_YUYV422) {
- av_log (NULL, AV_LOG_VERBOSE, "selecting Blackfin optimized yuyvtoyv12_unscaled\n");
- c->swScale = yuyvtoyv12_unscaled;
- }
-}
diff --git a/libswscale/bfin/yuv2rgb_bfin.c b/libswscale/bfin/yuv2rgb_bfin.c
deleted file mode 100644
index eaa83eaf3b..0000000000
--- a/libswscale/bfin/yuv2rgb_bfin.c
+++ /dev/null
@@ -1,203 +0,0 @@
-/*
- * Copyright (C) 2007 Marc Hoffman <marc.hoffman@analog.com>
- *
- * Blackfin video color space converter operations
- * convert I420 YV12 to RGB in various formats
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * FFmpeg 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <inttypes.h>
-#include <assert.h>
-#include "config.h"
-#include <unistd.h>
-#include "libswscale/rgb2rgb.h"
-#include "libswscale/swscale.h"
-#include "libswscale/swscale_internal.h"
-
-#if defined(__FDPIC__) && CONFIG_SRAM
-#define L1CODE __attribute__ ((l1_text))
-#else
-#define L1CODE
-#endif
-
-void ff_bfin_yuv2rgb555_line(uint8_t *Y, uint8_t *U, uint8_t *V, uint8_t *out,
- int w, uint32_t *coeffs) L1CODE;
-
-void ff_bfin_yuv2rgb565_line(uint8_t *Y, uint8_t *U, uint8_t *V, uint8_t *out,
- int w, uint32_t *coeffs) L1CODE;
-
-void ff_bfin_yuv2rgb24_line(uint8_t *Y, uint8_t *U, uint8_t *V, uint8_t *out,
- int w, uint32_t *coeffs) L1CODE;
-
-typedef void (* ltransform)(uint8_t *Y, uint8_t *U, uint8_t *V, uint8_t *out,
- int w, uint32_t *coeffs);
-
-
-static void bfin_prepare_coefficients(SwsContext *c, int rgb, int masks)
-{
- int oy;
- oy = c->yOffset&0xffff;
- oy = oy >> 3; // keep everything U8.0 for offset calculation
-
- c->oc = 128*0x01010101U;
- c->oy = oy*0x01010101U;
-
- /* copy 64bit vector coeffs down to 32bit vector coeffs */
- c->cy = c->yCoeff;
- c->zero = 0;
-
- if (rgb) {
- c->crv = c->vrCoeff;
- c->cbu = c->ubCoeff;
- c->cgu = c->ugCoeff;
- c->cgv = c->vgCoeff;
- } else {
- c->crv = c->ubCoeff;
- c->cbu = c->vrCoeff;
- c->cgu = c->vgCoeff;
- c->cgv = c->ugCoeff;
- }
-
-
- if (masks == 555) {
- c->rmask = 0x001f * 0x00010001U;
- c->gmask = 0x03e0 * 0x00010001U;
- c->bmask = 0x7c00 * 0x00010001U;
- } else if (masks == 565) {
- c->rmask = 0x001f * 0x00010001U;
- c->gmask = 0x07e0 * 0x00010001U;
- c->bmask = 0xf800 * 0x00010001U;
- }
-}
-
-static int core_yuv420_rgb(SwsContext *c,
- uint8_t **in, int *instrides,
- int srcSliceY, int srcSliceH,
- uint8_t **oplanes, int *outstrides,
- ltransform lcscf, int rgb, int masks)
-{
- uint8_t *py,*pu,*pv,*op;
- int w = instrides[0];
- int h2 = srcSliceH>>1;
- int i;
-
- bfin_prepare_coefficients(c, rgb, masks);
-
- py = in[0];
- pu = in[1+(1^rgb)];
- pv = in[1+(0^rgb)];
-
- op = oplanes[0] + srcSliceY*outstrides[0];
-
- for (i=0;i<h2;i++) {
-
- lcscf(py, pu, pv, op, w, &c->oy);
-
- py += instrides[0];
- op += outstrides[0];
-
- lcscf(py, pu, pv, op, w, &c->oy);
-
- py += instrides[0];
- pu += instrides[1];
- pv += instrides[2];
- op += outstrides[0];
- }
-
- return srcSliceH;
-}
-
-
-static int bfin_yuv420_rgb555(SwsContext *c,
- uint8_t **in, int *instrides,
- int srcSliceY, int srcSliceH,
- uint8_t **oplanes, int *outstrides)
-{
- return core_yuv420_rgb(c, in, instrides, srcSliceY, srcSliceH, oplanes,
- outstrides, ff_bfin_yuv2rgb555_line, 1, 555);
-}
-
-static int bfin_yuv420_bgr555(SwsContext *c,
- uint8_t **in, int *instrides,
- int srcSliceY, int srcSliceH,
- uint8_t **oplanes, int *outstrides)
-{
- return core_yuv420_rgb(c, in, instrides, srcSliceY, srcSliceH, oplanes,
- outstrides, ff_bfin_yuv2rgb555_line, 0, 555);
-}
-
-static int bfin_yuv420_rgb24(SwsContext *c,
- uint8_t **in, int *instrides,
- int srcSliceY, int srcSliceH,
- uint8_t **oplanes, int *outstrides)
-{
- return core_yuv420_rgb(c, in, instrides, srcSliceY, srcSliceH, oplanes,
- outstrides, ff_bfin_yuv2rgb24_line, 1, 888);
-}
-
-static int bfin_yuv420_bgr24(SwsContext *c,
- uint8_t **in, int *instrides,
- int srcSliceY, int srcSliceH,
- uint8_t **oplanes, int *outstrides)
-{
- return core_yuv420_rgb(c, in, instrides, srcSliceY, srcSliceH, oplanes,
- outstrides, ff_bfin_yuv2rgb24_line, 0, 888);
-}
-
-static int bfin_yuv420_rgb565(SwsContext *c,
- uint8_t **in, int *instrides,
- int srcSliceY, int srcSliceH,
- uint8_t **oplanes, int *outstrides)
-{
- return core_yuv420_rgb(c, in, instrides, srcSliceY, srcSliceH, oplanes,
- outstrides, ff_bfin_yuv2rgb565_line, 1, 565);
-}
-
-static int bfin_yuv420_bgr565(SwsContext *c,
- uint8_t **in, int *instrides,
- int srcSliceY, int srcSliceH,
- uint8_t **oplanes, int *outstrides)
-{
- return core_yuv420_rgb(c, in, instrides, srcSliceY, srcSliceH, oplanes,
- outstrides, ff_bfin_yuv2rgb565_line, 0, 565);
-}
-
-
-SwsFunc ff_yuv2rgb_get_func_ptr_bfin(SwsContext *c)
-{
- SwsFunc f;
-
- switch(c->dstFormat) {
- case PIX_FMT_RGB555: f = bfin_yuv420_rgb555; break;
- case PIX_FMT_BGR555: f = bfin_yuv420_bgr555; break;
- case PIX_FMT_RGB565: f = bfin_yuv420_rgb565; break;
- case PIX_FMT_BGR565: f = bfin_yuv420_bgr565; break;
- case PIX_FMT_RGB24: f = bfin_yuv420_rgb24; break;
- case PIX_FMT_BGR24: f = bfin_yuv420_bgr24; break;
- default:
- return 0;
- }
-
- av_log(c, AV_LOG_INFO, "BlackFin accelerated color space converter %s\n",
- sws_format_name (c->dstFormat));
-
- return f;
-}
diff --git a/libswscale/colorspace-test.c b/libswscale/colorspace-test.c
deleted file mode 100644
index 5a48065d1f..0000000000
--- a/libswscale/colorspace-test.c
+++ /dev/null
@@ -1,178 +0,0 @@
-/*
- * Copyright (C) 2002 Michael Niedermayer <michaelni@gmx.at>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * FFmpeg 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include <stdio.h>
-#include <string.h> /* for memset() */
-#include <unistd.h>
-#include <stdlib.h>
-#include <inttypes.h>
-
-#include "swscale.h"
-#include "rgb2rgb.h"
-
-#define SIZE 1000
-#define srcByte 0x55
-#define dstByte 0xBB
-
-#define FUNC(s,d,n) {s,d,#n,n}
-
-static int cpu_caps;
-
-static char *args_parse(int argc, char *argv[])
-{
- int o;
-
- while ((o = getopt(argc, argv, "m23")) != -1) {
- switch (o) {
- case 'm':
- cpu_caps |= SWS_CPU_CAPS_MMX;
- break;
- case '2':
- cpu_caps |= SWS_CPU_CAPS_MMX2;
- break;
- case '3':
- cpu_caps |= SWS_CPU_CAPS_3DNOW;
- break;
- default:
- av_log(NULL, AV_LOG_ERROR, "Unknown option %c\n", o);
- }
- }
-
- return argv[optind];
-}
-
-int main(int argc, char **argv)
-{
- int i, funcNum;
- uint8_t *srcBuffer= (uint8_t*)av_malloc(SIZE);
- uint8_t *dstBuffer= (uint8_t*)av_malloc(SIZE);
- int failedNum=0;
- int passedNum=0;
-
- if (!srcBuffer || !dstBuffer)
- return -1;
-
- av_log(NULL, AV_LOG_INFO, "memory corruption test ...\n");
- args_parse(argc, argv);
- av_log(NULL, AV_LOG_INFO, "CPU capabilities forced to %x\n", cpu_caps);
- sws_rgb2rgb_init(cpu_caps);
-
- for(funcNum=0; ; funcNum++) {
- struct func_info_s {
- int src_bpp;
- int dst_bpp;
- const char *name;
- void (*func)(const uint8_t *src, uint8_t *dst, long src_size);
- } func_info[] = {
- FUNC(2, 2, rgb15to16),
- FUNC(2, 3, rgb15to24),
- FUNC(2, 4, rgb15to32),
- FUNC(2, 3, rgb16to24),
- FUNC(2, 4, rgb16to32),
- FUNC(3, 2, rgb24to15),
- FUNC(3, 2, rgb24to16),
- FUNC(3, 4, rgb24to32),
- FUNC(4, 2, rgb32to15),
- FUNC(4, 2, rgb32to16),
- FUNC(4, 3, rgb32to24),
- FUNC(2, 2, rgb16to15),
- FUNC(2, 2, rgb15tobgr15),
- FUNC(2, 2, rgb15tobgr16),
- FUNC(2, 3, rgb15tobgr24),
- FUNC(2, 4, rgb15tobgr32),
- FUNC(2, 2, rgb16tobgr15),
- FUNC(2, 2, rgb16tobgr16),
- FUNC(2, 3, rgb16tobgr24),
- FUNC(2, 4, rgb16tobgr32),
- FUNC(3, 2, rgb24tobgr15),
- FUNC(3, 2, rgb24tobgr16),
- FUNC(3, 3, rgb24tobgr24),
- FUNC(3, 4, rgb24tobgr32),
- FUNC(4, 2, rgb32tobgr15),
- FUNC(4, 2, rgb32tobgr16),
- FUNC(4, 3, rgb32tobgr24),
- FUNC(4, 4, rgb32tobgr32),
- FUNC(0, 0, NULL)
- };
- int width;
- int failed=0;
- int srcBpp=0;
- int dstBpp=0;
-
- if (!func_info[funcNum].func) break;
-
- av_log(NULL, AV_LOG_INFO,".");
- memset(srcBuffer, srcByte, SIZE);
-
- for(width=63; width>0; width--) {
- int dstOffset;
- for(dstOffset=128; dstOffset<196; dstOffset+=4) {
- int srcOffset;
- memset(dstBuffer, dstByte, SIZE);
-
- for(srcOffset=128; srcOffset<196; srcOffset+=4) {
- uint8_t *src= srcBuffer+srcOffset;
- uint8_t *dst= dstBuffer+dstOffset;
- const char *name=NULL;
-
- if(failed) break; //don't fill the screen with shit ...
-
- srcBpp = func_info[funcNum].src_bpp;
- dstBpp = func_info[funcNum].dst_bpp;
- name = func_info[funcNum].name;
-
- func_info[funcNum].func(src, dst, width*srcBpp);
-
- if(!srcBpp) break;
-
- for(i=0; i<SIZE; i++) {
- if(srcBuffer[i]!=srcByte) {
- av_log(NULL, AV_LOG_INFO, "src damaged at %d w:%d src:%d dst:%d %s\n",
- i, width, srcOffset, dstOffset, name);
- failed=1;
- break;
- }
- }
- for(i=0; i<dstOffset; i++) {
- if(dstBuffer[i]!=dstByte) {
- av_log(NULL, AV_LOG_INFO, "dst damaged at %d w:%d src:%d dst:%d %s\n",
- i, width, srcOffset, dstOffset, name);
- failed=1;
- break;
- }
- }
- for(i=dstOffset + width*dstBpp; i<SIZE; i++) {
- if(dstBuffer[i]!=dstByte) {
- av_log(NULL, AV_LOG_INFO, "dst damaged at %d w:%d src:%d dst:%d %s\n",
- i, width, srcOffset, dstOffset, name);
- failed=1;
- break;
- }
- }
- }
- }
- }
- if(failed) failedNum++;
- else if(srcBpp) passedNum++;
- }
-
- av_log(NULL, AV_LOG_INFO, "\n%d converters passed, %d converters randomly overwrote memory\n", passedNum, failedNum);
- return failedNum;
-}
diff --git a/libswscale/libswscale.v b/libswscale/libswscale.v
deleted file mode 100644
index c68f153cbc..0000000000
--- a/libswscale/libswscale.v
+++ /dev/null
@@ -1,4 +0,0 @@
-LIBSWSCALE_$MAJOR {
- global: swscale_*; sws_*; ff_*;
- local: *;
-};
diff --git a/libswscale/mlib/yuv2rgb_mlib.c b/libswscale/mlib/yuv2rgb_mlib.c
deleted file mode 100644
index 011b0ef5cb..0000000000
--- a/libswscale/mlib/yuv2rgb_mlib.c
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * software YUV to RGB converter using mediaLib
- *
- * Copyright (C) 2003 Michael Niedermayer <michaelni@gmx.at>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * FFmpeg 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include <mlib_types.h>
-#include <mlib_status.h>
-#include <mlib_sys.h>
-#include <mlib_video.h>
-#include <inttypes.h>
-#include <stdlib.h>
-#include <assert.h>
-
-#include "libswscale/swscale.h"
-
-static int mlib_YUV2ARGB420_32(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY,
- int srcSliceH, uint8_t* dst[], int dstStride[])
-{
- if(c->srcFormat == PIX_FMT_YUV422P) {
- srcStride[1] *= 2;
- srcStride[2] *= 2;
- }
-
- assert(srcStride[1] == srcStride[2]);
-
- mlib_VideoColorYUV2ARGB420(dst[0]+srcSliceY*dstStride[0], src[0], src[1], src[2], c->dstW,
- srcSliceH, dstStride[0], srcStride[0], srcStride[1]);
- return srcSliceH;
-}
-
-static int mlib_YUV2ABGR420_32(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY,
- int srcSliceH, uint8_t* dst[], int dstStride[])
-{
- if(c->srcFormat == PIX_FMT_YUV422P) {
- srcStride[1] *= 2;
- srcStride[2] *= 2;
- }
-
- assert(srcStride[1] == srcStride[2]);
-
- mlib_VideoColorYUV2ABGR420(dst[0]+srcSliceY*dstStride[0], src[0], src[1], src[2], c->dstW,
- srcSliceH, dstStride[0], srcStride[0], srcStride[1]);
- return srcSliceH;
-}
-
-static int mlib_YUV2RGB420_24(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY,
- int srcSliceH, uint8_t* dst[], int dstStride[])
-{
- if(c->srcFormat == PIX_FMT_YUV422P) {
- srcStride[1] *= 2;
- srcStride[2] *= 2;
- }
-
- assert(srcStride[1] == srcStride[2]);
-
- mlib_VideoColorYUV2RGB420(dst[0]+srcSliceY*dstStride[0], src[0], src[1], src[2], c->dstW,
- srcSliceH, dstStride[0], srcStride[0], srcStride[1]);
- return srcSliceH;
-}
-
-
-SwsFunc ff_yuv2rgb_init_mlib(SwsContext *c)
-{
- switch(c->dstFormat) {
- case PIX_FMT_RGB24: return mlib_YUV2RGB420_24;
- case PIX_FMT_BGR32: return mlib_YUV2ARGB420_32;
- case PIX_FMT_RGB32: return mlib_YUV2ABGR420_32;
- default: return NULL;
- }
-}
-
diff --git a/libswscale/options.c b/libswscale/options.c
deleted file mode 100644
index 75564cbea4..0000000000
--- a/libswscale/options.c
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Copyright (C) 2001-2003 Michael Niedermayer <michaelni@gmx.at>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * FFmpeg 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "libavutil/avutil.h"
-#include "libavcodec/opt.h"
-#include "swscale.h"
-#include "swscale_internal.h"
-
-static const char * sws_context_to_name(void * ptr)
-{
- return "swscaler";
-}
-
-#define OFFSET(x) offsetof(SwsContext, x)
-#define DEFAULT 0
-#define VE AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM
-
-static const AVOption options[] = {
- { "sws_flags", "scaler/cpu flags", OFFSET(flags), FF_OPT_TYPE_FLAGS, DEFAULT, 0, UINT_MAX, VE, "sws_flags" },
- { "fast_bilinear", "fast bilinear", 0, FF_OPT_TYPE_CONST, SWS_FAST_BILINEAR, INT_MIN, INT_MAX, VE, "sws_flags" },
- { "bilinear", "bilinear", 0, FF_OPT_TYPE_CONST, SWS_BILINEAR, INT_MIN, INT_MAX, VE, "sws_flags" },
- { "bicubic", "bicubic", 0, FF_OPT_TYPE_CONST, SWS_BICUBIC, INT_MIN, INT_MAX, VE, "sws_flags" },
- { "experimental", "experimental", 0, FF_OPT_TYPE_CONST, SWS_X, INT_MIN, INT_MAX, VE, "sws_flags" },
- { "neighbor", "nearest neighbor", 0, FF_OPT_TYPE_CONST, SWS_POINT, INT_MIN, INT_MAX, VE, "sws_flags" },
- { "area", "averaging area", 0, FF_OPT_TYPE_CONST, SWS_AREA, INT_MIN, INT_MAX, VE, "sws_flags" },
- { "bicublin", "luma bicubic, chroma bilinear", 0, FF_OPT_TYPE_CONST, SWS_BICUBLIN, INT_MIN, INT_MAX, VE, "sws_flags" },
- { "gauss", "gaussian", 0, FF_OPT_TYPE_CONST, SWS_GAUSS, INT_MIN, INT_MAX, VE, "sws_flags" },
- { "sinc", "sinc", 0, FF_OPT_TYPE_CONST, SWS_SINC, INT_MIN, INT_MAX, VE, "sws_flags" },
- { "lanczos", "lanczos", 0, FF_OPT_TYPE_CONST, SWS_LANCZOS, INT_MIN, INT_MAX, VE, "sws_flags" },
- { "spline", "natural bicubic spline", 0, FF_OPT_TYPE_CONST, SWS_SPLINE, INT_MIN, INT_MAX, VE, "sws_flags" },
- { "print_info", "print info", 0, FF_OPT_TYPE_CONST, SWS_PRINT_INFO, INT_MIN, INT_MAX, VE, "sws_flags" },
- { "accurate_rnd", "accurate rounding", 0, FF_OPT_TYPE_CONST, SWS_ACCURATE_RND, INT_MIN, INT_MAX, VE, "sws_flags" },
- { "mmx", "MMX SIMD acceleration", 0, FF_OPT_TYPE_CONST, SWS_CPU_CAPS_MMX, INT_MIN, INT_MAX, VE, "sws_flags" },
- { "mmx2", "MMX2 SIMD acceleration", 0, FF_OPT_TYPE_CONST, SWS_CPU_CAPS_MMX2, INT_MIN, INT_MAX, VE, "sws_flags" },
- { "3dnow", "3DNOW SIMD acceleration", 0, FF_OPT_TYPE_CONST, SWS_CPU_CAPS_3DNOW, INT_MIN, INT_MAX, VE, "sws_flags" },
- { "altivec", "AltiVec SIMD acceleration", 0, FF_OPT_TYPE_CONST, SWS_CPU_CAPS_ALTIVEC, INT_MIN, INT_MAX, VE, "sws_flags" },
- { "bfin", "Blackfin SIMD acceleration", 0, FF_OPT_TYPE_CONST, SWS_CPU_CAPS_BFIN, INT_MIN, INT_MAX, VE, "sws_flags" },
- { "full_chroma_int", "full chroma interpolation", 0 , FF_OPT_TYPE_CONST, SWS_FULL_CHR_H_INT, INT_MIN, INT_MAX, VE, "sws_flags" },
- { "full_chroma_inp", "full chroma input", 0 , FF_OPT_TYPE_CONST, SWS_FULL_CHR_H_INP, INT_MIN, INT_MAX, VE, "sws_flags" },
- { "bitexact", "", 0 , FF_OPT_TYPE_CONST, SWS_BITEXACT, INT_MIN, INT_MAX, VE, "sws_flags" },
- { NULL }
-};
-
-const AVClass sws_context_class = { "SWScaler", sws_context_to_name, options };
diff --git a/libswscale/ppc/swscale_altivec_template.c b/libswscale/ppc/swscale_altivec_template.c
deleted file mode 100644
index a438e4cb37..0000000000
--- a/libswscale/ppc/swscale_altivec_template.c
+++ /dev/null
@@ -1,545 +0,0 @@
-/*
- * AltiVec-enhanced yuv2yuvX
- *
- * Copyright (C) 2004 Romain Dolbeau <romain@dolbeau.org>
- * based on the equivalent C code in swscale.c
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * FFmpeg 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#define vzero vec_splat_s32(0)
-
-static inline void
-altivec_packIntArrayToCharArray(int *val, uint8_t* dest, int dstW)
-{
- register int i;
- vector unsigned int altivec_vectorShiftInt19 =
- vec_add(vec_splat_u32(10), vec_splat_u32(9));
- if ((unsigned long)dest % 16) {
- /* badly aligned store, we force store alignment */
- /* and will handle load misalignment on val w/ vec_perm */
- vector unsigned char perm1;
- vector signed int v1;
- for (i = 0 ; (i < dstW) &&
- (((unsigned long)dest + i) % 16) ; i++) {
- int t = val[i] >> 19;
- dest[i] = (t < 0) ? 0 : ((t > 255) ? 255 : t);
- }
- perm1 = vec_lvsl(i << 2, val);
- v1 = vec_ld(i << 2, val);
- for ( ; i < (dstW - 15); i+=16) {
- int offset = i << 2;
- vector signed int v2 = vec_ld(offset + 16, val);
- vector signed int v3 = vec_ld(offset + 32, val);
- vector signed int v4 = vec_ld(offset + 48, val);
- vector signed int v5 = vec_ld(offset + 64, val);
- vector signed int v12 = vec_perm(v1, v2, perm1);
- vector signed int v23 = vec_perm(v2, v3, perm1);
- vector signed int v34 = vec_perm(v3, v4, perm1);
- vector signed int v45 = vec_perm(v4, v5, perm1);
-
- vector signed int vA = vec_sra(v12, altivec_vectorShiftInt19);
- vector signed int vB = vec_sra(v23, altivec_vectorShiftInt19);
- vector signed int vC = vec_sra(v34, altivec_vectorShiftInt19);
- vector signed int vD = vec_sra(v45, altivec_vectorShiftInt19);
- vector unsigned short vs1 = vec_packsu(vA, vB);
- vector unsigned short vs2 = vec_packsu(vC, vD);
- vector unsigned char vf = vec_packsu(vs1, vs2);
- vec_st(vf, i, dest);
- v1 = v5;
- }
- } else { // dest is properly aligned, great
- for (i = 0; i < (dstW - 15); i+=16) {
- int offset = i << 2;
- vector signed int v1 = vec_ld(offset, val);
- vector signed int v2 = vec_ld(offset + 16, val);
- vector signed int v3 = vec_ld(offset + 32, val);
- vector signed int v4 = vec_ld(offset + 48, val);
- vector signed int v5 = vec_sra(v1, altivec_vectorShiftInt19);
- vector signed int v6 = vec_sra(v2, altivec_vectorShiftInt19);
- vector signed int v7 = vec_sra(v3, altivec_vectorShiftInt19);
- vector signed int v8 = vec_sra(v4, altivec_vectorShiftInt19);
- vector unsigned short vs1 = vec_packsu(v5, v6);
- vector unsigned short vs2 = vec_packsu(v7, v8);
- vector unsigned char vf = vec_packsu(vs1, vs2);
- vec_st(vf, i, dest);
- }
- }
- for ( ; i < dstW ; i++) {
- int t = val[i] >> 19;
- dest[i] = (t < 0) ? 0 : ((t > 255) ? 255 : t);
- }
-}
-
-static inline void
-yuv2yuvX_altivec_real(const int16_t *lumFilter, int16_t **lumSrc, int lumFilterSize,
- const int16_t *chrFilter, int16_t **chrSrc, int chrFilterSize,
- uint8_t *dest, uint8_t *uDest, uint8_t *vDest, int dstW, int chrDstW)
-{
- const vector signed int vini = {(1 << 18), (1 << 18), (1 << 18), (1 << 18)};
- register int i, j;
- {
- DECLARE_ALIGNED(16, int, val)[dstW];
-
- for (i = 0; i < (dstW -7); i+=4) {
- vec_st(vini, i << 2, val);
- }
- for (; i < dstW; i++) {
- val[i] = (1 << 18);
- }
-
- for (j = 0; j < lumFilterSize; j++) {
- vector signed short l1, vLumFilter = vec_ld(j << 1, lumFilter);
- vector unsigned char perm, perm0 = vec_lvsl(j << 1, lumFilter);
- vLumFilter = vec_perm(vLumFilter, vLumFilter, perm0);
- vLumFilter = vec_splat(vLumFilter, 0); // lumFilter[j] is loaded 8 times in vLumFilter
-
- perm = vec_lvsl(0, lumSrc[j]);
- l1 = vec_ld(0, lumSrc[j]);
-
- for (i = 0; i < (dstW - 7); i+=8) {
- int offset = i << 2;
- vector signed short l2 = vec_ld((i << 1) + 16, lumSrc[j]);
-
- vector signed int v1 = vec_ld(offset, val);
- vector signed int v2 = vec_ld(offset + 16, val);
-
- vector signed short ls = vec_perm(l1, l2, perm); // lumSrc[j][i] ... lumSrc[j][i+7]
-
- vector signed int i1 = vec_mule(vLumFilter, ls);
- vector signed int i2 = vec_mulo(vLumFilter, ls);
-
- vector signed int vf1 = vec_mergeh(i1, i2);
- vector signed int vf2 = vec_mergel(i1, i2); // lumSrc[j][i] * lumFilter[j] ... lumSrc[j][i+7] * lumFilter[j]
-
- vector signed int vo1 = vec_add(v1, vf1);
- vector signed int vo2 = vec_add(v2, vf2);
-
- vec_st(vo1, offset, val);
- vec_st(vo2, offset + 16, val);
-
- l1 = l2;
- }
- for ( ; i < dstW; i++) {
- val[i] += lumSrc[j][i] * lumFilter[j];
- }
- }
- altivec_packIntArrayToCharArray(val, dest, dstW);
- }
- if (uDest != 0) {
- DECLARE_ALIGNED(16, int, u)[chrDstW];
- DECLARE_ALIGNED(16, int, v)[chrDstW];
-
- for (i = 0; i < (chrDstW -7); i+=4) {
- vec_st(vini, i << 2, u);
- vec_st(vini, i << 2, v);
- }
- for (; i < chrDstW; i++) {
- u[i] = (1 << 18);
- v[i] = (1 << 18);
- }
-
- for (j = 0; j < chrFilterSize; j++) {
- vector signed short l1, l1_V, vChrFilter = vec_ld(j << 1, chrFilter);
- vector unsigned char perm, perm0 = vec_lvsl(j << 1, chrFilter);
- vChrFilter = vec_perm(vChrFilter, vChrFilter, perm0);
- vChrFilter = vec_splat(vChrFilter, 0); // chrFilter[j] is loaded 8 times in vChrFilter
-
- perm = vec_lvsl(0, chrSrc[j]);
- l1 = vec_ld(0, chrSrc[j]);
- l1_V = vec_ld(2048 << 1, chrSrc[j]);
-
- for (i = 0; i < (chrDstW - 7); i+=8) {
- int offset = i << 2;
- vector signed short l2 = vec_ld((i << 1) + 16, chrSrc[j]);
- vector signed short l2_V = vec_ld(((i + 2048) << 1) + 16, chrSrc[j]);
-
- vector signed int v1 = vec_ld(offset, u);
- vector signed int v2 = vec_ld(offset + 16, u);
- vector signed int v1_V = vec_ld(offset, v);
- vector signed int v2_V = vec_ld(offset + 16, v);
-
- vector signed short ls = vec_perm(l1, l2, perm); // chrSrc[j][i] ... chrSrc[j][i+7]
- vector signed short ls_V = vec_perm(l1_V, l2_V, perm); // chrSrc[j][i+2048] ... chrSrc[j][i+2055]
-
- vector signed int i1 = vec_mule(vChrFilter, ls);
- vector signed int i2 = vec_mulo(vChrFilter, ls);
- vector signed int i1_V = vec_mule(vChrFilter, ls_V);
- vector signed int i2_V = vec_mulo(vChrFilter, ls_V);
-
- vector signed int vf1 = vec_mergeh(i1, i2);
- vector signed int vf2 = vec_mergel(i1, i2); // chrSrc[j][i] * chrFilter[j] ... chrSrc[j][i+7] * chrFilter[j]
- vector signed int vf1_V = vec_mergeh(i1_V, i2_V);
- vector signed int vf2_V = vec_mergel(i1_V, i2_V); // chrSrc[j][i] * chrFilter[j] ... chrSrc[j][i+7] * chrFilter[j]
-
- vector signed int vo1 = vec_add(v1, vf1);
- vector signed int vo2 = vec_add(v2, vf2);
- vector signed int vo1_V = vec_add(v1_V, vf1_V);
- vector signed int vo2_V = vec_add(v2_V, vf2_V);
-
- vec_st(vo1, offset, u);
- vec_st(vo2, offset + 16, u);
- vec_st(vo1_V, offset, v);
- vec_st(vo2_V, offset + 16, v);
-
- l1 = l2;
- l1_V = l2_V;
- }
- for ( ; i < chrDstW; i++) {
- u[i] += chrSrc[j][i] * chrFilter[j];
- v[i] += chrSrc[j][i + 2048] * chrFilter[j];
- }
- }
- altivec_packIntArrayToCharArray(u, uDest, chrDstW);
- altivec_packIntArrayToCharArray(v, vDest, chrDstW);
- }
-}
-
-static inline void hScale_altivec_real(int16_t *dst, int dstW,
- const uint8_t *src, int srcW,
- int xInc, const int16_t *filter,
- const int16_t *filterPos, int filterSize)
-{
- register int i;
- DECLARE_ALIGNED(16, int, tempo)[4];
-
- if (filterSize % 4) {
- for (i=0; i<dstW; i++) {
- register int j;
- register int srcPos = filterPos[i];
- register int val = 0;
- for (j=0; j<filterSize; j++) {
- val += ((int)src[srcPos + j])*filter[filterSize*i + j];
- }
- dst[i] = FFMIN(val>>7, (1<<15)-1);
- }
- }
- else
- switch (filterSize) {
- case 4:
- {
- for (i=0; i<dstW; i++) {
- register int srcPos = filterPos[i];
-
- vector unsigned char src_v0 = vec_ld(srcPos, src);
- vector unsigned char src_v1, src_vF;
- vector signed short src_v, filter_v;
- vector signed int val_vEven, val_s;
- if ((((int)src + srcPos)% 16) > 12) {
- src_v1 = vec_ld(srcPos + 16, src);
- }
- src_vF = vec_perm(src_v0, src_v1, vec_lvsl(srcPos, src));
-
- src_v = // vec_unpackh sign-extends...
- (vector signed short)(vec_mergeh((vector unsigned char)vzero, src_vF));
- // now put our elements in the even slots
- src_v = vec_mergeh(src_v, (vector signed short)vzero);
-
- filter_v = vec_ld(i << 3, filter);
- // The 3 above is 2 (filterSize == 4) + 1 (sizeof(short) == 2).
-
- // The neat trick: We only care for half the elements,
- // high or low depending on (i<<3)%16 (it's 0 or 8 here),
- // and we're going to use vec_mule, so we choose
- // carefully how to "unpack" the elements into the even slots.
- if ((i << 3) % 16)
- filter_v = vec_mergel(filter_v, (vector signed short)vzero);
- else
- filter_v = vec_mergeh(filter_v, (vector signed short)vzero);
-
- val_vEven = vec_mule(src_v, filter_v);
- val_s = vec_sums(val_vEven, vzero);
- vec_st(val_s, 0, tempo);
- dst[i] = FFMIN(tempo[3]>>7, (1<<15)-1);
- }
- }
- break;
-
- case 8:
- {
- for (i=0; i<dstW; i++) {
- register int srcPos = filterPos[i];
-
- vector unsigned char src_v0 = vec_ld(srcPos, src);
- vector unsigned char src_v1, src_vF;
- vector signed short src_v, filter_v;
- vector signed int val_v, val_s;
- if ((((int)src + srcPos)% 16) > 8) {
- src_v1 = vec_ld(srcPos + 16, src);
- }
- src_vF = vec_perm(src_v0, src_v1, vec_lvsl(srcPos, src));
-
- src_v = // vec_unpackh sign-extends...
- (vector signed short)(vec_mergeh((vector unsigned char)vzero, src_vF));
- filter_v = vec_ld(i << 4, filter);
- // the 4 above is 3 (filterSize == 8) + 1 (sizeof(short) == 2)
-
- val_v = vec_msums(src_v, filter_v, (vector signed int)vzero);
- val_s = vec_sums(val_v, vzero);
- vec_st(val_s, 0, tempo);
- dst[i] = FFMIN(tempo[3]>>7, (1<<15)-1);
- }
- }
- break;
-
- case 16:
- {
- for (i=0; i<dstW; i++) {
- register int srcPos = filterPos[i];
-
- vector unsigned char src_v0 = vec_ld(srcPos, src);
- vector unsigned char src_v1 = vec_ld(srcPos + 16, src);
- vector unsigned char src_vF = vec_perm(src_v0, src_v1, vec_lvsl(srcPos, src));
-
- vector signed short src_vA = // vec_unpackh sign-extends...
- (vector signed short)(vec_mergeh((vector unsigned char)vzero, src_vF));
- vector signed short src_vB = // vec_unpackh sign-extends...
- (vector signed short)(vec_mergel((vector unsigned char)vzero, src_vF));
-
- vector signed short filter_v0 = vec_ld(i << 5, filter);
- vector signed short filter_v1 = vec_ld((i << 5) + 16, filter);
- // the 5 above are 4 (filterSize == 16) + 1 (sizeof(short) == 2)
-
- vector signed int val_acc = vec_msums(src_vA, filter_v0, (vector signed int)vzero);
- vector signed int val_v = vec_msums(src_vB, filter_v1, val_acc);
-
- vector signed int val_s = vec_sums(val_v, vzero);
-
- vec_st(val_s, 0, tempo);
- dst[i] = FFMIN(tempo[3]>>7, (1<<15)-1);
- }
- }
- break;
-
- default:
- {
- for (i=0; i<dstW; i++) {
- register int j;
- register int srcPos = filterPos[i];
-
- vector signed int val_s, val_v = (vector signed int)vzero;
- vector signed short filter_v0R = vec_ld(i * 2 * filterSize, filter);
- vector unsigned char permF = vec_lvsl((i * 2 * filterSize), filter);
-
- vector unsigned char src_v0 = vec_ld(srcPos, src);
- vector unsigned char permS = vec_lvsl(srcPos, src);
-
- for (j = 0 ; j < filterSize - 15; j += 16) {
- vector unsigned char src_v1 = vec_ld(srcPos + j + 16, src);
- vector unsigned char src_vF = vec_perm(src_v0, src_v1, permS);
-
- vector signed short src_vA = // vec_unpackh sign-extends...
- (vector signed short)(vec_mergeh((vector unsigned char)vzero, src_vF));
- vector signed short src_vB = // vec_unpackh sign-extends...
- (vector signed short)(vec_mergel((vector unsigned char)vzero, src_vF));
-
- vector signed short filter_v1R = vec_ld((i * 2 * filterSize) + (j * 2) + 16, filter);
- vector signed short filter_v2R = vec_ld((i * 2 * filterSize) + (j * 2) + 32, filter);
- vector signed short filter_v0 = vec_perm(filter_v0R, filter_v1R, permF);
- vector signed short filter_v1 = vec_perm(filter_v1R, filter_v2R, permF);
-
- vector signed int val_acc = vec_msums(src_vA, filter_v0, val_v);
- val_v = vec_msums(src_vB, filter_v1, val_acc);
-
- filter_v0R = filter_v2R;
- src_v0 = src_v1;
- }
-
- if (j < filterSize-7) {
- // loading src_v0 is useless, it's already done above
- //vector unsigned char src_v0 = vec_ld(srcPos + j, src);
- vector unsigned char src_v1, src_vF;
- vector signed short src_v, filter_v1R, filter_v;
- if ((((int)src + srcPos)% 16) > 8) {
- src_v1 = vec_ld(srcPos + j + 16, src);
- }
- src_vF = vec_perm(src_v0, src_v1, permS);
-
- src_v = // vec_unpackh sign-extends...
- (vector signed short)(vec_mergeh((vector unsigned char)vzero, src_vF));
- // loading filter_v0R is useless, it's already done above
- //vector signed short filter_v0R = vec_ld((i * 2 * filterSize) + j, filter);
- filter_v1R = vec_ld((i * 2 * filterSize) + (j * 2) + 16, filter);
- filter_v = vec_perm(filter_v0R, filter_v1R, permF);
-
- val_v = vec_msums(src_v, filter_v, val_v);
- }
-
- val_s = vec_sums(val_v, vzero);
-
- vec_st(val_s, 0, tempo);
- dst[i] = FFMIN(tempo[3]>>7, (1<<15)-1);
- }
-
- }
- }
-}
-
-static inline int yv12toyuy2_unscaled_altivec(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY,
- int srcSliceH, uint8_t* dstParam[], int dstStride_a[])
-{
- uint8_t *dst=dstParam[0] + dstStride_a[0]*srcSliceY;
- // yv12toyuy2(src[0], src[1], src[2], dst, c->srcW, srcSliceH, srcStride[0], srcStride[1], dstStride[0]);
- uint8_t *ysrc = src[0];
- uint8_t *usrc = src[1];
- uint8_t *vsrc = src[2];
- const int width = c->srcW;
- const int height = srcSliceH;
- const int lumStride = srcStride[0];
- const int chromStride = srcStride[1];
- const int dstStride = dstStride_a[0];
- const vector unsigned char yperm = vec_lvsl(0, ysrc);
- const int vertLumPerChroma = 2;
- register unsigned int y;
-
- if (width&15) {
- yv12toyuy2(ysrc, usrc, vsrc, dst, c->srcW, srcSliceH, lumStride, chromStride, dstStride);
- return srcSliceH;
- }
-
- /* This code assumes:
-
- 1) dst is 16 bytes-aligned
- 2) dstStride is a multiple of 16
- 3) width is a multiple of 16
- 4) lum & chrom stride are multiples of 8
- */
-
- for (y=0; y<height; y++) {
- int i;
- for (i = 0; i < width - 31; i+= 32) {
- const unsigned int j = i >> 1;
- vector unsigned char v_yA = vec_ld(i, ysrc);
- vector unsigned char v_yB = vec_ld(i + 16, ysrc);
- vector unsigned char v_yC = vec_ld(i + 32, ysrc);
- vector unsigned char v_y1 = vec_perm(v_yA, v_yB, yperm);
- vector unsigned char v_y2 = vec_perm(v_yB, v_yC, yperm);
- vector unsigned char v_uA = vec_ld(j, usrc);
- vector unsigned char v_uB = vec_ld(j + 16, usrc);
- vector unsigned char v_u = vec_perm(v_uA, v_uB, vec_lvsl(j, usrc));
- vector unsigned char v_vA = vec_ld(j, vsrc);
- vector unsigned char v_vB = vec_ld(j + 16, vsrc);
- vector unsigned char v_v = vec_perm(v_vA, v_vB, vec_lvsl(j, vsrc));
- vector unsigned char v_uv_a = vec_mergeh(v_u, v_v);
- vector unsigned char v_uv_b = vec_mergel(v_u, v_v);
- vector unsigned char v_yuy2_0 = vec_mergeh(v_y1, v_uv_a);
- vector unsigned char v_yuy2_1 = vec_mergel(v_y1, v_uv_a);
- vector unsigned char v_yuy2_2 = vec_mergeh(v_y2, v_uv_b);
- vector unsigned char v_yuy2_3 = vec_mergel(v_y2, v_uv_b);
- vec_st(v_yuy2_0, (i << 1), dst);
- vec_st(v_yuy2_1, (i << 1) + 16, dst);
- vec_st(v_yuy2_2, (i << 1) + 32, dst);
- vec_st(v_yuy2_3, (i << 1) + 48, dst);
- }
- if (i < width) {
- const unsigned int j = i >> 1;
- vector unsigned char v_y1 = vec_ld(i, ysrc);
- vector unsigned char v_u = vec_ld(j, usrc);
- vector unsigned char v_v = vec_ld(j, vsrc);
- vector unsigned char v_uv_a = vec_mergeh(v_u, v_v);
- vector unsigned char v_yuy2_0 = vec_mergeh(v_y1, v_uv_a);
- vector unsigned char v_yuy2_1 = vec_mergel(v_y1, v_uv_a);
- vec_st(v_yuy2_0, (i << 1), dst);
- vec_st(v_yuy2_1, (i << 1) + 16, dst);
- }
- if ((y&(vertLumPerChroma-1)) == vertLumPerChroma-1) {
- usrc += chromStride;
- vsrc += chromStride;
- }
- ysrc += lumStride;
- dst += dstStride;
- }
-
- return srcSliceH;
-}
-
-static inline int yv12touyvy_unscaled_altivec(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY,
- int srcSliceH, uint8_t* dstParam[], int dstStride_a[])
-{
- uint8_t *dst=dstParam[0] + dstStride_a[0]*srcSliceY;
- // yv12toyuy2(src[0], src[1], src[2], dst, c->srcW, srcSliceH, srcStride[0], srcStride[1], dstStride[0]);
- uint8_t *ysrc = src[0];
- uint8_t *usrc = src[1];
- uint8_t *vsrc = src[2];
- const int width = c->srcW;
- const int height = srcSliceH;
- const int lumStride = srcStride[0];
- const int chromStride = srcStride[1];
- const int dstStride = dstStride_a[0];
- const int vertLumPerChroma = 2;
- const vector unsigned char yperm = vec_lvsl(0, ysrc);
- register unsigned int y;
-
- if (width&15) {
- yv12touyvy(ysrc, usrc, vsrc, dst, c->srcW, srcSliceH, lumStride, chromStride, dstStride);
- return srcSliceH;
- }
-
- /* This code assumes:
-
- 1) dst is 16 bytes-aligned
- 2) dstStride is a multiple of 16
- 3) width is a multiple of 16
- 4) lum & chrom stride are multiples of 8
- */
-
- for (y=0; y<height; y++) {
- int i;
- for (i = 0; i < width - 31; i+= 32) {
- const unsigned int j = i >> 1;
- vector unsigned char v_yA = vec_ld(i, ysrc);
- vector unsigned char v_yB = vec_ld(i + 16, ysrc);
- vector unsigned char v_yC = vec_ld(i + 32, ysrc);
- vector unsigned char v_y1 = vec_perm(v_yA, v_yB, yperm);
- vector unsigned char v_y2 = vec_perm(v_yB, v_yC, yperm);
- vector unsigned char v_uA = vec_ld(j, usrc);
- vector unsigned char v_uB = vec_ld(j + 16, usrc);
- vector unsigned char v_u = vec_perm(v_uA, v_uB, vec_lvsl(j, usrc));
- vector unsigned char v_vA = vec_ld(j, vsrc);
- vector unsigned char v_vB = vec_ld(j + 16, vsrc);
- vector unsigned char v_v = vec_perm(v_vA, v_vB, vec_lvsl(j, vsrc));
- vector unsigned char v_uv_a = vec_mergeh(v_u, v_v);
- vector unsigned char v_uv_b = vec_mergel(v_u, v_v);
- vector unsigned char v_uyvy_0 = vec_mergeh(v_uv_a, v_y1);
- vector unsigned char v_uyvy_1 = vec_mergel(v_uv_a, v_y1);
- vector unsigned char v_uyvy_2 = vec_mergeh(v_uv_b, v_y2);
- vector unsigned char v_uyvy_3 = vec_mergel(v_uv_b, v_y2);
- vec_st(v_uyvy_0, (i << 1), dst);
- vec_st(v_uyvy_1, (i << 1) + 16, dst);
- vec_st(v_uyvy_2, (i << 1) + 32, dst);
- vec_st(v_uyvy_3, (i << 1) + 48, dst);
- }
- if (i < width) {
- const unsigned int j = i >> 1;
- vector unsigned char v_y1 = vec_ld(i, ysrc);
- vector unsigned char v_u = vec_ld(j, usrc);
- vector unsigned char v_v = vec_ld(j, vsrc);
- vector unsigned char v_uv_a = vec_mergeh(v_u, v_v);
- vector unsigned char v_uyvy_0 = vec_mergeh(v_uv_a, v_y1);
- vector unsigned char v_uyvy_1 = vec_mergel(v_uv_a, v_y1);
- vec_st(v_uyvy_0, (i << 1), dst);
- vec_st(v_uyvy_1, (i << 1) + 16, dst);
- }
- if ((y&(vertLumPerChroma-1)) == vertLumPerChroma-1) {
- usrc += chromStride;
- vsrc += chromStride;
- }
- ysrc += lumStride;
- dst += dstStride;
- }
- return srcSliceH;
-}
diff --git a/libswscale/ppc/yuv2rgb_altivec.c b/libswscale/ppc/yuv2rgb_altivec.c
deleted file mode 100644
index be26647498..0000000000
--- a/libswscale/ppc/yuv2rgb_altivec.c
+++ /dev/null
@@ -1,953 +0,0 @@
-/*
- * AltiVec acceleration for colorspace conversion
- *
- * copyright (C) 2004 Marc Hoffman <marc.hoffman@analog.com>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * FFmpeg 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/*
-Convert I420 YV12 to RGB in various formats,
- it rejects images that are not in 420 formats,
- it rejects images that don't have widths of multiples of 16,
- it rejects images that don't have heights of multiples of 2.
-Reject defers to C simulation code.
-
-Lots of optimizations to be done here.
-
-1. Need to fix saturation code. I just couldn't get it to fly with packs
- and adds, so we currently use max/min to clip.
-
-2. The inefficient use of chroma loading needs a bit of brushing up.
-
-3. Analysis of pipeline stalls needs to be done. Use shark to identify
- pipeline stalls.
-
-
-MODIFIED to calculate coeffs from currently selected color space.
-MODIFIED core to be a macro where you specify the output format.
-ADDED UYVY conversion which is never called due to some thing in swscale.
-CORRECTED algorithim selection to be strict on input formats.
-ADDED runtime detection of AltiVec.
-
-ADDED altivec_yuv2packedX vertical scl + RGB converter
-
-March 27,2004
-PERFORMANCE ANALYSIS
-
-The C version uses 25% of the processor or ~250Mips for D1 video rawvideo
-used as test.
-The AltiVec version uses 10% of the processor or ~100Mips for D1 video
-same sequence.
-
-720 * 480 * 30 ~10MPS
-
-so we have roughly 10 clocks per pixel. This is too high, something has
-to be wrong.
-
-OPTIMIZED clip codes to utilize vec_max and vec_packs removing the
-need for vec_min.
-
-OPTIMIZED DST OUTPUT cache/DMA controls. We are pretty much guaranteed to have
-the input video frame, it was just decompressed so it probably resides in L1
-caches. However, we are creating the output video stream. This needs to use the
-DSTST instruction to optimize for the cache. We couple this with the fact that
-we are not going to be visiting the input buffer again so we mark it Least
-Recently Used. This shaves 25% of the processor cycles off.
-
-Now memcpy is the largest mips consumer in the system, probably due
-to the inefficient X11 stuff.
-
-GL libraries seem to be very slow on this machine 1.33Ghz PB running
-Jaguar, this is not the case for my 1Ghz PB. I thought it might be
-a versioning issue, however I have libGL.1.2.dylib for both
-machines. (We need to figure this out now.)
-
-GL2 libraries work now with patch for RGB32.
-
-NOTE: quartz vo driver ARGB32_to_RGB24 consumes 30% of the processor.
-
-Integrated luma prescaling adjustment for saturation/contrast/brightness
-adjustment.
-*/
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <inttypes.h>
-#include <assert.h>
-#include "config.h"
-#include "libswscale/rgb2rgb.h"
-#include "libswscale/swscale.h"
-#include "libswscale/swscale_internal.h"
-
-#undef PROFILE_THE_BEAST
-#undef INC_SCALING
-
-typedef unsigned char ubyte;
-typedef signed char sbyte;
-
-
-/* RGB interleaver, 16 planar pels 8-bit samples per channel in
- homogeneous vector registers x0,x1,x2 are interleaved with the
- following technique:
-
- o0 = vec_mergeh (x0,x1);
- o1 = vec_perm (o0, x2, perm_rgb_0);
- o2 = vec_perm (o0, x2, perm_rgb_1);
- o3 = vec_mergel (x0,x1);
- o4 = vec_perm (o3,o2,perm_rgb_2);
- o5 = vec_perm (o3,o2,perm_rgb_3);
-
- perm_rgb_0: o0(RG).h v1(B) --> o1*
- 0 1 2 3 4
- rgbr|gbrg|brgb|rgbr
- 0010 0100 1001 0010
- 0102 3145 2673 894A
-
- perm_rgb_1: o0(RG).h v1(B) --> o2
- 0 1 2 3 4
- gbrg|brgb|bbbb|bbbb
- 0100 1001 1111 1111
- B5CD 6EF7 89AB CDEF
-
- perm_rgb_2: o3(RG).l o2(rgbB.l) --> o4*
- 0 1 2 3 4
- gbrg|brgb|rgbr|gbrg
- 1111 1111 0010 0100
- 89AB CDEF 0182 3945
-
- perm_rgb_2: o3(RG).l o2(rgbB.l) ---> o5*
- 0 1 2 3 4
- brgb|rgbr|gbrg|brgb
- 1001 0010 0100 1001
- a67b 89cA BdCD eEFf
-
-*/
-static
-const vector unsigned char
- perm_rgb_0 = {0x00,0x01,0x10,0x02,0x03,0x11,0x04,0x05,
- 0x12,0x06,0x07,0x13,0x08,0x09,0x14,0x0a},
- perm_rgb_1 = {0x0b,0x15,0x0c,0x0d,0x16,0x0e,0x0f,0x17,
- 0x18,0x19,0x1a,0x1b,0x1c,0x1d,0x1e,0x1f},
- perm_rgb_2 = {0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,
- 0x00,0x01,0x18,0x02,0x03,0x19,0x04,0x05},
- perm_rgb_3 = {0x1a,0x06,0x07,0x1b,0x08,0x09,0x1c,0x0a,
- 0x0b,0x1d,0x0c,0x0d,0x1e,0x0e,0x0f,0x1f};
-
-#define vec_merge3(x2,x1,x0,y0,y1,y2) \
-do { \
- __typeof__(x0) o0,o2,o3; \
- o0 = vec_mergeh (x0,x1); \
- y0 = vec_perm (o0, x2, perm_rgb_0); \
- o2 = vec_perm (o0, x2, perm_rgb_1); \
- o3 = vec_mergel (x0,x1); \
- y1 = vec_perm (o3,o2,perm_rgb_2); \
- y2 = vec_perm (o3,o2,perm_rgb_3); \
-} while(0)
-
-#define vec_mstbgr24(x0,x1,x2,ptr) \
-do { \
- __typeof__(x0) _0,_1,_2; \
- vec_merge3 (x0,x1,x2,_0,_1,_2); \
- vec_st (_0, 0, ptr++); \
- vec_st (_1, 0, ptr++); \
- vec_st (_2, 0, ptr++); \
-} while (0)
-
-#define vec_mstrgb24(x0,x1,x2,ptr) \
-do { \
- __typeof__(x0) _0,_1,_2; \
- vec_merge3 (x2,x1,x0,_0,_1,_2); \
- vec_st (_0, 0, ptr++); \
- vec_st (_1, 0, ptr++); \
- vec_st (_2, 0, ptr++); \
-} while (0)
-
-/* pack the pixels in rgb0 format
- msb R
- lsb 0
-*/
-#define vec_mstrgb32(T,x0,x1,x2,x3,ptr) \
-do { \
- T _0,_1,_2,_3; \
- _0 = vec_mergeh (x0,x1); \
- _1 = vec_mergeh (x2,x3); \
- _2 = (T)vec_mergeh ((vector unsigned short)_0,(vector unsigned short)_1); \
- _3 = (T)vec_mergel ((vector unsigned short)_0,(vector unsigned short)_1); \
- vec_st (_2, 0*16, (T *)ptr); \
- vec_st (_3, 1*16, (T *)ptr); \
- _0 = vec_mergel (x0,x1); \
- _1 = vec_mergel (x2,x3); \
- _2 = (T)vec_mergeh ((vector unsigned short)_0,(vector unsigned short)_1); \
- _3 = (T)vec_mergel ((vector unsigned short)_0,(vector unsigned short)_1); \
- vec_st (_2, 2*16, (T *)ptr); \
- vec_st (_3, 3*16, (T *)ptr); \
- ptr += 4; \
-} while (0)
-
-/*
-
- | 1 0 1.4021 | | Y |
- | 1 -0.3441 -0.7142 |x| Cb|
- | 1 1.7718 0 | | Cr|
-
-
- Y: [-128 127]
- Cb/Cr : [-128 127]
-
- typical yuv conversion work on Y: 0-255 this version has been optimized for jpeg decode.
-
-*/
-
-
-
-
-#define vec_unh(x) \
- (vector signed short) \
- vec_perm(x,(__typeof__(x)){0}, \
- ((vector unsigned char){0x10,0x00,0x10,0x01,0x10,0x02,0x10,0x03,\
- 0x10,0x04,0x10,0x05,0x10,0x06,0x10,0x07}))
-#define vec_unl(x) \
- (vector signed short) \
- vec_perm(x,(__typeof__(x)){0}, \
- ((vector unsigned char){0x10,0x08,0x10,0x09,0x10,0x0A,0x10,0x0B,\
- 0x10,0x0C,0x10,0x0D,0x10,0x0E,0x10,0x0F}))
-
-#define vec_clip_s16(x) \
- vec_max (vec_min (x, ((vector signed short){235,235,235,235,235,235,235,235})), \
- ((vector signed short){ 16, 16, 16, 16, 16, 16, 16, 16}))
-
-#define vec_packclp(x,y) \
- (vector unsigned char)vec_packs \
- ((vector unsigned short)vec_max (x,((vector signed short) {0})), \
- (vector unsigned short)vec_max (y,((vector signed short) {0})))
-
-//#define out_pixels(a,b,c,ptr) vec_mstrgb32(__typeof__(a),((__typeof__ (a)){255}),a,a,a,ptr)
-
-
-static inline void cvtyuvtoRGB (SwsContext *c,
- vector signed short Y, vector signed short U, vector signed short V,
- vector signed short *R, vector signed short *G, vector signed short *B)
-{
- vector signed short vx,ux,uvx;
-
- Y = vec_mradds (Y, c->CY, c->OY);
- U = vec_sub (U,(vector signed short)
- vec_splat((vector signed short){128},0));
- V = vec_sub (V,(vector signed short)
- vec_splat((vector signed short){128},0));
-
- // ux = (CBU*(u<<c->CSHIFT)+0x4000)>>15;
- ux = vec_sl (U, c->CSHIFT);
- *B = vec_mradds (ux, c->CBU, Y);
-
- // vx = (CRV*(v<<c->CSHIFT)+0x4000)>>15;
- vx = vec_sl (V, c->CSHIFT);
- *R = vec_mradds (vx, c->CRV, Y);
-
- // uvx = ((CGU*u) + (CGV*v))>>15;
- uvx = vec_mradds (U, c->CGU, Y);
- *G = vec_mradds (V, c->CGV, uvx);
-}
-
-
-/*
- ------------------------------------------------------------------------------
- CS converters
- ------------------------------------------------------------------------------
-*/
-
-
-#define DEFCSP420_CVT(name,out_pixels) \
-static int altivec_##name (SwsContext *c, \
- unsigned char **in, int *instrides, \
- int srcSliceY, int srcSliceH, \
- unsigned char **oplanes, int *outstrides) \
-{ \
- int w = c->srcW; \
- int h = srcSliceH; \
- int i,j; \
- int instrides_scl[3]; \
- vector unsigned char y0,y1; \
- \
- vector signed char u,v; \
- \
- vector signed short Y0,Y1,Y2,Y3; \
- vector signed short U,V; \
- vector signed short vx,ux,uvx; \
- vector signed short vx0,ux0,uvx0; \
- vector signed short vx1,ux1,uvx1; \
- vector signed short R0,G0,B0; \
- vector signed short R1,G1,B1; \
- vector unsigned char R,G,B; \
- \
- vector unsigned char *y1ivP, *y2ivP, *uivP, *vivP; \
- vector unsigned char align_perm; \
- \
- vector signed short \
- lCY = c->CY, \
- lOY = c->OY, \
- lCRV = c->CRV, \
- lCBU = c->CBU, \
- lCGU = c->CGU, \
- lCGV = c->CGV; \
- \
- vector unsigned short lCSHIFT = c->CSHIFT; \
- \
- ubyte *y1i = in[0]; \
- ubyte *y2i = in[0]+instrides[0]; \
- ubyte *ui = in[1]; \
- ubyte *vi = in[2]; \
- \
- vector unsigned char *oute \
- = (vector unsigned char *) \
- (oplanes[0]+srcSliceY*outstrides[0]); \
- vector unsigned char *outo \
- = (vector unsigned char *) \
- (oplanes[0]+srcSliceY*outstrides[0]+outstrides[0]); \
- \
- \
- instrides_scl[0] = instrides[0]*2-w; /* the loop moves y{1,2}i by w */ \
- instrides_scl[1] = instrides[1]-w/2; /* the loop moves ui by w/2 */ \
- instrides_scl[2] = instrides[2]-w/2; /* the loop moves vi by w/2 */ \
- \
- \
- for (i=0;i<h/2;i++) { \
- vec_dstst (outo, (0x02000002|(((w*3+32)/32)<<16)), 0); \
- vec_dstst (oute, (0x02000002|(((w*3+32)/32)<<16)), 1); \
- \
- for (j=0;j<w/16;j++) { \
- \
- y1ivP = (vector unsigned char *)y1i; \
- y2ivP = (vector unsigned char *)y2i; \
- uivP = (vector unsigned char *)ui; \
- vivP = (vector unsigned char *)vi; \
- \
- align_perm = vec_lvsl (0, y1i); \
- y0 = (vector unsigned char) \
- vec_perm (y1ivP[0], y1ivP[1], align_perm); \
- \
- align_perm = vec_lvsl (0, y2i); \
- y1 = (vector unsigned char) \
- vec_perm (y2ivP[0], y2ivP[1], align_perm); \
- \
- align_perm = vec_lvsl (0, ui); \
- u = (vector signed char) \
- vec_perm (uivP[0], uivP[1], align_perm); \
- \
- align_perm = vec_lvsl (0, vi); \
- v = (vector signed char) \
- vec_perm (vivP[0], vivP[1], align_perm); \
- \
- u = (vector signed char) \
- vec_sub (u,(vector signed char) \
- vec_splat((vector signed char){128},0)); \
- v = (vector signed char) \
- vec_sub (v,(vector signed char) \
- vec_splat((vector signed char){128},0)); \
- \
- U = vec_unpackh (u); \
- V = vec_unpackh (v); \
- \
- \
- Y0 = vec_unh (y0); \
- Y1 = vec_unl (y0); \
- Y2 = vec_unh (y1); \
- Y3 = vec_unl (y1); \
- \
- Y0 = vec_mradds (Y0, lCY, lOY); \
- Y1 = vec_mradds (Y1, lCY, lOY); \
- Y2 = vec_mradds (Y2, lCY, lOY); \
- Y3 = vec_mradds (Y3, lCY, lOY); \
- \
- /* ux = (CBU*(u<<CSHIFT)+0x4000)>>15 */ \
- ux = vec_sl (U, lCSHIFT); \
- ux = vec_mradds (ux, lCBU, (vector signed short){0}); \
- ux0 = vec_mergeh (ux,ux); \
- ux1 = vec_mergel (ux,ux); \
- \
- /* vx = (CRV*(v<<CSHIFT)+0x4000)>>15; */ \
- vx = vec_sl (V, lCSHIFT); \
- vx = vec_mradds (vx, lCRV, (vector signed short){0}); \
- vx0 = vec_mergeh (vx,vx); \
- vx1 = vec_mergel (vx,vx); \
- \
- /* uvx = ((CGU*u) + (CGV*v))>>15 */ \
- uvx = vec_mradds (U, lCGU, (vector signed short){0}); \
- uvx = vec_mradds (V, lCGV, uvx); \
- uvx0 = vec_mergeh (uvx,uvx); \
- uvx1 = vec_mergel (uvx,uvx); \
- \
- R0 = vec_add (Y0,vx0); \
- G0 = vec_add (Y0,uvx0); \
- B0 = vec_add (Y0,ux0); \
- R1 = vec_add (Y1,vx1); \
- G1 = vec_add (Y1,uvx1); \
- B1 = vec_add (Y1,ux1); \
- \
- R = vec_packclp (R0,R1); \
- G = vec_packclp (G0,G1); \
- B = vec_packclp (B0,B1); \
- \
- out_pixels(R,G,B,oute); \
- \
- R0 = vec_add (Y2,vx0); \
- G0 = vec_add (Y2,uvx0); \
- B0 = vec_add (Y2,ux0); \
- R1 = vec_add (Y3,vx1); \
- G1 = vec_add (Y3,uvx1); \
- B1 = vec_add (Y3,ux1); \
- R = vec_packclp (R0,R1); \
- G = vec_packclp (G0,G1); \
- B = vec_packclp (B0,B1); \
- \
- \
- out_pixels(R,G,B,outo); \
- \
- y1i += 16; \
- y2i += 16; \
- ui += 8; \
- vi += 8; \
- \
- } \
- \
- outo += (outstrides[0])>>4; \
- oute += (outstrides[0])>>4; \
- \
- ui += instrides_scl[1]; \
- vi += instrides_scl[2]; \
- y1i += instrides_scl[0]; \
- y2i += instrides_scl[0]; \
- } \
- return srcSliceH; \
-}
-
-
-#define out_abgr(a,b,c,ptr) vec_mstrgb32(__typeof__(a),((__typeof__ (a)){255}),c,b,a,ptr)
-#define out_bgra(a,b,c,ptr) vec_mstrgb32(__typeof__(a),c,b,a,((__typeof__ (a)){255}),ptr)
-#define out_rgba(a,b,c,ptr) vec_mstrgb32(__typeof__(a),a,b,c,((__typeof__ (a)){255}),ptr)
-#define out_argb(a,b,c,ptr) vec_mstrgb32(__typeof__(a),((__typeof__ (a)){255}),a,b,c,ptr)
-#define out_rgb24(a,b,c,ptr) vec_mstrgb24(a,b,c,ptr)
-#define out_bgr24(a,b,c,ptr) vec_mstbgr24(a,b,c,ptr)
-
-DEFCSP420_CVT (yuv2_abgr, out_abgr)
-#if 1
-DEFCSP420_CVT (yuv2_bgra, out_bgra)
-#else
-static int altivec_yuv2_bgra32 (SwsContext *c,
- unsigned char **in, int *instrides,
- int srcSliceY, int srcSliceH,
- unsigned char **oplanes, int *outstrides)
-{
- int w = c->srcW;
- int h = srcSliceH;
- int i,j;
- int instrides_scl[3];
- vector unsigned char y0,y1;
-
- vector signed char u,v;
-
- vector signed short Y0,Y1,Y2,Y3;
- vector signed short U,V;
- vector signed short vx,ux,uvx;
- vector signed short vx0,ux0,uvx0;
- vector signed short vx1,ux1,uvx1;
- vector signed short R0,G0,B0;
- vector signed short R1,G1,B1;
- vector unsigned char R,G,B;
-
- vector unsigned char *uivP, *vivP;
- vector unsigned char align_perm;
-
- vector signed short
- lCY = c->CY,
- lOY = c->OY,
- lCRV = c->CRV,
- lCBU = c->CBU,
- lCGU = c->CGU,
- lCGV = c->CGV;
-
- vector unsigned short lCSHIFT = c->CSHIFT;
-
- ubyte *y1i = in[0];
- ubyte *y2i = in[0]+w;
- ubyte *ui = in[1];
- ubyte *vi = in[2];
-
- vector unsigned char *oute
- = (vector unsigned char *)
- (oplanes[0]+srcSliceY*outstrides[0]);
- vector unsigned char *outo
- = (vector unsigned char *)
- (oplanes[0]+srcSliceY*outstrides[0]+outstrides[0]);
-
-
- instrides_scl[0] = instrides[0];
- instrides_scl[1] = instrides[1]-w/2; /* the loop moves ui by w/2 */
- instrides_scl[2] = instrides[2]-w/2; /* the loop moves vi by w/2 */
-
-
- for (i=0;i<h/2;i++) {
- vec_dstst (outo, (0x02000002|(((w*3+32)/32)<<16)), 0);
- vec_dstst (oute, (0x02000002|(((w*3+32)/32)<<16)), 1);
-
- for (j=0;j<w/16;j++) {
-
- y0 = vec_ldl (0,y1i);
- y1 = vec_ldl (0,y2i);
- uivP = (vector unsigned char *)ui;
- vivP = (vector unsigned char *)vi;
-
- align_perm = vec_lvsl (0, ui);
- u = (vector signed char)vec_perm (uivP[0], uivP[1], align_perm);
-
- align_perm = vec_lvsl (0, vi);
- v = (vector signed char)vec_perm (vivP[0], vivP[1], align_perm);
- u = (vector signed char)
- vec_sub (u,(vector signed char)
- vec_splat((vector signed char){128},0));
-
- v = (vector signed char)
- vec_sub (v, (vector signed char)
- vec_splat((vector signed char){128},0));
-
- U = vec_unpackh (u);
- V = vec_unpackh (v);
-
-
- Y0 = vec_unh (y0);
- Y1 = vec_unl (y0);
- Y2 = vec_unh (y1);
- Y3 = vec_unl (y1);
-
- Y0 = vec_mradds (Y0, lCY, lOY);
- Y1 = vec_mradds (Y1, lCY, lOY);
- Y2 = vec_mradds (Y2, lCY, lOY);
- Y3 = vec_mradds (Y3, lCY, lOY);
-
- /* ux = (CBU*(u<<CSHIFT)+0x4000)>>15 */
- ux = vec_sl (U, lCSHIFT);
- ux = vec_mradds (ux, lCBU, (vector signed short){0});
- ux0 = vec_mergeh (ux,ux);
- ux1 = vec_mergel (ux,ux);
-
- /* vx = (CRV*(v<<CSHIFT)+0x4000)>>15; */
- vx = vec_sl (V, lCSHIFT);
- vx = vec_mradds (vx, lCRV, (vector signed short){0});
- vx0 = vec_mergeh (vx,vx);
- vx1 = vec_mergel (vx,vx);
- /* uvx = ((CGU*u) + (CGV*v))>>15 */
- uvx = vec_mradds (U, lCGU, (vector signed short){0});
- uvx = vec_mradds (V, lCGV, uvx);
- uvx0 = vec_mergeh (uvx,uvx);
- uvx1 = vec_mergel (uvx,uvx);
- R0 = vec_add (Y0,vx0);
- G0 = vec_add (Y0,uvx0);
- B0 = vec_add (Y0,ux0);
- R1 = vec_add (Y1,vx1);
- G1 = vec_add (Y1,uvx1);
- B1 = vec_add (Y1,ux1);
- R = vec_packclp (R0,R1);
- G = vec_packclp (G0,G1);
- B = vec_packclp (B0,B1);
-
- out_argb(R,G,B,oute);
- R0 = vec_add (Y2,vx0);
- G0 = vec_add (Y2,uvx0);
- B0 = vec_add (Y2,ux0);
- R1 = vec_add (Y3,vx1);
- G1 = vec_add (Y3,uvx1);
- B1 = vec_add (Y3,ux1);
- R = vec_packclp (R0,R1);
- G = vec_packclp (G0,G1);
- B = vec_packclp (B0,B1);
-
- out_argb(R,G,B,outo);
- y1i += 16;
- y2i += 16;
- ui += 8;
- vi += 8;
-
- }
-
- outo += (outstrides[0])>>4;
- oute += (outstrides[0])>>4;
-
- ui += instrides_scl[1];
- vi += instrides_scl[2];
- y1i += instrides_scl[0];
- y2i += instrides_scl[0];
- }
- return srcSliceH;
-}
-
-#endif
-
-
-DEFCSP420_CVT (yuv2_rgba, out_rgba)
-DEFCSP420_CVT (yuv2_argb, out_argb)
-DEFCSP420_CVT (yuv2_rgb24, out_rgb24)
-DEFCSP420_CVT (yuv2_bgr24, out_bgr24)
-
-
-// uyvy|uyvy|uyvy|uyvy
-// 0123 4567 89ab cdef
-static
-const vector unsigned char
- demux_u = {0x10,0x00,0x10,0x00,
- 0x10,0x04,0x10,0x04,
- 0x10,0x08,0x10,0x08,
- 0x10,0x0c,0x10,0x0c},
- demux_v = {0x10,0x02,0x10,0x02,
- 0x10,0x06,0x10,0x06,
- 0x10,0x0A,0x10,0x0A,
- 0x10,0x0E,0x10,0x0E},
- demux_y = {0x10,0x01,0x10,0x03,
- 0x10,0x05,0x10,0x07,
- 0x10,0x09,0x10,0x0B,
- 0x10,0x0D,0x10,0x0F};
-
-/*
- this is so I can play live CCIR raw video
-*/
-static int altivec_uyvy_rgb32 (SwsContext *c,
- unsigned char **in, int *instrides,
- int srcSliceY, int srcSliceH,
- unsigned char **oplanes, int *outstrides)
-{
- int w = c->srcW;
- int h = srcSliceH;
- int i,j;
- vector unsigned char uyvy;
- vector signed short Y,U,V;
- vector signed short R0,G0,B0,R1,G1,B1;
- vector unsigned char R,G,B;
- vector unsigned char *out;
- ubyte *img;
-
- img = in[0];
- out = (vector unsigned char *)(oplanes[0]+srcSliceY*outstrides[0]);
-
- for (i=0;i<h;i++) {
- for (j=0;j<w/16;j++) {
- uyvy = vec_ld (0, img);
- U = (vector signed short)
- vec_perm (uyvy, (vector unsigned char){0}, demux_u);
-
- V = (vector signed short)
- vec_perm (uyvy, (vector unsigned char){0}, demux_v);
-
- Y = (vector signed short)
- vec_perm (uyvy, (vector unsigned char){0}, demux_y);
-
- cvtyuvtoRGB (c, Y,U,V,&R0,&G0,&B0);
-
- uyvy = vec_ld (16, img);
- U = (vector signed short)
- vec_perm (uyvy, (vector unsigned char){0}, demux_u);
-
- V = (vector signed short)
- vec_perm (uyvy, (vector unsigned char){0}, demux_v);
-
- Y = (vector signed short)
- vec_perm (uyvy, (vector unsigned char){0}, demux_y);
-
- cvtyuvtoRGB (c, Y,U,V,&R1,&G1,&B1);
-
- R = vec_packclp (R0,R1);
- G = vec_packclp (G0,G1);
- B = vec_packclp (B0,B1);
-
- // vec_mstbgr24 (R,G,B, out);
- out_rgba (R,G,B,out);
-
- img += 32;
- }
- }
- return srcSliceH;
-}
-
-
-
-/* Ok currently the acceleration routine only supports
- inputs of widths a multiple of 16
- and heights a multiple 2
-
- So we just fall back to the C codes for this.
-*/
-SwsFunc ff_yuv2rgb_init_altivec(SwsContext *c)
-{
- if (!(c->flags & SWS_CPU_CAPS_ALTIVEC))
- return NULL;
-
- /*
- and this seems not to matter too much I tried a bunch of
- videos with abnormal widths and MPlayer crashes elsewhere.
- mplayer -vo x11 -rawvideo on:w=350:h=240 raw-350x240.eyuv
- boom with X11 bad match.
-
- */
- if ((c->srcW & 0xf) != 0) return NULL;
-
- switch (c->srcFormat) {
- case PIX_FMT_YUV410P:
- case PIX_FMT_YUV420P:
- /*case IMGFMT_CLPL: ??? */
- case PIX_FMT_GRAY8:
- case PIX_FMT_NV12:
- case PIX_FMT_NV21:
- if ((c->srcH & 0x1) != 0)
- return NULL;
-
- switch(c->dstFormat) {
- case PIX_FMT_RGB24:
- av_log(c, AV_LOG_WARNING, "ALTIVEC: Color Space RGB24\n");
- return altivec_yuv2_rgb24;
- case PIX_FMT_BGR24:
- av_log(c, AV_LOG_WARNING, "ALTIVEC: Color Space BGR24\n");
- return altivec_yuv2_bgr24;
- case PIX_FMT_ARGB:
- av_log(c, AV_LOG_WARNING, "ALTIVEC: Color Space ARGB\n");
- return altivec_yuv2_argb;
- case PIX_FMT_ABGR:
- av_log(c, AV_LOG_WARNING, "ALTIVEC: Color Space ABGR\n");
- return altivec_yuv2_abgr;
- case PIX_FMT_RGBA:
- av_log(c, AV_LOG_WARNING, "ALTIVEC: Color Space RGBA\n");
- return altivec_yuv2_rgba;
- case PIX_FMT_BGRA:
- av_log(c, AV_LOG_WARNING, "ALTIVEC: Color Space BGRA\n");
- return altivec_yuv2_bgra;
- default: return NULL;
- }
- break;
-
- case PIX_FMT_UYVY422:
- switch(c->dstFormat) {
- case PIX_FMT_BGR32:
- av_log(c, AV_LOG_WARNING, "ALTIVEC: Color Space UYVY -> RGB32\n");
- return altivec_uyvy_rgb32;
- default: return NULL;
- }
- break;
-
- }
- return NULL;
-}
-
-void ff_yuv2rgb_init_tables_altivec(SwsContext *c, const int inv_table[4], int brightness, int contrast, int saturation)
-{
- union {
- DECLARE_ALIGNED(16, signed short, tmp)[8];
- vector signed short vec;
- } buf;
-
- buf.tmp[0] = ((0xffffLL) * contrast>>8)>>9; //cy
- buf.tmp[1] = -256*brightness; //oy
- buf.tmp[2] = (inv_table[0]>>3) *(contrast>>16)*(saturation>>16); //crv
- buf.tmp[3] = (inv_table[1]>>3) *(contrast>>16)*(saturation>>16); //cbu
- buf.tmp[4] = -((inv_table[2]>>1)*(contrast>>16)*(saturation>>16)); //cgu
- buf.tmp[5] = -((inv_table[3]>>1)*(contrast>>16)*(saturation>>16)); //cgv
-
-
- c->CSHIFT = (vector unsigned short)vec_splat_u16(2);
- c->CY = vec_splat ((vector signed short)buf.vec, 0);
- c->OY = vec_splat ((vector signed short)buf.vec, 1);
- c->CRV = vec_splat ((vector signed short)buf.vec, 2);
- c->CBU = vec_splat ((vector signed short)buf.vec, 3);
- c->CGU = vec_splat ((vector signed short)buf.vec, 4);
- c->CGV = vec_splat ((vector signed short)buf.vec, 5);
- return;
-}
-
-
-void
-ff_yuv2packedX_altivec(SwsContext *c,
- const int16_t *lumFilter, int16_t **lumSrc, int lumFilterSize,
- const int16_t *chrFilter, int16_t **chrSrc, int chrFilterSize,
- uint8_t *dest, int dstW, int dstY)
-{
- int i,j;
- vector signed short X,X0,X1,Y0,U0,V0,Y1,U1,V1,U,V;
- vector signed short R0,G0,B0,R1,G1,B1;
-
- vector unsigned char R,G,B;
- vector unsigned char *out,*nout;
-
- vector signed short RND = vec_splat_s16(1<<3);
- vector unsigned short SCL = vec_splat_u16(4);
- DECLARE_ALIGNED(16, unsigned long, scratch)[16];
-
- vector signed short *YCoeffs, *CCoeffs;
-
- YCoeffs = c->vYCoeffsBank+dstY*lumFilterSize;
- CCoeffs = c->vCCoeffsBank+dstY*chrFilterSize;
-
- out = (vector unsigned char *)dest;
-
- for (i=0; i<dstW; i+=16) {
- Y0 = RND;
- Y1 = RND;
- /* extract 16 coeffs from lumSrc */
- for (j=0; j<lumFilterSize; j++) {
- X0 = vec_ld (0, &lumSrc[j][i]);
- X1 = vec_ld (16, &lumSrc[j][i]);
- Y0 = vec_mradds (X0, YCoeffs[j], Y0);
- Y1 = vec_mradds (X1, YCoeffs[j], Y1);
- }
-
- U = RND;
- V = RND;
- /* extract 8 coeffs from U,V */
- for (j=0; j<chrFilterSize; j++) {
- X = vec_ld (0, &chrSrc[j][i/2]);
- U = vec_mradds (X, CCoeffs[j], U);
- X = vec_ld (0, &chrSrc[j][i/2+2048]);
- V = vec_mradds (X, CCoeffs[j], V);
- }
-
- /* scale and clip signals */
- Y0 = vec_sra (Y0, SCL);
- Y1 = vec_sra (Y1, SCL);
- U = vec_sra (U, SCL);
- V = vec_sra (V, SCL);
-
- Y0 = vec_clip_s16 (Y0);
- Y1 = vec_clip_s16 (Y1);
- U = vec_clip_s16 (U);
- V = vec_clip_s16 (V);
-
- /* now we have
- Y0= y0 y1 y2 y3 y4 y5 y6 y7 Y1= y8 y9 y10 y11 y12 y13 y14 y15
- U= u0 u1 u2 u3 u4 u5 u6 u7 V= v0 v1 v2 v3 v4 v5 v6 v7
-
- Y0= y0 y1 y2 y3 y4 y5 y6 y7 Y1= y8 y9 y10 y11 y12 y13 y14 y15
- U0= u0 u0 u1 u1 u2 u2 u3 u3 U1= u4 u4 u5 u5 u6 u6 u7 u7
- V0= v0 v0 v1 v1 v2 v2 v3 v3 V1= v4 v4 v5 v5 v6 v6 v7 v7
- */
-
- U0 = vec_mergeh (U,U);
- V0 = vec_mergeh (V,V);
-
- U1 = vec_mergel (U,U);
- V1 = vec_mergel (V,V);
-
- cvtyuvtoRGB (c, Y0,U0,V0,&R0,&G0,&B0);
- cvtyuvtoRGB (c, Y1,U1,V1,&R1,&G1,&B1);
-
- R = vec_packclp (R0,R1);
- G = vec_packclp (G0,G1);
- B = vec_packclp (B0,B1);
-
- switch(c->dstFormat) {
- case PIX_FMT_ABGR: out_abgr (R,G,B,out); break;
- case PIX_FMT_BGRA: out_bgra (R,G,B,out); break;
- case PIX_FMT_RGBA: out_rgba (R,G,B,out); break;
- case PIX_FMT_ARGB: out_argb (R,G,B,out); break;
- case PIX_FMT_RGB24: out_rgb24 (R,G,B,out); break;
- case PIX_FMT_BGR24: out_bgr24 (R,G,B,out); break;
- default:
- {
- /* If this is reached, the caller should have called yuv2packedXinC
- instead. */
- static int printed_error_message;
- if (!printed_error_message) {
- av_log(c, AV_LOG_ERROR, "altivec_yuv2packedX doesn't support %s output\n",
- sws_format_name(c->dstFormat));
- printed_error_message=1;
- }
- return;
- }
- }
- }
-
- if (i < dstW) {
- i -= 16;
-
- Y0 = RND;
- Y1 = RND;
- /* extract 16 coeffs from lumSrc */
- for (j=0; j<lumFilterSize; j++) {
- X0 = vec_ld (0, &lumSrc[j][i]);
- X1 = vec_ld (16, &lumSrc[j][i]);
- Y0 = vec_mradds (X0, YCoeffs[j], Y0);
- Y1 = vec_mradds (X1, YCoeffs[j], Y1);
- }
-
- U = RND;
- V = RND;
- /* extract 8 coeffs from U,V */
- for (j=0; j<chrFilterSize; j++) {
- X = vec_ld (0, &chrSrc[j][i/2]);
- U = vec_mradds (X, CCoeffs[j], U);
- X = vec_ld (0, &chrSrc[j][i/2+2048]);
- V = vec_mradds (X, CCoeffs[j], V);
- }
-
- /* scale and clip signals */
- Y0 = vec_sra (Y0, SCL);
- Y1 = vec_sra (Y1, SCL);
- U = vec_sra (U, SCL);
- V = vec_sra (V, SCL);
-
- Y0 = vec_clip_s16 (Y0);
- Y1 = vec_clip_s16 (Y1);
- U = vec_clip_s16 (U);
- V = vec_clip_s16 (V);
-
- /* now we have
- Y0= y0 y1 y2 y3 y4 y5 y6 y7 Y1= y8 y9 y10 y11 y12 y13 y14 y15
- U = u0 u1 u2 u3 u4 u5 u6 u7 V = v0 v1 v2 v3 v4 v5 v6 v7
-
- Y0= y0 y1 y2 y3 y4 y5 y6 y7 Y1= y8 y9 y10 y11 y12 y13 y14 y15
- U0= u0 u0 u1 u1 u2 u2 u3 u3 U1= u4 u4 u5 u5 u6 u6 u7 u7
- V0= v0 v0 v1 v1 v2 v2 v3 v3 V1= v4 v4 v5 v5 v6 v6 v7 v7
- */
-
- U0 = vec_mergeh (U,U);
- V0 = vec_mergeh (V,V);
-
- U1 = vec_mergel (U,U);
- V1 = vec_mergel (V,V);
-
- cvtyuvtoRGB (c, Y0,U0,V0,&R0,&G0,&B0);
- cvtyuvtoRGB (c, Y1,U1,V1,&R1,&G1,&B1);
-
- R = vec_packclp (R0,R1);
- G = vec_packclp (G0,G1);
- B = vec_packclp (B0,B1);
-
- nout = (vector unsigned char *)scratch;
- switch(c->dstFormat) {
- case PIX_FMT_ABGR: out_abgr (R,G,B,nout); break;
- case PIX_FMT_BGRA: out_bgra (R,G,B,nout); break;
- case PIX_FMT_RGBA: out_rgba (R,G,B,nout); break;
- case PIX_FMT_ARGB: out_argb (R,G,B,nout); break;
- case PIX_FMT_RGB24: out_rgb24 (R,G,B,nout); break;
- case PIX_FMT_BGR24: out_bgr24 (R,G,B,nout); break;
- default:
- /* Unreachable, I think. */
- av_log(c, AV_LOG_ERROR, "altivec_yuv2packedX doesn't support %s output\n",
- sws_format_name(c->dstFormat));
- return;
- }
-
- memcpy (&((uint32_t*)dest)[i], scratch, (dstW-i)/4);
- }
-
-}
diff --git a/libswscale/rgb2rgb.c b/libswscale/rgb2rgb.c
deleted file mode 100644
index 1dc728ab9d..0000000000
--- a/libswscale/rgb2rgb.c
+++ /dev/null
@@ -1,444 +0,0 @@
-/*
- * software RGB to RGB converter
- * pluralize by software PAL8 to RGB converter
- * software YUV to YUV converter
- * software YUV to RGB converter
- * Written by Nick Kurshev.
- * palette & YUV & runtime CPU stuff by Michael (michaelni@gmx.at)
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * The C code (not assembly, MMX, ...) of this file can be used
- * under the LGPL license.
- */
-#include <inttypes.h>
-#include "config.h"
-#include "libavutil/x86_cpu.h"
-#include "libavutil/bswap.h"
-#include "rgb2rgb.h"
-#include "swscale.h"
-#include "swscale_internal.h"
-
-#define FAST_BGR2YV12 // use 7-bit instead of 15-bit coefficients
-
-void (*rgb24tobgr32)(const uint8_t *src, uint8_t *dst, long src_size);
-void (*rgb24tobgr16)(const uint8_t *src, uint8_t *dst, long src_size);
-void (*rgb24tobgr15)(const uint8_t *src, uint8_t *dst, long src_size);
-void (*rgb32tobgr24)(const uint8_t *src, uint8_t *dst, long src_size);
-void (*rgb32to16)(const uint8_t *src, uint8_t *dst, long src_size);
-void (*rgb32to15)(const uint8_t *src, uint8_t *dst, long src_size);
-void (*rgb15to16)(const uint8_t *src, uint8_t *dst, long src_size);
-void (*rgb15tobgr24)(const uint8_t *src, uint8_t *dst, long src_size);
-void (*rgb15to32)(const uint8_t *src, uint8_t *dst, long src_size);
-void (*rgb16to15)(const uint8_t *src, uint8_t *dst, long src_size);
-void (*rgb16tobgr24)(const uint8_t *src, uint8_t *dst, long src_size);
-void (*rgb16to32)(const uint8_t *src, uint8_t *dst, long src_size);
-void (*rgb24tobgr24)(const uint8_t *src, uint8_t *dst, long src_size);
-void (*rgb24to16)(const uint8_t *src, uint8_t *dst, long src_size);
-void (*rgb24to15)(const uint8_t *src, uint8_t *dst, long src_size);
-void (*rgb32tobgr32)(const uint8_t *src, uint8_t *dst, long src_size);
-void (*rgb32tobgr16)(const uint8_t *src, uint8_t *dst, long src_size);
-void (*rgb32tobgr15)(const uint8_t *src, uint8_t *dst, long src_size);
-
-void (*yv12toyuy2)(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc, uint8_t *dst,
- long width, long height,
- long lumStride, long chromStride, long dstStride);
-void (*yv12touyvy)(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc, uint8_t *dst,
- long width, long height,
- long lumStride, long chromStride, long dstStride);
-void (*yuv422ptoyuy2)(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc, uint8_t *dst,
- long width, long height,
- long lumStride, long chromStride, long dstStride);
-void (*yuv422ptouyvy)(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc, uint8_t *dst,
- long width, long height,
- long lumStride, long chromStride, long dstStride);
-void (*yuy2toyv12)(const uint8_t *src, uint8_t *ydst, uint8_t *udst, uint8_t *vdst,
- long width, long height,
- long lumStride, long chromStride, long srcStride);
-void (*rgb24toyv12)(const uint8_t *src, uint8_t *ydst, uint8_t *udst, uint8_t *vdst,
- long width, long height,
- long lumStride, long chromStride, long srcStride);
-void (*planar2x)(const uint8_t *src, uint8_t *dst, long width, long height,
- long srcStride, long dstStride);
-void (*interleaveBytes)(const uint8_t *src1, const uint8_t *src2, uint8_t *dst,
- long width, long height, long src1Stride,
- long src2Stride, long dstStride);
-void (*vu9_to_vu12)(const uint8_t *src1, const uint8_t *src2,
- uint8_t *dst1, uint8_t *dst2,
- long width, long height,
- long srcStride1, long srcStride2,
- long dstStride1, long dstStride2);
-void (*yvu9_to_yuy2)(const uint8_t *src1, const uint8_t *src2, const uint8_t *src3,
- uint8_t *dst,
- long width, long height,
- long srcStride1, long srcStride2,
- long srcStride3, long dstStride);
-void (*uyvytoyuv420)(uint8_t *ydst, uint8_t *udst, uint8_t *vdst, const uint8_t *src,
- long width, long height,
- long lumStride, long chromStride, long srcStride);
-void (*uyvytoyuv422)(uint8_t *ydst, uint8_t *udst, uint8_t *vdst, const uint8_t *src,
- long width, long height,
- long lumStride, long chromStride, long srcStride);
-void (*yuyvtoyuv420)(uint8_t *ydst, uint8_t *udst, uint8_t *vdst, const uint8_t *src,
- long width, long height,
- long lumStride, long chromStride, long srcStride);
-void (*yuyvtoyuv422)(uint8_t *ydst, uint8_t *udst, uint8_t *vdst, const uint8_t *src,
- long width, long height,
- long lumStride, long chromStride, long srcStride);
-
-
-#if ARCH_X86 && CONFIG_GPL
-DECLARE_ASM_CONST(8, uint64_t, mmx_null) = 0x0000000000000000ULL;
-DECLARE_ASM_CONST(8, uint64_t, mmx_one) = 0xFFFFFFFFFFFFFFFFULL;
-DECLARE_ASM_CONST(8, uint64_t, mask32b) = 0x000000FF000000FFULL;
-DECLARE_ASM_CONST(8, uint64_t, mask32g) = 0x0000FF000000FF00ULL;
-DECLARE_ASM_CONST(8, uint64_t, mask32r) = 0x00FF000000FF0000ULL;
-DECLARE_ASM_CONST(8, uint64_t, mask32a) = 0xFF000000FF000000ULL;
-DECLARE_ASM_CONST(8, uint64_t, mask32) = 0x00FFFFFF00FFFFFFULL;
-DECLARE_ASM_CONST(8, uint64_t, mask3216br) = 0x00F800F800F800F8ULL;
-DECLARE_ASM_CONST(8, uint64_t, mask3216g) = 0x0000FC000000FC00ULL;
-DECLARE_ASM_CONST(8, uint64_t, mask3215g) = 0x0000F8000000F800ULL;
-DECLARE_ASM_CONST(8, uint64_t, mul3216) = 0x2000000420000004ULL;
-DECLARE_ASM_CONST(8, uint64_t, mul3215) = 0x2000000820000008ULL;
-DECLARE_ASM_CONST(8, uint64_t, mask24b) = 0x00FF0000FF0000FFULL;
-DECLARE_ASM_CONST(8, uint64_t, mask24g) = 0xFF0000FF0000FF00ULL;
-DECLARE_ASM_CONST(8, uint64_t, mask24r) = 0x0000FF0000FF0000ULL;
-DECLARE_ASM_CONST(8, uint64_t, mask24l) = 0x0000000000FFFFFFULL;
-DECLARE_ASM_CONST(8, uint64_t, mask24h) = 0x0000FFFFFF000000ULL;
-DECLARE_ASM_CONST(8, uint64_t, mask24hh) = 0xffff000000000000ULL;
-DECLARE_ASM_CONST(8, uint64_t, mask24hhh) = 0xffffffff00000000ULL;
-DECLARE_ASM_CONST(8, uint64_t, mask24hhhh) = 0xffffffffffff0000ULL;
-DECLARE_ASM_CONST(8, uint64_t, mask15b) = 0x001F001F001F001FULL; /* 00000000 00011111 xxB */
-DECLARE_ASM_CONST(8, uint64_t, mask15rg) = 0x7FE07FE07FE07FE0ULL; /* 01111111 11100000 RGx */
-DECLARE_ASM_CONST(8, uint64_t, mask15s) = 0xFFE0FFE0FFE0FFE0ULL;
-DECLARE_ASM_CONST(8, uint64_t, mask15g) = 0x03E003E003E003E0ULL;
-DECLARE_ASM_CONST(8, uint64_t, mask15r) = 0x7C007C007C007C00ULL;
-#define mask16b mask15b
-DECLARE_ASM_CONST(8, uint64_t, mask16g) = 0x07E007E007E007E0ULL;
-DECLARE_ASM_CONST(8, uint64_t, mask16r) = 0xF800F800F800F800ULL;
-DECLARE_ASM_CONST(8, uint64_t, red_16mask) = 0x0000f8000000f800ULL;
-DECLARE_ASM_CONST(8, uint64_t, green_16mask) = 0x000007e0000007e0ULL;
-DECLARE_ASM_CONST(8, uint64_t, blue_16mask) = 0x0000001f0000001fULL;
-DECLARE_ASM_CONST(8, uint64_t, red_15mask) = 0x00007c0000007c00ULL;
-DECLARE_ASM_CONST(8, uint64_t, green_15mask) = 0x000003e0000003e0ULL;
-DECLARE_ASM_CONST(8, uint64_t, blue_15mask) = 0x0000001f0000001fULL;
-#endif /* ARCH_X86 */
-
-#define RGB2YUV_SHIFT 8
-#define BY ((int)( 0.098*(1<<RGB2YUV_SHIFT)+0.5))
-#define BV ((int)(-0.071*(1<<RGB2YUV_SHIFT)+0.5))
-#define BU ((int)( 0.439*(1<<RGB2YUV_SHIFT)+0.5))
-#define GY ((int)( 0.504*(1<<RGB2YUV_SHIFT)+0.5))
-#define GV ((int)(-0.368*(1<<RGB2YUV_SHIFT)+0.5))
-#define GU ((int)(-0.291*(1<<RGB2YUV_SHIFT)+0.5))
-#define RY ((int)( 0.257*(1<<RGB2YUV_SHIFT)+0.5))
-#define RV ((int)( 0.439*(1<<RGB2YUV_SHIFT)+0.5))
-#define RU ((int)(-0.148*(1<<RGB2YUV_SHIFT)+0.5))
-
-//Note: We have C, MMX, MMX2, 3DNOW versions, there is no 3DNOW + MMX2 one.
-//plain C versions
-#undef HAVE_MMX
-#undef HAVE_MMX2
-#undef HAVE_AMD3DNOW
-#undef HAVE_SSE2
-#define HAVE_MMX 0
-#define HAVE_MMX2 0
-#define HAVE_AMD3DNOW 0
-#define HAVE_SSE2 0
-#define RENAME(a) a ## _C
-#include "rgb2rgb_template.c"
-
-#if ARCH_X86 && CONFIG_GPL
-
-//MMX versions
-#undef RENAME
-#undef HAVE_MMX
-#define HAVE_MMX 1
-#define RENAME(a) a ## _MMX
-#include "rgb2rgb_template.c"
-
-//MMX2 versions
-#undef RENAME
-#undef HAVE_MMX2
-#define HAVE_MMX2 1
-#define RENAME(a) a ## _MMX2
-#include "rgb2rgb_template.c"
-
-//3DNOW versions
-#undef RENAME
-#undef HAVE_MMX2
-#undef HAVE_AMD3DNOW
-#define HAVE_MMX2 0
-#define HAVE_AMD3DNOW 1
-#define RENAME(a) a ## _3DNOW
-#include "rgb2rgb_template.c"
-
-#endif //ARCH_X86 || ARCH_X86_64
-
-/*
- RGB15->RGB16 original by Strepto/Astral
- ported to gcc & bugfixed : A'rpi
- MMX2, 3DNOW optimization by Nick Kurshev
- 32-bit C version, and and&add trick by Michael Niedermayer
-*/
-
-void sws_rgb2rgb_init(int flags)
-{
-#if (HAVE_MMX2 || HAVE_AMD3DNOW || HAVE_MMX) && CONFIG_GPL
- if (flags & SWS_CPU_CAPS_MMX2)
- rgb2rgb_init_MMX2();
- else if (flags & SWS_CPU_CAPS_3DNOW)
- rgb2rgb_init_3DNOW();
- else if (flags & SWS_CPU_CAPS_MMX)
- rgb2rgb_init_MMX();
- else
-#endif /* HAVE_MMX2 || HAVE_AMD3DNOW || HAVE_MMX */
- rgb2rgb_init_C();
-}
-
-/**
- * Convert the palette to the same packet 32-bit format as the palette
- */
-void palette8topacked32(const uint8_t *src, uint8_t *dst, long num_pixels, const uint8_t *palette)
-{
- long i;
-
- for (i=0; i<num_pixels; i++)
- ((uint32_t *) dst)[i] = ((const uint32_t *) palette)[src[i]];
-}
-
-/**
- * Palette format: ABCD -> dst format: ABC
- */
-void palette8topacked24(const uint8_t *src, uint8_t *dst, long num_pixels, const uint8_t *palette)
-{
- long i;
-
- for (i=0; i<num_pixels; i++) {
- //FIXME slow?
- dst[0]= palette[src[i]*4+0];
- dst[1]= palette[src[i]*4+1];
- dst[2]= palette[src[i]*4+2];
- dst+= 3;
- }
-}
-
-/**
- * Palette is assumed to contain BGR16, see rgb32to16 to convert the palette.
- */
-void palette8torgb16(const uint8_t *src, uint8_t *dst, long num_pixels, const uint8_t *palette)
-{
- long i;
- for (i=0; i<num_pixels; i++)
- ((uint16_t *)dst)[i] = ((const uint16_t *)palette)[src[i]];
-}
-void palette8tobgr16(const uint8_t *src, uint8_t *dst, long num_pixels, const uint8_t *palette)
-{
- long i;
- for (i=0; i<num_pixels; i++)
- ((uint16_t *)dst)[i] = bswap_16(((const uint16_t *)palette)[src[i]]);
-}
-
-/**
- * Palette is assumed to contain BGR15, see rgb32to15 to convert the palette.
- */
-void palette8torgb15(const uint8_t *src, uint8_t *dst, long num_pixels, const uint8_t *palette)
-{
- long i;
- for (i=0; i<num_pixels; i++)
- ((uint16_t *)dst)[i] = ((const uint16_t *)palette)[src[i]];
-}
-void palette8tobgr15(const uint8_t *src, uint8_t *dst, long num_pixels, const uint8_t *palette)
-{
- long i;
- for (i=0; i<num_pixels; i++)
- ((uint16_t *)dst)[i] = bswap_16(((const uint16_t *)palette)[src[i]]);
-}
-
-void rgb32to24(const uint8_t *src, uint8_t *dst, long src_size)
-{
- long i;
- long num_pixels = src_size >> 2;
- for (i=0; i<num_pixels; i++) {
-#if HAVE_BIGENDIAN
- /* RGB32 (= A,B,G,R) -> BGR24 (= B,G,R) */
- dst[3*i + 0] = src[4*i + 1];
- dst[3*i + 1] = src[4*i + 2];
- dst[3*i + 2] = src[4*i + 3];
-#else
- dst[3*i + 0] = src[4*i + 2];
- dst[3*i + 1] = src[4*i + 1];
- dst[3*i + 2] = src[4*i + 0];
-#endif
- }
-}
-
-void rgb24to32(const uint8_t *src, uint8_t *dst, long src_size)
-{
- long i;
- for (i=0; 3*i<src_size; i++) {
-#if HAVE_BIGENDIAN
- /* RGB24 (= R,G,B) -> BGR32 (= A,R,G,B) */
- dst[4*i + 0] = 255;
- dst[4*i + 1] = src[3*i + 0];
- dst[4*i + 2] = src[3*i + 1];
- dst[4*i + 3] = src[3*i + 2];
-#else
- dst[4*i + 0] = src[3*i + 2];
- dst[4*i + 1] = src[3*i + 1];
- dst[4*i + 2] = src[3*i + 0];
- dst[4*i + 3] = 255;
-#endif
- }
-}
-
-void rgb16tobgr32(const uint8_t *src, uint8_t *dst, long src_size)
-{
- const uint16_t *end;
- uint8_t *d = dst;
- const uint16_t *s = (const uint16_t *)src;
- end = s + src_size/2;
- while (s < end) {
- register uint16_t bgr;
- bgr = *s++;
-#if HAVE_BIGENDIAN
- *d++ = 255;
- *d++ = (bgr&0x1F)<<3;
- *d++ = (bgr&0x7E0)>>3;
- *d++ = (bgr&0xF800)>>8;
-#else
- *d++ = (bgr&0xF800)>>8;
- *d++ = (bgr&0x7E0)>>3;
- *d++ = (bgr&0x1F)<<3;
- *d++ = 255;
-#endif
- }
-}
-
-void rgb16to24(const uint8_t *src, uint8_t *dst, long src_size)
-{
- const uint16_t *end;
- uint8_t *d = dst;
- const uint16_t *s = (const uint16_t *)src;
- end = s + src_size/2;
- while (s < end) {
- register uint16_t bgr;
- bgr = *s++;
- *d++ = (bgr&0xF800)>>8;
- *d++ = (bgr&0x7E0)>>3;
- *d++ = (bgr&0x1F)<<3;
- }
-}
-
-void rgb16tobgr16(const uint8_t *src, uint8_t *dst, long src_size)
-{
- long i;
- long num_pixels = src_size >> 1;
-
- for (i=0; i<num_pixels; i++) {
- unsigned rgb = ((const uint16_t*)src)[i];
- ((uint16_t*)dst)[i] = (rgb>>11) | (rgb&0x7E0) | (rgb<<11);
- }
-}
-
-void rgb16tobgr15(const uint8_t *src, uint8_t *dst, long src_size)
-{
- long i;
- long num_pixels = src_size >> 1;
-
- for (i=0; i<num_pixels; i++) {
- unsigned rgb = ((const uint16_t*)src)[i];
- ((uint16_t*)dst)[i] = (rgb>>11) | ((rgb&0x7C0)>>1) | ((rgb&0x1F)<<10);
- }
-}
-
-void rgb15tobgr32(const uint8_t *src, uint8_t *dst, long src_size)
-{
- const uint16_t *end;
- uint8_t *d = dst;
- const uint16_t *s = (const uint16_t *)src;
- end = s + src_size/2;
- while (s < end) {
- register uint16_t bgr;
- bgr = *s++;
-#if HAVE_BIGENDIAN
- *d++ = 255;
- *d++ = (bgr&0x1F)<<3;
- *d++ = (bgr&0x3E0)>>2;
- *d++ = (bgr&0x7C00)>>7;
-#else
- *d++ = (bgr&0x7C00)>>7;
- *d++ = (bgr&0x3E0)>>2;
- *d++ = (bgr&0x1F)<<3;
- *d++ = 255;
-#endif
- }
-}
-
-void rgb15to24(const uint8_t *src, uint8_t *dst, long src_size)
-{
- const uint16_t *end;
- uint8_t *d = dst;
- const uint16_t *s = (const uint16_t *)src;
- end = s + src_size/2;
- while (s < end) {
- register uint16_t bgr;
- bgr = *s++;
- *d++ = (bgr&0x7C00)>>7;
- *d++ = (bgr&0x3E0)>>2;
- *d++ = (bgr&0x1F)<<3;
- }
-}
-
-void rgb15tobgr16(const uint8_t *src, uint8_t *dst, long src_size)
-{
- long i;
- long num_pixels = src_size >> 1;
-
- for (i=0; i<num_pixels; i++) {
- unsigned rgb = ((const uint16_t*)src)[i];
- ((uint16_t*)dst)[i] = ((rgb&0x7C00)>>10) | ((rgb&0x3E0)<<1) | (rgb<<11);
- }
-}
-
-void rgb15tobgr15(const uint8_t *src, uint8_t *dst, long src_size)
-{
- long i;
- long num_pixels = src_size >> 1;
-
- for (i=0; i<num_pixels; i++) {
- unsigned br;
- unsigned rgb = ((const uint16_t*)src)[i];
- br = rgb&0x7c1F;
- ((uint16_t*)dst)[i] = (br>>10) | (rgb&0x3E0) | (br<<10);
- }
-}
-
-void bgr8torgb8(const uint8_t *src, uint8_t *dst, long src_size)
-{
- long i;
- long num_pixels = src_size;
- for (i=0; i<num_pixels; i++) {
- unsigned b,g,r;
- register uint8_t rgb;
- rgb = src[i];
- r = (rgb&0x07);
- g = (rgb&0x38)>>3;
- b = (rgb&0xC0)>>6;
- dst[i] = ((b<<1)&0x07) | ((g&0x07)<<3) | ((r&0x03)<<6);
- }
-}
diff --git a/libswscale/rgb2rgb.h b/libswscale/rgb2rgb.h
deleted file mode 100644
index 740b04e1cb..0000000000
--- a/libswscale/rgb2rgb.h
+++ /dev/null
@@ -1,161 +0,0 @@
-/*
- * software RGB to RGB converter
- * pluralize by Software PAL8 to RGB converter
- * Software YUV to YUV converter
- * Software YUV to RGB converter
- * Written by Nick Kurshev.
- * palette & YUV & runtime CPU stuff by Michael (michaelni@gmx.at)
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * FFmpeg 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef SWSCALE_RGB2RGB_H
-#define SWSCALE_RGB2RGB_H
-
-#include <inttypes.h>
-
-/* A full collection of RGB to RGB(BGR) converters */
-extern void (*rgb24tobgr32)(const uint8_t *src, uint8_t *dst, long src_size);
-extern void (*rgb24tobgr16)(const uint8_t *src, uint8_t *dst, long src_size);
-extern void (*rgb24tobgr15)(const uint8_t *src, uint8_t *dst, long src_size);
-extern void (*rgb32tobgr24)(const uint8_t *src, uint8_t *dst, long src_size);
-extern void (*rgb32to16) (const uint8_t *src, uint8_t *dst, long src_size);
-extern void (*rgb32to15) (const uint8_t *src, uint8_t *dst, long src_size);
-extern void (*rgb15to16) (const uint8_t *src, uint8_t *dst, long src_size);
-extern void (*rgb15tobgr24)(const uint8_t *src, uint8_t *dst, long src_size);
-extern void (*rgb15to32) (const uint8_t *src, uint8_t *dst, long src_size);
-extern void (*rgb16to15) (const uint8_t *src, uint8_t *dst, long src_size);
-extern void (*rgb16tobgr24)(const uint8_t *src, uint8_t *dst, long src_size);
-extern void (*rgb16to32) (const uint8_t *src, uint8_t *dst, long src_size);
-extern void (*rgb24tobgr24)(const uint8_t *src, uint8_t *dst, long src_size);
-extern void (*rgb24to16) (const uint8_t *src, uint8_t *dst, long src_size);
-extern void (*rgb24to15) (const uint8_t *src, uint8_t *dst, long src_size);
-extern void (*rgb32tobgr32)(const uint8_t *src, uint8_t *dst, long src_size);
-extern void (*rgb32tobgr16)(const uint8_t *src, uint8_t *dst, long src_size);
-extern void (*rgb32tobgr15)(const uint8_t *src, uint8_t *dst, long src_size);
-
-void rgb24to32 (const uint8_t *src, uint8_t *dst, long src_size);
-void rgb32to24 (const uint8_t *src, uint8_t *dst, long src_size);
-void rgb16tobgr32(const uint8_t *src, uint8_t *dst, long src_size);
-void rgb16to24 (const uint8_t *src, uint8_t *dst, long src_size);
-void rgb16tobgr16(const uint8_t *src, uint8_t *dst, long src_size);
-void rgb16tobgr15(const uint8_t *src, uint8_t *dst, long src_size);
-void rgb15tobgr32(const uint8_t *src, uint8_t *dst, long src_size);
-void rgb15to24 (const uint8_t *src, uint8_t *dst, long src_size);
-void rgb15tobgr16(const uint8_t *src, uint8_t *dst, long src_size);
-void rgb15tobgr15(const uint8_t *src, uint8_t *dst, long src_size);
-void bgr8torgb8 (const uint8_t *src, uint8_t *dst, long src_size);
-
-
-void palette8topacked32(const uint8_t *src, uint8_t *dst, long num_pixels, const uint8_t *palette);
-void palette8topacked24(const uint8_t *src, uint8_t *dst, long num_pixels, const uint8_t *palette);
-void palette8torgb16(const uint8_t *src, uint8_t *dst, long num_pixels, const uint8_t *palette);
-void palette8tobgr16(const uint8_t *src, uint8_t *dst, long num_pixels, const uint8_t *palette);
-void palette8torgb15(const uint8_t *src, uint8_t *dst, long num_pixels, const uint8_t *palette);
-void palette8tobgr15(const uint8_t *src, uint8_t *dst, long num_pixels, const uint8_t *palette);
-
-/**
- * Height should be a multiple of 2 and width should be a multiple of 16.
- * (If this is a problem for anyone then tell me, and I will fix it.)
- * Chrominance data is only taken from every second line, others are ignored.
- * FIXME: Write high quality version.
- */
-//void uyvytoyv12(const uint8_t *src, uint8_t *ydst, uint8_t *udst, uint8_t *vdst,
-
-/**
- * Height should be a multiple of 2 and width should be a multiple of 16.
- * (If this is a problem for anyone then tell me, and I will fix it.)
- */
-extern void (*yv12toyuy2)(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc, uint8_t *dst,
- long width, long height,
- long lumStride, long chromStride, long dstStride);
-
-/**
- * Width should be a multiple of 16.
- */
-extern void (*yuv422ptoyuy2)(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc, uint8_t *dst,
- long width, long height,
- long lumStride, long chromStride, long dstStride);
-
-/**
- * Height should be a multiple of 2 and width should be a multiple of 16.
- * (If this is a problem for anyone then tell me, and I will fix it.)
- */
-extern void (*yuy2toyv12)(const uint8_t *src, uint8_t *ydst, uint8_t *udst, uint8_t *vdst,
- long width, long height,
- long lumStride, long chromStride, long srcStride);
-
-/**
- * Height should be a multiple of 2 and width should be a multiple of 16.
- * (If this is a problem for anyone then tell me, and I will fix it.)
- */
-extern void (*yv12touyvy)(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc, uint8_t *dst,
- long width, long height,
- long lumStride, long chromStride, long dstStride);
-
-/**
- * Width should be a multiple of 16.
- */
-extern void (*yuv422ptouyvy)(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc, uint8_t *dst,
- long width, long height,
- long lumStride, long chromStride, long dstStride);
-
-/**
- * Height should be a multiple of 2 and width should be a multiple of 2.
- * (If this is a problem for anyone then tell me, and I will fix it.)
- * Chrominance data is only taken from every second line, others are ignored.
- * FIXME: Write high quality version.
- */
-extern void (*rgb24toyv12)(const uint8_t *src, uint8_t *ydst, uint8_t *udst, uint8_t *vdst,
- long width, long height,
- long lumStride, long chromStride, long srcStride);
-extern void (*planar2x)(const uint8_t *src, uint8_t *dst, long width, long height,
- long srcStride, long dstStride);
-
-extern void (*interleaveBytes)(const uint8_t *src1, const uint8_t *src2, uint8_t *dst,
- long width, long height, long src1Stride,
- long src2Stride, long dstStride);
-
-extern void (*vu9_to_vu12)(const uint8_t *src1, const uint8_t *src2,
- uint8_t *dst1, uint8_t *dst2,
- long width, long height,
- long srcStride1, long srcStride2,
- long dstStride1, long dstStride2);
-
-extern void (*yvu9_to_yuy2)(const uint8_t *src1, const uint8_t *src2, const uint8_t *src3,
- uint8_t *dst,
- long width, long height,
- long srcStride1, long srcStride2,
- long srcStride3, long dstStride);
-
-
-extern void (*uyvytoyuv420)(uint8_t *ydst, uint8_t *udst, uint8_t *vdst, const uint8_t *src,
- long width, long height,
- long lumStride, long chromStride, long srcStride);
-extern void (*uyvytoyuv422)(uint8_t *ydst, uint8_t *udst, uint8_t *vdst, const uint8_t *src,
- long width, long height,
- long lumStride, long chromStride, long srcStride);
-extern void (*yuyvtoyuv420)(uint8_t *ydst, uint8_t *udst, uint8_t *vdst, const uint8_t *src,
- long width, long height,
- long lumStride, long chromStride, long srcStride);
-extern void (*yuyvtoyuv422)(uint8_t *ydst, uint8_t *udst, uint8_t *vdst, const uint8_t *src,
- long width, long height,
- long lumStride, long chromStride, long srcStride);
-
-void sws_rgb2rgb_init(int flags);
-
-#endif /* SWSCALE_RGB2RGB_H */
diff --git a/libswscale/rgb2rgb_template.c b/libswscale/rgb2rgb_template.c
deleted file mode 100644
index 8d027c1d7a..0000000000
--- a/libswscale/rgb2rgb_template.c
+++ /dev/null
@@ -1,3010 +0,0 @@
-/*
- * software RGB to RGB converter
- * pluralize by software PAL8 to RGB converter
- * software YUV to YUV converter
- * software YUV to RGB converter
- * Written by Nick Kurshev.
- * palette & YUV & runtime CPU stuff by Michael (michaelni@gmx.at)
- * lot of big-endian byte order fixes by Alex Beregszaszi
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * The C code (not assembly, MMX, ...) of this file can be used
- * under the LGPL license.
- */
-
-#include <stddef.h>
-
-#undef PREFETCH
-#undef MOVNTQ
-#undef EMMS
-#undef SFENCE
-#undef MMREG_SIZE
-#undef PAVGB
-
-#if HAVE_SSE2
-#define MMREG_SIZE 16
-#else
-#define MMREG_SIZE 8
-#endif
-
-#if HAVE_AMD3DNOW
-#define PREFETCH "prefetch"
-#define PAVGB "pavgusb"
-#elif HAVE_MMX2
-#define PREFETCH "prefetchnta"
-#define PAVGB "pavgb"
-#else
-#define PREFETCH " # nop"
-#endif
-
-#if HAVE_AMD3DNOW
-/* On K6 femms is faster than emms. On K7 femms is directly mapped to emms. */
-#define EMMS "femms"
-#else
-#define EMMS "emms"
-#endif
-
-#if HAVE_MMX2
-#define MOVNTQ "movntq"
-#define SFENCE "sfence"
-#else
-#define MOVNTQ "movq"
-#define SFENCE " # nop"
-#endif
-
-static inline void RENAME(rgb24tobgr32)(const uint8_t *src, uint8_t *dst, long src_size)
-{
- uint8_t *dest = dst;
- const uint8_t *s = src;
- const uint8_t *end;
-#if HAVE_MMX
- const uint8_t *mm_end;
-#endif
- end = s + src_size;
-#if HAVE_MMX
- __asm__ volatile(PREFETCH" %0"::"m"(*s):"memory");
- mm_end = end - 23;
- __asm__ volatile("movq %0, %%mm7"::"m"(mask32a):"memory");
- while (s < mm_end) {
- __asm__ volatile(
- PREFETCH" 32%1 \n\t"
- "movd %1, %%mm0 \n\t"
- "punpckldq 3%1, %%mm0 \n\t"
- "movd 6%1, %%mm1 \n\t"
- "punpckldq 9%1, %%mm1 \n\t"
- "movd 12%1, %%mm2 \n\t"
- "punpckldq 15%1, %%mm2 \n\t"
- "movd 18%1, %%mm3 \n\t"
- "punpckldq 21%1, %%mm3 \n\t"
- "por %%mm7, %%mm0 \n\t"
- "por %%mm7, %%mm1 \n\t"
- "por %%mm7, %%mm2 \n\t"
- "por %%mm7, %%mm3 \n\t"
- MOVNTQ" %%mm0, %0 \n\t"
- MOVNTQ" %%mm1, 8%0 \n\t"
- MOVNTQ" %%mm2, 16%0 \n\t"
- MOVNTQ" %%mm3, 24%0"
- :"=m"(*dest)
- :"m"(*s)
- :"memory");
- dest += 32;
- s += 24;
- }
- __asm__ volatile(SFENCE:::"memory");
- __asm__ volatile(EMMS:::"memory");
-#endif
- while (s < end) {
-#if HAVE_BIGENDIAN
- /* RGB24 (= R,G,B) -> RGB32 (= A,B,G,R) */
- *dest++ = 255;
- *dest++ = s[2];
- *dest++ = s[1];
- *dest++ = s[0];
- s+=3;
-#else
- *dest++ = *s++;
- *dest++ = *s++;
- *dest++ = *s++;
- *dest++ = 255;
-#endif
- }
-}
-
-static inline void RENAME(rgb32tobgr24)(const uint8_t *src, uint8_t *dst, long src_size)
-{
- uint8_t *dest = dst;
- const uint8_t *s = src;
- const uint8_t *end;
-#if HAVE_MMX
- const uint8_t *mm_end;
-#endif
- end = s + src_size;
-#if HAVE_MMX
- __asm__ volatile(PREFETCH" %0"::"m"(*s):"memory");
- mm_end = end - 31;
- while (s < mm_end) {
- __asm__ volatile(
- PREFETCH" 32%1 \n\t"
- "movq %1, %%mm0 \n\t"
- "movq 8%1, %%mm1 \n\t"
- "movq 16%1, %%mm4 \n\t"
- "movq 24%1, %%mm5 \n\t"
- "movq %%mm0, %%mm2 \n\t"
- "movq %%mm1, %%mm3 \n\t"
- "movq %%mm4, %%mm6 \n\t"
- "movq %%mm5, %%mm7 \n\t"
- "psrlq $8, %%mm2 \n\t"
- "psrlq $8, %%mm3 \n\t"
- "psrlq $8, %%mm6 \n\t"
- "psrlq $8, %%mm7 \n\t"
- "pand %2, %%mm0 \n\t"
- "pand %2, %%mm1 \n\t"
- "pand %2, %%mm4 \n\t"
- "pand %2, %%mm5 \n\t"
- "pand %3, %%mm2 \n\t"
- "pand %3, %%mm3 \n\t"
- "pand %3, %%mm6 \n\t"
- "pand %3, %%mm7 \n\t"
- "por %%mm2, %%mm0 \n\t"
- "por %%mm3, %%mm1 \n\t"
- "por %%mm6, %%mm4 \n\t"
- "por %%mm7, %%mm5 \n\t"
-
- "movq %%mm1, %%mm2 \n\t"
- "movq %%mm4, %%mm3 \n\t"
- "psllq $48, %%mm2 \n\t"
- "psllq $32, %%mm3 \n\t"
- "pand %4, %%mm2 \n\t"
- "pand %5, %%mm3 \n\t"
- "por %%mm2, %%mm0 \n\t"
- "psrlq $16, %%mm1 \n\t"
- "psrlq $32, %%mm4 \n\t"
- "psllq $16, %%mm5 \n\t"
- "por %%mm3, %%mm1 \n\t"
- "pand %6, %%mm5 \n\t"
- "por %%mm5, %%mm4 \n\t"
-
- MOVNTQ" %%mm0, %0 \n\t"
- MOVNTQ" %%mm1, 8%0 \n\t"
- MOVNTQ" %%mm4, 16%0"
- :"=m"(*dest)
- :"m"(*s),"m"(mask24l),
- "m"(mask24h),"m"(mask24hh),"m"(mask24hhh),"m"(mask24hhhh)
- :"memory");
- dest += 24;
- s += 32;
- }
- __asm__ volatile(SFENCE:::"memory");
- __asm__ volatile(EMMS:::"memory");
-#endif
- while (s < end) {
-#if HAVE_BIGENDIAN
- /* RGB32 (= A,B,G,R) -> RGB24 (= R,G,B) */
- s++;
- dest[2] = *s++;
- dest[1] = *s++;
- dest[0] = *s++;
- dest += 3;
-#else
- *dest++ = *s++;
- *dest++ = *s++;
- *dest++ = *s++;
- s++;
-#endif
- }
-}
-
-/*
- original by Strepto/Astral
- ported to gcc & bugfixed: A'rpi
- MMX2, 3DNOW optimization by Nick Kurshev
- 32-bit C version, and and&add trick by Michael Niedermayer
-*/
-static inline void RENAME(rgb15to16)(const uint8_t *src, uint8_t *dst, long src_size)
-{
- register const uint8_t* s=src;
- register uint8_t* d=dst;
- register const uint8_t *end;
- const uint8_t *mm_end;
- end = s + src_size;
-#if HAVE_MMX
- __asm__ volatile(PREFETCH" %0"::"m"(*s));
- __asm__ volatile("movq %0, %%mm4"::"m"(mask15s));
- mm_end = end - 15;
- while (s<mm_end) {
- __asm__ volatile(
- PREFETCH" 32%1 \n\t"
- "movq %1, %%mm0 \n\t"
- "movq 8%1, %%mm2 \n\t"
- "movq %%mm0, %%mm1 \n\t"
- "movq %%mm2, %%mm3 \n\t"
- "pand %%mm4, %%mm0 \n\t"
- "pand %%mm4, %%mm2 \n\t"
- "paddw %%mm1, %%mm0 \n\t"
- "paddw %%mm3, %%mm2 \n\t"
- MOVNTQ" %%mm0, %0 \n\t"
- MOVNTQ" %%mm2, 8%0"
- :"=m"(*d)
- :"m"(*s)
- );
- d+=16;
- s+=16;
- }
- __asm__ volatile(SFENCE:::"memory");
- __asm__ volatile(EMMS:::"memory");
-#endif
- mm_end = end - 3;
- while (s < mm_end) {
- register unsigned x= *((const uint32_t *)s);
- *((uint32_t *)d) = (x&0x7FFF7FFF) + (x&0x7FE07FE0);
- d+=4;
- s+=4;
- }
- if (s < end) {
- register unsigned short x= *((const uint16_t *)s);
- *((uint16_t *)d) = (x&0x7FFF) + (x&0x7FE0);
- }
-}
-
-static inline void RENAME(rgb16to15)(const uint8_t *src, uint8_t *dst, long src_size)
-{
- register const uint8_t* s=src;
- register uint8_t* d=dst;
- register const uint8_t *end;
- const uint8_t *mm_end;
- end = s + src_size;
-#if HAVE_MMX
- __asm__ volatile(PREFETCH" %0"::"m"(*s));
- __asm__ volatile("movq %0, %%mm7"::"m"(mask15rg));
- __asm__ volatile("movq %0, %%mm6"::"m"(mask15b));
- mm_end = end - 15;
- while (s<mm_end) {
- __asm__ volatile(
- PREFETCH" 32%1 \n\t"
- "movq %1, %%mm0 \n\t"
- "movq 8%1, %%mm2 \n\t"
- "movq %%mm0, %%mm1 \n\t"
- "movq %%mm2, %%mm3 \n\t"
- "psrlq $1, %%mm0 \n\t"
- "psrlq $1, %%mm2 \n\t"
- "pand %%mm7, %%mm0 \n\t"
- "pand %%mm7, %%mm2 \n\t"
- "pand %%mm6, %%mm1 \n\t"
- "pand %%mm6, %%mm3 \n\t"
- "por %%mm1, %%mm0 \n\t"
- "por %%mm3, %%mm2 \n\t"
- MOVNTQ" %%mm0, %0 \n\t"
- MOVNTQ" %%mm2, 8%0"
- :"=m"(*d)
- :"m"(*s)
- );
- d+=16;
- s+=16;
- }
- __asm__ volatile(SFENCE:::"memory");
- __asm__ volatile(EMMS:::"memory");
-#endif
- mm_end = end - 3;
- while (s < mm_end) {
- register uint32_t x= *((const uint32_t*)s);
- *((uint32_t *)d) = ((x>>1)&0x7FE07FE0) | (x&0x001F001F);
- s+=4;
- d+=4;
- }
- if (s < end) {
- register uint16_t x= *((const uint16_t*)s);
- *((uint16_t *)d) = ((x>>1)&0x7FE0) | (x&0x001F);
- }
-}
-
-static inline void RENAME(rgb32to16)(const uint8_t *src, uint8_t *dst, long src_size)
-{
- const uint8_t *s = src;
- const uint8_t *end;
-#if HAVE_MMX
- const uint8_t *mm_end;
-#endif
- uint16_t *d = (uint16_t *)dst;
- end = s + src_size;
-#if HAVE_MMX
- mm_end = end - 15;
-#if 1 //is faster only if multiplies are reasonably fast (FIXME figure out on which CPUs this is faster, on Athlon it is slightly faster)
- __asm__ volatile(
- "movq %3, %%mm5 \n\t"
- "movq %4, %%mm6 \n\t"
- "movq %5, %%mm7 \n\t"
- "jmp 2f \n\t"
- ASMALIGN(4)
- "1: \n\t"
- PREFETCH" 32(%1) \n\t"
- "movd (%1), %%mm0 \n\t"
- "movd 4(%1), %%mm3 \n\t"
- "punpckldq 8(%1), %%mm0 \n\t"
- "punpckldq 12(%1), %%mm3 \n\t"
- "movq %%mm0, %%mm1 \n\t"
- "movq %%mm3, %%mm4 \n\t"
- "pand %%mm6, %%mm0 \n\t"
- "pand %%mm6, %%mm3 \n\t"
- "pmaddwd %%mm7, %%mm0 \n\t"
- "pmaddwd %%mm7, %%mm3 \n\t"
- "pand %%mm5, %%mm1 \n\t"
- "pand %%mm5, %%mm4 \n\t"
- "por %%mm1, %%mm0 \n\t"
- "por %%mm4, %%mm3 \n\t"
- "psrld $5, %%mm0 \n\t"
- "pslld $11, %%mm3 \n\t"
- "por %%mm3, %%mm0 \n\t"
- MOVNTQ" %%mm0, (%0) \n\t"
- "add $16, %1 \n\t"
- "add $8, %0 \n\t"
- "2: \n\t"
- "cmp %2, %1 \n\t"
- " jb 1b \n\t"
- : "+r" (d), "+r"(s)
- : "r" (mm_end), "m" (mask3216g), "m" (mask3216br), "m" (mul3216)
- );
-#else
- __asm__ volatile(PREFETCH" %0"::"m"(*src):"memory");
- __asm__ volatile(
- "movq %0, %%mm7 \n\t"
- "movq %1, %%mm6 \n\t"
- ::"m"(red_16mask),"m"(green_16mask));
- while (s < mm_end) {
- __asm__ volatile(
- PREFETCH" 32%1 \n\t"
- "movd %1, %%mm0 \n\t"
- "movd 4%1, %%mm3 \n\t"
- "punpckldq 8%1, %%mm0 \n\t"
- "punpckldq 12%1, %%mm3 \n\t"
- "movq %%mm0, %%mm1 \n\t"
- "movq %%mm0, %%mm2 \n\t"
- "movq %%mm3, %%mm4 \n\t"
- "movq %%mm3, %%mm5 \n\t"
- "psrlq $3, %%mm0 \n\t"
- "psrlq $3, %%mm3 \n\t"
- "pand %2, %%mm0 \n\t"
- "pand %2, %%mm3 \n\t"
- "psrlq $5, %%mm1 \n\t"
- "psrlq $5, %%mm4 \n\t"
- "pand %%mm6, %%mm1 \n\t"
- "pand %%mm6, %%mm4 \n\t"
- "psrlq $8, %%mm2 \n\t"
- "psrlq $8, %%mm5 \n\t"
- "pand %%mm7, %%mm2 \n\t"
- "pand %%mm7, %%mm5 \n\t"
- "por %%mm1, %%mm0 \n\t"
- "por %%mm4, %%mm3 \n\t"
- "por %%mm2, %%mm0 \n\t"
- "por %%mm5, %%mm3 \n\t"
- "psllq $16, %%mm3 \n\t"
- "por %%mm3, %%mm0 \n\t"
- MOVNTQ" %%mm0, %0 \n\t"
- :"=m"(*d):"m"(*s),"m"(blue_16mask):"memory");
- d += 4;
- s += 16;
- }
-#endif
- __asm__ volatile(SFENCE:::"memory");
- __asm__ volatile(EMMS:::"memory");
-#endif
- while (s < end) {
- register int rgb = *(const uint32_t*)s; s += 4;
- *d++ = ((rgb&0xFF)>>3) + ((rgb&0xFC00)>>5) + ((rgb&0xF80000)>>8);
- }
-}
-
-static inline void RENAME(rgb32tobgr16)(const uint8_t *src, uint8_t *dst, long src_size)
-{
- const uint8_t *s = src;
- const uint8_t *end;
-#if HAVE_MMX
- const uint8_t *mm_end;
-#endif
- uint16_t *d = (uint16_t *)dst;
- end = s + src_size;
-#if HAVE_MMX
- __asm__ volatile(PREFETCH" %0"::"m"(*src):"memory");
- __asm__ volatile(
- "movq %0, %%mm7 \n\t"
- "movq %1, %%mm6 \n\t"
- ::"m"(red_16mask),"m"(green_16mask));
- mm_end = end - 15;
- while (s < mm_end) {
- __asm__ volatile(
- PREFETCH" 32%1 \n\t"
- "movd %1, %%mm0 \n\t"
- "movd 4%1, %%mm3 \n\t"
- "punpckldq 8%1, %%mm0 \n\t"
- "punpckldq 12%1, %%mm3 \n\t"
- "movq %%mm0, %%mm1 \n\t"
- "movq %%mm0, %%mm2 \n\t"
- "movq %%mm3, %%mm4 \n\t"
- "movq %%mm3, %%mm5 \n\t"
- "psllq $8, %%mm0 \n\t"
- "psllq $8, %%mm3 \n\t"
- "pand %%mm7, %%mm0 \n\t"
- "pand %%mm7, %%mm3 \n\t"
- "psrlq $5, %%mm1 \n\t"
- "psrlq $5, %%mm4 \n\t"
- "pand %%mm6, %%mm1 \n\t"
- "pand %%mm6, %%mm4 \n\t"
- "psrlq $19, %%mm2 \n\t"
- "psrlq $19, %%mm5 \n\t"
- "pand %2, %%mm2 \n\t"
- "pand %2, %%mm5 \n\t"
- "por %%mm1, %%mm0 \n\t"
- "por %%mm4, %%mm3 \n\t"
- "por %%mm2, %%mm0 \n\t"
- "por %%mm5, %%mm3 \n\t"
- "psllq $16, %%mm3 \n\t"
- "por %%mm3, %%mm0 \n\t"
- MOVNTQ" %%mm0, %0 \n\t"
- :"=m"(*d):"m"(*s),"m"(blue_16mask):"memory");
- d += 4;
- s += 16;
- }
- __asm__ volatile(SFENCE:::"memory");
- __asm__ volatile(EMMS:::"memory");
-#endif
- while (s < end) {
- register int rgb = *(const uint32_t*)s; s += 4;
- *d++ = ((rgb&0xF8)<<8) + ((rgb&0xFC00)>>5) + ((rgb&0xF80000)>>19);
- }
-}
-
-static inline void RENAME(rgb32to15)(const uint8_t *src, uint8_t *dst, long src_size)
-{
- const uint8_t *s = src;
- const uint8_t *end;
-#if HAVE_MMX
- const uint8_t *mm_end;
-#endif
- uint16_t *d = (uint16_t *)dst;
- end = s + src_size;
-#if HAVE_MMX
- mm_end = end - 15;
-#if 1 //is faster only if multiplies are reasonably fast (FIXME figure out on which CPUs this is faster, on Athlon it is slightly faster)
- __asm__ volatile(
- "movq %3, %%mm5 \n\t"
- "movq %4, %%mm6 \n\t"
- "movq %5, %%mm7 \n\t"
- "jmp 2f \n\t"
- ASMALIGN(4)
- "1: \n\t"
- PREFETCH" 32(%1) \n\t"
- "movd (%1), %%mm0 \n\t"
- "movd 4(%1), %%mm3 \n\t"
- "punpckldq 8(%1), %%mm0 \n\t"
- "punpckldq 12(%1), %%mm3 \n\t"
- "movq %%mm0, %%mm1 \n\t"
- "movq %%mm3, %%mm4 \n\t"
- "pand %%mm6, %%mm0 \n\t"
- "pand %%mm6, %%mm3 \n\t"
- "pmaddwd %%mm7, %%mm0 \n\t"
- "pmaddwd %%mm7, %%mm3 \n\t"
- "pand %%mm5, %%mm1 \n\t"
- "pand %%mm5, %%mm4 \n\t"
- "por %%mm1, %%mm0 \n\t"
- "por %%mm4, %%mm3 \n\t"
- "psrld $6, %%mm0 \n\t"
- "pslld $10, %%mm3 \n\t"
- "por %%mm3, %%mm0 \n\t"
- MOVNTQ" %%mm0, (%0) \n\t"
- "add $16, %1 \n\t"
- "add $8, %0 \n\t"
- "2: \n\t"
- "cmp %2, %1 \n\t"
- " jb 1b \n\t"
- : "+r" (d), "+r"(s)
- : "r" (mm_end), "m" (mask3215g), "m" (mask3216br), "m" (mul3215)
- );
-#else
- __asm__ volatile(PREFETCH" %0"::"m"(*src):"memory");
- __asm__ volatile(
- "movq %0, %%mm7 \n\t"
- "movq %1, %%mm6 \n\t"
- ::"m"(red_15mask),"m"(green_15mask));
- while (s < mm_end) {
- __asm__ volatile(
- PREFETCH" 32%1 \n\t"
- "movd %1, %%mm0 \n\t"
- "movd 4%1, %%mm3 \n\t"
- "punpckldq 8%1, %%mm0 \n\t"
- "punpckldq 12%1, %%mm3 \n\t"
- "movq %%mm0, %%mm1 \n\t"
- "movq %%mm0, %%mm2 \n\t"
- "movq %%mm3, %%mm4 \n\t"
- "movq %%mm3, %%mm5 \n\t"
- "psrlq $3, %%mm0 \n\t"
- "psrlq $3, %%mm3 \n\t"
- "pand %2, %%mm0 \n\t"
- "pand %2, %%mm3 \n\t"
- "psrlq $6, %%mm1 \n\t"
- "psrlq $6, %%mm4 \n\t"
- "pand %%mm6, %%mm1 \n\t"
- "pand %%mm6, %%mm4 \n\t"
- "psrlq $9, %%mm2 \n\t"
- "psrlq $9, %%mm5 \n\t"
- "pand %%mm7, %%mm2 \n\t"
- "pand %%mm7, %%mm5 \n\t"
- "por %%mm1, %%mm0 \n\t"
- "por %%mm4, %%mm3 \n\t"
- "por %%mm2, %%mm0 \n\t"
- "por %%mm5, %%mm3 \n\t"
- "psllq $16, %%mm3 \n\t"
- "por %%mm3, %%mm0 \n\t"
- MOVNTQ" %%mm0, %0 \n\t"
- :"=m"(*d):"m"(*s),"m"(blue_15mask):"memory");
- d += 4;
- s += 16;
- }
-#endif
- __asm__ volatile(SFENCE:::"memory");
- __asm__ volatile(EMMS:::"memory");
-#endif
- while (s < end) {
- register int rgb = *(const uint32_t*)s; s += 4;
- *d++ = ((rgb&0xFF)>>3) + ((rgb&0xF800)>>6) + ((rgb&0xF80000)>>9);
- }
-}
-
-static inline void RENAME(rgb32tobgr15)(const uint8_t *src, uint8_t *dst, long src_size)
-{
- const uint8_t *s = src;
- const uint8_t *end;
-#if HAVE_MMX
- const uint8_t *mm_end;
-#endif
- uint16_t *d = (uint16_t *)dst;
- end = s + src_size;
-#if HAVE_MMX
- __asm__ volatile(PREFETCH" %0"::"m"(*src):"memory");
- __asm__ volatile(
- "movq %0, %%mm7 \n\t"
- "movq %1, %%mm6 \n\t"
- ::"m"(red_15mask),"m"(green_15mask));
- mm_end = end - 15;
- while (s < mm_end) {
- __asm__ volatile(
- PREFETCH" 32%1 \n\t"
- "movd %1, %%mm0 \n\t"
- "movd 4%1, %%mm3 \n\t"
- "punpckldq 8%1, %%mm0 \n\t"
- "punpckldq 12%1, %%mm3 \n\t"
- "movq %%mm0, %%mm1 \n\t"
- "movq %%mm0, %%mm2 \n\t"
- "movq %%mm3, %%mm4 \n\t"
- "movq %%mm3, %%mm5 \n\t"
- "psllq $7, %%mm0 \n\t"
- "psllq $7, %%mm3 \n\t"
- "pand %%mm7, %%mm0 \n\t"
- "pand %%mm7, %%mm3 \n\t"
- "psrlq $6, %%mm1 \n\t"
- "psrlq $6, %%mm4 \n\t"
- "pand %%mm6, %%mm1 \n\t"
- "pand %%mm6, %%mm4 \n\t"
- "psrlq $19, %%mm2 \n\t"
- "psrlq $19, %%mm5 \n\t"
- "pand %2, %%mm2 \n\t"
- "pand %2, %%mm5 \n\t"
- "por %%mm1, %%mm0 \n\t"
- "por %%mm4, %%mm3 \n\t"
- "por %%mm2, %%mm0 \n\t"
- "por %%mm5, %%mm3 \n\t"
- "psllq $16, %%mm3 \n\t"
- "por %%mm3, %%mm0 \n\t"
- MOVNTQ" %%mm0, %0 \n\t"
- :"=m"(*d):"m"(*s),"m"(blue_15mask):"memory");
- d += 4;
- s += 16;
- }
- __asm__ volatile(SFENCE:::"memory");
- __asm__ volatile(EMMS:::"memory");
-#endif
- while (s < end) {
- register int rgb = *(const uint32_t*)s; s += 4;
- *d++ = ((rgb&0xF8)<<7) + ((rgb&0xF800)>>6) + ((rgb&0xF80000)>>19);
- }
-}
-
-static inline void RENAME(rgb24tobgr16)(const uint8_t *src, uint8_t *dst, long src_size)
-{
- const uint8_t *s = src;
- const uint8_t *end;
-#if HAVE_MMX
- const uint8_t *mm_end;
-#endif
- uint16_t *d = (uint16_t *)dst;
- end = s + src_size;
-#if HAVE_MMX
- __asm__ volatile(PREFETCH" %0"::"m"(*src):"memory");
- __asm__ volatile(
- "movq %0, %%mm7 \n\t"
- "movq %1, %%mm6 \n\t"
- ::"m"(red_16mask),"m"(green_16mask));
- mm_end = end - 11;
- while (s < mm_end) {
- __asm__ volatile(
- PREFETCH" 32%1 \n\t"
- "movd %1, %%mm0 \n\t"
- "movd 3%1, %%mm3 \n\t"
- "punpckldq 6%1, %%mm0 \n\t"
- "punpckldq 9%1, %%mm3 \n\t"
- "movq %%mm0, %%mm1 \n\t"
- "movq %%mm0, %%mm2 \n\t"
- "movq %%mm3, %%mm4 \n\t"
- "movq %%mm3, %%mm5 \n\t"
- "psrlq $3, %%mm0 \n\t"
- "psrlq $3, %%mm3 \n\t"
- "pand %2, %%mm0 \n\t"
- "pand %2, %%mm3 \n\t"
- "psrlq $5, %%mm1 \n\t"
- "psrlq $5, %%mm4 \n\t"
- "pand %%mm6, %%mm1 \n\t"
- "pand %%mm6, %%mm4 \n\t"
- "psrlq $8, %%mm2 \n\t"
- "psrlq $8, %%mm5 \n\t"
- "pand %%mm7, %%mm2 \n\t"
- "pand %%mm7, %%mm5 \n\t"
- "por %%mm1, %%mm0 \n\t"
- "por %%mm4, %%mm3 \n\t"
- "por %%mm2, %%mm0 \n\t"
- "por %%mm5, %%mm3 \n\t"
- "psllq $16, %%mm3 \n\t"
- "por %%mm3, %%mm0 \n\t"
- MOVNTQ" %%mm0, %0 \n\t"
- :"=m"(*d):"m"(*s),"m"(blue_16mask):"memory");
- d += 4;
- s += 12;
- }
- __asm__ volatile(SFENCE:::"memory");
- __asm__ volatile(EMMS:::"memory");
-#endif
- while (s < end) {
- const int b = *s++;
- const int g = *s++;
- const int r = *s++;
- *d++ = (b>>3) | ((g&0xFC)<<3) | ((r&0xF8)<<8);
- }
-}
-
-static inline void RENAME(rgb24to16)(const uint8_t *src, uint8_t *dst, long src_size)
-{
- const uint8_t *s = src;
- const uint8_t *end;
-#if HAVE_MMX
- const uint8_t *mm_end;
-#endif
- uint16_t *d = (uint16_t *)dst;
- end = s + src_size;
-#if HAVE_MMX
- __asm__ volatile(PREFETCH" %0"::"m"(*src):"memory");
- __asm__ volatile(
- "movq %0, %%mm7 \n\t"
- "movq %1, %%mm6 \n\t"
- ::"m"(red_16mask),"m"(green_16mask));
- mm_end = end - 15;
- while (s < mm_end) {
- __asm__ volatile(
- PREFETCH" 32%1 \n\t"
- "movd %1, %%mm0 \n\t"
- "movd 3%1, %%mm3 \n\t"
- "punpckldq 6%1, %%mm0 \n\t"
- "punpckldq 9%1, %%mm3 \n\t"
- "movq %%mm0, %%mm1 \n\t"
- "movq %%mm0, %%mm2 \n\t"
- "movq %%mm3, %%mm4 \n\t"
- "movq %%mm3, %%mm5 \n\t"
- "psllq $8, %%mm0 \n\t"
- "psllq $8, %%mm3 \n\t"
- "pand %%mm7, %%mm0 \n\t"
- "pand %%mm7, %%mm3 \n\t"
- "psrlq $5, %%mm1 \n\t"
- "psrlq $5, %%mm4 \n\t"
- "pand %%mm6, %%mm1 \n\t"
- "pand %%mm6, %%mm4 \n\t"
- "psrlq $19, %%mm2 \n\t"
- "psrlq $19, %%mm5 \n\t"
- "pand %2, %%mm2 \n\t"
- "pand %2, %%mm5 \n\t"
- "por %%mm1, %%mm0 \n\t"
- "por %%mm4, %%mm3 \n\t"
- "por %%mm2, %%mm0 \n\t"
- "por %%mm5, %%mm3 \n\t"
- "psllq $16, %%mm3 \n\t"
- "por %%mm3, %%mm0 \n\t"
- MOVNTQ" %%mm0, %0 \n\t"
- :"=m"(*d):"m"(*s),"m"(blue_16mask):"memory");
- d += 4;
- s += 12;
- }
- __asm__ volatile(SFENCE:::"memory");
- __asm__ volatile(EMMS:::"memory");
-#endif
- while (s < end) {
- const int r = *s++;
- const int g = *s++;
- const int b = *s++;
- *d++ = (b>>3) | ((g&0xFC)<<3) | ((r&0xF8)<<8);
- }
-}
-
-static inline void RENAME(rgb24tobgr15)(const uint8_t *src, uint8_t *dst, long src_size)
-{
- const uint8_t *s = src;
- const uint8_t *end;
-#if HAVE_MMX
- const uint8_t *mm_end;
-#endif
- uint16_t *d = (uint16_t *)dst;
- end = s + src_size;
-#if HAVE_MMX
- __asm__ volatile(PREFETCH" %0"::"m"(*src):"memory");
- __asm__ volatile(
- "movq %0, %%mm7 \n\t"
- "movq %1, %%mm6 \n\t"
- ::"m"(red_15mask),"m"(green_15mask));
- mm_end = end - 11;
- while (s < mm_end) {
- __asm__ volatile(
- PREFETCH" 32%1 \n\t"
- "movd %1, %%mm0 \n\t"
- "movd 3%1, %%mm3 \n\t"
- "punpckldq 6%1, %%mm0 \n\t"
- "punpckldq 9%1, %%mm3 \n\t"
- "movq %%mm0, %%mm1 \n\t"
- "movq %%mm0, %%mm2 \n\t"
- "movq %%mm3, %%mm4 \n\t"
- "movq %%mm3, %%mm5 \n\t"
- "psrlq $3, %%mm0 \n\t"
- "psrlq $3, %%mm3 \n\t"
- "pand %2, %%mm0 \n\t"
- "pand %2, %%mm3 \n\t"
- "psrlq $6, %%mm1 \n\t"
- "psrlq $6, %%mm4 \n\t"
- "pand %%mm6, %%mm1 \n\t"
- "pand %%mm6, %%mm4 \n\t"
- "psrlq $9, %%mm2 \n\t"
- "psrlq $9, %%mm5 \n\t"
- "pand %%mm7, %%mm2 \n\t"
- "pand %%mm7, %%mm5 \n\t"
- "por %%mm1, %%mm0 \n\t"
- "por %%mm4, %%mm3 \n\t"
- "por %%mm2, %%mm0 \n\t"
- "por %%mm5, %%mm3 \n\t"
- "psllq $16, %%mm3 \n\t"
- "por %%mm3, %%mm0 \n\t"
- MOVNTQ" %%mm0, %0 \n\t"
- :"=m"(*d):"m"(*s),"m"(blue_15mask):"memory");
- d += 4;
- s += 12;
- }
- __asm__ volatile(SFENCE:::"memory");
- __asm__ volatile(EMMS:::"memory");
-#endif
- while (s < end) {
- const int b = *s++;
- const int g = *s++;
- const int r = *s++;
- *d++ = (b>>3) | ((g&0xF8)<<2) | ((r&0xF8)<<7);
- }
-}
-
-static inline void RENAME(rgb24to15)(const uint8_t *src, uint8_t *dst, long src_size)
-{
- const uint8_t *s = src;
- const uint8_t *end;
-#if HAVE_MMX
- const uint8_t *mm_end;
-#endif
- uint16_t *d = (uint16_t *)dst;
- end = s + src_size;
-#if HAVE_MMX
- __asm__ volatile(PREFETCH" %0"::"m"(*src):"memory");
- __asm__ volatile(
- "movq %0, %%mm7 \n\t"
- "movq %1, %%mm6 \n\t"
- ::"m"(red_15mask),"m"(green_15mask));
- mm_end = end - 15;
- while (s < mm_end) {
- __asm__ volatile(
- PREFETCH" 32%1 \n\t"
- "movd %1, %%mm0 \n\t"
- "movd 3%1, %%mm3 \n\t"
- "punpckldq 6%1, %%mm0 \n\t"
- "punpckldq 9%1, %%mm3 \n\t"
- "movq %%mm0, %%mm1 \n\t"
- "movq %%mm0, %%mm2 \n\t"
- "movq %%mm3, %%mm4 \n\t"
- "movq %%mm3, %%mm5 \n\t"
- "psllq $7, %%mm0 \n\t"
- "psllq $7, %%mm3 \n\t"
- "pand %%mm7, %%mm0 \n\t"
- "pand %%mm7, %%mm3 \n\t"
- "psrlq $6, %%mm1 \n\t"
- "psrlq $6, %%mm4 \n\t"
- "pand %%mm6, %%mm1 \n\t"
- "pand %%mm6, %%mm4 \n\t"
- "psrlq $19, %%mm2 \n\t"
- "psrlq $19, %%mm5 \n\t"
- "pand %2, %%mm2 \n\t"
- "pand %2, %%mm5 \n\t"
- "por %%mm1, %%mm0 \n\t"
- "por %%mm4, %%mm3 \n\t"
- "por %%mm2, %%mm0 \n\t"
- "por %%mm5, %%mm3 \n\t"
- "psllq $16, %%mm3 \n\t"
- "por %%mm3, %%mm0 \n\t"
- MOVNTQ" %%mm0, %0 \n\t"
- :"=m"(*d):"m"(*s),"m"(blue_15mask):"memory");
- d += 4;
- s += 12;
- }
- __asm__ volatile(SFENCE:::"memory");
- __asm__ volatile(EMMS:::"memory");
-#endif
- while (s < end) {
- const int r = *s++;
- const int g = *s++;
- const int b = *s++;
- *d++ = (b>>3) | ((g&0xF8)<<2) | ((r&0xF8)<<7);
- }
-}
-
-/*
- I use less accurate approximation here by simply left-shifting the input
- value and filling the low order bits with zeroes. This method improves PNG
- compression but this scheme cannot reproduce white exactly, since it does
- not generate an all-ones maximum value; the net effect is to darken the
- image slightly.
-
- The better method should be "left bit replication":
-
- 4 3 2 1 0
- ---------
- 1 1 0 1 1
-
- 7 6 5 4 3 2 1 0
- ----------------
- 1 1 0 1 1 1 1 0
- |=======| |===|
- | leftmost bits repeated to fill open bits
- |
- original bits
-*/
-static inline void RENAME(rgb15tobgr24)(const uint8_t *src, uint8_t *dst, long src_size)
-{
- const uint16_t *end;
-#if HAVE_MMX
- const uint16_t *mm_end;
-#endif
- uint8_t *d = dst;
- const uint16_t *s = (const uint16_t*)src;
- end = s + src_size/2;
-#if HAVE_MMX
- __asm__ volatile(PREFETCH" %0"::"m"(*s):"memory");
- mm_end = end - 7;
- while (s < mm_end) {
- __asm__ volatile(
- PREFETCH" 32%1 \n\t"
- "movq %1, %%mm0 \n\t"
- "movq %1, %%mm1 \n\t"
- "movq %1, %%mm2 \n\t"
- "pand %2, %%mm0 \n\t"
- "pand %3, %%mm1 \n\t"
- "pand %4, %%mm2 \n\t"
- "psllq $3, %%mm0 \n\t"
- "psrlq $2, %%mm1 \n\t"
- "psrlq $7, %%mm2 \n\t"
- "movq %%mm0, %%mm3 \n\t"
- "movq %%mm1, %%mm4 \n\t"
- "movq %%mm2, %%mm5 \n\t"
- "punpcklwd %5, %%mm0 \n\t"
- "punpcklwd %5, %%mm1 \n\t"
- "punpcklwd %5, %%mm2 \n\t"
- "punpckhwd %5, %%mm3 \n\t"
- "punpckhwd %5, %%mm4 \n\t"
- "punpckhwd %5, %%mm5 \n\t"
- "psllq $8, %%mm1 \n\t"
- "psllq $16, %%mm2 \n\t"
- "por %%mm1, %%mm0 \n\t"
- "por %%mm2, %%mm0 \n\t"
- "psllq $8, %%mm4 \n\t"
- "psllq $16, %%mm5 \n\t"
- "por %%mm4, %%mm3 \n\t"
- "por %%mm5, %%mm3 \n\t"
-
- "movq %%mm0, %%mm6 \n\t"
- "movq %%mm3, %%mm7 \n\t"
-
- "movq 8%1, %%mm0 \n\t"
- "movq 8%1, %%mm1 \n\t"
- "movq 8%1, %%mm2 \n\t"
- "pand %2, %%mm0 \n\t"
- "pand %3, %%mm1 \n\t"
- "pand %4, %%mm2 \n\t"
- "psllq $3, %%mm0 \n\t"
- "psrlq $2, %%mm1 \n\t"
- "psrlq $7, %%mm2 \n\t"
- "movq %%mm0, %%mm3 \n\t"
- "movq %%mm1, %%mm4 \n\t"
- "movq %%mm2, %%mm5 \n\t"
- "punpcklwd %5, %%mm0 \n\t"
- "punpcklwd %5, %%mm1 \n\t"
- "punpcklwd %5, %%mm2 \n\t"
- "punpckhwd %5, %%mm3 \n\t"
- "punpckhwd %5, %%mm4 \n\t"
- "punpckhwd %5, %%mm5 \n\t"
- "psllq $8, %%mm1 \n\t"
- "psllq $16, %%mm2 \n\t"
- "por %%mm1, %%mm0 \n\t"
- "por %%mm2, %%mm0 \n\t"
- "psllq $8, %%mm4 \n\t"
- "psllq $16, %%mm5 \n\t"
- "por %%mm4, %%mm3 \n\t"
- "por %%mm5, %%mm3 \n\t"
-
- :"=m"(*d)
- :"m"(*s),"m"(mask15b),"m"(mask15g),"m"(mask15r), "m"(mmx_null)
- :"memory");
- /* borrowed 32 to 24 */
- __asm__ volatile(
- "movq %%mm0, %%mm4 \n\t"
- "movq %%mm3, %%mm5 \n\t"
- "movq %%mm6, %%mm0 \n\t"
- "movq %%mm7, %%mm1 \n\t"
-
- "movq %%mm4, %%mm6 \n\t"
- "movq %%mm5, %%mm7 \n\t"
- "movq %%mm0, %%mm2 \n\t"
- "movq %%mm1, %%mm3 \n\t"
-
- "psrlq $8, %%mm2 \n\t"
- "psrlq $8, %%mm3 \n\t"
- "psrlq $8, %%mm6 \n\t"
- "psrlq $8, %%mm7 \n\t"
- "pand %2, %%mm0 \n\t"
- "pand %2, %%mm1 \n\t"
- "pand %2, %%mm4 \n\t"
- "pand %2, %%mm5 \n\t"
- "pand %3, %%mm2 \n\t"
- "pand %3, %%mm3 \n\t"
- "pand %3, %%mm6 \n\t"
- "pand %3, %%mm7 \n\t"
- "por %%mm2, %%mm0 \n\t"
- "por %%mm3, %%mm1 \n\t"
- "por %%mm6, %%mm4 \n\t"
- "por %%mm7, %%mm5 \n\t"
-
- "movq %%mm1, %%mm2 \n\t"
- "movq %%mm4, %%mm3 \n\t"
- "psllq $48, %%mm2 \n\t"
- "psllq $32, %%mm3 \n\t"
- "pand %4, %%mm2 \n\t"
- "pand %5, %%mm3 \n\t"
- "por %%mm2, %%mm0 \n\t"
- "psrlq $16, %%mm1 \n\t"
- "psrlq $32, %%mm4 \n\t"
- "psllq $16, %%mm5 \n\t"
- "por %%mm3, %%mm1 \n\t"
- "pand %6, %%mm5 \n\t"
- "por %%mm5, %%mm4 \n\t"
-
- MOVNTQ" %%mm0, %0 \n\t"
- MOVNTQ" %%mm1, 8%0 \n\t"
- MOVNTQ" %%mm4, 16%0"
-
- :"=m"(*d)
- :"m"(*s),"m"(mask24l),"m"(mask24h),"m"(mask24hh),"m"(mask24hhh),"m"(mask24hhhh)
- :"memory");
- d += 24;
- s += 8;
- }
- __asm__ volatile(SFENCE:::"memory");
- __asm__ volatile(EMMS:::"memory");
-#endif
- while (s < end) {
- register uint16_t bgr;
- bgr = *s++;
- *d++ = (bgr&0x1F)<<3;
- *d++ = (bgr&0x3E0)>>2;
- *d++ = (bgr&0x7C00)>>7;
- }
-}
-
-static inline void RENAME(rgb16tobgr24)(const uint8_t *src, uint8_t *dst, long src_size)
-{
- const uint16_t *end;
-#if HAVE_MMX
- const uint16_t *mm_end;
-#endif
- uint8_t *d = (uint8_t *)dst;
- const uint16_t *s = (const uint16_t *)src;
- end = s + src_size/2;
-#if HAVE_MMX
- __asm__ volatile(PREFETCH" %0"::"m"(*s):"memory");
- mm_end = end - 7;
- while (s < mm_end) {
- __asm__ volatile(
- PREFETCH" 32%1 \n\t"
- "movq %1, %%mm0 \n\t"
- "movq %1, %%mm1 \n\t"
- "movq %1, %%mm2 \n\t"
- "pand %2, %%mm0 \n\t"
- "pand %3, %%mm1 \n\t"
- "pand %4, %%mm2 \n\t"
- "psllq $3, %%mm0 \n\t"
- "psrlq $3, %%mm1 \n\t"
- "psrlq $8, %%mm2 \n\t"
- "movq %%mm0, %%mm3 \n\t"
- "movq %%mm1, %%mm4 \n\t"
- "movq %%mm2, %%mm5 \n\t"
- "punpcklwd %5, %%mm0 \n\t"
- "punpcklwd %5, %%mm1 \n\t"
- "punpcklwd %5, %%mm2 \n\t"
- "punpckhwd %5, %%mm3 \n\t"
- "punpckhwd %5, %%mm4 \n\t"
- "punpckhwd %5, %%mm5 \n\t"
- "psllq $8, %%mm1 \n\t"
- "psllq $16, %%mm2 \n\t"
- "por %%mm1, %%mm0 \n\t"
- "por %%mm2, %%mm0 \n\t"
- "psllq $8, %%mm4 \n\t"
- "psllq $16, %%mm5 \n\t"
- "por %%mm4, %%mm3 \n\t"
- "por %%mm5, %%mm3 \n\t"
-
- "movq %%mm0, %%mm6 \n\t"
- "movq %%mm3, %%mm7 \n\t"
-
- "movq 8%1, %%mm0 \n\t"
- "movq 8%1, %%mm1 \n\t"
- "movq 8%1, %%mm2 \n\t"
- "pand %2, %%mm0 \n\t"
- "pand %3, %%mm1 \n\t"
- "pand %4, %%mm2 \n\t"
- "psllq $3, %%mm0 \n\t"
- "psrlq $3, %%mm1 \n\t"
- "psrlq $8, %%mm2 \n\t"
- "movq %%mm0, %%mm3 \n\t"
- "movq %%mm1, %%mm4 \n\t"
- "movq %%mm2, %%mm5 \n\t"
- "punpcklwd %5, %%mm0 \n\t"
- "punpcklwd %5, %%mm1 \n\t"
- "punpcklwd %5, %%mm2 \n\t"
- "punpckhwd %5, %%mm3 \n\t"
- "punpckhwd %5, %%mm4 \n\t"
- "punpckhwd %5, %%mm5 \n\t"
- "psllq $8, %%mm1 \n\t"
- "psllq $16, %%mm2 \n\t"
- "por %%mm1, %%mm0 \n\t"
- "por %%mm2, %%mm0 \n\t"
- "psllq $8, %%mm4 \n\t"
- "psllq $16, %%mm5 \n\t"
- "por %%mm4, %%mm3 \n\t"
- "por %%mm5, %%mm3 \n\t"
- :"=m"(*d)
- :"m"(*s),"m"(mask16b),"m"(mask16g),"m"(mask16r),"m"(mmx_null)
- :"memory");
- /* borrowed 32 to 24 */
- __asm__ volatile(
- "movq %%mm0, %%mm4 \n\t"
- "movq %%mm3, %%mm5 \n\t"
- "movq %%mm6, %%mm0 \n\t"
- "movq %%mm7, %%mm1 \n\t"
-
- "movq %%mm4, %%mm6 \n\t"
- "movq %%mm5, %%mm7 \n\t"
- "movq %%mm0, %%mm2 \n\t"
- "movq %%mm1, %%mm3 \n\t"
-
- "psrlq $8, %%mm2 \n\t"
- "psrlq $8, %%mm3 \n\t"
- "psrlq $8, %%mm6 \n\t"
- "psrlq $8, %%mm7 \n\t"
- "pand %2, %%mm0 \n\t"
- "pand %2, %%mm1 \n\t"
- "pand %2, %%mm4 \n\t"
- "pand %2, %%mm5 \n\t"
- "pand %3, %%mm2 \n\t"
- "pand %3, %%mm3 \n\t"
- "pand %3, %%mm6 \n\t"
- "pand %3, %%mm7 \n\t"
- "por %%mm2, %%mm0 \n\t"
- "por %%mm3, %%mm1 \n\t"
- "por %%mm6, %%mm4 \n\t"
- "por %%mm7, %%mm5 \n\t"
-
- "movq %%mm1, %%mm2 \n\t"
- "movq %%mm4, %%mm3 \n\t"
- "psllq $48, %%mm2 \n\t"
- "psllq $32, %%mm3 \n\t"
- "pand %4, %%mm2 \n\t"
- "pand %5, %%mm3 \n\t"
- "por %%mm2, %%mm0 \n\t"
- "psrlq $16, %%mm1 \n\t"
- "psrlq $32, %%mm4 \n\t"
- "psllq $16, %%mm5 \n\t"
- "por %%mm3, %%mm1 \n\t"
- "pand %6, %%mm5 \n\t"
- "por %%mm5, %%mm4 \n\t"
-
- MOVNTQ" %%mm0, %0 \n\t"
- MOVNTQ" %%mm1, 8%0 \n\t"
- MOVNTQ" %%mm4, 16%0"
-
- :"=m"(*d)
- :"m"(*s),"m"(mask24l),"m"(mask24h),"m"(mask24hh),"m"(mask24hhh),"m"(mask24hhhh)
- :"memory");
- d += 24;
- s += 8;
- }
- __asm__ volatile(SFENCE:::"memory");
- __asm__ volatile(EMMS:::"memory");
-#endif
- while (s < end) {
- register uint16_t bgr;
- bgr = *s++;
- *d++ = (bgr&0x1F)<<3;
- *d++ = (bgr&0x7E0)>>3;
- *d++ = (bgr&0xF800)>>8;
- }
-}
-
-/*
- * mm0 = 00 B3 00 B2 00 B1 00 B0
- * mm1 = 00 G3 00 G2 00 G1 00 G0
- * mm2 = 00 R3 00 R2 00 R1 00 R0
- * mm6 = FF FF FF FF FF FF FF FF
- * mm7 = 00 00 00 00 00 00 00 00
- */
-#define PACK_RGB32 \
- "packuswb %%mm7, %%mm0 \n\t" /* 00 00 00 00 B3 B2 B1 B0 */ \
- "packuswb %%mm7, %%mm1 \n\t" /* 00 00 00 00 G3 G2 G1 G0 */ \
- "packuswb %%mm7, %%mm2 \n\t" /* 00 00 00 00 R3 R2 R1 R0 */ \
- "punpcklbw %%mm1, %%mm0 \n\t" /* G3 B3 G2 B2 G1 B1 G0 B0 */ \
- "punpcklbw %%mm6, %%mm2 \n\t" /* FF R3 FF R2 FF R1 FF R0 */ \
- "movq %%mm0, %%mm3 \n\t" \
- "punpcklwd %%mm2, %%mm0 \n\t" /* FF R1 G1 B1 FF R0 G0 B0 */ \
- "punpckhwd %%mm2, %%mm3 \n\t" /* FF R3 G3 B3 FF R2 G2 B2 */ \
- MOVNTQ" %%mm0, %0 \n\t" \
- MOVNTQ" %%mm3, 8%0 \n\t" \
-
-static inline void RENAME(rgb15to32)(const uint8_t *src, uint8_t *dst, long src_size)
-{
- const uint16_t *end;
-#if HAVE_MMX
- const uint16_t *mm_end;
-#endif
- uint8_t *d = dst;
- const uint16_t *s = (const uint16_t *)src;
- end = s + src_size/2;
-#if HAVE_MMX
- __asm__ volatile(PREFETCH" %0"::"m"(*s):"memory");
- __asm__ volatile("pxor %%mm7,%%mm7 \n\t":::"memory");
- __asm__ volatile("pcmpeqd %%mm6,%%mm6 \n\t":::"memory");
- mm_end = end - 3;
- while (s < mm_end) {
- __asm__ volatile(
- PREFETCH" 32%1 \n\t"
- "movq %1, %%mm0 \n\t"
- "movq %1, %%mm1 \n\t"
- "movq %1, %%mm2 \n\t"
- "pand %2, %%mm0 \n\t"
- "pand %3, %%mm1 \n\t"
- "pand %4, %%mm2 \n\t"
- "psllq $3, %%mm0 \n\t"
- "psrlq $2, %%mm1 \n\t"
- "psrlq $7, %%mm2 \n\t"
- PACK_RGB32
- :"=m"(*d)
- :"m"(*s),"m"(mask15b),"m"(mask15g),"m"(mask15r)
- :"memory");
- d += 16;
- s += 4;
- }
- __asm__ volatile(SFENCE:::"memory");
- __asm__ volatile(EMMS:::"memory");
-#endif
- while (s < end) {
- register uint16_t bgr;
- bgr = *s++;
-#if HAVE_BIGENDIAN
- *d++ = 255;
- *d++ = (bgr&0x7C00)>>7;
- *d++ = (bgr&0x3E0)>>2;
- *d++ = (bgr&0x1F)<<3;
-#else
- *d++ = (bgr&0x1F)<<3;
- *d++ = (bgr&0x3E0)>>2;
- *d++ = (bgr&0x7C00)>>7;
- *d++ = 255;
-#endif
- }
-}
-
-static inline void RENAME(rgb16to32)(const uint8_t *src, uint8_t *dst, long src_size)
-{
- const uint16_t *end;
-#if HAVE_MMX
- const uint16_t *mm_end;
-#endif
- uint8_t *d = dst;
- const uint16_t *s = (const uint16_t*)src;
- end = s + src_size/2;
-#if HAVE_MMX
- __asm__ volatile(PREFETCH" %0"::"m"(*s):"memory");
- __asm__ volatile("pxor %%mm7,%%mm7 \n\t":::"memory");
- __asm__ volatile("pcmpeqd %%mm6,%%mm6 \n\t":::"memory");
- mm_end = end - 3;
- while (s < mm_end) {
- __asm__ volatile(
- PREFETCH" 32%1 \n\t"
- "movq %1, %%mm0 \n\t"
- "movq %1, %%mm1 \n\t"
- "movq %1, %%mm2 \n\t"
- "pand %2, %%mm0 \n\t"
- "pand %3, %%mm1 \n\t"
- "pand %4, %%mm2 \n\t"
- "psllq $3, %%mm0 \n\t"
- "psrlq $3, %%mm1 \n\t"
- "psrlq $8, %%mm2 \n\t"
- PACK_RGB32
- :"=m"(*d)
- :"m"(*s),"m"(mask16b),"m"(mask16g),"m"(mask16r)
- :"memory");
- d += 16;
- s += 4;
- }
- __asm__ volatile(SFENCE:::"memory");
- __asm__ volatile(EMMS:::"memory");
-#endif
- while (s < end) {
- register uint16_t bgr;
- bgr = *s++;
-#if HAVE_BIGENDIAN
- *d++ = 255;
- *d++ = (bgr&0xF800)>>8;
- *d++ = (bgr&0x7E0)>>3;
- *d++ = (bgr&0x1F)<<3;
-#else
- *d++ = (bgr&0x1F)<<3;
- *d++ = (bgr&0x7E0)>>3;
- *d++ = (bgr&0xF800)>>8;
- *d++ = 255;
-#endif
- }
-}
-
-static inline void RENAME(rgb32tobgr32)(const uint8_t *src, uint8_t *dst, long src_size)
-{
- x86_reg idx = 15 - src_size;
- const uint8_t *s = src-idx;
- uint8_t *d = dst-idx;
-#if HAVE_MMX
- __asm__ volatile(
- "test %0, %0 \n\t"
- "jns 2f \n\t"
- PREFETCH" (%1, %0) \n\t"
- "movq %3, %%mm7 \n\t"
- "pxor %4, %%mm7 \n\t"
- "movq %%mm7, %%mm6 \n\t"
- "pxor %5, %%mm7 \n\t"
- ASMALIGN(4)
- "1: \n\t"
- PREFETCH" 32(%1, %0) \n\t"
- "movq (%1, %0), %%mm0 \n\t"
- "movq 8(%1, %0), %%mm1 \n\t"
-# if HAVE_MMX2
- "pshufw $177, %%mm0, %%mm3 \n\t"
- "pshufw $177, %%mm1, %%mm5 \n\t"
- "pand %%mm7, %%mm0 \n\t"
- "pand %%mm6, %%mm3 \n\t"
- "pand %%mm7, %%mm1 \n\t"
- "pand %%mm6, %%mm5 \n\t"
- "por %%mm3, %%mm0 \n\t"
- "por %%mm5, %%mm1 \n\t"
-# else
- "movq %%mm0, %%mm2 \n\t"
- "movq %%mm1, %%mm4 \n\t"
- "pand %%mm7, %%mm0 \n\t"
- "pand %%mm6, %%mm2 \n\t"
- "pand %%mm7, %%mm1 \n\t"
- "pand %%mm6, %%mm4 \n\t"
- "movq %%mm2, %%mm3 \n\t"
- "movq %%mm4, %%mm5 \n\t"
- "pslld $16, %%mm2 \n\t"
- "psrld $16, %%mm3 \n\t"
- "pslld $16, %%mm4 \n\t"
- "psrld $16, %%mm5 \n\t"
- "por %%mm2, %%mm0 \n\t"
- "por %%mm4, %%mm1 \n\t"
- "por %%mm3, %%mm0 \n\t"
- "por %%mm5, %%mm1 \n\t"
-# endif
- MOVNTQ" %%mm0, (%2, %0) \n\t"
- MOVNTQ" %%mm1, 8(%2, %0) \n\t"
- "add $16, %0 \n\t"
- "js 1b \n\t"
- SFENCE" \n\t"
- EMMS" \n\t"
- "2: \n\t"
- : "+&r"(idx)
- : "r" (s), "r" (d), "m" (mask32b), "m" (mask32r), "m" (mmx_one)
- : "memory");
-#endif
- for (; idx<15; idx+=4) {
- register int v = *(const uint32_t *)&s[idx], g = v & 0xff00ff00;
- v &= 0xff00ff;
- *(uint32_t *)&d[idx] = (v>>16) + g + (v<<16);
- }
-}
-
-static inline void RENAME(rgb24tobgr24)(const uint8_t *src, uint8_t *dst, long src_size)
-{
- unsigned i;
-#if HAVE_MMX
- x86_reg mmx_size= 23 - src_size;
- __asm__ volatile (
- "test %%"REG_a", %%"REG_a" \n\t"
- "jns 2f \n\t"
- "movq "MANGLE(mask24r)", %%mm5 \n\t"
- "movq "MANGLE(mask24g)", %%mm6 \n\t"
- "movq "MANGLE(mask24b)", %%mm7 \n\t"
- ASMALIGN(4)
- "1: \n\t"
- PREFETCH" 32(%1, %%"REG_a") \n\t"
- "movq (%1, %%"REG_a"), %%mm0 \n\t" // BGR BGR BG
- "movq (%1, %%"REG_a"), %%mm1 \n\t" // BGR BGR BG
- "movq 2(%1, %%"REG_a"), %%mm2 \n\t" // R BGR BGR B
- "psllq $16, %%mm0 \n\t" // 00 BGR BGR
- "pand %%mm5, %%mm0 \n\t"
- "pand %%mm6, %%mm1 \n\t"
- "pand %%mm7, %%mm2 \n\t"
- "por %%mm0, %%mm1 \n\t"
- "por %%mm2, %%mm1 \n\t"
- "movq 6(%1, %%"REG_a"), %%mm0 \n\t" // BGR BGR BG
- MOVNTQ" %%mm1, (%2, %%"REG_a") \n\t" // RGB RGB RG
- "movq 8(%1, %%"REG_a"), %%mm1 \n\t" // R BGR BGR B
- "movq 10(%1, %%"REG_a"), %%mm2 \n\t" // GR BGR BGR
- "pand %%mm7, %%mm0 \n\t"
- "pand %%mm5, %%mm1 \n\t"
- "pand %%mm6, %%mm2 \n\t"
- "por %%mm0, %%mm1 \n\t"
- "por %%mm2, %%mm1 \n\t"
- "movq 14(%1, %%"REG_a"), %%mm0 \n\t" // R BGR BGR B
- MOVNTQ" %%mm1, 8(%2, %%"REG_a") \n\t" // B RGB RGB R
- "movq 16(%1, %%"REG_a"), %%mm1 \n\t" // GR BGR BGR
- "movq 18(%1, %%"REG_a"), %%mm2 \n\t" // BGR BGR BG
- "pand %%mm6, %%mm0 \n\t"
- "pand %%mm7, %%mm1 \n\t"
- "pand %%mm5, %%mm2 \n\t"
- "por %%mm0, %%mm1 \n\t"
- "por %%mm2, %%mm1 \n\t"
- MOVNTQ" %%mm1, 16(%2, %%"REG_a") \n\t"
- "add $24, %%"REG_a" \n\t"
- " js 1b \n\t"
- "2: \n\t"
- : "+a" (mmx_size)
- : "r" (src-mmx_size), "r"(dst-mmx_size)
- );
-
- __asm__ volatile(SFENCE:::"memory");
- __asm__ volatile(EMMS:::"memory");
-
- if (mmx_size==23) return; //finished, was multiple of 8
-
- src+= src_size;
- dst+= src_size;
- src_size= 23-mmx_size;
- src-= src_size;
- dst-= src_size;
-#endif
- for (i=0; i<src_size; i+=3) {
- register uint8_t x;
- x = src[i + 2];
- dst[i + 1] = src[i + 1];
- dst[i + 2] = src[i + 0];
- dst[i + 0] = x;
- }
-}
-
-static inline void RENAME(yuvPlanartoyuy2)(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc, uint8_t *dst,
- long width, long height,
- long lumStride, long chromStride, long dstStride, long vertLumPerChroma)
-{
- long y;
- const x86_reg chromWidth= width>>1;
- for (y=0; y<height; y++) {
-#if HAVE_MMX
- //FIXME handle 2 lines at once (fewer prefetches, reuse some chroma, but very likely memory-limited anyway)
- __asm__ volatile(
- "xor %%"REG_a", %%"REG_a" \n\t"
- ASMALIGN(4)
- "1: \n\t"
- PREFETCH" 32(%1, %%"REG_a", 2) \n\t"
- PREFETCH" 32(%2, %%"REG_a") \n\t"
- PREFETCH" 32(%3, %%"REG_a") \n\t"
- "movq (%2, %%"REG_a"), %%mm0 \n\t" // U(0)
- "movq %%mm0, %%mm2 \n\t" // U(0)
- "movq (%3, %%"REG_a"), %%mm1 \n\t" // V(0)
- "punpcklbw %%mm1, %%mm0 \n\t" // UVUV UVUV(0)
- "punpckhbw %%mm1, %%mm2 \n\t" // UVUV UVUV(8)
-
- "movq (%1, %%"REG_a",2), %%mm3 \n\t" // Y(0)
- "movq 8(%1, %%"REG_a",2), %%mm5 \n\t" // Y(8)
- "movq %%mm3, %%mm4 \n\t" // Y(0)
- "movq %%mm5, %%mm6 \n\t" // Y(8)
- "punpcklbw %%mm0, %%mm3 \n\t" // YUYV YUYV(0)
- "punpckhbw %%mm0, %%mm4 \n\t" // YUYV YUYV(4)
- "punpcklbw %%mm2, %%mm5 \n\t" // YUYV YUYV(8)
- "punpckhbw %%mm2, %%mm6 \n\t" // YUYV YUYV(12)
-
- MOVNTQ" %%mm3, (%0, %%"REG_a", 4) \n\t"
- MOVNTQ" %%mm4, 8(%0, %%"REG_a", 4) \n\t"
- MOVNTQ" %%mm5, 16(%0, %%"REG_a", 4) \n\t"
- MOVNTQ" %%mm6, 24(%0, %%"REG_a", 4) \n\t"
-
- "add $8, %%"REG_a" \n\t"
- "cmp %4, %%"REG_a" \n\t"
- " jb 1b \n\t"
- ::"r"(dst), "r"(ysrc), "r"(usrc), "r"(vsrc), "g" (chromWidth)
- : "%"REG_a
- );
-#else
-
-#if ARCH_ALPHA && HAVE_MVI
-#define pl2yuy2(n) \
- y1 = yc[n]; \
- y2 = yc2[n]; \
- u = uc[n]; \
- v = vc[n]; \
- __asm__("unpkbw %1, %0" : "=r"(y1) : "r"(y1)); \
- __asm__("unpkbw %1, %0" : "=r"(y2) : "r"(y2)); \
- __asm__("unpkbl %1, %0" : "=r"(u) : "r"(u)); \
- __asm__("unpkbl %1, %0" : "=r"(v) : "r"(v)); \
- yuv1 = (u << 8) + (v << 24); \
- yuv2 = yuv1 + y2; \
- yuv1 += y1; \
- qdst[n] = yuv1; \
- qdst2[n] = yuv2;
-
- int i;
- uint64_t *qdst = (uint64_t *) dst;
- uint64_t *qdst2 = (uint64_t *) (dst + dstStride);
- const uint32_t *yc = (uint32_t *) ysrc;
- const uint32_t *yc2 = (uint32_t *) (ysrc + lumStride);
- const uint16_t *uc = (uint16_t*) usrc, *vc = (uint16_t*) vsrc;
- for (i = 0; i < chromWidth; i += 8) {
- uint64_t y1, y2, yuv1, yuv2;
- uint64_t u, v;
- /* Prefetch */
- __asm__("ldq $31,64(%0)" :: "r"(yc));
- __asm__("ldq $31,64(%0)" :: "r"(yc2));
- __asm__("ldq $31,64(%0)" :: "r"(uc));
- __asm__("ldq $31,64(%0)" :: "r"(vc));
-
- pl2yuy2(0);
- pl2yuy2(1);
- pl2yuy2(2);
- pl2yuy2(3);
-
- yc += 4;
- yc2 += 4;
- uc += 4;
- vc += 4;
- qdst += 4;
- qdst2 += 4;
- }
- y++;
- ysrc += lumStride;
- dst += dstStride;
-
-#elif HAVE_FAST_64BIT
- int i;
- uint64_t *ldst = (uint64_t *) dst;
- const uint8_t *yc = ysrc, *uc = usrc, *vc = vsrc;
- for (i = 0; i < chromWidth; i += 2) {
- uint64_t k, l;
- k = yc[0] + (uc[0] << 8) +
- (yc[1] << 16) + (vc[0] << 24);
- l = yc[2] + (uc[1] << 8) +
- (yc[3] << 16) + (vc[1] << 24);
- *ldst++ = k + (l << 32);
- yc += 4;
- uc += 2;
- vc += 2;
- }
-
-#else
- int i, *idst = (int32_t *) dst;
- const uint8_t *yc = ysrc, *uc = usrc, *vc = vsrc;
- for (i = 0; i < chromWidth; i++) {
-#if HAVE_BIGENDIAN
- *idst++ = (yc[0] << 24)+ (uc[0] << 16) +
- (yc[1] << 8) + (vc[0] << 0);
-#else
- *idst++ = yc[0] + (uc[0] << 8) +
- (yc[1] << 16) + (vc[0] << 24);
-#endif
- yc += 2;
- uc++;
- vc++;
- }
-#endif
-#endif
- if ((y&(vertLumPerChroma-1)) == vertLumPerChroma-1) {
- usrc += chromStride;
- vsrc += chromStride;
- }
- ysrc += lumStride;
- dst += dstStride;
- }
-#if HAVE_MMX
- __asm__(EMMS" \n\t"
- SFENCE" \n\t"
- :::"memory");
-#endif
-}
-
-/**
- * Height should be a multiple of 2 and width should be a multiple of 16.
- * (If this is a problem for anyone then tell me, and I will fix it.)
- */
-static inline void RENAME(yv12toyuy2)(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc, uint8_t *dst,
- long width, long height,
- long lumStride, long chromStride, long dstStride)
-{
- //FIXME interpolate chroma
- RENAME(yuvPlanartoyuy2)(ysrc, usrc, vsrc, dst, width, height, lumStride, chromStride, dstStride, 2);
-}
-
-static inline void RENAME(yuvPlanartouyvy)(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc, uint8_t *dst,
- long width, long height,
- long lumStride, long chromStride, long dstStride, long vertLumPerChroma)
-{
- long y;
- const x86_reg chromWidth= width>>1;
- for (y=0; y<height; y++) {
-#if HAVE_MMX
- //FIXME handle 2 lines at once (fewer prefetches, reuse some chroma, but very likely memory-limited anyway)
- __asm__ volatile(
- "xor %%"REG_a", %%"REG_a" \n\t"
- ASMALIGN(4)
- "1: \n\t"
- PREFETCH" 32(%1, %%"REG_a", 2) \n\t"
- PREFETCH" 32(%2, %%"REG_a") \n\t"
- PREFETCH" 32(%3, %%"REG_a") \n\t"
- "movq (%2, %%"REG_a"), %%mm0 \n\t" // U(0)
- "movq %%mm0, %%mm2 \n\t" // U(0)
- "movq (%3, %%"REG_a"), %%mm1 \n\t" // V(0)
- "punpcklbw %%mm1, %%mm0 \n\t" // UVUV UVUV(0)
- "punpckhbw %%mm1, %%mm2 \n\t" // UVUV UVUV(8)
-
- "movq (%1, %%"REG_a",2), %%mm3 \n\t" // Y(0)
- "movq 8(%1, %%"REG_a",2), %%mm5 \n\t" // Y(8)
- "movq %%mm0, %%mm4 \n\t" // Y(0)
- "movq %%mm2, %%mm6 \n\t" // Y(8)
- "punpcklbw %%mm3, %%mm0 \n\t" // YUYV YUYV(0)
- "punpckhbw %%mm3, %%mm4 \n\t" // YUYV YUYV(4)
- "punpcklbw %%mm5, %%mm2 \n\t" // YUYV YUYV(8)
- "punpckhbw %%mm5, %%mm6 \n\t" // YUYV YUYV(12)
-
- MOVNTQ" %%mm0, (%0, %%"REG_a", 4) \n\t"
- MOVNTQ" %%mm4, 8(%0, %%"REG_a", 4) \n\t"
- MOVNTQ" %%mm2, 16(%0, %%"REG_a", 4) \n\t"
- MOVNTQ" %%mm6, 24(%0, %%"REG_a", 4) \n\t"
-
- "add $8, %%"REG_a" \n\t"
- "cmp %4, %%"REG_a" \n\t"
- " jb 1b \n\t"
- ::"r"(dst), "r"(ysrc), "r"(usrc), "r"(vsrc), "g" (chromWidth)
- : "%"REG_a
- );
-#else
-//FIXME adapt the Alpha ASM code from yv12->yuy2
-
-#if HAVE_FAST_64BIT
- int i;
- uint64_t *ldst = (uint64_t *) dst;
- const uint8_t *yc = ysrc, *uc = usrc, *vc = vsrc;
- for (i = 0; i < chromWidth; i += 2) {
- uint64_t k, l;
- k = uc[0] + (yc[0] << 8) +
- (vc[0] << 16) + (yc[1] << 24);
- l = uc[1] + (yc[2] << 8) +
- (vc[1] << 16) + (yc[3] << 24);
- *ldst++ = k + (l << 32);
- yc += 4;
- uc += 2;
- vc += 2;
- }
-
-#else
- int i, *idst = (int32_t *) dst;
- const uint8_t *yc = ysrc, *uc = usrc, *vc = vsrc;
- for (i = 0; i < chromWidth; i++) {
-#if HAVE_BIGENDIAN
- *idst++ = (uc[0] << 24)+ (yc[0] << 16) +
- (vc[0] << 8) + (yc[1] << 0);
-#else
- *idst++ = uc[0] + (yc[0] << 8) +
- (vc[0] << 16) + (yc[1] << 24);
-#endif
- yc += 2;
- uc++;
- vc++;
- }
-#endif
-#endif
- if ((y&(vertLumPerChroma-1)) == vertLumPerChroma-1) {
- usrc += chromStride;
- vsrc += chromStride;
- }
- ysrc += lumStride;
- dst += dstStride;
- }
-#if HAVE_MMX
- __asm__(EMMS" \n\t"
- SFENCE" \n\t"
- :::"memory");
-#endif
-}
-
-/**
- * Height should be a multiple of 2 and width should be a multiple of 16
- * (If this is a problem for anyone then tell me, and I will fix it.)
- */
-static inline void RENAME(yv12touyvy)(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc, uint8_t *dst,
- long width, long height,
- long lumStride, long chromStride, long dstStride)
-{
- //FIXME interpolate chroma
- RENAME(yuvPlanartouyvy)(ysrc, usrc, vsrc, dst, width, height, lumStride, chromStride, dstStride, 2);
-}
-
-/**
- * Width should be a multiple of 16.
- */
-static inline void RENAME(yuv422ptouyvy)(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc, uint8_t *dst,
- long width, long height,
- long lumStride, long chromStride, long dstStride)
-{
- RENAME(yuvPlanartouyvy)(ysrc, usrc, vsrc, dst, width, height, lumStride, chromStride, dstStride, 1);
-}
-
-/**
- * Width should be a multiple of 16.
- */
-static inline void RENAME(yuv422ptoyuy2)(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc, uint8_t *dst,
- long width, long height,
- long lumStride, long chromStride, long dstStride)
-{
- RENAME(yuvPlanartoyuy2)(ysrc, usrc, vsrc, dst, width, height, lumStride, chromStride, dstStride, 1);
-}
-
-/**
- * Height should be a multiple of 2 and width should be a multiple of 16.
- * (If this is a problem for anyone then tell me, and I will fix it.)
- */
-static inline void RENAME(yuy2toyv12)(const uint8_t *src, uint8_t *ydst, uint8_t *udst, uint8_t *vdst,
- long width, long height,
- long lumStride, long chromStride, long srcStride)
-{
- long y;
- const x86_reg chromWidth= width>>1;
- for (y=0; y<height; y+=2) {
-#if HAVE_MMX
- __asm__ volatile(
- "xor %%"REG_a", %%"REG_a" \n\t"
- "pcmpeqw %%mm7, %%mm7 \n\t"
- "psrlw $8, %%mm7 \n\t" // FF,00,FF,00...
- ASMALIGN(4)
- "1: \n\t"
- PREFETCH" 64(%0, %%"REG_a", 4) \n\t"
- "movq (%0, %%"REG_a", 4), %%mm0 \n\t" // YUYV YUYV(0)
- "movq 8(%0, %%"REG_a", 4), %%mm1 \n\t" // YUYV YUYV(4)
- "movq %%mm0, %%mm2 \n\t" // YUYV YUYV(0)
- "movq %%mm1, %%mm3 \n\t" // YUYV YUYV(4)
- "psrlw $8, %%mm0 \n\t" // U0V0 U0V0(0)
- "psrlw $8, %%mm1 \n\t" // U0V0 U0V0(4)
- "pand %%mm7, %%mm2 \n\t" // Y0Y0 Y0Y0(0)
- "pand %%mm7, %%mm3 \n\t" // Y0Y0 Y0Y0(4)
- "packuswb %%mm1, %%mm0 \n\t" // UVUV UVUV(0)
- "packuswb %%mm3, %%mm2 \n\t" // YYYY YYYY(0)
-
- MOVNTQ" %%mm2, (%1, %%"REG_a", 2) \n\t"
-
- "movq 16(%0, %%"REG_a", 4), %%mm1 \n\t" // YUYV YUYV(8)
- "movq 24(%0, %%"REG_a", 4), %%mm2 \n\t" // YUYV YUYV(12)
- "movq %%mm1, %%mm3 \n\t" // YUYV YUYV(8)
- "movq %%mm2, %%mm4 \n\t" // YUYV YUYV(12)
- "psrlw $8, %%mm1 \n\t" // U0V0 U0V0(8)
- "psrlw $8, %%mm2 \n\t" // U0V0 U0V0(12)
- "pand %%mm7, %%mm3 \n\t" // Y0Y0 Y0Y0(8)
- "pand %%mm7, %%mm4 \n\t" // Y0Y0 Y0Y0(12)
- "packuswb %%mm2, %%mm1 \n\t" // UVUV UVUV(8)
- "packuswb %%mm4, %%mm3 \n\t" // YYYY YYYY(8)
-
- MOVNTQ" %%mm3, 8(%1, %%"REG_a", 2) \n\t"
-
- "movq %%mm0, %%mm2 \n\t" // UVUV UVUV(0)
- "movq %%mm1, %%mm3 \n\t" // UVUV UVUV(8)
- "psrlw $8, %%mm0 \n\t" // V0V0 V0V0(0)
- "psrlw $8, %%mm1 \n\t" // V0V0 V0V0(8)
- "pand %%mm7, %%mm2 \n\t" // U0U0 U0U0(0)
- "pand %%mm7, %%mm3 \n\t" // U0U0 U0U0(8)
- "packuswb %%mm1, %%mm0 \n\t" // VVVV VVVV(0)
- "packuswb %%mm3, %%mm2 \n\t" // UUUU UUUU(0)
-
- MOVNTQ" %%mm0, (%3, %%"REG_a") \n\t"
- MOVNTQ" %%mm2, (%2, %%"REG_a") \n\t"
-
- "add $8, %%"REG_a" \n\t"
- "cmp %4, %%"REG_a" \n\t"
- " jb 1b \n\t"
- ::"r"(src), "r"(ydst), "r"(udst), "r"(vdst), "g" (chromWidth)
- : "memory", "%"REG_a
- );
-
- ydst += lumStride;
- src += srcStride;
-
- __asm__ volatile(
- "xor %%"REG_a", %%"REG_a" \n\t"
- ASMALIGN(4)
- "1: \n\t"
- PREFETCH" 64(%0, %%"REG_a", 4) \n\t"
- "movq (%0, %%"REG_a", 4), %%mm0 \n\t" // YUYV YUYV(0)
- "movq 8(%0, %%"REG_a", 4), %%mm1 \n\t" // YUYV YUYV(4)
- "movq 16(%0, %%"REG_a", 4), %%mm2 \n\t" // YUYV YUYV(8)
- "movq 24(%0, %%"REG_a", 4), %%mm3 \n\t" // YUYV YUYV(12)
- "pand %%mm7, %%mm0 \n\t" // Y0Y0 Y0Y0(0)
- "pand %%mm7, %%mm1 \n\t" // Y0Y0 Y0Y0(4)
- "pand %%mm7, %%mm2 \n\t" // Y0Y0 Y0Y0(8)
- "pand %%mm7, %%mm3 \n\t" // Y0Y0 Y0Y0(12)
- "packuswb %%mm1, %%mm0 \n\t" // YYYY YYYY(0)
- "packuswb %%mm3, %%mm2 \n\t" // YYYY YYYY(8)
-
- MOVNTQ" %%mm0, (%1, %%"REG_a", 2) \n\t"
- MOVNTQ" %%mm2, 8(%1, %%"REG_a", 2) \n\t"
-
- "add $8, %%"REG_a" \n\t"
- "cmp %4, %%"REG_a" \n\t"
- " jb 1b \n\t"
-
- ::"r"(src), "r"(ydst), "r"(udst), "r"(vdst), "g" (chromWidth)
- : "memory", "%"REG_a
- );
-#else
- long i;
- for (i=0; i<chromWidth; i++) {
- ydst[2*i+0] = src[4*i+0];
- udst[i] = src[4*i+1];
- ydst[2*i+1] = src[4*i+2];
- vdst[i] = src[4*i+3];
- }
- ydst += lumStride;
- src += srcStride;
-
- for (i=0; i<chromWidth; i++) {
- ydst[2*i+0] = src[4*i+0];
- ydst[2*i+1] = src[4*i+2];
- }
-#endif
- udst += chromStride;
- vdst += chromStride;
- ydst += lumStride;
- src += srcStride;
- }
-#if HAVE_MMX
- __asm__ volatile(EMMS" \n\t"
- SFENCE" \n\t"
- :::"memory");
-#endif
-}
-
-static inline void RENAME(yvu9toyv12)(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc,
- uint8_t *ydst, uint8_t *udst, uint8_t *vdst,
- long width, long height, long lumStride, long chromStride)
-{
- /* Y Plane */
- memcpy(ydst, ysrc, width*height);
-
- /* XXX: implement upscaling for U,V */
-}
-
-static inline void RENAME(planar2x)(const uint8_t *src, uint8_t *dst, long srcWidth, long srcHeight, long srcStride, long dstStride)
-{
- long x,y;
-
- dst[0]= src[0];
-
- // first line
- for (x=0; x<srcWidth-1; x++) {
- dst[2*x+1]= (3*src[x] + src[x+1])>>2;
- dst[2*x+2]= ( src[x] + 3*src[x+1])>>2;
- }
- dst[2*srcWidth-1]= src[srcWidth-1];
-
- dst+= dstStride;
-
- for (y=1; y<srcHeight; y++) {
-#if HAVE_MMX2 || HAVE_AMD3DNOW
- const x86_reg mmxSize= srcWidth&~15;
- __asm__ volatile(
- "mov %4, %%"REG_a" \n\t"
- "1: \n\t"
- "movq (%0, %%"REG_a"), %%mm0 \n\t"
- "movq (%1, %%"REG_a"), %%mm1 \n\t"
- "movq 1(%0, %%"REG_a"), %%mm2 \n\t"
- "movq 1(%1, %%"REG_a"), %%mm3 \n\t"
- "movq -1(%0, %%"REG_a"), %%mm4 \n\t"
- "movq -1(%1, %%"REG_a"), %%mm5 \n\t"
- PAVGB" %%mm0, %%mm5 \n\t"
- PAVGB" %%mm0, %%mm3 \n\t"
- PAVGB" %%mm0, %%mm5 \n\t"
- PAVGB" %%mm0, %%mm3 \n\t"
- PAVGB" %%mm1, %%mm4 \n\t"
- PAVGB" %%mm1, %%mm2 \n\t"
- PAVGB" %%mm1, %%mm4 \n\t"
- PAVGB" %%mm1, %%mm2 \n\t"
- "movq %%mm5, %%mm7 \n\t"
- "movq %%mm4, %%mm6 \n\t"
- "punpcklbw %%mm3, %%mm5 \n\t"
- "punpckhbw %%mm3, %%mm7 \n\t"
- "punpcklbw %%mm2, %%mm4 \n\t"
- "punpckhbw %%mm2, %%mm6 \n\t"
-#if 1
- MOVNTQ" %%mm5, (%2, %%"REG_a", 2) \n\t"
- MOVNTQ" %%mm7, 8(%2, %%"REG_a", 2) \n\t"
- MOVNTQ" %%mm4, (%3, %%"REG_a", 2) \n\t"
- MOVNTQ" %%mm6, 8(%3, %%"REG_a", 2) \n\t"
-#else
- "movq %%mm5, (%2, %%"REG_a", 2) \n\t"
- "movq %%mm7, 8(%2, %%"REG_a", 2) \n\t"
- "movq %%mm4, (%3, %%"REG_a", 2) \n\t"
- "movq %%mm6, 8(%3, %%"REG_a", 2) \n\t"
-#endif
- "add $8, %%"REG_a" \n\t"
- " js 1b \n\t"
- :: "r" (src + mmxSize ), "r" (src + srcStride + mmxSize ),
- "r" (dst + mmxSize*2), "r" (dst + dstStride + mmxSize*2),
- "g" (-mmxSize)
- : "%"REG_a
-
- );
-#else
- const x86_reg mmxSize=1;
-#endif
- dst[0 ]= (3*src[0] + src[srcStride])>>2;
- dst[dstStride]= ( src[0] + 3*src[srcStride])>>2;
-
- for (x=mmxSize-1; x<srcWidth-1; x++) {
- dst[2*x +1]= (3*src[x+0] + src[x+srcStride+1])>>2;
- dst[2*x+dstStride+2]= ( src[x+0] + 3*src[x+srcStride+1])>>2;
- dst[2*x+dstStride+1]= ( src[x+1] + 3*src[x+srcStride ])>>2;
- dst[2*x +2]= (3*src[x+1] + src[x+srcStride ])>>2;
- }
- dst[srcWidth*2 -1 ]= (3*src[srcWidth-1] + src[srcWidth-1 + srcStride])>>2;
- dst[srcWidth*2 -1 + dstStride]= ( src[srcWidth-1] + 3*src[srcWidth-1 + srcStride])>>2;
-
- dst+=dstStride*2;
- src+=srcStride;
- }
-
- // last line
-#if 1
- dst[0]= src[0];
-
- for (x=0; x<srcWidth-1; x++) {
- dst[2*x+1]= (3*src[x] + src[x+1])>>2;
- dst[2*x+2]= ( src[x] + 3*src[x+1])>>2;
- }
- dst[2*srcWidth-1]= src[srcWidth-1];
-#else
- for (x=0; x<srcWidth; x++) {
- dst[2*x+0]=
- dst[2*x+1]= src[x];
- }
-#endif
-
-#if HAVE_MMX
- __asm__ volatile(EMMS" \n\t"
- SFENCE" \n\t"
- :::"memory");
-#endif
-}
-
-/**
- * Height should be a multiple of 2 and width should be a multiple of 16.
- * (If this is a problem for anyone then tell me, and I will fix it.)
- * Chrominance data is only taken from every second line, others are ignored.
- * FIXME: Write HQ version.
- */
-static inline void RENAME(uyvytoyv12)(const uint8_t *src, uint8_t *ydst, uint8_t *udst, uint8_t *vdst,
- long width, long height,
- long lumStride, long chromStride, long srcStride)
-{
- long y;
- const x86_reg chromWidth= width>>1;
- for (y=0; y<height; y+=2) {
-#if HAVE_MMX
- __asm__ volatile(
- "xor %%"REG_a", %%"REG_a" \n\t"
- "pcmpeqw %%mm7, %%mm7 \n\t"
- "psrlw $8, %%mm7 \n\t" // FF,00,FF,00...
- ASMALIGN(4)
- "1: \n\t"
- PREFETCH" 64(%0, %%"REG_a", 4) \n\t"
- "movq (%0, %%"REG_a", 4), %%mm0 \n\t" // UYVY UYVY(0)
- "movq 8(%0, %%"REG_a", 4), %%mm1 \n\t" // UYVY UYVY(4)
- "movq %%mm0, %%mm2 \n\t" // UYVY UYVY(0)
- "movq %%mm1, %%mm3 \n\t" // UYVY UYVY(4)
- "pand %%mm7, %%mm0 \n\t" // U0V0 U0V0(0)
- "pand %%mm7, %%mm1 \n\t" // U0V0 U0V0(4)
- "psrlw $8, %%mm2 \n\t" // Y0Y0 Y0Y0(0)
- "psrlw $8, %%mm3 \n\t" // Y0Y0 Y0Y0(4)
- "packuswb %%mm1, %%mm0 \n\t" // UVUV UVUV(0)
- "packuswb %%mm3, %%mm2 \n\t" // YYYY YYYY(0)
-
- MOVNTQ" %%mm2, (%1, %%"REG_a", 2) \n\t"
-
- "movq 16(%0, %%"REG_a", 4), %%mm1 \n\t" // UYVY UYVY(8)
- "movq 24(%0, %%"REG_a", 4), %%mm2 \n\t" // UYVY UYVY(12)
- "movq %%mm1, %%mm3 \n\t" // UYVY UYVY(8)
- "movq %%mm2, %%mm4 \n\t" // UYVY UYVY(12)
- "pand %%mm7, %%mm1 \n\t" // U0V0 U0V0(8)
- "pand %%mm7, %%mm2 \n\t" // U0V0 U0V0(12)
- "psrlw $8, %%mm3 \n\t" // Y0Y0 Y0Y0(8)
- "psrlw $8, %%mm4 \n\t" // Y0Y0 Y0Y0(12)
- "packuswb %%mm2, %%mm1 \n\t" // UVUV UVUV(8)
- "packuswb %%mm4, %%mm3 \n\t" // YYYY YYYY(8)
-
- MOVNTQ" %%mm3, 8(%1, %%"REG_a", 2) \n\t"
-
- "movq %%mm0, %%mm2 \n\t" // UVUV UVUV(0)
- "movq %%mm1, %%mm3 \n\t" // UVUV UVUV(8)
- "psrlw $8, %%mm0 \n\t" // V0V0 V0V0(0)
- "psrlw $8, %%mm1 \n\t" // V0V0 V0V0(8)
- "pand %%mm7, %%mm2 \n\t" // U0U0 U0U0(0)
- "pand %%mm7, %%mm3 \n\t" // U0U0 U0U0(8)
- "packuswb %%mm1, %%mm0 \n\t" // VVVV VVVV(0)
- "packuswb %%mm3, %%mm2 \n\t" // UUUU UUUU(0)
-
- MOVNTQ" %%mm0, (%3, %%"REG_a") \n\t"
- MOVNTQ" %%mm2, (%2, %%"REG_a") \n\t"
-
- "add $8, %%"REG_a" \n\t"
- "cmp %4, %%"REG_a" \n\t"
- " jb 1b \n\t"
- ::"r"(src), "r"(ydst), "r"(udst), "r"(vdst), "g" (chromWidth)
- : "memory", "%"REG_a
- );
-
- ydst += lumStride;
- src += srcStride;
-
- __asm__ volatile(
- "xor %%"REG_a", %%"REG_a" \n\t"
- ASMALIGN(4)
- "1: \n\t"
- PREFETCH" 64(%0, %%"REG_a", 4) \n\t"
- "movq (%0, %%"REG_a", 4), %%mm0 \n\t" // YUYV YUYV(0)
- "movq 8(%0, %%"REG_a", 4), %%mm1 \n\t" // YUYV YUYV(4)
- "movq 16(%0, %%"REG_a", 4), %%mm2 \n\t" // YUYV YUYV(8)
- "movq 24(%0, %%"REG_a", 4), %%mm3 \n\t" // YUYV YUYV(12)
- "psrlw $8, %%mm0 \n\t" // Y0Y0 Y0Y0(0)
- "psrlw $8, %%mm1 \n\t" // Y0Y0 Y0Y0(4)
- "psrlw $8, %%mm2 \n\t" // Y0Y0 Y0Y0(8)
- "psrlw $8, %%mm3 \n\t" // Y0Y0 Y0Y0(12)
- "packuswb %%mm1, %%mm0 \n\t" // YYYY YYYY(0)
- "packuswb %%mm3, %%mm2 \n\t" // YYYY YYYY(8)
-
- MOVNTQ" %%mm0, (%1, %%"REG_a", 2) \n\t"
- MOVNTQ" %%mm2, 8(%1, %%"REG_a", 2) \n\t"
-
- "add $8, %%"REG_a" \n\t"
- "cmp %4, %%"REG_a" \n\t"
- " jb 1b \n\t"
-
- ::"r"(src), "r"(ydst), "r"(udst), "r"(vdst), "g" (chromWidth)
- : "memory", "%"REG_a
- );
-#else
- long i;
- for (i=0; i<chromWidth; i++) {
- udst[i] = src[4*i+0];
- ydst[2*i+0] = src[4*i+1];
- vdst[i] = src[4*i+2];
- ydst[2*i+1] = src[4*i+3];
- }
- ydst += lumStride;
- src += srcStride;
-
- for (i=0; i<chromWidth; i++) {
- ydst[2*i+0] = src[4*i+1];
- ydst[2*i+1] = src[4*i+3];
- }
-#endif
- udst += chromStride;
- vdst += chromStride;
- ydst += lumStride;
- src += srcStride;
- }
-#if HAVE_MMX
- __asm__ volatile(EMMS" \n\t"
- SFENCE" \n\t"
- :::"memory");
-#endif
-}
-
-/**
- * Height should be a multiple of 2 and width should be a multiple of 2.
- * (If this is a problem for anyone then tell me, and I will fix it.)
- * Chrominance data is only taken from every second line,
- * others are ignored in the C version.
- * FIXME: Write HQ version.
- */
-static inline void RENAME(rgb24toyv12)(const uint8_t *src, uint8_t *ydst, uint8_t *udst, uint8_t *vdst,
- long width, long height,
- long lumStride, long chromStride, long srcStride)
-{
- long y;
- const x86_reg chromWidth= width>>1;
-#if HAVE_MMX
- for (y=0; y<height-2; y+=2) {
- long i;
- for (i=0; i<2; i++) {
- __asm__ volatile(
- "mov %2, %%"REG_a" \n\t"
- "movq "MANGLE(ff_bgr2YCoeff)", %%mm6 \n\t"
- "movq "MANGLE(ff_w1111)", %%mm5 \n\t"
- "pxor %%mm7, %%mm7 \n\t"
- "lea (%%"REG_a", %%"REG_a", 2), %%"REG_d" \n\t"
- ASMALIGN(4)
- "1: \n\t"
- PREFETCH" 64(%0, %%"REG_d") \n\t"
- "movd (%0, %%"REG_d"), %%mm0 \n\t"
- "movd 3(%0, %%"REG_d"), %%mm1 \n\t"
- "punpcklbw %%mm7, %%mm0 \n\t"
- "punpcklbw %%mm7, %%mm1 \n\t"
- "movd 6(%0, %%"REG_d"), %%mm2 \n\t"
- "movd 9(%0, %%"REG_d"), %%mm3 \n\t"
- "punpcklbw %%mm7, %%mm2 \n\t"
- "punpcklbw %%mm7, %%mm3 \n\t"
- "pmaddwd %%mm6, %%mm0 \n\t"
- "pmaddwd %%mm6, %%mm1 \n\t"
- "pmaddwd %%mm6, %%mm2 \n\t"
- "pmaddwd %%mm6, %%mm3 \n\t"
-#ifndef FAST_BGR2YV12
- "psrad $8, %%mm0 \n\t"
- "psrad $8, %%mm1 \n\t"
- "psrad $8, %%mm2 \n\t"
- "psrad $8, %%mm3 \n\t"
-#endif
- "packssdw %%mm1, %%mm0 \n\t"
- "packssdw %%mm3, %%mm2 \n\t"
- "pmaddwd %%mm5, %%mm0 \n\t"
- "pmaddwd %%mm5, %%mm2 \n\t"
- "packssdw %%mm2, %%mm0 \n\t"
- "psraw $7, %%mm0 \n\t"
-
- "movd 12(%0, %%"REG_d"), %%mm4 \n\t"
- "movd 15(%0, %%"REG_d"), %%mm1 \n\t"
- "punpcklbw %%mm7, %%mm4 \n\t"
- "punpcklbw %%mm7, %%mm1 \n\t"
- "movd 18(%0, %%"REG_d"), %%mm2 \n\t"
- "movd 21(%0, %%"REG_d"), %%mm3 \n\t"
- "punpcklbw %%mm7, %%mm2 \n\t"
- "punpcklbw %%mm7, %%mm3 \n\t"
- "pmaddwd %%mm6, %%mm4 \n\t"
- "pmaddwd %%mm6, %%mm1 \n\t"
- "pmaddwd %%mm6, %%mm2 \n\t"
- "pmaddwd %%mm6, %%mm3 \n\t"
-#ifndef FAST_BGR2YV12
- "psrad $8, %%mm4 \n\t"
- "psrad $8, %%mm1 \n\t"
- "psrad $8, %%mm2 \n\t"
- "psrad $8, %%mm3 \n\t"
-#endif
- "packssdw %%mm1, %%mm4 \n\t"
- "packssdw %%mm3, %%mm2 \n\t"
- "pmaddwd %%mm5, %%mm4 \n\t"
- "pmaddwd %%mm5, %%mm2 \n\t"
- "add $24, %%"REG_d" \n\t"
- "packssdw %%mm2, %%mm4 \n\t"
- "psraw $7, %%mm4 \n\t"
-
- "packuswb %%mm4, %%mm0 \n\t"
- "paddusb "MANGLE(ff_bgr2YOffset)", %%mm0 \n\t"
-
- MOVNTQ" %%mm0, (%1, %%"REG_a") \n\t"
- "add $8, %%"REG_a" \n\t"
- " js 1b \n\t"
- : : "r" (src+width*3), "r" (ydst+width), "g" ((x86_reg)-width)
- : "%"REG_a, "%"REG_d
- );
- ydst += lumStride;
- src += srcStride;
- }
- src -= srcStride*2;
- __asm__ volatile(
- "mov %4, %%"REG_a" \n\t"
- "movq "MANGLE(ff_w1111)", %%mm5 \n\t"
- "movq "MANGLE(ff_bgr2UCoeff)", %%mm6 \n\t"
- "pxor %%mm7, %%mm7 \n\t"
- "lea (%%"REG_a", %%"REG_a", 2), %%"REG_d" \n\t"
- "add %%"REG_d", %%"REG_d" \n\t"
- ASMALIGN(4)
- "1: \n\t"
- PREFETCH" 64(%0, %%"REG_d") \n\t"
- PREFETCH" 64(%1, %%"REG_d") \n\t"
-#if HAVE_MMX2 || HAVE_AMD3DNOW
- "movq (%0, %%"REG_d"), %%mm0 \n\t"
- "movq (%1, %%"REG_d"), %%mm1 \n\t"
- "movq 6(%0, %%"REG_d"), %%mm2 \n\t"
- "movq 6(%1, %%"REG_d"), %%mm3 \n\t"
- PAVGB" %%mm1, %%mm0 \n\t"
- PAVGB" %%mm3, %%mm2 \n\t"
- "movq %%mm0, %%mm1 \n\t"
- "movq %%mm2, %%mm3 \n\t"
- "psrlq $24, %%mm0 \n\t"
- "psrlq $24, %%mm2 \n\t"
- PAVGB" %%mm1, %%mm0 \n\t"
- PAVGB" %%mm3, %%mm2 \n\t"
- "punpcklbw %%mm7, %%mm0 \n\t"
- "punpcklbw %%mm7, %%mm2 \n\t"
-#else
- "movd (%0, %%"REG_d"), %%mm0 \n\t"
- "movd (%1, %%"REG_d"), %%mm1 \n\t"
- "movd 3(%0, %%"REG_d"), %%mm2 \n\t"
- "movd 3(%1, %%"REG_d"), %%mm3 \n\t"
- "punpcklbw %%mm7, %%mm0 \n\t"
- "punpcklbw %%mm7, %%mm1 \n\t"
- "punpcklbw %%mm7, %%mm2 \n\t"
- "punpcklbw %%mm7, %%mm3 \n\t"
- "paddw %%mm1, %%mm0 \n\t"
- "paddw %%mm3, %%mm2 \n\t"
- "paddw %%mm2, %%mm0 \n\t"
- "movd 6(%0, %%"REG_d"), %%mm4 \n\t"
- "movd 6(%1, %%"REG_d"), %%mm1 \n\t"
- "movd 9(%0, %%"REG_d"), %%mm2 \n\t"
- "movd 9(%1, %%"REG_d"), %%mm3 \n\t"
- "punpcklbw %%mm7, %%mm4 \n\t"
- "punpcklbw %%mm7, %%mm1 \n\t"
- "punpcklbw %%mm7, %%mm2 \n\t"
- "punpcklbw %%mm7, %%mm3 \n\t"
- "paddw %%mm1, %%mm4 \n\t"
- "paddw %%mm3, %%mm2 \n\t"
- "paddw %%mm4, %%mm2 \n\t"
- "psrlw $2, %%mm0 \n\t"
- "psrlw $2, %%mm2 \n\t"
-#endif
- "movq "MANGLE(ff_bgr2VCoeff)", %%mm1 \n\t"
- "movq "MANGLE(ff_bgr2VCoeff)", %%mm3 \n\t"
-
- "pmaddwd %%mm0, %%mm1 \n\t"
- "pmaddwd %%mm2, %%mm3 \n\t"
- "pmaddwd %%mm6, %%mm0 \n\t"
- "pmaddwd %%mm6, %%mm2 \n\t"
-#ifndef FAST_BGR2YV12
- "psrad $8, %%mm0 \n\t"
- "psrad $8, %%mm1 \n\t"
- "psrad $8, %%mm2 \n\t"
- "psrad $8, %%mm3 \n\t"
-#endif
- "packssdw %%mm2, %%mm0 \n\t"
- "packssdw %%mm3, %%mm1 \n\t"
- "pmaddwd %%mm5, %%mm0 \n\t"
- "pmaddwd %%mm5, %%mm1 \n\t"
- "packssdw %%mm1, %%mm0 \n\t" // V1 V0 U1 U0
- "psraw $7, %%mm0 \n\t"
-
-#if HAVE_MMX2 || HAVE_AMD3DNOW
- "movq 12(%0, %%"REG_d"), %%mm4 \n\t"
- "movq 12(%1, %%"REG_d"), %%mm1 \n\t"
- "movq 18(%0, %%"REG_d"), %%mm2 \n\t"
- "movq 18(%1, %%"REG_d"), %%mm3 \n\t"
- PAVGB" %%mm1, %%mm4 \n\t"
- PAVGB" %%mm3, %%mm2 \n\t"
- "movq %%mm4, %%mm1 \n\t"
- "movq %%mm2, %%mm3 \n\t"
- "psrlq $24, %%mm4 \n\t"
- "psrlq $24, %%mm2 \n\t"
- PAVGB" %%mm1, %%mm4 \n\t"
- PAVGB" %%mm3, %%mm2 \n\t"
- "punpcklbw %%mm7, %%mm4 \n\t"
- "punpcklbw %%mm7, %%mm2 \n\t"
-#else
- "movd 12(%0, %%"REG_d"), %%mm4 \n\t"
- "movd 12(%1, %%"REG_d"), %%mm1 \n\t"
- "movd 15(%0, %%"REG_d"), %%mm2 \n\t"
- "movd 15(%1, %%"REG_d"), %%mm3 \n\t"
- "punpcklbw %%mm7, %%mm4 \n\t"
- "punpcklbw %%mm7, %%mm1 \n\t"
- "punpcklbw %%mm7, %%mm2 \n\t"
- "punpcklbw %%mm7, %%mm3 \n\t"
- "paddw %%mm1, %%mm4 \n\t"
- "paddw %%mm3, %%mm2 \n\t"
- "paddw %%mm2, %%mm4 \n\t"
- "movd 18(%0, %%"REG_d"), %%mm5 \n\t"
- "movd 18(%1, %%"REG_d"), %%mm1 \n\t"
- "movd 21(%0, %%"REG_d"), %%mm2 \n\t"
- "movd 21(%1, %%"REG_d"), %%mm3 \n\t"
- "punpcklbw %%mm7, %%mm5 \n\t"
- "punpcklbw %%mm7, %%mm1 \n\t"
- "punpcklbw %%mm7, %%mm2 \n\t"
- "punpcklbw %%mm7, %%mm3 \n\t"
- "paddw %%mm1, %%mm5 \n\t"
- "paddw %%mm3, %%mm2 \n\t"
- "paddw %%mm5, %%mm2 \n\t"
- "movq "MANGLE(ff_w1111)", %%mm5 \n\t"
- "psrlw $2, %%mm4 \n\t"
- "psrlw $2, %%mm2 \n\t"
-#endif
- "movq "MANGLE(ff_bgr2VCoeff)", %%mm1 \n\t"
- "movq "MANGLE(ff_bgr2VCoeff)", %%mm3 \n\t"
-
- "pmaddwd %%mm4, %%mm1 \n\t"
- "pmaddwd %%mm2, %%mm3 \n\t"
- "pmaddwd %%mm6, %%mm4 \n\t"
- "pmaddwd %%mm6, %%mm2 \n\t"
-#ifndef FAST_BGR2YV12
- "psrad $8, %%mm4 \n\t"
- "psrad $8, %%mm1 \n\t"
- "psrad $8, %%mm2 \n\t"
- "psrad $8, %%mm3 \n\t"
-#endif
- "packssdw %%mm2, %%mm4 \n\t"
- "packssdw %%mm3, %%mm1 \n\t"
- "pmaddwd %%mm5, %%mm4 \n\t"
- "pmaddwd %%mm5, %%mm1 \n\t"
- "add $24, %%"REG_d" \n\t"
- "packssdw %%mm1, %%mm4 \n\t" // V3 V2 U3 U2
- "psraw $7, %%mm4 \n\t"
-
- "movq %%mm0, %%mm1 \n\t"
- "punpckldq %%mm4, %%mm0 \n\t"
- "punpckhdq %%mm4, %%mm1 \n\t"
- "packsswb %%mm1, %%mm0 \n\t"
- "paddb "MANGLE(ff_bgr2UVOffset)", %%mm0 \n\t"
- "movd %%mm0, (%2, %%"REG_a") \n\t"
- "punpckhdq %%mm0, %%mm0 \n\t"
- "movd %%mm0, (%3, %%"REG_a") \n\t"
- "add $4, %%"REG_a" \n\t"
- " js 1b \n\t"
- : : "r" (src+chromWidth*6), "r" (src+srcStride+chromWidth*6), "r" (udst+chromWidth), "r" (vdst+chromWidth), "g" (-chromWidth)
- : "%"REG_a, "%"REG_d
- );
-
- udst += chromStride;
- vdst += chromStride;
- src += srcStride*2;
- }
-
- __asm__ volatile(EMMS" \n\t"
- SFENCE" \n\t"
- :::"memory");
-#else
- y=0;
-#endif
- for (; y<height; y+=2) {
- long i;
- for (i=0; i<chromWidth; i++) {
- unsigned int b = src[6*i+0];
- unsigned int g = src[6*i+1];
- unsigned int r = src[6*i+2];
-
- unsigned int Y = ((RY*r + GY*g + BY*b)>>RGB2YUV_SHIFT) + 16;
- unsigned int V = ((RV*r + GV*g + BV*b)>>RGB2YUV_SHIFT) + 128;
- unsigned int U = ((RU*r + GU*g + BU*b)>>RGB2YUV_SHIFT) + 128;
-
- udst[i] = U;
- vdst[i] = V;
- ydst[2*i] = Y;
-
- b = src[6*i+3];
- g = src[6*i+4];
- r = src[6*i+5];
-
- Y = ((RY*r + GY*g + BY*b)>>RGB2YUV_SHIFT) + 16;
- ydst[2*i+1] = Y;
- }
- ydst += lumStride;
- src += srcStride;
-
- for (i=0; i<chromWidth; i++) {
- unsigned int b = src[6*i+0];
- unsigned int g = src[6*i+1];
- unsigned int r = src[6*i+2];
-
- unsigned int Y = ((RY*r + GY*g + BY*b)>>RGB2YUV_SHIFT) + 16;
-
- ydst[2*i] = Y;
-
- b = src[6*i+3];
- g = src[6*i+4];
- r = src[6*i+5];
-
- Y = ((RY*r + GY*g + BY*b)>>RGB2YUV_SHIFT) + 16;
- ydst[2*i+1] = Y;
- }
- udst += chromStride;
- vdst += chromStride;
- ydst += lumStride;
- src += srcStride;
- }
-}
-
-static void RENAME(interleaveBytes)(const uint8_t *src1, const uint8_t *src2, uint8_t *dest,
- long width, long height, long src1Stride,
- long src2Stride, long dstStride)
-{
- long h;
-
- for (h=0; h < height; h++) {
- long w;
-
-#if HAVE_MMX
-#if HAVE_SSE2
- __asm__(
- "xor %%"REG_a", %%"REG_a" \n\t"
- "1: \n\t"
- PREFETCH" 64(%1, %%"REG_a") \n\t"
- PREFETCH" 64(%2, %%"REG_a") \n\t"
- "movdqa (%1, %%"REG_a"), %%xmm0 \n\t"
- "movdqa (%1, %%"REG_a"), %%xmm1 \n\t"
- "movdqa (%2, %%"REG_a"), %%xmm2 \n\t"
- "punpcklbw %%xmm2, %%xmm0 \n\t"
- "punpckhbw %%xmm2, %%xmm1 \n\t"
- "movntdq %%xmm0, (%0, %%"REG_a", 2) \n\t"
- "movntdq %%xmm1, 16(%0, %%"REG_a", 2) \n\t"
- "add $16, %%"REG_a" \n\t"
- "cmp %3, %%"REG_a" \n\t"
- " jb 1b \n\t"
- ::"r"(dest), "r"(src1), "r"(src2), "r" ((x86_reg)width-15)
- : "memory", "%"REG_a""
- );
-#else
- __asm__(
- "xor %%"REG_a", %%"REG_a" \n\t"
- "1: \n\t"
- PREFETCH" 64(%1, %%"REG_a") \n\t"
- PREFETCH" 64(%2, %%"REG_a") \n\t"
- "movq (%1, %%"REG_a"), %%mm0 \n\t"
- "movq 8(%1, %%"REG_a"), %%mm2 \n\t"
- "movq %%mm0, %%mm1 \n\t"
- "movq %%mm2, %%mm3 \n\t"
- "movq (%2, %%"REG_a"), %%mm4 \n\t"
- "movq 8(%2, %%"REG_a"), %%mm5 \n\t"
- "punpcklbw %%mm4, %%mm0 \n\t"
- "punpckhbw %%mm4, %%mm1 \n\t"
- "punpcklbw %%mm5, %%mm2 \n\t"
- "punpckhbw %%mm5, %%mm3 \n\t"
- MOVNTQ" %%mm0, (%0, %%"REG_a", 2) \n\t"
- MOVNTQ" %%mm1, 8(%0, %%"REG_a", 2) \n\t"
- MOVNTQ" %%mm2, 16(%0, %%"REG_a", 2) \n\t"
- MOVNTQ" %%mm3, 24(%0, %%"REG_a", 2) \n\t"
- "add $16, %%"REG_a" \n\t"
- "cmp %3, %%"REG_a" \n\t"
- " jb 1b \n\t"
- ::"r"(dest), "r"(src1), "r"(src2), "r" ((x86_reg)width-15)
- : "memory", "%"REG_a
- );
-#endif
- for (w= (width&(~15)); w < width; w++) {
- dest[2*w+0] = src1[w];
- dest[2*w+1] = src2[w];
- }
-#else
- for (w=0; w < width; w++) {
- dest[2*w+0] = src1[w];
- dest[2*w+1] = src2[w];
- }
-#endif
- dest += dstStride;
- src1 += src1Stride;
- src2 += src2Stride;
- }
-#if HAVE_MMX
- __asm__(
- EMMS" \n\t"
- SFENCE" \n\t"
- ::: "memory"
- );
-#endif
-}
-
-static inline void RENAME(vu9_to_vu12)(const uint8_t *src1, const uint8_t *src2,
- uint8_t *dst1, uint8_t *dst2,
- long width, long height,
- long srcStride1, long srcStride2,
- long dstStride1, long dstStride2)
-{
- x86_reg y;
- long x,w,h;
- w=width/2; h=height/2;
-#if HAVE_MMX
- __asm__ volatile(
- PREFETCH" %0 \n\t"
- PREFETCH" %1 \n\t"
- ::"m"(*(src1+srcStride1)),"m"(*(src2+srcStride2)):"memory");
-#endif
- for (y=0;y<h;y++) {
- const uint8_t* s1=src1+srcStride1*(y>>1);
- uint8_t* d=dst1+dstStride1*y;
- x=0;
-#if HAVE_MMX
- for (;x<w-31;x+=32) {
- __asm__ volatile(
- PREFETCH" 32%1 \n\t"
- "movq %1, %%mm0 \n\t"
- "movq 8%1, %%mm2 \n\t"
- "movq 16%1, %%mm4 \n\t"
- "movq 24%1, %%mm6 \n\t"
- "movq %%mm0, %%mm1 \n\t"
- "movq %%mm2, %%mm3 \n\t"
- "movq %%mm4, %%mm5 \n\t"
- "movq %%mm6, %%mm7 \n\t"
- "punpcklbw %%mm0, %%mm0 \n\t"
- "punpckhbw %%mm1, %%mm1 \n\t"
- "punpcklbw %%mm2, %%mm2 \n\t"
- "punpckhbw %%mm3, %%mm3 \n\t"
- "punpcklbw %%mm4, %%mm4 \n\t"
- "punpckhbw %%mm5, %%mm5 \n\t"
- "punpcklbw %%mm6, %%mm6 \n\t"
- "punpckhbw %%mm7, %%mm7 \n\t"
- MOVNTQ" %%mm0, %0 \n\t"
- MOVNTQ" %%mm1, 8%0 \n\t"
- MOVNTQ" %%mm2, 16%0 \n\t"
- MOVNTQ" %%mm3, 24%0 \n\t"
- MOVNTQ" %%mm4, 32%0 \n\t"
- MOVNTQ" %%mm5, 40%0 \n\t"
- MOVNTQ" %%mm6, 48%0 \n\t"
- MOVNTQ" %%mm7, 56%0"
- :"=m"(d[2*x])
- :"m"(s1[x])
- :"memory");
- }
-#endif
- for (;x<w;x++) d[2*x]=d[2*x+1]=s1[x];
- }
- for (y=0;y<h;y++) {
- const uint8_t* s2=src2+srcStride2*(y>>1);
- uint8_t* d=dst2+dstStride2*y;
- x=0;
-#if HAVE_MMX
- for (;x<w-31;x+=32) {
- __asm__ volatile(
- PREFETCH" 32%1 \n\t"
- "movq %1, %%mm0 \n\t"
- "movq 8%1, %%mm2 \n\t"
- "movq 16%1, %%mm4 \n\t"
- "movq 24%1, %%mm6 \n\t"
- "movq %%mm0, %%mm1 \n\t"
- "movq %%mm2, %%mm3 \n\t"
- "movq %%mm4, %%mm5 \n\t"
- "movq %%mm6, %%mm7 \n\t"
- "punpcklbw %%mm0, %%mm0 \n\t"
- "punpckhbw %%mm1, %%mm1 \n\t"
- "punpcklbw %%mm2, %%mm2 \n\t"
- "punpckhbw %%mm3, %%mm3 \n\t"
- "punpcklbw %%mm4, %%mm4 \n\t"
- "punpckhbw %%mm5, %%mm5 \n\t"
- "punpcklbw %%mm6, %%mm6 \n\t"
- "punpckhbw %%mm7, %%mm7 \n\t"
- MOVNTQ" %%mm0, %0 \n\t"
- MOVNTQ" %%mm1, 8%0 \n\t"
- MOVNTQ" %%mm2, 16%0 \n\t"
- MOVNTQ" %%mm3, 24%0 \n\t"
- MOVNTQ" %%mm4, 32%0 \n\t"
- MOVNTQ" %%mm5, 40%0 \n\t"
- MOVNTQ" %%mm6, 48%0 \n\t"
- MOVNTQ" %%mm7, 56%0"
- :"=m"(d[2*x])
- :"m"(s2[x])
- :"memory");
- }
-#endif
- for (;x<w;x++) d[2*x]=d[2*x+1]=s2[x];
- }
-#if HAVE_MMX
- __asm__(
- EMMS" \n\t"
- SFENCE" \n\t"
- ::: "memory"
- );
-#endif
-}
-
-static inline void RENAME(yvu9_to_yuy2)(const uint8_t *src1, const uint8_t *src2, const uint8_t *src3,
- uint8_t *dst,
- long width, long height,
- long srcStride1, long srcStride2,
- long srcStride3, long dstStride)
-{
- x86_reg x;
- long y,w,h;
- w=width/2; h=height;
- for (y=0;y<h;y++) {
- const uint8_t* yp=src1+srcStride1*y;
- const uint8_t* up=src2+srcStride2*(y>>2);
- const uint8_t* vp=src3+srcStride3*(y>>2);
- uint8_t* d=dst+dstStride*y;
- x=0;
-#if HAVE_MMX
- for (;x<w-7;x+=8) {
- __asm__ volatile(
- PREFETCH" 32(%1, %0) \n\t"
- PREFETCH" 32(%2, %0) \n\t"
- PREFETCH" 32(%3, %0) \n\t"
- "movq (%1, %0, 4), %%mm0 \n\t" /* Y0Y1Y2Y3Y4Y5Y6Y7 */
- "movq (%2, %0), %%mm1 \n\t" /* U0U1U2U3U4U5U6U7 */
- "movq (%3, %0), %%mm2 \n\t" /* V0V1V2V3V4V5V6V7 */
- "movq %%mm0, %%mm3 \n\t" /* Y0Y1Y2Y3Y4Y5Y6Y7 */
- "movq %%mm1, %%mm4 \n\t" /* U0U1U2U3U4U5U6U7 */
- "movq %%mm2, %%mm5 \n\t" /* V0V1V2V3V4V5V6V7 */
- "punpcklbw %%mm1, %%mm1 \n\t" /* U0U0 U1U1 U2U2 U3U3 */
- "punpcklbw %%mm2, %%mm2 \n\t" /* V0V0 V1V1 V2V2 V3V3 */
- "punpckhbw %%mm4, %%mm4 \n\t" /* U4U4 U5U5 U6U6 U7U7 */
- "punpckhbw %%mm5, %%mm5 \n\t" /* V4V4 V5V5 V6V6 V7V7 */
-
- "movq %%mm1, %%mm6 \n\t"
- "punpcklbw %%mm2, %%mm1 \n\t" /* U0V0 U0V0 U1V1 U1V1*/
- "punpcklbw %%mm1, %%mm0 \n\t" /* Y0U0 Y1V0 Y2U0 Y3V0*/
- "punpckhbw %%mm1, %%mm3 \n\t" /* Y4U1 Y5V1 Y6U1 Y7V1*/
- MOVNTQ" %%mm0, (%4, %0, 8) \n\t"
- MOVNTQ" %%mm3, 8(%4, %0, 8) \n\t"
-
- "punpckhbw %%mm2, %%mm6 \n\t" /* U2V2 U2V2 U3V3 U3V3*/
- "movq 8(%1, %0, 4), %%mm0 \n\t"
- "movq %%mm0, %%mm3 \n\t"
- "punpcklbw %%mm6, %%mm0 \n\t" /* Y U2 Y V2 Y U2 Y V2*/
- "punpckhbw %%mm6, %%mm3 \n\t" /* Y U3 Y V3 Y U3 Y V3*/
- MOVNTQ" %%mm0, 16(%4, %0, 8) \n\t"
- MOVNTQ" %%mm3, 24(%4, %0, 8) \n\t"
-
- "movq %%mm4, %%mm6 \n\t"
- "movq 16(%1, %0, 4), %%mm0 \n\t"
- "movq %%mm0, %%mm3 \n\t"
- "punpcklbw %%mm5, %%mm4 \n\t"
- "punpcklbw %%mm4, %%mm0 \n\t" /* Y U4 Y V4 Y U4 Y V4*/
- "punpckhbw %%mm4, %%mm3 \n\t" /* Y U5 Y V5 Y U5 Y V5*/
- MOVNTQ" %%mm0, 32(%4, %0, 8) \n\t"
- MOVNTQ" %%mm3, 40(%4, %0, 8) \n\t"
-
- "punpckhbw %%mm5, %%mm6 \n\t"
- "movq 24(%1, %0, 4), %%mm0 \n\t"
- "movq %%mm0, %%mm3 \n\t"
- "punpcklbw %%mm6, %%mm0 \n\t" /* Y U6 Y V6 Y U6 Y V6*/
- "punpckhbw %%mm6, %%mm3 \n\t" /* Y U7 Y V7 Y U7 Y V7*/
- MOVNTQ" %%mm0, 48(%4, %0, 8) \n\t"
- MOVNTQ" %%mm3, 56(%4, %0, 8) \n\t"
-
- : "+r" (x)
- : "r"(yp), "r" (up), "r"(vp), "r"(d)
- :"memory");
- }
-#endif
- for (; x<w; x++) {
- const long x2 = x<<2;
- d[8*x+0] = yp[x2];
- d[8*x+1] = up[x];
- d[8*x+2] = yp[x2+1];
- d[8*x+3] = vp[x];
- d[8*x+4] = yp[x2+2];
- d[8*x+5] = up[x];
- d[8*x+6] = yp[x2+3];
- d[8*x+7] = vp[x];
- }
- }
-#if HAVE_MMX
- __asm__(
- EMMS" \n\t"
- SFENCE" \n\t"
- ::: "memory"
- );
-#endif
-}
-
-static void RENAME(extract_even)(const uint8_t *src, uint8_t *dst, x86_reg count)
-{
- dst += count;
- src += 2*count;
- count= - count;
-
-#if HAVE_MMX
- if(count <= -16) {
- count += 15;
- __asm__ volatile(
- "pcmpeqw %%mm7, %%mm7 \n\t"
- "psrlw $8, %%mm7 \n\t"
- "1: \n\t"
- "movq -30(%1, %0, 2), %%mm0 \n\t"
- "movq -22(%1, %0, 2), %%mm1 \n\t"
- "movq -14(%1, %0, 2), %%mm2 \n\t"
- "movq -6(%1, %0, 2), %%mm3 \n\t"
- "pand %%mm7, %%mm0 \n\t"
- "pand %%mm7, %%mm1 \n\t"
- "pand %%mm7, %%mm2 \n\t"
- "pand %%mm7, %%mm3 \n\t"
- "packuswb %%mm1, %%mm0 \n\t"
- "packuswb %%mm3, %%mm2 \n\t"
- MOVNTQ" %%mm0,-15(%2, %0) \n\t"
- MOVNTQ" %%mm2,- 7(%2, %0) \n\t"
- "add $16, %0 \n\t"
- " js 1b \n\t"
- : "+r"(count)
- : "r"(src), "r"(dst)
- );
- count -= 15;
- }
-#endif
- while(count<0) {
- dst[count]= src[2*count];
- count++;
- }
-}
-
-static void RENAME(extract_even2)(const uint8_t *src, uint8_t *dst0, uint8_t *dst1, x86_reg count)
-{
- dst0+= count;
- dst1+= count;
- src += 4*count;
- count= - count;
-#if HAVE_MMX
- if(count <= -8) {
- count += 7;
- __asm__ volatile(
- "pcmpeqw %%mm7, %%mm7 \n\t"
- "psrlw $8, %%mm7 \n\t"
- "1: \n\t"
- "movq -28(%1, %0, 4), %%mm0 \n\t"
- "movq -20(%1, %0, 4), %%mm1 \n\t"
- "movq -12(%1, %0, 4), %%mm2 \n\t"
- "movq -4(%1, %0, 4), %%mm3 \n\t"
- "pand %%mm7, %%mm0 \n\t"
- "pand %%mm7, %%mm1 \n\t"
- "pand %%mm7, %%mm2 \n\t"
- "pand %%mm7, %%mm3 \n\t"
- "packuswb %%mm1, %%mm0 \n\t"
- "packuswb %%mm3, %%mm2 \n\t"
- "movq %%mm0, %%mm1 \n\t"
- "movq %%mm2, %%mm3 \n\t"
- "psrlw $8, %%mm0 \n\t"
- "psrlw $8, %%mm2 \n\t"
- "pand %%mm7, %%mm1 \n\t"
- "pand %%mm7, %%mm3 \n\t"
- "packuswb %%mm2, %%mm0 \n\t"
- "packuswb %%mm3, %%mm1 \n\t"
- MOVNTQ" %%mm0,- 7(%3, %0) \n\t"
- MOVNTQ" %%mm1,- 7(%2, %0) \n\t"
- "add $8, %0 \n\t"
- " js 1b \n\t"
- : "+r"(count)
- : "r"(src), "r"(dst0), "r"(dst1)
- );
- count -= 7;
- }
-#endif
- while(count<0) {
- dst0[count]= src[4*count+0];
- dst1[count]= src[4*count+2];
- count++;
- }
-}
-
-static void RENAME(extract_even2avg)(const uint8_t *src0, const uint8_t *src1, uint8_t *dst0, uint8_t *dst1, x86_reg count)
-{
- dst0 += count;
- dst1 += count;
- src0 += 4*count;
- src1 += 4*count;
- count= - count;
-#ifdef PAVGB
- if(count <= -8) {
- count += 7;
- __asm__ volatile(
- "pcmpeqw %%mm7, %%mm7 \n\t"
- "psrlw $8, %%mm7 \n\t"
- "1: \n\t"
- "movq -28(%1, %0, 4), %%mm0 \n\t"
- "movq -20(%1, %0, 4), %%mm1 \n\t"
- "movq -12(%1, %0, 4), %%mm2 \n\t"
- "movq -4(%1, %0, 4), %%mm3 \n\t"
- PAVGB" -28(%2, %0, 4), %%mm0 \n\t"
- PAVGB" -20(%2, %0, 4), %%mm1 \n\t"
- PAVGB" -12(%2, %0, 4), %%mm2 \n\t"
- PAVGB" - 4(%2, %0, 4), %%mm3 \n\t"
- "pand %%mm7, %%mm0 \n\t"
- "pand %%mm7, %%mm1 \n\t"
- "pand %%mm7, %%mm2 \n\t"
- "pand %%mm7, %%mm3 \n\t"
- "packuswb %%mm1, %%mm0 \n\t"
- "packuswb %%mm3, %%mm2 \n\t"
- "movq %%mm0, %%mm1 \n\t"
- "movq %%mm2, %%mm3 \n\t"
- "psrlw $8, %%mm0 \n\t"
- "psrlw $8, %%mm2 \n\t"
- "pand %%mm7, %%mm1 \n\t"
- "pand %%mm7, %%mm3 \n\t"
- "packuswb %%mm2, %%mm0 \n\t"
- "packuswb %%mm3, %%mm1 \n\t"
- MOVNTQ" %%mm0,- 7(%4, %0) \n\t"
- MOVNTQ" %%mm1,- 7(%3, %0) \n\t"
- "add $8, %0 \n\t"
- " js 1b \n\t"
- : "+r"(count)
- : "r"(src0), "r"(src1), "r"(dst0), "r"(dst1)
- );
- count -= 7;
- }
-#endif
- while(count<0) {
- dst0[count]= (src0[4*count+0]+src1[4*count+0])>>1;
- dst1[count]= (src0[4*count+2]+src1[4*count+2])>>1;
- count++;
- }
-}
-
-static void RENAME(extract_odd2)(const uint8_t *src, uint8_t *dst0, uint8_t *dst1, x86_reg count)
-{
- dst0+= count;
- dst1+= count;
- src += 4*count;
- count= - count;
-#if HAVE_MMX
- if(count <= -8) {
- count += 7;
- __asm__ volatile(
- "pcmpeqw %%mm7, %%mm7 \n\t"
- "psrlw $8, %%mm7 \n\t"
- "1: \n\t"
- "movq -28(%1, %0, 4), %%mm0 \n\t"
- "movq -20(%1, %0, 4), %%mm1 \n\t"
- "movq -12(%1, %0, 4), %%mm2 \n\t"
- "movq -4(%1, %0, 4), %%mm3 \n\t"
- "psrlw $8, %%mm0 \n\t"
- "psrlw $8, %%mm1 \n\t"
- "psrlw $8, %%mm2 \n\t"
- "psrlw $8, %%mm3 \n\t"
- "packuswb %%mm1, %%mm0 \n\t"
- "packuswb %%mm3, %%mm2 \n\t"
- "movq %%mm0, %%mm1 \n\t"
- "movq %%mm2, %%mm3 \n\t"
- "psrlw $8, %%mm0 \n\t"
- "psrlw $8, %%mm2 \n\t"
- "pand %%mm7, %%mm1 \n\t"
- "pand %%mm7, %%mm3 \n\t"
- "packuswb %%mm2, %%mm0 \n\t"
- "packuswb %%mm3, %%mm1 \n\t"
- MOVNTQ" %%mm0,- 7(%3, %0) \n\t"
- MOVNTQ" %%mm1,- 7(%2, %0) \n\t"
- "add $8, %0 \n\t"
- " js 1b \n\t"
- : "+r"(count)
- : "r"(src), "r"(dst0), "r"(dst1)
- );
- count -= 7;
- }
-#endif
- src++;
- while(count<0) {
- dst0[count]= src[4*count+0];
- dst1[count]= src[4*count+2];
- count++;
- }
-}
-
-static void RENAME(extract_odd2avg)(const uint8_t *src0, const uint8_t *src1, uint8_t *dst0, uint8_t *dst1, x86_reg count)
-{
- dst0 += count;
- dst1 += count;
- src0 += 4*count;
- src1 += 4*count;
- count= - count;
-#ifdef PAVGB
- if(count <= -8) {
- count += 7;
- __asm__ volatile(
- "pcmpeqw %%mm7, %%mm7 \n\t"
- "psrlw $8, %%mm7 \n\t"
- "1: \n\t"
- "movq -28(%1, %0, 4), %%mm0 \n\t"
- "movq -20(%1, %0, 4), %%mm1 \n\t"
- "movq -12(%1, %0, 4), %%mm2 \n\t"
- "movq -4(%1, %0, 4), %%mm3 \n\t"
- PAVGB" -28(%2, %0, 4), %%mm0 \n\t"
- PAVGB" -20(%2, %0, 4), %%mm1 \n\t"
- PAVGB" -12(%2, %0, 4), %%mm2 \n\t"
- PAVGB" - 4(%2, %0, 4), %%mm3 \n\t"
- "psrlw $8, %%mm0 \n\t"
- "psrlw $8, %%mm1 \n\t"
- "psrlw $8, %%mm2 \n\t"
- "psrlw $8, %%mm3 \n\t"
- "packuswb %%mm1, %%mm0 \n\t"
- "packuswb %%mm3, %%mm2 \n\t"
- "movq %%mm0, %%mm1 \n\t"
- "movq %%mm2, %%mm3 \n\t"
- "psrlw $8, %%mm0 \n\t"
- "psrlw $8, %%mm2 \n\t"
- "pand %%mm7, %%mm1 \n\t"
- "pand %%mm7, %%mm3 \n\t"
- "packuswb %%mm2, %%mm0 \n\t"
- "packuswb %%mm3, %%mm1 \n\t"
- MOVNTQ" %%mm0,- 7(%4, %0) \n\t"
- MOVNTQ" %%mm1,- 7(%3, %0) \n\t"
- "add $8, %0 \n\t"
- " js 1b \n\t"
- : "+r"(count)
- : "r"(src0), "r"(src1), "r"(dst0), "r"(dst1)
- );
- count -= 7;
- }
-#endif
- src0++;
- src1++;
- while(count<0) {
- dst0[count]= (src0[4*count+0]+src1[4*count+0])>>1;
- dst1[count]= (src0[4*count+2]+src1[4*count+2])>>1;
- count++;
- }
-}
-
-static void RENAME(yuyvtoyuv420)(uint8_t *ydst, uint8_t *udst, uint8_t *vdst, const uint8_t *src,
- long width, long height,
- long lumStride, long chromStride, long srcStride)
-{
- long y;
- const long chromWidth= -((-width)>>1);
-
- for (y=0; y<height; y++) {
- RENAME(extract_even)(src, ydst, width);
- if(y&1) {
- RENAME(extract_odd2avg)(src-srcStride, src, udst, vdst, chromWidth);
- udst+= chromStride;
- vdst+= chromStride;
- }
-
- src += srcStride;
- ydst+= lumStride;
- }
-#if HAVE_MMX
- __asm__(
- EMMS" \n\t"
- SFENCE" \n\t"
- ::: "memory"
- );
-#endif
-}
-
-static void RENAME(yuyvtoyuv422)(uint8_t *ydst, uint8_t *udst, uint8_t *vdst, const uint8_t *src,
- long width, long height,
- long lumStride, long chromStride, long srcStride)
-{
- long y;
- const long chromWidth= -((-width)>>1);
-
- for (y=0; y<height; y++) {
- RENAME(extract_even)(src, ydst, width);
- RENAME(extract_odd2)(src, udst, vdst, chromWidth);
-
- src += srcStride;
- ydst+= lumStride;
- udst+= chromStride;
- vdst+= chromStride;
- }
-#if HAVE_MMX
- __asm__(
- EMMS" \n\t"
- SFENCE" \n\t"
- ::: "memory"
- );
-#endif
-}
-
-static void RENAME(uyvytoyuv420)(uint8_t *ydst, uint8_t *udst, uint8_t *vdst, const uint8_t *src,
- long width, long height,
- long lumStride, long chromStride, long srcStride)
-{
- long y;
- const long chromWidth= -((-width)>>1);
-
- for (y=0; y<height; y++) {
- RENAME(extract_even)(src+1, ydst, width);
- if(y&1) {
- RENAME(extract_even2avg)(src-srcStride, src, udst, vdst, chromWidth);
- udst+= chromStride;
- vdst+= chromStride;
- }
-
- src += srcStride;
- ydst+= lumStride;
- }
-#if HAVE_MMX
- __asm__(
- EMMS" \n\t"
- SFENCE" \n\t"
- ::: "memory"
- );
-#endif
-}
-
-static void RENAME(uyvytoyuv422)(uint8_t *ydst, uint8_t *udst, uint8_t *vdst, const uint8_t *src,
- long width, long height,
- long lumStride, long chromStride, long srcStride)
-{
- long y;
- const long chromWidth= -((-width)>>1);
-
- for (y=0; y<height; y++) {
- RENAME(extract_even)(src+1, ydst, width);
- RENAME(extract_even2)(src, udst, vdst, chromWidth);
-
- src += srcStride;
- ydst+= lumStride;
- udst+= chromStride;
- vdst+= chromStride;
- }
-#if HAVE_MMX
- __asm__(
- EMMS" \n\t"
- SFENCE" \n\t"
- ::: "memory"
- );
-#endif
-}
-
-static inline void RENAME(rgb2rgb_init)(void)
-{
- rgb15to16 = RENAME(rgb15to16);
- rgb15tobgr24 = RENAME(rgb15tobgr24);
- rgb15to32 = RENAME(rgb15to32);
- rgb16tobgr24 = RENAME(rgb16tobgr24);
- rgb16to32 = RENAME(rgb16to32);
- rgb16to15 = RENAME(rgb16to15);
- rgb24tobgr16 = RENAME(rgb24tobgr16);
- rgb24tobgr15 = RENAME(rgb24tobgr15);
- rgb24tobgr32 = RENAME(rgb24tobgr32);
- rgb32to16 = RENAME(rgb32to16);
- rgb32to15 = RENAME(rgb32to15);
- rgb32tobgr24 = RENAME(rgb32tobgr24);
- rgb24to15 = RENAME(rgb24to15);
- rgb24to16 = RENAME(rgb24to16);
- rgb24tobgr24 = RENAME(rgb24tobgr24);
- rgb32tobgr32 = RENAME(rgb32tobgr32);
- rgb32tobgr16 = RENAME(rgb32tobgr16);
- rgb32tobgr15 = RENAME(rgb32tobgr15);
- yv12toyuy2 = RENAME(yv12toyuy2);
- yv12touyvy = RENAME(yv12touyvy);
- yuv422ptoyuy2 = RENAME(yuv422ptoyuy2);
- yuv422ptouyvy = RENAME(yuv422ptouyvy);
- yuy2toyv12 = RENAME(yuy2toyv12);
-// yvu9toyv12 = RENAME(yvu9toyv12);
- planar2x = RENAME(planar2x);
- rgb24toyv12 = RENAME(rgb24toyv12);
- interleaveBytes = RENAME(interleaveBytes);
- vu9_to_vu12 = RENAME(vu9_to_vu12);
- yvu9_to_yuy2 = RENAME(yvu9_to_yuy2);
-
- uyvytoyuv420 = RENAME(uyvytoyuv420);
- uyvytoyuv422 = RENAME(uyvytoyuv422);
- yuyvtoyuv420 = RENAME(yuyvtoyuv420);
- yuyvtoyuv422 = RENAME(yuyvtoyuv422);
-}
diff --git a/libswscale/sparc/yuv2rgb_vis.c b/libswscale/sparc/yuv2rgb_vis.c
deleted file mode 100644
index cc98f04053..0000000000
--- a/libswscale/sparc/yuv2rgb_vis.c
+++ /dev/null
@@ -1,212 +0,0 @@
-/*
- * VIS optimized software YUV to RGB converter
- * Copyright (c) 2007 Denes Balatoni <dbalatoni@programozo.hu>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * FFmpeg 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include <inttypes.h>
-#include <stdlib.h>
-
-#include "libswscale/swscale.h"
-#include "libswscale/swscale_internal.h"
-
-#define YUV2RGB_INIT \
- "wr %%g0, 0x10, %%gsr \n\t" \
- "ldd [%5], %%f32 \n\t" \
- "ldd [%5+8], %%f34 \n\t" \
- "ldd [%5+16], %%f36 \n\t" \
- "ldd [%5+24], %%f38 \n\t" \
- "ldd [%5+32], %%f40 \n\t" \
- "ldd [%5+40], %%f42 \n\t" \
- "ldd [%5+48], %%f44 \n\t" \
- "ldd [%5+56], %%f46 \n\t" \
- "ldd [%5+64], %%f48 \n\t" \
- "ldd [%5+72], %%f50 \n\t"
-
-#define YUV2RGB_KERNEL \
- /* ^^^^ f0=Y f3=u f5=v */ \
- "fmul8x16 %%f3, %%f48, %%f6 \n\t" \
- "fmul8x16 %%f19, %%f48, %%f22 \n\t" \
- "fmul8x16 %%f5, %%f44, %%f8 \n\t" \
- "fmul8x16 %%f21, %%f44, %%f24 \n\t" \
- "fmul8x16 %%f0, %%f42, %%f0 \n\t" \
- "fmul8x16 %%f16, %%f42, %%f16 \n\t" \
- "fmul8x16 %%f3, %%f50, %%f2 \n\t" \
- "fmul8x16 %%f19, %%f50, %%f18 \n\t" \
- "fmul8x16 %%f5, %%f46, %%f4 \n\t" \
- "fmul8x16 %%f21, %%f46, %%f20 \n\t" \
- \
- "fpsub16 %%f6, %%f34, %%f6 \n\t" /* 1 */ \
- "fpsub16 %%f22, %%f34, %%f22 \n\t" /* 1 */ \
- "fpsub16 %%f8, %%f38, %%f8 \n\t" /* 3 */ \
- "fpsub16 %%f24, %%f38, %%f24 \n\t" /* 3 */ \
- "fpsub16 %%f0, %%f32, %%f0 \n\t" /* 0 */ \
- "fpsub16 %%f16, %%f32, %%f16 \n\t" /* 0 */ \
- "fpsub16 %%f2, %%f36, %%f2 \n\t" /* 2 */ \
- "fpsub16 %%f18, %%f36, %%f18 \n\t" /* 2 */ \
- "fpsub16 %%f4, %%f40, %%f4 \n\t" /* 4 */ \
- "fpsub16 %%f20, %%f40, %%f20 \n\t" /* 4 */ \
- \
- "fpadd16 %%f0, %%f8, %%f8 \n\t" /* Gt */ \
- "fpadd16 %%f16, %%f24, %%f24 \n\t" /* Gt */ \
- "fpadd16 %%f0, %%f4, %%f4 \n\t" /* R */ \
- "fpadd16 %%f16, %%f20, %%f20 \n\t" /* R */ \
- "fpadd16 %%f0, %%f6, %%f6 \n\t" /* B */ \
- "fpadd16 %%f16, %%f22, %%f22 \n\t" /* B */ \
- "fpadd16 %%f8, %%f2, %%f2 \n\t" /* G */ \
- "fpadd16 %%f24, %%f18, %%f18 \n\t" /* G */ \
- \
- "fpack16 %%f4, %%f4 \n\t" \
- "fpack16 %%f20, %%f20 \n\t" \
- "fpack16 %%f6, %%f6 \n\t" \
- "fpack16 %%f22, %%f22 \n\t" \
- "fpack16 %%f2, %%f2 \n\t" \
- "fpack16 %%f18, %%f18 \n\t"
-
-
-
-// FIXME: must be changed to set alpha to 255 instead of 0
-static int vis_420P_ARGB32(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY,
- int srcSliceH, uint8_t* dst[], int dstStride[])
-{
- int y, out1, out2, out3, out4, out5, out6;
-
- for(y=0;y < srcSliceH;++y) {
- __asm__ volatile (
- YUV2RGB_INIT
- "wr %%g0, 0xd2, %%asi \n\t" /* ASI_FL16_P */
- "1: \n\t"
- "ldda [%1] %%asi, %%f2 \n\t"
- "ldda [%1+2] %%asi, %%f18 \n\t"
- "ldda [%2] %%asi, %%f4 \n\t"
- "ldda [%2+2] %%asi, %%f20 \n\t"
- "ld [%0], %%f0 \n\t"
- "ld [%0+4], %%f16 \n\t"
- "fpmerge %%f3, %%f3, %%f2 \n\t"
- "fpmerge %%f19, %%f19, %%f18 \n\t"
- "fpmerge %%f5, %%f5, %%f4 \n\t"
- "fpmerge %%f21, %%f21, %%f20 \n\t"
- YUV2RGB_KERNEL
- "fzero %%f0 \n\t"
- "fpmerge %%f4, %%f6, %%f8 \n\t" // r,b,t1
- "fpmerge %%f20, %%f22, %%f24 \n\t" // r,b,t1
- "fpmerge %%f0, %%f2, %%f10 \n\t" // 0,g,t2
- "fpmerge %%f0, %%f18, %%f26 \n\t" // 0,g,t2
- "fpmerge %%f10, %%f8, %%f4 \n\t" // t2,t1,msb
- "fpmerge %%f26, %%f24, %%f20 \n\t" // t2,t1,msb
- "fpmerge %%f11, %%f9, %%f6 \n\t" // t2,t1,lsb
- "fpmerge %%f27, %%f25, %%f22 \n\t" // t2,t1,lsb
- "std %%f4, [%3] \n\t"
- "std %%f20, [%3+16] \n\t"
- "std %%f6, [%3+8] \n\t"
- "std %%f22, [%3+24] \n\t"
-
- "add %0, 8, %0 \n\t"
- "add %1, 4, %1 \n\t"
- "add %2, 4, %2 \n\t"
- "subcc %4, 8, %4 \n\t"
- "bne 1b \n\t"
- "add %3, 32, %3 \n\t" //delay slot
- : "=r" (out1), "=r" (out2), "=r" (out3), "=r" (out4), "=r" (out5), "=r" (out6)
- : "0" (src[0]+(y+srcSliceY)*srcStride[0]), "1" (src[1]+((y+srcSliceY)>>1)*srcStride[1]),
- "2" (src[2]+((y+srcSliceY)>>1)*srcStride[2]), "3" (dst[0]+(y+srcSliceY)*dstStride[0]),
- "4" (c->dstW),
- "5" (c->sparc_coeffs)
- );
- }
-
- return srcSliceH;
-}
-
-// FIXME: must be changed to set alpha to 255 instead of 0
-static int vis_422P_ARGB32(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY,
- int srcSliceH, uint8_t* dst[], int dstStride[])
-{
- int y, out1, out2, out3, out4, out5, out6;
-
- for(y=0;y < srcSliceH;++y) {
- __asm__ volatile (
- YUV2RGB_INIT
- "wr %%g0, 0xd2, %%asi \n\t" /* ASI_FL16_P */
- "1: \n\t"
- "ldda [%1] %%asi, %%f2 \n\t"
- "ldda [%1+2] %%asi, %%f18 \n\t"
- "ldda [%2] %%asi, %%f4 \n\t"
- "ldda [%2+2] %%asi, %%f20 \n\t"
- "ld [%0], %%f0 \n\t"
- "ld [%0+4], %%f16 \n\t"
- "fpmerge %%f3, %%f3, %%f2 \n\t"
- "fpmerge %%f19, %%f19, %%f18 \n\t"
- "fpmerge %%f5, %%f5, %%f4 \n\t"
- "fpmerge %%f21, %%f21, %%f20 \n\t"
- YUV2RGB_KERNEL
- "fzero %%f0 \n\t"
- "fpmerge %%f4, %%f6, %%f8 \n\t" // r,b,t1
- "fpmerge %%f20, %%f22, %%f24 \n\t" // r,b,t1
- "fpmerge %%f0, %%f2, %%f10 \n\t" // 0,g,t2
- "fpmerge %%f0, %%f18, %%f26 \n\t" // 0,g,t2
- "fpmerge %%f10, %%f8, %%f4 \n\t" // t2,t1,msb
- "fpmerge %%f26, %%f24, %%f20 \n\t" // t2,t1,msb
- "fpmerge %%f11, %%f9, %%f6 \n\t" // t2,t1,lsb
- "fpmerge %%f27, %%f25, %%f22 \n\t" // t2,t1,lsb
- "std %%f4, [%3] \n\t"
- "std %%f20, [%3+16] \n\t"
- "std %%f6, [%3+8] \n\t"
- "std %%f22, [%3+24] \n\t"
-
- "add %0, 8, %0 \n\t"
- "add %1, 4, %1 \n\t"
- "add %2, 4, %2 \n\t"
- "subcc %4, 8, %4 \n\t"
- "bne 1b \n\t"
- "add %3, 32, %3 \n\t" //delay slot
- : "=r" (out1), "=r" (out2), "=r" (out3), "=r" (out4), "=r" (out5), "=r" (out6)
- : "0" (src[0]+(y+srcSliceY)*srcStride[0]), "1" (src[1]+(y+srcSliceY)*srcStride[1]),
- "2" (src[2]+(y+srcSliceY)*srcStride[2]), "3" (dst[0]+(y+srcSliceY)*dstStride[0]),
- "4" (c->dstW),
- "5" (c->sparc_coeffs)
- );
- }
-
- return srcSliceH;
-}
-
-SwsFunc ff_yuv2rgb_init_vis(SwsContext *c)
-{
- c->sparc_coeffs[5]=c->yCoeff;
- c->sparc_coeffs[6]=c->vgCoeff;
- c->sparc_coeffs[7]=c->vrCoeff;
- c->sparc_coeffs[8]=c->ubCoeff;
- c->sparc_coeffs[9]=c->ugCoeff;
-
- c->sparc_coeffs[0]=(((int16_t)c->yOffset*(int16_t)c->yCoeff >>11) & 0xffff) * 0x0001000100010001ULL;
- c->sparc_coeffs[1]=(((int16_t)c->uOffset*(int16_t)c->ubCoeff>>11) & 0xffff) * 0x0001000100010001ULL;
- c->sparc_coeffs[2]=(((int16_t)c->uOffset*(int16_t)c->ugCoeff>>11) & 0xffff) * 0x0001000100010001ULL;
- c->sparc_coeffs[3]=(((int16_t)c->vOffset*(int16_t)c->vgCoeff>>11) & 0xffff) * 0x0001000100010001ULL;
- c->sparc_coeffs[4]=(((int16_t)c->vOffset*(int16_t)c->vrCoeff>>11) & 0xffff) * 0x0001000100010001ULL;
-
- if (c->dstFormat == PIX_FMT_RGB32 && c->srcFormat == PIX_FMT_YUV422P && (c->dstW & 7)==0) {
- av_log(c, AV_LOG_INFO, "SPARC VIS accelerated YUV422P -> RGB32 (WARNING: alpha value is wrong)\n");
- return vis_422P_ARGB32;
- }
- else if (c->dstFormat == PIX_FMT_RGB32 && c->srcFormat == PIX_FMT_YUV420P && (c->dstW & 7)==0) {
- av_log(c, AV_LOG_INFO, "SPARC VIS accelerated YUV420P -> RGB32 (WARNING: alpha value is wrong)\n");
- return vis_420P_ARGB32;
- }
- return NULL;
-}
diff --git a/libswscale/swscale-test.c b/libswscale/swscale-test.c
deleted file mode 100644
index 887973a40e..0000000000
--- a/libswscale/swscale-test.c
+++ /dev/null
@@ -1,260 +0,0 @@
-/*
- * Copyright (C) 2003 Michael Niedermayer <michaelni@gmx.at>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * FFmpeg 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <inttypes.h>
-#include <stdarg.h>
-
-#undef HAVE_AV_CONFIG_H
-#include "libavutil/mem.h"
-#include "libavutil/avutil.h"
-#include "libavutil/lfg.h"
-#include "swscale.h"
-
-/* HACK Duplicated from swscale_internal.h.
- * Should be removed when a cleaner pixel format system exists. */
-const char *sws_format_name(enum PixelFormat format);
-#define isGray(x) ( \
- (x)==PIX_FMT_GRAY8 \
- || (x)==PIX_FMT_GRAY16BE \
- || (x)==PIX_FMT_GRAY16LE \
- )
-#define hasChroma(x) (!( \
- isGray(x) \
- || (x)==PIX_FMT_MONOBLACK \
- || (x)==PIX_FMT_MONOWHITE \
- ))
-#define isALPHA(x) ( \
- (x)==PIX_FMT_BGR32 \
- || (x)==PIX_FMT_BGR32_1 \
- || (x)==PIX_FMT_RGB32 \
- || (x)==PIX_FMT_RGB32_1 \
- || (x)==PIX_FMT_YUVA420P \
- )
-
-static uint64_t getSSD(uint8_t *src1, uint8_t *src2, int stride1, int stride2, int w, int h)
-{
- int x,y;
- uint64_t ssd=0;
-
-//printf("%d %d\n", w, h);
-
- for (y=0; y<h; y++) {
- for (x=0; x<w; x++) {
- int d= src1[x + y*stride1] - src2[x + y*stride2];
- ssd+= d*d;
-//printf("%d", abs(src1[x + y*stride1] - src2[x + y*stride2])/26 );
- }
-//printf("\n");
- }
- return ssd;
-}
-
-// test by ref -> src -> dst -> out & compare out against ref
-// ref & out are YV12
-static int doTest(uint8_t *ref[4], int refStride[4], int w, int h,
- enum PixelFormat srcFormat, enum PixelFormat dstFormat,
- int srcW, int srcH, int dstW, int dstH, int flags)
-{
- uint8_t *src[4] = {0};
- uint8_t *dst[4] = {0};
- uint8_t *out[4] = {0};
- int srcStride[4], dstStride[4];
- int i;
- uint64_t ssdY, ssdU=0, ssdV=0, ssdA=0;
- struct SwsContext *srcContext = NULL, *dstContext = NULL,
- *outContext = NULL;
- int res;
-
- res = 0;
- for (i=0; i<4; i++) {
- // avoid stride % bpp != 0
- if (srcFormat==PIX_FMT_RGB24 || srcFormat==PIX_FMT_BGR24)
- srcStride[i]= srcW*3;
- else if (srcFormat==PIX_FMT_RGB48BE || srcFormat==PIX_FMT_RGB48LE)
- srcStride[i]= srcW*6;
- else
- srcStride[i]= srcW*4;
-
- if (dstFormat==PIX_FMT_RGB24 || dstFormat==PIX_FMT_BGR24)
- dstStride[i]= dstW*3;
- else if (dstFormat==PIX_FMT_RGB48BE || dstFormat==PIX_FMT_RGB48LE)
- dstStride[i]= dstW*6;
- else
- dstStride[i]= dstW*4;
-
- /* Image buffers passed into libswscale can be allocated any way you
- * prefer, as long as they're aligned enough for the architecture, and
- * they're freed appropriately (such as using av_free for buffers
- * allocated with av_malloc). */
- src[i]= av_mallocz(srcStride[i]*srcH);
- dst[i]= av_mallocz(dstStride[i]*dstH);
- out[i]= av_mallocz(refStride[i]*h);
- if (!src[i] || !dst[i] || !out[i]) {
- perror("Malloc");
- res = -1;
-
- goto end;
- }
- }
-
- srcContext= sws_getContext(w, h, PIX_FMT_YUVA420P, srcW, srcH, srcFormat, flags, NULL, NULL, NULL);
- if (!srcContext) {
- fprintf(stderr, "Failed to get %s ---> %s\n",
- sws_format_name(PIX_FMT_YUVA420P),
- sws_format_name(srcFormat));
- res = -1;
-
- goto end;
- }
- dstContext= sws_getContext(srcW, srcH, srcFormat, dstW, dstH, dstFormat, flags, NULL, NULL, NULL);
- if (!dstContext) {
- fprintf(stderr, "Failed to get %s ---> %s\n",
- sws_format_name(srcFormat),
- sws_format_name(dstFormat));
- res = -1;
-
- goto end;
- }
- outContext= sws_getContext(dstW, dstH, dstFormat, w, h, PIX_FMT_YUVA420P, flags, NULL, NULL, NULL);
- if (!outContext) {
- fprintf(stderr, "Failed to get %s ---> %s\n",
- sws_format_name(dstFormat),
- sws_format_name(PIX_FMT_YUVA420P));
- res = -1;
-
- goto end;
- }
-// printf("test %X %X %X -> %X %X %X\n", (int)ref[0], (int)ref[1], (int)ref[2],
-// (int)src[0], (int)src[1], (int)src[2]);
-
- sws_scale(srcContext, ref, refStride, 0, h , src, srcStride);
- sws_scale(dstContext, src, srcStride, 0, srcH, dst, dstStride);
- sws_scale(outContext, dst, dstStride, 0, dstH, out, refStride);
-
- ssdY= getSSD(ref[0], out[0], refStride[0], refStride[0], w, h);
- if (hasChroma(srcFormat) && hasChroma(dstFormat)) {
- //FIXME check that output is really gray
- ssdU= getSSD(ref[1], out[1], refStride[1], refStride[1], (w+1)>>1, (h+1)>>1);
- ssdV= getSSD(ref[2], out[2], refStride[2], refStride[2], (w+1)>>1, (h+1)>>1);
- }
- if (isALPHA(srcFormat) && isALPHA(dstFormat))
- ssdA= getSSD(ref[3], out[3], refStride[3], refStride[3], w, h);
-
- ssdY/= w*h;
- ssdU/= w*h/4;
- ssdV/= w*h/4;
- ssdA/= w*h;
-
- printf(" %s %dx%d -> %s %4dx%4d flags=%2d SSD=%5"PRId64",%5"PRId64",%5"PRId64",%5"PRId64"\n",
- sws_format_name(srcFormat), srcW, srcH,
- sws_format_name(dstFormat), dstW, dstH,
- flags, ssdY, ssdU, ssdV, ssdA);
- fflush(stdout);
-
-end:
-
- sws_freeContext(srcContext);
- sws_freeContext(dstContext);
- sws_freeContext(outContext);
-
- for (i=0; i<4; i++) {
- av_free(src[i]);
- av_free(dst[i]);
- av_free(out[i]);
- }
-
- return res;
-}
-
-static void selfTest(uint8_t *ref[4], int refStride[4], int w, int h)
-{
- const int flags[] = { SWS_FAST_BILINEAR,
- SWS_BILINEAR, SWS_BICUBIC,
- SWS_X , SWS_POINT , SWS_AREA, 0 };
- const int srcW = w;
- const int srcH = h;
- const int dstW[] = { srcW - srcW/3, srcW, srcW + srcW/3, 0 };
- const int dstH[] = { srcH - srcH/3, srcH, srcH + srcH/3, 0 };
- enum PixelFormat srcFormat, dstFormat;
-
- for (srcFormat = 0; srcFormat < PIX_FMT_NB; srcFormat++) {
- if (!sws_isSupportedInput(srcFormat) || !sws_isSupportedOutput(srcFormat))
- continue;
-
- for (dstFormat = 0; dstFormat < PIX_FMT_NB; dstFormat++) {
- int i, j, k;
- int res = 0;
-
- if (!sws_isSupportedInput(dstFormat) || !sws_isSupportedOutput(dstFormat))
- continue;
-
- printf("%s -> %s\n",
- sws_format_name(srcFormat),
- sws_format_name(dstFormat));
- fflush(stdout);
-
- for (i = 0; dstW[i] && !res; i++)
- for (j = 0; dstH[j] && !res; j++)
- for (k = 0; flags[k] && !res; k++)
- res = doTest(ref, refStride, w, h, srcFormat, dstFormat,
- srcW, srcH, dstW[i], dstH[j], flags[k]);
- }
- }
-}
-
-#define W 96
-#define H 96
-
-int main(int argc, char **argv)
-{
- uint8_t *rgb_data = av_malloc (W*H*4);
- uint8_t *rgb_src[3]= {rgb_data, NULL, NULL};
- int rgb_stride[3]={4*W, 0, 0};
- uint8_t *data = av_malloc (4*W*H);
- uint8_t *src[4]= {data, data+W*H, data+W*H*2, data+W*H*3};
- int stride[4]={W, W, W, W};
- int x, y;
- struct SwsContext *sws;
- AVLFG rand;
-
- if (!rgb_data || !data)
- return -1;
-
- sws= sws_getContext(W/12, H/12, PIX_FMT_RGB32, W, H, PIX_FMT_YUVA420P, SWS_BILINEAR, NULL, NULL, NULL);
-
- av_lfg_init(&rand, 1);
-
- for (y=0; y<H; y++) {
- for (x=0; x<W*4; x++) {
- rgb_data[ x + y*4*W]= av_lfg_get(&rand);
- }
- }
- sws_scale(sws, rgb_src, rgb_stride, 0, H, src, stride);
- sws_freeContext(sws);
- av_free(rgb_data);
-
- selfTest(src, stride, W, H);
- av_free(data);
-
- return 0;
-}
diff --git a/libswscale/swscale.c b/libswscale/swscale.c
deleted file mode 100644
index ff68f344c3..0000000000
--- a/libswscale/swscale.c
+++ /dev/null
@@ -1,1914 +0,0 @@
-/*
- * Copyright (C) 2001-2003 Michael Niedermayer <michaelni@gmx.at>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * the C code (not assembly, mmx, ...) of this file can be used
- * under the LGPL license too
- */
-
-/*
- supported Input formats: YV12, I420/IYUV, YUY2, UYVY, BGR32, BGR32_1, BGR24, BGR16, BGR15, RGB32, RGB32_1, RGB24, Y8/Y800, YVU9/IF09, PAL8
- supported output formats: YV12, I420/IYUV, YUY2, UYVY, {BGR,RGB}{1,4,8,15,16,24,32}, Y8/Y800, YVU9/IF09
- {BGR,RGB}{1,4,8,15,16} support dithering
-
- unscaled special converters (YV12=I420=IYUV, Y800=Y8)
- YV12 -> {BGR,RGB}{1,4,8,15,16,24,32}
- x -> x
- YUV9 -> YV12
- YUV9/YV12 -> Y800
- Y800 -> YUV9/YV12
- BGR24 -> BGR32 & RGB24 -> RGB32
- BGR32 -> BGR24 & RGB32 -> RGB24
- BGR15 -> BGR16
-*/
-
-/*
-tested special converters (most are tested actually, but I did not write it down ...)
- YV12 -> BGR16
- YV12 -> YV12
- BGR15 -> BGR16
- BGR16 -> BGR16
- YVU9 -> YV12
-
-untested special converters
- YV12/I420 -> BGR15/BGR24/BGR32 (it is the yuv2rgb stuff, so it should be OK)
- YV12/I420 -> YV12/I420
- YUY2/BGR15/BGR24/BGR32/RGB24/RGB32 -> same format
- BGR24 -> BGR32 & RGB24 -> RGB32
- BGR32 -> BGR24 & RGB32 -> RGB24
- BGR24 -> YV12
-*/
-
-#include <inttypes.h>
-#include <string.h>
-#include <math.h>
-#include <stdio.h>
-#include "config.h"
-#include <assert.h>
-#include "swscale.h"
-#include "swscale_internal.h"
-#include "rgb2rgb.h"
-#include "libavutil/intreadwrite.h"
-#include "libavutil/x86_cpu.h"
-#include "libavutil/avutil.h"
-#include "libavutil/bswap.h"
-#include "libavutil/pixdesc.h"
-
-#undef MOVNTQ
-#undef PAVGB
-
-//#undef HAVE_MMX2
-//#define HAVE_AMD3DNOW
-//#undef HAVE_MMX
-//#undef ARCH_X86
-#define DITHER1XBPP
-
-#define FAST_BGR2YV12 // use 7 bit coefficients instead of 15 bit
-
-#ifdef M_PI
-#define PI M_PI
-#else
-#define PI 3.14159265358979323846
-#endif
-
-#define isPacked(x) ( \
- (x)==PIX_FMT_PAL8 \
- || (x)==PIX_FMT_YUYV422 \
- || (x)==PIX_FMT_UYVY422 \
- || isAnyRGB(x) \
- )
-#define usePal(x) (av_pix_fmt_descriptors[x].flags & PIX_FMT_PAL)
-
-#define RGB2YUV_SHIFT 15
-#define BY ( (int)(0.114*219/255*(1<<RGB2YUV_SHIFT)+0.5))
-#define BV (-(int)(0.081*224/255*(1<<RGB2YUV_SHIFT)+0.5))
-#define BU ( (int)(0.500*224/255*(1<<RGB2YUV_SHIFT)+0.5))
-#define GY ( (int)(0.587*219/255*(1<<RGB2YUV_SHIFT)+0.5))
-#define GV (-(int)(0.419*224/255*(1<<RGB2YUV_SHIFT)+0.5))
-#define GU (-(int)(0.331*224/255*(1<<RGB2YUV_SHIFT)+0.5))
-#define RY ( (int)(0.299*219/255*(1<<RGB2YUV_SHIFT)+0.5))
-#define RV ( (int)(0.500*224/255*(1<<RGB2YUV_SHIFT)+0.5))
-#define RU (-(int)(0.169*224/255*(1<<RGB2YUV_SHIFT)+0.5))
-
-static const double rgb2yuv_table[8][9]={
- {0.7152, 0.0722, 0.2126, -0.386, 0.5, -0.115, -0.454, -0.046, 0.5},
- {0.7152, 0.0722, 0.2126, -0.386, 0.5, -0.115, -0.454, -0.046, 0.5},
- {0.587 , 0.114 , 0.299 , -0.331, 0.5, -0.169, -0.419, -0.081, 0.5},
- {0.587 , 0.114 , 0.299 , -0.331, 0.5, -0.169, -0.419, -0.081, 0.5},
- {0.59 , 0.11 , 0.30 , -0.331, 0.5, -0.169, -0.421, -0.079, 0.5}, //FCC
- {0.587 , 0.114 , 0.299 , -0.331, 0.5, -0.169, -0.419, -0.081, 0.5},
- {0.587 , 0.114 , 0.299 , -0.331, 0.5, -0.169, -0.419, -0.081, 0.5}, //SMPTE 170M
- {0.701 , 0.087 , 0.212 , -0.384, 0.5 -0.116, -0.445, -0.055, 0.5}, //SMPTE 240M
-};
-
-/*
-NOTES
-Special versions: fast Y 1:1 scaling (no interpolation in y direction)
-
-TODO
-more intelligent misalignment avoidance for the horizontal scaler
-write special vertical cubic upscale version
-optimize C code (YV12 / minmax)
-add support for packed pixel YUV input & output
-add support for Y8 output
-optimize BGR24 & BGR32
-add BGR4 output support
-write special BGR->BGR scaler
-*/
-
-#if ARCH_X86 && CONFIG_GPL
-DECLARE_ASM_CONST(8, uint64_t, bF8)= 0xF8F8F8F8F8F8F8F8LL;
-DECLARE_ASM_CONST(8, uint64_t, bFC)= 0xFCFCFCFCFCFCFCFCLL;
-DECLARE_ASM_CONST(8, uint64_t, w10)= 0x0010001000100010LL;
-DECLARE_ASM_CONST(8, uint64_t, w02)= 0x0002000200020002LL;
-DECLARE_ASM_CONST(8, uint64_t, bm00001111)=0x00000000FFFFFFFFLL;
-DECLARE_ASM_CONST(8, uint64_t, bm00000111)=0x0000000000FFFFFFLL;
-DECLARE_ASM_CONST(8, uint64_t, bm11111000)=0xFFFFFFFFFF000000LL;
-DECLARE_ASM_CONST(8, uint64_t, bm01010101)=0x00FF00FF00FF00FFLL;
-
-const DECLARE_ALIGNED(8, uint64_t, ff_dither4)[2] = {
- 0x0103010301030103LL,
- 0x0200020002000200LL,};
-
-const DECLARE_ALIGNED(8, uint64_t, ff_dither8)[2] = {
- 0x0602060206020602LL,
- 0x0004000400040004LL,};
-
-DECLARE_ASM_CONST(8, uint64_t, b16Mask)= 0x001F001F001F001FLL;
-DECLARE_ASM_CONST(8, uint64_t, g16Mask)= 0x07E007E007E007E0LL;
-DECLARE_ASM_CONST(8, uint64_t, r16Mask)= 0xF800F800F800F800LL;
-DECLARE_ASM_CONST(8, uint64_t, b15Mask)= 0x001F001F001F001FLL;
-DECLARE_ASM_CONST(8, uint64_t, g15Mask)= 0x03E003E003E003E0LL;
-DECLARE_ASM_CONST(8, uint64_t, r15Mask)= 0x7C007C007C007C00LL;
-
-DECLARE_ALIGNED(8, const uint64_t, ff_M24A) = 0x00FF0000FF0000FFLL;
-DECLARE_ALIGNED(8, const uint64_t, ff_M24B) = 0xFF0000FF0000FF00LL;
-DECLARE_ALIGNED(8, const uint64_t, ff_M24C) = 0x0000FF0000FF0000LL;
-
-#ifdef FAST_BGR2YV12
-DECLARE_ALIGNED(8, const uint64_t, ff_bgr2YCoeff) = 0x000000210041000DULL;
-DECLARE_ALIGNED(8, const uint64_t, ff_bgr2UCoeff) = 0x0000FFEEFFDC0038ULL;
-DECLARE_ALIGNED(8, const uint64_t, ff_bgr2VCoeff) = 0x00000038FFD2FFF8ULL;
-#else
-DECLARE_ALIGNED(8, const uint64_t, ff_bgr2YCoeff) = 0x000020E540830C8BULL;
-DECLARE_ALIGNED(8, const uint64_t, ff_bgr2UCoeff) = 0x0000ED0FDAC23831ULL;
-DECLARE_ALIGNED(8, const uint64_t, ff_bgr2VCoeff) = 0x00003831D0E6F6EAULL;
-#endif /* FAST_BGR2YV12 */
-DECLARE_ALIGNED(8, const uint64_t, ff_bgr2YOffset) = 0x1010101010101010ULL;
-DECLARE_ALIGNED(8, const uint64_t, ff_bgr2UVOffset) = 0x8080808080808080ULL;
-DECLARE_ALIGNED(8, const uint64_t, ff_w1111) = 0x0001000100010001ULL;
-
-DECLARE_ASM_CONST(8, uint64_t, ff_bgr24toY1Coeff) = 0x0C88000040870C88ULL;
-DECLARE_ASM_CONST(8, uint64_t, ff_bgr24toY2Coeff) = 0x20DE4087000020DEULL;
-DECLARE_ASM_CONST(8, uint64_t, ff_rgb24toY1Coeff) = 0x20DE0000408720DEULL;
-DECLARE_ASM_CONST(8, uint64_t, ff_rgb24toY2Coeff) = 0x0C88408700000C88ULL;
-DECLARE_ASM_CONST(8, uint64_t, ff_bgr24toYOffset) = 0x0008400000084000ULL;
-
-DECLARE_ASM_CONST(8, uint64_t, ff_bgr24toUV)[2][4] = {
- {0x38380000DAC83838ULL, 0xECFFDAC80000ECFFULL, 0xF6E40000D0E3F6E4ULL, 0x3838D0E300003838ULL},
- {0xECFF0000DAC8ECFFULL, 0x3838DAC800003838ULL, 0x38380000D0E33838ULL, 0xF6E4D0E30000F6E4ULL},
-};
-
-DECLARE_ASM_CONST(8, uint64_t, ff_bgr24toUVOffset)= 0x0040400000404000ULL;
-
-#endif /* ARCH_X86 && CONFIG_GPL */
-
-DECLARE_ALIGNED(8, static const uint8_t, dither_2x2_4)[2][8]={
-{ 1, 3, 1, 3, 1, 3, 1, 3, },
-{ 2, 0, 2, 0, 2, 0, 2, 0, },
-};
-
-DECLARE_ALIGNED(8, static const uint8_t, dither_2x2_8)[2][8]={
-{ 6, 2, 6, 2, 6, 2, 6, 2, },
-{ 0, 4, 0, 4, 0, 4, 0, 4, },
-};
-
-DECLARE_ALIGNED(8, const uint8_t, dither_8x8_32)[8][8]={
-{ 17, 9, 23, 15, 16, 8, 22, 14, },
-{ 5, 29, 3, 27, 4, 28, 2, 26, },
-{ 21, 13, 19, 11, 20, 12, 18, 10, },
-{ 0, 24, 6, 30, 1, 25, 7, 31, },
-{ 16, 8, 22, 14, 17, 9, 23, 15, },
-{ 4, 28, 2, 26, 5, 29, 3, 27, },
-{ 20, 12, 18, 10, 21, 13, 19, 11, },
-{ 1, 25, 7, 31, 0, 24, 6, 30, },
-};
-
-DECLARE_ALIGNED(8, const uint8_t, dither_8x8_73)[8][8]={
-{ 0, 55, 14, 68, 3, 58, 17, 72, },
-{ 37, 18, 50, 32, 40, 22, 54, 35, },
-{ 9, 64, 5, 59, 13, 67, 8, 63, },
-{ 46, 27, 41, 23, 49, 31, 44, 26, },
-{ 2, 57, 16, 71, 1, 56, 15, 70, },
-{ 39, 21, 52, 34, 38, 19, 51, 33, },
-{ 11, 66, 7, 62, 10, 65, 6, 60, },
-{ 48, 30, 43, 25, 47, 29, 42, 24, },
-};
-
-#if 1
-DECLARE_ALIGNED(8, const uint8_t, dither_8x8_220)[8][8]={
-{117, 62, 158, 103, 113, 58, 155, 100, },
-{ 34, 199, 21, 186, 31, 196, 17, 182, },
-{144, 89, 131, 76, 141, 86, 127, 72, },
-{ 0, 165, 41, 206, 10, 175, 52, 217, },
-{110, 55, 151, 96, 120, 65, 162, 107, },
-{ 28, 193, 14, 179, 38, 203, 24, 189, },
-{138, 83, 124, 69, 148, 93, 134, 79, },
-{ 7, 172, 48, 213, 3, 168, 45, 210, },
-};
-#elif 1
-// tries to correct a gamma of 1.5
-DECLARE_ALIGNED(8, const uint8_t, dither_8x8_220)[8][8]={
-{ 0, 143, 18, 200, 2, 156, 25, 215, },
-{ 78, 28, 125, 64, 89, 36, 138, 74, },
-{ 10, 180, 3, 161, 16, 195, 8, 175, },
-{109, 51, 93, 38, 121, 60, 105, 47, },
-{ 1, 152, 23, 210, 0, 147, 20, 205, },
-{ 85, 33, 134, 71, 81, 30, 130, 67, },
-{ 14, 190, 6, 171, 12, 185, 5, 166, },
-{117, 57, 101, 44, 113, 54, 97, 41, },
-};
-#elif 1
-// tries to correct a gamma of 2.0
-DECLARE_ALIGNED(8, const uint8_t, dither_8x8_220)[8][8]={
-{ 0, 124, 8, 193, 0, 140, 12, 213, },
-{ 55, 14, 104, 42, 66, 19, 119, 52, },
-{ 3, 168, 1, 145, 6, 187, 3, 162, },
-{ 86, 31, 70, 21, 99, 39, 82, 28, },
-{ 0, 134, 11, 206, 0, 129, 9, 200, },
-{ 62, 17, 114, 48, 58, 16, 109, 45, },
-{ 5, 181, 2, 157, 4, 175, 1, 151, },
-{ 95, 36, 78, 26, 90, 34, 74, 24, },
-};
-#else
-// tries to correct a gamma of 2.5
-DECLARE_ALIGNED(8, const uint8_t, dither_8x8_220)[8][8]={
-{ 0, 107, 3, 187, 0, 125, 6, 212, },
-{ 39, 7, 86, 28, 49, 11, 102, 36, },
-{ 1, 158, 0, 131, 3, 180, 1, 151, },
-{ 68, 19, 52, 12, 81, 25, 64, 17, },
-{ 0, 119, 5, 203, 0, 113, 4, 195, },
-{ 45, 9, 96, 33, 42, 8, 91, 30, },
-{ 2, 172, 1, 144, 2, 165, 0, 137, },
-{ 77, 23, 60, 15, 72, 21, 56, 14, },
-};
-#endif
-
-static av_always_inline void yuv2yuvX16inC_template(const int16_t *lumFilter, const int16_t **lumSrc, int lumFilterSize,
- const int16_t *chrFilter, const int16_t **chrSrc, int chrFilterSize,
- const int16_t **alpSrc, uint16_t *dest, uint16_t *uDest, uint16_t *vDest, uint16_t *aDest,
- int dstW, int chrDstW, int big_endian)
-{
- //FIXME Optimize (just quickly written not optimized..)
- int i;
-
- for (i = 0; i < dstW; i++) {
- int val = 1 << 10;
- int j;
-
- for (j = 0; j < lumFilterSize; j++)
- val += lumSrc[j][i] * lumFilter[j];
-
- if (big_endian) {
- AV_WB16(&dest[i], av_clip_uint16(val >> 11));
- } else {
- AV_WL16(&dest[i], av_clip_uint16(val >> 11));
- }
- }
-
- if (uDest) {
- for (i = 0; i < chrDstW; i++) {
- int u = 1 << 10;
- int v = 1 << 10;
- int j;
-
- for (j = 0; j < chrFilterSize; j++) {
- u += chrSrc[j][i ] * chrFilter[j];
- v += chrSrc[j][i + VOFW] * chrFilter[j];
- }
-
- if (big_endian) {
- AV_WB16(&uDest[i], av_clip_uint16(u >> 11));
- AV_WB16(&vDest[i], av_clip_uint16(v >> 11));
- } else {
- AV_WL16(&uDest[i], av_clip_uint16(u >> 11));
- AV_WL16(&vDest[i], av_clip_uint16(v >> 11));
- }
- }
- }
-
- if (CONFIG_SWSCALE_ALPHA && aDest) {
- for (i = 0; i < dstW; i++) {
- int val = 1 << 10;
- int j;
-
- for (j = 0; j < lumFilterSize; j++)
- val += alpSrc[j][i] * lumFilter[j];
-
- if (big_endian) {
- AV_WB16(&aDest[i], av_clip_uint16(val >> 11));
- } else {
- AV_WL16(&aDest[i], av_clip_uint16(val >> 11));
- }
- }
- }
-}
-
-static inline void yuv2yuvX16inC(const int16_t *lumFilter, const int16_t **lumSrc, int lumFilterSize,
- const int16_t *chrFilter, const int16_t **chrSrc, int chrFilterSize,
- const int16_t **alpSrc, uint16_t *dest, uint16_t *uDest, uint16_t *vDest, uint16_t *aDest, int dstW, int chrDstW,
- enum PixelFormat dstFormat)
-{
- if (isBE(dstFormat)) {
- yuv2yuvX16inC_template(lumFilter, lumSrc, lumFilterSize,
- chrFilter, chrSrc, chrFilterSize,
- alpSrc,
- dest, uDest, vDest, aDest,
- dstW, chrDstW, 1);
- } else {
- yuv2yuvX16inC_template(lumFilter, lumSrc, lumFilterSize,
- chrFilter, chrSrc, chrFilterSize,
- alpSrc,
- dest, uDest, vDest, aDest,
- dstW, chrDstW, 0);
- }
-}
-
-static inline void yuv2yuvXinC(const int16_t *lumFilter, const int16_t **lumSrc, int lumFilterSize,
- const int16_t *chrFilter, const int16_t **chrSrc, int chrFilterSize,
- const int16_t **alpSrc, uint8_t *dest, uint8_t *uDest, uint8_t *vDest, uint8_t *aDest, int dstW, int chrDstW)
-{
- //FIXME Optimize (just quickly written not optimized..)
- int i;
- for (i=0; i<dstW; i++) {
- int val=1<<18;
- int j;
- for (j=0; j<lumFilterSize; j++)
- val += lumSrc[j][i] * lumFilter[j];
-
- dest[i]= av_clip_uint8(val>>19);
- }
-
- if (uDest)
- for (i=0; i<chrDstW; i++) {
- int u=1<<18;
- int v=1<<18;
- int j;
- for (j=0; j<chrFilterSize; j++) {
- u += chrSrc[j][i] * chrFilter[j];
- v += chrSrc[j][i + VOFW] * chrFilter[j];
- }
-
- uDest[i]= av_clip_uint8(u>>19);
- vDest[i]= av_clip_uint8(v>>19);
- }
-
- if (CONFIG_SWSCALE_ALPHA && aDest)
- for (i=0; i<dstW; i++) {
- int val=1<<18;
- int j;
- for (j=0; j<lumFilterSize; j++)
- val += alpSrc[j][i] * lumFilter[j];
-
- aDest[i]= av_clip_uint8(val>>19);
- }
-
-}
-
-static inline void yuv2nv12XinC(const int16_t *lumFilter, const int16_t **lumSrc, int lumFilterSize,
- const int16_t *chrFilter, const int16_t **chrSrc, int chrFilterSize,
- uint8_t *dest, uint8_t *uDest, int dstW, int chrDstW, int dstFormat)
-{
- //FIXME Optimize (just quickly written not optimized..)
- int i;
- for (i=0; i<dstW; i++) {
- int val=1<<18;
- int j;
- for (j=0; j<lumFilterSize; j++)
- val += lumSrc[j][i] * lumFilter[j];
-
- dest[i]= av_clip_uint8(val>>19);
- }
-
- if (!uDest)
- return;
-
- if (dstFormat == PIX_FMT_NV12)
- for (i=0; i<chrDstW; i++) {
- int u=1<<18;
- int v=1<<18;
- int j;
- for (j=0; j<chrFilterSize; j++) {
- u += chrSrc[j][i] * chrFilter[j];
- v += chrSrc[j][i + VOFW] * chrFilter[j];
- }
-
- uDest[2*i]= av_clip_uint8(u>>19);
- uDest[2*i+1]= av_clip_uint8(v>>19);
- }
- else
- for (i=0; i<chrDstW; i++) {
- int u=1<<18;
- int v=1<<18;
- int j;
- for (j=0; j<chrFilterSize; j++) {
- u += chrSrc[j][i] * chrFilter[j];
- v += chrSrc[j][i + VOFW] * chrFilter[j];
- }
-
- uDest[2*i]= av_clip_uint8(v>>19);
- uDest[2*i+1]= av_clip_uint8(u>>19);
- }
-}
-
-#define YSCALE_YUV_2_PACKEDX_NOCLIP_C(type,alpha) \
- for (i=0; i<(dstW>>1); i++) {\
- int j;\
- int Y1 = 1<<18;\
- int Y2 = 1<<18;\
- int U = 1<<18;\
- int V = 1<<18;\
- int av_unused A1, A2;\
- type av_unused *r, *b, *g;\
- const int i2= 2*i;\
- \
- for (j=0; j<lumFilterSize; j++) {\
- Y1 += lumSrc[j][i2] * lumFilter[j];\
- Y2 += lumSrc[j][i2+1] * lumFilter[j];\
- }\
- for (j=0; j<chrFilterSize; j++) {\
- U += chrSrc[j][i] * chrFilter[j];\
- V += chrSrc[j][i+VOFW] * chrFilter[j];\
- }\
- Y1>>=19;\
- Y2>>=19;\
- U >>=19;\
- V >>=19;\
- if (alpha) {\
- A1 = 1<<18;\
- A2 = 1<<18;\
- for (j=0; j<lumFilterSize; j++) {\
- A1 += alpSrc[j][i2 ] * lumFilter[j];\
- A2 += alpSrc[j][i2+1] * lumFilter[j];\
- }\
- A1>>=19;\
- A2>>=19;\
- }
-
-#define YSCALE_YUV_2_PACKEDX_C(type,alpha) \
- YSCALE_YUV_2_PACKEDX_NOCLIP_C(type,alpha)\
- if ((Y1|Y2|U|V)&256) {\
- if (Y1>255) Y1=255; \
- else if (Y1<0)Y1=0; \
- if (Y2>255) Y2=255; \
- else if (Y2<0)Y2=0; \
- if (U>255) U=255; \
- else if (U<0) U=0; \
- if (V>255) V=255; \
- else if (V<0) V=0; \
- }\
- if (alpha && ((A1|A2)&256)) {\
- A1=av_clip_uint8(A1);\
- A2=av_clip_uint8(A2);\
- }
-
-#define YSCALE_YUV_2_PACKEDX_FULL_C(rnd,alpha) \
- for (i=0; i<dstW; i++) {\
- int j;\
- int Y = 0;\
- int U = -128<<19;\
- int V = -128<<19;\
- int av_unused A;\
- int R,G,B;\
- \
- for (j=0; j<lumFilterSize; j++) {\
- Y += lumSrc[j][i ] * lumFilter[j];\
- }\
- for (j=0; j<chrFilterSize; j++) {\
- U += chrSrc[j][i ] * chrFilter[j];\
- V += chrSrc[j][i+VOFW] * chrFilter[j];\
- }\
- Y >>=10;\
- U >>=10;\
- V >>=10;\
- if (alpha) {\
- A = rnd;\
- for (j=0; j<lumFilterSize; j++)\
- A += alpSrc[j][i ] * lumFilter[j];\
- A >>=19;\
- if (A&256)\
- A = av_clip_uint8(A);\
- }
-
-#define YSCALE_YUV_2_RGBX_FULL_C(rnd,alpha) \
- YSCALE_YUV_2_PACKEDX_FULL_C(rnd>>3,alpha)\
- Y-= c->yuv2rgb_y_offset;\
- Y*= c->yuv2rgb_y_coeff;\
- Y+= rnd;\
- R= Y + V*c->yuv2rgb_v2r_coeff;\
- G= Y + V*c->yuv2rgb_v2g_coeff + U*c->yuv2rgb_u2g_coeff;\
- B= Y + U*c->yuv2rgb_u2b_coeff;\
- if ((R|G|B)&(0xC0000000)) {\
- if (R>=(256<<22)) R=(256<<22)-1; \
- else if (R<0)R=0; \
- if (G>=(256<<22)) G=(256<<22)-1; \
- else if (G<0)G=0; \
- if (B>=(256<<22)) B=(256<<22)-1; \
- else if (B<0)B=0; \
- }
-
-#define YSCALE_YUV_2_GRAY16_C \
- for (i=0; i<(dstW>>1); i++) {\
- int j;\
- int Y1 = 1<<18;\
- int Y2 = 1<<18;\
- int U = 1<<18;\
- int V = 1<<18;\
- \
- const int i2= 2*i;\
- \
- for (j=0; j<lumFilterSize; j++) {\
- Y1 += lumSrc[j][i2] * lumFilter[j];\
- Y2 += lumSrc[j][i2+1] * lumFilter[j];\
- }\
- Y1>>=11;\
- Y2>>=11;\
- if ((Y1|Y2|U|V)&65536) {\
- if (Y1>65535) Y1=65535; \
- else if (Y1<0)Y1=0; \
- if (Y2>65535) Y2=65535; \
- else if (Y2<0)Y2=0; \
- }
-
-#define YSCALE_YUV_2_RGBX_C(type,alpha) \
- YSCALE_YUV_2_PACKEDX_C(type,alpha) /* FIXME fix tables so that clipping is not needed and then use _NOCLIP*/\
- r = (type *)c->table_rV[V]; \
- g = (type *)(c->table_gU[U] + c->table_gV[V]); \
- b = (type *)c->table_bU[U];
-
-#define YSCALE_YUV_2_PACKED2_C(type,alpha) \
- for (i=0; i<(dstW>>1); i++) { \
- const int i2= 2*i; \
- int Y1= (buf0[i2 ]*yalpha1+buf1[i2 ]*yalpha)>>19; \
- int Y2= (buf0[i2+1]*yalpha1+buf1[i2+1]*yalpha)>>19; \
- int U= (uvbuf0[i ]*uvalpha1+uvbuf1[i ]*uvalpha)>>19; \
- int V= (uvbuf0[i+VOFW]*uvalpha1+uvbuf1[i+VOFW]*uvalpha)>>19; \
- type av_unused *r, *b, *g; \
- int av_unused A1, A2; \
- if (alpha) {\
- A1= (abuf0[i2 ]*yalpha1+abuf1[i2 ]*yalpha)>>19; \
- A2= (abuf0[i2+1]*yalpha1+abuf1[i2+1]*yalpha)>>19; \
- }
-
-#define YSCALE_YUV_2_GRAY16_2_C \
- for (i=0; i<(dstW>>1); i++) { \
- const int i2= 2*i; \
- int Y1= (buf0[i2 ]*yalpha1+buf1[i2 ]*yalpha)>>11; \
- int Y2= (buf0[i2+1]*yalpha1+buf1[i2+1]*yalpha)>>11;
-
-#define YSCALE_YUV_2_RGB2_C(type,alpha) \
- YSCALE_YUV_2_PACKED2_C(type,alpha)\
- r = (type *)c->table_rV[V];\
- g = (type *)(c->table_gU[U] + c->table_gV[V]);\
- b = (type *)c->table_bU[U];
-
-#define YSCALE_YUV_2_PACKED1_C(type,alpha) \
- for (i=0; i<(dstW>>1); i++) {\
- const int i2= 2*i;\
- int Y1= buf0[i2 ]>>7;\
- int Y2= buf0[i2+1]>>7;\
- int U= (uvbuf1[i ])>>7;\
- int V= (uvbuf1[i+VOFW])>>7;\
- type av_unused *r, *b, *g;\
- int av_unused A1, A2;\
- if (alpha) {\
- A1= abuf0[i2 ]>>7;\
- A2= abuf0[i2+1]>>7;\
- }
-
-#define YSCALE_YUV_2_GRAY16_1_C \
- for (i=0; i<(dstW>>1); i++) {\
- const int i2= 2*i;\
- int Y1= buf0[i2 ]<<1;\
- int Y2= buf0[i2+1]<<1;
-
-#define YSCALE_YUV_2_RGB1_C(type,alpha) \
- YSCALE_YUV_2_PACKED1_C(type,alpha)\
- r = (type *)c->table_rV[V];\
- g = (type *)(c->table_gU[U] + c->table_gV[V]);\
- b = (type *)c->table_bU[U];
-
-#define YSCALE_YUV_2_PACKED1B_C(type,alpha) \
- for (i=0; i<(dstW>>1); i++) {\
- const int i2= 2*i;\
- int Y1= buf0[i2 ]>>7;\
- int Y2= buf0[i2+1]>>7;\
- int U= (uvbuf0[i ] + uvbuf1[i ])>>8;\
- int V= (uvbuf0[i+VOFW] + uvbuf1[i+VOFW])>>8;\
- type av_unused *r, *b, *g;\
- int av_unused A1, A2;\
- if (alpha) {\
- A1= abuf0[i2 ]>>7;\
- A2= abuf0[i2+1]>>7;\
- }
-
-#define YSCALE_YUV_2_RGB1B_C(type,alpha) \
- YSCALE_YUV_2_PACKED1B_C(type,alpha)\
- r = (type *)c->table_rV[V];\
- g = (type *)(c->table_gU[U] + c->table_gV[V]);\
- b = (type *)c->table_bU[U];
-
-#define YSCALE_YUV_2_MONO2_C \
- const uint8_t * const d128=dither_8x8_220[y&7];\
- uint8_t *g= c->table_gU[128] + c->table_gV[128];\
- for (i=0; i<dstW-7; i+=8) {\
- int acc;\
- acc = g[((buf0[i ]*yalpha1+buf1[i ]*yalpha)>>19) + d128[0]];\
- acc+= acc + g[((buf0[i+1]*yalpha1+buf1[i+1]*yalpha)>>19) + d128[1]];\
- acc+= acc + g[((buf0[i+2]*yalpha1+buf1[i+2]*yalpha)>>19) + d128[2]];\
- acc+= acc + g[((buf0[i+3]*yalpha1+buf1[i+3]*yalpha)>>19) + d128[3]];\
- acc+= acc + g[((buf0[i+4]*yalpha1+buf1[i+4]*yalpha)>>19) + d128[4]];\
- acc+= acc + g[((buf0[i+5]*yalpha1+buf1[i+5]*yalpha)>>19) + d128[5]];\
- acc+= acc + g[((buf0[i+6]*yalpha1+buf1[i+6]*yalpha)>>19) + d128[6]];\
- acc+= acc + g[((buf0[i+7]*yalpha1+buf1[i+7]*yalpha)>>19) + d128[7]];\
- ((uint8_t*)dest)[0]= c->dstFormat == PIX_FMT_MONOBLACK ? acc : ~acc;\
- dest++;\
- }
-
-#define YSCALE_YUV_2_MONOX_C \
- const uint8_t * const d128=dither_8x8_220[y&7];\
- uint8_t *g= c->table_gU[128] + c->table_gV[128];\
- int acc=0;\
- for (i=0; i<dstW-1; i+=2) {\
- int j;\
- int Y1=1<<18;\
- int Y2=1<<18;\
-\
- for (j=0; j<lumFilterSize; j++) {\
- Y1 += lumSrc[j][i] * lumFilter[j];\
- Y2 += lumSrc[j][i+1] * lumFilter[j];\
- }\
- Y1>>=19;\
- Y2>>=19;\
- if ((Y1|Y2)&256) {\
- if (Y1>255) Y1=255;\
- else if (Y1<0)Y1=0;\
- if (Y2>255) Y2=255;\
- else if (Y2<0)Y2=0;\
- }\
- acc+= acc + g[Y1+d128[(i+0)&7]];\
- acc+= acc + g[Y2+d128[(i+1)&7]];\
- if ((i&7)==6) {\
- ((uint8_t*)dest)[0]= c->dstFormat == PIX_FMT_MONOBLACK ? acc : ~acc;\
- dest++;\
- }\
- }
-
-#define YSCALE_YUV_2_ANYRGB_C(func, func2, func_g16, func_monoblack)\
- switch(c->dstFormat) {\
- case PIX_FMT_RGB48BE:\
- case PIX_FMT_RGB48LE:\
- func(uint8_t,0)\
- ((uint8_t*)dest)[ 0]= r[Y1];\
- ((uint8_t*)dest)[ 1]= r[Y1];\
- ((uint8_t*)dest)[ 2]= g[Y1];\
- ((uint8_t*)dest)[ 3]= g[Y1];\
- ((uint8_t*)dest)[ 4]= b[Y1];\
- ((uint8_t*)dest)[ 5]= b[Y1];\
- ((uint8_t*)dest)[ 6]= r[Y2];\
- ((uint8_t*)dest)[ 7]= r[Y2];\
- ((uint8_t*)dest)[ 8]= g[Y2];\
- ((uint8_t*)dest)[ 9]= g[Y2];\
- ((uint8_t*)dest)[10]= b[Y2];\
- ((uint8_t*)dest)[11]= b[Y2];\
- dest+=12;\
- }\
- break;\
- case PIX_FMT_RGBA:\
- case PIX_FMT_BGRA:\
- if (CONFIG_SMALL) {\
- int needAlpha = CONFIG_SWSCALE_ALPHA && c->alpPixBuf;\
- func(uint32_t,needAlpha)\
- ((uint32_t*)dest)[i2+0]= r[Y1] + g[Y1] + b[Y1] + (needAlpha ? (A1<<24) : 0);\
- ((uint32_t*)dest)[i2+1]= r[Y2] + g[Y2] + b[Y2] + (needAlpha ? (A2<<24) : 0);\
- }\
- } else {\
- if (CONFIG_SWSCALE_ALPHA && c->alpPixBuf) {\
- func(uint32_t,1)\
- ((uint32_t*)dest)[i2+0]= r[Y1] + g[Y1] + b[Y1] + (A1<<24);\
- ((uint32_t*)dest)[i2+1]= r[Y2] + g[Y2] + b[Y2] + (A2<<24);\
- }\
- } else {\
- func(uint32_t,0)\
- ((uint32_t*)dest)[i2+0]= r[Y1] + g[Y1] + b[Y1];\
- ((uint32_t*)dest)[i2+1]= r[Y2] + g[Y2] + b[Y2];\
- }\
- }\
- }\
- break;\
- case PIX_FMT_ARGB:\
- case PIX_FMT_ABGR:\
- if (CONFIG_SMALL) {\
- int needAlpha = CONFIG_SWSCALE_ALPHA && c->alpPixBuf;\
- func(uint32_t,needAlpha)\
- ((uint32_t*)dest)[i2+0]= r[Y1] + g[Y1] + b[Y1] + (needAlpha ? A1 : 0);\
- ((uint32_t*)dest)[i2+1]= r[Y2] + g[Y2] + b[Y2] + (needAlpha ? A2 : 0);\
- }\
- } else {\
- if (CONFIG_SWSCALE_ALPHA && c->alpPixBuf) {\
- func(uint32_t,1)\
- ((uint32_t*)dest)[i2+0]= r[Y1] + g[Y1] + b[Y1] + A1;\
- ((uint32_t*)dest)[i2+1]= r[Y2] + g[Y2] + b[Y2] + A2;\
- }\
- } else {\
- func(uint32_t,0)\
- ((uint32_t*)dest)[i2+0]= r[Y1] + g[Y1] + b[Y1];\
- ((uint32_t*)dest)[i2+1]= r[Y2] + g[Y2] + b[Y2];\
- }\
- }\
- } \
- break;\
- case PIX_FMT_RGB24:\
- func(uint8_t,0)\
- ((uint8_t*)dest)[0]= r[Y1];\
- ((uint8_t*)dest)[1]= g[Y1];\
- ((uint8_t*)dest)[2]= b[Y1];\
- ((uint8_t*)dest)[3]= r[Y2];\
- ((uint8_t*)dest)[4]= g[Y2];\
- ((uint8_t*)dest)[5]= b[Y2];\
- dest+=6;\
- }\
- break;\
- case PIX_FMT_BGR24:\
- func(uint8_t,0)\
- ((uint8_t*)dest)[0]= b[Y1];\
- ((uint8_t*)dest)[1]= g[Y1];\
- ((uint8_t*)dest)[2]= r[Y1];\
- ((uint8_t*)dest)[3]= b[Y2];\
- ((uint8_t*)dest)[4]= g[Y2];\
- ((uint8_t*)dest)[5]= r[Y2];\
- dest+=6;\
- }\
- break;\
- case PIX_FMT_RGB565:\
- case PIX_FMT_BGR565:\
- {\
- const int dr1= dither_2x2_8[y&1 ][0];\
- const int dg1= dither_2x2_4[y&1 ][0];\
- const int db1= dither_2x2_8[(y&1)^1][0];\
- const int dr2= dither_2x2_8[y&1 ][1];\
- const int dg2= dither_2x2_4[y&1 ][1];\
- const int db2= dither_2x2_8[(y&1)^1][1];\
- func(uint16_t,0)\
- ((uint16_t*)dest)[i2+0]= r[Y1+dr1] + g[Y1+dg1] + b[Y1+db1];\
- ((uint16_t*)dest)[i2+1]= r[Y2+dr2] + g[Y2+dg2] + b[Y2+db2];\
- }\
- }\
- break;\
- case PIX_FMT_RGB555:\
- case PIX_FMT_BGR555:\
- {\
- const int dr1= dither_2x2_8[y&1 ][0];\
- const int dg1= dither_2x2_8[y&1 ][1];\
- const int db1= dither_2x2_8[(y&1)^1][0];\
- const int dr2= dither_2x2_8[y&1 ][1];\
- const int dg2= dither_2x2_8[y&1 ][0];\
- const int db2= dither_2x2_8[(y&1)^1][1];\
- func(uint16_t,0)\
- ((uint16_t*)dest)[i2+0]= r[Y1+dr1] + g[Y1+dg1] + b[Y1+db1];\
- ((uint16_t*)dest)[i2+1]= r[Y2+dr2] + g[Y2+dg2] + b[Y2+db2];\
- }\
- }\
- break;\
- case PIX_FMT_RGB8:\
- case PIX_FMT_BGR8:\
- {\
- const uint8_t * const d64= dither_8x8_73[y&7];\
- const uint8_t * const d32= dither_8x8_32[y&7];\
- func(uint8_t,0)\
- ((uint8_t*)dest)[i2+0]= r[Y1+d32[(i2+0)&7]] + g[Y1+d32[(i2+0)&7]] + b[Y1+d64[(i2+0)&7]];\
- ((uint8_t*)dest)[i2+1]= r[Y2+d32[(i2+1)&7]] + g[Y2+d32[(i2+1)&7]] + b[Y2+d64[(i2+1)&7]];\
- }\
- }\
- break;\
- case PIX_FMT_RGB4:\
- case PIX_FMT_BGR4:\
- {\
- const uint8_t * const d64= dither_8x8_73 [y&7];\
- const uint8_t * const d128=dither_8x8_220[y&7];\
- func(uint8_t,0)\
- ((uint8_t*)dest)[i]= r[Y1+d128[(i2+0)&7]] + g[Y1+d64[(i2+0)&7]] + b[Y1+d128[(i2+0)&7]]\
- + ((r[Y2+d128[(i2+1)&7]] + g[Y2+d64[(i2+1)&7]] + b[Y2+d128[(i2+1)&7]])<<4);\
- }\
- }\
- break;\
- case PIX_FMT_RGB4_BYTE:\
- case PIX_FMT_BGR4_BYTE:\
- {\
- const uint8_t * const d64= dither_8x8_73 [y&7];\
- const uint8_t * const d128=dither_8x8_220[y&7];\
- func(uint8_t,0)\
- ((uint8_t*)dest)[i2+0]= r[Y1+d128[(i2+0)&7]] + g[Y1+d64[(i2+0)&7]] + b[Y1+d128[(i2+0)&7]];\
- ((uint8_t*)dest)[i2+1]= r[Y2+d128[(i2+1)&7]] + g[Y2+d64[(i2+1)&7]] + b[Y2+d128[(i2+1)&7]];\
- }\
- }\
- break;\
- case PIX_FMT_MONOBLACK:\
- case PIX_FMT_MONOWHITE:\
- {\
- func_monoblack\
- }\
- break;\
- case PIX_FMT_YUYV422:\
- func2\
- ((uint8_t*)dest)[2*i2+0]= Y1;\
- ((uint8_t*)dest)[2*i2+1]= U;\
- ((uint8_t*)dest)[2*i2+2]= Y2;\
- ((uint8_t*)dest)[2*i2+3]= V;\
- } \
- break;\
- case PIX_FMT_UYVY422:\
- func2\
- ((uint8_t*)dest)[2*i2+0]= U;\
- ((uint8_t*)dest)[2*i2+1]= Y1;\
- ((uint8_t*)dest)[2*i2+2]= V;\
- ((uint8_t*)dest)[2*i2+3]= Y2;\
- } \
- break;\
- case PIX_FMT_GRAY16BE:\
- func_g16\
- ((uint8_t*)dest)[2*i2+0]= Y1>>8;\
- ((uint8_t*)dest)[2*i2+1]= Y1;\
- ((uint8_t*)dest)[2*i2+2]= Y2>>8;\
- ((uint8_t*)dest)[2*i2+3]= Y2;\
- } \
- break;\
- case PIX_FMT_GRAY16LE:\
- func_g16\
- ((uint8_t*)dest)[2*i2+0]= Y1;\
- ((uint8_t*)dest)[2*i2+1]= Y1>>8;\
- ((uint8_t*)dest)[2*i2+2]= Y2;\
- ((uint8_t*)dest)[2*i2+3]= Y2>>8;\
- } \
- break;\
- }
-
-static inline void yuv2packedXinC(SwsContext *c, const int16_t *lumFilter, const int16_t **lumSrc, int lumFilterSize,
- const int16_t *chrFilter, const int16_t **chrSrc, int chrFilterSize,
- const int16_t **alpSrc, uint8_t *dest, int dstW, int y)
-{
- int i;
- YSCALE_YUV_2_ANYRGB_C(YSCALE_YUV_2_RGBX_C, YSCALE_YUV_2_PACKEDX_C(void,0), YSCALE_YUV_2_GRAY16_C, YSCALE_YUV_2_MONOX_C)
-}
-
-static inline void yuv2rgbXinC_full(SwsContext *c, const int16_t *lumFilter, const int16_t **lumSrc, int lumFilterSize,
- const int16_t *chrFilter, const int16_t **chrSrc, int chrFilterSize,
- const int16_t **alpSrc, uint8_t *dest, int dstW, int y)
-{
- int i;
- int step= c->dstFormatBpp/8;
- int aidx= 3;
-
- switch(c->dstFormat) {
- case PIX_FMT_ARGB:
- dest++;
- aidx= 0;
- case PIX_FMT_RGB24:
- aidx--;
- case PIX_FMT_RGBA:
- if (CONFIG_SMALL) {
- int needAlpha = CONFIG_SWSCALE_ALPHA && c->alpPixBuf;
- YSCALE_YUV_2_RGBX_FULL_C(1<<21, needAlpha)
- dest[aidx]= needAlpha ? A : 255;
- dest[0]= R>>22;
- dest[1]= G>>22;
- dest[2]= B>>22;
- dest+= step;
- }
- } else {
- if (CONFIG_SWSCALE_ALPHA && c->alpPixBuf) {
- YSCALE_YUV_2_RGBX_FULL_C(1<<21, 1)
- dest[aidx]= A;
- dest[0]= R>>22;
- dest[1]= G>>22;
- dest[2]= B>>22;
- dest+= step;
- }
- } else {
- YSCALE_YUV_2_RGBX_FULL_C(1<<21, 0)
- dest[aidx]= 255;
- dest[0]= R>>22;
- dest[1]= G>>22;
- dest[2]= B>>22;
- dest+= step;
- }
- }
- }
- break;
- case PIX_FMT_ABGR:
- dest++;
- aidx= 0;
- case PIX_FMT_BGR24:
- aidx--;
- case PIX_FMT_BGRA:
- if (CONFIG_SMALL) {
- int needAlpha = CONFIG_SWSCALE_ALPHA && c->alpPixBuf;
- YSCALE_YUV_2_RGBX_FULL_C(1<<21, needAlpha)
- dest[aidx]= needAlpha ? A : 255;
- dest[0]= B>>22;
- dest[1]= G>>22;
- dest[2]= R>>22;
- dest+= step;
- }
- } else {
- if (CONFIG_SWSCALE_ALPHA && c->alpPixBuf) {
- YSCALE_YUV_2_RGBX_FULL_C(1<<21, 1)
- dest[aidx]= A;
- dest[0]= B>>22;
- dest[1]= G>>22;
- dest[2]= R>>22;
- dest+= step;
- }
- } else {
- YSCALE_YUV_2_RGBX_FULL_C(1<<21, 0)
- dest[aidx]= 255;
- dest[0]= B>>22;
- dest[1]= G>>22;
- dest[2]= R>>22;
- dest+= step;
- }
- }
- }
- break;
- default:
- assert(0);
- }
-}
-
-static void fillPlane(uint8_t* plane, int stride, int width, int height, int y, uint8_t val)
-{
- int i;
- uint8_t *ptr = plane + stride*y;
- for (i=0; i<height; i++) {
- memset(ptr, val, width);
- ptr += stride;
- }
-}
-
-static inline void rgb48ToY(uint8_t *dst, const uint8_t *src, int width,
- uint32_t *unused)
-{
- int i;
- for (i = 0; i < width; i++) {
- int r = src[i*6+0];
- int g = src[i*6+2];
- int b = src[i*6+4];
-
- dst[i] = (RY*r + GY*g + BY*b + (33<<(RGB2YUV_SHIFT-1))) >> RGB2YUV_SHIFT;
- }
-}
-
-static inline void rgb48ToUV(uint8_t *dstU, uint8_t *dstV,
- const uint8_t *src1, const uint8_t *src2,
- int width, uint32_t *unused)
-{
- int i;
- assert(src1==src2);
- for (i = 0; i < width; i++) {
- int r = src1[6*i + 0];
- int g = src1[6*i + 2];
- int b = src1[6*i + 4];
-
- dstU[i] = (RU*r + GU*g + BU*b + (257<<(RGB2YUV_SHIFT-1))) >> RGB2YUV_SHIFT;
- dstV[i] = (RV*r + GV*g + BV*b + (257<<(RGB2YUV_SHIFT-1))) >> RGB2YUV_SHIFT;
- }
-}
-
-static inline void rgb48ToUV_half(uint8_t *dstU, uint8_t *dstV,
- const uint8_t *src1, const uint8_t *src2,
- int width, uint32_t *unused)
-{
- int i;
- assert(src1==src2);
- for (i = 0; i < width; i++) {
- int r= src1[12*i + 0] + src1[12*i + 6];
- int g= src1[12*i + 2] + src1[12*i + 8];
- int b= src1[12*i + 4] + src1[12*i + 10];
-
- dstU[i]= (RU*r + GU*g + BU*b + (257<<RGB2YUV_SHIFT)) >> (RGB2YUV_SHIFT+1);
- dstV[i]= (RV*r + GV*g + BV*b + (257<<RGB2YUV_SHIFT)) >> (RGB2YUV_SHIFT+1);
- }
-}
-
-#define BGR2Y(type, name, shr, shg, shb, maskr, maskg, maskb, RY, GY, BY, S)\
-static inline void name(uint8_t *dst, const uint8_t *src, long width, uint32_t *unused)\
-{\
- int i;\
- for (i=0; i<width; i++) {\
- int b= (((const type*)src)[i]>>shb)&maskb;\
- int g= (((const type*)src)[i]>>shg)&maskg;\
- int r= (((const type*)src)[i]>>shr)&maskr;\
-\
- dst[i]= (((RY)*r + (GY)*g + (BY)*b + (33<<((S)-1)))>>(S));\
- }\
-}
-
-BGR2Y(uint32_t, bgr32ToY,16, 0, 0, 0x00FF, 0xFF00, 0x00FF, RY<< 8, GY , BY<< 8, RGB2YUV_SHIFT+8)
-BGR2Y(uint32_t, rgb32ToY, 0, 0,16, 0x00FF, 0xFF00, 0x00FF, RY<< 8, GY , BY<< 8, RGB2YUV_SHIFT+8)
-BGR2Y(uint16_t, bgr16ToY, 0, 0, 0, 0x001F, 0x07E0, 0xF800, RY<<11, GY<<5, BY , RGB2YUV_SHIFT+8)
-BGR2Y(uint16_t, bgr15ToY, 0, 0, 0, 0x001F, 0x03E0, 0x7C00, RY<<10, GY<<5, BY , RGB2YUV_SHIFT+7)
-BGR2Y(uint16_t, rgb16ToY, 0, 0, 0, 0xF800, 0x07E0, 0x001F, RY , GY<<5, BY<<11, RGB2YUV_SHIFT+8)
-BGR2Y(uint16_t, rgb15ToY, 0, 0, 0, 0x7C00, 0x03E0, 0x001F, RY , GY<<5, BY<<10, RGB2YUV_SHIFT+7)
-
-static inline void abgrToA(uint8_t *dst, const uint8_t *src, long width, uint32_t *unused)
-{
- int i;
- for (i=0; i<width; i++) {
- dst[i]= src[4*i];
- }
-}
-
-#define BGR2UV(type, name, shr, shg, shb, maska, maskr, maskg, maskb, RU, GU, BU, RV, GV, BV, S)\
-static inline void name(uint8_t *dstU, uint8_t *dstV, const uint8_t *src, const uint8_t *dummy, long width, uint32_t *unused)\
-{\
- int i;\
- for (i=0; i<width; i++) {\
- int b= (((const type*)src)[i]&maskb)>>shb;\
- int g= (((const type*)src)[i]&maskg)>>shg;\
- int r= (((const type*)src)[i]&maskr)>>shr;\
-\
- dstU[i]= ((RU)*r + (GU)*g + (BU)*b + (257<<((S)-1)))>>(S);\
- dstV[i]= ((RV)*r + (GV)*g + (BV)*b + (257<<((S)-1)))>>(S);\
- }\
-}\
-static inline void name ## _half(uint8_t *dstU, uint8_t *dstV, const uint8_t *src, const uint8_t *dummy, long width, uint32_t *unused)\
-{\
- int i;\
- for (i=0; i<width; i++) {\
- int pix0= ((const type*)src)[2*i+0];\
- int pix1= ((const type*)src)[2*i+1];\
- int g= (pix0&~(maskr|maskb))+(pix1&~(maskr|maskb));\
- int b= ((pix0+pix1-g)&(maskb|(2*maskb)))>>shb;\
- int r= ((pix0+pix1-g)&(maskr|(2*maskr)))>>shr;\
- g&= maskg|(2*maskg);\
-\
- g>>=shg;\
-\
- dstU[i]= ((RU)*r + (GU)*g + (BU)*b + (257<<(S)))>>((S)+1);\
- dstV[i]= ((RV)*r + (GV)*g + (BV)*b + (257<<(S)))>>((S)+1);\
- }\
-}
-
-BGR2UV(uint32_t, bgr32ToUV,16, 0, 0, 0xFF000000, 0xFF0000, 0xFF00, 0x00FF, RU<< 8, GU , BU<< 8, RV<< 8, GV , BV<< 8, RGB2YUV_SHIFT+8)
-BGR2UV(uint32_t, rgb32ToUV, 0, 0,16, 0xFF000000, 0x00FF, 0xFF00, 0xFF0000, RU<< 8, GU , BU<< 8, RV<< 8, GV , BV<< 8, RGB2YUV_SHIFT+8)
-BGR2UV(uint16_t, bgr16ToUV, 0, 0, 0, 0, 0x001F, 0x07E0, 0xF800, RU<<11, GU<<5, BU , RV<<11, GV<<5, BV , RGB2YUV_SHIFT+8)
-BGR2UV(uint16_t, bgr15ToUV, 0, 0, 0, 0, 0x001F, 0x03E0, 0x7C00, RU<<10, GU<<5, BU , RV<<10, GV<<5, BV , RGB2YUV_SHIFT+7)
-BGR2UV(uint16_t, rgb16ToUV, 0, 0, 0, 0, 0xF800, 0x07E0, 0x001F, RU , GU<<5, BU<<11, RV , GV<<5, BV<<11, RGB2YUV_SHIFT+8)
-BGR2UV(uint16_t, rgb15ToUV, 0, 0, 0, 0, 0x7C00, 0x03E0, 0x001F, RU , GU<<5, BU<<10, RV , GV<<5, BV<<10, RGB2YUV_SHIFT+7)
-
-static inline void palToY(uint8_t *dst, const uint8_t *src, long width, uint32_t *pal)
-{
- int i;
- for (i=0; i<width; i++) {
- int d= src[i];
-
- dst[i]= pal[d] & 0xFF;
- }
-}
-
-static inline void palToUV(uint8_t *dstU, uint8_t *dstV,
- const uint8_t *src1, const uint8_t *src2,
- long width, uint32_t *pal)
-{
- int i;
- assert(src1 == src2);
- for (i=0; i<width; i++) {
- int p= pal[src1[i]];
-
- dstU[i]= p>>8;
- dstV[i]= p>>16;
- }
-}
-
-static inline void monowhite2Y(uint8_t *dst, const uint8_t *src, long width, uint32_t *unused)
-{
- int i, j;
- for (i=0; i<width/8; i++) {
- int d= ~src[i];
- for(j=0; j<8; j++)
- dst[8*i+j]= ((d>>(7-j))&1)*255;
- }
-}
-
-static inline void monoblack2Y(uint8_t *dst, const uint8_t *src, long width, uint32_t *unused)
-{
- int i, j;
- for (i=0; i<width/8; i++) {
- int d= src[i];
- for(j=0; j<8; j++)
- dst[8*i+j]= ((d>>(7-j))&1)*255;
- }
-}
-
-//Note: we have C, MMX, MMX2, 3DNOW versions, there is no 3DNOW+MMX2 one
-//Plain C versions
-#if ((!HAVE_MMX || !CONFIG_GPL) && !HAVE_ALTIVEC) || CONFIG_RUNTIME_CPUDETECT
-#define COMPILE_C
-#endif
-
-#if ARCH_PPC
-#if HAVE_ALTIVEC || CONFIG_RUNTIME_CPUDETECT
-#define COMPILE_ALTIVEC
-#endif
-#endif //ARCH_PPC
-
-#if ARCH_X86
-
-#if ((HAVE_MMX && !HAVE_AMD3DNOW && !HAVE_MMX2) || CONFIG_RUNTIME_CPUDETECT) && CONFIG_GPL
-#define COMPILE_MMX
-#endif
-
-#if (HAVE_MMX2 || CONFIG_RUNTIME_CPUDETECT) && CONFIG_GPL
-#define COMPILE_MMX2
-#endif
-
-#if ((HAVE_AMD3DNOW && !HAVE_MMX2) || CONFIG_RUNTIME_CPUDETECT) && CONFIG_GPL
-#define COMPILE_3DNOW
-#endif
-#endif //ARCH_X86
-
-#define COMPILE_TEMPLATE_MMX 0
-#define COMPILE_TEMPLATE_MMX2 0
-#define COMPILE_TEMPLATE_AMD3DNOW 0
-#define COMPILE_TEMPLATE_ALTIVEC 0
-
-#ifdef COMPILE_C
-#define RENAME(a) a ## _C
-#include "swscale_template.c"
-#endif
-
-#ifdef COMPILE_ALTIVEC
-#undef RENAME
-#undef COMPILE_TEMPLATE_ALTIVEC
-#define COMPILE_TEMPLATE_ALTIVEC 1
-#define RENAME(a) a ## _altivec
-#include "swscale_template.c"
-#endif
-
-#if ARCH_X86
-
-//MMX versions
-#ifdef COMPILE_MMX
-#undef RENAME
-#undef COMPILE_TEMPLATE_MMX
-#undef COMPILE_TEMPLATE_MMX2
-#undef COMPILE_TEMPLATE_AMD3DNOW
-#define COMPILE_TEMPLATE_MMX 1
-#define COMPILE_TEMPLATE_MMX2 0
-#define COMPILE_TEMPLATE_AMD3DNOW 0
-#define RENAME(a) a ## _MMX
-#include "swscale_template.c"
-#endif
-
-//MMX2 versions
-#ifdef COMPILE_MMX2
-#undef RENAME
-#undef COMPILE_TEMPLATE_MMX
-#undef COMPILE_TEMPLATE_MMX2
-#undef COMPILE_TEMPLATE_AMD3DNOW
-#define COMPILE_TEMPLATE_MMX 1
-#define COMPILE_TEMPLATE_MMX2 1
-#define COMPILE_TEMPLATE_AMD3DNOW 0
-#define RENAME(a) a ## _MMX2
-#include "swscale_template.c"
-#endif
-
-//3DNOW versions
-#ifdef COMPILE_3DNOW
-#undef RENAME
-#undef COMPILE_TEMPLATE_MMX
-#undef COMPILE_TEMPLATE_MMX2
-#undef COMPILE_TEMPLATE_AMD3DNOW
-#define COMPILE_TEMPLATE_MMX 1
-#define COMPILE_TEMPLATE_MMX2 0
-#define COMPILE_TEMPLATE_AMD3DNOW 1
-#define RENAME(a) a ## _3DNow
-#include "swscale_template.c"
-#endif
-
-#endif //ARCH_X86
-
-SwsFunc ff_getSwsFunc(SwsContext *c)
-{
-#if CONFIG_RUNTIME_CPUDETECT
- int flags = c->flags;
-
-#if ARCH_X86 && CONFIG_GPL
- // ordered per speed fastest first
- if (flags & SWS_CPU_CAPS_MMX2) {
- sws_init_swScale_MMX2(c);
- return swScale_MMX2;
- } else if (flags & SWS_CPU_CAPS_3DNOW) {
- sws_init_swScale_3DNow(c);
- return swScale_3DNow;
- } else if (flags & SWS_CPU_CAPS_MMX) {
- sws_init_swScale_MMX(c);
- return swScale_MMX;
- } else {
- sws_init_swScale_C(c);
- return swScale_C;
- }
-
-#else
-#if ARCH_PPC
- if (flags & SWS_CPU_CAPS_ALTIVEC) {
- sws_init_swScale_altivec(c);
- return swScale_altivec;
- } else {
- sws_init_swScale_C(c);
- return swScale_C;
- }
-#endif
- sws_init_swScale_C(c);
- return swScale_C;
-#endif /* ARCH_X86 && CONFIG_GPL */
-#else //CONFIG_RUNTIME_CPUDETECT
-#if COMPILE_TEMPLATE_MMX2
- sws_init_swScale_MMX2(c);
- return swScale_MMX2;
-#elif COMPILE_TEMPLATE_AMD3DNOW
- sws_init_swScale_3DNow(c);
- return swScale_3DNow;
-#elif COMPILE_TEMPLATE_MMX
- sws_init_swScale_MMX(c);
- return swScale_MMX;
-#elif COMPILE_TEMPLATE_ALTIVEC
- sws_init_swScale_altivec(c);
- return swScale_altivec;
-#else
- sws_init_swScale_C(c);
- return swScale_C;
-#endif
-#endif //!CONFIG_RUNTIME_CPUDETECT
-}
-
-static int planarToNv12Wrapper(SwsContext *c, const uint8_t* src[], int srcStride[], int srcSliceY,
- int srcSliceH, uint8_t* dstParam[], int dstStride[])
-{
- uint8_t *dst=dstParam[0] + dstStride[0]*srcSliceY;
- /* Copy Y plane */
- if (dstStride[0]==srcStride[0] && srcStride[0] > 0)
- memcpy(dst, src[0], srcSliceH*dstStride[0]);
- else {
- int i;
- const uint8_t *srcPtr= src[0];
- uint8_t *dstPtr= dst;
- for (i=0; i<srcSliceH; i++) {
- memcpy(dstPtr, srcPtr, c->srcW);
- srcPtr+= srcStride[0];
- dstPtr+= dstStride[0];
- }
- }
- dst = dstParam[1] + dstStride[1]*srcSliceY/2;
- if (c->dstFormat == PIX_FMT_NV12)
- interleaveBytes(src[1], src[2], dst, c->srcW/2, srcSliceH/2, srcStride[1], srcStride[2], dstStride[0]);
- else
- interleaveBytes(src[2], src[1], dst, c->srcW/2, srcSliceH/2, srcStride[2], srcStride[1], dstStride[0]);
-
- return srcSliceH;
-}
-
-static int planarToYuy2Wrapper(SwsContext *c, const uint8_t* src[], int srcStride[], int srcSliceY,
- int srcSliceH, uint8_t* dstParam[], int dstStride[])
-{
- uint8_t *dst=dstParam[0] + dstStride[0]*srcSliceY;
-
- yv12toyuy2(src[0], src[1], src[2], dst, c->srcW, srcSliceH, srcStride[0], srcStride[1], dstStride[0]);
-
- return srcSliceH;
-}
-
-static int planarToUyvyWrapper(SwsContext *c, const uint8_t* src[], int srcStride[], int srcSliceY,
- int srcSliceH, uint8_t* dstParam[], int dstStride[])
-{
- uint8_t *dst=dstParam[0] + dstStride[0]*srcSliceY;
-
- yv12touyvy(src[0], src[1], src[2], dst, c->srcW, srcSliceH, srcStride[0], srcStride[1], dstStride[0]);
-
- return srcSliceH;
-}
-
-static int yuv422pToYuy2Wrapper(SwsContext *c, const uint8_t* src[], int srcStride[], int srcSliceY,
- int srcSliceH, uint8_t* dstParam[], int dstStride[])
-{
- uint8_t *dst=dstParam[0] + dstStride[0]*srcSliceY;
-
- yuv422ptoyuy2(src[0],src[1],src[2],dst,c->srcW,srcSliceH,srcStride[0],srcStride[1],dstStride[0]);
-
- return srcSliceH;
-}
-
-static int yuv422pToUyvyWrapper(SwsContext *c, const uint8_t* src[], int srcStride[], int srcSliceY,
- int srcSliceH, uint8_t* dstParam[], int dstStride[])
-{
- uint8_t *dst=dstParam[0] + dstStride[0]*srcSliceY;
-
- yuv422ptouyvy(src[0],src[1],src[2],dst,c->srcW,srcSliceH,srcStride[0],srcStride[1],dstStride[0]);
-
- return srcSliceH;
-}
-
-static int yuyvToYuv420Wrapper(SwsContext *c, const uint8_t* src[], int srcStride[], int srcSliceY,
- int srcSliceH, uint8_t* dstParam[], int dstStride[])
-{
- uint8_t *ydst=dstParam[0] + dstStride[0]*srcSliceY;
- uint8_t *udst=dstParam[1] + dstStride[1]*srcSliceY/2;
- uint8_t *vdst=dstParam[2] + dstStride[2]*srcSliceY/2;
-
- yuyvtoyuv420(ydst, udst, vdst, src[0], c->srcW, srcSliceH, dstStride[0], dstStride[1], srcStride[0]);
-
- if (dstParam[3])
- fillPlane(dstParam[3], dstStride[3], c->srcW, srcSliceH, srcSliceY, 255);
-
- return srcSliceH;
-}
-
-static int yuyvToYuv422Wrapper(SwsContext *c, const uint8_t* src[], int srcStride[], int srcSliceY,
- int srcSliceH, uint8_t* dstParam[], int dstStride[])
-{
- uint8_t *ydst=dstParam[0] + dstStride[0]*srcSliceY;
- uint8_t *udst=dstParam[1] + dstStride[1]*srcSliceY;
- uint8_t *vdst=dstParam[2] + dstStride[2]*srcSliceY;
-
- yuyvtoyuv422(ydst, udst, vdst, src[0], c->srcW, srcSliceH, dstStride[0], dstStride[1], srcStride[0]);
-
- return srcSliceH;
-}
-
-static int uyvyToYuv420Wrapper(SwsContext *c, const uint8_t* src[], int srcStride[], int srcSliceY,
- int srcSliceH, uint8_t* dstParam[], int dstStride[])
-{
- uint8_t *ydst=dstParam[0] + dstStride[0]*srcSliceY;
- uint8_t *udst=dstParam[1] + dstStride[1]*srcSliceY/2;
- uint8_t *vdst=dstParam[2] + dstStride[2]*srcSliceY/2;
-
- uyvytoyuv420(ydst, udst, vdst, src[0], c->srcW, srcSliceH, dstStride[0], dstStride[1], srcStride[0]);
-
- if (dstParam[3])
- fillPlane(dstParam[3], dstStride[3], c->srcW, srcSliceH, srcSliceY, 255);
-
- return srcSliceH;
-}
-
-static int uyvyToYuv422Wrapper(SwsContext *c, const uint8_t* src[], int srcStride[], int srcSliceY,
- int srcSliceH, uint8_t* dstParam[], int dstStride[])
-{
- uint8_t *ydst=dstParam[0] + dstStride[0]*srcSliceY;
- uint8_t *udst=dstParam[1] + dstStride[1]*srcSliceY;
- uint8_t *vdst=dstParam[2] + dstStride[2]*srcSliceY;
-
- uyvytoyuv422(ydst, udst, vdst, src[0], c->srcW, srcSliceH, dstStride[0], dstStride[1], srcStride[0]);
-
- return srcSliceH;
-}
-
-static int palToRgbWrapper(SwsContext *c, const uint8_t* src[], int srcStride[], int srcSliceY,
- int srcSliceH, uint8_t* dst[], int dstStride[])
-{
- const enum PixelFormat srcFormat= c->srcFormat;
- const enum PixelFormat dstFormat= c->dstFormat;
- void (*conv)(const uint8_t *src, uint8_t *dst, long num_pixels,
- const uint8_t *palette)=NULL;
- int i;
- uint8_t *dstPtr= dst[0] + dstStride[0]*srcSliceY;
- const uint8_t *srcPtr= src[0];
-
- if (usePal(srcFormat)) {
- switch (dstFormat) {
- case PIX_FMT_RGB32 : conv = palette8topacked32; break;
- case PIX_FMT_BGR32 : conv = palette8topacked32; break;
- case PIX_FMT_BGR32_1: conv = palette8topacked32; break;
- case PIX_FMT_RGB32_1: conv = palette8topacked32; break;
- case PIX_FMT_RGB24 : conv = palette8topacked24; break;
- case PIX_FMT_BGR24 : conv = palette8topacked24; break;
- }
- }
-
- if (!conv)
- av_log(c, AV_LOG_ERROR, "internal error %s -> %s converter\n",
- sws_format_name(srcFormat), sws_format_name(dstFormat));
- else {
- for (i=0; i<srcSliceH; i++) {
- conv(srcPtr, dstPtr, c->srcW, (uint8_t *) c->pal_rgb);
- srcPtr+= srcStride[0];
- dstPtr+= dstStride[0];
- }
- }
-
- return srcSliceH;
-}
-
-/* {RGB,BGR}{15,16,24,32,32_1} -> {RGB,BGR}{15,16,24,32} */
-static int rgbToRgbWrapper(SwsContext *c, const uint8_t* src[], int srcStride[], int srcSliceY,
- int srcSliceH, uint8_t* dst[], int dstStride[])
-{
- const enum PixelFormat srcFormat= c->srcFormat;
- const enum PixelFormat dstFormat= c->dstFormat;
- const int srcBpp= (c->srcFormatBpp + 7) >> 3;
- const int dstBpp= (c->dstFormatBpp + 7) >> 3;
- const int srcId= c->srcFormatBpp >> 2; /* 1:0, 4:1, 8:2, 15:3, 16:4, 24:6, 32:8 */
- const int dstId= c->dstFormatBpp >> 2;
- void (*conv)(const uint8_t *src, uint8_t *dst, long src_size)=NULL;
-
- /* BGR -> BGR */
- if ( (isBGRinInt(srcFormat) && isBGRinInt(dstFormat))
- || (isRGBinInt(srcFormat) && isRGBinInt(dstFormat))) {
- switch(srcId | (dstId<<4)) {
- case 0x34: conv= rgb16to15; break;
- case 0x36: conv= rgb24to15; break;
- case 0x38: conv= rgb32to15; break;
- case 0x43: conv= rgb15to16; break;
- case 0x46: conv= rgb24to16; break;
- case 0x48: conv= rgb32to16; break;
- case 0x63: conv= rgb15to24; break;
- case 0x64: conv= rgb16to24; break;
- case 0x68: conv= rgb32to24; break;
- case 0x83: conv= rgb15to32; break;
- case 0x84: conv= rgb16to32; break;
- case 0x86: conv= rgb24to32; break;
- }
- } else if ( (isBGRinInt(srcFormat) && isRGBinInt(dstFormat))
- || (isRGBinInt(srcFormat) && isBGRinInt(dstFormat))) {
- switch(srcId | (dstId<<4)) {
- case 0x33: conv= rgb15tobgr15; break;
- case 0x34: conv= rgb16tobgr15; break;
- case 0x36: conv= rgb24tobgr15; break;
- case 0x38: conv= rgb32tobgr15; break;
- case 0x43: conv= rgb15tobgr16; break;
- case 0x44: conv= rgb16tobgr16; break;
- case 0x46: conv= rgb24tobgr16; break;
- case 0x48: conv= rgb32tobgr16; break;
- case 0x63: conv= rgb15tobgr24; break;
- case 0x64: conv= rgb16tobgr24; break;
- case 0x66: conv= rgb24tobgr24; break;
- case 0x68: conv= rgb32tobgr24; break;
- case 0x83: conv= rgb15tobgr32; break;
- case 0x84: conv= rgb16tobgr32; break;
- case 0x86: conv= rgb24tobgr32; break;
- case 0x88: conv= rgb32tobgr32; break;
- }
- }
-
- if (!conv) {
- av_log(c, AV_LOG_ERROR, "internal error %s -> %s converter\n",
- sws_format_name(srcFormat), sws_format_name(dstFormat));
- } else {
- const uint8_t *srcPtr= src[0];
- if(srcFormat == PIX_FMT_RGB32_1 || srcFormat == PIX_FMT_BGR32_1)
- srcPtr += ALT32_CORR;
-
- if (dstStride[0]*srcBpp == srcStride[0]*dstBpp && srcStride[0] > 0)
- conv(srcPtr, dst[0] + dstStride[0]*srcSliceY, srcSliceH*srcStride[0]);
- else {
- int i;
- uint8_t *dstPtr= dst[0] + dstStride[0]*srcSliceY;
-
- for (i=0; i<srcSliceH; i++) {
- conv(srcPtr, dstPtr, c->srcW*srcBpp);
- srcPtr+= srcStride[0];
- dstPtr+= dstStride[0];
- }
- }
- }
- return srcSliceH;
-}
-
-static int bgr24ToYv12Wrapper(SwsContext *c, const uint8_t* src[], int srcStride[], int srcSliceY,
- int srcSliceH, uint8_t* dst[], int dstStride[])
-{
- rgb24toyv12(
- src[0],
- dst[0]+ srcSliceY *dstStride[0],
- dst[1]+(srcSliceY>>1)*dstStride[1],
- dst[2]+(srcSliceY>>1)*dstStride[2],
- c->srcW, srcSliceH,
- dstStride[0], dstStride[1], srcStride[0]);
- if (dst[3])
- fillPlane(dst[3], dstStride[3], c->srcW, srcSliceH, srcSliceY, 255);
- return srcSliceH;
-}
-
-static int yvu9ToYv12Wrapper(SwsContext *c, const uint8_t* src[], int srcStride[], int srcSliceY,
- int srcSliceH, uint8_t* dst[], int dstStride[])
-{
- int i;
-
- /* copy Y */
- if (srcStride[0]==dstStride[0] && srcStride[0] > 0)
- memcpy(dst[0]+ srcSliceY*dstStride[0], src[0], srcStride[0]*srcSliceH);
- else {
- const uint8_t *srcPtr= src[0];
- uint8_t *dstPtr= dst[0] + dstStride[0]*srcSliceY;
-
- for (i=0; i<srcSliceH; i++) {
- memcpy(dstPtr, srcPtr, c->srcW);
- srcPtr+= srcStride[0];
- dstPtr+= dstStride[0];
- }
- }
-
- if (c->dstFormat==PIX_FMT_YUV420P || c->dstFormat==PIX_FMT_YUVA420P) {
- planar2x(src[1], dst[1] + dstStride[1]*(srcSliceY >> 1), c->chrSrcW,
- srcSliceH >> 2, srcStride[1], dstStride[1]);
- planar2x(src[2], dst[2] + dstStride[2]*(srcSliceY >> 1), c->chrSrcW,
- srcSliceH >> 2, srcStride[2], dstStride[2]);
- } else {
- planar2x(src[1], dst[2] + dstStride[2]*(srcSliceY >> 1), c->chrSrcW,
- srcSliceH >> 2, srcStride[1], dstStride[2]);
- planar2x(src[2], dst[1] + dstStride[1]*(srcSliceY >> 1), c->chrSrcW,
- srcSliceH >> 2, srcStride[2], dstStride[1]);
- }
- if (dst[3])
- fillPlane(dst[3], dstStride[3], c->srcW, srcSliceH, srcSliceY, 255);
- return srcSliceH;
-}
-
-/* unscaled copy like stuff (assumes nearly identical formats) */
-static int packedCopyWrapper(SwsContext *c, const uint8_t* src[], int srcStride[], int srcSliceY,
- int srcSliceH, uint8_t* dst[], int dstStride[])
-{
- if (dstStride[0]==srcStride[0] && srcStride[0] > 0)
- memcpy(dst[0] + dstStride[0]*srcSliceY, src[0], srcSliceH*dstStride[0]);
- else {
- int i;
- const uint8_t *srcPtr= src[0];
- uint8_t *dstPtr= dst[0] + dstStride[0]*srcSliceY;
- int length=0;
-
- /* universal length finder */
- while(length+c->srcW <= FFABS(dstStride[0])
- && length+c->srcW <= FFABS(srcStride[0])) length+= c->srcW;
- assert(length!=0);
-
- for (i=0; i<srcSliceH; i++) {
- memcpy(dstPtr, srcPtr, length);
- srcPtr+= srcStride[0];
- dstPtr+= dstStride[0];
- }
- }
- return srcSliceH;
-}
-
-static int planarCopyWrapper(SwsContext *c, const uint8_t* src[], int srcStride[], int srcSliceY,
- int srcSliceH, uint8_t* dst[], int dstStride[])
-{
- int plane, i, j;
- for (plane=0; plane<4; plane++) {
- int length= (plane==0 || plane==3) ? c->srcW : -((-c->srcW )>>c->chrDstHSubSample);
- int y= (plane==0 || plane==3) ? srcSliceY: -((-srcSliceY)>>c->chrDstVSubSample);
- int height= (plane==0 || plane==3) ? srcSliceH: -((-srcSliceH)>>c->chrDstVSubSample);
- const uint8_t *srcPtr= src[plane];
- uint8_t *dstPtr= dst[plane] + dstStride[plane]*y;
-
- if (!dst[plane]) continue;
- // ignore palette for GRAY8
- if (plane == 1 && !dst[2]) continue;
- if (!src[plane] || (plane == 1 && !src[2])) {
- if(is16BPS(c->dstFormat))
- length*=2;
- fillPlane(dst[plane], dstStride[plane], length, height, y, (plane==3) ? 255 : 128);
- } else {
- if(is16BPS(c->srcFormat) && !is16BPS(c->dstFormat)) {
- if (!isBE(c->srcFormat)) srcPtr++;
- for (i=0; i<height; i++) {
- for (j=0; j<length; j++) dstPtr[j] = srcPtr[j<<1];
- srcPtr+= srcStride[plane];
- dstPtr+= dstStride[plane];
- }
- } else if(!is16BPS(c->srcFormat) && is16BPS(c->dstFormat)) {
- for (i=0; i<height; i++) {
- for (j=0; j<length; j++) {
- dstPtr[ j<<1 ] = srcPtr[j];
- dstPtr[(j<<1)+1] = srcPtr[j];
- }
- srcPtr+= srcStride[plane];
- dstPtr+= dstStride[plane];
- }
- } else if(is16BPS(c->srcFormat) && is16BPS(c->dstFormat)
- && isBE(c->srcFormat) != isBE(c->dstFormat)) {
-
- for (i=0; i<height; i++) {
- for (j=0; j<length; j++)
- ((uint16_t*)dstPtr)[j] = bswap_16(((const uint16_t*)srcPtr)[j]);
- srcPtr+= srcStride[plane];
- dstPtr+= dstStride[plane];
- }
- } else if (dstStride[plane]==srcStride[plane] && srcStride[plane] > 0)
- memcpy(dst[plane] + dstStride[plane]*y, src[plane], height*dstStride[plane]);
- else {
- if(is16BPS(c->srcFormat) && is16BPS(c->dstFormat))
- length*=2;
- for (i=0; i<height; i++) {
- memcpy(dstPtr, srcPtr, length);
- srcPtr+= srcStride[plane];
- dstPtr+= dstStride[plane];
- }
- }
- }
- }
- return srcSliceH;
-}
-
-int ff_hardcodedcpuflags(void)
-{
- int flags = 0;
-#if COMPILE_TEMPLATE_MMX2
- flags |= SWS_CPU_CAPS_MMX|SWS_CPU_CAPS_MMX2;
-#elif COMPILE_TEMPLATE_AMD3DNOW
- flags |= SWS_CPU_CAPS_MMX|SWS_CPU_CAPS_3DNOW;
-#elif COMPILE_TEMPLATE_MMX
- flags |= SWS_CPU_CAPS_MMX;
-#elif COMPILE_TEMPLATE_ALTIVEC
- flags |= SWS_CPU_CAPS_ALTIVEC;
-#elif ARCH_BFIN
- flags |= SWS_CPU_CAPS_BFIN;
-#endif
- return flags;
-}
-
-void ff_get_unscaled_swscale(SwsContext *c)
-{
- const enum PixelFormat srcFormat = c->srcFormat;
- const enum PixelFormat dstFormat = c->dstFormat;
- const int flags = c->flags;
- const int dstH = c->dstH;
- int needsDither;
-
- needsDither= isAnyRGB(dstFormat)
- && c->dstFormatBpp < 24
- && (c->dstFormatBpp < c->srcFormatBpp || (!isAnyRGB(srcFormat)));
-
- /* yv12_to_nv12 */
- if ((srcFormat == PIX_FMT_YUV420P || srcFormat == PIX_FMT_YUVA420P) && (dstFormat == PIX_FMT_NV12 || dstFormat == PIX_FMT_NV21)) {
- c->swScale= planarToNv12Wrapper;
- }
- /* yuv2bgr */
- if ((srcFormat==PIX_FMT_YUV420P || srcFormat==PIX_FMT_YUV422P || srcFormat==PIX_FMT_YUVA420P) && isAnyRGB(dstFormat)
- && !(flags & SWS_ACCURATE_RND) && !(dstH&1)) {
- c->swScale= ff_yuv2rgb_get_func_ptr(c);
- }
-
- if (srcFormat==PIX_FMT_YUV410P && (dstFormat==PIX_FMT_YUV420P || dstFormat==PIX_FMT_YUVA420P) && !(flags & SWS_BITEXACT)) {
- c->swScale= yvu9ToYv12Wrapper;
- }
-
- /* bgr24toYV12 */
- if (srcFormat==PIX_FMT_BGR24 && (dstFormat==PIX_FMT_YUV420P || dstFormat==PIX_FMT_YUVA420P) && !(flags & SWS_ACCURATE_RND))
- c->swScale= bgr24ToYv12Wrapper;
-
- /* RGB/BGR -> RGB/BGR (no dither needed forms) */
- if ( isAnyRGB(srcFormat)
- && isAnyRGB(dstFormat)
- && srcFormat != PIX_FMT_BGR8 && dstFormat != PIX_FMT_BGR8
- && srcFormat != PIX_FMT_RGB8 && dstFormat != PIX_FMT_RGB8
- && srcFormat != PIX_FMT_BGR4 && dstFormat != PIX_FMT_BGR4
- && srcFormat != PIX_FMT_RGB4 && dstFormat != PIX_FMT_RGB4
- && srcFormat != PIX_FMT_BGR4_BYTE && dstFormat != PIX_FMT_BGR4_BYTE
- && srcFormat != PIX_FMT_RGB4_BYTE && dstFormat != PIX_FMT_RGB4_BYTE
- && srcFormat != PIX_FMT_MONOBLACK && dstFormat != PIX_FMT_MONOBLACK
- && srcFormat != PIX_FMT_MONOWHITE && dstFormat != PIX_FMT_MONOWHITE
- && dstFormat != PIX_FMT_RGB32_1
- && dstFormat != PIX_FMT_BGR32_1
- && srcFormat != PIX_FMT_RGB48LE && dstFormat != PIX_FMT_RGB48LE
- && srcFormat != PIX_FMT_RGB48BE && dstFormat != PIX_FMT_RGB48BE
- && (!needsDither || (c->flags&(SWS_FAST_BILINEAR|SWS_POINT))))
- c->swScale= rgbToRgbWrapper;
-
- if ((usePal(srcFormat) && (
- dstFormat == PIX_FMT_RGB32 ||
- dstFormat == PIX_FMT_RGB32_1 ||
- dstFormat == PIX_FMT_RGB24 ||
- dstFormat == PIX_FMT_BGR32 ||
- dstFormat == PIX_FMT_BGR32_1 ||
- dstFormat == PIX_FMT_BGR24)))
- c->swScale= palToRgbWrapper;
-
- if (srcFormat == PIX_FMT_YUV422P) {
- if (dstFormat == PIX_FMT_YUYV422)
- c->swScale= yuv422pToYuy2Wrapper;
- else if (dstFormat == PIX_FMT_UYVY422)
- c->swScale= yuv422pToUyvyWrapper;
- }
-
- /* LQ converters if -sws 0 or -sws 4*/
- if (c->flags&(SWS_FAST_BILINEAR|SWS_POINT)) {
- /* yv12_to_yuy2 */
- if (srcFormat == PIX_FMT_YUV420P || srcFormat == PIX_FMT_YUVA420P) {
- if (dstFormat == PIX_FMT_YUYV422)
- c->swScale= planarToYuy2Wrapper;
- else if (dstFormat == PIX_FMT_UYVY422)
- c->swScale= planarToUyvyWrapper;
- }
- }
- if(srcFormat == PIX_FMT_YUYV422 && (dstFormat == PIX_FMT_YUV420P || dstFormat == PIX_FMT_YUVA420P))
- c->swScale= yuyvToYuv420Wrapper;
- if(srcFormat == PIX_FMT_UYVY422 && (dstFormat == PIX_FMT_YUV420P || dstFormat == PIX_FMT_YUVA420P))
- c->swScale= uyvyToYuv420Wrapper;
- if(srcFormat == PIX_FMT_YUYV422 && dstFormat == PIX_FMT_YUV422P)
- c->swScale= yuyvToYuv422Wrapper;
- if(srcFormat == PIX_FMT_UYVY422 && dstFormat == PIX_FMT_YUV422P)
- c->swScale= uyvyToYuv422Wrapper;
-
-#ifdef COMPILE_ALTIVEC
- if ((c->flags & SWS_CPU_CAPS_ALTIVEC) &&
- !(c->flags & SWS_BITEXACT) &&
- srcFormat == PIX_FMT_YUV420P) {
- // unscaled YV12 -> packed YUV, we want speed
- if (dstFormat == PIX_FMT_YUYV422)
- c->swScale= yv12toyuy2_unscaled_altivec;
- else if (dstFormat == PIX_FMT_UYVY422)
- c->swScale= yv12touyvy_unscaled_altivec;
- }
-#endif
-
- /* simple copy */
- if ( srcFormat == dstFormat
- || (srcFormat == PIX_FMT_YUVA420P && dstFormat == PIX_FMT_YUV420P)
- || (srcFormat == PIX_FMT_YUV420P && dstFormat == PIX_FMT_YUVA420P)
- || (isPlanarYUV(srcFormat) && isGray(dstFormat))
- || (isPlanarYUV(dstFormat) && isGray(srcFormat))
- || (isGray(dstFormat) && isGray(srcFormat))
- || (isPlanarYUV(srcFormat) && isPlanarYUV(dstFormat)
- && c->chrDstHSubSample == c->chrSrcHSubSample
- && c->chrDstVSubSample == c->chrSrcVSubSample
- && dstFormat != PIX_FMT_NV12 && dstFormat != PIX_FMT_NV21
- && srcFormat != PIX_FMT_NV12 && srcFormat != PIX_FMT_NV21))
- {
- if (isPacked(c->srcFormat))
- c->swScale= packedCopyWrapper;
- else /* Planar YUV or gray */
- c->swScale= planarCopyWrapper;
- }
-#if ARCH_BFIN
- if (flags & SWS_CPU_CAPS_BFIN)
- ff_bfin_get_unscaled_swscale (c);
-#endif
-}
-
-static void reset_ptr(const uint8_t* src[], int format)
-{
- if(!isALPHA(format))
- src[3]=NULL;
- if(!isPlanarYUV(format)) {
- src[3]=src[2]=NULL;
-
- if (!usePal(format))
- src[1]= NULL;
- }
-}
-
-/**
- * swscale wrapper, so we don't need to export the SwsContext.
- * Assumes planar YUV to be in YUV order instead of YVU.
- */
-int sws_scale(SwsContext *c, const uint8_t* const src[], const int srcStride[], int srcSliceY,
- int srcSliceH, uint8_t* const dst[], const int dstStride[])
-{
- int i;
- const uint8_t* src2[4]= {src[0], src[1], src[2], src[3]};
- uint8_t* dst2[4]= {dst[0], dst[1], dst[2], dst[3]};
-
- // do not mess up sliceDir if we have a "trailing" 0-size slice
- if (srcSliceH == 0)
- return 0;
-
- if (c->sliceDir == 0 && srcSliceY != 0 && srcSliceY + srcSliceH != c->srcH) {
- av_log(c, AV_LOG_ERROR, "Slices start in the middle!\n");
- return 0;
- }
- if (c->sliceDir == 0) {
- if (srcSliceY == 0) c->sliceDir = 1; else c->sliceDir = -1;
- }
-
- if (usePal(c->srcFormat)) {
- for (i=0; i<256; i++) {
- int p, r, g, b,y,u,v;
- if(c->srcFormat == PIX_FMT_PAL8) {
- p=((const uint32_t*)(src[1]))[i];
- r= (p>>16)&0xFF;
- g= (p>> 8)&0xFF;
- b= p &0xFF;
- } else if(c->srcFormat == PIX_FMT_RGB8) {
- r= (i>>5 )*36;
- g= ((i>>2)&7)*36;
- b= (i&3 )*85;
- } else if(c->srcFormat == PIX_FMT_BGR8) {
- b= (i>>6 )*85;
- g= ((i>>3)&7)*36;
- r= (i&7 )*36;
- } else if(c->srcFormat == PIX_FMT_RGB4_BYTE) {
- r= (i>>3 )*255;
- g= ((i>>1)&3)*85;
- b= (i&1 )*255;
- } else {
- assert(c->srcFormat == PIX_FMT_BGR4_BYTE);
- b= (i>>3 )*255;
- g= ((i>>1)&3)*85;
- r= (i&1 )*255;
- }
- y= av_clip_uint8((RY*r + GY*g + BY*b + ( 33<<(RGB2YUV_SHIFT-1)))>>RGB2YUV_SHIFT);
- u= av_clip_uint8((RU*r + GU*g + BU*b + (257<<(RGB2YUV_SHIFT-1)))>>RGB2YUV_SHIFT);
- v= av_clip_uint8((RV*r + GV*g + BV*b + (257<<(RGB2YUV_SHIFT-1)))>>RGB2YUV_SHIFT);
- c->pal_yuv[i]= y + (u<<8) + (v<<16);
-
- switch(c->dstFormat) {
- case PIX_FMT_BGR32:
-#if !HAVE_BIGENDIAN
- case PIX_FMT_RGB24:
-#endif
- c->pal_rgb[i]= r + (g<<8) + (b<<16);
- break;
- case PIX_FMT_BGR32_1:
-#if HAVE_BIGENDIAN
- case PIX_FMT_BGR24:
-#endif
- c->pal_rgb[i]= (r + (g<<8) + (b<<16)) << 8;
- break;
- case PIX_FMT_RGB32_1:
-#if HAVE_BIGENDIAN
- case PIX_FMT_RGB24:
-#endif
- c->pal_rgb[i]= (b + (g<<8) + (r<<16)) << 8;
- break;
- case PIX_FMT_RGB32:
-#if !HAVE_BIGENDIAN
- case PIX_FMT_BGR24:
-#endif
- default:
- c->pal_rgb[i]= b + (g<<8) + (r<<16);
- }
- }
- }
-
- // copy strides, so they can safely be modified
- if (c->sliceDir == 1) {
- // slices go from top to bottom
- int srcStride2[4]= {srcStride[0], srcStride[1], srcStride[2], srcStride[3]};
- int dstStride2[4]= {dstStride[0], dstStride[1], dstStride[2], dstStride[3]};
-
- reset_ptr(src2, c->srcFormat);
- reset_ptr((const uint8_t**)dst2, c->dstFormat);
-
- /* reset slice direction at end of frame */
- if (srcSliceY + srcSliceH == c->srcH)
- c->sliceDir = 0;
-
- return c->swScale(c, src2, srcStride2, srcSliceY, srcSliceH, dst2, dstStride2);
- } else {
- // slices go from bottom to top => we flip the image internally
- int srcStride2[4]= {-srcStride[0], -srcStride[1], -srcStride[2], -srcStride[3]};
- int dstStride2[4]= {-dstStride[0], -dstStride[1], -dstStride[2], -dstStride[3]};
-
- src2[0] += (srcSliceH-1)*srcStride[0];
- if (!usePal(c->srcFormat))
- src2[1] += ((srcSliceH>>c->chrSrcVSubSample)-1)*srcStride[1];
- src2[2] += ((srcSliceH>>c->chrSrcVSubSample)-1)*srcStride[2];
- src2[3] += (srcSliceH-1)*srcStride[3];
- dst2[0] += ( c->dstH -1)*dstStride[0];
- dst2[1] += ((c->dstH>>c->chrDstVSubSample)-1)*dstStride[1];
- dst2[2] += ((c->dstH>>c->chrDstVSubSample)-1)*dstStride[2];
- dst2[3] += ( c->dstH -1)*dstStride[3];
-
- reset_ptr(src2, c->srcFormat);
- reset_ptr((const uint8_t**)dst2, c->dstFormat);
-
- /* reset slice direction at end of frame */
- if (!srcSliceY)
- c->sliceDir = 0;
-
- return c->swScale(c, src2, srcStride2, c->srcH-srcSliceY-srcSliceH, srcSliceH, dst2, dstStride2);
- }
-}
-
-#if LIBSWSCALE_VERSION_MAJOR < 1
-int sws_scale_ordered(SwsContext *c, const uint8_t* const src[], int srcStride[], int srcSliceY,
- int srcSliceH, uint8_t* dst[], int dstStride[])
-{
- return sws_scale(c, src, srcStride, srcSliceY, srcSliceH, dst, dstStride);
-}
-#endif
diff --git a/libswscale/swscale.h b/libswscale/swscale.h
deleted file mode 100644
index 9e14262d30..0000000000
--- a/libswscale/swscale.h
+++ /dev/null
@@ -1,297 +0,0 @@
-/*
- * Copyright (C) 2001-2003 Michael Niedermayer <michaelni@gmx.at>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * FFmpeg 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef SWSCALE_SWSCALE_H
-#define SWSCALE_SWSCALE_H
-
-/**
- * @file libswscale/swscale.h
- * @brief
- * external api for the swscale stuff
- */
-
-#include "libavutil/avutil.h"
-
-#define LIBSWSCALE_VERSION_MAJOR 0
-#define LIBSWSCALE_VERSION_MINOR 9
-#define LIBSWSCALE_VERSION_MICRO 0
-
-#define LIBSWSCALE_VERSION_INT AV_VERSION_INT(LIBSWSCALE_VERSION_MAJOR, \
- LIBSWSCALE_VERSION_MINOR, \
- LIBSWSCALE_VERSION_MICRO)
-#define LIBSWSCALE_VERSION AV_VERSION(LIBSWSCALE_VERSION_MAJOR, \
- LIBSWSCALE_VERSION_MINOR, \
- LIBSWSCALE_VERSION_MICRO)
-#define LIBSWSCALE_BUILD LIBSWSCALE_VERSION_INT
-
-#define LIBSWSCALE_IDENT "SwS" AV_STRINGIFY(LIBSWSCALE_VERSION)
-
-/**
- * Returns the LIBSWSCALE_VERSION_INT constant.
- */
-unsigned swscale_version(void);
-
-/**
- * Returns the libswscale build-time configuration.
- */
-const char *swscale_configuration(void);
-
-/**
- * Returns the libswscale license.
- */
-const char *swscale_license(void);
-
-/* values for the flags, the stuff on the command line is different */
-#define SWS_FAST_BILINEAR 1
-#define SWS_BILINEAR 2
-#define SWS_BICUBIC 4
-#define SWS_X 8
-#define SWS_POINT 0x10
-#define SWS_AREA 0x20
-#define SWS_BICUBLIN 0x40
-#define SWS_GAUSS 0x80
-#define SWS_SINC 0x100
-#define SWS_LANCZOS 0x200
-#define SWS_SPLINE 0x400
-
-#define SWS_SRC_V_CHR_DROP_MASK 0x30000
-#define SWS_SRC_V_CHR_DROP_SHIFT 16
-
-#define SWS_PARAM_DEFAULT 123456
-
-#define SWS_PRINT_INFO 0x1000
-
-//the following 3 flags are not completely implemented
-//internal chrominace subsampling info
-#define SWS_FULL_CHR_H_INT 0x2000
-//input subsampling info
-#define SWS_FULL_CHR_H_INP 0x4000
-#define SWS_DIRECT_BGR 0x8000
-#define SWS_ACCURATE_RND 0x40000
-#define SWS_BITEXACT 0x80000
-
-#define SWS_CPU_CAPS_MMX 0x80000000
-#define SWS_CPU_CAPS_MMX2 0x20000000
-#define SWS_CPU_CAPS_3DNOW 0x40000000
-#define SWS_CPU_CAPS_ALTIVEC 0x10000000
-#define SWS_CPU_CAPS_BFIN 0x01000000
-
-#define SWS_MAX_REDUCE_CUTOFF 0.002
-
-#define SWS_CS_ITU709 1
-#define SWS_CS_FCC 4
-#define SWS_CS_ITU601 5
-#define SWS_CS_ITU624 5
-#define SWS_CS_SMPTE170M 5
-#define SWS_CS_SMPTE240M 7
-#define SWS_CS_DEFAULT 5
-
-
-
-// when used for filters they must have an odd number of elements
-// coeffs cannot be shared between vectors
-typedef struct {
- double *coeff; ///< pointer to the list of coefficients
- int length; ///< number of coefficients in the vector
-} SwsVector;
-
-// vectors can be shared
-typedef struct {
- SwsVector *lumH;
- SwsVector *lumV;
- SwsVector *chrH;
- SwsVector *chrV;
-} SwsFilter;
-
-struct SwsContext;
-
-/**
- * Returns a positive value if pix_fmt is a supported input format, 0
- * otherwise.
- */
-int sws_isSupportedInput(enum PixelFormat pix_fmt);
-
-/**
- * Returns a positive value if pix_fmt is a supported output format, 0
- * otherwise.
- */
-int sws_isSupportedOutput(enum PixelFormat pix_fmt);
-
-/**
- * Frees the swscaler context swsContext.
- * If swsContext is NULL, then does nothing.
- */
-void sws_freeContext(struct SwsContext *swsContext);
-
-/**
- * Allocates and returns a SwsContext. You need it to perform
- * scaling/conversion operations using sws_scale().
- *
- * @param srcW the width of the source image
- * @param srcH the height of the source image
- * @param srcFormat the source image format
- * @param dstW the width of the destination image
- * @param dstH the height of the destination image
- * @param dstFormat the destination image format
- * @param flags specify which algorithm and options to use for rescaling
- * @return a pointer to an allocated context, or NULL in case of error
- */
-struct SwsContext *sws_getContext(int srcW, int srcH, enum PixelFormat srcFormat,
- int dstW, int dstH, enum PixelFormat dstFormat,
- int flags, SwsFilter *srcFilter,
- SwsFilter *dstFilter, const double *param);
-
-/**
- * Scales the image slice in srcSlice and puts the resulting scaled
- * slice in the image in dst. A slice is a sequence of consecutive
- * rows in an image.
- *
- * Slices have to be provided in sequential order, either in
- * top-bottom or bottom-top order. If slices are provided in
- * non-sequential order the behavior of the function is undefined.
- *
- * @param context the scaling context previously created with
- * sws_getContext()
- * @param srcSlice the array containing the pointers to the planes of
- * the source slice
- * @param srcStride the array containing the strides for each plane of
- * the source image
- * @param srcSliceY the position in the source image of the slice to
- * process, that is the number (counted starting from
- * zero) in the image of the first row of the slice
- * @param srcSliceH the height of the source slice, that is the number
- * of rows in the slice
- * @param dst the array containing the pointers to the planes of
- * the destination image
- * @param dstStride the array containing the strides for each plane of
- * the destination image
- * @return the height of the output slice
- */
-int sws_scale(struct SwsContext *context, const uint8_t* const srcSlice[], const int srcStride[],
- int srcSliceY, int srcSliceH, uint8_t* const dst[], const int dstStride[]);
-#if LIBSWSCALE_VERSION_MAJOR < 1
-/**
- * @deprecated Use sws_scale() instead.
- */
-int sws_scale_ordered(struct SwsContext *context, const uint8_t* const src[],
- int srcStride[], int srcSliceY, int srcSliceH,
- uint8_t* dst[], int dstStride[]) attribute_deprecated;
-#endif
-
-/**
- * @param inv_table the yuv2rgb coefficients, normally ff_yuv2rgb_coeffs[x]
- * @param fullRange if 1 then the luma range is 0..255 if 0 it is 16..235
- * @return -1 if not supported
- */
-int sws_setColorspaceDetails(struct SwsContext *c, const int inv_table[4],
- int srcRange, const int table[4], int dstRange,
- int brightness, int contrast, int saturation);
-
-/**
- * @return -1 if not supported
- */
-int sws_getColorspaceDetails(struct SwsContext *c, int **inv_table,
- int *srcRange, int **table, int *dstRange,
- int *brightness, int *contrast, int *saturation);
-
-/**
- * Allocates and returns an uninitialized vector with length coefficients.
- */
-SwsVector *sws_allocVec(int length);
-
-/**
- * Returns a normalized Gaussian curve used to filter stuff
- * quality=3 is high quality, lower is lower quality.
- */
-SwsVector *sws_getGaussianVec(double variance, double quality);
-
-/**
- * Allocates and returns a vector with length coefficients, all
- * with the same value c.
- */
-SwsVector *sws_getConstVec(double c, int length);
-
-/**
- * Allocates and returns a vector with just one coefficient, with
- * value 1.0.
- */
-SwsVector *sws_getIdentityVec(void);
-
-/**
- * Scales all the coefficients of a by the scalar value.
- */
-void sws_scaleVec(SwsVector *a, double scalar);
-
-/**
- * Scales all the coefficients of a so that their sum equals height.
- */
-void sws_normalizeVec(SwsVector *a, double height);
-void sws_convVec(SwsVector *a, SwsVector *b);
-void sws_addVec(SwsVector *a, SwsVector *b);
-void sws_subVec(SwsVector *a, SwsVector *b);
-void sws_shiftVec(SwsVector *a, int shift);
-
-/**
- * Allocates and returns a clone of the vector a, that is a vector
- * with the same coefficients as a.
- */
-SwsVector *sws_cloneVec(SwsVector *a);
-
-#if LIBSWSCALE_VERSION_MAJOR < 1
-/**
- * @deprecated Use sws_printVec2() instead.
- */
-attribute_deprecated void sws_printVec(SwsVector *a);
-#endif
-
-/**
- * Prints with av_log() a textual representation of the vector a
- * if log_level <= av_log_level.
- */
-void sws_printVec2(SwsVector *a, AVClass *log_ctx, int log_level);
-
-void sws_freeVec(SwsVector *a);
-
-SwsFilter *sws_getDefaultFilter(float lumaGBlur, float chromaGBlur,
- float lumaSharpen, float chromaSharpen,
- float chromaHShift, float chromaVShift,
- int verbose);
-void sws_freeFilter(SwsFilter *filter);
-
-/**
- * Checks if context can be reused, otherwise reallocates a new
- * one.
- *
- * If context is NULL, just calls sws_getContext() to get a new
- * context. Otherwise, checks if the parameters are the ones already
- * saved in context. If that is the case, returns the current
- * context. Otherwise, frees context and gets a new context with
- * the new parameters.
- *
- * Be warned that srcFilter and dstFilter are not checked, they
- * are assumed to remain the same.
- */
-struct SwsContext *sws_getCachedContext(struct SwsContext *context,
- int srcW, int srcH, enum PixelFormat srcFormat,
- int dstW, int dstH, enum PixelFormat dstFormat,
- int flags, SwsFilter *srcFilter,
- SwsFilter *dstFilter, const double *param);
-
-#endif /* SWSCALE_SWSCALE_H */
diff --git a/libswscale/swscale_internal.h b/libswscale/swscale_internal.h
deleted file mode 100644
index 836a868055..0000000000
--- a/libswscale/swscale_internal.h
+++ /dev/null
@@ -1,460 +0,0 @@
-/*
- * Copyright (C) 2001-2003 Michael Niedermayer <michaelni@gmx.at>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * FFmpeg 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef SWSCALE_SWSCALE_INTERNAL_H
-#define SWSCALE_SWSCALE_INTERNAL_H
-
-#include "config.h"
-
-#if HAVE_ALTIVEC_H
-#include <altivec.h>
-#endif
-
-#include "libavutil/avutil.h"
-
-#define STR(s) AV_TOSTRING(s) //AV_STRINGIFY is too long
-
-#define MAX_FILTER_SIZE 256
-
-#if ARCH_X86
-#define VOFW 5120
-#else
-#define VOFW 2048 // faster on PPC and not tested on others
-#endif
-
-#define VOF (VOFW*2)
-
-#if HAVE_BIGENDIAN
-#define ALT32_CORR (-1)
-#else
-#define ALT32_CORR 1
-#endif
-
-#if ARCH_X86_64
-# define APCK_PTR2 8
-# define APCK_COEF 16
-# define APCK_SIZE 24
-#else
-# define APCK_PTR2 4
-# define APCK_COEF 8
-# define APCK_SIZE 16
-#endif
-
-struct SwsContext;
-
-typedef int (*SwsFunc)(struct SwsContext *context, const uint8_t* src[],
- int srcStride[], int srcSliceY, int srcSliceH,
- uint8_t* dst[], int dstStride[]);
-
-/* This struct should be aligned on at least a 32-byte boundary. */
-typedef struct SwsContext {
- /**
- * info on struct for av_log
- */
- const AVClass *av_class;
-
- /**
- * Note that src, dst, srcStride, dstStride will be copied in the
- * sws_scale() wrapper so they can be freely modified here.
- */
- SwsFunc swScale;
- int srcW; ///< Width of source luma/alpha planes.
- int srcH; ///< Height of source luma/alpha planes.
- int dstH; ///< Height of destination luma/alpha planes.
- int chrSrcW; ///< Width of source chroma planes.
- int chrSrcH; ///< Height of source chroma planes.
- int chrDstW; ///< Width of destination chroma planes.
- int chrDstH; ///< Height of destination chroma planes.
- int lumXInc, chrXInc;
- int lumYInc, chrYInc;
- enum PixelFormat dstFormat; ///< Destination pixel format.
- enum PixelFormat srcFormat; ///< Source pixel format.
- int dstFormatBpp; ///< Number of bits per pixel of the destination pixel format.
- int srcFormatBpp; ///< Number of bits per pixel of the source pixel format.
- int chrSrcHSubSample; ///< Binary logarithm of horizontal subsampling factor between luma/alpha and chroma planes in source image.
- int chrSrcVSubSample; ///< Binary logarithm of vertical subsampling factor between luma/alpha and chroma planes in source image.
- int chrDstHSubSample; ///< Binary logarithm of horizontal subsampling factor between luma/alpha and chroma planes in destination image.
- int chrDstVSubSample; ///< Binary logarithm of vertical subsampling factor between luma/alpha and chroma planes in destination image.
- int vChrDrop; ///< Binary logarithm of extra vertical subsampling factor in source image chroma planes specified by user.
- int sliceDir; ///< Direction that slices are fed to the scaler (1 = top-to-bottom, -1 = bottom-to-top).
- double param[2]; ///< Input parameters for scaling algorithms that need them.
-
- uint32_t pal_yuv[256];
- uint32_t pal_rgb[256];
-
- /**
- * @name Scaled horizontal lines ring buffer.
- * The horizontal scaler keeps just enough scaled lines in a ring buffer
- * so they may be passed to the vertical scaler. The pointers to the
- * allocated buffers for each line are duplicated in sequence in the ring
- * buffer to simplify indexing and avoid wrapping around between lines
- * inside the vertical scaler code. The wrapping is done before the
- * vertical scaler is called.
- */
- //@{
- int16_t **lumPixBuf; ///< Ring buffer for scaled horizontal luma plane lines to be fed to the vertical scaler.
- int16_t **chrPixBuf; ///< Ring buffer for scaled horizontal chroma plane lines to be fed to the vertical scaler.
- int16_t **alpPixBuf; ///< Ring buffer for scaled horizontal alpha plane lines to be fed to the vertical scaler.
- int vLumBufSize; ///< Number of vertical luma/alpha lines allocated in the ring buffer.
- int vChrBufSize; ///< Number of vertical chroma lines allocated in the ring buffer.
- int lastInLumBuf; ///< Last scaled horizontal luma/alpha line from source in the ring buffer.
- int lastInChrBuf; ///< Last scaled horizontal chroma line from source in the ring buffer.
- int lumBufIndex; ///< Index in ring buffer of the last scaled horizontal luma/alpha line from source.
- int chrBufIndex; ///< Index in ring buffer of the last scaled horizontal chroma line from source.
- //@}
-
- uint8_t formatConvBuffer[VOF]; //FIXME dynamic allocation, but we have to change a lot of code for this to be useful
-
- /**
- * @name Horizontal and vertical filters.
- * To better understand the following fields, here is a pseudo-code of
- * their usage in filtering a horizontal line:
- * @code
- * for (i = 0; i < width; i++) {
- * dst[i] = 0;
- * for (j = 0; j < filterSize; j++)
- * dst[i] += src[ filterPos[i] + j ] * filter[ filterSize * i + j ];
- * dst[i] >>= FRAC_BITS; // The actual implementation is fixed-point.
- * }
- * @endcode
- */
- //@{
- int16_t *hLumFilter; ///< Array of horizontal filter coefficients for luma/alpha planes.
- int16_t *hChrFilter; ///< Array of horizontal filter coefficients for chroma planes.
- int16_t *vLumFilter; ///< Array of vertical filter coefficients for luma/alpha planes.
- int16_t *vChrFilter; ///< Array of vertical filter coefficients for chroma planes.
- int16_t *hLumFilterPos; ///< Array of horizontal filter starting positions for each dst[i] for luma/alpha planes.
- int16_t *hChrFilterPos; ///< Array of horizontal filter starting positions for each dst[i] for chroma planes.
- int16_t *vLumFilterPos; ///< Array of vertical filter starting positions for each dst[i] for luma/alpha planes.
- int16_t *vChrFilterPos; ///< Array of vertical filter starting positions for each dst[i] for chroma planes.
- int hLumFilterSize; ///< Horizontal filter size for luma/alpha pixels.
- int hChrFilterSize; ///< Horizontal filter size for chroma pixels.
- int vLumFilterSize; ///< Vertical filter size for luma/alpha pixels.
- int vChrFilterSize; ///< Vertical filter size for chroma pixels.
- //@}
-
- int lumMmx2FilterCodeSize; ///< Runtime-generated MMX2 horizontal fast bilinear scaler code size for luma/alpha planes.
- int chrMmx2FilterCodeSize; ///< Runtime-generated MMX2 horizontal fast bilinear scaler code size for chroma planes.
- uint8_t *lumMmx2FilterCode; ///< Runtime-generated MMX2 horizontal fast bilinear scaler code for luma/alpha planes.
- uint8_t *chrMmx2FilterCode; ///< Runtime-generated MMX2 horizontal fast bilinear scaler code for chroma planes.
-
- int canMMX2BeUsed;
-
- int dstY; ///< Last destination vertical line output from last slice.
- int flags; ///< Flags passed by the user to select scaler algorithm, optimizations, subsampling, etc...
- void * yuvTable; // pointer to the yuv->rgb table start so it can be freed()
- uint8_t * table_rV[256];
- uint8_t * table_gU[256];
- int table_gV[256];
- uint8_t * table_bU[256];
-
- //Colorspace stuff
- int contrast, brightness, saturation; // for sws_getColorspaceDetails
- int srcColorspaceTable[4];
- int dstColorspaceTable[4];
- int srcRange; ///< 0 = MPG YUV range, 1 = JPG YUV range (source image).
- int dstRange; ///< 0 = MPG YUV range, 1 = JPG YUV range (destination image).
- int yuv2rgb_y_offset;
- int yuv2rgb_y_coeff;
- int yuv2rgb_v2r_coeff;
- int yuv2rgb_v2g_coeff;
- int yuv2rgb_u2g_coeff;
- int yuv2rgb_u2b_coeff;
-
-#define RED_DITHER "0*8"
-#define GREEN_DITHER "1*8"
-#define BLUE_DITHER "2*8"
-#define Y_COEFF "3*8"
-#define VR_COEFF "4*8"
-#define UB_COEFF "5*8"
-#define VG_COEFF "6*8"
-#define UG_COEFF "7*8"
-#define Y_OFFSET "8*8"
-#define U_OFFSET "9*8"
-#define V_OFFSET "10*8"
-#define LUM_MMX_FILTER_OFFSET "11*8"
-#define CHR_MMX_FILTER_OFFSET "11*8+4*4*256"
-#define DSTW_OFFSET "11*8+4*4*256*2" //do not change, it is hardcoded in the ASM
-#define ESP_OFFSET "11*8+4*4*256*2+8"
-#define VROUNDER_OFFSET "11*8+4*4*256*2+16"
-#define U_TEMP "11*8+4*4*256*2+24"
-#define V_TEMP "11*8+4*4*256*2+32"
-#define Y_TEMP "11*8+4*4*256*2+40"
-#define ALP_MMX_FILTER_OFFSET "11*8+4*4*256*2+48"
-
- DECLARE_ALIGNED(8, uint64_t, redDither);
- DECLARE_ALIGNED(8, uint64_t, greenDither);
- DECLARE_ALIGNED(8, uint64_t, blueDither);
-
- DECLARE_ALIGNED(8, uint64_t, yCoeff);
- DECLARE_ALIGNED(8, uint64_t, vrCoeff);
- DECLARE_ALIGNED(8, uint64_t, ubCoeff);
- DECLARE_ALIGNED(8, uint64_t, vgCoeff);
- DECLARE_ALIGNED(8, uint64_t, ugCoeff);
- DECLARE_ALIGNED(8, uint64_t, yOffset);
- DECLARE_ALIGNED(8, uint64_t, uOffset);
- DECLARE_ALIGNED(8, uint64_t, vOffset);
- int32_t lumMmxFilter[4*MAX_FILTER_SIZE];
- int32_t chrMmxFilter[4*MAX_FILTER_SIZE];
- int dstW; ///< Width of destination luma/alpha planes.
- DECLARE_ALIGNED(8, uint64_t, esp);
- DECLARE_ALIGNED(8, uint64_t, vRounder);
- DECLARE_ALIGNED(8, uint64_t, u_temp);
- DECLARE_ALIGNED(8, uint64_t, v_temp);
- DECLARE_ALIGNED(8, uint64_t, y_temp);
- int32_t alpMmxFilter[4*MAX_FILTER_SIZE];
-
-#if HAVE_ALTIVEC
- vector signed short CY;
- vector signed short CRV;
- vector signed short CBU;
- vector signed short CGU;
- vector signed short CGV;
- vector signed short OY;
- vector unsigned short CSHIFT;
- vector signed short *vYCoeffsBank, *vCCoeffsBank;
-#endif
-
-#if ARCH_BFIN
- DECLARE_ALIGNED(4, uint32_t, oy);
- DECLARE_ALIGNED(4, uint32_t, oc);
- DECLARE_ALIGNED(4, uint32_t, zero);
- DECLARE_ALIGNED(4, uint32_t, cy);
- DECLARE_ALIGNED(4, uint32_t, crv);
- DECLARE_ALIGNED(4, uint32_t, rmask);
- DECLARE_ALIGNED(4, uint32_t, cbu);
- DECLARE_ALIGNED(4, uint32_t, bmask);
- DECLARE_ALIGNED(4, uint32_t, cgu);
- DECLARE_ALIGNED(4, uint32_t, cgv);
- DECLARE_ALIGNED(4, uint32_t, gmask);
-#endif
-
-#if HAVE_VIS
- DECLARE_ALIGNED(8, uint64_t, sparc_coeffs)[10];
-#endif
-
- /* function pointers for swScale() */
- void (*yuv2nv12X )(struct SwsContext *c,
- const int16_t *lumFilter, const int16_t **lumSrc, int lumFilterSize,
- const int16_t *chrFilter, const int16_t **chrSrc, int chrFilterSize,
- uint8_t *dest, uint8_t *uDest,
- int dstW, int chrDstW, int dstFormat);
- void (*yuv2yuv1 )(struct SwsContext *c,
- const int16_t *lumSrc, const int16_t *chrSrc, const int16_t *alpSrc,
- uint8_t *dest,
- uint8_t *uDest, uint8_t *vDest, uint8_t *aDest,
- long dstW, long chrDstW);
- void (*yuv2yuvX )(struct SwsContext *c,
- const int16_t *lumFilter, const int16_t **lumSrc, int lumFilterSize,
- const int16_t *chrFilter, const int16_t **chrSrc, int chrFilterSize,
- const int16_t **alpSrc,
- uint8_t *dest,
- uint8_t *uDest, uint8_t *vDest, uint8_t *aDest,
- long dstW, long chrDstW);
- void (*yuv2packed1)(struct SwsContext *c,
- const uint16_t *buf0,
- const uint16_t *uvbuf0, const uint16_t *uvbuf1,
- const uint16_t *abuf0,
- uint8_t *dest,
- int dstW, int uvalpha, int dstFormat, int flags, int y);
- void (*yuv2packed2)(struct SwsContext *c,
- const uint16_t *buf0, const uint16_t *buf1,
- const uint16_t *uvbuf0, const uint16_t *uvbuf1,
- const uint16_t *abuf0, const uint16_t *abuf1,
- uint8_t *dest,
- int dstW, int yalpha, int uvalpha, int y);
- void (*yuv2packedX)(struct SwsContext *c,
- const int16_t *lumFilter, const int16_t **lumSrc, int lumFilterSize,
- const int16_t *chrFilter, const int16_t **chrSrc, int chrFilterSize,
- const int16_t **alpSrc, uint8_t *dest,
- long dstW, long dstY);
-
- void (*lumToYV12)(uint8_t *dst, const uint8_t *src,
- long width, uint32_t *pal); ///< Unscaled conversion of luma plane to YV12 for horizontal scaler.
- void (*alpToYV12)(uint8_t *dst, const uint8_t *src,
- long width, uint32_t *pal); ///< Unscaled conversion of alpha plane to YV12 for horizontal scaler.
- void (*chrToYV12)(uint8_t *dstU, uint8_t *dstV,
- const uint8_t *src1, const uint8_t *src2,
- long width, uint32_t *pal); ///< Unscaled conversion of chroma planes to YV12 for horizontal scaler.
- void (*hyscale_fast)(struct SwsContext *c,
- int16_t *dst, long dstWidth,
- const uint8_t *src, int srcW, int xInc);
- void (*hcscale_fast)(struct SwsContext *c,
- int16_t *dst, long dstWidth,
- const uint8_t *src1, const uint8_t *src2,
- int srcW, int xInc);
-
- void (*hScale)(int16_t *dst, int dstW, const uint8_t *src, int srcW,
- int xInc, const int16_t *filter, const int16_t *filterPos,
- long filterSize);
-
- void (*lumConvertRange)(uint16_t *dst, int width); ///< Color range conversion function for luma plane if needed.
- void (*chrConvertRange)(uint16_t *dst, int width); ///< Color range conversion function for chroma planes if needed.
-
- int lumSrcOffset; ///< Offset given to luma src pointers passed to horizontal input functions.
- int chrSrcOffset; ///< Offset given to chroma src pointers passed to horizontal input functions.
- int alpSrcOffset; ///< Offset given to alpha src pointers passed to horizontal input functions.
-
- int needs_hcscale; ///< Set if there are chroma planes to be converted.
-
-} SwsContext;
-//FIXME check init (where 0)
-
-SwsFunc ff_yuv2rgb_get_func_ptr(SwsContext *c);
-int ff_yuv2rgb_c_init_tables(SwsContext *c, const int inv_table[4],
- int fullRange, int brightness,
- int contrast, int saturation);
-
-void ff_yuv2rgb_init_tables_altivec(SwsContext *c, const int inv_table[4],
- int brightness, int contrast, int saturation);
-SwsFunc ff_yuv2rgb_init_mmx(SwsContext *c);
-SwsFunc ff_yuv2rgb_init_vis(SwsContext *c);
-SwsFunc ff_yuv2rgb_init_mlib(SwsContext *c);
-SwsFunc ff_yuv2rgb_init_altivec(SwsContext *c);
-SwsFunc ff_yuv2rgb_get_func_ptr_bfin(SwsContext *c);
-void ff_bfin_get_unscaled_swscale(SwsContext *c);
-void ff_yuv2packedX_altivec(SwsContext *c,
- const int16_t *lumFilter, int16_t **lumSrc, int lumFilterSize,
- const int16_t *chrFilter, int16_t **chrSrc, int chrFilterSize,
- uint8_t *dest, int dstW, int dstY);
-
-const char *sws_format_name(enum PixelFormat format);
-
-//FIXME replace this with something faster
-#define is16BPS(x) ( \
- (x)==PIX_FMT_GRAY16BE \
- || (x)==PIX_FMT_GRAY16LE \
- || (x)==PIX_FMT_RGB48BE \
- || (x)==PIX_FMT_RGB48LE \
- || (x)==PIX_FMT_YUV420P16LE \
- || (x)==PIX_FMT_YUV422P16LE \
- || (x)==PIX_FMT_YUV444P16LE \
- || (x)==PIX_FMT_YUV420P16BE \
- || (x)==PIX_FMT_YUV422P16BE \
- || (x)==PIX_FMT_YUV444P16BE \
- )
-#define isBE(x) ((x)&1)
-#define isPlanar8YUV(x) ( \
- (x)==PIX_FMT_YUV410P \
- || (x)==PIX_FMT_YUV420P \
- || (x)==PIX_FMT_YUVA420P \
- || (x)==PIX_FMT_YUV411P \
- || (x)==PIX_FMT_YUV422P \
- || (x)==PIX_FMT_YUV444P \
- || (x)==PIX_FMT_YUV440P \
- || (x)==PIX_FMT_NV12 \
- || (x)==PIX_FMT_NV21 \
- )
-#define isPlanarYUV(x) ( \
- isPlanar8YUV(x) \
- || (x)==PIX_FMT_YUV420P16LE \
- || (x)==PIX_FMT_YUV422P16LE \
- || (x)==PIX_FMT_YUV444P16LE \
- || (x)==PIX_FMT_YUV420P16BE \
- || (x)==PIX_FMT_YUV422P16BE \
- || (x)==PIX_FMT_YUV444P16BE \
- )
-#define isYUV(x) ( \
- (x)==PIX_FMT_UYVY422 \
- || (x)==PIX_FMT_YUYV422 \
- || isPlanarYUV(x) \
- )
-#define isGray(x) ( \
- (x)==PIX_FMT_GRAY8 \
- || (x)==PIX_FMT_GRAY16BE \
- || (x)==PIX_FMT_GRAY16LE \
- )
-#define isGray16(x) ( \
- (x)==PIX_FMT_GRAY16BE \
- || (x)==PIX_FMT_GRAY16LE \
- )
-#define isRGBinInt(x) ( \
- (x)==PIX_FMT_RGB48BE \
- || (x)==PIX_FMT_RGB48LE \
- || (x)==PIX_FMT_RGB32 \
- || (x)==PIX_FMT_RGB32_1 \
- || (x)==PIX_FMT_RGB24 \
- || (x)==PIX_FMT_RGB565 \
- || (x)==PIX_FMT_RGB555 \
- || (x)==PIX_FMT_RGB8 \
- || (x)==PIX_FMT_RGB4 \
- || (x)==PIX_FMT_RGB4_BYTE \
- || (x)==PIX_FMT_MONOBLACK \
- || (x)==PIX_FMT_MONOWHITE \
- )
-#define isBGRinInt(x) ( \
- (x)==PIX_FMT_BGR32 \
- || (x)==PIX_FMT_BGR32_1 \
- || (x)==PIX_FMT_BGR24 \
- || (x)==PIX_FMT_BGR565 \
- || (x)==PIX_FMT_BGR555 \
- || (x)==PIX_FMT_BGR8 \
- || (x)==PIX_FMT_BGR4 \
- || (x)==PIX_FMT_BGR4_BYTE \
- || (x)==PIX_FMT_MONOBLACK \
- || (x)==PIX_FMT_MONOWHITE \
- )
-#define isRGBinBytes(x) ( \
- (x)==PIX_FMT_RGB48BE \
- || (x)==PIX_FMT_RGB48LE \
- || (x)==PIX_FMT_RGBA \
- || (x)==PIX_FMT_ARGB \
- || (x)==PIX_FMT_RGB24 \
- )
-#define isBGRinBytes(x) ( \
- (x)==PIX_FMT_BGRA \
- || (x)==PIX_FMT_ABGR \
- || (x)==PIX_FMT_BGR24 \
- )
-#define isAnyRGB(x) ( \
- isRGBinInt(x) \
- || isBGRinInt(x) \
- )
-#define isALPHA(x) ( \
- (x)==PIX_FMT_BGR32 \
- || (x)==PIX_FMT_BGR32_1 \
- || (x)==PIX_FMT_RGB32 \
- || (x)==PIX_FMT_RGB32_1 \
- || (x)==PIX_FMT_YUVA420P \
- )
-
-extern const uint64_t ff_dither4[2];
-extern const uint64_t ff_dither8[2];
-
-extern const AVClass sws_context_class;
-
-/**
- * Sets c->swScale to an unscaled converter if one exists for the specific
- * source and destination formats, bit depths, flags, etc.
- */
-void ff_get_unscaled_swscale(SwsContext *c);
-
-/**
- * Returns the SWS_CPU_CAPS for the optimized code compiled into swscale.
- */
-int ff_hardcodedcpuflags(void);
-
-/**
- * Returns function pointer to fastest main scaler path function depending
- * on architecture and available optimizations.
- */
-SwsFunc ff_getSwsFunc(SwsContext *c);
-
-#endif /* SWSCALE_SWSCALE_INTERNAL_H */
diff --git a/libswscale/swscale_template.c b/libswscale/swscale_template.c
deleted file mode 100644
index b682c11d42..0000000000
--- a/libswscale/swscale_template.c
+++ /dev/null
@@ -1,3064 +0,0 @@
-/*
- * Copyright (C) 2001-2003 Michael Niedermayer <michaelni@gmx.at>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * The C code (not assembly, MMX, ...) of this file can be used
- * under the LGPL license.
- */
-
-#undef REAL_MOVNTQ
-#undef MOVNTQ
-#undef PAVGB
-#undef PREFETCH
-
-#if COMPILE_TEMPLATE_AMD3DNOW
-#define PREFETCH "prefetch"
-#elif COMPILE_TEMPLATE_MMX2
-#define PREFETCH "prefetchnta"
-#else
-#define PREFETCH " # nop"
-#endif
-
-#if COMPILE_TEMPLATE_MMX2
-#define PAVGB(a,b) "pavgb " #a ", " #b " \n\t"
-#elif COMPILE_TEMPLATE_AMD3DNOW
-#define PAVGB(a,b) "pavgusb " #a ", " #b " \n\t"
-#endif
-
-#if COMPILE_TEMPLATE_MMX2
-#define REAL_MOVNTQ(a,b) "movntq " #a ", " #b " \n\t"
-#else
-#define REAL_MOVNTQ(a,b) "movq " #a ", " #b " \n\t"
-#endif
-#define MOVNTQ(a,b) REAL_MOVNTQ(a,b)
-
-#if COMPILE_TEMPLATE_ALTIVEC
-#include "ppc/swscale_altivec_template.c"
-#endif
-
-#define YSCALEYUV2YV12X(x, offset, dest, width) \
- __asm__ volatile(\
- "xor %%"REG_a", %%"REG_a" \n\t"\
- "movq "VROUNDER_OFFSET"(%0), %%mm3 \n\t"\
- "movq %%mm3, %%mm4 \n\t"\
- "lea " offset "(%0), %%"REG_d" \n\t"\
- "mov (%%"REG_d"), %%"REG_S" \n\t"\
- ASMALIGN(4) /* FIXME Unroll? */\
- "1: \n\t"\
- "movq 8(%%"REG_d"), %%mm0 \n\t" /* filterCoeff */\
- "movq " x "(%%"REG_S", %%"REG_a", 2), %%mm2 \n\t" /* srcData */\
- "movq 8+" x "(%%"REG_S", %%"REG_a", 2), %%mm5 \n\t" /* srcData */\
- "add $16, %%"REG_d" \n\t"\
- "mov (%%"REG_d"), %%"REG_S" \n\t"\
- "test %%"REG_S", %%"REG_S" \n\t"\
- "pmulhw %%mm0, %%mm2 \n\t"\
- "pmulhw %%mm0, %%mm5 \n\t"\
- "paddw %%mm2, %%mm3 \n\t"\
- "paddw %%mm5, %%mm4 \n\t"\
- " jnz 1b \n\t"\
- "psraw $3, %%mm3 \n\t"\
- "psraw $3, %%mm4 \n\t"\
- "packuswb %%mm4, %%mm3 \n\t"\
- MOVNTQ(%%mm3, (%1, %%REGa))\
- "add $8, %%"REG_a" \n\t"\
- "cmp %2, %%"REG_a" \n\t"\
- "movq "VROUNDER_OFFSET"(%0), %%mm3 \n\t"\
- "movq %%mm3, %%mm4 \n\t"\
- "lea " offset "(%0), %%"REG_d" \n\t"\
- "mov (%%"REG_d"), %%"REG_S" \n\t"\
- "jb 1b \n\t"\
- :: "r" (&c->redDither),\
- "r" (dest), "g" (width)\
- : "%"REG_a, "%"REG_d, "%"REG_S\
- );
-
-#define YSCALEYUV2YV12X_ACCURATE(x, offset, dest, width) \
- __asm__ volatile(\
- "lea " offset "(%0), %%"REG_d" \n\t"\
- "xor %%"REG_a", %%"REG_a" \n\t"\
- "pxor %%mm4, %%mm4 \n\t"\
- "pxor %%mm5, %%mm5 \n\t"\
- "pxor %%mm6, %%mm6 \n\t"\
- "pxor %%mm7, %%mm7 \n\t"\
- "mov (%%"REG_d"), %%"REG_S" \n\t"\
- ASMALIGN(4) \
- "1: \n\t"\
- "movq " x "(%%"REG_S", %%"REG_a", 2), %%mm0 \n\t" /* srcData */\
- "movq 8+" x "(%%"REG_S", %%"REG_a", 2), %%mm2 \n\t" /* srcData */\
- "mov "STR(APCK_PTR2)"(%%"REG_d"), %%"REG_S" \n\t"\
- "movq " x "(%%"REG_S", %%"REG_a", 2), %%mm1 \n\t" /* srcData */\
- "movq %%mm0, %%mm3 \n\t"\
- "punpcklwd %%mm1, %%mm0 \n\t"\
- "punpckhwd %%mm1, %%mm3 \n\t"\
- "movq "STR(APCK_COEF)"(%%"REG_d"), %%mm1 \n\t" /* filterCoeff */\
- "pmaddwd %%mm1, %%mm0 \n\t"\
- "pmaddwd %%mm1, %%mm3 \n\t"\
- "paddd %%mm0, %%mm4 \n\t"\
- "paddd %%mm3, %%mm5 \n\t"\
- "movq 8+" x "(%%"REG_S", %%"REG_a", 2), %%mm3 \n\t" /* srcData */\
- "mov "STR(APCK_SIZE)"(%%"REG_d"), %%"REG_S" \n\t"\
- "add $"STR(APCK_SIZE)", %%"REG_d" \n\t"\
- "test %%"REG_S", %%"REG_S" \n\t"\
- "movq %%mm2, %%mm0 \n\t"\
- "punpcklwd %%mm3, %%mm2 \n\t"\
- "punpckhwd %%mm3, %%mm0 \n\t"\
- "pmaddwd %%mm1, %%mm2 \n\t"\
- "pmaddwd %%mm1, %%mm0 \n\t"\
- "paddd %%mm2, %%mm6 \n\t"\
- "paddd %%mm0, %%mm7 \n\t"\
- " jnz 1b \n\t"\
- "psrad $16, %%mm4 \n\t"\
- "psrad $16, %%mm5 \n\t"\
- "psrad $16, %%mm6 \n\t"\
- "psrad $16, %%mm7 \n\t"\
- "movq "VROUNDER_OFFSET"(%0), %%mm0 \n\t"\
- "packssdw %%mm5, %%mm4 \n\t"\
- "packssdw %%mm7, %%mm6 \n\t"\
- "paddw %%mm0, %%mm4 \n\t"\
- "paddw %%mm0, %%mm6 \n\t"\
- "psraw $3, %%mm4 \n\t"\
- "psraw $3, %%mm6 \n\t"\
- "packuswb %%mm6, %%mm4 \n\t"\
- MOVNTQ(%%mm4, (%1, %%REGa))\
- "add $8, %%"REG_a" \n\t"\
- "cmp %2, %%"REG_a" \n\t"\
- "lea " offset "(%0), %%"REG_d" \n\t"\
- "pxor %%mm4, %%mm4 \n\t"\
- "pxor %%mm5, %%mm5 \n\t"\
- "pxor %%mm6, %%mm6 \n\t"\
- "pxor %%mm7, %%mm7 \n\t"\
- "mov (%%"REG_d"), %%"REG_S" \n\t"\
- "jb 1b \n\t"\
- :: "r" (&c->redDither),\
- "r" (dest), "g" (width)\
- : "%"REG_a, "%"REG_d, "%"REG_S\
- );
-
-#define YSCALEYUV2YV121 \
- "mov %2, %%"REG_a" \n\t"\
- ASMALIGN(4) /* FIXME Unroll? */\
- "1: \n\t"\
- "movq (%0, %%"REG_a", 2), %%mm0 \n\t"\
- "movq 8(%0, %%"REG_a", 2), %%mm1 \n\t"\
- "psraw $7, %%mm0 \n\t"\
- "psraw $7, %%mm1 \n\t"\
- "packuswb %%mm1, %%mm0 \n\t"\
- MOVNTQ(%%mm0, (%1, %%REGa))\
- "add $8, %%"REG_a" \n\t"\
- "jnc 1b \n\t"
-
-#define YSCALEYUV2YV121_ACCURATE \
- "mov %2, %%"REG_a" \n\t"\
- "pcmpeqw %%mm7, %%mm7 \n\t"\
- "psrlw $15, %%mm7 \n\t"\
- "psllw $6, %%mm7 \n\t"\
- ASMALIGN(4) /* FIXME Unroll? */\
- "1: \n\t"\
- "movq (%0, %%"REG_a", 2), %%mm0 \n\t"\
- "movq 8(%0, %%"REG_a", 2), %%mm1 \n\t"\
- "paddsw %%mm7, %%mm0 \n\t"\
- "paddsw %%mm7, %%mm1 \n\t"\
- "psraw $7, %%mm0 \n\t"\
- "psraw $7, %%mm1 \n\t"\
- "packuswb %%mm1, %%mm0 \n\t"\
- MOVNTQ(%%mm0, (%1, %%REGa))\
- "add $8, %%"REG_a" \n\t"\
- "jnc 1b \n\t"
-
-/*
- :: "m" (-lumFilterSize), "m" (-chrFilterSize),
- "m" (lumMmxFilter+lumFilterSize*4), "m" (chrMmxFilter+chrFilterSize*4),
- "r" (dest), "m" (dstW),
- "m" (lumSrc+lumFilterSize), "m" (chrSrc+chrFilterSize)
- : "%eax", "%ebx", "%ecx", "%edx", "%esi"
-*/
-#define YSCALEYUV2PACKEDX_UV \
- __asm__ volatile(\
- "xor %%"REG_a", %%"REG_a" \n\t"\
- ASMALIGN(4)\
- "nop \n\t"\
- "1: \n\t"\
- "lea "CHR_MMX_FILTER_OFFSET"(%0), %%"REG_d" \n\t"\
- "mov (%%"REG_d"), %%"REG_S" \n\t"\
- "movq "VROUNDER_OFFSET"(%0), %%mm3 \n\t"\
- "movq %%mm3, %%mm4 \n\t"\
- ASMALIGN(4)\
- "2: \n\t"\
- "movq 8(%%"REG_d"), %%mm0 \n\t" /* filterCoeff */\
- "movq (%%"REG_S", %%"REG_a"), %%mm2 \n\t" /* UsrcData */\
- "movq "AV_STRINGIFY(VOF)"(%%"REG_S", %%"REG_a"), %%mm5 \n\t" /* VsrcData */\
- "add $16, %%"REG_d" \n\t"\
- "mov (%%"REG_d"), %%"REG_S" \n\t"\
- "pmulhw %%mm0, %%mm2 \n\t"\
- "pmulhw %%mm0, %%mm5 \n\t"\
- "paddw %%mm2, %%mm3 \n\t"\
- "paddw %%mm5, %%mm4 \n\t"\
- "test %%"REG_S", %%"REG_S" \n\t"\
- " jnz 2b \n\t"\
-
-#define YSCALEYUV2PACKEDX_YA(offset,coeff,src1,src2,dst1,dst2) \
- "lea "offset"(%0), %%"REG_d" \n\t"\
- "mov (%%"REG_d"), %%"REG_S" \n\t"\
- "movq "VROUNDER_OFFSET"(%0), "#dst1" \n\t"\
- "movq "#dst1", "#dst2" \n\t"\
- ASMALIGN(4)\
- "2: \n\t"\
- "movq 8(%%"REG_d"), "#coeff" \n\t" /* filterCoeff */\
- "movq (%%"REG_S", %%"REG_a", 2), "#src1" \n\t" /* Y1srcData */\
- "movq 8(%%"REG_S", %%"REG_a", 2), "#src2" \n\t" /* Y2srcData */\
- "add $16, %%"REG_d" \n\t"\
- "mov (%%"REG_d"), %%"REG_S" \n\t"\
- "pmulhw "#coeff", "#src1" \n\t"\
- "pmulhw "#coeff", "#src2" \n\t"\
- "paddw "#src1", "#dst1" \n\t"\
- "paddw "#src2", "#dst2" \n\t"\
- "test %%"REG_S", %%"REG_S" \n\t"\
- " jnz 2b \n\t"\
-
-#define YSCALEYUV2PACKEDX \
- YSCALEYUV2PACKEDX_UV \
- YSCALEYUV2PACKEDX_YA(LUM_MMX_FILTER_OFFSET,%%mm0,%%mm2,%%mm5,%%mm1,%%mm7) \
-
-#define YSCALEYUV2PACKEDX_END \
- :: "r" (&c->redDither), \
- "m" (dummy), "m" (dummy), "m" (dummy),\
- "r" (dest), "m" (dstW) \
- : "%"REG_a, "%"REG_d, "%"REG_S \
- );
-
-#define YSCALEYUV2PACKEDX_ACCURATE_UV \
- __asm__ volatile(\
- "xor %%"REG_a", %%"REG_a" \n\t"\
- ASMALIGN(4)\
- "nop \n\t"\
- "1: \n\t"\
- "lea "CHR_MMX_FILTER_OFFSET"(%0), %%"REG_d" \n\t"\
- "mov (%%"REG_d"), %%"REG_S" \n\t"\
- "pxor %%mm4, %%mm4 \n\t"\
- "pxor %%mm5, %%mm5 \n\t"\
- "pxor %%mm6, %%mm6 \n\t"\
- "pxor %%mm7, %%mm7 \n\t"\
- ASMALIGN(4)\
- "2: \n\t"\
- "movq (%%"REG_S", %%"REG_a"), %%mm0 \n\t" /* UsrcData */\
- "movq "AV_STRINGIFY(VOF)"(%%"REG_S", %%"REG_a"), %%mm2 \n\t" /* VsrcData */\
- "mov "STR(APCK_PTR2)"(%%"REG_d"), %%"REG_S" \n\t"\
- "movq (%%"REG_S", %%"REG_a"), %%mm1 \n\t" /* UsrcData */\
- "movq %%mm0, %%mm3 \n\t"\
- "punpcklwd %%mm1, %%mm0 \n\t"\
- "punpckhwd %%mm1, %%mm3 \n\t"\
- "movq "STR(APCK_COEF)"(%%"REG_d"),%%mm1 \n\t" /* filterCoeff */\
- "pmaddwd %%mm1, %%mm0 \n\t"\
- "pmaddwd %%mm1, %%mm3 \n\t"\
- "paddd %%mm0, %%mm4 \n\t"\
- "paddd %%mm3, %%mm5 \n\t"\
- "movq "AV_STRINGIFY(VOF)"(%%"REG_S", %%"REG_a"), %%mm3 \n\t" /* VsrcData */\
- "mov "STR(APCK_SIZE)"(%%"REG_d"), %%"REG_S" \n\t"\
- "add $"STR(APCK_SIZE)", %%"REG_d" \n\t"\
- "test %%"REG_S", %%"REG_S" \n\t"\
- "movq %%mm2, %%mm0 \n\t"\
- "punpcklwd %%mm3, %%mm2 \n\t"\
- "punpckhwd %%mm3, %%mm0 \n\t"\
- "pmaddwd %%mm1, %%mm2 \n\t"\
- "pmaddwd %%mm1, %%mm0 \n\t"\
- "paddd %%mm2, %%mm6 \n\t"\
- "paddd %%mm0, %%mm7 \n\t"\
- " jnz 2b \n\t"\
- "psrad $16, %%mm4 \n\t"\
- "psrad $16, %%mm5 \n\t"\
- "psrad $16, %%mm6 \n\t"\
- "psrad $16, %%mm7 \n\t"\
- "movq "VROUNDER_OFFSET"(%0), %%mm0 \n\t"\
- "packssdw %%mm5, %%mm4 \n\t"\
- "packssdw %%mm7, %%mm6 \n\t"\
- "paddw %%mm0, %%mm4 \n\t"\
- "paddw %%mm0, %%mm6 \n\t"\
- "movq %%mm4, "U_TEMP"(%0) \n\t"\
- "movq %%mm6, "V_TEMP"(%0) \n\t"\
-
-#define YSCALEYUV2PACKEDX_ACCURATE_YA(offset) \
- "lea "offset"(%0), %%"REG_d" \n\t"\
- "mov (%%"REG_d"), %%"REG_S" \n\t"\
- "pxor %%mm1, %%mm1 \n\t"\
- "pxor %%mm5, %%mm5 \n\t"\
- "pxor %%mm7, %%mm7 \n\t"\
- "pxor %%mm6, %%mm6 \n\t"\
- ASMALIGN(4)\
- "2: \n\t"\
- "movq (%%"REG_S", %%"REG_a", 2), %%mm0 \n\t" /* Y1srcData */\
- "movq 8(%%"REG_S", %%"REG_a", 2), %%mm2 \n\t" /* Y2srcData */\
- "mov "STR(APCK_PTR2)"(%%"REG_d"), %%"REG_S" \n\t"\
- "movq (%%"REG_S", %%"REG_a", 2), %%mm4 \n\t" /* Y1srcData */\
- "movq %%mm0, %%mm3 \n\t"\
- "punpcklwd %%mm4, %%mm0 \n\t"\
- "punpckhwd %%mm4, %%mm3 \n\t"\
- "movq "STR(APCK_COEF)"(%%"REG_d"), %%mm4 \n\t" /* filterCoeff */\
- "pmaddwd %%mm4, %%mm0 \n\t"\
- "pmaddwd %%mm4, %%mm3 \n\t"\
- "paddd %%mm0, %%mm1 \n\t"\
- "paddd %%mm3, %%mm5 \n\t"\
- "movq 8(%%"REG_S", %%"REG_a", 2), %%mm3 \n\t" /* Y2srcData */\
- "mov "STR(APCK_SIZE)"(%%"REG_d"), %%"REG_S" \n\t"\
- "add $"STR(APCK_SIZE)", %%"REG_d" \n\t"\
- "test %%"REG_S", %%"REG_S" \n\t"\
- "movq %%mm2, %%mm0 \n\t"\
- "punpcklwd %%mm3, %%mm2 \n\t"\
- "punpckhwd %%mm3, %%mm0 \n\t"\
- "pmaddwd %%mm4, %%mm2 \n\t"\
- "pmaddwd %%mm4, %%mm0 \n\t"\
- "paddd %%mm2, %%mm7 \n\t"\
- "paddd %%mm0, %%mm6 \n\t"\
- " jnz 2b \n\t"\
- "psrad $16, %%mm1 \n\t"\
- "psrad $16, %%mm5 \n\t"\
- "psrad $16, %%mm7 \n\t"\
- "psrad $16, %%mm6 \n\t"\
- "movq "VROUNDER_OFFSET"(%0), %%mm0 \n\t"\
- "packssdw %%mm5, %%mm1 \n\t"\
- "packssdw %%mm6, %%mm7 \n\t"\
- "paddw %%mm0, %%mm1 \n\t"\
- "paddw %%mm0, %%mm7 \n\t"\
- "movq "U_TEMP"(%0), %%mm3 \n\t"\
- "movq "V_TEMP"(%0), %%mm4 \n\t"\
-
-#define YSCALEYUV2PACKEDX_ACCURATE \
- YSCALEYUV2PACKEDX_ACCURATE_UV \
- YSCALEYUV2PACKEDX_ACCURATE_YA(LUM_MMX_FILTER_OFFSET)
-
-#define YSCALEYUV2RGBX \
- "psubw "U_OFFSET"(%0), %%mm3 \n\t" /* (U-128)8*/\
- "psubw "V_OFFSET"(%0), %%mm4 \n\t" /* (V-128)8*/\
- "movq %%mm3, %%mm2 \n\t" /* (U-128)8*/\
- "movq %%mm4, %%mm5 \n\t" /* (V-128)8*/\
- "pmulhw "UG_COEFF"(%0), %%mm3 \n\t"\
- "pmulhw "VG_COEFF"(%0), %%mm4 \n\t"\
- /* mm2=(U-128)8, mm3=ug, mm4=vg mm5=(V-128)8 */\
- "pmulhw "UB_COEFF"(%0), %%mm2 \n\t"\
- "pmulhw "VR_COEFF"(%0), %%mm5 \n\t"\
- "psubw "Y_OFFSET"(%0), %%mm1 \n\t" /* 8(Y-16)*/\
- "psubw "Y_OFFSET"(%0), %%mm7 \n\t" /* 8(Y-16)*/\
- "pmulhw "Y_COEFF"(%0), %%mm1 \n\t"\
- "pmulhw "Y_COEFF"(%0), %%mm7 \n\t"\
- /* mm1= Y1, mm2=ub, mm3=ug, mm4=vg mm5=vr, mm7=Y2 */\
- "paddw %%mm3, %%mm4 \n\t"\
- "movq %%mm2, %%mm0 \n\t"\
- "movq %%mm5, %%mm6 \n\t"\
- "movq %%mm4, %%mm3 \n\t"\
- "punpcklwd %%mm2, %%mm2 \n\t"\
- "punpcklwd %%mm5, %%mm5 \n\t"\
- "punpcklwd %%mm4, %%mm4 \n\t"\
- "paddw %%mm1, %%mm2 \n\t"\
- "paddw %%mm1, %%mm5 \n\t"\
- "paddw %%mm1, %%mm4 \n\t"\
- "punpckhwd %%mm0, %%mm0 \n\t"\
- "punpckhwd %%mm6, %%mm6 \n\t"\
- "punpckhwd %%mm3, %%mm3 \n\t"\
- "paddw %%mm7, %%mm0 \n\t"\
- "paddw %%mm7, %%mm6 \n\t"\
- "paddw %%mm7, %%mm3 \n\t"\
- /* mm0=B1, mm2=B2, mm3=G2, mm4=G1, mm5=R1, mm6=R2 */\
- "packuswb %%mm0, %%mm2 \n\t"\
- "packuswb %%mm6, %%mm5 \n\t"\
- "packuswb %%mm3, %%mm4 \n\t"\
-
-#define REAL_YSCALEYUV2PACKED(index, c) \
- "movq "CHR_MMX_FILTER_OFFSET"+8("#c"), %%mm0 \n\t"\
- "movq "LUM_MMX_FILTER_OFFSET"+8("#c"), %%mm1 \n\t"\
- "psraw $3, %%mm0 \n\t"\
- "psraw $3, %%mm1 \n\t"\
- "movq %%mm0, "CHR_MMX_FILTER_OFFSET"+8("#c") \n\t"\
- "movq %%mm1, "LUM_MMX_FILTER_OFFSET"+8("#c") \n\t"\
- "xor "#index", "#index" \n\t"\
- ASMALIGN(4)\
- "1: \n\t"\
- "movq (%2, "#index"), %%mm2 \n\t" /* uvbuf0[eax]*/\
- "movq (%3, "#index"), %%mm3 \n\t" /* uvbuf1[eax]*/\
- "movq "AV_STRINGIFY(VOF)"(%2, "#index"), %%mm5 \n\t" /* uvbuf0[eax+2048]*/\
- "movq "AV_STRINGIFY(VOF)"(%3, "#index"), %%mm4 \n\t" /* uvbuf1[eax+2048]*/\
- "psubw %%mm3, %%mm2 \n\t" /* uvbuf0[eax] - uvbuf1[eax]*/\
- "psubw %%mm4, %%mm5 \n\t" /* uvbuf0[eax+2048] - uvbuf1[eax+2048]*/\
- "movq "CHR_MMX_FILTER_OFFSET"+8("#c"), %%mm0 \n\t"\
- "pmulhw %%mm0, %%mm2 \n\t" /* (uvbuf0[eax] - uvbuf1[eax])uvalpha1>>16*/\
- "pmulhw %%mm0, %%mm5 \n\t" /* (uvbuf0[eax+2048] - uvbuf1[eax+2048])uvalpha1>>16*/\
- "psraw $7, %%mm3 \n\t" /* uvbuf0[eax] - uvbuf1[eax] >>4*/\
- "psraw $7, %%mm4 \n\t" /* uvbuf0[eax+2048] - uvbuf1[eax+2048] >>4*/\
- "paddw %%mm2, %%mm3 \n\t" /* uvbuf0[eax]uvalpha1 - uvbuf1[eax](1-uvalpha1)*/\
- "paddw %%mm5, %%mm4 \n\t" /* uvbuf0[eax+2048]uvalpha1 - uvbuf1[eax+2048](1-uvalpha1)*/\
- "movq (%0, "#index", 2), %%mm0 \n\t" /*buf0[eax]*/\
- "movq (%1, "#index", 2), %%mm1 \n\t" /*buf1[eax]*/\
- "movq 8(%0, "#index", 2), %%mm6 \n\t" /*buf0[eax]*/\
- "movq 8(%1, "#index", 2), %%mm7 \n\t" /*buf1[eax]*/\
- "psubw %%mm1, %%mm0 \n\t" /* buf0[eax] - buf1[eax]*/\
- "psubw %%mm7, %%mm6 \n\t" /* buf0[eax] - buf1[eax]*/\
- "pmulhw "LUM_MMX_FILTER_OFFSET"+8("#c"), %%mm0 \n\t" /* (buf0[eax] - buf1[eax])yalpha1>>16*/\
- "pmulhw "LUM_MMX_FILTER_OFFSET"+8("#c"), %%mm6 \n\t" /* (buf0[eax] - buf1[eax])yalpha1>>16*/\
- "psraw $7, %%mm1 \n\t" /* buf0[eax] - buf1[eax] >>4*/\
- "psraw $7, %%mm7 \n\t" /* buf0[eax] - buf1[eax] >>4*/\
- "paddw %%mm0, %%mm1 \n\t" /* buf0[eax]yalpha1 + buf1[eax](1-yalpha1) >>16*/\
- "paddw %%mm6, %%mm7 \n\t" /* buf0[eax]yalpha1 + buf1[eax](1-yalpha1) >>16*/\
-
-#define YSCALEYUV2PACKED(index, c) REAL_YSCALEYUV2PACKED(index, c)
-
-#define REAL_YSCALEYUV2RGB_UV(index, c) \
- "xor "#index", "#index" \n\t"\
- ASMALIGN(4)\
- "1: \n\t"\
- "movq (%2, "#index"), %%mm2 \n\t" /* uvbuf0[eax]*/\
- "movq (%3, "#index"), %%mm3 \n\t" /* uvbuf1[eax]*/\
- "movq "AV_STRINGIFY(VOF)"(%2, "#index"), %%mm5 \n\t" /* uvbuf0[eax+2048]*/\
- "movq "AV_STRINGIFY(VOF)"(%3, "#index"), %%mm4 \n\t" /* uvbuf1[eax+2048]*/\
- "psubw %%mm3, %%mm2 \n\t" /* uvbuf0[eax] - uvbuf1[eax]*/\
- "psubw %%mm4, %%mm5 \n\t" /* uvbuf0[eax+2048] - uvbuf1[eax+2048]*/\
- "movq "CHR_MMX_FILTER_OFFSET"+8("#c"), %%mm0 \n\t"\
- "pmulhw %%mm0, %%mm2 \n\t" /* (uvbuf0[eax] - uvbuf1[eax])uvalpha1>>16*/\
- "pmulhw %%mm0, %%mm5 \n\t" /* (uvbuf0[eax+2048] - uvbuf1[eax+2048])uvalpha1>>16*/\
- "psraw $4, %%mm3 \n\t" /* uvbuf0[eax] - uvbuf1[eax] >>4*/\
- "psraw $4, %%mm4 \n\t" /* uvbuf0[eax+2048] - uvbuf1[eax+2048] >>4*/\
- "paddw %%mm2, %%mm3 \n\t" /* uvbuf0[eax]uvalpha1 - uvbuf1[eax](1-uvalpha1)*/\
- "paddw %%mm5, %%mm4 \n\t" /* uvbuf0[eax+2048]uvalpha1 - uvbuf1[eax+2048](1-uvalpha1)*/\
- "psubw "U_OFFSET"("#c"), %%mm3 \n\t" /* (U-128)8*/\
- "psubw "V_OFFSET"("#c"), %%mm4 \n\t" /* (V-128)8*/\
- "movq %%mm3, %%mm2 \n\t" /* (U-128)8*/\
- "movq %%mm4, %%mm5 \n\t" /* (V-128)8*/\
- "pmulhw "UG_COEFF"("#c"), %%mm3 \n\t"\
- "pmulhw "VG_COEFF"("#c"), %%mm4 \n\t"\
- /* mm2=(U-128)8, mm3=ug, mm4=vg mm5=(V-128)8 */\
-
-#define REAL_YSCALEYUV2RGB_YA(index, c, b1, b2) \
- "movq ("#b1", "#index", 2), %%mm0 \n\t" /*buf0[eax]*/\
- "movq ("#b2", "#index", 2), %%mm1 \n\t" /*buf1[eax]*/\
- "movq 8("#b1", "#index", 2), %%mm6 \n\t" /*buf0[eax]*/\
- "movq 8("#b2", "#index", 2), %%mm7 \n\t" /*buf1[eax]*/\
- "psubw %%mm1, %%mm0 \n\t" /* buf0[eax] - buf1[eax]*/\
- "psubw %%mm7, %%mm6 \n\t" /* buf0[eax] - buf1[eax]*/\
- "pmulhw "LUM_MMX_FILTER_OFFSET"+8("#c"), %%mm0 \n\t" /* (buf0[eax] - buf1[eax])yalpha1>>16*/\
- "pmulhw "LUM_MMX_FILTER_OFFSET"+8("#c"), %%mm6 \n\t" /* (buf0[eax] - buf1[eax])yalpha1>>16*/\
- "psraw $4, %%mm1 \n\t" /* buf0[eax] - buf1[eax] >>4*/\
- "psraw $4, %%mm7 \n\t" /* buf0[eax] - buf1[eax] >>4*/\
- "paddw %%mm0, %%mm1 \n\t" /* buf0[eax]yalpha1 + buf1[eax](1-yalpha1) >>16*/\
- "paddw %%mm6, %%mm7 \n\t" /* buf0[eax]yalpha1 + buf1[eax](1-yalpha1) >>16*/\
-
-#define REAL_YSCALEYUV2RGB_COEFF(c) \
- "pmulhw "UB_COEFF"("#c"), %%mm2 \n\t"\
- "pmulhw "VR_COEFF"("#c"), %%mm5 \n\t"\
- "psubw "Y_OFFSET"("#c"), %%mm1 \n\t" /* 8(Y-16)*/\
- "psubw "Y_OFFSET"("#c"), %%mm7 \n\t" /* 8(Y-16)*/\
- "pmulhw "Y_COEFF"("#c"), %%mm1 \n\t"\
- "pmulhw "Y_COEFF"("#c"), %%mm7 \n\t"\
- /* mm1= Y1, mm2=ub, mm3=ug, mm4=vg mm5=vr, mm7=Y2 */\
- "paddw %%mm3, %%mm4 \n\t"\
- "movq %%mm2, %%mm0 \n\t"\
- "movq %%mm5, %%mm6 \n\t"\
- "movq %%mm4, %%mm3 \n\t"\
- "punpcklwd %%mm2, %%mm2 \n\t"\
- "punpcklwd %%mm5, %%mm5 \n\t"\
- "punpcklwd %%mm4, %%mm4 \n\t"\
- "paddw %%mm1, %%mm2 \n\t"\
- "paddw %%mm1, %%mm5 \n\t"\
- "paddw %%mm1, %%mm4 \n\t"\
- "punpckhwd %%mm0, %%mm0 \n\t"\
- "punpckhwd %%mm6, %%mm6 \n\t"\
- "punpckhwd %%mm3, %%mm3 \n\t"\
- "paddw %%mm7, %%mm0 \n\t"\
- "paddw %%mm7, %%mm6 \n\t"\
- "paddw %%mm7, %%mm3 \n\t"\
- /* mm0=B1, mm2=B2, mm3=G2, mm4=G1, mm5=R1, mm6=R2 */\
- "packuswb %%mm0, %%mm2 \n\t"\
- "packuswb %%mm6, %%mm5 \n\t"\
- "packuswb %%mm3, %%mm4 \n\t"\
-
-#define YSCALEYUV2RGB_YA(index, c, b1, b2) REAL_YSCALEYUV2RGB_YA(index, c, b1, b2)
-
-#define YSCALEYUV2RGB(index, c) \
- REAL_YSCALEYUV2RGB_UV(index, c) \
- REAL_YSCALEYUV2RGB_YA(index, c, %0, %1) \
- REAL_YSCALEYUV2RGB_COEFF(c)
-
-#define REAL_YSCALEYUV2PACKED1(index, c) \
- "xor "#index", "#index" \n\t"\
- ASMALIGN(4)\
- "1: \n\t"\
- "movq (%2, "#index"), %%mm3 \n\t" /* uvbuf0[eax]*/\
- "movq "AV_STRINGIFY(VOF)"(%2, "#index"), %%mm4 \n\t" /* uvbuf0[eax+2048]*/\
- "psraw $7, %%mm3 \n\t" \
- "psraw $7, %%mm4 \n\t" \
- "movq (%0, "#index", 2), %%mm1 \n\t" /*buf0[eax]*/\
- "movq 8(%0, "#index", 2), %%mm7 \n\t" /*buf0[eax]*/\
- "psraw $7, %%mm1 \n\t" \
- "psraw $7, %%mm7 \n\t" \
-
-#define YSCALEYUV2PACKED1(index, c) REAL_YSCALEYUV2PACKED1(index, c)
-
-#define REAL_YSCALEYUV2RGB1(index, c) \
- "xor "#index", "#index" \n\t"\
- ASMALIGN(4)\
- "1: \n\t"\
- "movq (%2, "#index"), %%mm3 \n\t" /* uvbuf0[eax]*/\
- "movq "AV_STRINGIFY(VOF)"(%2, "#index"), %%mm4 \n\t" /* uvbuf0[eax+2048]*/\
- "psraw $4, %%mm3 \n\t" /* uvbuf0[eax] - uvbuf1[eax] >>4*/\
- "psraw $4, %%mm4 \n\t" /* uvbuf0[eax+2048] - uvbuf1[eax+2048] >>4*/\
- "psubw "U_OFFSET"("#c"), %%mm3 \n\t" /* (U-128)8*/\
- "psubw "V_OFFSET"("#c"), %%mm4 \n\t" /* (V-128)8*/\
- "movq %%mm3, %%mm2 \n\t" /* (U-128)8*/\
- "movq %%mm4, %%mm5 \n\t" /* (V-128)8*/\
- "pmulhw "UG_COEFF"("#c"), %%mm3 \n\t"\
- "pmulhw "VG_COEFF"("#c"), %%mm4 \n\t"\
- /* mm2=(U-128)8, mm3=ug, mm4=vg mm5=(V-128)8 */\
- "movq (%0, "#index", 2), %%mm1 \n\t" /*buf0[eax]*/\
- "movq 8(%0, "#index", 2), %%mm7 \n\t" /*buf0[eax]*/\
- "psraw $4, %%mm1 \n\t" /* buf0[eax] - buf1[eax] >>4*/\
- "psraw $4, %%mm7 \n\t" /* buf0[eax] - buf1[eax] >>4*/\
- "pmulhw "UB_COEFF"("#c"), %%mm2 \n\t"\
- "pmulhw "VR_COEFF"("#c"), %%mm5 \n\t"\
- "psubw "Y_OFFSET"("#c"), %%mm1 \n\t" /* 8(Y-16)*/\
- "psubw "Y_OFFSET"("#c"), %%mm7 \n\t" /* 8(Y-16)*/\
- "pmulhw "Y_COEFF"("#c"), %%mm1 \n\t"\
- "pmulhw "Y_COEFF"("#c"), %%mm7 \n\t"\
- /* mm1= Y1, mm2=ub, mm3=ug, mm4=vg mm5=vr, mm7=Y2 */\
- "paddw %%mm3, %%mm4 \n\t"\
- "movq %%mm2, %%mm0 \n\t"\
- "movq %%mm5, %%mm6 \n\t"\
- "movq %%mm4, %%mm3 \n\t"\
- "punpcklwd %%mm2, %%mm2 \n\t"\
- "punpcklwd %%mm5, %%mm5 \n\t"\
- "punpcklwd %%mm4, %%mm4 \n\t"\
- "paddw %%mm1, %%mm2 \n\t"\
- "paddw %%mm1, %%mm5 \n\t"\
- "paddw %%mm1, %%mm4 \n\t"\
- "punpckhwd %%mm0, %%mm0 \n\t"\
- "punpckhwd %%mm6, %%mm6 \n\t"\
- "punpckhwd %%mm3, %%mm3 \n\t"\
- "paddw %%mm7, %%mm0 \n\t"\
- "paddw %%mm7, %%mm6 \n\t"\
- "paddw %%mm7, %%mm3 \n\t"\
- /* mm0=B1, mm2=B2, mm3=G2, mm4=G1, mm5=R1, mm6=R2 */\
- "packuswb %%mm0, %%mm2 \n\t"\
- "packuswb %%mm6, %%mm5 \n\t"\
- "packuswb %%mm3, %%mm4 \n\t"\
-
-#define YSCALEYUV2RGB1(index, c) REAL_YSCALEYUV2RGB1(index, c)
-
-#define REAL_YSCALEYUV2PACKED1b(index, c) \
- "xor "#index", "#index" \n\t"\
- ASMALIGN(4)\
- "1: \n\t"\
- "movq (%2, "#index"), %%mm2 \n\t" /* uvbuf0[eax]*/\
- "movq (%3, "#index"), %%mm3 \n\t" /* uvbuf1[eax]*/\
- "movq "AV_STRINGIFY(VOF)"(%2, "#index"), %%mm5 \n\t" /* uvbuf0[eax+2048]*/\
- "movq "AV_STRINGIFY(VOF)"(%3, "#index"), %%mm4 \n\t" /* uvbuf1[eax+2048]*/\
- "paddw %%mm2, %%mm3 \n\t" /* uvbuf0[eax] + uvbuf1[eax]*/\
- "paddw %%mm5, %%mm4 \n\t" /* uvbuf0[eax+2048] + uvbuf1[eax+2048]*/\
- "psrlw $8, %%mm3 \n\t" \
- "psrlw $8, %%mm4 \n\t" \
- "movq (%0, "#index", 2), %%mm1 \n\t" /*buf0[eax]*/\
- "movq 8(%0, "#index", 2), %%mm7 \n\t" /*buf0[eax]*/\
- "psraw $7, %%mm1 \n\t" \
- "psraw $7, %%mm7 \n\t"
-#define YSCALEYUV2PACKED1b(index, c) REAL_YSCALEYUV2PACKED1b(index, c)
-
-// do vertical chrominance interpolation
-#define REAL_YSCALEYUV2RGB1b(index, c) \
- "xor "#index", "#index" \n\t"\
- ASMALIGN(4)\
- "1: \n\t"\
- "movq (%2, "#index"), %%mm2 \n\t" /* uvbuf0[eax]*/\
- "movq (%3, "#index"), %%mm3 \n\t" /* uvbuf1[eax]*/\
- "movq "AV_STRINGIFY(VOF)"(%2, "#index"), %%mm5 \n\t" /* uvbuf0[eax+2048]*/\
- "movq "AV_STRINGIFY(VOF)"(%3, "#index"), %%mm4 \n\t" /* uvbuf1[eax+2048]*/\
- "paddw %%mm2, %%mm3 \n\t" /* uvbuf0[eax] + uvbuf1[eax]*/\
- "paddw %%mm5, %%mm4 \n\t" /* uvbuf0[eax+2048] + uvbuf1[eax+2048]*/\
- "psrlw $5, %%mm3 \n\t" /*FIXME might overflow*/\
- "psrlw $5, %%mm4 \n\t" /*FIXME might overflow*/\
- "psubw "U_OFFSET"("#c"), %%mm3 \n\t" /* (U-128)8*/\
- "psubw "V_OFFSET"("#c"), %%mm4 \n\t" /* (V-128)8*/\
- "movq %%mm3, %%mm2 \n\t" /* (U-128)8*/\
- "movq %%mm4, %%mm5 \n\t" /* (V-128)8*/\
- "pmulhw "UG_COEFF"("#c"), %%mm3 \n\t"\
- "pmulhw "VG_COEFF"("#c"), %%mm4 \n\t"\
- /* mm2=(U-128)8, mm3=ug, mm4=vg mm5=(V-128)8 */\
- "movq (%0, "#index", 2), %%mm1 \n\t" /*buf0[eax]*/\
- "movq 8(%0, "#index", 2), %%mm7 \n\t" /*buf0[eax]*/\
- "psraw $4, %%mm1 \n\t" /* buf0[eax] - buf1[eax] >>4*/\
- "psraw $4, %%mm7 \n\t" /* buf0[eax] - buf1[eax] >>4*/\
- "pmulhw "UB_COEFF"("#c"), %%mm2 \n\t"\
- "pmulhw "VR_COEFF"("#c"), %%mm5 \n\t"\
- "psubw "Y_OFFSET"("#c"), %%mm1 \n\t" /* 8(Y-16)*/\
- "psubw "Y_OFFSET"("#c"), %%mm7 \n\t" /* 8(Y-16)*/\
- "pmulhw "Y_COEFF"("#c"), %%mm1 \n\t"\
- "pmulhw "Y_COEFF"("#c"), %%mm7 \n\t"\
- /* mm1= Y1, mm2=ub, mm3=ug, mm4=vg mm5=vr, mm7=Y2 */\
- "paddw %%mm3, %%mm4 \n\t"\
- "movq %%mm2, %%mm0 \n\t"\
- "movq %%mm5, %%mm6 \n\t"\
- "movq %%mm4, %%mm3 \n\t"\
- "punpcklwd %%mm2, %%mm2 \n\t"\
- "punpcklwd %%mm5, %%mm5 \n\t"\
- "punpcklwd %%mm4, %%mm4 \n\t"\
- "paddw %%mm1, %%mm2 \n\t"\
- "paddw %%mm1, %%mm5 \n\t"\
- "paddw %%mm1, %%mm4 \n\t"\
- "punpckhwd %%mm0, %%mm0 \n\t"\
- "punpckhwd %%mm6, %%mm6 \n\t"\
- "punpckhwd %%mm3, %%mm3 \n\t"\
- "paddw %%mm7, %%mm0 \n\t"\
- "paddw %%mm7, %%mm6 \n\t"\
- "paddw %%mm7, %%mm3 \n\t"\
- /* mm0=B1, mm2=B2, mm3=G2, mm4=G1, mm5=R1, mm6=R2 */\
- "packuswb %%mm0, %%mm2 \n\t"\
- "packuswb %%mm6, %%mm5 \n\t"\
- "packuswb %%mm3, %%mm4 \n\t"\
-
-#define YSCALEYUV2RGB1b(index, c) REAL_YSCALEYUV2RGB1b(index, c)
-
-#define REAL_YSCALEYUV2RGB1_ALPHA(index) \
- "movq (%1, "#index", 2), %%mm7 \n\t" /* abuf0[index ] */\
- "movq 8(%1, "#index", 2), %%mm1 \n\t" /* abuf0[index+4] */\
- "psraw $7, %%mm7 \n\t" /* abuf0[index ] >>7 */\
- "psraw $7, %%mm1 \n\t" /* abuf0[index+4] >>7 */\
- "packuswb %%mm1, %%mm7 \n\t"
-#define YSCALEYUV2RGB1_ALPHA(index) REAL_YSCALEYUV2RGB1_ALPHA(index)
-
-#define REAL_WRITEBGR32(dst, dstw, index, b, g, r, a, q0, q2, q3, t) \
- "movq "#b", "#q2" \n\t" /* B */\
- "movq "#r", "#t" \n\t" /* R */\
- "punpcklbw "#g", "#b" \n\t" /* GBGBGBGB 0 */\
- "punpcklbw "#a", "#r" \n\t" /* ARARARAR 0 */\
- "punpckhbw "#g", "#q2" \n\t" /* GBGBGBGB 2 */\
- "punpckhbw "#a", "#t" \n\t" /* ARARARAR 2 */\
- "movq "#b", "#q0" \n\t" /* GBGBGBGB 0 */\
- "movq "#q2", "#q3" \n\t" /* GBGBGBGB 2 */\
- "punpcklwd "#r", "#q0" \n\t" /* ARGBARGB 0 */\
- "punpckhwd "#r", "#b" \n\t" /* ARGBARGB 1 */\
- "punpcklwd "#t", "#q2" \n\t" /* ARGBARGB 2 */\
- "punpckhwd "#t", "#q3" \n\t" /* ARGBARGB 3 */\
-\
- MOVNTQ( q0, (dst, index, 4))\
- MOVNTQ( b, 8(dst, index, 4))\
- MOVNTQ( q2, 16(dst, index, 4))\
- MOVNTQ( q3, 24(dst, index, 4))\
-\
- "add $8, "#index" \n\t"\
- "cmp "#dstw", "#index" \n\t"\
- " jb 1b \n\t"
-#define WRITEBGR32(dst, dstw, index, b, g, r, a, q0, q2, q3, t) REAL_WRITEBGR32(dst, dstw, index, b, g, r, a, q0, q2, q3, t)
-
-#define REAL_WRITERGB16(dst, dstw, index) \
- "pand "MANGLE(bF8)", %%mm2 \n\t" /* B */\
- "pand "MANGLE(bFC)", %%mm4 \n\t" /* G */\
- "pand "MANGLE(bF8)", %%mm5 \n\t" /* R */\
- "psrlq $3, %%mm2 \n\t"\
-\
- "movq %%mm2, %%mm1 \n\t"\
- "movq %%mm4, %%mm3 \n\t"\
-\
- "punpcklbw %%mm7, %%mm3 \n\t"\
- "punpcklbw %%mm5, %%mm2 \n\t"\
- "punpckhbw %%mm7, %%mm4 \n\t"\
- "punpckhbw %%mm5, %%mm1 \n\t"\
-\
- "psllq $3, %%mm3 \n\t"\
- "psllq $3, %%mm4 \n\t"\
-\
- "por %%mm3, %%mm2 \n\t"\
- "por %%mm4, %%mm1 \n\t"\
-\
- MOVNTQ(%%mm2, (dst, index, 2))\
- MOVNTQ(%%mm1, 8(dst, index, 2))\
-\
- "add $8, "#index" \n\t"\
- "cmp "#dstw", "#index" \n\t"\
- " jb 1b \n\t"
-#define WRITERGB16(dst, dstw, index) REAL_WRITERGB16(dst, dstw, index)
-
-#define REAL_WRITERGB15(dst, dstw, index) \
- "pand "MANGLE(bF8)", %%mm2 \n\t" /* B */\
- "pand "MANGLE(bF8)", %%mm4 \n\t" /* G */\
- "pand "MANGLE(bF8)", %%mm5 \n\t" /* R */\
- "psrlq $3, %%mm2 \n\t"\
- "psrlq $1, %%mm5 \n\t"\
-\
- "movq %%mm2, %%mm1 \n\t"\
- "movq %%mm4, %%mm3 \n\t"\
-\
- "punpcklbw %%mm7, %%mm3 \n\t"\
- "punpcklbw %%mm5, %%mm2 \n\t"\
- "punpckhbw %%mm7, %%mm4 \n\t"\
- "punpckhbw %%mm5, %%mm1 \n\t"\
-\
- "psllq $2, %%mm3 \n\t"\
- "psllq $2, %%mm4 \n\t"\
-\
- "por %%mm3, %%mm2 \n\t"\
- "por %%mm4, %%mm1 \n\t"\
-\
- MOVNTQ(%%mm2, (dst, index, 2))\
- MOVNTQ(%%mm1, 8(dst, index, 2))\
-\
- "add $8, "#index" \n\t"\
- "cmp "#dstw", "#index" \n\t"\
- " jb 1b \n\t"
-#define WRITERGB15(dst, dstw, index) REAL_WRITERGB15(dst, dstw, index)
-
-#define WRITEBGR24OLD(dst, dstw, index) \
- /* mm2=B, %%mm4=G, %%mm5=R, %%mm7=0 */\
- "movq %%mm2, %%mm1 \n\t" /* B */\
- "movq %%mm5, %%mm6 \n\t" /* R */\
- "punpcklbw %%mm4, %%mm2 \n\t" /* GBGBGBGB 0 */\
- "punpcklbw %%mm7, %%mm5 \n\t" /* 0R0R0R0R 0 */\
- "punpckhbw %%mm4, %%mm1 \n\t" /* GBGBGBGB 2 */\
- "punpckhbw %%mm7, %%mm6 \n\t" /* 0R0R0R0R 2 */\
- "movq %%mm2, %%mm0 \n\t" /* GBGBGBGB 0 */\
- "movq %%mm1, %%mm3 \n\t" /* GBGBGBGB 2 */\
- "punpcklwd %%mm5, %%mm0 \n\t" /* 0RGB0RGB 0 */\
- "punpckhwd %%mm5, %%mm2 \n\t" /* 0RGB0RGB 1 */\
- "punpcklwd %%mm6, %%mm1 \n\t" /* 0RGB0RGB 2 */\
- "punpckhwd %%mm6, %%mm3 \n\t" /* 0RGB0RGB 3 */\
-\
- "movq %%mm0, %%mm4 \n\t" /* 0RGB0RGB 0 */\
- "psrlq $8, %%mm0 \n\t" /* 00RGB0RG 0 */\
- "pand "MANGLE(bm00000111)", %%mm4 \n\t" /* 00000RGB 0 */\
- "pand "MANGLE(bm11111000)", %%mm0 \n\t" /* 00RGB000 0.5 */\
- "por %%mm4, %%mm0 \n\t" /* 00RGBRGB 0 */\
- "movq %%mm2, %%mm4 \n\t" /* 0RGB0RGB 1 */\
- "psllq $48, %%mm2 \n\t" /* GB000000 1 */\
- "por %%mm2, %%mm0 \n\t" /* GBRGBRGB 0 */\
-\
- "movq %%mm4, %%mm2 \n\t" /* 0RGB0RGB 1 */\
- "psrld $16, %%mm4 \n\t" /* 000R000R 1 */\
- "psrlq $24, %%mm2 \n\t" /* 0000RGB0 1.5 */\
- "por %%mm4, %%mm2 \n\t" /* 000RRGBR 1 */\
- "pand "MANGLE(bm00001111)", %%mm2 \n\t" /* 0000RGBR 1 */\
- "movq %%mm1, %%mm4 \n\t" /* 0RGB0RGB 2 */\
- "psrlq $8, %%mm1 \n\t" /* 00RGB0RG 2 */\
- "pand "MANGLE(bm00000111)", %%mm4 \n\t" /* 00000RGB 2 */\
- "pand "MANGLE(bm11111000)", %%mm1 \n\t" /* 00RGB000 2.5 */\
- "por %%mm4, %%mm1 \n\t" /* 00RGBRGB 2 */\
- "movq %%mm1, %%mm4 \n\t" /* 00RGBRGB 2 */\
- "psllq $32, %%mm1 \n\t" /* BRGB0000 2 */\
- "por %%mm1, %%mm2 \n\t" /* BRGBRGBR 1 */\
-\
- "psrlq $32, %%mm4 \n\t" /* 000000RG 2.5 */\
- "movq %%mm3, %%mm5 \n\t" /* 0RGB0RGB 3 */\
- "psrlq $8, %%mm3 \n\t" /* 00RGB0RG 3 */\
- "pand "MANGLE(bm00000111)", %%mm5 \n\t" /* 00000RGB 3 */\
- "pand "MANGLE(bm11111000)", %%mm3 \n\t" /* 00RGB000 3.5 */\
- "por %%mm5, %%mm3 \n\t" /* 00RGBRGB 3 */\
- "psllq $16, %%mm3 \n\t" /* RGBRGB00 3 */\
- "por %%mm4, %%mm3 \n\t" /* RGBRGBRG 2.5 */\
-\
- MOVNTQ(%%mm0, (dst))\
- MOVNTQ(%%mm2, 8(dst))\
- MOVNTQ(%%mm3, 16(dst))\
- "add $24, "#dst" \n\t"\
-\
- "add $8, "#index" \n\t"\
- "cmp "#dstw", "#index" \n\t"\
- " jb 1b \n\t"
-
-#define WRITEBGR24MMX(dst, dstw, index) \
- /* mm2=B, %%mm4=G, %%mm5=R, %%mm7=0 */\
- "movq %%mm2, %%mm1 \n\t" /* B */\
- "movq %%mm5, %%mm6 \n\t" /* R */\
- "punpcklbw %%mm4, %%mm2 \n\t" /* GBGBGBGB 0 */\
- "punpcklbw %%mm7, %%mm5 \n\t" /* 0R0R0R0R 0 */\
- "punpckhbw %%mm4, %%mm1 \n\t" /* GBGBGBGB 2 */\
- "punpckhbw %%mm7, %%mm6 \n\t" /* 0R0R0R0R 2 */\
- "movq %%mm2, %%mm0 \n\t" /* GBGBGBGB 0 */\
- "movq %%mm1, %%mm3 \n\t" /* GBGBGBGB 2 */\
- "punpcklwd %%mm5, %%mm0 \n\t" /* 0RGB0RGB 0 */\
- "punpckhwd %%mm5, %%mm2 \n\t" /* 0RGB0RGB 1 */\
- "punpcklwd %%mm6, %%mm1 \n\t" /* 0RGB0RGB 2 */\
- "punpckhwd %%mm6, %%mm3 \n\t" /* 0RGB0RGB 3 */\
-\
- "movq %%mm0, %%mm4 \n\t" /* 0RGB0RGB 0 */\
- "movq %%mm2, %%mm6 \n\t" /* 0RGB0RGB 1 */\
- "movq %%mm1, %%mm5 \n\t" /* 0RGB0RGB 2 */\
- "movq %%mm3, %%mm7 \n\t" /* 0RGB0RGB 3 */\
-\
- "psllq $40, %%mm0 \n\t" /* RGB00000 0 */\
- "psllq $40, %%mm2 \n\t" /* RGB00000 1 */\
- "psllq $40, %%mm1 \n\t" /* RGB00000 2 */\
- "psllq $40, %%mm3 \n\t" /* RGB00000 3 */\
-\
- "punpckhdq %%mm4, %%mm0 \n\t" /* 0RGBRGB0 0 */\
- "punpckhdq %%mm6, %%mm2 \n\t" /* 0RGBRGB0 1 */\
- "punpckhdq %%mm5, %%mm1 \n\t" /* 0RGBRGB0 2 */\
- "punpckhdq %%mm7, %%mm3 \n\t" /* 0RGBRGB0 3 */\
-\
- "psrlq $8, %%mm0 \n\t" /* 00RGBRGB 0 */\
- "movq %%mm2, %%mm6 \n\t" /* 0RGBRGB0 1 */\
- "psllq $40, %%mm2 \n\t" /* GB000000 1 */\
- "por %%mm2, %%mm0 \n\t" /* GBRGBRGB 0 */\
- MOVNTQ(%%mm0, (dst))\
-\
- "psrlq $24, %%mm6 \n\t" /* 0000RGBR 1 */\
- "movq %%mm1, %%mm5 \n\t" /* 0RGBRGB0 2 */\
- "psllq $24, %%mm1 \n\t" /* BRGB0000 2 */\
- "por %%mm1, %%mm6 \n\t" /* BRGBRGBR 1 */\
- MOVNTQ(%%mm6, 8(dst))\
-\
- "psrlq $40, %%mm5 \n\t" /* 000000RG 2 */\
- "psllq $8, %%mm3 \n\t" /* RGBRGB00 3 */\
- "por %%mm3, %%mm5 \n\t" /* RGBRGBRG 2 */\
- MOVNTQ(%%mm5, 16(dst))\
-\
- "add $24, "#dst" \n\t"\
-\
- "add $8, "#index" \n\t"\
- "cmp "#dstw", "#index" \n\t"\
- " jb 1b \n\t"
-
-#define WRITEBGR24MMX2(dst, dstw, index) \
- /* mm2=B, %%mm4=G, %%mm5=R, %%mm7=0 */\
- "movq "MANGLE(ff_M24A)", %%mm0 \n\t"\
- "movq "MANGLE(ff_M24C)", %%mm7 \n\t"\
- "pshufw $0x50, %%mm2, %%mm1 \n\t" /* B3 B2 B3 B2 B1 B0 B1 B0 */\
- "pshufw $0x50, %%mm4, %%mm3 \n\t" /* G3 G2 G3 G2 G1 G0 G1 G0 */\
- "pshufw $0x00, %%mm5, %%mm6 \n\t" /* R1 R0 R1 R0 R1 R0 R1 R0 */\
-\
- "pand %%mm0, %%mm1 \n\t" /* B2 B1 B0 */\
- "pand %%mm0, %%mm3 \n\t" /* G2 G1 G0 */\
- "pand %%mm7, %%mm6 \n\t" /* R1 R0 */\
-\
- "psllq $8, %%mm3 \n\t" /* G2 G1 G0 */\
- "por %%mm1, %%mm6 \n\t"\
- "por %%mm3, %%mm6 \n\t"\
- MOVNTQ(%%mm6, (dst))\
-\
- "psrlq $8, %%mm4 \n\t" /* 00 G7 G6 G5 G4 G3 G2 G1 */\
- "pshufw $0xA5, %%mm2, %%mm1 \n\t" /* B5 B4 B5 B4 B3 B2 B3 B2 */\
- "pshufw $0x55, %%mm4, %%mm3 \n\t" /* G4 G3 G4 G3 G4 G3 G4 G3 */\
- "pshufw $0xA5, %%mm5, %%mm6 \n\t" /* R5 R4 R5 R4 R3 R2 R3 R2 */\
-\
- "pand "MANGLE(ff_M24B)", %%mm1 \n\t" /* B5 B4 B3 */\
- "pand %%mm7, %%mm3 \n\t" /* G4 G3 */\
- "pand %%mm0, %%mm6 \n\t" /* R4 R3 R2 */\
-\
- "por %%mm1, %%mm3 \n\t" /* B5 G4 B4 G3 B3 */\
- "por %%mm3, %%mm6 \n\t"\
- MOVNTQ(%%mm6, 8(dst))\
-\
- "pshufw $0xFF, %%mm2, %%mm1 \n\t" /* B7 B6 B7 B6 B7 B6 B6 B7 */\
- "pshufw $0xFA, %%mm4, %%mm3 \n\t" /* 00 G7 00 G7 G6 G5 G6 G5 */\
- "pshufw $0xFA, %%mm5, %%mm6 \n\t" /* R7 R6 R7 R6 R5 R4 R5 R4 */\
-\
- "pand %%mm7, %%mm1 \n\t" /* B7 B6 */\
- "pand %%mm0, %%mm3 \n\t" /* G7 G6 G5 */\
- "pand "MANGLE(ff_M24B)", %%mm6 \n\t" /* R7 R6 R5 */\
-\
- "por %%mm1, %%mm3 \n\t"\
- "por %%mm3, %%mm6 \n\t"\
- MOVNTQ(%%mm6, 16(dst))\
-\
- "add $24, "#dst" \n\t"\
-\
- "add $8, "#index" \n\t"\
- "cmp "#dstw", "#index" \n\t"\
- " jb 1b \n\t"
-
-#if COMPILE_TEMPLATE_MMX2
-#undef WRITEBGR24
-#define WRITEBGR24(dst, dstw, index) WRITEBGR24MMX2(dst, dstw, index)
-#else
-#undef WRITEBGR24
-#define WRITEBGR24(dst, dstw, index) WRITEBGR24MMX(dst, dstw, index)
-#endif
-
-#define REAL_WRITEYUY2(dst, dstw, index) \
- "packuswb %%mm3, %%mm3 \n\t"\
- "packuswb %%mm4, %%mm4 \n\t"\
- "packuswb %%mm7, %%mm1 \n\t"\
- "punpcklbw %%mm4, %%mm3 \n\t"\
- "movq %%mm1, %%mm7 \n\t"\
- "punpcklbw %%mm3, %%mm1 \n\t"\
- "punpckhbw %%mm3, %%mm7 \n\t"\
-\
- MOVNTQ(%%mm1, (dst, index, 2))\
- MOVNTQ(%%mm7, 8(dst, index, 2))\
-\
- "add $8, "#index" \n\t"\
- "cmp "#dstw", "#index" \n\t"\
- " jb 1b \n\t"
-#define WRITEYUY2(dst, dstw, index) REAL_WRITEYUY2(dst, dstw, index)
-
-
-static inline void RENAME(yuv2yuvX)(SwsContext *c, const int16_t *lumFilter, const int16_t **lumSrc, int lumFilterSize,
- const int16_t *chrFilter, const int16_t **chrSrc, int chrFilterSize, const int16_t **alpSrc,
- uint8_t *dest, uint8_t *uDest, uint8_t *vDest, uint8_t *aDest, long dstW, long chrDstW)
-{
-#if COMPILE_TEMPLATE_MMX
- if(!(c->flags & SWS_BITEXACT)) {
- if (c->flags & SWS_ACCURATE_RND) {
- if (uDest) {
- YSCALEYUV2YV12X_ACCURATE( "0", CHR_MMX_FILTER_OFFSET, uDest, chrDstW)
- YSCALEYUV2YV12X_ACCURATE(AV_STRINGIFY(VOF), CHR_MMX_FILTER_OFFSET, vDest, chrDstW)
- }
- if (CONFIG_SWSCALE_ALPHA && aDest) {
- YSCALEYUV2YV12X_ACCURATE( "0", ALP_MMX_FILTER_OFFSET, aDest, dstW)
- }
-
- YSCALEYUV2YV12X_ACCURATE("0", LUM_MMX_FILTER_OFFSET, dest, dstW)
- } else {
- if (uDest) {
- YSCALEYUV2YV12X( "0", CHR_MMX_FILTER_OFFSET, uDest, chrDstW)
- YSCALEYUV2YV12X(AV_STRINGIFY(VOF), CHR_MMX_FILTER_OFFSET, vDest, chrDstW)
- }
- if (CONFIG_SWSCALE_ALPHA && aDest) {
- YSCALEYUV2YV12X( "0", ALP_MMX_FILTER_OFFSET, aDest, dstW)
- }
-
- YSCALEYUV2YV12X("0", LUM_MMX_FILTER_OFFSET, dest, dstW)
- }
- return;
- }
-#endif
-#if COMPILE_TEMPLATE_ALTIVEC
- yuv2yuvX_altivec_real(lumFilter, lumSrc, lumFilterSize,
- chrFilter, chrSrc, chrFilterSize,
- dest, uDest, vDest, dstW, chrDstW);
-#else //COMPILE_TEMPLATE_ALTIVEC
- yuv2yuvXinC(lumFilter, lumSrc, lumFilterSize,
- chrFilter, chrSrc, chrFilterSize,
- alpSrc, dest, uDest, vDest, aDest, dstW, chrDstW);
-#endif //!COMPILE_TEMPLATE_ALTIVEC
-}
-
-static inline void RENAME(yuv2nv12X)(SwsContext *c, const int16_t *lumFilter, const int16_t **lumSrc, int lumFilterSize,
- const int16_t *chrFilter, const int16_t **chrSrc, int chrFilterSize,
- uint8_t *dest, uint8_t *uDest, int dstW, int chrDstW, enum PixelFormat dstFormat)
-{
- yuv2nv12XinC(lumFilter, lumSrc, lumFilterSize,
- chrFilter, chrSrc, chrFilterSize,
- dest, uDest, dstW, chrDstW, dstFormat);
-}
-
-static inline void RENAME(yuv2yuv1)(SwsContext *c, const int16_t *lumSrc, const int16_t *chrSrc, const int16_t *alpSrc,
- uint8_t *dest, uint8_t *uDest, uint8_t *vDest, uint8_t *aDest, long dstW, long chrDstW)
-{
- int i;
-#if COMPILE_TEMPLATE_MMX
- if(!(c->flags & SWS_BITEXACT)) {
- long p= 4;
- const uint8_t *src[4]= {alpSrc + dstW, lumSrc + dstW, chrSrc + chrDstW, chrSrc + VOFW + chrDstW};
- uint8_t *dst[4]= {aDest, dest, uDest, vDest};
- x86_reg counter[4]= {dstW, dstW, chrDstW, chrDstW};
-
- if (c->flags & SWS_ACCURATE_RND) {
- while(p--) {
- if (dst[p]) {
- __asm__ volatile(
- YSCALEYUV2YV121_ACCURATE
- :: "r" (src[p]), "r" (dst[p] + counter[p]),
- "g" (-counter[p])
- : "%"REG_a
- );
- }
- }
- } else {
- while(p--) {
- if (dst[p]) {
- __asm__ volatile(
- YSCALEYUV2YV121
- :: "r" (src[p]), "r" (dst[p] + counter[p]),
- "g" (-counter[p])
- : "%"REG_a
- );
- }
- }
- }
- return;
- }
-#endif
- for (i=0; i<dstW; i++) {
- int val= (lumSrc[i]+64)>>7;
-
- if (val&256) {
- if (val<0) val=0;
- else val=255;
- }
-
- dest[i]= val;
- }
-
- if (uDest)
- for (i=0; i<chrDstW; i++) {
- int u=(chrSrc[i ]+64)>>7;
- int v=(chrSrc[i + VOFW]+64)>>7;
-
- if ((u|v)&256) {
- if (u<0) u=0;
- else if (u>255) u=255;
- if (v<0) v=0;
- else if (v>255) v=255;
- }
-
- uDest[i]= u;
- vDest[i]= v;
- }
-
- if (CONFIG_SWSCALE_ALPHA && aDest)
- for (i=0; i<dstW; i++) {
- int val= (alpSrc[i]+64)>>7;
- aDest[i]= av_clip_uint8(val);
- }
-}
-
-
-/**
- * vertical scale YV12 to RGB
- */
-static inline void RENAME(yuv2packedX)(SwsContext *c, const int16_t *lumFilter, const int16_t **lumSrc, int lumFilterSize,
- const int16_t *chrFilter, const int16_t **chrSrc, int chrFilterSize,
- const int16_t **alpSrc, uint8_t *dest, long dstW, long dstY)
-{
-#if COMPILE_TEMPLATE_MMX
- x86_reg dummy=0;
- if(!(c->flags & SWS_BITEXACT)) {
- if (c->flags & SWS_ACCURATE_RND) {
- switch(c->dstFormat) {
- case PIX_FMT_RGB32:
- if (CONFIG_SWSCALE_ALPHA && c->alpPixBuf) {
- YSCALEYUV2PACKEDX_ACCURATE
- YSCALEYUV2RGBX
- "movq %%mm2, "U_TEMP"(%0) \n\t"
- "movq %%mm4, "V_TEMP"(%0) \n\t"
- "movq %%mm5, "Y_TEMP"(%0) \n\t"
- YSCALEYUV2PACKEDX_ACCURATE_YA(ALP_MMX_FILTER_OFFSET)
- "movq "Y_TEMP"(%0), %%mm5 \n\t"
- "psraw $3, %%mm1 \n\t"
- "psraw $3, %%mm7 \n\t"
- "packuswb %%mm7, %%mm1 \n\t"
- WRITEBGR32(%4, %5, %%REGa, %%mm3, %%mm4, %%mm5, %%mm1, %%mm0, %%mm7, %%mm2, %%mm6)
-
- YSCALEYUV2PACKEDX_END
- } else {
- YSCALEYUV2PACKEDX_ACCURATE
- YSCALEYUV2RGBX
- "pcmpeqd %%mm7, %%mm7 \n\t"
- WRITEBGR32(%4, %5, %%REGa, %%mm2, %%mm4, %%mm5, %%mm7, %%mm0, %%mm1, %%mm3, %%mm6)
-
- YSCALEYUV2PACKEDX_END
- }
- return;
- case PIX_FMT_BGR24:
- YSCALEYUV2PACKEDX_ACCURATE
- YSCALEYUV2RGBX
- "pxor %%mm7, %%mm7 \n\t"
- "lea (%%"REG_a", %%"REG_a", 2), %%"REG_c"\n\t" //FIXME optimize
- "add %4, %%"REG_c" \n\t"
- WRITEBGR24(%%REGc, %5, %%REGa)
-
-
- :: "r" (&c->redDither),
- "m" (dummy), "m" (dummy), "m" (dummy),
- "r" (dest), "m" (dstW)
- : "%"REG_a, "%"REG_c, "%"REG_d, "%"REG_S
- );
- return;
- case PIX_FMT_RGB555:
- YSCALEYUV2PACKEDX_ACCURATE
- YSCALEYUV2RGBX
- "pxor %%mm7, %%mm7 \n\t"
- /* mm2=B, %%mm4=G, %%mm5=R, %%mm7=0 */
-#ifdef DITHER1XBPP
- "paddusb "BLUE_DITHER"(%0), %%mm2\n\t"
- "paddusb "GREEN_DITHER"(%0), %%mm4\n\t"
- "paddusb "RED_DITHER"(%0), %%mm5\n\t"
-#endif
-
- WRITERGB15(%4, %5, %%REGa)
- YSCALEYUV2PACKEDX_END
- return;
- case PIX_FMT_RGB565:
- YSCALEYUV2PACKEDX_ACCURATE
- YSCALEYUV2RGBX
- "pxor %%mm7, %%mm7 \n\t"
- /* mm2=B, %%mm4=G, %%mm5=R, %%mm7=0 */
-#ifdef DITHER1XBPP
- "paddusb "BLUE_DITHER"(%0), %%mm2\n\t"
- "paddusb "GREEN_DITHER"(%0), %%mm4\n\t"
- "paddusb "RED_DITHER"(%0), %%mm5\n\t"
-#endif
-
- WRITERGB16(%4, %5, %%REGa)
- YSCALEYUV2PACKEDX_END
- return;
- case PIX_FMT_YUYV422:
- YSCALEYUV2PACKEDX_ACCURATE
- /* mm2=B, %%mm4=G, %%mm5=R, %%mm7=0 */
-
- "psraw $3, %%mm3 \n\t"
- "psraw $3, %%mm4 \n\t"
- "psraw $3, %%mm1 \n\t"
- "psraw $3, %%mm7 \n\t"
- WRITEYUY2(%4, %5, %%REGa)
- YSCALEYUV2PACKEDX_END
- return;
- }
- } else {
- switch(c->dstFormat) {
- case PIX_FMT_RGB32:
- if (CONFIG_SWSCALE_ALPHA && c->alpPixBuf) {
- YSCALEYUV2PACKEDX
- YSCALEYUV2RGBX
- YSCALEYUV2PACKEDX_YA(ALP_MMX_FILTER_OFFSET, %%mm0, %%mm3, %%mm6, %%mm1, %%mm7)
- "psraw $3, %%mm1 \n\t"
- "psraw $3, %%mm7 \n\t"
- "packuswb %%mm7, %%mm1 \n\t"
- WRITEBGR32(%4, %5, %%REGa, %%mm2, %%mm4, %%mm5, %%mm1, %%mm0, %%mm7, %%mm3, %%mm6)
- YSCALEYUV2PACKEDX_END
- } else {
- YSCALEYUV2PACKEDX
- YSCALEYUV2RGBX
- "pcmpeqd %%mm7, %%mm7 \n\t"
- WRITEBGR32(%4, %5, %%REGa, %%mm2, %%mm4, %%mm5, %%mm7, %%mm0, %%mm1, %%mm3, %%mm6)
- YSCALEYUV2PACKEDX_END
- }
- return;
- case PIX_FMT_BGR24:
- YSCALEYUV2PACKEDX
- YSCALEYUV2RGBX
- "pxor %%mm7, %%mm7 \n\t"
- "lea (%%"REG_a", %%"REG_a", 2), %%"REG_c" \n\t" //FIXME optimize
- "add %4, %%"REG_c" \n\t"
- WRITEBGR24(%%REGc, %5, %%REGa)
-
- :: "r" (&c->redDither),
- "m" (dummy), "m" (dummy), "m" (dummy),
- "r" (dest), "m" (dstW)
- : "%"REG_a, "%"REG_c, "%"REG_d, "%"REG_S
- );
- return;
- case PIX_FMT_RGB555:
- YSCALEYUV2PACKEDX
- YSCALEYUV2RGBX
- "pxor %%mm7, %%mm7 \n\t"
- /* mm2=B, %%mm4=G, %%mm5=R, %%mm7=0 */
-#ifdef DITHER1XBPP
- "paddusb "BLUE_DITHER"(%0), %%mm2 \n\t"
- "paddusb "GREEN_DITHER"(%0), %%mm4 \n\t"
- "paddusb "RED_DITHER"(%0), %%mm5 \n\t"
-#endif
-
- WRITERGB15(%4, %5, %%REGa)
- YSCALEYUV2PACKEDX_END
- return;
- case PIX_FMT_RGB565:
- YSCALEYUV2PACKEDX
- YSCALEYUV2RGBX
- "pxor %%mm7, %%mm7 \n\t"
- /* mm2=B, %%mm4=G, %%mm5=R, %%mm7=0 */
-#ifdef DITHER1XBPP
- "paddusb "BLUE_DITHER"(%0), %%mm2 \n\t"
- "paddusb "GREEN_DITHER"(%0), %%mm4 \n\t"
- "paddusb "RED_DITHER"(%0), %%mm5 \n\t"
-#endif
-
- WRITERGB16(%4, %5, %%REGa)
- YSCALEYUV2PACKEDX_END
- return;
- case PIX_FMT_YUYV422:
- YSCALEYUV2PACKEDX
- /* mm2=B, %%mm4=G, %%mm5=R, %%mm7=0 */
-
- "psraw $3, %%mm3 \n\t"
- "psraw $3, %%mm4 \n\t"
- "psraw $3, %%mm1 \n\t"
- "psraw $3, %%mm7 \n\t"
- WRITEYUY2(%4, %5, %%REGa)
- YSCALEYUV2PACKEDX_END
- return;
- }
- }
- }
-#endif /* COMPILE_TEMPLATE_MMX */
-#if COMPILE_TEMPLATE_ALTIVEC
- /* The following list of supported dstFormat values should
- match what's found in the body of ff_yuv2packedX_altivec() */
- if (!(c->flags & SWS_BITEXACT) && !c->alpPixBuf &&
- (c->dstFormat==PIX_FMT_ABGR || c->dstFormat==PIX_FMT_BGRA ||
- c->dstFormat==PIX_FMT_BGR24 || c->dstFormat==PIX_FMT_RGB24 ||
- c->dstFormat==PIX_FMT_RGBA || c->dstFormat==PIX_FMT_ARGB))
- ff_yuv2packedX_altivec(c, lumFilter, lumSrc, lumFilterSize,
- chrFilter, chrSrc, chrFilterSize,
- dest, dstW, dstY);
- else
-#endif
- yuv2packedXinC(c, lumFilter, lumSrc, lumFilterSize,
- chrFilter, chrSrc, chrFilterSize,
- alpSrc, dest, dstW, dstY);
-}
-
-/**
- * vertical bilinear scale YV12 to RGB
- */
-static inline void RENAME(yuv2packed2)(SwsContext *c, const uint16_t *buf0, const uint16_t *buf1, const uint16_t *uvbuf0, const uint16_t *uvbuf1,
- const uint16_t *abuf0, const uint16_t *abuf1, uint8_t *dest, int dstW, int yalpha, int uvalpha, int y)
-{
- int yalpha1=4095- yalpha;
- int uvalpha1=4095-uvalpha;
- int i;
-
-#if COMPILE_TEMPLATE_MMX
- if(!(c->flags & SWS_BITEXACT)) {
- switch(c->dstFormat) {
- //Note 8280 == DSTW_OFFSET but the preprocessor can't handle that there :(
- case PIX_FMT_RGB32:
- if (CONFIG_SWSCALE_ALPHA && c->alpPixBuf) {
-#if ARCH_X86_64
- __asm__ volatile(
- YSCALEYUV2RGB(%%r8, %5)
- YSCALEYUV2RGB_YA(%%r8, %5, %6, %7)
- "psraw $3, %%mm1 \n\t" /* abuf0[eax] - abuf1[eax] >>7*/
- "psraw $3, %%mm7 \n\t" /* abuf0[eax] - abuf1[eax] >>7*/
- "packuswb %%mm7, %%mm1 \n\t"
- WRITEBGR32(%4, 8280(%5), %%r8, %%mm2, %%mm4, %%mm5, %%mm1, %%mm0, %%mm7, %%mm3, %%mm6)
-
- :: "c" (buf0), "d" (buf1), "S" (uvbuf0), "D" (uvbuf1), "r" (dest),
- "a" (&c->redDither)
- ,"r" (abuf0), "r" (abuf1)
- : "%r8"
- );
-#else
- *(const uint16_t **)(&c->u_temp)=abuf0;
- *(const uint16_t **)(&c->v_temp)=abuf1;
- __asm__ volatile(
- "mov %%"REG_b", "ESP_OFFSET"(%5) \n\t"
- "mov %4, %%"REG_b" \n\t"
- "push %%"REG_BP" \n\t"
- YSCALEYUV2RGB(%%REGBP, %5)
- "push %0 \n\t"
- "push %1 \n\t"
- "mov "U_TEMP"(%5), %0 \n\t"
- "mov "V_TEMP"(%5), %1 \n\t"
- YSCALEYUV2RGB_YA(%%REGBP, %5, %0, %1)
- "psraw $3, %%mm1 \n\t" /* abuf0[eax] - abuf1[eax] >>7*/
- "psraw $3, %%mm7 \n\t" /* abuf0[eax] - abuf1[eax] >>7*/
- "packuswb %%mm7, %%mm1 \n\t"
- "pop %1 \n\t"
- "pop %0 \n\t"
- WRITEBGR32(%%REGb, 8280(%5), %%REGBP, %%mm2, %%mm4, %%mm5, %%mm1, %%mm0, %%mm7, %%mm3, %%mm6)
- "pop %%"REG_BP" \n\t"
- "mov "ESP_OFFSET"(%5), %%"REG_b" \n\t"
-
- :: "c" (buf0), "d" (buf1), "S" (uvbuf0), "D" (uvbuf1), "m" (dest),
- "a" (&c->redDither)
- );
-#endif
- } else {
- __asm__ volatile(
- "mov %%"REG_b", "ESP_OFFSET"(%5) \n\t"
- "mov %4, %%"REG_b" \n\t"
- "push %%"REG_BP" \n\t"
- YSCALEYUV2RGB(%%REGBP, %5)
- "pcmpeqd %%mm7, %%mm7 \n\t"
- WRITEBGR32(%%REGb, 8280(%5), %%REGBP, %%mm2, %%mm4, %%mm5, %%mm7, %%mm0, %%mm1, %%mm3, %%mm6)
- "pop %%"REG_BP" \n\t"
- "mov "ESP_OFFSET"(%5), %%"REG_b" \n\t"
-
- :: "c" (buf0), "d" (buf1), "S" (uvbuf0), "D" (uvbuf1), "m" (dest),
- "a" (&c->redDither)
- );
- }
- return;
- case PIX_FMT_BGR24:
- __asm__ volatile(
- "mov %%"REG_b", "ESP_OFFSET"(%5) \n\t"
- "mov %4, %%"REG_b" \n\t"
- "push %%"REG_BP" \n\t"
- YSCALEYUV2RGB(%%REGBP, %5)
- "pxor %%mm7, %%mm7 \n\t"
- WRITEBGR24(%%REGb, 8280(%5), %%REGBP)
- "pop %%"REG_BP" \n\t"
- "mov "ESP_OFFSET"(%5), %%"REG_b" \n\t"
- :: "c" (buf0), "d" (buf1), "S" (uvbuf0), "D" (uvbuf1), "m" (dest),
- "a" (&c->redDither)
- );
- return;
- case PIX_FMT_RGB555:
- __asm__ volatile(
- "mov %%"REG_b", "ESP_OFFSET"(%5) \n\t"
- "mov %4, %%"REG_b" \n\t"
- "push %%"REG_BP" \n\t"
- YSCALEYUV2RGB(%%REGBP, %5)
- "pxor %%mm7, %%mm7 \n\t"
- /* mm2=B, %%mm4=G, %%mm5=R, %%mm7=0 */
-#ifdef DITHER1XBPP
- "paddusb "BLUE_DITHER"(%5), %%mm2 \n\t"
- "paddusb "GREEN_DITHER"(%5), %%mm4 \n\t"
- "paddusb "RED_DITHER"(%5), %%mm5 \n\t"
-#endif
-
- WRITERGB15(%%REGb, 8280(%5), %%REGBP)
- "pop %%"REG_BP" \n\t"
- "mov "ESP_OFFSET"(%5), %%"REG_b" \n\t"
-
- :: "c" (buf0), "d" (buf1), "S" (uvbuf0), "D" (uvbuf1), "m" (dest),
- "a" (&c->redDither)
- );
- return;
- case PIX_FMT_RGB565:
- __asm__ volatile(
- "mov %%"REG_b", "ESP_OFFSET"(%5) \n\t"
- "mov %4, %%"REG_b" \n\t"
- "push %%"REG_BP" \n\t"
- YSCALEYUV2RGB(%%REGBP, %5)
- "pxor %%mm7, %%mm7 \n\t"
- /* mm2=B, %%mm4=G, %%mm5=R, %%mm7=0 */
-#ifdef DITHER1XBPP
- "paddusb "BLUE_DITHER"(%5), %%mm2 \n\t"
- "paddusb "GREEN_DITHER"(%5), %%mm4 \n\t"
- "paddusb "RED_DITHER"(%5), %%mm5 \n\t"
-#endif
-
- WRITERGB16(%%REGb, 8280(%5), %%REGBP)
- "pop %%"REG_BP" \n\t"
- "mov "ESP_OFFSET"(%5), %%"REG_b" \n\t"
- :: "c" (buf0), "d" (buf1), "S" (uvbuf0), "D" (uvbuf1), "m" (dest),
- "a" (&c->redDither)
- );
- return;
- case PIX_FMT_YUYV422:
- __asm__ volatile(
- "mov %%"REG_b", "ESP_OFFSET"(%5) \n\t"
- "mov %4, %%"REG_b" \n\t"
- "push %%"REG_BP" \n\t"
- YSCALEYUV2PACKED(%%REGBP, %5)
- WRITEYUY2(%%REGb, 8280(%5), %%REGBP)
- "pop %%"REG_BP" \n\t"
- "mov "ESP_OFFSET"(%5), %%"REG_b" \n\t"
- :: "c" (buf0), "d" (buf1), "S" (uvbuf0), "D" (uvbuf1), "m" (dest),
- "a" (&c->redDither)
- );
- return;
- default: break;
- }
- }
-#endif //COMPILE_TEMPLATE_MMX
- YSCALE_YUV_2_ANYRGB_C(YSCALE_YUV_2_RGB2_C, YSCALE_YUV_2_PACKED2_C(void,0), YSCALE_YUV_2_GRAY16_2_C, YSCALE_YUV_2_MONO2_C)
-}
-
-/**
- * YV12 to RGB without scaling or interpolating
- */
-static inline void RENAME(yuv2packed1)(SwsContext *c, const uint16_t *buf0, const uint16_t *uvbuf0, const uint16_t *uvbuf1,
- const uint16_t *abuf0, uint8_t *dest, int dstW, int uvalpha, enum PixelFormat dstFormat, int flags, int y)
-{
- const int yalpha1=0;
- int i;
-
- const uint16_t *buf1= buf0; //FIXME needed for RGB1/BGR1
- const int yalpha= 4096; //FIXME ...
-
- if (flags&SWS_FULL_CHR_H_INT) {
- c->yuv2packed2(c, buf0, buf0, uvbuf0, uvbuf1, abuf0, abuf0, dest, dstW, 0, uvalpha, y);
- return;
- }
-
-#if COMPILE_TEMPLATE_MMX
- if(!(flags & SWS_BITEXACT)) {
- if (uvalpha < 2048) { // note this is not correct (shifts chrominance by 0.5 pixels) but it is a bit faster
- switch(dstFormat) {
- case PIX_FMT_RGB32:
- if (CONFIG_SWSCALE_ALPHA && c->alpPixBuf) {
- __asm__ volatile(
- "mov %%"REG_b", "ESP_OFFSET"(%5) \n\t"
- "mov %4, %%"REG_b" \n\t"
- "push %%"REG_BP" \n\t"
- YSCALEYUV2RGB1(%%REGBP, %5)
- YSCALEYUV2RGB1_ALPHA(%%REGBP)
- WRITEBGR32(%%REGb, 8280(%5), %%REGBP, %%mm2, %%mm4, %%mm5, %%mm7, %%mm0, %%mm1, %%mm3, %%mm6)
- "pop %%"REG_BP" \n\t"
- "mov "ESP_OFFSET"(%5), %%"REG_b" \n\t"
-
- :: "c" (buf0), "d" (abuf0), "S" (uvbuf0), "D" (uvbuf1), "m" (dest),
- "a" (&c->redDither)
- );
- } else {
- __asm__ volatile(
- "mov %%"REG_b", "ESP_OFFSET"(%5) \n\t"
- "mov %4, %%"REG_b" \n\t"
- "push %%"REG_BP" \n\t"
- YSCALEYUV2RGB1(%%REGBP, %5)
- "pcmpeqd %%mm7, %%mm7 \n\t"
- WRITEBGR32(%%REGb, 8280(%5), %%REGBP, %%mm2, %%mm4, %%mm5, %%mm7, %%mm0, %%mm1, %%mm3, %%mm6)
- "pop %%"REG_BP" \n\t"
- "mov "ESP_OFFSET"(%5), %%"REG_b" \n\t"
-
- :: "c" (buf0), "d" (buf1), "S" (uvbuf0), "D" (uvbuf1), "m" (dest),
- "a" (&c->redDither)
- );
- }
- return;
- case PIX_FMT_BGR24:
- __asm__ volatile(
- "mov %%"REG_b", "ESP_OFFSET"(%5) \n\t"
- "mov %4, %%"REG_b" \n\t"
- "push %%"REG_BP" \n\t"
- YSCALEYUV2RGB1(%%REGBP, %5)
- "pxor %%mm7, %%mm7 \n\t"
- WRITEBGR24(%%REGb, 8280(%5), %%REGBP)
- "pop %%"REG_BP" \n\t"
- "mov "ESP_OFFSET"(%5), %%"REG_b" \n\t"
-
- :: "c" (buf0), "d" (buf1), "S" (uvbuf0), "D" (uvbuf1), "m" (dest),
- "a" (&c->redDither)
- );
- return;
- case PIX_FMT_RGB555:
- __asm__ volatile(
- "mov %%"REG_b", "ESP_OFFSET"(%5) \n\t"
- "mov %4, %%"REG_b" \n\t"
- "push %%"REG_BP" \n\t"
- YSCALEYUV2RGB1(%%REGBP, %5)
- "pxor %%mm7, %%mm7 \n\t"
- /* mm2=B, %%mm4=G, %%mm5=R, %%mm7=0 */
-#ifdef DITHER1XBPP
- "paddusb "BLUE_DITHER"(%5), %%mm2 \n\t"
- "paddusb "GREEN_DITHER"(%5), %%mm4 \n\t"
- "paddusb "RED_DITHER"(%5), %%mm5 \n\t"
-#endif
- WRITERGB15(%%REGb, 8280(%5), %%REGBP)
- "pop %%"REG_BP" \n\t"
- "mov "ESP_OFFSET"(%5), %%"REG_b" \n\t"
-
- :: "c" (buf0), "d" (buf1), "S" (uvbuf0), "D" (uvbuf1), "m" (dest),
- "a" (&c->redDither)
- );
- return;
- case PIX_FMT_RGB565:
- __asm__ volatile(
- "mov %%"REG_b", "ESP_OFFSET"(%5) \n\t"
- "mov %4, %%"REG_b" \n\t"
- "push %%"REG_BP" \n\t"
- YSCALEYUV2RGB1(%%REGBP, %5)
- "pxor %%mm7, %%mm7 \n\t"
- /* mm2=B, %%mm4=G, %%mm5=R, %%mm7=0 */
-#ifdef DITHER1XBPP
- "paddusb "BLUE_DITHER"(%5), %%mm2 \n\t"
- "paddusb "GREEN_DITHER"(%5), %%mm4 \n\t"
- "paddusb "RED_DITHER"(%5), %%mm5 \n\t"
-#endif
-
- WRITERGB16(%%REGb, 8280(%5), %%REGBP)
- "pop %%"REG_BP" \n\t"
- "mov "ESP_OFFSET"(%5), %%"REG_b" \n\t"
-
- :: "c" (buf0), "d" (buf1), "S" (uvbuf0), "D" (uvbuf1), "m" (dest),
- "a" (&c->redDither)
- );
- return;
- case PIX_FMT_YUYV422:
- __asm__ volatile(
- "mov %%"REG_b", "ESP_OFFSET"(%5) \n\t"
- "mov %4, %%"REG_b" \n\t"
- "push %%"REG_BP" \n\t"
- YSCALEYUV2PACKED1(%%REGBP, %5)
- WRITEYUY2(%%REGb, 8280(%5), %%REGBP)
- "pop %%"REG_BP" \n\t"
- "mov "ESP_OFFSET"(%5), %%"REG_b" \n\t"
-
- :: "c" (buf0), "d" (buf1), "S" (uvbuf0), "D" (uvbuf1), "m" (dest),
- "a" (&c->redDither)
- );
- return;
- }
- } else {
- switch(dstFormat) {
- case PIX_FMT_RGB32:
- if (CONFIG_SWSCALE_ALPHA && c->alpPixBuf) {
- __asm__ volatile(
- "mov %%"REG_b", "ESP_OFFSET"(%5) \n\t"
- "mov %4, %%"REG_b" \n\t"
- "push %%"REG_BP" \n\t"
- YSCALEYUV2RGB1b(%%REGBP, %5)
- YSCALEYUV2RGB1_ALPHA(%%REGBP)
- WRITEBGR32(%%REGb, 8280(%5), %%REGBP, %%mm2, %%mm4, %%mm5, %%mm7, %%mm0, %%mm1, %%mm3, %%mm6)
- "pop %%"REG_BP" \n\t"
- "mov "ESP_OFFSET"(%5), %%"REG_b" \n\t"
-
- :: "c" (buf0), "d" (abuf0), "S" (uvbuf0), "D" (uvbuf1), "m" (dest),
- "a" (&c->redDither)
- );
- } else {
- __asm__ volatile(
- "mov %%"REG_b", "ESP_OFFSET"(%5) \n\t"
- "mov %4, %%"REG_b" \n\t"
- "push %%"REG_BP" \n\t"
- YSCALEYUV2RGB1b(%%REGBP, %5)
- "pcmpeqd %%mm7, %%mm7 \n\t"
- WRITEBGR32(%%REGb, 8280(%5), %%REGBP, %%mm2, %%mm4, %%mm5, %%mm7, %%mm0, %%mm1, %%mm3, %%mm6)
- "pop %%"REG_BP" \n\t"
- "mov "ESP_OFFSET"(%5), %%"REG_b" \n\t"
-
- :: "c" (buf0), "d" (buf1), "S" (uvbuf0), "D" (uvbuf1), "m" (dest),
- "a" (&c->redDither)
- );
- }
- return;
- case PIX_FMT_BGR24:
- __asm__ volatile(
- "mov %%"REG_b", "ESP_OFFSET"(%5) \n\t"
- "mov %4, %%"REG_b" \n\t"
- "push %%"REG_BP" \n\t"
- YSCALEYUV2RGB1b(%%REGBP, %5)
- "pxor %%mm7, %%mm7 \n\t"
- WRITEBGR24(%%REGb, 8280(%5), %%REGBP)
- "pop %%"REG_BP" \n\t"
- "mov "ESP_OFFSET"(%5), %%"REG_b" \n\t"
-
- :: "c" (buf0), "d" (buf1), "S" (uvbuf0), "D" (uvbuf1), "m" (dest),
- "a" (&c->redDither)
- );
- return;
- case PIX_FMT_RGB555:
- __asm__ volatile(
- "mov %%"REG_b", "ESP_OFFSET"(%5) \n\t"
- "mov %4, %%"REG_b" \n\t"
- "push %%"REG_BP" \n\t"
- YSCALEYUV2RGB1b(%%REGBP, %5)
- "pxor %%mm7, %%mm7 \n\t"
- /* mm2=B, %%mm4=G, %%mm5=R, %%mm7=0 */
-#ifdef DITHER1XBPP
- "paddusb "BLUE_DITHER"(%5), %%mm2 \n\t"
- "paddusb "GREEN_DITHER"(%5), %%mm4 \n\t"
- "paddusb "RED_DITHER"(%5), %%mm5 \n\t"
-#endif
- WRITERGB15(%%REGb, 8280(%5), %%REGBP)
- "pop %%"REG_BP" \n\t"
- "mov "ESP_OFFSET"(%5), %%"REG_b" \n\t"
-
- :: "c" (buf0), "d" (buf1), "S" (uvbuf0), "D" (uvbuf1), "m" (dest),
- "a" (&c->redDither)
- );
- return;
- case PIX_FMT_RGB565:
- __asm__ volatile(
- "mov %%"REG_b", "ESP_OFFSET"(%5) \n\t"
- "mov %4, %%"REG_b" \n\t"
- "push %%"REG_BP" \n\t"
- YSCALEYUV2RGB1b(%%REGBP, %5)
- "pxor %%mm7, %%mm7 \n\t"
- /* mm2=B, %%mm4=G, %%mm5=R, %%mm7=0 */
-#ifdef DITHER1XBPP
- "paddusb "BLUE_DITHER"(%5), %%mm2 \n\t"
- "paddusb "GREEN_DITHER"(%5), %%mm4 \n\t"
- "paddusb "RED_DITHER"(%5), %%mm5 \n\t"
-#endif
-
- WRITERGB16(%%REGb, 8280(%5), %%REGBP)
- "pop %%"REG_BP" \n\t"
- "mov "ESP_OFFSET"(%5), %%"REG_b" \n\t"
-
- :: "c" (buf0), "d" (buf1), "S" (uvbuf0), "D" (uvbuf1), "m" (dest),
- "a" (&c->redDither)
- );
- return;
- case PIX_FMT_YUYV422:
- __asm__ volatile(
- "mov %%"REG_b", "ESP_OFFSET"(%5) \n\t"
- "mov %4, %%"REG_b" \n\t"
- "push %%"REG_BP" \n\t"
- YSCALEYUV2PACKED1b(%%REGBP, %5)
- WRITEYUY2(%%REGb, 8280(%5), %%REGBP)
- "pop %%"REG_BP" \n\t"
- "mov "ESP_OFFSET"(%5), %%"REG_b" \n\t"
-
- :: "c" (buf0), "d" (buf1), "S" (uvbuf0), "D" (uvbuf1), "m" (dest),
- "a" (&c->redDither)
- );
- return;
- }
- }
- }
-#endif /* COMPILE_TEMPLATE_MMX */
- if (uvalpha < 2048) {
- YSCALE_YUV_2_ANYRGB_C(YSCALE_YUV_2_RGB1_C, YSCALE_YUV_2_PACKED1_C(void,0), YSCALE_YUV_2_GRAY16_1_C, YSCALE_YUV_2_MONO2_C)
- } else {
- YSCALE_YUV_2_ANYRGB_C(YSCALE_YUV_2_RGB1B_C, YSCALE_YUV_2_PACKED1B_C(void,0), YSCALE_YUV_2_GRAY16_1_C, YSCALE_YUV_2_MONO2_C)
- }
-}
-
-//FIXME yuy2* can read up to 7 samples too much
-
-static inline void RENAME(yuy2ToY)(uint8_t *dst, const uint8_t *src, long width, uint32_t *unused)
-{
-#if COMPILE_TEMPLATE_MMX
- __asm__ volatile(
- "movq "MANGLE(bm01010101)", %%mm2 \n\t"
- "mov %0, %%"REG_a" \n\t"
- "1: \n\t"
- "movq (%1, %%"REG_a",2), %%mm0 \n\t"
- "movq 8(%1, %%"REG_a",2), %%mm1 \n\t"
- "pand %%mm2, %%mm0 \n\t"
- "pand %%mm2, %%mm1 \n\t"
- "packuswb %%mm1, %%mm0 \n\t"
- "movq %%mm0, (%2, %%"REG_a") \n\t"
- "add $8, %%"REG_a" \n\t"
- " js 1b \n\t"
- : : "g" ((x86_reg)-width), "r" (src+width*2), "r" (dst+width)
- : "%"REG_a
- );
-#else
- int i;
- for (i=0; i<width; i++)
- dst[i]= src[2*i];
-#endif
-}
-
-static inline void RENAME(yuy2ToUV)(uint8_t *dstU, uint8_t *dstV, const uint8_t *src1, const uint8_t *src2, long width, uint32_t *unused)
-{
-#if COMPILE_TEMPLATE_MMX
- __asm__ volatile(
- "movq "MANGLE(bm01010101)", %%mm4 \n\t"
- "mov %0, %%"REG_a" \n\t"
- "1: \n\t"
- "movq (%1, %%"REG_a",4), %%mm0 \n\t"
- "movq 8(%1, %%"REG_a",4), %%mm1 \n\t"
- "psrlw $8, %%mm0 \n\t"
- "psrlw $8, %%mm1 \n\t"
- "packuswb %%mm1, %%mm0 \n\t"
- "movq %%mm0, %%mm1 \n\t"
- "psrlw $8, %%mm0 \n\t"
- "pand %%mm4, %%mm1 \n\t"
- "packuswb %%mm0, %%mm0 \n\t"
- "packuswb %%mm1, %%mm1 \n\t"
- "movd %%mm0, (%3, %%"REG_a") \n\t"
- "movd %%mm1, (%2, %%"REG_a") \n\t"
- "add $4, %%"REG_a" \n\t"
- " js 1b \n\t"
- : : "g" ((x86_reg)-width), "r" (src1+width*4), "r" (dstU+width), "r" (dstV+width)
- : "%"REG_a
- );
-#else
- int i;
- for (i=0; i<width; i++) {
- dstU[i]= src1[4*i + 1];
- dstV[i]= src1[4*i + 3];
- }
-#endif
- assert(src1 == src2);
-}
-
-static inline void RENAME(LEToUV)(uint8_t *dstU, uint8_t *dstV, const uint8_t *src1, const uint8_t *src2, long width, uint32_t *unused)
-{
-#if COMPILE_TEMPLATE_MMX
- __asm__ volatile(
- "mov %0, %%"REG_a" \n\t"
- "1: \n\t"
- "movq (%1, %%"REG_a",2), %%mm0 \n\t"
- "movq 8(%1, %%"REG_a",2), %%mm1 \n\t"
- "movq (%2, %%"REG_a",2), %%mm2 \n\t"
- "movq 8(%2, %%"REG_a",2), %%mm3 \n\t"
- "psrlw $8, %%mm0 \n\t"
- "psrlw $8, %%mm1 \n\t"
- "psrlw $8, %%mm2 \n\t"
- "psrlw $8, %%mm3 \n\t"
- "packuswb %%mm1, %%mm0 \n\t"
- "packuswb %%mm3, %%mm2 \n\t"
- "movq %%mm0, (%3, %%"REG_a") \n\t"
- "movq %%mm2, (%4, %%"REG_a") \n\t"
- "add $8, %%"REG_a" \n\t"
- " js 1b \n\t"
- : : "g" ((x86_reg)-width), "r" (src1+width*2), "r" (src2+width*2), "r" (dstU+width), "r" (dstV+width)
- : "%"REG_a
- );
-#else
- int i;
- for (i=0; i<width; i++) {
- dstU[i]= src1[2*i + 1];
- dstV[i]= src2[2*i + 1];
- }
-#endif
-}
-
-/* This is almost identical to the previous, end exists only because
- * yuy2ToY/UV)(dst, src+1, ...) would have 100% unaligned accesses. */
-static inline void RENAME(uyvyToY)(uint8_t *dst, const uint8_t *src, long width, uint32_t *unused)
-{
-#if COMPILE_TEMPLATE_MMX
- __asm__ volatile(
- "mov %0, %%"REG_a" \n\t"
- "1: \n\t"
- "movq (%1, %%"REG_a",2), %%mm0 \n\t"
- "movq 8(%1, %%"REG_a",2), %%mm1 \n\t"
- "psrlw $8, %%mm0 \n\t"
- "psrlw $8, %%mm1 \n\t"
- "packuswb %%mm1, %%mm0 \n\t"
- "movq %%mm0, (%2, %%"REG_a") \n\t"
- "add $8, %%"REG_a" \n\t"
- " js 1b \n\t"
- : : "g" ((x86_reg)-width), "r" (src+width*2), "r" (dst+width)
- : "%"REG_a
- );
-#else
- int i;
- for (i=0; i<width; i++)
- dst[i]= src[2*i+1];
-#endif
-}
-
-static inline void RENAME(uyvyToUV)(uint8_t *dstU, uint8_t *dstV, const uint8_t *src1, const uint8_t *src2, long width, uint32_t *unused)
-{
-#if COMPILE_TEMPLATE_MMX
- __asm__ volatile(
- "movq "MANGLE(bm01010101)", %%mm4 \n\t"
- "mov %0, %%"REG_a" \n\t"
- "1: \n\t"
- "movq (%1, %%"REG_a",4), %%mm0 \n\t"
- "movq 8(%1, %%"REG_a",4), %%mm1 \n\t"
- "pand %%mm4, %%mm0 \n\t"
- "pand %%mm4, %%mm1 \n\t"
- "packuswb %%mm1, %%mm0 \n\t"
- "movq %%mm0, %%mm1 \n\t"
- "psrlw $8, %%mm0 \n\t"
- "pand %%mm4, %%mm1 \n\t"
- "packuswb %%mm0, %%mm0 \n\t"
- "packuswb %%mm1, %%mm1 \n\t"
- "movd %%mm0, (%3, %%"REG_a") \n\t"
- "movd %%mm1, (%2, %%"REG_a") \n\t"
- "add $4, %%"REG_a" \n\t"
- " js 1b \n\t"
- : : "g" ((x86_reg)-width), "r" (src1+width*4), "r" (dstU+width), "r" (dstV+width)
- : "%"REG_a
- );
-#else
- int i;
- for (i=0; i<width; i++) {
- dstU[i]= src1[4*i + 0];
- dstV[i]= src1[4*i + 2];
- }
-#endif
- assert(src1 == src2);
-}
-
-static inline void RENAME(BEToUV)(uint8_t *dstU, uint8_t *dstV, const uint8_t *src1, const uint8_t *src2, long width, uint32_t *unused)
-{
-#if COMPILE_TEMPLATE_MMX
- __asm__ volatile(
- "movq "MANGLE(bm01010101)", %%mm4 \n\t"
- "mov %0, %%"REG_a" \n\t"
- "1: \n\t"
- "movq (%1, %%"REG_a",2), %%mm0 \n\t"
- "movq 8(%1, %%"REG_a",2), %%mm1 \n\t"
- "movq (%2, %%"REG_a",2), %%mm2 \n\t"
- "movq 8(%2, %%"REG_a",2), %%mm3 \n\t"
- "pand %%mm4, %%mm0 \n\t"
- "pand %%mm4, %%mm1 \n\t"
- "pand %%mm4, %%mm2 \n\t"
- "pand %%mm4, %%mm3 \n\t"
- "packuswb %%mm1, %%mm0 \n\t"
- "packuswb %%mm3, %%mm2 \n\t"
- "movq %%mm0, (%3, %%"REG_a") \n\t"
- "movq %%mm2, (%4, %%"REG_a") \n\t"
- "add $8, %%"REG_a" \n\t"
- " js 1b \n\t"
- : : "g" ((x86_reg)-width), "r" (src1+width*2), "r" (src2+width*2), "r" (dstU+width), "r" (dstV+width)
- : "%"REG_a
- );
-#else
- int i;
- for (i=0; i<width; i++) {
- dstU[i]= src1[2*i];
- dstV[i]= src2[2*i];
- }
-#endif
-}
-
-static inline void RENAME(nvXXtoUV)(uint8_t *dst1, uint8_t *dst2,
- const uint8_t *src, long width)
-{
-#if COMPILE_TEMPLATE_MMX
- __asm__ volatile(
- "movq "MANGLE(bm01010101)", %%mm4 \n\t"
- "mov %0, %%"REG_a" \n\t"
- "1: \n\t"
- "movq (%1, %%"REG_a",2), %%mm0 \n\t"
- "movq 8(%1, %%"REG_a",2), %%mm1 \n\t"
- "movq %%mm0, %%mm2 \n\t"
- "movq %%mm1, %%mm3 \n\t"
- "pand %%mm4, %%mm0 \n\t"
- "pand %%mm4, %%mm1 \n\t"
- "psrlw $8, %%mm2 \n\t"
- "psrlw $8, %%mm3 \n\t"
- "packuswb %%mm1, %%mm0 \n\t"
- "packuswb %%mm3, %%mm2 \n\t"
- "movq %%mm0, (%2, %%"REG_a") \n\t"
- "movq %%mm2, (%3, %%"REG_a") \n\t"
- "add $8, %%"REG_a" \n\t"
- " js 1b \n\t"
- : : "g" ((x86_reg)-width), "r" (src+width*2), "r" (dst1+width), "r" (dst2+width)
- : "%"REG_a
- );
-#else
- int i;
- for (i = 0; i < width; i++) {
- dst1[i] = src[2*i+0];
- dst2[i] = src[2*i+1];
- }
-#endif
-}
-
-static inline void RENAME(nv12ToUV)(uint8_t *dstU, uint8_t *dstV,
- const uint8_t *src1, const uint8_t *src2,
- long width, uint32_t *unused)
-{
- RENAME(nvXXtoUV)(dstU, dstV, src1, width);
-}
-
-static inline void RENAME(nv21ToUV)(uint8_t *dstU, uint8_t *dstV,
- const uint8_t *src1, const uint8_t *src2,
- long width, uint32_t *unused)
-{
- RENAME(nvXXtoUV)(dstV, dstU, src1, width);
-}
-
-#if COMPILE_TEMPLATE_MMX
-static inline void RENAME(bgr24ToY_mmx)(uint8_t *dst, const uint8_t *src, long width, enum PixelFormat srcFormat)
-{
-
- if(srcFormat == PIX_FMT_BGR24) {
- __asm__ volatile(
- "movq "MANGLE(ff_bgr24toY1Coeff)", %%mm5 \n\t"
- "movq "MANGLE(ff_bgr24toY2Coeff)", %%mm6 \n\t"
- :
- );
- } else {
- __asm__ volatile(
- "movq "MANGLE(ff_rgb24toY1Coeff)", %%mm5 \n\t"
- "movq "MANGLE(ff_rgb24toY2Coeff)", %%mm6 \n\t"
- :
- );
- }
-
- __asm__ volatile(
- "movq "MANGLE(ff_bgr24toYOffset)", %%mm4 \n\t"
- "mov %2, %%"REG_a" \n\t"
- "pxor %%mm7, %%mm7 \n\t"
- "1: \n\t"
- PREFETCH" 64(%0) \n\t"
- "movd (%0), %%mm0 \n\t"
- "movd 2(%0), %%mm1 \n\t"
- "movd 6(%0), %%mm2 \n\t"
- "movd 8(%0), %%mm3 \n\t"
- "add $12, %0 \n\t"
- "punpcklbw %%mm7, %%mm0 \n\t"
- "punpcklbw %%mm7, %%mm1 \n\t"
- "punpcklbw %%mm7, %%mm2 \n\t"
- "punpcklbw %%mm7, %%mm3 \n\t"
- "pmaddwd %%mm5, %%mm0 \n\t"
- "pmaddwd %%mm6, %%mm1 \n\t"
- "pmaddwd %%mm5, %%mm2 \n\t"
- "pmaddwd %%mm6, %%mm3 \n\t"
- "paddd %%mm1, %%mm0 \n\t"
- "paddd %%mm3, %%mm2 \n\t"
- "paddd %%mm4, %%mm0 \n\t"
- "paddd %%mm4, %%mm2 \n\t"
- "psrad $15, %%mm0 \n\t"
- "psrad $15, %%mm2 \n\t"
- "packssdw %%mm2, %%mm0 \n\t"
- "packuswb %%mm0, %%mm0 \n\t"
- "movd %%mm0, (%1, %%"REG_a") \n\t"
- "add $4, %%"REG_a" \n\t"
- " js 1b \n\t"
- : "+r" (src)
- : "r" (dst+width), "g" ((x86_reg)-width)
- : "%"REG_a
- );
-}
-
-static inline void RENAME(bgr24ToUV_mmx)(uint8_t *dstU, uint8_t *dstV, const uint8_t *src, long width, enum PixelFormat srcFormat)
-{
- __asm__ volatile(
- "movq 24+%4, %%mm6 \n\t"
- "mov %3, %%"REG_a" \n\t"
- "pxor %%mm7, %%mm7 \n\t"
- "1: \n\t"
- PREFETCH" 64(%0) \n\t"
- "movd (%0), %%mm0 \n\t"
- "movd 2(%0), %%mm1 \n\t"
- "punpcklbw %%mm7, %%mm0 \n\t"
- "punpcklbw %%mm7, %%mm1 \n\t"
- "movq %%mm0, %%mm2 \n\t"
- "movq %%mm1, %%mm3 \n\t"
- "pmaddwd %4, %%mm0 \n\t"
- "pmaddwd 8+%4, %%mm1 \n\t"
- "pmaddwd 16+%4, %%mm2 \n\t"
- "pmaddwd %%mm6, %%mm3 \n\t"
- "paddd %%mm1, %%mm0 \n\t"
- "paddd %%mm3, %%mm2 \n\t"
-
- "movd 6(%0), %%mm1 \n\t"
- "movd 8(%0), %%mm3 \n\t"
- "add $12, %0 \n\t"
- "punpcklbw %%mm7, %%mm1 \n\t"
- "punpcklbw %%mm7, %%mm3 \n\t"
- "movq %%mm1, %%mm4 \n\t"
- "movq %%mm3, %%mm5 \n\t"
- "pmaddwd %4, %%mm1 \n\t"
- "pmaddwd 8+%4, %%mm3 \n\t"
- "pmaddwd 16+%4, %%mm4 \n\t"
- "pmaddwd %%mm6, %%mm5 \n\t"
- "paddd %%mm3, %%mm1 \n\t"
- "paddd %%mm5, %%mm4 \n\t"
-
- "movq "MANGLE(ff_bgr24toUVOffset)", %%mm3 \n\t"
- "paddd %%mm3, %%mm0 \n\t"
- "paddd %%mm3, %%mm2 \n\t"
- "paddd %%mm3, %%mm1 \n\t"
- "paddd %%mm3, %%mm4 \n\t"
- "psrad $15, %%mm0 \n\t"
- "psrad $15, %%mm2 \n\t"
- "psrad $15, %%mm1 \n\t"
- "psrad $15, %%mm4 \n\t"
- "packssdw %%mm1, %%mm0 \n\t"
- "packssdw %%mm4, %%mm2 \n\t"
- "packuswb %%mm0, %%mm0 \n\t"
- "packuswb %%mm2, %%mm2 \n\t"
- "movd %%mm0, (%1, %%"REG_a") \n\t"
- "movd %%mm2, (%2, %%"REG_a") \n\t"
- "add $4, %%"REG_a" \n\t"
- " js 1b \n\t"
- : "+r" (src)
- : "r" (dstU+width), "r" (dstV+width), "g" ((x86_reg)-width), "m"(ff_bgr24toUV[srcFormat == PIX_FMT_RGB24][0])
- : "%"REG_a
- );
-}
-#endif
-
-static inline void RENAME(bgr24ToY)(uint8_t *dst, const uint8_t *src, long width, uint32_t *unused)
-{
-#if COMPILE_TEMPLATE_MMX
- RENAME(bgr24ToY_mmx)(dst, src, width, PIX_FMT_BGR24);
-#else
- int i;
- for (i=0; i<width; i++) {
- int b= src[i*3+0];
- int g= src[i*3+1];
- int r= src[i*3+2];
-
- dst[i]= ((RY*r + GY*g + BY*b + (33<<(RGB2YUV_SHIFT-1)))>>RGB2YUV_SHIFT);
- }
-#endif /* COMPILE_TEMPLATE_MMX */
-}
-
-static inline void RENAME(bgr24ToUV)(uint8_t *dstU, uint8_t *dstV, const uint8_t *src1, const uint8_t *src2, long width, uint32_t *unused)
-{
-#if COMPILE_TEMPLATE_MMX
- RENAME(bgr24ToUV_mmx)(dstU, dstV, src1, width, PIX_FMT_BGR24);
-#else
- int i;
- for (i=0; i<width; i++) {
- int b= src1[3*i + 0];
- int g= src1[3*i + 1];
- int r= src1[3*i + 2];
-
- dstU[i]= (RU*r + GU*g + BU*b + (257<<(RGB2YUV_SHIFT-1)))>>RGB2YUV_SHIFT;
- dstV[i]= (RV*r + GV*g + BV*b + (257<<(RGB2YUV_SHIFT-1)))>>RGB2YUV_SHIFT;
- }
-#endif /* COMPILE_TEMPLATE_MMX */
- assert(src1 == src2);
-}
-
-static inline void RENAME(bgr24ToUV_half)(uint8_t *dstU, uint8_t *dstV, const uint8_t *src1, const uint8_t *src2, long width, uint32_t *unused)
-{
- int i;
- for (i=0; i<width; i++) {
- int b= src1[6*i + 0] + src1[6*i + 3];
- int g= src1[6*i + 1] + src1[6*i + 4];
- int r= src1[6*i + 2] + src1[6*i + 5];
-
- dstU[i]= (RU*r + GU*g + BU*b + (257<<RGB2YUV_SHIFT))>>(RGB2YUV_SHIFT+1);
- dstV[i]= (RV*r + GV*g + BV*b + (257<<RGB2YUV_SHIFT))>>(RGB2YUV_SHIFT+1);
- }
- assert(src1 == src2);
-}
-
-static inline void RENAME(rgb24ToY)(uint8_t *dst, const uint8_t *src, long width, uint32_t *unused)
-{
-#if COMPILE_TEMPLATE_MMX
- RENAME(bgr24ToY_mmx)(dst, src, width, PIX_FMT_RGB24);
-#else
- int i;
- for (i=0; i<width; i++) {
- int r= src[i*3+0];
- int g= src[i*3+1];
- int b= src[i*3+2];
-
- dst[i]= ((RY*r + GY*g + BY*b + (33<<(RGB2YUV_SHIFT-1)))>>RGB2YUV_SHIFT);
- }
-#endif
-}
-
-static inline void RENAME(rgb24ToUV)(uint8_t *dstU, uint8_t *dstV, const uint8_t *src1, const uint8_t *src2, long width, uint32_t *unused)
-{
-#if COMPILE_TEMPLATE_MMX
- assert(src1==src2);
- RENAME(bgr24ToUV_mmx)(dstU, dstV, src1, width, PIX_FMT_RGB24);
-#else
- int i;
- assert(src1==src2);
- for (i=0; i<width; i++) {
- int r= src1[3*i + 0];
- int g= src1[3*i + 1];
- int b= src1[3*i + 2];
-
- dstU[i]= (RU*r + GU*g + BU*b + (257<<(RGB2YUV_SHIFT-1)))>>RGB2YUV_SHIFT;
- dstV[i]= (RV*r + GV*g + BV*b + (257<<(RGB2YUV_SHIFT-1)))>>RGB2YUV_SHIFT;
- }
-#endif
-}
-
-static inline void RENAME(rgb24ToUV_half)(uint8_t *dstU, uint8_t *dstV, const uint8_t *src1, const uint8_t *src2, long width, uint32_t *unused)
-{
- int i;
- assert(src1==src2);
- for (i=0; i<width; i++) {
- int r= src1[6*i + 0] + src1[6*i + 3];
- int g= src1[6*i + 1] + src1[6*i + 4];
- int b= src1[6*i + 2] + src1[6*i + 5];
-
- dstU[i]= (RU*r + GU*g + BU*b + (257<<RGB2YUV_SHIFT))>>(RGB2YUV_SHIFT+1);
- dstV[i]= (RV*r + GV*g + BV*b + (257<<RGB2YUV_SHIFT))>>(RGB2YUV_SHIFT+1);
- }
-}
-
-
-// bilinear / bicubic scaling
-static inline void RENAME(hScale)(int16_t *dst, int dstW, const uint8_t *src, int srcW, int xInc,
- const int16_t *filter, const int16_t *filterPos, long filterSize)
-{
-#if COMPILE_TEMPLATE_MMX
- assert(filterSize % 4 == 0 && filterSize>0);
- if (filterSize==4) { // Always true for upscaling, sometimes for down, too.
- x86_reg counter= -2*dstW;
- filter-= counter*2;
- filterPos-= counter/2;
- dst-= counter/2;
- __asm__ volatile(
-#if defined(PIC)
- "push %%"REG_b" \n\t"
-#endif
- "pxor %%mm7, %%mm7 \n\t"
- "push %%"REG_BP" \n\t" // we use 7 regs here ...
- "mov %%"REG_a", %%"REG_BP" \n\t"
- ASMALIGN(4)
- "1: \n\t"
- "movzwl (%2, %%"REG_BP"), %%eax \n\t"
- "movzwl 2(%2, %%"REG_BP"), %%ebx \n\t"
- "movq (%1, %%"REG_BP", 4), %%mm1 \n\t"
- "movq 8(%1, %%"REG_BP", 4), %%mm3 \n\t"
- "movd (%3, %%"REG_a"), %%mm0 \n\t"
- "movd (%3, %%"REG_b"), %%mm2 \n\t"
- "punpcklbw %%mm7, %%mm0 \n\t"
- "punpcklbw %%mm7, %%mm2 \n\t"
- "pmaddwd %%mm1, %%mm0 \n\t"
- "pmaddwd %%mm2, %%mm3 \n\t"
- "movq %%mm0, %%mm4 \n\t"
- "punpckldq %%mm3, %%mm0 \n\t"
- "punpckhdq %%mm3, %%mm4 \n\t"
- "paddd %%mm4, %%mm0 \n\t"
- "psrad $7, %%mm0 \n\t"
- "packssdw %%mm0, %%mm0 \n\t"
- "movd %%mm0, (%4, %%"REG_BP") \n\t"
- "add $4, %%"REG_BP" \n\t"
- " jnc 1b \n\t"
-
- "pop %%"REG_BP" \n\t"
-#if defined(PIC)
- "pop %%"REG_b" \n\t"
-#endif
- : "+a" (counter)
- : "c" (filter), "d" (filterPos), "S" (src), "D" (dst)
-#if !defined(PIC)
- : "%"REG_b
-#endif
- );
- } else if (filterSize==8) {
- x86_reg counter= -2*dstW;
- filter-= counter*4;
- filterPos-= counter/2;
- dst-= counter/2;
- __asm__ volatile(
-#if defined(PIC)
- "push %%"REG_b" \n\t"
-#endif
- "pxor %%mm7, %%mm7 \n\t"
- "push %%"REG_BP" \n\t" // we use 7 regs here ...
- "mov %%"REG_a", %%"REG_BP" \n\t"
- ASMALIGN(4)
- "1: \n\t"
- "movzwl (%2, %%"REG_BP"), %%eax \n\t"
- "movzwl 2(%2, %%"REG_BP"), %%ebx \n\t"
- "movq (%1, %%"REG_BP", 8), %%mm1 \n\t"
- "movq 16(%1, %%"REG_BP", 8), %%mm3 \n\t"
- "movd (%3, %%"REG_a"), %%mm0 \n\t"
- "movd (%3, %%"REG_b"), %%mm2 \n\t"
- "punpcklbw %%mm7, %%mm0 \n\t"
- "punpcklbw %%mm7, %%mm2 \n\t"
- "pmaddwd %%mm1, %%mm0 \n\t"
- "pmaddwd %%mm2, %%mm3 \n\t"
-
- "movq 8(%1, %%"REG_BP", 8), %%mm1 \n\t"
- "movq 24(%1, %%"REG_BP", 8), %%mm5 \n\t"
- "movd 4(%3, %%"REG_a"), %%mm4 \n\t"
- "movd 4(%3, %%"REG_b"), %%mm2 \n\t"
- "punpcklbw %%mm7, %%mm4 \n\t"
- "punpcklbw %%mm7, %%mm2 \n\t"
- "pmaddwd %%mm1, %%mm4 \n\t"
- "pmaddwd %%mm2, %%mm5 \n\t"
- "paddd %%mm4, %%mm0 \n\t"
- "paddd %%mm5, %%mm3 \n\t"
- "movq %%mm0, %%mm4 \n\t"
- "punpckldq %%mm3, %%mm0 \n\t"
- "punpckhdq %%mm3, %%mm4 \n\t"
- "paddd %%mm4, %%mm0 \n\t"
- "psrad $7, %%mm0 \n\t"
- "packssdw %%mm0, %%mm0 \n\t"
- "movd %%mm0, (%4, %%"REG_BP") \n\t"
- "add $4, %%"REG_BP" \n\t"
- " jnc 1b \n\t"
-
- "pop %%"REG_BP" \n\t"
-#if defined(PIC)
- "pop %%"REG_b" \n\t"
-#endif
- : "+a" (counter)
- : "c" (filter), "d" (filterPos), "S" (src), "D" (dst)
-#if !defined(PIC)
- : "%"REG_b
-#endif
- );
- } else {
- const uint8_t *offset = src+filterSize;
- x86_reg counter= -2*dstW;
- //filter-= counter*filterSize/2;
- filterPos-= counter/2;
- dst-= counter/2;
- __asm__ volatile(
- "pxor %%mm7, %%mm7 \n\t"
- ASMALIGN(4)
- "1: \n\t"
- "mov %2, %%"REG_c" \n\t"
- "movzwl (%%"REG_c", %0), %%eax \n\t"
- "movzwl 2(%%"REG_c", %0), %%edx \n\t"
- "mov %5, %%"REG_c" \n\t"
- "pxor %%mm4, %%mm4 \n\t"
- "pxor %%mm5, %%mm5 \n\t"
- "2: \n\t"
- "movq (%1), %%mm1 \n\t"
- "movq (%1, %6), %%mm3 \n\t"
- "movd (%%"REG_c", %%"REG_a"), %%mm0 \n\t"
- "movd (%%"REG_c", %%"REG_d"), %%mm2 \n\t"
- "punpcklbw %%mm7, %%mm0 \n\t"
- "punpcklbw %%mm7, %%mm2 \n\t"
- "pmaddwd %%mm1, %%mm0 \n\t"
- "pmaddwd %%mm2, %%mm3 \n\t"
- "paddd %%mm3, %%mm5 \n\t"
- "paddd %%mm0, %%mm4 \n\t"
- "add $8, %1 \n\t"
- "add $4, %%"REG_c" \n\t"
- "cmp %4, %%"REG_c" \n\t"
- " jb 2b \n\t"
- "add %6, %1 \n\t"
- "movq %%mm4, %%mm0 \n\t"
- "punpckldq %%mm5, %%mm4 \n\t"
- "punpckhdq %%mm5, %%mm0 \n\t"
- "paddd %%mm0, %%mm4 \n\t"
- "psrad $7, %%mm4 \n\t"
- "packssdw %%mm4, %%mm4 \n\t"
- "mov %3, %%"REG_a" \n\t"
- "movd %%mm4, (%%"REG_a", %0) \n\t"
- "add $4, %0 \n\t"
- " jnc 1b \n\t"
-
- : "+r" (counter), "+r" (filter)
- : "m" (filterPos), "m" (dst), "m"(offset),
- "m" (src), "r" ((x86_reg)filterSize*2)
- : "%"REG_a, "%"REG_c, "%"REG_d
- );
- }
-#else
-#if COMPILE_TEMPLATE_ALTIVEC
- hScale_altivec_real(dst, dstW, src, srcW, xInc, filter, filterPos, filterSize);
-#else
- int i;
- for (i=0; i<dstW; i++) {
- int j;
- int srcPos= filterPos[i];
- int val=0;
- //printf("filterPos: %d\n", filterPos[i]);
- for (j=0; j<filterSize; j++) {
- //printf("filter: %d, src: %d\n", filter[i], src[srcPos + j]);
- val += ((int)src[srcPos + j])*filter[filterSize*i + j];
- }
- //filter += hFilterSize;
- dst[i] = FFMIN(val>>7, (1<<15)-1); // the cubic equation does overflow ...
- //dst[i] = val>>7;
- }
-#endif /* COMPILE_ALTIVEC */
-#endif /* COMPILE_MMX */
-}
-
-//FIXME all pal and rgb srcFormats could do this convertion as well
-//FIXME all scalers more complex than bilinear could do half of this transform
-static void RENAME(chrRangeToJpeg)(uint16_t *dst, int width)
-{
- int i;
- for (i = 0; i < width; i++) {
- dst[i ] = (FFMIN(dst[i ],30775)*4663 - 9289992)>>12; //-264
- dst[i+VOFW] = (FFMIN(dst[i+VOFW],30775)*4663 - 9289992)>>12; //-264
- }
-}
-static void RENAME(chrRangeFromJpeg)(uint16_t *dst, int width)
-{
- int i;
- for (i = 0; i < width; i++) {
- dst[i ] = (dst[i ]*1799 + 4081085)>>11; //1469
- dst[i+VOFW] = (dst[i+VOFW]*1799 + 4081085)>>11; //1469
- }
-}
-static void RENAME(lumRangeToJpeg)(uint16_t *dst, int width)
-{
- int i;
- for (i = 0; i < width; i++)
- dst[i] = (FFMIN(dst[i],30189)*19077 - 39057361)>>14;
-}
-static void RENAME(lumRangeFromJpeg)(uint16_t *dst, int width)
-{
- int i;
- for (i = 0; i < width; i++)
- dst[i] = (dst[i]*14071 + 33561947)>>14;
-}
-
-#define FAST_BILINEAR_X86 \
- "subl %%edi, %%esi \n\t" /* src[xx+1] - src[xx] */ \
- "imull %%ecx, %%esi \n\t" /* (src[xx+1] - src[xx])*xalpha */ \
- "shll $16, %%edi \n\t" \
- "addl %%edi, %%esi \n\t" /* src[xx+1]*xalpha + src[xx]*(1-xalpha) */ \
- "mov %1, %%"REG_D"\n\t" \
- "shrl $9, %%esi \n\t" \
-
-static inline void RENAME(hyscale_fast)(SwsContext *c, int16_t *dst,
- long dstWidth, const uint8_t *src, int srcW,
- int xInc)
-{
-#if ARCH_X86 && CONFIG_GPL
-#if COMPILE_TEMPLATE_MMX2
- int32_t *filterPos = c->hLumFilterPos;
- int16_t *filter = c->hLumFilter;
- int canMMX2BeUsed = c->canMMX2BeUsed;
- void *mmx2FilterCode= c->lumMmx2FilterCode;
- int i;
-#if defined(PIC)
- DECLARE_ALIGNED(8, uint64_t, ebxsave);
-#endif
- if (canMMX2BeUsed) {
- __asm__ volatile(
-#if defined(PIC)
- "mov %%"REG_b", %5 \n\t"
-#endif
- "pxor %%mm7, %%mm7 \n\t"
- "mov %0, %%"REG_c" \n\t"
- "mov %1, %%"REG_D" \n\t"
- "mov %2, %%"REG_d" \n\t"
- "mov %3, %%"REG_b" \n\t"
- "xor %%"REG_a", %%"REG_a" \n\t" // i
- PREFETCH" (%%"REG_c") \n\t"
- PREFETCH" 32(%%"REG_c") \n\t"
- PREFETCH" 64(%%"REG_c") \n\t"
-
-#if ARCH_X86_64
-
-#define CALL_MMX2_FILTER_CODE \
- "movl (%%"REG_b"), %%esi \n\t"\
- "call *%4 \n\t"\
- "movl (%%"REG_b", %%"REG_a"), %%esi \n\t"\
- "add %%"REG_S", %%"REG_c" \n\t"\
- "add %%"REG_a", %%"REG_D" \n\t"\
- "xor %%"REG_a", %%"REG_a" \n\t"\
-
-#else
-
-#define CALL_MMX2_FILTER_CODE \
- "movl (%%"REG_b"), %%esi \n\t"\
- "call *%4 \n\t"\
- "addl (%%"REG_b", %%"REG_a"), %%"REG_c" \n\t"\
- "add %%"REG_a", %%"REG_D" \n\t"\
- "xor %%"REG_a", %%"REG_a" \n\t"\
-
-#endif /* ARCH_X86_64 */
-
- CALL_MMX2_FILTER_CODE
- CALL_MMX2_FILTER_CODE
- CALL_MMX2_FILTER_CODE
- CALL_MMX2_FILTER_CODE
- CALL_MMX2_FILTER_CODE
- CALL_MMX2_FILTER_CODE
- CALL_MMX2_FILTER_CODE
- CALL_MMX2_FILTER_CODE
-
-#if defined(PIC)
- "mov %5, %%"REG_b" \n\t"
-#endif
- :: "m" (src), "m" (dst), "m" (filter), "m" (filterPos),
- "m" (mmx2FilterCode)
-#if defined(PIC)
- ,"m" (ebxsave)
-#endif
- : "%"REG_a, "%"REG_c, "%"REG_d, "%"REG_S, "%"REG_D
-#if !defined(PIC)
- ,"%"REG_b
-#endif
- );
- for (i=dstWidth-1; (i*xInc)>>16 >=srcW-1; i--) dst[i] = src[srcW-1]*128;
- } else {
-#endif /* COMPILE_TEMPLATE_MMX2 */
- x86_reg xInc_shr16 = xInc >> 16;
- uint16_t xInc_mask = xInc & 0xffff;
- //NO MMX just normal asm ...
- __asm__ volatile(
- "xor %%"REG_a", %%"REG_a" \n\t" // i
- "xor %%"REG_d", %%"REG_d" \n\t" // xx
- "xorl %%ecx, %%ecx \n\t" // xalpha
- ASMALIGN(4)
- "1: \n\t"
- "movzbl (%0, %%"REG_d"), %%edi \n\t" //src[xx]
- "movzbl 1(%0, %%"REG_d"), %%esi \n\t" //src[xx+1]
- FAST_BILINEAR_X86
- "movw %%si, (%%"REG_D", %%"REG_a", 2) \n\t"
- "addw %4, %%cx \n\t" //xalpha += xInc&0xFFFF
- "adc %3, %%"REG_d" \n\t" //xx+= xInc>>16 + carry
-
- "movzbl (%0, %%"REG_d"), %%edi \n\t" //src[xx]
- "movzbl 1(%0, %%"REG_d"), %%esi \n\t" //src[xx+1]
- FAST_BILINEAR_X86
- "movw %%si, 2(%%"REG_D", %%"REG_a", 2) \n\t"
- "addw %4, %%cx \n\t" //xalpha += xInc&0xFFFF
- "adc %3, %%"REG_d" \n\t" //xx+= xInc>>16 + carry
-
-
- "add $2, %%"REG_a" \n\t"
- "cmp %2, %%"REG_a" \n\t"
- " jb 1b \n\t"
-
-
- :: "r" (src), "m" (dst), "m" (dstWidth), "m" (xInc_shr16), "m" (xInc_mask)
- : "%"REG_a, "%"REG_d, "%ecx", "%"REG_D, "%esi"
- );
-#if COMPILE_TEMPLATE_MMX2
- } //if MMX2 can't be used
-#endif
-#else
- int i;
- unsigned int xpos=0;
- for (i=0;i<dstWidth;i++) {
- register unsigned int xx=xpos>>16;
- register unsigned int xalpha=(xpos&0xFFFF)>>9;
- dst[i]= (src[xx]<<7) + (src[xx+1] - src[xx])*xalpha;
- xpos+=xInc;
- }
-#endif /* ARCH_X86 */
-}
-
- // *** horizontal scale Y line to temp buffer
-static inline void RENAME(hyscale)(SwsContext *c, uint16_t *dst, long dstWidth, const uint8_t *src, int srcW, int xInc,
- const int16_t *hLumFilter,
- const int16_t *hLumFilterPos, int hLumFilterSize,
- uint8_t *formatConvBuffer,
- uint32_t *pal, int isAlpha)
-{
- void (*toYV12)(uint8_t *, const uint8_t *, long, uint32_t *) = isAlpha ? c->alpToYV12 : c->lumToYV12;
- void (*convertRange)(uint16_t *, int) = isAlpha ? NULL : c->lumConvertRange;
-
- src += isAlpha ? c->alpSrcOffset : c->lumSrcOffset;
-
- if (toYV12) {
- toYV12(formatConvBuffer, src, srcW, pal);
- src= formatConvBuffer;
- }
-
- if (!c->hyscale_fast) {
- c->hScale(dst, dstWidth, src, srcW, xInc, hLumFilter, hLumFilterPos, hLumFilterSize);
- } else { // fast bilinear upscale / crap downscale
- c->hyscale_fast(c, dst, dstWidth, src, srcW, xInc);
- }
-
- if (convertRange)
- convertRange(dst, dstWidth);
-}
-
-static inline void RENAME(hcscale_fast)(SwsContext *c, int16_t *dst,
- long dstWidth, const uint8_t *src1,
- const uint8_t *src2, int srcW, int xInc)
-{
-#if ARCH_X86 && CONFIG_GPL
-#if COMPILE_TEMPLATE_MMX2
- int32_t *filterPos = c->hChrFilterPos;
- int16_t *filter = c->hChrFilter;
- int canMMX2BeUsed = c->canMMX2BeUsed;
- void *mmx2FilterCode= c->chrMmx2FilterCode;
- int i;
-#if defined(PIC)
- DECLARE_ALIGNED(8, uint64_t, ebxsave);
-#endif
- if (canMMX2BeUsed) {
- __asm__ volatile(
-#if defined(PIC)
- "mov %%"REG_b", %6 \n\t"
-#endif
- "pxor %%mm7, %%mm7 \n\t"
- "mov %0, %%"REG_c" \n\t"
- "mov %1, %%"REG_D" \n\t"
- "mov %2, %%"REG_d" \n\t"
- "mov %3, %%"REG_b" \n\t"
- "xor %%"REG_a", %%"REG_a" \n\t" // i
- PREFETCH" (%%"REG_c") \n\t"
- PREFETCH" 32(%%"REG_c") \n\t"
- PREFETCH" 64(%%"REG_c") \n\t"
-
- CALL_MMX2_FILTER_CODE
- CALL_MMX2_FILTER_CODE
- CALL_MMX2_FILTER_CODE
- CALL_MMX2_FILTER_CODE
- "xor %%"REG_a", %%"REG_a" \n\t" // i
- "mov %5, %%"REG_c" \n\t" // src
- "mov %1, %%"REG_D" \n\t" // buf1
- "add $"AV_STRINGIFY(VOF)", %%"REG_D" \n\t"
- PREFETCH" (%%"REG_c") \n\t"
- PREFETCH" 32(%%"REG_c") \n\t"
- PREFETCH" 64(%%"REG_c") \n\t"
-
- CALL_MMX2_FILTER_CODE
- CALL_MMX2_FILTER_CODE
- CALL_MMX2_FILTER_CODE
- CALL_MMX2_FILTER_CODE
-
-#if defined(PIC)
- "mov %6, %%"REG_b" \n\t"
-#endif
- :: "m" (src1), "m" (dst), "m" (filter), "m" (filterPos),
- "m" (mmx2FilterCode), "m" (src2)
-#if defined(PIC)
- ,"m" (ebxsave)
-#endif
- : "%"REG_a, "%"REG_c, "%"REG_d, "%"REG_S, "%"REG_D
-#if !defined(PIC)
- ,"%"REG_b
-#endif
- );
- for (i=dstWidth-1; (i*xInc)>>16 >=srcW-1; i--) {
- //printf("%d %d %d\n", dstWidth, i, srcW);
- dst[i] = src1[srcW-1]*128;
- dst[i+VOFW] = src2[srcW-1]*128;
- }
- } else {
-#endif /* COMPILE_TEMPLATE_MMX2 */
- x86_reg xInc_shr16 = (x86_reg) (xInc >> 16);
- uint16_t xInc_mask = xInc & 0xffff;
- __asm__ volatile(
- "xor %%"REG_a", %%"REG_a" \n\t" // i
- "xor %%"REG_d", %%"REG_d" \n\t" // xx
- "xorl %%ecx, %%ecx \n\t" // xalpha
- ASMALIGN(4)
- "1: \n\t"
- "mov %0, %%"REG_S" \n\t"
- "movzbl (%%"REG_S", %%"REG_d"), %%edi \n\t" //src[xx]
- "movzbl 1(%%"REG_S", %%"REG_d"), %%esi \n\t" //src[xx+1]
- FAST_BILINEAR_X86
- "movw %%si, (%%"REG_D", %%"REG_a", 2) \n\t"
-
- "movzbl (%5, %%"REG_d"), %%edi \n\t" //src[xx]
- "movzbl 1(%5, %%"REG_d"), %%esi \n\t" //src[xx+1]
- FAST_BILINEAR_X86
- "movw %%si, "AV_STRINGIFY(VOF)"(%%"REG_D", %%"REG_a", 2) \n\t"
-
- "addw %4, %%cx \n\t" //xalpha += xInc&0xFFFF
- "adc %3, %%"REG_d" \n\t" //xx+= xInc>>16 + carry
- "add $1, %%"REG_a" \n\t"
- "cmp %2, %%"REG_a" \n\t"
- " jb 1b \n\t"
-
-/* GCC 3.3 makes MPlayer crash on IA-32 machines when using "g" operand here,
-which is needed to support GCC 4.0. */
-#if ARCH_X86_64 && AV_GCC_VERSION_AT_LEAST(3,4)
- :: "m" (src1), "m" (dst), "g" (dstWidth), "m" (xInc_shr16), "m" (xInc_mask),
-#else
- :: "m" (src1), "m" (dst), "m" (dstWidth), "m" (xInc_shr16), "m" (xInc_mask),
-#endif
- "r" (src2)
- : "%"REG_a, "%"REG_d, "%ecx", "%"REG_D, "%esi"
- );
-#if COMPILE_TEMPLATE_MMX2
- } //if MMX2 can't be used
-#endif
-#else
- int i;
- unsigned int xpos=0;
- for (i=0;i<dstWidth;i++) {
- register unsigned int xx=xpos>>16;
- register unsigned int xalpha=(xpos&0xFFFF)>>9;
- dst[i]=(src1[xx]*(xalpha^127)+src1[xx+1]*xalpha);
- dst[i+VOFW]=(src2[xx]*(xalpha^127)+src2[xx+1]*xalpha);
- /* slower
- dst[i]= (src1[xx]<<7) + (src1[xx+1] - src1[xx])*xalpha;
- dst[i+VOFW]=(src2[xx]<<7) + (src2[xx+1] - src2[xx])*xalpha;
- */
- xpos+=xInc;
- }
-#endif /* ARCH_X86 */
-}
-
-inline static void RENAME(hcscale)(SwsContext *c, uint16_t *dst, long dstWidth, const uint8_t *src1, const uint8_t *src2,
- int srcW, int xInc, const int16_t *hChrFilter,
- const int16_t *hChrFilterPos, int hChrFilterSize,
- uint8_t *formatConvBuffer,
- uint32_t *pal)
-{
-
- src1 += c->chrSrcOffset;
- src2 += c->chrSrcOffset;
-
- if (c->chrToYV12) {
- c->chrToYV12(formatConvBuffer, formatConvBuffer+VOFW, src1, src2, srcW, pal);
- src1= formatConvBuffer;
- src2= formatConvBuffer+VOFW;
- }
-
- if (!c->hcscale_fast) {
- c->hScale(dst , dstWidth, src1, srcW, xInc, hChrFilter, hChrFilterPos, hChrFilterSize);
- c->hScale(dst+VOFW, dstWidth, src2, srcW, xInc, hChrFilter, hChrFilterPos, hChrFilterSize);
- } else { // fast bilinear upscale / crap downscale
- c->hcscale_fast(c, dst, dstWidth, src1, src2, srcW, xInc);
- }
-
- if (c->chrConvertRange)
- c->chrConvertRange(dst, dstWidth);
-}
-
-#define DEBUG_SWSCALE_BUFFERS 0
-#define DEBUG_BUFFERS(...) if (DEBUG_SWSCALE_BUFFERS) av_log(c, AV_LOG_DEBUG, __VA_ARGS__)
-
-static int RENAME(swScale)(SwsContext *c, const uint8_t* src[], int srcStride[], int srcSliceY,
- int srcSliceH, uint8_t* dst[], int dstStride[])
-{
- /* load a few things into local vars to make the code more readable? and faster */
- const int srcW= c->srcW;
- const int dstW= c->dstW;
- const int dstH= c->dstH;
- const int chrDstW= c->chrDstW;
- const int chrSrcW= c->chrSrcW;
- const int lumXInc= c->lumXInc;
- const int chrXInc= c->chrXInc;
- const enum PixelFormat dstFormat= c->dstFormat;
- const int flags= c->flags;
- int16_t *vLumFilterPos= c->vLumFilterPos;
- int16_t *vChrFilterPos= c->vChrFilterPos;
- int16_t *hLumFilterPos= c->hLumFilterPos;
- int16_t *hChrFilterPos= c->hChrFilterPos;
- int16_t *vLumFilter= c->vLumFilter;
- int16_t *vChrFilter= c->vChrFilter;
- int16_t *hLumFilter= c->hLumFilter;
- int16_t *hChrFilter= c->hChrFilter;
- int32_t *lumMmxFilter= c->lumMmxFilter;
- int32_t *chrMmxFilter= c->chrMmxFilter;
- int32_t av_unused *alpMmxFilter= c->alpMmxFilter;
- const int vLumFilterSize= c->vLumFilterSize;
- const int vChrFilterSize= c->vChrFilterSize;
- const int hLumFilterSize= c->hLumFilterSize;
- const int hChrFilterSize= c->hChrFilterSize;
- int16_t **lumPixBuf= c->lumPixBuf;
- int16_t **chrPixBuf= c->chrPixBuf;
- int16_t **alpPixBuf= c->alpPixBuf;
- const int vLumBufSize= c->vLumBufSize;
- const int vChrBufSize= c->vChrBufSize;
- uint8_t *formatConvBuffer= c->formatConvBuffer;
- const int chrSrcSliceY= srcSliceY >> c->chrSrcVSubSample;
- const int chrSrcSliceH= -((-srcSliceH) >> c->chrSrcVSubSample);
- int lastDstY;
- uint32_t *pal=c->pal_yuv;
-
- /* vars which will change and which we need to store back in the context */
- int dstY= c->dstY;
- int lumBufIndex= c->lumBufIndex;
- int chrBufIndex= c->chrBufIndex;
- int lastInLumBuf= c->lastInLumBuf;
- int lastInChrBuf= c->lastInChrBuf;
-
- if (isPacked(c->srcFormat)) {
- src[0]=
- src[1]=
- src[2]=
- src[3]= src[0];
- srcStride[0]=
- srcStride[1]=
- srcStride[2]=
- srcStride[3]= srcStride[0];
- }
- srcStride[1]<<= c->vChrDrop;
- srcStride[2]<<= c->vChrDrop;
-
- DEBUG_BUFFERS("swScale() %p[%d] %p[%d] %p[%d] %p[%d] -> %p[%d] %p[%d] %p[%d] %p[%d]\n",
- src[0], srcStride[0], src[1], srcStride[1], src[2], srcStride[2], src[3], srcStride[3],
- dst[0], dstStride[0], dst[1], dstStride[1], dst[2], dstStride[2], dst[3], dstStride[3]);
- DEBUG_BUFFERS("srcSliceY: %d srcSliceH: %d dstY: %d dstH: %d\n",
- srcSliceY, srcSliceH, dstY, dstH);
- DEBUG_BUFFERS("vLumFilterSize: %d vLumBufSize: %d vChrFilterSize: %d vChrBufSize: %d\n",
- vLumFilterSize, vLumBufSize, vChrFilterSize, vChrBufSize);
-
- if (dstStride[0]%8 !=0 || dstStride[1]%8 !=0 || dstStride[2]%8 !=0 || dstStride[3]%8 != 0) {
- static int warnedAlready=0; //FIXME move this into the context perhaps
- if (flags & SWS_PRINT_INFO && !warnedAlready) {
- av_log(c, AV_LOG_WARNING, "Warning: dstStride is not aligned!\n"
- " ->cannot do aligned memory accesses anymore\n");
- warnedAlready=1;
- }
- }
-
- /* Note the user might start scaling the picture in the middle so this
- will not get executed. This is not really intended but works
- currently, so people might do it. */
- if (srcSliceY ==0) {
- lumBufIndex=-1;
- chrBufIndex=-1;
- dstY=0;
- lastInLumBuf= -1;
- lastInChrBuf= -1;
- }
-
- lastDstY= dstY;
-
- for (;dstY < dstH; dstY++) {
- unsigned char *dest =dst[0]+dstStride[0]*dstY;
- const int chrDstY= dstY>>c->chrDstVSubSample;
- unsigned char *uDest=dst[1]+dstStride[1]*chrDstY;
- unsigned char *vDest=dst[2]+dstStride[2]*chrDstY;
- unsigned char *aDest=(CONFIG_SWSCALE_ALPHA && alpPixBuf) ? dst[3]+dstStride[3]*dstY : NULL;
-
- const int firstLumSrcY= vLumFilterPos[dstY]; //First line needed as input
- const int firstChrSrcY= vChrFilterPos[chrDstY]; //First line needed as input
- int lastLumSrcY= firstLumSrcY + vLumFilterSize -1; // Last line needed as input
- int lastChrSrcY= firstChrSrcY + vChrFilterSize -1; // Last line needed as input
- int enough_lines;
-
- //handle holes (FAST_BILINEAR & weird filters)
- if (firstLumSrcY > lastInLumBuf) lastInLumBuf= firstLumSrcY-1;
- if (firstChrSrcY > lastInChrBuf) lastInChrBuf= firstChrSrcY-1;
- assert(firstLumSrcY >= lastInLumBuf - vLumBufSize + 1);
- assert(firstChrSrcY >= lastInChrBuf - vChrBufSize + 1);
-
- // Do we have enough lines in this slice to output the dstY line
- enough_lines = lastLumSrcY < srcSliceY + srcSliceH && lastChrSrcY < -((-srcSliceY - srcSliceH)>>c->chrSrcVSubSample);
- if (!enough_lines) {
- lastLumSrcY = srcSliceY + srcSliceH - 1;
- lastChrSrcY = chrSrcSliceY + chrSrcSliceH - 1;
- }
-
- DEBUG_BUFFERS("dstY: %d\n", dstY);
- DEBUG_BUFFERS("\tfirstLumSrcY: %d lastLumSrcY: %d lastInLumBuf: %d\n",
- firstLumSrcY, lastLumSrcY, lastInLumBuf);
- DEBUG_BUFFERS("\tfirstChrSrcY: %d lastChrSrcY: %d lastInChrBuf: %d\n",
- firstChrSrcY, lastChrSrcY, lastInChrBuf);
-
- //Do horizontal scaling
- while(lastInLumBuf < lastLumSrcY) {
- const uint8_t *src1= src[0]+(lastInLumBuf + 1 - srcSliceY)*srcStride[0];
- const uint8_t *src2= src[3]+(lastInLumBuf + 1 - srcSliceY)*srcStride[3];
- lumBufIndex++;
- DEBUG_BUFFERS("\t\tlumBufIndex %d: lastInLumBuf: %d\n",
- lumBufIndex, lastInLumBuf);
- assert(lumBufIndex < 2*vLumBufSize);
- assert(lastInLumBuf + 1 - srcSliceY < srcSliceH);
- assert(lastInLumBuf + 1 - srcSliceY >= 0);
- RENAME(hyscale)(c, lumPixBuf[ lumBufIndex ], dstW, src1, srcW, lumXInc,
- hLumFilter, hLumFilterPos, hLumFilterSize,
- formatConvBuffer,
- pal, 0);
- if (CONFIG_SWSCALE_ALPHA && alpPixBuf)
- RENAME(hyscale)(c, alpPixBuf[ lumBufIndex ], dstW, src2, srcW, lumXInc,
- hLumFilter, hLumFilterPos, hLumFilterSize,
- formatConvBuffer,
- pal, 1);
- lastInLumBuf++;
- }
- while(lastInChrBuf < lastChrSrcY) {
- const uint8_t *src1= src[1]+(lastInChrBuf + 1 - chrSrcSliceY)*srcStride[1];
- const uint8_t *src2= src[2]+(lastInChrBuf + 1 - chrSrcSliceY)*srcStride[2];
- chrBufIndex++;
- DEBUG_BUFFERS("\t\tchrBufIndex %d: lastInChrBuf: %d\n",
- chrBufIndex, lastInChrBuf);
- assert(chrBufIndex < 2*vChrBufSize);
- assert(lastInChrBuf + 1 - chrSrcSliceY < (chrSrcSliceH));
- assert(lastInChrBuf + 1 - chrSrcSliceY >= 0);
- //FIXME replace parameters through context struct (some at least)
-
- if (c->needs_hcscale)
- RENAME(hcscale)(c, chrPixBuf[ chrBufIndex ], chrDstW, src1, src2, chrSrcW, chrXInc,
- hChrFilter, hChrFilterPos, hChrFilterSize,
- formatConvBuffer,
- pal);
- lastInChrBuf++;
- }
- //wrap buf index around to stay inside the ring buffer
- if (lumBufIndex >= vLumBufSize) lumBufIndex-= vLumBufSize;
- if (chrBufIndex >= vChrBufSize) chrBufIndex-= vChrBufSize;
- if (!enough_lines)
- break; //we can't output a dstY line so let's try with the next slice
-
-#if COMPILE_TEMPLATE_MMX
- c->blueDither= ff_dither8[dstY&1];
- if (c->dstFormat == PIX_FMT_RGB555 || c->dstFormat == PIX_FMT_BGR555)
- c->greenDither= ff_dither8[dstY&1];
- else
- c->greenDither= ff_dither4[dstY&1];
- c->redDither= ff_dither8[(dstY+1)&1];
-#endif
- if (dstY < dstH-2) {
- const int16_t **lumSrcPtr= (const int16_t **) lumPixBuf + lumBufIndex + firstLumSrcY - lastInLumBuf + vLumBufSize;
- const int16_t **chrSrcPtr= (const int16_t **) chrPixBuf + chrBufIndex + firstChrSrcY - lastInChrBuf + vChrBufSize;
- const int16_t **alpSrcPtr= (CONFIG_SWSCALE_ALPHA && alpPixBuf) ? (const int16_t **) alpPixBuf + lumBufIndex + firstLumSrcY - lastInLumBuf + vLumBufSize : NULL;
-#if COMPILE_TEMPLATE_MMX
- int i;
- if (flags & SWS_ACCURATE_RND) {
- int s= APCK_SIZE / 8;
- for (i=0; i<vLumFilterSize; i+=2) {
- *(const void**)&lumMmxFilter[s*i ]= lumSrcPtr[i ];
- *(const void**)&lumMmxFilter[s*i+APCK_PTR2/4 ]= lumSrcPtr[i+(vLumFilterSize>1)];
- lumMmxFilter[s*i+APCK_COEF/4 ]=
- lumMmxFilter[s*i+APCK_COEF/4+1]= vLumFilter[dstY*vLumFilterSize + i ]
- + (vLumFilterSize>1 ? vLumFilter[dstY*vLumFilterSize + i + 1]<<16 : 0);
- if (CONFIG_SWSCALE_ALPHA && alpPixBuf) {
- *(const void**)&alpMmxFilter[s*i ]= alpSrcPtr[i ];
- *(const void**)&alpMmxFilter[s*i+APCK_PTR2/4 ]= alpSrcPtr[i+(vLumFilterSize>1)];
- alpMmxFilter[s*i+APCK_COEF/4 ]=
- alpMmxFilter[s*i+APCK_COEF/4+1]= lumMmxFilter[s*i+APCK_COEF/4 ];
- }
- }
- for (i=0; i<vChrFilterSize; i+=2) {
- *(const void**)&chrMmxFilter[s*i ]= chrSrcPtr[i ];
- *(const void**)&chrMmxFilter[s*i+APCK_PTR2/4 ]= chrSrcPtr[i+(vChrFilterSize>1)];
- chrMmxFilter[s*i+APCK_COEF/4 ]=
- chrMmxFilter[s*i+APCK_COEF/4+1]= vChrFilter[chrDstY*vChrFilterSize + i ]
- + (vChrFilterSize>1 ? vChrFilter[chrDstY*vChrFilterSize + i + 1]<<16 : 0);
- }
- } else {
- for (i=0; i<vLumFilterSize; i++) {
- lumMmxFilter[4*i+0]= (int32_t)lumSrcPtr[i];
- lumMmxFilter[4*i+1]= (uint64_t)lumSrcPtr[i] >> 32;
- lumMmxFilter[4*i+2]=
- lumMmxFilter[4*i+3]=
- ((uint16_t)vLumFilter[dstY*vLumFilterSize + i])*0x10001;
- if (CONFIG_SWSCALE_ALPHA && alpPixBuf) {
- alpMmxFilter[4*i+0]= (int32_t)alpSrcPtr[i];
- alpMmxFilter[4*i+1]= (uint64_t)alpSrcPtr[i] >> 32;
- alpMmxFilter[4*i+2]=
- alpMmxFilter[4*i+3]= lumMmxFilter[4*i+2];
- }
- }
- for (i=0; i<vChrFilterSize; i++) {
- chrMmxFilter[4*i+0]= (int32_t)chrSrcPtr[i];
- chrMmxFilter[4*i+1]= (uint64_t)chrSrcPtr[i] >> 32;
- chrMmxFilter[4*i+2]=
- chrMmxFilter[4*i+3]=
- ((uint16_t)vChrFilter[chrDstY*vChrFilterSize + i])*0x10001;
- }
- }
-#endif
- if (dstFormat == PIX_FMT_NV12 || dstFormat == PIX_FMT_NV21) {
- const int chrSkipMask= (1<<c->chrDstVSubSample)-1;
- if (dstY&chrSkipMask) uDest= NULL; //FIXME split functions in lumi / chromi
- c->yuv2nv12X(c,
- vLumFilter+dstY*vLumFilterSize , lumSrcPtr, vLumFilterSize,
- vChrFilter+chrDstY*vChrFilterSize, chrSrcPtr, vChrFilterSize,
- dest, uDest, dstW, chrDstW, dstFormat);
- } else if (isPlanarYUV(dstFormat) || dstFormat==PIX_FMT_GRAY8) { //YV12 like
- const int chrSkipMask= (1<<c->chrDstVSubSample)-1;
- if ((dstY&chrSkipMask) || isGray(dstFormat)) uDest=vDest= NULL; //FIXME split functions in lumi / chromi
- if (is16BPS(dstFormat)) {
- yuv2yuvX16inC(
- vLumFilter+dstY*vLumFilterSize , lumSrcPtr, vLumFilterSize,
- vChrFilter+chrDstY*vChrFilterSize, chrSrcPtr, vChrFilterSize,
- alpSrcPtr, (uint16_t *) dest, (uint16_t *) uDest, (uint16_t *) vDest, (uint16_t *) aDest, dstW, chrDstW,
- dstFormat);
- } else if (vLumFilterSize == 1 && vChrFilterSize == 1) { // unscaled YV12
- const int16_t *lumBuf = lumSrcPtr[0];
- const int16_t *chrBuf= chrSrcPtr[0];
- const int16_t *alpBuf= (CONFIG_SWSCALE_ALPHA && alpPixBuf) ? alpSrcPtr[0] : NULL;
- c->yuv2yuv1(c, lumBuf, chrBuf, alpBuf, dest, uDest, vDest, aDest, dstW, chrDstW);
- } else { //General YV12
- c->yuv2yuvX(c,
- vLumFilter+dstY*vLumFilterSize , lumSrcPtr, vLumFilterSize,
- vChrFilter+chrDstY*vChrFilterSize, chrSrcPtr, vChrFilterSize,
- alpSrcPtr, dest, uDest, vDest, aDest, dstW, chrDstW);
- }
- } else {
- assert(lumSrcPtr + vLumFilterSize - 1 < lumPixBuf + vLumBufSize*2);
- assert(chrSrcPtr + vChrFilterSize - 1 < chrPixBuf + vChrBufSize*2);
- if (vLumFilterSize == 1 && vChrFilterSize == 2) { //unscaled RGB
- int chrAlpha= vChrFilter[2*dstY+1];
- if(flags & SWS_FULL_CHR_H_INT) {
- yuv2rgbXinC_full(c, //FIXME write a packed1_full function
- vLumFilter+dstY*vLumFilterSize, lumSrcPtr, vLumFilterSize,
- vChrFilter+dstY*vChrFilterSize, chrSrcPtr, vChrFilterSize,
- alpSrcPtr, dest, dstW, dstY);
- } else {
- c->yuv2packed1(c, *lumSrcPtr, *chrSrcPtr, *(chrSrcPtr+1),
- alpPixBuf ? *alpSrcPtr : NULL,
- dest, dstW, chrAlpha, dstFormat, flags, dstY);
- }
- } else if (vLumFilterSize == 2 && vChrFilterSize == 2) { //bilinear upscale RGB
- int lumAlpha= vLumFilter[2*dstY+1];
- int chrAlpha= vChrFilter[2*dstY+1];
- lumMmxFilter[2]=
- lumMmxFilter[3]= vLumFilter[2*dstY ]*0x10001;
- chrMmxFilter[2]=
- chrMmxFilter[3]= vChrFilter[2*chrDstY]*0x10001;
- if(flags & SWS_FULL_CHR_H_INT) {
- yuv2rgbXinC_full(c, //FIXME write a packed2_full function
- vLumFilter+dstY*vLumFilterSize, lumSrcPtr, vLumFilterSize,
- vChrFilter+dstY*vChrFilterSize, chrSrcPtr, vChrFilterSize,
- alpSrcPtr, dest, dstW, dstY);
- } else {
- c->yuv2packed2(c, *lumSrcPtr, *(lumSrcPtr+1), *chrSrcPtr, *(chrSrcPtr+1),
- alpPixBuf ? *alpSrcPtr : NULL, alpPixBuf ? *(alpSrcPtr+1) : NULL,
- dest, dstW, lumAlpha, chrAlpha, dstY);
- }
- } else { //general RGB
- if(flags & SWS_FULL_CHR_H_INT) {
- yuv2rgbXinC_full(c,
- vLumFilter+dstY*vLumFilterSize, lumSrcPtr, vLumFilterSize,
- vChrFilter+dstY*vChrFilterSize, chrSrcPtr, vChrFilterSize,
- alpSrcPtr, dest, dstW, dstY);
- } else {
- c->yuv2packedX(c,
- vLumFilter+dstY*vLumFilterSize, lumSrcPtr, vLumFilterSize,
- vChrFilter+dstY*vChrFilterSize, chrSrcPtr, vChrFilterSize,
- alpSrcPtr, dest, dstW, dstY);
- }
- }
- }
- } else { // hmm looks like we can't use MMX here without overwriting this array's tail
- const int16_t **lumSrcPtr= (const int16_t **)lumPixBuf + lumBufIndex + firstLumSrcY - lastInLumBuf + vLumBufSize;
- const int16_t **chrSrcPtr= (const int16_t **)chrPixBuf + chrBufIndex + firstChrSrcY - lastInChrBuf + vChrBufSize;
- const int16_t **alpSrcPtr= (CONFIG_SWSCALE_ALPHA && alpPixBuf) ? (const int16_t **)alpPixBuf + lumBufIndex + firstLumSrcY - lastInLumBuf + vLumBufSize : NULL;
- if (dstFormat == PIX_FMT_NV12 || dstFormat == PIX_FMT_NV21) {
- const int chrSkipMask= (1<<c->chrDstVSubSample)-1;
- if (dstY&chrSkipMask) uDest= NULL; //FIXME split functions in lumi / chromi
- yuv2nv12XinC(
- vLumFilter+dstY*vLumFilterSize , lumSrcPtr, vLumFilterSize,
- vChrFilter+chrDstY*vChrFilterSize, chrSrcPtr, vChrFilterSize,
- dest, uDest, dstW, chrDstW, dstFormat);
- } else if (isPlanarYUV(dstFormat) || dstFormat==PIX_FMT_GRAY8) { //YV12
- const int chrSkipMask= (1<<c->chrDstVSubSample)-1;
- if ((dstY&chrSkipMask) || isGray(dstFormat)) uDest=vDest= NULL; //FIXME split functions in lumi / chromi
- if (is16BPS(dstFormat)) {
- yuv2yuvX16inC(
- vLumFilter+dstY*vLumFilterSize , lumSrcPtr, vLumFilterSize,
- vChrFilter+chrDstY*vChrFilterSize, chrSrcPtr, vChrFilterSize,
- alpSrcPtr, (uint16_t *) dest, (uint16_t *) uDest, (uint16_t *) vDest, (uint16_t *) aDest, dstW, chrDstW,
- dstFormat);
- } else {
- yuv2yuvXinC(
- vLumFilter+dstY*vLumFilterSize , lumSrcPtr, vLumFilterSize,
- vChrFilter+chrDstY*vChrFilterSize, chrSrcPtr, vChrFilterSize,
- alpSrcPtr, dest, uDest, vDest, aDest, dstW, chrDstW);
- }
- } else {
- assert(lumSrcPtr + vLumFilterSize - 1 < lumPixBuf + vLumBufSize*2);
- assert(chrSrcPtr + vChrFilterSize - 1 < chrPixBuf + vChrBufSize*2);
- if(flags & SWS_FULL_CHR_H_INT) {
- yuv2rgbXinC_full(c,
- vLumFilter+dstY*vLumFilterSize, lumSrcPtr, vLumFilterSize,
- vChrFilter+dstY*vChrFilterSize, chrSrcPtr, vChrFilterSize,
- alpSrcPtr, dest, dstW, dstY);
- } else {
- yuv2packedXinC(c,
- vLumFilter+dstY*vLumFilterSize, lumSrcPtr, vLumFilterSize,
- vChrFilter+dstY*vChrFilterSize, chrSrcPtr, vChrFilterSize,
- alpSrcPtr, dest, dstW, dstY);
- }
- }
- }
- }
-
- if ((dstFormat == PIX_FMT_YUVA420P) && !alpPixBuf)
- fillPlane(dst[3], dstStride[3], dstW, dstY-lastDstY, lastDstY, 255);
-
-#if COMPILE_TEMPLATE_MMX
- if (flags & SWS_CPU_CAPS_MMX2 ) __asm__ volatile("sfence":::"memory");
- /* On K6 femms is faster than emms. On K7 femms is directly mapped to emms. */
- if (flags & SWS_CPU_CAPS_3DNOW) __asm__ volatile("femms" :::"memory");
- else __asm__ volatile("emms" :::"memory");
-#endif
- /* store changed local vars back in the context */
- c->dstY= dstY;
- c->lumBufIndex= lumBufIndex;
- c->chrBufIndex= chrBufIndex;
- c->lastInLumBuf= lastInLumBuf;
- c->lastInChrBuf= lastInChrBuf;
-
- return dstY - lastDstY;
-}
-
-static void RENAME(sws_init_swScale)(SwsContext *c)
-{
- enum PixelFormat srcFormat = c->srcFormat;
-
- c->yuv2nv12X = RENAME(yuv2nv12X );
- c->yuv2yuv1 = RENAME(yuv2yuv1 );
- c->yuv2yuvX = RENAME(yuv2yuvX );
- c->yuv2packed1 = RENAME(yuv2packed1 );
- c->yuv2packed2 = RENAME(yuv2packed2 );
- c->yuv2packedX = RENAME(yuv2packedX );
-
- c->hScale = RENAME(hScale );
-
-#if COMPILE_TEMPLATE_MMX
- // Use the new MMX scaler if the MMX2 one can't be used (it is faster than the x86 ASM one).
- if (c->flags & SWS_FAST_BILINEAR && c->canMMX2BeUsed)
-#else
- if (c->flags & SWS_FAST_BILINEAR)
-#endif
- {
- c->hyscale_fast = RENAME(hyscale_fast);
- c->hcscale_fast = RENAME(hcscale_fast);
- }
-
- c->chrToYV12 = NULL;
- switch(srcFormat) {
- case PIX_FMT_YUYV422 : c->chrToYV12 = RENAME(yuy2ToUV); break;
- case PIX_FMT_UYVY422 : c->chrToYV12 = RENAME(uyvyToUV); break;
- case PIX_FMT_NV12 : c->chrToYV12 = RENAME(nv12ToUV); break;
- case PIX_FMT_NV21 : c->chrToYV12 = RENAME(nv21ToUV); break;
- case PIX_FMT_RGB8 :
- case PIX_FMT_BGR8 :
- case PIX_FMT_PAL8 :
- case PIX_FMT_BGR4_BYTE:
- case PIX_FMT_RGB4_BYTE: c->chrToYV12 = palToUV; break;
- case PIX_FMT_YUV420P16BE:
- case PIX_FMT_YUV422P16BE:
- case PIX_FMT_YUV444P16BE: c->chrToYV12 = RENAME(BEToUV); break;
- case PIX_FMT_YUV420P16LE:
- case PIX_FMT_YUV422P16LE:
- case PIX_FMT_YUV444P16LE: c->chrToYV12 = RENAME(LEToUV); break;
- }
- if (c->chrSrcHSubSample) {
- switch(srcFormat) {
- case PIX_FMT_RGB48BE:
- case PIX_FMT_RGB48LE: c->chrToYV12 = rgb48ToUV_half; break;
- case PIX_FMT_RGB32 :
- case PIX_FMT_RGB32_1: c->chrToYV12 = bgr32ToUV_half; break;
- case PIX_FMT_BGR24 : c->chrToYV12 = RENAME(bgr24ToUV_half); break;
- case PIX_FMT_BGR565 : c->chrToYV12 = bgr16ToUV_half; break;
- case PIX_FMT_BGR555 : c->chrToYV12 = bgr15ToUV_half; break;
- case PIX_FMT_BGR32 :
- case PIX_FMT_BGR32_1: c->chrToYV12 = rgb32ToUV_half; break;
- case PIX_FMT_RGB24 : c->chrToYV12 = RENAME(rgb24ToUV_half); break;
- case PIX_FMT_RGB565 : c->chrToYV12 = rgb16ToUV_half; break;
- case PIX_FMT_RGB555 : c->chrToYV12 = rgb15ToUV_half; break;
- }
- } else {
- switch(srcFormat) {
- case PIX_FMT_RGB48BE:
- case PIX_FMT_RGB48LE: c->chrToYV12 = rgb48ToUV; break;
- case PIX_FMT_RGB32 :
- case PIX_FMT_RGB32_1: c->chrToYV12 = bgr32ToUV; break;
- case PIX_FMT_BGR24 : c->chrToYV12 = RENAME(bgr24ToUV); break;
- case PIX_FMT_BGR565 : c->chrToYV12 = bgr16ToUV; break;
- case PIX_FMT_BGR555 : c->chrToYV12 = bgr15ToUV; break;
- case PIX_FMT_BGR32 :
- case PIX_FMT_BGR32_1: c->chrToYV12 = rgb32ToUV; break;
- case PIX_FMT_RGB24 : c->chrToYV12 = RENAME(rgb24ToUV); break;
- case PIX_FMT_RGB565 : c->chrToYV12 = rgb16ToUV; break;
- case PIX_FMT_RGB555 : c->chrToYV12 = rgb15ToUV; break;
- }
- }
-
- c->lumToYV12 = NULL;
- c->alpToYV12 = NULL;
- switch (srcFormat) {
- case PIX_FMT_YUYV422 :
- case PIX_FMT_YUV420P16BE:
- case PIX_FMT_YUV422P16BE:
- case PIX_FMT_YUV444P16BE:
- case PIX_FMT_GRAY16BE : c->lumToYV12 = RENAME(yuy2ToY); break;
- case PIX_FMT_UYVY422 :
- case PIX_FMT_YUV420P16LE:
- case PIX_FMT_YUV422P16LE:
- case PIX_FMT_YUV444P16LE:
- case PIX_FMT_GRAY16LE : c->lumToYV12 = RENAME(uyvyToY); break;
- case PIX_FMT_BGR24 : c->lumToYV12 = RENAME(bgr24ToY); break;
- case PIX_FMT_BGR565 : c->lumToYV12 = bgr16ToY; break;
- case PIX_FMT_BGR555 : c->lumToYV12 = bgr15ToY; break;
- case PIX_FMT_RGB24 : c->lumToYV12 = RENAME(rgb24ToY); break;
- case PIX_FMT_RGB565 : c->lumToYV12 = rgb16ToY; break;
- case PIX_FMT_RGB555 : c->lumToYV12 = rgb15ToY; break;
- case PIX_FMT_RGB8 :
- case PIX_FMT_BGR8 :
- case PIX_FMT_PAL8 :
- case PIX_FMT_BGR4_BYTE:
- case PIX_FMT_RGB4_BYTE: c->lumToYV12 = palToY; break;
- case PIX_FMT_MONOBLACK: c->lumToYV12 = monoblack2Y; break;
- case PIX_FMT_MONOWHITE: c->lumToYV12 = monowhite2Y; break;
- case PIX_FMT_RGB32 :
- case PIX_FMT_RGB32_1: c->lumToYV12 = bgr32ToY; break;
- case PIX_FMT_BGR32 :
- case PIX_FMT_BGR32_1: c->lumToYV12 = rgb32ToY; break;
- case PIX_FMT_RGB48BE:
- case PIX_FMT_RGB48LE: c->lumToYV12 = rgb48ToY; break;
- }
- if (c->alpPixBuf) {
- switch (srcFormat) {
- case PIX_FMT_RGB32 :
- case PIX_FMT_RGB32_1:
- case PIX_FMT_BGR32 :
- case PIX_FMT_BGR32_1: c->alpToYV12 = abgrToA; break;
- }
- }
-
- switch (srcFormat) {
- case PIX_FMT_RGB32 :
- case PIX_FMT_BGR32 :
- c->alpSrcOffset = 3;
- break;
- case PIX_FMT_RGB32_1:
- case PIX_FMT_BGR32_1:
- c->lumSrcOffset = ALT32_CORR;
- c->chrSrcOffset = ALT32_CORR;
- break;
- case PIX_FMT_RGB48LE:
- c->lumSrcOffset = 1;
- c->chrSrcOffset = 1;
- c->alpSrcOffset = 1;
- break;
- }
-
- if (c->srcRange != c->dstRange && !isAnyRGB(c->dstFormat)) {
- if (c->srcRange) {
- c->lumConvertRange = RENAME(lumRangeFromJpeg);
- c->chrConvertRange = RENAME(chrRangeFromJpeg);
- } else {
- c->lumConvertRange = RENAME(lumRangeToJpeg);
- c->chrConvertRange = RENAME(chrRangeToJpeg);
- }
- }
-
- if (!(isGray(srcFormat) || isGray(c->dstFormat) ||
- srcFormat == PIX_FMT_MONOBLACK || srcFormat == PIX_FMT_MONOWHITE))
- c->needs_hcscale = 1;
-}
diff --git a/libswscale/utils.c b/libswscale/utils.c
deleted file mode 100644
index 928a5fd85e..0000000000
--- a/libswscale/utils.c
+++ /dev/null
@@ -1,1588 +0,0 @@
-/*
- * Copyright (C) 2001-2003 Michael Niedermayer <michaelni@gmx.at>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg 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.
- *
- * FFmpeg 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 FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * the C code (not assembly, mmx, ...) of this file can be used
- * under the LGPL license too
- */
-
-#define _SVID_SOURCE //needed for MAP_ANONYMOUS
-#include <inttypes.h>
-#include <string.h>
-#include <math.h>
-#include <stdio.h>
-#include "config.h"
-#include <assert.h>
-#if HAVE_SYS_MMAN_H
-#include <sys/mman.h>
-#if defined(MAP_ANON) && !defined(MAP_ANONYMOUS)
-#define MAP_ANONYMOUS MAP_ANON
-#endif
-#endif
-#if HAVE_VIRTUALALLOC
-#define WIN32_LEAN_AND_MEAN
-#include <windows.h>
-#endif
-#include "swscale.h"
-#include "swscale_internal.h"
-#include "rgb2rgb.h"
-#include "libavutil/intreadwrite.h"
-#include "libavutil/x86_cpu.h"
-#include "libavutil/avutil.h"
-#include "libavutil/bswap.h"
-#include "libavutil/pixdesc.h"
-
-unsigned swscale_version(void)
-{
- return LIBSWSCALE_VERSION_INT;
-}
-
-const char *swscale_configuration(void)
-{
- return FFMPEG_CONFIGURATION;
-}
-
-const char *swscale_license(void)
-{
-#define LICENSE_PREFIX "libswscale license: "
- return LICENSE_PREFIX FFMPEG_LICENSE + sizeof(LICENSE_PREFIX) - 1;
-}
-
-#define RET 0xC3 //near return opcode for x86
-
-#define isSupportedIn(x) ( \
- (x)==PIX_FMT_YUV420P \
- || (x)==PIX_FMT_YUVA420P \
- || (x)==PIX_FMT_YUYV422 \
- || (x)==PIX_FMT_UYVY422 \
- || (x)==PIX_FMT_RGB48BE \
- || (x)==PIX_FMT_RGB48LE \
- || (x)==PIX_FMT_RGB32 \
- || (x)==PIX_FMT_RGB32_1 \
- || (x)==PIX_FMT_BGR24 \
- || (x)==PIX_FMT_BGR565 \
- || (x)==PIX_FMT_BGR555 \
- || (x)==PIX_FMT_BGR32 \
- || (x)==PIX_FMT_BGR32_1 \
- || (x)==PIX_FMT_RGB24 \
- || (x)==PIX_FMT_RGB565 \
- || (x)==PIX_FMT_RGB555 \
- || (x)==PIX_FMT_GRAY8 \
- || (x)==PIX_FMT_YUV410P \
- || (x)==PIX_FMT_YUV440P \
- || (x)==PIX_FMT_NV12 \
- || (x)==PIX_FMT_NV21 \
- || (x)==PIX_FMT_GRAY16BE \
- || (x)==PIX_FMT_GRAY16LE \
- || (x)==PIX_FMT_YUV444P \
- || (x)==PIX_FMT_YUV422P \
- || (x)==PIX_FMT_YUV411P \
- || (x)==PIX_FMT_YUVJ420P \
- || (x)==PIX_FMT_YUVJ422P \
- || (x)==PIX_FMT_YUVJ440P \
- || (x)==PIX_FMT_YUVJ444P \
- || (x)==PIX_FMT_PAL8 \
- || (x)==PIX_FMT_BGR8 \
- || (x)==PIX_FMT_RGB8 \
- || (x)==PIX_FMT_BGR4_BYTE \
- || (x)==PIX_FMT_RGB4_BYTE \
- || (x)==PIX_FMT_YUV440P \
- || (x)==PIX_FMT_MONOWHITE \
- || (x)==PIX_FMT_MONOBLACK \
- || (x)==PIX_FMT_YUV420P16LE \
- || (x)==PIX_FMT_YUV422P16LE \
- || (x)==PIX_FMT_YUV444P16LE \
- || (x)==PIX_FMT_YUV420P16BE \
- || (x)==PIX_FMT_YUV422P16BE \
- || (x)==PIX_FMT_YUV444P16BE \
- )
-
-int sws_isSupportedInput(enum PixelFormat pix_fmt)
-{
- return isSupportedIn(pix_fmt);
-}
-
-#define isSupportedOut(x) ( \
- (x)==PIX_FMT_YUV420P \
- || (x)==PIX_FMT_YUVA420P \
- || (x)==PIX_FMT_YUYV422 \
- || (x)==PIX_FMT_UYVY422 \
- || (x)==PIX_FMT_YUV444P \
- || (x)==PIX_FMT_YUV422P \
- || (x)==PIX_FMT_YUV411P \
- || (x)==PIX_FMT_YUVJ420P \
- || (x)==PIX_FMT_YUVJ422P \
- || (x)==PIX_FMT_YUVJ440P \
- || (x)==PIX_FMT_YUVJ444P \
- || isAnyRGB(x) \
- || (x)==PIX_FMT_NV12 \
- || (x)==PIX_FMT_NV21 \
- || (x)==PIX_FMT_GRAY16BE \
- || (x)==PIX_FMT_GRAY16LE \
- || (x)==PIX_FMT_GRAY8 \
- || (x)==PIX_FMT_YUV410P \
- || (x)==PIX_FMT_YUV440P \
- || (x)==PIX_FMT_YUV420P16LE \
- || (x)==PIX_FMT_YUV422P16LE \
- || (x)==PIX_FMT_YUV444P16LE \
- || (x)==PIX_FMT_YUV420P16BE \
- || (x)==PIX_FMT_YUV422P16BE \
- || (x)==PIX_FMT_YUV444P16BE \
- )
-
-int sws_isSupportedOutput(enum PixelFormat pix_fmt)
-{
- return isSupportedOut(pix_fmt);
-}
-
-#define usePal(x) (av_pix_fmt_descriptors[x].flags & PIX_FMT_PAL)
-
-extern const int32_t ff_yuv2rgb_coeffs[8][4];
-
-const char *sws_format_name(enum PixelFormat format)
-{
- if ((unsigned)format < PIX_FMT_NB && av_pix_fmt_descriptors[format].name)
- return av_pix_fmt_descriptors[format].name;
- else
- return "Unknown format";
-}
-
-static double getSplineCoeff(double a, double b, double c, double d, double dist)
-{
-// printf("%f %f %f %f %f\n", a,b,c,d,dist);
- if (dist<=1.0) return ((d*dist + c)*dist + b)*dist +a;
- else return getSplineCoeff( 0.0,
- b+ 2.0*c + 3.0*d,
- c + 3.0*d,
- -b- 3.0*c - 6.0*d,
- dist-1.0);
-}
-
-static int initFilter(int16_t **outFilter, int16_t **filterPos, int *outFilterSize, int xInc,
- int srcW, int dstW, int filterAlign, int one, int flags,
- SwsVector *srcFilter, SwsVector *dstFilter, double param[2])
-{
- int i;
- int filterSize;
- int filter2Size;
- int minFilterSize;
- int64_t *filter=NULL;
- int64_t *filter2=NULL;
- const int64_t fone= 1LL<<54;
- int ret= -1;
-#if ARCH_X86
- if (flags & SWS_CPU_CAPS_MMX)
- __asm__ volatile("emms\n\t"::: "memory"); //FIXME this should not be required but it IS (even for non-MMX versions)
-#endif
-
- // NOTE: the +1 is for the MMX scaler which reads over the end
- FF_ALLOC_OR_GOTO(NULL, *filterPos, (dstW+1)*sizeof(int16_t), fail);
-
- if (FFABS(xInc - 0x10000) <10) { // unscaled
- int i;
- filterSize= 1;
- FF_ALLOCZ_OR_GOTO(NULL, filter, dstW*sizeof(*filter)*filterSize, fail);
-
- for (i=0; i<dstW; i++) {
- filter[i*filterSize]= fone;
- (*filterPos)[i]=i;
- }
-
- } else if (flags&SWS_POINT) { // lame looking point sampling mode
- int i;
- int xDstInSrc;
- filterSize= 1;
- FF_ALLOC_OR_GOTO(NULL, filter, dstW*sizeof(*filter)*filterSize, fail);
-
- xDstInSrc= xInc/2 - 0x8000;
- for (i=0; i<dstW; i++) {
- int xx= (xDstInSrc - ((filterSize-1)<<15) + (1<<15))>>16;
-
- (*filterPos)[i]= xx;
- filter[i]= fone;
- xDstInSrc+= xInc;
- }
- } else if ((xInc <= (1<<16) && (flags&SWS_AREA)) || (flags&SWS_FAST_BILINEAR)) { // bilinear upscale
- int i;
- int xDstInSrc;
- filterSize= 2;
- FF_ALLOC_OR_GOTO(NULL, filter, dstW*sizeof(*filter)*filterSize, fail);
-
- xDstInSrc= xInc/2 - 0x8000;
- for (i=0; i<dstW; i++) {
- int xx= (xDstInSrc - ((filterSize-1)<<15) + (1<<15))>>16;
- int j;
-
- (*filterPos)[i]= xx;
- //bilinear upscale / linear interpolate / area averaging
- for (j=0; j<filterSize; j++) {
- int64_t coeff= fone - FFABS((xx<<16) - xDstInSrc)*(fone>>16);
- if (coeff<0) coeff=0;
- filter[i*filterSize + j]= coeff;
- xx++;
- }
- xDstInSrc+= xInc;
- }
- } else {
- int xDstInSrc;
- int sizeFactor;
-
- if (flags&SWS_BICUBIC) sizeFactor= 4;
- else if (flags&SWS_X) sizeFactor= 8;
- else if (flags&SWS_AREA) sizeFactor= 1; //downscale only, for upscale it is bilinear
- else if (flags&SWS_GAUSS) sizeFactor= 8; // infinite ;)
- else if (flags&SWS_LANCZOS) sizeFactor= param[0] != SWS_PARAM_DEFAULT ? ceil(2*param[0]) : 6;
- else if (flags&SWS_SINC) sizeFactor= 20; // infinite ;)
- else if (flags&SWS_SPLINE) sizeFactor= 20; // infinite ;)
- else if (flags&SWS_BILINEAR) sizeFactor= 2;
- else {
- sizeFactor= 0; //GCC warning killer
- assert(0);
- }
-
- if (xInc <= 1<<16) filterSize= 1 + sizeFactor; // upscale
- else filterSize= 1 + (sizeFactor*srcW + dstW - 1)/ dstW;
-
- if (filterSize > srcW-2) filterSize=srcW-2;
-
- FF_ALLOC_OR_GOTO(NULL, filter, dstW*sizeof(*filter)*filterSize, fail);
-
- xDstInSrc= xInc - 0x10000;
- for (i=0; i<dstW; i++) {
- int xx= (xDstInSrc - ((filterSize-2)<<16)) / (1<<17);
- int j;
- (*filterPos)[i]= xx;
- for (j=0; j<filterSize; j++) {
- int64_t d= ((int64_t)FFABS((xx<<17) - xDstInSrc))<<13;
- double floatd;
- int64_t coeff;
-
- if (xInc > 1<<16)
- d= d*dstW/srcW;
- floatd= d * (1.0/(1<<30));
-
- if (flags & SWS_BICUBIC) {
- int64_t B= (param[0] != SWS_PARAM_DEFAULT ? param[0] : 0) * (1<<24);
- int64_t C= (param[1] != SWS_PARAM_DEFAULT ? param[1] : 0.6) * (1<<24);
- int64_t dd = ( d*d)>>30;
- int64_t ddd= (dd*d)>>30;
-
- if (d < 1LL<<30)
- coeff = (12*(1<<24)-9*B-6*C)*ddd + (-18*(1<<24)+12*B+6*C)*dd + (6*(1<<24)-2*B)*(1<<30);
- else if (d < 1LL<<31)
- coeff = (-B-6*C)*ddd + (6*B+30*C)*dd + (-12*B-48*C)*d + (8*B+24*C)*(1<<30);
- else
- coeff=0.0;
- coeff *= fone>>(30+24);
- }
-/* else if (flags & SWS_X) {
- double p= param ? param*0.01 : 0.3;
- coeff = d ? sin(d*PI)/(d*PI) : 1.0;
- coeff*= pow(2.0, - p*d*d);
- }*/
- else if (flags & SWS_X) {
- double A= param[0] != SWS_PARAM_DEFAULT ? param[0] : 1.0;
- double c;
-
- if (floatd<1.0)
- c = cos(floatd*M_PI);
- else
- c=-1.0;
- if (c<0.0) c= -pow(-c, A);
- else c= pow( c, A);
- coeff= (c*0.5 + 0.5)*fone;
- } else if (flags & SWS_AREA) {
- int64_t d2= d - (1<<29);
- if (d2*xInc < -(1LL<<(29+16))) coeff= 1.0 * (1LL<<(30+16));
- else if (d2*xInc < (1LL<<(29+16))) coeff= -d2*xInc + (1LL<<(29+16));
- else coeff=0.0;
- coeff *= fone>>(30+16);
- } else if (flags & SWS_GAUSS) {
- double p= param[0] != SWS_PARAM_DEFAULT ? param[0] : 3.0;
- coeff = (pow(2.0, - p*floatd*floatd))*fone;
- } else if (flags & SWS_SINC) {
- coeff = (d ? sin(floatd*M_PI)/(floatd*M_PI) : 1.0)*fone;
- } else if (flags & SWS_LANCZOS) {
- double p= param[0] != SWS_PARAM_DEFAULT ? param[0] : 3.0;
- coeff = (d ? sin(floatd*M_PI)*sin(floatd*M_PI/p)/(floatd*floatd*M_PI*M_PI/p) : 1.0)*fone;
- if (floatd>p) coeff=0;
- } else if (flags & SWS_BILINEAR) {
- coeff= (1<<30) - d;
- if (coeff<0) coeff=0;
- coeff *= fone >> 30;
- } else if (flags & SWS_SPLINE) {
- double p=-2.196152422706632;
- coeff = getSplineCoeff(1.0, 0.0, p, -p-1.0, floatd) * fone;
- } else {
- coeff= 0.0; //GCC warning killer
- assert(0);
- }
-
- filter[i*filterSize + j]= coeff;
- xx++;
- }
- xDstInSrc+= 2*xInc;
- }
- }
-
- /* apply src & dst Filter to filter -> filter2
- av_free(filter);
- */
- assert(filterSize>0);
- filter2Size= filterSize;
- if (srcFilter) filter2Size+= srcFilter->length - 1;
- if (dstFilter) filter2Size+= dstFilter->length - 1;
- assert(filter2Size>0);
- FF_ALLOCZ_OR_GOTO(NULL, filter2, filter2Size*dstW*sizeof(*filter2), fail);
-
- for (i=0; i<dstW; i++) {
- int j, k;
-
- if(srcFilter) {
- for (k=0; k<srcFilter->length; k++) {
- for (j=0; j<filterSize; j++)
- filter2[i*filter2Size + k + j] += srcFilter->coeff[k]*filter[i*filterSize + j];
- }
- } else {
- for (j=0; j<filterSize; j++)
- filter2[i*filter2Size + j]= filter[i*filterSize + j];
- }
- //FIXME dstFilter
-
- (*filterPos)[i]+= (filterSize-1)/2 - (filter2Size-1)/2;
- }
- av_freep(&filter);
-
- /* try to reduce the filter-size (step1 find size and shift left) */
- // Assume it is near normalized (*0.5 or *2.0 is OK but * 0.001 is not).
- minFilterSize= 0;
- for (i=dstW-1; i>=0; i--) {
- int min= filter2Size;
- int j;
- int64_t cutOff=0.0;
-
- /* get rid of near zero elements on the left by shifting left */
- for (j=0; j<filter2Size; j++) {
- int k;
- cutOff += FFABS(filter2[i*filter2Size]);
-
- if (cutOff > SWS_MAX_REDUCE_CUTOFF*fone) break;
-
- /* preserve monotonicity because the core can't handle the filter otherwise */
- if (i<dstW-1 && (*filterPos)[i] >= (*filterPos)[i+1]) break;
-
- // move filter coefficients left
- for (k=1; k<filter2Size; k++)
- filter2[i*filter2Size + k - 1]= filter2[i*filter2Size + k];
- filter2[i*filter2Size + k - 1]= 0;
- (*filterPos)[i]++;
- }
-
- cutOff=0;
- /* count near zeros on the right */
- for (j=filter2Size-1; j>0; j--) {
- cutOff += FFABS(filter2[i*filter2Size + j]);
-
- if (cutOff > SWS_MAX_REDUCE_CUTOFF*fone) break;
- min--;
- }
-
- if (min>minFilterSize) minFilterSize= min;
- }
-
- if (flags & SWS_CPU_CAPS_ALTIVEC) {
- // we can handle the special case 4,
- // so we don't want to go to the full 8
- if (minFilterSize < 5)
- filterAlign = 4;
-
- // We really don't want to waste our time
- // doing useless computation, so fall back on
- // the scalar C code for very small filters.
- // Vectorizing is worth it only if you have a
- // decent-sized vector.
- if (minFilterSize < 3)
- filterAlign = 1;
- }
-
- if (flags & SWS_CPU_CAPS_MMX) {
- // special case for unscaled vertical filtering
- if (minFilterSize == 1 && filterAlign == 2)
- filterAlign= 1;
- }
-
- assert(minFilterSize > 0);
- filterSize= (minFilterSize +(filterAlign-1)) & (~(filterAlign-1));
- assert(filterSize > 0);
- filter= av_malloc(filterSize*dstW*sizeof(*filter));
- if (filterSize >= MAX_FILTER_SIZE*16/((flags&SWS_ACCURATE_RND) ? APCK_SIZE : 16) || !filter)
- goto fail;
- *outFilterSize= filterSize;
-
- if (flags&SWS_PRINT_INFO)
- av_log(NULL, AV_LOG_VERBOSE, "SwScaler: reducing / aligning filtersize %d -> %d\n", filter2Size, filterSize);
- /* try to reduce the filter-size (step2 reduce it) */
- for (i=0; i<dstW; i++) {
- int j;
-
- for (j=0; j<filterSize; j++) {
- if (j>=filter2Size) filter[i*filterSize + j]= 0;
- else filter[i*filterSize + j]= filter2[i*filter2Size + j];
- if((flags & SWS_BITEXACT) && j>=minFilterSize)
- filter[i*filterSize + j]= 0;
- }
- }
-
- //FIXME try to align filterPos if possible
-
- //fix borders
- for (i=0; i<dstW; i++) {
- int j;
- if ((*filterPos)[i] < 0) {
- // move filter coefficients left to compensate for filterPos
- for (j=1; j<filterSize; j++) {
- int left= FFMAX(j + (*filterPos)[i], 0);
- filter[i*filterSize + left] += filter[i*filterSize + j];
- filter[i*filterSize + j]=0;
- }
- (*filterPos)[i]= 0;
- }
-
- if ((*filterPos)[i] + filterSize > srcW) {
- int shift= (*filterPos)[i] + filterSize - srcW;
- // move filter coefficients right to compensate for filterPos
- for (j=filterSize-2; j>=0; j--) {
- int right= FFMIN(j + shift, filterSize-1);
- filter[i*filterSize +right] += filter[i*filterSize +j];
- filter[i*filterSize +j]=0;
- }
- (*filterPos)[i]= srcW - filterSize;
- }
- }
-
- // Note the +1 is for the MMX scaler which reads over the end
- /* align at 16 for AltiVec (needed by hScale_altivec_real) */
- FF_ALLOCZ_OR_GOTO(NULL, *outFilter, *outFilterSize*(dstW+1)*sizeof(int16_t), fail);
-
- /* normalize & store in outFilter */
- for (i=0; i<dstW; i++) {
- int j;
- int64_t error=0;
- int64_t sum=0;
-
- for (j=0; j<filterSize; j++) {
- sum+= filter[i*filterSize + j];
- }
- sum= (sum + one/2)/ one;
- for (j=0; j<*outFilterSize; j++) {
- int64_t v= filter[i*filterSize + j] + error;
- int intV= ROUNDED_DIV(v, sum);
- (*outFilter)[i*(*outFilterSize) + j]= intV;
- error= v - intV*sum;
- }
- }
-
- (*filterPos)[dstW]= (*filterPos)[dstW-1]; // the MMX scaler will read over the end
- for (i=0; i<*outFilterSize; i++) {
- int j= dstW*(*outFilterSize);
- (*outFilter)[j + i]= (*outFilter)[j + i - (*outFilterSize)];
- }
-
- ret=0;
-fail:
- av_free(filter);
- av_free(filter2);
- return ret;
-}
-
-#if ARCH_X86 && (HAVE_MMX2 || CONFIG_RUNTIME_CPUDETECT) && CONFIG_GPL
-static int initMMX2HScaler(int dstW, int xInc, uint8_t *filterCode, int16_t *filter, int32_t *filterPos, int numSplits)
-{
- uint8_t *fragmentA;
- x86_reg imm8OfPShufW1A;
- x86_reg imm8OfPShufW2A;
- x86_reg fragmentLengthA;
- uint8_t *fragmentB;
- x86_reg imm8OfPShufW1B;
- x86_reg imm8OfPShufW2B;
- x86_reg fragmentLengthB;
- int fragmentPos;
-
- int xpos, i;
-
- // create an optimized horizontal scaling routine
- /* This scaler is made of runtime-generated MMX2 code using specially
- * tuned pshufw instructions. For every four output pixels, if four
- * input pixels are enough for the fast bilinear scaling, then a chunk
- * of fragmentB is used. If five input pixels are needed, then a chunk
- * of fragmentA is used.
- */
-
- //code fragment
-
- __asm__ volatile(
- "jmp 9f \n\t"
- // Begin
- "0: \n\t"
- "movq (%%"REG_d", %%"REG_a"), %%mm3 \n\t"
- "movd (%%"REG_c", %%"REG_S"), %%mm0 \n\t"
- "movd 1(%%"REG_c", %%"REG_S"), %%mm1 \n\t"
- "punpcklbw %%mm7, %%mm1 \n\t"
- "punpcklbw %%mm7, %%mm0 \n\t"
- "pshufw $0xFF, %%mm1, %%mm1 \n\t"
- "1: \n\t"
- "pshufw $0xFF, %%mm0, %%mm0 \n\t"
- "2: \n\t"
- "psubw %%mm1, %%mm0 \n\t"
- "movl 8(%%"REG_b", %%"REG_a"), %%esi \n\t"
- "pmullw %%mm3, %%mm0 \n\t"
- "psllw $7, %%mm1 \n\t"
- "paddw %%mm1, %%mm0 \n\t"
-
- "movq %%mm0, (%%"REG_D", %%"REG_a") \n\t"
-
- "add $8, %%"REG_a" \n\t"
- // End
- "9: \n\t"
-// "int $3 \n\t"
- "lea " LOCAL_MANGLE(0b) ", %0 \n\t"
- "lea " LOCAL_MANGLE(1b) ", %1 \n\t"
- "lea " LOCAL_MANGLE(2b) ", %2 \n\t"
- "dec %1 \n\t"
- "dec %2 \n\t"
- "sub %0, %1 \n\t"
- "sub %0, %2 \n\t"
- "lea " LOCAL_MANGLE(9b) ", %3 \n\t"
- "sub %0, %3 \n\t"
-
-
- :"=r" (fragmentA), "=r" (imm8OfPShufW1A), "=r" (imm8OfPShufW2A),
- "=r" (fragmentLengthA)
- );
-
- __asm__ volatile(
- "jmp 9f \n\t"
- // Begin
- "0: \n\t"
- "movq (%%"REG_d", %%"REG_a"), %%mm3 \n\t"
- "movd (%%"REG_c", %%"REG_S"), %%mm0 \n\t"
- "punpcklbw %%mm7, %%mm0 \n\t"
- "pshufw $0xFF, %%mm0, %%mm1 \n\t"
- "1: \n\t"
- "pshufw $0xFF, %%mm0, %%mm0 \n\t"
- "2: \n\t"
- "psubw %%mm1, %%mm0 \n\t"
- "movl 8(%%"REG_b", %%"REG_a"), %%esi \n\t"
- "pmullw %%mm3, %%mm0 \n\t"
- "psllw $7, %%mm1 \n\t"
- "paddw %%mm1, %%mm0 \n\t"
-
- "movq %%mm0, (%%"REG_D", %%"REG_a") \n\t"
-
- "add $8, %%"REG_a" \n\t"
- // End
- "9: \n\t"
-// "int $3 \n\t"
- "lea " LOCAL_MANGLE(0b) ", %0 \n\t"
- "lea " LOCAL_MANGLE(1b) ", %1 \n\t"
- "lea " LOCAL_MANGLE(2b) ", %2 \n\t"
- "dec %1 \n\t"
- "dec %2 \n\t"
- "sub %0, %1 \n\t"
- "sub %0, %2 \n\t"
- "lea " LOCAL_MANGLE(9b) ", %3 \n\t"
- "sub %0, %3 \n\t"
-
-
- :"=r" (fragmentB), "=r" (imm8OfPShufW1B), "=r" (imm8OfPShufW2B),
- "=r" (fragmentLengthB)
- );
-
- xpos= 0; //lumXInc/2 - 0x8000; // difference between pixel centers
- fragmentPos=0;
-
- for (i=0; i<dstW/numSplits; i++) {
- int xx=xpos>>16;
-
- if ((i&3) == 0) {
- int a=0;
- int b=((xpos+xInc)>>16) - xx;
- int c=((xpos+xInc*2)>>16) - xx;
- int d=((xpos+xInc*3)>>16) - xx;
- int inc = (d+1<4);
- uint8_t *fragment = (d+1<4) ? fragmentB : fragmentA;
- x86_reg imm8OfPShufW1 = (d+1<4) ? imm8OfPShufW1B : imm8OfPShufW1A;
- x86_reg imm8OfPShufW2 = (d+1<4) ? imm8OfPShufW2B : imm8OfPShufW2A;
- x86_reg fragmentLength = (d+1<4) ? fragmentLengthB : fragmentLengthA;
- int maxShift= 3-(d+inc);
- int shift=0;
-
- if (filterCode) {
- filter[i ] = (( xpos & 0xFFFF) ^ 0xFFFF)>>9;
- filter[i+1] = (((xpos+xInc ) & 0xFFFF) ^ 0xFFFF)>>9;
- filter[i+2] = (((xpos+xInc*2) & 0xFFFF) ^ 0xFFFF)>>9;
- filter[i+3] = (((xpos+xInc*3) & 0xFFFF) ^ 0xFFFF)>>9;
- filterPos[i/2]= xx;
-
- memcpy(filterCode + fragmentPos, fragment, fragmentLength);
-
- filterCode[fragmentPos + imm8OfPShufW1]=
- (a+inc) | ((b+inc)<<2) | ((c+inc)<<4) | ((d+inc)<<6);
- filterCode[fragmentPos + imm8OfPShufW2]=
- a | (b<<2) | (c<<4) | (d<<6);
-
- if (i+4-inc>=dstW) shift=maxShift; //avoid overread
- else if ((filterPos[i/2]&3) <= maxShift) shift=filterPos[i/2]&3; //Align
-
- if (shift && i>=shift) {
- filterCode[fragmentPos + imm8OfPShufW1]+= 0x55*shift;
- filterCode[fragmentPos + imm8OfPShufW2]+= 0x55*shift;
- filterPos[i/2]-=shift;
- }
- }
-
- fragmentPos+= fragmentLength;
-
- if (filterCode)
- filterCode[fragmentPos]= RET;
- }
- xpos+=xInc;
- }
- if (filterCode)
- filterPos[((i/2)+1)&(~1)]= xpos>>16; // needed to jump to the next part
-
- return fragmentPos + 1;
-}
-#endif /* ARCH_X86 && (HAVE_MMX2 || CONFIG_RUNTIME_CPUDETECT) && CONFIG_GPL */
-
-static void getSubSampleFactors(int *h, int *v, enum PixelFormat format)
-{
- *h = av_pix_fmt_descriptors[format].log2_chroma_w;
- *v = av_pix_fmt_descriptors[format].log2_chroma_h;
-}
-
-static uint16_t roundToInt16(int64_t f)
-{
- int r= (f + (1<<15))>>16;
- if (r<-0x7FFF) return 0x8000;
- else if (r> 0x7FFF) return 0x7FFF;
- else return r;
-}
-
-int sws_setColorspaceDetails(SwsContext *c, const int inv_table[4], int srcRange, const int table[4], int dstRange, int brightness, int contrast, int saturation)
-{
- int64_t crv = inv_table[0];
- int64_t cbu = inv_table[1];
- int64_t cgu = -inv_table[2];
- int64_t cgv = -inv_table[3];
- int64_t cy = 1<<16;
- int64_t oy = 0;
-
- memcpy(c->srcColorspaceTable, inv_table, sizeof(int)*4);
- memcpy(c->dstColorspaceTable, table, sizeof(int)*4);
-
- c->brightness= brightness;
- c->contrast = contrast;
- c->saturation= saturation;
- c->srcRange = srcRange;
- c->dstRange = dstRange;
- if (isYUV(c->dstFormat) || isGray(c->dstFormat)) return -1;
-
- c->uOffset= 0x0400040004000400LL;
- c->vOffset= 0x0400040004000400LL;
-
- if (!srcRange) {
- cy= (cy*255) / 219;
- oy= 16<<16;
- } else {
- crv= (crv*224) / 255;
- cbu= (cbu*224) / 255;
- cgu= (cgu*224) / 255;
- cgv= (cgv*224) / 255;
- }
-
- cy = (cy *contrast )>>16;
- crv= (crv*contrast * saturation)>>32;
- cbu= (cbu*contrast * saturation)>>32;
- cgu= (cgu*contrast * saturation)>>32;
- cgv= (cgv*contrast * saturation)>>32;
-
- oy -= 256*brightness;
-
- c->yCoeff= roundToInt16(cy *8192) * 0x0001000100010001ULL;
- c->vrCoeff= roundToInt16(crv*8192) * 0x0001000100010001ULL;
- c->ubCoeff= roundToInt16(cbu*8192) * 0x0001000100010001ULL;
- c->vgCoeff= roundToInt16(cgv*8192) * 0x0001000100010001ULL;
- c->ugCoeff= roundToInt16(cgu*8192) * 0x0001000100010001ULL;
- c->yOffset= roundToInt16(oy * 8) * 0x0001000100010001ULL;
-
- c->yuv2rgb_y_coeff = (int16_t)roundToInt16(cy <<13);
- c->yuv2rgb_y_offset = (int16_t)roundToInt16(oy << 9);
- c->yuv2rgb_v2r_coeff= (int16_t)roundToInt16(crv<<13);
- c->yuv2rgb_v2g_coeff= (int16_t)roundToInt16(cgv<<13);
- c->yuv2rgb_u2g_coeff= (int16_t)roundToInt16(cgu<<13);
- c->yuv2rgb_u2b_coeff= (int16_t)roundToInt16(cbu<<13);
-
- ff_yuv2rgb_c_init_tables(c, inv_table, srcRange, brightness, contrast, saturation);
- //FIXME factorize
-
-#if ARCH_PPC && (HAVE_ALTIVEC || CONFIG_RUNTIME_CPUDETECT)
- if (c->flags & SWS_CPU_CAPS_ALTIVEC)
- ff_yuv2rgb_init_tables_altivec(c, inv_table, brightness, contrast, saturation);
-#endif
- return 0;
-}
-
-int sws_getColorspaceDetails(SwsContext *c, int **inv_table, int *srcRange, int **table, int *dstRange, int *brightness, int *contrast, int *saturation)
-{
- if (isYUV(c->dstFormat) || isGray(c->dstFormat)) return -1;
-
- *inv_table = c->srcColorspaceTable;
- *table = c->dstColorspaceTable;
- *srcRange = c->srcRange;
- *dstRange = c->dstRange;
- *brightness= c->brightness;
- *contrast = c->contrast;
- *saturation= c->saturation;
-
- return 0;
-}
-
-static int handle_jpeg(enum PixelFormat *format)
-{
- switch (*format) {
- case PIX_FMT_YUVJ420P:
- *format = PIX_FMT_YUV420P;
- return 1;
- case PIX_FMT_YUVJ422P:
- *format = PIX_FMT_YUV422P;
- return 1;
- case PIX_FMT_YUVJ444P:
- *format = PIX_FMT_YUV444P;
- return 1;
- case PIX_FMT_YUVJ440P:
- *format = PIX_FMT_YUV440P;
- return 1;
- default:
- return 0;
- }
-}
-
-SwsContext *sws_getContext(int srcW, int srcH, enum PixelFormat srcFormat,
- int dstW, int dstH, enum PixelFormat dstFormat, int flags,
- SwsFilter *srcFilter, SwsFilter *dstFilter, const double *param)
-{
-
- SwsContext *c;
- int i;
- int usesVFilter, usesHFilter;
- int unscaled;
- int srcRange, dstRange;
- SwsFilter dummyFilter= {NULL, NULL, NULL, NULL};
-#if ARCH_X86
- if (flags & SWS_CPU_CAPS_MMX)
- __asm__ volatile("emms\n\t"::: "memory");
-#endif
-
-#if !CONFIG_RUNTIME_CPUDETECT //ensure that the flags match the compiled variant if cpudetect is off
- flags &= ~(SWS_CPU_CAPS_MMX|SWS_CPU_CAPS_MMX2|SWS_CPU_CAPS_3DNOW|SWS_CPU_CAPS_ALTIVEC|SWS_CPU_CAPS_BFIN);
- flags |= ff_hardcodedcpuflags();
-#endif /* CONFIG_RUNTIME_CPUDETECT */
- if (!rgb15to16) sws_rgb2rgb_init(flags);
-
- unscaled = (srcW == dstW && srcH == dstH);
-
- srcRange = handle_jpeg(&srcFormat);
- dstRange = handle_jpeg(&dstFormat);
-
- if (!isSupportedIn(srcFormat)) {
- av_log(NULL, AV_LOG_ERROR, "swScaler: %s is not supported as input pixel format\n", sws_format_name(srcFormat));
- return NULL;
- }
- if (!isSupportedOut(dstFormat)) {
- av_log(NULL, AV_LOG_ERROR, "swScaler: %s is not supported as output pixel format\n", sws_format_name(dstFormat));
- return NULL;
- }
-
- i= flags & ( SWS_POINT
- |SWS_AREA
- |SWS_BILINEAR
- |SWS_FAST_BILINEAR
- |SWS_BICUBIC
- |SWS_X
- |SWS_GAUSS
- |SWS_LANCZOS
- |SWS_SINC
- |SWS_SPLINE
- |SWS_BICUBLIN);
- if(!i || (i & (i-1))) {
- av_log(NULL, AV_LOG_ERROR, "swScaler: Exactly one scaler algorithm must be chosen\n");
- return NULL;
- }
-
- /* sanity check */
- if (srcW<4 || srcH<1 || dstW<8 || dstH<1) { //FIXME check if these are enough and try to lowwer them after fixing the relevant parts of the code
- av_log(NULL, AV_LOG_ERROR, "swScaler: %dx%d -> %dx%d is invalid scaling dimension\n",
- srcW, srcH, dstW, dstH);
- return NULL;
- }
- if(srcW > VOFW || dstW > VOFW) {
- av_log(NULL, AV_LOG_ERROR, "swScaler: Compile-time maximum width is "AV_STRINGIFY(VOFW)" change VOF/VOFW and recompile\n");
- return NULL;
- }
-
- if (!dstFilter) dstFilter= &dummyFilter;
- if (!srcFilter) srcFilter= &dummyFilter;
-
- FF_ALLOCZ_OR_GOTO(NULL, c, sizeof(SwsContext), fail);
-
- c->av_class = &sws_context_class;
- c->srcW= srcW;
- c->srcH= srcH;
- c->dstW= dstW;
- c->dstH= dstH;
- c->lumXInc= ((srcW<<16) + (dstW>>1))/dstW;
- c->lumYInc= ((srcH<<16) + (dstH>>1))/dstH;
- c->flags= flags;
- c->dstFormat= dstFormat;
- c->srcFormat= srcFormat;
- c->dstFormatBpp = av_get_bits_per_pixel(&av_pix_fmt_descriptors[dstFormat]);
- c->srcFormatBpp = av_get_bits_per_pixel(&av_pix_fmt_descriptors[srcFormat]);
- c->vRounder= 4* 0x0001000100010001ULL;
-
- usesHFilter= usesVFilter= 0;
- if (dstFilter->lumV && dstFilter->lumV->length>1) usesVFilter=1;
- if (dstFilter->lumH && dstFilter->lumH->length>1) usesHFilter=1;
- if (dstFilter->chrV && dstFilter->chrV->length>1) usesVFilter=1;
- if (dstFilter->chrH && dstFilter->chrH->length>1) usesHFilter=1;
- if (srcFilter->lumV && srcFilter->lumV->length>1) usesVFilter=1;
- if (srcFilter->lumH && srcFilter->lumH->length>1) usesHFilter=1;
- if (srcFilter->chrV && srcFilter->chrV->length>1) usesVFilter=1;
- if (srcFilter->chrH && srcFilter->chrH->length>1) usesHFilter=1;
-
- getSubSampleFactors(&c->chrSrcHSubSample, &c->chrSrcVSubSample, srcFormat);
- getSubSampleFactors(&c->chrDstHSubSample, &c->chrDstVSubSample, dstFormat);
-
- // reuse chroma for 2 pixels RGB/BGR unless user wants full chroma interpolation
- if (isAnyRGB(dstFormat) && !(flags&SWS_FULL_CHR_H_INT)) c->chrDstHSubSample=1;
-
- // drop some chroma lines if the user wants it
- c->vChrDrop= (flags&SWS_SRC_V_CHR_DROP_MASK)>>SWS_SRC_V_CHR_DROP_SHIFT;
- c->chrSrcVSubSample+= c->vChrDrop;
-
- // drop every other pixel for chroma calculation unless user wants full chroma
- if (isAnyRGB(srcFormat) && !(flags&SWS_FULL_CHR_H_INP)
- && srcFormat!=PIX_FMT_RGB8 && srcFormat!=PIX_FMT_BGR8
- && srcFormat!=PIX_FMT_RGB4 && srcFormat!=PIX_FMT_BGR4
- && srcFormat!=PIX_FMT_RGB4_BYTE && srcFormat!=PIX_FMT_BGR4_BYTE
- && ((dstW>>c->chrDstHSubSample) <= (srcW>>1) || (flags&(SWS_FAST_BILINEAR|SWS_POINT))))
- c->chrSrcHSubSample=1;
-
- if (param) {
- c->param[0] = param[0];
- c->param[1] = param[1];
- } else {
- c->param[0] =
- c->param[1] = SWS_PARAM_DEFAULT;
- }
-
- // Note the -((-x)>>y) is so that we always round toward +inf.
- c->chrSrcW= -((-srcW) >> c->chrSrcHSubSample);
- c->chrSrcH= -((-srcH) >> c->chrSrcVSubSample);
- c->chrDstW= -((-dstW) >> c->chrDstHSubSample);
- c->chrDstH= -((-dstH) >> c->chrDstVSubSample);
-
- sws_setColorspaceDetails(c, ff_yuv2rgb_coeffs[SWS_CS_DEFAULT], srcRange, ff_yuv2rgb_coeffs[SWS_CS_DEFAULT] /* FIXME*/, dstRange, 0, 1<<16, 1<<16);
-
- /* unscaled special cases */
- if (unscaled && !usesHFilter && !usesVFilter && (srcRange == dstRange || isAnyRGB(dstFormat))) {
- ff_get_unscaled_swscale(c);
-
- if (c->swScale) {
- if (flags&SWS_PRINT_INFO)
- av_log(c, AV_LOG_INFO, "using unscaled %s -> %s special converter\n",
- sws_format_name(srcFormat), sws_format_name(dstFormat));
- return c;
- }
- }
-
- if (flags & SWS_CPU_CAPS_MMX2) {
- c->canMMX2BeUsed= (dstW >=srcW && (dstW&31)==0 && (srcW&15)==0) ? 1 : 0;
- if (!c->canMMX2BeUsed && dstW >=srcW && (srcW&15)==0 && (flags&SWS_FAST_BILINEAR)) {
- if (flags&SWS_PRINT_INFO)
- av_log(c, AV_LOG_INFO, "output width is not a multiple of 32 -> no MMX2 scaler\n");
- }
- if (usesHFilter) c->canMMX2BeUsed=0;
- }
- else
- c->canMMX2BeUsed=0;
-
- c->chrXInc= ((c->chrSrcW<<16) + (c->chrDstW>>1))/c->chrDstW;
- c->chrYInc= ((c->chrSrcH<<16) + (c->chrDstH>>1))/c->chrDstH;
-
- // match pixel 0 of the src to pixel 0 of dst and match pixel n-2 of src to pixel n-2 of dst
- // but only for the FAST_BILINEAR mode otherwise do correct scaling
- // n-2 is the last chrominance sample available
- // this is not perfect, but no one should notice the difference, the more correct variant
- // would be like the vertical one, but that would require some special code for the
- // first and last pixel
- if (flags&SWS_FAST_BILINEAR) {
- if (c->canMMX2BeUsed) {
- c->lumXInc+= 20;
- c->chrXInc+= 20;
- }
- //we don't use the x86 asm scaler if MMX is available
- else if (flags & SWS_CPU_CAPS_MMX) {
- c->lumXInc = ((srcW-2)<<16)/(dstW-2) - 20;
- c->chrXInc = ((c->chrSrcW-2)<<16)/(c->chrDstW-2) - 20;
- }
- }
-
- /* precalculate horizontal scaler filter coefficients */
- {
-#if ARCH_X86 && (HAVE_MMX2 || CONFIG_RUNTIME_CPUDETECT) && CONFIG_GPL
-// can't downscale !!!
- if (c->canMMX2BeUsed && (flags & SWS_FAST_BILINEAR)) {
- c->lumMmx2FilterCodeSize = initMMX2HScaler( dstW, c->lumXInc, NULL, NULL, NULL, 8);
- c->chrMmx2FilterCodeSize = initMMX2HScaler(c->chrDstW, c->chrXInc, NULL, NULL, NULL, 4);
-
-#ifdef MAP_ANONYMOUS
- c->lumMmx2FilterCode = mmap(NULL, c->lumMmx2FilterCodeSize, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, 0, 0);
- c->chrMmx2FilterCode = mmap(NULL, c->chrMmx2FilterCodeSize, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, 0, 0);
-#elif HAVE_VIRTUALALLOC
- c->lumMmx2FilterCode = VirtualAlloc(NULL, c->lumMmx2FilterCodeSize, MEM_COMMIT, PAGE_EXECUTE_READWRITE);
- c->chrMmx2FilterCode = VirtualAlloc(NULL, c->chrMmx2FilterCodeSize, MEM_COMMIT, PAGE_EXECUTE_READWRITE);
-#else
- c->lumMmx2FilterCode = av_malloc(c->lumMmx2FilterCodeSize);
- c->chrMmx2FilterCode = av_malloc(c->chrMmx2FilterCodeSize);
-#endif
-
- FF_ALLOCZ_OR_GOTO(c, c->hLumFilter , (dstW /8+8)*sizeof(int16_t), fail);
- FF_ALLOCZ_OR_GOTO(c, c->hChrFilter , (c->chrDstW /4+8)*sizeof(int16_t), fail);
- FF_ALLOCZ_OR_GOTO(c, c->hLumFilterPos, (dstW /2/8+8)*sizeof(int32_t), fail);
- FF_ALLOCZ_OR_GOTO(c, c->hChrFilterPos, (c->chrDstW/2/4+8)*sizeof(int32_t), fail);
-
- initMMX2HScaler( dstW, c->lumXInc, c->lumMmx2FilterCode, c->hLumFilter, c->hLumFilterPos, 8);
- initMMX2HScaler(c->chrDstW, c->chrXInc, c->chrMmx2FilterCode, c->hChrFilter, c->hChrFilterPos, 4);
-
-#ifdef MAP_ANONYMOUS
- mprotect(c->lumMmx2FilterCode, c->lumMmx2FilterCodeSize, PROT_EXEC | PROT_READ);
- mprotect(c->chrMmx2FilterCode, c->chrMmx2FilterCodeSize, PROT_EXEC | PROT_READ);
-#endif
- } else
-#endif /* ARCH_X86 && (HAVE_MMX2 || CONFIG_RUNTIME_CPUDETECT) && CONFIG_GPL */
- {
- const int filterAlign=
- (flags & SWS_CPU_CAPS_MMX) ? 4 :
- (flags & SWS_CPU_CAPS_ALTIVEC) ? 8 :
- 1;
-
- if (initFilter(&c->hLumFilter, &c->hLumFilterPos, &c->hLumFilterSize, c->lumXInc,
- srcW , dstW, filterAlign, 1<<14,
- (flags&SWS_BICUBLIN) ? (flags|SWS_BICUBIC) : flags,
- srcFilter->lumH, dstFilter->lumH, c->param) < 0)
- goto fail;
- if (initFilter(&c->hChrFilter, &c->hChrFilterPos, &c->hChrFilterSize, c->chrXInc,
- c->chrSrcW, c->chrDstW, filterAlign, 1<<14,
- (flags&SWS_BICUBLIN) ? (flags|SWS_BILINEAR) : flags,
- srcFilter->chrH, dstFilter->chrH, c->param) < 0)
- goto fail;
- }
- } // initialize horizontal stuff
-
- /* precalculate vertical scaler filter coefficients */
- {
- const int filterAlign=
- (flags & SWS_CPU_CAPS_MMX) && (flags & SWS_ACCURATE_RND) ? 2 :
- (flags & SWS_CPU_CAPS_ALTIVEC) ? 8 :
- 1;
-
- if (initFilter(&c->vLumFilter, &c->vLumFilterPos, &c->vLumFilterSize, c->lumYInc,
- srcH , dstH, filterAlign, (1<<12),
- (flags&SWS_BICUBLIN) ? (flags|SWS_BICUBIC) : flags,
- srcFilter->lumV, dstFilter->lumV, c->param) < 0)
- goto fail;
- if (initFilter(&c->vChrFilter, &c->vChrFilterPos, &c->vChrFilterSize, c->chrYInc,
- c->chrSrcH, c->chrDstH, filterAlign, (1<<12),
- (flags&SWS_BICUBLIN) ? (flags|SWS_BILINEAR) : flags,
- srcFilter->chrV, dstFilter->chrV, c->param) < 0)
- goto fail;
-
-#if ARCH_PPC && (HAVE_ALTIVEC || CONFIG_RUNTIME_CPUDETECT)
- FF_ALLOC_OR_GOTO(c, c->vYCoeffsBank, sizeof (vector signed short)*c->vLumFilterSize*c->dstH, fail);
- FF_ALLOC_OR_GOTO(c, c->vCCoeffsBank, sizeof (vector signed short)*c->vChrFilterSize*c->chrDstH, fail);
-
- for (i=0;i<c->vLumFilterSize*c->dstH;i++) {
- int j;
- short *p = (short *)&c->vYCoeffsBank[i];
- for (j=0;j<8;j++)
- p[j] = c->vLumFilter[i];
- }
-
- for (i=0;i<c->vChrFilterSize*c->chrDstH;i++) {
- int j;
- short *p = (short *)&c->vCCoeffsBank[i];
- for (j=0;j<8;j++)
- p[j] = c->vChrFilter[i];
- }
-#endif
- }
-
- // calculate buffer sizes so that they won't run out while handling these damn slices
- c->vLumBufSize= c->vLumFilterSize;
- c->vChrBufSize= c->vChrFilterSize;
- for (i=0; i<dstH; i++) {
- int chrI= i*c->chrDstH / dstH;
- int nextSlice= FFMAX(c->vLumFilterPos[i ] + c->vLumFilterSize - 1,
- ((c->vChrFilterPos[chrI] + c->vChrFilterSize - 1)<<c->chrSrcVSubSample));
-
- nextSlice>>= c->chrSrcVSubSample;
- nextSlice<<= c->chrSrcVSubSample;
- if (c->vLumFilterPos[i ] + c->vLumBufSize < nextSlice)
- c->vLumBufSize= nextSlice - c->vLumFilterPos[i];
- if (c->vChrFilterPos[chrI] + c->vChrBufSize < (nextSlice>>c->chrSrcVSubSample))
- c->vChrBufSize= (nextSlice>>c->chrSrcVSubSample) - c->vChrFilterPos[chrI];
- }
-
- // allocate pixbufs (we use dynamic allocation because otherwise we would need to
- // allocate several megabytes to handle all possible cases)
- FF_ALLOC_OR_GOTO(c, c->lumPixBuf, c->vLumBufSize*2*sizeof(int16_t*), fail);
- FF_ALLOC_OR_GOTO(c, c->chrPixBuf, c->vChrBufSize*2*sizeof(int16_t*), fail);
- if (CONFIG_SWSCALE_ALPHA && isALPHA(c->srcFormat) && isALPHA(c->dstFormat))
- FF_ALLOCZ_OR_GOTO(c, c->alpPixBuf, c->vLumBufSize*2*sizeof(int16_t*), fail);
- //Note we need at least one pixel more at the end because of the MMX code (just in case someone wanna replace the 4000/8000)
- /* align at 16 bytes for AltiVec */
- for (i=0; i<c->vLumBufSize; i++) {
- FF_ALLOCZ_OR_GOTO(c, c->lumPixBuf[i+c->vLumBufSize], VOF+1, fail);
- c->lumPixBuf[i] = c->lumPixBuf[i+c->vLumBufSize];
- }
- for (i=0; i<c->vChrBufSize; i++) {
- FF_ALLOC_OR_GOTO(c, c->chrPixBuf[i+c->vChrBufSize], (VOF+1)*2, fail);
- c->chrPixBuf[i] = c->chrPixBuf[i+c->vChrBufSize];
- }
- if (CONFIG_SWSCALE_ALPHA && c->alpPixBuf)
- for (i=0; i<c->vLumBufSize; i++) {
- FF_ALLOCZ_OR_GOTO(c, c->alpPixBuf[i+c->vLumBufSize], VOF+1, fail);
- c->alpPixBuf[i] = c->alpPixBuf[i+c->vLumBufSize];
- }
-
- //try to avoid drawing green stuff between the right end and the stride end
- for (i=0; i<c->vChrBufSize; i++) memset(c->chrPixBuf[i], 64, (VOF+1)*2);
-
- assert(2*VOFW == VOF);
-
- assert(c->chrDstH <= dstH);
-
- if (flags&SWS_PRINT_INFO) {
- if (flags&SWS_FAST_BILINEAR)
- av_log(c, AV_LOG_INFO, "FAST_BILINEAR scaler, ");
- else if (flags&SWS_BILINEAR)
- av_log(c, AV_LOG_INFO, "BILINEAR scaler, ");
- else if (flags&SWS_BICUBIC)
- av_log(c, AV_LOG_INFO, "BICUBIC scaler, ");
- else if (flags&SWS_X)
- av_log(c, AV_LOG_INFO, "Experimental scaler, ");
- else if (flags&SWS_POINT)
- av_log(c, AV_LOG_INFO, "Nearest Neighbor / POINT scaler, ");
- else if (flags&SWS_AREA)
- av_log(c, AV_LOG_INFO, "Area Averaging scaler, ");
- else if (flags&SWS_BICUBLIN)
- av_log(c, AV_LOG_INFO, "luma BICUBIC / chroma BILINEAR scaler, ");
- else if (flags&SWS_GAUSS)
- av_log(c, AV_LOG_INFO, "Gaussian scaler, ");
- else if (flags&SWS_SINC)
- av_log(c, AV_LOG_INFO, "Sinc scaler, ");
- else if (flags&SWS_LANCZOS)
- av_log(c, AV_LOG_INFO, "Lanczos scaler, ");
- else if (flags&SWS_SPLINE)
- av_log(c, AV_LOG_INFO, "Bicubic spline scaler, ");
- else
- av_log(c, AV_LOG_INFO, "ehh flags invalid?! ");
-
- av_log(c, AV_LOG_INFO, "from %s to %s%s ",
- sws_format_name(srcFormat),
-#ifdef DITHER1XBPP
- dstFormat == PIX_FMT_BGR555 || dstFormat == PIX_FMT_BGR565 ? "dithered " : "",
-#else
- "",
-#endif
- sws_format_name(dstFormat));
-
- if (flags & SWS_CPU_CAPS_MMX2)
- av_log(c, AV_LOG_INFO, "using MMX2\n");
- else if (flags & SWS_CPU_CAPS_3DNOW)
- av_log(c, AV_LOG_INFO, "using 3DNOW\n");
- else if (flags & SWS_CPU_CAPS_MMX)
- av_log(c, AV_LOG_INFO, "using MMX\n");
- else if (flags & SWS_CPU_CAPS_ALTIVEC)
- av_log(c, AV_LOG_INFO, "using AltiVec\n");
- else
- av_log(c, AV_LOG_INFO, "using C\n");
-
- if (flags & SWS_CPU_CAPS_MMX) {
- if (c->canMMX2BeUsed && (flags&SWS_FAST_BILINEAR))
- av_log(c, AV_LOG_VERBOSE, "using FAST_BILINEAR MMX2 scaler for horizontal scaling\n");
- else {
- if (c->hLumFilterSize==4)
- av_log(c, AV_LOG_VERBOSE, "using 4-tap MMX scaler for horizontal luminance scaling\n");
- else if (c->hLumFilterSize==8)
- av_log(c, AV_LOG_VERBOSE, "using 8-tap MMX scaler for horizontal luminance scaling\n");
- else
- av_log(c, AV_LOG_VERBOSE, "using n-tap MMX scaler for horizontal luminance scaling\n");
-
- if (c->hChrFilterSize==4)
- av_log(c, AV_LOG_VERBOSE, "using 4-tap MMX scaler for horizontal chrominance scaling\n");
- else if (c->hChrFilterSize==8)
- av_log(c, AV_LOG_VERBOSE, "using 8-tap MMX scaler for horizontal chrominance scaling\n");
- else
- av_log(c, AV_LOG_VERBOSE, "using n-tap MMX scaler for horizontal chrominance scaling\n");
- }
- } else {
-#if ARCH_X86
- av_log(c, AV_LOG_VERBOSE, "using x86 asm scaler for horizontal scaling\n");
-#else
- if (flags & SWS_FAST_BILINEAR)
- av_log(c, AV_LOG_VERBOSE, "using FAST_BILINEAR C scaler for horizontal scaling\n");
- else
- av_log(c, AV_LOG_VERBOSE, "using C scaler for horizontal scaling\n");
-#endif
- }
- if (isPlanarYUV(dstFormat)) {
- if (c->vLumFilterSize==1)
- av_log(c, AV_LOG_VERBOSE, "using 1-tap %s \"scaler\" for vertical scaling (YV12 like)\n", (flags & SWS_CPU_CAPS_MMX) ? "MMX" : "C");
- else
- av_log(c, AV_LOG_VERBOSE, "using n-tap %s scaler for vertical scaling (YV12 like)\n", (flags & SWS_CPU_CAPS_MMX) ? "MMX" : "C");
- } else {
- if (c->vLumFilterSize==1 && c->vChrFilterSize==2)
- av_log(c, AV_LOG_VERBOSE, "using 1-tap %s \"scaler\" for vertical luminance scaling (BGR)\n"
- " 2-tap scaler for vertical chrominance scaling (BGR)\n", (flags & SWS_CPU_CAPS_MMX) ? "MMX" : "C");
- else if (c->vLumFilterSize==2 && c->vChrFilterSize==2)
- av_log(c, AV_LOG_VERBOSE, "using 2-tap linear %s scaler for vertical scaling (BGR)\n", (flags & SWS_CPU_CAPS_MMX) ? "MMX" : "C");
- else
- av_log(c, AV_LOG_VERBOSE, "using n-tap %s scaler for vertical scaling (BGR)\n", (flags & SWS_CPU_CAPS_MMX) ? "MMX" : "C");
- }
-
- if (dstFormat==PIX_FMT_BGR24)
- av_log(c, AV_LOG_VERBOSE, "using %s YV12->BGR24 converter\n",
- (flags & SWS_CPU_CAPS_MMX2) ? "MMX2" : ((flags & SWS_CPU_CAPS_MMX) ? "MMX" : "C"));
- else if (dstFormat==PIX_FMT_RGB32)
- av_log(c, AV_LOG_VERBOSE, "using %s YV12->BGR32 converter\n", (flags & SWS_CPU_CAPS_MMX) ? "MMX" : "C");
- else if (dstFormat==PIX_FMT_BGR565)
- av_log(c, AV_LOG_VERBOSE, "using %s YV12->BGR16 converter\n", (flags & SWS_CPU_CAPS_MMX) ? "MMX" : "C");
- else if (dstFormat==PIX_FMT_BGR555)
- av_log(c, AV_LOG_VERBOSE, "using %s YV12->BGR15 converter\n", (flags & SWS_CPU_CAPS_MMX) ? "MMX" : "C");
-
- av_log(c, AV_LOG_VERBOSE, "%dx%d -> %dx%d\n", srcW, srcH, dstW, dstH);
- av_log(c, AV_LOG_DEBUG, "lum srcW=%d srcH=%d dstW=%d dstH=%d xInc=%d yInc=%d\n",
- c->srcW, c->srcH, c->dstW, c->dstH, c->lumXInc, c->lumYInc);
- av_log(c, AV_LOG_DEBUG, "chr srcW=%d srcH=%d dstW=%d dstH=%d xInc=%d yInc=%d\n",
- c->chrSrcW, c->chrSrcH, c->chrDstW, c->chrDstH, c->chrXInc, c->chrYInc);
- }
-
- c->swScale= ff_getSwsFunc(c);
- return c;
-
-fail:
- sws_freeContext(c);
- return NULL;
-}
-
-SwsFilter *sws_getDefaultFilter(float lumaGBlur, float chromaGBlur,
- float lumaSharpen, float chromaSharpen,
- float chromaHShift, float chromaVShift,
- int verbose)
-{
- SwsFilter *filter= av_malloc(sizeof(SwsFilter));
- if (!filter)
- return NULL;
-
- if (lumaGBlur!=0.0) {
- filter->lumH= sws_getGaussianVec(lumaGBlur, 3.0);
- filter->lumV= sws_getGaussianVec(lumaGBlur, 3.0);
- } else {
- filter->lumH= sws_getIdentityVec();
- filter->lumV= sws_getIdentityVec();
- }
-
- if (chromaGBlur!=0.0) {
- filter->chrH= sws_getGaussianVec(chromaGBlur, 3.0);
- filter->chrV= sws_getGaussianVec(chromaGBlur, 3.0);
- } else {
- filter->chrH= sws_getIdentityVec();
- filter->chrV= sws_getIdentityVec();
- }
-
- if (chromaSharpen!=0.0) {
- SwsVector *id= sws_getIdentityVec();
- sws_scaleVec(filter->chrH, -chromaSharpen);
- sws_scaleVec(filter->chrV, -chromaSharpen);
- sws_addVec(filter->chrH, id);
- sws_addVec(filter->chrV, id);
- sws_freeVec(id);
- }
-
- if (lumaSharpen!=0.0) {
- SwsVector *id= sws_getIdentityVec();
- sws_scaleVec(filter->lumH, -lumaSharpen);
- sws_scaleVec(filter->lumV, -lumaSharpen);
- sws_addVec(filter->lumH, id);
- sws_addVec(filter->lumV, id);
- sws_freeVec(id);
- }
-
- if (chromaHShift != 0.0)
- sws_shiftVec(filter->chrH, (int)(chromaHShift+0.5));
-
- if (chromaVShift != 0.0)
- sws_shiftVec(filter->chrV, (int)(chromaVShift+0.5));
-
- sws_normalizeVec(filter->chrH, 1.0);
- sws_normalizeVec(filter->chrV, 1.0);
- sws_normalizeVec(filter->lumH, 1.0);
- sws_normalizeVec(filter->lumV, 1.0);
-
- if (verbose) sws_printVec2(filter->chrH, NULL, AV_LOG_DEBUG);
- if (verbose) sws_printVec2(filter->lumH, NULL, AV_LOG_DEBUG);
-
- return filter;
-}
-
-SwsVector *sws_allocVec(int length)
-{
- SwsVector *vec = av_malloc(sizeof(SwsVector));
- if (!vec)
- return NULL;
- vec->length = length;
- vec->coeff = av_malloc(sizeof(double) * length);
- if (!vec->coeff)
- av_freep(&vec);
- return vec;
-}
-
-SwsVector *sws_getGaussianVec(double variance, double quality)
-{
- const int length= (int)(variance*quality + 0.5) | 1;
- int i;
- double middle= (length-1)*0.5;
- SwsVector *vec= sws_allocVec(length);
-
- if (!vec)
- return NULL;
-
- for (i=0; i<length; i++) {
- double dist= i-middle;
- vec->coeff[i]= exp(-dist*dist/(2*variance*variance)) / sqrt(2*variance*M_PI);
- }
-
- sws_normalizeVec(vec, 1.0);
-
- return vec;
-}
-
-SwsVector *sws_getConstVec(double c, int length)
-{
- int i;
- SwsVector *vec= sws_allocVec(length);
-
- if (!vec)
- return NULL;
-
- for (i=0; i<length; i++)
- vec->coeff[i]= c;
-
- return vec;
-}
-
-SwsVector *sws_getIdentityVec(void)
-{
- return sws_getConstVec(1.0, 1);
-}
-
-double sws_dcVec(SwsVector *a)
-{
- int i;
- double sum=0;
-
- for (i=0; i<a->length; i++)
- sum+= a->coeff[i];
-
- return sum;
-}
-
-void sws_scaleVec(SwsVector *a, double scalar)
-{
- int i;
-
- for (i=0; i<a->length; i++)
- a->coeff[i]*= scalar;
-}
-
-void sws_normalizeVec(SwsVector *a, double height)
-{
- sws_scaleVec(a, height/sws_dcVec(a));
-}
-
-static SwsVector *sws_getConvVec(SwsVector *a, SwsVector *b)
-{
- int length= a->length + b->length - 1;
- int i, j;
- SwsVector *vec= sws_getConstVec(0.0, length);
-
- if (!vec)
- return NULL;
-
- for (i=0; i<a->length; i++) {
- for (j=0; j<b->length; j++) {
- vec->coeff[i+j]+= a->coeff[i]*b->coeff[j];
- }
- }
-
- return vec;
-}
-
-static SwsVector *sws_sumVec(SwsVector *a, SwsVector *b)
-{
- int length= FFMAX(a->length, b->length);
- int i;
- SwsVector *vec= sws_getConstVec(0.0, length);
-
- if (!vec)
- return NULL;
-
- for (i=0; i<a->length; i++) vec->coeff[i + (length-1)/2 - (a->length-1)/2]+= a->coeff[i];
- for (i=0; i<b->length; i++) vec->coeff[i + (length-1)/2 - (b->length-1)/2]+= b->coeff[i];
-
- return vec;
-}
-
-static SwsVector *sws_diffVec(SwsVector *a, SwsVector *b)
-{
- int length= FFMAX(a->length, b->length);
- int i;
- SwsVector *vec= sws_getConstVec(0.0, length);
-
- if (!vec)
- return NULL;
-
- for (i=0; i<a->length; i++) vec->coeff[i + (length-1)/2 - (a->length-1)/2]+= a->coeff[i];
- for (i=0; i<b->length; i++) vec->coeff[i + (length-1)/2 - (b->length-1)/2]-= b->coeff[i];
-
- return vec;
-}
-
-/* shift left / or right if "shift" is negative */
-static SwsVector *sws_getShiftedVec(SwsVector *a, int shift)
-{
- int length= a->length + FFABS(shift)*2;
- int i;
- SwsVector *vec= sws_getConstVec(0.0, length);
-
- if (!vec)
- return NULL;
-
- for (i=0; i<a->length; i++) {
- vec->coeff[i + (length-1)/2 - (a->length-1)/2 - shift]= a->coeff[i];
- }
-
- return vec;
-}
-
-void sws_shiftVec(SwsVector *a, int shift)
-{
- SwsVector *shifted= sws_getShiftedVec(a, shift);
- av_free(a->coeff);
- a->coeff= shifted->coeff;
- a->length= shifted->length;
- av_free(shifted);
-}
-
-void sws_addVec(SwsVector *a, SwsVector *b)
-{
- SwsVector *sum= sws_sumVec(a, b);
- av_free(a->coeff);
- a->coeff= sum->coeff;
- a->length= sum->length;
- av_free(sum);
-}
-
-void sws_subVec(SwsVector *a, SwsVector *b)
-{
- SwsVector *diff= sws_diffVec(a, b);
- av_free(a->coeff);
- a->coeff= diff->coeff;
- a->length= diff->length;
- av_free(diff);
-}
-
-void sws_convVec(SwsVector *a, SwsVector *b)
-{
- SwsVector *conv= sws_getConvVec(a, b);
- av_free(a->coeff);
- a->coeff= conv->coeff;
- a->length= conv->length;
- av_free(conv);
-}
-
-SwsVector *sws_cloneVec(SwsVector *a)
-{
- int i;
- SwsVector *vec= sws_allocVec(a->length);
-
- if (!vec)
- return NULL;
-
- for (i=0; i<a->length; i++) vec->coeff[i]= a->coeff[i];
-
- return vec;
-}
-
-void sws_printVec2(SwsVector *a, AVClass *log_ctx, int log_level)
-{
- int i;
- double max=0;
- double min=0;
- double range;
-
- for (i=0; i<a->length; i++)
- if (a->coeff[i]>max) max= a->coeff[i];
-
- for (i=0; i<a->length; i++)
- if (a->coeff[i]<min) min= a->coeff[i];
-
- range= max - min;
-
- for (i=0; i<a->length; i++) {
- int x= (int)((a->coeff[i]-min)*60.0/range +0.5);
- av_log(log_ctx, log_level, "%1.3f ", a->coeff[i]);
- for (;x>0; x--) av_log(log_ctx, log_level, " ");
- av_log(log_ctx, log_level, "|\n");
- }
-}
-
-#if LIBSWSCALE_VERSION_MAJOR < 1
-void sws_printVec(SwsVector *a)
-{
- sws_printVec2(a, NULL, AV_LOG_DEBUG);
-}
-#endif
-
-void sws_freeVec(SwsVector *a)
-{
- if (!a) return;
- av_freep(&a->coeff);
- a->length=0;
- av_free(a);
-}
-
-void sws_freeFilter(SwsFilter *filter)
-{
- if (!filter) return;
-
- if (filter->lumH) sws_freeVec(filter->lumH);
- if (filter->lumV) sws_freeVec(filter->lumV);
- if (filter->chrH) sws_freeVec(filter->chrH);
- if (filter->chrV) sws_freeVec(filter->chrV);
- av_free(filter);
-}
-
-void sws_freeContext(SwsContext *c)
-{
- int i;
- if (!c) return;
-
- if (c->lumPixBuf) {
- for (i=0; i<c->vLumBufSize; i++)
- av_freep(&c->lumPixBuf[i]);
- av_freep(&c->lumPixBuf);
- }
-
- if (c->chrPixBuf) {
- for (i=0; i<c->vChrBufSize; i++)
- av_freep(&c->chrPixBuf[i]);
- av_freep(&c->chrPixBuf);
- }
-
- if (CONFIG_SWSCALE_ALPHA && c->alpPixBuf) {
- for (i=0; i<c->vLumBufSize; i++)
- av_freep(&c->alpPixBuf[i]);
- av_freep(&c->alpPixBuf);
- }
-
- av_freep(&c->vLumFilter);
- av_freep(&c->vChrFilter);
- av_freep(&c->hLumFilter);
- av_freep(&c->hChrFilter);
-#if ARCH_PPC && (HAVE_ALTIVEC || CONFIG_RUNTIME_CPUDETECT)
- av_freep(&c->vYCoeffsBank);
- av_freep(&c->vCCoeffsBank);
-#endif
-
- av_freep(&c->vLumFilterPos);
- av_freep(&c->vChrFilterPos);
- av_freep(&c->hLumFilterPos);
- av_freep(&c->hChrFilterPos);
-
-#if ARCH_X86 && CONFIG_GPL
-#ifdef MAP_ANONYMOUS
- if (c->lumMmx2FilterCode) munmap(c->lumMmx2FilterCode, c->lumMmx2FilterCodeSize);
- if (c->chrMmx2FilterCode) munmap(c->chrMmx2FilterCode, c->chrMmx2FilterCodeSize);
-#elif HAVE_VIRTUALALLOC
- if (c->lumMmx2FilterCode) VirtualFree(c->lumMmx2FilterCode, c->lumMmx2FilterCodeSize, MEM_RELEASE);
- if (c->chrMmx2FilterCode) VirtualFree(c->chrMmx2FilterCode, c->chrMmx2FilterCodeSize, MEM_RELEASE);
-#else
- av_free(c->lumMmx2FilterCode);
- av_free(c->chrMmx2FilterCode);
-#endif
- c->lumMmx2FilterCode=NULL;
- c->chrMmx2FilterCode=NULL;
-#endif /* ARCH_X86 && CONFIG_GPL */
-
- av_freep(&c->yuvTable);
-
- av_free(c);
-}
-
-struct SwsContext *sws_getCachedContext(struct SwsContext *context,
- int srcW, int srcH, enum PixelFormat srcFormat,
- int dstW, int dstH, enum PixelFormat dstFormat, int flags,
- SwsFilter *srcFilter, SwsFilter *dstFilter, const double *param)
-{
- static const double default_param[2] = {SWS_PARAM_DEFAULT, SWS_PARAM_DEFAULT};
-
- if (!param)
- param = default_param;
-
- if (context) {
- if (context->srcW != srcW || context->srcH != srcH ||
- context->srcFormat != srcFormat ||
- context->dstW != dstW || context->dstH != dstH ||
- context->dstFormat != dstFormat || context->flags != flags ||
- context->param[0] != param[0] || context->param[1] != param[1])
- {
- sws_freeContext(context);
- context = NULL;
- }
- }
- if (!context) {
- return sws_getContext(srcW, srcH, srcFormat,
- dstW, dstH, dstFormat, flags,
- srcFilter, dstFilter, param);
- }
- return context;
-}
-
diff --git a/libswscale/x86/yuv2rgb_mmx.c b/libswscale/x86/yuv2rgb_mmx.c
deleted file mode 100644
index 1e69df1641..0000000000
--- a/libswscale/x86/yuv2rgb_mmx.c
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * software YUV to RGB converter
- *
- * Copyright (C) 2009 Konstantin Shishkov
- *
- * MMX/MMX2 template stuff (needed for fast movntq support),
- * 1,4,8bpp support and context / deglobalize stuff
- * by Michael Niedermayer (michaelni@gmx.at)
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * FFmpeg 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <inttypes.h>
-#include <assert.h>
-
-#include "config.h"
-#include "libswscale/rgb2rgb.h"
-#include "libswscale/swscale.h"
-#include "libswscale/swscale_internal.h"
-#include "libavutil/x86_cpu.h"
-
-#define DITHER1XBPP // only for MMX
-
-/* hope these constant values are cache line aligned */
-DECLARE_ASM_CONST(8, uint64_t, mmx_00ffw) = 0x00ff00ff00ff00ffULL;
-DECLARE_ASM_CONST(8, uint64_t, mmx_redmask) = 0xf8f8f8f8f8f8f8f8ULL;
-DECLARE_ASM_CONST(8, uint64_t, mmx_grnmask) = 0xfcfcfcfcfcfcfcfcULL;
-
-//MMX versions
-#undef RENAME
-#undef HAVE_MMX2
-#undef HAVE_AMD3DNOW
-#define HAVE_MMX2 0
-#define HAVE_AMD3DNOW 0
-#define RENAME(a) a ## _MMX
-#include "yuv2rgb_template.c"
-
-//MMX2 versions
-#undef RENAME
-#undef HAVE_MMX2
-#define HAVE_MMX2 1
-#define RENAME(a) a ## _MMX2
-#include "yuv2rgb_template.c"
-
-SwsFunc ff_yuv2rgb_init_mmx(SwsContext *c)
-{
- if (c->flags & SWS_CPU_CAPS_MMX2) {
- switch (c->dstFormat) {
- case PIX_FMT_RGB32:
- if (CONFIG_SWSCALE_ALPHA && c->srcFormat == PIX_FMT_YUVA420P) {
- if (HAVE_7REGS) return yuva420_rgb32_MMX2;
- break;
- } else return yuv420_rgb32_MMX2;
- case PIX_FMT_BGR32:
- if (CONFIG_SWSCALE_ALPHA && c->srcFormat == PIX_FMT_YUVA420P) {
- if (HAVE_7REGS) return yuva420_bgr32_MMX2;
- break;
- } else return yuv420_bgr32_MMX2;
- case PIX_FMT_RGB24: return yuv420_rgb24_MMX2;
- case PIX_FMT_BGR24: return yuv420_bgr24_MMX2;
- case PIX_FMT_RGB565: return yuv420_rgb16_MMX2;
- case PIX_FMT_RGB555: return yuv420_rgb15_MMX2;
- }
- }
- if (c->flags & SWS_CPU_CAPS_MMX) {
- switch (c->dstFormat) {
- case PIX_FMT_RGB32:
- if (CONFIG_SWSCALE_ALPHA && c->srcFormat == PIX_FMT_YUVA420P) {
- if (HAVE_7REGS) return yuva420_rgb32_MMX;
- break;
- } else return yuv420_rgb32_MMX;
- case PIX_FMT_BGR32:
- if (CONFIG_SWSCALE_ALPHA && c->srcFormat == PIX_FMT_YUVA420P) {
- if (HAVE_7REGS) return yuva420_bgr32_MMX;
- break;
- } else return yuv420_bgr32_MMX;
- case PIX_FMT_RGB24: return yuv420_rgb24_MMX;
- case PIX_FMT_BGR24: return yuv420_bgr24_MMX;
- case PIX_FMT_RGB565: return yuv420_rgb16_MMX;
- case PIX_FMT_RGB555: return yuv420_rgb15_MMX;
- }
- }
-
- return NULL;
-}
diff --git a/libswscale/x86/yuv2rgb_template.c b/libswscale/x86/yuv2rgb_template.c
deleted file mode 100644
index ba906899f0..0000000000
--- a/libswscale/x86/yuv2rgb_template.c
+++ /dev/null
@@ -1,564 +0,0 @@
-/*
- * yuv2rgb_mmx.c, software YUV to RGB converter with Intel MMX "technology"
- *
- * Copyright (C) 2000, Silicon Integrated System Corp
- *
- * Author: Olie Lho <ollie@sis.com.tw>
- *
- * 15,24 bpp and dithering from Michael Niedermayer (michaelni@gmx.at)
- * MMX/MMX2 Template stuff from Michael Niedermayer (needed for fast movntq support)
- * context / deglobalize stuff by Michael Niedermayer
- *
- * This file is part of mpeg2dec, a free MPEG-2 video decoder
- *
- * mpeg2dec 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, or (at your option)
- * any later version.
- *
- * mpeg2dec 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 mpeg2dec; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#undef MOVNTQ
-#undef EMMS
-#undef SFENCE
-
-#if HAVE_AMD3DNOW
-/* On K6 femms is faster than emms. On K7 femms is directly mapped to emms. */
-#define EMMS "femms"
-#else
-#define EMMS "emms"
-#endif
-
-#if HAVE_MMX2
-#define MOVNTQ "movntq"
-#define SFENCE "sfence"
-#else
-#define MOVNTQ "movq"
-#define SFENCE " # nop"
-#endif
-
-#define YUV2RGB \
- /* Do the multiply part of the conversion for even and odd pixels,
- register usage:
- mm0 -> Cblue, mm1 -> Cred, mm2 -> Cgreen even pixels,
- mm3 -> Cblue, mm4 -> Cred, mm5 -> Cgreen odd pixels,
- mm6 -> Y even, mm7 -> Y odd */\
- /* convert the chroma part */\
- "punpcklbw %%mm4, %%mm0;" /* scatter 4 Cb 00 u3 00 u2 00 u1 00 u0 */ \
- "punpcklbw %%mm4, %%mm1;" /* scatter 4 Cr 00 v3 00 v2 00 v1 00 v0 */ \
-\
- "psllw $3, %%mm0;" /* Promote precision */ \
- "psllw $3, %%mm1;" /* Promote precision */ \
-\
- "psubsw "U_OFFSET"(%4), %%mm0;" /* Cb -= 128 */ \
- "psubsw "V_OFFSET"(%4), %%mm1;" /* Cr -= 128 */ \
-\
- "movq %%mm0, %%mm2;" /* Copy 4 Cb 00 u3 00 u2 00 u1 00 u0 */ \
- "movq %%mm1, %%mm3;" /* Copy 4 Cr 00 v3 00 v2 00 v1 00 v0 */ \
-\
- "pmulhw "UG_COEFF"(%4), %%mm2;" /* Mul Cb with green coeff -> Cb green */ \
- "pmulhw "VG_COEFF"(%4), %%mm3;" /* Mul Cr with green coeff -> Cr green */ \
-\
- "pmulhw "UB_COEFF"(%4), %%mm0;" /* Mul Cb -> Cblue 00 b3 00 b2 00 b1 00 b0 */\
- "pmulhw "VR_COEFF"(%4), %%mm1;" /* Mul Cr -> Cred 00 r3 00 r2 00 r1 00 r0 */\
-\
- "paddsw %%mm3, %%mm2;" /* Cb green + Cr green -> Cgreen */\
-\
- /* convert the luma part */\
- "movq %%mm6, %%mm7;" /* Copy 8 Y Y7 Y6 Y5 Y4 Y3 Y2 Y1 Y0 */\
- "pand "MANGLE(mmx_00ffw)", %%mm6;" /* get Y even 00 Y6 00 Y4 00 Y2 00 Y0 */\
-\
- "psrlw $8, %%mm7;" /* get Y odd 00 Y7 00 Y5 00 Y3 00 Y1 */\
-\
- "psllw $3, %%mm6;" /* Promote precision */\
- "psllw $3, %%mm7;" /* Promote precision */\
-\
- "psubw "Y_OFFSET"(%4), %%mm6;" /* Y -= 16 */\
- "psubw "Y_OFFSET"(%4), %%mm7;" /* Y -= 16 */\
-\
- "pmulhw "Y_COEFF"(%4), %%mm6;" /* Mul 4 Y even 00 y6 00 y4 00 y2 00 y0 */\
- "pmulhw "Y_COEFF"(%4), %%mm7;" /* Mul 4 Y odd 00 y7 00 y5 00 y3 00 y1 */\
-\
- /* Do the addition part of the conversion for even and odd pixels,
- register usage:
- mm0 -> Cblue, mm1 -> Cred, mm2 -> Cgreen even pixels,
- mm3 -> Cblue, mm4 -> Cred, mm5 -> Cgreen odd pixels,
- mm6 -> Y even, mm7 -> Y odd */\
- "movq %%mm0, %%mm3;" /* Copy Cblue */\
- "movq %%mm1, %%mm4;" /* Copy Cred */\
- "movq %%mm2, %%mm5;" /* Copy Cgreen */\
-\
- "paddsw %%mm6, %%mm0;" /* Y even + Cblue 00 B6 00 B4 00 B2 00 B0 */\
- "paddsw %%mm7, %%mm3;" /* Y odd + Cblue 00 B7 00 B5 00 B3 00 B1 */\
-\
- "paddsw %%mm6, %%mm1;" /* Y even + Cred 00 R6 00 R4 00 R2 00 R0 */\
- "paddsw %%mm7, %%mm4;" /* Y odd + Cred 00 R7 00 R5 00 R3 00 R1 */\
-\
- "paddsw %%mm6, %%mm2;" /* Y even + Cgreen 00 G6 00 G4 00 G2 00 G0 */\
- "paddsw %%mm7, %%mm5;" /* Y odd + Cgreen 00 G7 00 G5 00 G3 00 G1 */\
-\
- /* Limit RGB even to 0..255 */\
- "packuswb %%mm0, %%mm0;" /* B6 B4 B2 B0 B6 B4 B2 B0 */\
- "packuswb %%mm1, %%mm1;" /* R6 R4 R2 R0 R6 R4 R2 R0 */\
- "packuswb %%mm2, %%mm2;" /* G6 G4 G2 G0 G6 G4 G2 G0 */\
-\
- /* Limit RGB odd to 0..255 */\
- "packuswb %%mm3, %%mm3;" /* B7 B5 B3 B1 B7 B5 B3 B1 */\
- "packuswb %%mm4, %%mm4;" /* R7 R5 R3 R1 R7 R5 R3 R1 */\
- "packuswb %%mm5, %%mm5;" /* G7 G5 G3 G1 G7 G5 G3 G1 */\
-\
- /* Interleave RGB even and odd */\
- "punpcklbw %%mm3, %%mm0;" /* B7 B6 B5 B4 B3 B2 B1 B0 */\
- "punpcklbw %%mm4, %%mm1;" /* R7 R6 R5 R4 R3 R2 R1 R0 */\
- "punpcklbw %%mm5, %%mm2;" /* G7 G6 G5 G4 G3 G2 G1 G0 */\
-
-
-#define YUV422_UNSHIFT \
- if(c->srcFormat == PIX_FMT_YUV422P) {\
- srcStride[1] *= 2; \
- srcStride[2] *= 2; \
- } \
-
-#define YUV2RGB_LOOP(depth) \
- h_size= (c->dstW+7)&~7; \
- if(h_size*depth > FFABS(dstStride[0])) h_size-=8; \
-\
- __asm__ volatile ("pxor %mm4, %mm4;" /* zero mm4 */ ); \
- for (y= 0; y<srcSliceH; y++ ) { \
- uint8_t *image = dst[0] + (y+srcSliceY)*dstStride[0]; \
- const uint8_t *py = src[0] + y*srcStride[0]; \
- const uint8_t *pu = src[1] + (y>>1)*srcStride[1]; \
- const uint8_t *pv = src[2] + (y>>1)*srcStride[2]; \
- x86_reg index= -h_size/2; \
-
-#define YUV2RGB_INIT \
- /* This MMX assembly code deals with a SINGLE scan line at a time, \
- * it converts 8 pixels in each iteration. */ \
- __asm__ volatile ( \
- /* load data for start of next scan line */ \
- "movd (%2, %0), %%mm0;" /* Load 4 Cb 00 00 00 00 u3 u2 u1 u0 */ \
- "movd (%3, %0), %%mm1;" /* Load 4 Cr 00 00 00 00 v3 v2 v1 v0 */ \
- "movq (%5, %0, 2), %%mm6;" /* Load 8 Y Y7 Y6 Y5 Y4 Y3 Y2 Y1 Y0 */ \
- /* \
- ".balign 16 \n\t" \
- */ \
- "1: \n\t" \
- /* No speed difference on my p3@500 with prefetch, \
- * if it is faster for anyone with -benchmark then tell me. \
- PREFETCH" 64(%0) \n\t" \
- PREFETCH" 64(%1) \n\t" \
- PREFETCH" 64(%2) \n\t" \
- */ \
-
-#define YUV2RGB_ENDLOOP(depth) \
- "add $"AV_STRINGIFY(depth*8)", %1 \n\t" \
- "add $4, %0 \n\t" \
- " js 1b \n\t" \
-
-#define YUV2RGB_OPERANDS \
- : "+r" (index), "+r" (image) \
- : "r" (pu - index), "r" (pv - index), "r"(&c->redDither), "r" (py - 2*index) \
- ); \
- } \
- __asm__ volatile (SFENCE"\n\t"EMMS); \
- return srcSliceH; \
-
-#define YUV2RGB_OPERANDS_ALPHA \
- : "+r" (index), "+r" (image) \
- : "r" (pu - index), "r" (pv - index), "r"(&c->redDither), "r" (py - 2*index), "r" (pa - 2*index) \
- ); \
- } \
- __asm__ volatile (SFENCE"\n\t"EMMS); \
- return srcSliceH; \
-
-static inline int RENAME(yuv420_rgb16)(SwsContext *c, const uint8_t* src[], int srcStride[], int srcSliceY,
- int srcSliceH, uint8_t* dst[], int dstStride[])
-{
- int y, h_size;
-
- YUV422_UNSHIFT
- YUV2RGB_LOOP(2)
-
- c->blueDither= ff_dither8[y&1];
- c->greenDither= ff_dither4[y&1];
- c->redDither= ff_dither8[(y+1)&1];
-
- YUV2RGB_INIT
- YUV2RGB
-
-#ifdef DITHER1XBPP
- "paddusb "BLUE_DITHER"(%4), %%mm0;"
- "paddusb "GREEN_DITHER"(%4), %%mm2;"
- "paddusb "RED_DITHER"(%4), %%mm1;"
-#endif
- /* mask unneeded bits off */
- "pand "MANGLE(mmx_redmask)", %%mm0;" /* b7b6b5b4 b3_0_0_0 b7b6b5b4 b3_0_0_0 */
- "pand "MANGLE(mmx_grnmask)", %%mm2;" /* g7g6g5g4 g3g2_0_0 g7g6g5g4 g3g2_0_0 */
- "pand "MANGLE(mmx_redmask)", %%mm1;" /* r7r6r5r4 r3_0_0_0 r7r6r5r4 r3_0_0_0 */
-
- "psrlw $3, %%mm0;" /* 0_0_0_b7 b6b5b4b3 0_0_0_b7 b6b5b4b3 */
- "pxor %%mm4, %%mm4;" /* zero mm4 */
-
- "movq %%mm0, %%mm5;" /* Copy B7-B0 */
- "movq %%mm2, %%mm7;" /* Copy G7-G0 */
-
- /* convert RGB24 plane to RGB16 pack for pixel 0-3 */
- "punpcklbw %%mm4, %%mm2;" /* 0_0_0_0 0_0_0_0 g7g6g5g4 g3g2_0_0 */
- "punpcklbw %%mm1, %%mm0;" /* r7r6r5r4 r3_0_0_0 0_0_0_b7 b6b5b4b3 */
-
- "psllw $3, %%mm2;" /* 0_0_0_0 0_g7g6g5 g4g3g2_0 0_0_0_0 */
- "por %%mm2, %%mm0;" /* r7r6r5r4 r3g7g6g5 g4g3g2b7 b6b5b4b3 */
-
- "movq 8 (%5, %0, 2), %%mm6;" /* Load 8 Y Y7 Y6 Y5 Y4 Y3 Y2 Y1 Y0 */
- MOVNTQ " %%mm0, (%1);" /* store pixel 0-3 */
-
- /* convert RGB24 plane to RGB16 pack for pixel 0-3 */
- "punpckhbw %%mm4, %%mm7;" /* 0_0_0_0 0_0_0_0 g7g6g5g4 g3g2_0_0 */
- "punpckhbw %%mm1, %%mm5;" /* r7r6r5r4 r3_0_0_0 0_0_0_b7 b6b5b4b3 */
-
- "psllw $3, %%mm7;" /* 0_0_0_0 0_g7g6g5 g4g3g2_0 0_0_0_0 */
- "movd 4 (%2, %0), %%mm0;" /* Load 4 Cb 00 00 00 00 u3 u2 u1 u0 */
-
- "por %%mm7, %%mm5;" /* r7r6r5r4 r3g7g6g5 g4g3g2b7 b6b5b4b3 */
- "movd 4 (%3, %0), %%mm1;" /* Load 4 Cr 00 00 00 00 v3 v2 v1 v0 */
-
- MOVNTQ " %%mm5, 8 (%1);" /* store pixel 4-7 */
-
- YUV2RGB_ENDLOOP(2)
- YUV2RGB_OPERANDS
-}
-
-static inline int RENAME(yuv420_rgb15)(SwsContext *c, const uint8_t* src[], int srcStride[], int srcSliceY,
- int srcSliceH, uint8_t* dst[], int dstStride[])
-{
- int y, h_size;
-
- YUV422_UNSHIFT
- YUV2RGB_LOOP(2)
-
- c->blueDither= ff_dither8[y&1];
- c->greenDither= ff_dither8[y&1];
- c->redDither= ff_dither8[(y+1)&1];
-
- YUV2RGB_INIT
- YUV2RGB
-
-#ifdef DITHER1XBPP
- "paddusb "BLUE_DITHER"(%4), %%mm0 \n\t"
- "paddusb "GREEN_DITHER"(%4), %%mm2 \n\t"
- "paddusb "RED_DITHER"(%4), %%mm1 \n\t"
-#endif
-
- /* mask unneeded bits off */
- "pand "MANGLE(mmx_redmask)", %%mm0;" /* b7b6b5b4 b3_0_0_0 b7b6b5b4 b3_0_0_0 */
- "pand "MANGLE(mmx_redmask)", %%mm2;" /* g7g6g5g4 g3_0_0_0 g7g6g5g4 g3_0_0_0 */
- "pand "MANGLE(mmx_redmask)", %%mm1;" /* r7r6r5r4 r3_0_0_0 r7r6r5r4 r3_0_0_0 */
-
- "psrlw $3, %%mm0;" /* 0_0_0_b7 b6b5b4b3 0_0_0_b7 b6b5b4b3 */
- "psrlw $1, %%mm1;" /* 0_r7r6r5 r4r3_0_0 0_r7r6r5 r4r3_0_0 */
- "pxor %%mm4, %%mm4;" /* zero mm4 */
-
- "movq %%mm0, %%mm5;" /* Copy B7-B0 */
- "movq %%mm2, %%mm7;" /* Copy G7-G0 */
-
- /* convert RGB24 plane to RGB16 pack for pixel 0-3 */
- "punpcklbw %%mm4, %%mm2;" /* 0_0_0_0 0_0_0_0 g7g6g5g4 g3_0_0_0 */
- "punpcklbw %%mm1, %%mm0;" /* r7r6r5r4 r3_0_0_0 0_0_0_b7 b6b5b4b3 */
-
- "psllw $2, %%mm2;" /* 0_0_0_0 0_0_g7g6 g5g4g3_0 0_0_0_0 */
- "por %%mm2, %%mm0;" /* 0_r7r6r5 r4r3g7g6 g5g4g3b7 b6b5b4b3 */
-
- "movq 8 (%5, %0, 2), %%mm6;" /* Load 8 Y Y7 Y6 Y5 Y4 Y3 Y2 Y1 Y0 */
- MOVNTQ " %%mm0, (%1);" /* store pixel 0-3 */
-
- /* convert RGB24 plane to RGB16 pack for pixel 0-3 */
- "punpckhbw %%mm4, %%mm7;" /* 0_0_0_0 0_0_0_0 0_g7g6g5 g4g3_0_0 */
- "punpckhbw %%mm1, %%mm5;" /* r7r6r5r4 r3_0_0_0 0_0_0_b7 b6b5b4b3 */
-
- "psllw $2, %%mm7;" /* 0_0_0_0 0_0_g7g6 g5g4g3_0 0_0_0_0 */
- "movd 4 (%2, %0), %%mm0;" /* Load 4 Cb 00 00 00 00 u3 u2 u1 u0 */
-
- "por %%mm7, %%mm5;" /* 0_r7r6r5 r4r3g7g6 g5g4g3b7 b6b5b4b3 */
- "movd 4 (%3, %0), %%mm1;" /* Load 4 Cr 00 00 00 00 v3 v2 v1 v0 */
-
- MOVNTQ " %%mm5, 8 (%1);" /* store pixel 4-7 */
-
- YUV2RGB_ENDLOOP(2)
- YUV2RGB_OPERANDS
-}
-
-#undef RGB_PLANAR2PACKED24
-#if HAVE_MMX2
-#define RGB_PLANAR2PACKED24(red, blue)\
- "movq "MANGLE(ff_M24A)", %%mm4 \n\t"\
- "movq "MANGLE(ff_M24C)", %%mm7 \n\t"\
- "pshufw $0x50, %%mm"blue", %%mm5 \n\t" /* B3 B2 B3 B2 B1 B0 B1 B0 */\
- "pshufw $0x50, %%mm2, %%mm3 \n\t" /* G3 G2 G3 G2 G1 G0 G1 G0 */\
- "pshufw $0x00, %%mm"red", %%mm6 \n\t" /* R1 R0 R1 R0 R1 R0 R1 R0 */\
-\
- "pand %%mm4, %%mm5 \n\t" /* B2 B1 B0 */\
- "pand %%mm4, %%mm3 \n\t" /* G2 G1 G0 */\
- "pand %%mm7, %%mm6 \n\t" /* R1 R0 */\
-\
- "psllq $8, %%mm3 \n\t" /* G2 G1 G0 */\
- "por %%mm5, %%mm6 \n\t"\
- "por %%mm3, %%mm6 \n\t"\
- MOVNTQ" %%mm6, (%1) \n\t"\
-\
- "psrlq $8, %%mm2 \n\t" /* 00 G7 G6 G5 G4 G3 G2 G1 */\
- "pshufw $0xA5, %%mm"blue", %%mm5\n\t" /* B5 B4 B5 B4 B3 B2 B3 B2 */\
- "pshufw $0x55, %%mm2, %%mm3 \n\t" /* G4 G3 G4 G3 G4 G3 G4 G3 */\
- "pshufw $0xA5, %%mm"red", %%mm6 \n\t" /* R5 R4 R5 R4 R3 R2 R3 R2 */\
-\
- "pand "MANGLE(ff_M24B)", %%mm5 \n\t" /* B5 B4 B3 */\
- "pand %%mm7, %%mm3 \n\t" /* G4 G3 */\
- "pand %%mm4, %%mm6 \n\t" /* R4 R3 R2 */\
-\
- "por %%mm5, %%mm3 \n\t" /* B5 G4 B4 G3 B3 */\
- "por %%mm3, %%mm6 \n\t"\
- MOVNTQ" %%mm6, 8(%1) \n\t"\
-\
- "pshufw $0xFF, %%mm"blue", %%mm5\n\t" /* B7 B6 B7 B6 B7 B6 B6 B7 */\
- "pshufw $0xFA, %%mm2, %%mm3 \n\t" /* 00 G7 00 G7 G6 G5 G6 G5 */\
- "pshufw $0xFA, %%mm"red", %%mm6 \n\t" /* R7 R6 R7 R6 R5 R4 R5 R4 */\
- "movd 4 (%2, %0), %%mm0;" /* Load 4 Cb 00 00 00 00 u3 u2 u1 u0 */\
-\
- "pand %%mm7, %%mm5 \n\t" /* B7 B6 */\
- "pand %%mm4, %%mm3 \n\t" /* G7 G6 G5 */\
- "pand "MANGLE(ff_M24B)", %%mm6 \n\t" /* R7 R6 R5 */\
- "movd 4 (%3, %0), %%mm1;" /* Load 4 Cr 00 00 00 00 v3 v2 v1 v0 */\
-\
- "por %%mm5, %%mm3 \n\t"\
- "por %%mm3, %%mm6 \n\t"\
- MOVNTQ" %%mm6, 16(%1) \n\t"\
- "movq 8 (%5, %0, 2), %%mm6;" /* Load 8 Y Y7 Y6 Y5 Y4 Y3 Y2 Y1 Y0 */\
- "pxor %%mm4, %%mm4 \n\t"
-#else
-#define RGB_PLANAR2PACKED24(red, blue)\
- "pxor %%mm4, %%mm4 \n\t"\
- "movq %%mm"blue", %%mm5\n\t" /* B */\
- "movq %%mm"red", %%mm6 \n\t" /* R */\
- "punpcklbw %%mm2, %%mm"blue"\n\t" /* GBGBGBGB 0 */\
- "punpcklbw %%mm4, %%mm"red" \n\t" /* 0R0R0R0R 0 */\
- "punpckhbw %%mm2, %%mm5 \n\t" /* GBGBGBGB 2 */\
- "punpckhbw %%mm4, %%mm6 \n\t" /* 0R0R0R0R 2 */\
- "movq %%mm"blue", %%mm7\n\t" /* GBGBGBGB 0 */\
- "movq %%mm5, %%mm3 \n\t" /* GBGBGBGB 2 */\
- "punpcklwd %%mm"red", %%mm7 \n\t" /* 0RGB0RGB 0 */\
- "punpckhwd %%mm"red", %%mm"blue"\n\t" /* 0RGB0RGB 1 */\
- "punpcklwd %%mm6, %%mm5 \n\t" /* 0RGB0RGB 2 */\
- "punpckhwd %%mm6, %%mm3 \n\t" /* 0RGB0RGB 3 */\
-\
- "movq %%mm7, %%mm2 \n\t" /* 0RGB0RGB 0 */\
- "movq %%mm"blue", %%mm6\n\t" /* 0RGB0RGB 1 */\
- "movq %%mm5, %%mm"red" \n\t" /* 0RGB0RGB 2 */\
- "movq %%mm3, %%mm4 \n\t" /* 0RGB0RGB 3 */\
-\
- "psllq $40, %%mm7 \n\t" /* RGB00000 0 */\
- "psllq $40, %%mm"blue"\n\t" /* RGB00000 1 */\
- "psllq $40, %%mm5 \n\t" /* RGB00000 2 */\
- "psllq $40, %%mm3 \n\t" /* RGB00000 3 */\
-\
- "punpckhdq %%mm2, %%mm7 \n\t" /* 0RGBRGB0 0 */\
- "punpckhdq %%mm6, %%mm"blue"\n\t" /* 0RGBRGB0 1 */\
- "punpckhdq %%mm"red", %%mm5 \n\t" /* 0RGBRGB0 2 */\
- "punpckhdq %%mm4, %%mm3 \n\t" /* 0RGBRGB0 3 */\
-\
- "psrlq $8, %%mm7 \n\t" /* 00RGBRGB 0 */\
- "movq %%mm"blue", %%mm6\n\t" /* 0RGBRGB0 1 */\
- "psllq $40, %%mm"blue"\n\t" /* GB000000 1 */\
- "por %%mm"blue", %%mm7\n\t" /* GBRGBRGB 0 */\
- MOVNTQ" %%mm7, (%1) \n\t"\
-\
- "psrlq $24, %%mm6 \n\t" /* 0000RGBR 1 */\
- "movq %%mm5, %%mm"red" \n\t" /* 0RGBRGB0 2 */\
- "psllq $24, %%mm5 \n\t" /* BRGB0000 2 */\
- "por %%mm5, %%mm6 \n\t" /* BRGBRGBR 1 */\
- MOVNTQ" %%mm6, 8(%1) \n\t"\
-\
- "movq 8 (%5, %0, 2), %%mm6;" /* Load 8 Y Y7 Y6 Y5 Y4 Y3 Y2 Y1 Y0 */\
-\
- "psrlq $40, %%mm"red" \n\t" /* 000000RG 2 */\
- "psllq $8, %%mm3 \n\t" /* RGBRGB00 3 */\
- "por %%mm3, %%mm"red" \n\t" /* RGBRGBRG 2 */\
- MOVNTQ" %%mm"red", 16(%1)\n\t"\
-\
- "movd 4 (%3, %0), %%mm1;" /* Load 4 Cr 00 00 00 00 v3 v2 v1 v0 */\
- "movd 4 (%2, %0), %%mm0;" /* Load 4 Cb 00 00 00 00 u3 u2 u1 u0 */\
- "pxor %%mm4, %%mm4 \n\t"
-#endif
-
-static inline int RENAME(yuv420_rgb24)(SwsContext *c, const uint8_t* src[], int srcStride[], int srcSliceY,
- int srcSliceH, uint8_t* dst[], int dstStride[])
-{
- int y, h_size;
-
- YUV422_UNSHIFT
- YUV2RGB_LOOP(3)
-
- YUV2RGB_INIT
- YUV2RGB
- /* mm0=B, %%mm2=G, %%mm1=R */
- RGB_PLANAR2PACKED24("0", "1")
-
- YUV2RGB_ENDLOOP(3)
- YUV2RGB_OPERANDS
-}
-
-static inline int RENAME(yuv420_bgr24)(SwsContext *c, const uint8_t* src[], int srcStride[], int srcSliceY,
- int srcSliceH, uint8_t* dst[], int dstStride[])
-{
- int y, h_size;
-
- YUV422_UNSHIFT
- YUV2RGB_LOOP(3)
-
- YUV2RGB_INIT
- YUV2RGB
- /* mm0=B, %%mm2=G, %%mm1=R */
- RGB_PLANAR2PACKED24("1", "0")
-
- YUV2RGB_ENDLOOP(3)
- YUV2RGB_OPERANDS
-}
-
-/*
-
-RGB_PLANAR2PACKED32(red,green,blue,alpha)
-
-convert RGB plane to RGB packed format
-
-macro parameters specify the output color channel order:
-
-RGB_PLANAR2PACKED32(REG_RED, REG_GREEN, REG_BLUE, REG_ALPHA) for RGBA output,
-RGB_PLANAR2PACKED32(REG_BLUE, REG_GREEN, REG_RED, REG_ALPHA) for BGRA output,
-RGB_PLANAR2PACKED32(REG_ALPHA,REG_BLUE, REG_GREEN,REG_RED) for ABGR output,
-
-etc.
-*/
-
-#define REG_BLUE "0"
-#define REG_RED "1"
-#define REG_GREEN "2"
-#define REG_ALPHA "3"
-
-#define RGB_PLANAR2PACKED32(red,green,blue,alpha) \
- /* convert RGB plane to RGB packed format, \
- mm0 -> B, mm1 -> R, mm2 -> G, mm3 -> A, \
- mm4 -> GB, mm5 -> AR pixel 4-7, \
- mm6 -> GB, mm7 -> AR pixel 0-3 */ \
- "movq %%mm" blue ", %%mm6;" /* B7 B6 B5 B4 B3 B2 B1 B0 */ \
- "movq %%mm" red ", %%mm7;" /* R7 R6 R5 R4 R3 R2 R1 R0 */ \
-\
- "movq %%mm" blue ", %%mm4;" /* B7 B6 B5 B4 B3 B2 B1 B0 */ \
- "movq %%mm" red ", %%mm5;" /* R7 R6 R5 R4 R3 R2 R1 R0 */ \
-\
- "punpcklbw %%mm" green ", %%mm6;" /* G3 B3 G2 B2 G1 B1 G0 B0 */ \
- "punpcklbw %%mm" alpha ", %%mm7;" /* A3 R3 A2 R2 A1 R1 A0 R0 */ \
-\
- "punpcklwd %%mm7, %%mm6;" /* A1 R1 B1 G1 A0 R0 B0 G0 */ \
- MOVNTQ " %%mm6, (%1);" /* Store ARGB1 ARGB0 */ \
-\
- "movq %%mm" blue ", %%mm6;" /* B7 B6 B5 B4 B3 B2 B1 B0 */ \
- "punpcklbw %%mm" green ", %%mm6;" /* G3 B3 G2 B2 G1 B1 G0 B0 */ \
-\
- "punpckhwd %%mm7, %%mm6;" /* A3 R3 G3 B3 A2 R2 B3 G2 */ \
- MOVNTQ " %%mm6, 8 (%1);" /* Store ARGB3 ARGB2 */ \
-\
- "punpckhbw %%mm" green ", %%mm4;" /* G7 B7 G6 B6 G5 B5 G4 B4 */ \
- "punpckhbw %%mm" alpha ", %%mm5;" /* A7 R7 A6 R6 A5 R5 A4 R4 */ \
-\
- "punpcklwd %%mm5, %%mm4;" /* A5 R5 B5 G5 A4 R4 B4 G4 */ \
- MOVNTQ " %%mm4, 16 (%1);" /* Store ARGB5 ARGB4 */ \
-\
- "movq %%mm" blue ", %%mm4;" /* B7 B6 B5 B4 B3 B2 B1 B0 */ \
- "punpckhbw %%mm" green ", %%mm4;" /* G7 B7 G6 B6 G5 B5 G4 B4 */ \
-\
- "punpckhwd %%mm5, %%mm4;" /* A7 R7 G7 B7 A6 R6 B6 G6 */ \
- MOVNTQ " %%mm4, 24 (%1);" /* Store ARGB7 ARGB6 */ \
-\
- "movd 4 (%2, %0), %%mm0;" /* Load 4 Cb 00 00 00 00 u3 u2 u1 u0 */ \
- "movd 4 (%3, %0), %%mm1;" /* Load 4 Cr 00 00 00 00 v3 v2 v1 v0 */ \
-\
- "pxor %%mm4, %%mm4;" /* zero mm4 */ \
- "movq 8 (%5, %0, 2), %%mm6;" /* Load 8 Y Y7 Y6 Y5 Y4 Y3 Y2 Y1 Y0 */ \
-
-static inline int RENAME(yuv420_rgb32)(SwsContext *c, const uint8_t* src[], int srcStride[], int srcSliceY,
- int srcSliceH, uint8_t* dst[], int dstStride[])
-{
- int y, h_size;
-
- YUV422_UNSHIFT
- YUV2RGB_LOOP(4)
-
- YUV2RGB_INIT
- YUV2RGB
- "pcmpeqd %%mm3, %%mm3;" /* fill mm3 */
- RGB_PLANAR2PACKED32(REG_RED,REG_GREEN,REG_BLUE,REG_ALPHA)
-
- YUV2RGB_ENDLOOP(4)
- YUV2RGB_OPERANDS
-}
-
-static inline int RENAME(yuva420_rgb32)(SwsContext *c, const uint8_t* src[], int srcStride[], int srcSliceY,
- int srcSliceH, uint8_t* dst[], int dstStride[])
-{
-#if HAVE_7REGS
- int y, h_size;
-
- YUV2RGB_LOOP(4)
-
- const uint8_t *pa = src[3] + y*srcStride[3];
- YUV2RGB_INIT
- YUV2RGB
- "movq (%6, %0, 2), %%mm3;" /* Load 8 A A7 A6 A5 A4 A3 A2 A1 A0 */
- RGB_PLANAR2PACKED32(REG_RED,REG_GREEN,REG_BLUE,REG_ALPHA)
-
- YUV2RGB_ENDLOOP(4)
- YUV2RGB_OPERANDS_ALPHA
-#endif
-}
-
-static inline int RENAME(yuv420_bgr32)(SwsContext *c, const uint8_t* src[], int srcStride[], int srcSliceY,
- int srcSliceH, uint8_t* dst[], int dstStride[])
-{
- int y, h_size;
-
- YUV422_UNSHIFT
- YUV2RGB_LOOP(4)
-
- YUV2RGB_INIT
- YUV2RGB
- "pcmpeqd %%mm3, %%mm3;" /* fill mm3 */
- RGB_PLANAR2PACKED32(REG_BLUE,REG_GREEN,REG_RED,REG_ALPHA)
-
- YUV2RGB_ENDLOOP(4)
- YUV2RGB_OPERANDS
-}
-
-static inline int RENAME(yuva420_bgr32)(SwsContext *c, const uint8_t* src[], int srcStride[], int srcSliceY,
- int srcSliceH, uint8_t* dst[], int dstStride[])
-{
-#if HAVE_7REGS
- int y, h_size;
-
- YUV2RGB_LOOP(4)
-
- const uint8_t *pa = src[3] + y*srcStride[3];
- YUV2RGB_INIT
- YUV2RGB
- "movq (%6, %0, 2), %%mm3;" /* Load 8 A A7 A6 A5 A4 A3 A2 A1 A0 */
- RGB_PLANAR2PACKED32(REG_BLUE,REG_GREEN,REG_RED,REG_ALPHA)
-
- YUV2RGB_ENDLOOP(4)
- YUV2RGB_OPERANDS_ALPHA
-#endif
-}
diff --git a/libswscale/yuv2rgb.c b/libswscale/yuv2rgb.c
deleted file mode 100644
index 3c7bb3fd9f..0000000000
--- a/libswscale/yuv2rgb.c
+++ /dev/null
@@ -1,753 +0,0 @@
-/*
- * software YUV to RGB converter
- *
- * Copyright (C) 2009 Konstantin Shishkov
- *
- * 1,4,8bpp support and context / deglobalize stuff
- * by Michael Niedermayer (michaelni@gmx.at)
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * FFmpeg 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <inttypes.h>
-#include <assert.h>
-
-#include "config.h"
-#include "rgb2rgb.h"
-#include "swscale.h"
-#include "swscale_internal.h"
-#include "libavutil/x86_cpu.h"
-
-extern const uint8_t dither_8x8_32[8][8];
-extern const uint8_t dither_8x8_73[8][8];
-extern const uint8_t dither_8x8_220[8][8];
-
-const int32_t ff_yuv2rgb_coeffs[8][4] = {
- {117504, 138453, 13954, 34903}, /* no sequence_display_extension */
- {117504, 138453, 13954, 34903}, /* ITU-R Rec. 709 (1990) */
- {104597, 132201, 25675, 53279}, /* unspecified */
- {104597, 132201, 25675, 53279}, /* reserved */
- {104448, 132798, 24759, 53109}, /* FCC */
- {104597, 132201, 25675, 53279}, /* ITU-R Rec. 624-4 System B, G */
- {104597, 132201, 25675, 53279}, /* SMPTE 170M */
- {117579, 136230, 16907, 35559} /* SMPTE 240M (1987) */
-};
-
-#define LOADCHROMA(i) \
- U = pu[i]; \
- V = pv[i]; \
- r = (void *)c->table_rV[V]; \
- g = (void *)(c->table_gU[U] + c->table_gV[V]); \
- b = (void *)c->table_bU[U];
-
-#define PUTRGB(dst,src,i) \
- Y = src[2*i]; \
- dst[2*i ] = r[Y] + g[Y] + b[Y]; \
- Y = src[2*i+1]; \
- dst[2*i+1] = r[Y] + g[Y] + b[Y];
-
-#define PUTRGB24(dst,src,i) \
- Y = src[2*i]; \
- dst[6*i+0] = r[Y]; dst[6*i+1] = g[Y]; dst[6*i+2] = b[Y]; \
- Y = src[2*i+1]; \
- dst[6*i+3] = r[Y]; dst[6*i+4] = g[Y]; dst[6*i+5] = b[Y];
-
-#define PUTBGR24(dst,src,i) \
- Y = src[2*i]; \
- dst[6*i+0] = b[Y]; dst[6*i+1] = g[Y]; dst[6*i+2] = r[Y]; \
- Y = src[2*i+1]; \
- dst[6*i+3] = b[Y]; dst[6*i+4] = g[Y]; dst[6*i+5] = r[Y];
-
-#define PUTRGBA(dst,ysrc,asrc,i,s) \
- Y = ysrc[2*i]; \
- dst[2*i ] = r[Y] + g[Y] + b[Y] + (asrc[2*i ]<<s); \
- Y = ysrc[2*i+1]; \
- dst[2*i+1] = r[Y] + g[Y] + b[Y] + (asrc[2*i+1]<<s);
-
-#define PUTRGB48(dst,src,i) \
- Y = src[2*i]; \
- dst[12*i+ 0] = dst[12*i+ 1] = r[Y]; \
- dst[12*i+ 2] = dst[12*i+ 3] = g[Y]; \
- dst[12*i+ 4] = dst[12*i+ 5] = b[Y]; \
- Y = src[2*i+1]; \
- dst[12*i+ 6] = dst[12*i+ 7] = r[Y]; \
- dst[12*i+ 8] = dst[12*i+ 9] = g[Y]; \
- dst[12*i+10] = dst[12*i+11] = b[Y];
-
-#define YUV2RGBFUNC(func_name, dst_type, alpha) \
-static int func_name(SwsContext *c, const uint8_t* src[], int srcStride[], int srcSliceY, \
- int srcSliceH, uint8_t* dst[], int dstStride[]) \
-{\
- int y;\
-\
- if (!alpha && c->srcFormat == PIX_FMT_YUV422P) {\
- srcStride[1] *= 2;\
- srcStride[2] *= 2;\
- }\
- for (y=0; y<srcSliceH; y+=2) {\
- dst_type *dst_1 = (dst_type*)(dst[0] + (y+srcSliceY )*dstStride[0]);\
- dst_type *dst_2 = (dst_type*)(dst[0] + (y+srcSliceY+1)*dstStride[0]);\
- dst_type av_unused *r, *b;\
- dst_type *g;\
- const uint8_t *py_1 = src[0] + y*srcStride[0];\
- const uint8_t *py_2 = py_1 + srcStride[0];\
- const uint8_t *pu = src[1] + (y>>1)*srcStride[1];\
- const uint8_t *pv = src[2] + (y>>1)*srcStride[2];\
- const uint8_t av_unused *pa_1, *pa_2;\
- unsigned int h_size = c->dstW>>3;\
- if (alpha) {\
- pa_1 = src[3] + y*srcStride[3];\
- pa_2 = pa_1 + srcStride[3];\
- }\
- while (h_size--) {\
- int av_unused U, V;\
- int Y;\
-
-#define ENDYUV2RGBLINE(dst_delta)\
- pu += 4;\
- pv += 4;\
- py_1 += 8;\
- py_2 += 8;\
- dst_1 += dst_delta;\
- dst_2 += dst_delta;\
- }\
- if (c->dstW & 4) {\
- int av_unused Y, U, V;\
-
-#define ENDYUV2RGBFUNC()\
- }\
- }\
- return srcSliceH;\
-}
-
-#define CLOSEYUV2RGBFUNC(dst_delta)\
- ENDYUV2RGBLINE(dst_delta)\
- ENDYUV2RGBFUNC()
-
-YUV2RGBFUNC(yuv2rgb_c_48, uint8_t, 0)
- LOADCHROMA(0);
- PUTRGB48(dst_1,py_1,0);
- PUTRGB48(dst_2,py_2,0);
-
- LOADCHROMA(1);
- PUTRGB48(dst_2,py_2,1);
- PUTRGB48(dst_1,py_1,1);
-
- LOADCHROMA(2);
- PUTRGB48(dst_1,py_1,2);
- PUTRGB48(dst_2,py_2,2);
-
- LOADCHROMA(3);
- PUTRGB48(dst_2,py_2,3);
- PUTRGB48(dst_1,py_1,3);
-ENDYUV2RGBLINE(48)
- LOADCHROMA(0);
- PUTRGB48(dst_1,py_1,0);
- PUTRGB48(dst_2,py_2,0);
-
- LOADCHROMA(1);
- PUTRGB48(dst_2,py_2,1);
- PUTRGB48(dst_1,py_1,1);
-ENDYUV2RGBFUNC()
-
-YUV2RGBFUNC(yuv2rgb_c_32, uint32_t, 0)
- LOADCHROMA(0);
- PUTRGB(dst_1,py_1,0);
- PUTRGB(dst_2,py_2,0);
-
- LOADCHROMA(1);
- PUTRGB(dst_2,py_2,1);
- PUTRGB(dst_1,py_1,1);
-
- LOADCHROMA(2);
- PUTRGB(dst_1,py_1,2);
- PUTRGB(dst_2,py_2,2);
-
- LOADCHROMA(3);
- PUTRGB(dst_2,py_2,3);
- PUTRGB(dst_1,py_1,3);
-ENDYUV2RGBLINE(8)
- LOADCHROMA(0);
- PUTRGB(dst_1,py_1,0);
- PUTRGB(dst_2,py_2,0);
-
- LOADCHROMA(1);
- PUTRGB(dst_2,py_2,1);
- PUTRGB(dst_1,py_1,1);
-ENDYUV2RGBFUNC()
-
-YUV2RGBFUNC(yuva2rgba_c, uint32_t, 1)
- LOADCHROMA(0);
- PUTRGBA(dst_1,py_1,pa_1,0,24);
- PUTRGBA(dst_2,py_2,pa_2,0,24);
-
- LOADCHROMA(1);
- PUTRGBA(dst_2,py_2,pa_1,1,24);
- PUTRGBA(dst_1,py_1,pa_2,1,24);
-
- LOADCHROMA(2);
- PUTRGBA(dst_1,py_1,pa_1,2,24);
- PUTRGBA(dst_2,py_2,pa_2,2,24);
-
- LOADCHROMA(3);
- PUTRGBA(dst_2,py_2,pa_1,3,24);
- PUTRGBA(dst_1,py_1,pa_2,3,24);
- pa_1 += 8;\
- pa_2 += 8;\
-ENDYUV2RGBLINE(8)
- LOADCHROMA(0);
- PUTRGBA(dst_1,py_1,pa_1,0,24);
- PUTRGBA(dst_2,py_2,pa_2,0,24);
-
- LOADCHROMA(1);
- PUTRGBA(dst_2,py_2,pa_1,1,24);
- PUTRGBA(dst_1,py_1,pa_2,1,24);
-ENDYUV2RGBFUNC()
-
-YUV2RGBFUNC(yuva2argb_c, uint32_t, 1)
- LOADCHROMA(0);
- PUTRGBA(dst_1,py_1,pa_1,0,0);
- PUTRGBA(dst_2,py_2,pa_2,0,0);
-
- LOADCHROMA(1);
- PUTRGBA(dst_2,py_2,pa_2,1,0);
- PUTRGBA(dst_1,py_1,pa_1,1,0);
-
- LOADCHROMA(2);
- PUTRGBA(dst_1,py_1,pa_1,2,0);
- PUTRGBA(dst_2,py_2,pa_2,2,0);
-
- LOADCHROMA(3);
- PUTRGBA(dst_2,py_2,pa_2,3,0);
- PUTRGBA(dst_1,py_1,pa_1,3,0);
- pa_1 += 8;\
- pa_2 += 8;\
-ENDYUV2RGBLINE(8)
- LOADCHROMA(0);
- PUTRGBA(dst_1,py_1,pa_1,0,0);
- PUTRGBA(dst_2,py_2,pa_2,0,0);
-
- LOADCHROMA(1);
- PUTRGBA(dst_2,py_2,pa_2,1,0);
- PUTRGBA(dst_1,py_1,pa_1,1,0);
-ENDYUV2RGBFUNC()
-
-YUV2RGBFUNC(yuv2rgb_c_24_rgb, uint8_t, 0)
- LOADCHROMA(0);
- PUTRGB24(dst_1,py_1,0);
- PUTRGB24(dst_2,py_2,0);
-
- LOADCHROMA(1);
- PUTRGB24(dst_2,py_2,1);
- PUTRGB24(dst_1,py_1,1);
-
- LOADCHROMA(2);
- PUTRGB24(dst_1,py_1,2);
- PUTRGB24(dst_2,py_2,2);
-
- LOADCHROMA(3);
- PUTRGB24(dst_2,py_2,3);
- PUTRGB24(dst_1,py_1,3);
-ENDYUV2RGBLINE(24)
- LOADCHROMA(0);
- PUTRGB24(dst_1,py_1,0);
- PUTRGB24(dst_2,py_2,0);
-
- LOADCHROMA(1);
- PUTRGB24(dst_2,py_2,1);
- PUTRGB24(dst_1,py_1,1);
-ENDYUV2RGBFUNC()
-
-// only trivial mods from yuv2rgb_c_24_rgb
-YUV2RGBFUNC(yuv2rgb_c_24_bgr, uint8_t, 0)
- LOADCHROMA(0);
- PUTBGR24(dst_1,py_1,0);
- PUTBGR24(dst_2,py_2,0);
-
- LOADCHROMA(1);
- PUTBGR24(dst_2,py_2,1);
- PUTBGR24(dst_1,py_1,1);
-
- LOADCHROMA(2);
- PUTBGR24(dst_1,py_1,2);
- PUTBGR24(dst_2,py_2,2);
-
- LOADCHROMA(3);
- PUTBGR24(dst_2,py_2,3);
- PUTBGR24(dst_1,py_1,3);
-ENDYUV2RGBLINE(24)
- LOADCHROMA(0);
- PUTBGR24(dst_1,py_1,0);
- PUTBGR24(dst_2,py_2,0);
-
- LOADCHROMA(1);
- PUTBGR24(dst_2,py_2,1);
- PUTBGR24(dst_1,py_1,1);
-ENDYUV2RGBFUNC()
-
-// This is exactly the same code as yuv2rgb_c_32 except for the types of
-// r, g, b, dst_1, dst_2
-YUV2RGBFUNC(yuv2rgb_c_16, uint16_t, 0)
- LOADCHROMA(0);
- PUTRGB(dst_1,py_1,0);
- PUTRGB(dst_2,py_2,0);
-
- LOADCHROMA(1);
- PUTRGB(dst_2,py_2,1);
- PUTRGB(dst_1,py_1,1);
-
- LOADCHROMA(2);
- PUTRGB(dst_1,py_1,2);
- PUTRGB(dst_2,py_2,2);
-
- LOADCHROMA(3);
- PUTRGB(dst_2,py_2,3);
- PUTRGB(dst_1,py_1,3);
-CLOSEYUV2RGBFUNC(8)
-
-#if 0 // Currently unused
-// This is exactly the same code as yuv2rgb_c_32 except for the types of
-// r, g, b, dst_1, dst_2
-YUV2RGBFUNC(yuv2rgb_c_8, uint8_t, 0)
- LOADCHROMA(0);
- PUTRGB(dst_1,py_1,0);
- PUTRGB(dst_2,py_2,0);
-
- LOADCHROMA(1);
- PUTRGB(dst_2,py_2,1);
- PUTRGB(dst_1,py_1,1);
-
- LOADCHROMA(2);
- PUTRGB(dst_1,py_1,2);
- PUTRGB(dst_2,py_2,2);
-
- LOADCHROMA(3);
- PUTRGB(dst_2,py_2,3);
- PUTRGB(dst_1,py_1,3);
-CLOSEYUV2RGBFUNC(8)
-#endif
-
-// r, g, b, dst_1, dst_2
-YUV2RGBFUNC(yuv2rgb_c_8_ordered_dither, uint8_t, 0)
- const uint8_t *d32 = dither_8x8_32[y&7];
- const uint8_t *d64 = dither_8x8_73[y&7];
-#define PUTRGB8(dst,src,i,o) \
- Y = src[2*i]; \
- dst[2*i] = r[Y+d32[0+o]] + g[Y+d32[0+o]] + b[Y+d64[0+o]]; \
- Y = src[2*i+1]; \
- dst[2*i+1] = r[Y+d32[1+o]] + g[Y+d32[1+o]] + b[Y+d64[1+o]];
-
- LOADCHROMA(0);
- PUTRGB8(dst_1,py_1,0,0);
- PUTRGB8(dst_2,py_2,0,0+8);
-
- LOADCHROMA(1);
- PUTRGB8(dst_2,py_2,1,2+8);
- PUTRGB8(dst_1,py_1,1,2);
-
- LOADCHROMA(2);
- PUTRGB8(dst_1,py_1,2,4);
- PUTRGB8(dst_2,py_2,2,4+8);
-
- LOADCHROMA(3);
- PUTRGB8(dst_2,py_2,3,6+8);
- PUTRGB8(dst_1,py_1,3,6);
-CLOSEYUV2RGBFUNC(8)
-
-#if 0 // Currently unused
-// This is exactly the same code as yuv2rgb_c_32 except for the types of
-// r, g, b, dst_1, dst_2
-YUV2RGBFUNC(yuv2rgb_c_4, uint8_t, 0)
- int acc;
-#define PUTRGB4(dst,src,i) \
- Y = src[2*i]; \
- acc = r[Y] + g[Y] + b[Y]; \
- Y = src[2*i+1]; \
- acc |= (r[Y] + g[Y] + b[Y])<<4; \
- dst[i] = acc;
-
- LOADCHROMA(0);
- PUTRGB4(dst_1,py_1,0);
- PUTRGB4(dst_2,py_2,0);
-
- LOADCHROMA(1);
- PUTRGB4(dst_2,py_2,1);
- PUTRGB4(dst_1,py_1,1);
-
- LOADCHROMA(2);
- PUTRGB4(dst_1,py_1,2);
- PUTRGB4(dst_2,py_2,2);
-
- LOADCHROMA(3);
- PUTRGB4(dst_2,py_2,3);
- PUTRGB4(dst_1,py_1,3);
-CLOSEYUV2RGBFUNC(4)
-#endif
-
-YUV2RGBFUNC(yuv2rgb_c_4_ordered_dither, uint8_t, 0)
- const uint8_t *d64 = dither_8x8_73[y&7];
- const uint8_t *d128 = dither_8x8_220[y&7];
- int acc;
-
-#define PUTRGB4D(dst,src,i,o) \
- Y = src[2*i]; \
- acc = r[Y+d128[0+o]] + g[Y+d64[0+o]] + b[Y+d128[0+o]]; \
- Y = src[2*i+1]; \
- acc |= (r[Y+d128[1+o]] + g[Y+d64[1+o]] + b[Y+d128[1+o]])<<4; \
- dst[i]= acc;
-
- LOADCHROMA(0);
- PUTRGB4D(dst_1,py_1,0,0);
- PUTRGB4D(dst_2,py_2,0,0+8);
-
- LOADCHROMA(1);
- PUTRGB4D(dst_2,py_2,1,2+8);
- PUTRGB4D(dst_1,py_1,1,2);
-
- LOADCHROMA(2);
- PUTRGB4D(dst_1,py_1,2,4);
- PUTRGB4D(dst_2,py_2,2,4+8);
-
- LOADCHROMA(3);
- PUTRGB4D(dst_2,py_2,3,6+8);
- PUTRGB4D(dst_1,py_1,3,6);
-CLOSEYUV2RGBFUNC(4)
-
-#if 0 // Currently unused
-// This is exactly the same code as yuv2rgb_c_32 except for the types of
-// r, g, b, dst_1, dst_2
-YUV2RGBFUNC(yuv2rgb_c_4b, uint8_t, 0)
- LOADCHROMA(0);
- PUTRGB(dst_1,py_1,0);
- PUTRGB(dst_2,py_2,0);
-
- LOADCHROMA(1);
- PUTRGB(dst_2,py_2,1);
- PUTRGB(dst_1,py_1,1);
-
- LOADCHROMA(2);
- PUTRGB(dst_1,py_1,2);
- PUTRGB(dst_2,py_2,2);
-
- LOADCHROMA(3);
- PUTRGB(dst_2,py_2,3);
- PUTRGB(dst_1,py_1,3);
-CLOSEYUV2RGBFUNC(8)
-#endif
-
-YUV2RGBFUNC(yuv2rgb_c_4b_ordered_dither, uint8_t, 0)
- const uint8_t *d64 = dither_8x8_73[y&7];
- const uint8_t *d128 = dither_8x8_220[y&7];
-
-#define PUTRGB4DB(dst,src,i,o) \
- Y = src[2*i]; \
- dst[2*i] = r[Y+d128[0+o]] + g[Y+d64[0+o]] + b[Y+d128[0+o]]; \
- Y = src[2*i+1]; \
- dst[2*i+1] = r[Y+d128[1+o]] + g[Y+d64[1+o]] + b[Y+d128[1+o]];
-
- LOADCHROMA(0);
- PUTRGB4DB(dst_1,py_1,0,0);
- PUTRGB4DB(dst_2,py_2,0,0+8);
-
- LOADCHROMA(1);
- PUTRGB4DB(dst_2,py_2,1,2+8);
- PUTRGB4DB(dst_1,py_1,1,2);
-
- LOADCHROMA(2);
- PUTRGB4DB(dst_1,py_1,2,4);
- PUTRGB4DB(dst_2,py_2,2,4+8);
-
- LOADCHROMA(3);
- PUTRGB4DB(dst_2,py_2,3,6+8);
- PUTRGB4DB(dst_1,py_1,3,6);
-CLOSEYUV2RGBFUNC(8)
-
-YUV2RGBFUNC(yuv2rgb_c_1_ordered_dither, uint8_t, 0)
- const uint8_t *d128 = dither_8x8_220[y&7];
- char out_1 = 0, out_2 = 0;
- g= c->table_gU[128] + c->table_gV[128];
-
-#define PUTRGB1(out,src,i,o) \
- Y = src[2*i]; \
- out+= out + g[Y+d128[0+o]]; \
- Y = src[2*i+1]; \
- out+= out + g[Y+d128[1+o]];
-
- PUTRGB1(out_1,py_1,0,0);
- PUTRGB1(out_2,py_2,0,0+8);
-
- PUTRGB1(out_2,py_2,1,2+8);
- PUTRGB1(out_1,py_1,1,2);
-
- PUTRGB1(out_1,py_1,2,4);
- PUTRGB1(out_2,py_2,2,4+8);
-
- PUTRGB1(out_2,py_2,3,6+8);
- PUTRGB1(out_1,py_1,3,6);
-
- dst_1[0]= out_1;
- dst_2[0]= out_2;
-CLOSEYUV2RGBFUNC(1)
-
-SwsFunc ff_yuv2rgb_get_func_ptr(SwsContext *c)
-{
- SwsFunc t = NULL;
-#if (HAVE_MMX2 || HAVE_MMX) && CONFIG_GPL
- t = ff_yuv2rgb_init_mmx(c);
-#endif
-#if HAVE_VIS
- t = ff_yuv2rgb_init_vis(c);
-#endif
-#if CONFIG_MLIB
- t = ff_yuv2rgb_init_mlib(c);
-#endif
-#if HAVE_ALTIVEC
- if (c->flags & SWS_CPU_CAPS_ALTIVEC)
- t = ff_yuv2rgb_init_altivec(c);
-#endif
-
-#if ARCH_BFIN
- if (c->flags & SWS_CPU_CAPS_BFIN)
- t = ff_yuv2rgb_get_func_ptr_bfin(c);
-#endif
-
- if (t)
- return t;
-
- av_log(c, AV_LOG_WARNING, "No accelerated colorspace conversion found from %s to %s.\n", sws_format_name(c->srcFormat), sws_format_name(c->dstFormat));
-
- switch (c->dstFormat) {
- case PIX_FMT_RGB48BE:
- case PIX_FMT_RGB48LE: return yuv2rgb_c_48;
- case PIX_FMT_ARGB:
- case PIX_FMT_ABGR: if (CONFIG_SWSCALE_ALPHA && c->srcFormat == PIX_FMT_YUVA420P) return yuva2argb_c;
- case PIX_FMT_RGBA:
- case PIX_FMT_BGRA: return (CONFIG_SWSCALE_ALPHA && c->srcFormat == PIX_FMT_YUVA420P) ? yuva2rgba_c : yuv2rgb_c_32;
- case PIX_FMT_RGB24: return yuv2rgb_c_24_rgb;
- case PIX_FMT_BGR24: return yuv2rgb_c_24_bgr;
- case PIX_FMT_RGB565:
- case PIX_FMT_BGR565:
- case PIX_FMT_RGB555:
- case PIX_FMT_BGR555: return yuv2rgb_c_16;
- case PIX_FMT_RGB8:
- case PIX_FMT_BGR8: return yuv2rgb_c_8_ordered_dither;
- case PIX_FMT_RGB4:
- case PIX_FMT_BGR4: return yuv2rgb_c_4_ordered_dither;
- case PIX_FMT_RGB4_BYTE:
- case PIX_FMT_BGR4_BYTE: return yuv2rgb_c_4b_ordered_dither;
- case PIX_FMT_MONOBLACK: return yuv2rgb_c_1_ordered_dither;
- default:
- assert(0);
- }
- return NULL;
-}
-
-static void fill_table(uint8_t* table[256], const int elemsize, const int inc, uint8_t *y_table)
-{
- int i;
- int64_t cb = 0;
-
- y_table -= elemsize * (inc >> 9);
-
- for (i = 0; i < 256; i++) {
- table[i] = y_table + elemsize * (cb >> 16);
- cb += inc;
- }
-}
-
-static void fill_gv_table(int table[256], const int elemsize, const int inc)
-{
- int i;
- int64_t cb = 0;
- int off = -(inc >> 9);
-
- for (i = 0; i < 256; i++) {
- table[i] = elemsize * (off + (cb >> 16));
- cb += inc;
- }
-}
-
-av_cold int ff_yuv2rgb_c_init_tables(SwsContext *c, const int inv_table[4], int fullRange,
- int brightness, int contrast, int saturation)
-{
- const int isRgb = c->dstFormat==PIX_FMT_RGB32
- || c->dstFormat==PIX_FMT_RGB32_1
- || c->dstFormat==PIX_FMT_BGR24
- || c->dstFormat==PIX_FMT_RGB565
- || c->dstFormat==PIX_FMT_RGB555
- || c->dstFormat==PIX_FMT_RGB8
- || c->dstFormat==PIX_FMT_RGB4
- || c->dstFormat==PIX_FMT_RGB4_BYTE
- || c->dstFormat==PIX_FMT_MONOBLACK;
- const int bpp = c->dstFormatBpp;
- uint8_t *y_table;
- uint16_t *y_table16;
- uint32_t *y_table32;
- int i, base, rbase, gbase, bbase, abase, needAlpha;
- const int yoffs = fullRange ? 384 : 326;
-
- int64_t crv = inv_table[0];
- int64_t cbu = inv_table[1];
- int64_t cgu = -inv_table[2];
- int64_t cgv = -inv_table[3];
- int64_t cy = 1<<16;
- int64_t oy = 0;
-
- int64_t yb = 0;
-
- if (!fullRange) {
- cy = (cy*255) / 219;
- oy = 16<<16;
- } else {
- crv = (crv*224) / 255;
- cbu = (cbu*224) / 255;
- cgu = (cgu*224) / 255;
- cgv = (cgv*224) / 255;
- }
-
- cy = (cy *contrast ) >> 16;
- crv = (crv*contrast * saturation) >> 32;
- cbu = (cbu*contrast * saturation) >> 32;
- cgu = (cgu*contrast * saturation) >> 32;
- cgv = (cgv*contrast * saturation) >> 32;
- oy -= 256*brightness;
-
- //scale coefficients by cy
- crv = ((crv << 16) + 0x8000) / cy;
- cbu = ((cbu << 16) + 0x8000) / cy;
- cgu = ((cgu << 16) + 0x8000) / cy;
- cgv = ((cgv << 16) + 0x8000) / cy;
-
- av_free(c->yuvTable);
-
- switch (bpp) {
- case 1:
- c->yuvTable = av_malloc(1024);
- y_table = c->yuvTable;
- yb = -(384<<16) - oy;
- for (i = 0; i < 1024-110; i++) {
- y_table[i+110] = av_clip_uint8((yb + 0x8000) >> 16) >> 7;
- yb += cy;
- }
- fill_table(c->table_gU, 1, cgu, y_table + yoffs);
- fill_gv_table(c->table_gV, 1, cgv);
- break;
- case 4:
- case 4|128:
- rbase = isRgb ? 3 : 0;
- gbase = 1;
- bbase = isRgb ? 0 : 3;
- c->yuvTable = av_malloc(1024*3);
- y_table = c->yuvTable;
- yb = -(384<<16) - oy;
- for (i = 0; i < 1024-110; i++) {
- int yval = av_clip_uint8((yb + 0x8000) >> 16);
- y_table[i+110 ] = (yval >> 7) << rbase;
- y_table[i+ 37+1024] = ((yval + 43) / 85) << gbase;
- y_table[i+110+2048] = (yval >> 7) << bbase;
- yb += cy;
- }
- fill_table(c->table_rV, 1, crv, y_table + yoffs);
- fill_table(c->table_gU, 1, cgu, y_table + yoffs + 1024);
- fill_table(c->table_bU, 1, cbu, y_table + yoffs + 2048);
- fill_gv_table(c->table_gV, 1, cgv);
- break;
- case 8:
- rbase = isRgb ? 5 : 0;
- gbase = isRgb ? 2 : 3;
- bbase = isRgb ? 0 : 6;
- c->yuvTable = av_malloc(1024*3);
- y_table = c->yuvTable;
- yb = -(384<<16) - oy;
- for (i = 0; i < 1024-38; i++) {
- int yval = av_clip_uint8((yb + 0x8000) >> 16);
- y_table[i+16 ] = ((yval + 18) / 36) << rbase;
- y_table[i+16+1024] = ((yval + 18) / 36) << gbase;
- y_table[i+37+2048] = ((yval + 43) / 85) << bbase;
- yb += cy;
- }
- fill_table(c->table_rV, 1, crv, y_table + yoffs);
- fill_table(c->table_gU, 1, cgu, y_table + yoffs + 1024);
- fill_table(c->table_bU, 1, cbu, y_table + yoffs + 2048);
- fill_gv_table(c->table_gV, 1, cgv);
- break;
- case 15:
- case 16:
- rbase = isRgb ? bpp - 5 : 0;
- gbase = 5;
- bbase = isRgb ? 0 : (bpp - 5);
- c->yuvTable = av_malloc(1024*3*2);
- y_table16 = c->yuvTable;
- yb = -(384<<16) - oy;
- for (i = 0; i < 1024; i++) {
- uint8_t yval = av_clip_uint8((yb + 0x8000) >> 16);
- y_table16[i ] = (yval >> 3) << rbase;
- y_table16[i+1024] = (yval >> (18 - bpp)) << gbase;
- y_table16[i+2048] = (yval >> 3) << bbase;
- yb += cy;
- }
- fill_table(c->table_rV, 2, crv, y_table16 + yoffs);
- fill_table(c->table_gU, 2, cgu, y_table16 + yoffs + 1024);
- fill_table(c->table_bU, 2, cbu, y_table16 + yoffs + 2048);
- fill_gv_table(c->table_gV, 2, cgv);
- break;
- case 24:
- case 48:
- c->yuvTable = av_malloc(1024);
- y_table = c->yuvTable;
- yb = -(384<<16) - oy;
- for (i = 0; i < 1024; i++) {
- y_table[i] = av_clip_uint8((yb + 0x8000) >> 16);
- yb += cy;
- }
- fill_table(c->table_rV, 1, crv, y_table + yoffs);
- fill_table(c->table_gU, 1, cgu, y_table + yoffs);
- fill_table(c->table_bU, 1, cbu, y_table + yoffs);
- fill_gv_table(c->table_gV, 1, cgv);
- break;
- case 32:
- base = (c->dstFormat == PIX_FMT_RGB32_1 || c->dstFormat == PIX_FMT_BGR32_1) ? 8 : 0;
- rbase = base + (isRgb ? 16 : 0);
- gbase = base + 8;
- bbase = base + (isRgb ? 0 : 16);
- needAlpha = CONFIG_SWSCALE_ALPHA && isALPHA(c->srcFormat);
- if (!needAlpha)
- abase = (base + 24) & 31;
- c->yuvTable = av_malloc(1024*3*4);
- y_table32 = c->yuvTable;
- yb = -(384<<16) - oy;
- for (i = 0; i < 1024; i++) {
- uint8_t yval = av_clip_uint8((yb + 0x8000) >> 16);
- y_table32[i ] = (yval << rbase) + (needAlpha ? 0 : (255 << abase));
- y_table32[i+1024] = yval << gbase;
- y_table32[i+2048] = yval << bbase;
- yb += cy;
- }
- fill_table(c->table_rV, 4, crv, y_table32 + yoffs);
- fill_table(c->table_gU, 4, cgu, y_table32 + yoffs + 1024);
- fill_table(c->table_bU, 4, cbu, y_table32 + yoffs + 2048);
- fill_gv_table(c->table_gV, 4, cgv);
- break;
- default:
- c->yuvTable = NULL;
- av_log(c, AV_LOG_ERROR, "%ibpp not supported by yuv2rgb\n", bpp);
- return -1;
- }
- return 0;
-}
diff --git a/libvo/aclib.c b/libvo/aclib.c
index 377dff9fce..7328de794a 100644
--- a/libvo/aclib.c
+++ b/libvo/aclib.c
@@ -27,7 +27,7 @@
#include <string.h>
#include "cpudetect.h"
#include "fastmemcpy.h"
-#include "libavutil/x86_cpu.h"
+#include "ffmpeg_files/x86_cpu.h"
#undef memcpy
#define BLOCK_SIZE 4096
diff --git a/libvo/aclib_template.c b/libvo/aclib_template.c
index ba9ee484db..db3015ae66 100644
--- a/libvo/aclib_template.c
+++ b/libvo/aclib_template.c
@@ -458,4 +458,3 @@ static void * RENAME(mem2agpcpy)(void * to, const void * from, size_t len)
if(len) small_memcpy(to, from, len);
return retval;
}
-
diff --git a/libvo/aspect.c b/libvo/aspect.c
index 9ddc105aee..1b1e5857f3 100644
--- a/libvo/aspect.c
+++ b/libvo/aspect.c
@@ -19,9 +19,11 @@
/* Stuff for correct aspect scaling. */
#include "aspect.h"
#include "geometry.h"
+#include "video_out.h"
//#ifndef ASPECT_TEST
#include "mp_msg.h"
#include "help_mp.h"
+#include "options.h"
//#endif
//#define ASPECT_DEBUG
@@ -30,157 +32,147 @@
#include <stdio.h>
#endif
-int vo_panscan_x = 0;
-int vo_panscan_y = 0;
-float vo_panscan_amount = 0;
-float vo_panscanrange = 1.0;
-
#include "video_out.h"
-float force_monitor_aspect=0;
-float monitor_aspect=0;
-float monitor_pixel_aspect=1;
-
-static struct {
- int orgw; // real width
- int orgh; // real height
- int prew; // prescaled width
- int preh; // prescaled height
- int scrw; // horizontal resolution
- int scrh; // vertical resolution
- float asp;
-} aspdat;
-
-void aspect_save_orig(int orgw, int orgh){
+void aspect_save_orig(struct vo *vo, int orgw, int orgh)
+{
#ifdef ASPECT_DEBUG
printf("aspect_save_orig %dx%d \n",orgw,orgh);
#endif
- aspdat.orgw = orgw;
- aspdat.orgh = orgh;
+ vo->aspdat.orgw = orgw;
+ vo->aspdat.orgh = orgh;
}
-void aspect_save_prescale(int prew, int preh){
+void aspect_save_prescale(struct vo *vo, int prew, int preh)
+{
#ifdef ASPECT_DEBUG
printf("aspect_save_prescale %dx%d \n",prew,preh);
#endif
- aspdat.prew = prew;
- aspdat.preh = preh;
+ vo->aspdat.prew = prew;
+ vo->aspdat.preh = preh;
}
-void aspect_save_screenres(int scrw, int scrh){
+void aspect_save_screenres(struct vo *vo, int scrw, int scrh)
+{
#ifdef ASPECT_DEBUG
printf("aspect_save_screenres %dx%d \n",scrw,scrh);
#endif
- aspdat.scrw = scrw;
- aspdat.scrh = scrh;
- if (force_monitor_aspect)
- monitor_aspect = force_monitor_aspect;
- else
- monitor_aspect = monitor_pixel_aspect * scrw / scrh;
+ struct MPOpts *opts = vo->opts;
+ vo->aspdat.scrw = scrw;
+ vo->aspdat.scrh = scrh;
+ if (opts->force_monitor_aspect)
+ vo->monitor_aspect = opts->force_monitor_aspect;
+ else
+ vo->monitor_aspect = opts->monitor_pixel_aspect * scrw / scrh;
}
/* aspect is called with the source resolution and the
* resolution, that the scaled image should fit into
*/
-void aspect_fit(int *srcw, int *srch, int fitw, int fith){
+void aspect_fit(struct vo *vo, int *srcw, int *srch, int fitw, int fith)
+{
+ struct aspect_data *aspdat = &vo->aspdat;
int tmpw;
#ifdef ASPECT_DEBUG
- printf("aspect(0) fitin: %dx%d screenaspect: %.2f\n",aspdat.scrw,aspdat.scrh,
+ printf("aspect(0) fitin: %dx%d screenaspect: %.2f\n",aspdat->scrw,aspdat->scrh,
monitor_aspect);
- printf("aspect(1) wh: %dx%d (org: %dx%d)\n",*srcw,*srch,aspdat.prew,aspdat.preh);
+ printf("aspect(1) wh: %dx%d (org: %dx%d)\n",*srcw,*srch,aspdat->prew,aspdat->preh);
#endif
*srcw = fitw;
- *srch = (int)(((float)fitw / (float)aspdat.prew * (float)aspdat.preh)
- * ((float)aspdat.scrh / ((float)aspdat.scrw / monitor_aspect)));
+ *srch = (int)(((float)fitw / (float)aspdat->prew * (float)aspdat->preh)
+ * ((float)aspdat->scrh / ((float)aspdat->scrw / vo->monitor_aspect)));
*srch+= *srch%2; // round
#ifdef ASPECT_DEBUG
- printf("aspect(2) wh: %dx%d (org: %dx%d)\n",*srcw,*srch,aspdat.prew,aspdat.preh);
+ printf("aspect(2) wh: %dx%d (org: %dx%d)\n",*srcw,*srch,aspdat->prew,aspdat->preh);
#endif
- if(*srch>fith || *srch<aspdat.orgh){
- tmpw = (int)(((float)fith / (float)aspdat.preh * (float)aspdat.prew)
- * ((float)aspdat.scrw / ((float)aspdat.scrh / (1.0/monitor_aspect))));
+ if(*srch>fith || *srch<aspdat->orgh){
+ tmpw = (int)(((float)fith / (float)aspdat->preh * (float)aspdat->prew)
+ * ((float)aspdat->scrw / ((float)aspdat->scrh / (1.0/vo->monitor_aspect))));
tmpw+= tmpw%2; // round
- if(tmpw<=fitw /*&& tmpw>=aspdat.orgw*/){
+ if(tmpw<=fitw /*&& tmpw>=aspdat->orgw*/){
*srch = fith;
*srcw = tmpw;
}else{
#ifndef ASPECT_TEST
- mp_msg(MSGT_VO,MSGL_WARN,MSGTR_LIBVO_ASPECT_NoSuitableNewResFound);
+ mp_tmsg(MSGT_VO,MSGL_WARN,"[ASPECT] Warning: No suitable new res found!\n");
#else
- mp_msg(MSGT_VO,MSGL_WARN,MSGTR_LIBVO_ASPECT_NoNewSizeFoundThatFitsIntoRes);
+ mp_tmsg(MSGT_VO,MSGL_WARN,"[ASPECT] Error: No new size found that fits into res!\n");
#endif
}
}
- aspdat.asp=*srcw / (float)*srch;
+ aspdat->asp=*srcw / (float)*srch;
#ifdef ASPECT_DEBUG
- printf("aspect(3) wh: %dx%d (org: %dx%d)\n",*srcw,*srch,aspdat.prew,aspdat.preh);
+ printf("aspect(3) wh: %dx%d (org: %dx%d)\n",*srcw,*srch,aspdat->prew,aspdat->preh);
#endif
}
-static void get_max_dims(int *w, int *h, int zoom)
+static void get_max_dims(struct vo *vo, int *w, int *h, int zoom)
{
- *w = zoom ? aspdat.scrw : aspdat.prew;
- *h = zoom ? aspdat.scrh : aspdat.preh;
+ struct aspect_data *aspdat = &vo->aspdat;
+ *w = zoom ? aspdat->scrw : aspdat->prew;
+ *h = zoom ? aspdat->scrh : aspdat->preh;
if (zoom && WinID >= 0) zoom = A_WINZOOM;
if (zoom == A_WINZOOM) {
- *w = vo_dwidth;
- *h = vo_dheight;
+ *w = vo->dwidth;
+ *h = vo->dheight;
}
}
-void aspect(int *srcw, int *srch, int zoom){
+void aspect(struct vo *vo, int *srcw, int *srch, int zoom)
+{
int fitw;
int fith;
- get_max_dims(&fitw, &fith, zoom);
+ get_max_dims(vo, &fitw, &fith, zoom);
if( !zoom && geometry_wh_changed ) {
#ifdef ASPECT_DEBUG
printf("aspect(0) no aspect forced!\n");
#endif
return; // the user doesn't want to fix aspect
}
- aspect_fit(srcw, srch, fitw, fith);
+ aspect_fit(vo, srcw, srch, fitw, fith);
}
-void panscan_init( void )
+void panscan_init(struct vo *vo)
{
- vo_panscan_x=0;
- vo_panscan_y=0;
- vo_panscan_amount=0.0f;
+ vo->panscan_x = 0;
+ vo->panscan_y = 0;
+ vo->panscan_amount = 0.0f;
}
-static void panscan_calc_internal(int zoom)
+static void panscan_calc_internal(struct vo *vo, int zoom)
{
int fwidth,fheight;
int vo_panscan_area;
int max_w, max_h;
- get_max_dims(&max_w, &max_h, zoom);
-
- if (vo_panscanrange > 0) {
- aspect(&fwidth,&fheight,zoom);
- vo_panscan_area = max_h - fheight;
- if (!vo_panscan_area)
- vo_panscan_area = max_w - fwidth;
- vo_panscan_area *= vo_panscanrange;
- } else
- vo_panscan_area = -vo_panscanrange * max_h;
-
- vo_panscan_amount = vo_fs || zoom == A_WINZOOM ? vo_panscan : 0;
- vo_panscan_x = vo_panscan_area * vo_panscan_amount * aspdat.asp;
- vo_panscan_y = vo_panscan_area * vo_panscan_amount;
+ get_max_dims(vo, &max_w, &max_h, zoom);
+ struct MPOpts *opts = vo->opts;
+
+ if (opts->vo_panscanrange > 0) {
+ aspect(vo, &fwidth, &fheight, zoom);
+ vo_panscan_area = max_h - fheight;
+ if (!vo_panscan_area)
+ vo_panscan_area = max_w - fwidth;
+ vo_panscan_area *= opts->vo_panscanrange;
+ } else
+ vo_panscan_area = -opts->vo_panscanrange * max_h;
+
+ vo->panscan_amount = vo_fs || zoom == A_WINZOOM ? vo_panscan : 0;
+ vo->panscan_x = vo_panscan_area * vo->panscan_amount * vo->aspdat.asp;
+ vo->panscan_y = vo_panscan_area * vo->panscan_amount;
}
-void panscan_calc(void)
+void panscan_calc(struct vo *vo)
{
- panscan_calc_internal(A_ZOOM);
+ panscan_calc_internal(vo, A_ZOOM);
}
/**
* vos that set vo_dwidth and v_dheight correctly should call this to update
* vo_panscan_x and vo_panscan_y
*/
-void panscan_calc_windowed(void)
+void panscan_calc_windowed(struct vo *vo)
{
- panscan_calc_internal(A_WINZOOM);
+ panscan_calc_internal(vo, A_WINZOOM);
}
diff --git a/libvo/aspect.h b/libvo/aspect.h
index 0654d86c9f..07f928a9ff 100644
--- a/libvo/aspect.h
+++ b/libvo/aspect.h
@@ -20,25 +20,38 @@
#define MPLAYER_ASPECT_H
/* Stuff for correct aspect scaling. */
-extern int vo_panscan_x;
-extern int vo_panscan_y;
-extern float vo_panscan_amount;
+struct vo;
+void panscan_init(struct vo *vo);
+void panscan_calc(struct vo *vo);
+void panscan_calc_windowed(struct vo *vo);
-void panscan_init(void);
-void panscan_calc(void);
-void panscan_calc_windowed(void);
+void aspect_save_orig(struct vo *vo, int orgw, int orgh);
-void aspect_save_orig(int orgw, int orgh);
+void aspect_save_prescale(struct vo *vo, int prew, int preh);
-void aspect_save_prescale(int prew, int preh);
-
-void aspect_save_screenres(int scrw, int scrh);
+void aspect_save_screenres(struct vo *vo, int scrw, int scrh);
#define A_WINZOOM 2 ///< zoom to fill window size
#define A_ZOOM 1
#define A_NOZOOM 0
-void aspect(int *srcw, int *srch, int zoom);
-void aspect_fit(int *srcw, int *srch, int fitw, int fith);
+void aspect(struct vo *vo, int *srcw, int *srch, int zoom);
+void aspect_fit(struct vo *vo, int *srcw, int *srch, int fitw, int fith);
+
+
+#ifdef IS_OLD_VO
+#define vo_panscan_x global_vo->panscan_x
+#define vo_panscan_y global_vo->panscan_y
+#define vo_panscan_amount global_vo->panscan_amount
+#define monitor_aspect global_vo->monitor_aspect
+
+#define panscan_init() panscan_init(global_vo)
+#define panscan_calc() panscan_calc(global_vo)
+#define panscan_calc_windowed() panscan_calc_windowed(global_vo)
+#define aspect_save_orig(...) aspect_save_orig(global_vo, __VA_ARGS__)
+#define aspect_save_prescale(...) aspect_save_prescale(global_vo, __VA_ARGS__)
+#define aspect_save_screenres(...) aspect_save_screenres(global_vo, __VA_ARGS__)
+#define aspect(...) aspect(global_vo, __VA_ARGS__)
+#endif
#endif /* MPLAYER_ASPECT_H */
diff --git a/libvo/aspecttest.c b/libvo/aspecttest.c
index fcd912bb28..b73e8c589c 100644
--- a/libvo/aspecttest.c
+++ b/libvo/aspecttest.c
@@ -63,4 +63,3 @@ int main(int argc, char *argv[]) {
printf("new size: %dx%d\n",w,h);
return 0;
}
-
diff --git a/libvo/font_load.h b/libvo/font_load.h
index ebd03c0963..7efe067aaf 100644
--- a/libvo/font_load.h
+++ b/libvo/font_load.h
@@ -82,7 +82,6 @@ typedef struct font_desc {
} font_desc_t;
extern font_desc_t* vo_font;
-extern font_desc_t* sub_font;
extern char *subtitle_font_encoding;
extern float text_font_scale_factor;
diff --git a/libvo/font_load_ft.c b/libvo/font_load_ft.c
index 2b4caad215..1ddd15d268 100644
--- a/libvo/font_load_ft.c
+++ b/libvo/font_load_ft.c
@@ -84,13 +84,13 @@ static FT_Library library;
#define OSD_CHARSET_SIZE 15
-static FT_ULong osd_charset[OSD_CHARSET_SIZE] =
+static const FT_ULong osd_charset[OSD_CHARSET_SIZE] =
{
0xe001, 0xe002, 0xe003, 0xe004, 0xe005, 0xe006, 0xe007, 0xe008,
0xe009, 0xe00a, 0xe00b, 0xe010, 0xe011, 0xe012, 0xe013
};
-static FT_ULong osd_charcodes[OSD_CHARSET_SIZE] =
+static const FT_ULong osd_charcodes[OSD_CHARSET_SIZE] =
{
0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,
0x09,0x0a,0x0b,0x10,0x11,0x12,0x13
@@ -920,7 +920,7 @@ static int load_sub_face(const char *name, int face_index, FT_Face *face)
if (err) {
err = FT_New_Face(library, MPLAYER_DATADIR "/subfont.ttf", 0, face);
if (err) {
- mp_msg(MSGT_OSD, MSGL_ERR, MSGTR_LIBVO_FONT_LOAD_FT_NewFaceFailed);
+ mp_tmsg(MSGT_OSD, MSGL_ERR, "New_Face failed. Maybe the font path is wrong.\nPlease supply the text font file (~/.mplayer/subfont.ttf).\n");
return -1;
}
}
@@ -931,7 +931,7 @@ static int load_sub_face(const char *name, int face_index, FT_Face *face)
static int load_osd_face(FT_Face *face)
{
if ( FT_New_Memory_Face(library, osd_font_pfb, sizeof(osd_font_pfb), 0, face) ) {
- mp_msg(MSGT_OSD, MSGL_ERR, MSGTR_LIBVO_FONT_LOAD_FT_NewMemoryFaceFailed);
+ mp_tmsg(MSGT_OSD, MSGL_ERR, "New_Memory_Face failed..\n");
return -1;
}
return 0;
@@ -1018,7 +1018,7 @@ font_desc_t* read_font_desc_ft(const char *fname, int face_index, int movie_widt
/* generate the subtitle font */
err = load_sub_face(fname, face_index, &face);
if (err) {
- mp_msg(MSGT_OSD, MSGL_WARN, MSGTR_LIBVO_FONT_LOAD_FT_SubFaceFailed);
+ mp_tmsg(MSGT_OSD, MSGL_WARN, "subtitle font: load_sub_face failed.\n");
goto gen_osd;
}
desc->face_cnt++;
@@ -1035,7 +1035,7 @@ font_desc_t* read_font_desc_ft(const char *fname, int face_index, int movie_widt
}
if (charset_size < 0) {
- mp_msg(MSGT_OSD, MSGL_ERR, MSGTR_LIBVO_FONT_LOAD_FT_SubFontCharsetFailed);
+ mp_tmsg(MSGT_OSD, MSGL_ERR, "subtitle font: prepare_charset failed.\n");
goto err_out;
}
#else
@@ -1049,7 +1049,7 @@ font_desc_t* read_font_desc_ft(const char *fname, int face_index, int movie_widt
subtitle_font_thickness, subtitle_font_radius);
if (err) {
- mp_msg(MSGT_OSD, MSGL_ERR, MSGTR_LIBVO_FONT_LOAD_FT_CannotPrepareSubtitleFont);
+ mp_tmsg(MSGT_OSD, MSGL_ERR, "Cannot prepare subtitle font.\n");
goto err_out;
}
@@ -1067,14 +1067,14 @@ gen_osd:
subtitle_font_thickness, subtitle_font_radius);
if (err) {
- mp_msg(MSGT_OSD, MSGL_ERR, MSGTR_LIBVO_FONT_LOAD_FT_CannotPrepareOSDFont);
+ mp_tmsg(MSGT_OSD, MSGL_ERR, "Cannot prepare OSD font.\n");
goto err_out;
}
err = generate_tables(desc, subtitle_font_thickness, subtitle_font_radius);
if (err) {
- mp_msg(MSGT_OSD, MSGL_ERR, MSGTR_LIBVO_FONT_LOAD_FT_CannotGenerateTables);
+ mp_tmsg(MSGT_OSD, MSGL_ERR, "Cannot generate tables.\n");
goto err_out;
}
@@ -1129,7 +1129,7 @@ int done_freetype(void)
err = FT_Done_FreeType(library);
if (err) {
- mp_msg(MSGT_OSD, MSGL_ERR, MSGTR_LIBVO_FONT_LOAD_FT_DoneFreeTypeFailed);
+ mp_tmsg(MSGT_OSD, MSGL_ERR, "FT_Done_FreeType failed.\n");
return -1;
}
@@ -1183,8 +1183,8 @@ void load_font_ft(int width, int height, font_desc_t** fontp, const char *font_n
FcPatternDestroy(fc_pattern);
return;
}
- // Failed to match any font, try without fontconfig
- mp_msg(MSGT_OSD, MSGL_ERR, MSGTR_LIBVO_FONT_LOAD_FT_FontconfigNoMatch);
+ mp_tmsg(MSGT_OSD, MSGL_ERR, "Fontconfig failed to select a font. "
+ "Trying without fontconfig...\n");
}
#endif
*fontp=read_font_desc_ft(font_name, 0, width, height, font_scale_factor);
diff --git a/libvo/gl_common.c b/libvo/gl_common.c
index 3e9263c9e9..ce65873349 100644
--- a/libvo/gl_common.c
+++ b/libvo/gl_common.c
@@ -32,6 +32,7 @@
#include <string.h>
#include <ctype.h>
#include <math.h>
+#include "old_vo_defines.h"
#include "gl_common.h"
#include "csputils.h"
@@ -1752,6 +1753,26 @@ static void swapGlBuffers_x11(MPGLContext *ctx) {
static int x11_check_events(void) {
return vo_x11_check_events(mDisplay);
}
+
+static void gl_update_xinerama_info(void)
+{
+ update_xinerama_info(global_vo);
+}
+
+static void gl_border(void)
+{
+ vo_x11_border();
+}
+
+static void gl_fullscreen(void)
+{
+ vo_x11_fullscreen();
+}
+
+static void gl_ontop(void)
+{
+ vo_x11_ontop();
+}
#endif
int init_mpglcontext(MPGLContext *ctx, enum MPGLType type) {
@@ -1775,11 +1796,11 @@ int init_mpglcontext(MPGLContext *ctx, enum MPGLType type) {
ctx->setGlWindow = setGlWindow_x11;
ctx->releaseGlContext = releaseGlContext_x11;
ctx->swapGlBuffers = swapGlBuffers_x11;
- ctx->update_xinerama_info = update_xinerama_info;
- ctx->border = vo_x11_border;
+ ctx->update_xinerama_info = gl_update_xinerama_info;
+ ctx->border = gl_border;
ctx->check_events = x11_check_events;
- ctx->fullscreen = vo_x11_fullscreen;
- ctx->ontop = vo_x11_ontop;
+ ctx->fullscreen = gl_fullscreen;
+ ctx->ontop = gl_ontop;
return vo_init();
#endif
default:
diff --git a/libvo/gl_common.h b/libvo/gl_common.h
index d792dd8a94..0be98cf6ed 100644
--- a/libvo/gl_common.h
+++ b/libvo/gl_common.h
@@ -38,6 +38,8 @@
#include <X11/Xlib.h>
#include <GL/glx.h>
#include "x11_common.h"
+// This old-vo wrapper macro would conflict with the struct member
+#undef update_xinerama_info
#endif
// workaround for some gl.h headers
diff --git a/libvo/gtf.c b/libvo/gtf.c
index ce82d39a70..6dd64a57c8 100644
--- a/libvo/gtf.c
+++ b/libvo/gtf.c
@@ -302,5 +302,3 @@ void GTF_calcTimings(double X,double Y,double freq, int type,
result-> RefreshRate = actual_V_frame_freq*100;/* Refresh rate in units of 0.01 Hz*/
}
-
-
diff --git a/libvo/mga_common.c b/libvo/mga_common.c
index 13b73d1b45..9a173b3ded 100644
--- a/libvo/mga_common.c
+++ b/libvo/mga_common.c
@@ -23,6 +23,7 @@
#include "libmpcodecs/vf_scale.h"
#include "mp_msg.h"
#include "help_mp.h"
+#include "old_vo_wrapper.h"
// mga_vid drawing functions
static void set_window( void ); /* forward declaration to kill warnings */
@@ -242,11 +243,11 @@ static void mga_fullscreen(void)
mga_vid_config.x_org=(vo_screenwidth-w)/2;
mga_vid_config.y_org=(vo_screenheight-h)/2;
if ( ioctl( f,MGA_VID_CONFIG,&mga_vid_config ) )
- mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_MGA_ErrorInConfigIoctl );
+ mp_tmsg(MSGT_VO,MSGL_WARN, "[MGA] error in mga_vid_config ioctl (wrong mga_vid.o version?)" );
}
#endif
-static int control(uint32_t request, void *data, ...)
+static int control(uint32_t request, void *data)
{
switch (request) {
case VOCTRL_QUERY_FORMAT:
@@ -257,36 +258,35 @@ static int control(uint32_t request, void *data, ...)
return draw_image(data);
case VOCTRL_SET_EQUALIZER:
{
- va_list ap;
short value;
uint32_t luma,prev;
+ struct voctrl_set_equalizer_args *args = data;
- if ( strcmp( data,"brightness" ) && strcmp( data,"contrast" ) ) return VO_FALSE;
+ if (strcmp(args->name, "brightness") && strcmp(args->name, "contrast"))
+ return VO_FALSE;
if (ioctl(f,MGA_VID_GET_LUMA,&prev)) {
perror("Error in mga_vid_config ioctl()");
- mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_MGA_CouldNotGetLumaValuesFromTheKernelModule);
+ mp_tmsg(MSGT_VO,MSGL_WARN, "[MGA] Could not get luma values from the kernel module!\n");
return VO_FALSE;
}
// printf("GET: 0x%4X 0x%4X \n",(prev>>16),(prev&0xffff));
- va_start(ap, data);
- value = va_arg(ap, int);
- va_end(ap);
+ value = args->value;
// printf("value: %d -> ",value);
value=((value+100)*255)/200-128; // maps -100=>-128 and +100=>127
// printf("%d \n",value);
- if(!strcmp(data,"contrast"))
+ if (!strcmp(args->name, "contrast"))
luma = (prev&0xFFFF0000)|(value&0xFFFF);
else
luma = (prev&0xFFFF)|(value<<16);
if (ioctl(f,MGA_VID_SET_LUMA,luma)) {
perror("Error in mga_vid_config ioctl()");
- mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_MGA_CouldNotSetLumaValuesFromTheKernelModule);
+ mp_tmsg(MSGT_VO,MSGL_WARN, "[MGA] Could not set luma values from the kernel module!\n");
return VO_FALSE;
}
@@ -295,29 +295,25 @@ static int control(uint32_t request, void *data, ...)
case VOCTRL_GET_EQUALIZER:
{
- va_list ap;
- int * value;
short val;
uint32_t luma;
+ struct voctrl_get_equalizer_args *args = data;
- if ( strcmp( data,"brightness" ) && strcmp( data,"contrast" ) ) return VO_FALSE;
+ if (strcmp(args->name, "brightness") && strcmp(args->name, "contrast"))
+ return VO_FALSE;
if (ioctl(f,MGA_VID_GET_LUMA,&luma)) {
perror("Error in mga_vid_config ioctl()");
- mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_MGA_CouldNotGetLumaValuesFromTheKernelModule);
+ mp_tmsg(MSGT_VO,MSGL_WARN, "[MGA] Could not get luma values from the kernel module!\n");
return VO_FALSE;
}
- if ( !strcmp( data,"contrast" ) )
+ if (!strcmp(args->name, "contrast"))
val=(luma & 0xFFFF);
else
val=(luma >> 16);
- va_start(ap, data);
- value = va_arg(ap, int*);
- va_end(ap);
-
- *value = (val*200)/255;
+ *args->valueptr = (val*200)/255;
return VO_TRUE;
}
@@ -327,18 +323,13 @@ static int control(uint32_t request, void *data, ...)
if (vo_screenwidth && vo_screenheight)
mga_fullscreen();
else
- mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_MGA_ScreenWidthHeightUnknown);
+ mp_tmsg(MSGT_VO,MSGL_WARN, "[MGA] Screen width/height unknown!\n");
return VO_TRUE;
case VOCTRL_GET_PANSCAN:
if ( !vo_fs ) return VO_FALSE;
return VO_TRUE;
#endif
-#if defined(VO_XMGA) && defined(CONFIG_GUI)
- case VOCTRL_GUISUPPORT:
- return VO_TRUE;
-#endif
-
#ifdef VO_XMGA
case VOCTRL_ONTOP:
vo_x11_ontop();
@@ -384,7 +375,7 @@ static int mga_init(int width,int height,unsigned int format){
mga_vid_config.frame_size = ((width + 31) & ~31) * height * 2;
mga_vid_config.format=MGA_VID_FORMAT_UYVY; break;
default:
- mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_MGA_InvalidOutputFormat,format);
+ mp_tmsg(MSGT_VO,MSGL_WARN, "[MGA] invalid output format %0X\n",format);
return -1;
}
@@ -402,7 +393,7 @@ static int mga_init(int width,int height,unsigned int format){
if(width > 1024 && height > 1024)
{
- mp_msg(MSGT_VO,MSGL_ERR, MSGTR_LIBVO_MGA_ResolutionTooHigh);
+ mp_tmsg(MSGT_VO,MSGL_ERR, "[MGA] Source resolution exceeds 1023x1023 in at least one dimension.\n[MGA] Rescale in software or use -lavdopts lowres=1.\n");
return -1;
} else if(height <= 1024)
{
@@ -413,13 +404,13 @@ static int mga_init(int width,int height,unsigned int format){
if(mga_vid_config.card_type != MGA_G550)
{
// we don't have a G550, so our resolution is too high
- mp_msg(MSGT_VO,MSGL_ERR, MSGTR_LIBVO_MGA_ResolutionTooHigh);
+ mp_tmsg(MSGT_VO,MSGL_ERR, "[MGA] Source resolution exceeds 1023x1023 in at least one dimension.\n[MGA] Rescale in software or use -lavdopts lowres=1.\n");
return -1;
} else {
// there is a deeper problem
// we have a G550, but still couldn't configure mga_vid
perror("Error in mga_vid_config ioctl()");
- mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_MGA_IncompatibleDriverVersion);
+ mp_tmsg(MSGT_VO,MSGL_WARN, "[MGA] Your mga_vid driver version is incompatible with this MPlayer version!\n");
return -1;
}
// if we arrived here, then we could successfully configure mga_vid
@@ -430,7 +421,7 @@ static int mga_init(int width,int height,unsigned int format){
if (ioctl(f,MGA_VID_CONFIG,&mga_vid_config))
{
perror("Error in mga_vid_config ioctl()");
- mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_MGA_IncompatibleDriverVersion);
+ mp_tmsg(MSGT_VO,MSGL_WARN, "[MGA] Your mga_vid driver version is incompatible with this MPlayer version!\n");
return -1;
}
}
@@ -474,7 +465,7 @@ static int preinit(const char *vo_subdevice)
if(f == -1)
{
perror("open");
- mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_MGA_CouldntOpen,devname);
+ mp_tmsg(MSGT_VO,MSGL_WARN, "[MGA] Couldn't open: %s\n",devname);
return -1;
}
@@ -484,7 +475,7 @@ static int preinit(const char *vo_subdevice)
ioctl(f,MGA_VID_GET_VERSION,&ver);
if(MGA_VID_VERSION != ver)
{
- mp_msg(MSGT_VO, MSGL_ERR, MSGTR_LIBVO_MGA_mgavidVersionMismatch, ver, MGA_VID_VERSION);
+ mp_tmsg(MSGT_VO, MSGL_ERR, "[MGA] mismatch between kernel (%u) and MPlayer (%u) mga_vid driver versions\n", ver, MGA_VID_VERSION);
return -1;
}
diff --git a/libvo/old_vo_defines.h b/libvo/old_vo_defines.h
new file mode 100644
index 0000000000..feded12d5b
--- /dev/null
+++ b/libvo/old_vo_defines.h
@@ -0,0 +1,24 @@
+#ifndef MPLAYER_OLD_VO_DEFINES_H
+#define MPLAYER_OLD_VO_DEFINES_H
+
+#include "options.h"
+#include "video_out.h"
+#include "old_vo_wrapper.h"
+
+// Triggers more defines in x11_common.h
+#define IS_OLD_VO 1
+
+#define vo_ontop global_vo->opts->vo_ontop
+#define vo_config_count global_vo->config_count
+#define vo_dx global_vo->dx
+#define vo_dy global_vo->dy
+#define vo_dwidth global_vo->dwidth
+#define vo_dheight global_vo->dheight
+#define vo_dbpp global_vo->opts->vo_dbpp
+#define vo_screenwidth global_vo->opts->vo_screenwidth
+#define vo_screenheight global_vo->opts->vo_screenheight
+#define vidmode global_vo->opts->vidmode
+#define movie_aspect global_vo->opts->movie_aspect
+
+#define calc_src_dst_rects(...) calc_src_dst_rects(global_vo, __VA_ARGS__)
+#endif
diff --git a/libvo/old_vo_wrapper.c b/libvo/old_vo_wrapper.c
new file mode 100644
index 0000000000..bdbc8b8349
--- /dev/null
+++ b/libvo/old_vo_wrapper.c
@@ -0,0 +1,116 @@
+/*
+ * 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.
+ */
+
+
+#include <stdint.h>
+#include "old_vo_wrapper.h"
+#include "video_out.h"
+#include "sub.h"
+
+struct vo *global_vo;
+struct osd_state *global_osd;
+
+int old_vo_preinit(struct vo *vo, const char *arg)
+{
+ global_vo = vo;
+ return vo->driver->old_functions->preinit(arg);
+}
+
+
+int old_vo_config(struct vo *vo, uint32_t width, uint32_t height,
+ uint32_t d_width, uint32_t d_height,
+ uint32_t flags, char *title, uint32_t format)
+{
+ return vo->driver->old_functions->config(width, height, d_width,
+ d_height, flags, title, format);
+}
+
+
+int old_vo_control(struct vo *vo, uint32_t request, void *data)
+{
+ return vo->driver->old_functions->control(request, data);
+}
+
+
+int old_vo_draw_frame(struct vo *vo, uint8_t *src[])
+{
+ return vo->driver->old_functions->draw_frame(src);
+}
+
+
+int old_vo_draw_slice(struct vo *vo, uint8_t *src[], int stride[],
+ int w, int h, int x, int y)
+{
+ return vo->driver->old_functions->draw_slice(src, stride, w, h, x, y);
+}
+
+
+void old_vo_draw_osd(struct vo *vo, struct osd_state *osd)
+{
+ global_osd = osd;
+ vo->driver->old_functions->draw_osd();
+}
+
+
+void old_vo_flip_page(struct vo *vo)
+{
+ vo->driver->old_functions->flip_page();
+}
+
+
+void old_vo_check_events(struct vo *vo)
+{
+ vo->driver->old_functions->check_events();
+}
+
+
+void old_vo_uninit(struct vo *vo)
+{
+ vo->driver->old_functions->uninit();
+}
+
+
+static void draw_alpha_wrapper(void *ctx, int x0, int y0, int w, int h,
+ unsigned char *src, unsigned char *srca,
+ int stride)
+{
+ void (*draw_alpha)(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride) = ctx;
+ draw_alpha(x0, y0, w, h, src, srca, stride);
+}
+
+
+void vo_draw_text(int dxs,int dys,void (*draw_alpha)(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride))
+{
+ osd_draw_text(global_osd, dxs, dys, draw_alpha_wrapper, draw_alpha);
+}
+
+void vo_draw_text_ext(int dxs, int dys, int left_border, int top_border,
+ int right_border, int bottom_border, int orig_w, int orig_h,
+ void (*draw_alpha)(int x0, int y0, int w,int h,
+ unsigned char* src,
+ unsigned char *srca, int stride))
+{
+ osd_draw_text_ext(global_osd, dxs, dys, left_border, top_border,
+ right_border, bottom_border, orig_w, orig_h,
+ draw_alpha_wrapper, draw_alpha);
+}
+
+int vo_update_osd(int dxs, int dys)
+{
+ return osd_update(global_osd, dxs, dys);
+}
diff --git a/libvo/old_vo_wrapper.h b/libvo/old_vo_wrapper.h
new file mode 100644
index 0000000000..250a1187fe
--- /dev/null
+++ b/libvo/old_vo_wrapper.h
@@ -0,0 +1,29 @@
+#ifndef MPLAYER_OLD_VO_WRAPPER_H
+#define MPLAYER_OLD_VO_WRAPPER_H
+
+#include <stdint.h>
+#include "video_out.h"
+
+extern struct vo *global_vo;
+extern struct osd_state *global_osd;
+
+int old_vo_preinit(struct vo *vo, const char *);
+int old_vo_config(struct vo *vo, uint32_t width, uint32_t height,
+ uint32_t d_width, uint32_t d_height,
+ uint32_t flags, char *title, uint32_t format);
+int old_vo_control(struct vo *vo, uint32_t request, void *data);
+int old_vo_draw_frame(struct vo *vo, uint8_t *src[]);
+int old_vo_draw_slice(struct vo *vo, uint8_t *src[], int stride[],
+ int w, int h, int x, int y);
+void old_vo_draw_osd(struct vo *vo, struct osd_state *osd);
+void old_vo_flip_page(struct vo *vo);
+void old_vo_check_events(struct vo *vo);
+void old_vo_uninit(struct vo *vo);
+
+void vo_draw_text(int dxs,int dys,void (*draw_alpha)(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride));
+void vo_draw_text_ext(int dxs, int dys, int left_border, int top_border,
+ int right_border, int bottom_border, int orig_w, int orig_h,
+ void (*draw_alpha)(int x0, int y0, int w,int h,unsigned char* src, unsigned char *srca, int stride));
+int vo_update_osd(int dxs, int dys);
+
+#endif
diff --git a/libvo/osd.c b/libvo/osd.c
index 9f17bdb31e..a3664dadb3 100644
--- a/libvo/osd.c
+++ b/libvo/osd.c
@@ -391,4 +391,3 @@ void vo_draw_alpha_rgb16(int w,int h, unsigned char* src, unsigned char *srca, i
}
return;
}
-
diff --git a/libvo/osx_common.c b/libvo/osx_common.c
index b953860e36..e82bc7aa6e 100644
--- a/libvo/osx_common.c
+++ b/libvo/osx_common.c
@@ -20,6 +20,7 @@
// only to get keycode definitions from HIToolbox/Events.h
#include <Carbon/Carbon.h>
#include "osx_common.h"
+#include "old_vo_defines.h"
#include "video_out.h"
#include "osdep/keycodes.h"
#include "input/input.h"
@@ -127,7 +128,7 @@ void change_movie_aspect(float new_aspect)
new_aspect = old_movie_aspect;
our_aspect_change = 1;
snprintf(cmd_str, sizeof(cmd_str), "switch_ratio %f", new_aspect);
- mp_input_queue_cmd(mp_input_parse_cmd(cmd_str));
+ mp_input_queue_cmd(global_vo->input_ctx, mp_input_parse_cmd(cmd_str));
}
/**
diff --git a/libvo/spuenc.c b/libvo/spuenc.c
index 670a393bc2..bc35a06d18 100644
--- a/libvo/spuenc.c
+++ b/libvo/spuenc.c
@@ -229,50 +229,3 @@ pixbuf_encode_rle(int x, int y, int w, int h, char *inbuf, int stride,encodedat
}
encode_do_control(x,y, ed, &pb);
}
-
-
-void
-pixbuf_load_xpm( pixbuf* pb, char* xpm[] ) {
- int colors, chrs, l, n;
- char c[4], table[256];
- unsigned char *b, *i;
-
- sscanf( xpm[0], "%d %d %d %d", &pb->x, &pb->y, &colors, &chrs);
- if( colors > 4 ) {
- fprintf( stderr, "the pixmap MUST be 4 colors or less\n");
- exit (-1);
- }
- if( chrs != 1 ) {
- fprintf( stderr, "the XPM format MUST be 1 char per pixel\n");
- exit (-1);
- }
- if( pb->x > 0xFFF || pb->y > 0xFFF ) {
- fprintf( stderr, "the size is excesive\n");
- exit (-1);
- }
-
- for( l=0; l<colors; l++ ) {
- n= sscanf( xpm[l+1], "%c c #%x", &c[l], &pb->rgb[l]);
- if( n < 2 ) {
- /* this one is transparent */
- pb->rgb[l]=0xff000000;
- }
- table[(int)c[l]]=l;
- }
-
- pb->pixels= malloc( pb->x * pb->y );
- b= pb->pixels;
-
- for( l= colors+1; l <= pb->y + colors; l++ ) {
- i= xpm[l];
- while( (int)*i) {
- *b++ = table[*i++];
- }
- }
-}
-
-void
-pixbuf_delete( pixbuf* pb ) {
- free( pb->pixels );
-}
-
diff --git a/libvo/spuenc.h b/libvo/spuenc.h
index 5bc83b329b..7f4590b4ac 100644
--- a/libvo/spuenc.h
+++ b/libvo/spuenc.h
@@ -41,6 +41,5 @@ typedef struct {
} encodedata;
void pixbuf_encode_rle(int x, int y, int w, int h, char *inbuf, int stride, encodedata *ed);
-void pixbuf_delete(pixbuf* pb);
#endif /* MPLAYER_SPUENC_H */
diff --git a/libvo/sub.c b/libvo/sub.c
index d0abbf30cc..3187f935ea 100644
--- a/libvo/sub.c
+++ b/libvo/sub.c
@@ -32,6 +32,7 @@
#include "libmpcodecs/dec_teletext.h"
#include "osdep/timer.h"
+#include "talloc.h"
#include "mplayer.h"
#include "mp_msg.h"
#include "help_mp.h"
@@ -64,28 +65,26 @@ struct osd_text_p {
};
//^
-char * sub_osd_names[]={
- MSGTR_VO_SUB_Seekbar,
- MSGTR_VO_SUB_Play,
- MSGTR_VO_SUB_Pause,
- MSGTR_VO_SUB_Stop,
- MSGTR_VO_SUB_Rewind,
- MSGTR_VO_SUB_Forward,
- MSGTR_VO_SUB_Clock,
- MSGTR_VO_SUB_Contrast,
- MSGTR_VO_SUB_Saturation,
- MSGTR_VO_SUB_Volume,
- MSGTR_VO_SUB_Brightness,
- MSGTR_VO_SUB_Hue,
- MSGTR_VO_SUB_Balance
+char * const sub_osd_names[]={
+ _("Seekbar"),
+ _("Play"),
+ _("Pause"),
+ _("Stop"),
+ _("Rewind"),
+ _("Forward"),
+ _("Clock"),
+ _("Contrast"),
+ _("Saturation"),
+ _("Volume"),
+ _("Brightness"),
+ _("Hue"),
+ _("Balance")
};
-char * sub_osd_names_short[] ={ "", "|>", "||", "[]", "<<" , ">>", "", "", "", "", "", "", "" };
+char * const sub_osd_names_short[] ={ "", "|>", "||", "[]", "<<" , ">>", "", "", "", "", "", "", "" };
//static int vo_font_loaded=-1;
font_desc_t* vo_font=NULL;
-font_desc_t* sub_font=NULL;
-unsigned char* vo_osd_text=NULL;
void* vo_osd_teletext_page=NULL;
int vo_osd_teletext_half = 0;
int vo_osd_teletext_mode=0;
@@ -165,9 +164,11 @@ static void alloc_buf(mp_osd_obj_t* obj)
}
// renders the buffer
-inline static void vo_draw_text_from_buffer(mp_osd_obj_t* obj,void (*draw_alpha)(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride)){
+inline static void vo_draw_text_from_buffer(mp_osd_obj_t* obj,void (*draw_alpha)(void *ctx, int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride), void *ctx)
+{
if (obj->allocated > 0) {
- draw_alpha(obj->bbox.x1,obj->bbox.y1,
+ draw_alpha(ctx,
+ obj->bbox.x1,obj->bbox.y1,
obj->bbox.x2-obj->bbox.x1,
obj->bbox.y2-obj->bbox.y1,
obj->bitmap_buffer,
@@ -190,8 +191,10 @@ no_utf8:
return c;
}
-inline static void vo_update_text_osd(mp_osd_obj_t* obj,int dxs,int dys){
- const char *cp=vo_osd_text;
+inline static void vo_update_text_osd(struct osd_state *osd, mp_osd_obj_t* obj,
+ int dxs, int dys)
+{
+ const char *cp = osd->osd_text;
int x=20;
int h=0;
int font;
@@ -212,7 +215,7 @@ inline static void vo_update_text_osd(mp_osd_obj_t* obj,int dxs,int dys){
alloc_buf(obj);
- cp=vo_osd_text;
+ cp = osd->osd_text;
x = obj->x;
while (*cp){
uint16_t c=utf8_get_char(&cp);
@@ -667,7 +670,7 @@ inline static void vo_update_text_progbar(mp_osd_obj_t* obj,int dxs,int dys){
subtitle* vo_sub=NULL;
-inline static void vo_update_text_sub(mp_osd_obj_t* obj,int dxs,int dys){
+inline static void vo_update_text_sub(struct osd_state *osd, mp_osd_obj_t* obj,int dxs,int dys){
unsigned char *t;
int c,i,j,l,x,y,font,prevc,counter;
int k;
@@ -676,10 +679,11 @@ inline static void vo_update_text_sub(mp_osd_obj_t* obj,int dxs,int dys){
int xmin=dxs,xmax=0;
int h,lasth;
int xtblc, utblc;
+ struct font_desc *sub_font = osd->sub_font;
obj->flags|=OSDFLAG_CHANGED|OSDFLAG_VISIBLE;
- if(!vo_sub || !sub_font || !sub_visibility || (sub_font->font[40]<0)){
+ if(!vo_sub || !osd->sub_font || !sub_visibility || (sub_font->font[40]<0)){
obj->flags&=~OSDFLAG_VISIBLE;
return;
}
@@ -1050,9 +1054,9 @@ inline static void vo_update_spudec_sub(mp_osd_obj_t* obj, int dxs, int dys)
obj->flags |= OSDFLAG_BBOX;
}
-inline static void vo_draw_spudec_sub(mp_osd_obj_t* obj, void (*draw_alpha)(int x0, int y0, int w, int h, unsigned char* src, unsigned char* srca, int stride))
+inline static void vo_draw_spudec_sub(mp_osd_obj_t* obj, void (*draw_alpha)(void *ctx, int x0, int y0, int w, int h, unsigned char* src, unsigned char* srca, int stride), void *ctx)
{
- spudec_draw_scaled(vo_spudec, obj->dxs, obj->dys, draw_alpha);
+ spudec_draw_scaled(vo_spudec, obj->dxs, obj->dys, draw_alpha, ctx);
}
void *vo_spudec=NULL;
@@ -1076,7 +1080,8 @@ static mp_osd_obj_t* new_osd_obj(int type){
return osd;
}
-void free_osd_list(void){
+void osd_free(struct osd_state *osd)
+{
mp_osd_obj_t* obj=vo_osd_list;
while(obj){
mp_osd_obj_t* next=obj->next;
@@ -1086,12 +1091,15 @@ void free_osd_list(void){
obj=next;
}
vo_osd_list=NULL;
+ talloc_free(osd);
}
#define FONT_LOAD_DEFER 6
-int vo_update_osd_ext(int dxs,int dys, int left_border, int top_border,
- int right_border, int bottom_border, int orig_w, int orig_h){
+int osd_update_ext(struct osd_state *osd, int dxs, int dys, int left_border,
+ int top_border, int right_border, int bottom_border,
+ int orig_w, int orig_h)
+{
mp_osd_obj_t* obj=vo_osd_list;
int chg=0;
#ifdef CONFIG_FREETYPE
@@ -1121,20 +1129,20 @@ int vo_update_osd_ext(int dxs,int dys, int left_border, int top_border,
force_load_font = 0;
load_font_ft(dxs, dys, &vo_font, font_name, osd_font_scale_factor);
if (sub_font_name)
- load_font_ft(dxs, dys, &sub_font, sub_font_name, text_font_scale_factor);
+ load_font_ft(dxs, dys, &osd->sub_font, sub_font_name, text_font_scale_factor);
else
- load_font_ft(dxs, dys, &sub_font, font_name, text_font_scale_factor);
+ load_font_ft(dxs, dys, &osd->sub_font, font_name, text_font_scale_factor);
prev_dxs = dxs;
prev_dys = dys;
defer_counter = 0;
} else {
if (!vo_font)
load_font_ft(dxs, dys, &vo_font, font_name, osd_font_scale_factor);
- if (!sub_font) {
+ if (!osd->sub_font) {
if (sub_font_name)
- load_font_ft(dxs, dys, &sub_font, sub_font_name, text_font_scale_factor);
+ load_font_ft(dxs, dys, &osd->sub_font, sub_font_name, text_font_scale_factor);
else
- load_font_ft(dxs, dys, &sub_font, font_name, text_font_scale_factor);
+ load_font_ft(dxs, dys, &osd->sub_font, font_name, text_font_scale_factor);
}
}
#endif
@@ -1150,7 +1158,7 @@ int vo_update_osd_ext(int dxs,int dys, int left_border, int top_border,
break;
#endif
case OSDTYPE_SUBTITLE:
- vo_update_text_sub(obj,dxs,dys);
+ vo_update_text_sub(osd, obj,dxs,dys);
break;
case OSDTYPE_TELETEXT:
vo_update_text_teletext(obj,dxs,dys);
@@ -1167,8 +1175,8 @@ int vo_update_osd_ext(int dxs,int dys, int left_border, int top_border,
obj->flags&=~OSDFLAG_VISIBLE;
break;
case OSDTYPE_OSD:
- if(vo_font && vo_osd_text && vo_osd_text[0]){
- vo_update_text_osd(obj,dxs,dys); // update bbox
+ if(vo_font && osd->osd_text[0]){
+ vo_update_text_osd(osd, obj, dxs, dys); // update bbox
obj->flags|=OSDFLAG_VISIBLE|OSDFLAG_CHANGED;
} else
obj->flags&=~OSDFLAG_VISIBLE;
@@ -1208,16 +1216,20 @@ int vo_update_osd_ext(int dxs,int dys, int left_border, int top_border,
return chg;
}
-int vo_update_osd(int dxs, int dys) {
- return vo_update_osd_ext(dxs, dys, 0, 0, 0, 0, dxs, dys);
+int osd_update(struct osd_state *osd, int dxs, int dys)
+{
+ return osd_update_ext(osd, dxs, dys, 0, 0, 0, 0, dxs, dys);
}
-void vo_init_osd(void){
+struct osd_state *osd_create(void)
+{
+ struct osd_state *osd = talloc_zero(NULL, struct osd_state);
+ *osd = (struct osd_state){
+ };
if(!draw_alpha_init_flag){
draw_alpha_init_flag=1;
vo_draw_alpha_init();
}
- if(vo_osd_list) free_osd_list();
// temp hack, should be moved to mplayer/mencoder later
new_osd_obj(OSDTYPE_OSD);
new_osd_obj(OSDTYPE_SUBTITLE);
@@ -1230,13 +1242,16 @@ void vo_init_osd(void){
#ifdef CONFIG_FREETYPE
force_load_font = 1;
#endif
+ return osd;
}
int vo_osd_changed_flag=0;
-void vo_remove_text(int dxs,int dys,void (*remove)(int x0,int y0, int w,int h)){
+void osd_remove_text(struct osd_state *osd, int dxs, int dys,
+ void (*remove)(int x0, int y0, int w, int h))
+{
mp_osd_obj_t* obj=vo_osd_list;
- vo_update_osd(dxs,dys);
+ osd_update(osd, dxs, dys);
while(obj){
if(((obj->flags&OSDFLAG_CHANGED) || (obj->flags&OSDFLAG_VISIBLE)) &&
(obj->flags&OSDFLAG_OLD_BBOX)){
@@ -1252,17 +1267,24 @@ void vo_remove_text(int dxs,int dys,void (*remove)(int x0,int y0, int w,int h)){
}
}
-void vo_draw_text_ext(int dxs, int dys, int left_border, int top_border,
- int right_border, int bottom_border, int orig_w, int orig_h,
- void (*draw_alpha)(int x0, int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride)) {
+void osd_draw_text_ext(struct osd_state *osd, int dxs, int dys,
+ int left_border, int top_border, int right_border,
+ int bottom_border, int orig_w, int orig_h,
+ void (*draw_alpha)(void *ctx, int x0, int y0, int w,
+ int h, unsigned char* src,
+ unsigned char *srca,
+ int stride),
+ void *ctx)
+{
mp_osd_obj_t* obj=vo_osd_list;
- vo_update_osd_ext(dxs, dys, left_border, top_border, right_border, bottom_border, orig_w, orig_h);
+ osd_update_ext(osd, dxs, dys, left_border, top_border, right_border,
+ bottom_border, orig_w, orig_h);
while(obj){
if(obj->flags&OSDFLAG_VISIBLE){
vo_osd_changed_flag=obj->flags&OSDFLAG_CHANGED; // temp hack
switch(obj->type){
case OSDTYPE_SPU:
- vo_draw_spudec_sub(obj, draw_alpha); // FIXME
+ vo_draw_spudec_sub(obj, draw_alpha, ctx); // FIXME
break;
#ifdef CONFIG_DVDNAV
case OSDTYPE_DVDNAV:
@@ -1271,7 +1293,7 @@ void vo_draw_text_ext(int dxs, int dys, int left_border, int top_border,
case OSDTYPE_OSD:
case OSDTYPE_SUBTITLE:
case OSDTYPE_PROGBAR:
- vo_draw_text_from_buffer(obj,draw_alpha);
+ vo_draw_text_from_buffer(obj, draw_alpha, ctx);
break;
}
obj->old_bbox=obj->bbox;
@@ -1282,8 +1304,13 @@ void vo_draw_text_ext(int dxs, int dys, int left_border, int top_border,
}
}
-void vo_draw_text(int dxs, int dys, void (*draw_alpha)(int x0, int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride)) {
- vo_draw_text_ext(dxs, dys, 0, 0, 0, 0, dxs, dys, draw_alpha);
+void osd_draw_text(struct osd_state *osd, int dxs, int dys,
+ void (*draw_alpha)(void *ctx, int x0, int y0, int w, int h,
+ unsigned char* src, unsigned char *srca,
+ int stride),
+ void *ctx)
+{
+ osd_draw_text_ext(osd, dxs, dys, 0, 0, 0, 0, dxs, dys, draw_alpha, ctx);
}
static int vo_osd_changed_status = 0;
diff --git a/libvo/sub.h b/libvo/sub.h
index 978b4c940d..d5a30e0b86 100644
--- a/libvo/sub.h
+++ b/libvo/sub.h
@@ -66,14 +66,16 @@ typedef struct mp_osd_obj_s {
unsigned char *bitmap_buffer;
} mp_osd_obj_t;
+struct osd_state {
+ unsigned char osd_text[128];
+ struct font_desc *sub_font;
+};
#include "subreader.h"
extern sub_data* subdata; //currently used subtitles
extern subtitle* vo_sub;
-extern unsigned char* vo_osd_text;
-
extern void* vo_osd_teletext_page;
extern int vo_osd_teletext_half;
extern int vo_osd_teletext_mode;
@@ -105,8 +107,8 @@ extern void* vo_vobsub;
#define OSD_PB_1 0x13
/* now in textform */
-extern char * sub_osd_names[];
-extern char * sub_osd_names_short[];
+extern char * const sub_osd_names[];
+extern char * const sub_osd_names_short[];
extern int sub_unicode;
extern int sub_utf8;
@@ -122,17 +124,27 @@ extern int spu_alignment;
extern int spu_aamode;
extern float spu_gaussvar;
-void vo_draw_text(int dxs,int dys,void (*draw_alpha)(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride));
-void vo_draw_text_ext(int dxs, int dys, int left_border, int top_border,
- int right_border, int bottom_border, int orig_w, int orig_h,
- void (*draw_alpha)(int x0, int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride));
-void vo_remove_text(int dxs,int dys,void (*remove)(int x0,int y0, int w,int h));
-
-void vo_init_osd(void);
-int vo_update_osd(int dxs,int dys);
+void osd_draw_text(struct osd_state *osd, int dxs, int dys,
+ void (*draw_alpha)(void *ctx, int x0, int y0, int w, int h,
+ unsigned char* src, unsigned char *srca,
+ int stride),
+ void *ctx);
+void osd_draw_text_ext(struct osd_state *osd, int dxs, int dys,
+ int left_border, int top_border, int right_border,
+ int bottom_border, int orig_w, int orig_h,
+ void (*draw_alpha)(void *ctx, int x0, int y0, int w,
+ int h, unsigned char* src,
+ unsigned char *srca,
+ int stride),
+ void *ctx);
+void osd_remove_text(struct osd_state *osd, int dxs, int dys,
+ void (*remove)(int x0, int y0, int w, int h));
+
+struct osd_state *osd_create(void);
+int osd_update(struct osd_state *osd, int dxs, int dys);
int vo_osd_changed(int new_value);
int vo_osd_check_range_update(int,int,int,int);
-void free_osd_list(void);
+void osd_free(struct osd_state *osd);
extern int vo_osd_changed_flag;
@@ -143,4 +155,9 @@ unsigned utf8_get_char(const char **str);
void osd_set_nav_box (uint16_t sx, uint16_t sy, uint16_t ex, uint16_t ey);
#endif
+
+#ifdef IS_OLD_VO
+#define vo_remove_text(...) osd_remove_text(global_osd, __VA_ARGS__)
+#endif
+
#endif /* MPLAYER_SUB_H */
diff --git a/libvo/vdpau_template.c b/libvo/vdpau_template.c
new file mode 100644
index 0000000000..3f9b26c5d8
--- /dev/null
+++ b/libvo/vdpau_template.c
@@ -0,0 +1,42 @@
+
+/* List the VDPAU functions used by MPlayer.
+ * Generated by vdpau_functions.py.
+ * First argument on each line is the VDPAU function type name,
+ * second macro name needed to get function address,
+ * third name MPlayer uses for the function.
+ */
+
+VDP_FUNCTION(VdpGetErrorString, VDP_FUNC_ID_GET_ERROR_STRING, get_error_string)
+VDP_FUNCTION(VdpBitmapSurfaceCreate, VDP_FUNC_ID_BITMAP_SURFACE_CREATE, bitmap_surface_create)
+VDP_FUNCTION(VdpBitmapSurfaceDestroy, VDP_FUNC_ID_BITMAP_SURFACE_DESTROY, bitmap_surface_destroy)
+VDP_FUNCTION(VdpBitmapSurfacePutBitsNative, VDP_FUNC_ID_BITMAP_SURFACE_PUT_BITS_NATIVE, bitmap_surface_put_bits_native)
+VDP_FUNCTION(VdpBitmapSurfaceQueryCapabilities, VDP_FUNC_ID_BITMAP_SURFACE_QUERY_CAPABILITIES, bitmap_surface_query_capabilities)
+VDP_FUNCTION(VdpDecoderCreate, VDP_FUNC_ID_DECODER_CREATE, decoder_create)
+VDP_FUNCTION(VdpDecoderDestroy, VDP_FUNC_ID_DECODER_DESTROY, decoder_destroy)
+VDP_FUNCTION(VdpDecoderRender, VDP_FUNC_ID_DECODER_RENDER, decoder_render)
+VDP_FUNCTION(VdpDeviceDestroy, VDP_FUNC_ID_DEVICE_DESTROY, device_destroy)
+VDP_FUNCTION(VdpGenerateCSCMatrix, VDP_FUNC_ID_GENERATE_CSC_MATRIX, generate_csc_matrix)
+VDP_FUNCTION(VdpOutputSurfaceCreate, VDP_FUNC_ID_OUTPUT_SURFACE_CREATE, output_surface_create)
+VDP_FUNCTION(VdpOutputSurfaceDestroy, VDP_FUNC_ID_OUTPUT_SURFACE_DESTROY, output_surface_destroy)
+VDP_FUNCTION(VdpOutputSurfacePutBitsIndexed, VDP_FUNC_ID_OUTPUT_SURFACE_PUT_BITS_INDEXED, output_surface_put_bits_indexed)
+VDP_FUNCTION(VdpOutputSurfacePutBitsNative, VDP_FUNC_ID_OUTPUT_SURFACE_PUT_BITS_NATIVE, output_surface_put_bits_native)
+VDP_FUNCTION(VdpOutputSurfaceRenderBitmapSurface, VDP_FUNC_ID_OUTPUT_SURFACE_RENDER_BITMAP_SURFACE, output_surface_render_bitmap_surface)
+VDP_FUNCTION(VdpOutputSurfaceRenderOutputSurface, VDP_FUNC_ID_OUTPUT_SURFACE_RENDER_OUTPUT_SURFACE, output_surface_render_output_surface)
+VDP_FUNCTION(VdpPreemptionCallbackRegister, VDP_FUNC_ID_PREEMPTION_CALLBACK_REGISTER, preemption_callback_register)
+VDP_FUNCTION(VdpPresentationQueueBlockUntilSurfaceIdle, VDP_FUNC_ID_PRESENTATION_QUEUE_BLOCK_UNTIL_SURFACE_IDLE, presentation_queue_block_until_surface_idle)
+VDP_FUNCTION(VdpPresentationQueueCreate, VDP_FUNC_ID_PRESENTATION_QUEUE_CREATE, presentation_queue_create)
+VDP_FUNCTION(VdpPresentationQueueDestroy, VDP_FUNC_ID_PRESENTATION_QUEUE_DESTROY, presentation_queue_destroy)
+VDP_FUNCTION(VdpPresentationQueueDisplay, VDP_FUNC_ID_PRESENTATION_QUEUE_DISPLAY, presentation_queue_display)
+VDP_FUNCTION(VdpPresentationQueueGetTime, VDP_FUNC_ID_PRESENTATION_QUEUE_GET_TIME, presentation_queue_get_time)
+VDP_FUNCTION(VdpPresentationQueueQuerySurfaceStatus, VDP_FUNC_ID_PRESENTATION_QUEUE_QUERY_SURFACE_STATUS, presentation_queue_query_surface_status)
+VDP_FUNCTION(VdpPresentationQueueTargetCreateX11, VDP_FUNC_ID_PRESENTATION_QUEUE_TARGET_CREATE_X11, presentation_queue_target_create_x11)
+VDP_FUNCTION(VdpPresentationQueueTargetDestroy, VDP_FUNC_ID_PRESENTATION_QUEUE_TARGET_DESTROY, presentation_queue_target_destroy)
+VDP_FUNCTION(VdpVideoMixerCreate, VDP_FUNC_ID_VIDEO_MIXER_CREATE, video_mixer_create)
+VDP_FUNCTION(VdpVideoMixerDestroy, VDP_FUNC_ID_VIDEO_MIXER_DESTROY, video_mixer_destroy)
+VDP_FUNCTION(VdpVideoMixerQueryFeatureSupport, VDP_FUNC_ID_VIDEO_MIXER_QUERY_FEATURE_SUPPORT, video_mixer_query_feature_support)
+VDP_FUNCTION(VdpVideoMixerRender, VDP_FUNC_ID_VIDEO_MIXER_RENDER, video_mixer_render)
+VDP_FUNCTION(VdpVideoMixerSetAttributeValues, VDP_FUNC_ID_VIDEO_MIXER_SET_ATTRIBUTE_VALUES, video_mixer_set_attribute_values)
+VDP_FUNCTION(VdpVideoMixerSetFeatureEnables, VDP_FUNC_ID_VIDEO_MIXER_SET_FEATURE_ENABLES, video_mixer_set_feature_enables)
+VDP_FUNCTION(VdpVideoSurfaceCreate, VDP_FUNC_ID_VIDEO_SURFACE_CREATE, video_surface_create)
+VDP_FUNCTION(VdpVideoSurfaceDestroy, VDP_FUNC_ID_VIDEO_SURFACE_DESTROY, video_surface_destroy)
+VDP_FUNCTION(VdpVideoSurfacePutBitsYCbCr, VDP_FUNC_ID_VIDEO_SURFACE_PUT_BITS_Y_CB_CR, video_surface_put_bits_y_cb_cr)
diff --git a/libvo/vesa_lvo.c b/libvo/vesa_lvo.c
index a7b1120ceb..27ce03c63b 100644
--- a/libvo/vesa_lvo.c
+++ b/libvo/vesa_lvo.c
@@ -54,24 +54,24 @@ static uint8_t *lvo_mem = NULL;
static uint8_t next_frame;
static mga_vid_config_t mga_vid_config;
static unsigned image_bpp,image_height,image_width,src_format;
-uint32_t vlvo_control(uint32_t request, void *data, ...);
+int vlvo_control(uint32_t request, void *data);
#define PIXEL_SIZE() ((video_mode_info.BitsPerPixel+7)/8)
#define SCREEN_LINE_SIZE(pixel_size) (video_mode_info.XResolution*(pixel_size) )
#define IMAGE_LINE_SIZE(pixel_size) (image_width*(pixel_size))
-extern vo_functions_t video_out_vesa;
+extern struct vo_old_functions video_out_vesa;
int vlvo_preinit(const char *drvname)
{
- mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_VESA_ThisBranchIsNoLongerSupported);
+ mp_tmsg(MSGT_VO,MSGL_WARN, "[VESA_LVO] This branch is no longer supported.\n[VESA_LVO] Please use -vo vesa:vidix instead.\n");
return -1;
if( mp_msg_test(MSGT_VO,MSGL_DBG2) ) {
mp_msg(MSGT_VO,MSGL_DBG2, "vesa_lvo: vlvo_preinit(%s) was called\n",drvname);}
lvo_handler = open(drvname,O_RDWR);
if(lvo_handler == -1)
{
- mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_VESA_CouldntOpen,drvname);
+ mp_tmsg(MSGT_VO,MSGL_WARN, "[VESA_LVO] Couldn't open: '%s'\n",drvname);
return -1;
}
/* we are able to tune up this stuff depend on fourcc format */
@@ -88,7 +88,7 @@ int vlvo_init(unsigned src_width,unsigned src_height,
unsigned dst_height,unsigned format,unsigned dest_bpp)
{
size_t i,awidth;
- mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_VESA_ThisBranchIsNoLongerSupported);
+ mp_tmsg(MSGT_VO,MSGL_WARN, "[VESA_LVO] This branch is no longer supported.\n[VESA_LVO] Please use -vo vesa:vidix instead.\n");
return -1;
if( mp_msg_test(MSGT_VO,MSGL_DBG2) ) {
mp_msg(MSGT_VO,MSGL_DBG2, "vesa_lvo: vlvo_init() was called\n");}
@@ -127,7 +127,7 @@ int vlvo_init(unsigned src_width,unsigned src_height,
mga_vid_config.frame_size = awidth*src_height*4;
break;
default:
- mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_VESA_InvalidOutputFormat,vo_format_name(format),format);
+ mp_tmsg(MSGT_VO,MSGL_WARN, "[VESA_LVI] Invalid output format: %s(%0X)\n",vo_format_name(format),format);
return -1;
}
mga_vid_config.colkey_on=0;
@@ -141,7 +141,7 @@ int vlvo_init(unsigned src_width,unsigned src_height,
if (ioctl(lvo_handler,MGA_VID_CONFIG,&mga_vid_config))
{
perror("vesa_lvo: Error in mga_vid_config ioctl()");
- mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_VESA_IncompatibleDriverVersion);
+ mp_tmsg(MSGT_VO,MSGL_WARN, "[VESA_LVO] Your fb_vid driver version is incompatible with this MPlayer version!\n");
return -1;
}
ioctl(lvo_handler,MGA_VID_ON,0);
@@ -166,7 +166,7 @@ void vlvo_term( void )
if(lvo_handler != -1) close(lvo_handler);
}
-uint32_t vlvo_draw_slice_420(uint8_t *image[], int stride[], int w,int h,int x,int y)
+int vlvo_draw_slice_420(uint8_t *image[], int stride[], int w,int h,int x,int y)
{
uint8_t *src;
uint8_t *dest;
@@ -206,7 +206,7 @@ uint32_t vlvo_draw_slice_420(uint8_t *image[], int stride[], int w,int h,int x,i
return 0;
}
-uint32_t vlvo_draw_slice(uint8_t *image[], int stride[], int w,int h,int x,int y)
+int vlvo_draw_slice(uint8_t *image[], int stride[], int w,int h,int x,int y)
{
if( mp_msg_test(MSGT_VO,MSGL_DBG2) ) {
mp_msg(MSGT_VO,MSGL_DBG2, "vesa_lvo: vlvo_draw_slice() was called\n");}
@@ -224,7 +224,7 @@ uint32_t vlvo_draw_slice(uint8_t *image[], int stride[], int w,int h,int x,int y
return 0;
}
-uint32_t vlvo_draw_frame(uint8_t *image[])
+int vlvo_draw_frame(uint8_t *image[])
{
/* Note it's very strange but sometime for YUY2 draw_frame is called */
fast_memcpy(lvo_mem,image[0],mga_vid_config.frame_size);
@@ -314,7 +314,7 @@ uint32_t vlvo_query_info(uint32_t format)
return VFCAP_CSP_SUPPORTED;
}
-uint32_t vlvo_control(uint32_t request, void *data, ...)
+int vlvo_control(uint32_t request, void *data)
{
switch (request) {
case VOCTRL_QUERY_FORMAT:
diff --git a/libvo/vesa_lvo.h b/libvo/vesa_lvo.h
index 1e7887c8ae..9d77f60045 100644
--- a/libvo/vesa_lvo.h
+++ b/libvo/vesa_lvo.h
@@ -32,8 +32,8 @@ int vlvo_init(unsigned src_width,unsigned src_height,
void vlvo_term( void );
uint32_t vlvo_query_info(uint32_t format);
-uint32_t vlvo_draw_slice(uint8_t *image[], int stride[], int w,int h,int x,int y);
-uint32_t vlvo_draw_frame(uint8_t *src[]);
+int vlvo_draw_slice(uint8_t *image[], int stride[], int w,int h,int x,int y);
+int vlvo_draw_frame(uint8_t *src[]);
void vlvo_flip_page(void);
void vlvo_draw_osd(void);
diff --git a/libvo/video_out.c b/libvo/video_out.c
index 6db664af40..f8d857dfc5 100644
--- a/libvo/video_out.c
+++ b/libvo/video_out.c
@@ -21,40 +21,32 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <assert.h>
+#include <stdbool.h>
#include <unistd.h>
//#include <sys/mman.h>
#include "config.h"
+#include "options.h"
+#include "talloc.h"
#include "video_out.h"
#include "aspect.h"
#include "geometry.h"
+#include "old_vo_wrapper.h"
#include "mp_msg.h"
#include "help_mp.h"
#include "osdep/shmem.h"
-
-//int vo_flags=0;
+#ifdef CONFIG_X11
+#include "x11_common.h"
+#endif
int xinerama_screen = -1;
int xinerama_x;
int xinerama_y;
-// currect resolution/bpp on screen: (should be autodetected by vo_init())
-int vo_depthonscreen=0;
-int vo_screenwidth=0;
-int vo_screenheight=0;
-
-int vo_config_count=0;
-
-// requested resolution/bpp: (-x -y -bpp options)
-int vo_dx=0;
-int vo_dy=0;
-int vo_dwidth=0;
-int vo_dheight=0;
-int vo_dbpp=0;
-
int vo_nomouse_input = 0;
int vo_grabpointer = 1;
int vo_doublebuffering = 1;
@@ -62,7 +54,6 @@ int vo_vsync = 0;
int vo_fs = 0;
int vo_fsmode = 0;
float vo_panscan = 0.0f;
-int vo_ontop = 0;
int vo_adapter_num=0;
int vo_refresh_rate=0;
int vo_keepaspect=1;
@@ -87,59 +78,59 @@ char *vo_wintitle;
//
// Externally visible list of all vo drivers
//
-extern vo_functions_t video_out_mga;
-extern vo_functions_t video_out_xmga;
-extern vo_functions_t video_out_x11;
-extern vo_functions_t video_out_xover;
-extern vo_functions_t video_out_xvmc;
-extern vo_functions_t video_out_vdpau;
-extern vo_functions_t video_out_xv;
-extern vo_functions_t video_out_gl;
-extern vo_functions_t video_out_gl2;
-extern vo_functions_t video_out_matrixview;
-extern vo_functions_t video_out_dga;
-extern vo_functions_t video_out_sdl;
-extern vo_functions_t video_out_3dfx;
-extern vo_functions_t video_out_tdfxfb;
-extern vo_functions_t video_out_s3fb;
-extern vo_functions_t video_out_wii;
-extern vo_functions_t video_out_null;
-extern vo_functions_t video_out_zr;
-extern vo_functions_t video_out_zr2;
-extern vo_functions_t video_out_bl;
-extern vo_functions_t video_out_fbdev;
-extern vo_functions_t video_out_fbdev2;
-extern vo_functions_t video_out_svga;
-extern vo_functions_t video_out_png;
-extern vo_functions_t video_out_ggi;
-extern vo_functions_t video_out_aa;
-extern vo_functions_t video_out_caca;
-extern vo_functions_t video_out_mpegpes;
-extern vo_functions_t video_out_yuv4mpeg;
-extern vo_functions_t video_out_direct3d;
-extern vo_functions_t video_out_directx;
-extern vo_functions_t video_out_kva;
-extern vo_functions_t video_out_dxr2;
-extern vo_functions_t video_out_dxr3;
-extern vo_functions_t video_out_ivtv;
-extern vo_functions_t video_out_v4l2;
-extern vo_functions_t video_out_jpeg;
-extern vo_functions_t video_out_gif89a;
-extern vo_functions_t video_out_vesa;
-extern vo_functions_t video_out_directfb;
-extern vo_functions_t video_out_dfbmga;
-extern vo_functions_t video_out_xvidix;
-extern vo_functions_t video_out_winvidix;
-extern vo_functions_t video_out_cvidix;
-extern vo_functions_t video_out_tdfx_vid;
-extern vo_functions_t video_out_xvr100;
-extern vo_functions_t video_out_tga;
-extern vo_functions_t video_out_corevideo;
-extern vo_functions_t video_out_quartz;
-extern vo_functions_t video_out_pnm;
-extern vo_functions_t video_out_md5sum;
-
-const vo_functions_t* const video_out_drivers[] =
+extern struct vo_driver video_out_mga;
+extern struct vo_driver video_out_xmga;
+extern struct vo_driver video_out_x11;
+extern struct vo_driver video_out_xover;
+extern struct vo_driver video_out_xvmc;
+extern struct vo_driver video_out_vdpau;
+extern struct vo_driver video_out_xv;
+extern struct vo_driver video_out_gl;
+extern struct vo_driver video_out_gl2;
+extern struct vo_driver video_out_matrixview;
+extern struct vo_driver video_out_dga;
+extern struct vo_driver video_out_sdl;
+extern struct vo_driver video_out_3dfx;
+extern struct vo_driver video_out_tdfxfb;
+extern struct vo_driver video_out_s3fb;
+extern struct vo_driver video_out_wii;
+extern struct vo_driver video_out_null;
+extern struct vo_driver video_out_zr;
+extern struct vo_driver video_out_zr2;
+extern struct vo_driver video_out_bl;
+extern struct vo_driver video_out_fbdev;
+extern struct vo_driver video_out_fbdev2;
+extern struct vo_driver video_out_svga;
+extern struct vo_driver video_out_png;
+extern struct vo_driver video_out_ggi;
+extern struct vo_driver video_out_aa;
+extern struct vo_driver video_out_caca;
+extern struct vo_driver video_out_mpegpes;
+extern struct vo_driver video_out_yuv4mpeg;
+extern struct vo_driver video_out_direct3d;
+extern struct vo_driver video_out_directx;
+extern struct vo_driver video_out_kva;
+extern struct vo_driver video_out_dxr2;
+extern struct vo_driver video_out_dxr3;
+extern struct vo_driver video_out_ivtv;
+extern struct vo_driver video_out_v4l2;
+extern struct vo_driver video_out_jpeg;
+extern struct vo_driver video_out_gif89a;
+extern struct vo_driver video_out_vesa;
+extern struct vo_driver video_out_directfb;
+extern struct vo_driver video_out_dfbmga;
+extern struct vo_driver video_out_xvidix;
+extern struct vo_driver video_out_winvidix;
+extern struct vo_driver video_out_cvidix;
+extern struct vo_driver video_out_tdfx_vid;
+extern struct vo_driver video_out_xvr100;
+extern struct vo_driver video_out_tga;
+extern struct vo_driver video_out_corevideo;
+extern struct vo_driver video_out_quartz;
+extern struct vo_driver video_out_pnm;
+extern struct vo_driver video_out_md5sum;
+
+const struct vo_driver *video_out_drivers[] =
{
#ifdef CONFIG_XVR100
&video_out_xvr100,
@@ -241,9 +232,6 @@ const vo_functions_t* const video_out_drivers[] =
#ifdef CONFIG_VESA
&video_out_vesa,
#endif
-#ifdef CONFIG_DIRECTFB
- &video_out_directfb,
-#endif
#ifdef CONFIG_DFBMGA
&video_out_dfbmga,
#endif
@@ -258,6 +246,10 @@ const vo_functions_t* const video_out_drivers[] =
#endif
&video_out_null,
// should not be auto-selected
+#ifdef CONFIG_DIRECTFB
+ // vo directfb can call exit() if initialization fails
+ &video_out_directfb,
+#endif
#if CONFIG_XVMC
&video_out_xvmc,
#endif
@@ -286,79 +278,195 @@ const vo_functions_t* const video_out_drivers[] =
NULL
};
-void list_video_out(void){
- int i=0;
- mp_msg(MSGT_CPLAYER, MSGL_INFO, MSGTR_AvailableVideoOutputDrivers);
- mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_VIDEO_OUTPUTS\n");
- while (video_out_drivers[i]) {
+
+static int vo_preinit(struct vo *vo, const char *arg)
+{
+ return vo->driver->preinit(vo, arg);
+}
+
+int vo_control(struct vo *vo, uint32_t request, void *data)
+{
+ return vo->driver->control(vo, request, data);
+}
+
+// Return -1 if driver appears not to support a draw_image interface,
+// 0 otherwise (whether the driver actually drew something or not).
+int vo_draw_image(struct vo *vo, struct mp_image *mpi, double pts)
+{
+ if (!vo->config_ok)
+ return 0;
+ if (vo->driver->buffer_frames) {
+ vo->driver->draw_image(vo, mpi, pts);
+ return 0;
+ }
+ vo->frame_loaded = true;
+ vo->next_pts = pts;
+ if (vo_control(vo, VOCTRL_DRAW_IMAGE, mpi) == VO_NOTIMPL)
+ return -1;
+ return 0;
+}
+
+int vo_get_buffered_frame(struct vo *vo, bool eof)
+{
+ if (!vo->config_ok)
+ return -1;
+ if (vo->frame_loaded)
+ return 0;
+ if (!vo->driver->buffer_frames)
+ return -1;
+ vo->driver->get_buffered_frame(vo, eof);
+ return vo->frame_loaded ? 0 : -1;
+}
+
+int vo_draw_frame(struct vo *vo, uint8_t *src[])
+{
+ assert(!vo->driver->is_new);
+ if (!vo->config_ok)
+ return 0;
+ return old_vo_draw_frame(vo, src);
+}
+
+int vo_draw_slice(struct vo *vo, uint8_t *src[], int stride[], int w, int h, int x, int y)
+{
+ return vo->driver->draw_slice(vo, src, stride, w, h, x, y);
+}
+
+void vo_draw_osd(struct vo *vo, struct osd_state *osd)
+{
+ if (!vo->config_ok)
+ return;
+ vo->driver->draw_osd(vo, osd);
+}
+
+void vo_flip_page(struct vo *vo, unsigned int pts_us, int duration)
+{
+ if (!vo->config_ok)
+ return;
+ vo->frame_loaded = false;
+ vo->next_pts = MP_NOPTS_VALUE;
+ if (vo->driver->flip_page_timed)
+ vo->driver->flip_page_timed(vo, pts_us, duration);
+ else
+ vo->driver->flip_page(vo);
+}
+
+void vo_check_events(struct vo *vo)
+{
+ if (!vo->config_ok)
+ return;
+ vo->driver->check_events(vo);
+}
+
+void vo_seek_reset(struct vo *vo)
+{
+ vo_control(vo, VOCTRL_RESET, NULL);
+ vo->frame_loaded = false;
+}
+
+void vo_destroy(struct vo *vo)
+{
+ vo->driver->uninit(vo);
+ talloc_free(vo);
+}
+
+void list_video_out(void)
+{
+ int i = 0;
+ mp_tmsg(MSGT_CPLAYER, MSGL_INFO, "Available video output drivers:\n");
+ mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_VIDEO_OUTPUTS\n");
+ while (video_out_drivers[i]) {
const vo_info_t *info = video_out_drivers[i++]->info;
mp_msg(MSGT_GLOBAL, MSGL_INFO,"\t%s\t%s\n", info->short_name, info->name);
- }
- mp_msg(MSGT_GLOBAL, MSGL_INFO,"\n");
+ }
+ mp_msg(MSGT_GLOBAL, MSGL_INFO,"\n");
}
-const vo_functions_t* init_best_video_out(char** vo_list){
+struct vo *init_best_video_out(struct MPOpts *opts, struct vo_x11_state *x11,
+ struct mp_fifo *key_fifo,
+ struct input_ctx *input_ctx)
+{
+ char **vo_list = opts->video_driver_list;
int i;
+ struct vo *vo = talloc_ptrtype(NULL, vo);
+ struct vo initial_values = {
+ .opts = opts,
+ .x11 = x11,
+ .key_fifo = key_fifo,
+ .input_ctx = input_ctx,
+ };
// first try the preferred drivers, with their optional subdevice param:
- if(vo_list && vo_list[0])
- while(vo_list[0][0]){
- char* vo=strdup(vo_list[0]);
- vo_subdevice=strchr(vo,':');
- if (!strcmp(vo, "pgm"))
- mp_msg(MSGT_CPLAYER, MSGL_ERR, MSGTR_VO_PGM_HasBeenReplaced);
- if (!strcmp(vo, "md5"))
- mp_msg(MSGT_CPLAYER, MSGL_ERR, MSGTR_VO_MD5_HasBeenReplaced);
- if(vo_subdevice){
- vo_subdevice[0]=0;
- ++vo_subdevice;
- }
- for(i=0;video_out_drivers[i];i++){
- const vo_functions_t* video_driver=video_out_drivers[i];
- const vo_info_t *info = video_driver->info;
- if(!strcmp(info->short_name,vo)){
- // name matches, try it
- if(!video_driver->preinit(vo_subdevice))
- {
- free(vo);
- return video_driver; // success!
+ if (vo_list && vo_list[0])
+ while (vo_list[0][0]) {
+ char *name = strdup(vo_list[0]);
+ vo_subdevice = strchr(name,':');
+ if (!strcmp(name, "pgm"))
+ mp_tmsg(MSGT_CPLAYER, MSGL_ERR, "The pgm video output driver has been replaced by -vo pnm:pgmyuv.\n");
+ if (!strcmp(name, "md5"))
+ mp_tmsg(MSGT_CPLAYER, MSGL_ERR, "The md5 video output driver has been replaced by -vo md5sum.\n");
+ if (vo_subdevice) {
+ vo_subdevice[0] = 0;
+ ++vo_subdevice;
+ }
+ for (i = 0; video_out_drivers[i]; i++) {
+ const struct vo_driver *video_driver = video_out_drivers[i];
+ const vo_info_t *info = video_driver->info;
+ if (!strcmp(info->short_name, name)) {
+ // name matches, try it
+ *vo = initial_values;
+ vo->driver = video_driver;
+ if (!vo_preinit(vo, vo_subdevice)) {
+ free(name);
+ return vo; // success!
+ }
+ talloc_free_children(vo);
}
}
+ // continue...
+ free(name);
+ ++vo_list;
+ if (!(vo_list[0]))
+ return NULL; // do NOT fallback to others
}
- // continue...
- free(vo);
- ++vo_list;
- if(!(vo_list[0])) return NULL; // do NOT fallback to others
- }
// now try the rest...
- vo_subdevice=NULL;
- for(i=0;video_out_drivers[i];i++){
- const vo_functions_t* video_driver=video_out_drivers[i];
- if(!video_driver->preinit(vo_subdevice))
- return video_driver; // success!
+ vo_subdevice = NULL;
+ for (i = 0; video_out_drivers[i]; i++) {
+ const struct vo_driver *video_driver = video_out_drivers[i];
+ *vo = initial_values;
+ vo->driver = video_driver;
+ if (!vo_preinit(vo, vo_subdevice))
+ return vo; // success!
+ talloc_free_children(vo);
}
+ free(vo);
return NULL;
}
-int config_video_out(const vo_functions_t *vo, uint32_t width, uint32_t height,
+int vo_config(struct vo *vo, uint32_t width, uint32_t height,
uint32_t d_width, uint32_t d_height, uint32_t flags,
- char *title, uint32_t format) {
- panscan_init();
- aspect_save_orig(width,height);
- aspect_save_prescale(d_width,d_height);
-
- if (vo->control(VOCTRL_UPDATE_SCREENINFO, NULL) == VO_TRUE) {
- aspect(&d_width,&d_height,A_NOZOOM);
- vo_dx = (int)(vo_screenwidth - d_width) / 2;
- vo_dy = (int)(vo_screenheight - d_height) / 2;
- geometry(&vo_dx, &vo_dy, &d_width, &d_height,
- vo_screenwidth, vo_screenheight);
- vo_dx += xinerama_x;
- vo_dy += xinerama_y;
- vo_dwidth = d_width;
- vo_dheight = d_height;
- }
+ char *title, uint32_t format)
+{
+ struct MPOpts *opts = vo->opts;
+ panscan_init(vo);
+ aspect_save_orig(vo, width, height);
+ aspect_save_prescale(vo, d_width, d_height);
+
+ if (vo_control(vo, VOCTRL_UPDATE_SCREENINFO, NULL) == VO_TRUE) {
+ aspect(vo, &d_width, &d_height, A_NOZOOM);
+ vo->dx = (int)(opts->vo_screenwidth - d_width) / 2;
+ vo->dy = (int)(opts->vo_screenheight - d_height) / 2;
+ geometry(&vo->dx, &vo->dy, &d_width, &d_height,
+ opts->vo_screenwidth, opts->vo_screenheight);
+ vo->dx += xinerama_x;
+ vo->dy += xinerama_y;
+ vo->dwidth = d_width;
+ vo->dheight = d_height;
+ }
- return vo->config(width, height, d_width, d_height, flags, title, format);
+ int ret = vo->driver->config(vo, width, height, d_width, d_height, flags,
+ title, format);
+ vo->config_ok = (ret == 0);
+ vo->config_count += vo->config_ok;
+ return ret;
}
/**
@@ -403,8 +511,10 @@ static void src_dst_split_scaling(int src_size, int dst_size, int scaled_src_siz
* \param borders the border values as e.g. EOSD (ASS) and properly placed DVD highlight support requires,
* may be NULL and only left and top are currently valid.
*/
-void calc_src_dst_rects(int src_width, int src_height, struct vo_rect *src, struct vo_rect *dst,
- struct vo_rect *borders, const struct vo_rect *crop) {
+void calc_src_dst_rects(struct vo *vo, int src_width, int src_height,
+ struct vo_rect *src, struct vo_rect *dst,
+ struct vo_rect *borders, const struct vo_rect *crop)
+{
static const struct vo_rect no_crop = {0, 0, 0, 0, 0, 0};
int scaled_width = 0;
int scaled_height = 0;
@@ -413,25 +523,25 @@ void calc_src_dst_rects(int src_width, int src_height, struct vo_rect *src, stru
src_height -= crop->top + crop->bottom;
if (src_width < 2) src_width = 2;
if (src_height < 2) src_height = 2;
- dst->left = 0; dst->right = vo_dwidth;
- dst->top = 0; dst->bottom = vo_dheight;
+ dst->left = 0; dst->right = vo->dwidth;
+ dst->top = 0; dst->bottom = vo->dheight;
src->left = 0; src->right = src_width;
src->top = 0; src->bottom = src_height;
if (borders) {
borders->left = 0; borders->top = 0;
}
if (aspect_scaling()) {
- aspect(&scaled_width, &scaled_height, A_WINZOOM);
- panscan_calc_windowed();
- scaled_width += vo_panscan_x;
- scaled_height += vo_panscan_y;
+ aspect(vo, &scaled_width, &scaled_height, A_WINZOOM);
+ panscan_calc_windowed(vo);
+ scaled_width += vo->panscan_x;
+ scaled_height += vo->panscan_y;
if (borders) {
- borders->left = (vo_dwidth - scaled_width ) / 2;
- borders->top = (vo_dheight - scaled_height) / 2;
+ borders->left = (vo->dwidth - scaled_width ) / 2;
+ borders->top = (vo->dheight - scaled_height) / 2;
}
- src_dst_split_scaling(src_width, vo_dwidth, scaled_width,
+ src_dst_split_scaling(src_width, vo->dwidth, scaled_width,
&src->left, &src->right, &dst->left, &dst->right);
- src_dst_split_scaling(src_height, vo_dheight, scaled_height,
+ src_dst_split_scaling(src_height, vo->dheight, scaled_height,
&src->top, &src->bottom, &dst->top, &dst->bottom);
}
src->left += crop->left; src->right += crop->left;
@@ -523,4 +633,3 @@ out_err:
/* Borrowed from vo_fbdev.c END */
#endif
-
diff --git a/libvo/video_out.h b/libvo/video_out.h
index b9380fadf1..697cc4e0d5 100644
--- a/libvo/video_out.h
+++ b/libvo/video_out.h
@@ -24,12 +24,14 @@
#define MPLAYER_VIDEO_OUT_H
#include <inttypes.h>
-#include <stdarg.h>
+#include <stdbool.h>
//#include "font_load.h"
#include "libmpcodecs/img_format.h"
//#include "vidix/vidix.h"
+#define MP_NOPTS_VALUE (-1LL<<63)
+
#define VO_EVENT_EXPOSE 1
#define VO_EVENT_RESIZE 2
#define VO_EVENT_KEYPRESS 4
@@ -39,9 +41,6 @@
#define VOCTRL_QUERY_FORMAT 2
/* signal a device reset seek */
#define VOCTRL_RESET 3
-/* true if vo driver can use GUI created windows */
-#define VOCTRL_GUISUPPORT 4
-#define VOCTRL_GUI_NOWINDOW 19
/* used to switch to fullscreen */
#define VOCTRL_FULLSCREEN 5
/* signal a device pause */
@@ -60,8 +59,15 @@
#define VOCTRL_SET_PANSCAN 16
/* equalizer controls */
#define VOCTRL_SET_EQUALIZER 17
+struct voctrl_set_equalizer_args {
+ const char *name;
+ int value;
+};
#define VOCTRL_GET_EQUALIZER 18
-//#define VOCTRL_GUI_NOWINDOW 19
+struct voctrl_get_equalizer_args {
+ const char *name;
+ int *valueptr;
+};
/* Frame duplication */
#define VOCTRL_DUPLICATE_FRAME 20
// ... 21
@@ -74,7 +80,6 @@
#define VOCTRL_GET_EOSD_RES 29
typedef struct {
int w, h; // screen dimensions, including black borders
- int srcw, srch; // unscaled source dimensions
int mt, mb, ml, mr; // borders (top, bottom, left, right)
} mp_eosd_res_t;
@@ -83,6 +88,9 @@ typedef struct {
#define VOCTRL_UPDATE_SCREENINFO 32
+#define VOCTRL_SET_YUV_COLORSPACE 33
+#define VOCTRL_GET_YUV_COLORSPACE 34
+
// Vo can be used by xover
#define VOCTRL_XOVERLAY_SUPPORT 22
@@ -93,6 +101,8 @@ typedef struct {
} mp_colorkey_t;
#define VOCTRL_XOVERLAY_SET_WIN 23
+#define VOCTRL_REDRAW_OSD 24
+
typedef struct {
int x,y;
int w,h;
@@ -112,113 +122,180 @@ typedef struct {
typedef struct vo_info_s
{
- /* driver name ("Matrox Millennium G200/G400" */
- const char *name;
- /* short name (for config strings) ("mga") */
- const char *short_name;
- /* author ("Aaron Holtzman <aholtzma@ess.engr.uvic.ca>") */
- const char *author;
- /* any additional comments */
- const char *comment;
+ /* driver name ("Matrox Millennium G200/G400" */
+ const char *name;
+ /* short name (for config strings) ("mga") */
+ const char *short_name;
+ /* author ("Aaron Holtzman <aholtzma@ess.engr.uvic.ca>") */
+ const char *author;
+ /* any additional comments */
+ const char *comment;
} vo_info_t;
-typedef struct vo_functions_s
-{
- const vo_info_t *info;
- /*
- * Preinitializes driver (real INITIALIZATION)
- * arg - currently it's vo_subdevice
- * returns: zero on successful initialization, non-zero on error.
- */
- int (*preinit)(const char *arg);
- /*
- * Initialize (means CONFIGURE) the display driver.
- * params:
- * width,height: image source size
- * d_width,d_height: size of the requested window size, just a hint
- * fullscreen: flag, 0=windowd 1=fullscreen, just a hint
- * title: window title, if available
- * format: fourcc of pixel format
- * returns : zero on successful initialization, non-zero on error.
- */
- int (*config)(uint32_t width, uint32_t height, uint32_t d_width,
- uint32_t d_height, uint32_t fullscreen, char *title,
- uint32_t format);
-
- /*
- * Control interface
- */
- int (*control)(uint32_t request, void *data, ...);
-
- /*
- * Display a new RGB/BGR frame of the video to the screen.
- * params:
- * src[0] - pointer to the image
- */
- int (*draw_frame)(uint8_t *src[]);
-
- /*
- * Draw a planar YUV slice to the buffer:
- * params:
- * src[3] = source image planes (Y,U,V)
- * stride[3] = source image planes line widths (in bytes)
- * w,h = width*height of area to be copied (in Y pixels)
- * x,y = position at the destination image (in Y pixels)
- */
- int (*draw_slice)(uint8_t *src[], int stride[], int w,int h, int x,int y);
-
- /*
- * Draws OSD to the screen buffer
- */
- void (*draw_osd)(void);
-
- /*
- * Blit/Flip buffer to the screen. Must be called after each frame!
- */
- void (*flip_page)(void);
-
- /*
- * This func is called after every frames to handle keyboard and
- * other events. It's called in PAUSE mode too!
- */
- void (*check_events)(void);
-
- /*
- * Closes driver. Should restore the original state of the system.
- */
- void (*uninit)(void);
-
-} vo_functions_t;
-
-const vo_functions_t* init_best_video_out(char** vo_list);
-int config_video_out(const vo_functions_t *vo, uint32_t width, uint32_t height,
+struct vo;
+struct osd_state;
+struct mp_image;
+
+struct vo_driver {
+ // Driver uses new API
+ bool is_new;
+ // Driver buffers or adds (deinterlace) frames and will keep track
+ // of pts values itself
+ bool buffer_frames;
+
+ // This is set if the driver is not new and contains pointers to
+ // old-API functions to be used instead of the ones below.
+ struct vo_old_functions *old_functions;
+
+ const vo_info_t *info;
+ /*
+ * Preinitializes driver (real INITIALIZATION)
+ * arg - currently it's vo_subdevice
+ * returns: zero on successful initialization, non-zero on error.
+ */
+ int (*preinit)(struct vo *vo, const char *arg);
+ /*
+ * Initialize (means CONFIGURE) the display driver.
+ * params:
+ * width,height: image source size
+ * d_width,d_height: size of the requested window size, just a hint
+ * fullscreen: flag, 0=windowd 1=fullscreen, just a hint
+ * title: window title, if available
+ * format: fourcc of pixel format
+ * returns : zero on successful initialization, non-zero on error.
+ */
+ int (*config)(struct vo *vo, uint32_t width, uint32_t height,
+ uint32_t d_width, uint32_t d_height, uint32_t fullscreen,
+ char *title, uint32_t format);
+
+ /*
+ * Control interface
+ */
+ int (*control)(struct vo *vo, uint32_t request, void *data);
+
+ void (*draw_image)(struct vo *vo, struct mp_image *mpi, double pts);
+
+ /*
+ * Get extra frames from the VO, such as those added by VDPAU
+ * deinterlace. Preparing the next such frame if any could be done
+ * automatically by the VO after a previous flip_page(), but having
+ * it as a separate step seems to allow making code more robust.
+ */
+ void (*get_buffered_frame)(struct vo *vo, bool eof);
+
+ /*
+ * Draw a planar YUV slice to the buffer:
+ * params:
+ * src[3] = source image planes (Y,U,V)
+ * stride[3] = source image planes line widths (in bytes)
+ * w,h = width*height of area to be copied (in Y pixels)
+ * x,y = position at the destination image (in Y pixels)
+ */
+ int (*draw_slice)(struct vo *vo, uint8_t *src[], int stride[], int w,
+ int h, int x, int y);
+
+ /*
+ * Draws OSD to the screen buffer
+ */
+ void (*draw_osd)(struct vo *vo, struct osd_state *osd);
+
+ /*
+ * Blit/Flip buffer to the screen. Must be called after each frame!
+ */
+ void (*flip_page)(struct vo *vo);
+ void (*flip_page_timed)(struct vo *vo, unsigned int pts_us, int duration);
+
+ /*
+ * This func is called after every frames to handle keyboard and
+ * other events. It's called in PAUSE mode too!
+ */
+ void (*check_events)(struct vo *vo);
+
+ /*
+ * Closes driver. Should restore the original state of the system.
+ */
+ void (*uninit)(struct vo *vo);
+};
+
+struct vo_old_functions {
+ int (*preinit)(const char *arg);
+ int (*config)(uint32_t width, uint32_t height, uint32_t d_width,
+ uint32_t d_height, uint32_t fullscreen, char *title,
+ uint32_t format);
+ int (*control)(uint32_t request, void *data);
+ int (*draw_frame)(uint8_t *src[]);
+ int (*draw_slice)(uint8_t *src[], int stride[], int w,int h, int x,int y);
+ void (*draw_osd)(void);
+ void (*flip_page)(void);
+ void (*check_events)(void);
+ void (*uninit)(void);
+};
+
+struct vo {
+ int config_ok; // Last config call was successful?
+ int config_count; // Total number of successful config calls
+
+ bool frame_loaded; // Is there a next frame the VO could flip to?
+ double next_pts; // pts value of the next frame if any
+ double next_pts2; // optional pts of frame after that
+
+ double flip_queue_offset; // queue flip events at most this much in advance
+
+ const struct vo_driver *driver;
+ void *priv;
+ struct MPOpts *opts;
+ struct vo_x11_state *x11;
+ struct mp_fifo *key_fifo;
+ struct input_ctx *input_ctx;
+
+ // requested position/resolution
+ int dx;
+ int dy;
+ int dwidth;
+ int dheight;
+
+ int panscan_x;
+ int panscan_y;
+ float panscan_amount;
+ float monitor_aspect;
+ struct aspect_data {
+ int orgw; // real width
+ int orgh; // real height
+ int prew; // prescaled width
+ int preh; // prescaled height
+ int scrw; // horizontal resolution
+ int scrh; // vertical resolution
+ float asp;
+ } aspdat;
+};
+
+struct vo *init_best_video_out(struct MPOpts *opts, struct vo_x11_state *x11,
+ struct mp_fifo *key_fifo,
+ struct input_ctx *input_ctx);
+int vo_config(struct vo *vo, uint32_t width, uint32_t height,
uint32_t d_width, uint32_t d_height, uint32_t flags,
char *title, uint32_t format);
void list_video_out(void);
-// NULL terminated array of all drivers
-extern const vo_functions_t* const video_out_drivers[];
+int vo_control(struct vo *vo, uint32_t request, void *data);
+int vo_draw_image(struct vo *vo, struct mp_image *mpi, double pts);
+int vo_get_buffered_frame(struct vo *vo, bool eof);
+int vo_draw_frame(struct vo *vo, uint8_t *src[]);
+int vo_draw_slice(struct vo *vo, uint8_t *src[], int stride[], int w, int h, int x, int y);
+void vo_draw_osd(struct vo *vo, struct osd_state *osd);
+void vo_flip_page(struct vo *vo, unsigned int pts_us, int duration);
+void vo_check_events(struct vo *vo);
+void vo_seek_reset(struct vo *vo);
+void vo_destroy(struct vo *vo);
-extern int vo_flags;
-extern int vo_config_count;
+// NULL terminated array of all drivers
+extern const struct vo_driver *video_out_drivers[];
extern int xinerama_screen;
extern int xinerama_x;
extern int xinerama_y;
-// correct resolution/bpp on screen: (should be autodetected by vo_init())
-extern int vo_depthonscreen;
-extern int vo_screenwidth;
-extern int vo_screenheight;
-
-// requested resolution/bpp: (-x -y -bpp options)
-extern int vo_dx;
-extern int vo_dy;
-extern int vo_dwidth;
-extern int vo_dheight;
-extern int vo_dbpp;
-
extern int vo_grabpointer;
extern int vo_doublebuffering;
extern int vo_directrendering;
@@ -230,18 +307,8 @@ extern int vo_adapter_num;
extern int vo_refresh_rate;
extern int vo_keepaspect;
extern int vo_rootwin;
-extern int vo_ontop;
extern int vo_border;
-extern int vo_gamma_gamma;
-extern int vo_gamma_brightness;
-extern int vo_gamma_saturation;
-extern int vo_gamma_contrast;
-extern int vo_gamma_hue;
-extern int vo_gamma_red_intensity;
-extern int vo_gamma_green_intensity;
-extern int vo_gamma_blue_intensity;
-
extern int vo_nomouse_input;
extern int vo_pts;
@@ -276,12 +343,13 @@ int lookup_keymap_table(const struct keymap *map, int key);
struct vo_rect {
int left, right, top, bottom, width, height;
};
-void calc_src_dst_rects(int src_width, int src_height, struct vo_rect *src, struct vo_rect *dst,
+void calc_src_dst_rects(struct vo *vo, int src_width, int src_height,
+ struct vo_rect *src, struct vo_rect *dst,
struct vo_rect *borders, const struct vo_rect *crop);
static inline int aspect_scaling(void)
{
- return vo_fs;
+ return vo_keepaspect || vo_fs;
}
#endif /* MPLAYER_VIDEO_OUT_H */
diff --git a/libvo/video_out_internal.h b/libvo/video_out_internal.h
index 36aa210fdd..8595d4ef05 100644
--- a/libvo/video_out_internal.h
+++ b/libvo/video_out_internal.h
@@ -27,8 +27,10 @@
#include "libmpcodecs/vfcap.h"
#include "libmpcodecs/mp_image.h"
#include "geometry.h"
+#include "old_vo_wrapper.h"
+#include "old_vo_defines.h"
-static int control(uint32_t request, void *data, ...);
+static int control(uint32_t request, void *data);
static int config(uint32_t width, uint32_t height, uint32_t d_width,
uint32_t d_height, uint32_t fullscreen, char *title,
uint32_t format);
@@ -41,9 +43,19 @@ static void uninit(void);
static int query_format(uint32_t format);
static int preinit(const char *);
-#define LIBVO_EXTERN(x) vo_functions_t video_out_##x =\
+#define LIBVO_EXTERN(x) struct vo_driver video_out_##x =\
{\
- &info,\
+ .is_new = 0,\
+ .info = &info,\
+ .preinit = old_vo_preinit,\
+ .config = old_vo_config,\
+ .control = old_vo_control,\
+ .draw_slice = old_vo_draw_slice,\
+ .draw_osd = old_vo_draw_osd,\
+ .flip_page = old_vo_flip_page,\
+ .check_events = old_vo_check_events,\
+ .uninit = old_vo_uninit,\
+ .old_functions = &(struct vo_old_functions){\
preinit,\
config,\
control,\
@@ -52,7 +64,8 @@ static int preinit(const char *);
draw_osd,\
flip_page,\
check_events,\
- uninit\
+ uninit,\
+ }\
};
#include "osd.h"
diff --git a/libvo/vo_3dfx.c b/libvo/vo_3dfx.c
index b86e593281..9295a65a67 100644
--- a/libvo/vo_3dfx.c
+++ b/libvo/vo_3dfx.c
@@ -169,12 +169,12 @@ create_window(Display *display, char *title)
bpp = attribs.depth;
if (bpp != 16)
{
- mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_3DFX_Only16BppSupported);
+ mp_tmsg(MSGT_VO,MSGL_WARN, "[VO_3DFX] Only 16bpp supported!");
exit(-1);
}
XMatchVisualInfo(display,screen,bpp,TrueColor,&vinfo);
- mp_msg(MSGT_VO,MSGL_INFO, MSGTR_LIBVO_3DFX_VisualIdIs,vinfo.visualid);
+ mp_tmsg(MSGT_VO,MSGL_INFO, "[VO_3DFX] Visual ID is %lx.\n",vinfo.visualid);
theCmap = XCreateColormap(display, RootWindow(display,screen),
vinfo.visual, AllocNone);
@@ -335,7 +335,7 @@ config(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uin
// Open driver device
if ( fd == -1 )
{
- mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_3DFX_UnableToOpenDevice);
+ mp_tmsg(MSGT_VO,MSGL_WARN, "[VO_3DFX] Unable to open /dev/3dfx.\n");
return -1;
}
@@ -354,7 +354,7 @@ config(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uin
data.device = 0;
if ((retval = ioctl(fd,_IOC(_IOC_READ,'3',3,0),&data)) < 0)
{
- mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_3DFX_Error,retval);
+ mp_tmsg(MSGT_VO,MSGL_WARN, "[VO_3DFX] Error: %d.\n",retval);
return -1;
}
@@ -365,7 +365,7 @@ config(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uin
data.device = 0;
if ((retval = ioctl(fd,_IOC(_IOC_READ,'3',3,0),&data)) < 0)
{
- mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_3DFX_Error,retval);
+ mp_tmsg(MSGT_VO,MSGL_WARN, "[VO_3DFX] Error: %d.\n",retval);
return -1;
}
@@ -374,7 +374,7 @@ config(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uin
memBase1 = mmap(0,3*page_space,PROT_READ | PROT_WRITE,MAP_SHARED,fd,baseAddr1);
if (memBase0 == (uint32_t *) 0xFFFFFFFF || memBase1 == (uint32_t *) 0xFFFFFFFF)
{
- mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_3DFX_CouldntMapMemoryArea,
+ mp_tmsg(MSGT_VO,MSGL_WARN, "[VO_3DFX] Couldn't map 3dfx memory areas: %p,%p,%d.\n",
memBase0,memBase1,errno);
}
@@ -413,7 +413,7 @@ config(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uin
atexit(restore);
- mp_msg(MSGT_VO,MSGL_INFO, MSGTR_LIBVO_3DFX_DisplayInitialized,memBase1);
+ mp_tmsg(MSGT_VO,MSGL_INFO, "[VO_3DFX] Initialized: %p.\n",memBase1);
return 0;
}
@@ -485,19 +485,19 @@ static int preinit(const char *arg)
{
if ( (fd = open("/dev/3dfx",O_RDWR) ) == -1)
{
- mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_3DFX_UnableToOpenDevice);
+ mp_tmsg(MSGT_VO,MSGL_WARN, "[VO_3DFX] Unable to open /dev/3dfx.\n");
return -1;
}
if(arg)
{
- mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_3DFX_UnknownSubdevice,arg);
+ mp_tmsg(MSGT_VO,MSGL_WARN, "[VO_3DFX] Unknown subdevice: %s.\n",arg);
return ENOSYS;
}
return 0;
}
-static int control(uint32_t request, void *data, ...)
+static int control(uint32_t request, void *data)
{
switch (request) {
case VOCTRL_QUERY_FORMAT:
diff --git a/libvo/vo_aa.c b/libvo/vo_aa.c
index cefd88c819..c1ff5efa27 100644
--- a/libvo/vo_aa.c
+++ b/libvo/vo_aa.c
@@ -96,7 +96,9 @@ static struct SwsContext *sws=NULL;
int aaopt_osdcolor = AA_SPECIAL;
int aaopt_subcolor = AA_SPECIAL;
-void
+static unsigned char vo_osd_text[64];
+
+static void
resize(void){
/*
* this function is called by aa lib if windows resizes
@@ -190,15 +192,10 @@ osdpercent(int duration, int deko, int min, int max, int val, const char * desc,
static void
printosdtext(void)
{
- if(osd_text_length > 0 && !vo_osd_text) {
- memset(c->textbuffer,' ',osd_text_length);
- memset(c->attrbuffer,0,osd_text_length);
- osd_text_length = 0;
- }
/*
* places the mplayer status osd
*/
- if (vo_osd_text && vo_osd_text[0] != 0) {
+ if (vo_osd_text[0] != 0) {
int len;
if(vo_osd_text[0] < 32) {
len = strlen(sub_osd_names_short[vo_osd_text[0]]) + strlen(vo_osd_text+1) + 2;
@@ -542,18 +539,18 @@ static void clear_alpha(int x0,int y0, int w,int h) {
static void
draw_osd(void){
- char * vo_osd_text_save;
+ char vo_osd_text_save;
int vo_osd_progbar_type_save;
printosdprogbar();
/* let vo_draw_text only write subtitle */
- vo_osd_text_save=vo_osd_text; /* we have to save the osd_text */
- vo_osd_text=NULL;
+ vo_osd_text_save = global_osd->osd_text[0];
+ global_osd->osd_text[0] = 0;
vo_osd_progbar_type_save=vo_osd_progbar_type;
vo_osd_progbar_type=-1;
vo_remove_text(aa_scrwidth(c), aa_scrheight(c),clear_alpha);
vo_draw_text(aa_scrwidth(c), aa_scrheight(c), draw_alpha);
- vo_osd_text=vo_osd_text_save;
+ global_osd->osd_text[0] = vo_osd_text_save;
vo_osd_progbar_type=vo_osd_progbar_type_save;
}
@@ -620,9 +617,16 @@ static int parse_suboptions(const char *arg) {
helpmsg = strdup(aa_help);
for (i=0; i<(signed)strlen(helpmsg); i++)
if (helpmsg[i] == '-') helpmsg[i] = ' ';
- mp_msg(MSGT_VO, MSGL_INFO, MSGTR_VO_AA_HelpHeader);
+ mp_tmsg(MSGT_VO, MSGL_INFO, "\n\nHere are the aalib vo_aa suboptions:\n");
mp_msg(MSGT_VO, MSGL_INFO, "%s\n\n", helpmsg);
- mp_msg(MSGT_VO, MSGL_INFO, MSGTR_VO_AA_AdditionalOptions);
+#define VO_AA_AdditionalOptions _("Additional options vo_aa provides:\n" \
+" help print this help message\n" \
+" osdcolor set OSD color\n subcolor set subtitle color\n" \
+" the color parameters are:\n 0 : normal\n" \
+" 1 : dim\n 2 : bold\n 3 : boldfont\n" \
+" 4 : reverse\n 5 : special\n\n\n")
+
+ mp_tmsg(MSGT_VO, MSGL_INFO, VO_AA_AdditionalOptions);
retval = -1;
}
if (retval == 0) {
@@ -726,37 +730,26 @@ static int preinit(const char *arg)
return 0;
}
-static int control(uint32_t request, void *data, ...)
+static int control(uint32_t request, void *data)
{
switch (request) {
case VOCTRL_QUERY_FORMAT:
return query_format(*((uint32_t*)data));
case VOCTRL_SET_EQUALIZER: {
- va_list ap;
- int val;
-
- va_start(ap, data);
- val = va_arg(ap, int);
- va_end(ap);
-
- if(strcmp((char*)data,"contrast") == 0)
- p->contrast = ( val + 100 ) * 64 / 100;
- else if(strcmp((char*)data,"brightness") == 0)
- p->bright = ( val + 100) * 128 / 100;
+ struct voctrl_set_equalizer_args *args = data;
+ if (strcmp(args->name, "contrast") == 0)
+ p->contrast = (args->value + 100) * 64 / 100;
+ else if (strcmp(args->name, "brightness") == 0)
+ p->bright = (args->value + 100) * 128 / 100;
return VO_TRUE;
}
case VOCTRL_GET_EQUALIZER: {
- va_list ap;
- int* val;
-
- va_start(ap, data);
- val = va_arg(ap, int*);
- va_end(ap);
+ struct voctrl_get_equalizer_args *args = data;
- if(strcmp((char*)data,"contrast") == 0)
- *val = (p->contrast - 64) * 100 / 64;
- else if(strcmp((char*)data,"brightness") == 0)
- *val = (p->bright - 128) * 100 / 128;
+ if (strcmp(args->name, "contrast") == 0)
+ *args->valueptr = (p->contrast - 64) * 100 / 64;
+ else if (strcmp(args->name, "brightness") == 0)
+ *args->valueptr = (p->bright - 128) * 100 / 128;
return VO_TRUE;
}
diff --git a/libvo/vo_bl.c b/libvo/vo_bl.c
index 9e98130adb..8a4c29edd7 100644
--- a/libvo/vo_bl.c
+++ b/libvo/vo_bl.c
@@ -470,7 +470,7 @@ static int preinit(const char *arg) {
return 0;
}
-static int control(uint32_t request, void *data, ...) {
+static int control(uint32_t request, void *data) {
switch (request) {
case VOCTRL_QUERY_FORMAT:
return query_format(*((uint32_t*)data));
diff --git a/libvo/vo_caca.c b/libvo/vo_caca.c
index 4415459080..2c36700be8 100644
--- a/libvo/vo_caca.c
+++ b/libvo/vo_caca.c
@@ -335,7 +335,7 @@ static int query_format(uint32_t format)
return 0;
}
-static int control(uint32_t request, void *data, ...)
+static int control(uint32_t request, void *data)
{
switch(request)
{
diff --git a/libvo/vo_corevideo.m b/libvo/vo_corevideo.m
index 5d25b088f4..9cd3447072 100644
--- a/libvo/vo_corevideo.m
+++ b/libvo/vo_corevideo.m
@@ -417,7 +417,7 @@ static int preinit(const char *arg)
return 0;
}
-static int control(uint32_t request, void *data, ...)
+static int control(uint32_t request, void *data)
{
switch (request)
{
@@ -963,7 +963,7 @@ static int control(uint32_t request, void *data, ...)
snprintf(cmdstr, sizeof(cmdstr), "set_mouse_pos %i %i",
(int)(vo_fs ? p.x : (p.x - textureFrame.origin.x)),
(int)(vo_fs ? [self frame].size.height - p.y: (NSMaxY(textureFrame) - p.y)));
- mp_input_queue_cmd(mp_input_parse_cmd(cmdstr));
+ mp_input_queue_cmd(global_vo->input_ctx, mp_input_parse_cmd(cmdstr));
}
}
}
diff --git a/libvo/vo_cvidix.c b/libvo/vo_cvidix.c
index 70ea155535..a4a29719de 100644
--- a/libvo/vo_cvidix.c
+++ b/libvo/vo_cvidix.c
@@ -171,11 +171,11 @@ static int preinit(const char *arg){
mp_msg(MSGT_VO, MSGL_INFO, "vo_cvidix: No vidix driver name provided, probing available ones (-v option for details)!\n");
vidix_name = NULL;
}
- if(vidix_preinit(vidix_name, &video_out_cvidix))return 1;
+ if (vidix_preinit(vidix_name, video_out_cvidix.old_functions))return 1;
return 0;
}
-static int control(uint32_t request, void *data, ...){
+static int control(uint32_t request, void *data){
switch (request) {
case VOCTRL_QUERY_FORMAT:
return query_format(*((uint32_t*)data));
@@ -184,24 +184,6 @@ static int control(uint32_t request, void *data, ...){
else vo_fs=1;
setup_vidix();
return VO_TRUE;
- case VOCTRL_SET_EQUALIZER:
- {
- va_list ap;
- int value;
- va_start(ap, data);
- value = va_arg(ap, int);
- va_end(ap);
- return vidix_control(request, data, value);
- }
- case VOCTRL_GET_EQUALIZER:
- {
- va_list ap;
- int *value;
- va_start(ap, data);
- value = va_arg(ap, int *);
- va_end(ap);
- return vidix_control(request, data, value);
- }
}
return vidix_control(request, data);
}
diff --git a/libvo/vo_dfbmga.c b/libvo/vo_dfbmga.c
index fd1a3638db..457a481c7a 100644
--- a/libvo/vo_dfbmga.c
+++ b/libvo/vo_dfbmga.c
@@ -1465,13 +1465,9 @@ get_equalizer( char *data, int *value )
}
static int
-control( uint32_t request, void *data, ... )
+control( uint32_t request, void *data)
{
switch (request) {
- case VOCTRL_GUISUPPORT:
- case VOCTRL_GUI_NOWINDOW:
- return VO_TRUE;
-
case VOCTRL_QUERY_FORMAT:
return query_format( *((uint32_t *) data) );
@@ -1483,25 +1479,13 @@ control( uint32_t request, void *data, ... )
case VOCTRL_SET_EQUALIZER:
{
- va_list ap;
- int value;
-
- va_start( ap, data );
- value = va_arg( ap, int );
- va_end( ap );
-
- return set_equalizer( data, value );
+ struct voctrl_set_equalizer_args *args = data;
+ return set_equalizer(args->name, args->value);
}
case VOCTRL_GET_EQUALIZER:
{
- va_list ap;
- int *value;
-
- va_start( ap, data );
- value = va_arg( ap, int* );
- va_end( ap );
-
- return get_equalizer( data, value );
+ struct voctrl_get_equalizer_args *args = data;
+ return get_equalizer(args->name, args->valueptr);
}
}
diff --git a/libvo/vo_dga.c b/libvo/vo_dga.c
index 51527bdc6a..879831761d 100644
--- a/libvo/vo_dga.c
+++ b/libvo/vo_dga.c
@@ -984,7 +984,7 @@ static uint32_t get_image(mp_image_t * mpi)
return VO_FALSE;
}
-static int control(uint32_t request, void *data, ...)
+static int control(uint32_t request, void *data)
{
switch (request)
{
diff --git a/libvo/vo_direct3d.c b/libvo/vo_direct3d.c
index 6e8cdaf1fe..384dcb477b 100644
--- a/libvo/vo_direct3d.c
+++ b/libvo/vo_direct3d.c
@@ -760,7 +760,7 @@ err_out:
/** @brief libvo Callback: Handle control requests.
* @return VO_TRUE on success, VO_NOTIMPL when not implemented
*/
-static int control(uint32_t request, void *data, ...)
+static int control(uint32_t request, void *data)
{
switch (request) {
case VOCTRL_QUERY_FORMAT:
@@ -783,8 +783,6 @@ static int control(uint32_t request, void *data, ...)
case VOCTRL_RESUME:
priv->is_paused = 0;
return VO_TRUE;
- case VOCTRL_GUISUPPORT:
- return VO_NOTIMPL;
case VOCTRL_SET_EQUALIZER:
return VO_NOTIMPL;
case VOCTRL_GET_EQUALIZER:
diff --git a/libvo/vo_directfb2.c b/libvo/vo_directfb2.c
index d2e8a4a7fa..4a88b3881e 100644
--- a/libvo/vo_directfb2.c
+++ b/libvo/vo_directfb2.c
@@ -1411,7 +1411,7 @@ static uint32_t put_image(mp_image_t *mpi){
-static int control(uint32_t request, void *data, ...)
+static int control(uint32_t request, void *data)
{
switch (request) {
case VOCTRL_QUERY_FORMAT:
@@ -1422,25 +1422,13 @@ static int control(uint32_t request, void *data, ...)
return put_image(data);
case VOCTRL_SET_EQUALIZER:
{
- va_list ap;
- int value;
-
- va_start(ap, data);
- value = va_arg(ap, int);
- va_end(ap);
-
- return directfb_set_video_eq(data, value);
+ struct voctrl_set_equalizer_args *args = data;
+ return directfb_set_video_eq(args->name, args->value);
}
case VOCTRL_GET_EQUALIZER:
{
- va_list ap;
- int *value;
-
- va_start(ap, data);
- value = va_arg(ap, int*);
- va_end(ap);
-
- return directfb_get_video_eq(data, value);
+ struct voctrl_get_equalizer_args *args = data;
+ return directfb_get_video_eq(args->name, args->valueptr);
}
};
return VO_NOTIMPL;
diff --git a/libvo/vo_directx.c b/libvo/vo_directx.c
index af4a090493..00294b881d 100644
--- a/libvo/vo_directx.c
+++ b/libvo/vo_directx.c
@@ -39,10 +39,6 @@
#include "mp_fifo.h"
#include "sub.h"
-#ifdef CONFIG_GUI
-#include "gui/interface.h"
-#endif
-
#ifndef WM_XBUTTONDOWN
# define WM_XBUTTONDOWN 0x020B
# define WM_XBUTTONUP 0x020C
@@ -90,8 +86,6 @@ static float window_aspect;
static BOOL (WINAPI* myGetMonitorInfo)(HMONITOR, LPMONITORINFO) = NULL;
static RECT last_rect = {0xDEADC0DE, 0xDEADC0DE, 0xDEADC0DE, 0xDEADC0DE};
-extern int vidmode;
-
/*****************************************************************************
* DirectDraw GUIDs.
* Defining them here allows us to get rid of the dxguid library during
@@ -1296,11 +1290,6 @@ config(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uin
if(format != primary_image_format)nooverlay = 0;
window_aspect= (float)d_image_width / (float)d_image_height;
-#ifdef CONFIG_GUI
- if(use_gui){
- guiGetEvent(guiSetShVideo, 0);
- }
-#endif
/*release all directx objects*/
if (g_cc != NULL)g_cc->lpVtbl->Release(g_cc);
g_cc=NULL;
@@ -1476,7 +1465,7 @@ static uint32_t color_ctrl_get(char *what, int *value)
return r;
}
-static int control(uint32_t request, void *data, ...)
+static int control(uint32_t request, void *data)
{
switch (request) {
@@ -1568,22 +1557,12 @@ static int control(uint32_t request, void *data, ...)
return VO_TRUE;
}
case VOCTRL_SET_EQUALIZER: {
- va_list ap;
- int value;
-
- va_start(ap, data);
- value = va_arg(ap, int);
- va_end(ap);
- return color_ctrl_set(data, value);
+ struct voctrl_set_equalizer_args *args = data;
+ return color_ctrl_set(args->name, args->value);
}
case VOCTRL_GET_EQUALIZER: {
- va_list ap;
- int *value;
-
- va_start(ap, data);
- value = va_arg(ap, int*);
- va_end(ap);
- return color_ctrl_get(data, value);
+ struct voctrl_get_equalizer_args *args = data;
+ return color_ctrl_get(args->name, args->valueptr);
}
case VOCTRL_UPDATE_SCREENINFO:
if (vidmode) {
diff --git a/libvo/vo_dxr2.c b/libvo/vo_dxr2.c
index 0e1ac2fc35..66f73f1d6d 100644
--- a/libvo/vo_dxr2.c
+++ b/libvo/vo_dxr2.c
@@ -42,8 +42,7 @@
#include <dxr2ioctl.h>
-extern float monitor_aspect;
-extern float movie_aspect;
+#include "aspect.h"
int dxr2_fd = -1;
@@ -51,7 +50,8 @@ static int movie_w,movie_h;
static int playing = 0;
// vo device used to blank the screen for the overlay init
-static const vo_functions_t* sub_vo = NULL;
+static const struct vo_old_functions *sub_vo = NULL;
+static const struct vo_info_s *sub_info;
static uint8_t* sub_img = NULL;
static int sub_x,sub_y,sub_w,sub_h;
@@ -446,7 +446,7 @@ static int dxr2_load_vga_params(dxr2_vgaParams_t* vga,char* name) {
}
static int dxr2_setup_vga_params(void) {
- const vo_info_t* vi = sub_vo->info;
+ const vo_info_t* vi = sub_info;
dxr2_vgaParams_t vga;
int loaded = dxr2_load_vga_params(&vga,(char*)vi->short_name);
@@ -660,7 +660,7 @@ static int config(uint32_t s_width, uint32_t s_height, uint32_t width, uint32_t
}
// Does the sub vo support the x11 stuff
// Fix me : test the other x11 vo's and enable them
- if(strcmp(sub_vo->info->short_name,"x11") == 0)
+ if(strcmp(sub_info->short_name,"x11") == 0)
sub_vo_win = 1;
else
sub_vo_win = 0;
@@ -834,10 +834,11 @@ static int preinit(const char *arg) {
const vo_info_t* vi = video_out_drivers[n]->info;
if(!vi)
continue;
- if(strcasecmp(arg,vi->short_name) == 0)
+ if(!video_out_drivers[n]->is_new && strcasecmp(arg,vi->short_name) == 0)
break;
}
- sub_vo = video_out_drivers[n];
+ sub_vo = video_out_drivers[n]->old_functions;
+ sub_info = video_out_drivers[n]->info;
} else {
mp_msg(MSGT_VO,MSGL_WARN,"VO: [dxr2] We need a sub driver to initialize the overlay\n");
use_ol = 0;
@@ -920,7 +921,7 @@ static int preinit(const char *arg) {
return 0;
}
-static int control(uint32_t request, void *data, ...)
+static int control(uint32_t request, void *data)
{
switch (request) {
case VOCTRL_QUERY_FORMAT:
diff --git a/libvo/vo_dxr3.c b/libvo/vo_dxr3.c
index 05f55aa4f9..898ee96756 100644
--- a/libvo/vo_dxr3.c
+++ b/libvo/vo_dxr3.c
@@ -44,9 +44,6 @@
#include "aspect.h"
#include "spuenc.h"
#include "sub.h"
-#ifdef CONFIG_GUI
-#include "gui/interface.h"
-#endif
#ifdef CONFIG_X11
#include "x11_common.h"
#endif
@@ -174,19 +171,12 @@ static overlay_t *overlay_data;
/* Functions for working with the em8300's internal clock */
/* End of internal clock functions */
-static int control(uint32_t request, void *data, ...)
+static int control(uint32_t request, void *data)
{
switch (request) {
- case VOCTRL_GUISUPPORT:
- return VO_TRUE;
- case VOCTRL_GUI_NOWINDOW:
- if (dxr3_overlay) {
- return VO_FALSE;
- }
- return VO_TRUE;
case VOCTRL_SET_SPU_PALETTE:
if (ioctl(fd_spu, EM8300_IOCTL_SPU_SETPALETTE, data) < 0) {
- mp_msg(MSGT_VO,MSGL_ERR, MSGTR_LIBVO_DXR3_UnableToLoadNewSPUPalette);
+ mp_tmsg(MSGT_VO,MSGL_ERR, "[VO_DXR3] Unable to load new SPU palette!\n");
return VO_ERROR;
}
return VO_TRUE;
@@ -216,7 +206,7 @@ static int control(uint32_t request, void *data, ...)
if (dxr3_prebuf) {
ioval = EM8300_PLAYMODE_PLAY;
if (ioctl(fd_control, EM8300_IOCTL_SET_PLAYMODE, &ioval) < 0) {
- mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_DXR3_UnableToSetPlaymode);
+ mp_tmsg(MSGT_VO,MSGL_WARN, "[VO_DXR3] Unable to set playmode!\n");
}
}
return VO_TRUE;
@@ -224,7 +214,7 @@ static int control(uint32_t request, void *data, ...)
if (dxr3_prebuf) {
ioval = EM8300_PLAYMODE_PAUSED;
if (ioctl(fd_control, EM8300_IOCTL_SET_PLAYMODE, &ioval) < 0) {
- mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_DXR3_UnableToSetPlaymode);
+ mp_tmsg(MSGT_VO,MSGL_WARN, "[VO_DXR3] Unable to set playmode!\n");
}
}
return VO_TRUE;
@@ -252,22 +242,17 @@ static int control(uint32_t request, void *data, ...)
}
case VOCTRL_SET_EQUALIZER:
{
- va_list ap;
- int value;
em8300_bcs_t bcs;
-
- va_start(ap, data);
- value = va_arg(ap, int);
- va_end(ap);
+ struct voctrl_set_equalizer_args *args = data;
if (ioctl(fd_control, EM8300_IOCTL_GETBCS, &bcs) < 0)
return VO_FALSE;
- if (!strcasecmp(data, "brightness"))
- bcs.brightness = (value+100)*5;
- else if (!strcasecmp(data, "contrast"))
- bcs.contrast = (value+100)*5;
- else if (!strcasecmp(data, "saturation"))
- bcs.saturation = (value+100)*5;
+ if (!strcasecmp(args->name, "brightness"))
+ bcs.brightness = (args->value+100)*5;
+ else if (!strcasecmp(args->name, "contrast"))
+ bcs.contrast = (args->value+100)*5;
+ else if (!strcasecmp(args->name, "saturation"))
+ bcs.saturation = (args->value+100)*5;
else return VO_FALSE;
if (ioctl(fd_control, EM8300_IOCTL_SETBCS, &bcs) < 0)
@@ -276,23 +261,18 @@ static int control(uint32_t request, void *data, ...)
}
case VOCTRL_GET_EQUALIZER:
{
- va_list ap;
- int *value;
em8300_bcs_t bcs;
-
- va_start(ap, data);
- value = va_arg(ap, int*);
- va_end(ap);
+ struct voctrl_get_equalizer_args *args = data;
if (ioctl(fd_control, EM8300_IOCTL_GETBCS, &bcs) < 0)
return VO_FALSE;
- if (!strcasecmp(data, "brightness"))
- *value = (bcs.brightness/5)-100;
- else if (!strcasecmp(data, "contrast"))
- *value = (bcs.contrast/5)-100;
- else if (!strcasecmp(data, "saturation"))
- *value = (bcs.saturation/5)-100;
+ if (!strcasecmp(args->name, "brightness"))
+ *args->valueptr = (bcs.brightness/5)-100;
+ else if (!strcasecmp(args->name, "contrast"))
+ *args->valueptr = (bcs.contrast/5)-100;
+ else if (!strcasecmp(args->name, "saturation"))
+ *args->valueptr = (bcs.saturation/5)-100;
else return VO_FALSE;
return VO_TRUE;
@@ -322,7 +302,6 @@ static int config(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_
{
int tmp1, tmp2, size;
em8300_register_t reg;
- extern float monitor_aspect;
/* Softzoom turned on, downscale */
/* This activates the subpicture processor, you can safely disable this and still send */
@@ -330,7 +309,7 @@ static int config(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_
/* up in a lockup */
ioval = EM8300_SPUMODE_ON;
if (ioctl(fd_control, EM8300_IOCTL_SET_SPUMODE, &ioval) < 0) {
- mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_DXR3_UnableToSetSubpictureMode);
+ mp_tmsg(MSGT_VO,MSGL_WARN, "[VO_DXR3] Unable to set subpicture mode!\n");
uninit();
return -1;
}
@@ -338,7 +317,7 @@ static int config(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_
/* Set the playmode to play (just in case another app has set it to something else) */
ioval = EM8300_PLAYMODE_PLAY;
if (ioctl(fd_control, EM8300_IOCTL_SET_PLAYMODE, &ioval) < 0) {
- mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_DXR3_UnableToSetPlaymode);
+ mp_tmsg(MSGT_VO,MSGL_WARN, "[VO_DXR3] Unable to set playmode!\n");
}
/* Start em8300 prebuffering and sync engine */
@@ -370,7 +349,7 @@ static int config(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_
monitor_aspect = (float) width / (float) height;
if (ioctl(fd_control, EM8300_IOCTL_GET_VIDEOMODE, &old_vmode) < 0) {
- mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_DXR3_UnableToGetTVNorm);
+ mp_tmsg(MSGT_VO,MSGL_WARN, "[VO_DXR3] Unable to get TV norm!\n");
old_vmode = -1;
}
@@ -389,7 +368,7 @@ static int config(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_
ioval = EM8300_VIDEOMODE_PAL;
}
- mp_msg(MSGT_VO,MSGL_INFO, MSGTR_LIBVO_DXR3_AutoSelectedTVNormByFrameRate);
+ mp_tmsg(MSGT_VO,MSGL_INFO, "[VO_DXR3] Auto-selected TV norm by framerate: ");
ioval == EM8300_VIDEOMODE_PAL60 ? mp_msg(MSGT_VO,MSGL_INFO, "PAL-60") : mp_msg(MSGT_VO,MSGL_INFO, "PAL");
printf(".\n");
} else {
@@ -399,14 +378,14 @@ static int config(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_
ioval = EM8300_VIDEOMODE_PAL;
}
- mp_msg(MSGT_VO,MSGL_INFO, MSGTR_LIBVO_DXR3_AutoSelectedTVNormByFrameRate);
+ mp_tmsg(MSGT_VO,MSGL_INFO, "[VO_DXR3] Auto-selected TV norm by framerate: ");
ioval == EM8300_VIDEOMODE_NTSC ? mp_msg(MSGT_VO,MSGL_INFO, "NTSC") : mp_msg(MSGT_VO,MSGL_INFO, "PAL");
printf(".\n");
}
if (old_vmode != ioval) {
if (ioctl(fd_control, EM8300_IOCTL_SET_VIDEOMODE, &ioval) < 0) {
- mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_DXR3_UnableToSetTVNorm);
+ mp_tmsg(MSGT_VO,MSGL_WARN, "[VO_DXR3] Unable to set TV norm!\n");
}
}
}
@@ -417,10 +396,10 @@ static int config(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_
aspect_save_prescale(d_width, d_height);
ioctl(fd_control, EM8300_IOCTL_GET_VIDEOMODE, &ioval);
if (ioval == EM8300_VIDEOMODE_NTSC) {
- mp_msg(MSGT_VO,MSGL_INFO, MSGTR_LIBVO_DXR3_SettingUpForNTSC);
+ mp_tmsg(MSGT_VO,MSGL_INFO, "[VO_DXR3] Setting up for NTSC.\n");
aspect_save_screenres(352, 240);
} else {
- mp_msg(MSGT_VO,MSGL_INFO, MSGTR_LIBVO_DXR3_SettingUpForPALSECAM);
+ mp_tmsg(MSGT_VO,MSGL_INFO, "[VO_DXR3] Setting up for PAL/SECAM.\n");
aspect_save_screenres(352, 288);
}
aspect(&s_width, &s_height, A_ZOOM);
@@ -433,10 +412,10 @@ static int config(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_
tmp2 = abs(d_height - (int) (d_width / 2.35));
if (tmp1 < tmp2) {
ioval = EM8300_ASPECTRATIO_4_3;
- mp_msg(MSGT_VO,MSGL_INFO, MSGTR_LIBVO_DXR3_SettingAspectRatioTo43);
+ mp_tmsg(MSGT_VO,MSGL_INFO, "[VO_DXR3] Setting aspect ratio to 4:3.\n");
} else {
ioval = EM8300_ASPECTRATIO_16_9;
- mp_msg(MSGT_VO,MSGL_INFO, MSGTR_LIBVO_DXR3_SettingAspectRatioTo169);
+ mp_tmsg(MSGT_VO,MSGL_INFO, "[VO_DXR3] Setting aspect ratio to 16:9.\n");
}
ioctl(fd_control, EM8300_IOCTL_SET_ASPECTRATIO, &ioval);
@@ -455,20 +434,20 @@ static int config(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_
osdpicbuf = calloc( 1,s_width * s_height);
if (osdpicbuf == NULL) {
- mp_msg(MSGT_VO,MSGL_ERR, MSGTR_LIBVO_DXR3_OutOfMemory);
+ mp_tmsg(MSGT_VO,MSGL_ERR, "[VO_DXR3] out of memory\n");
return -1;
}
spued = (encodedata *) malloc(sizeof(encodedata));
if (spued == NULL) {
free( osdpicbuf );
- mp_msg(MSGT_VO,MSGL_ERR, MSGTR_LIBVO_DXR3_OutOfMemory);
+ mp_tmsg(MSGT_VO,MSGL_ERR, "[VO_DXR3] out of memory\n");
return -1;
}
spubuf = (encodedata *) malloc(sizeof(encodedata));
if (spubuf == NULL) {
free( osdpicbuf );
free( spued );
- mp_msg(MSGT_VO,MSGL_ERR, MSGTR_LIBVO_DXR3_OutOfMemory);
+ mp_tmsg(MSGT_VO,MSGL_ERR, "[VO_DXR3] out of memory\n");
return -1;
}
osd_w = s_width;
@@ -499,19 +478,6 @@ static int config(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_
vo_dy = (vo_screenheight - d_height) / 2;
vo_dwidth = d_width;
vo_dheight = d_height;
-#ifdef CONFIG_GUI
- if (use_gui) {
- guiGetEvent(guiSetShVideo, 0);
- XSetWindowBackground(mDisplay, vo_window, KEY_COLOR);
- XClearWindow(mDisplay, vo_window);
- XGetWindowAttributes(mDisplay, DefaultRootWindow(mDisplay), &xwin_attribs);
- depth = xwin_attribs.depth;
- if (depth != 15 && depth != 16 && depth != 24 && depth != 32) {
- depth = 24;
- }
- XMatchVisualInfo(mDisplay, mScreen, depth, TrueColor, &vinfo);
- } else
-#endif
{
XGetWindowAttributes(mDisplay, DefaultRootWindow(mDisplay), &xwin_attribs);
depth = xwin_attribs.depth;
@@ -547,13 +513,13 @@ static int config(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_
((key_color.blue >> (16 - blue_prec)) << blue_shift));
key_color.flags = DoRed | DoGreen | DoBlue;
if (!XAllocColor(mDisplay, cmap, &key_color)) {
- mp_msg(MSGT_VO,MSGL_ERR, MSGTR_LIBVO_DXR3_UnableToAllocateKeycolor);
+ mp_tmsg(MSGT_VO,MSGL_ERR, "[VO_DXR3] Unable to allocate keycolor!\n");
return -1;
}
acq_color = ((key_color.red / 256) << 16) | ((key_color.green / 256) << 8) | key_color.blue;
if (key_color.pixel != KEY_COLOR) {
- mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_DXR3_UnableToAllocateExactKeycolor, key_color.pixel);
+ mp_tmsg(MSGT_VO,MSGL_WARN, "[VO_DXR3] Unable to allocate exact keycolor, using closest match (0x%lx).\n", key_color.pixel);
}
/* Set keycolor and activate overlay */
@@ -707,25 +673,19 @@ static int draw_slice(uint8_t *srcimg[], int stride[], int w, int h, int x0, int
static void uninit(void)
{
- mp_msg(MSGT_VO,MSGL_INFO, MSGTR_LIBVO_DXR3_Uninitializing);
+ mp_tmsg(MSGT_VO,MSGL_INFO, "[VO_DXR3] Uninitializing.\n");
#ifdef CONFIG_X11
if (dxr3_overlay) {
overlay_set_mode(overlay_data, EM8300_OVERLAY_MODE_OFF);
overlay_release(overlay_data);
-#ifdef CONFIG_GUI
- if (!use_gui) {
-#endif
vo_x11_uninit();
-#ifdef CONFIG_GUI
- }
-#endif
}
#endif
if (old_vmode != -1) {
if (ioctl(fd_control, EM8300_IOCTL_SET_VIDEOMODE, &old_vmode) < 0) {
- mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_DXR3_FailedRestoringTVNorm);
+ mp_tmsg(MSGT_VO,MSGL_WARN, "[VO_DXR3] Failed restoring TV norm!\n");
}
}
@@ -760,24 +720,24 @@ static int preinit(const char *arg)
/* Parse commandline */
while (arg) {
if (!strncmp("prebuf", arg, 6) && !dxr3_prebuf) {
- mp_msg(MSGT_VO,MSGL_INFO, MSGTR_LIBVO_DXR3_EnablingPrebuffering);
+ mp_tmsg(MSGT_VO,MSGL_INFO, "[VO_DXR3] Enabling prebuffering.\n");
dxr3_prebuf = 1;
} else if (!strncmp("sync", arg, 4) && !dxr3_newsync) {
- mp_msg(MSGT_VO,MSGL_INFO, MSGTR_LIBVO_DXR3_UsingNewSyncEngine);
+ mp_tmsg(MSGT_VO,MSGL_INFO, "[VO_DXR3] Using new sync engine.\n");
dxr3_newsync = 1;
} else if (!strncmp("overlay", arg, 7) && !dxr3_overlay) {
#ifdef CONFIG_X11
- mp_msg(MSGT_VO,MSGL_INFO, MSGTR_LIBVO_DXR3_UsingOverlay);
+ mp_tmsg(MSGT_VO,MSGL_INFO, "[VO_DXR3] Using overlay.\n");
dxr3_overlay = 1;
#else
- mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_DXR3_ErrorYouNeedToCompileMplayerWithX11);
+ mp_tmsg(MSGT_VO,MSGL_WARN, "[VO_DXR3] Error: Overlay requires compiling with X11 libs/headers installed.\n");
#endif
} else if (!strncmp("norm=", arg, 5)) {
arg += 5;
// dxr3_norm is 0 (-> don't change norm) by default
// but maybe someone changes this in the future
- mp_msg(MSGT_VO,MSGL_INFO, MSGTR_LIBVO_DXR3_WillSetTVNormTo);
+ mp_tmsg(MSGT_VO,MSGL_INFO, "[VO_DXR3] Will set TV norm to: ");
if (*arg == '5') {
dxr3_norm = 5;
@@ -790,16 +750,16 @@ static int preinit(const char *arg)
mp_msg(MSGT_VO,MSGL_INFO, "PAL");
} else if (*arg == '2') {
dxr3_norm = 2;
- mp_msg(MSGT_VO,MSGL_INFO, MSGTR_LIBVO_DXR3_AutoAdjustToMovieFrameRatePALPAL60);
+ mp_tmsg(MSGT_VO,MSGL_INFO, "auto-adjust to movie framerate (PAL/PAL-60)");
} else if (*arg == '1') {
dxr3_norm = 1;
- mp_msg(MSGT_VO,MSGL_INFO, MSGTR_LIBVO_DXR3_AutoAdjustToMovieFrameRatePALNTSC);
+ mp_tmsg(MSGT_VO,MSGL_INFO, "auto-adjust to movie framerate (PAL/NTSC)");
} else if (*arg == '0') {
dxr3_norm = 0;
- mp_msg(MSGT_VO,MSGL_INFO, MSGTR_LIBVO_DXR3_UseCurrentNorm);
+ mp_tmsg(MSGT_VO,MSGL_INFO, "Use current norm.");
} else {
dxr3_norm = 0;
- mp_msg(MSGT_VO,MSGL_INFO, MSGTR_LIBVO_DXR3_UseUnknownNormSuppliedCurrentNorm);
+ mp_tmsg(MSGT_VO,MSGL_INFO, "Unknown norm supplied. Use current norm.");
}
mp_msg(MSGT_VO,MSGL_INFO, ".\n");
@@ -819,15 +779,15 @@ static int preinit(const char *arg)
fd_control = open(devname, fdflags);
if (fd_control < 1) {
/* Fall back to old naming scheme */
- mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_DXR3_ErrorOpeningForWritingTrying, devname);
+ mp_tmsg(MSGT_VO,MSGL_WARN, "[VO_DXR3] Error opening %s for writing, trying /dev/em8300 instead.\n", devname);
sprintf(devname, "/dev/em8300");
fd_control = open(devname, fdflags);
if (fd_control < 1) {
- mp_msg(MSGT_VO,MSGL_ERR, MSGTR_LIBVO_DXR3_ErrorOpeningForWritingAsWell);
+ mp_tmsg(MSGT_VO,MSGL_ERR, "[VO_DXR3] Error opening /dev/em8300 for writing as well!\nBailing out.\n");
return -1;
}
} else {
- mp_msg(MSGT_VO,MSGL_INFO, MSGTR_LIBVO_DXR3_Opened, devname);
+ mp_tmsg(MSGT_VO,MSGL_INFO, "[VO_DXR3] Opened: %s.\n", devname);
}
/* Open the video interface */
@@ -835,16 +795,16 @@ static int preinit(const char *arg)
fd_video = open(devname, fdflags);
if (fd_video < 0) {
/* Fall back to old naming scheme */
- mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_DXR3_ErrorOpeningForWritingTryingMV, devname);
+ mp_tmsg(MSGT_VO,MSGL_WARN, "[VO_DXR3] Error opening %s for writing, trying /dev/em8300_mv instead.\n", devname);
sprintf(devname, "/dev/em8300_mv");
fd_video = open(devname, fdflags);
if (fd_video < 0) {
- mp_msg(MSGT_VO,MSGL_ERR, MSGTR_LIBVO_DXR3_ErrorOpeningForWritingAsWellMV);
+ mp_tmsg(MSGT_VO,MSGL_ERR, "[VO_DXR3] Error opening /dev/em8300_mv for writing as well!\nBailing out.\n");
uninit();
return -1;
}
} else {
- mp_msg(MSGT_VO,MSGL_INFO, MSGTR_LIBVO_DXR3_Opened, devname);
+ mp_tmsg(MSGT_VO,MSGL_INFO, "[VO_DXR3] Opened: %s.\n", devname);
}
strcpy(fdv_name, devname);
@@ -853,16 +813,16 @@ static int preinit(const char *arg)
fd_spu = open(devname, fdflags);
if (fd_spu < 0) {
/* Fall back to old naming scheme */
- mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_DXR3_ErrorOpeningForWritingTryingSP, devname);
+ mp_tmsg(MSGT_VO,MSGL_WARN, "[VO_DXR3] Error opening %s for writing, trying /dev/em8300_sp instead.\n", devname);
sprintf(devname, "/dev/em8300_sp");
fd_spu = open(devname, fdflags);
if (fd_spu < 0) {
- mp_msg(MSGT_VO,MSGL_ERR, MSGTR_LIBVO_DXR3_ErrorOpeningForWritingAsWellSP);
+ mp_tmsg(MSGT_VO,MSGL_ERR, "[VO_DXR3] Error opening /dev/em8300_sp for writing as well!\nBailing out.\n");
uninit();
return -1;
}
} else {
- mp_msg(MSGT_VO,MSGL_INFO, MSGTR_LIBVO_DXR3_Opened, devname);
+ mp_tmsg(MSGT_VO,MSGL_INFO, "[VO_DXR3] Opened: %s.\n", devname);
}
strcpy(fds_name, devname);
@@ -879,7 +839,7 @@ static int preinit(const char *arg)
dpy = XOpenDisplay(NULL);
if (!dpy) {
- mp_msg(MSGT_VO,MSGL_ERR, MSGTR_LIBVO_DXR3_UnableToOpenDisplayDuringHackSetup);
+ mp_tmsg(MSGT_VO,MSGL_ERR, "[VO_DXR3] Unable to open display during overlay hack setup!\n");
return -1;
}
XGetWindowAttributes(dpy, RootWindow(dpy, DefaultScreen(dpy)), &attribs);
@@ -895,16 +855,10 @@ static int preinit(const char *arg)
/* Initialize overlay and X11 */
overlay_data = overlay_init(fd_control);
-#ifdef CONFIG_GUI
- if (!use_gui) {
-#endif
if (!vo_init()) {
- mp_msg(MSGT_VO,MSGL_ERR, MSGTR_LIBVO_DXR3_UnableToInitX11);
+ mp_tmsg(MSGT_VO,MSGL_ERR, "[VO_DXR3] Unable to init X11!\n");
return -1;
}
-#ifdef CONFIG_GUI
- }
-#endif
}
#endif
@@ -938,7 +892,7 @@ static int overlay_set_attribute(overlay_t *o, int attribute, int value)
attr.value = value;
if (ioctl(o->dev, EM8300_IOCTL_OVERLAY_SET_ATTRIBUTE, &attr)==-1)
{
- mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_DXR3_FailedSettingOverlayAttribute);
+ mp_tmsg(MSGT_VO,MSGL_WARN, "[VO_DXR3] Failed setting overlay attribute.\n");
return -1;
}
@@ -1144,7 +1098,7 @@ static int overlay_set_screen(overlay_t *o, int xres, int yres, int depth)
if (ioctl(o->dev, EM8300_IOCTL_OVERLAY_SETSCREEN, &scr)==-1)
{
- mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_DXR3_FailedSettingOverlayScreen);
+ mp_tmsg(MSGT_VO,MSGL_WARN, "[VO_DXR3] Failed setting overlay screen!\nExiting.\n");
return -1;
}
return 0;
@@ -1153,7 +1107,7 @@ static int overlay_set_screen(overlay_t *o, int xres, int yres, int depth)
static int overlay_set_mode(overlay_t *o, int mode)
{
if (ioctl(o->dev, EM8300_IOCTL_OVERLAY_SETMODE, &mode)==-1) {
- mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_DXR3_FailedEnablingOverlay);
+ mp_tmsg(MSGT_VO,MSGL_WARN, "[VO_DXR3] Failed enabling overlay!\nExiting.\n");
return -1;
}
return 0;
@@ -1169,7 +1123,7 @@ static int overlay_set_window(overlay_t *o, int xpos,int ypos,int width,int heig
if (ioctl(o->dev, EM8300_IOCTL_OVERLAY_SETWINDOW, &win)==-1)
{
- mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_DXR3_FailedResizingOverlayWindow);
+ mp_tmsg(MSGT_VO,MSGL_WARN, "[VO_DXR3] Failed resizing overlay window!\n");
return -1;
}
return 0;
@@ -1184,7 +1138,7 @@ static int overlay_set_bcs(overlay_t *o, int brightness, int contrast, int satur
if (ioctl(o->dev, EM8300_IOCTL_GETBCS, &bcs)==-1)
{
- mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_DXR3_FailedSettingOverlayBcs);
+ mp_tmsg(MSGT_VO,MSGL_WARN, "[VO_DXR3] Failed setting overlay bcs!\n");
return -1;
}
return 0;
@@ -1272,11 +1226,11 @@ static int overlay_autocalibrate(overlay_t *o, pattern_drawer_cb pd, void *arg)
cal.cal_mode = EM8300_OVERLAY_CALMODE_YOFFSET;
if (ioctl(o->dev, EM8300_IOCTL_OVERLAY_CALIBRATE, &cal))
{
- mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_DXR3_FailedGettingOverlayYOffsetValues);
+ mp_tmsg(MSGT_VO,MSGL_WARN, "[VO_DXR3] Failed getting overlay Y-offset values!\nExiting.\n");
return -1;
}
o->yoffset = cal.result;
- mp_msg(MSGT_VO,MSGL_INFO, MSGTR_LIBVO_DXR3_YOffset,cal.result);
+ mp_tmsg(MSGT_VO,MSGL_INFO, "[VO_DXR3] Yoffset: %d.\n",cal.result);
/* Calibrate X-offset */
@@ -1285,11 +1239,11 @@ static int overlay_autocalibrate(overlay_t *o, pattern_drawer_cb pd, void *arg)
cal.cal_mode = EM8300_OVERLAY_CALMODE_XOFFSET;
if (ioctl(o->dev, EM8300_IOCTL_OVERLAY_CALIBRATE, &cal))
{
- mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_DXR3_FailedGettingOverlayXOffsetValues);
+ mp_tmsg(MSGT_VO,MSGL_WARN, "[VO_DXR3] Failed getting overlay X-offset values!\nExiting.\n");
return -1;
}
o->xoffset = cal.result;
- mp_msg(MSGT_VO,MSGL_INFO, MSGTR_LIBVO_DXR3_XOffset,cal.result);
+ mp_tmsg(MSGT_VO,MSGL_INFO, "[VO_DXR3] Xoffset: %d.\n",cal.result);
/* Calibrate X scale correction */
@@ -1298,10 +1252,10 @@ static int overlay_autocalibrate(overlay_t *o, pattern_drawer_cb pd, void *arg)
cal.cal_mode = EM8300_OVERLAY_CALMODE_XCORRECTION;
if (ioctl(o->dev, EM8300_IOCTL_OVERLAY_CALIBRATE, &cal))
{
- mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_DXR3_FailedGettingOverlayXScaleCorrection);
+ mp_tmsg(MSGT_VO,MSGL_WARN, "[VO_DXR3] Failed getting overlay X scale correction!\nExiting.\n");
return -1;
}
- mp_msg(MSGT_VO,MSGL_INFO, MSGTR_LIBVO_DXR3_XCorrection,cal.result);
+ mp_tmsg(MSGT_VO,MSGL_INFO, "[VO_DXR3] Xcorrection: %d.\n",cal.result);
o->xcorr = cal.result;
win.xpos = 10;
@@ -1309,7 +1263,7 @@ static int overlay_autocalibrate(overlay_t *o, pattern_drawer_cb pd, void *arg)
win.width = o->xres-20;
win.height = o->yres-20;
if (ioctl(o->dev, EM8300_IOCTL_OVERLAY_SETWINDOW, &win)==-1) {
- mp_msg(MSGT_VO,MSGL_ERR, MSGTR_LIBVO_DXR3_FailedResizingOverlayWindow);
+ mp_tmsg(MSGT_VO,MSGL_ERR, "[VO_DXR3] Failed resizing overlay window!\n");
exit(1);
}
@@ -1372,7 +1326,7 @@ static int overlay_autocalibrate(overlay_t *o, pattern_drawer_cb pd, void *arg)
static int overlay_signalmode(overlay_t *o, int mode) {
if(ioctl(o->dev, EM8300_IOCTL_OVERLAY_SIGNALMODE, &mode) ==-1) {
- mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_DXR3_FailedSetSignalMix);
+ mp_tmsg(MSGT_VO,MSGL_WARN, "[VO_DXR3] Failed to set signal mix!\n");
return -1;
}
return 0;
diff --git a/libvo/vo_fbdev.c b/libvo/vo_fbdev.c
index c3341858c2..96a173938c 100644
--- a/libvo/vo_fbdev.c
+++ b/libvo/vo_fbdev.c
@@ -1079,7 +1079,8 @@ static int preinit(const char *vo_subdevice)
if (memcmp(vo_subdevice, "vidix", 5) == 0)
vidix_name = &vo_subdevice[5];
if (vidix_name)
- pre_init_err = vidix_preinit(vidix_name, &video_out_fbdev);
+ pre_init_err = vidix_preinit(vidix_name,
+ video_out_fbdev.old_functions);
else
#endif
{
@@ -1111,7 +1112,7 @@ static uint32_t get_image(mp_image_t *mpi)
return VO_TRUE;
}
-static int control(uint32_t request, void *data, ...)
+static int control(uint32_t request, void *data)
{
switch (request) {
case VOCTRL_GET_IMAGE:
@@ -1124,27 +1125,8 @@ static int control(uint32_t request, void *data, ...)
if (vidix_name) {
switch (request) {
case VOCTRL_SET_EQUALIZER:
- {
- va_list ap;
- int value;
-
- va_start(ap, data);
- value = va_arg(ap, int);
- va_end(ap);
-
- return vidix_control(request, data, value);
- }
case VOCTRL_GET_EQUALIZER:
- {
- va_list ap;
- int *value;
-
- va_start(ap, data);
- value = va_arg(ap, int*);
- va_end(ap);
-
- return vidix_control(request, data, value);
- }
+ return vidix_control(request, data);
}
}
#endif
diff --git a/libvo/vo_fbdev2.c b/libvo/vo_fbdev2.c
index 55527a660c..c44a216b75 100644
--- a/libvo/vo_fbdev2.c
+++ b/libvo/vo_fbdev2.c
@@ -417,7 +417,7 @@ static void uninit(void)
fb_preinit(1); // so that later calls to preinit don't fail
}
-static int control(uint32_t request, void *data, ...)
+static int control(uint32_t request, void *data)
{
switch (request) {
case VOCTRL_QUERY_FORMAT:
diff --git a/libvo/vo_ggi.c b/libvo/vo_ggi.c
index 645bed2577..2be65696f5 100644
--- a/libvo/vo_ggi.c
+++ b/libvo/vo_ggi.c
@@ -83,6 +83,8 @@ static struct ggi_conf_s {
} flushregion;
int voflags;
+
+ int depthonscreen;
} ggi_conf;
@@ -210,7 +212,7 @@ static int config(uint32_t width, uint32_t height, uint32_t d_width,
ggiSetFlags(ggi_conf.drawvis, GGIFLAG_ASYNC);
}
- vo_depthonscreen = GT_DEPTH(mode.graphtype);
+ ggi_conf.depthonscreen = GT_DEPTH(mode.graphtype);
vo_screenwidth = mode.virt.x;
vo_screenheight = mode.virt.y;
@@ -374,9 +376,9 @@ static int query_format(uint32_t format)
| VFCAP_CSP_SUPPORTED_BY_HW
| VFCAP_ACCEPT_STRIDE;
- if ((!vo_depthonscreen || !vo_dbpp) && ggi_conf.vis) {
+ if ((!ggi_conf.depthonscreen || !vo_dbpp) && ggi_conf.vis) {
if (ggiGetMode(ggi_conf.vis, &mode) == 0) {
- vo_depthonscreen = GT_DEPTH(mode.graphtype);
+ ggi_conf.depthonscreen = GT_DEPTH(mode.graphtype);
vo_dbpp = GT_SIZE(mode.graphtype);
}
if (GT_SCHEME(mode.graphtype) == GT_AUTO) {
@@ -384,7 +386,7 @@ static int query_format(uint32_t format)
}
if (GT_SCHEME(mode.graphtype) != GT_TRUECOLOR) {
mode.graphtype = GT_32BIT;
- vo_depthonscreen = GT_DEPTH(mode.graphtype);
+ ggi_conf.depthonscreen = GT_DEPTH(mode.graphtype);
vo_dbpp = GT_SIZE(mode.graphtype);
}
}
@@ -468,7 +470,7 @@ static void uninit(void)
ggiExit();
}
-static int control(uint32_t request, void *data, ...)
+static int control(uint32_t request, void *data)
{
switch (request) {
case VOCTRL_QUERY_FORMAT:
diff --git a/libvo/vo_gif89a.c b/libvo/vo_gif89a.c
index eb4c178365..3a1525f244 100644
--- a/libvo/vo_gif89a.c
+++ b/libvo/vo_gif89a.c
@@ -335,7 +335,7 @@ static int query_format(uint32_t format)
return 0;
}
-static int control(uint32_t request, void *data, ...)
+static int control(uint32_t request, void *data)
{
if (request == VOCTRL_QUERY_FORMAT) {
return query_format(*((uint32_t*)data));
@@ -374,4 +374,3 @@ static void uninit(void)
reduce_data = NULL;
reduce_cmap = NULL;
}
-
diff --git a/libvo/vo_gl.c b/libvo/vo_gl.c
index 16bb1b9328..b962beabc8 100644
--- a/libvo/vo_gl.c
+++ b/libvo/vo_gl.c
@@ -31,11 +31,8 @@
#include "gl_common.h"
#include "aspect.h"
-#ifdef CONFIG_GUI
-#include "gui/interface.h"
-#endif
#include "fastmemcpy.h"
-#include "libass/ass_mp.h"
+#include "ass_mp.h"
static const vo_info_t info =
{
@@ -294,11 +291,11 @@ static void clearEOSD(void) {
eosdtex = NULL;
}
-static inline int is_tinytex(ass_image_t *i, int tinytexcur) {
+static inline int is_tinytex(ASS_Image *i, int tinytexcur) {
return i->w < TINYTEX_SIZE && i->h < TINYTEX_SIZE && tinytexcur < TINYTEX_MAX;
}
-static inline int is_smalltex(ass_image_t *i, int smalltexcur) {
+static inline int is_smalltex(ASS_Image *i, int smalltexcur) {
return i->w < SMALLTEX_SIZE && i->h < SMALLTEX_SIZE && smalltexcur < SMALLTEX_MAX;
}
@@ -323,8 +320,8 @@ static void genEOSD(mp_eosd_images_t *imgs) {
int smalltexcur = 0;
GLuint *curtex;
GLint scale_type = scaled_osd ? GL_LINEAR : GL_NEAREST;
- ass_image_t *img = imgs->imgs;
- ass_image_t *i;
+ ASS_Image *img = imgs->imgs;
+ ASS_Image *i;
if (imgs->changed == 0) // there are elements, but they are unchanged
return;
@@ -551,16 +548,8 @@ config(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uin
is_yuv |= (xs << 8) | (ys << 16);
glFindFormat(format, NULL, &gl_texfmt, &gl_format, &gl_type);
- int_pause = 0;
vo_flipped = !!(flags & VOFLAG_FLIPPING);
-#ifdef CONFIG_GUI
- if (use_gui) {
- // GUI creates and manages window for us
- guiGetEvent(guiSetShVideo, 0);
- goto glconfig;
- }
-#endif
#ifdef CONFIG_GL_WIN32
if (glctx.type == GLTYPE_W32 && !vo_w32_config(d_width, d_height, flags))
return -1;
@@ -1180,7 +1169,7 @@ static const struct {
{NULL, NULL, 0 }
};
-static int control(uint32_t request, void *data, ...)
+static int control(uint32_t request, void *data)
{
switch (request) {
case VOCTRL_PAUSE:
@@ -1203,7 +1192,6 @@ static int control(uint32_t request, void *data, ...)
{
mp_eosd_res_t *r = data;
r->w = vo_dwidth; r->h = vo_dheight;
- r->srcw = image_width; r->srch = image_height;
r->mt = r->mb = r->ml = r->mr = 0;
if (scaled_osd) {r->w = image_width; r->h = image_height;}
else if (aspect_scaling()) {
@@ -1212,8 +1200,6 @@ static int control(uint32_t request, void *data, ...)
}
}
return VO_TRUE;
- case VOCTRL_GUISUPPORT:
- return VO_TRUE;
case VOCTRL_ONTOP:
glctx.ontop();
return VO_TRUE;
@@ -1234,33 +1220,25 @@ static int control(uint32_t request, void *data, ...)
return VO_TRUE;
case VOCTRL_GET_EQUALIZER:
if (is_yuv) {
+ struct voctrl_get_equalizer_args *args = data;
int i;
- va_list va;
- int *value;
- va_start(va, data);
- value = va_arg(va, int *);
- va_end(va);
for (i = 0; eq_map[i].name; i++)
- if (strcmp(data, eq_map[i].name) == 0) break;
+ if (strcmp(args->name, eq_map[i].name) == 0) break;
if (!(eq_map[i].supportmask & (1 << use_yuv)))
break;
- *value = *eq_map[i].value;
+ *args->valueptr = *eq_map[i].value;
return VO_TRUE;
}
break;
case VOCTRL_SET_EQUALIZER:
if (is_yuv) {
+ struct voctrl_set_equalizer_args *args = data;
int i;
- va_list va;
- int value;
- va_start(va, data);
- value = va_arg(va, int);
- va_end(va);
for (i = 0; eq_map[i].name; i++)
- if (strcmp(data, eq_map[i].name) == 0) break;
+ if (strcmp(args->name, eq_map[i].name) == 0) break;
if (!(eq_map[i].supportmask & (1 << use_yuv)))
break;
- *eq_map[i].value = value;
+ *eq_map[i].value = args->value;
update_yuvconv();
return VO_TRUE;
}
@@ -1268,6 +1246,14 @@ static int control(uint32_t request, void *data, ...)
case VOCTRL_UPDATE_SCREENINFO:
glctx.update_xinerama_info();
return VO_TRUE;
+ case VOCTRL_REDRAW_OSD:
+ if (vo_doublebuffering)
+ do_render();
+ draw_osd();
+ if (vo_doublebuffering)
+ do_render_osd(2);
+ flip_page();
+ return VO_TRUE;
}
return VO_NOTIMPL;
}
diff --git a/libvo/vo_gl2.c b/libvo/vo_gl2.c
index 9d1bd533d1..ae04cf4139 100644
--- a/libvo/vo_gl2.c
+++ b/libvo/vo_gl2.c
@@ -33,9 +33,6 @@
#include "gl_common.h"
#include "aspect.h"
-#ifdef CONFIG_GUI
-#include "gui/interface.h"
-#endif
#undef TEXTUREFORMAT_ALWAYS
#ifdef __APPLE__
@@ -550,13 +547,6 @@ static int config_glx(uint32_t width, uint32_t height, uint32_t d_width, uint32_
}
#endif
-#ifdef CONFIG_GUI
-static int config_glx_gui(uint32_t d_width, uint32_t d_height) {
- guiGetEvent( guiSetShVideo,0 ); // the GUI will set up / resize the window
- return 0;
-}
-#endif
-
static int initGl(uint32_t d_width, uint32_t d_height)
{
fragprog = lookupTex = 0;
@@ -629,17 +619,6 @@ config(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uin
is_yuv = mp_get_chroma_shift(image_format, &xs, &ys) > 0;
is_yuv |= (xs << 8) | (ys << 16);
- int_pause = 0;
-
-#ifdef CONFIG_GUI
- if (use_gui) {
- if (config_glx_gui(d_width, d_height) == -1)
- return -1;
- }
-#ifndef CONFIG_GL_WIN32
- else
-#endif
-#endif
#ifdef CONFIG_GL_WIN32
if (config_w32(width, height, d_width, d_height, flags, title, format) == -1)
#else
@@ -888,7 +867,7 @@ static int preinit(const char *arg)
return 0;
}
-static int control(uint32_t request, void *data, ...)
+static int control(uint32_t request, void *data)
{
switch (request) {
case VOCTRL_PAUSE:
@@ -897,8 +876,6 @@ static int control(uint32_t request, void *data, ...)
return VO_TRUE;
case VOCTRL_QUERY_FORMAT:
return query_format(*((uint32_t*)data));
- case VOCTRL_GUISUPPORT:
- return VO_TRUE;
case VOCTRL_ONTOP:
glctx.ontop();
return VO_TRUE;
@@ -919,23 +896,13 @@ static int control(uint32_t request, void *data, ...)
#ifndef CONFIG_GL_WIN32
case VOCTRL_SET_EQUALIZER:
{
- va_list ap;
- int value;
-
- va_start(ap, data);
- value = va_arg(ap, int);
- va_end(ap);
- return vo_x11_set_equalizer(data, value);
+ struct voctrl_set_equalizer_args *args = data;
+ return vo_x11_set_equalizer(args->name, args->value);
}
case VOCTRL_GET_EQUALIZER:
{
- va_list ap;
- int *value;
-
- va_start(ap, data);
- value = va_arg(ap, int *);
- va_end(ap);
- return vo_x11_get_equalizer(data, value);
+ struct voctrl_get_equalizer_args *args = data;
+ return vo_x11_get_equalizer(args->name, args->valueptr);
}
#endif
case VOCTRL_UPDATE_SCREENINFO:
diff --git a/libvo/vo_ivtv.c b/libvo/vo_ivtv.c
index 8c79bf4041..d39edcbcea 100644
--- a/libvo/vo_ivtv.c
+++ b/libvo/vo_ivtv.c
@@ -108,7 +108,7 @@ ivtv_reset (int blank_screen)
}
int
-ivtv_write (unsigned char *data, int len)
+ivtv_write (const unsigned char *data, int len)
{
if (ivtv_fd < 0)
return 0;
@@ -285,7 +285,7 @@ query_format (uint32_t format)
}
static int
-control (uint32_t request, void *data, ...)
+control (uint32_t request, void *data)
{
switch (request)
{
diff --git a/libvo/vo_jpeg.c b/libvo/vo_jpeg.c
index 1be11014b0..112ec0c2ef 100644
--- a/libvo/vo_jpeg.c
+++ b/libvo/vo_jpeg.c
@@ -44,7 +44,7 @@
#include "mp_msg.h"
#include "video_out.h"
#include "video_out_internal.h"
-#include "mplayer.h" /* for exit_player() */
+#include "mplayer.h" /* for exit_player_bad() */
#include "help_mp.h"
/* ------------------------------------------------------------------------- */
@@ -118,36 +118,36 @@ static void jpeg_mkdir(char *buf, int verbose) {
case EEXIST:
if ( stat(buf, &stat_p ) < 0 ) {
mp_msg(MSGT_VO, MSGL_ERR, "%s: %s: %s\n", info.short_name,
- MSGTR_VO_GenericError, strerror(errno) );
+ _("This error has occurred"), strerror(errno) );
mp_msg(MSGT_VO, MSGL_ERR, "%s: %s %s\n", info.short_name,
- MSGTR_VO_UnableToAccess,buf);
- exit_player(MSGTR_Exit_error);
+ _("Unable to access"), buf);
+ exit_player_bad(_("Fatal error"));
}
if ( !S_ISDIR(stat_p.st_mode) ) {
mp_msg(MSGT_VO, MSGL_ERR, "%s: %s %s\n", info.short_name,
- buf, MSGTR_VO_ExistsButNoDirectory);
- exit_player(MSGTR_Exit_error);
+ buf, _("already exists, but is not a directory."));
+ exit_player_bad(_("Fatal error"));
}
if ( !(stat_p.st_mode & S_IWUSR) ) {
mp_msg(MSGT_VO, MSGL_ERR, "%s: %s - %s\n", info.short_name,
- buf, MSGTR_VO_DirExistsButNotWritable);
- exit_player(MSGTR_Exit_error);
+ buf, _("Output directory already exists, but is not writable."));
+ exit_player_bad(_("Fatal error"));
}
mp_msg(MSGT_VO, MSGL_INFO, "%s: %s - %s\n", info.short_name,
- buf, MSGTR_VO_DirExistsAndIsWritable);
+ buf, _("Output directory already exists and is writable."));
break;
default:
mp_msg(MSGT_VO, MSGL_ERR, "%s: %s: %s\n", info.short_name,
- MSGTR_VO_GenericError, strerror(errno) );
+ _("This error has occurred"), strerror(errno) );
mp_msg(MSGT_VO, MSGL_ERR, "%s: %s - %s\n", info.short_name,
- buf, MSGTR_VO_CantCreateDirectory);
- exit_player(MSGTR_Exit_error);
+ buf, _("Unable to create output directory."));
+ exit_player_bad(_("Fatal error"));
} /* end switch */
} else if ( verbose ) {
mp_msg(MSGT_VO, MSGL_INFO, "%s: %s - %s\n", info.short_name,
- buf, MSGTR_VO_DirectoryCreateSuccess);
+ buf, _("Output directory successfully created."));
} /* end if */
}
@@ -188,11 +188,11 @@ static uint32_t jpeg_write(uint8_t * name, uint8_t * buffer)
if ( !buffer ) return 1;
if ( (outfile = fopen(name, "wb") ) == NULL ) {
mp_msg(MSGT_VO, MSGL_ERR, "\n%s: %s\n", info.short_name,
- MSGTR_VO_CantCreateFile);
+ _("Unable to create output file."));
mp_msg(MSGT_VO, MSGL_ERR, "%s: %s: %s\n",
- info.short_name, MSGTR_VO_GenericError,
- strerror(errno) );
- exit_player(MSGTR_Exit_error);
+ info.short_name, _("This error has occurred"),
+ strerror(errno) );
+ exit_player_bad(_("Fatal error"));
}
cinfo.err = jpeg_std_error(&jerr);
@@ -356,7 +356,7 @@ static int preinit(const char *arg)
const char *info_message = NULL;
mp_msg(MSGT_VO, MSGL_INFO, "%s: %s\n", info.short_name,
- MSGTR_VO_ParsingSuboptions);
+ _("Parsing suboptions."));
jpeg_progressive_mode = 0;
jpeg_baseline = 1;
@@ -371,12 +371,12 @@ static int preinit(const char *arg)
return -1;
}
- if (jpeg_progressive_mode) info_message = MSGTR_VO_JPEG_ProgressiveJPEG;
- else info_message = MSGTR_VO_JPEG_NoProgressiveJPEG;
+ if (jpeg_progressive_mode) info_message = _("Progressive JPEG enabled.");
+ else info_message = _("Progressive JPEG disabled.");
mp_msg(MSGT_VO, MSGL_INFO, "%s: %s\n", info.short_name, info_message);
- if (jpeg_baseline) info_message = MSGTR_VO_JPEG_BaselineJPEG;
- else info_message = MSGTR_VO_JPEG_NoBaselineJPEG;
+ if (jpeg_baseline) info_message = _("Baseline JPEG enabled.");
+ else info_message = _("Baseline JPEG disabled.");
mp_msg(MSGT_VO, MSGL_INFO, "%s: %s\n", info.short_name, info_message);
mp_msg(MSGT_VO, MSGL_V, "%s: optimize --> %d\n", info.short_name,
@@ -397,13 +397,13 @@ static int preinit(const char *arg)
}
mp_msg(MSGT_VO, MSGL_INFO, "%s: %s\n", info.short_name,
- MSGTR_VO_SuboptionsParsedOK);
+ _("Suboptions parsed OK."));
return 0;
}
/* ------------------------------------------------------------------------- */
-static int control(uint32_t request, void *data, ...)
+static int control(uint32_t request, void *data)
{
switch (request) {
case VOCTRL_QUERY_FORMAT:
@@ -417,4 +417,3 @@ static int control(uint32_t request, void *data, ...)
#undef BUFLENGTH
/* ------------------------------------------------------------------------- */
-
diff --git a/libvo/vo_kva.c b/libvo/vo_kva.c
index 4805d51fbd..fbd670e790 100644
--- a/libvo/vo_kva.c
+++ b/libvo/vo_kva.c
@@ -933,7 +933,7 @@ static int color_ctrl_get(char *what, int *value)
return VO_TRUE;
}
-static int control(uint32_t request, void *data, ...)
+static int control(uint32_t request, void *data)
{
switch (request) {
case VOCTRL_GET_IMAGE:
@@ -950,26 +950,14 @@ static int control(uint32_t request, void *data, ...)
case VOCTRL_SET_EQUALIZER:
{
- va_list ap;
- int value;
-
- va_start(ap, data);
- value = va_arg(ap, int);
- va_end(ap);
-
- return color_ctrl_set(data, value);
+ struct voctrl_set_equalizer_args *args = data;
+ color_ctrl_set(args->name, args->value);
}
case VOCTRL_GET_EQUALIZER:
{
- va_list ap;
- int *value;
-
- va_start(ap, data);
- value = va_arg(ap, int *);
- va_end(ap);
-
- return color_ctrl_get(data, value);
+ struct voctrl_get_equalizer_args *args = data;
+ return color_ctrl_get(args->name, args->valueptr);
}
case VOCTRL_UPDATE_SCREENINFO:
diff --git a/libvo/vo_matrixview.c b/libvo/vo_matrixview.c
index 8c6b0276d1..002494b0bd 100644
--- a/libvo/vo_matrixview.c
+++ b/libvo/vo_matrixview.c
@@ -275,7 +275,7 @@ static int preinit(const char *arg)
}
-static int control(uint32_t request, void *data, ...)
+static int control(uint32_t request, void *data)
{
switch (request) {
case VOCTRL_PAUSE:
@@ -296,29 +296,23 @@ static int control(uint32_t request, void *data, ...)
return VO_TRUE;
case VOCTRL_GET_EQUALIZER:
{
- va_list va;
- int *value;
- va_start(va, data);
- value = va_arg(va, int *);
- va_end(va);
- if (strcasecmp(data, "contrast") == 0) {
- *value = eq_contrast;
- } else if (strcasecmp(data, "brightness") == 0) {
- *value = eq_brightness;
+ struct voctrl_get_equalizer_args *args = data;
+ if (strcasecmp(args->name, "contrast") == 0) {
+ *args->valueptr = eq_contrast;
+ }
+ else if (strcasecmp(args->name, "brightness") == 0) {
+ *args->valueptr = eq_brightness;
}
}
return VO_TRUE;
case VOCTRL_SET_EQUALIZER:
{
- va_list va;
- int value;
- va_start(va, data);
- value = va_arg(va, int);
- va_end(va);
- if (strcasecmp(data, "contrast") == 0) {
- contrast_set(value);
- } else if (strcasecmp(data, "brightness") == 0) {
- brightness_set(value);
+ struct voctrl_set_equalizer_args *args = data;
+ if (strcasecmp(args->name, "contrast") == 0) {
+ contrast_set(args->value);
+ }
+ else if (strcasecmp(args->name, "brightness") == 0) {
+ brightness_set(args->value);
}
}
return VO_TRUE;
diff --git a/libvo/vo_md5sum.c b/libvo/vo_md5sum.c
index 754630f2da..b279ea5ad6 100644
--- a/libvo/vo_md5sum.c
+++ b/libvo/vo_md5sum.c
@@ -40,7 +40,7 @@
#include "mp_msg.h"
#include "video_out.h"
#include "video_out_internal.h"
-#include "mplayer.h" /* for exit_player() */
+#include "mplayer.h" /* for exit_player_bad() */
#include "help_mp.h"
#include "libavutil/md5.h"
@@ -85,8 +85,8 @@ int framenum = 0;
*/
static void md5sum_write_error(void) {
- mp_msg(MSGT_VO, MSGL_ERR, MSGTR_ErrorWritingFile, info.short_name);
- exit_player(MSGTR_Exit_error);
+ mp_tmsg(MSGT_VO, MSGL_ERR, "%s: Error writing file.\n", info.short_name);
+ exit_player_bad(_("Fatal error"));
}
/* ------------------------------------------------------------------------- */
@@ -113,7 +113,7 @@ static int preinit(const char *arg)
};
mp_msg(MSGT_VO, MSGL_INFO, "%s: %s\n", info.short_name,
- MSGTR_VO_ParsingSuboptions);
+ _("Parsing suboptions."));
md5sum_outfile = strdup("md5sums");
if (subopt_parse(arg, subopts) != 0) {
@@ -124,7 +124,7 @@ static int preinit(const char *arg)
md5sum_outfile);
mp_msg(MSGT_VO, MSGL_INFO, "%s: %s\n", info.short_name,
- MSGTR_VO_SuboptionsParsedOK);
+ _("Suboptions parsed OK."));
return 0;
}
@@ -149,10 +149,10 @@ static int config(uint32_t width, uint32_t height, uint32_t d_width,
if ( (md5sum_fd = fopen(md5sum_outfile, "w") ) == NULL ) {
mp_msg(MSGT_VO, MSGL_ERR, "\n%s: %s\n", info.short_name,
- MSGTR_VO_CantCreateFile);
+ _("Unable to create output file."));
mp_msg(MSGT_VO, MSGL_ERR, "%s: %s: %s\n",
- info.short_name, MSGTR_VO_GenericError, strerror(errno) );
- exit_player(MSGTR_Exit_error);
+ info.short_name, _("This error has occurred"), strerror(errno) );
+ exit_player_bad(_("Fatal error"));
}
return 0;
@@ -264,7 +264,7 @@ static int query_format(uint32_t format)
/* ------------------------------------------------------------------------- */
-static int control(uint32_t request, void *data, ...)
+static int control(uint32_t request, void *data)
{
switch (request) {
case VOCTRL_QUERY_FORMAT:
@@ -311,4 +311,3 @@ static void flip_page (void)
#undef MD5SUM_YUV_MODE
/* ------------------------------------------------------------------------- */
-
diff --git a/libvo/vo_mga.c b/libvo/vo_mga.c
index 7a365151ac..a83b75285f 100644
--- a/libvo/vo_mga.c
+++ b/libvo/vo_mga.c
@@ -85,7 +85,7 @@ static int config(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_
aspect(&d_width,&d_height,A_NOZOOM);
vo_fs = VO_FALSE;
}
- mp_msg(MSGT_VO,MSGL_INFO, MSGTR_LIBVO_MGA_AspectResized,d_width,d_height);
+ mp_tmsg(MSGT_VO,MSGL_INFO, "[VO_MGA] aspect(): resized to %dx%d.\n",d_width,d_height);
}
vo_dwidth=d_width; vo_dheight=d_height;
@@ -103,7 +103,7 @@ static int config(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_
static void uninit(void)
{
- mp_msg(MSGT_VO,MSGL_INFO, MSGTR_LIBVO_MGA_Uninit);
+ mp_tmsg(MSGT_VO,MSGL_INFO, "[VO] uninit!\n");
mga_uninit();
}
@@ -116,4 +116,3 @@ static void flip_page(void)
static void check_events(void)
{
}
-
diff --git a/libvo/vo_mpegpes.c b/libvo/vo_mpegpes.c
index 94fe08f6f2..b96b0af639 100644
--- a/libvo/vo_mpegpes.c
+++ b/libvo/vo_mpegpes.c
@@ -185,7 +185,7 @@ static void draw_osd(void)
}
-static int my_write(unsigned char* data,int len){
+static int my_write(const unsigned char* data,int len){
int orig_len = len;
#ifdef CONFIG_DVB
#define NFD 2
@@ -220,15 +220,10 @@ static int my_write(unsigned char* data,int len){
return orig_len;
}
-void send_pes_packet(unsigned char* data,int len,int id,int timestamp){
+static void send_pes_packet(unsigned char* data,int len,int id,int timestamp){
send_mpeg_pes_packet (data, len, id, timestamp, 1, my_write);
}
-void send_lpcm_packet(unsigned char* data,int len,int id,unsigned int timestamp,int freq_id){
- send_mpeg_lpcm_packet(data, len, id, timestamp, freq_id, my_write);
-}
-
-
static int draw_frame(uint8_t * src[])
{
vo_mpegpes_t *p=(vo_mpegpes_t *)src[0];
@@ -266,7 +261,7 @@ static void check_events(void)
{
}
-static int control(uint32_t request, void *data, ...)
+static int control(uint32_t request, void *data)
{
switch (request) {
case VOCTRL_QUERY_FORMAT:
diff --git a/libvo/vo_null.c b/libvo/vo_null.c
index a6b14b4edd..9bcd4a2c24 100644
--- a/libvo/vo_null.c
+++ b/libvo/vo_null.c
@@ -92,13 +92,13 @@ static int preinit(const char *arg)
{
if(arg)
{
- mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_NULL_UnknownSubdevice,arg);
+ mp_tmsg(MSGT_VO,MSGL_WARN, "[VO_NULL] Unknown subdevice: %s.\n",arg);
return ENOSYS;
}
return 0;
}
-static int control(uint32_t request, void *data, ...)
+static int control(uint32_t request, void *data)
{
switch (request) {
case VOCTRL_QUERY_FORMAT:
diff --git a/libvo/vo_png.c b/libvo/vo_png.c
index 0f449cd9e3..bce8d05390 100644
--- a/libvo/vo_png.c
+++ b/libvo/vo_png.c
@@ -26,22 +26,16 @@
#include <stdlib.h>
#include <string.h>
#include <errno.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <unistd.h>
#include "config.h"
-#include "fmt-conversion.h"
#include "mp_msg.h"
#include "mp_msg.h"
#include "help_mp.h"
#include "video_out.h"
#include "video_out_internal.h"
#include "subopt-helper.h"
-#include "mplayer.h"
#include "libavcodec/avcodec.h"
-
-#define BUFLENGTH 512
+#include "fmt-conversion.h"
static const vo_info_t info =
{
@@ -54,72 +48,21 @@ static const vo_info_t info =
const LIBVO_EXTERN (png)
static int z_compression;
-static char *png_outdir;
static int framenum;
static int use_alpha;
static AVCodecContext *avctx;
static uint8_t *outbuffer;
int outbuffer_size;
-static void png_mkdir(char *buf, int verbose) {
- struct stat stat_p;
-
-#ifndef __MINGW32__
- if ( mkdir(buf, 0755) < 0 ) {
-#else
- if ( mkdir(buf) < 0 ) {
-#endif
- switch (errno) { /* use switch in case other errors need to be caught
- and handled in the future */
- case EEXIST:
- if ( stat(buf, &stat_p ) < 0 ) {
- mp_msg(MSGT_VO, MSGL_ERR, "%s: %s: %s\n", info.short_name,
- MSGTR_VO_GenericError, strerror(errno) );
- mp_msg(MSGT_VO, MSGL_ERR, "%s: %s %s\n", info.short_name,
- MSGTR_VO_UnableToAccess,buf);
- exit_player(MSGTR_Exit_error);
- }
- if ( !S_ISDIR(stat_p.st_mode) ) {
- mp_msg(MSGT_VO, MSGL_ERR, "%s: %s %s\n", info.short_name,
- buf, MSGTR_VO_ExistsButNoDirectory);
- exit_player(MSGTR_Exit_error);
- }
- if ( !(stat_p.st_mode & S_IWUSR) ) {
- mp_msg(MSGT_VO, MSGL_ERR, "%s: %s - %s\n", info.short_name,
- buf, MSGTR_VO_DirExistsButNotWritable);
- exit_player(MSGTR_Exit_error);
- }
-
- mp_msg(MSGT_VO, MSGL_INFO, "%s: %s - %s\n", info.short_name,
- buf, MSGTR_VO_DirExistsAndIsWritable);
- break;
-
- default:
- mp_msg(MSGT_VO, MSGL_ERR, "%s: %s: %s\n", info.short_name,
- MSGTR_VO_GenericError, strerror(errno) );
- mp_msg(MSGT_VO, MSGL_ERR, "%s: %s - %s\n", info.short_name,
- buf, MSGTR_VO_CantCreateDirectory);
- exit_player(MSGTR_Exit_error);
- } /* end switch */
- } else if ( verbose ) {
- mp_msg(MSGT_VO, MSGL_INFO, "%s: %s - %s\n", info.short_name,
- buf, MSGTR_VO_DirectoryCreateSuccess);
- } /* end if */
-}
-
static int
config(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uint32_t flags, char *title, uint32_t format)
{
- char buf[BUFLENGTH];
-
if(z_compression == 0) {
- mp_msg(MSGT_VO,MSGL_INFO, MSGTR_LIBVO_PNG_Warning1);
- mp_msg(MSGT_VO,MSGL_INFO, MSGTR_LIBVO_PNG_Warning2);
- mp_msg(MSGT_VO,MSGL_INFO, MSGTR_LIBVO_PNG_Warning3);
+ mp_tmsg(MSGT_VO,MSGL_INFO, "[VO_PNG] Warning: compression level set to 0, compression disabled!\n");
+ mp_tmsg(MSGT_VO,MSGL_INFO, "[VO_PNG] Info: Use -vo png:z=<n> to set compression level from 0 to 9.\n");
+ mp_tmsg(MSGT_VO,MSGL_INFO, "[VO_PNG] Info: (0 = no compression, 1 = fastest, lowest - 9 best, slowest compression)\n");
}
- snprintf(buf, BUFLENGTH, "%s", png_outdir);
- png_mkdir(buf, 1);
mp_msg(MSGT_VO,MSGL_DBG2, "PNG Compression level %i\n", z_compression);
return 0;
@@ -136,10 +79,10 @@ static uint32_t draw_image(mp_image_t* mpi){
// if -dr or -slices then do nothing:
if(mpi->flags&(MP_IMGFLAG_DIRECT|MP_IMGFLAG_DRAW_CALLBACK)) return VO_TRUE;
- snprintf (buf, 100, "%s/%08d.png", png_outdir, ++framenum);
+ snprintf (buf, 100, "%08d.png", ++framenum);
outfile = fopen(buf, "wb");
if (!outfile) {
- mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_PNG_ErrorOpeningForWriting, strerror(errno));
+ mp_msg(MSGT_VO,MSGL_WARN, "\n[VO_PNG] Error opening '%s' for writing!\n", strerror(errno));
return 1;
}
@@ -157,7 +100,7 @@ static uint32_t draw_image(mp_image_t* mpi){
res = avcodec_encode_video(avctx, outbuffer, outbuffer_size, &pic);
if(res < 0){
- mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_PNG_ErrorInCreatePng);
+ mp_msg(MSGT_VO,MSGL_WARN, "[VO_PNG] Error in create_png.\n");
fclose(outfile);
return 1;
}
@@ -200,10 +143,6 @@ static void uninit(void){
av_freep(&avctx);
av_freep(&outbuffer);
outbuffer_size = 0;
- if (png_outdir) {
- free(png_outdir);
- png_outdir = NULL;
- }
}
static void check_events(void){}
@@ -217,14 +156,12 @@ static int int_zero_to_nine(void *value)
static const opt_t subopts[] = {
{"alpha", OPT_ARG_BOOL, &use_alpha, NULL},
{"z", OPT_ARG_INT, &z_compression, int_zero_to_nine},
- {"outdir", OPT_ARG_MSTRZ, &png_outdir, NULL},
{NULL}
};
static int preinit(const char *arg)
{
z_compression = 0;
- png_outdir = strdup(".");
use_alpha = 0;
if (subopt_parse(arg, subopts) != 0) {
return -1;
@@ -239,7 +176,7 @@ static int preinit(const char *arg)
return 0;
}
-static int control(uint32_t request, void *data, ...)
+static int control(uint32_t request, void *data)
{
switch (request) {
case VOCTRL_DRAW_IMAGE:
diff --git a/libvo/vo_pnm.c b/libvo/vo_pnm.c
index 20290272bc..0ced629da0 100644
--- a/libvo/vo_pnm.c
+++ b/libvo/vo_pnm.c
@@ -39,7 +39,7 @@
#include "mp_msg.h"
#include "video_out.h"
#include "video_out_internal.h"
-#include "mplayer.h" /* for exit_player() */
+#include "mplayer.h" /* for exit_player_bad() */
#include "help_mp.h"
/* ------------------------------------------------------------------------- */
@@ -97,8 +97,8 @@ char *pnm_file_extension = NULL;
*/
static void pnm_write_error(void) {
- mp_msg(MSGT_VO, MSGL_ERR, MSGTR_ErrorWritingFile, info.short_name);
- exit_player(MSGTR_Exit_error);
+ mp_tmsg(MSGT_VO, MSGL_ERR, "%s: Error writing file.\n", info.short_name);
+ exit_player_bad(_("Fatal error"));
}
/* ------------------------------------------------------------------------- */
@@ -134,7 +134,7 @@ static int preinit(const char *arg)
const char *info_message = NULL;
mp_msg(MSGT_VO, MSGL_INFO, "%s: %s\n", info.short_name,
- MSGTR_VO_ParsingSuboptions);
+ _("Parsing suboptions."));
pnm_maxfiles = 1000;
pnm_outdir = strdup(".");
@@ -155,29 +155,29 @@ static int preinit(const char *arg)
switch (pnm_mode) {
case PNM_ASCII_MODE:
- info_message = MSGTR_VO_PNM_ASCIIMode;
+ info_message = _("ASCII mode enabled.");
break;
case PNM_RAW_MODE:
- info_message = MSGTR_VO_PNM_RawMode;
+ info_message = _("Raw mode enabled.");
break;
}
mp_msg(MSGT_VO, MSGL_INFO, "%s: %s\n", info.short_name, info_message);
switch (pnm_type) {
case PNM_TYPE_PPM:
- info_message = MSGTR_VO_PNM_PPMType;
+ info_message = _("Will write PPM files.");
break;
case PNM_TYPE_PGM:
- info_message = MSGTR_VO_PNM_PGMType;
+ info_message = _("Will write PGM files.");
break;
case PNM_TYPE_PGMYUV:
- info_message = MSGTR_VO_PNM_PGMYUVType;
+ info_message = _("Will write PGMYUV files.");
break;
}
mp_msg(MSGT_VO, MSGL_INFO, "%s: %s\n", info.short_name, info_message);
mp_msg(MSGT_VO, MSGL_INFO, "%s: %s\n", info.short_name,
- MSGTR_VO_SuboptionsParsedOK);
+ _("Suboptions parsed OK."));
return 0;
}
@@ -211,38 +211,38 @@ static void pnm_mkdir(char *buf, int verbose) {
case EEXIST:
if ( stat(buf, &stat_p ) < 0 ) {
mp_msg(MSGT_VO, MSGL_ERR, "%s: %s: %s\n", info.short_name,
- MSGTR_VO_GenericError, strerror(errno) );
+ _("This error has occurred"), strerror(errno) );
mp_msg(MSGT_VO, MSGL_ERR, "%s: %s %s\n", info.short_name,
- MSGTR_VO_UnableToAccess,buf);
- exit_player(MSGTR_Exit_error);
+ _("Unable to access"), buf);
+ exit_player_bad(_("Fatal error"));
}
if ( !S_ISDIR(stat_p.st_mode) ) {
mp_msg(MSGT_VO, MSGL_ERR, "%s: %s %s\n", info.short_name,
- buf, MSGTR_VO_ExistsButNoDirectory);
- exit_player(MSGTR_Exit_error);
+ buf, _("already exists, but is not a directory."));
+ exit_player_bad(_("Fatal error"));
}
if ( !(stat_p.st_mode & S_IWUSR) ) {
mp_msg(MSGT_VO, MSGL_ERR, "%s: %s - %s\n", info.short_name,
- buf, MSGTR_VO_DirExistsButNotWritable);
- exit_player(MSGTR_Exit_error);
+ buf, _("Output directory already exists, but is not writable."));
+ exit_player_bad(_("Fatal error"));
}
if (strcmp(buf, ".") != 0) {
mp_msg(MSGT_VO, MSGL_INFO, "%s: %s - %s\n", info.short_name,
- buf, MSGTR_VO_DirExistsAndIsWritable);
+ buf, _("Output directory already exists and is writable."));
}
break;
default:
mp_msg(MSGT_VO, MSGL_ERR, "%s: %s: %s\n", info.short_name,
- MSGTR_VO_GenericError, strerror(errno) );
+ _("This error has occurred"), strerror(errno) );
mp_msg(MSGT_VO, MSGL_ERR, "%s: %s - %s\n", info.short_name,
- buf, MSGTR_VO_CantCreateDirectory);
- exit_player(MSGTR_Exit_error);
+ buf, _("Unable to create output directory."));
+ exit_player_bad(_("Fatal error"));
} /* end switch */
} else if ( verbose ) {
mp_msg(MSGT_VO, MSGL_INFO, "%s: %s - %s\n", info.short_name,
- buf, MSGTR_VO_DirectoryCreateSuccess);
+ buf, _("Output directory successfully created."));
} /* end if */
}
@@ -442,7 +442,7 @@ static void pnm_write_image(mp_image_t *mpi)
if (!mpi) {
mp_msg(MSGT_VO, MSGL_ERR, "%s: No image data suplied to video output driver\n", info.short_name );
- exit_player(MSGTR_Exit_error);
+ exit_player_bad(_("Fatal error"));
}
/* Start writing to new subdirectory after a certain amount of frames */
@@ -470,11 +470,11 @@ static void pnm_write_image(mp_image_t *mpi)
if ( (outfile = fopen(buf, "wb") ) == NULL ) {
mp_msg(MSGT_VO, MSGL_ERR, "\n%s: %s\n", info.short_name,
- MSGTR_VO_CantCreateFile);
+ "Unable to create output file.");
mp_msg(MSGT_VO, MSGL_ERR, "%s: %s: %s\n",
- info.short_name, MSGTR_VO_GenericError,
+ info.short_name, "This error has occurred",
strerror(errno) );
- exit_player(MSGTR_Exit_error);
+ exit_player_bad(_("Fatal error"));
}
pnm_write_pnm(outfile, mpi);
@@ -542,7 +542,7 @@ static int query_format(uint32_t format)
/* ------------------------------------------------------------------------- */
-static int control(uint32_t request, void *data, ...)
+static int control(uint32_t request, void *data)
{
switch (request) {
case VOCTRL_QUERY_FORMAT:
@@ -595,4 +595,3 @@ static void flip_page (void)
#undef PNM_TYPE_PGMYUV
/* ------------------------------------------------------------------------- */
-
diff --git a/libvo/vo_quartz.c b/libvo/vo_quartz.c
index 46c78b0583..42c9eb4ed4 100644
--- a/libvo/vo_quartz.c
+++ b/libvo/vo_quartz.c
@@ -1179,7 +1179,7 @@ static uint32_t get_yuv_image(mp_image_t * mpi)
return VO_FALSE;
}
-static int control(uint32_t request, void *data, ...)
+static int control(uint32_t request, void *data)
{
switch (request)
{
diff --git a/libvo/vo_s3fb.c b/libvo/vo_s3fb.c
index c45b2c66e4..5b884b75b8 100644
--- a/libvo/vo_s3fb.c
+++ b/libvo/vo_s3fb.c
@@ -521,7 +521,7 @@ static uint32_t get_image(mp_image_t *mpi)
return VO_TRUE;
}
-static int control(uint32_t request, void *data, ...)
+static int control(uint32_t request, void *data)
{
switch(request) {
case VOCTRL_GET_IMAGE:
diff --git a/libvo/vo_sdl.c b/libvo/vo_sdl.c
index 17ab0239b1..617ffec0c5 100644
--- a/libvo/vo_sdl.c
+++ b/libvo/vo_sdl.c
@@ -429,7 +429,7 @@ static int sdl_open (void *plugin, void *name)
*/
priv->sdlflags &= ~SDL_HWSURFACE;
if ((!SDL_ListModes (vidInfo->vfmt, priv->sdlflags)) && (!priv->fullmodes)) {
- mp_msg(MSGT_VO,MSGL_ERR, MSGTR_LIBVO_SDL_CouldntGetAnyAcceptableSDLModeForOutput);
+ mp_tmsg(MSGT_VO,MSGL_ERR, "[VO_SDL] Couldn't get any acceptable SDL Mode for output.\n");
return -1;
}
}
@@ -710,7 +710,7 @@ static void set_fullmode (int mode) {
setup_surfaces();
}
else
- mp_msg(MSGT_VO,MSGL_INFO, MSGTR_LIBVO_SDL_SetVideoModeFailedFull, SDL_GetError());
+ mp_tmsg(MSGT_VO,MSGL_INFO, "[VO_SDL] Set_fullmode: SDL_SetVideoMode failed: %s.\n", SDL_GetError());
}
@@ -732,7 +732,7 @@ config(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uin
switch(format){
case IMGFMT_I420:
- mp_msg(MSGT_VO,MSGL_INFO, MSGTR_LIBVO_SDL_MappingI420ToIYUV);
+ mp_tmsg(MSGT_VO,MSGL_INFO, "[VO_SDL] Mapping I420 to IYUV.\n");
format = SDL_IYUV_OVERLAY;
case IMGFMT_YV12:
case IMGFMT_IYUV:
@@ -754,7 +754,7 @@ config(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uin
priv->mode = RGB;
break;
default:
- mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_SDL_UnsupportedImageFormat,format);
+ mp_tmsg(MSGT_VO,MSGL_WARN, "[VO_SDL] Unsupported image format (0x%X).\n",format);
return -1;
}
@@ -812,7 +812,7 @@ config(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uin
}
if(flags&VOFLAG_FULLSCREEN) {
mp_msg(MSGT_VO,MSGL_V, "SDL: setting zoomed fullscreen without modeswitching\n");
- mp_msg(MSGT_VO,MSGL_INFO, MSGTR_LIBVO_SDL_InfoPleaseUseVmOrZoom);
+ mp_tmsg(MSGT_VO,MSGL_INFO, "[VO_SDL] Info - please use -vm or -zoom to switch to the best resolution.\n");
priv->fulltype = VOFLAG_FULLSCREEN;
set_fullmode(priv->fullmode);
/*if((priv->surface = SDL_SetVideoMode (d_width, d_height, priv->bpp, priv->sdlfullflags)))
@@ -849,7 +849,7 @@ config(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uin
}
if(!priv->surface) { // cannot SetVideoMode
- mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_SDL_FailedToSetVideoMode, SDL_GetError());
+ mp_tmsg(MSGT_VO,MSGL_WARN, "[VO_SDL] Failed to set video mode: %s.\n", SDL_GetError());
return -1;
}
@@ -937,7 +937,7 @@ static int setup_surfaces(void)
default:
/* Initialize and create the YUV Overlay used for video out */
if (!(priv->overlay = SDL_CreateYUVOverlay (surfwidth, surfheight, priv->format, priv->surface))) {
- mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_SDL_CouldntCreateAYUVOverlay, SDL_GetError());
+ mp_tmsg(MSGT_VO,MSGL_WARN, "[VO_SDL] Couldn't create a YUV overlay: %s.\n", SDL_GetError());
return -1;
}
priv->framePlaneY = priv->width * priv->height;
@@ -950,14 +950,14 @@ static int setup_surfaces(void)
if(priv->mode != YUV) {
if(!priv->rgbsurface) {
- mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_SDL_CouldntCreateARGBSurface, SDL_GetError());
+ mp_tmsg(MSGT_VO,MSGL_WARN, "[VO_SDL] Couldn't create an RGB surface: %s.\n", SDL_GetError());
return -1;
}
priv->dblit = 0;
if((priv->format&0xFF) != priv->bpp)
- mp_msg(MSGT_VO,MSGL_INFO, MSGTR_LIBVO_SDL_UsingDepthColorspaceConversion, priv->format&0xFF, priv->bpp);
+ mp_tmsg(MSGT_VO,MSGL_INFO, "[VO_SDL] Using depth/colorspace conversion, this will slow things down (%ibpp -> %ibpp).\n", priv->format&0xFF, priv->bpp);
priv->framePlaneRGB = priv->width * priv->height * priv->rgbsurface->format->BytesPerPixel;
priv->stridePlaneRGB = priv->width * priv->rgbsurface->format->BytesPerPixel;
@@ -1085,7 +1085,7 @@ static int draw_slice(uint8_t *image[], int stride[], int w,int h,int x,int y)
break;
default:
- mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_SDL_UnsupportedImageFormatInDrawslice);
+ mp_tmsg(MSGT_VO,MSGL_WARN, "[VO_SDL] Unsupported image format in draw_slice, contact MPlayer developers!\n");
}
SDL_OVR_UNLOCK
@@ -1447,7 +1447,7 @@ static void flip_page (void)
if(!priv->dblit) {
/* blit to the RGB surface */
if(SDL_BlitSurface (priv->rgbsurface, NULL, priv->surface, NULL))
- mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_SDL_BlitFailed, SDL_GetError());
+ mp_tmsg(MSGT_VO,MSGL_WARN, "[VO_SDL] Blit failed: %s.\n", SDL_GetError());
}
/* update screen */
@@ -1570,14 +1570,14 @@ static int preinit(const char *arg)
/* initialize the SDL Video system */
if (!SDL_WasInit(SDL_INIT_VIDEO)) {
if (SDL_Init (SDL_INIT_VIDEO|SDL_INIT_NOPARACHUTE)) {
- mp_msg(MSGT_VO,MSGL_ERR, MSGTR_LIBVO_SDL_InitializationFailed, SDL_GetError());
+ mp_tmsg(MSGT_VO,MSGL_ERR, "[VO_SDL] SDL initialization failed: %s.\n", SDL_GetError());
return -1;
}
}
SDL_VideoDriverName(priv->driver, 8);
- mp_msg(MSGT_VO,MSGL_INFO, MSGTR_LIBVO_SDL_UsingDriver, priv->driver);
+ mp_tmsg(MSGT_VO,MSGL_INFO, "[VO_SDL] Using driver: %s.\n", priv->driver);
priv->X = 0;
#ifdef CONFIG_X11
@@ -1639,7 +1639,7 @@ static uint32_t get_image(mp_image_t *mpi)
return VO_FALSE;
}
-static int control(uint32_t request, void *data, ...)
+static int control(uint32_t request, void *data)
{
struct sdl_priv_s *priv = &sdl_priv;
switch (request) {
diff --git a/libvo/vo_svga.c b/libvo/vo_svga.c
index 606d02c7d3..1223fed8f9 100644
--- a/libvo/vo_svga.c
+++ b/libvo/vo_svga.c
@@ -152,7 +152,7 @@ static int preinit(const char *arg)
vidix_name[i-5]=0;
if(arg[i]==':')i++;
arg+=i;
- vidix_preinit(vidix_name, &video_out_svga);
+ vidix_preinit(vidix_name, video_out_svga.old_functions);
}
#endif
if(!strncmp(arg,"sq",2)) {
@@ -358,7 +358,7 @@ static int find_best_svga_mode(int req_w,int req_h, int req_bpp){
return bestmode;
}
-static int control(uint32_t request, void *data, ...)
+static int control(uint32_t request, void *data)
{
switch (request) {
case VOCTRL_QUERY_FORMAT:
@@ -370,33 +370,8 @@ static int control(uint32_t request, void *data, ...)
}
#ifdef CONFIG_VIDIX
- if (vidix_name[0]) {
- switch (request) {
- case VOCTRL_SET_EQUALIZER:
- {
- va_list ap;
- int value;
-
- va_start(ap, data);
- value = va_arg(ap, int);
- va_end(ap);
-
- return vidix_control(request, data, value);
- }
- case VOCTRL_GET_EQUALIZER:
- {
- va_list ap;
- int *value;
-
- va_start(ap, data);
- value = va_arg(ap, int*);
- va_end(ap);
-
- return vidix_control(request, data, value);
- }
- }
+ if (vidix_name[0])
return vidix_control(request, data);
- }
#endif
return VO_NOTIMPL;
@@ -432,24 +407,24 @@ static int config(uint32_t width, uint32_t height, uint32_t d_width,
}else{//force_vm
vid_mode=force_vm;
if(vga_hasmode(vid_mode) == 0){
- mp_msg(MSGT_VO,MSGL_ERR, MSGTR_LIBVO_SVGA_ForcedVidmodeNotAvailable,
+ mp_tmsg(MSGT_VO,MSGL_ERR, "[VO_SVGA] Forced vid_mode %d (%s) not available.\n",
vid_mode,vga_getmodename(vid_mode));
return 1; //error;
}
modeinfo=vga_getmodeinfo(vid_mode);
if( (modeinfo->width < req_w) || (modeinfo->height < req_h) ){
- mp_msg(MSGT_VO,MSGL_ERR, MSGTR_LIBVO_SVGA_ForcedVidmodeTooSmall,
+ mp_tmsg(MSGT_VO,MSGL_ERR, "[VO_SVGA] Forced vid_mode %d (%s) too small.\n",
vid_mode,vga_getmodename(vid_mode));
return 1;
}
}
mode_bpp=bpp_from_vminfo(modeinfo);
- mp_msg(MSGT_VO,MSGL_INFO, MSGTR_LIBVO_SVGA_Vidmode,
+ mp_tmsg(MSGT_VO,MSGL_INFO, "[VO_SVGA] Vid_mode: %d, %dx%d %dbpp.\n",
vid_mode,modeinfo->width,modeinfo->height,mode_bpp);
if (vga_setmode(vid_mode) == -1) {
- mp_msg(MSGT_VO,MSGL_ERR, MSGTR_LIBVO_SVGA_VgasetmodeFailed,vid_mode);
+ mp_tmsg(MSGT_VO,MSGL_ERR, "[VO_SVGA] Vga_setmode(%d) failed.\n",vid_mode);
uninit();
return 1; // error
}
@@ -499,11 +474,11 @@ static int config(uint32_t width, uint32_t height, uint32_t d_width,
}
}//fi force native
if(mode_capabilities&CAP_LINEAR){
- mp_msg(MSGT_VO,MSGL_INFO, MSGTR_LIBVO_SVGA_VideoModeIsLinearAndMemcpyCouldBeUsed);
+ mp_tmsg(MSGT_VO,MSGL_INFO, "[VO_SVGA] Video mode is linear and memcpy could be used for image transfer.\n");
}
if(mode_capabilities&CAP_ACCEL_PUTIMAGE){
- mp_msg(MSGT_VO,MSGL_INFO, MSGTR_LIBVO_SVGA_VideoModeHasHardwareAcceleration);
- mp_msg(MSGT_VO,MSGL_INFO, MSGTR_LIBVO_SVGA_IfItWorksForYouIWouldLikeToKnow);
+ mp_tmsg(MSGT_VO,MSGL_INFO, "[VO_SVGA] Video mode has hardware acceleration and put_image could be used.\n");
+ mp_tmsg(MSGT_VO,MSGL_INFO, "[VO_SVGA] If it works for you I would like to know.\n[VO_SVGA] (send log with `mplayer test.avi -v -v -v -v &> svga.log`). Thx!\n");
}
//here is the place to handle strides for accel_ modes;
@@ -537,7 +512,7 @@ static int config(uint32_t width, uint32_t height, uint32_t d_width,
}
}
assert(max_pages>0);
- mp_msg(MSGT_VO,MSGL_INFO, MSGTR_LIBVO_SVGA_VideoModeHas,max_pages);
+ mp_tmsg(MSGT_VO,MSGL_INFO, "[VO_SVGA] Video mode has %d page(s).\n",max_pages);
//15bpp
if(modeinfo->bytesperpixel!=0)
vga_claimvideomemory(max_pages * modeinfo->height * modeinfo->width * modeinfo->bytesperpixel);
@@ -552,14 +527,14 @@ static int config(uint32_t width, uint32_t height, uint32_t d_width,
x_pos = (modeinfo->width - req_w) / 2;
y_pos = (modeinfo->height - req_h) / 2;
x_pos &= ~(15); //align x offset position to 16 pixels
- mp_msg(MSGT_VO,MSGL_INFO, MSGTR_LIBVO_SVGA_CenteringImageStartAt,x_pos,y_pos);
+ mp_tmsg(MSGT_VO,MSGL_INFO, "[VO_SVGA] Centering image. Starting at (%d,%d)\n",x_pos,y_pos);
#ifdef CONFIG_VIDIX
if(vidix_name[0]){
vidix_init(width, height, x_pos, y_pos, modeinfo->width, modeinfo->height,
format, mode_bpp, modeinfo->width,modeinfo->height);
- mp_msg(MSGT_VO,MSGL_INFO, MSGTR_LIBVO_SVGA_UsingVidix,width,height,
+ mp_tmsg(MSGT_VO,MSGL_INFO, "[VO_SVGA] Using VIDIX. w=%i h=%i mw=%i mh=%i\n",width,height,
modeinfo->width,modeinfo->height);
vidix_start();
/*set colorkey*/
diff --git a/libvo/vo_tdfx_vid.c b/libvo/vo_tdfx_vid.c
index fcd00969d2..b9fb75eec6 100644
--- a/libvo/vo_tdfx_vid.c
+++ b/libvo/vo_tdfx_vid.c
@@ -87,10 +87,10 @@ static void clear_screen(void) {
mov.dst = front_buffer;
mov.dst_stride = tdfx_cfg.screen_stride;
- mp_msg(MSGT_VO,MSGL_INFO, MSGTR_LIBVO_TDFXVID_Move, mov.width,mov.src_stride,mov.height,mov.dst_stride);
+ mp_tmsg(MSGT_VO,MSGL_INFO, "[VO_TDXVID] Move %d(%d) x %d => %d.\n", mov.width,mov.src_stride,mov.height,mov.dst_stride);
if(ioctl(tdfx_fd,TDFX_VID_AGP_MOVE,&mov))
- mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_TDFXVID_AGPMoveFailedToClearTheScreen);
+ mp_tmsg(MSGT_VO,MSGL_WARN, "[VO_TDFXVID] AGP move failed to clear the screen.\n");
}
#endif
@@ -176,7 +176,7 @@ flip_page(void)
blit.dst_h = src_height;
blit.dst_format = IMGFMT_BGR16;
if(ioctl(tdfx_fd,TDFX_VID_BLIT,&blit))
- mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_TDFXVID_BlitFailed);
+ mp_tmsg(MSGT_VO,MSGL_WARN, "[VO_TDFXVID] Blit failed.\n");
}
return;
}
@@ -198,7 +198,7 @@ flip_page(void)
blit.dst_format = dst_fmt;
if(ioctl(tdfx_fd,TDFX_VID_BLIT,&blit))
- mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_TDFXVID_BlitFailed);
+ mp_tmsg(MSGT_VO,MSGL_WARN, "[VO_TDFXVID] Blit failed.\n");
}
static int
@@ -266,7 +266,7 @@ config(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uin
case IMGFMT_BGR24:
case IMGFMT_BGR32:
if(use_overlay)
- mp_msg(MSGT_VO,MSGL_INFO, MSGTR_LIBVO_TDFXVID_NonNativeOverlayFormatNeedConversion);
+ mp_tmsg(MSGT_VO,MSGL_INFO, "[VO_TDFXVID] Non-native overlay format needs conversion.\n");
case IMGFMT_BGR15:
case IMGFMT_BGR16:
src_bpp = ((format & 0x3F)+7)/8;
@@ -282,7 +282,7 @@ config(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uin
src_bpp = 2;
break;
default:
- mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_TDFXVID_UnsupportedInputFormat,format);
+ mp_tmsg(MSGT_VO,MSGL_WARN, "[VO_TDFXVID] Unsupported input format 0x%x.\n",format);
return 1;
}
@@ -338,28 +338,28 @@ config(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uin
ov.use_colorkey = 0;
if(ioctl(tdfx_fd,TDFX_VID_SET_OVERLAY,&ov)) {
- mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_TDFXVID_OverlaySetupFailed);
+ mp_tmsg(MSGT_VO,MSGL_WARN, "[VO_TDFXVID] Overlay setup failed.\n");
use_overlay = 0;
break;
}
tdfx_ov = ov;
if(use_overlay == 1) {
if(ioctl(tdfx_fd,TDFX_VID_OVERLAY_ON)) {
- mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_TDFXVID_OverlayOnFailed);
+ mp_tmsg(MSGT_VO,MSGL_WARN, "[VO_TDFXVID] Overlay on failed.\n");
use_overlay = 0;
break;
}
use_overlay++;
}
- mp_msg(MSGT_VO,MSGL_INFO, MSGTR_LIBVO_TDFXVID_OverlayReady,
+ mp_tmsg(MSGT_VO,MSGL_INFO, "[VO_TDFXVID] Overlay ready: %d(%d) x %d @ %d => %d(%d) x %d @ %d.\n",
src_width,src_stride,src_height,src_bpp,
dst_width,dst_stride,dst_height,dst_bpp);
break;
}
if(!use_overlay)
- mp_msg(MSGT_VO,MSGL_INFO, MSGTR_LIBVO_TDFXVID_TextureBlitReady,
+ mp_tmsg(MSGT_VO,MSGL_INFO, "[VO_TDFXVID] Texture blit ready: %d(%d) x %d @ %d => %d(%d) x %d @ %d.\n",
src_width,src_stride,src_height,src_bpp,
dst_width,dst_stride,dst_height,dst_bpp);
@@ -371,7 +371,7 @@ uninit(void)
{
if(use_overlay == 2) {
if(ioctl(tdfx_fd,TDFX_VID_OVERLAY_OFF))
- mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_TDFXVID_OverlayOffFailed);
+ mp_tmsg(MSGT_VO,MSGL_WARN, "[VO_TDFXVID] Overlay off failed\n");
use_overlay--;
}
close(tdfx_fd);
@@ -388,13 +388,13 @@ static int preinit(const char *arg)
tdfx_fd = open(arg ? arg : "/dev/tdfx_vid", O_RDWR);
if(tdfx_fd < 0) {
- mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_TDFXVID_CantOpen,arg ? arg : "/dev/tdfx_vid",
+ mp_tmsg(MSGT_VO,MSGL_WARN, "[VO_TDFXVID] Can't open %s: %s.\n",arg ? arg : "/dev/tdfx_vid",
strerror(errno));
return 1;
}
if(ioctl(tdfx_fd,TDFX_VID_GET_CONFIG,&tdfx_cfg)) {
- mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_TDFXVID_CantGetCurrentCfg,strerror(errno));
+ mp_tmsg(MSGT_VO,MSGL_WARN, "[VO_TDFXVID] Can't get current configuration: %s.\n",strerror(errno));
return 1;
}
@@ -413,7 +413,7 @@ static int preinit(const char *arg)
tdfx_fd, 0);
if(agp_mem == MAP_FAILED) {
- mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_TDFXVID_MemmapFailed);
+ mp_tmsg(MSGT_VO,MSGL_WARN, "[VO_TDFXVID] Memmap failed !!!!!\n");
return 1;
}
@@ -465,7 +465,7 @@ static uint32_t get_image(mp_image_t *mpi) {
mpi->stride[2] = mpi->chroma_width;
break;
default:
- mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_TDFXVID_GetImageTodo);
+ mp_tmsg(MSGT_VO,MSGL_WARN, "Get image todo.\n");
return VO_FALSE;
}
mpi->flags |= MP_IMGFLAG_DIRECT;
@@ -531,7 +531,7 @@ static uint32_t draw_image(mp_image_t *mpi){
mov.dst_stride = src_stride;
if(ioctl(tdfx_fd,TDFX_VID_AGP_MOVE,&mov))
- mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_TDFXVID_AgpMoveFailed);
+ mp_tmsg(MSGT_VO,MSGL_WARN, "[VO_TDFXVID] AGP move failed.\n");
break;
case IMGFMT_YV12:
@@ -560,7 +560,7 @@ static uint32_t draw_image(mp_image_t *mpi){
yuv.base = back_buffer;
yuv.stride = src_stride;
if(ioctl(tdfx_fd,TDFX_VID_SET_YUV,&yuv)) {
- mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_TDFXVID_SetYuvFailed);
+ mp_tmsg(MSGT_VO,MSGL_WARN, "[VO_TDFXVID] Set YUV failed.\n");
break;
}
@@ -576,7 +576,7 @@ static uint32_t draw_image(mp_image_t *mpi){
mov.dst_stride = TDFX_VID_YUV_STRIDE;
if(ioctl(tdfx_fd,TDFX_VID_AGP_MOVE,&mov)) {
- mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_TDFXVID_AgpMoveFailedOnYPlane);
+ mp_tmsg(MSGT_VO,MSGL_WARN, "[VO_TDFXVID] AGP move failed on Y plane.\n");
break;
}
//return 0;
@@ -588,7 +588,7 @@ static uint32_t draw_image(mp_image_t *mpi){
mov.src_stride = buffer_stride[p];
mov.dst += TDFX_VID_YUV_PLANE_SIZE;
if(ioctl(tdfx_fd,TDFX_VID_AGP_MOVE,&mov)) {
- mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_TDFXVID_AgpMoveFailedOnUPlane);
+ mp_tmsg(MSGT_VO,MSGL_WARN, "[VO_TDFXVID] AGP move failed on U plane.\n");
break;
}
// V
@@ -597,12 +597,12 @@ static uint32_t draw_image(mp_image_t *mpi){
mov.src_stride = buffer_stride[p];
mov.dst += TDFX_VID_YUV_PLANE_SIZE;
if(ioctl(tdfx_fd,TDFX_VID_AGP_MOVE,&mov)) {
- mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_TDFXVID_AgpMoveFailedOnVPlane);
+ mp_tmsg(MSGT_VO,MSGL_WARN, "[VO_TDFXVID] AGP move failed on V plane.\n");
break;
}
break;
default:
- mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_TDFXVID_UnknownFormat,mpi->imgfmt);
+ mp_tmsg(MSGT_VO,MSGL_WARN, "[VO_TDFXVID] unknown format: 0x%x.\n",mpi->imgfmt);
return VO_TRUE;
}
@@ -644,7 +644,7 @@ static uint32_t set_colorkey(mp_colorkey_t* colork) {
return VO_TRUE;
}
-static int control(uint32_t request, void *data, ...)
+static int control(uint32_t request, void *data)
{
switch (request) {
case VOCTRL_QUERY_FORMAT:
@@ -666,4 +666,3 @@ static int control(uint32_t request, void *data, ...)
}
return VO_NOTIMPL;
}
-
diff --git a/libvo/vo_tdfxfb.c b/libvo/vo_tdfxfb.c
index 03f0513076..343045dff3 100644
--- a/libvo/vo_tdfxfb.c
+++ b/libvo/vo_tdfxfb.c
@@ -111,12 +111,12 @@ static int preinit(const char *arg)
name = "/dev/fb0";
if((fd = open(name, O_RDWR)) == -1) {
- mp_msg(MSGT_VO,MSGL_ERR, MSGTR_LIBVO_TDFXFB_CantOpen, name, strerror(errno));
+ mp_tmsg(MSGT_VO,MSGL_ERR, "[VO_TDFXFB] Can't open %s: %s.\n", name, strerror(errno));
return -1;
}
if(ioctl(fd, FBIOGET_FSCREENINFO, &fb_finfo)) {
- mp_msg(MSGT_VO,MSGL_ERR, MSGTR_LIBVO_TDFXFB_ProblemWithFbitgetFscreenInfo,
+ mp_tmsg(MSGT_VO,MSGL_ERR, "[VO_TDFXFB] Problem with FBITGET_FSCREENINFO ioctl: %s.\n",
strerror(errno));
close(fd);
fd = -1;
@@ -124,7 +124,7 @@ static int preinit(const char *arg)
}
if(ioctl(fd, FBIOGET_VSCREENINFO, &fb_vinfo)) {
- mp_msg(MSGT_VO,MSGL_ERR, MSGTR_LIBVO_TDFXFB_ProblemWithFbitgetVscreenInfo,
+ mp_tmsg(MSGT_VO,MSGL_ERR, "[VO_TDFXFB] Problem with FBITGET_VSCREENINFO ioctl: %s.\n",
strerror(errno));
close(fd);
fd = -1;
@@ -133,7 +133,7 @@ static int preinit(const char *arg)
/* BANSHEE means any of the series aparently */
if (fb_finfo.accel != FB_ACCEL_3DFX_BANSHEE) {
- mp_msg(MSGT_VO,MSGL_ERR, MSGTR_LIBVO_TDFXFB_ThisDriverOnlySupports);
+ mp_tmsg(MSGT_VO,MSGL_ERR, "[VO_TDFXFB] This driver only supports the 3Dfx Banshee, Voodoo3 and Voodoo 5.\n");
close(fd);
fd = -1;
return -1;
@@ -146,7 +146,7 @@ static int preinit(const char *arg)
case 32:
break; // Ok
default:
- mp_msg(MSGT_VO,MSGL_ERR, MSGTR_LIBVO_TDFXFB_OutputIsNotSupported, fb_vinfo.bits_per_pixel);
+ mp_tmsg(MSGT_VO,MSGL_ERR, "[VO_TDFXFB] %d bpp output is not supported.\n", fb_vinfo.bits_per_pixel);
close(fd);
fd = -1;
return -1;
@@ -159,7 +159,7 @@ static int preinit(const char *arg)
MAP_SHARED, fd, fb_finfo.smem_len);
if((long)memBase0 == -1 || (long)memBase1 == -1) {
- mp_msg(MSGT_VO,MSGL_ERR, MSGTR_LIBVO_TDFXFB_CouldntMapMemoryAreas, strerror(errno));
+ mp_tmsg(MSGT_VO,MSGL_ERR, "[VO_TDFXFB] Couldn't map memory areas: %s.\n", strerror(errno));
if((long)memBase0 != -1)
munmap(memBase0, fb_finfo.smem_len);
if((long)memBase1 != -1)
@@ -266,7 +266,7 @@ static int config(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_
break;
default:
- mp_msg(MSGT_VO, MSGL_ERR, MSGTR_LIBVO_TDFXFB_BppOutputIsNotSupported, fb_vinfo.bits_per_pixel);
+ mp_tmsg(MSGT_VO, MSGL_ERR, "[VO_TDFXFB] %d bpp output is not supported (This should never have happened).\n", fb_vinfo.bits_per_pixel);
return -1;
}
@@ -304,7 +304,7 @@ static int config(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_
break;
default:
- mp_msg(MSGT_VO,MSGL_ERR, MSGTR_LIBVO_TDFXFB_SomethingIsWrongWithControl);
+ mp_tmsg(MSGT_VO,MSGL_ERR, "[VO_TDFXFB] Eik! Something's wrong with control().\n");
return -1;
}
@@ -321,7 +321,7 @@ static int config(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_
inpageoffset = hidpageoffset + screenwidth * screenheight * screendepth;
if(inpageoffset + in_width * in_depth * in_height > fb_finfo.smem_len) {
- mp_msg(MSGT_VO,MSGL_ERR, MSGTR_LIBVO_TDFXFB_NotEnoughVideoMemoryToPlay);
+ mp_tmsg(MSGT_VO,MSGL_ERR, "[VO_TDFXFB] Not enough video memory to play this movie. Try at a lower resolution.\n");
return -1;
}
@@ -333,7 +333,7 @@ static int config(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_
memset(inpage, 0, in_width * in_height * in_depth);
- mp_msg(MSGT_VO,MSGL_INFO, MSGTR_LIBVO_TDFXFB_ScreenIs,
+ mp_tmsg(MSGT_VO,MSGL_INFO, "[VO_TDFXFB] Screen is %dx%d at %d bpp, in is %dx%d at %d bpp, norm is %dx%d.\n",
screenwidth, screenheight, screendepth * 8,
in_width, in_height, in_depth * 8,
d_width, d_height);
@@ -496,7 +496,7 @@ static uint32_t get_image(mp_image_t *mpi)
return VO_TRUE;
}
-static int control(uint32_t request, void *data, ...)
+static int control(uint32_t request, void *data)
{
switch(request) {
case VOCTRL_GET_IMAGE:
diff --git a/libvo/vo_tga.c b/libvo/vo_tga.c
index dad6b960a9..38299aca88 100644
--- a/libvo/vo_tga.c
+++ b/libvo/vo_tga.c
@@ -254,13 +254,13 @@ static void check_events(void)
static int preinit(const char *arg)
{
if(arg) {
- mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_TGA_UnknownSubdevice,arg);
+ mp_tmsg(MSGT_VO,MSGL_WARN, "[VO_TGA] Unknown subdevice: %s.\n",arg);
return ENOSYS;
}
return 0;
}
-static int control(uint32_t request, void *data, ...)
+static int control(uint32_t request, void *data)
{
switch (request) {
case VOCTRL_DRAW_IMAGE:
diff --git a/libvo/vo_v4l2.c b/libvo/vo_v4l2.c
index f2e6535bab..bb21096b8d 100644
--- a/libvo/vo_v4l2.c
+++ b/libvo/vo_v4l2.c
@@ -69,7 +69,7 @@ static const vo_info_t info =
const LIBVO_EXTERN (v4l2)
int
-v4l2_write (unsigned char *data, int len)
+v4l2_write (const unsigned char *data, int len)
{
if (v4l2_fd < 0)
return 0;
@@ -253,7 +253,7 @@ query_format (uint32_t format)
}
static int
-control (uint32_t request, void *data, ...)
+control (uint32_t request, void *data)
{
switch (request)
{
diff --git a/libvo/vo_vdpau.c b/libvo/vo_vdpau.c
index 2ee7cccf9b..3623bfd9d7 100644
--- a/libvo/vo_vdpau.c
+++ b/libvo/vo_vdpau.c
@@ -2,6 +2,7 @@
* VDPAU video output driver
*
* Copyright (C) 2008 NVIDIA
+ * Copyright (C) 2009 Uoti Urpala
*
* This file is part of MPlayer.
*
@@ -20,621 +21,819 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-/**
- * \defgroup VDPAU_Presentation VDPAU Presentation
- * \ingroup Decoder
- *
+/*
* Actual decoding and presentation are implemented here.
* All necessary frame information is collected through
* the "vdpau_render_state" structure after parsing all headers
* etc. in libavcodec for different codecs.
- *
- * @{
*/
#include <stdio.h>
+#include <stdlib.h>
+#include <stdint.h>
+#include <stdbool.h>
+#include <limits.h>
#include "config.h"
#include "mp_msg.h"
+#include "options.h"
+#include "talloc.h"
#include "video_out.h"
-#include "video_out_internal.h"
#include "x11_common.h"
#include "aspect.h"
#include "sub.h"
#include "subopt-helper.h"
+#include "libmpcodecs/vfcap.h"
+#include "libmpcodecs/mp_image.h"
+#include "osdep/timer.h"
#include "libavcodec/vdpau.h"
-#include "gui/interface.h"
+#include "font_load.h"
#include "libavutil/common.h"
#include "libavutil/mathematics.h"
-#include "libass/ass_mp.h"
-
-static vo_info_t info = {
- "VDPAU with X11",
- "vdpau",
- "Rajib Mahapatra <rmahapatra@nvidia.com> and others",
- ""
-};
-
-LIBVO_EXTERN(vdpau)
+#include "ass_mp.h"
#define CHECK_ST_ERROR(message) \
- if (vdp_st != VDP_STATUS_OK) { \
- mp_msg(MSGT_VO, MSGL_ERR, "[vdpau] %s: %s\n", \
- message, vdp_get_error_string(vdp_st)); \
- return -1; \
- }
+ do { \
+ if (vdp_st != VDP_STATUS_OK) { \
+ mp_msg(MSGT_VO, MSGL_ERR, "[vdpau] %s: %s\n", \
+ message, vdp->get_error_string(vdp_st)); \
+ return -1; \
+ } \
+ } while (0)
#define CHECK_ST_WARNING(message) \
- if (vdp_st != VDP_STATUS_OK) \
- mp_msg(MSGT_VO, MSGL_WARN, "[vdpau] %s: %s\n", \
- message, vdp_get_error_string(vdp_st));
+ do { \
+ if (vdp_st != VDP_STATUS_OK) \
+ mp_msg(MSGT_VO, MSGL_WARN, "[ vdpau] %s: %s\n", \
+ message, vdp->get_error_string(vdp_st)); \
+ } while (0)
/* number of video and output surfaces */
#define NUM_OUTPUT_SURFACES 3
#define MAX_VIDEO_SURFACES 50
+#define NUM_BUFFERED_VIDEO 4
/* number of palette entries */
#define PALETTE_SIZE 256
-/* Initial maximum number of EOSD surfaces */
-#define EOSD_SURFACES_INITIAL 512
+/* Initial size of EOSD surface in pixels (x*x) */
+#define EOSD_SURFACE_INITIAL_SIZE 256
/*
* Global variable declaration - VDPAU specific
*/
-/* Declaration for all variables of win_x11_init_vdpau_procs() and
- * win_x11_init_vdpau_flip_queue() functions
- */
-static VdpDevice vdp_device;
-static VdpGetProcAddress *vdp_get_proc_address;
-
-static VdpPresentationQueueTarget vdp_flip_target;
-static VdpPresentationQueue vdp_flip_queue;
-
-static VdpDeviceDestroy *vdp_device_destroy;
-static VdpVideoSurfaceCreate *vdp_video_surface_create;
-static VdpVideoSurfaceDestroy *vdp_video_surface_destroy;
-
-static VdpGetErrorString *vdp_get_error_string;
+struct vdp_functions {
+#define VDP_FUNCTION(vdp_type, _, mp_name) vdp_type *mp_name;
+#include "vdpau_template.c"
+#undef VDP_FUNCTION
+};
-/* May be used in software filtering/postprocessing options
- * in MPlayer (./mplayer -vf ..) if we copy video_surface data to
- * system memory.
- */
-static VdpVideoSurfacePutBitsYCbCr *vdp_video_surface_put_bits_y_cb_cr;
-static VdpOutputSurfacePutBitsNative *vdp_output_surface_put_bits_native;
-
-static VdpOutputSurfaceCreate *vdp_output_surface_create;
-static VdpOutputSurfaceDestroy *vdp_output_surface_destroy;
-
-/* VideoMixer puts video_surface data on displayable output_surface. */
-static VdpVideoMixerCreate *vdp_video_mixer_create;
-static VdpVideoMixerDestroy *vdp_video_mixer_destroy;
-static VdpVideoMixerRender *vdp_video_mixer_render;
-static VdpVideoMixerSetFeatureEnables *vdp_video_mixer_set_feature_enables;
-static VdpVideoMixerSetAttributeValues *vdp_video_mixer_set_attribute_values;
-
-static VdpPresentationQueueTargetDestroy *vdp_presentation_queue_target_destroy;
-static VdpPresentationQueueCreate *vdp_presentation_queue_create;
-static VdpPresentationQueueDestroy *vdp_presentation_queue_destroy;
-static VdpPresentationQueueDisplay *vdp_presentation_queue_display;
-static VdpPresentationQueueBlockUntilSurfaceIdle *vdp_presentation_queue_block_until_surface_idle;
-static VdpPresentationQueueTargetCreateX11 *vdp_presentation_queue_target_create_x11;
-
-static VdpOutputSurfaceRenderOutputSurface *vdp_output_surface_render_output_surface;
-static VdpOutputSurfacePutBitsIndexed *vdp_output_surface_put_bits_indexed;
-static VdpOutputSurfaceRenderBitmapSurface *vdp_output_surface_render_bitmap_surface;
-
-static VdpBitmapSurfaceCreate *vdp_bitmap_surface_create;
-static VdpBitmapSurfaceDestroy *vdp_bitmap_surface_destroy;
-static VdpBitmapSurfacePutBitsNative *vdp_bitmap_surface_putbits_native;
-
-static VdpDecoderCreate *vdp_decoder_create;
-static VdpDecoderDestroy *vdp_decoder_destroy;
-static VdpDecoderRender *vdp_decoder_render;
-
-static VdpGenerateCSCMatrix *vdp_generate_csc_matrix;
-static VdpPreemptionCallbackRegister *vdp_preemption_callback_register;
-
-/* output_surfaces[NUM_OUTPUT_SURFACES] is misused for OSD. */
-#define osd_surface output_surfaces[NUM_OUTPUT_SURFACES]
-static VdpOutputSurface output_surfaces[NUM_OUTPUT_SURFACES + 1];
-static VdpVideoSurface deint_surfaces[3];
-static mp_image_t *deint_mpi[2];
-static int output_surface_width, output_surface_height;
-
-static VdpVideoMixer video_mixer;
-static int deint;
-static int deint_type;
-static int deint_counter;
-static int pullup;
-static float denoise;
-static float sharpen;
-static int colorspace;
-static int chroma_deint;
-static int force_mixer;
-static int top_field_first;
-static int flip;
-static int hqscaling;
-
-static VdpDecoder decoder;
-static int decoder_max_refs;
-
-static VdpRect src_rect_vid;
-static VdpRect out_rect_vid;
-static int border_x, border_y;
-
-static struct vdpau_render_state surface_render[MAX_VIDEO_SURFACES];
-static int surface_num;
-static int vid_surface_num;
-static uint32_t vid_width, vid_height;
-static uint32_t image_format;
-static VdpChromaType vdp_chroma_type;
-static VdpYCbCrFormat vdp_pixel_format;
-
-static volatile int is_preempted;
-
-/* draw_osd */
-static unsigned char *index_data;
-static int index_data_size;
-static uint32_t palette[PALETTE_SIZE];
-
-// EOSD
-// Pool of surfaces
-struct {
- VdpBitmapSurface surface;
- int w;
- int h;
- char in_use;
-} *eosd_surfaces;
-
-// List of surfaces to be rendered
-struct {
- VdpBitmapSurface surface;
- VdpRect source;
- VdpRect dest;
- VdpColor color;
-} *eosd_targets;
-
-static int eosd_render_count;
-static int eosd_surface_count;
-
-// Video equalizer
-static VdpProcamp procamp;
+struct vdpctx {
+ struct vdp_functions *vdp;
+
+ VdpDevice vdp_device;
+ bool is_preempted;
+ bool preemption_acked;
+ bool preemption_user_notified;
+ unsigned int last_preemption_retry_fail;
+ VdpGetProcAddress *vdp_get_proc_address;
+
+ VdpPresentationQueueTarget flip_target;
+ VdpPresentationQueue flip_queue;
+ uint64_t last_vdp_time;
+ unsigned int last_sync_update;
+
+ /* output_surfaces[NUM_OUTPUT_SURFACES] is misused for OSD. */
+#define osd_surface vc->output_surfaces[NUM_OUTPUT_SURFACES]
+ VdpOutputSurface output_surfaces[NUM_OUTPUT_SURFACES + 1];
+ struct buffered_video_surface {
+ VdpVideoSurface surface;
+ double pts;
+ mp_image_t *mpi;
+ } buffered_video[NUM_BUFFERED_VIDEO];
+ int deint_queue_pos;
+ int output_surface_width, output_surface_height;
+
+ VdpVideoMixer video_mixer;
+ int user_colorspace;
+ int colorspace;
+ int deint;
+ int deint_type;
+ int deint_counter;
+ int pullup;
+ float denoise;
+ float sharpen;
+ int hqscaling;
+ int chroma_deint;
+ int flip_offset_window;
+ int flip_offset_fs;
+ int top_field_first;
+ bool flip;
+
+ VdpDecoder decoder;
+ int decoder_max_refs;
+
+ VdpRect src_rect_vid;
+ VdpRect out_rect_vid;
+ int border_x, border_y;
+
+ struct vdpau_render_state surface_render[MAX_VIDEO_SURFACES];
+ int surface_num;
+ VdpTime recent_vsync_time;
+ float user_fps;
+ unsigned int vsync_interval;
+ uint64_t last_queue_time;
+ uint64_t last_ideal_time;
+ bool dropped_frame;
+ uint64_t dropped_time;
+ uint32_t vid_width, vid_height;
+ uint32_t image_format;
+ VdpChromaType vdp_chroma_type;
+ VdpYCbCrFormat vdp_pixel_format;
+
+ /* draw_osd */
+ unsigned char *index_data;
+ int index_data_size;
+ uint32_t palette[PALETTE_SIZE];
+
+ // EOSD
+ // Pool of surfaces
+ struct eosd_bitmap_surface {
+ VdpBitmapSurface surface;
+ int w;
+ int h;
+ uint32_t max_width;
+ uint32_t max_height;
+ } eosd_surface;
+
+ // List of surfaces to be rendered
+ struct eosd_target {
+ VdpRect source;
+ VdpRect dest;
+ VdpColor color;
+ } *eosd_targets;
+ int eosd_targets_size;
+ int *eosd_scratch;
+
+ int eosd_render_count;
+
+ // Video equalizer
+ VdpProcamp procamp;
+
+ int num_shown_frames;
+ bool paused;
+
+ // These tell what's been initialized and uninit() should free/uninitialize
+ bool mode_switched;
+};
-/*
- * X11 specific
- */
-static int visible_buf;
-static int int_pause;
+static int change_vdptime_sync(struct vdpctx *vc, unsigned int *t)
+{
+ struct vdp_functions *vdp = vc->vdp;
+ VdpStatus vdp_st;
+ VdpTime vdp_time;
+ vdp_st = vdp->presentation_queue_get_time(vc->flip_queue, &vdp_time);
+ CHECK_ST_ERROR("Error when calling vdp_presentation_queue_get_time");
+ unsigned int t1 = *t;
+ unsigned int t2 = GetTimer();
+ uint64_t old = vc->last_vdp_time + (t1 - vc->last_sync_update) * 1000ULL;
+ if (vdp_time > old)
+ if (vdp_time > old + (t2 - t1) * 1000ULL)
+ vdp_time -= (t2 - t1) * 1000ULL;
+ else
+ vdp_time = old;
+ mp_msg(MSGT_VO, MSGL_V, "[vdpau] adjusting VdpTime offset by %f µs\n",
+ (int64_t)(vdp_time - old) / 1000.);
+ vc->last_vdp_time = vdp_time;
+ vc->last_sync_update = t1;
+ *t = t2;
+ return 0;
+}
-static void draw_eosd(void);
+static uint64_t sync_vdptime(struct vo *vo)
+{
+ struct vdpctx *vc = vo->priv;
+
+ unsigned int t = GetTimer();
+ if (t - vc->last_sync_update > 5000000)
+ change_vdptime_sync(vc, &t);
+ uint64_t now = (t - vc->last_sync_update) * 1000ULL + vc->last_vdp_time;
+ // Make sure nanosecond inaccuracies don't make things inconsistent
+ now = FFMAX(now, vc->recent_vsync_time);
+ return now;
+}
-static void push_deint_surface(VdpVideoSurface surface)
+static uint64_t convert_to_vdptime(struct vo *vo, unsigned int t)
{
- deint_surfaces[2] = deint_surfaces[1];
- deint_surfaces[1] = deint_surfaces[0];
- deint_surfaces[0] = surface;
+ struct vdpctx *vc = vo->priv;
+ return (int)(t - vc->last_sync_update) * 1000LL + vc->last_vdp_time;
}
-static void video_to_output_surface(void)
+static void flip_page_timed(struct vo *vo, unsigned int pts_us, int duration);
+
+static int video_to_output_surface(struct vo *vo)
{
+ struct vdpctx *vc = vo->priv;
+ struct vdp_functions *vdp = vc->vdp;
VdpTime dummy;
VdpStatus vdp_st;
- int i;
- if (vid_surface_num < 0)
- return;
+ if (vc->deint_queue_pos < 0)
+ return -1;
- if (deint < 2 || deint_surfaces[0] == VDP_INVALID_HANDLE)
- push_deint_surface(surface_render[vid_surface_num].surface);
+ struct buffered_video_surface *bv = vc->buffered_video;
+ int field = VDP_VIDEO_MIXER_PICTURE_STRUCTURE_FRAME;
+ unsigned int dp = vc->deint_queue_pos;
+ // dp==0 means last field of latest frame, 1 earlier field of latest frame,
+ // 2 last field of previous frame and so on
+ if (vc->deint) {
+ field = vc->top_field_first ^ (dp & 1) ?
+ VDP_VIDEO_MIXER_PICTURE_STRUCTURE_BOTTOM_FIELD:
+ VDP_VIDEO_MIXER_PICTURE_STRUCTURE_TOP_FIELD;
+ }
+ const VdpVideoSurface *past_fields = (const VdpVideoSurface []){
+ bv[(dp+1)/2].surface, bv[(dp+2)/2].surface};
+ const VdpVideoSurface *future_fields = (const VdpVideoSurface []){
+ dp >= 1 ? bv[(dp-1)/2].surface : VDP_INVALID_HANDLE};
+ VdpOutputSurface output_surface = vc->output_surfaces[vc->surface_num];
+ vdp_st = vdp->presentation_queue_block_until_surface_idle(vc->flip_queue,
+ output_surface,
+ &dummy);
+ CHECK_ST_WARNING("Error when calling "
+ "vdp_presentation_queue_block_until_surface_idle");
+
+ vdp_st = vdp->video_mixer_render(vc->video_mixer, VDP_INVALID_HANDLE,
+ 0, field, 2, past_fields,
+ bv[dp/2].surface, 1, future_fields,
+ &vc->src_rect_vid, output_surface,
+ NULL, &vc->out_rect_vid, 0, NULL);
+ CHECK_ST_WARNING("Error when calling vdp_video_mixer_render");
+ return 0;
+}
- for (i = 0; i <= !!(deint > 1); i++) {
- int field = VDP_VIDEO_MIXER_PICTURE_STRUCTURE_FRAME;
- VdpOutputSurface output_surface;
- if (i) {
- draw_eosd();
- draw_osd();
- flip_page();
+static void get_buffered_frame(struct vo *vo, bool eof)
+{
+ struct vdpctx *vc = vo->priv;
+
+ int dqp = vc->deint_queue_pos;
+ if (dqp < 0)
+ dqp += 1000;
+ else
+ dqp = vc->deint >= 2 ? dqp - 1 : dqp - 2 | 1;
+ if (dqp < (eof ? 0 : 3))
+ return;
+
+ dqp = FFMIN(dqp, 4);
+ vc->deint_queue_pos = dqp;
+ vo->frame_loaded = true;
+
+ // Set pts values
+ struct buffered_video_surface *bv = vc->buffered_video;
+ int idx = vc->deint_queue_pos >> 1;
+ if (idx == 0) { // no future frame/pts available
+ vo->next_pts = bv[0].pts;
+ vo->next_pts2 = MP_NOPTS_VALUE;
+ } else if (!(vc->deint >= 2)) { // no field-splitting deinterlace
+ vo->next_pts = bv[idx].pts;
+ vo->next_pts2 = bv[idx - 1].pts;
+ } else { // deinterlace with separate fields
+ double intermediate_pts;
+ double diff = bv[idx - 1].pts - bv[idx].pts;
+ if (diff > 0 && diff < 0.5)
+ intermediate_pts = (bv[idx].pts + bv[idx - 1].pts) / 2;
+ else
+ intermediate_pts = bv[idx].pts;
+ if (vc->deint_queue_pos & 1) { // first field
+ vo->next_pts = bv[idx].pts;
+ vo->next_pts2 = intermediate_pts;
+ } else {
+ vo->next_pts = intermediate_pts;
+ vo->next_pts2 = bv[idx - 1].pts;
}
- if (deint)
- field = (top_field_first == i) ^ (deint > 1) ?
- VDP_VIDEO_MIXER_PICTURE_STRUCTURE_BOTTOM_FIELD:
- VDP_VIDEO_MIXER_PICTURE_STRUCTURE_TOP_FIELD;
- output_surface = output_surfaces[surface_num];
- vdp_st = vdp_presentation_queue_block_until_surface_idle(vdp_flip_queue,
- output_surface,
- &dummy);
- CHECK_ST_WARNING("Error when calling vdp_presentation_queue_block_until_surface_idle")
-
- vdp_st = vdp_video_mixer_render(video_mixer, VDP_INVALID_HANDLE, 0,
- field, 2, deint_surfaces + 1,
- deint_surfaces[0],
- 1, &surface_render[vid_surface_num].surface,
- &src_rect_vid,
- output_surface,
- NULL, &out_rect_vid, 0, NULL);
- CHECK_ST_WARNING("Error when calling vdp_video_mixer_render")
- push_deint_surface(surface_render[vid_surface_num].surface);
+ }
+
+ video_to_output_surface(vo);
+}
+
+static void add_new_video_surface(struct vo *vo, VdpVideoSurface surface,
+ struct mp_image *reserved_mpi, double pts)
+{
+ struct vdpctx *vc = vo->priv;
+ struct buffered_video_surface *bv = vc->buffered_video;
+
+ if (reserved_mpi)
+ reserved_mpi->usage_count++;
+ if (bv[NUM_BUFFERED_VIDEO - 1].mpi)
+ bv[NUM_BUFFERED_VIDEO - 1].mpi->usage_count--;
+
+ for (int i = NUM_BUFFERED_VIDEO - 1; i > 0; i--)
+ bv[i] = bv[i - 1];
+ bv[0] = (struct buffered_video_surface){
+ .mpi = reserved_mpi,
+ .surface = surface,
+ .pts = pts,
+ };
+
+ vc->deint_queue_pos += 2;
+ get_buffered_frame(vo, false);
+}
+
+static void forget_frames(struct vo *vo)
+{
+ struct vdpctx *vc = vo->priv;
+
+ vc->deint_queue_pos = -1001;
+ vc->dropped_frame = false;
+ for (int i = 0; i < NUM_BUFFERED_VIDEO; i++) {
+ struct buffered_video_surface *p = vc->buffered_video + i;
+ if (p->mpi)
+ p->mpi->usage_count--;
+ *p = (struct buffered_video_surface){
+ .surface = VDP_INVALID_HANDLE,
+ };
}
}
-static void resize(void)
+static void resize(struct vo *vo)
{
+ struct vdpctx *vc = vo->priv;
+ struct vdp_functions *vdp = vc->vdp;
VdpStatus vdp_st;
int i;
struct vo_rect src_rect;
struct vo_rect dst_rect;
struct vo_rect borders;
- calc_src_dst_rects(vid_width, vid_height, &src_rect, &dst_rect, &borders, NULL);
- out_rect_vid.x0 = dst_rect.left;
- out_rect_vid.x1 = dst_rect.right;
- out_rect_vid.y0 = dst_rect.top;
- out_rect_vid.y1 = dst_rect.bottom;
- src_rect_vid.x0 = src_rect.left;
- src_rect_vid.x1 = src_rect.right;
- src_rect_vid.y0 = flip ? src_rect.bottom : src_rect.top;
- src_rect_vid.y1 = flip ? src_rect.top : src_rect.bottom;
- border_x = borders.left;
- border_y = borders.top;
+ calc_src_dst_rects(vo, vc->vid_width, vc->vid_height, &src_rect, &dst_rect,
+ &borders, NULL);
+ vc->out_rect_vid.x0 = dst_rect.left;
+ vc->out_rect_vid.x1 = dst_rect.right;
+ vc->out_rect_vid.y0 = dst_rect.top;
+ vc->out_rect_vid.y1 = dst_rect.bottom;
+ vc->src_rect_vid.x0 = src_rect.left;
+ vc->src_rect_vid.x1 = src_rect.right;
+ vc->src_rect_vid.y0 = vc->flip ? src_rect.bottom : src_rect.top;
+ vc->src_rect_vid.y1 = vc->flip ? src_rect.top : src_rect.bottom;
+ vc->border_x = borders.left;
+ vc->border_y = borders.top;
#ifdef CONFIG_FREETYPE
// adjust font size to display size
force_load_font = 1;
#endif
vo_osd_changed(OSDTYPE_OSD);
-
- if (output_surface_width < vo_dwidth || output_surface_height < vo_dheight) {
- if (output_surface_width < vo_dwidth) {
- output_surface_width += output_surface_width >> 1;
- output_surface_width = FFMAX(output_surface_width, vo_dwidth);
+ int flip_offset_ms = vo_fs ? vc->flip_offset_fs : vc->flip_offset_window;
+ vo->flip_queue_offset = flip_offset_ms / 1000.;
+
+ bool had_frames = vc->num_shown_frames;
+ if (vc->output_surface_width < vo->dwidth
+ || vc->output_surface_height < vo->dheight) {
+ if (vc->output_surface_width < vo->dwidth) {
+ vc->output_surface_width += vc->output_surface_width >> 1;
+ vc->output_surface_width = FFMAX(vc->output_surface_width,
+ vo->dwidth);
}
- if (output_surface_height < vo_dheight) {
- output_surface_height += output_surface_height >> 1;
- output_surface_height = FFMAX(output_surface_height, vo_dheight);
+ if (vc->output_surface_height < vo->dheight) {
+ vc->output_surface_height += vc->output_surface_height >> 1;
+ vc->output_surface_height = FFMAX(vc->output_surface_height,
+ vo->dheight);
}
// Creation of output_surfaces
for (i = 0; i <= NUM_OUTPUT_SURFACES; i++) {
- if (output_surfaces[i] != VDP_INVALID_HANDLE)
- vdp_output_surface_destroy(output_surfaces[i]);
- vdp_st = vdp_output_surface_create(vdp_device, VDP_RGBA_FORMAT_B8G8R8A8,
- output_surface_width, output_surface_height,
- &output_surfaces[i]);
- CHECK_ST_WARNING("Error when calling vdp_output_surface_create")
- mp_msg(MSGT_VO, MSGL_DBG2, "OUT CREATE: %u\n", output_surfaces[i]);
+ if (vc->output_surfaces[i] != VDP_INVALID_HANDLE)
+ vdp->output_surface_destroy(vc->output_surfaces[i]);
+ vdp_st = vdp->output_surface_create(vc->vdp_device,
+ VDP_RGBA_FORMAT_B8G8R8A8,
+ vc->output_surface_width,
+ vc->output_surface_height,
+ &vc->output_surfaces[i]);
+ CHECK_ST_WARNING("Error when calling vdp_output_surface_create");
+ mp_msg(MSGT_VO, MSGL_DBG2, "OUT CREATE: %u\n",
+ vc->output_surfaces[i]);
}
+ vc->num_shown_frames = 0;
}
- if (image_format == IMGFMT_BGRA) {
- vdp_st = vdp_output_surface_render_output_surface(output_surfaces[surface_num],
- NULL, VDP_INVALID_HANDLE,
- NULL, NULL, NULL,
- VDP_OUTPUT_SURFACE_RENDER_ROTATE_0);
- CHECK_ST_WARNING("Error when calling vdp_output_surface_render_output_surface")
- vdp_st = vdp_output_surface_render_output_surface(output_surfaces[1 - surface_num],
- NULL, VDP_INVALID_HANDLE,
- NULL, NULL, NULL,
- VDP_OUTPUT_SURFACE_RENDER_ROTATE_0);
- CHECK_ST_WARNING("Error when calling vdp_output_surface_render_output_surface")
- } else
- video_to_output_surface();
- if (visible_buf)
- flip_page();
+ if (vc->paused && had_frames)
+ if (video_to_output_surface(vo) >= 0)
+ flip_page_timed(vo, 0, -1);
}
static void preemption_callback(VdpDevice device, void *context)
{
- mp_msg(MSGT_VO, MSGL_ERR, "[vdpau] Display preemption detected\n");
- is_preempted = 1;
+ struct vdpctx *vc = context;
+ vc->is_preempted = true;
+ vc->preemption_acked = false;
}
/* Initialize vdp_get_proc_address, called from preinit() */
-static int win_x11_init_vdpau_procs(void)
+static int win_x11_init_vdpau_procs(struct vo *vo)
{
+ struct vo_x11_state *x11 = vo->x11;
+ struct vdpctx *vc = vo->priv;
+ talloc_free(vc->vdp); // In case this is reinitialization after preemption
+ struct vdp_functions *vdp = talloc_zero(vc, struct vdp_functions);
+ vc->vdp = vdp;
VdpStatus vdp_st;
struct vdp_function {
const int id;
- void *pointer;
+ int offset;
};
const struct vdp_function *dsc;
static const struct vdp_function vdp_func[] = {
- {VDP_FUNC_ID_GET_ERROR_STRING, &vdp_get_error_string},
- {VDP_FUNC_ID_DEVICE_DESTROY, &vdp_device_destroy},
- {VDP_FUNC_ID_VIDEO_SURFACE_CREATE, &vdp_video_surface_create},
- {VDP_FUNC_ID_VIDEO_SURFACE_DESTROY, &vdp_video_surface_destroy},
- {VDP_FUNC_ID_VIDEO_SURFACE_PUT_BITS_Y_CB_CR,
- &vdp_video_surface_put_bits_y_cb_cr},
- {VDP_FUNC_ID_OUTPUT_SURFACE_PUT_BITS_NATIVE,
- &vdp_output_surface_put_bits_native},
- {VDP_FUNC_ID_OUTPUT_SURFACE_CREATE, &vdp_output_surface_create},
- {VDP_FUNC_ID_OUTPUT_SURFACE_DESTROY, &vdp_output_surface_destroy},
- {VDP_FUNC_ID_VIDEO_MIXER_CREATE, &vdp_video_mixer_create},
- {VDP_FUNC_ID_VIDEO_MIXER_DESTROY, &vdp_video_mixer_destroy},
- {VDP_FUNC_ID_VIDEO_MIXER_RENDER, &vdp_video_mixer_render},
- {VDP_FUNC_ID_VIDEO_MIXER_SET_FEATURE_ENABLES,
- &vdp_video_mixer_set_feature_enables},
- {VDP_FUNC_ID_VIDEO_MIXER_SET_ATTRIBUTE_VALUES,
- &vdp_video_mixer_set_attribute_values},
- {VDP_FUNC_ID_PRESENTATION_QUEUE_TARGET_DESTROY,
- &vdp_presentation_queue_target_destroy},
- {VDP_FUNC_ID_PRESENTATION_QUEUE_CREATE, &vdp_presentation_queue_create},
- {VDP_FUNC_ID_PRESENTATION_QUEUE_DESTROY,
- &vdp_presentation_queue_destroy},
- {VDP_FUNC_ID_PRESENTATION_QUEUE_DISPLAY,
- &vdp_presentation_queue_display},
- {VDP_FUNC_ID_PRESENTATION_QUEUE_BLOCK_UNTIL_SURFACE_IDLE,
- &vdp_presentation_queue_block_until_surface_idle},
- {VDP_FUNC_ID_PRESENTATION_QUEUE_TARGET_CREATE_X11,
- &vdp_presentation_queue_target_create_x11},
- {VDP_FUNC_ID_OUTPUT_SURFACE_RENDER_OUTPUT_SURFACE,
- &vdp_output_surface_render_output_surface},
- {VDP_FUNC_ID_OUTPUT_SURFACE_PUT_BITS_INDEXED,
- &vdp_output_surface_put_bits_indexed},
- {VDP_FUNC_ID_DECODER_CREATE, &vdp_decoder_create},
- {VDP_FUNC_ID_DECODER_RENDER, &vdp_decoder_render},
- {VDP_FUNC_ID_DECODER_DESTROY, &vdp_decoder_destroy},
- {VDP_FUNC_ID_BITMAP_SURFACE_CREATE, &vdp_bitmap_surface_create},
- {VDP_FUNC_ID_BITMAP_SURFACE_DESTROY, &vdp_bitmap_surface_destroy},
- {VDP_FUNC_ID_BITMAP_SURFACE_PUT_BITS_NATIVE,
- &vdp_bitmap_surface_putbits_native},
- {VDP_FUNC_ID_OUTPUT_SURFACE_RENDER_BITMAP_SURFACE,
- &vdp_output_surface_render_bitmap_surface},
- {VDP_FUNC_ID_GENERATE_CSC_MATRIX, &vdp_generate_csc_matrix},
- {VDP_FUNC_ID_PREEMPTION_CALLBACK_REGISTER,
- &vdp_preemption_callback_register},
- {0, NULL}
+#define VDP_FUNCTION(_, macro_name, mp_name) {macro_name, offsetof(struct vdp_functions, mp_name)},
+#include "vdpau_template.c"
+#undef VDP_FUNCTION
+ {0, -1}
};
- vdp_st = vdp_device_create_x11(mDisplay, mScreen,
- &vdp_device, &vdp_get_proc_address);
+ vdp_st = vdp_device_create_x11(x11->display, x11->screen,&vc->vdp_device,
+ &vc->vdp_get_proc_address);
if (vdp_st != VDP_STATUS_OK) {
- mp_msg(MSGT_VO, MSGL_ERR, "[vdpau] Error when calling vdp_device_create_x11: %i\n", vdp_st);
+ mp_msg(MSGT_VO, MSGL_ERR, "[vdpau] Error when calling "
+ "vdp_device_create_x11: %i\n", vdp_st);
return -1;
}
- vdp_get_error_string = NULL;
- for (dsc = vdp_func; dsc->pointer; dsc++) {
- vdp_st = vdp_get_proc_address(vdp_device, dsc->id, dsc->pointer);
+ vdp->get_error_string = NULL;
+ for (dsc = vdp_func; dsc->offset >= 0; dsc++) {
+ vdp_st = vc->vdp_get_proc_address(vc->vdp_device, dsc->id,
+ (void **)((char *)vdp + dsc->offset));
if (vdp_st != VDP_STATUS_OK) {
- mp_msg(MSGT_VO, MSGL_ERR, "[vdpau] Error when calling vdp_get_proc_address(function id %d): %s\n",
- dsc->id, vdp_get_error_string ? vdp_get_error_string(vdp_st) : "?");
+ mp_msg(MSGT_VO, MSGL_ERR, "[vdpau] Error when calling "
+ "vdp_get_proc_address(function id %d): %s\n", dsc->id,
+ vdp->get_error_string ? vdp->get_error_string(vdp_st) : "?");
return -1;
}
}
- vdp_st = vdp_preemption_callback_register(vdp_device,
- preemption_callback, NULL);
- CHECK_ST_ERROR("Error when calling vdp_preemption_callback_register")
-
+ vdp_st = vdp->preemption_callback_register(vc->vdp_device,
+ preemption_callback, vc);
return 0;
}
-/* Initialize vdpau_flip_queue, called from config() */
-static int win_x11_init_vdpau_flip_queue(void)
+static int win_x11_init_vdpau_flip_queue(struct vo *vo)
{
+ struct vdpctx *vc = vo->priv;
+ struct vdp_functions *vdp = vc->vdp;
+ struct vo_x11_state *x11 = vo->x11;
VdpStatus vdp_st;
- vdp_st = vdp_presentation_queue_target_create_x11(vdp_device, vo_window,
- &vdp_flip_target);
- CHECK_ST_ERROR("Error when calling vdp_presentation_queue_target_create_x11")
+ if (vc->flip_target == VDP_INVALID_HANDLE) {
+ vdp_st = vdp->presentation_queue_target_create_x11(vc->vdp_device,
+ x11->window,
+ &vc->flip_target);
+ CHECK_ST_ERROR("Error when calling "
+ "vdp_presentation_queue_target_create_x11");
+ }
+
+ /* Emperically this seems to be the first call which fails when we
+ * try to reinit after preemption while the user is still switched
+ * from X to a virtual terminal (creating the vdp_device initially
+ * succeeds, as does creating the flip_target above). This is
+ * probably not guaranteed behavior, but we'll assume it as a simple
+ * way to reduce warnings while trying to recover from preemption.
+ */
+ if (vc->flip_queue == VDP_INVALID_HANDLE) {
+ vdp_st = vdp->presentation_queue_create(vc->vdp_device, vc->flip_target,
+ &vc->flip_queue);
+ if (vc->is_preempted && vdp_st != VDP_STATUS_OK) {
+ mp_msg(MSGT_VO, MSGL_DBG2, "[vdpau] Failed to create flip queue "
+ "while preempted: %s\n", vdp->get_error_string(vdp_st));
+ return -1;
+ } else
+ CHECK_ST_ERROR("Error when calling vdp_presentation_queue_create");
+ }
- vdp_st = vdp_presentation_queue_create(vdp_device, vdp_flip_target,
- &vdp_flip_queue);
- CHECK_ST_ERROR("Error when calling vdp_presentation_queue_create")
+ VdpTime vdp_time;
+ vdp_st = vdp->presentation_queue_get_time(vc->flip_queue, &vdp_time);
+ CHECK_ST_ERROR("Error when calling vdp_presentation_queue_get_time");
+ vc->last_vdp_time = vdp_time;
+ vc->last_sync_update = GetTimer();
+
+ vc->vsync_interval = 1;
+ if (vc->user_fps > 0) {
+ vc->vsync_interval = 1e9 / vc->user_fps;
+ mp_msg(MSGT_VO, MSGL_INFO, "[vdpau] Assuming user-specified display "
+ "refresh rate of %.3f Hz.\n", vc->user_fps);
+ } else if (vc->user_fps == 0) {
+#ifdef CONFIG_XF86VM
+ double fps = vo_vm_get_fps(vo);
+ if (!fps)
+ mp_msg(MSGT_VO, MSGL_WARN, "[vdpau] Failed to get display FPS\n");
+ else {
+ vc->vsync_interval = 1e9 / fps;
+ // This is verbose, but I'm not yet sure how common wrong values are
+ mp_msg(MSGT_VO, MSGL_INFO,
+ "[vdpau] Got display refresh rate %.3f Hz.\n"
+ "[vdpau] If that value looks wrong give the "
+ "-vo vdpau:fps=X suboption manually.\n", fps);
+ }
+#else
+ mp_msg(MSGT_VO, MSGL_INFO, "[vdpau] This binary has been compiled "
+ "without XF86VidMode support.\n");
+ mp_msg(MSGT_VO, MSGL_INFO, "[vdpau] Can't use vsync-aware timing "
+ "without manually provided -vo vdpau:fps=X suboption.\n");
+#endif
+ } else
+ mp_msg(MSGT_VO, MSGL_V, "[vdpau] framedrop/timing logic disabled by "
+ "user.\n");
return 0;
}
-static int update_csc_matrix(void)
+static int set_video_attribute(struct vdpctx *vc, VdpVideoMixerAttribute attr,
+ const void *value, char *attr_name)
{
+ struct vdp_functions *vdp = vc->vdp;
VdpStatus vdp_st;
- VdpCSCMatrix matrix;
- static const VdpVideoMixerAttribute attributes[] = {VDP_VIDEO_MIXER_ATTRIBUTE_CSC_MATRIX};
- const void *attribute_values[] = {&matrix};
- static const VdpColorStandard vdp_colors[] = {0, VDP_COLOR_STANDARD_ITUR_BT_601, VDP_COLOR_STANDARD_ITUR_BT_709, VDP_COLOR_STANDARD_SMPTE_240M};
- static const char * const vdp_names[] = {NULL, "BT.601", "BT.709", "SMPTE-240M"};
- int csp = colorspace;
- if (!csp)
- csp = vid_width >= 1280 || vid_height > 576 ? 2 : 1;
+ vdp_st = vdp->video_mixer_set_attribute_values(vc->video_mixer, 1, &attr,
+ &value);
+ if (vdp_st != VDP_STATUS_OK) {
+ mp_msg(MSGT_VO, MSGL_ERR, "[vdpau] Error setting video mixer "
+ "attribute %s: %s\n", attr_name, vdp->get_error_string(vdp_st));
+ return -1;
+ }
+ return 0;
+}
+
+static void update_csc_matrix(struct vo *vo)
+{
+ struct vdpctx *vc = vo->priv;
+ struct vdp_functions *vdp = vc->vdp;
+ VdpStatus vdp_st;
+ const VdpColorStandard vdp_colors[] = {VDP_COLOR_STANDARD_ITUR_BT_601,
+ VDP_COLOR_STANDARD_ITUR_BT_709,
+ VDP_COLOR_STANDARD_SMPTE_240M};
+ char * const vdp_names[] = {"BT.601", "BT.709", "SMPTE-240M"};
+ int csp = vc->colorspace;
mp_msg(MSGT_VO, MSGL_V, "[vdpau] Updating CSC matrix for %s\n",
vdp_names[csp]);
- vdp_st = vdp_generate_csc_matrix(&procamp, vdp_colors[csp], &matrix);
- CHECK_ST_WARNING("Error when generating CSC matrix")
+ VdpCSCMatrix matrix;
+ vdp_st = vdp->generate_csc_matrix(&vc->procamp, vdp_colors[csp], &matrix);
+ CHECK_ST_WARNING("Error when generating CSC matrix");
- vdp_st = vdp_video_mixer_set_attribute_values(video_mixer, 1, attributes,
- attribute_values);
- CHECK_ST_WARNING("Error when setting CSC matrix")
- return VO_TRUE;
+ set_video_attribute(vc, VDP_VIDEO_MIXER_ATTRIBUTE_CSC_MATRIX,
+ &matrix, "CSC matrix");
}
-static int create_vdp_mixer(VdpChromaType vdp_chroma_type)
+#define SET_VIDEO_ATTR(attr_name, attr_type, value) set_video_attribute(vc, \
+ VDP_VIDEO_MIXER_ATTRIBUTE_ ## attr_name, &(attr_type){value},\
+ # attr_name)
+static int create_vdp_mixer(struct vo *vo, VdpChromaType vdp_chroma_type)
{
+ struct vdpctx *vc = vo->priv;
+ struct vdp_functions *vdp = vc->vdp;
#define VDP_NUM_MIXER_PARAMETER 3
#define MAX_NUM_FEATURES 6
int i;
VdpStatus vdp_st;
+
+ if (vc->video_mixer != VDP_INVALID_HANDLE)
+ return 0;
+
int feature_count = 0;
VdpVideoMixerFeature features[MAX_NUM_FEATURES];
VdpBool feature_enables[MAX_NUM_FEATURES];
- static const VdpVideoMixerAttribute denoise_attrib[] = {VDP_VIDEO_MIXER_ATTRIBUTE_NOISE_REDUCTION_LEVEL};
- const void * const denoise_value[] = {&denoise};
- static const VdpVideoMixerAttribute sharpen_attrib[] = {VDP_VIDEO_MIXER_ATTRIBUTE_SHARPNESS_LEVEL};
- const void * const sharpen_value[] = {&sharpen};
- static const VdpVideoMixerAttribute skip_chroma_attrib[] = {VDP_VIDEO_MIXER_ATTRIBUTE_SKIP_CHROMA_DEINTERLACE};
- const uint8_t skip_chroma_value = 1;
- const void * const skip_chroma_value_ptr[] = {&skip_chroma_value};
static const VdpVideoMixerParameter parameters[VDP_NUM_MIXER_PARAMETER] = {
VDP_VIDEO_MIXER_PARAMETER_VIDEO_SURFACE_WIDTH,
VDP_VIDEO_MIXER_PARAMETER_VIDEO_SURFACE_HEIGHT,
- VDP_VIDEO_MIXER_PARAMETER_CHROMA_TYPE
+ VDP_VIDEO_MIXER_PARAMETER_CHROMA_TYPE,
};
const void *const parameter_values[VDP_NUM_MIXER_PARAMETER] = {
- &vid_width,
- &vid_height,
- &vdp_chroma_type
+ &vc->vid_width,
+ &vc->vid_height,
+ &vdp_chroma_type,
};
features[feature_count++] = VDP_VIDEO_MIXER_FEATURE_DEINTERLACE_TEMPORAL;
- if (deint == 4)
- features[feature_count++] = VDP_VIDEO_MIXER_FEATURE_DEINTERLACE_TEMPORAL_SPATIAL;
- if (pullup)
+ if (vc->deint == 4)
+ features[feature_count++] =
+ VDP_VIDEO_MIXER_FEATURE_DEINTERLACE_TEMPORAL_SPATIAL;
+ if (vc->pullup)
features[feature_count++] = VDP_VIDEO_MIXER_FEATURE_INVERSE_TELECINE;
- if (denoise)
+ if (vc->denoise)
features[feature_count++] = VDP_VIDEO_MIXER_FEATURE_NOISE_REDUCTION;
- if (sharpen)
+ if (vc->sharpen)
features[feature_count++] = VDP_VIDEO_MIXER_FEATURE_SHARPNESS;
- if (hqscaling)
- features[feature_count++] = VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L1 + (hqscaling - 1);
+ if (vc->hqscaling) {
+#ifndef VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L1
+ mp_msg(MSGT_VO, MSGL_ERR, "[vdpau] MPlayer was compiled with (old?) "
+ "libvdpau headers with no support for requested hqscaling.\n");
+#else
+ VdpVideoMixerFeature hqscaling_feature =
+ VDP_VIDEO_MIXER_FEATURE_HIGH_QUALITY_SCALING_L1 + vc->hqscaling-1;
+ VdpBool hqscaling_available;
+ vdp_st = vdp->video_mixer_query_feature_support(vc->vdp_device,
+ hqscaling_feature,
+ &hqscaling_available);
+ CHECK_ST_ERROR("Error when calling video_mixer_query_feature_support");
+ if (hqscaling_available)
+ features[feature_count++] = hqscaling_feature;
+ else
+ mp_msg(MSGT_VO, MSGL_ERR, "[vdpau] Your hardware or VDPAU "
+ "library does not support requested hqscaling.\n");
+#endif
+ }
- vdp_st = vdp_video_mixer_create(vdp_device, feature_count, features,
- VDP_NUM_MIXER_PARAMETER,
- parameters, parameter_values,
- &video_mixer);
- CHECK_ST_ERROR("Error when calling vdp_video_mixer_create")
+ vdp_st = vdp->video_mixer_create(vc->vdp_device, feature_count, features,
+ VDP_NUM_MIXER_PARAMETER,
+ parameters, parameter_values,
+ &vc->video_mixer);
+ CHECK_ST_ERROR("Error when calling vdp_video_mixer_create");
for (i = 0; i < feature_count; i++)
feature_enables[i] = VDP_TRUE;
- if (deint < 3)
+ if (vc->deint < 3)
feature_enables[0] = VDP_FALSE;
- if (feature_count)
- vdp_video_mixer_set_feature_enables(video_mixer, feature_count, features, feature_enables);
- if (denoise)
- vdp_video_mixer_set_attribute_values(video_mixer, 1, denoise_attrib, denoise_value);
- if (sharpen)
- vdp_video_mixer_set_attribute_values(video_mixer, 1, sharpen_attrib, sharpen_value);
- if (!chroma_deint)
- vdp_video_mixer_set_attribute_values(video_mixer, 1, skip_chroma_attrib, skip_chroma_value_ptr);
-
- update_csc_matrix();
+ if (feature_count) {
+ vdp_st = vdp->video_mixer_set_feature_enables(vc->video_mixer,
+ feature_count, features,
+ feature_enables);
+ CHECK_ST_WARNING("Error calling vdp_video_mixer_set_feature_enables");
+ }
+ if (vc->denoise)
+ SET_VIDEO_ATTR(NOISE_REDUCTION_LEVEL, float, vc->denoise);
+ if (vc->sharpen)
+ SET_VIDEO_ATTR(SHARPNESS_LEVEL, float, vc->sharpen);
+ if (!vc->chroma_deint)
+ SET_VIDEO_ATTR(SKIP_CHROMA_DEINTERLACE, uint8_t, 1);
+
+ update_csc_matrix(vo);
return 0;
}
// Free everything specific to a certain video file
-static void free_video_specific(void)
+static void free_video_specific(struct vo *vo)
{
+ struct vdpctx *vc = vo->priv;
+ struct vdp_functions *vdp = vc->vdp;
int i;
VdpStatus vdp_st;
- if (decoder != VDP_INVALID_HANDLE)
- vdp_decoder_destroy(decoder);
- decoder = VDP_INVALID_HANDLE;
- decoder_max_refs = -1;
-
- for (i = 0; i < 3; i++)
- deint_surfaces[i] = VDP_INVALID_HANDLE;
+ if (vc->decoder != VDP_INVALID_HANDLE)
+ vdp->decoder_destroy(vc->decoder);
+ vc->decoder = VDP_INVALID_HANDLE;
+ vc->decoder_max_refs = -1;
- for (i = 0; i < 2; i++)
- if (deint_mpi[i]) {
- deint_mpi[i]->usage_count--;
- deint_mpi[i] = NULL;
- }
+ forget_frames(vo);
for (i = 0; i < MAX_VIDEO_SURFACES; i++) {
- if (surface_render[i].surface != VDP_INVALID_HANDLE) {
- vdp_st = vdp_video_surface_destroy(surface_render[i].surface);
- CHECK_ST_WARNING("Error when calling vdp_video_surface_destroy")
+ if (vc->surface_render[i].surface != VDP_INVALID_HANDLE) {
+ vdp_st = vdp->video_surface_destroy(vc->surface_render[i].surface);
+ CHECK_ST_WARNING("Error when calling vdp_video_surface_destroy");
}
- surface_render[i].surface = VDP_INVALID_HANDLE;
+ vc->surface_render[i].surface = VDP_INVALID_HANDLE;
}
- if (video_mixer != VDP_INVALID_HANDLE) {
- vdp_st = vdp_video_mixer_destroy(video_mixer);
- CHECK_ST_WARNING("Error when calling vdp_video_mixer_destroy")
+ if (vc->video_mixer != VDP_INVALID_HANDLE) {
+ vdp_st = vdp->video_mixer_destroy(vc->video_mixer);
+ CHECK_ST_WARNING("Error when calling vdp_video_mixer_destroy");
}
- video_mixer = VDP_INVALID_HANDLE;
+ vc->video_mixer = VDP_INVALID_HANDLE;
}
-static int create_vdp_decoder(uint32_t format, uint32_t width, uint32_t height,
- int max_refs)
+static int create_vdp_decoder(struct vo *vo, int max_refs)
{
+ struct vdpctx *vc = vo->priv;
+ struct vdp_functions *vdp = vc->vdp;
VdpStatus vdp_st;
VdpDecoderProfile vdp_decoder_profile;
- if (decoder != VDP_INVALID_HANDLE)
- vdp_decoder_destroy(decoder);
- switch (format) {
- case IMGFMT_VDPAU_MPEG1:
- vdp_decoder_profile = VDP_DECODER_PROFILE_MPEG1;
- break;
- case IMGFMT_VDPAU_MPEG2:
- vdp_decoder_profile = VDP_DECODER_PROFILE_MPEG2_MAIN;
- break;
- case IMGFMT_VDPAU_H264:
- vdp_decoder_profile = VDP_DECODER_PROFILE_H264_HIGH;
- mp_msg(MSGT_VO, MSGL_V, "[vdpau] Creating H264 hardware decoder for %d reference frames.\n", max_refs);
- break;
- case IMGFMT_VDPAU_WMV3:
- vdp_decoder_profile = VDP_DECODER_PROFILE_VC1_MAIN;
- break;
- case IMGFMT_VDPAU_VC1:
- vdp_decoder_profile = VDP_DECODER_PROFILE_VC1_ADVANCED;
- break;
- case IMGFMT_VDPAU_MPEG4:
- vdp_decoder_profile = VDP_DECODER_PROFILE_MPEG4_PART2_ASP;
- break;
- default:
- goto err_out;
+ if (vc->decoder != VDP_INVALID_HANDLE)
+ vdp->decoder_destroy(vc->decoder);
+ switch (vc->image_format) {
+ case IMGFMT_VDPAU_MPEG1:
+ vdp_decoder_profile = VDP_DECODER_PROFILE_MPEG1;
+ break;
+ case IMGFMT_VDPAU_MPEG2:
+ vdp_decoder_profile = VDP_DECODER_PROFILE_MPEG2_MAIN;
+ break;
+ case IMGFMT_VDPAU_H264:
+ vdp_decoder_profile = VDP_DECODER_PROFILE_H264_HIGH;
+ mp_msg(MSGT_VO, MSGL_V, "[vdpau] Creating H264 hardware decoder "
+ "for %d reference frames.\n", max_refs);
+ break;
+ case IMGFMT_VDPAU_WMV3:
+ vdp_decoder_profile = VDP_DECODER_PROFILE_VC1_MAIN;
+ break;
+ case IMGFMT_VDPAU_VC1:
+ vdp_decoder_profile = VDP_DECODER_PROFILE_VC1_ADVANCED;
+ break;
+#ifdef VDP_DECODER_PROFILE_MPEG4_PART2_ASP
+ case IMGFMT_VDPAU_MPEG4:
+ vdp_decoder_profile = VDP_DECODER_PROFILE_MPEG4_PART2_ASP;
+ break;
+#endif
}
- vdp_st = vdp_decoder_create(vdp_device, vdp_decoder_profile,
- width, height, max_refs, &decoder);
+ vdp_st = vdp->decoder_create(vc->vdp_device, vdp_decoder_profile,
+ vc->vid_width, vc->vid_height, max_refs,
+ &vc->decoder);
CHECK_ST_WARNING("Failed creating VDPAU decoder");
if (vdp_st != VDP_STATUS_OK) {
-err_out:
- decoder = VDP_INVALID_HANDLE;
- decoder_max_refs = 0;
+ vc->decoder = VDP_INVALID_HANDLE;
+ vc->decoder_max_refs = 0;
return 0;
}
- decoder_max_refs = max_refs;
+ vc->decoder_max_refs = max_refs;
return 1;
}
-static void mark_vdpau_objects_uninitialized(void)
+static int initialize_vdpau_objects(struct vo *vo)
{
- int i;
+ struct vdpctx *vc = vo->priv;
+ struct vdp_functions *vdp = vc->vdp;
+ VdpStatus vdp_st;
- decoder = VDP_INVALID_HANDLE;
- for (i = 0; i < MAX_VIDEO_SURFACES; i++)
- surface_render[i].surface = VDP_INVALID_HANDLE;
- for (i = 0; i < 3; i++) {
- deint_surfaces[i] = VDP_INVALID_HANDLE;
- if (i < 2 && deint_mpi[i])
- deint_mpi[i]->usage_count--;
- deint_mpi[i] = NULL;
+ vc->vdp_chroma_type = VDP_CHROMA_TYPE_420;
+ switch (vc->image_format) {
+ case IMGFMT_YV12:
+ case IMGFMT_I420:
+ case IMGFMT_IYUV:
+ vc->vdp_pixel_format = VDP_YCBCR_FORMAT_YV12;
+ break;
+ case IMGFMT_NV12:
+ vc->vdp_pixel_format = VDP_YCBCR_FORMAT_NV12;
+ break;
+ case IMGFMT_YUY2:
+ vc->vdp_pixel_format = VDP_YCBCR_FORMAT_YUYV;
+ vc->vdp_chroma_type = VDP_CHROMA_TYPE_422;
+ break;
+ case IMGFMT_UYVY:
+ vc->vdp_pixel_format = VDP_YCBCR_FORMAT_UYVY;
+ vc->vdp_chroma_type = VDP_CHROMA_TYPE_422;
}
- video_mixer = VDP_INVALID_HANDLE;
- vdp_flip_queue = VDP_INVALID_HANDLE;
- vdp_flip_target = VDP_INVALID_HANDLE;
- for (i = 0; i <= NUM_OUTPUT_SURFACES; i++)
- output_surfaces[i] = VDP_INVALID_HANDLE;
- vdp_device = VDP_INVALID_HANDLE;
- for (i = 0; i < eosd_surface_count; i++)
- eosd_surfaces[i].surface = VDP_INVALID_HANDLE;
- output_surface_width = output_surface_height = -1;
- eosd_render_count = 0;
- visible_buf = 0;
+ if (win_x11_init_vdpau_flip_queue(vo) < 0)
+ return -1;
+
+ if (create_vdp_mixer(vo, vc->vdp_chroma_type) < 0)
+ return -1;
+
+ vdp_st = vdp->
+ bitmap_surface_query_capabilities(vc->vdp_device,
+ VDP_RGBA_FORMAT_A8,
+ &(VdpBool){0},
+ &vc->eosd_surface.max_width,
+ &vc->eosd_surface.max_height);
+ CHECK_ST_WARNING("Query to get max EOSD surface size failed");
+ forget_frames(vo);
+ resize(vo);
+ return 0;
+}
+
+static void mark_vdpau_objects_uninitialized(struct vo *vo)
+{
+ struct vdpctx *vc = vo->priv;
+
+ vc->decoder = VDP_INVALID_HANDLE;
+ for (int i = 0; i < MAX_VIDEO_SURFACES; i++)
+ vc->surface_render[i].surface = VDP_INVALID_HANDLE;
+ forget_frames(vo);
+ vc->video_mixer = VDP_INVALID_HANDLE;
+ vc->flip_queue = VDP_INVALID_HANDLE;
+ vc->flip_target = VDP_INVALID_HANDLE;
+ for (int i = 0; i <= NUM_OUTPUT_SURFACES; i++)
+ vc->output_surfaces[i] = VDP_INVALID_HANDLE;
+ vc->vdp_device = VDP_INVALID_HANDLE;
+ vc->eosd_surface = (struct eosd_bitmap_surface){
+ .surface = VDP_INVALID_HANDLE,
+ };
+ vc->output_surface_width = vc->output_surface_height = -1;
+ vc->eosd_render_count = 0;
+ vc->num_shown_frames = 0;
}
-static int handle_preemption(void)
+static int handle_preemption(struct vo *vo)
{
- if (!is_preempted)
+ struct vdpctx *vc = vo->priv;
+
+ if (!vc->is_preempted)
return 0;
- is_preempted = 0;
- mp_msg(MSGT_VO, MSGL_INFO, "[vdpau] Attempting to recover from preemption.\n");
- mark_vdpau_objects_uninitialized();
- if (win_x11_init_vdpau_procs() < 0 ||
- win_x11_init_vdpau_flip_queue() < 0 ||
- create_vdp_mixer(vdp_chroma_type) < 0) {
- mp_msg(MSGT_VO, MSGL_ERR, "[vdpau] Recovering from preemption failed\n");
- is_preempted = 1;
+ if (!vc->preemption_acked)
+ mark_vdpau_objects_uninitialized(vo);
+ vc->preemption_acked = true;
+ if (!vc->preemption_user_notified) {
+ mp_tmsg(MSGT_VO, MSGL_ERR, "[vdpau] Got display preemption notice! "
+ "Will attempt to recover.\n");
+ vc->preemption_user_notified = true;
+ }
+ /* Trying to initialize seems to be quite slow, so only try once a
+ * second to avoid using 100% CPU. */
+ if (vc->last_preemption_retry_fail
+ && GetTimerMS() - vc->last_preemption_retry_fail < 1000)
+ return -1;
+ if (win_x11_init_vdpau_procs(vo) < 0 || initialize_vdpau_objects(vo) < 0) {
+ vc->last_preemption_retry_fail = GetTimerMS() | 1;
return -1;
}
- resize();
- mp_msg(MSGT_VO, MSGL_INFO, "[vdpau] Recovered from display preemption.\n");
+ vc->last_preemption_retry_fail = 0;
+ vc->is_preempted = false;
+ vc->preemption_user_notified = false;
+ mp_tmsg(MSGT_VO, MSGL_INFO, "[vdpau] Recovered from display preemption.\n");
return 1;
}
@@ -642,10 +841,12 @@ static int handle_preemption(void)
* connect to X server, create and map window, initialize all
* VDPAU objects, create different surfaces etc.
*/
-static int config(uint32_t width, uint32_t height, uint32_t d_width,
- uint32_t d_height, uint32_t flags, char *title,
- uint32_t format)
+static int config(struct vo *vo, uint32_t width, uint32_t height,
+ uint32_t d_width, uint32_t d_height, uint32_t flags,
+ char *title, uint32_t format)
{
+ struct vdpctx *vc = vo->priv;
+ struct vo_x11_state *x11 = vo->x11;
XVisualInfo vinfo;
XSetWindowAttributes xswa;
XWindowAttributes attribs;
@@ -655,142 +856,121 @@ static int config(uint32_t width, uint32_t height, uint32_t d_width,
#ifdef CONFIG_XF86VM
int vm = flags & VOFLAG_MODESWITCHING;
#endif
- flip = flags & VOFLAG_FLIPPING;
-
- image_format = format;
- vid_width = width;
- vid_height = height;
- free_video_specific();
- if (IMGFMT_IS_VDPAU(image_format)
- && !create_vdp_decoder(image_format, vid_width, vid_height, 2))
- return -1;
- int_pause = 0;
- visible_buf = 0;
+ if (handle_preemption(vo) < 0)
+ return -1;
-#ifdef CONFIG_GUI
- if (use_gui)
- guiGetEvent(guiSetShVideo, 0); // the GUI will set up / resize our window
+ vc->flip = flags & VOFLAG_FLIPPING;
+ vc->image_format = format;
+ vc->vid_width = width;
+ vc->vid_height = height;
+ if (vc->user_colorspace == 0)
+ vc->colorspace = width >= 1280 || height > 576 ? 1 : 0;
else
-#endif
- {
+ vc->colorspace = vc->user_colorspace - 1;
+ free_video_specific(vo);
+ if (IMGFMT_IS_VDPAU(vc->image_format) && !create_vdp_decoder(vo, 2))
+ return -1;
+
#ifdef CONFIG_XF86VM
- if (vm)
- vo_vm_switch();
- else
+ if (vm) {
+ vo_vm_switch(vo);
+ vc->mode_switched = true;
+ }
#endif
- XGetWindowAttributes(mDisplay, DefaultRootWindow(mDisplay), &attribs);
- depth = attribs.depth;
- if (depth != 15 && depth != 16 && depth != 24 && depth != 32)
- depth = 24;
- XMatchVisualInfo(mDisplay, mScreen, depth, TrueColor, &vinfo);
-
- xswa.background_pixel = 0;
- xswa.border_pixel = 0;
- /* Do not use CWBackPixel: It leads to VDPAU errors after
- aspect ratio changes. */
- xswamask = CWBorderPixel;
-
- vo_x11_create_vo_window(&vinfo, vo_dx, vo_dy, d_width, d_height,
- flags, CopyFromParent, "vdpau", title);
- XChangeWindowAttributes(mDisplay, vo_window, xswamask, &xswa);
+ XGetWindowAttributes(x11->display, DefaultRootWindow(x11->display),
+ &attribs);
+ depth = attribs.depth;
+ if (depth != 15 && depth != 16 && depth != 24 && depth != 32)
+ depth = 24;
+ XMatchVisualInfo(x11->display, x11->screen, depth, TrueColor, &vinfo);
+
+ xswa.background_pixel = 0;
+ xswa.border_pixel = 0;
+ /* Do not use CWBackPixel: It leads to VDPAU errors after
+ * aspect ratio changes. */
+ xswamask = CWBorderPixel;
+
+ vo_x11_create_vo_window(vo, &vinfo, vo->dx, vo->dy, d_width, d_height,
+ flags, CopyFromParent, "vdpau", title);
+ XChangeWindowAttributes(x11->display, x11->window, xswamask, &xswa);
#ifdef CONFIG_XF86VM
- if (vm) {
- /* Grab the mouse pointer in our window */
- if (vo_grabpointer)
- XGrabPointer(mDisplay, vo_window, True, 0,
- GrabModeAsync, GrabModeAsync,
- vo_window, None, CurrentTime);
- XSetInputFocus(mDisplay, vo_window, RevertToNone, CurrentTime);
- }
-#endif
+ if (vm) {
+ /* Grab the mouse pointer in our window */
+ if (vo_grabpointer)
+ XGrabPointer(x11->display, x11->window, True, 0,
+ GrabModeAsync, GrabModeAsync,
+ x11->window, None, CurrentTime);
+ XSetInputFocus(x11->display, x11->window, RevertToNone, CurrentTime);
}
+#endif
if ((flags & VOFLAG_FULLSCREEN) && WinID <= 0)
vo_fs = 1;
- /* -----VDPAU related code here -------- */
- if (vdp_flip_queue == VDP_INVALID_HANDLE && win_x11_init_vdpau_flip_queue())
+ if (initialize_vdpau_objects(vo) < 0)
return -1;
- vdp_chroma_type = VDP_CHROMA_TYPE_420;
- switch (image_format) {
- case IMGFMT_YV12:
- case IMGFMT_I420:
- case IMGFMT_IYUV:
- vdp_pixel_format = VDP_YCBCR_FORMAT_YV12;
- break;
- case IMGFMT_NV12:
- vdp_pixel_format = VDP_YCBCR_FORMAT_NV12;
- break;
- case IMGFMT_YUY2:
- vdp_pixel_format = VDP_YCBCR_FORMAT_YUYV;
- vdp_chroma_type = VDP_CHROMA_TYPE_422;
- break;
- case IMGFMT_UYVY:
- vdp_pixel_format = VDP_YCBCR_FORMAT_UYVY;
- vdp_chroma_type = VDP_CHROMA_TYPE_422;
- }
- if (create_vdp_mixer(vdp_chroma_type))
- return -1;
-
- surface_num = 0;
- vid_surface_num = -1;
- resize();
-
return 0;
}
-static void check_events(void)
+static void check_events(struct vo *vo)
{
- int e = vo_x11_check_events(mDisplay);
+ struct vdpctx *vc = vo->priv;
+ struct vdp_functions *vdp = vc->vdp;
- if (handle_preemption() < 0)
+ if (handle_preemption(vo) < 0)
return;
- if (e & VO_EVENT_RESIZE)
- resize();
+ int e = vo_x11_check_events(vo);
- if ((e & VO_EVENT_EXPOSE || e & VO_EVENT_RESIZE) && int_pause) {
+ if (e & VO_EVENT_RESIZE)
+ resize(vo);
+ else if (e & VO_EVENT_EXPOSE && vc->paused) {
/* did we already draw a buffer */
- if (visible_buf) {
+ if (vc->num_shown_frames) {
/* redraw the last visible buffer */
VdpStatus vdp_st;
- vdp_st = vdp_presentation_queue_display(vdp_flip_queue,
- output_surfaces[surface_num],
- vo_dwidth, vo_dheight,
- 0);
- CHECK_ST_WARNING("Error when calling vdp_presentation_queue_display")
+ int last_surface = (vc->surface_num + NUM_OUTPUT_SURFACES - 1)
+ % NUM_OUTPUT_SURFACES;
+ vdp_st = vdp->presentation_queue_display(vc->flip_queue,
+ vc->output_surfaces[last_surface],
+ vo->dwidth, vo->dheight, 0);
+ CHECK_ST_WARNING("Error when calling "
+ "vdp_presentation_queue_display");
}
}
}
-static void draw_osd_I8A8(int x0,int y0, int w,int h, unsigned char *src,
- unsigned char *srca, int stride)
+static void draw_osd_I8A8(void *ctx, int x0, int y0, int w, int h,
+ unsigned char *src, unsigned char *srca, int stride)
{
- VdpOutputSurface output_surface = output_surfaces[surface_num];
+ struct vo *vo = ctx;
+ struct vdpctx *vc = vo->priv;
+ struct vdp_functions *vdp = vc->vdp;
+ VdpOutputSurface output_surface = vc->output_surfaces[vc->surface_num];
VdpStatus vdp_st;
- int i, j;
+ int i;
int pitch;
int index_data_size_required;
VdpRect output_indexed_rect_vid;
- VdpOutputSurfaceRenderBlendState blend_state;
if (!w || !h)
return;
index_data_size_required = 2*w*h;
- if (index_data_size < index_data_size_required) {
- index_data = realloc(index_data, index_data_size_required);
- index_data_size = index_data_size_required;
+ if (vc->index_data_size < index_data_size_required) {
+ vc->index_data = talloc_realloc_size(vc, vc->index_data,
+ index_data_size_required);
+ vc->index_data_size = index_data_size_required;
}
// index_data creation, component order - I, A, I, A, .....
for (i = 0; i < h; i++)
- for (j = 0; j < w; j++) {
- index_data[i*2*w + j*2] = src [i*stride + j];
- index_data[i*2*w + j*2 + 1] = -srca[i*stride + j];
+ for (int j = 0; j < w; j++) {
+ vc->index_data[i*2*w + j*2] = src [i*stride+j];
+ vc->index_data[i*2*w + j*2 + 1] = -srca[i*stride+j];
}
output_indexed_rect_vid.x0 = x0;
@@ -801,281 +981,510 @@ static void draw_osd_I8A8(int x0,int y0, int w,int h, unsigned char *src,
pitch = w*2;
// write source_data to osd_surface.
- vdp_st = vdp_output_surface_put_bits_indexed(osd_surface,
- VDP_INDEXED_FORMAT_I8A8,
- (const void *const*)&index_data,
- &pitch,
- &output_indexed_rect_vid,
- VDP_COLOR_TABLE_FORMAT_B8G8R8X8,
- (void *)palette);
- CHECK_ST_WARNING("Error when calling vdp_output_surface_put_bits_indexed")
-
- blend_state.struct_version = VDP_OUTPUT_SURFACE_RENDER_BLEND_STATE_VERSION;
- blend_state.blend_factor_source_color = VDP_OUTPUT_SURFACE_RENDER_BLEND_FACTOR_ONE;
- blend_state.blend_factor_source_alpha = VDP_OUTPUT_SURFACE_RENDER_BLEND_FACTOR_ONE;
- blend_state.blend_factor_destination_color = VDP_OUTPUT_SURFACE_RENDER_BLEND_FACTOR_ONE_MINUS_SRC_ALPHA;
- blend_state.blend_factor_destination_alpha = VDP_OUTPUT_SURFACE_RENDER_BLEND_FACTOR_ONE_MINUS_SRC_ALPHA;
- blend_state.blend_equation_color = VDP_OUTPUT_SURFACE_RENDER_BLEND_EQUATION_ADD;
- blend_state.blend_equation_alpha = VDP_OUTPUT_SURFACE_RENDER_BLEND_EQUATION_ADD;
-
- vdp_st = vdp_output_surface_render_output_surface(output_surface,
- &output_indexed_rect_vid,
- osd_surface,
- &output_indexed_rect_vid,
- NULL,
- &blend_state,
- VDP_OUTPUT_SURFACE_RENDER_ROTATE_0);
- CHECK_ST_WARNING("Error when calling vdp_output_surface_render_output_surface")
+ vdp_st = vdp->
+ output_surface_put_bits_indexed(osd_surface, VDP_INDEXED_FORMAT_I8A8,
+ (const void *const*)&vc->index_data,
+ &pitch, &output_indexed_rect_vid,
+ VDP_COLOR_TABLE_FORMAT_B8G8R8X8,
+ (void *)vc->palette);
+ CHECK_ST_WARNING("Error when calling vdp_output_surface_put_bits_indexed");
+
+ VdpOutputSurfaceRenderBlendState blend_state = {
+ .struct_version = VDP_OUTPUT_SURFACE_RENDER_BLEND_STATE_VERSION,
+ .blend_factor_source_color =
+ VDP_OUTPUT_SURFACE_RENDER_BLEND_FACTOR_ONE,
+ .blend_factor_source_alpha =
+ VDP_OUTPUT_SURFACE_RENDER_BLEND_FACTOR_ONE,
+ .blend_factor_destination_color =
+ VDP_OUTPUT_SURFACE_RENDER_BLEND_FACTOR_ONE_MINUS_SRC_ALPHA,
+ .blend_factor_destination_alpha =
+ VDP_OUTPUT_SURFACE_RENDER_BLEND_FACTOR_ONE_MINUS_SRC_ALPHA,
+ .blend_equation_color = VDP_OUTPUT_SURFACE_RENDER_BLEND_EQUATION_ADD,
+ .blend_equation_alpha = VDP_OUTPUT_SURFACE_RENDER_BLEND_EQUATION_ADD,
+ };
+
+ vdp_st = vdp->
+ output_surface_render_output_surface(output_surface,
+ &output_indexed_rect_vid,
+ osd_surface,
+ &output_indexed_rect_vid,
+ NULL, &blend_state,
+ VDP_OUTPUT_SURFACE_RENDER_ROTATE_0);
+ CHECK_ST_WARNING("Error when calling "
+ "vdp_output_surface_render_output_surface");
}
-static void draw_eosd(void)
+static void draw_eosd(struct vo *vo)
{
+ struct vdpctx *vc = vo->priv;
+ struct vdp_functions *vdp = vc->vdp;
VdpStatus vdp_st;
- VdpOutputSurface output_surface = output_surfaces[surface_num];
- VdpOutputSurfaceRenderBlendState blend_state;
+ VdpOutputSurface output_surface = vc->output_surfaces[vc->surface_num];
int i;
- blend_state.struct_version = VDP_OUTPUT_SURFACE_RENDER_BLEND_STATE_VERSION;
- blend_state.blend_factor_source_color = VDP_OUTPUT_SURFACE_RENDER_BLEND_FACTOR_SRC_ALPHA;
- blend_state.blend_factor_source_alpha = VDP_OUTPUT_SURFACE_RENDER_BLEND_FACTOR_ONE;
- blend_state.blend_factor_destination_color = VDP_OUTPUT_SURFACE_RENDER_BLEND_FACTOR_ONE_MINUS_SRC_ALPHA;
- blend_state.blend_factor_destination_alpha = VDP_OUTPUT_SURFACE_RENDER_BLEND_FACTOR_SRC_ALPHA;
- blend_state.blend_equation_color = VDP_OUTPUT_SURFACE_RENDER_BLEND_EQUATION_ADD;
- blend_state.blend_equation_alpha = VDP_OUTPUT_SURFACE_RENDER_BLEND_EQUATION_ADD;
-
- for (i = 0; i < eosd_render_count; i++) {
- vdp_st = vdp_output_surface_render_bitmap_surface(
- output_surface, &eosd_targets[i].dest,
- eosd_targets[i].surface, &eosd_targets[i].source,
- &eosd_targets[i].color, &blend_state,
- VDP_OUTPUT_SURFACE_RENDER_ROTATE_0);
- CHECK_ST_WARNING("EOSD: Error when rendering")
+ if (handle_preemption(vo) < 0)
+ return;
+
+ VdpOutputSurfaceRenderBlendState blend_state = {
+ .struct_version = VDP_OUTPUT_SURFACE_RENDER_BLEND_STATE_VERSION,
+ .blend_factor_source_color =
+ VDP_OUTPUT_SURFACE_RENDER_BLEND_FACTOR_SRC_ALPHA,
+ .blend_factor_source_alpha =
+ VDP_OUTPUT_SURFACE_RENDER_BLEND_FACTOR_ONE,
+ .blend_factor_destination_color =
+ VDP_OUTPUT_SURFACE_RENDER_BLEND_FACTOR_ONE_MINUS_SRC_ALPHA,
+ .blend_factor_destination_alpha =
+ VDP_OUTPUT_SURFACE_RENDER_BLEND_FACTOR_SRC_ALPHA,
+ .blend_equation_color = VDP_OUTPUT_SURFACE_RENDER_BLEND_EQUATION_ADD,
+ .blend_equation_alpha = VDP_OUTPUT_SURFACE_RENDER_BLEND_EQUATION_ADD,
+ };
+
+ for (i = 0; i < vc->eosd_render_count; i++) {
+ vdp_st = vdp->
+ output_surface_render_bitmap_surface(output_surface,
+ &vc->eosd_targets[i].dest,
+ vc->eosd_surface.surface,
+ &vc->eosd_targets[i].source,
+ &vc->eosd_targets[i].color,
+ &blend_state,
+ VDP_OUTPUT_SURFACE_RENDER_ROTATE_0);
+ CHECK_ST_WARNING("EOSD: Error when rendering");
+ }
+}
+
+#define HEIGHT_SORT_BITS 4
+static int size_index(struct eosd_target *r)
+{
+ unsigned int h = r->source.y1;
+ int n = av_log2_16bit(h);
+ return (n << HEIGHT_SORT_BITS)
+ + (- 1 - (h << HEIGHT_SORT_BITS >> n) & (1 << HEIGHT_SORT_BITS) - 1);
+}
+
+/* Pack the given rectangles into an area of size w * h.
+ * The size of each rectangle is read from .source.x1/.source.y1.
+ * The height of each rectangle must be at least 1 and less than 65536.
+ * The .source rectangle is then set corresponding to the packed position.
+ * 'scratch' must point to work memory for num_rects+16 ints.
+ * Return 0 on success, -1 if the rectangles did not fit in w*h.
+ *
+ * The rectangles are placed in rows in order approximately sorted by
+ * height (the approximate sorting is simpler than a full one would be,
+ * and allows the algorithm to work in linear time). Additionally, to
+ * reduce wasted space when there are a few tall rectangles, empty
+ * lower-right parts of rows are filled recursively when the size of
+ * rectangles in the row drops past a power-of-two threshold. So if a
+ * row starts with rectangles of size 3x50, 10x40 and 5x20 then the
+ * free rectangle with corners (13, 20)-(w, 50) is filled recursively.
+ */
+static int pack_rectangles(struct eosd_target *rects, int num_rects,
+ int w, int h, int *scratch)
+{
+ int bins[16 << HEIGHT_SORT_BITS];
+ int sizes[16 << HEIGHT_SORT_BITS] = {};
+ for (int i = 0; i < num_rects; i++)
+ sizes[size_index(rects + i)]++;
+ int idx = 0;
+ for (int i = 0; i < 16 << HEIGHT_SORT_BITS; i += 1 << HEIGHT_SORT_BITS) {
+ for (int j = 0; j < 1 << HEIGHT_SORT_BITS; j++) {
+ bins[i + j] = idx;
+ idx += sizes[i + j];
+ }
+ scratch[idx++] = -1;
+ }
+ for (int i = 0; i < num_rects; i++)
+ scratch[bins[size_index(rects + i)]++] = i;
+ for (int i = 0; i < 16; i++)
+ bins[i] = bins[i << HEIGHT_SORT_BITS] - sizes[i << HEIGHT_SORT_BITS];
+ struct {
+ int size, x, bottom;
+ } stack[16] = {{15, 0, h}}, s = {};
+ int stackpos = 1;
+ int y;
+ while (stackpos) {
+ y = s.bottom;
+ s = stack[--stackpos];
+ s.size++;
+ while (s.size--) {
+ int maxy = -1;
+ int obj;
+ while ((obj = scratch[bins[s.size]]) >= 0) {
+ int bottom = y + rects[obj].source.y1;
+ if (bottom > s.bottom)
+ break;
+ int right = s.x + rects[obj].source.x1;
+ if (right > w)
+ break;
+ bins[s.size]++;
+ rects[obj].source.x0 = s.x;
+ rects[obj].source.x1 += s.x;
+ rects[obj].source.y0 = y;
+ rects[obj].source.y1 += y;
+ num_rects--;
+ if (maxy <= 0)
+ stack[stackpos++] = s;
+ s.x = right;
+ maxy = FFMAX(maxy, bottom);
+ }
+ if (maxy > 0)
+ s.bottom = maxy;
+ }
}
+ return num_rects ? -1 : 0;
}
-static void generate_eosd(mp_eosd_images_t *imgs)
+static void generate_eosd(struct vo *vo, mp_eosd_images_t *imgs)
{
+ struct vdpctx *vc = vo->priv;
+ struct vdp_functions *vdp = vc->vdp;
VdpStatus vdp_st;
- VdpRect destRect;
- int j, found;
- ass_image_t *img = imgs->imgs;
- ass_image_t *i;
+ int i;
+ ASS_Image *img = imgs->imgs;
+ ASS_Image *p;
+ struct eosd_bitmap_surface *sfc = &vc->eosd_surface;
+ bool need_upload = false;
- // Nothing changed, no need to redraw
if (imgs->changed == 0)
- return;
- eosd_render_count = 0;
- // There's nothing to render!
+ return; // Nothing changed, no need to redraw
+
+ vc->eosd_render_count = 0;
+
if (!img)
- return;
+ return; // There's nothing to render!
if (imgs->changed == 1)
goto eosd_skip_upload;
- for (j = 0; j < eosd_surface_count; j++)
- eosd_surfaces[j].in_use = 0;
-
- for (i = img; i; i = i->next) {
- // Try to reuse a suitable surface
- found = -1;
- for (j = 0; j < eosd_surface_count; j++) {
- if (eosd_surfaces[j].surface != VDP_INVALID_HANDLE && !eosd_surfaces[j].in_use &&
- eosd_surfaces[j].w >= i->w && eosd_surfaces[j].h >= i->h) {
- found = j;
- break;
- }
- }
- // None found, allocate a new surface
- if (found < 0) {
- for (j = 0; j < eosd_surface_count; j++) {
- if (!eosd_surfaces[j].in_use) {
- if (eosd_surfaces[j].surface != VDP_INVALID_HANDLE)
- vdp_bitmap_surface_destroy(eosd_surfaces[j].surface);
- found = j;
- break;
- }
- }
+ need_upload = true;
+ bool reallocate = false;
+ while (1) {
+ for (p = img, i = 0; p; p = p->next) {
+ if (p->w <= 0 || p->h <= 0)
+ continue;
// Allocate new space for surface/target arrays
- if (found < 0) {
- j = found = eosd_surface_count;
- eosd_surface_count = eosd_surface_count ? eosd_surface_count*2 : EOSD_SURFACES_INITIAL;
- eosd_surfaces = realloc(eosd_surfaces, eosd_surface_count * sizeof(*eosd_surfaces));
- eosd_targets = realloc(eosd_targets, eosd_surface_count * sizeof(*eosd_targets));
- for (j = found; j < eosd_surface_count; j++) {
- eosd_surfaces[j].surface = VDP_INVALID_HANDLE;
- eosd_surfaces[j].in_use = 0;
- }
+ if (i >= vc->eosd_targets_size) {
+ vc->eosd_targets_size = FFMAX(vc->eosd_targets_size * 2, 512);
+ vc->eosd_targets =
+ talloc_realloc_size(vc, vc->eosd_targets,
+ vc->eosd_targets_size
+ * sizeof(*vc->eosd_targets));
+ vc->eosd_scratch =
+ talloc_realloc_size(vc, vc->eosd_scratch,
+ (vc->eosd_targets_size + 16)
+ * sizeof(*vc->eosd_scratch));
}
- vdp_st = vdp_bitmap_surface_create(vdp_device, VDP_RGBA_FORMAT_A8,
- i->w, i->h, VDP_TRUE, &eosd_surfaces[found].surface);
- CHECK_ST_WARNING("EOSD: error when creating surface")
- eosd_surfaces[found].w = i->w;
- eosd_surfaces[found].h = i->h;
+ vc->eosd_targets[i].source.x1 = p->w;
+ vc->eosd_targets[i].source.y1 = p->h;
+ i++;
+ }
+ if (pack_rectangles(vc->eosd_targets, i, sfc->w, sfc->h,
+ vc->eosd_scratch) >= 0)
+ break;
+ int w = FFMIN(FFMAX(sfc->w * 2, EOSD_SURFACE_INITIAL_SIZE),
+ sfc->max_width);
+ int h = FFMIN(FFMAX(sfc->h * 2, EOSD_SURFACE_INITIAL_SIZE),
+ sfc->max_height);
+ if (w == sfc->w && h == sfc->h) {
+ mp_msg(MSGT_VO, MSGL_ERR, "[vdpau] EOSD bitmaps do not fit on "
+ "a surface with the maximum supported size\n");
+ return;
+ } else {
+ sfc->w = w;
+ sfc->h = h;
}
- eosd_surfaces[found].in_use = 1;
- eosd_targets[eosd_render_count].surface = eosd_surfaces[found].surface;
- destRect.x0 = 0;
- destRect.y0 = 0;
- destRect.x1 = i->w;
- destRect.y1 = i->h;
- vdp_st = vdp_bitmap_surface_putbits_native(eosd_targets[eosd_render_count].surface,
- (const void *) &i->bitmap, &i->stride, &destRect);
- CHECK_ST_WARNING("EOSD: putbits failed")
- eosd_render_count++;
+ reallocate = true;
+ }
+ if (reallocate) {
+ if (sfc->surface != VDP_INVALID_HANDLE)
+ vdp->bitmap_surface_destroy(sfc->surface);
+ mp_msg(MSGT_VO, MSGL_V, "[vdpau] Allocating a %dx%d surface for "
+ "EOSD bitmaps.\n", sfc->w, sfc->h);
+ vdp_st = vdp->bitmap_surface_create(vc->vdp_device, VDP_RGBA_FORMAT_A8,
+ sfc->w, sfc->h, true,
+ &sfc->surface);
+ if (vdp_st != VDP_STATUS_OK)
+ sfc->surface = VDP_INVALID_HANDLE;
+ CHECK_ST_WARNING("EOSD: error when creating surface");
}
eosd_skip_upload:
- eosd_render_count = 0;
- for (i = img; i; i = i->next) {
+ if (sfc->surface == VDP_INVALID_HANDLE)
+ return;
+ for (p = img; p; p = p->next) {
+ if (p->w <= 0 || p->h <= 0)
+ continue;
+ struct eosd_target *target = &vc->eosd_targets[vc->eosd_render_count];
+ if (need_upload) {
+ vdp_st = vdp->
+ bitmap_surface_put_bits_native(sfc->surface,
+ (const void *) &p->bitmap,
+ &p->stride, &target->source);
+ CHECK_ST_WARNING("EOSD: putbits failed");
+ }
// Render dest, color, etc.
- eosd_targets[eosd_render_count].color.alpha = 1.0 - ((i->color >> 0) & 0xff) / 255.0;
- eosd_targets[eosd_render_count].color.blue = ((i->color >> 8) & 0xff) / 255.0;
- eosd_targets[eosd_render_count].color.green = ((i->color >> 16) & 0xff) / 255.0;
- eosd_targets[eosd_render_count].color.red = ((i->color >> 24) & 0xff) / 255.0;
- eosd_targets[eosd_render_count].dest.x0 = i->dst_x;
- eosd_targets[eosd_render_count].dest.y0 = i->dst_y;
- eosd_targets[eosd_render_count].dest.x1 = i->w + i->dst_x;
- eosd_targets[eosd_render_count].dest.y1 = i->h + i->dst_y;
- eosd_targets[eosd_render_count].source.x0 = 0;
- eosd_targets[eosd_render_count].source.y0 = 0;
- eosd_targets[eosd_render_count].source.x1 = i->w;
- eosd_targets[eosd_render_count].source.y1 = i->h;
- eosd_render_count++;
+ target->color.alpha = 1.0 - ((p->color >> 0) & 0xff) / 255.0;
+ target->color.blue = ((p->color >> 8) & 0xff) / 255.0;
+ target->color.green = ((p->color >> 16) & 0xff) / 255.0;
+ target->color.red = ((p->color >> 24) & 0xff) / 255.0;
+ target->dest.x0 = p->dst_x;
+ target->dest.y0 = p->dst_y;
+ target->dest.x1 = p->w + p->dst_x;
+ target->dest.y1 = p->h + p->dst_y;
+ vc->eosd_render_count++;
}
}
-static void draw_osd(void)
+static void draw_osd(struct vo *vo, struct osd_state *osd)
{
+ struct vdpctx *vc = vo->priv;
mp_msg(MSGT_VO, MSGL_DBG2, "DRAW_OSD\n");
- if (handle_preemption() < 0)
+ if (handle_preemption(vo) < 0)
return;
- vo_draw_text_ext(vo_dwidth, vo_dheight, border_x, border_y, border_x, border_y,
- vid_width, vid_height, draw_osd_I8A8);
+ osd_draw_text_ext(osd, vo->dwidth, vo->dheight, vc->border_x, vc->border_y,
+ vc->border_x, vc->border_y, vc->vid_width,
+ vc->vid_height, draw_osd_I8A8, vo);
}
-static void flip_page(void)
+static void wait_for_previous_frame(struct vo *vo)
{
+ struct vdpctx *vc = vo->priv;
+ struct vdp_functions *vdp = vc->vdp;
VdpStatus vdp_st;
- mp_msg(MSGT_VO, MSGL_DBG2, "\nFLIP_PAGE VID:%u -> OUT:%u\n",
- surface_render[vid_surface_num].surface, output_surfaces[surface_num]);
- if (handle_preemption() < 0)
+ if (vc->num_shown_frames < 2)
return;
- vdp_st = vdp_presentation_queue_display(vdp_flip_queue, output_surfaces[surface_num],
- vo_dwidth, vo_dheight,
- 0);
- CHECK_ST_WARNING("Error when calling vdp_presentation_queue_display")
+ VdpTime vtime;
+ VdpOutputSurface visible_s, prev_s;
+ int base = vc->surface_num + NUM_OUTPUT_SURFACES;
+ visible_s = vc->output_surfaces[(base - 1) % NUM_OUTPUT_SURFACES];
+ prev_s = vc->output_surfaces[(base - 2) % NUM_OUTPUT_SURFACES];
+ vdp_st = vdp->presentation_queue_block_until_surface_idle(vc->flip_queue,
+ prev_s, &vtime);
+ CHECK_ST_WARNING("Error calling "
+ "presentation_queue_block_until_surface_idle");
+ VdpPresentationQueueStatus status;
+ vdp_st = vdp->presentation_queue_query_surface_status(vc->flip_queue,
+ visible_s,
+ &status, &vtime);
+ CHECK_ST_WARNING("Error calling presentation_queue_query_surface_status");
+ vc->recent_vsync_time = vtime;
+}
- surface_num = (surface_num + 1) % NUM_OUTPUT_SURFACES;
- visible_buf = 1;
+static inline uint64_t prev_vs2(struct vdpctx *vc, uint64_t ts, int shift)
+{
+ uint64_t offset = ts - vc->recent_vsync_time;
+ // Fix negative values for 1<<shift vsyncs before vc->recent_vsync_time
+ offset += (uint64_t)vc->vsync_interval << shift;
+ offset %= vc->vsync_interval;
+ return ts - offset;
}
-static int draw_slice(uint8_t *image[], int stride[], int w, int h,
- int x, int y)
+static void flip_page_timed(struct vo *vo, unsigned int pts_us, int duration)
{
+ struct vdpctx *vc = vo->priv;
+ struct vdp_functions *vdp = vc->vdp;
VdpStatus vdp_st;
- struct vdpau_render_state *rndr = (struct vdpau_render_state *)image[0];
- int max_refs = image_format == IMGFMT_VDPAU_H264 ? rndr->info.h264.num_ref_frames : 2;
+ uint32_t vsync_interval = vc->vsync_interval;
+
+ if (handle_preemption(vo) < 0)
+ return;
+
+ if (duration > INT_MAX / 1000)
+ duration = -1;
+ else
+ duration *= 1000;
+
+ if (vc->user_fps < 0)
+ duration = -1; // Make sure drop logic is disabled
+
+ uint64_t now = sync_vdptime(vo);
+ uint64_t pts = pts_us ? convert_to_vdptime(vo, pts_us) : now;
+ uint64_t ideal_pts = pts;
+ uint64_t npts = duration >= 0 ? pts + duration : UINT64_MAX;
+
+#define PREV_VS2(ts, shift) prev_vs2(vc, ts, shift)
+ // Only gives accurate results for ts >= vc->recent_vsync_time
+#define PREV_VSYNC(ts) PREV_VS2(ts, 0)
+
+ /* We hope to be here at least one vsync before the frame should be shown.
+ * If we are running late then don't drop the frame unless there is
+ * already one queued for the next vsync; even if we _hope_ to show the
+ * next frame soon enough to mean this one should be dropped we might
+ * not make the target time in reality. Without this check we could drop
+ * every frame, freezing the display completely if video lags behind.
+ */
+ if (now > PREV_VSYNC(FFMAX(pts,
+ vc->last_queue_time + vsync_interval)))
+ npts = UINT64_MAX;
+
+ /* Allow flipping a frame at a vsync if its presentation time is a
+ * bit after that vsync and the change makes the flip time delta
+ * from previous frame better match the target timestamp delta.
+ * This avoids instability with frame timestamps falling near vsyncs.
+ * For example if the frame timestamps were (with vsyncs at
+ * integer values) 0.01, 1.99, 4.01, 5.99, 8.01, ... then
+ * straightforward timing at next vsync would flip the frames at
+ * 1, 2, 5, 6, 9; this changes it to 1, 2, 4, 6, 8 and so on with
+ * regular 2-vsync intervals.
+ *
+ * Also allow moving the frame forward if it looks like we dropped
+ * the previous frame incorrectly (now that we know better after
+ * having final exact timestamp information for this frame) and
+ * there would unnecessarily be a vsync without a frame change.
+ */
+ uint64_t vsync = PREV_VSYNC(pts);
+ if (pts < vsync + vsync_interval / 4
+ && (vsync - PREV_VS2(vc->last_queue_time, 16)
+ > pts - vc->last_ideal_time + vsync_interval / 2
+ || vc->dropped_frame && vsync > vc->dropped_time))
+ pts -= vsync_interval / 2;
+
+ vc->dropped_frame = true; // changed at end if false
+ vc->dropped_time = ideal_pts;
+
+ pts = FFMAX(pts, vc->last_queue_time + vsync_interval);
+ pts = FFMAX(pts, now);
+ if (npts < PREV_VSYNC(pts) + vsync_interval)
+ return;
+
+ /* At least on my NVIDIA 9500GT with driver versions 185.18.36 and 190.42
+ * trying to queue two unshown frames simultaneously caused bad behavior
+ * (high CPU use in _other_ VDPAU functions called later). Avoiding
+ * longer queues also makes things simpler. So currently we always
+ * try to keep exactly one frame queued for the future, queuing the
+ * current frame immediately after the previous one is shown.
+ */
+ wait_for_previous_frame(vo);
+
+ now = sync_vdptime(vo);
+ pts = FFMAX(pts, now);
+ vsync = PREV_VSYNC(pts);
+ if (npts < vsync + vsync_interval)
+ return;
+ pts = vsync + (vsync_interval >> 2);
+ vdp_st =
+ vdp->presentation_queue_display(vc->flip_queue,
+ vc->output_surfaces[vc->surface_num],
+ vo->dwidth, vo->dheight, pts);
+ CHECK_ST_WARNING("Error when calling vdp_presentation_queue_display");
+
+ vc->last_queue_time = pts;
+ vc->last_ideal_time = ideal_pts;
+ vc->dropped_frame = false;
+ vc->surface_num = (vc->surface_num + 1) % NUM_OUTPUT_SURFACES;
+ vc->num_shown_frames = FFMIN(vc->num_shown_frames + 1, 1000);
+}
- if (handle_preemption() < 0)
+static int draw_slice(struct vo *vo, uint8_t *image[], int stride[], int w,
+ int h, int x, int y)
+{
+ struct vdpctx *vc = vo->priv;
+ struct vdp_functions *vdp = vc->vdp;
+ VdpStatus vdp_st;
+
+ if (handle_preemption(vo) < 0)
return VO_TRUE;
- if (!IMGFMT_IS_VDPAU(image_format))
+ struct vdpau_render_state *rndr = (struct vdpau_render_state *)image[0];
+ int max_refs = vc->image_format == IMGFMT_VDPAU_H264 ?
+ rndr->info.h264.num_ref_frames : 2;
+ if (!IMGFMT_IS_VDPAU(vc->image_format))
return VO_FALSE;
- if ((decoder == VDP_INVALID_HANDLE || decoder_max_refs < max_refs)
- && !create_vdp_decoder(image_format, vid_width, vid_height, max_refs))
+ if ((vc->decoder == VDP_INVALID_HANDLE || vc->decoder_max_refs < max_refs)
+ && !create_vdp_decoder(vo, max_refs))
return VO_FALSE;
- vdp_st = vdp_decoder_render(decoder, rndr->surface, (void *)&rndr->info, rndr->bitstream_buffers_used, rndr->bitstream_buffers);
+ vdp_st = vdp->decoder_render(vc->decoder, rndr->surface,
+ (void *)&rndr->info,
+ rndr->bitstream_buffers_used,
+ rndr->bitstream_buffers);
CHECK_ST_WARNING("Failed VDPAU decoder rendering");
return VO_TRUE;
}
-static int draw_frame(uint8_t *src[])
+static struct vdpau_render_state *get_surface(struct vo *vo, int number)
{
- return VO_ERROR;
-}
+ struct vdpctx *vc = vo->priv;
+ struct vdp_functions *vdp = vc->vdp;
-static struct vdpau_render_state *get_surface(int number)
-{
if (number > MAX_VIDEO_SURFACES)
return NULL;
- if (surface_render[number].surface == VDP_INVALID_HANDLE) {
+ if (vc->surface_render[number].surface == VDP_INVALID_HANDLE
+ && !vc->is_preempted) {
VdpStatus vdp_st;
- vdp_st = vdp_video_surface_create(vdp_device, vdp_chroma_type,
- vid_width, vid_height,
- &surface_render[number].surface);
- CHECK_ST_WARNING("Error when calling vdp_video_surface_create")
- if (vdp_st != VDP_STATUS_OK)
- return NULL;
+ vdp_st = vdp->video_surface_create(vc->vdp_device, vc->vdp_chroma_type,
+ vc->vid_width, vc->vid_height,
+ &vc->surface_render[number].surface);
+ CHECK_ST_WARNING("Error when calling vdp_video_surface_create");
}
- mp_msg(MSGT_VO, MSGL_DBG2, "VID CREATE: %u\n", surface_render[number].surface);
- return &surface_render[number];
+ mp_msg(MSGT_VO, MSGL_DBG2, "VID CREATE: %u\n",
+ vc->surface_render[number].surface);
+ return &vc->surface_render[number];
}
-static uint32_t draw_image(mp_image_t *mpi)
+static void draw_image(struct vo *vo, mp_image_t *mpi, double pts)
{
- if (IMGFMT_IS_VDPAU(image_format)) {
- struct vdpau_render_state *rndr = mpi->priv;
- vid_surface_num = rndr - surface_render;
- mpi->usage_count++;
- if (deint_mpi[1])
- deint_mpi[1]->usage_count--;
- deint_mpi[1] = deint_mpi[0];
- deint_mpi[0] = mpi;
- } else if (image_format == IMGFMT_BGRA) {
- VdpStatus vdp_st;
- VdpRect r = {0, 0, vid_width, vid_height};
- vdp_st = vdp_output_surface_put_bits_native(output_surfaces[2],
- (void const*const*)mpi->planes,
- mpi->stride, &r);
- CHECK_ST_ERROR("Error when calling vdp_output_surface_put_bits_native")
- vdp_st = vdp_output_surface_render_output_surface(output_surfaces[surface_num],
- &out_rect_vid,
- output_surfaces[2],
- &src_rect_vid, NULL, NULL,
- VDP_OUTPUT_SURFACE_RENDER_ROTATE_0);
- CHECK_ST_ERROR("Error when calling vdp_output_surface_render_output_surface")
+ struct vdpctx *vc = vo->priv;
+ struct vdp_functions *vdp = vc->vdp;
+ struct mp_image *reserved_mpi = NULL;
+ struct vdpau_render_state *rndr;
+
+ if (vc->is_preempted) {
+ vo->frame_loaded = true;
+ return;
+ }
+
+ if (IMGFMT_IS_VDPAU(vc->image_format)) {
+ rndr = mpi->priv;
+ reserved_mpi = mpi;
} else if (!(mpi->flags & MP_IMGFLAG_DRAW_CALLBACK)) {
VdpStatus vdp_st;
void *destdata[3] = {mpi->planes[0], mpi->planes[2], mpi->planes[1]};
- struct vdpau_render_state *rndr = get_surface(deint_counter);
- deint_counter = (deint_counter + 1) % 3;
- vid_surface_num = rndr - surface_render;
- if (image_format == IMGFMT_NV12)
+ rndr = get_surface(vo, vc->deint_counter);
+ vc->deint_counter = (vc->deint_counter + 1) % NUM_BUFFERED_VIDEO;
+ if (vc->image_format == IMGFMT_NV12)
destdata[1] = destdata[2];
- vdp_st = vdp_video_surface_put_bits_y_cb_cr(rndr->surface,
- vdp_pixel_format,
- (const void *const*)destdata,
- mpi->stride); // pitch
- CHECK_ST_ERROR("Error when calling vdp_video_surface_put_bits_y_cb_cr")
- }
+ vdp_st =
+ vdp->video_surface_put_bits_y_cb_cr(rndr->surface,
+ vc->vdp_pixel_format,
+ (const void *const*)destdata,
+ mpi->stride); // pitch
+ CHECK_ST_WARNING("Error when calling "
+ "vdp_video_surface_put_bits_y_cb_cr");
+ } else
+ // We don't support slice callbacks so this shouldn't occur -
+ // I think the flags test above in pointless, but I'm adding
+ // this instead of removing it just in case.
+ abort();
if (mpi->fields & MP_IMGFIELD_ORDERED)
- top_field_first = !!(mpi->fields & MP_IMGFIELD_TOP_FIRST);
+ vc->top_field_first = !!(mpi->fields & MP_IMGFIELD_TOP_FIRST);
else
- top_field_first = 1;
+ vc->top_field_first = 1;
- video_to_output_surface();
- return VO_TRUE;
+ add_new_video_surface(vo, rndr->surface, mpi, pts);
+
+ return;
}
-static uint32_t get_image(mp_image_t *mpi)
+static uint32_t get_image(struct vo *vo, mp_image_t *mpi)
{
+ struct vdpctx *vc = vo->priv;
struct vdpau_render_state *rndr;
// no dr for non-decoding for now
- if (!IMGFMT_IS_VDPAU(image_format))
+ if (!IMGFMT_IS_VDPAU(vc->image_format))
return VO_FALSE;
if (mpi->type != MP_IMGTYPE_NUMBERED)
return VO_FALSE;
- rndr = get_surface(mpi->number);
+ rndr = get_surface(vo, mpi->number);
if (!rndr) {
- mp_msg(MSGT_VO, MSGL_ERR, "[vdpau] no surfaces available in get_image\n");
+ mp_msg(MSGT_VO, MSGL_ERR, "[vdpau] no surfaces available in "
+ "get_image\n");
// TODO: this probably breaks things forever, provide a dummy buffer?
return VO_FALSE;
}
@@ -1091,329 +1500,303 @@ static uint32_t get_image(mp_image_t *mpi)
static int query_format(uint32_t format)
{
- int default_flags = VFCAP_CSP_SUPPORTED | VFCAP_CSP_SUPPORTED_BY_HW | VFCAP_HWSCALE_UP | VFCAP_HWSCALE_DOWN | VFCAP_OSD | VFCAP_EOSD | VFCAP_EOSD_UNSCALED | VFCAP_FLIP;
+ int default_flags = VFCAP_CSP_SUPPORTED | VFCAP_CSP_SUPPORTED_BY_HW
+ | VFCAP_HWSCALE_UP | VFCAP_HWSCALE_DOWN | VFCAP_OSD | VFCAP_EOSD
+ | VFCAP_EOSD_UNSCALED | VFCAP_FLIP;
switch (format) {
- case IMGFMT_BGRA:
- if (force_mixer)
- return 0;
- case IMGFMT_YV12:
- case IMGFMT_I420:
- case IMGFMT_IYUV:
- case IMGFMT_NV12:
- case IMGFMT_YUY2:
- case IMGFMT_UYVY:
- return default_flags | VOCAP_NOSLICES;
- case IMGFMT_VDPAU_MPEG1:
- case IMGFMT_VDPAU_MPEG2:
- case IMGFMT_VDPAU_H264:
- case IMGFMT_VDPAU_WMV3:
- case IMGFMT_VDPAU_VC1:
- case IMGFMT_VDPAU_MPEG4:
- if (create_vdp_decoder(format, 48, 48, 2))
+ case IMGFMT_YV12:
+ case IMGFMT_I420:
+ case IMGFMT_IYUV:
+ case IMGFMT_NV12:
+ case IMGFMT_YUY2:
+ case IMGFMT_UYVY:
+ return default_flags | VOCAP_NOSLICES;
+ case IMGFMT_VDPAU_MPEG1:
+ case IMGFMT_VDPAU_MPEG2:
+ case IMGFMT_VDPAU_H264:
+ case IMGFMT_VDPAU_WMV3:
+ case IMGFMT_VDPAU_VC1:
+ case IMGFMT_VDPAU_MPEG4:
return default_flags;
}
return 0;
}
-static void DestroyVdpauObjects(void)
+static void destroy_vdpau_objects(struct vo *vo)
{
+ struct vdpctx *vc = vo->priv;
+ struct vdp_functions *vdp = vc->vdp;
+
int i;
VdpStatus vdp_st;
- free_video_specific();
+ free_video_specific(vo);
- vdp_st = vdp_presentation_queue_destroy(vdp_flip_queue);
- CHECK_ST_WARNING("Error when calling vdp_presentation_queue_destroy")
+ if (vc->flip_queue != VDP_INVALID_HANDLE) {
+ vdp_st = vdp->presentation_queue_destroy(vc->flip_queue);
+ CHECK_ST_WARNING("Error when calling vdp_presentation_queue_destroy");
+ }
- vdp_st = vdp_presentation_queue_target_destroy(vdp_flip_target);
- CHECK_ST_WARNING("Error when calling vdp_presentation_queue_target_destroy")
+ if (vc->flip_target != VDP_INVALID_HANDLE) {
+ vdp_st = vdp->presentation_queue_target_destroy(vc->flip_target);
+ CHECK_ST_WARNING("Error when calling "
+ "vdp_presentation_queue_target_destroy");
+ }
for (i = 0; i <= NUM_OUTPUT_SURFACES; i++) {
- vdp_st = vdp_output_surface_destroy(output_surfaces[i]);
- output_surfaces[i] = VDP_INVALID_HANDLE;
- CHECK_ST_WARNING("Error when calling vdp_output_surface_destroy")
+ if (vc->output_surfaces[i] == VDP_INVALID_HANDLE)
+ continue;
+ vdp_st = vdp->output_surface_destroy(vc->output_surfaces[i]);
+ CHECK_ST_WARNING("Error when calling vdp_output_surface_destroy");
}
- for (i = 0; i<eosd_surface_count; i++) {
- if (eosd_surfaces[i].surface != VDP_INVALID_HANDLE) {
- vdp_st = vdp_bitmap_surface_destroy(eosd_surfaces[i].surface);
- CHECK_ST_WARNING("Error when calling vdp_bitmap_surface_destroy")
- }
- eosd_surfaces[i].surface = VDP_INVALID_HANDLE;
+ if (vc->eosd_surface.surface != VDP_INVALID_HANDLE) {
+ vdp_st = vdp->bitmap_surface_destroy(vc->eosd_surface.surface);
+ CHECK_ST_WARNING("Error when calling vdp_bitmap_surface_destroy");
}
- vdp_st = vdp_device_destroy(vdp_device);
- CHECK_ST_WARNING("Error when calling vdp_device_destroy")
+ vdp_st = vdp->device_destroy(vc->vdp_device);
+ CHECK_ST_WARNING("Error when calling vdp_device_destroy");
}
-static void uninit(void)
+static void uninit(struct vo *vo)
{
- int i;
-
- if (!vo_config_count)
- return;
- visible_buf = 0;
-
- for (i = 0; i < MAX_VIDEO_SURFACES; i++) {
- // Allocated in ff_vdpau_add_data_chunk()
- av_freep(&surface_render[i].bitstream_buffers);
- surface_render[i].bitstream_buffers_allocated = 0;
- }
+ struct vdpctx *vc = vo->priv;
/* Destroy all vdpau objects */
- DestroyVdpauObjects();
-
- free(index_data);
- index_data = NULL;
-
- free(eosd_surfaces);
- eosd_surfaces = NULL;
- free(eosd_targets);
- eosd_targets = NULL;
+ destroy_vdpau_objects(vo);
#ifdef CONFIG_XF86VM
- vo_vm_close();
+ if (vc->mode_switched)
+ vo_vm_close(vo);
#endif
- vo_x11_uninit();
-}
+ vo_x11_uninit(vo);
-static const opt_t subopts[] = {
- {"deint", OPT_ARG_INT, &deint, (opt_test_f)int_non_neg},
- {"chroma-deint", OPT_ARG_BOOL, &chroma_deint, NULL},
- {"pullup", OPT_ARG_BOOL, &pullup, NULL},
- {"denoise", OPT_ARG_FLOAT, &denoise, NULL},
- {"sharpen", OPT_ARG_FLOAT, &sharpen, NULL},
- {"colorspace", OPT_ARG_INT, &colorspace, NULL},
- {"force-mixer", OPT_ARG_BOOL, &force_mixer, NULL},
- {"hqscaling", OPT_ARG_INT, &hqscaling, (opt_test_f)int_non_neg},
- {NULL}
-};
+ // Free bitstream buffers allocated by FFmpeg
+ for (int i = 0; i < MAX_VIDEO_SURFACES; i++)
+ av_freep(&vc->surface_render[i].bitstream_buffers);
+}
-static const char help_msg[] =
- "\n-vo vdpau command line help:\n"
- "Example: mplayer -vo vdpau:deint=2\n"
- "\nOptions:\n"
- " deint (all modes > 0 respect -field-dominance)\n"
- " 0: no deinterlacing\n"
- " 1: only show first field\n"
- " 2: bob deinterlacing\n"
- " 3: temporal deinterlacing (resource-hungry)\n"
- " 4: temporal-spatial deinterlacing (very resource-hungry)\n"
- " chroma-deint\n"
- " Operate on luma and chroma when using temporal deinterlacing (default)\n"
- " Use nochroma-deint to speed up temporal deinterlacing\n"
- " pullup\n"
- " Try to apply inverse-telecine (needs temporal deinterlacing)\n"
- " denoise\n"
- " Apply denoising, argument is strength from 0.0 to 1.0\n"
- " sharpen\n"
- " Apply sharpening or softening, argument is strength from -1.0 to 1.0\n"
- " colorspace\n"
- " 0: guess based on video resolution\n"
- " 1: ITU-R BT.601 (default)\n"
- " 2: ITU-R BT.709\n"
- " 3: SMPTE-240M\n"
- " hqscaling\n"
- " 0: default VDPAU scaler\n"
- " 1-9: high quality VDPAU scaler (needs capable hardware)\n"
- " force-mixer\n"
- " Use the VDPAU mixer (default)\n"
- " Use noforce-mixer to allow BGRA output (disables all above options)\n"
- ;
-
-static int preinit(const char *arg)
+static int preinit(struct vo *vo, const char *arg)
{
int i;
- deint = 0;
- deint_type = 3;
- deint_counter = 0;
- deint_mpi[0] = deint_mpi[1] = NULL;
- chroma_deint = 1;
- pullup = 0;
- denoise = 0;
- sharpen = 0;
- colorspace = 1;
- force_mixer = 1;
- hqscaling = 0;
+ struct vdpctx *vc = talloc_zero(vo, struct vdpctx);
+ vo->priv = vc;
+
+ // Mark everything as invalid first so uninit() can tell what has been
+ // allocated
+ mark_vdpau_objects_uninitialized(vo);
+
+ vc->deint_type = 3;
+ vc->chroma_deint = 1;
+ vc->user_colorspace = 1;
+ vc->flip_offset_window = 50;
+ vc->flip_offset_fs = 50;
+ const opt_t subopts[] = {
+ {"deint", OPT_ARG_INT, &vc->deint, (opt_test_f)int_non_neg},
+ {"chroma-deint", OPT_ARG_BOOL, &vc->chroma_deint, NULL},
+ {"pullup", OPT_ARG_BOOL, &vc->pullup, NULL},
+ {"denoise", OPT_ARG_FLOAT, &vc->denoise, NULL},
+ {"sharpen", OPT_ARG_FLOAT, &vc->sharpen, NULL},
+ {"colorspace", OPT_ARG_INT, &vc->user_colorspace, NULL},
+ {"hqscaling", OPT_ARG_INT, &vc->hqscaling, NULL},
+ {"fps", OPT_ARG_FLOAT, &vc->user_fps, NULL},
+ {"queuetime_windowed", OPT_ARG_INT, &vc->flip_offset_window, NULL},
+ {"queuetime_fs", OPT_ARG_INT, &vc->flip_offset_fs, NULL},
+ {NULL}
+ };
if (subopt_parse(arg, subopts) != 0) {
- mp_msg(MSGT_VO, MSGL_FATAL, help_msg);
+ mp_msg(MSGT_VO, MSGL_FATAL, "[vdpau] Could not parse suboptions.\n");
return -1;
}
- if (deint)
- deint_type = deint;
- if (colorspace < 0 || colorspace > 3) {
- mp_msg(MSGT_VO, MSGL_WARN, "[vdpau] Invalid color space specified, "
- "using BT.601\n");
- colorspace = 1;
+ if (vc->hqscaling < 0 || vc->hqscaling > 9) {
+ mp_msg(MSGT_VO, MSGL_FATAL, "[vdpau] Invalid value for suboption "
+ "hqscaling\n");
+ return -1;
}
+ if (vc->deint)
+ vc->deint_type = vc->deint;
- if (!vo_init() || win_x11_init_vdpau_procs())
+ if (!vo_init(vo))
return -1;
- decoder = VDP_INVALID_HANDLE;
- for (i = 0; i < MAX_VIDEO_SURFACES; i++)
- surface_render[i].surface = VDP_INVALID_HANDLE;
- video_mixer = VDP_INVALID_HANDLE;
- for (i = 0; i <= NUM_OUTPUT_SURFACES; i++)
- output_surfaces[i] = VDP_INVALID_HANDLE;
- vdp_flip_queue = VDP_INVALID_HANDLE;
- output_surface_width = output_surface_height = -1;
+ // After this calling uninit() should work to free resources
+
+ if (win_x11_init_vdpau_procs(vo) < 0) {
+ if (vc->vdp->device_destroy)
+ vc->vdp->device_destroy(vc->vdp_device);
+ vo_x11_uninit(vo);
+ return -1;
+ }
// full grayscale palette.
for (i = 0; i < PALETTE_SIZE; ++i)
- palette[i] = (i << 16) | (i << 8) | i;
- index_data = NULL;
- index_data_size = 0;
+ vc->palette[i] = (i << 16) | (i << 8) | i;
- eosd_surface_count = eosd_render_count = 0;
- eosd_surfaces = NULL;
- eosd_targets = NULL;
-
- procamp.struct_version = VDP_PROCAMP_VERSION;
- procamp.brightness = 0.0;
- procamp.contrast = 1.0;
- procamp.saturation = 1.0;
- procamp.hue = 0.0;
+ vc->procamp.struct_version = VDP_PROCAMP_VERSION;
+ vc->procamp.brightness = 0.0;
+ vc->procamp.contrast = 1.0;
+ vc->procamp.saturation = 1.0;
+ vc->procamp.hue = 0.0;
return 0;
}
-static int get_equalizer(char *name, int *value)
+static int get_equalizer(struct vo *vo, const char *name, int *value)
{
+ struct vdpctx *vc = vo->priv;
+
if (!strcasecmp(name, "brightness"))
- *value = procamp.brightness * 100;
+ *value = vc->procamp.brightness * 100;
else if (!strcasecmp(name, "contrast"))
- *value = (procamp.contrast-1.0) * 100;
+ *value = (vc->procamp.contrast - 1.0) * 100;
else if (!strcasecmp(name, "saturation"))
- *value = (procamp.saturation-1.0) * 100;
+ *value = (vc->procamp.saturation - 1.0) * 100;
else if (!strcasecmp(name, "hue"))
- *value = procamp.hue * 100 / M_PI;
+ *value = vc->procamp.hue * 100 / M_PI;
else
return VO_NOTIMPL;
return VO_TRUE;
}
-static int set_equalizer(char *name, int value)
+static int set_equalizer(struct vo *vo, const char *name, int value)
{
+ struct vdpctx *vc = vo->priv;
+
if (!strcasecmp(name, "brightness"))
- procamp.brightness = value / 100.0;
+ vc->procamp.brightness = value / 100.0;
else if (!strcasecmp(name, "contrast"))
- procamp.contrast = value / 100.0 + 1.0;
+ vc->procamp.contrast = value / 100.0 + 1.0;
else if (!strcasecmp(name, "saturation"))
- procamp.saturation = value / 100.0 + 1.0;
+ vc->procamp.saturation = value / 100.0 + 1.0;
else if (!strcasecmp(name, "hue"))
- procamp.hue = value / 100.0 * M_PI;
+ vc->procamp.hue = value / 100.0 * M_PI;
else
return VO_NOTIMPL;
- return update_csc_matrix();
+ update_csc_matrix(vo);
+ return true;
}
-static int control(uint32_t request, void *data, ...)
+static int control(struct vo *vo, uint32_t request, void *data)
{
- if (handle_preemption() < 0)
- return VO_FALSE;
+ struct vdpctx *vc = vo->priv;
+ struct vdp_functions *vdp = vc->vdp;
+
+ handle_preemption(vo);
switch (request) {
case VOCTRL_GET_DEINTERLACE:
- *(int*)data = deint;
+ *(int*)data = vc->deint;
return VO_TRUE;
case VOCTRL_SET_DEINTERLACE:
- if (image_format == IMGFMT_BGRA)
- return VO_NOTIMPL;
- deint = *(int*)data;
- if (deint)
- deint = deint_type;
- if (deint_type > 2) {
+ vc->deint = *(int*)data;
+ if (vc->deint)
+ vc->deint = vc->deint_type;
+ if (vc->deint_type > 2) {
VdpStatus vdp_st;
VdpVideoMixerFeature features[1] =
- {deint_type == 3 ?
+ {vc->deint_type == 3 ?
VDP_VIDEO_MIXER_FEATURE_DEINTERLACE_TEMPORAL :
VDP_VIDEO_MIXER_FEATURE_DEINTERLACE_TEMPORAL_SPATIAL};
- VdpBool feature_enables[1] = {deint ? VDP_TRUE : VDP_FALSE};
- vdp_st = vdp_video_mixer_set_feature_enables(video_mixer, 1,
- features,
- feature_enables);
- CHECK_ST_WARNING("Error changing deinterlacing settings")
+ VdpBool feature_enables[1] = {vc->deint ? VDP_TRUE : VDP_FALSE};
+ vdp_st = vdp->video_mixer_set_feature_enables(vc->video_mixer,
+ 1, features,
+ feature_enables);
+ CHECK_ST_WARNING("Error changing deinterlacing settings");
}
return VO_TRUE;
case VOCTRL_PAUSE:
- return int_pause = 1;
+ if (vc->dropped_frame)
+ flip_page_timed(vo, 0, -1);
+ return (vc->paused = true);
case VOCTRL_RESUME:
- return int_pause = 0;
+ return (vc->paused = false);
case VOCTRL_QUERY_FORMAT:
return query_format(*(uint32_t *)data);
case VOCTRL_GET_IMAGE:
- return get_image(data);
+ return get_image(vo, data);
case VOCTRL_DRAW_IMAGE:
- return draw_image(data);
- case VOCTRL_GUISUPPORT:
- return VO_TRUE;
+ abort(); // draw_image() should get called directly
case VOCTRL_BORDER:
- vo_x11_border();
- resize();
+ vo_x11_border(vo);
+ resize(vo);
return VO_TRUE;
case VOCTRL_FULLSCREEN:
- vo_x11_fullscreen();
- resize();
+ vo_x11_fullscreen(vo);
+ resize(vo);
return VO_TRUE;
case VOCTRL_GET_PANSCAN:
return VO_TRUE;
case VOCTRL_SET_PANSCAN:
- resize();
+ resize(vo);
return VO_TRUE;
case VOCTRL_SET_EQUALIZER: {
- va_list ap;
- int value;
- if (image_format == IMGFMT_BGRA)
- return VO_NOTIMPL;
-
- va_start(ap, data);
- value = va_arg(ap, int);
-
- va_end(ap);
- return set_equalizer(data, value);
+ struct voctrl_set_equalizer_args *args = data;
+ return set_equalizer(vo, args->name, args->value);
}
case VOCTRL_GET_EQUALIZER: {
- va_list ap;
- int *value;
-
- va_start(ap, data);
- value = va_arg(ap, int *);
-
- va_end(ap);
- return get_equalizer(data, value);
+ struct voctrl_get_equalizer_args *args = data;
+ return get_equalizer(vo, args->name, args->valueptr);
}
+ case VOCTRL_SET_YUV_COLORSPACE:
+ vc->colorspace = *(int *)data % 3;
+ update_csc_matrix(vo);
+ return true;
+ case VOCTRL_GET_YUV_COLORSPACE:
+ *(int *)data = vc->colorspace;
+ return true;
case VOCTRL_ONTOP:
- vo_x11_ontop();
+ vo_x11_ontop(vo);
return VO_TRUE;
case VOCTRL_UPDATE_SCREENINFO:
- update_xinerama_info();
+ update_xinerama_info(vo);
return VO_TRUE;
case VOCTRL_DRAW_EOSD:
if (!data)
return VO_FALSE;
- generate_eosd(data);
- draw_eosd();
+ generate_eosd(vo, data);
+ draw_eosd(vo);
return VO_TRUE;
case VOCTRL_GET_EOSD_RES: {
mp_eosd_res_t *r = data;
- r->mt = r->mb = r->ml = r->mr = 0;
- r->srcw = vid_width; r->srch = vid_height;
- if (vo_fs) {
- r->w = vo_screenwidth;
- r->h = vo_screenheight;
- r->ml = r->mr = border_x;
- r->mt = r->mb = border_y;
- } else {
- r->w = vo_dwidth;
- r->h = vo_dheight;
- }
+ r->w = vo->dwidth;
+ r->h = vo->dheight;
+ r->ml = r->mr = vc->border_x;
+ r->mt = r->mb = vc->border_y;
return VO_TRUE;
}
+ case VOCTRL_REDRAW_OSD:
+ video_to_output_surface(vo);
+ draw_eosd(vo);
+ draw_osd(vo, data);
+ flip_page_timed(vo, 0, -1);
+ return true;
+ case VOCTRL_RESET:
+ forget_frames(vo);
+ return true;
}
return VO_NOTIMPL;
}
-/* @} */
+const struct vo_driver video_out_vdpau = {
+ .is_new = true,
+ .buffer_frames = true,
+ .info = &(const struct vo_info_s){
+ "VDPAU with X11",
+ "vdpau",
+ "Rajib Mahapatra <rmahapatra@nvidia.com> and others",
+ ""
+ },
+ .preinit = preinit,
+ .config = config,
+ .control = control,
+ .draw_image = draw_image,
+ .get_buffered_frame = get_buffered_frame,
+ .draw_slice = draw_slice,
+ .draw_osd = draw_osd,
+ .flip_page_timed = flip_page_timed,
+ .check_events = check_events,
+ .uninit = uninit,
+};
diff --git a/libvo/vo_vesa.c b/libvo/vo_vesa.c
index b7376155d2..1dd328149b 100644
--- a/libvo/vo_vesa.c
+++ b/libvo/vo_vesa.c
@@ -194,7 +194,7 @@ static inline void vbeSwitchBank(unsigned long offset)
show_err:
vesa_term();
PRINT_VBE_ERR("vbeSetWindow",err);
- mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_VESA_FatalErrorOccurred);
+ mp_tmsg(MSGT_VO,MSGL_WARN, "[VO_VESA] Fatal error occurred! Can't continue.\n");
abort();
}
win.low = new_offset * gran;
@@ -396,7 +396,7 @@ static void flip_page(void)
{
vesa_term();
PRINT_VBE_ERR("vbeSetDisplayStart",err);
- mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_VESA_FatalErrorOccurred);
+ mp_tmsg(MSGT_VO,MSGL_WARN, "[VO_VESA] Fatal error occurred! Can't continue.\n");
abort();
}
multi_idx = multi_idx ? 0 : 1;
@@ -462,7 +462,7 @@ static uint32_t parseSubDevice(const char *sd)
else
if(memcmp(sd,"vidix",5) == 0) vidix_name = &sd[5]; /* vidix_name will be valid within init() */
#endif
- else { mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_VESA_UnknownSubdevice, sd); return 0xFFFFFFFFUL; }
+ else { mp_tmsg(MSGT_VO,MSGL_WARN, "[VO_VESA] unknown subdevice: '%s'.\n", sd); return 0xFFFFFFFFUL; }
return flags;
}
@@ -550,7 +550,7 @@ unsigned fillMultiBuffer( unsigned long vsize, unsigned nbuffs )
total = min(total,nbuffs);
while(i < total) { multi_buff[i++] = offset; offset += screen_size; }
if(!i)
- mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_VESA_YouHaveTooLittleVideoMemory, screen_size, vsize);
+ mp_tmsg(MSGT_VO,MSGL_WARN, "[VO_VESA] You have too little video memory for this mode:\n[VO_VESA] Required: %08lX present: %08lX.\n", screen_size, vsize);
return i;
}
@@ -569,7 +569,7 @@ static int set_refresh(unsigned x, unsigned y, unsigned mode,struct VesaCRTCInfo
monitor_dotclock = str2range(monitor_dotclock_str);
if (!monitor_hfreq || !monitor_vfreq || !monitor_dotclock) {
- mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_VESA_YouHaveToSpecifyTheCapabilitiesOfTheMonitor);
+ mp_tmsg(MSGT_VO,MSGL_WARN, "[VO_VESA] You have to specify the capabilities of the monitor. Not changing refresh rate.\n");
return 0;
}
@@ -606,7 +606,7 @@ static int set_refresh(unsigned x, unsigned y, unsigned mode,struct VesaCRTCInfo
if (!in_range(monitor_vfreq,crtc_pass->RefreshRate/100)||
!in_range(monitor_hfreq,H_freq*1000)) {
- mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_VESA_UnableToFitTheMode);
+ mp_tmsg(MSGT_VO,MSGL_WARN, "[VO_VESA] The mode does not fit the monitor limits. Not changing refresh rate.\n");
return 0;
}
@@ -637,13 +637,13 @@ config(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uin
fs_mode = 0;
if(subdev_flags == 0xFFFFFFFEUL)
{
- mp_msg(MSGT_VO,MSGL_ERR, MSGTR_LIBVO_VESA_DetectedInternalFatalError);
+ mp_tmsg(MSGT_VO,MSGL_ERR, "[VO_VESA] Detected internal fatal error: init is called before preinit.\n");
return -1;
}
if(subdev_flags == 0xFFFFFFFFUL) return -1;
if(flags & VOFLAG_FLIPPING)
{
- mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_VESA_SwitchFlipIsNotSupported);
+ mp_tmsg(MSGT_VO,MSGL_WARN, "[VO_VESA] The -flip option is not supported.\n");
}
if(flags & VOFLAG_SWSCALE) use_scaler = 1;
if(flags & VOFLAG_FULLSCREEN)
@@ -656,30 +656,32 @@ config(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uin
if(!vib_set && (err=vbeGetControllerInfo(&vib)) != VBE_OK)
{
PRINT_VBE_ERR("vbeGetControllerInfo",err);
- mp_msg(MSGT_VO,MSGL_ERR, MSGTR_LIBVO_VESA_PossibleReasonNoVbe2BiosFound);
+ mp_tmsg(MSGT_VO,MSGL_ERR, "[VO_VESA] Possible reason: No VBE2 BIOS found.\n");
return -1;
}
vib_set = 1;
/* Print general info here */
- mp_msg(MSGT_VO,MSGL_INFO, MSGTR_LIBVO_VESA_FoundVesaVbeBiosVersion,
+ mp_tmsg(MSGT_VO,MSGL_INFO, "[VO_VESA] Found VESA VBE BIOS Version %x.%x Revision: %x.\n",
(int)(vib.VESAVersion >> 8) & 0xff,
(int)(vib.VESAVersion & 0xff),
(int)(vib.OemSoftwareRev & 0xffff));
- mp_msg(MSGT_VO,MSGL_INFO, MSGTR_LIBVO_VESA_VideoMemory,vib.TotalMemory*64);
- mp_msg(MSGT_VO,MSGL_INFO, MSGTR_LIBVO_VESA_Capabilites
+ mp_tmsg(MSGT_VO,MSGL_INFO, "[VO_VESA] Video memory: %u Kb.\n",vib.TotalMemory*64);
+ mp_tmsg(MSGT_VO,MSGL_INFO, "[VO_VESA] VESA Capabilities: %s %s %s %s %s.\n"
,vib.Capabilities & VBE_DAC_8BIT ? "8-bit DAC," : "6-bit DAC,"
,vib.Capabilities & VBE_NONVGA_CRTC ? "non-VGA CRTC,":"VGA CRTC,"
,vib.Capabilities & VBE_SNOWED_RAMDAC ? "snowed RAMDAC,":"normal RAMDAC,"
,vib.Capabilities & VBE_STEREOSCOPIC ? "stereoscopic,":"no stereoscopic,"
,vib.Capabilities & VBE_STEREO_EVC ? "Stereo EVC":"no stereo");
- mp_msg(MSGT_VO,MSGL_INFO, MSGTR_LIBVO_VESA_BelowWillBePrintedOemInfo);
- mp_msg(MSGT_VO,MSGL_INFO, MSGTR_LIBVO_VESA_YouShouldSee5OemRelatedLines);
- mp_msg(MSGT_VO,MSGL_INFO, MSGTR_LIBVO_VESA_OemInfo,vib.OemStringPtr);
- mp_msg(MSGT_VO,MSGL_INFO, MSGTR_LIBVO_VESA_OemRevision,vib.OemSoftwareRev);
- mp_msg(MSGT_VO,MSGL_INFO, MSGTR_LIBVO_VESA_OemVendor,vib.OemVendorNamePtr);
- mp_msg(MSGT_VO,MSGL_INFO, MSGTR_LIBVO_VESA_OemProductName,vib.OemProductNamePtr);
- mp_msg(MSGT_VO,MSGL_INFO, MSGTR_LIBVO_VESA_OemProductRev,vib.OemProductRevPtr);
- mp_msg(MSGT_VO,MSGL_INFO, MSGTR_LIBVO_VESA_Hint);
+ mp_tmsg(MSGT_VO,MSGL_INFO, "[VO_VESA] !!! OEM info will be printed below !!!\n");
+ mp_tmsg(MSGT_VO,MSGL_INFO, "[VO_VESA] You should see 5 OEM related lines below; If not, you've broken vm86.\n");
+ mp_tmsg(MSGT_VO,MSGL_INFO, "[VO_VESA] OEM info: %s.\n",vib.OemStringPtr);
+ mp_tmsg(MSGT_VO,MSGL_INFO, "[VO_VESA] OEM Revision: %x.\n",vib.OemSoftwareRev);
+ mp_tmsg(MSGT_VO,MSGL_INFO, "[VO_VESA] OEM vendor: %s.\n",vib.OemVendorNamePtr);
+ mp_tmsg(MSGT_VO,MSGL_INFO, "[VO_VESA] OEM Product Name: %s.\n",vib.OemProductNamePtr);
+ mp_tmsg(MSGT_VO,MSGL_INFO, "[VO_VESA] OEM Product Rev: %s.\n",vib.OemProductRevPtr);
+ mp_tmsg(MSGT_VO,MSGL_INFO,
+ "[VO_VESA] Hint: For working TV-Out you should have plugged in the TV connector\n"\
+ "[VO_VESA] before booting since VESA BIOS initializes itself only during POST.\n");
/* Find best mode here */
num_modes = 0;
mode_ptr = vib.VideoModePtr;
@@ -795,7 +797,7 @@ config(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uin
return -1;
}
dstBpp = video_mode_info.BitsPerPixel;
- mp_msg(MSGT_VO,MSGL_INFO, MSGTR_LIBVO_VESA_UsingVesaMode
+ mp_tmsg(MSGT_VO,MSGL_INFO, "[VO_VESA] Using VESA mode (%u) = %x [%ux%u@%u]\n"
,best_mode_idx,video_mode,video_mode_info.XResolution
,video_mode_info.YResolution,dstBpp);
if(subdev_flags & SUBDEV_NODGA) video_mode_info.PhysBasePtr = 0;
@@ -830,7 +832,7 @@ config(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uin
sws = sws_getContextFromCmdLine(srcW,srcH,srcFourcc,dstW,dstH,dstFourcc);
if(!sws)
{
- mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_VESA_CantInitializeSwscaler);
+ mp_tmsg(MSGT_VO,MSGL_WARN, "[VO_VESA] Can't initialize software scaler.\n");
return -1;
}
else if( mp_msg_test(MSGT_VO,MSGL_V) ) {
@@ -850,7 +852,7 @@ config(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uin
vsize = vib.TotalMemory*64*1024;
lfb = vbeMapVideoBuffer(video_mode_info.PhysBasePtr,vsize);
if(lfb == NULL)
- mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_VESA_CantUseDga);
+ mp_tmsg(MSGT_VO,MSGL_WARN, "[VO_VESA] Can't use DGA. Force bank switching mode. :(\n");
else
{
video_base = win.ptr = lfb;
@@ -858,7 +860,7 @@ config(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uin
win.high = vsize;
win.idx = -1; /* HAS_DGA() is on */
video_mode |= VESA_MODE_USE_LINEAR;
- mp_msg(MSGT_VO,MSGL_INFO, MSGTR_LIBVO_VESA_UsingDga
+ mp_tmsg(MSGT_VO,MSGL_INFO, "[VO_VESA] Using DGA (physical resources: %08lXh, %08lXh)"
,video_mode_info.PhysBasePtr
,vsize);
if( mp_msg_test(MSGT_VO,MSGL_V) ) {
@@ -866,30 +868,30 @@ config(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uin
printf("\n");
if(!(multi_size = fillMultiBuffer(vsize,2))) return -1;
if(vo_doublebuffering && multi_size < 2)
- mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_VESA_CantUseDoubleBuffering);
+ mp_tmsg(MSGT_VO,MSGL_WARN, "[VO_VESA] Can't use double buffering: not enough video memory.\n");
}
}
if(win.idx == -2)
{
- mp_msg(MSGT_VO,MSGL_ERR, MSGTR_LIBVO_VESA_CantFindNeitherDga);
+ mp_tmsg(MSGT_VO,MSGL_ERR, "[VO_VESA] Can find neither DGA nor relocatable window frame.\n");
return -1;
}
if(!HAS_DGA())
{
if(subdev_flags & SUBDEV_FORCEDGA)
{
- mp_msg(MSGT_VO,MSGL_ERR, MSGTR_LIBVO_VESA_YouveForcedDga);
+ mp_tmsg(MSGT_VO,MSGL_ERR, "[VO_VESA] You've forced DGA. Exiting\n");
return -1;
}
if(!(win_seg = win.idx == 0 ? video_mode_info.WinASegment:video_mode_info.WinBSegment))
{
- mp_msg(MSGT_VO,MSGL_ERR, MSGTR_LIBVO_VESA_CantFindValidWindowAddress);
+ mp_tmsg(MSGT_VO,MSGL_ERR, "[VO_VESA] Can't find valid window address.\n");
return -1;
}
win.ptr = PhysToVirtSO(win_seg,0);
win.low = 0L;
win.high= video_mode_info.WinSize*1024;
- mp_msg(MSGT_VO,MSGL_INFO, MSGTR_LIBVO_VESA_UsingBankSwitchingMode
+ mp_tmsg(MSGT_VO,MSGL_INFO, "[VO_VESA] Using bank switching mode (physical resources: %08lXh, %08lXh).\n"
,(unsigned long)win.ptr,(unsigned long)win.high);
}
if(video_mode_info.XResolution > dstW)
@@ -919,7 +921,7 @@ config(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uin
{
if(!(dga_buffer = memalign(64,video_mode_info.XResolution*video_mode_info.YResolution*dstBpp)))
{
- mp_msg(MSGT_VO,MSGL_ERR, MSGTR_LIBVO_VESA_CantAllocateTemporaryBuffer);
+ mp_tmsg(MSGT_VO,MSGL_ERR, "[VO_VESA] Can't allocate temporary buffer.\n");
return -1;
}
if( mp_msg_test(MSGT_VO,MSGL_V) ) {
@@ -955,10 +957,10 @@ config(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uin
if (neomagic_tvout) {
err = vbeSetTV(video_mode,neomagic_tvnorm);
if (err!=0x4f) {
- mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_VESA_SorryUnsupportedMode);
+ mp_tmsg(MSGT_VO,MSGL_WARN, "[VO_VESA] Sorry, unsupported mode -- try -x 640 -zoom.\n");
}
else {
- mp_msg(MSGT_VO,MSGL_INFO, MSGTR_LIBVO_VESA_OhYouReallyHavePictureOnTv);
+ mp_tmsg(MSGT_VO,MSGL_INFO, "[VO_VESA] Oh you really have a picture on the TV!\n");
}
}
/* Now we are in video mode!!!*/
@@ -972,11 +974,11 @@ config(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uin
{
if(vlvo_init(width,height,x_offset,y_offset,dstW,dstH,format,dstBpp) != 0)
{
- mp_msg(MSGT_VO,MSGL_ERR, MSGTR_LIBVO_VESA_CantInitialozeLinuxVideoOverlay);
+ mp_tmsg(MSGT_VO,MSGL_ERR, "[VO_VESA] Can't initialize Linux Video Overlay.\n");
vesa_term();
return -1;
}
- else mp_msg(MSGT_VO,MSGL_INFO, MSGTR_LIBVO_VESA_UsingVideoOverlay,lvo_name);
+ else mp_tmsg(MSGT_VO,MSGL_INFO, "[VO_VESA] Using video overlay: %s.\n",lvo_name);
lvo_opened = 1;
}
#ifdef CONFIG_VIDIX
@@ -987,11 +989,11 @@ config(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uin
dstH,format,dstBpp,
video_mode_info.XResolution,video_mode_info.YResolution) != 0)
{
- mp_msg(MSGT_VO,MSGL_ERR, MSGTR_LIBVO_VESA_CantInitializeVidixDriver);
+ mp_tmsg(MSGT_VO,MSGL_ERR, "[VO_VESA] Can't initialize VIDIX driver.\n");
vesa_term();
return -1;
}
- else mp_msg(MSGT_VO,MSGL_INFO, MSGTR_LIBVO_VESA_UsingVidix);
+ else mp_tmsg(MSGT_VO,MSGL_INFO, "[VO_VESA] Using VIDIX.\n");
vidix_start();
/* set colorkey */
@@ -1017,12 +1019,12 @@ config(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uin
}
else
{
- mp_msg(MSGT_VO,MSGL_ERR, MSGTR_LIBVO_VESA_CantFindModeFor,width,height,bpp);
+ mp_tmsg(MSGT_VO,MSGL_ERR, "[VO_VESA] Can't find mode for: %ux%u@%u.\n",width,height,bpp);
return -1;
}
if( mp_msg_test(MSGT_VO,MSGL_V) )
{
- mp_msg(MSGT_VO,MSGL_INFO, MSGTR_LIBVO_VESA_InitializationComplete);
+ mp_tmsg(MSGT_VO,MSGL_INFO, "[VO_VESA] VESA initialization complete.\n");
fflush(stdout);
}
if(HAS_DGA() && vo_doublebuffering)
@@ -1087,7 +1089,8 @@ static int preinit(const char *arg)
if(arg) subdev_flags = parseSubDevice(arg);
if(lvo_name) pre_init_err = vlvo_preinit(lvo_name);
#ifdef CONFIG_VIDIX
- else if(vidix_name) pre_init_err = vidix_preinit(vidix_name,&video_out_vesa);
+ else if(vidix_name) pre_init_err = vidix_preinit(vidix_name,
+ video_out_vesa.old_functions);
#endif
// check if we can open /dev/mem (it will be opened later in config(), but if we
// detect now that we can't we can exit cleanly)
@@ -1101,7 +1104,7 @@ static int preinit(const char *arg)
return pre_init_err;
}
-static int control(uint32_t request, void *data, ...)
+static int control(uint32_t request, void *data)
{
switch (request) {
case VOCTRL_QUERY_FORMAT:
@@ -1109,33 +1112,8 @@ static int control(uint32_t request, void *data, ...)
}
#ifdef CONFIG_VIDIX
- if (vidix_name) {
- switch (request) {
- case VOCTRL_SET_EQUALIZER:
- {
- va_list ap;
- int value;
-
- va_start(ap, data);
- value = va_arg(ap, int);
- va_end(ap);
-
- return vidix_control(request, data, (int *)value);
- }
- case VOCTRL_GET_EQUALIZER:
- {
- va_list ap;
- int *value;
-
- va_start(ap, data);
- value = va_arg(ap, int*);
- va_end(ap);
-
- return vidix_control(request, data, value);
- }
- }
+ if (vidix_name)
return vidix_control(request, data);
- }
#endif
return VO_NOTIMPL;
diff --git a/libvo/vo_wii.c b/libvo/vo_wii.c
index 030b19dd05..8999852d80 100644
--- a/libvo/vo_wii.c
+++ b/libvo/vo_wii.c
@@ -351,7 +351,7 @@ static uint32_t get_image(mp_image_t *mpi)
return VO_TRUE;
}
-static int control(uint32_t request, void *data, ...)
+static int control(uint32_t request, void *data)
{
if (request == VOCTRL_GET_IMAGE)
return get_image(data);
diff --git a/libvo/vo_winvidix.c b/libvo/vo_winvidix.c
index ad4c5e2dd8..3c3f0419d8 100644
--- a/libvo/vo_winvidix.c
+++ b/libvo/vo_winvidix.c
@@ -57,6 +57,7 @@ LIBVO_EXTERN(winvidix)
/* VIDIX related */
static char *vidix_name;
+static int depthonscreen;
/* Image parameters */
static uint32_t image_width;
static uint32_t image_height;
@@ -129,7 +130,7 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM l
/*update vidix*/
/* FIXME: implement runtime resize/move if possible, this way is very ugly! */
vidix_stop();
- if(vidix_init(image_width, image_height, vo_dx, vo_dy, vo_dwidth, vo_dheight, image_format, vo_depthonscreen, vo_screenwidth, vo_screenheight) != 0)
+ if(vidix_init(image_width, image_height, vo_dx, vo_dy, vo_dwidth, vo_dheight, image_format, depthonscreen, vo_screenwidth, vo_screenheight) != 0)
mp_msg(MSGT_VO, MSGL_FATAL, "Can't initialize VIDIX driver: %s\n", strerror(errno));
/*set colorkey*/
vidix_start();
@@ -203,7 +204,7 @@ static int config(uint32_t width, uint32_t height, uint32_t d_width,uint32_t d_h
image_format = format;
vo_screenwidth = GetSystemMetrics(SM_CXSCREEN);
vo_screenheight = GetSystemMetrics(SM_CYSCREEN);
- vo_depthonscreen = GetDeviceCaps(GetDC(GetDesktopWindow()),BITSPIXEL);
+ depthonscreen = GetDeviceCaps(GetDC(GetDesktopWindow()),BITSPIXEL);
aspect_save_orig(width, height);
@@ -336,13 +337,13 @@ static int preinit(const char *arg){
vidix_name = NULL;
}
- if (vidix_preinit(vidix_name, &video_out_winvidix) != 0)
+ if (vidix_preinit(vidix_name, video_out_winvidix.old_functions) != 0)
return 1;
return 0;
}
-static int control(uint32_t request, void *data, ...){
+static int control(uint32_t request, void *data){
switch (request) {
case VOCTRL_FULLSCREEN:
if(!vo_fs){vo_fs=1;ShowWindow(hWndFS,SW_SHOW);SetForegroundWindow(hWndFS);}
@@ -350,28 +351,6 @@ static int control(uint32_t request, void *data, ...){
break;
case VOCTRL_QUERY_FORMAT:
return query_format(*((uint32_t*)data));
- case VOCTRL_SET_EQUALIZER:
- {
- va_list ap;
- int value;
-
- va_start(ap, data);
- value = va_arg(ap, int);
- va_end(ap);
-
- return vidix_control(request, data, (int *)value);
- }
- case VOCTRL_GET_EQUALIZER:
- {
- va_list ap;
- int *value;
-
- va_start(ap, data);
- value = va_arg(ap, int*);
- va_end(ap);
-
- return vidix_control(request, data, value);
- }
}
return vidix_control(request, data);
// return VO_NOTIMPL;
diff --git a/libvo/vo_x11.c b/libvo/vo_x11.c
index da08265760..11c563d05d 100644
--- a/libvo/vo_x11.c
+++ b/libvo/vo_x11.c
@@ -56,11 +56,6 @@ static int CompletionType = -1;
#include "mp_msg.h"
#include "help_mp.h"
-#ifdef CONFIG_GUI
-#include "gui/interface.h"
-#include "mplayer.h"
-#endif
-
static const vo_info_t info = {
"X11 ( XImage/Shm )",
"x11",
@@ -330,7 +325,6 @@ static int config(uint32_t width, uint32_t height, uint32_t d_width,
old_vo_dwidth = -1;
old_vo_dheight = -1;
- int_pause = 0;
if (!title)
title = "MPlayer X11 (XImage/Shm) render";
@@ -358,11 +352,6 @@ static int config(uint32_t width, uint32_t height, uint32_t d_width,
image_width = (width + 7) & (~7);
image_height = height;
-#ifdef CONFIG_GUI
- if (use_gui)
- guiGetEvent(guiSetShVideo, 0); // the GUI will set up / resize the window
- else
-#endif
{
#ifdef CONFIG_XF86VM
if (vm)
@@ -665,7 +654,7 @@ static int preinit(const char *arg)
return 0;
}
-static int control(uint32_t request, void *data, ...)
+static int control(uint32_t request, void *data)
{
switch (request)
{
@@ -677,33 +666,19 @@ static int control(uint32_t request, void *data, ...)
return query_format(*((uint32_t *) data));
case VOCTRL_GET_IMAGE:
return get_image(data);
- case VOCTRL_GUISUPPORT:
- return VO_TRUE;
case VOCTRL_FULLSCREEN:
vo_x11_fullscreen();
vo_x11_clearwindow(mDisplay, vo_window);
return VO_TRUE;
case VOCTRL_SET_EQUALIZER:
{
- va_list ap;
- int value;
-
- va_start(ap, data);
- value = va_arg(ap, int);
-
- va_end(ap);
- return vo_x11_set_equalizer(data, value);
+ struct voctrl_set_equalizer_args *args = data;
+ return vo_x11_set_equalizer(args->name, args->value);
}
case VOCTRL_GET_EQUALIZER:
{
- va_list ap;
- int *value;
-
- va_start(ap, data);
- value = va_arg(ap, int *);
-
- va_end(ap);
- return vo_x11_get_equalizer(data, value);
+ struct voctrl_get_equalizer_args *args = data;
+ return vo_x11_get_equalizer(args->name, args->valueptr);
}
case VOCTRL_ONTOP:
vo_x11_ontop();
diff --git a/libvo/vo_xmga.c b/libvo/vo_xmga.c
index b0d44440bb..817ce2d2e8 100644
--- a/libvo/vo_xmga.c
+++ b/libvo/vo_xmga.c
@@ -55,10 +55,6 @@ static unsigned int timer = 0;
static unsigned int timerd = 0;
#endif
-#ifdef CONFIG_GUI
-#include "gui/interface.h"
-#endif
-
static const vo_info_t info = {
"Matrox G200/G4x0/G550 overlay in X11 window (using /dev/mga_vid)",
"xmga",
@@ -181,11 +177,6 @@ static int config(uint32_t width, uint32_t height, uint32_t d_width,
initialized = 1;
-#ifdef CONFIG_GUI
- if (use_gui)
- guiGetEvent(guiSetShVideo, 0); // the GUI will set up / resize the window
- else
-#endif
{
if (flags & VOFLAG_FULLSCREEN)
aspect(&dwidth, &dheight, A_ZOOM);
@@ -205,7 +196,7 @@ static int config(uint32_t width, uint32_t height, uint32_t d_width,
flags, xWAttribs.colormap, "xmga", title);
XChangeWindowAttributes(mDisplay, vo_window, xswamask, &xWAttribs);
- } // !GUI
+ }
if ((flags & VOFLAG_FULLSCREEN) && (!WinID))
{
diff --git a/libvo/vo_xover.c b/libvo/vo_xover.c
index 06815f15cd..dd7bceadb1 100644
--- a/libvo/vo_xover.c
+++ b/libvo/vo_xover.c
@@ -48,10 +48,6 @@
#include "aspect.h"
#include "mp_msg.h"
-#ifdef CONFIG_GUI
-#include "gui/interface.h"
-#endif
-
static const vo_info_t info =
{
@@ -82,8 +78,8 @@ static uint32_t window_width, window_height;
static uint32_t drwX, drwY, drwWidth, drwHeight, drwBorderWidth,
drwDepth, drwcX, drwcY, dwidth, dheight;
-static const vo_functions_t* sub_vo = NULL;
-
+static const struct vo_old_functions *sub_vo = NULL;
+static const struct vo_info_s *sub_info;
static void set_window(int force_update)
{
@@ -224,7 +220,7 @@ static int config(uint32_t width, uint32_t height, uint32_t d_width,
mp_colorkey_t colork;
char _title[255];
- sprintf(_title,"MPlayer %s X11 Overlay",sub_vo->info->name);
+ sprintf(_title,"MPlayer %s X11 Overlay", sub_info->name);
title = _title;
panscan_init();
@@ -270,12 +266,6 @@ static int config(uint32_t width, uint32_t height, uint32_t d_width,
vo_dy += xinerama_y;
vo_dwidth=d_width; vo_dheight=d_height;
-#ifdef CONFIG_GUI
- if(use_gui) guiGetEvent( guiSetShVideo,0 ); // the GUI will set up / resize the window
- else
- {
-#endif
-
#ifdef X11_FULLSCREEN
if ( ( flags&VOFLAG_FULLSCREEN )||(flags & VOFLAG_SWSCALE) ) aspect(&d_width, &d_height, A_ZOOM);
#endif
@@ -302,10 +292,6 @@ static int config(uint32_t width, uint32_t height, uint32_t d_width,
xswa.colormap, "xvidix", title);
XChangeWindowAttributes(mDisplay, vo_window, xswamask, &xswa);
-#ifdef CONFIG_GUI
- }
-#endif
-
if ( ( !WinID )&&( flags&VOFLAG_FULLSCREEN ) ) { vo_dx=0; vo_dy=0; vo_dwidth=vo_screenwidth; vo_dheight=vo_screenheight; vo_fs=1; }
if(sub_vo->config(image_width,image_height,vo_dwidth,vo_dheight,
@@ -378,10 +364,10 @@ static void uninit(void)
sub_vo = NULL;
vo_x11_uninit();
// Restore our callbacks
- video_out_xover.draw_frame = draw_frame;
- video_out_xover.draw_slice = draw_slice;
- video_out_xover.flip_page = flip_page;
- video_out_xover.draw_osd = draw_osd;
+ video_out_xover.old_functions->draw_frame = draw_frame;
+ video_out_xover.old_functions->draw_slice = draw_slice;
+ video_out_xover.old_functions->flip_page = flip_page;
+ video_out_xover.old_functions->draw_osd = draw_osd;
}
static int preinit(const char *arg)
@@ -393,40 +379,41 @@ static int preinit(const char *arg)
return 1;
}
- for(i = 0 ; video_out_drivers[i] != NULL ; i++) {
- if(!strcmp(video_out_drivers[i]->info->short_name,arg) &&
- strcmp(video_out_drivers[i]->info->short_name,"xover"))
+ const struct vo_driver *candidate;
+ for(i = 0; (candidate = video_out_drivers[i]) != NULL; i++)
+ if (!candidate->is_new && !strcmp(candidate->info->short_name,arg) &&
+ strcmp(candidate->info->short_name,"xover"))
break;
- }
- if(!video_out_drivers[i]) {
+ if (!candidate) {
mp_msg(MSGT_VO, MSGL_ERR, "VO XOverlay: Subdriver %s not found\n", arg);
return 1;
}
- if(video_out_drivers[i]->control(VOCTRL_XOVERLAY_SUPPORT,NULL) != VO_TRUE) {
+
+ const struct vo_old_functions *functions = candidate->old_functions;
+ if (functions->control(VOCTRL_XOVERLAY_SUPPORT,NULL) != VO_TRUE) {
mp_msg(MSGT_VO, MSGL_ERR, "VO XOverlay: %s doesn't support XOverlay\n", arg);
return 1;
}
// X11 init
if (!vo_init()) return VO_FALSE;
- if(video_out_drivers[i]->preinit(NULL)) {
+ if(functions->preinit(NULL)) {
mp_msg(MSGT_VO, MSGL_ERR, "VO XOverlay: Subvo init failed\n");
return 1;
}
- sub_vo = video_out_drivers[i];
+ sub_vo = functions;
+ sub_info = candidate->info;
// Setup the sub vo callbacks
- video_out_xover.draw_frame = sub_vo->draw_frame;
- video_out_xover.draw_slice = sub_vo->draw_slice;
- video_out_xover.flip_page = sub_vo->flip_page;
- video_out_xover.draw_osd = sub_vo->draw_osd;
+ video_out_xover.old_functions->draw_frame = sub_vo->draw_frame;
+ video_out_xover.old_functions->draw_slice = sub_vo->draw_slice;
+ video_out_xover.old_functions->flip_page = sub_vo->flip_page;
+ video_out_xover.old_functions->draw_osd = sub_vo->draw_osd;
return 0;
}
-static int control(uint32_t request, void *data, ...)
+static int control(uint32_t request, void *data)
{
if(!sub_vo) return VO_ERROR;
switch (request) {
- case VOCTRL_GUISUPPORT:
- return VO_TRUE;
case VOCTRL_GET_PANSCAN:
if ( !vo_config_count || !vo_fs ) return VO_FALSE;
return VO_TRUE;
@@ -443,7 +430,6 @@ static int control(uint32_t request, void *data, ...)
}
return VO_TRUE;
default:
- // Safe atm bcs nothing use more than 1 arg
return sub_vo->control(request,data);
}
return VO_NOTIMPL;
diff --git a/libvo/vo_xv.c b/libvo/vo_xv.c
index 6f1f7b6a36..54eecd2015 100644
--- a/libvo/vo_xv.c
+++ b/libvo/vo_xv.c
@@ -37,13 +37,18 @@ Buffer allocation:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <stdint.h>
+#include <stdbool.h>
#include "config.h"
+#include "options.h"
+#include "talloc.h"
#include "mp_msg.h"
#include "help_mp.h"
#include "video_out.h"
-#include "video_out_internal.h"
-
+#include "libmpcodecs/vfcap.h"
+#include "libmpcodecs/mp_image.h"
+#include "osd.h"
#include <X11/Xlib.h>
#include <X11/Xutil.h>
@@ -58,10 +63,7 @@ Buffer allocation:
#include "subopt-helper.h"
#include "input/input.h"
-
-#ifdef CONFIG_GUI
-#include "gui/interface.h"
-#endif
+#include "mp_fifo.h"
#include "libavutil/common.h"
@@ -72,719 +74,778 @@ static const vo_info_t info = {
""
};
-const LIBVO_EXTERN(xv)
#ifdef HAVE_SHM
#include <sys/ipc.h>
#include <sys/shm.h>
#include <X11/extensions/XShm.h>
-
-static XShmSegmentInfo Shminfo[NUM_BUFFERS];
-static int Shmem_Flag;
#endif
// Note: depends on the inclusion of X11/extensions/XShm.h
#include <X11/extensions/Xv.h>
#include <X11/extensions/Xvlib.h>
-// FIXME: dynamically allocate this stuff
-static void allocate_xvimage(int);
-static unsigned int ver, rel, req, ev, err;
-static unsigned int formats, adaptors, xv_format;
-static XvAdaptorInfo *ai = NULL;
-static XvImageFormatValues *fo=NULL;
-
-static int current_buf = 0;
-static int current_ip_buf = 0;
-static int num_buffers = 1; // default
-static int visible_buf = -1; // -1 means: no buffer was drawn yet
-static XvImage *xvimage[NUM_BUFFERS];
-
-
-static uint32_t image_width;
-static uint32_t image_height;
-static uint32_t image_format;
-
-static int int_pause;
+struct xvctx {
+ XvAdaptorInfo *ai;
+ XvImageFormatValues *fo;
+ unsigned int formats, adaptors, xv_format;
+ int current_buf;
+ int current_ip_buf;
+ int num_buffers;
+ int total_buffers;
+ int have_visible_image_copy;
+ int have_next_image_copy;
+ int unchanged_visible_image;
+ int unchanged_next_image;
+ int visible_buf;
+ XvImage *xvimage[NUM_BUFFERS + 1];
+ uint32_t image_width;
+ uint32_t image_height;
+ uint32_t image_format;
+ int is_paused;
+ struct vo_rect src_rect;
+ struct vo_rect dst_rect;
+ uint32_t max_width, max_height; // zero means: not set
+ int event_fd_registered; // for uninit called from preinit
+ int mode_switched;
+ int osd_objects_drawn;
+ void (*draw_alpha_fnc)(void *ctx, int x0, int y0, int w, int h,
+ unsigned char *src, unsigned char *srca,
+ int stride);
+#ifdef HAVE_SHM
+ XShmSegmentInfo Shminfo[NUM_BUFFERS + 1];
+ int Shmem_Flag;
+#endif
+};
-static struct vo_rect src_rect;
-static struct vo_rect dst_rect;
-static uint32_t max_width = 0, max_height = 0; // zero means: not set
+static void allocate_xvimage(struct vo *, int);
-static void (*draw_alpha_fnc) (int x0, int y0, int w, int h,
- unsigned char *src, unsigned char *srca,
- int stride);
-static void draw_alpha_yv12(int x0, int y0, int w, int h,
+static void draw_alpha_yv12(void *p, int x0, int y0, int w, int h,
unsigned char *src, unsigned char *srca,
int stride)
{
- x0 += image_width * (vo_panscan_x >> 1) / (vo_dwidth + vo_panscan_x);
+ struct vo *vo = p;
+ struct xvctx *ctx = vo->priv;
+ x0 += ctx->image_width * (vo->panscan_x >> 1)
+ / (vo->dwidth + vo->panscan_x);
vo_draw_alpha_yv12(w, h, src, srca, stride,
- xvimage[current_buf]->data +
- xvimage[current_buf]->offsets[0] +
- xvimage[current_buf]->pitches[0] * y0 + x0,
- xvimage[current_buf]->pitches[0]);
+ ctx->xvimage[ctx->current_buf]->data +
+ ctx->xvimage[ctx->current_buf]->offsets[0] +
+ ctx->xvimage[ctx->current_buf]->pitches[0] * y0 + x0,
+ ctx->xvimage[ctx->current_buf]->pitches[0]);
+ ctx->osd_objects_drawn++;
}
-static void draw_alpha_yuy2(int x0, int y0, int w, int h,
+static void draw_alpha_yuy2(void *p, int x0, int y0, int w, int h,
unsigned char *src, unsigned char *srca,
int stride)
{
- x0 += image_width * (vo_panscan_x >> 1) / (vo_dwidth + vo_panscan_x);
+ struct vo *vo = p;
+ struct xvctx *ctx = vo->priv;
+ x0 += ctx->image_width * (vo->panscan_x >> 1)
+ / (vo->dwidth + vo->panscan_x);
vo_draw_alpha_yuy2(w, h, src, srca, stride,
- xvimage[current_buf]->data +
- xvimage[current_buf]->offsets[0] +
- xvimage[current_buf]->pitches[0] * y0 + 2 * x0,
- xvimage[current_buf]->pitches[0]);
+ ctx->xvimage[ctx->current_buf]->data +
+ ctx->xvimage[ctx->current_buf]->offsets[0] +
+ ctx->xvimage[ctx->current_buf]->pitches[0] * y0 + 2 * x0,
+ ctx->xvimage[ctx->current_buf]->pitches[0]);
+ ctx->osd_objects_drawn++;
}
-static void draw_alpha_uyvy(int x0, int y0, int w, int h,
+static void draw_alpha_uyvy(void *p, int x0, int y0, int w, int h,
unsigned char *src, unsigned char *srca,
int stride)
{
- x0 += image_width * (vo_panscan_x >> 1) / (vo_dwidth + vo_panscan_x);
+ struct vo *vo = p;
+ struct xvctx *ctx = vo->priv;
+ x0 += ctx->image_width * (vo->panscan_x >> 1)
+ / (vo->dwidth + vo->panscan_x);
vo_draw_alpha_yuy2(w, h, src, srca, stride,
- xvimage[current_buf]->data +
- xvimage[current_buf]->offsets[0] +
- xvimage[current_buf]->pitches[0] * y0 + 2 * x0 + 1,
- xvimage[current_buf]->pitches[0]);
+ ctx->xvimage[ctx->current_buf]->data +
+ ctx->xvimage[ctx->current_buf]->offsets[0] +
+ ctx->xvimage[ctx->current_buf]->pitches[0] * y0 + 2 * x0 + 1,
+ ctx->xvimage[ctx->current_buf]->pitches[0]);
+ ctx->osd_objects_drawn++;
}
-static void draw_alpha_null(int x0, int y0, int w, int h,
+static void draw_alpha_null(void *p, int x0, int y0, int w, int h,
unsigned char *src, unsigned char *srca,
int stride)
{
}
-static void deallocate_xvimage(int foo);
+static void deallocate_xvimage(struct vo *vo, int foo);
-static void resize(void)
+static void resize(struct vo *vo)
{
- calc_src_dst_rects(image_width, image_height, &src_rect, &dst_rect, NULL, NULL);
- vo_x11_clearwindow_part(mDisplay, vo_window, dst_rect.width, dst_rect.height, 1);
- vo_xv_draw_colorkey(dst_rect.left, dst_rect.top, dst_rect.width, dst_rect.height);
+ struct xvctx *ctx = vo->priv;
+
+ calc_src_dst_rects(vo, ctx->image_width, ctx->image_height, &ctx->src_rect,
+ &ctx->dst_rect, NULL, NULL);
+ struct vo_rect *dst = &ctx->dst_rect;
+ vo_x11_clearwindow_part(vo, vo->x11->window, dst->width, dst->height, 1);
+ vo_xv_draw_colorkey(vo, dst->left, dst->top, dst->width, dst->height);
}
/*
* connect to server, create and map window,
* allocate colors and (shared) memory
*/
-static int config(uint32_t width, uint32_t height, uint32_t d_width,
- uint32_t d_height, uint32_t flags, char *title,
- uint32_t format)
+static int config(struct vo *vo, uint32_t width, uint32_t height,
+ uint32_t d_width, uint32_t d_height, uint32_t flags,
+ char *title, uint32_t format)
{
+ struct vo_x11_state *x11 = vo->x11;
XVisualInfo vinfo;
XSetWindowAttributes xswa;
XWindowAttributes attribs;
unsigned long xswamask;
int depth;
+ struct xvctx *ctx = vo->priv;
+ int i;
-#ifdef CONFIG_XF86VM
- int vm = flags & VOFLAG_MODESWITCHING;
-#endif
-
- image_height = height;
- image_width = width;
- image_format = format;
+ ctx->image_height = height;
+ ctx->image_width = width;
+ ctx->image_format = format;
- if ((max_width != 0 && max_height != 0) &&
- (image_width > max_width || image_height > max_height))
- {
- mp_msg( MSGT_VO, MSGL_ERR, MSGTR_VO_XV_ImagedimTooHigh,
- image_width, image_height, max_width, max_height);
+ if ((ctx->max_width != 0 && ctx->max_height != 0)
+ && (ctx->image_width > ctx->max_width
+ || ctx->image_height > ctx->max_height)) {
+ mp_tmsg(MSGT_VO, MSGL_ERR, "Source image dimensions are too high: %ux%u (maximum is %ux%u)\n",
+ ctx->image_width, ctx->image_height, ctx->max_width,
+ ctx->max_height);
return -1;
}
- int_pause = 0;
- visible_buf = -1;
-
- num_buffers =
- vo_doublebuffering ? (vo_directrendering ? NUM_BUFFERS : 2) : 1;
+ ctx->visible_buf = -1;
+ ctx->have_visible_image_copy = false;
+ ctx->have_next_image_copy = false;
/* check image formats */
- {
- unsigned int i;
-
- xv_format = 0;
- for (i = 0; i < formats; i++)
- {
- mp_msg(MSGT_VO, MSGL_V,
- "Xvideo image format: 0x%x (%4.4s) %s\n", fo[i].id,
- (char *) &fo[i].id,
- (fo[i].format == XvPacked) ? "packed" : "planar");
- if (fo[i].id == format)
- xv_format = fo[i].id;
- }
- if (!xv_format)
- return -1;
+ ctx->xv_format = 0;
+ for (i = 0; i < ctx->formats; i++) {
+ mp_msg(MSGT_VO, MSGL_V, "Xvideo image format: 0x%x (%4.4s) %s\n",
+ ctx->fo[i].id, (char *) &ctx->fo[i].id,
+ (ctx->fo[i].format == XvPacked) ? "packed" : "planar");
+ if (ctx->fo[i].id == format)
+ ctx->xv_format = ctx->fo[i].id;
}
+ if (!ctx->xv_format)
+ return -1;
-#ifdef CONFIG_GUI
- if (use_gui)
- guiGetEvent(guiSetShVideo, 0); // the GUI will set up / resize the window
- else
-#endif
{
#ifdef CONFIG_XF86VM
- if (vm)
- {
- vo_vm_switch();
+ int vm = flags & VOFLAG_MODESWITCHING;
+ if (vm) {
+ vo_vm_switch(vo);
+ ctx->mode_switched = 1;
}
#endif
- XGetWindowAttributes(mDisplay, DefaultRootWindow(mDisplay),
+ XGetWindowAttributes(x11->display, DefaultRootWindow(x11->display),
&attribs);
depth = attribs.depth;
if (depth != 15 && depth != 16 && depth != 24 && depth != 32)
depth = 24;
- XMatchVisualInfo(mDisplay, mScreen, depth, TrueColor, &vinfo);
+ XMatchVisualInfo(x11->display, x11->screen, depth, TrueColor, &vinfo);
xswa.background_pixel = 0;
- if (xv_ck_info.method == CK_METHOD_BACKGROUND)
- {
- xswa.background_pixel = xv_colorkey;
- }
+ if (x11->xv_ck_info.method == CK_METHOD_BACKGROUND)
+ xswa.background_pixel = x11->xv_colorkey;
xswa.border_pixel = 0;
xswamask = CWBackPixel | CWBorderPixel;
- vo_x11_create_vo_window(&vinfo, vo_dx, vo_dy, vo_dwidth, vo_dheight,
- flags, CopyFromParent, "xv", title);
- XChangeWindowAttributes(mDisplay, vo_window, xswamask, &xswa);
+ vo_x11_create_vo_window(vo, &vinfo, vo->dx, vo->dy, vo->dwidth,
+ vo->dheight, flags, CopyFromParent, "xv",
+ title);
+ XChangeWindowAttributes(x11->display, x11->window, xswamask, &xswa);
#ifdef CONFIG_XF86VM
- if (vm)
- {
+ if (vm) {
/* Grab the mouse pointer in our window */
if (vo_grabpointer)
- XGrabPointer(mDisplay, vo_window, True, 0,
- GrabModeAsync, GrabModeAsync,
- vo_window, None, CurrentTime);
- XSetInputFocus(mDisplay, vo_window, RevertToNone, CurrentTime);
+ XGrabPointer(x11->display, x11->window, True, 0, GrabModeAsync,
+ GrabModeAsync, x11->window, None, CurrentTime);
+ XSetInputFocus(x11->display, x11->window, RevertToNone,
+ CurrentTime);
}
#endif
}
mp_msg(MSGT_VO, MSGL_V, "using Xvideo port %d for hw scaling\n",
- xv_port);
-
- switch (xv_format)
- {
- case IMGFMT_YV12:
- case IMGFMT_I420:
- case IMGFMT_IYUV:
- draw_alpha_fnc = draw_alpha_yv12;
- break;
- case IMGFMT_YUY2:
- case IMGFMT_YVYU:
- draw_alpha_fnc = draw_alpha_yuy2;
- break;
- case IMGFMT_UYVY:
- draw_alpha_fnc = draw_alpha_uyvy;
- break;
- default:
- draw_alpha_fnc = draw_alpha_null;
+ x11->xv_port);
+
+ switch (ctx->xv_format) {
+ case IMGFMT_YV12:
+ case IMGFMT_I420:
+ case IMGFMT_IYUV:
+ ctx->draw_alpha_fnc = draw_alpha_yv12;
+ break;
+ case IMGFMT_YUY2:
+ case IMGFMT_YVYU:
+ ctx->draw_alpha_fnc = draw_alpha_yuy2;
+ break;
+ case IMGFMT_UYVY:
+ ctx->draw_alpha_fnc = draw_alpha_uyvy;
+ break;
+ default:
+ ctx->draw_alpha_fnc = draw_alpha_null;
}
- if (vo_config_count)
- for (current_buf = 0; current_buf < num_buffers; ++current_buf)
- deallocate_xvimage(current_buf);
+ // In case config has been called before
+ for (i = 0; i < ctx->total_buffers; i++)
+ deallocate_xvimage(vo, i);
+
+ ctx->num_buffers =
+ vo_doublebuffering ? (vo_directrendering ? NUM_BUFFERS : 2) : 1;
+ ctx->total_buffers = ctx->num_buffers + 1;
+
+ for (i = 0; i < ctx->total_buffers; i++)
+ allocate_xvimage(vo, i);
- for (current_buf = 0; current_buf < num_buffers; ++current_buf)
- allocate_xvimage(current_buf);
+ ctx->current_buf = 0;
+ ctx->current_ip_buf = 0;
- current_buf = 0;
- current_ip_buf = 0;
- resize();
+ resize(vo);
return 0;
}
-static void allocate_xvimage(int foo)
+static void allocate_xvimage(struct vo *vo, int foo)
{
+ struct xvctx *ctx = vo->priv;
+ struct vo_x11_state *x11 = vo->x11;
/*
* allocate XvImages. FIXME: no error checking, without
* mit-shm this will bomb... trzing to fix ::atmos
*/
#ifdef HAVE_SHM
- if (mLocalDisplay && XShmQueryExtension(mDisplay))
- Shmem_Flag = 1;
- else
- {
- Shmem_Flag = 0;
- mp_msg(MSGT_VO, MSGL_INFO,
- MSGTR_LIBVO_XV_SharedMemoryNotSupported);
+ if (x11->display_is_local && XShmQueryExtension(x11->display))
+ ctx->Shmem_Flag = 1;
+ else {
+ ctx->Shmem_Flag = 0;
+ mp_tmsg(MSGT_VO, MSGL_INFO, "[VO_XV] Shared memory not supported\nReverting to normal Xv.\n");
}
- if (Shmem_Flag)
- {
- xvimage[foo] =
- (XvImage *) XvShmCreateImage(mDisplay, xv_port, xv_format,
- NULL, image_width, image_height,
- &Shminfo[foo]);
-
- Shminfo[foo].shmid =
- shmget(IPC_PRIVATE, xvimage[foo]->data_size, IPC_CREAT | 0777);
- Shminfo[foo].shmaddr = (char *) shmat(Shminfo[foo].shmid, 0, 0);
- Shminfo[foo].readOnly = False;
-
- xvimage[foo]->data = Shminfo[foo].shmaddr;
- XShmAttach(mDisplay, &Shminfo[foo]);
- XSync(mDisplay, False);
- shmctl(Shminfo[foo].shmid, IPC_RMID, 0);
+ if (ctx->Shmem_Flag) {
+ ctx->xvimage[foo] =
+ (XvImage *) XvShmCreateImage(x11->display, x11->xv_port,
+ ctx->xv_format, NULL,
+ ctx->image_width, ctx->image_height,
+ &ctx->Shminfo[foo]);
+
+ ctx->Shminfo[foo].shmid = shmget(IPC_PRIVATE,
+ ctx->xvimage[foo]->data_size,
+ IPC_CREAT | 0777);
+ ctx->Shminfo[foo].shmaddr = (char *) shmat(ctx->Shminfo[foo].shmid, 0,
+ 0);
+ ctx->Shminfo[foo].readOnly = False;
+
+ ctx->xvimage[foo]->data = ctx->Shminfo[foo].shmaddr;
+ XShmAttach(x11->display, &ctx->Shminfo[foo]);
+ XSync(x11->display, False);
+ shmctl(ctx->Shminfo[foo].shmid, IPC_RMID, 0);
} else
#endif
{
- xvimage[foo] =
- (XvImage *) XvCreateImage(mDisplay, xv_port, xv_format, NULL,
- image_width, image_height);
- xvimage[foo]->data = malloc(xvimage[foo]->data_size);
- XSync(mDisplay, False);
+ ctx->xvimage[foo] =
+ (XvImage *) XvCreateImage(x11->display, x11->xv_port,
+ ctx->xv_format, NULL, ctx->image_width,
+ ctx->image_height);
+ ctx->xvimage[foo]->data = malloc(ctx->xvimage[foo]->data_size);
+ XSync(x11->display, False);
}
- memset(xvimage[foo]->data, 128, xvimage[foo]->data_size);
+ memset(ctx->xvimage[foo]->data, 128, ctx->xvimage[foo]->data_size);
return;
}
-static void deallocate_xvimage(int foo)
+static void deallocate_xvimage(struct vo *vo, int foo)
{
+ struct xvctx *ctx = vo->priv;
#ifdef HAVE_SHM
- if (Shmem_Flag)
- {
- XShmDetach(mDisplay, &Shminfo[foo]);
- shmdt(Shminfo[foo].shmaddr);
+ if (ctx->Shmem_Flag) {
+ XShmDetach(vo->x11->display, &ctx->Shminfo[foo]);
+ shmdt(ctx->Shminfo[foo].shmaddr);
} else
#endif
{
- free(xvimage[foo]->data);
+ free(ctx->xvimage[foo]->data);
}
- XFree(xvimage[foo]);
+ XFree(ctx->xvimage[foo]);
- XSync(mDisplay, False);
+ XSync(vo->x11->display, False);
return;
}
-static inline void put_xvimage( XvImage * xvi )
+static inline void put_xvimage(struct vo *vo, XvImage *xvi)
{
+ struct xvctx *ctx = vo->priv;
+ struct vo_x11_state *x11 = vo->x11;
+ struct vo_rect *src = &ctx->src_rect;
+ struct vo_rect *dst = &ctx->dst_rect;
#ifdef HAVE_SHM
- if (Shmem_Flag)
- {
- XvShmPutImage(mDisplay, xv_port, vo_window, vo_gc,
- xvi,
- src_rect.left, src_rect.top, src_rect.width, src_rect.height,
- dst_rect.left, dst_rect.top, dst_rect.width, dst_rect.height,
+ if (ctx->Shmem_Flag) {
+ XvShmPutImage(x11->display, x11->xv_port, x11->window, x11->vo_gc, xvi,
+ src->left, src->top, src->width, src->height,
+ dst->left, dst->top, dst->width, dst->height,
False);
} else
#endif
{
- XvPutImage(mDisplay, xv_port, vo_window, vo_gc,
- xvi,
- src_rect.left, src_rect.top, src_rect.width, src_rect.height,
- dst_rect.left, dst_rect.top, dst_rect.width, dst_rect.height);
+ XvPutImage(x11->display, x11->xv_port, x11->window, x11->vo_gc, xvi,
+ src->left, src->top, src->width, src->height,
+ dst->left, dst->top, dst->width, dst->height);
}
}
-static void check_events(void)
+// Only copies luma for planar formats as draw_alpha doesn't change others */
+static void copy_backup_image(struct vo *vo, int dest, int src)
{
- int e = vo_x11_check_events(mDisplay);
+ struct xvctx *ctx = vo->priv;
+
+ XvImage *vb = ctx->xvimage[dest];
+ XvImage *cp = ctx->xvimage[src];
+ memcpy_pic(vb->data + vb->offsets[0], cp->data + cp->offsets[0],
+ vb->width, vb->height,
+ vb->pitches[0], cp->pitches[0]);
+}
+
+static void check_events(struct vo *vo)
+{
+ struct xvctx *ctx = vo->priv;
+ int e = vo_x11_check_events(vo);
if (e & VO_EVENT_EXPOSE || e & VO_EVENT_RESIZE)
- {
- resize();
- }
+ resize(vo);
- if ((e & VO_EVENT_EXPOSE || e & VO_EVENT_RESIZE) && int_pause)
- {
+ if ((e & VO_EVENT_EXPOSE || e & VO_EVENT_RESIZE) && ctx->is_paused) {
/* did we already draw a buffer */
- if ( visible_buf != -1 )
- {
- /* redraw the last visible buffer */
- put_xvimage( xvimage[visible_buf] );
+ if (ctx->visible_buf != -1) {
+ /* redraw the last visible buffer */
+ put_xvimage(vo, ctx->xvimage[ctx->visible_buf]);
}
}
}
-static void draw_osd(void)
+static void draw_osd(struct vo *vo, struct osd_state *osd)
{
- vo_draw_text(image_width -
- image_width * vo_panscan_x / (vo_dwidth + vo_panscan_x),
- image_height, draw_alpha_fnc);
+ struct xvctx *ctx = vo->priv;
+
+ ctx->osd_objects_drawn = 0;
+ osd_draw_text(osd,
+ ctx->image_width -
+ ctx->image_width * vo->panscan_x / (vo->dwidth +
+ vo->panscan_x),
+ ctx->image_height, ctx->draw_alpha_fnc, vo);
+ if (ctx->osd_objects_drawn)
+ ctx->unchanged_next_image = false;
}
-static void flip_page(void)
+static int redraw_osd(struct vo *vo, struct osd_state *osd)
{
- put_xvimage( xvimage[current_buf] );
+ struct xvctx *ctx = vo->priv;
+
+ if (ctx->have_visible_image_copy)
+ copy_backup_image(vo, ctx->visible_buf, ctx->num_buffers);
+ else if (ctx->unchanged_visible_image) {
+ copy_backup_image(vo, ctx->num_buffers, ctx->visible_buf);
+ ctx->have_visible_image_copy = true;
+ }
+ else
+ return false;
+ int temp = ctx->current_buf;
+ ctx->current_buf = ctx->visible_buf;
+ draw_osd(vo, osd);
+ ctx->current_buf = temp;
+ put_xvimage(vo, ctx->xvimage[ctx->visible_buf]);
+ return true;
+}
+
+static void flip_page(struct vo *vo)
+{
+ struct xvctx *ctx = vo->priv;
+ put_xvimage(vo, ctx->xvimage[ctx->current_buf]);
/* remember the currently visible buffer */
- visible_buf = current_buf;
+ ctx->visible_buf = ctx->current_buf;
- if (num_buffers > 1)
- {
- current_buf =
- vo_directrendering ? 0 : ((current_buf + 1) % num_buffers);
- XFlush(mDisplay);
+ ctx->have_visible_image_copy = ctx->have_next_image_copy;
+ ctx->have_next_image_copy = false;
+ ctx->unchanged_visible_image = ctx->unchanged_next_image;
+ ctx->unchanged_next_image = false;
+
+ if (ctx->num_buffers > 1) {
+ ctx->current_buf = vo_directrendering ? 0 : ((ctx->current_buf + 1) %
+ ctx->num_buffers);
+ XFlush(vo->x11->display);
} else
- XSync(mDisplay, False);
+ XSync(vo->x11->display, False);
return;
}
-static int draw_slice(uint8_t * image[], int stride[], int w, int h,
- int x, int y)
+static int draw_slice(struct vo *vo, uint8_t *image[], int stride[], int w,
+ int h, int x, int y)
{
+ struct xvctx *ctx = vo->priv;
uint8_t *dst;
+ XvImage *current_image = ctx->xvimage[ctx->current_buf];
- dst = xvimage[current_buf]->data + xvimage[current_buf]->offsets[0] +
- xvimage[current_buf]->pitches[0] * y + x;
- memcpy_pic(dst, image[0], w, h, xvimage[current_buf]->pitches[0],
- stride[0]);
+ dst = current_image->data + current_image->offsets[0]
+ + current_image->pitches[0] * y + x;
+ memcpy_pic(dst, image[0], w, h, current_image->pitches[0], stride[0]);
x /= 2;
y /= 2;
w /= 2;
h /= 2;
- dst = xvimage[current_buf]->data + xvimage[current_buf]->offsets[1] +
- xvimage[current_buf]->pitches[1] * y + x;
- if (image_format != IMGFMT_YV12)
- memcpy_pic(dst, image[1], w, h, xvimage[current_buf]->pitches[1],
- stride[1]);
+ dst = current_image->data + current_image->offsets[1]
+ + current_image->pitches[1] * y + x;
+ if (ctx->image_format != IMGFMT_YV12)
+ memcpy_pic(dst, image[1], w, h, current_image->pitches[1], stride[1]);
else
- memcpy_pic(dst, image[2], w, h, xvimage[current_buf]->pitches[1],
- stride[2]);
-
- dst = xvimage[current_buf]->data + xvimage[current_buf]->offsets[2] +
- xvimage[current_buf]->pitches[2] * y + x;
- if (image_format == IMGFMT_YV12)
- memcpy_pic(dst, image[1], w, h, xvimage[current_buf]->pitches[1],
- stride[1]);
+ memcpy_pic(dst, image[2], w, h, current_image->pitches[1], stride[2]);
+
+ dst = current_image->data + current_image->offsets[2]
+ + current_image->pitches[2] * y + x;
+ if (ctx->image_format == IMGFMT_YV12)
+ memcpy_pic(dst, image[1], w, h, current_image->pitches[1], stride[1]);
else
- memcpy_pic(dst, image[2], w, h, xvimage[current_buf]->pitches[1],
- stride[2]);
+ memcpy_pic(dst, image[2], w, h, current_image->pitches[1], stride[2]);
return 0;
}
-static int draw_frame(uint8_t * src[])
+static uint32_t draw_image(struct vo *vo, mp_image_t *mpi)
{
- return VO_ERROR;
-}
+ struct xvctx *ctx = vo->priv;
+
+ ctx->have_next_image_copy = false;
-static uint32_t draw_image(mp_image_t * mpi)
-{
if (mpi->flags & MP_IMGFLAG_DIRECT)
- {
// direct rendering:
- current_buf = (int) (mpi->priv); // hack!
- return VO_TRUE;
- }
- if (mpi->flags & MP_IMGFLAG_DRAW_CALLBACK)
- return VO_TRUE; // done
- if (mpi->flags & MP_IMGFLAG_PLANAR)
- {
- draw_slice(mpi->planes, mpi->stride, mpi->w, mpi->h, 0, 0);
- return VO_TRUE;
- }
- if (mpi->flags & MP_IMGFLAG_YUV)
- {
+ ctx->current_buf = (int) (mpi->priv); // hack!
+ else if (mpi->flags & MP_IMGFLAG_DRAW_CALLBACK)
+ ; // done
+ else if (mpi->flags & MP_IMGFLAG_PLANAR)
+ draw_slice(vo, mpi->planes, mpi->stride, mpi->w, mpi->h, 0, 0);
+ else if (mpi->flags & MP_IMGFLAG_YUV)
// packed YUV:
- memcpy_pic(xvimage[current_buf]->data +
- xvimage[current_buf]->offsets[0], mpi->planes[0],
+ memcpy_pic(ctx->xvimage[ctx->current_buf]->data +
+ ctx->xvimage[ctx->current_buf]->offsets[0], mpi->planes[0],
mpi->w * (mpi->bpp / 8), mpi->h,
- xvimage[current_buf]->pitches[0], mpi->stride[0]);
- return VO_TRUE;
+ ctx->xvimage[ctx->current_buf]->pitches[0], mpi->stride[0]);
+ else
+ return false;
+
+ if (ctx->is_paused) {
+ copy_backup_image(vo, ctx->num_buffers, ctx->current_buf);
+ ctx->have_next_image_copy = true;
}
- return VO_FALSE; // not (yet) supported
+ ctx->unchanged_next_image = true;
+ return true;
}
-static uint32_t get_image(mp_image_t * mpi)
+static uint32_t get_image(struct xvctx *ctx, mp_image_t *mpi)
{
- int buf = current_buf; // we shouldn't change current_buf unless we do DR!
+ // we shouldn't change current_buf unless we do DR!
+ int buf = ctx->current_buf;
- if (mpi->type == MP_IMGTYPE_STATIC && num_buffers > 1)
+ if (mpi->type == MP_IMGTYPE_STATIC && ctx->num_buffers > 1)
return VO_FALSE; // it is not static
- if (mpi->imgfmt != image_format)
+ if (mpi->imgfmt != ctx->image_format)
return VO_FALSE; // needs conversion :(
-// if(mpi->flags&MP_IMGFLAG_READABLE) return VO_FALSE; // slow video ram
- if (mpi->flags & MP_IMGFLAG_READABLE &&
- (mpi->type == MP_IMGTYPE_IPB || mpi->type == MP_IMGTYPE_IP))
- {
+ if (mpi->flags & MP_IMGFLAG_READABLE
+ && (mpi->type == MP_IMGTYPE_IPB || mpi->type == MP_IMGTYPE_IP)) {
// reference (I/P) frame of IP or IPB:
- if (num_buffers < 2)
+ if (ctx->num_buffers < 2)
return VO_FALSE; // not enough
- current_ip_buf ^= 1;
+ ctx->current_ip_buf ^= 1;
// for IPB with 2 buffers we can DR only one of the 2 P frames:
- if (mpi->type == MP_IMGTYPE_IPB && num_buffers < 3
- && current_ip_buf)
+ if (mpi->type == MP_IMGTYPE_IPB && ctx->num_buffers < 3
+ && ctx->current_ip_buf)
return VO_FALSE;
- buf = current_ip_buf;
+ buf = ctx->current_ip_buf;
if (mpi->type == MP_IMGTYPE_IPB)
++buf; // preserve space for B
}
- if (mpi->height > xvimage[buf]->height)
+ if (mpi->height > ctx->xvimage[buf]->height)
return VO_FALSE; //buffer to small
- if (mpi->width * (mpi->bpp / 8) > xvimage[buf]->pitches[0])
+ if (mpi->width * (mpi->bpp / 8) > ctx->xvimage[buf]->pitches[0])
return VO_FALSE; //buffer to small
if ((mpi->flags & (MP_IMGFLAG_ACCEPT_STRIDE | MP_IMGFLAG_ACCEPT_WIDTH))
- || (mpi->width * (mpi->bpp / 8) == xvimage[buf]->pitches[0]))
- {
- current_buf = buf;
- mpi->planes[0] =
- xvimage[current_buf]->data + xvimage[current_buf]->offsets[0];
- mpi->stride[0] = xvimage[current_buf]->pitches[0];
+ || (mpi->width * (mpi->bpp / 8) == ctx->xvimage[buf]->pitches[0])) {
+ ctx->current_buf = buf;
+ XvImage *current_image = ctx->xvimage[ctx->current_buf];
+ mpi->planes[0] = current_image->data + current_image->offsets[0];
+ mpi->stride[0] = current_image->pitches[0];
mpi->width = mpi->stride[0] / (mpi->bpp / 8);
- if (mpi->flags & MP_IMGFLAG_PLANAR)
- {
- if (mpi->flags & MP_IMGFLAG_SWAPPED)
- {
+ if (mpi->flags & MP_IMGFLAG_PLANAR) {
+ if (mpi->flags & MP_IMGFLAG_SWAPPED) {
// I420
- mpi->planes[1] =
- xvimage[current_buf]->data +
- xvimage[current_buf]->offsets[1];
- mpi->planes[2] =
- xvimage[current_buf]->data +
- xvimage[current_buf]->offsets[2];
- mpi->stride[1] = xvimage[current_buf]->pitches[1];
- mpi->stride[2] = xvimage[current_buf]->pitches[2];
- } else
- {
+ mpi->planes[1] = current_image->data
+ + current_image->offsets[1];
+ mpi->planes[2] = current_image->data
+ + current_image->offsets[2];
+ mpi->stride[1] = current_image->pitches[1];
+ mpi->stride[2] = current_image->pitches[2];
+ } else {
// YV12
- mpi->planes[1] =
- xvimage[current_buf]->data +
- xvimage[current_buf]->offsets[2];
- mpi->planes[2] =
- xvimage[current_buf]->data +
- xvimage[current_buf]->offsets[1];
- mpi->stride[1] = xvimage[current_buf]->pitches[2];
- mpi->stride[2] = xvimage[current_buf]->pitches[1];
+ mpi->planes[1] = current_image->data
+ + current_image->offsets[2];
+ mpi->planes[2] = current_image->data
+ + current_image->offsets[1];
+ mpi->stride[1] = current_image->pitches[2];
+ mpi->stride[2] = current_image->pitches[1];
}
}
mpi->flags |= MP_IMGFLAG_DIRECT;
- mpi->priv = (void *) current_buf;
-// printf("mga: get_image() SUCCESS -> Direct Rendering ENABLED\n");
+ mpi->priv = (void *) ctx->current_buf;
return VO_TRUE;
}
return VO_FALSE;
}
-static int query_format(uint32_t format)
+static int query_format(struct xvctx *ctx, uint32_t format)
{
uint32_t i;
int flag = VFCAP_CSP_SUPPORTED | VFCAP_CSP_SUPPORTED_BY_HW | VFCAP_HWSCALE_UP | VFCAP_HWSCALE_DOWN | VFCAP_OSD | VFCAP_ACCEPT_STRIDE; // FIXME! check for DOWN
/* check image formats */
- for (i = 0; i < formats; i++)
- {
- if (fo[i].id == format)
+ for (i = 0; i < ctx->formats; i++) {
+ if (ctx->fo[i].id == format)
return flag; //xv_format = fo[i].id;
}
return 0;
}
-static void uninit(void)
+static void uninit(struct vo *vo)
{
+ struct xvctx *ctx = vo->priv;
int i;
- if (!vo_config_count)
- return;
- visible_buf = -1;
- XvFreeAdaptorInfo(ai);
- ai = NULL;
- if(fo){
- XFree(fo);
- fo=NULL;
+ ctx->visible_buf = -1;
+ if (ctx->ai)
+ XvFreeAdaptorInfo(ctx->ai);
+ ctx->ai = NULL;
+ if (ctx->fo) {
+ XFree(ctx->fo);
+ ctx->fo = NULL;
}
- for (i = 0; i < num_buffers; i++)
- deallocate_xvimage(i);
+ for (i = 0; i < ctx->total_buffers; i++)
+ deallocate_xvimage(vo, i);
#ifdef CONFIG_XF86VM
- vo_vm_close();
+ if (ctx->mode_switched)
+ vo_vm_close(vo);
#endif
- mp_input_rm_event_fd(ConnectionNumber(mDisplay));
- vo_x11_uninit();
+ if (ctx->event_fd_registered)
+ mp_input_rm_key_fd(vo->input_ctx, ConnectionNumber(vo->x11->display));
+ // uninit() shouldn't get called unless initialization went past vo_init()
+ vo_x11_uninit(vo);
}
-static int preinit(const char *arg)
+static int x11_fd_callback(void *ctx, int fd)
+{
+ struct vo *vo = ctx;
+ check_events(vo);
+ return mplayer_get_key(vo->key_fifo, 0);
+}
+
+static int preinit(struct vo *vo, const char *arg)
{
XvPortID xv_p;
int busy_ports = 0;
unsigned int i;
strarg_t ck_src_arg = { 0, NULL };
strarg_t ck_method_arg = { 0, NULL };
+ struct xvctx *ctx = talloc_zero(vo, struct xvctx);
+ vo->priv = ctx;
+ struct vo_x11_state *x11 = vo->x11;
int xv_adaptor = -1;
const opt_t subopts[] =
{
/* name arg type arg var test */
- { "port", OPT_ARG_INT, &xv_port, int_pos },
+ { "port", OPT_ARG_INT, &x11->xv_port, int_pos },
{ "adaptor", OPT_ARG_INT, &xv_adaptor, int_non_neg },
{ "ck", OPT_ARG_STR, &ck_src_arg, xv_test_ck },
{ "ck-method", OPT_ARG_STR, &ck_method_arg, xv_test_ckm },
{ NULL }
};
- xv_port = 0;
+ x11->xv_port = 0;
/* parse suboptions */
- if ( subopt_parse( arg, subopts ) != 0 )
- {
- return -1;
+ if (subopt_parse(arg, subopts) != 0) {
+ return -1;
}
/* modify colorkey settings according to the given options */
- xv_setup_colorkeyhandling( ck_method_arg.str, ck_src_arg.str );
+ xv_setup_colorkeyhandling(vo, ck_method_arg.str, ck_src_arg.str);
- if (!vo_init())
+ if (!vo_init(vo))
return -1;
/* check for Xvideo extension */
- if (Success != XvQueryExtension(mDisplay, &ver, &rel, &req, &ev, &err))
- {
- mp_msg(MSGT_VO, MSGL_ERR,
- MSGTR_LIBVO_XV_XvNotSupportedByX11);
- return -1;
+ unsigned int ver, rel, req, ev, err;
+ if (Success != XvQueryExtension(x11->display, &ver, &rel, &req, &ev, &err)) {
+ mp_tmsg(MSGT_VO, MSGL_ERR, "[VO_XV] Sorry, Xv not supported by this X11 version/driver\n[VO_XV] ******** Try with -vo x11 or -vo sdl *********\n");
+ goto error;
}
/* check for Xvideo support */
if (Success !=
- XvQueryAdaptors(mDisplay, DefaultRootWindow(mDisplay), &adaptors,
- &ai))
- {
- mp_msg(MSGT_VO, MSGL_ERR, MSGTR_LIBVO_XV_XvQueryAdaptorsFailed);
- return -1;
+ XvQueryAdaptors(x11->display, DefaultRootWindow(x11->display),
+ &ctx->adaptors, &ctx->ai)) {
+ mp_tmsg(MSGT_VO, MSGL_ERR, "[VO_XV] XvQueryAdaptors failed.\n");
+ goto error;
}
/* check adaptors */
- if (xv_port)
- {
+ if (x11->xv_port) {
int port_found;
- for (port_found = 0, i = 0; !port_found && i < adaptors; i++)
- {
- if ((ai[i].type & XvInputMask) && (ai[i].type & XvImageMask))
- {
- for (xv_p = ai[i].base_id;
- xv_p < ai[i].base_id + ai[i].num_ports; ++xv_p)
- {
- if (xv_p == xv_port)
- {
+ for (port_found = 0, i = 0; !port_found && i < ctx->adaptors; i++) {
+ if ((ctx->ai[i].type & XvInputMask)
+ && (ctx->ai[i].type & XvImageMask)) {
+ for (xv_p = ctx->ai[i].base_id;
+ xv_p < ctx->ai[i].base_id + ctx->ai[i].num_ports;
+ ++xv_p) {
+ if (xv_p == x11->xv_port) {
port_found = 1;
break;
}
}
}
}
- if (port_found)
- {
- if (XvGrabPort(mDisplay, xv_port, CurrentTime))
- xv_port = 0;
- } else
- {
- mp_msg(MSGT_VO, MSGL_WARN,
- MSGTR_LIBVO_XV_InvalidPortParameter);
- xv_port = 0;
+ if (port_found) {
+ if (XvGrabPort(x11->display, x11->xv_port, CurrentTime))
+ x11->xv_port = 0;
+ } else {
+ mp_tmsg(MSGT_VO, MSGL_WARN, "[VO_XV] Invalid port parameter, overriding with port 0.\n");
+ x11->xv_port = 0;
}
}
- for (i = 0; i < adaptors && xv_port == 0; i++)
- {
+ for (i = 0; i < ctx->adaptors && x11->xv_port == 0; i++) {
/* check if adaptor number has been specified */
if (xv_adaptor != -1 && xv_adaptor != i)
- continue;
+ continue;
- if ((ai[i].type & XvInputMask) && (ai[i].type & XvImageMask))
- {
- for (xv_p = ai[i].base_id;
- xv_p < ai[i].base_id + ai[i].num_ports; ++xv_p)
- if (!XvGrabPort(mDisplay, xv_p, CurrentTime))
- {
- xv_port = xv_p;
+ if ((ctx->ai[i].type & XvInputMask) && (ctx->ai[i].type & XvImageMask)) {
+ for (xv_p = ctx->ai[i].base_id;
+ xv_p < ctx->ai[i].base_id + ctx->ai[i].num_ports; ++xv_p)
+ if (!XvGrabPort(x11->display, xv_p, CurrentTime)) {
+ x11->xv_port = xv_p;
mp_msg(MSGT_VO, MSGL_V,
"[VO_XV] Using Xv Adapter #%d (%s)\n",
- i, ai[i].name);
+ i, ctx->ai[i].name);
break;
- } else
- {
- mp_msg(MSGT_VO, MSGL_WARN,
- MSGTR_LIBVO_XV_CouldNotGrabPort, (int) xv_p);
+ } else {
+ mp_tmsg(MSGT_VO, MSGL_WARN, "[VO_XV] Could not grab port %i.\n",
+ (int) xv_p);
++busy_ports;
}
}
}
- if (!xv_port)
- {
+ if (!x11->xv_port) {
if (busy_ports)
- mp_msg(MSGT_VO, MSGL_ERR,
- MSGTR_LIBVO_XV_CouldNotFindFreePort);
+ mp_tmsg(MSGT_VO, MSGL_ERR,
+ "[VO_XV] Could not find free Xvideo port - maybe another process is already\n"\
+ "[VO_XV] using it. Close all video applications, and try again. If that does\n"\
+ "[VO_XV] not help, see 'mplayer -vo help' for other (non-xv) video out drivers.\n");
else
- mp_msg(MSGT_VO, MSGL_ERR,
- MSGTR_LIBVO_XV_NoXvideoSupport);
- return -1;
+ mp_tmsg(MSGT_VO, MSGL_ERR,
+ "[VO_XV] It seems there is no Xvideo support for your video card available.\n"\
+ "[VO_XV] Run 'xvinfo' to verify its Xv support and read\n"\
+ "[VO_XV] DOCS/HTML/en/video.html#xv!\n"\
+ "[VO_XV] See 'mplayer -vo help' for other (non-xv) video out drivers.\n"\
+ "[VO_XV] Try -vo x11.\n");
+ goto error;
}
- if ( !vo_xv_init_colorkey() )
- {
- return -1; // bail out, colorkey setup failed
+ if (!vo_xv_init_colorkey(vo)) {
+ goto error; // bail out, colorkey setup failed
}
- vo_xv_enable_vsync();
- vo_xv_get_max_img_dim( &max_width, &max_height );
+ vo_xv_enable_vsync(vo);
+ vo_xv_get_max_img_dim(vo, &ctx->max_width, &ctx->max_height);
- fo = XvListImageFormats(mDisplay, xv_port, (int *) &formats);
+ ctx->fo = XvListImageFormats(x11->display, x11->xv_port,
+ (int *) &ctx->formats);
- mp_input_add_event_fd(ConnectionNumber(mDisplay), check_events);
+ mp_input_add_key_fd(vo->input_ctx, ConnectionNumber(x11->display), 1,
+ x11_fd_callback, NULL, vo);
+ ctx->event_fd_registered = 1;
return 0;
+
+ error:
+ uninit(vo); // free resources
+ return -1;
}
-static int control(uint32_t request, void *data, ...)
+static int control(struct vo *vo, uint32_t request, void *data)
{
- switch (request)
- {
- case VOCTRL_PAUSE:
- return int_pause = 1;
- case VOCTRL_RESUME:
- return int_pause = 0;
- case VOCTRL_QUERY_FORMAT:
- return query_format(*((uint32_t *) data));
- case VOCTRL_GET_IMAGE:
- return get_image(data);
- case VOCTRL_DRAW_IMAGE:
- return draw_image(data);
- case VOCTRL_GUISUPPORT:
- return VO_TRUE;
- case VOCTRL_GET_PANSCAN:
- return VO_TRUE;
- case VOCTRL_FULLSCREEN:
- vo_x11_fullscreen();
- /* indended, fallthrough to update panscan on fullscreen/windowed switch */
- case VOCTRL_SET_PANSCAN:
- resize();
- return VO_TRUE;
- case VOCTRL_SET_EQUALIZER:
- {
- va_list ap;
- int value;
-
- va_start(ap, data);
- value = va_arg(ap, int);
-
- va_end(ap);
-
- return vo_xv_set_eq(xv_port, data, value);
- }
- case VOCTRL_GET_EQUALIZER:
- {
- va_list ap;
- int *value;
-
- va_start(ap, data);
- value = va_arg(ap, int *);
-
- va_end(ap);
-
- return vo_xv_get_eq(xv_port, data, value);
- }
- case VOCTRL_ONTOP:
- vo_x11_ontop();
- return VO_TRUE;
- case VOCTRL_UPDATE_SCREENINFO:
- update_xinerama_info();
- return VO_TRUE;
+ struct xvctx *ctx = vo->priv;
+ struct vo_x11_state *x11 = vo->x11;
+ switch (request) {
+ case VOCTRL_PAUSE:
+ return (ctx->is_paused = 1);
+ case VOCTRL_RESUME:
+ return (ctx->is_paused = 0);
+ case VOCTRL_QUERY_FORMAT:
+ return query_format(ctx, *((uint32_t *) data));
+ case VOCTRL_GET_IMAGE:
+ return get_image(ctx, data);
+ case VOCTRL_DRAW_IMAGE:
+ return draw_image(vo, data);
+ case VOCTRL_GET_PANSCAN:
+ return VO_TRUE;
+ case VOCTRL_FULLSCREEN:
+ vo_x11_fullscreen(vo);
+ /* indended, fallthrough to update panscan on fullscreen/windowed switch */
+ case VOCTRL_SET_PANSCAN:
+ resize(vo);
+ return VO_TRUE;
+ case VOCTRL_SET_EQUALIZER:
+ {
+ struct voctrl_set_equalizer_args *args = data;
+ return vo_xv_set_eq(vo, x11->xv_port, args->name, args->value);
+ }
+ case VOCTRL_GET_EQUALIZER:
+ {
+ struct voctrl_get_equalizer_args *args = data;
+ return vo_xv_get_eq(vo, x11->xv_port, args->name, args->valueptr);
+ }
+ case VOCTRL_SET_YUV_COLORSPACE:;
+ int given_cspc = *(int *)data % 2;
+ return vo_xv_set_eq(vo, x11->xv_port, "bt_709", given_cspc * 200 - 100);
+ case VOCTRL_GET_YUV_COLORSPACE:;
+ int bt709_enabled;
+ if (!vo_xv_get_eq(vo, x11->xv_port, "bt_709", &bt709_enabled))
+ return false;
+ *(int *)data = bt709_enabled == 100;
+ return true;
+ case VOCTRL_ONTOP:
+ vo_x11_ontop(vo);
+ return VO_TRUE;
+ case VOCTRL_UPDATE_SCREENINFO:
+ update_xinerama_info(vo);
+ return VO_TRUE;
+ case VOCTRL_REDRAW_OSD:
+ return redraw_osd(vo, data);
}
return VO_NOTIMPL;
}
+
+const struct vo_driver video_out_xv = {
+ .is_new = 1,
+ .info = &info,
+ .preinit = preinit,
+ .config = config,
+ .control = control,
+ .draw_slice = draw_slice,
+ .draw_osd = draw_osd,
+ .flip_page = flip_page,
+ .check_events = check_events,
+ .uninit = uninit
+};
diff --git a/libvo/vo_xvidix.c b/libvo/vo_xvidix.c
index b48168e6d5..c7481ae613 100644
--- a/libvo/vo_xvidix.c
+++ b/libvo/vo_xvidix.c
@@ -49,11 +49,6 @@
#include "vosub_vidix.h"
#include "vidix/vidix.h"
-#ifdef CONFIG_GUI
-#include "gui/interface.h"
-#endif
-
-
static const vo_info_t info = {
"X11 (VIDIX)",
"xvidix",
@@ -252,13 +247,6 @@ static int config(uint32_t width, uint32_t height, uint32_t d_width,
}
mp_msg(MSGT_VO, MSGL_V, "Using colorkey: %x\n", colorkey);
-#ifdef CONFIG_GUI
- if (use_gui)
- guiGetEvent(guiSetShVideo, 0); // the GUI will set up / resize the window
- else
- {
-#endif
-
#ifdef X11_FULLSCREEN
if ((flags & VOFLAG_FULLSCREEN) || (flags & VOFLAG_SWSCALE))
aspect(&d_width, &d_height, A_ZOOM);
@@ -289,10 +277,6 @@ static int config(uint32_t width, uint32_t height, uint32_t d_width,
CopyFromParent, "xvidix", title);
XChangeWindowAttributes(mDisplay, vo_window, xswamask, &xswa);
-#ifdef CONFIG_GUI
- }
-#endif
-
if ((!WinID) && (flags & VOFLAG_FULLSCREEN))
{
vo_dx = 0;
@@ -409,20 +393,18 @@ static int preinit(const char *arg)
if (!vo_init())
return -1;
- if (vidix_preinit(vidix_name, &video_out_xvidix) != 0)
+ if (vidix_preinit(vidix_name, video_out_xvidix.old_functions) != 0)
return 1;
return 0;
}
-static int control(uint32_t request, void *data, ...)
+static int control(uint32_t request, void *data)
{
switch (request)
{
case VOCTRL_QUERY_FORMAT:
return query_format(*((uint32_t *) data));
- case VOCTRL_GUISUPPORT:
- return VO_TRUE;
case VOCTRL_GET_PANSCAN:
if (!vo_config_count || !vo_fs)
return VO_FALSE;
@@ -439,30 +421,6 @@ static int control(uint32_t request, void *data, ...)
set_window(0);
}
return VO_TRUE;
- case VOCTRL_SET_EQUALIZER:
- {
- va_list ap;
- int value;
-
- va_start(ap, data);
- value = va_arg(ap, int);
-
- va_end(ap);
-
- return vidix_control(request, data, value);
- }
- case VOCTRL_GET_EQUALIZER:
- {
- va_list ap;
- int *value;
-
- va_start(ap, data);
- value = va_arg(ap, int *);
-
- va_end(ap);
-
- return vidix_control(request, data, value);
- }
case VOCTRL_UPDATE_SCREENINFO:
aspect_save_screenres(vo_screenwidth, vo_screenheight);
return VO_TRUE;
diff --git a/libvo/vo_xvmc.c b/libvo/vo_xvmc.c
index 76954b2649..ac832d91d3 100644
--- a/libvo/vo_xvmc.c
+++ b/libvo/vo_xvmc.c
@@ -49,7 +49,6 @@
#include "aspect.h"
#include "subopt-helper.h"
-#include "gui/interface.h"
#include "libavutil/common.h"
@@ -623,11 +622,6 @@ found_subpic:
skip_surface_allocation:
-#ifdef CONFIG_GUI
- if(use_gui)
- guiGetEvent( guiSetShVideo,0 ); // let the GUI to setup/resize our window
- else
-#endif
{
#ifdef CONFIG_XF86VM
if ( vm )
@@ -1269,7 +1263,7 @@ assert(rndr->next_free_data_block_num == 0);
return VO_TRUE;
}
-static int control(uint32_t request, void *data, ... )
+static int control(uint32_t request, void *data)
{
switch (request){
case VOCTRL_GET_DEINTERLACE:
@@ -1285,8 +1279,6 @@ static int control(uint32_t request, void *data, ... )
case VOCTRL_GET_IMAGE:
return get_image((mp_image_t *)data);
//vo_xv
- case VOCTRL_GUISUPPORT:
- return VO_TRUE;
case VOCTRL_ONTOP:
vo_x11_ontop();
return VO_TRUE;
@@ -1311,26 +1303,14 @@ static int control(uint32_t request, void *data, ... )
return VO_TRUE;
case VOCTRL_SET_EQUALIZER:
{
- va_list ap;
- int value;
-
- va_start(ap, data);
- value = va_arg(ap, int);
- va_end(ap);
-
- return vo_xv_set_eq(xv_port, data, value);
+ struct voctrl_set_equalizer_args *args = data;
+ return vo_xv_set_eq(xv_port, args->name, args->value);
}
case VOCTRL_GET_EQUALIZER:
{
- va_list ap;
- int *value;
-
- va_start(ap, data);
- value = va_arg(ap, int*);
- va_end(ap);
-
- return vo_xv_get_eq(xv_port, data, value);
+ struct voctrl_get_equalizer_args *args = data;
+ return vo_xv_get_eq(xv_port, args->name, args->valueptr);
}
case VOCTRL_UPDATE_SCREENINFO:
update_xinerama_info();
diff --git a/libvo/vo_xvr100.c b/libvo/vo_xvr100.c
index 476744729c..7a82c436fb 100644
--- a/libvo/vo_xvr100.c
+++ b/libvo/vo_xvr100.c
@@ -428,7 +428,7 @@ static int query_format(uint32_t format)
return 0;
}
-static int control(uint32_t request, void *data, ...)
+static int control(uint32_t request, void *data)
{
switch (request) {
case VOCTRL_GET_IMAGE:
diff --git a/libvo/vo_yuv4mpeg.c b/libvo/vo_yuv4mpeg.c
index f4cbfb1639..0cc7f9a62c 100644
--- a/libvo/vo_yuv4mpeg.c
+++ b/libvo/vo_yuv4mpeg.c
@@ -56,7 +56,9 @@
#include "fastmemcpy.h"
#include "libswscale/swscale.h"
+#ifdef CONFIG_LIBSWSCALE_INTERNALS
#include "libswscale/rgb2rgb.h"
+#endif
#include "libmpcodecs/vf_scale.h"
#include "libavutil/rational.h"
@@ -122,42 +124,44 @@ static int config(uint32_t width, uint32_t height, uint32_t d_width,
{
if (height % 4)
{
- mp_msg(MSGT_VO,MSGL_FATAL,
- MSGTR_VO_YUV4MPEG_InterlacedHeightDivisibleBy4);
+ mp_tmsg(MSGT_VO,MSGL_FATAL,
+ "Interlaced mode requires image height to be divisible by 4.");
return -1;
}
rgb_line_buffer = malloc(image_width * 3);
if (!rgb_line_buffer)
{
- mp_msg(MSGT_VO,MSGL_FATAL,
- MSGTR_VO_YUV4MPEG_InterlacedLineBufAllocFail);
+ mp_tmsg(MSGT_VO,MSGL_FATAL,
+ "Unable to allocate line buffer for interlaced mode.");
return -1;
}
if (using_format == IMGFMT_YV12)
- mp_msg(MSGT_VO,MSGL_WARN,
- MSGTR_VO_YUV4MPEG_InterlacedInputNotRGB);
+ mp_tmsg(MSGT_VO,MSGL_WARN,
+ "Input not RGB, can't separate chrominance by fields!");
}
if (width % 2)
{
- mp_msg(MSGT_VO,MSGL_FATAL,
- MSGTR_VO_YUV4MPEG_WidthDivisibleBy2);
+ mp_tmsg(MSGT_VO,MSGL_FATAL,
+ "Image width must be divisible by 2.");
return -1;
}
+#ifdef CONFIG_LIBSWSCALE_INTERNALS
if(using_format != IMGFMT_YV12)
{
sws_rgb2rgb_init(get_sws_cpuflags());
rgb_buffer = malloc(image_width * image_height * 3);
if (!rgb_buffer)
{
- mp_msg(MSGT_VO,MSGL_FATAL,
- MSGTR_VO_YUV4MPEG_NoMemRGBFrameBuf);
+ mp_tmsg(MSGT_VO,MSGL_FATAL,
+ "Not enough memory to allocate RGB framebuffer.");
return -1;
}
}
+#endif
write_bytes = image_width * image_height * 3 / 2;
image = malloc(write_bytes);
@@ -165,8 +169,8 @@ static int config(uint32_t width, uint32_t height, uint32_t d_width,
yuv_out = fopen(yuv_filename, "wb");
if (!yuv_out || image == 0)
{
- mp_msg(MSGT_VO,MSGL_FATAL,
- MSGTR_VO_YUV4MPEG_OutFileOpenError,
+ mp_tmsg(MSGT_VO,MSGL_FATAL,
+ "Can't get memory or file handle to write \"%s\"!",
yuv_filename);
return -1;
}
@@ -228,6 +232,7 @@ static void draw_osd(void)
vo_draw_text(image_width, image_height, draw_alpha);
}
+#ifdef CONFIG_LIBSWSCALE_INTERNALS
static void deinterleave_fields(uint8_t *ptr, const int stride,
const int img_height)
{
@@ -258,12 +263,13 @@ static void deinterleave_fields(uint8_t *ptr, const int stride,
}
free(line_state);
}
+#endif
static void vo_y4m_write(const void *ptr, const size_t num_bytes)
{
if (fwrite(ptr, 1, num_bytes, yuv_out) != num_bytes)
- mp_msg(MSGT_VO,MSGL_ERR,
- MSGTR_VO_YUV4MPEG_OutFileWriteError);
+ mp_tmsg(MSGT_VO,MSGL_ERR,
+ "Error writing image to output!");
}
static int write_last_frame(void)
@@ -318,14 +324,15 @@ static int write_last_frame(void)
static void flip_page (void)
{
- uint8_t *upper_y, *upper_u, *upper_v, *rgb_buffer_lower;
- int rgb_stride, uv_stride, field_height;
- unsigned int i, low_ofs;
-
fprintf(yuv_out, "FRAME\n");
+#ifdef CONFIG_LIBSWSCALE_INTERNALS
if (using_format != IMGFMT_YV12)
{
+ uint8_t *upper_y, *upper_u, *upper_v, *rgb_buffer_lower;
+ int rgb_stride, uv_stride, field_height;
+ unsigned int i, low_ofs;
+
rgb_stride = image_width * 3;
uv_stride = image_width / 2;
@@ -374,6 +381,7 @@ static void flip_page (void)
image_width, image_height,
image_width, uv_stride, rgb_stride);
}
+#endif
/* Write progressive frame */
vo_y4m_write(image, write_bytes);
@@ -458,9 +466,11 @@ static int query_format(uint32_t format)
{
case IMGFMT_YV12:
return VFCAP_CSP_SUPPORTED|VFCAP_OSD|VFCAP_ACCEPT_STRIDE;
+#ifdef CONFIG_LIBSWSCALE_INTERNALS
case IMGFMT_BGR|24:
case IMGFMT_RGB|24:
return VFCAP_CSP_SUPPORTED|VFCAP_CSP_SUPPORTED_BY_HW|VFCAP_OSD|VFCAP_ACCEPT_STRIDE;
+#endif
}
}
else
@@ -470,9 +480,11 @@ static int query_format(uint32_t format)
{
case IMGFMT_YV12:
return VFCAP_CSP_SUPPORTED|VFCAP_CSP_SUPPORTED_BY_HW|VFCAP_OSD|VFCAP_ACCEPT_STRIDE;
+#ifdef CONFIG_LIBSWSCALE_INTERNALS
case IMGFMT_BGR|24:
case IMGFMT_RGB|24:
return VFCAP_CSP_SUPPORTED|VFCAP_OSD|VFCAP_ACCEPT_STRIDE;
+#endif
}
}
return 0;
@@ -524,7 +536,7 @@ static int preinit(const char *arg)
il_bf = 0;
yuv_filename = strdup("stream.yuv");
if (subopt_parse(arg, subopts) != 0) {
- mp_msg(MSGT_VO, MSGL_FATAL, MSGTR_VO_YUV4MPEG_UnknownSubDev, arg);
+ mp_tmsg(MSGT_VO, MSGL_FATAL, "Unknown subdevice: %s", arg);
return -1;
}
@@ -538,22 +550,22 @@ static int preinit(const char *arg)
switch (config_interlace)
{
case Y4M_ILACE_TOP_FIRST:
- mp_msg(MSGT_VO,MSGL_STATUS,
- MSGTR_VO_YUV4MPEG_InterlacedTFFMode);
+ mp_tmsg(MSGT_VO,MSGL_STATUS,
+ "Using interlaced output mode, top-field first.");
break;
case Y4M_ILACE_BOTTOM_FIRST:
- mp_msg(MSGT_VO,MSGL_STATUS,
- MSGTR_VO_YUV4MPEG_InterlacedBFFMode);
+ mp_tmsg(MSGT_VO,MSGL_STATUS,
+ "Using interlaced output mode, bottom-field first.");
break;
default:
- mp_msg(MSGT_VO,MSGL_STATUS,
- MSGTR_VO_YUV4MPEG_ProgressiveMode);
+ mp_tmsg(MSGT_VO,MSGL_STATUS,
+ "Using (default) progressive frame mode.");
break;
}
return 0;
}
-static int control(uint32_t request, void *data, ...)
+static int control(uint32_t request, void *data)
{
switch (request) {
case VOCTRL_QUERY_FORMAT:
diff --git a/libvo/vo_zr.c b/libvo/vo_zr.c
index e8d1f23e11..9b7968a6ba 100644
--- a/libvo/vo_zr.c
+++ b/libvo/vo_zr.c
@@ -830,7 +830,7 @@ static int preinit(const char *arg)
return 0;
}
-static int control(uint32_t request, void *data, ...)
+static int control(uint32_t request, void *data)
{
switch (request) {
case VOCTRL_QUERY_FORMAT:
diff --git a/libvo/vo_zr2.c b/libvo/vo_zr2.c
index 9f086cc4e1..57addb03f1 100644
--- a/libvo/vo_zr2.c
+++ b/libvo/vo_zr2.c
@@ -451,7 +451,7 @@ static int config(uint32_t width, uint32_t height, uint32_t d_width,
return 0;
}
-static int control(uint32_t request, void *data, ...) {
+static int control(uint32_t request, void *data) {
switch (request) {
case VOCTRL_QUERY_FORMAT:
return query_format(*((uint32_t*)data));
diff --git a/libvo/vosub_vidix.c b/libvo/vosub_vidix.c
index a6f261130b..9b3c941c4d 100644
--- a/libvo/vosub_vidix.c
+++ b/libvo/vosub_vidix.c
@@ -44,6 +44,7 @@
#include "video_out.h"
#include "sub.h"
#include "vosub_vidix.h"
+#include "old_vo_wrapper.h"
#include "libmpcodecs/vfcap.h"
#include "libmpcodecs/mp_image.h"
@@ -59,7 +60,7 @@ static int video_on=0;
static vidix_capability_t vidix_cap;
static vidix_playback_t vidix_play;
static vidix_fourcc_t vidix_fourcc;
-static vo_functions_t * vo_server;
+static struct vo_old_functions *vo_server;
static vidix_yuv_t dstrides;
/*static uint32_t (*server_control)(uint32_t request, void *data, ...);*/
@@ -68,7 +69,7 @@ int vidix_start(void)
int err;
if((err=vdlPlaybackOn(vidix_handler))!=0)
{
- mp_msg(MSGT_VO,MSGL_ERR, MSGTR_LIBVO_SUB_VIDIX_CantStartPlayback,strerror(err));
+ mp_tmsg(MSGT_VO,MSGL_ERR, "[VO_SUB_VIDIX] Can't start playback: %s\n",strerror(err));
return -1;
}
video_on=1;
@@ -80,7 +81,7 @@ int vidix_stop(void)
int err;
if((err=vdlPlaybackOff(vidix_handler))!=0)
{
- mp_msg(MSGT_VO,MSGL_ERR, MSGTR_LIBVO_SUB_VIDIX_CantStopPlayback,strerror(err));
+ mp_tmsg(MSGT_VO,MSGL_ERR, "[VO_SUB_VIDIX] Can't stop playback: %s\n",strerror(err));
return -1;
}
video_on=0;
@@ -96,7 +97,7 @@ void vidix_term( void )
// vo_server->control=server_control;
}
-static uint32_t vidix_draw_slice_420(uint8_t *image[], int stride[], int w,int h,int x,int y)
+static int vidix_draw_slice_420(uint8_t *image[], int stride[], int w,int h,int x,int y)
{
uint8_t *src;
uint8_t *dest;
@@ -160,7 +161,7 @@ static uint32_t vidix_draw_slice_420(uint8_t *image[], int stride[], int w,int h
return -1;
}
-static uint32_t vidix_draw_slice_410(uint8_t *image[], int stride[], int w,int h,int x,int y)
+static int vidix_draw_slice_410(uint8_t *image[], int stride[], int w,int h,int x,int y)
{
uint8_t *src;
uint8_t *dest;
@@ -178,7 +179,7 @@ static uint32_t vidix_draw_slice_410(uint8_t *image[], int stride[], int w,int h
if (vidix_play.flags & VID_PLAY_INTERLEAVED_UV)
{
- mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_SUB_VIDIX_InterleavedUvForYuv410pNotSupported);
+ mp_tmsg(MSGT_VO,MSGL_WARN, "[VO_SUB_VIDIX] Interleaved UV for YUV410P not supported.\n");
}
else
{
@@ -206,7 +207,7 @@ static uint32_t vidix_draw_slice_410(uint8_t *image[], int stride[], int w,int h
return -1;
}
-static uint32_t vidix_draw_slice_packed(uint8_t *image[], int stride[], int w,int h,int x,int y)
+static int vidix_draw_slice_packed(uint8_t *image[], int stride[], int w,int h,int x,int y)
{
uint8_t *src;
uint8_t *dest;
@@ -223,7 +224,7 @@ static uint32_t vidix_draw_slice_packed(uint8_t *image[], int stride[], int w,in
return 0;
}
-static uint32_t vidix_draw_slice_nv12(uint8_t *image[], int stride[], int w,int h,int x,int y)
+static int vidix_draw_slice_nv12(uint8_t *image[], int stride[], int w,int h,int x,int y)
{
uint8_t *src;
uint8_t *dest;
@@ -251,9 +252,9 @@ static uint32_t vidix_draw_slice_nv12(uint8_t *image[], int stride[], int w,int
return 0;
}
-static uint32_t vidix_draw_slice(uint8_t *image[], int stride[], int w,int h,int x,int y)
+static int vidix_draw_slice(uint8_t *image[], int stride[], int w,int h,int x,int y)
{
- mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_SUB_VIDIX_DummyVidixdrawsliceWasCalled);
+ mp_tmsg(MSGT_VO,MSGL_WARN, "[VO_SUB_VIDIX] Dummy vidix_draw_slice() was called.\n");
return -1;
}
@@ -269,9 +270,9 @@ static uint32_t vidix_draw_image(mp_image_t *mpi){
return VO_TRUE;
}
-static uint32_t vidix_draw_frame(uint8_t *image[])
+static int vidix_draw_frame(uint8_t *image[])
{
- mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_SUB_VIDIX_DummyVidixdrawframeWasCalled);
+ mp_tmsg(MSGT_VO,MSGL_WARN, "[VO_SUB_VIDIX] Dummy vidix_draw_frame() was called.\n");
return -1;
}
@@ -391,7 +392,7 @@ int vidix_init(unsigned src_width,unsigned src_height,
if(vidix_query_fourcc(format) == 0)
{
- mp_msg(MSGT_VO,MSGL_ERR, MSGTR_LIBVO_SUB_VIDIX_UnsupportedFourccForThisVidixDriver,
+ mp_tmsg(MSGT_VO,MSGL_ERR, "[VO_SUB_VIDIX] Unsupported FourCC for this VIDIX driver: %x (%s).\n",
format,vo_format_name(format));
return -1;
}
@@ -401,7 +402,7 @@ int vidix_init(unsigned src_width,unsigned src_height,
((vidix_cap.maxheight != -1) && (vid_h > vidix_cap.maxheight)) ||
((vidix_cap.minwidth != -1 ) && (vid_h < vidix_cap.minheight)))
{
- mp_msg(MSGT_VO,MSGL_ERR, MSGTR_LIBVO_SUB_VIDIX_VideoServerHasUnsupportedResolution,
+ mp_tmsg(MSGT_VO,MSGL_ERR, "[VO_SUB_VIDIX] Video server has unsupported resolution (%dx%d), supported: %dx%d-%dx%d.\n",
vid_w, vid_h, vidix_cap.minwidth, vidix_cap.minheight,
vidix_cap.maxwidth, vidix_cap.maxheight);
return -1;
@@ -423,19 +424,19 @@ int vidix_init(unsigned src_width,unsigned src_height,
}
if(err)
{
- mp_msg(MSGT_VO,MSGL_ERR, MSGTR_LIBVO_SUB_VIDIX_VideoServerHasUnsupportedColorDepth
+ mp_tmsg(MSGT_VO,MSGL_ERR, "[VO_SUB_VIDIX] Video server has unsupported color depth by vidix (%d).\n"
,vidix_fourcc.depth);
return -1;
}
if((dst_width > src_width || dst_height > src_height) && (vidix_cap.flags & FLAG_UPSCALER) != FLAG_UPSCALER)
{
- mp_msg(MSGT_VO,MSGL_ERR, MSGTR_LIBVO_SUB_VIDIX_DriverCantUpscaleImage,
+ mp_tmsg(MSGT_VO,MSGL_ERR, "[VO_SUB_VIDIX] VIDIX driver can't upscale image (%d%d -> %d%d).\n",
src_width, src_height, dst_width, dst_height);
return -1;
}
if((dst_width > src_width || dst_height > src_height) && (vidix_cap.flags & FLAG_DOWNSCALER) != FLAG_DOWNSCALER)
{
- mp_msg(MSGT_VO,MSGL_ERR, MSGTR_LIBVO_SUB_VIDIX_DriverCantDownscaleImage,
+ mp_tmsg(MSGT_VO,MSGL_ERR, "[VO_SUB_VIDIX] VIDIX driver can't downscale image (%d%d -> %d%d).\n",
src_width, src_height, dst_width, dst_height);
return -1;
}
@@ -463,7 +464,7 @@ int vidix_init(unsigned src_width,unsigned src_height,
if((err=vdlConfigPlayback(vidix_handler,&vidix_play))!=0)
{
- mp_msg(MSGT_VO,MSGL_ERR, MSGTR_LIBVO_SUB_VIDIX_CantConfigurePlayback,strerror(err));
+ mp_tmsg(MSGT_VO,MSGL_ERR, "[VO_SUB_VIDIX] Can't configure playback: %s.\n",strerror(err));
return -1;
}
if ( mp_msg_test(MSGT_VO,MSGL_V) ) {
@@ -576,7 +577,7 @@ static uint32_t vidix_get_image(mp_image_t *mpi)
return VO_FALSE;
}
-uint32_t vidix_control(uint32_t request, void *data, ...)
+uint32_t vidix_control(uint32_t request, void *data)
{
switch (request) {
case VOCTRL_QUERY_FORMAT:
@@ -596,36 +597,31 @@ uint32_t vidix_control(uint32_t request, void *data, ...)
return VO_TRUE;
case VOCTRL_SET_EQUALIZER:
{
- va_list ap;
- int value;
vidix_video_eq_t info;
if(!video_on) return VO_FALSE;
- va_start(ap, data);
- value = va_arg(ap, int);
- va_end(ap);
-// printf("vidix seteq %s -> %d \n",data,value);
+ struct voctrl_set_equalizer_args *args = data;
/* vidix eq ranges are -1000..1000 */
- if (!strcasecmp(data, "brightness"))
+ if (!strcasecmp(args->name, "brightness"))
{
- info.brightness = value*10;
+ info.brightness = args->value*10;
info.cap = VEQ_CAP_BRIGHTNESS;
}
- else if (!strcasecmp(data, "contrast"))
+ else if (!strcasecmp(args->name, "contrast"))
{
- info.contrast = value*10;
+ info.contrast = args->value*10;
info.cap = VEQ_CAP_CONTRAST;
}
- else if (!strcasecmp(data, "saturation"))
+ else if (!strcasecmp(args->name, "saturation"))
{
- info.saturation = value*10;
+ info.saturation = args->value*10;
info.cap = VEQ_CAP_SATURATION;
}
- else if (!strcasecmp(data, "hue"))
+ else if (!strcasecmp(args->name, "hue"))
{
- info.hue = value*10;
+ info.hue = args->value*10;
info.cap = VEQ_CAP_HUE;
}
@@ -635,38 +631,34 @@ uint32_t vidix_control(uint32_t request, void *data, ...)
}
case VOCTRL_GET_EQUALIZER:
{
- va_list ap;
- int *value;
vidix_video_eq_t info;
if(!video_on) return VO_FALSE;
if (vdlPlaybackGetEq(vidix_handler, &info) != 0)
return VO_FALSE;
- va_start(ap, data);
- value = va_arg(ap, int*);
- va_end(ap);
+ struct voctrl_get_equalizer_args *args = data;
/* vidix eq ranges are -1000..1000 */
- if (!strcasecmp(data, "brightness"))
+ if (!strcasecmp(args->name, "brightness"))
{
if (info.cap & VEQ_CAP_BRIGHTNESS)
- *value = info.brightness/10;
+ *args->valueptr = info.brightness/10;
}
- else if (!strcasecmp(data, "contrast"))
+ else if (!strcasecmp(args->name, "contrast"))
{
if (info.cap & VEQ_CAP_CONTRAST)
- *value = info.contrast/10;
+ *args->valueptr = info.contrast/10;
}
- else if (!strcasecmp(data, "saturation"))
+ else if (!strcasecmp(args->name, "saturation"))
{
if (info.cap & VEQ_CAP_SATURATION)
- *value = info.saturation/10;
+ *args->valueptr = info.saturation/10;
}
- else if (!strcasecmp(data, "hue"))
+ else if (!strcasecmp(args->name, "hue"))
{
if (info.cap & VEQ_CAP_HUE)
- *value = info.hue/10;
+ *args->valueptr = info.hue/10;
}
return VO_TRUE;
@@ -677,7 +669,7 @@ uint32_t vidix_control(uint32_t request, void *data, ...)
// return server_control(request,data); //VO_NOTIMPL;
}
-int vidix_preinit(const char *drvname,vo_functions_t *server)
+int vidix_preinit(const char *drvname, struct vo_old_functions *server)
{
int err;
if( mp_msg_test(MSGT_VO,MSGL_DBG2) ) {
@@ -689,12 +681,12 @@ int vidix_preinit(const char *drvname,vo_functions_t *server)
if(vidix_handler == NULL)
{
- mp_msg(MSGT_VO,MSGL_ERR, MSGTR_LIBVO_SUB_VIDIX_CouldntFindWorkingVidixDriver);
+ mp_tmsg(MSGT_VO,MSGL_ERR, "[VO_SUB_VIDIX] Couldn't find working VIDIX driver.\n");
return -1;
}
if((err=vdlGetCapability(vidix_handler,&vidix_cap)) != 0)
{
- mp_msg(MSGT_VO,MSGL_ERR, MSGTR_LIBVO_SUB_VIDIX_CouldntGetCapability,strerror(err));
+ mp_tmsg(MSGT_VO,MSGL_ERR, "[VO_SUB_VIDIX] Couldn't get capability: %s.\n",strerror(err));
return -1;
}
mp_msg(MSGT_VO,MSGL_V, "[VO_SUB_VIDIX] Description: %s.\n", vidix_cap.name);
diff --git a/libvo/vosub_vidix.h b/libvo/vosub_vidix.h
index 128409e95a..7b05607de6 100644
--- a/libvo/vosub_vidix.h
+++ b/libvo/vosub_vidix.h
@@ -27,7 +27,7 @@
#include "video_out.h"
/* drvname can be NULL */
-int vidix_preinit(const char *drvname,vo_functions_t *server);
+int vidix_preinit(const char *drvname, struct vo_old_functions *server);
int vidix_init(unsigned src_width,unsigned src_height,
unsigned dest_x,unsigned dest_y,unsigned dst_width,
unsigned dst_height,unsigned format,unsigned dest_bpp,
@@ -35,7 +35,7 @@ int vidix_init(unsigned src_width,unsigned src_height,
int vidix_start(void);
int vidix_stop(void);
void vidix_term( void );
-uint32_t vidix_control(uint32_t request, void *data, ...);
+uint32_t vidix_control(uint32_t request, void *data);
uint32_t vidix_query_fourcc(uint32_t fourcc);
#include "vidix/vidix.h"
diff --git a/libvo/w32_common.c b/libvo/w32_common.c
index da8ed74695..3b5f97de29 100644
--- a/libvo/w32_common.c
+++ b/libvo/w32_common.c
@@ -21,6 +21,8 @@
#include <windows.h>
#include <windowsx.h>
+// To get "#define vo_ontop global_vo->opts->vo_ontop" etc
+#include "old_vo_defines.h"
#include "osdep/keycodes.h"
#include "input/input.h"
#include "input/mouse.h"
@@ -39,6 +41,7 @@ extern int enable_mouse_movements;
static const char classname[] = "MPlayer - The Movie Player";
int vo_vm = 0;
+static int depthonscreen;
// last non-fullscreen extends
static int prev_width;
static int prev_height;
@@ -118,7 +121,7 @@ static LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM l
xborder = (r.right - r.left) - wpos->cx;
yborder = (r.bottom - r.top) - wpos->cy;
wpos->cx -= xborder; wpos->cy -= yborder;
- aspect_fit(&wpos->cx, &wpos->cy, wpos->cx, wpos->cy);
+ aspect_fit(global_vo, &wpos->cx, &wpos->cy, wpos->cx, wpos->cy);
wpos->cx += xborder; wpos->cy += yborder;
}
return 0;
@@ -165,7 +168,7 @@ static LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM l
char cmd_str[40];
snprintf(cmd_str, sizeof(cmd_str), "set_mouse_pos %i %i",
GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam));
- mp_input_queue_cmd(mp_input_parse_cmd(cmd_str));
+ mp_input_queue_cmd(global_vo->input_ctx, mp_input_parse_cmd(cmd_str));
}
break;
case WM_MOUSEWHEEL:
@@ -285,7 +288,7 @@ static void updateScreenProperties(void) {
vo_screenwidth = dm.dmPelsWidth;
vo_screenheight = dm.dmPelsHeight;
- vo_depthonscreen = dm.dmBitsPerPel;
+ depthonscreen = dm.dmBitsPerPel;
w32_update_xinerama_info();
}
@@ -295,7 +298,7 @@ static void changeMode(void) {
dm.dmDriverExtra = 0;
dm.dmFields = DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT;
- dm.dmBitsPerPel = vo_depthonscreen;
+ dm.dmBitsPerPel = depthonscreen;
dm.dmPelsWidth = vo_screenwidth;
dm.dmPelsHeight = vo_screenheight;
@@ -305,7 +308,7 @@ static void changeMode(void) {
int i;
for (i = 0; EnumDisplaySettings(0, i, &dm); ++i) {
int score = (dm.dmPelsWidth - o_dwidth) * (dm.dmPelsHeight - o_dheight);
- if (dm.dmBitsPerPel != vo_depthonscreen) continue;
+ if (dm.dmBitsPerPel != depthonscreen) continue;
if (dm.dmPelsWidth < o_dwidth) continue;
if (dm.dmPelsHeight < o_dheight) continue;
@@ -395,7 +398,7 @@ static int createRenderingContext(void) {
SetPixelFormat(vo_hdc, pf, &pfd);
- mp_msg(MSGT_VO, MSGL_V, "vo: win32: running at %dx%d with depth %d\n", vo_screenwidth, vo_screenheight, vo_depthonscreen);
+ mp_msg(MSGT_VO, MSGL_V, "vo: win32: running at %dx%d with depth %d\n", vo_screenwidth, vo_screenheight, depthonscreen);
vo_w32_release_dc(vo_window, vo_hdc);
return 1;
@@ -581,7 +584,7 @@ void vo_w32_uninit(void) {
mp_msg(MSGT_VO, MSGL_V, "vo: win32: uninit\n");
resetMode();
ShowCursor(1);
- vo_depthonscreen = 0;
+ depthonscreen = 0;
if (dev_hdc) DeleteDC(dev_hdc);
dev_hdc = 0;
DestroyWindow(vo_window);
diff --git a/libvo/x11_common.c b/libvo/x11_common.c
index 5af4f19ac3..85ba55cc3f 100644
--- a/libvo/x11_common.c
+++ b/libvo/x11_common.c
@@ -23,10 +23,12 @@
#include <limits.h>
#include "config.h"
+#include "options.h"
#include "mp_msg.h"
#include "mp_fifo.h"
#include "libavutil/common.h"
#include "x11_common.h"
+#include "talloc.h"
#ifdef X11_FULLSCREEN
@@ -75,11 +77,6 @@
#include "input/input.h"
#include "input/mouse.h"
-#ifdef CONFIG_GUI
-#include "gui/interface.h"
-#include "mplayer.h"
-#endif
-
#define WIN_LAYER_ONBOTTOM 2
#define WIN_LAYER_NORMAL 4
#define WIN_LAYER_ONTOP 6
@@ -87,56 +84,26 @@
extern int enable_mouse_movements;
int fs_layer = WIN_LAYER_ABOVE_DOCK;
-static int orig_layer = 0;
-static int old_gravity = NorthWestGravity;
int stop_xscreensaver = 0;
static int dpms_disabled = 0;
char *mDisplayName = NULL;
-Display *mDisplay = NULL;
-Window mRootWin;
-int mScreen;
-int mLocalDisplay;
-
-/* output window id */
-int vo_mouse_autohide = 0;
-int vo_wm_type = 0;
-int vo_fs_type = 0; // needs to be accessible for GUI X11 code
-static int vo_fs_flip = 0;
+
char **vo_fstype_list;
/* 1 means that the WM is metacity (broken as hell) */
int metacity_hack = 0;
-static Atom XA_NET_SUPPORTED;
-static Atom XA_NET_WM_STATE;
-static Atom XA_NET_WM_STATE_FULLSCREEN;
-static Atom XA_NET_WM_STATE_ABOVE;
-static Atom XA_NET_WM_STATE_STAYS_ON_TOP;
-static Atom XA_NET_WM_STATE_BELOW;
-static Atom XA_NET_WM_PID;
-static Atom XA_WIN_PROTOCOLS;
-static Atom XA_WIN_LAYER;
-static Atom XA_WIN_HINTS;
-static Atom XAWM_PROTOCOLS;
-static Atom XAWM_DELETE_WINDOW;
-
-#define XA_INIT(x) XA##x = XInternAtom(mDisplay, #x, False)
-
-static int vo_old_x = 0;
-static int vo_old_y = 0;
-static int vo_old_width = 0;
-static int vo_old_height = 0;
-
#ifdef CONFIG_XF86VM
XF86VidModeModeInfo **vidmodes = NULL;
XF86VidModeModeLine modeline;
#endif
static int vo_x11_get_fs_type(int supported);
-
+static void saver_off(Display *);
+static void saver_on(Display *);
/*
* Sends the EWMH fullscreen state event.
@@ -145,12 +112,12 @@ static int vo_x11_get_fs_type(int supported);
* _NET_WM_STATE_ADD -- add state
* _NET_WM_STATE_TOGGLE -- toggle
*/
-void vo_x11_ewmh_fullscreen(int action)
+void vo_x11_ewmh_fullscreen(struct vo_x11_state *x11, int action)
{
assert(action == _NET_WM_STATE_REMOVE ||
action == _NET_WM_STATE_ADD || action == _NET_WM_STATE_TOGGLE);
- if (vo_fs_type & vo_wm_FULLSCREEN)
+ if (x11->fs_type & vo_wm_FULLSCREEN)
{
XEvent xev;
@@ -158,32 +125,32 @@ void vo_x11_ewmh_fullscreen(int action)
xev.xclient.type = ClientMessage;
xev.xclient.serial = 0;
xev.xclient.send_event = True;
- xev.xclient.message_type = XA_NET_WM_STATE;
- xev.xclient.window = vo_window;
+ xev.xclient.message_type = x11->XA_NET_WM_STATE;
+ xev.xclient.window = x11->window;
xev.xclient.format = 32;
xev.xclient.data.l[0] = action;
- xev.xclient.data.l[1] = XA_NET_WM_STATE_FULLSCREEN;
+ xev.xclient.data.l[1] = x11->XA_NET_WM_STATE_FULLSCREEN;
xev.xclient.data.l[2] = 0;
xev.xclient.data.l[3] = 0;
xev.xclient.data.l[4] = 0;
/* finally send that damn thing */
- if (!XSendEvent(mDisplay, DefaultRootWindow(mDisplay), False,
+ if (!XSendEvent(x11->display, DefaultRootWindow(x11->display), False,
SubstructureRedirectMask | SubstructureNotifyMask,
&xev))
{
- mp_msg(MSGT_VO, MSGL_ERR, MSGTR_EwmhFullscreenStateFailed);
+ mp_tmsg(MSGT_VO, MSGL_ERR, "\nX11: Couldn't send EWMH fullscreen event!\n");
}
}
}
-void vo_hidecursor(Display * disp, Window win)
+static void vo_hidecursor(Display * disp, Window win)
{
Cursor no_ptr;
Pixmap bm_no;
XColor black, dummy;
Colormap colormap;
- static char bm_no_data[] = { 0, 0, 0, 0, 0, 0, 0, 0 };
+ const char bm_no_data[] = { 0, 0, 0, 0, 0, 0, 0, 0 };
if (WinID == 0)
return; // do not hide if playing on the root window
@@ -202,7 +169,7 @@ void vo_hidecursor(Display * disp, Window win)
XFreeColors(disp,colormap,&black.pixel,1,0);
}
-void vo_showcursor(Display * disp, Window win)
+static void vo_showcursor(Display * disp, Window win)
{
if (WinID == 0)
return;
@@ -233,7 +200,7 @@ static int x11_errorhandler(Display * display, XErrorEvent * event)
void fstype_help(void)
{
- mp_msg(MSGT_VO, MSGL_INFO, MSGTR_AvailableFsType);
+ mp_tmsg(MSGT_VO, MSGL_INFO, "Available fullscreen layer change modes:\n");
mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_FULL_SCREEN_TYPES\n");
mp_msg(MSGT_VO, MSGL_INFO, " %-15s %s\n", "none",
@@ -278,9 +245,9 @@ static void fstype_dump(int fstype)
"[x11] Current fstype setting doesn't honour any X atoms\n");
}
-static int net_wm_support_state_test(Atom atom)
+static int net_wm_support_state_test(struct vo_x11_state *x11, Atom atom)
{
-#define NET_WM_STATE_TEST(x) { if (atom == XA_NET_WM_STATE_##x) { mp_msg( MSGT_VO,MSGL_V, "[x11] Detected wm supports " #x " state.\n" ); return vo_wm_##x; } }
+#define NET_WM_STATE_TEST(x) { if (atom == x11->XA_NET_WM_STATE_##x) { mp_msg( MSGT_VO,MSGL_V, "[x11] Detected wm supports " #x " state.\n" ); return vo_wm_##x; } }
NET_WM_STATE_TEST(FULLSCREEN);
NET_WM_STATE_TEST(ABOVE);
@@ -289,20 +256,22 @@ static int net_wm_support_state_test(Atom atom)
return 0;
}
-static int x11_get_property(Atom type, Atom ** args, unsigned long *nitems)
+static int x11_get_property(struct vo_x11_state *x11, Atom type, Atom ** args,
+ unsigned long *nitems)
{
int format;
unsigned long bytesafter;
return Success ==
- XGetWindowProperty(mDisplay, mRootWin, type, 0, 16384, False,
+ XGetWindowProperty(x11->display, x11->rootwin, type, 0, 16384, False,
AnyPropertyType, &type, &format, nitems,
&bytesafter, (unsigned char **) args)
&& *nitems > 0;
}
-static int vo_wm_detect(void)
+static int vo_wm_detect(struct vo *vo)
{
+ struct vo_x11_state *x11 = vo->x11;
int i;
int wm = 0;
unsigned long nitems;
@@ -312,12 +281,12 @@ static int vo_wm_detect(void)
return 0;
// -- supports layers
- if (x11_get_property(XA_WIN_PROTOCOLS, &args, &nitems))
+ if (x11_get_property(x11, x11->XA_WIN_PROTOCOLS, &args, &nitems))
{
mp_msg(MSGT_VO, MSGL_V, "[x11] Detected wm supports layers.\n");
for (i = 0; i < nitems; i++)
{
- if (args[i] == XA_WIN_LAYER)
+ if (args[i] == x11->XA_WIN_LAYER)
{
wm |= vo_wm_LAYER;
metacity_hack |= 1;
@@ -337,11 +306,11 @@ static int vo_wm_detect(void)
}
}
// --- netwm
- if (x11_get_property(XA_NET_SUPPORTED, &args, &nitems))
+ if (x11_get_property(x11, x11->XA_NET_SUPPORTED, &args, &nitems))
{
mp_msg(MSGT_VO, MSGL_V, "[x11] Detected wm supports NetWM.\n");
for (i = 0; i < nitems; i++)
- wm |= net_wm_support_state_test(args[i]);
+ wm |= net_wm_support_state_test(vo->x11, args[i]);
XFree(args);
}
@@ -350,7 +319,8 @@ static int vo_wm_detect(void)
return wm;
}
-static void init_atoms(void)
+#define XA_INIT(x) x11->XA##x = XInternAtom(x11->display, #x, False)
+static void init_atoms(struct vo_x11_state *x11)
{
XA_INIT(_NET_SUPPORTED);
XA_INIT(_NET_WM_STATE);
@@ -366,21 +336,22 @@ static void init_atoms(void)
XA_INIT(WM_DELETE_WINDOW);
}
-void update_xinerama_info(void) {
+void update_xinerama_info(struct vo *vo) {
+ struct MPOpts *opts = vo->opts;
int screen = xinerama_screen;
xinerama_x = xinerama_y = 0;
#ifdef CONFIG_XINERAMA
- if (screen >= -1 && XineramaIsActive(mDisplay))
+ if (screen >= -1 && XineramaIsActive(vo->x11->display))
{
XineramaScreenInfo *screens;
int num_screens;
- screens = XineramaQueryScreens(mDisplay, &num_screens);
+ screens = XineramaQueryScreens(vo->x11->display, &num_screens);
if (screen >= num_screens)
screen = num_screens - 1;
if (screen == -1) {
- int x = vo_dx + vo_dwidth / 2;
- int y = vo_dy + vo_dheight / 2;
+ int x = vo->dx + vo->dwidth / 2;
+ int y = vo->dy + vo->dheight / 2;
for (screen = num_screens - 1; screen > 0; screen--) {
int left = screens[screen].x_org;
int right = left + screens[screen].width;
@@ -392,19 +363,21 @@ void update_xinerama_info(void) {
}
if (screen < 0)
screen = 0;
- vo_screenwidth = screens[screen].width;
- vo_screenheight = screens[screen].height;
+ opts->vo_screenwidth = screens[screen].width;
+ opts->vo_screenheight = screens[screen].height;
xinerama_x = screens[screen].x_org;
xinerama_y = screens[screen].y_org;
XFree(screens);
}
#endif
- aspect_save_screenres(vo_screenwidth, vo_screenheight);
+ aspect_save_screenres(vo, opts->vo_screenwidth, opts->vo_screenheight);
}
-int vo_init(void)
+int vo_init(struct vo *vo)
{
+ struct MPOpts *opts = vo->opts;
+ struct vo_x11_state *x11 = vo->x11;
// int mScreen;
int depth, bpp;
unsigned int mask;
@@ -420,9 +393,9 @@ int vo_init(void)
if (vo_rootwin)
WinID = 0; // use root window
- if (vo_depthonscreen)
+ if (x11->depthonscreen)
{
- saver_off(mDisplay);
+ saver_off(x11->display);
return 1; // already called
}
@@ -438,52 +411,52 @@ int vo_init(void)
mp_msg(MSGT_VO, MSGL_V, "X11 opening display: %s\n", dispName);
- mDisplay = XOpenDisplay(dispName);
- if (!mDisplay)
+ x11->display = XOpenDisplay(dispName);
+ if (!x11->display)
{
mp_msg(MSGT_VO, MSGL_ERR,
"vo: couldn't open the X11 display (%s)!\n", dispName);
return 0;
}
- mScreen = DefaultScreen(mDisplay); // screen ID
- mRootWin = RootWindow(mDisplay, mScreen); // root window ID
+ x11->screen = DefaultScreen(x11->display); // screen ID
+ x11->rootwin = RootWindow(x11->display, x11->screen); // root window ID
- init_atoms();
+ init_atoms(vo->x11);
#ifdef CONFIG_XF86VM
{
int clock;
- XF86VidModeGetModeLine(mDisplay, mScreen, &clock, &modeline);
- if (!vo_screenwidth)
- vo_screenwidth = modeline.hdisplay;
- if (!vo_screenheight)
- vo_screenheight = modeline.vdisplay;
+ XF86VidModeGetModeLine(x11->display, x11->screen, &clock, &modeline);
+ if (!opts->vo_screenwidth)
+ opts->vo_screenwidth = modeline.hdisplay;
+ if (!opts->vo_screenheight)
+ opts->vo_screenheight = modeline.vdisplay;
}
#endif
{
- if (!vo_screenwidth)
- vo_screenwidth = DisplayWidth(mDisplay, mScreen);
- if (!vo_screenheight)
- vo_screenheight = DisplayHeight(mDisplay, mScreen);
+ if (!opts->vo_screenwidth)
+ opts->vo_screenwidth = DisplayWidth(x11->display, x11->screen);
+ if (!opts->vo_screenheight)
+ opts->vo_screenheight = DisplayHeight(x11->display, x11->screen);
}
// get color depth (from root window, or the best visual):
- XGetWindowAttributes(mDisplay, mRootWin, &attribs);
+ XGetWindowAttributes(x11->display, x11->rootwin, &attribs);
depth = attribs.depth;
if (depth != 15 && depth != 16 && depth != 24 && depth != 32)
{
Visual *visual;
- depth = vo_find_depth_from_visuals(mDisplay, mScreen, &visual);
+ depth = vo_find_depth_from_visuals(x11->display, x11->screen, &visual);
if (depth != -1)
- mXImage = XCreateImage(mDisplay, visual, depth, ZPixmap,
+ mXImage = XCreateImage(x11->display, visual, depth, ZPixmap,
0, NULL, 1, 1, 8, 1);
} else
mXImage =
- XGetImage(mDisplay, mRootWin, 0, 0, 1, 1, AllPlanes, ZPixmap);
+ XGetImage(x11->display, x11->rootwin, 0, 0, 1, 1, AllPlanes, ZPixmap);
- vo_depthonscreen = depth; // display depth on screen
+ x11->depthonscreen = depth; // display depth on screen
// get bits/pixel from XImage structure:
if (mXImage == NULL)
@@ -493,15 +466,15 @@ int vo_init(void)
{
/*
* for the depth==24 case, the XImage structures might use
- * 24 or 32 bits of data per pixel. The global variable
- * vo_depthonscreen stores the amount of data per pixel in the
+ * 24 or 32 bits of data per pixel. The x11->depthonscreen
+ * field stores the amount of data per pixel in the
* XImage structure!
*
* Maybe we should rename vo_depthonscreen to (or add) vo_bpp?
*/
bpp = mXImage->bits_per_pixel;
- if ((vo_depthonscreen + 7) / 8 != (bpp + 7) / 8)
- vo_depthonscreen = bpp; // by A'rpi
+ if ((x11->depthonscreen + 7) / 8 != (bpp + 7) / 8)
+ x11->depthonscreen = bpp; // by A'rpi
mask =
mXImage->red_mask | mXImage->green_mask | mXImage->blue_mask;
mp_msg(MSGT_VO, MSGL_V,
@@ -509,12 +482,12 @@ int vo_init(void)
mXImage->red_mask, mXImage->green_mask, mXImage->blue_mask);
XDestroyImage(mXImage);
}
- if (((vo_depthonscreen + 7) / 8) == 2)
+ if (((x11->depthonscreen + 7) / 8) == 2)
{
if (mask == 0x7FFF)
- vo_depthonscreen = 15;
+ x11->depthonscreen = 15;
else if (mask == 0xFFFF)
- vo_depthonscreen = 16;
+ x11->depthonscreen = 16;
}
// XCloseDisplay( mDisplay );
/* slightly improved local display detection AST */
@@ -523,38 +496,38 @@ int vo_init(void)
else if (strncmp(dispName, "localhost:", 10) == 0)
dispName += 9;
if (*dispName == ':' && atoi(dispName + 1) < 10)
- mLocalDisplay = 1;
+ x11->display_is_local = 1;
else
- mLocalDisplay = 0;
+ x11->display_is_local = 0;
mp_msg(MSGT_VO, MSGL_V,
"vo: X11 running at %dx%d with depth %d and %d bpp (\"%s\" => %s display)\n",
- vo_screenwidth, vo_screenheight, depth, vo_depthonscreen,
- dispName, mLocalDisplay ? "local" : "remote");
+ opts->vo_screenwidth, opts->vo_screenheight, depth, x11->depthonscreen,
+ dispName, x11->display_is_local ? "local" : "remote");
- vo_wm_type = vo_wm_detect();
+ x11->wm_type = vo_wm_detect(vo);
- vo_fs_type = vo_x11_get_fs_type(vo_wm_type);
+ x11->fs_type = vo_x11_get_fs_type(x11->wm_type);
- fstype_dump(vo_fs_type);
+ fstype_dump(x11->fs_type);
- saver_off(mDisplay);
+ saver_off(x11->display);
return 1;
}
-void vo_uninit(void)
+void vo_uninit(struct vo_x11_state *x11)
{
- if (!mDisplay)
+ if (!x11->display)
{
mp_msg(MSGT_VO, MSGL_V,
"vo: x11 uninit called but X11 not initialized..\n");
- return;
+ } else {
+ mp_msg(MSGT_VO, MSGL_V, "vo: uninit ...\n");
+ XSetErrorHandler(NULL);
+ XCloseDisplay(x11->display);
+ x11->depthonscreen = 0;
+ x11->display = NULL;
}
-// if( !vo_depthonscreen ) return;
- mp_msg(MSGT_VO, MSGL_V, "vo: uninit ...\n");
- XSetErrorHandler(NULL);
- XCloseDisplay(mDisplay);
- vo_depthonscreen = 0;
- mDisplay = NULL;
+ talloc_free(x11);
}
#include "osdep/keycodes.h"
@@ -569,11 +542,12 @@ static const struct keymap keysym_map[] = {
{0, 0}
};
-static void vo_x11_putkey_ext(int keysym)
+static void vo_x11_putkey_ext(struct vo *vo, int keysym)
{
+ struct mp_fifo *f = vo->key_fifo;
int mpkey = lookup_keymap_table(keysym_map, keysym);
if (mpkey)
- mplayer_put_key(mpkey);
+ mplayer_put_key(f, mpkey);
}
#endif
@@ -612,7 +586,7 @@ static const struct keymap keymap[] = {
{0, 0}
};
-void vo_x11_putkey(int key)
+void vo_x11_putkey(struct vo *vo, int key)
{
static const char *passthrough_keys = " -+*/<>`~!@#$%^&()_{}:;\"\',.?\\|=[]";
int mpkey = 0;
@@ -626,7 +600,7 @@ void vo_x11_putkey(int key)
mpkey = lookup_keymap_table(keymap, key);
if (mpkey)
- mplayer_put_key(mpkey);
+ mplayer_put_key(vo->key_fifo, mpkey);
}
@@ -672,12 +646,9 @@ typedef struct
static MotifWmHints vo_MotifWmHints;
static Atom vo_MotifHints = None;
-void vo_x11_decoration(Display * vo_Display, Window w, int d)
+void vo_x11_decoration(struct vo *vo, int d)
{
- static unsigned int olddecor = MWM_DECOR_ALL;
- static unsigned int oldfuncs =
- MWM_FUNC_MOVE | MWM_FUNC_CLOSE | MWM_FUNC_MINIMIZE |
- MWM_FUNC_MAXIMIZE | MWM_FUNC_RESIZE;
+ struct vo_x11_state *x11 = vo->x11;
Atom mtype;
int mformat;
unsigned long mn, mb;
@@ -687,26 +658,27 @@ void vo_x11_decoration(Display * vo_Display, Window w, int d)
if (vo_fsmode & 8)
{
- XSetTransientForHint(vo_Display, w,
- RootWindow(vo_Display, mScreen));
+ XSetTransientForHint(x11->display, x11->window,
+ RootWindow(x11->display, x11->screen));
}
- vo_MotifHints = XInternAtom(vo_Display, "_MOTIF_WM_HINTS", 0);
+ vo_MotifHints = XInternAtom(x11->display, "_MOTIF_WM_HINTS", 0);
if (vo_MotifHints != None)
{
if (!d)
{
MotifWmHints *mhints = NULL;
- XGetWindowProperty(vo_Display, w, vo_MotifHints, 0, 20, False,
+ XGetWindowProperty(x11->display, x11->window,
+ vo_MotifHints, 0, 20, False,
vo_MotifHints, &mtype, &mformat, &mn,
&mb, (unsigned char **) &mhints);
if (mhints)
{
if (mhints->flags & MWM_HINTS_DECORATIONS)
- olddecor = mhints->decorations;
+ x11->olddecor = mhints->decorations;
if (mhints->flags & MWM_HINTS_FUNCTIONS)
- oldfuncs = mhints->functions;
+ x11->oldfuncs = mhints->functions;
XFree(mhints);
}
}
@@ -716,8 +688,8 @@ void vo_x11_decoration(Display * vo_Display, Window w, int d)
MWM_HINTS_FUNCTIONS | MWM_HINTS_DECORATIONS;
if (d)
{
- vo_MotifWmHints.functions = oldfuncs;
- d = olddecor;
+ vo_MotifWmHints.functions = x11->oldfuncs;
+ d = x11->olddecor;
}
#if 0
vo_MotifWmHints.decorations =
@@ -726,113 +698,89 @@ void vo_x11_decoration(Display * vo_Display, Window w, int d)
vo_MotifWmHints.decorations =
d | ((vo_fsmode & 2) ? MWM_DECOR_MENU : 0);
#endif
- XChangeProperty(vo_Display, w, vo_MotifHints, vo_MotifHints, 32,
+ XChangeProperty(x11->display, x11->window, vo_MotifHints,
+ vo_MotifHints, 32,
PropModeReplace,
(unsigned char *) &vo_MotifWmHints,
(vo_fsmode & 4) ? 4 : 5);
}
}
-void vo_x11_classhint(Display * display, Window window, const char *name)
+void vo_x11_classhint(struct vo *vo, Window window, const char *name)
{
+ struct vo_x11_state *x11 = vo->x11;
XClassHint wmClass;
pid_t pid = getpid();
wmClass.res_name = vo_winname ? vo_winname : name;
wmClass.res_class = "MPlayer";
- XSetClassHint(display, window, &wmClass);
- XChangeProperty(display, window, XA_NET_WM_PID, XA_CARDINAL, 32,
- PropModeReplace, (unsigned char *) &pid, 1);
+ XSetClassHint(x11->display, window, &wmClass);
+ XChangeProperty(x11->display, window, x11->XA_NET_WM_PID, XA_CARDINAL,
+ 32, PropModeReplace, (unsigned char *) &pid, 1);
}
-Window vo_window = None;
-GC vo_gc = NULL;
-GC f_gc = NULL;
-XSizeHints vo_hint;
-
-#ifdef CONFIG_GUI
-void vo_setwindow(Window w, GC g)
+void vo_x11_uninit(struct vo *vo)
{
- vo_window = w;
- vo_gc = g;
-}
-#endif
+ struct vo_x11_state *x11 = vo->x11;
+ saver_on(x11->display);
+ if (x11->window != None)
+ vo_showcursor(x11->display, x11->window);
-void vo_x11_uninit(void)
-{
- saver_on(mDisplay);
- if (vo_window != None)
- vo_showcursor(mDisplay, vo_window);
-
- if (f_gc)
+ if (x11->f_gc)
{
- XFreeGC(mDisplay, f_gc);
- f_gc = NULL;
+ XFreeGC(vo->x11->display, x11->f_gc);
+ x11->f_gc = NULL;
}
-#ifdef CONFIG_GUI
- /* destroy window only if it's not controlled by the GUI */
- if (!use_gui)
-#endif
{
- if (vo_gc)
+ if (x11->vo_gc)
{
- XSetBackground(mDisplay, vo_gc, 0);
- XFreeGC(mDisplay, vo_gc);
- vo_gc = NULL;
+ XSetBackground(vo->x11->display, x11->vo_gc, 0);
+ XFreeGC(vo->x11->display, x11->vo_gc);
+ x11->vo_gc = NULL;
}
- if (vo_window != None)
+ if (x11->window != None)
{
- XClearWindow(mDisplay, vo_window);
+ XClearWindow(x11->display, x11->window);
if (WinID < 0)
{
XEvent xev;
- XUnmapWindow(mDisplay, vo_window);
- XDestroyWindow(mDisplay, vo_window);
+ XUnmapWindow(x11->display, x11->window);
+ XDestroyWindow(x11->display, x11->window);
do
{
- XNextEvent(mDisplay, &xev);
+ XNextEvent(x11->display, &xev);
}
while (xev.type != DestroyNotify
- || xev.xdestroywindow.event != vo_window);
+ || xev.xdestroywindow.event != x11->window);
}
- vo_window = None;
+ x11->window = None;
}
vo_fs = 0;
- vo_old_width = vo_old_height = 0;
+ x11->vo_old_width = x11->vo_old_height = 0;
}
}
-static unsigned int mouse_timer;
-static int mouse_waiting_hide;
-
-int vo_x11_check_events(Display * mydisplay)
+int vo_x11_check_events(struct vo *vo)
{
+ struct vo_x11_state *x11 = vo->x11;
+ Display *display = vo->x11->display;
int ret = 0;
XEvent Event;
char buf[100];
KeySym keySym;
- static XComposeStatus stat;
// unsigned long vo_KeyTable[512];
- if ((vo_mouse_autohide) && mouse_waiting_hide &&
- (GetTimerMS() - mouse_timer >= 1000)) {
- vo_hidecursor(mydisplay, vo_window);
- mouse_waiting_hide = 0;
+ if ((x11->vo_mouse_autohide) && x11->mouse_waiting_hide &&
+ (GetTimerMS() - x11->mouse_timer >= 1000)) {
+ vo_hidecursor(display, x11->window);
+ x11->mouse_waiting_hide = 0;
}
- while (XPending(mydisplay))
+ while (XPending(display))
{
- XNextEvent(mydisplay, &Event);
-#ifdef CONFIG_GUI
- if (use_gui)
- {
- guiGetEvent(0, (char *) &Event);
- if (vo_window != Event.xany.window)
- continue;
- }
-#endif
+ XNextEvent(display, &Event);
// printf("\rEvent.type=%X \n",Event.type);
switch (Event.type)
{
@@ -840,15 +788,12 @@ int vo_x11_check_events(Display * mydisplay)
ret |= VO_EVENT_EXPOSE;
break;
case ConfigureNotify:
-// if (!vo_fs && (Event.xconfigure.width == vo_screenwidth || Event.xconfigure.height == vo_screenheight)) break;
-// if (vo_fs && Event.xconfigure.width != vo_screenwidth && Event.xconfigure.height != vo_screenheight) break;
- if (vo_window == None)
+ if (x11->window == None)
break;
{
- int old_w = vo_dwidth, old_h = vo_dheight;
- int old_x = vo_dx, old_y = vo_dy;
- vo_x11_update_geometry();
- if (vo_dwidth != old_w || vo_dheight != old_h || vo_dx != old_x || vo_dy != old_y)
+ int old_w = vo->dwidth, old_h = vo->dheight;
+ vo_x11_update_geometry(vo);
+ if (vo->dwidth != old_w || vo->dheight != old_h)
ret |= VO_EVENT_RESIZE;
}
break;
@@ -856,19 +801,15 @@ int vo_x11_check_events(Display * mydisplay)
{
int key;
-#ifdef CONFIG_GUI
- if ( use_gui ) { break; }
-#endif
-
XLookupString(&Event.xkey, buf, sizeof(buf), &keySym,
- &stat);
+ &x11->compose_status);
#ifdef XF86XK_AudioPause
- vo_x11_putkey_ext(keySym);
+ vo_x11_putkey_ext(vo, keySym);
#endif
key =
((keySym & 0xff00) !=
0 ? ((keySym & 0x00ff) + 256) : (keySym));
- vo_x11_putkey(key);
+ vo_x11_putkey(vo, key);
ret |= VO_EVENT_KEYPRESS;
}
break;
@@ -877,51 +818,42 @@ int vo_x11_check_events(Display * mydisplay)
{
char cmd_str[40];
sprintf(cmd_str,"set_mouse_pos %i %i",Event.xmotion.x, Event.xmotion.y);
- mp_input_queue_cmd(mp_input_parse_cmd(cmd_str));
+ mp_input_queue_cmd(vo->input_ctx,
+ mp_input_parse_cmd(cmd_str));
}
- if (vo_mouse_autohide)
+ if (x11->vo_mouse_autohide)
{
- vo_showcursor(mydisplay, vo_window);
- mouse_waiting_hide = 1;
- mouse_timer = GetTimerMS();
+ vo_showcursor(display, x11->window);
+ x11->mouse_waiting_hide = 1;
+ x11->mouse_timer = GetTimerMS();
}
break;
case ButtonPress:
- if (vo_mouse_autohide)
+ if (x11->vo_mouse_autohide)
{
- vo_showcursor(mydisplay, vo_window);
- mouse_waiting_hide = 1;
- mouse_timer = GetTimerMS();
+ vo_showcursor(display, x11->window);
+ x11->mouse_waiting_hide = 1;
+ x11->mouse_timer = GetTimerMS();
}
-#ifdef CONFIG_GUI
- // Ignore mouse button 1-3 under GUI.
- if (use_gui && (Event.xbutton.button >= 1)
- && (Event.xbutton.button <= 3))
- break;
-#endif
- mplayer_put_key((MOUSE_BTN0 + Event.xbutton.button -
- 1) | MP_KEY_DOWN);
+ mplayer_put_key(vo->key_fifo,
+ (MOUSE_BTN0 + Event.xbutton.button - 1)
+ | MP_KEY_DOWN);
break;
case ButtonRelease:
- if (vo_mouse_autohide)
+ if (x11->vo_mouse_autohide)
{
- vo_showcursor(mydisplay, vo_window);
- mouse_waiting_hide = 1;
- mouse_timer = GetTimerMS();
+ vo_showcursor(display, x11->window);
+ x11->mouse_waiting_hide = 1;
+ x11->mouse_timer = GetTimerMS();
}
-#ifdef CONFIG_GUI
- // Ignore mouse button 1-3 under GUI.
- if (use_gui && (Event.xbutton.button >= 1)
- && (Event.xbutton.button <= 3))
- break;
-#endif
- mplayer_put_key(MOUSE_BTN0 + Event.xbutton.button - 1);
+ mplayer_put_key(vo->key_fifo,
+ MOUSE_BTN0 + Event.xbutton.button - 1);
break;
case PropertyNotify:
{
char *name =
- XGetAtomName(mydisplay, Event.xproperty.atom);
+ XGetAtomName(display, Event.xproperty.atom);
if (!name)
break;
@@ -932,14 +864,14 @@ int vo_x11_check_events(Display * mydisplay)
}
break;
case MapNotify:
- vo_hint.win_gravity = old_gravity;
- XSetWMNormalHints(mDisplay, vo_window, &vo_hint);
- vo_fs_flip = 0;
+ x11->vo_hint.win_gravity = x11->old_gravity;
+ XSetWMNormalHints(display, x11->window, &x11->vo_hint);
+ x11->fs_flip = 0;
break;
case ClientMessage:
- if (Event.xclient.message_type == XAWM_PROTOCOLS &&
- Event.xclient.data.l[0] == XAWM_DELETE_WINDOW)
- mplayer_put_key(KEY_CLOSE_WIN);
+ if (Event.xclient.message_type == x11->XAWM_PROTOCOLS &&
+ Event.xclient.data.l[0] == x11->XAWM_DELETE_WINDOW)
+ mplayer_put_key(vo->key_fifo, KEY_CLOSE_WIN);
break;
}
}
@@ -949,69 +881,76 @@ int vo_x11_check_events(Display * mydisplay)
/**
* \brief sets the size and position of the non-fullscreen window.
*/
-void vo_x11_nofs_sizepos(int x, int y, int width, int height)
+static void vo_x11_nofs_sizepos(struct vo *vo, int x, int y,
+ int width, int height)
{
- vo_x11_sizehint(x, y, width, height, 0);
+ struct vo_x11_state *x11 = vo->x11;
+ vo_x11_sizehint(vo, x, y, width, height, 0);
if (vo_fs) {
- vo_old_x = x;
- vo_old_y = y;
- vo_old_width = width;
- vo_old_height = height;
+ x11->vo_old_x = x;
+ x11->vo_old_y = y;
+ x11->vo_old_width = width;
+ x11->vo_old_height = height;
}
else
{
- vo_dwidth = width;
- vo_dheight = height;
- XMoveResizeWindow(mDisplay, vo_window, x, y, width, height);
+ vo->dwidth = width;
+ vo->dheight = height;
+ if (vo->opts->force_window_position)
+ XMoveResizeWindow(vo->x11->display, vo->x11->window, x, y, width,
+ height);
+ else
+ XResizeWindow(vo->x11->display, vo->x11->window, width, height);
}
}
-void vo_x11_sizehint(int x, int y, int width, int height, int max)
+void vo_x11_sizehint(struct vo *vo, int x, int y, int width, int height, int max)
{
- vo_hint.flags = 0;
+ struct vo_x11_state *x11 = vo->x11;
+ x11->vo_hint.flags = 0;
if (vo_keepaspect)
{
- vo_hint.flags |= PAspect;
- vo_hint.min_aspect.x = width;
- vo_hint.min_aspect.y = height;
- vo_hint.max_aspect.x = width;
- vo_hint.max_aspect.y = height;
+ x11->vo_hint.flags |= PAspect;
+ x11->vo_hint.min_aspect.x = width;
+ x11->vo_hint.min_aspect.y = height;
+ x11->vo_hint.max_aspect.x = width;
+ x11->vo_hint.max_aspect.y = height;
}
- vo_hint.flags |= PPosition | PSize;
- vo_hint.x = x;
- vo_hint.y = y;
- vo_hint.width = width;
- vo_hint.height = height;
+ x11->vo_hint.flags |= PPosition | PSize;
+ x11->vo_hint.x = x;
+ x11->vo_hint.y = y;
+ x11->vo_hint.width = width;
+ x11->vo_hint.height = height;
if (max)
{
- vo_hint.flags |= PMaxSize;
- vo_hint.max_width = width;
- vo_hint.max_height = height;
+ x11->vo_hint.flags |= PMaxSize;
+ x11->vo_hint.max_width = width;
+ x11->vo_hint.max_height = height;
} else
{
- vo_hint.max_width = 0;
- vo_hint.max_height = 0;
+ x11->vo_hint.max_width = 0;
+ x11->vo_hint.max_height = 0;
}
// Set minimum height/width to 4 to avoid off-by-one errors
// and because mga_vid requires a minimal size of 4 pixels.
- vo_hint.flags |= PMinSize;
- vo_hint.min_width = vo_hint.min_height = 4;
+ x11->vo_hint.flags |= PMinSize;
+ x11->vo_hint.min_width = x11->vo_hint.min_height = 4;
// Set the base size. A window manager might display the window
// size to the user relative to this.
// Setting these to width/height might be nice, but e.g. fluxbox can't handle it.
- vo_hint.flags |= PBaseSize;
- vo_hint.base_width = 0 /*width*/;
- vo_hint.base_height = 0 /*height*/;
+ x11->vo_hint.flags |= PBaseSize;
+ x11->vo_hint.base_width = 0 /*width*/;
+ x11->vo_hint.base_height = 0 /*height*/;
- vo_hint.flags |= PWinGravity;
- vo_hint.win_gravity = StaticGravity;
- XSetWMNormalHints(mDisplay, vo_window, &vo_hint);
+ x11->vo_hint.flags |= PWinGravity;
+ x11->vo_hint.win_gravity = StaticGravity;
+ XSetWMNormalHints(x11->display, x11->window, &x11->vo_hint);
}
-static int vo_x11_get_gnome_layer(Display * mDisplay, Window win)
+static int vo_x11_get_gnome_layer(struct vo_x11_state *x11, Window win)
{
Atom type;
int format;
@@ -1019,7 +958,7 @@ static int vo_x11_get_gnome_layer(Display * mDisplay, Window win)
unsigned long bytesafter;
unsigned short *args = NULL;
- if (XGetWindowProperty(mDisplay, win, XA_WIN_LAYER, 0, 16384,
+ if (XGetWindowProperty(x11->display, win, x11->XA_WIN_LAYER, 0, 16384,
False, AnyPropertyType, &type, &format, &nitems,
&bytesafter,
(unsigned char **) &args) == Success
@@ -1033,7 +972,7 @@ static int vo_x11_get_gnome_layer(Display * mDisplay, Window win)
}
//
-Window vo_x11_create_smooth_window(Display * mDisplay, Window mRoot,
+static Window vo_x11_create_smooth_window(struct vo_x11_state *x11, Window mRoot,
Visual * vis, int x, int y,
unsigned int width, unsigned int height,
int depth, Colormap col_map)
@@ -1053,12 +992,12 @@ Window vo_x11_create_smooth_window(Display * mDisplay, Window mRoot,
xswa.bit_gravity = StaticGravity;
ret_win =
- XCreateWindow(mDisplay, mRootWin, x, y, width, height, 0, depth,
+ XCreateWindow(x11->display, x11->rootwin, x, y, width, height, 0, depth,
CopyFromParent, vis, xswamask, &xswa);
- XSetWMProtocols(mDisplay, ret_win, &XAWM_DELETE_WINDOW, 1);
- if (!f_gc)
- f_gc = XCreateGC(mDisplay, ret_win, 0, 0);
- XSetForeground(mDisplay, f_gc, 0);
+ XSetWMProtocols(x11->display, ret_win, &x11->XAWM_DELETE_WINDOW, 1);
+ if (!x11->f_gc)
+ x11->f_gc = XCreateGC(x11->display, ret_win, 0, 0);
+ XSetForeground(x11->display, x11->f_gc, 0);
return ret_win;
}
@@ -1079,171 +1018,180 @@ Window vo_x11_create_smooth_window(Display * mDisplay, Window mRoot,
* This also does the grunt-work like setting Window Manager hints etc.
* If vo_window is already set it just moves and resizes it.
*/
-void vo_x11_create_vo_window(XVisualInfo *vis, int x, int y,
+void vo_x11_create_vo_window(struct vo *vo, XVisualInfo *vis, int x, int y,
unsigned int width, unsigned int height, int flags,
Colormap col_map,
const char *classname, const char *title)
{
+ struct MPOpts *opts = vo->opts;
+ struct vo_x11_state *x11 = vo->x11;
+ Display *mDisplay = vo->x11->display;
XGCValues xgcv;
if (WinID >= 0) {
vo_fs = flags & VOFLAG_FULLSCREEN;
- vo_window = WinID ? (Window)WinID : mRootWin;
+ x11->window = WinID ? (Window)WinID : x11->rootwin;
if (col_map != CopyFromParent) {
unsigned long xswamask = CWColormap;
XSetWindowAttributes xswa;
xswa.colormap = col_map;
- XChangeWindowAttributes(mDisplay, vo_window, xswamask, &xswa);
+ XChangeWindowAttributes(mDisplay, x11->window, xswamask, &xswa);
XInstallColormap(mDisplay, col_map);
}
- if (WinID) vo_x11_update_geometry();
- vo_x11_selectinput_witherr(mDisplay, vo_window,
+ if (WinID) vo_x11_update_geometry(vo);
+ vo_x11_selectinput_witherr(mDisplay, x11->window,
StructureNotifyMask | KeyPressMask | PointerMotionMask |
ButtonPressMask | ButtonReleaseMask | ExposureMask);
goto final;
}
- if (vo_window == None) {
+ if (x11->window == None) {
XSizeHints hint;
XEvent xev;
vo_fs = 0;
- vo_dwidth = width;
- vo_dheight = height;
- vo_window = vo_x11_create_smooth_window(mDisplay, mRootWin, vis->visual,
+ vo->dwidth = width;
+ vo->dheight = height;
+ x11->window = vo_x11_create_smooth_window(x11, x11->rootwin, vis->visual,
x, y, width, height, vis->depth, col_map);
- vo_x11_classhint(mDisplay, vo_window, classname);
- XStoreName(mDisplay, vo_window, title);
- vo_hidecursor(mDisplay, vo_window);
- XSelectInput(mDisplay, vo_window, StructureNotifyMask);
+ vo_x11_classhint(vo, x11->window, classname);
+ XStoreName(mDisplay, x11->window, title);
+ vo_hidecursor(mDisplay, x11->window);
+ XSelectInput(mDisplay, x11->window, StructureNotifyMask);
hint.x = x; hint.y = y;
hint.width = width; hint.height = height;
hint.flags = PPosition | PSize;
- XSetStandardProperties(mDisplay, vo_window, title, title, None, NULL, 0, &hint);
- vo_x11_sizehint(x, y, width, height, 0);
- if (!vo_border) vo_x11_decoration(mDisplay, vo_window, 0);
+ XSetStandardProperties(mDisplay, x11->window, title, title, None, NULL, 0, &hint);
+ vo_x11_sizehint(vo, x, y, width, height, 0);
+ if (!vo_border) vo_x11_decoration(vo, 0);
// map window
- XMapWindow(mDisplay, vo_window);
- XClearWindow(mDisplay, vo_window);
+ XMapWindow(mDisplay, x11->window);
+ XClearWindow(mDisplay, x11->window);
// wait for map
do {
XNextEvent(mDisplay, &xev);
- } while (xev.type != MapNotify || xev.xmap.event != vo_window);
- XSelectInput(mDisplay, vo_window, NoEventMask);
+ } while (xev.type != MapNotify || xev.xmap.event != x11->window);
+ XSelectInput(mDisplay, x11->window, NoEventMask);
XSync(mDisplay, False);
- vo_x11_selectinput_witherr(mDisplay, vo_window,
+ vo_x11_selectinput_witherr(mDisplay, x11->window,
StructureNotifyMask | KeyPressMask | PointerMotionMask |
ButtonPressMask | ButtonReleaseMask | ExposureMask);
}
- if (vo_ontop) vo_x11_setlayer(mDisplay, vo_window, vo_ontop);
- vo_x11_nofs_sizepos(vo_dx, vo_dy, width, height);
+ if (opts->vo_ontop) vo_x11_setlayer(vo, x11->window, opts->vo_ontop);
+ vo_x11_nofs_sizepos(vo, vo->dx, vo->dy, width, height);
if (!!vo_fs != !!(flags & VOFLAG_FULLSCREEN))
- vo_x11_fullscreen();
+ vo_x11_fullscreen(vo);
else if (vo_fs) {
// if we are already in fullscreen do not switch back and forth, just
// set the size values right.
- vo_dwidth = vo_screenwidth;
- vo_dheight = vo_screenheight;
+ vo->dwidth = vo->opts->vo_screenwidth;
+ vo->dheight = vo->opts->vo_screenheight;
}
final:
- if (vo_gc != None)
- XFreeGC(mDisplay, vo_gc);
- vo_gc = XCreateGC(mDisplay, vo_window, GCForeground, &xgcv);
+ if (x11->vo_gc != None)
+ XFreeGC(mDisplay, x11->vo_gc);
+ x11->vo_gc = XCreateGC(mDisplay, x11->window, GCForeground, &xgcv);
XSync(mDisplay, False);
- vo_mouse_autohide = 1;
+ x11->vo_mouse_autohide = 1;
}
-void vo_x11_clearwindow_part(Display * mDisplay, Window vo_window,
+void vo_x11_clearwindow_part(struct vo *vo, Window vo_window,
int img_width, int img_height, int use_fs)
{
+ struct vo_x11_state *x11 = vo->x11;
+ struct MPOpts *opts = vo->opts;
+ Display *mDisplay = vo->x11->display;
int u_dheight, u_dwidth, left_ov, left_ov2;
- if (!f_gc)
+ if (!x11->f_gc)
return;
- u_dheight = use_fs ? vo_screenheight : vo_dheight;
- u_dwidth = use_fs ? vo_screenwidth : vo_dwidth;
+ u_dheight = use_fs ? opts->vo_screenheight : vo->dheight;
+ u_dwidth = use_fs ? opts->vo_screenwidth : vo->dwidth;
if ((u_dheight <= img_height) && (u_dwidth <= img_width))
return;
left_ov = (u_dheight - img_height) / 2;
left_ov2 = (u_dwidth - img_width) / 2;
- XFillRectangle(mDisplay, vo_window, f_gc, 0, 0, u_dwidth, left_ov);
- XFillRectangle(mDisplay, vo_window, f_gc, 0, u_dheight - left_ov - 1,
+ XFillRectangle(mDisplay, vo_window, x11->f_gc, 0, 0, u_dwidth, left_ov);
+ XFillRectangle(mDisplay, vo_window, x11->f_gc, 0, u_dheight - left_ov - 1,
u_dwidth, left_ov + 1);
if (u_dwidth > img_width)
{
- XFillRectangle(mDisplay, vo_window, f_gc, 0, left_ov, left_ov2,
+ XFillRectangle(mDisplay, vo_window, x11->f_gc, 0, left_ov, left_ov2,
img_height);
- XFillRectangle(mDisplay, vo_window, f_gc, u_dwidth - left_ov2 - 1,
+ XFillRectangle(mDisplay, vo_window, x11->f_gc, u_dwidth - left_ov2 - 1,
left_ov, left_ov2 + 1, img_height);
}
XFlush(mDisplay);
}
-void vo_x11_clearwindow(Display * mDisplay, Window vo_window)
+void vo_x11_clearwindow(struct vo *vo, Window vo_window)
{
- if (!f_gc)
+ struct vo_x11_state *x11 = vo->x11;
+ struct MPOpts *opts = vo->opts;
+ if (!x11->f_gc)
return;
- XFillRectangle(mDisplay, vo_window, f_gc, 0, 0, vo_screenwidth,
- vo_screenheight);
+ XFillRectangle(x11->display, vo_window, x11->f_gc, 0, 0,
+ opts->vo_screenwidth, opts->vo_screenheight);
//
- XFlush(mDisplay);
+ XFlush(x11->display);
}
-void vo_x11_setlayer(Display * mDisplay, Window vo_window, int layer)
+void vo_x11_setlayer(struct vo *vo, Window vo_window, int layer)
{
+ struct vo_x11_state *x11 = vo->x11;
if (WinID >= 0)
return;
- if (vo_fs_type & vo_wm_LAYER)
+ if (x11->fs_type & vo_wm_LAYER)
{
XClientMessageEvent xev;
- if (!orig_layer)
- orig_layer = vo_x11_get_gnome_layer(mDisplay, vo_window);
+ if (!x11->orig_layer)
+ x11->orig_layer = vo_x11_get_gnome_layer(x11, vo_window);
memset(&xev, 0, sizeof(xev));
xev.type = ClientMessage;
- xev.display = mDisplay;
+ xev.display = x11->display;
xev.window = vo_window;
- xev.message_type = XA_WIN_LAYER;
+ xev.message_type = x11->XA_WIN_LAYER;
xev.format = 32;
- xev.data.l[0] = layer ? fs_layer : orig_layer; // if not fullscreen, stay on default layer
+ xev.data.l[0] = layer ? fs_layer : x11->orig_layer; // if not fullscreen, stay on default layer
xev.data.l[1] = CurrentTime;
mp_msg(MSGT_VO, MSGL_V,
"[x11] Layered style stay on top (layer %ld).\n",
xev.data.l[0]);
- XSendEvent(mDisplay, mRootWin, False, SubstructureNotifyMask,
+ XSendEvent(x11->display, x11->rootwin, False, SubstructureNotifyMask,
(XEvent *) & xev);
- } else if (vo_fs_type & vo_wm_NETWM)
+ } else if (x11->fs_type & vo_wm_NETWM)
{
XClientMessageEvent xev;
char *state;
memset(&xev, 0, sizeof(xev));
xev.type = ClientMessage;
- xev.message_type = XA_NET_WM_STATE;
- xev.display = mDisplay;
+ xev.message_type = x11->XA_NET_WM_STATE;
+ xev.display = x11->display;
xev.window = vo_window;
xev.format = 32;
xev.data.l[0] = layer;
- if (vo_fs_type & vo_wm_STAYS_ON_TOP)
- xev.data.l[1] = XA_NET_WM_STATE_STAYS_ON_TOP;
- else if (vo_fs_type & vo_wm_ABOVE)
- xev.data.l[1] = XA_NET_WM_STATE_ABOVE;
- else if (vo_fs_type & vo_wm_FULLSCREEN)
- xev.data.l[1] = XA_NET_WM_STATE_FULLSCREEN;
- else if (vo_fs_type & vo_wm_BELOW)
+ if (x11->fs_type & vo_wm_STAYS_ON_TOP)
+ xev.data.l[1] = x11->XA_NET_WM_STATE_STAYS_ON_TOP;
+ else if (x11->fs_type & vo_wm_ABOVE)
+ xev.data.l[1] = x11->XA_NET_WM_STATE_ABOVE;
+ else if (x11->fs_type & vo_wm_FULLSCREEN)
+ xev.data.l[1] = x11->XA_NET_WM_STATE_FULLSCREEN;
+ else if (x11->fs_type & vo_wm_BELOW)
// This is not fallback. We can safely assume that the situation
// where only NETWM_STATE_BELOW is supported doesn't exist.
- xev.data.l[1] = XA_NET_WM_STATE_BELOW;
+ xev.data.l[1] = x11->XA_NET_WM_STATE_BELOW;
- XSendEvent(mDisplay, mRootWin, False, SubstructureRedirectMask,
+ XSendEvent(x11->display, x11->rootwin, False, SubstructureRedirectMask,
(XEvent *) & xev);
- state = XGetAtomName(mDisplay, xev.data.l[1]);
+ state = XGetAtomName(x11->display, xev.data.l[1]);
mp_msg(MSGT_VO, MSGL_V,
"[x11] NET style stay on top (layer %d). Using state %s.\n",
layer, state);
@@ -1323,109 +1271,117 @@ static int vo_x11_get_fs_type(int supported)
}
/**
- * \brief update vo_dx, vo_dy, vo_dwidth and vo_dheight with current values of vo_window
- * \return returns current color depth of vo_window
+ * \brief update vo->dx, vo->dy, vo->dwidth and vo->dheight with current values of vo->x11->window
+ * \return returns current color depth of vo->x11->window
*/
-int vo_x11_update_geometry(void) {
+int vo_x11_update_geometry(struct vo *vo)
+{
+ struct vo_x11_state *x11 = vo->x11;
unsigned depth, w, h;
int dummy_int;
Window dummy_win;
- XGetGeometry(mDisplay, vo_window, &dummy_win, &dummy_int, &dummy_int,
+ XGetGeometry(x11->display, x11->window, &dummy_win, &dummy_int, &dummy_int,
&w, &h, &dummy_int, &depth);
- if (w <= INT_MAX && h <= INT_MAX) { vo_dwidth = w; vo_dheight = h; }
- XTranslateCoordinates(mDisplay, vo_window, mRootWin, 0, 0, &vo_dx, &vo_dy,
- &dummy_win);
+ if (w <= INT_MAX && h <= INT_MAX) {
+ vo->dwidth = w;
+ vo->dheight = h;
+ }
+ XTranslateCoordinates(x11->display, x11->window, x11->rootwin, 0, 0,
+ &vo->dx, &vo->dy, &dummy_win);
if (vo_wintitle)
- XStoreName(mDisplay, vo_window, vo_wintitle);
+ XStoreName(x11->display, x11->window, vo_wintitle);
return depth <= INT_MAX ? depth : 0;
}
-void vo_x11_fullscreen(void)
+void vo_x11_fullscreen(struct vo *vo)
{
+ struct MPOpts *opts = vo->opts;
+ struct vo_x11_state *x11 = vo->x11;
int x, y, w, h;
- x = vo_old_x;
- y = vo_old_y;
- w = vo_old_width;
- h = vo_old_height;
+ x = x11->vo_old_x;
+ y = x11->vo_old_y;
+ w = x11->vo_old_width;
+ h = x11->vo_old_height;
if (WinID >= 0) {
vo_fs = !vo_fs;
return;
}
- if (vo_fs_flip)
+ if (x11->fs_flip)
return;
if (vo_fs)
{
- vo_x11_ewmh_fullscreen(_NET_WM_STATE_REMOVE); // removes fullscreen state if wm supports EWMH
+ vo_x11_ewmh_fullscreen(x11, _NET_WM_STATE_REMOVE); // removes fullscreen state if wm supports EWMH
vo_fs = VO_FALSE;
} else
{
// win->fs
- vo_x11_ewmh_fullscreen(_NET_WM_STATE_ADD); // sends fullscreen state to be added if wm supports EWMH
+ vo_x11_ewmh_fullscreen(x11, _NET_WM_STATE_ADD); // sends fullscreen state to be added if wm supports EWMH
vo_fs = VO_TRUE;
- if ( ! (vo_fs_type & vo_wm_FULLSCREEN) ) // not needed with EWMH fs
+ if ( ! (x11->fs_type & vo_wm_FULLSCREEN) ) // not needed with EWMH fs
{
- vo_old_x = vo_dx;
- vo_old_y = vo_dy;
- vo_old_width = vo_dwidth;
- vo_old_height = vo_dheight;
+ x11->vo_old_x = vo->dx;
+ x11->vo_old_y = vo->dy;
+ x11->vo_old_width = vo->dwidth;
+ x11->vo_old_height = vo->dheight;
}
- update_xinerama_info();
+ update_xinerama_info(vo);
x = xinerama_x;
y = xinerama_y;
- w = vo_screenwidth;
- h = vo_screenheight;
+ w = opts->vo_screenwidth;
+ h = opts->vo_screenheight;
}
{
long dummy;
- XGetWMNormalHints(mDisplay, vo_window, &vo_hint, &dummy);
- if (!(vo_hint.flags & PWinGravity))
- old_gravity = NorthWestGravity;
+ XGetWMNormalHints(x11->display, x11->window, &x11->vo_hint, &dummy);
+ if (!(x11->vo_hint.flags & PWinGravity))
+ x11->old_gravity = NorthWestGravity;
else
- old_gravity = vo_hint.win_gravity;
+ x11->old_gravity = x11->vo_hint.win_gravity;
}
- if (vo_wm_type == 0 && !(vo_fsmode & 16))
+ if (x11->wm_type == 0 && !(vo_fsmode & 16))
{
- XUnmapWindow(mDisplay, vo_window); // required for MWM
- XWithdrawWindow(mDisplay, vo_window, mScreen);
- vo_fs_flip = 1;
+ XUnmapWindow(x11->display, x11->window); // required for MWM
+ XWithdrawWindow(x11->display, x11->window, x11->screen);
+ x11->fs_flip = 1;
}
- if ( ! (vo_fs_type & vo_wm_FULLSCREEN) ) // not needed with EWMH fs
+ if ( ! (x11->fs_type & vo_wm_FULLSCREEN) ) // not needed with EWMH fs
{
- vo_x11_decoration(mDisplay, vo_window, vo_border && !vo_fs);
- vo_x11_sizehint(x, y, w, h, 0);
- vo_x11_setlayer(mDisplay, vo_window, vo_fs);
+ vo_x11_decoration(vo, vo_border && !vo_fs);
+ vo_x11_sizehint(vo, x, y, w, h, 0);
+ vo_x11_setlayer(vo, x11->window, vo_fs);
- XMoveResizeWindow(mDisplay, vo_window, x, y, w, h);
+ XMoveResizeWindow(x11->display, x11->window, x, y, w, h);
}
/* some WMs lose ontop after fullscreen */
- if ((!(vo_fs)) & vo_ontop)
- vo_x11_setlayer(mDisplay, vo_window, vo_ontop);
-
- XMapRaised(mDisplay, vo_window);
- if ( ! (vo_fs_type & vo_wm_FULLSCREEN) ) // some WMs change window pos on map
- XMoveResizeWindow(mDisplay, vo_window, x, y, w, h);
- XRaiseWindow(mDisplay, vo_window);
- XFlush(mDisplay);
+ if ((!(vo_fs)) & opts->vo_ontop)
+ vo_x11_setlayer(vo, x11->window, opts->vo_ontop);
+
+ XMapRaised(x11->display, x11->window);
+ if ( ! (x11->fs_type & vo_wm_FULLSCREEN) ) // some WMs change window pos on map
+ XMoveResizeWindow(x11->display, x11->window, x, y, w, h);
+ XRaiseWindow(x11->display, x11->window);
+ XFlush(x11->display);
}
-void vo_x11_ontop(void)
+void vo_x11_ontop(struct vo *vo)
{
- vo_ontop = (!(vo_ontop));
+ struct MPOpts *opts = vo->opts;
+ opts->vo_ontop = !opts->vo_ontop;
- vo_x11_setlayer(mDisplay, vo_window, vo_ontop);
+ vo_x11_setlayer(vo, vo->x11->window, opts->vo_ontop);
}
-void vo_x11_border(void)
+void vo_x11_border(struct vo *vo)
{
vo_border = !vo_border;
- vo_x11_decoration(mDisplay, vo_window, vo_border && !vo_fs);
+ vo_x11_decoration(vo, vo_border && !vo_fs);
}
/*
@@ -1435,19 +1391,19 @@ void vo_x11_border(void)
static int screensaver_off;
static unsigned int time_last;
-void xscreensaver_heartbeat(void)
+void xscreensaver_heartbeat(struct vo_x11_state *x11)
{
unsigned int time = GetTimerMS();
- if (mDisplay && screensaver_off && (time - time_last) > 30000)
+ if (x11->display && screensaver_off && (time - time_last) > 30000)
{
time_last = time;
- XResetScreenSaver(mDisplay);
+ XResetScreenSaver(x11->display);
}
}
-static int xss_suspend(Bool suspend)
+static int xss_suspend(Display *mDisplay, Bool suspend)
{
#ifndef CONFIG_XSS
return 0;
@@ -1467,13 +1423,13 @@ static int xss_suspend(Bool suspend)
* End of XScreensaver stuff
*/
-void saver_on(Display * mDisplay)
+static void saver_on(Display * mDisplay)
{
if (!screensaver_off)
return;
screensaver_off = 0;
- if (xss_suspend(False))
+ if (xss_suspend(mDisplay, False))
return;
#ifdef CONFIG_XDPMS
if (dpms_disabled)
@@ -1507,14 +1463,14 @@ void saver_on(Display * mDisplay)
#endif
}
-void saver_off(Display * mDisplay)
+static void saver_off(Display * mDisplay)
{
int nothing;
if (screensaver_off)
return;
screensaver_off = 1;
- if (xss_suspend(True))
+ if (xss_suspend(mDisplay, True))
return;
#ifdef CONFIG_XDPMS
if (DPMSQueryExtension(mDisplay, &nothing, &nothing))
@@ -1589,12 +1545,15 @@ void vo_x11_selectinput_witherr(Display * display, Window w,
}
#ifdef CONFIG_XF86VM
-void vo_vm_switch(void)
+void vo_vm_switch(struct vo *vo)
{
+ struct vo_x11_state *x11 = vo->x11;
+ struct MPOpts *opts = vo->opts;
+ Display *mDisplay = x11->display;
int vm_event, vm_error;
int vm_ver, vm_rev;
int i, j, have_vm = 0;
- int X = vo_dwidth, Y = vo_dheight;
+ int X = vo->dwidth, Y = vo->dheight;
int modeline_width, modeline_height;
int modecount;
@@ -1613,7 +1572,7 @@ void vo_vm_switch(void)
if (have_vm)
{
if (vidmodes == NULL)
- XF86VidModeGetAllModeLines(mDisplay, mScreen, &modecount,
+ XF86VidModeGetAllModeLines(mDisplay, x11->screen, &modecount,
&vidmodes);
j = 0;
modeline_width = vidmodes[0]->hdisplay;
@@ -1630,54 +1589,64 @@ void vo_vm_switch(void)
j = i;
}
- mp_msg(MSGT_VO, MSGL_INFO, MSGTR_SelectedVideoMode,
+ mp_tmsg(MSGT_VO, MSGL_INFO, "XF86VM: Selected video mode %dx%d for image size %dx%d.\n",
modeline_width, modeline_height, X, Y);
- XF86VidModeLockModeSwitch(mDisplay, mScreen, 0);
- XF86VidModeSwitchToMode(mDisplay, mScreen, vidmodes[j]);
- XF86VidModeSwitchToMode(mDisplay, mScreen, vidmodes[j]);
+ XF86VidModeLockModeSwitch(mDisplay, x11->screen, 0);
+ XF86VidModeSwitchToMode(mDisplay, x11->screen, vidmodes[j]);
+ XF86VidModeSwitchToMode(mDisplay, x11->screen, vidmodes[j]);
// FIXME: all this is more of a hack than proper solution
- X = (vo_screenwidth - modeline_width) / 2;
- Y = (vo_screenheight - modeline_height) / 2;
- XF86VidModeSetViewPort(mDisplay, mScreen, X, Y);
- vo_dx = X;
- vo_dy = Y;
- vo_dwidth = modeline_width;
- vo_dheight = modeline_height;
- aspect_save_screenres(modeline_width, modeline_height);
+ X = (opts->vo_screenwidth - modeline_width) / 2;
+ Y = (opts->vo_screenheight - modeline_height) / 2;
+ XF86VidModeSetViewPort(mDisplay, x11->screen, X, Y);
+ vo->dx = X;
+ vo->dy = Y;
+ vo->dwidth = modeline_width;
+ vo->dheight = modeline_height;
+ aspect_save_screenres(vo, modeline_width, modeline_height);
}
}
-void vo_vm_close(void)
+void vo_vm_close(struct vo *vo)
{
-#ifdef CONFIG_GUI
- if (vidmodes != NULL && vo_window != None)
-#else
+ Display *dpy = vo->x11->display;
+ struct MPOpts *opts = vo->opts;
if (vidmodes != NULL)
-#endif
{
int i, modecount;
free(vidmodes);
vidmodes = NULL;
- XF86VidModeGetAllModeLines(mDisplay, mScreen, &modecount,
+ XF86VidModeGetAllModeLines(dpy, vo->x11->screen, &modecount,
&vidmodes);
for (i = 0; i < modecount; i++)
- if ((vidmodes[i]->hdisplay == vo_screenwidth)
- && (vidmodes[i]->vdisplay == vo_screenheight))
+ if ((vidmodes[i]->hdisplay == opts->vo_screenwidth)
+ && (vidmodes[i]->vdisplay == opts->vo_screenheight))
{
mp_msg(MSGT_VO, MSGL_INFO,
"Returning to original mode %dx%d\n",
- vo_screenwidth, vo_screenheight);
+ opts->vo_screenwidth, opts->vo_screenheight);
break;
}
- XF86VidModeSwitchToMode(mDisplay, mScreen, vidmodes[i]);
- XF86VidModeSwitchToMode(mDisplay, mScreen, vidmodes[i]);
+ XF86VidModeSwitchToMode(dpy, vo->x11->screen, vidmodes[i]);
+ XF86VidModeSwitchToMode(dpy, vo->x11->screen, vidmodes[i]);
free(vidmodes);
vidmodes = NULL;
}
}
+
+double vo_vm_get_fps(struct vo *vo)
+{
+ struct vo_x11_state *x11 = vo->x11;
+ int clock;
+ XF86VidModeModeLine modeline;
+ if (!XF86VidModeGetModeLine(x11->display, x11->screen, &clock, &modeline))
+ return 0;
+ if (modeline.privsize)
+ XFree(modeline.private);
+ return 1e3 * clock / modeline.htotal / modeline.vtotal;
+}
#endif
#endif /* X11_FULLSCREEN */
@@ -1741,12 +1710,13 @@ static XColor cols[256];
static int cm_size, red_mask, green_mask, blue_mask;
-Colormap vo_x11_create_colormap(XVisualInfo * vinfo)
+Colormap vo_x11_create_colormap(struct vo *vo, XVisualInfo *vinfo)
{
+ struct vo_x11_state *x11 = vo->x11;
unsigned k, r, g, b, ru, gu, bu, m, rv, gv, bv, rvu, gvu, bvu;
if (vinfo->class != DirectColor)
- return XCreateColormap(mDisplay, mRootWin, vinfo->visual,
+ return XCreateColormap(x11->display, x11->rootwin, vinfo->visual,
AllocNone);
/* can this function get called twice or more? */
@@ -1790,8 +1760,8 @@ Colormap vo_x11_create_colormap(XVisualInfo * vinfo)
gv += gvu;
bv += bvu;
}
- cmap = XCreateColormap(mDisplay, mRootWin, vinfo->visual, AllocAll);
- XStoreColors(mDisplay, cmap, cols, cm_size);
+ cmap = XCreateColormap(x11->display, x11->rootwin, vinfo->visual, AllocAll);
+ XStoreColors(x11->display, cmap, cols, cm_size);
return cmap;
}
@@ -1818,7 +1788,7 @@ static int transform_color(float val,
return (unsigned short) (s * 65535);
}
-uint32_t vo_x11_set_equalizer(char *name, int value)
+uint32_t vo_x11_set_equalizer(struct vo *vo, char *name, int value)
{
float gamma, brightness, contrast;
float rf, gf, bf;
@@ -1864,8 +1834,8 @@ uint32_t vo_x11_set_equalizer(char *name, int value)
cols[k].blue = transform_color(bf * k, brightness, contrast, gamma);
}
- XStoreColors(mDisplay, cmap, cols, cm_size);
- XFlush(mDisplay);
+ XStoreColors(vo->x11->display, cmap, cols, cm_size);
+ XFlush(vo->x11->display);
return VO_TRUE;
}
@@ -1885,7 +1855,7 @@ uint32_t vo_x11_get_equalizer(char *name, int *value)
}
#ifdef CONFIG_XV
-int vo_xv_set_eq(uint32_t xv_port, char *name, int value)
+int vo_xv_set_eq(struct vo *vo, uint32_t xv_port, char *name, int value)
{
XvAttribute *attributes;
int i, howmany, xv_atom;
@@ -1893,11 +1863,11 @@ int vo_xv_set_eq(uint32_t xv_port, char *name, int value)
mp_dbg(MSGT_VO, MSGL_V, "xv_set_eq called! (%s, %d)\n", name, value);
/* get available attributes */
- attributes = XvQueryPortAttributes(mDisplay, xv_port, &howmany);
+ attributes = XvQueryPortAttributes(vo->x11->display, xv_port, &howmany);
for (i = 0; i < howmany && attributes; i++)
if (attributes[i].flags & XvSettable)
{
- xv_atom = XInternAtom(mDisplay, attributes[i].name, True);
+ xv_atom = XInternAtom(vo->x11->display, attributes[i].name, True);
/* since we have SET_DEFAULTS first in our list, we can check if it's available
then trigger it if it's ok so that the other values are at default upon query */
if (xv_atom != None)
@@ -1929,6 +1899,10 @@ int vo_xv_set_eq(uint32_t xv_port, char *name, int value)
else if (!strcmp(attributes[i].name, "XV_BLUE_INTENSITY")
&& (!strcasecmp(name, "blue_intensity")))
port_value = value;
+ else if ((!strcmp(attributes[i].name, "XV_ITURBT_709") //NVIDIA
+ || !strcmp(attributes[i].name, "XV_COLORSPACE"))//ATI
+ && (!strcasecmp(name, "bt_709")))
+ port_value = value;
else
continue;
@@ -1948,32 +1922,32 @@ int vo_xv_set_eq(uint32_t xv_port, char *name, int value)
port_value =
(port_value + 100) * (port_max - port_min) / 200 +
port_min;
- XvSetPortAttribute(mDisplay, xv_port, xv_atom, port_value);
+ XvSetPortAttribute(vo->x11->display, xv_port, xv_atom, port_value);
return VO_TRUE;
}
}
return VO_FALSE;
}
-int vo_xv_get_eq(uint32_t xv_port, char *name, int *value)
+int vo_xv_get_eq(struct vo *vo, uint32_t xv_port, char *name, int *value)
{
XvAttribute *attributes;
int i, howmany, xv_atom;
/* get available attributes */
- attributes = XvQueryPortAttributes(mDisplay, xv_port, &howmany);
+ attributes = XvQueryPortAttributes(vo->x11->display, xv_port, &howmany);
for (i = 0; i < howmany && attributes; i++)
if (attributes[i].flags & XvGettable)
{
- xv_atom = XInternAtom(mDisplay, attributes[i].name, True);
+ xv_atom = XInternAtom(vo->x11->display, attributes[i].name, True);
/* since we have SET_DEFAULTS first in our list, we can check if it's available
then trigger it if it's ok so that the other values are at default upon query */
if (xv_atom != None)
{
int val, port_value = 0, port_min, port_max;
- XvGetPortAttribute(mDisplay, xv_port, xv_atom,
+ XvGetPortAttribute(vo->x11->display, xv_port, xv_atom,
&port_value);
port_min = attributes[i].min_value;
@@ -2010,6 +1984,10 @@ int vo_xv_get_eq(uint32_t xv_port, char *name, int *value)
else if (!strcmp(attributes[i].name, "XV_BLUE_INTENSITY")
&& (!strcasecmp(name, "blue_intensity")))
*value = val;
+ else if ((!strcmp(attributes[i].name, "XV_ITURBT_709") //NVIDIA
+ || !strcmp(attributes[i].name, "XV_COLORSPACE"))//ATI
+ && (!strcasecmp(name, "bt_709")))
+ *value = val;
else
continue;
@@ -2021,11 +1999,6 @@ int vo_xv_get_eq(uint32_t xv_port, char *name, int *value)
return VO_FALSE;
}
-/** \brief contains flags changing the execution of the colorkeying code */
-xv_ck_info_t xv_ck_info = { CK_METHOD_MANUALFILL, CK_SRC_CUR };
-unsigned long xv_colorkey; ///< The color used for manual colorkeying.
-unsigned int xv_port; ///< The selected Xv port.
-
/**
* \brief Interns the requested atom if it is available.
*
@@ -2034,20 +2007,21 @@ unsigned int xv_port; ///< The selected Xv port.
* \return Returns the atom if available, else None is returned.
*
*/
-static Atom xv_intern_atom_if_exists( char const * atom_name )
+static Atom xv_intern_atom_if_exists(struct vo_x11_state *x11,
+ char const *atom_name)
{
XvAttribute * attributes;
int attrib_count,i;
Atom xv_atom = None;
- attributes = XvQueryPortAttributes( mDisplay, xv_port, &attrib_count );
+ attributes = XvQueryPortAttributes(x11->display, x11->xv_port, &attrib_count );
if( attributes!=NULL )
{
for ( i = 0; i < attrib_count; ++i )
{
if ( strcmp(attributes[i].name, atom_name ) == 0 )
{
- xv_atom = XInternAtom( mDisplay, atom_name, False );
+ xv_atom = XInternAtom(x11->display, atom_name, False );
break; // found what we want, break out
}
}
@@ -2061,12 +2035,13 @@ static Atom xv_intern_atom_if_exists( char const * atom_name )
* \brief Try to enable vsync for xv.
* \return Returns -1 if not available, 0 on failure and 1 on success.
*/
-int vo_xv_enable_vsync(void)
+int vo_xv_enable_vsync(struct vo *vo)
{
- Atom xv_atom = xv_intern_atom_if_exists("XV_SYNC_TO_VBLANK");
+ struct vo_x11_state *x11 = vo->x11;
+ Atom xv_atom = xv_intern_atom_if_exists(x11, "XV_SYNC_TO_VBLANK");
if (xv_atom == None)
return -1;
- return XvSetPortAttribute(mDisplay, xv_port, xv_atom, 1) == Success;
+ return XvSetPortAttribute(x11->display, x11->xv_port, xv_atom, 1) == Success;
}
/**
@@ -2080,13 +2055,14 @@ int vo_xv_enable_vsync(void)
* \param height [out] The maximum height gets stored here.
*
*/
-void vo_xv_get_max_img_dim( uint32_t * width, uint32_t * height )
+void vo_xv_get_max_img_dim(struct vo *vo, uint32_t * width, uint32_t * height)
{
+ struct vo_x11_state *x11 = vo->x11;
XvEncodingInfo * encodings;
//unsigned long num_encodings, idx; to int or too long?!
unsigned int num_encodings, idx;
- XvQueryEncodings( mDisplay, xv_port, &num_encodings, &encodings);
+ XvQueryEncodings(x11->display, x11->xv_port, &num_encodings, &encodings);
if ( encodings )
{
@@ -2117,11 +2093,11 @@ void vo_xv_get_max_img_dim( uint32_t * width, uint32_t * height )
* Outputs the content of |ck_handling| as a readable message.
*
*/
-void vo_xv_print_ck_info(void)
+static void vo_xv_print_ck_info(struct vo_x11_state *x11)
{
mp_msg( MSGT_VO, MSGL_V, "[xv common] " );
- switch ( xv_ck_info.method )
+ switch ( x11->xv_ck_info.method )
{
case CK_METHOD_NONE:
mp_msg( MSGT_VO, MSGL_V, "Drawing no colorkey.\n" ); return;
@@ -2135,32 +2111,32 @@ void vo_xv_print_ck_info(void)
mp_msg( MSGT_VO, MSGL_V, "\n[xv common] " );
- switch ( xv_ck_info.source )
+ switch ( x11->xv_ck_info.source )
{
case CK_SRC_CUR:
mp_msg( MSGT_VO, MSGL_V, "Using colorkey from Xv (0x%06lx).\n",
- xv_colorkey );
+ x11->xv_colorkey );
break;
case CK_SRC_USE:
- if ( xv_ck_info.method == CK_METHOD_AUTOPAINT )
+ if ( x11->xv_ck_info.method == CK_METHOD_AUTOPAINT )
{
mp_msg( MSGT_VO, MSGL_V,
"Ignoring colorkey from MPlayer (0x%06lx).\n",
- xv_colorkey );
+ x11->xv_colorkey );
}
else
{
mp_msg( MSGT_VO, MSGL_V,
"Using colorkey from MPlayer (0x%06lx)."
" Use -colorkey to change.\n",
- xv_colorkey );
+ x11->xv_colorkey );
}
break;
case CK_SRC_SET:
mp_msg( MSGT_VO, MSGL_V,
"Setting and using colorkey from MPlayer (0x%06lx)."
" Use -colorkey to change.\n",
- xv_colorkey );
+ x11->xv_colorkey );
break;
}
}
@@ -2185,28 +2161,29 @@ void vo_xv_print_ck_info(void)
* NOTE: If vo_colorkey has bits set after the first 3 low order bytes
* we don't draw anything as this means it was forced to off.
*/
-int vo_xv_init_colorkey(void)
+int vo_xv_init_colorkey(struct vo *vo)
{
+ struct vo_x11_state *x11 = vo->x11;
Atom xv_atom;
int rez;
/* check if colorkeying is needed */
- xv_atom = xv_intern_atom_if_exists( "XV_COLORKEY" );
+ xv_atom = xv_intern_atom_if_exists(vo->x11, "XV_COLORKEY");
/* if we have to deal with colorkeying ... */
if( xv_atom != None && !(vo_colorkey & 0xFF000000) )
{
/* check if we should use the colorkey specified in vo_colorkey */
- if ( xv_ck_info.source != CK_SRC_CUR )
+ if ( x11->xv_ck_info.source != CK_SRC_CUR )
{
- xv_colorkey = vo_colorkey;
+ x11->xv_colorkey = vo_colorkey;
/* check if we have to set the colorkey too */
- if ( xv_ck_info.source == CK_SRC_SET )
+ if ( x11->xv_ck_info.source == CK_SRC_SET )
{
- xv_atom = XInternAtom(mDisplay, "XV_COLORKEY",False);
+ xv_atom = XInternAtom(x11->display, "XV_COLORKEY",False);
- rez = XvSetPortAttribute( mDisplay, xv_port, xv_atom, vo_colorkey );
+ rez = XvSetPortAttribute(x11->display, x11->xv_port, xv_atom, vo_colorkey);
if ( rez != Success )
{
mp_msg( MSGT_VO, MSGL_FATAL,
@@ -2219,10 +2196,10 @@ int vo_xv_init_colorkey(void)
{
int colorkey_ret;
- rez=XvGetPortAttribute(mDisplay,xv_port, xv_atom, &colorkey_ret);
+ rez=XvGetPortAttribute(x11->display,x11->xv_port, xv_atom, &colorkey_ret);
if ( rez == Success )
{
- xv_colorkey = colorkey_ret;
+ x11->xv_colorkey = colorkey_ret;
}
else
{
@@ -2233,39 +2210,39 @@ int vo_xv_init_colorkey(void)
}
}
- xv_atom = xv_intern_atom_if_exists( "XV_AUTOPAINT_COLORKEY" );
+ xv_atom = xv_intern_atom_if_exists(vo->x11, "XV_AUTOPAINT_COLORKEY");
/* should we draw the colorkey ourselves or activate autopainting? */
- if ( xv_ck_info.method == CK_METHOD_AUTOPAINT )
+ if ( x11->xv_ck_info.method == CK_METHOD_AUTOPAINT )
{
rez = !Success; // reset rez to something different than Success
if ( xv_atom != None ) // autopaint is supported
{
- rez = XvSetPortAttribute( mDisplay, xv_port, xv_atom, 1 );
+ rez = XvSetPortAttribute(x11->display, x11->xv_port, xv_atom, 1);
}
if ( rez != Success )
{
// fallback to manual colorkey drawing
- xv_ck_info.method = CK_METHOD_MANUALFILL;
+ x11->xv_ck_info.method = CK_METHOD_MANUALFILL;
}
}
else // disable colorkey autopainting if supported
{
if ( xv_atom != None ) // we have autopaint attribute
{
- XvSetPortAttribute( mDisplay, xv_port, xv_atom, 0 );
+ XvSetPortAttribute(x11->display, x11->xv_port, xv_atom, 0);
}
}
}
else // do no colorkey drawing at all
{
- xv_ck_info.method = CK_METHOD_NONE;
+ x11->xv_ck_info.method = CK_METHOD_NONE;
} /* end: should we draw colorkey */
/* output information about the current colorkey settings */
- vo_xv_print_ck_info();
+ vo_xv_print_ck_info(x11);
return 1; // success
}
@@ -2280,14 +2257,16 @@ int vo_xv_init_colorkey(void)
* It doesn't call XFlush.
*
*/
-void vo_xv_draw_colorkey( int32_t x, int32_t y,
- int32_t w, int32_t h )
+void vo_xv_draw_colorkey(struct vo *vo, int32_t x, int32_t y,
+ int32_t w, int32_t h)
{
- if( xv_ck_info.method == CK_METHOD_MANUALFILL ||
- xv_ck_info.method == CK_METHOD_BACKGROUND )//less tearing than XClearWindow()
+ struct MPOpts *opts = vo->opts;
+ struct vo_x11_state *x11 = vo->x11;
+ if( x11->xv_ck_info.method == CK_METHOD_MANUALFILL ||
+ x11->xv_ck_info.method == CK_METHOD_BACKGROUND )//less tearing than XClearWindow()
{
- XSetForeground( mDisplay, vo_gc, xv_colorkey );
- XFillRectangle( mDisplay, vo_window, vo_gc,
+ XSetForeground(x11->display, x11->vo_gc, x11->xv_colorkey );
+ XFillRectangle(x11->display, x11->window, x11->vo_gc,
x, y,
w, h );
}
@@ -2296,24 +2275,24 @@ void vo_xv_draw_colorkey( int32_t x, int32_t y,
/* TODO! move this to vo_x11_clearwindow_part() */
if ( vo_fs )
{
- XSetForeground( mDisplay, vo_gc, 0 );
+ XSetForeground(x11->display, x11->vo_gc, 0 );
/* making non-overlap fills, requires 8 checks instead of 4 */
if ( y > 0 )
- XFillRectangle( mDisplay, vo_window, vo_gc,
+ XFillRectangle(x11->display, x11->window, x11->vo_gc,
0, 0,
- vo_screenwidth, y);
+ opts->vo_screenwidth, y);
if (x > 0)
- XFillRectangle( mDisplay, vo_window, vo_gc,
+ XFillRectangle(x11->display, x11->window, x11->vo_gc,
0, 0,
- x, vo_screenheight);
- if (x + w < vo_screenwidth)
- XFillRectangle( mDisplay, vo_window, vo_gc,
+ x, opts->vo_screenheight);
+ if (x + w < opts->vo_screenwidth)
+ XFillRectangle(x11->display, x11->window, x11->vo_gc,
x + w, 0,
- vo_screenwidth, vo_screenheight);
- if (y + h < vo_screenheight)
- XFillRectangle( mDisplay, vo_window, vo_gc,
+ opts->vo_screenwidth, opts->vo_screenheight);
+ if (y + h < opts->vo_screenheight)
+ XFillRectangle(x11->display, x11->window, x11->vo_gc,
0, y + h,
- vo_screenwidth, vo_screenheight);
+ opts->vo_screenwidth, opts->vo_screenheight);
}
}
@@ -2358,19 +2337,20 @@ int xv_test_ckm( void * arg )
* \param str Pointer to the string or NULL
*
*/
-void xv_setup_colorkeyhandling( char const * ck_method_str,
- char const * ck_str )
+void xv_setup_colorkeyhandling(struct vo *vo, const char *ck_method_str,
+ const char *ck_str)
{
+ struct vo_x11_state *x11 = vo->x11;
/* check if a valid pointer to the string was passed */
if ( ck_str )
{
if ( strncmp( ck_str, "use", 3 ) == 0 )
{
- xv_ck_info.source = CK_SRC_USE;
+ x11->xv_ck_info.source = CK_SRC_USE;
}
else if ( strncmp( ck_str, "set", 3 ) == 0 )
{
- xv_ck_info.source = CK_SRC_SET;
+ x11->xv_ck_info.source = CK_SRC_SET;
}
}
/* check if a valid pointer to the string was passed */
@@ -2378,17 +2358,30 @@ void xv_setup_colorkeyhandling( char const * ck_method_str,
{
if ( strncmp( ck_method_str, "bg", 2 ) == 0 )
{
- xv_ck_info.method = CK_METHOD_BACKGROUND;
+ x11->xv_ck_info.method = CK_METHOD_BACKGROUND;
}
else if ( strncmp( ck_method_str, "man", 3 ) == 0 )
{
- xv_ck_info.method = CK_METHOD_MANUALFILL;
+ x11->xv_ck_info.method = CK_METHOD_MANUALFILL;
}
else if ( strncmp( ck_method_str, "auto", 4 ) == 0 )
{
- xv_ck_info.method = CK_METHOD_AUTOPAINT;
+ x11->xv_ck_info.method = CK_METHOD_AUTOPAINT;
}
}
}
#endif
+
+struct vo_x11_state *vo_x11_init_state(void)
+{
+ struct vo_x11_state *s = talloc_ptrtype(NULL, s);
+ *s = (struct vo_x11_state){
+ .xv_ck_info = { CK_METHOD_MANUALFILL, CK_SRC_CUR },
+ .olddecor = MWM_DECOR_ALL,
+ .oldfuncs = MWM_FUNC_MOVE | MWM_FUNC_CLOSE | MWM_FUNC_MINIMIZE |
+ MWM_FUNC_MAXIMIZE | MWM_FUNC_RESIZE,
+ .old_gravity = NorthWestGravity,
+ };
+ return s;
+}
diff --git a/libvo/x11_common.h b/libvo/x11_common.h
index 152e70ff80..677ee189db 100644
--- a/libvo/x11_common.h
+++ b/libvo/x11_common.h
@@ -25,6 +25,60 @@
#include "config.h"
+struct vo;
+
+struct vo_x11_state {
+ Display *display;
+ Window window;
+ Window rootwin;
+ int screen;
+ int display_is_local;
+ int depthonscreen;
+
+ GC vo_gc;
+
+ struct xv_ck_info_s {
+ int method; ///< CK_METHOD_* constants
+ int source; ///< CK_SRC_* constants
+ } xv_ck_info;
+ unsigned long xv_colorkey;
+ unsigned int xv_port;
+
+ int vo_mouse_autohide;
+ int wm_type;
+ int fs_type;
+ int fs_flip;
+
+ GC f_gc;
+ XSizeHints vo_hint;
+ unsigned int mouse_timer;
+ int mouse_waiting_hide;
+ int orig_layer;
+ int old_gravity;
+ int vo_old_x;
+ int vo_old_y;
+ int vo_old_width;
+ int vo_old_height;
+
+
+ unsigned int olddecor;
+ unsigned int oldfuncs;
+ XComposeStatus compose_status;
+
+ Atom XA_NET_SUPPORTED;
+ Atom XA_NET_WM_STATE;
+ Atom XA_NET_WM_STATE_FULLSCREEN;
+ Atom XA_NET_WM_STATE_ABOVE;
+ Atom XA_NET_WM_STATE_STAYS_ON_TOP;
+ Atom XA_NET_WM_STATE_BELOW;
+ Atom XA_NET_WM_PID;
+ Atom XA_WIN_PROTOCOLS;
+ Atom XA_WIN_LAYER;
+ Atom XA_WIN_HINTS;
+ Atom XAWM_PROTOCOLS;
+ Atom XAWM_DELETE_WINDOW;
+};
+
#if defined(CONFIG_GL) || defined(CONFIG_X11) || defined(CONFIG_XV)
#define X11_FULLSCREEN 1
#endif
@@ -52,67 +106,43 @@ extern int vo_fs_type;
extern char** vo_fstype_list;
extern char *mDisplayName;
-extern Display *mDisplay;
-extern Window mRootWin;
-extern int mScreen;
-extern int mLocalDisplay;
-
-extern int vo_mouse_autohide;
-
-int vo_init( void );
-void vo_uninit( void );
-void vo_hidecursor ( Display* , Window );
-void vo_showcursor( Display *disp, Window win );
-void vo_x11_decoration( Display * vo_Display,Window w,int d );
-void vo_x11_classhint( Display * display,Window window,const char *name );
-void vo_x11_nofs_sizepos(int x, int y, int width, int height);
-void vo_x11_sizehint( int x, int y, int width, int height, int max );
-int vo_x11_check_events(Display *mydisplay);
+
+struct vo_x11_state *vo_x11_init_state(void);
+int vo_init(struct vo *vo);
+void vo_uninit(struct vo_x11_state *x11);
+void vo_x11_decoration(struct vo *vo, int d );
+void vo_x11_classhint(struct vo *vo, Window window, const char *name);
+void vo_x11_sizehint(struct vo *vo, int x, int y, int width, int height, int max);
+int vo_x11_check_events(struct vo *vo);
void vo_x11_selectinput_witherr(Display *display, Window w, long event_mask);
-int vo_x11_update_geometry(void);
-void vo_x11_fullscreen( void );
-void vo_x11_setlayer( Display * mDisplay,Window vo_window,int layer );
-void vo_x11_uninit(void);
-Colormap vo_x11_create_colormap(XVisualInfo *vinfo);
-uint32_t vo_x11_set_equalizer(char *name, int value);
+void vo_x11_fullscreen(struct vo *vo);
+int vo_x11_update_geometry(struct vo *vo);
+void vo_x11_setlayer(struct vo *vo, Window vo_window, int layer);
+void vo_x11_uninit(struct vo *vo);
+Colormap vo_x11_create_colormap(struct vo *vo, XVisualInfo *vinfo);
+uint32_t vo_x11_set_equalizer(struct vo *vo, char *name, int value);
uint32_t vo_x11_get_equalizer(char *name, int *value);
void fstype_help(void);
-Window vo_x11_create_smooth_window( Display *mDisplay, Window mRoot,
- Visual *vis, int x, int y, unsigned int width, unsigned int height,
- int depth, Colormap col_map);
-void vo_x11_create_vo_window(XVisualInfo *vis, int x, int y,
- unsigned int width, unsigned int height, int flags,
+void vo_x11_create_vo_window(struct vo *vo, XVisualInfo *vis,
+ int x, int y, unsigned int width, unsigned int height, int flags,
Colormap col_map, const char *classname, const char *title);
-void vo_x11_clearwindow_part(Display *mDisplay, Window vo_window,
+void vo_x11_clearwindow_part(struct vo *vo, Window vo_window,
int img_width, int img_height, int use_fs);
-void vo_x11_clearwindow( Display *mDisplay, Window vo_window );
-void vo_x11_ontop(void);
-void vo_x11_border(void);
-void vo_x11_ewmh_fullscreen( int action );
+void vo_x11_clearwindow(struct vo *vo, Window vo_window);
+void vo_x11_ontop(struct vo *vo);
+void vo_x11_border(struct vo *vo);
+void vo_x11_ewmh_fullscreen(struct vo_x11_state *x11, int action);
#endif
-extern Window vo_window;
-extern GC vo_gc;
-extern XSizeHints vo_hint;
-
-#ifdef CONFIG_XV
-//XvPortID xv_port;
-extern unsigned int xv_port;
-
-int vo_xv_set_eq(uint32_t xv_port, char * name, int value);
-int vo_xv_get_eq(uint32_t xv_port, char * name, int *value);
+int vo_xv_set_eq(struct vo *vo, uint32_t xv_port, char * name, int value);
+int vo_xv_get_eq(struct vo *vo, uint32_t xv_port, char * name, int *value);
-int vo_xv_enable_vsync(void);
+int vo_xv_enable_vsync(struct vo *vo);
-void vo_xv_get_max_img_dim( uint32_t * width, uint32_t * height );
+void vo_xv_get_max_img_dim(struct vo *vo, uint32_t * width, uint32_t * height);
/*** colorkey handling ***/
-typedef struct xv_ck_info_s
-{
- int method; ///< CK_METHOD_* constants
- int source; ///< CK_SRC_* constants
-} xv_ck_info_t;
#define CK_METHOD_NONE 0 ///< no colorkey drawing
#define CK_METHOD_BACKGROUND 1 ///< set colorkey as window background
@@ -122,31 +152,67 @@ typedef struct xv_ck_info_s
#define CK_SRC_SET 1 ///< use and set specified / default colorkey
#define CK_SRC_CUR 2 ///< use current colorkey ( get it from xv )
-extern xv_ck_info_t xv_ck_info;
-extern unsigned long xv_colorkey;
-
-int vo_xv_init_colorkey(void);
-void vo_xv_draw_colorkey(int32_t x, int32_t y, int32_t w, int32_t h);
-void xv_setup_colorkeyhandling(char const * ck_method_str, char const * ck_str);
+int vo_xv_init_colorkey(struct vo *vo);
+void vo_xv_draw_colorkey(struct vo *vo, int32_t x, int32_t y, int32_t w, int32_t h);
+void xv_setup_colorkeyhandling(struct vo *vo, const char *ck_method_str, const char *ck_str);
/*** test functions for common suboptions ***/
int xv_test_ck( void * arg );
int xv_test_ckm( void * arg );
-#endif
-void vo_setwindow( Window w,GC g );
-void vo_x11_putkey(int key);
-
-void saver_off( Display * );
-void saver_on( Display * );
+void vo_x11_putkey(struct vo *vo, int key);
#ifdef CONFIG_XF86VM
-void vo_vm_switch(void);
-void vo_vm_close(void);
+void vo_vm_switch(struct vo *vo);
+void vo_vm_close(struct vo *vo);
+double vo_vm_get_fps(struct vo *vo);
#endif
-void update_xinerama_info(void);
+void update_xinerama_info(struct vo *vo);
int vo_find_depth_from_visuals(Display *dpy, int screen, Visual **visual_return);
+void xscreensaver_heartbeat(struct vo_x11_state *x11);
+
+// Old VOs use incompatible function calls, translate them to new
+// prototypes
+#ifdef IS_OLD_VO
+#define vo_x11_create_vo_window(...) vo_x11_create_vo_window(global_vo, __VA_ARGS__)
+#define vo_x11_fullscreen() vo_x11_fullscreen(global_vo)
+#define vo_x11_update_geometry() vo_x11_update_geometry(global_vo)
+#define vo_x11_ontop() vo_x11_ontop(global_vo)
+#define vo_init() vo_init(global_vo)
+#define vo_x11_ewmh_fullscreen(action) vo_x11_ewmh_fullscreen(global_vo->x11->display, action)
+#define update_xinerama_info() update_xinerama_info(global_vo)
+#define vo_x11_uninit() vo_x11_uninit(global_vo)
+#define vo_x11_check_events(display) vo_x11_check_events(global_vo)
+#define vo_x11_sizehint(...) vo_x11_sizehint(global_vo, __VA_ARGS__)
+#define vo_vm_switch() vo_vm_switch(global_vo)
+#define vo_x11_create_colormap(vinfo) vo_x11_create_colormap(global_vo, vinfo)
+#define vo_x11_set_equalizer(...) vo_x11_set_equalizer(global_vo, __VA_ARGS__)
+#define vo_xv_set_eq(...) vo_xv_set_eq(global_vo, __VA_ARGS__)
+#define vo_xv_get_eq(...) vo_xv_get_eq(global_vo, __VA_ARGS__)
+#define vo_xv_enable_vsync() vo_xv_enable_vsync(global_vo)
+#define vo_xv_get_max_img_dim(...) vo_xv_get_max_img_dim(global_vo, __VA_ARGS__)
+#define vo_xv_init_colorkey() vo_xv_init_colorkey(global_vo)
+#define vo_xv_draw_colorkey(...) vo_xv_draw_colorkey(global_vo, __VA_ARGS__)
+#define vo_x11_clearwindow_part(display, ...) vo_x11_clearwindow_part(global_vo, __VA_ARGS__)
+#define vo_vm_close() vo_vm_close(global_vo)
+#define vo_x11_clearwindow(display, window) vo_x11_clearwindow(global_vo, window)
+#define vo_x11_classhint(display, window, name) vo_x11_classhint(global_vo, window, name)
+#define vo_x11_setlayer(display, window, layer) vo_x11_setlayer(global_vo, window, layer)
+#define xv_setup_colorkeyhandling(a, b) xv_setup_colorkeyhandling(global_vo, a, b)
+#define vo_x11_border() vo_x11_border(global_vo)
+
+#define mDisplay global_vo->x11->display
+#define vo_depthonscreen global_vo->x11->depthonscreen
+#define vo_window global_vo->x11->window
+#define xv_ck_info global_vo->x11->xv_ck_info
+#define xv_colorkey global_vo->x11->xv_colorkey
+#define xv_port global_vo->x11->xv_port
+#define vo_gc global_vo->x11->vo_gc
+#define mRootWin global_vo->x11->rootwin
+#define mScreen global_vo->x11->screen
+#define mLocalDisplay global_vo->x11->display_is_local
+#endif
#endif /* MPLAYER_X11_COMMON_H */
diff --git a/loader/dmo/DMO_VideoDecoder.c b/loader/dmo/DMO_VideoDecoder.c
index 3dd7098534..db0cd4c995 100644
--- a/loader/dmo/DMO_VideoDecoder.c
+++ b/loader/dmo/DMO_VideoDecoder.c
@@ -552,4 +552,3 @@ int DMO_VideoDecoder_SetDirection(DMO_VideoDecoder *this, int d)
this->m_sVhdr2->bmiHeader.biHeight = this->iv.m_obh.biHeight;
return 0;
}
-
diff --git a/loader/dshow/DS_VideoDecoder.c b/loader/dshow/DS_VideoDecoder.c
index 130e31c07a..c0441ceacb 100644
--- a/loader/dshow/DS_VideoDecoder.c
+++ b/loader/dshow/DS_VideoDecoder.c
@@ -917,7 +917,3 @@ int DS_SetAttr_DivX(char* attribute, int value){
printf("Unknown attribute!\n");
return -200;
}
-
-
-
-
diff --git a/loader/ldt_keeper.c b/loader/ldt_keeper.c
index 8bffa6e958..adbe9900c9 100644
--- a/loader/ldt_keeper.c
+++ b/loader/ldt_keeper.c
@@ -209,7 +209,7 @@ ldt_fs_t* Setup_LDT_Keeper(void)
#ifdef __APPLE__
if (getenv("DYLD_BIND_AT_LAUNCH") == NULL)
- mp_msg(MSGT_LOADER, MSGL_WARN, MSGTR_LOADER_DYLD_Warning);
+ mp_tmsg(MSGT_LOADER, MSGL_WARN, "WARNING: Attempting to use DLL codecs but environment variable\n DYLD_BIND_AT_LAUNCH not set. This will likely crash.\n");
#endif /* __APPLE__ */
fs_seg=
diff --git a/loader/qtx/qtxsdk/components.h b/loader/qtx/qtxsdk/components.h
index 0856e279f4..08b883099c 100644
--- a/loader/qtx/qtxsdk/components.h
+++ b/loader/qtx/qtxsdk/components.h
@@ -656,6 +656,7 @@ static inline void dump_ImageDescription(void* xxx){
printf("=========================================================\n");
}
+#if 0
static inline void dump_Rect(char* title,Rect *r){
printf("%s: %d;%d - %d;%d\n",title,
(int)r->top,(int)r->left,(int)r->bottom,(int)r->right);
@@ -743,5 +744,6 @@ static inline void dump_CodecDecompressParams(void* xxx){
}
+#endif
#endif /* MPLAYER_COMPONENTS_H */
diff --git a/loader/vfl.c b/loader/vfl.c
index b0ce80acfd..e5d0445b92 100644
--- a/loader/vfl.c
+++ b/loader/vfl.c
@@ -227,4 +227,3 @@ int VFWAPI ICDoSomething(void)
{
return 0;
}
-
diff --git a/loader/wrapper.S b/loader/wrapper.S
index 7656a00f92..f21001f392 100644
--- a/loader/wrapper.S
+++ b/loader/wrapper.S
@@ -80,4 +80,3 @@ wrapper:
popf
popa
ret
-
diff --git a/loader/wrapper.h b/loader/wrapper.h
index 64fbe94217..a7c7da224e 100644
--- a/loader/wrapper.h
+++ b/loader/wrapper.h
@@ -17,4 +17,3 @@ int wrapper(void);
int null_call(void);
#endif /* MPLAYER_WRAPPER_H */
-
diff --git a/m_config.c b/m_config.c
index f2902f9873..6b8a05a264 100644
--- a/m_config.c
+++ b/m_config.c
@@ -25,6 +25,7 @@
#include <stdio.h>
#include <errno.h>
#include <string.h>
+#include "talloc.h"
#ifdef MP_DEBUG
#include <assert.h>
#endif
@@ -51,12 +52,33 @@ m_config_add_option(m_config_t *config, const m_option_t *arg, const char* prefi
static int
list_options(m_option_t *opt, char* name, char *param);
-m_config_t*
-m_config_new(void) {
+static void m_option_save(const m_config_t *config, const m_option_t *opt,
+ void *dst)
+{
+ if (opt->type->save) {
+ void *src = opt->new ? (char*)config->optstruct + opt->offset : opt->p;
+ opt->type->save(opt, dst, src);
+ }
+}
+
+static void m_option_set(const m_config_t *config, const m_option_t *opt,
+ void *src)
+{
+ if (opt->type->set) {
+ void *dst = opt->new ? (char*)config->optstruct + opt->offset : opt->p;
+ opt->type->set(opt, dst, src);
+ }
+}
+
+
+
+m_config_t *m_config_new(void *optstruct,
+ int includefunc(m_option_t *conf, char *filename))
+{
m_config_t* config;
static int initialized = 0;
static m_option_type_t profile_opt_type;
- static m_option_t ref_opts[] = {
+ static const m_option_t ref_opts[] = {
{ "profile", NULL, &profile_opt_type, CONF_NOSAVE, 0, 0, NULL },
{ "show-profile", show_profile, CONF_TYPE_PRINT_FUNC, CONF_NOCFG, 0, 0, NULL },
{ "list-options", list_options, CONF_TYPE_PRINT_FUNC, CONF_NOCFG, 0, 0, NULL },
@@ -64,7 +86,7 @@ m_config_new(void) {
};
int i;
- config = calloc(1,sizeof(m_config_t));
+ config = talloc_zero(NULL, m_config_t);
config->lvl = 1; // 0 Is the defaults
if(!initialized) {
initialized = 1;
@@ -72,56 +94,32 @@ m_config_new(void) {
profile_opt_type.parse = parse_profile;
profile_opt_type.set = set_profile;
}
- config->self_opts = malloc(sizeof(ref_opts));
- memcpy(config->self_opts,ref_opts,sizeof(ref_opts));
- for(i = 0 ; config->self_opts[i].name ; i++)
- config->self_opts[i].priv = config;
- m_config_register_options(config,config->self_opts);
+ m_option_t *self_opts = talloc_memdup(config, ref_opts, sizeof(ref_opts));
+ for (i = 0; self_opts[i].name; i++)
+ self_opts[i].priv = config;
+ m_config_register_options(config, self_opts);
+ if (includefunc) {
+ struct m_option *p = talloc_ptrtype(config, p);
+ *p = (struct m_option){"include", includefunc, CONF_TYPE_FUNC_PARAM,
+ CONF_NOSAVE, 0, 0, config};
+ m_config_add_option(config, p, NULL);
+ }
+ config->optstruct = optstruct;
return config;
}
-void
-m_config_free(m_config_t* config) {
- m_config_option_t *i = config->opts, *ct;
- m_config_save_slot_t *sl,*st;
- m_profile_t *p,*pn;
- int j;
-
-#ifdef MP_DEBUG
- assert(config != NULL);
-#endif
-
- while(i) {
- if (i->flags & M_CFG_OPT_ALIAS)
- sl = NULL;
- else
- sl = i->slots;
- while(sl) {
- m_option_free(i->opt,sl->data);
- st = sl->prev;
- free(sl);
- sl = st;
- }
- if(i->name != i->opt->name)
- free(i->name);
- ct = i->next;
- free(i);
- i = ct;
- }
- for(p = config->profiles ; p ; p = pn) {
- pn = p->next;
- free(p->name);
- if(p->desc) free(p->desc);
- for(j = 0 ; j < p->num_opts ; j++) {
- free(p->opts[2*j]);
- if(p->opts[2*j+1]) free(p->opts[2*j+1]);
+void m_config_free(m_config_t* config)
+{
+ m_config_option_t *opt;
+ for (opt = config->opts; opt; opt = opt->next) {
+ if (opt->flags & M_CFG_OPT_ALIAS)
+ continue;
+ m_config_save_slot_t *sl;
+ for (sl = opt->slots; sl; sl = sl->prev)
+ m_option_free(opt->opt, sl->data);
}
- free(p->opts);
- free(p);
- }
- free(config->self_opts);
- free(config);
+ talloc_free(config);
}
void
@@ -147,10 +145,11 @@ m_config_push(m_config_t* config) {
continue;
// Update the current status
- m_option_save(co->opt,co->slots->data,co->opt->p);
+ m_option_save(config, co->opt, co->slots->data);
// Allocate a new slot
- slot = calloc(1,sizeof(m_config_save_slot_t) + co->opt->type->size);
+ slot = talloc_zero_size(co, sizeof(m_config_save_slot_t) +
+ co->opt->type->size);
slot->lvl = config->lvl;
slot->prev = co->slots;
co->slots = slot;
@@ -181,17 +180,17 @@ m_config_pop(m_config_t* config) {
if(co->flags & M_CFG_OPT_ALIAS)
continue;
if(co->slots->lvl > config->lvl)
- mp_msg(MSGT_CFGPARSER, MSGL_WARN,MSGTR_SaveSlotTooOld,config->lvl,co->slots->lvl);
+ mp_tmsg(MSGT_CFGPARSER, MSGL_WARN,"Save slot found from lvl %d is too old: %d !!!\n",config->lvl,co->slots->lvl);
while(co->slots->lvl >= config->lvl) {
m_option_free(co->opt,co->slots->data);
slot = co->slots;
co->slots = slot->prev;
- free(slot);
+ talloc_free(slot);
pop++;
}
if(pop) // We removed some ctx -> set the previous value
- m_option_set(co->opt,co->opt->p,co->slots->data);
+ m_option_set(config, co->opt, co->slots->data);
}
config->lvl--;
@@ -210,14 +209,12 @@ m_config_add_option(m_config_t *config, const m_option_t *arg, const char* prefi
#endif
// Allocate a new entry for this option
- co = calloc(1,sizeof(m_config_option_t) + arg->type->size);
+ co = talloc_zero_size(config, sizeof(m_config_option_t) + arg->type->size);
co->opt = arg;
// Fill in the full name
if(prefix && strlen(prefix) > 0) {
- int l = strlen(prefix) + 1 + strlen(arg->name) + 1;
- co->name = malloc(l);
- sprintf(co->name,"%s:%s",prefix,arg->name);
+ co->name = talloc_asprintf(co, "%s:%s", prefix, arg->name);
} else
co->name = arg->name;
@@ -231,9 +228,11 @@ m_config_add_option(m_config_t *config, const m_option_t *arg, const char* prefi
} else {
m_config_option_t *i;
// Check if there is already an option pointing to this address
- if(arg->p) {
+ if(arg->p || arg->new && arg->offset >= 0) {
for(i = config->opts ; i ; i = i->next ) {
- if(i->opt->p == arg->p) { // So we don't save the same vars more than 1 time
+ if (arg->new ? (i->opt->new && i->opt->offset == arg->offset)
+ : (!i->opt->new && i->opt->p == arg->p)) {
+ // So we don't save the same vars more than 1 time
co->slots = i->slots;
co->flags |= M_CFG_OPT_ALIAS;
break;
@@ -241,22 +240,28 @@ m_config_add_option(m_config_t *config, const m_option_t *arg, const char* prefi
}
}
if(!(co->flags & M_CFG_OPT_ALIAS)) {
- // Allocate a slot for the defaults
- sl = calloc(1,sizeof(m_config_save_slot_t) + arg->type->size);
- m_option_save(arg,sl->data,(void**)arg->p);
- // Hack to avoid too much trouble with dynamically allocated data :
- // We always use a dynamic version
- if((arg->type->flags & M_OPT_TYPE_DYNAMIC) && arg->p && (*(void**)arg->p)) {
- *(void**)arg->p = NULL;
- m_option_set(arg,arg->p,sl->data);
+ // Allocate a slot for the defaults
+ sl = talloc_zero_size(co, sizeof(m_config_save_slot_t) +
+ arg->type->size);
+ m_option_save(config, arg, sl->data);
+ // Hack to avoid too much trouble with dynamically allocated data :
+ // We always use a dynamic version
+ if ((arg->type->flags & M_OPT_TYPE_DYNAMIC)) {
+ char **hackptr = arg->new ? (char*)config->optstruct + arg->offset
+ : arg->p;
+ if (hackptr && *hackptr) {
+ *hackptr = NULL;
+ m_option_set(config, arg, sl->data);
+ }
+ }
+ sl->lvl = 0;
+ sl->prev = NULL;
+ co->slots = talloc_zero_size(co, sizeof(m_config_save_slot_t) +
+ arg->type->size);
+ co->slots->prev = sl;
+ co->slots->lvl = config->lvl;
+ m_option_copy(co->opt, co->slots->data, sl->data);
}
- sl->lvl = 0;
- sl->prev = NULL;
- co->slots = calloc(1,sizeof(m_config_save_slot_t) + arg->type->size);
- co->slots->prev = sl;
- co->slots->lvl = config->lvl;
- m_option_copy(co->opt,co->slots->data,sl->data);
- } // !M_OPT_ALIAS
}
co->next = config->opts;
config->opts = co;
@@ -318,11 +323,11 @@ m_config_parse_option(m_config_t *config, char* arg, char* param,int set) {
// Check if this option isn't forbidden in the current mode
if((config->mode == M_CONFIG_FILE) && (co->opt->flags & M_OPT_NOCFG)) {
- mp_msg(MSGT_CFGPARSER, MSGL_ERR,MSGTR_InvalidCfgfileOption,arg);
+ mp_tmsg(MSGT_CFGPARSER, MSGL_ERR,"The %s option can't be used in a config file.\n",arg);
return M_OPT_INVALID;
}
if((config->mode == M_COMMAND_LINE) && (co->opt->flags & M_OPT_NOCMD)) {
- mp_msg(MSGT_CFGPARSER, MSGL_ERR,MSGTR_InvalidCmdlineOption,arg);
+ mp_tmsg(MSGT_CFGPARSER, MSGL_ERR,"The %s option can't be used on the command line.\n",arg);
return M_OPT_INVALID;
}
// During command line preparse set only pre-parse options
@@ -350,11 +355,11 @@ m_config_parse_option(m_config_t *config, char* arg, char* param,int set) {
sr = m_config_parse_option(config,n,lst[2*i+1],set);
if(sr < 0){
if(sr == M_OPT_UNKNOWN){
- mp_msg(MSGT_CFGPARSER, MSGL_ERR,MSGTR_InvalidSuboption,co->name,lst[2*i]);
+ mp_tmsg(MSGT_CFGPARSER, MSGL_ERR,"Error: option '%s' has no suboption '%s'.\n",co->name,lst[2*i]);
r = M_OPT_INVALID;
} else
if(sr == M_OPT_MISSING_PARAM){
- mp_msg(MSGT_CFGPARSER, MSGL_ERR,MSGTR_MissingSuboptionParameter,lst[2*i],co->name);
+ mp_tmsg(MSGT_CFGPARSER, MSGL_ERR,"Error: suboption '%s' of '%s' must have a parameter!\n",lst[2*i],co->name);
r = M_OPT_INVALID;
} else
r = sr;
@@ -372,7 +377,7 @@ m_config_parse_option(m_config_t *config, char* arg, char* param,int set) {
return r;
// Set the option
if(set) {
- m_option_set(co->opt,co->opt->p,co->slots->data);
+ m_option_set(config, co->opt, co->slots->data);
co->flags |= M_CFG_OPT_SET;
}
@@ -391,7 +396,7 @@ m_config_check_option(m_config_t *config, char* arg, char* param) {
mp_msg(MSGT_CFGPARSER, MSGL_DBG2,"Checking %s=%s\n",arg,param);
r=m_config_parse_option(config,arg,param,0);
if(r==M_OPT_MISSING_PARAM){
- mp_msg(MSGT_CFGPARSER, MSGL_ERR,MSGTR_MissingOptionParameter,arg);
+ mp_tmsg(MSGT_CFGPARSER, MSGL_ERR,"Error: option '%s' must have a parameter!\n",arg);
return M_OPT_INVALID;
}
return r;
@@ -415,20 +420,6 @@ m_config_get_option(m_config_t *config, char* arg) {
return NULL;
}
-const void*
-m_config_get_option_ptr(m_config_t *config, char* arg) {
- const m_option_t* conf;
-
-#ifdef MP_DEBUG
- assert(config != NULL);
- assert(arg != NULL);
-#endif
-
- conf = m_config_get_option(config,arg);
- if(!conf) return NULL;
- return conf->p;
-}
-
void
m_config_print_option_list(m_config_t *config) {
char min[50],max[50];
@@ -437,7 +428,7 @@ m_config_print_option_list(m_config_t *config) {
if(!config->opts) return;
- mp_msg(MSGT_CFGPARSER, MSGL_INFO, MSGTR_OptionListHeader);
+ mp_tmsg(MSGT_CFGPARSER, MSGL_INFO, "\n Name Type Min Max Global CL Cfg\n\n");
for(co = config->opts ; co ; co = co->next) {
const m_option_t* opt = co->opt;
if(opt->type->flags & M_OPT_TYPE_HAS_CHILD) continue;
@@ -459,7 +450,7 @@ m_config_print_option_list(m_config_t *config) {
opt->flags & CONF_NOCFG ? "No" : "Yes");
count++;
}
- mp_msg(MSGT_CFGPARSER, MSGL_INFO, MSGTR_TotalOptions,count);
+ mp_tmsg(MSGT_CFGPARSER, MSGL_INFO, "\nTotal: %d options\n",count);
}
m_profile_t*
@@ -474,8 +465,8 @@ m_profile_t*
m_config_add_profile(m_config_t* config, char* name) {
m_profile_t* p = m_config_get_profile(config,name);
if(p) return p;
- p = calloc(1,sizeof(m_profile_t));
- p->name = strdup(name);
+ p = talloc_zero(config, m_profile_t);
+ p->name = talloc_strdup(p, name);
p->next = config->profiles;
config->profiles = p;
return p;
@@ -483,8 +474,8 @@ m_config_add_profile(m_config_t* config, char* name) {
void
m_profile_set_desc(m_profile_t* p, char* desc) {
- if(p->desc) free(p->desc);
- p->desc = desc ? strdup(desc) : NULL;
+ talloc_free(p->desc);
+ p->desc = talloc_strdup(p, desc);
}
int
@@ -492,10 +483,9 @@ m_config_set_profile_option(m_config_t* config, m_profile_t* p,
char* name, char* val) {
int i = m_config_check_option(config,name,val);
if(i < 0) return i;
- if(p->opts) p->opts = realloc(p->opts,2*(p->num_opts+2)*sizeof(char*));
- else p->opts = malloc(2*(p->num_opts+2)*sizeof(char*));
- p->opts[p->num_opts*2] = strdup(name);
- p->opts[p->num_opts*2+1] = val ? strdup(val) : NULL;
+ p->opts = talloc_realloc(p, p->opts, char *, 2*(p->num_opts+2));
+ p->opts[p->num_opts*2] = talloc_strdup(p, name);
+ p->opts[p->num_opts*2+1] = talloc_strdup(p, val);
p->num_opts++;
p->opts[p->num_opts*2] = p->opts[p->num_opts*2+1] = NULL;
return 1;
@@ -505,7 +495,7 @@ void
m_config_set_profile(m_config_t* config, m_profile_t* p) {
int i;
if(config->profile_depth > MAX_PROFILE_DEPTH) {
- mp_msg(MSGT_CFGPARSER, MSGL_WARN, MSGTR_ProfileInclusionTooDeep);
+ mp_tmsg(MSGT_CFGPARSER, MSGL_WARN, "WARNING: Profile inclusion too deep.\n");
return;
}
config->profile_depth++;
@@ -523,10 +513,10 @@ parse_profile(const m_option_t *opt, const char *name, char *param, void *dst, i
if(param && !strcmp(param,"help")) {
m_profile_t* p;
if(!config->profiles) {
- mp_msg(MSGT_CFGPARSER, MSGL_INFO, MSGTR_NoProfileDefined);
+ mp_tmsg(MSGT_CFGPARSER, MSGL_INFO, "No profiles have been defined.\n");
return M_OPT_EXIT-1;
}
- mp_msg(MSGT_CFGPARSER, MSGL_INFO, MSGTR_AvailableProfiles);
+ mp_tmsg(MSGT_CFGPARSER, MSGL_INFO, "Available profiles:\n");
for(p = config->profiles ; p ; p = p->next)
mp_msg(MSGT_CFGPARSER, MSGL_INFO, "\t%s\t%s\n",p->name,
p->desc ? p->desc : "");
@@ -539,7 +529,7 @@ parse_profile(const m_option_t *opt, const char *name, char *param, void *dst, i
if(!list || !list[0]) return M_OPT_INVALID;
for(i = 0 ; list[i] ; i++)
if(!m_config_get_profile(config,list[i])) {
- mp_msg(MSGT_CFGPARSER, MSGL_WARN, MSGTR_UnknownProfile,
+ mp_tmsg(MSGT_CFGPARSER, MSGL_WARN, "Unknown profile '%s'.\n",
list[i]);
r = M_OPT_INVALID;
}
@@ -573,11 +563,11 @@ show_profile(m_option_t *opt, char* name, char *param) {
int i,j;
if(!param) return M_OPT_MISSING_PARAM;
if(!(p = m_config_get_profile(config,param))) {
- mp_msg(MSGT_CFGPARSER, MSGL_ERR, MSGTR_UnknownProfile, param);
+ mp_tmsg(MSGT_CFGPARSER, MSGL_ERR, "Unknown profile '%s'.\n", param);
return M_OPT_EXIT-1;
}
if(!config->profile_depth)
- mp_msg(MSGT_CFGPARSER, MSGL_INFO, MSGTR_Profile, param,
+ mp_tmsg(MSGT_CFGPARSER, MSGL_INFO, "Profile %s: %s\n", param,
p->desc ? p->desc : "");
config->profile_depth++;
for(i = 0 ; i < p->num_opts ; i++) {
diff --git a/m_config.h b/m_config.h
index 2805c40fd0..ad5acfc374 100644
--- a/m_config.h
+++ b/m_config.h
@@ -94,8 +94,8 @@ typedef struct m_config {
m_profile_t* profiles;
/// Depth when recursively including profiles.
int profile_depth;
- /// Options defined by the config itself.
- struct m_option* self_opts;
+
+ void *optstruct; // struct mpopts or other
} m_config_t;
/// \defgroup ConfigOptionFlags Config option flags
@@ -114,7 +114,8 @@ typedef struct m_config {
/** \ingroup Config
*/
m_config_t*
-m_config_new(void);
+m_config_new(void *optstruct,
+ int includefunc(struct m_option *conf, char *filename));
/// Free a config object.
void
diff --git a/m_option.c b/m_option.c
index 35e2b775c9..0b11e67e5d 100644
--- a/m_option.c
+++ b/m_option.c
@@ -798,8 +798,6 @@ static void set_func_param(const m_option_t* opt, void* dst, void* src) {
if(!s) return;
- // Revert if needed
- if(opt->priv) ((m_opt_default_func_t)opt->priv)(opt,opt->name);
for( ; s != NULL ; s = s->next)
((m_opt_func_param_t) opt->p)(opt,s->param);
}
@@ -847,18 +845,12 @@ const m_option_type_t m_option_type_func_full = {
/////////////// Func
#undef VAL
-#define VAL(x) (*(int*)(x))
static int parse_func(const m_option_t* opt,const char *name, char *param, void* dst, int src) {
- if(dst)
- VAL(dst) += 1;
return 0;
}
static void set_func(const m_option_t* opt,void* dst, void* src) {
- int i;
- if(opt->priv) ((m_opt_default_func_t)opt->priv)(opt,opt->name);
- for(i = 0 ; i < VAL(src) ; i++)
((m_opt_func_t) opt->p)(opt);
}
@@ -883,7 +875,7 @@ static int parse_print(const m_option_t* opt,const char *name, char *param, void
else if(opt->type == CONF_TYPE_PRINT_FUNC)
return ((m_opt_func_full_t) opt->p)(opt,name,param);
else
- mp_msg(MSGT_CFGPARSER, MSGL_INFO, "%s", (char *) opt->p);
+ mp_msg(MSGT_CFGPARSER, MSGL_INFO, "%s", mp_gtext(opt->p));
if(opt->priv == NULL)
return M_OPT_EXIT;
diff --git a/m_option.h b/m_option.h
index 3aa7ba930a..d66f670d2a 100644
--- a/m_option.h
+++ b/m_option.h
@@ -20,6 +20,7 @@
#define MPLAYER_M_OPTION_H
#include <string.h>
+#include <stddef.h>
/// \defgroup Options
/// m_option allows to parse, print and copy data of various types.
@@ -302,6 +303,10 @@ struct m_option {
* Passing a 'default func' is still valid for all func based option types.
*/
void* priv;
+
+ int new;
+
+ int offset;
};
@@ -496,20 +501,6 @@ m_option_print(const m_option_t* opt, const void* val_ptr) {
return (char*)-1;
}
-/// Helper around \ref m_option_type::save.
-inline static void
-m_option_save(const m_option_t* opt,void* dst, void* src) {
- if(opt->type->save)
- opt->type->save(opt,dst,src);
-}
-
-/// Helper around \ref m_option_type::set.
-inline static void
-m_option_set(const m_option_t* opt,void* dst, void* src) {
- if(opt->type->set)
- opt->type->set(opt,dst,src);
-}
-
/// Helper around \ref m_option_type::copy.
inline static void
m_option_copy(const m_option_t* opt,void* dst, void* src) {
@@ -528,4 +519,14 @@ m_option_free(const m_option_t* opt,void* dst) {
/*@}*/
+#define OPT_FLAG_ON(optname, varname, flags) {optname, NULL, &m_option_type_flag, flags, 0, 1, NULL, 1, offsetof(struct MPOpts, varname)}
+#define OPT_FLAG_OFF(optname, varname, flags) {optname, NULL, &m_option_type_flag, flags, 1, 0, NULL, 1, offsetof(struct MPOpts, varname)}
+#define OPT_FLAG_CONSTANTS(optname, varname, flags, offvalue, value) {optname, NULL, &m_option_type_flag, flags, offvalue, value, NULL, 1, offsetof(struct MPOpts, varname)}
+#define OPT_STRINGLIST(optname, varname, flags) {optname, NULL, &m_option_type_string_list, flags, 0, 0, NULL, 1, offsetof(struct MPOpts, varname)}
+#define OPT_INT(optname, varname, flags) {optname, NULL, &m_option_type_int, flags, 0, 0, NULL, 1, offsetof(struct MPOpts, varname)}
+#define OPT_INTRANGE(optname, varname, flags, min, max) {optname, NULL, &m_option_type_int, (flags)|CONF_RANGE, min, max, NULL, 1, offsetof(struct MPOpts, varname)}
+#define OPT_FLOATRANGE(optname, varname, flags, min, max) {optname, NULL, &m_option_type_float, (flags)|CONF_RANGE, min, max, NULL, 1, offsetof(struct MPOpts, varname)}
+#define OPT_STRING(optname, varname, flags) {optname, NULL, &m_option_type_string, flags, 0, 0, NULL, 1, offsetof(struct MPOpts, varname)}
+#define OPT_SETTINGSLIST(optname, varname, flags, objlist) {optname, NULL, &m_option_type_obj_settings_list, flags, 0, 0, objlist, 1, offsetof(struct MPOpts, varname)}
+
#endif /* MPLAYER_M_OPTION_H */
diff --git a/m_property.c b/m_property.c
index 8ab97d82e8..50b74b86ea 100644
--- a/m_property.c
+++ b/m_property.c
@@ -198,7 +198,7 @@ void m_properties_print_help_list(const m_option_t* list) {
char min[50],max[50];
int i,count = 0;
- mp_msg(MSGT_CFGPARSER, MSGL_INFO, MSGTR_PropertyListHeader);
+ mp_tmsg(MSGT_CFGPARSER, MSGL_INFO, "\n Name Type Min Max\n\n");
for(i = 0 ; list[i].name ; i++) {
const m_option_t* opt = &list[i];
if(opt->flags & M_OPT_MIN)
@@ -216,7 +216,7 @@ void m_properties_print_help_list(const m_option_t* list) {
max);
count++;
}
- mp_msg(MSGT_CFGPARSER, MSGL_INFO, MSGTR_TotalProperties, count);
+ mp_tmsg(MSGT_CFGPARSER, MSGL_INFO, "\nTotal: %d properties\n", count);
}
// Some generic property implementations
@@ -267,7 +267,8 @@ int m_property_flag_ro(const m_option_t* prop,int action,
switch(action) {
case M_PROPERTY_PRINT:
if(!arg) return 0;
- *(char**)arg = strdup((var > prop->min) ? MSGTR_Enabled : MSGTR_Disabled);
+ *(char**)arg = strdup((var > prop->min) ?
+ mp_gtext("enabled") : mp_gtext("disabled"));
return 1;
}
return m_property_int_ro(prop,action,arg,var);
diff --git a/mencoder.c b/mencoder.c
index 1265c0b227..bffa3b791d 100644
--- a/mencoder.c
+++ b/mencoder.c
@@ -55,6 +55,7 @@
#include <sys/time.h>
#include "mp_msg.h"
+#include "av_log.h"
#include "help_mp.h"
#include "codec-cfg.h"
@@ -99,9 +100,15 @@
#include "libavcodec/avcodec.h"
#include "libmpcodecs/ae.h"
+#include "options.h"
+#include "defaultopts.h"
+
+MPOpts opts;
+struct osd_state *osd;
+
+const int under_mencoder = 1;
int vo_doublebuffering=0;
int vo_directrendering=0;
-int vo_config_count=1;
int forced_subs_only=0;
//--------------------------
@@ -117,9 +124,6 @@ float stream_cache_seek_min_percent=50.0;
#define cache_fill_status 0
#endif
-int audio_id=-1;
-int video_id=-1;
-int dvdsub_id=-1;
int vobsub_id=-1;
char* audio_lang=NULL;
char* dvdsub_lang=NULL;
@@ -169,7 +173,6 @@ static int audio_density=2;
double force_fps=0;
static double force_ofps=0; // set to 24 for inverse telecine
static int skip_limit=-1;
-float playback_speed=1.0;
static int force_srate=0;
static int audio_output_format=0;
@@ -216,27 +219,30 @@ char *info_sourceform=NULL;
char *info_comment=NULL;
// Needed by libmpcodecs vf_vo.c
-int config_video_out(const vo_functions_t *vo, uint32_t width, uint32_t height,
- uint32_t d_width, uint32_t d_height, uint32_t flags,
- char *title, uint32_t format) {
- return 1;
-}
-// Needed by libmpdemux.
-int mp_input_check_interrupt(int time) {
- usec_sleep(time);
- return 0;
-}
+int vo_config(struct vo *vo, uint32_t width, uint32_t height,
+ uint32_t d_width, uint32_t d_height, uint32_t flags,
+ char *title, uint32_t format) { abort(); }
+int vo_control(struct vo *vo, uint32_t request, void *data) { abort(); }
+void vo_seek_reset(struct vo *vo) { abort(); }
+int vo_draw_image(struct vo *vo, struct mp_image *mpi, double pts) { abort(); }
+int vo_draw_frame(struct vo *vo, uint8_t *src[]) { abort(); }
+int vo_draw_slice(struct vo *vo, uint8_t *src[], int stride[], int w, int h, int x, int y) { abort(); }
+void vo_draw_osd(struct vo *vo, struct osd_state *osd) { abort(); }
+void vo_flip_page(struct vo *vo, uint32_t pts_us, int duration) { abort(); }
+void vo_check_events(struct vo *vo) { abort(); }
+
// Needed by getch2
-void mplayer_put_key(int code)
+struct mp_fifo;
+void mplayer_put_key(struct mp_fifo *fifo, int code)
{
}
-#include "libass/ass_mp.h"
+#include "ass_mp.h"
char *current_module;
#include "mpcommon.h"
// Needed by mpcommon.c
-void set_osd_subtitle(subtitle *subs) {
+void set_osd_subtitle(struct MPContext *mpctx, subtitle *subs) {
vo_sub = subs;
vo_osd_changed(OSDTYPE_SUBTITLE);
}
@@ -309,9 +315,9 @@ static int edl_seek(edl_record_ptr next_edl_record, demuxer_t* demuxer, demux_st
static void mencoder_exit(int level, const char *how)
{
if (how)
- mp_msg(MSGT_MENCODER, MSGL_INFO, MSGTR_ExitingHow, how);
+ mp_tmsg(MSGT_MENCODER, MSGL_INFO, "\nExiting... (%s)\n", how);
else
- mp_msg(MSGT_MENCODER, MSGL_INFO, MSGTR_Exiting);
+ mp_tmsg(MSGT_MENCODER, MSGL_INFO, "\nExiting...\n");
exit(level);
}
@@ -321,14 +327,14 @@ static void parse_cfgfiles( m_config_t* conf )
char *conffile;
if (!disable_system_conf &&
m_config_parse_config_file(conf, MPLAYER_CONFDIR "/mencoder.conf") < 0)
- mencoder_exit(1,MSGTR_ConfigFileError);
+ mencoder_exit(1,_("config file error"));
if (!disable_user_conf) {
if ((conffile = get_path("mencoder.conf")) == NULL) {
- mp_msg(MSGT_CPLAYER,MSGL_ERR,MSGTR_GetpathProblem);
+ mp_tmsg(MSGT_CPLAYER,MSGL_ERR,"get_path(\"config\") problem\n");
} else {
if (m_config_parse_config_file(conf, conffile) < 0)
- mencoder_exit(1,MSGTR_ConfigFileError);
+ mencoder_exit(1,_("config file error"));
free(conffile);
}
}
@@ -342,7 +348,6 @@ static int dec_audio(sh_audio_t *sh_audio,unsigned char* buffer,int total){
int at_eof=0;
while(size<total && !at_eof){
int len=total-size;
- if(len>MAX_OUTBURST) len=MAX_OUTBURST;
if (decode_audio(sh_audio, len) < 0) at_eof=1;
if(len>sh_audio->a_out_buffer_len) len=sh_audio->a_out_buffer_len;
fast_memcpy(buffer+size,sh_audio->a_out_buffer,len);
@@ -418,12 +423,12 @@ ao_data_t ao_data = {0,0,0,0,OUTBURST,-1,0};
audio_encoding_params_t aparams;
audio_encoder_t *aencoder = NULL;
-user_correct_pts = 0;
-
mp_msg_init();
+ set_av_log_callback();
// Create the config context and register the options
- mconfig = m_config_new();
+ set_default_mencoder_options(&opts);
+ mconfig = m_config_new(&opts, cfg_include);
m_config_register_options(mconfig,mencoder_opts);
// Preparse the command line
@@ -444,19 +449,19 @@ if(!codecs_file || !parse_codec_cfg(codecs_file)){
if(!parse_codec_cfg(NULL)){
mencoder_exit(1,NULL);
}
- mp_msg(MSGT_MENCODER,MSGL_V,MSGTR_BuiltinCodecsConf);
+ mp_tmsg(MSGT_MENCODER,MSGL_V,"Using built-in default codecs.conf.\n");
}
}
}
parse_cfgfiles(mconfig);
filelist = m_config_parse_me_command_line(mconfig, argc, argv);
- if(!filelist) mencoder_exit(1, MSGTR_ErrorParsingCommandLine);
+ if(!filelist) mencoder_exit(1, _("error parsing command line"));
{
char *extension;
- if (!out_filename) mencoder_exit(1,MSGTR_MissingOutputFilename);
+ if (!out_filename) mencoder_exit(1,_("No output file specified, please see the -o option."));
extension=strrchr(out_filename,'.');
if (extension != NULL && strlen(extension) > 3 && strlen(extension) < 6)
{
@@ -466,14 +471,14 @@ if(!codecs_file || !parse_codec_cfg(codecs_file)){
{
case MUXER_TYPE_AVI:
if (strcasecmp(extension,"avi"))
- mp_msg(MSGT_MENCODER, MSGL_WARN, MSGTR_MencoderWrongFormatAVI);
+ mp_tmsg(MSGT_MENCODER, MSGL_WARN, "\nWARNING: OUTPUT FILE FORMAT IS _AVI_. See -of help.\n");
break;
case MUXER_TYPE_MPEG:
if (strcasecmp(extension,"mpg") &&
strcasecmp(extension,"mpeg") &&
strcasecmp(extension,"vob"))
- mp_msg(MSGT_MENCODER, MSGL_WARN, MSGTR_MencoderWrongFormatMPG);
+ mp_tmsg(MSGT_MENCODER, MSGL_WARN, "\nWARNING: OUTPUT FILE FORMAT IS _MPEG_. See -of help.\n");
break;
}
}
@@ -481,13 +486,16 @@ if(!codecs_file || !parse_codec_cfg(codecs_file)){
/* Display what configure line was used */
mp_msg(MSGT_MENCODER, MSGL_V, "Configuration: " CONFIGURATION "\n");
+#define FormatNotRecognized _("============ Sorry, this file format is not recognized/supported =============\n"\
+"=== If this file is an AVI, ASF or MPEG stream, please contact the author! ===\n")
+
if (frameno_filename) {
stream2=open_stream(frameno_filename,0,&i);
if(stream2){
- demuxer2=demux_open(stream2,DEMUXER_TYPE_AVI,-1,-1,-2,NULL);
- if(demuxer2) mp_msg(MSGT_MENCODER, MSGL_INFO, MSGTR_UsingPass3ControlFile, frameno_filename);
- else mp_msg(MSGT_DEMUXER,MSGL_ERR,MSGTR_FormatNotRecognized);
+ demuxer2=demux_open(&opts, stream2,DEMUXER_TYPE_AVI,-1,-1,-2,NULL);
+ if(demuxer2) mp_tmsg(MSGT_MENCODER, MSGL_INFO, "Using pass3 control file: %s\n", frameno_filename);
+ else mp_tmsg(MSGT_DEMUXER,MSGL_ERR, FormatNotRecognized);
}
}
@@ -506,7 +514,7 @@ if (frameno_filename) {
#ifdef CONFIG_BITMAP_FONT
if(font_name){
vo_font=read_font_desc(font_name,font_factor,verbose>1);
- if(!vo_font) mp_msg(MSGT_CPLAYER,MSGL_ERR,MSGTR_CantLoadFont,font_name);
+ if(!vo_font) mp_tmsg(MSGT_CPLAYER,MSGL_ERR,"Cannot load bitmap font: %s\n",font_name);
} else {
// try default:
vo_font=read_font_desc(get_path("font/font.desc"),font_factor,verbose>1);
@@ -518,7 +526,7 @@ if (frameno_filename) {
}
#endif
- vo_init_osd();
+ osd = osd_create();
/* HACK, for some weird reason, push() has to be called twice,
otherwise options are not saved correctly */
@@ -529,29 +537,29 @@ play_next_file:
filename = filelist[curfile].name;
if(!filename){
- mp_msg(MSGT_CPLAYER, MSGL_FATAL, MSGTR_MissingFilename);
+ mp_tmsg(MSGT_CPLAYER, MSGL_FATAL, "\nFilename missing.\n\n");
mencoder_exit(1,NULL);
}
stream=open_stream(filename,0,&file_format);
if(!stream){
- mp_msg(MSGT_CPLAYER, MSGL_FATAL, MSGTR_CannotOpenFile_Device);
+ mp_tmsg(MSGT_CPLAYER, MSGL_FATAL, "Cannot open file/device.\n");
mencoder_exit(1,NULL);
}
- mp_msg(MSGT_CPLAYER, MSGL_INFO, MSGTR_OpenedStream, file_format, (int)(stream->start_pos), (int)(stream->end_pos));
+ mp_tmsg(MSGT_CPLAYER, MSGL_INFO, "success: format: %d data: 0x%X - 0x%x\n", file_format, (int)(stream->start_pos), (int)(stream->end_pos));
#ifdef CONFIG_DVDREAD
if(stream->type==STREAMTYPE_DVD){
- if(audio_lang && audio_id==-1) audio_id=dvd_aid_from_lang(stream,audio_lang);
- if(dvdsub_lang && dvdsub_id==-1) dvdsub_id=dvd_sid_from_lang(stream,dvdsub_lang);
+ if(audio_lang && opts.audio_id==-1) opts.audio_id=dvd_aid_from_lang(stream,audio_lang);
+ if(dvdsub_lang && opts.sub_id==-1) opts.sub_id=dvd_sid_from_lang(stream,dvdsub_lang);
}
#endif
#ifdef CONFIG_DVDNAV
if(stream->type==STREAMTYPE_DVDNAV){
- if(audio_lang && audio_id==-1) audio_id=mp_dvdnav_aid_from_lang(stream,audio_lang);
- if(dvdsub_lang && dvdsub_id==-1) dvdsub_id=mp_dvdnav_sid_from_lang(stream,dvdsub_lang);
+ if(audio_lang && opts.audio_id==-1) opts.audio_id=mp_dvdnav_aid_from_lang(stream,audio_lang);
+ if(dvdsub_lang && opts.sub_id==-1) opts.sub_id=mp_dvdnav_sid_from_lang(stream,dvdsub_lang);
}
#endif
@@ -559,35 +567,35 @@ if(stream->type==STREAMTYPE_DVDNAV){
if(stream_cache_size>0) stream_enable_cache(stream,stream_cache_size*1024,0,0);
- if(demuxer2) audio_id=-2; /* do NOT read audio packets... */
+ if(demuxer2) opts.audio_id=-2; /* do NOT read audio packets... */
- //demuxer=demux_open(stream,file_format,video_id,audio_id,dvdsub_id);
- demuxer=demux_open(stream,file_format,audio_id,video_id,dvdsub_id,filename);
+ //demuxer=demux_open(stream,file_format,opts.video_id,opts.audio_id,opts.sub_id);
+ demuxer=demux_open(&opts, stream,file_format,opts.audio_id,opts.video_id,opts.sub_id,filename);
if(!demuxer){
- mp_msg(MSGT_DEMUXER, MSGL_FATAL, MSGTR_FormatNotRecognized);
- mp_msg(MSGT_DEMUXER, MSGL_FATAL, MSGTR_CannotOpenDemuxer);
+ mp_tmsg(MSGT_DEMUXER, MSGL_FATAL, FormatNotRecognized);
+ mp_tmsg(MSGT_DEMUXER, MSGL_FATAL, "Cannot open demuxer.\n");
mencoder_exit(1,NULL);
}
if (ts_prog) {
demux_program_t prog = { .progid = ts_prog };
if (demux_control(demuxer, DEMUXER_CTRL_IDENTIFY_PROGRAM, &prog) != DEMUXER_CTRL_NOTIMPL) {
- audio_id = prog.aid; // switching is handled by select_audio below
- video_id = prog.vid;
- demuxer_switch_video(demuxer, video_id);
+ opts.audio_id = prog.aid; // switching is handled by select_audio below
+ opts.video_id = prog.vid;
+ demuxer_switch_video(demuxer, opts.video_id);
}
}
- select_audio(demuxer, audio_id, audio_lang);
+ select_audio(demuxer, opts.audio_id, audio_lang);
- if (dvdsub_id == -1 && dvdsub_lang)
- dvdsub_id = demuxer_sub_track_by_lang(demuxer, dvdsub_lang);
+ if (opts.sub_id < -1 && dvdsub_lang)
+ opts.sub_id = demuxer_sub_track_by_lang(demuxer, dvdsub_lang);
- if (dvdsub_id == -1)
- dvdsub_id = demuxer_default_sub_track(demuxer);
+ if (opts.sub_id < -1)
+ opts.sub_id = demuxer_default_sub_track(demuxer);
for (i = 0; i < MAX_S_STREAMS; i++) {
sh_sub_t *sh = demuxer->s_streams[i];
- if (sh && sh->sid == dvdsub_id) {
+ if (sh && sh->sid == opts.sub_id) {
demuxer->sub->id = i;
demuxer->sub->sh = sh;
break;
@@ -595,8 +603,8 @@ if(stream->type==STREAMTYPE_DVDNAV){
}
if(dvd_chapter>1) {
- float pts;
- if (demuxer_seek_chapter(demuxer, dvd_chapter-1, 1, &pts, NULL, NULL) >= 0 && pts > -1.0)
+ double pts;
+ if (demuxer_seek_chapter(demuxer, dvd_chapter-1, &pts, NULL) >= 0 && pts > -1.0)
seek_to_sec = pts;
}
@@ -608,16 +616,16 @@ sh_video=d_video->sh;
if(!sh_video)
{
- mp_msg(MSGT_CPLAYER,MSGL_FATAL,MSGTR_VideoStreamRequired);
+ mp_tmsg(MSGT_CPLAYER,MSGL_FATAL,"Video stream is mandatory!\n");
mencoder_exit(1,NULL);
}
if(!video_read_properties(sh_video)){
- mp_msg(MSGT_CPLAYER, MSGL_FATAL, MSGTR_CannotReadVideoProperties);
+ mp_tmsg(MSGT_CPLAYER, MSGL_FATAL, "Video: Cannot read properties.\n");
mencoder_exit(1,NULL);
}
- mp_msg(MSGT_MENCODER,MSGL_INFO, MSGTR_FilefmtFourccSizeFpsFtime,
+ mp_tmsg(MSGT_MENCODER,MSGL_INFO, "[V] filefmt:%d fourcc:0x%X size:%dx%d fps:%5.3f ftime:=%6.4f\n",
demuxer->file_format,sh_video->format, sh_video->disp_w,sh_video->disp_h,
sh_video->fps,sh_video->frametime
);
@@ -625,21 +633,21 @@ sh_video=d_video->sh;
if(force_fps){
sh_video->fps=force_fps;
sh_video->frametime=1.0f/sh_video->fps;
- mp_msg(MSGT_MENCODER,MSGL_INFO,MSGTR_ForcingInputFPS, sh_video->fps);
+ mp_tmsg(MSGT_MENCODER,MSGL_INFO,"Input fps will be interpreted as %5.3f instead.\n", sh_video->fps);
}
if(sh_audio && out_audio_codec<0){
- if(audio_id==-2)
- mp_msg(MSGT_MENCODER,MSGL_ERR,MSGTR_DemuxerDoesntSupportNosound);
- mp_msg(MSGT_MENCODER,MSGL_FATAL,MSGTR_NoAudioEncoderSelected);
+ if(opts.audio_id==-2)
+ mp_tmsg(MSGT_MENCODER,MSGL_ERR,"This demuxer doesn't support -nosound yet.\n");
+ mp_tmsg(MSGT_MENCODER,MSGL_FATAL,"\nNo audio encoder (-oac) selected. Select one (see -oac help) or use -nosound.\n");
mencoder_exit(1,NULL);
}
if(sh_video && out_video_codec<0){
- mp_msg(MSGT_MENCODER,MSGL_FATAL,MSGTR_NoVideoEncoderSelected);
+ mp_tmsg(MSGT_MENCODER,MSGL_FATAL,"\nNo video encoder (-ovc) selected. Select one (see -ovc help).\n");
mencoder_exit(1,NULL);
}
-if(sh_audio && (out_audio_codec || seek_to_sec || !sh_audio->wf || playback_speed != 1.0)){
+if(sh_audio && (out_audio_codec || seek_to_sec || !sh_audio->wf || opts.playback_speed != 1.0)){
// Go through the codec.conf and find the best codec...
mp_msg(MSGT_CPLAYER,MSGL_INFO,"==========================================================================\n");
if(!init_best_audio_codec(sh_audio,audio_codec_list,audio_fm_list)){
@@ -650,12 +658,12 @@ if(sh_audio && (out_audio_codec || seek_to_sec || !sh_audio->wf || playback_spee
if (sh_audio) {
new_srate = sh_audio->samplerate;
- if (playback_speed != 1.0) {
- new_srate *= playback_speed;
+ if (opts.playback_speed != 1.0) {
+ new_srate *= opts.playback_speed;
// limits are taken from libaf/af_resample.c
if (new_srate < 8000) new_srate = 8000;
if (new_srate > 192000) new_srate = 192000;
- playback_speed = (float)new_srate / (float)sh_audio->samplerate;
+ opts.playback_speed = (float)new_srate / (float)sh_audio->samplerate;
}
}
@@ -665,7 +673,7 @@ if(sh_audio && (out_audio_codec || seek_to_sec || !sh_audio->wf || playback_spee
// current_module="read_subtitles_file";
if(sub_name && sub_name[0]){
subdata=sub_read_file(sub_name[0], sh_video->fps);
- if(!subdata) mp_msg(MSGT_CPLAYER,MSGL_ERR,MSGTR_CantLoadSub,sub_name[0]);
+ if(!subdata) mp_tmsg(MSGT_CPLAYER,MSGL_ERR,"Cannot load subtitles: %s\n",sub_name[0]);
} else
if(sub_auto && filename) { // auto load sub file ...
char **tmp = NULL;
@@ -685,7 +693,7 @@ if (!curfile) { // curfile is non zero when a second file is opened
if (vobsub_out) {
unsigned int palette[16], width, height;
unsigned char tmp[3] = { 0, 0, 0 };
- if (spudec_ifo && vobsub_parse_ifo(NULL,spudec_ifo, palette, &width, &height, 1, dvdsub_id, tmp) >= 0)
+ if (spudec_ifo && vobsub_parse_ifo(NULL,spudec_ifo, palette, &width, &height, 1, opts.sub_id, tmp) >= 0)
vobsub_writer = vobsub_out_open(vobsub_out, palette, sh_video->disp_w, sh_video->disp_h,
vobsub_out_id?vobsub_out_id:(char *)tmp, vobsub_out_index);
#ifdef CONFIG_DVDREAD
@@ -695,7 +703,7 @@ if (vobsub_out) {
int i;
dvd_priv_t *dvd = (dvd_priv_t*)stream->priv;
for (i = 0; i < dvd->nr_of_subtitles; ++i)
- if (dvd->subtitles[i].id == dvdsub_id) {
+ if (dvd->subtitles[i].id == opts.sub_id) {
tmp[0] = (dvd->subtitles[i].language >> 8) & 0xff;
tmp[1] = dvd->subtitles[i].language & 0xff;
tmp[2] = 0;
@@ -726,13 +734,13 @@ if (vo_spudec)
ostream = open_output_stream(out_filename, 0);
if(!ostream) {
- mp_msg(MSGT_MENCODER, MSGL_FATAL, MSGTR_CannotOpenOutputFile, out_filename);
+ mp_tmsg(MSGT_MENCODER, MSGL_FATAL, "Cannot open output file '%s'.\n", out_filename);
mencoder_exit(1,NULL);
}
muxer=muxer_new_muxer(out_file_format,ostream);
if(!muxer) {
- mp_msg(MSGT_MENCODER, MSGL_FATAL, MSGTR_CannotInitializeMuxer);
+ mp_tmsg(MSGT_MENCODER, MSGL_FATAL, "Cannot initialize muxer.");
mencoder_exit(1,NULL);
}
#if 0
@@ -754,14 +762,14 @@ mux_v->source=sh_video;
mux_v->h.dwSampleSize=0; // VBR
#ifdef CONFIG_LIBAVCODEC
{
- double fps = force_ofps?force_ofps:sh_video->fps*playback_speed;
+ double fps = force_ofps?force_ofps:sh_video->fps*opts.playback_speed;
AVRational q= av_d2q(fps, fps*1001+2);
mux_v->h.dwScale= q.den;
mux_v->h.dwRate = q.num;
}
#else
mux_v->h.dwScale=10000;
-mux_v->h.dwRate=mux_v->h.dwScale*(force_ofps?force_ofps:sh_video->fps*playback_speed);
+mux_v->h.dwRate=mux_v->h.dwScale*(force_ofps?force_ofps:sh_video->fps*opts.playback_speed);
#endif
mux_v->codec=out_video_codec;
@@ -790,7 +798,7 @@ case VCODEC_COPY:
mux_v->bih->biSizeImage=mux_v->bih->biWidth*mux_v->bih->biHeight*(mux_v->bih->biBitCount/8);
}
}
- mp_msg(MSGT_MENCODER, MSGL_INFO, MSGTR_VCodecFramecopy,
+ mp_tmsg(MSGT_MENCODER, MSGL_INFO, "videocodec: framecopy (%dx%d %dbpp fourcc=%x)\n",
mux_v->bih->biWidth, mux_v->bih->biHeight,
mux_v->bih->biBitCount, mux_v->bih->biCompression);
@@ -799,10 +807,10 @@ case VCODEC_COPY:
if ((mux_v->bih->biSize != sh_video->bih->biSize) ||
memcmp(mux_v->bih, sh_video->bih, sh_video->bih->biSize))
{
- mp_msg(MSGT_MENCODER, MSGL_INFO, MSGTR_VCodecFramecopy,
+ mp_tmsg(MSGT_MENCODER, MSGL_INFO, "videocodec: framecopy (%dx%d %dbpp fourcc=%x)\n",
sh_video->bih->biWidth, sh_video->bih->biHeight,
sh_video->bih->biBitCount, sh_video->bih->biCompression);
- mp_msg(MSGT_MENCODER,MSGL_FATAL,MSGTR_FrameCopyFileMismatch);
+ mp_tmsg(MSGT_MENCODER,MSGL_FATAL,"\nAll video files must have identical fps, resolution, and codec for -ovc copy.\n");
mencoder_exit(1,NULL);
}
}
@@ -810,9 +818,9 @@ case VCODEC_COPY:
if ((mux_v->bih->biWidth != sh_video->disp_w) ||
(mux_v->bih->biHeight != sh_video->disp_h) ||
(mux_v->bih->biCompression != sh_video->format)) {
- mp_msg(MSGT_MENCODER, MSGL_INFO, MSGTR_VCodecFramecopy,
+ mp_tmsg(MSGT_MENCODER, MSGL_INFO, "videocodec: framecopy (%dx%d %dbpp fourcc=%x)\n",
sh_video->disp_w, sh_video->disp_w, 24, sh_video->format);
- mp_msg(MSGT_MENCODER,MSGL_FATAL,MSGTR_FrameCopyFileMismatch);
+ mp_tmsg(MSGT_MENCODER,MSGL_FATAL,"\nAll video files must have identical fps, resolution, and codec for -ovc copy.\n");
mencoder_exit(1,NULL);
}
}
@@ -835,24 +843,24 @@ default: {
if (!ve) {
switch(mux_v->codec){
case VCODEC_LIBAVCODEC:
- sh_video->vfilter=vf_open_encoder(NULL,"lavc",(char *)mux_v); break;
+ sh_video->vfilter=vf_open_encoder(&opts, NULL,"lavc",(char *)mux_v); break;
case VCODEC_RAW:
- sh_video->vfilter=vf_open_encoder(NULL,"raw",(char *)mux_v); break;
+ sh_video->vfilter=vf_open_encoder(&opts, NULL,"raw",(char *)mux_v); break;
case VCODEC_VFW:
- sh_video->vfilter=vf_open_encoder(NULL,"vfw",(char *)mux_v); break;
+ sh_video->vfilter=vf_open_encoder(&opts, NULL,"vfw",(char *)mux_v); break;
case VCODEC_LIBDV:
- sh_video->vfilter=vf_open_encoder(NULL,"libdv",(char *)mux_v); break;
+ sh_video->vfilter=vf_open_encoder(&opts, NULL,"libdv",(char *)mux_v); break;
case VCODEC_XVID:
- sh_video->vfilter=vf_open_encoder(NULL,"xvid",(char *)mux_v); break;
+ sh_video->vfilter=vf_open_encoder(&opts, NULL,"xvid",(char *)mux_v); break;
case VCODEC_QTVIDEO:
- sh_video->vfilter=vf_open_encoder(NULL,"qtvideo",(char *)mux_v); break;
+ sh_video->vfilter=vf_open_encoder(&opts, NULL,"qtvideo",(char *)mux_v); break;
case VCODEC_NUV:
- sh_video->vfilter=vf_open_encoder(NULL,"nuv",(char *)mux_v); break;
+ sh_video->vfilter=vf_open_encoder(&opts, NULL,"nuv",(char *)mux_v); break;
case VCODEC_X264:
- sh_video->vfilter=vf_open_encoder(NULL,"x264",(char *)mux_v); break;
+ sh_video->vfilter=vf_open_encoder(&opts, NULL,"x264",(char *)mux_v); break;
}
if(!mux_v->bih || !sh_video->vfilter){
- mp_msg(MSGT_MENCODER,MSGL_FATAL,MSGTR_EncoderOpenFailed);
+ mp_tmsg(MSGT_MENCODER,MSGL_FATAL,"Failed to open the encoder.\n");
mencoder_exit(1,NULL);
}
ve = sh_video->vfilter;
@@ -860,9 +868,9 @@ default: {
// append 'expand' filter, it fixes stride problems and renders osd:
if (auto_expand) {
char* vf_args[] = { "osd", "1", NULL };
- sh_video->vfilter=vf_open_filter(sh_video->vfilter,"expand",vf_args);
+ sh_video->vfilter=vf_open_filter(&opts, sh_video->vfilter,"expand",vf_args);
}
- sh_video->vfilter=append_filters(sh_video->vfilter);
+ sh_video->vfilter=append_filters(sh_video->vfilter, opts.vf_settings);
mp_msg(MSGT_CPLAYER,MSGL_INFO,"==========================================================================\n");
init_best_video_codec(sh_video,video_codec_list,video_fm_list);
@@ -877,7 +885,7 @@ if ((force_fourcc != NULL) && (strlen(force_fourcc) >= 4))
{
mux_v->bih->biCompression = mmioFOURCC(force_fourcc[0], force_fourcc[1],
force_fourcc[2], force_fourcc[3]);
- mp_msg(MSGT_MENCODER, MSGL_INFO, MSGTR_ForcingOutputFourcc,
+ mp_tmsg(MSGT_MENCODER, MSGL_INFO, "Forcing output FourCC to %x [%.4s].\n",
mux_v->bih->biCompression, (char *)&mux_v->bih->biCompression);
}
@@ -894,7 +902,7 @@ if (force_audiofmttag != -1) {
if (sh_audio->wf) {
sh_audio->wf->wFormatTag = sh_audio->format;
}
- mp_msg(MSGT_MENCODER, MSGL_INFO, MSGTR_ForcingOutputAudiofmtTag,
+ mp_tmsg(MSGT_MENCODER, MSGL_INFO, "Forcing output audio format tag to 0x%x.\n",
force_audiofmttag);
}
@@ -903,7 +911,7 @@ mux_a=muxer_new_stream(muxer,MUXER_TYPE_AUDIO);
mux_a->buffer_size=0x100000; //16384;
mux_a->buffer=malloc(mux_a->buffer_size);
if (!mux_a->buffer)
- mencoder_exit(1,MSGTR_MemAllocFailed);
+ mencoder_exit(1,_("Memory allocation failed.\n"));
mux_a->source=sh_audio;
@@ -917,7 +925,7 @@ if(!init_audio_filters(sh_audio,
new_srate,
// output:
&ao_data.samplerate, &ao_data.channels, &ao_data.format)) {
- mp_msg(MSGT_CPLAYER,MSGL_ERR,MSGTR_AudioFilterChainPreinitError);
+ mp_tmsg(MSGT_CPLAYER,MSGL_ERR,"Error at audio filter chain pre-init!\n");
mencoder_exit(1, NULL);
}
@@ -931,15 +939,19 @@ if(mux_a->codec != ACODEC_COPY) {
if(!init_audio_filters(sh_audio,
new_srate,
&aparams.sample_rate, &aparams.channels, &aencoder->input_format)) {
- mp_msg(MSGT_CPLAYER,MSGL_FATAL,MSGTR_NoMatchingFilter);
+ mp_tmsg(MSGT_CPLAYER,MSGL_FATAL,"Couldn't find matching filter/ao format!\n");
mencoder_exit(1,NULL);
}
}
+
+#define NoSpeedWithFrameCopy _("WARNING: -speed is not guaranteed to work correctly with -oac copy!\n"\
+"Your encode might be broken!\n")
+
switch(mux_a->codec){
case ACODEC_COPY:
- if (playback_speed != 1.0) mp_msg(MSGT_CPLAYER, MSGL_WARN, MSGTR_NoSpeedWithFrameCopy);
+ if (opts.playback_speed != 1.0) mp_tmsg(MSGT_CPLAYER, MSGL_WARN, NoSpeedWithFrameCopy);
if (sh_audio->format >= 0x10000) {
- mp_msg(MSGT_MENCODER,MSGL_ERR,MSGTR_CantCopyAudioFormat, sh_audio->format);
+ mp_tmsg(MSGT_MENCODER,MSGL_ERR,"Audio format 0x%x is incompatible with '-oac copy', please try '-oac pcm' instead or use '-fafmttag' to override it.\n", sh_audio->format);
mencoder_exit(1,NULL);
}
if (sh_audio->wf){
@@ -965,9 +977,9 @@ case ACODEC_COPY:
mux_a->h.dwScale=mux_a->h.dwSampleSize;
mux_a->h.dwRate=mux_a->wf->nAvgBytesPerSec;
}
- mux_a->h.dwRate *= playback_speed;
- mux_a->wf->nSamplesPerSec *= playback_speed;
- mp_msg(MSGT_MENCODER, MSGL_INFO, MSGTR_ACodecFramecopy,
+ mux_a->h.dwRate *= opts.playback_speed;
+ mux_a->wf->nSamplesPerSec *= opts.playback_speed;
+ mp_tmsg(MSGT_MENCODER, MSGL_INFO, "audiocodec: framecopy (format=%x chans=%d rate=%d bits=%d B/s=%d sample-%d)\n",
mux_a->wf->wFormatTag, mux_a->wf->nChannels, mux_a->wf->nSamplesPerSec,
mux_a->wf->wBitsPerSample, mux_a->wf->nAvgBytesPerSec, mux_a->h.dwSampleSize);
break;
@@ -992,34 +1004,34 @@ timer_start=GetTimerMS();
} // if (!curfile) // if this was the first file.
else {
if (!mux_a != !sh_audio) {
- mp_msg(MSGT_MENCODER,MSGL_FATAL,MSGTR_NoAudioFileMismatch);
+ mp_tmsg(MSGT_MENCODER,MSGL_FATAL,"\nCannot mix video-only files with audio and video files. Try -nosound.\n");
mencoder_exit(1,NULL);
}
if (sh_audio && mux_a->codec == ACODEC_COPY) {
- if (playback_speed != 1.0) mp_msg(MSGT_CPLAYER, MSGL_WARN, MSGTR_NoSpeedWithFrameCopy);
- mp_msg(MSGT_MENCODER, MSGL_INFO, MSGTR_ACodecFramecopy,
+ if (opts.playback_speed != 1.0) mp_tmsg(MSGT_CPLAYER, MSGL_WARN, NoSpeedWithFrameCopy);
+ mp_tmsg(MSGT_MENCODER, MSGL_INFO, "audiocodec: framecopy (format=%x chans=%d rate=%d bits=%d B/s=%d sample-%d)\n",
mux_a->wf->wFormatTag, mux_a->wf->nChannels, mux_a->wf->nSamplesPerSec,
mux_a->wf->wBitsPerSample, mux_a->wf->nAvgBytesPerSec, mux_a->h.dwSampleSize);
if (sh_audio->wf) {
if ((mux_a->wf->wFormatTag != sh_audio->wf->wFormatTag) ||
(mux_a->wf->nChannels != sh_audio->wf->nChannels) ||
- (mux_a->wf->nSamplesPerSec != sh_audio->wf->nSamplesPerSec * playback_speed))
+ (mux_a->wf->nSamplesPerSec != sh_audio->wf->nSamplesPerSec * opts.playback_speed))
{
- mp_msg(MSGT_MENCODER, MSGL_INFO, MSGTR_ACodecFramecopy,
- sh_audio->wf->wFormatTag, sh_audio->wf->nChannels, (int)(sh_audio->wf->nSamplesPerSec * playback_speed),
+ mp_tmsg(MSGT_MENCODER, MSGL_INFO, "audiocodec: framecopy (format=%x chans=%d rate=%d bits=%d B/s=%d sample-%d)\n",
+ sh_audio->wf->wFormatTag, sh_audio->wf->nChannels, (int)(sh_audio->wf->nSamplesPerSec * opts.playback_speed),
sh_audio->wf->wBitsPerSample, sh_audio->wf->nAvgBytesPerSec, 0);
- mp_msg(MSGT_MENCODER,MSGL_FATAL,MSGTR_AudioCopyFileMismatch);
+ mp_tmsg(MSGT_MENCODER,MSGL_FATAL,"\nAll files must have identical audio codec and format for -oac copy.\n");
mencoder_exit(1,NULL);
}
} else {
if ((mux_a->wf->wFormatTag != sh_audio->format) ||
(mux_a->wf->nChannels != sh_audio->channels) ||
- (mux_a->wf->nSamplesPerSec != sh_audio->samplerate * playback_speed))
+ (mux_a->wf->nSamplesPerSec != sh_audio->samplerate * opts.playback_speed))
{
- mp_msg(MSGT_MENCODER, MSGL_INFO, MSGTR_ACodecFramecopy,
- sh_audio->wf->wFormatTag, sh_audio->wf->nChannels, (int)(sh_audio->wf->nSamplesPerSec * playback_speed),
+ mp_tmsg(MSGT_MENCODER, MSGL_INFO, "audiocodec: framecopy (format=%x chans=%d rate=%d bits=%d B/s=%d sample-%d)\n",
+ sh_audio->wf->wFormatTag, sh_audio->wf->nChannels, (int)(sh_audio->wf->nSamplesPerSec * opts.playback_speed),
sh_audio->wf->wBitsPerSample, sh_audio->wf->nAvgBytesPerSec, 0);
- mp_msg(MSGT_MENCODER,MSGL_FATAL,MSGTR_AudioCopyFileMismatch);
+ mp_tmsg(MSGT_MENCODER,MSGL_FATAL,"\nAll files must have identical audio codec and format for -oac copy.\n");
mencoder_exit(1,NULL);
}
}
@@ -1030,7 +1042,7 @@ else {
if (!init_audio_filters(sh_audio, new_srate,
&out_srate, &out_channels,
&out_format)) {
- mp_msg(MSGT_CPLAYER, MSGL_FATAL, MSGTR_NoMatchingFilter);
+ mp_tmsg(MSGT_CPLAYER, MSGL_FATAL, "Couldn't find matching filter/ao format!\n");
mencoder_exit(1, NULL);
}
mux_a->wf->nSamplesPerSec = out_srate;
@@ -1050,18 +1062,18 @@ if (seek_to_sec) {
if (out_file_format == MUXER_TYPE_MPEG)
{
if (audio_preload > 0.4) {
- mp_msg(MSGT_MENCODER, MSGL_WARN, MSGTR_LimitingAudioPreload);
+ mp_tmsg(MSGT_MENCODER, MSGL_WARN, "Limiting audio preload to 0.4s.\n");
audio_preload = 0.4;
}
if (audio_density < 4) {
- mp_msg(MSGT_MENCODER, MSGL_WARN, MSGTR_IncreasingAudioDensity);
+ mp_tmsg(MSGT_MENCODER, MSGL_WARN, "Increasing audio density to 4.\n");
audio_density = 4;
}
}
if(file_format == DEMUXER_TYPE_TV)
{
- mp_msg(MSGT_MENCODER, MSGL_WARN, MSGTR_ZeroingAudioPreloadAndMaxPtsCorrection);
+ mp_tmsg(MSGT_MENCODER, MSGL_WARN, "Forcing audio preload to 0, max pts correction to 0.\n");
audio_preload = 0.0;
default_max_pts_correction = 0;
}
@@ -1244,7 +1256,7 @@ if(sh_audio){
frame_data.in_size=video_read_frame(sh_video,&frame_data.frame_time,&frame_data.start,force_fps);
sh_video->timer+=frame_data.frame_time;
}
- frame_data.frame_time /= playback_speed;
+ frame_data.frame_time /= opts.playback_speed;
if(frame_data.in_size<0){ at_eof=1; break; }
++decoded_frameno;
@@ -1317,9 +1329,16 @@ case VCODEC_FRAMENO:
break;
default:
// decode_video will callback down to ve_*.c encoders, through the video filters
+ sh_video->vfilter->control(sh_video->vfilter, VFCTRL_SET_OSD_OBJ, osd);
{void *decoded_frame = decode_video(sh_video,frame_data.start,frame_data.in_size,
- skip_flag>0 && (!sh_video->vfilter || ((vf_instance_t *)sh_video->vfilter)->control(sh_video->vfilter, VFCTRL_SKIP_NEXT_FRAME, 0) != CONTROL_TRUE), MP_NOPTS_VALUE);
- blit_frame = decoded_frame && filter_video(sh_video, decoded_frame, MP_NOPTS_VALUE);}
+ skip_flag>0 && (!sh_video->vfilter || sh_video->vfilter->control(sh_video->vfilter, VFCTRL_SKIP_NEXT_FRAME, 0) != CONTROL_TRUE), MP_NOPTS_VALUE);
+ blit_frame = decoded_frame && filter_video(sh_video, decoded_frame, MP_NOPTS_VALUE);
+ if (blit_frame) {
+ struct vf_instance *vf = sh_video->vfilter;
+ vf->control(vf, VFCTRL_DRAW_EOSD, NULL);
+ vf->control(vf, VFCTRL_DRAW_OSD, osd);
+ }
+ }
if (sh_video->vf_initialized < 0) mencoder_exit(1, NULL);
@@ -1338,7 +1357,7 @@ default:
// Eventually this entire block should probably be removed.
if(skip_limit==0){
// skipping not allowed -> write empty frame:
- if (!encode_duplicates || !sh_video->vfilter || ((vf_instance_t *)sh_video->vfilter)->control(sh_video->vfilter, VFCTRL_DUPLICATE_FRAME, 0) != CONTROL_TRUE)
+ if (!encode_duplicates || !sh_video->vfilter || sh_video->vfilter->control(sh_video->vfilter, VFCTRL_DUPLICATE_FRAME, 0) != CONTROL_TRUE)
muxer_write_chunk(mux_v,0,0, MP_NOPTS_VALUE, MP_NOPTS_VALUE);
} else {
// skipping allowed -> skip it and distriubute timer error:
@@ -1354,17 +1373,17 @@ videorate+=(GetTimerMS() - ptimer_start);
if(skip_flag<0){
// duplicate frame
- if(!quiet) mp_msg(MSGT_MENCODER, MSGL_WARN, MSGTR_DuplicateFrames,-skip_flag);
+ if(!quiet) mp_tmsg(MSGT_MENCODER, MSGL_WARN, "\n%d duplicate frame(s)!\n",-skip_flag);
while(skip_flag<0){
duplicatedframes++;
- if (!encode_duplicates || !sh_video->vfilter || ((vf_instance_t *)sh_video->vfilter)->control(sh_video->vfilter, VFCTRL_DUPLICATE_FRAME, 0) != CONTROL_TRUE)
+ if (!encode_duplicates || !sh_video->vfilter || sh_video->vfilter->control(sh_video->vfilter, VFCTRL_DUPLICATE_FRAME, 0) != CONTROL_TRUE)
muxer_write_chunk(mux_v,0,0, MP_NOPTS_VALUE, MP_NOPTS_VALUE);
++skip_flag;
}
} else
if(skip_flag>0){
// skip frame
- if(!quiet) mp_msg(MSGT_MENCODER, MSGL_WARN, MSGTR_SkipFrame);
+ if(!quiet) mp_tmsg(MSGT_MENCODER, MSGL_WARN, "\nSkipping frame!\n");
skippedframes++;
--skip_flag;
}
@@ -1393,7 +1412,7 @@ if(sh_audio && !demuxer2){
// av = compensated (with out buffering delay) A-V diff
AV_delay=(a_pts-v_pts);
AV_delay-=audio_delay;
- AV_delay /= playback_speed;
+ AV_delay /= opts.playback_speed;
AV_delay-=mux_a->timer-(mux_v->timer-(v_timer_corr+v_pts_corr));
// adjust for encoder delays
AV_delay -= (float) mux_a->encoder_delay * mux_a->h.dwScale/mux_a->h.dwRate;
@@ -1403,9 +1422,9 @@ if(sh_audio && !demuxer2){
if(x<-max_pts_correction) x=-max_pts_correction; else
if(x> max_pts_correction) x= max_pts_correction;
if(default_max_pts_correction>=0)
- max_pts_correction=default_max_pts_correction*playback_speed;
+ max_pts_correction=default_max_pts_correction*opts.playback_speed;
else
- max_pts_correction=sh_video->frametime*0.10 *playback_speed; // +-10% of time
+ max_pts_correction=sh_video->frametime*0.10 *opts.playback_speed; // +-10% of time
// sh_video->timer-=x;
c_total+=x;
v_pts_corr+=x;
@@ -1485,13 +1504,13 @@ if(sh_audio && !demuxer2){
}
else
#endif
- update_subtitles(sh_video, sh_video->pts, d_dvdsub, 0);
+ update_subtitles(NULL, &opts, sh_video, sh_video->pts, 0, d_dvdsub, 0);
frame_data = (s_frame_data){ .start = NULL, .in_size = 0, .frame_time = 0., .already_read = 0 };
#if 0
if(ferror(muxer_f)) {
- mp_msg(MSGT_MENCODER,MSGL_FATAL,MSGTR_ErrorWritingFile, out_filename);
+ mp_tmsg(MSGT_MENCODER,MSGL_FATAL,"%s: Error writing file.\n", out_filename);
mencoder_exit(1, NULL);
}
#endif
@@ -1521,11 +1540,11 @@ if (!interrupted && filelist[++curfile].name != 0) {
/* Emit the remaining frames in the video system */
/*TODO emit frmaes delayed by decoder lag*/
if(sh_video && sh_video->vfilter){
- mp_msg(MSGT_MENCODER, MSGL_INFO, MSGTR_FlushingVideoFrames);
- if (!((vf_instance_t *)sh_video->vfilter)->fmt.have_configured)
- mp_msg(MSGT_MENCODER, MSGL_WARN, MSGTR_FiltersHaveNotBeenConfiguredEmptyFile);
+ mp_tmsg(MSGT_MENCODER, MSGL_INFO, "\nFlushing video frames.\n");
+ if (!sh_video->vfilter->fmt.have_configured)
+ mp_tmsg(MSGT_MENCODER, MSGL_WARN, "Filters have not been configured! Empty file?\n");
else
- ((vf_instance_t *)sh_video->vfilter)->control(sh_video->vfilter,
+ sh_video->vfilter->control(sh_video->vfilter,
VFCTRL_FLUSH_FRAMES, 0);
}
@@ -1539,7 +1558,7 @@ stream_seek(muxer->stream,0);
if (muxer->cont_write_header) muxer_write_header(muxer); // update header
#if 0
if(ferror(muxer_f) || fclose(muxer_f) != 0) {
- mp_msg(MSGT_MENCODER,MSGL_FATAL,MSGTR_ErrorWritingFile, out_filename);
+ mp_tmsg(MSGT_MENCODER,MSGL_FATAL,"%s: Error writing file.\n", out_filename);
mencoder_exit(1, NULL);
}
#endif
@@ -1547,18 +1566,18 @@ if(vobsub_writer)
vobsub_out_close(vobsub_writer);
if(out_video_codec==VCODEC_FRAMENO && mux_v->timer>100){
- mp_msg(MSGT_MENCODER, MSGL_INFO, MSGTR_RecommendedVideoBitrate,"650MB",(int)((650*1024*1024-muxer_f_size)/mux_v->timer/125));
- mp_msg(MSGT_MENCODER, MSGL_INFO, MSGTR_RecommendedVideoBitrate,"700MB",(int)((700*1024*1024-muxer_f_size)/mux_v->timer/125));
- mp_msg(MSGT_MENCODER, MSGL_INFO, MSGTR_RecommendedVideoBitrate,"800MB",(int)((800*1024*1024-muxer_f_size)/mux_v->timer/125));
- mp_msg(MSGT_MENCODER, MSGL_INFO, MSGTR_RecommendedVideoBitrate,"2 x 650MB",(int)((2*650*1024*1024-muxer_f_size)/mux_v->timer/125));
- mp_msg(MSGT_MENCODER, MSGL_INFO, MSGTR_RecommendedVideoBitrate,"2 x 700MB",(int)((2*700*1024*1024-muxer_f_size)/mux_v->timer/125));
- mp_msg(MSGT_MENCODER, MSGL_INFO, MSGTR_RecommendedVideoBitrate,"2 x 800MB",(int)((2*800*1024*1024-muxer_f_size)/mux_v->timer/125));
+ mp_tmsg(MSGT_MENCODER, MSGL_INFO, "Recommended video bitrate for %s CD: %d\n","650MB",(int)((650*1024*1024-muxer_f_size)/mux_v->timer/125));
+ mp_tmsg(MSGT_MENCODER, MSGL_INFO, "Recommended video bitrate for %s CD: %d\n","700MB",(int)((700*1024*1024-muxer_f_size)/mux_v->timer/125));
+ mp_tmsg(MSGT_MENCODER, MSGL_INFO, "Recommended video bitrate for %s CD: %d\n","800MB",(int)((800*1024*1024-muxer_f_size)/mux_v->timer/125));
+ mp_tmsg(MSGT_MENCODER, MSGL_INFO, "Recommended video bitrate for %s CD: %d\n","2 x 650MB",(int)((2*650*1024*1024-muxer_f_size)/mux_v->timer/125));
+ mp_tmsg(MSGT_MENCODER, MSGL_INFO, "Recommended video bitrate for %s CD: %d\n","2 x 700MB",(int)((2*700*1024*1024-muxer_f_size)/mux_v->timer/125));
+ mp_tmsg(MSGT_MENCODER, MSGL_INFO, "Recommended video bitrate for %s CD: %d\n","2 x 800MB",(int)((2*800*1024*1024-muxer_f_size)/mux_v->timer/125));
}
-mp_msg(MSGT_MENCODER, MSGL_INFO, MSGTR_VideoStreamResult,
+mp_tmsg(MSGT_MENCODER, MSGL_INFO, "\nVideo stream: %8.3f kbit/s (%d B/s) size: %"PRIu64" bytes %5.3f secs %d frames\n",
(float)(mux_v->size/mux_v->timer*8.0f/1000.0f), (int)(mux_v->size/mux_v->timer), (uint64_t)mux_v->size, (float)mux_v->timer, decoded_frameno);
if(sh_audio)
-mp_msg(MSGT_MENCODER, MSGL_INFO, MSGTR_AudioStreamResult,
+mp_tmsg(MSGT_MENCODER, MSGL_INFO, "\nAudio stream: %8.3f kbit/s (%d B/s) size: %"PRIu64" bytes %5.3f secs\n",
(float)(mux_a->size/mux_a->timer*8.0f/1000.0f), (int)(mux_a->size/mux_a->timer), (uint64_t)mux_a->size, (float)mux_a->timer);
if(sh_audio){ uninit_audio(sh_audio);sh_audio=NULL; }
@@ -1680,14 +1699,20 @@ static int slowseek(float end_pts, demux_stream_t *d_video, demux_stream_t *d_au
if (sh_video->pts >= end_pts) done = 1;
if (vfilter) {
+ sh_video->vfilter->control(sh_video->vfilter, VFCTRL_SET_OSD_OBJ,
+ osd);
int softskip = (vfilter->control(vfilter, VFCTRL_SKIP_NEXT_FRAME, 0) == CONTROL_TRUE);
void *decoded_frame = decode_video(sh_video, frame_data->start, frame_data->in_size, !softskip, MP_NOPTS_VALUE);
if (decoded_frame)
- filter_video(sh_video, decoded_frame, MP_NOPTS_VALUE);
+ if (filter_video(sh_video, decoded_frame, MP_NOPTS_VALUE)) {
+ struct vf_instance *vf = sh_video->vfilter;
+ vf->control(vf, VFCTRL_DRAW_EOSD, NULL);
+ vf->control(vf, VFCTRL_DRAW_OSD, osd);
+ }
}
- if (print_info) mp_msg(MSGT_MENCODER, MSGL_STATUS,
- MSGTR_EdlSkipStartEndCurrent,
+ if (print_info) mp_tmsg(MSGT_MENCODER, MSGL_STATUS,
+ "EDL SKIP: Start: %.2f End: %.2f Current: V: %.2f A: %.2f \r",
next_edl_record->start_sec, next_edl_record->stop_sec,
sh_video->pts, a_pts);
}
@@ -1726,6 +1751,7 @@ static int edl_seek(edl_record_ptr next_edl_record, demuxer_t* demuxer, demux_st
if(demux_seek(demuxer, next_edl_record->stop_sec - sh_video->pts, audio_delay, 0)){
sh_video->pts = demuxer->video->pts;
//if (vo_vobsub) vobsub_seek(vo_vobsub,sh_video->pts);
+ resync_video_stream(sh_video);
//if(vo_spudec) spudec_reset(vo_spudec);
if (audio_delay != 0.0) fixdelay(demuxer->video, d_audio, mux_a, frame_data, framecopy);
return 1;
diff --git a/metadata.h b/metadata.h
index 6a31d75f4b..06c3822d81 100644
--- a/metadata.h
+++ b/metadata.h
@@ -48,7 +48,8 @@ enum metadata_s {
META_INFO_GENRE
};
-char *get_metadata (metadata_t type);
+struct MPContext;
-#endif /* MPLAYER_METADATA_H */
+char *get_metadata(struct MPContext *mpctx, metadata_t type);
+#endif /* MPLAYER_METADATA_H */
diff --git a/mixer.c b/mixer.c
index eb1210c780..ae88d1ffe1 100644
--- a/mixer.c
+++ b/mixer.c
@@ -82,11 +82,11 @@ void mixer_setvolume(mixer_t *mixer, float l, float r)
af_to_dB (AF_NCH, db_vals, db_vals, 20.0);
if (!af_control_any_rev(mixer->afilter,
AF_CONTROL_VOLUME_LEVEL | AF_CONTROL_SET, db_vals)) {
- mp_msg(MSGT_GLOBAL, MSGL_INFO, MSGTR_InsertingAfVolume);
+ mp_tmsg(MSGT_GLOBAL, MSGL_INFO, "[Mixer] No hardware mixing, inserting volume filter.\n");
if (af_add(mixer->afilter, "volume")) {
if (!af_control_any_rev(mixer->afilter,
AF_CONTROL_VOLUME_LEVEL | AF_CONTROL_SET, db_vals)) {
- mp_msg(MSGT_GLOBAL, MSGL_ERR, MSGTR_NoVolume);
+ mp_tmsg(MSGT_GLOBAL, MSGL_ERR, "[Mixer] No volume control available.\n");
return;
}
}
@@ -160,7 +160,7 @@ void mixer_setbalance(mixer_t *mixer, float val)
return;
if (!(af_pan_balance = af_add(mixer->afilter, "pan"))) {
- mp_msg(MSGT_GLOBAL, MSGL_ERR, MSGTR_NoBalance);
+ mp_tmsg(MSGT_GLOBAL, MSGL_ERR, "[Mixer] No balance control available.\n");
return;
}
@@ -178,4 +178,3 @@ void mixer_setbalance(mixer_t *mixer, float val)
af_pan_balance->control(af_pan_balance,
AF_CONTROL_PAN_BALANCE | AF_CONTROL_SET, &val);
}
-
diff --git a/mp3lib/dct36.c b/mp3lib/dct36.c
index 753c2f25d5..b884bb949d 100644
--- a/mp3lib/dct36.c
+++ b/mp3lib/dct36.c
@@ -267,4 +267,3 @@ static void dct36(real *inbuf,real *o1,real *o2,real *wintab,real *tsbuf)
}
}
-
diff --git a/mp3lib/dct64_sse.c b/mp3lib/dct64_sse.c
index 46e951cc9a..2827f2c1b1 100644
--- a/mp3lib/dct64_sse.c
+++ b/mp3lib/dct64_sse.c
@@ -5,7 +5,8 @@
* and mp3lib/dct64_mmx.c
*/
-#include "libavutil/internal.h"
+#include "libavutil/mem.h"
+
#include "mpg123.h"
extern float __attribute__((aligned(16))) costab_mmx[];
diff --git a/mp3lib/layer1.c b/mp3lib/layer1.c
index 200aa453ba..d53c628314 100644
--- a/mp3lib/layer1.c
+++ b/mp3lib/layer1.c
@@ -163,5 +163,3 @@ static int do_layer1(struct frame *fr,int single)
return clip;
}
-
-
diff --git a/mp3lib/layer3.c b/mp3lib/layer3.c
index fdac27f781..16dfb06bb8 100644
--- a/mp3lib/layer3.c
+++ b/mp3lib/layer3.c
@@ -1347,5 +1347,3 @@ static int do_layer3(struct frame *fr,int single){
return clip;
}
-
-
diff --git a/mp3lib/sr1.c b/mp3lib/sr1.c
index 77ba630453..fdbf19ba89 100644
--- a/mp3lib/sr1.c
+++ b/mp3lib/sr1.c
@@ -24,10 +24,6 @@
#include "libvo/fastmemcpy.h"
#include "libavutil/common.h"
-#include "libavutil/internal.h"
-
-#undef fprintf
-#undef printf
#if ARCH_X86_64
// 3DNow! and 3DNow!Ext routines don't compile under AMD64
diff --git a/mp_core.h b/mp_core.h
index 83eca9ebe1..bd8a4aee99 100644
--- a/mp_core.h
+++ b/mp_core.h
@@ -19,25 +19,20 @@
#ifndef MPLAYER_MP_CORE_H
#define MPLAYER_MP_CORE_H
-#include "mp_osd.h"
-#include "libao2/audio_out.h"
-#include "playtree.h"
-#include "stream/stream.h"
-#include "libmpdemux/demuxer.h"
-#include "libmpdemux/stheader.h"
+#include <stdbool.h>
+
+#include "options.h"
#include "mixer.h"
-#include "libvo/video_out.h"
#include "subreader.h"
// definitions used internally by the core player code
#define INITIALIZED_VO 1
#define INITIALIZED_AO 2
-#define INITIALIZED_GUI 4
+
#define INITIALIZED_GETCH2 8
#define INITIALIZED_SPUDEC 32
#define INITIALIZED_STREAM 64
-#define INITIALIZED_INPUT 128
#define INITIALIZED_VOBSUB 256
#define INITIALIZED_DEMUXER 512
#define INITIALIZED_ACODEC 1024
@@ -51,13 +46,17 @@
#define SUB_SOURCES 3
-#define PT_NEXT_ENTRY 1
-#define PT_PREV_ENTRY -1
-#define PT_NEXT_SRC 2
-#define PT_PREV_SRC -2
-#define PT_UP_NEXT 3
-#define PT_UP_PREV -3
-#define PT_STOP 4
+enum stop_play_reason {
+ KEEP_PLAYING = 0, // must be 0, numeric values of others do not matter
+ AT_END_OF_FILE,
+ PT_NEXT_ENTRY,
+ PT_PREV_ENTRY,
+ PT_NEXT_SRC,
+ PT_PREV_SRC,
+ PT_UP_NEXT,
+ PT_UP_PREV,
+ PT_STOP,
+};
typedef enum {
EXIT_NONE,
@@ -66,41 +65,94 @@ typedef enum {
EXIT_ERROR
} exit_reason_t;
+struct content_source {
+ struct stream *stream;
+ struct demuxer *demuxer;
+};
+
+struct timeline_part {
+ double start;
+ double source_start;
+ struct content_source *source;
+};
+
+struct chapter {
+ double start;
+ char *name;
+};
+
typedef struct MPContext {
- int osd_show_percentage;
+ struct MPOpts opts;
+ struct m_config *mconfig;
+ struct vo_x11_state *x11_state;
+ struct mp_fifo *key_fifo;
+ struct input_ctx *input;
+ struct osd_state *osd;
+
+ bool add_osd_seek_info;
+ // if nonzero, hide current OSD contents when GetTimerMS() reaches this
+ unsigned int osd_show_percentage_until;
+ unsigned int osd_visible;
+
int osd_function;
const ao_functions_t *audio_out;
- play_tree_t *playtree;
- play_tree_iter_t *playtree_iter;
- int eof;
+ struct play_tree *playtree;
+ struct play_tree_iter *playtree_iter;
+ char *filename; // currently playing file
+ enum stop_play_reason stop_play;
int play_tree_step;
- int loop_times;
-
- stream_t *stream;
- demuxer_t *demuxer;
- sh_audio_t *sh_audio;
- sh_video_t *sh_video;
- demux_stream_t *d_audio;
- demux_stream_t *d_video;
- demux_stream_t *d_sub;
+ unsigned int initialized_flags; // which subsystems have been initialized
+
+ struct content_source *sources;
+ int num_sources;
+ struct timeline_part *timeline;
+ int num_timeline_parts;
+ int timeline_part;
+ struct chapter *chapters;
+ int num_chapters;
+ double video_offset;
+
+ struct stream *stream;
+ struct demuxer *demuxer;
+ struct sh_audio *sh_audio;
+ struct sh_video *sh_video;
+ struct demux_stream *d_audio;
+ struct demux_stream *d_video;
+ struct demux_stream *d_sub;
mixer_t mixer;
- const vo_functions_t *video_out;
- // Frames buffered in the vo ready to flip. Currently always 0 or 1.
- // This is really a vo variable but currently there's no suitable vo
- // struct.
- int num_buffered_frames;
-
- // used to retry decoding after startup/seeking to compensate for codec delay
- int startup_decode_retry;
- // how long until we need to display the "current" frame
- float time_frame;
+ struct vo *video_out;
+ // Show a video frame as quickly as possible without trying to adjust
+ // for AV sync. Used when starting a file or after seeking.
+ bool update_video_immediately;
// AV sync: the next frame should be shown when the audio out has this
// much (in seconds) buffered data left. Increased when more data is
// written to the ao, decreased when moving to the next frame.
// In the audio-only case used as a timer since the last seek
// by the audio CPU usage meter.
double delay;
+ // AV sync: time until next frame should be shown
+ float time_frame;
+ // How long the last vo flip() call took. Used to adjust timing with
+ // the goal of making flip() calls finish (rather than start) at the
+ // specified time.
+ float last_vo_flip_duration;
+ // How much video timing has been changed to make it match the audio
+ // timeline. Used for status line information only.
+ double total_avsync_change;
+ // A-V sync difference when last frame was displayed. Kept to display
+ // the same value if the status line is updated at a time where no new
+ // video frame is shown.
+ double last_av_difference;
+
+ // Timestamp from the last time some timing functions read the
+ // current time, in (occasionally wrapping) microseconds. Used
+ // to turn a new time value to a delta from last time.
+ unsigned int last_time;
+
+ // Used to communicate the parameters of a seek between parts
+ double rel_seek_secs;
+ int abs_seek_pos;
float begin_skip; ///< start time of the current skip while on edlout mode
// audio is muted if either EDL or user activates mute
@@ -112,24 +164,26 @@ typedef struct MPContext {
int set_of_sub_pos;
int set_of_sub_size;
int global_sub_indices[SUB_SOURCES];
-#ifdef CONFIG_ASS
// set_of_ass_tracks[i] contains subtitles from set_of_subtitles[i]
// parsed by libass or NULL if format unsupported
- ass_track_t* set_of_ass_tracks[MAX_SUBTITLE_FILES];
-#endif
+ struct ass_track *set_of_ass_tracks[MAX_SUBTITLE_FILES];
sub_data* set_of_subtitles[MAX_SUBTITLE_FILES];
int file_format;
-#ifdef CONFIG_DVBIN
int last_dvb_step;
int dvbin_reopen;
-#endif
- int was_paused;
+ int paused;
+ // step this many frames, then pause
+ int step_frames;
+
+ // Set after showing warning about decoding being too slow for realtime
+ // playback rate. Used to avoid showing it multiple times.
+ bool drop_message_shown;
#ifdef CONFIG_DVDNAV
- struct mp_image_s *nav_smpi; ///< last decoded dvdnav video image
+ struct mp_image *nav_smpi; ///< last decoded dvdnav video image
unsigned char *nav_buffer; ///< last read dvdnav video frame
unsigned char *nav_start; ///< pointer to last read video buffer
int nav_in_size; ///< last read size
@@ -138,24 +192,26 @@ typedef struct MPContext {
// Most of these should not be globals
-extern int abs_seek_pos;
-extern float rel_seek_secs;
extern FILE *edl_fd;
extern int file_filter;
// These appear in options list
-extern float playback_speed;
-extern int fixed_vo;
extern int forced_subs_only;
-
-int build_afilter_chain(sh_audio_t *sh_audio, ao_data_t *ao_data);
-void uninit_player(unsigned int mask);
-void reinit_audio_chain(void);
-void init_vo_spudec(void);
-double playing_audio_pts(sh_audio_t *sh_audio, demux_stream_t *d_audio,
- const ao_functions_t *audio_out);
-void exit_player_with_rc(exit_reason_t how, int rc);
-void add_subtitles(char *filename, float fps, int noerr);
-int reinit_video_chain(void);
+struct ao_data;
+int build_afilter_chain(struct MPContext *mpctx, struct sh_audio *sh_audio, struct ao_data *ao_data);
+void uninit_player(struct MPContext *mpctx, unsigned int mask);
+void reinit_audio_chain(struct MPContext *mpctx);
+void init_vo_spudec(struct MPContext *mpctx);
+double playing_audio_pts(struct MPContext *mpctx);
+void exit_player_with_rc(struct MPContext *mpctx, exit_reason_t how, int rc);
+void add_subtitles(struct MPContext *mpctx, char *filename, float fps, int noerr);
+int reinit_video_chain(struct MPContext *mpctx);
+void pause_player(struct MPContext *mpctx);
+void unpause_player(struct MPContext *mpctx);
+void add_step_frame(struct MPContext *mpctx);
+int seek_chapter(struct MPContext *mpctx, int chapter, double *seek_pts,
+ char **chapter_name);
+int get_current_chapter(struct MPContext *mpctx);
+char *chapter_display_name(struct MPContext *mpctx, int chapter);
#endif /* MPLAYER_MP_CORE_H */
diff --git a/mp_fifo.c b/mp_fifo.c
index f56f79555b..4c8e9c6496 100644
--- a/mp_fifo.c
+++ b/mp_fifo.c
@@ -20,69 +20,82 @@
#include "osdep/timer.h"
#include "input/input.h"
#include "input/mouse.h"
+#include "mp_fifo.h"
+#include "talloc.h"
+#include "options.h"
-int key_fifo_size = 7;
-static int *key_fifo_data = NULL;
-static int key_fifo_read=0;
-static int key_fifo_write=0;
+struct mp_fifo {
+ struct MPOpts *opts;
+ int *data;
+ int readpos;
+ int writepos;
+ int size;
+ unsigned last_key_time[2];
+ int last_key[2];
+};
-static void mplayer_put_key_internal(int code){
- int fifo_free = key_fifo_read - key_fifo_write - 1;
- if (fifo_free < 0) fifo_free += key_fifo_size;
-// printf("mplayer_put_key(%d)\n",code);
- if (key_fifo_data == NULL)
- key_fifo_data = malloc(key_fifo_size * sizeof(int));
- if(!fifo_free) return; // FIFO FULL!!
- // reserve some space for key release events to avoid stuck keys
- if((code & MP_KEY_DOWN) && fifo_free < (key_fifo_size >> 1))
- return;
- key_fifo_data[key_fifo_write]=code;
- key_fifo_write=(key_fifo_write+1)%key_fifo_size;
+struct mp_fifo *mp_fifo_create(struct MPOpts *opts)
+{
+ struct mp_fifo *fifo = talloc_zero(NULL, struct mp_fifo);
+ fifo->opts = opts;
+ fifo->size = opts->key_fifo_size;
+ fifo->data = talloc_array_ptrtype(fifo, fifo->data, fifo->size);
+ return fifo;
}
-int mplayer_get_key(int fd){
- int key;
-// printf("mplayer_get_key(%d)\n",fd);
- if (key_fifo_data == NULL)
- return MP_INPUT_NOTHING;
- if(key_fifo_write==key_fifo_read) return MP_INPUT_NOTHING;
- key=key_fifo_data[key_fifo_read];
- key_fifo_read=(key_fifo_read+1)%key_fifo_size;
-// printf("mplayer_get_key => %d\n",key);
- return key;
+static void mplayer_put_key_internal(struct mp_fifo *fifo, int code)
+{
+ int fifo_free = fifo->readpos - fifo->writepos - 1;
+ if (fifo_free < 0)
+ fifo_free += fifo->size;
+ if (!fifo_free)
+ return; // FIFO FULL!!
+ // reserve some space for key release events to avoid stuck keys
+ if((code & MP_KEY_DOWN) && fifo_free < (fifo->size >> 1))
+ return;
+ fifo->data[fifo->writepos++] = code;
+ fifo->writepos %= fifo->size;
}
+int mplayer_get_key(void *ctx, int fd)
+{
+ struct mp_fifo *fifo = ctx;
+ if (fifo->writepos == fifo->readpos)
+ return MP_INPUT_NOTHING;
+ int key = fifo->data[fifo->readpos++];
+ fifo->readpos %= fifo->size;
+ return key;
+}
-unsigned doubleclick_time = 300;
-
-static void put_double(int code) {
+static void put_double(struct mp_fifo *fifo, int code)
+{
if (code >= MOUSE_BTN0 && code <= MOUSE_BTN9)
- mplayer_put_key_internal(code - MOUSE_BTN0 + MOUSE_BTN0_DBL);
+ mplayer_put_key_internal(fifo, code - MOUSE_BTN0 + MOUSE_BTN0_DBL);
}
-void mplayer_put_key(int code) {
- static unsigned last_key_time[2];
- static int last_key[2];
- unsigned now = GetTimerMS();
- // ignore system-doubleclick if we generate these events ourselves
- if (doubleclick_time &&
- (code & ~MP_KEY_DOWN) >= MOUSE_BTN0_DBL &&
- (code & ~MP_KEY_DOWN) <= MOUSE_BTN9_DBL)
- return;
- mplayer_put_key_internal(code);
- if (code & MP_KEY_DOWN) {
- code &= ~MP_KEY_DOWN;
- last_key[1] = last_key[0];
- last_key[0] = code;
- last_key_time[1] = last_key_time[0];
- last_key_time[0] = now;
- if (last_key[1] == code &&
- now - last_key_time[1] < doubleclick_time)
- put_double(code);
- return;
- }
- if (last_key[0] == code && last_key[1] == code &&
- now - last_key_time[1] < doubleclick_time)
- put_double(code);
+void mplayer_put_key(struct mp_fifo *fifo, int code)
+{
+ unsigned now = GetTimerMS();
+ int doubleclick_time = fifo->opts->doubleclick_time;
+ // ignore system-doubleclick if we generate these events ourselves
+ if (doubleclick_time
+ && (code & ~MP_KEY_DOWN) >= MOUSE_BTN0_DBL
+ && (code & ~MP_KEY_DOWN) <= MOUSE_BTN9_DBL)
+ return;
+ mplayer_put_key_internal(fifo, code);
+ if (code & MP_KEY_DOWN) {
+ code &= ~MP_KEY_DOWN;
+ fifo->last_key[1] = fifo->last_key[0];
+ fifo->last_key[0] = code;
+ fifo->last_key_time[1] = fifo->last_key_time[0];
+ fifo->last_key_time[0] = now;
+ if (fifo->last_key[1] == code
+ && now - fifo->last_key_time[1] < doubleclick_time)
+ put_double(fifo, code);
+ return;
+ }
+ if (fifo->last_key[0] == code && fifo->last_key[1] == code
+ && now - fifo->last_key_time[1] < doubleclick_time)
+ put_double(fifo, code);
}
diff --git a/mp_fifo.h b/mp_fifo.h
index b50173c0af..125b67eb2c 100644
--- a/mp_fifo.h
+++ b/mp_fifo.h
@@ -19,7 +19,16 @@
#ifndef MPLAYER_MP_FIFO_H
#define MPLAYER_MP_FIFO_H
-int mplayer_get_key(int fd);
-void mplayer_put_key(int code);
+struct mp_fifo;
+int mplayer_get_key(void *ctx, int fd);
+void mplayer_put_key(struct mp_fifo *fifo, int code);
+// Can be freed with talloc_free()
+struct MPOpts;
+struct mp_fifo *mp_fifo_create(struct MPOpts *opts);
+
+
+#ifdef IS_OLD_VO
+#define mplayer_put_key(key) mplayer_put_key(global_vo->key_fifo, key)
+#endif
#endif /* MPLAYER_MP_FIFO_H */
diff --git a/mp_msg-mencoder.c b/mp_msg-mencoder.c
deleted file mode 100644
index d295020364..0000000000
--- a/mp_msg-mencoder.c
+++ /dev/null
@@ -1,3 +0,0 @@
-
-#define FOR_MENCODER 1
-#include "mp_msg.c"
diff --git a/mp_msg.c b/mp_msg.c
index 93f793d7c8..3fed697331 100644
--- a/mp_msg.c
+++ b/mp_msg.c
@@ -23,6 +23,11 @@
#include "config.h"
+#ifdef CONFIG_TRANSLATION
+#include <locale.h>
+#include <libintl.h>
+#endif
+
#ifdef CONFIG_ICONV
#include <iconv.h>
#include <errno.h>
@@ -36,13 +41,6 @@
char* get_term_charset(void);
#endif
-#if defined(FOR_MENCODER)
-#undef CONFIG_GUI
-int use_gui;
-#else
-#include "gui/interface.h"
-#endif
-
#include "mp_msg.h"
/* maximum message length of mp_msg */
@@ -102,6 +100,14 @@ void mp_msg_init(void){
if (!mp_msg_charset)
mp_msg_charset = get_term_charset();
#endif
+#ifdef CONFIG_TRANSLATION
+ textdomain("mplayer");
+ char *localedir = getenv("MPLAYER_LOCALEDIR");
+ if (localedir == NULL && strlen(MPLAYER_LOCALEDIR))
+ localedir = MPLAYER_LOCALEDIR;
+ bindtextdomain("mplayer", localedir);
+ bind_textdomain_codeset("mplayer", "UTF-8");
+#endif
}
int mp_msg_test(int mod, int lev)
@@ -190,24 +196,17 @@ static void print_msg_module(FILE* stream, int mod)
fprintf(stream, ": ");
}
-void mp_msg(int mod, int lev, const char *format, ... ){
- va_list va;
+void mp_msg_va(int mod, int lev, const char *format, va_list va)
+{
char tmp[MSGSIZE_MAX];
FILE *stream = lev <= MSGL_WARN ? stderr : stdout;
static int header = 1;
if (!mp_msg_test(mod, lev)) return; // do not display
- va_start(va, format);
vsnprintf(tmp, MSGSIZE_MAX, format, va);
- va_end(va);
tmp[MSGSIZE_MAX-2] = '\n';
tmp[MSGSIZE_MAX-1] = 0;
-#ifdef CONFIG_GUI
- if(use_gui)
- guiMessageBox(lev, tmp);
-#endif
-
#if defined(CONFIG_ICONV) && defined(MSG_CHARSET)
if (mp_msg_charset && strcasecmp(mp_msg_charset, "noconv")) {
char tmp2[MSGSIZE_MAX];
@@ -247,3 +246,72 @@ void mp_msg(int mod, int lev, const char *format, ... ){
fprintf(stream, "%s", tmp);
fflush(stream);
}
+
+void mp_msg(int mod, int lev, const char *format, ...)
+{
+ va_list va;
+ va_start(va, format);
+ mp_msg_va(mod, lev, format, va);
+ va_end(va);
+}
+
+char *mp_gtext(const char *string)
+{
+#ifdef CONFIG_TRANSLATION
+ /* gettext expects the global locale to be set with
+ * setlocale(LC_ALL, ""). However doing that would suck for a
+ * couple of reasons (locale stuff is badly designed and sucks in
+ * general).
+ *
+ * First setting the locale, especially LC_CTYPE, changes the
+ * behavior of various C functions and we don't want that - we
+ * want isalpha() for example to always behave like in the C
+ * locale.
+
+ * Second, there is no way to enforce a sane character set. All
+ * strings inside MPlayer must always be in utf-8, not in the
+ * character set specified by the system locale which could be
+ * something different and completely insane. The locale system
+ * lacks any way to say "set LC_CTYPE to utf-8, ignoring the
+ * default system locale if it specifies something different". We
+ * could try to work around that flaw by leaving LC_CTYPE to the C
+ * locale and only setting LC_MESSAGES (which is the variable that
+ * must be set to tell gettext which language to translate
+ * to). However if we leave LC_MESSAGES set then things like
+ * strerror() may produce completely garbled output when they try
+ * to translate their results but then try to convert some
+ * translated non-ASCII text to the character set specified by
+ * LC_CTYPE which would still be in the C locale (this doesn't
+ * affect gettext itself because it supports specifying the
+ * character set directly with bind_textdomain_codeset()).
+ *
+ * So the only solution (at leat short of trying to work around
+ * things possibly producing non-utf-8 output) is to leave all the
+ * locale variables unset. Note that this means it's not possible
+ * to get translated output from any libraries we call if they
+ * only rely on the broken locale system to specify the language
+ * to use; this is the case with libc for example.
+ *
+ * The locale changing below is rather ugly, but hard to avoid.
+ * gettext doesn't support specifying the translation target
+ * directly, only through locale.
+ * The main actual problem this could cause is interference with
+ * other threads; that could be avoided with thread-specific
+ * locale changes, but such functionality is less standard and I
+ * think it's not worth adding pre-emptively unless someone sees
+ * an actual problem case.
+ */
+ setlocale(LC_MESSAGES, "");
+ string = gettext(string);
+ setlocale(LC_MESSAGES, "C");
+#endif
+ return string;
+}
+
+void mp_tmsg(int mod, int lev, const char *format, ...)
+{
+ va_list va;
+ va_start(va, format);
+ mp_msg_va(mod, lev, mp_gtext(format), va);
+ va_end(va);
+}
diff --git a/mp_msg.h b/mp_msg.h
index 44ce09e2fc..86e010ba16 100644
--- a/mp_msg.h
+++ b/mp_msg.h
@@ -19,9 +19,14 @@
#ifndef MPLAYER_MP_MSG_H
#define MPLAYER_MP_MSG_H
+#include <stdarg.h>
+
// defined in mplayer.c and mencoder.c
extern int verbose;
+/* No-op macro to mark translated strings in the sources */
+#define _(x) x
+
// verbosity elevel:
/* Only messages level MSGL_FATAL-MSGL_STATUS should be translated,
@@ -46,7 +51,6 @@ extern int verbose;
#define MSGT_GLOBAL 0 // common player stuff errors
#define MSGT_CPLAYER 1 // console player (mplayer.c)
-#define MSGT_GPLAYER 2 // gui player
#define MSGT_VO 3 // libvo
#define MSGT_AO 4 // libao
@@ -131,8 +135,13 @@ int mp_msg_test(int mod, int lev);
#include "config.h"
+char *mp_gtext(const char *string);
+
+void mp_msg_va(int mod, int lev, const char *format, va_list va);
+
#ifdef __GNUC__
void mp_msg(int mod, int lev, const char *format, ... ) __attribute__ ((format (printf, 3, 4)));
+void mp_tmsg(int mod, int lev, const char *format, ... ) __attribute__ ((format (printf, 3, 4)));
# ifdef MP_DEBUG
# define mp_dbg(mod,lev, args... ) mp_msg(mod, lev, ## args )
# else
@@ -140,6 +149,7 @@ void mp_msg(int mod, int lev, const char *format, ... ) __attribute__ ((format (
# endif
#else // not GNU C
void mp_msg(int mod, int lev, const char *format, ... );
+void mp_tmsg(int mod, int lev, const char *format, ...)
# ifdef MP_DEBUG
# define mp_dbg(mod,lev, ... ) mp_msg(mod, lev, __VA_ARGS__)
# else
diff --git a/mp_osd.h b/mp_osd.h
index b9f10d664b..7c5da6b7a9 100644
--- a/mp_osd.h
+++ b/mp_osd.h
@@ -35,11 +35,13 @@
#define MAX_TERM_OSD_LEVEL 1
// These appear in options list
-extern int osd_duration;
extern int term_osd;
-void set_osd_bar(int type,const char* name,double min,double max,double val);
+struct MPContext;
+
+void set_osd_bar(struct MPContext *mpctx, int type,const char* name,double min,double max,double val);
void set_osd_msg(int id, int level, int time, const char* fmt, ...);
+void set_osd_tmsg(int id, int level, int time, const char* fmt, ...);
void rm_osd_msg(int id);
#endif /* MPLAYER_MP_OSD_H */
diff --git a/mpbswap.h b/mpbswap.h
index 66640e63c2..3d32eb38cb 100644
--- a/mpbswap.h
+++ b/mpbswap.h
@@ -21,7 +21,7 @@
#include <sys/types.h>
#include "config.h"
-#include "libavutil/bswap.h"
+#include "ffmpeg_files/bswap.h"
#ifndef HAVE_SWAB
void swab(const void *from, void *to, ssize_t n);
diff --git a/mpcommon.c b/mpcommon.c
index bdc307baeb..a816e32b3d 100644
--- a/mpcommon.c
+++ b/mpcommon.c
@@ -17,6 +17,8 @@
*/
#include <stdlib.h>
+#include "mpcommon.h"
+#include "options.h"
#include "stream/stream.h"
#include "libmpdemux/demuxer.h"
#include "libmpdemux/stheader.h"
@@ -30,15 +32,14 @@
#include "version.h"
#include "vobsub.h"
#include "libmpcodecs/dec_teletext.h"
-#include "libavutil/intreadwrite.h"
+#include "ffmpeg_files/intreadwrite.h"
#include "m_option.h"
-#include "mpcommon.h"
double sub_last_pts = -303;
#ifdef CONFIG_ASS
-#include "libass/ass_mp.h"
-ass_track_t* ass_track = 0; // current track to render
+#include "ass_mp.h"
+ASS_Track *ass_track = 0; // current track to render
#endif
sub_data* subdata = NULL;
@@ -58,9 +59,9 @@ void print_version(const char* name)
gCpuCaps.has3DNow, gCpuCaps.has3DNowExt,
gCpuCaps.hasSSE, gCpuCaps.hasSSE2, gCpuCaps.hasSSSE3);
#if CONFIG_RUNTIME_CPUDETECT
- mp_msg(MSGT_CPLAYER,MSGL_V, MSGTR_CompiledWithRuntimeDetection);
+ mp_tmsg(MSGT_CPLAYER,MSGL_V, "Compiled with runtime CPU detection.\n");
#else
- mp_msg(MSGT_CPLAYER,MSGL_V, MSGTR_CompiledWithCPUExtensions);
+ mp_tmsg(MSGT_CPLAYER,MSGL_V, "Compiled for x86 CPU with extensions:");
if (HAVE_MMX)
mp_msg(MSGT_CPLAYER,MSGL_V," MMX");
if (HAVE_MMX2)
@@ -83,7 +84,9 @@ if (HAVE_CMOV)
}
-void update_subtitles(sh_video_t *sh_video, double refpts, demux_stream_t *d_dvdsub, int reset)
+void update_subtitles(struct MPContext *mpctx, struct MPOpts *opts,
+ sh_video_t *sh_video, double refpts, double sub_offset,
+ demux_stream_t *d_dvdsub, int reset)
{
unsigned char *packet=NULL;
int len;
@@ -92,19 +95,20 @@ void update_subtitles(sh_video_t *sh_video, double refpts, demux_stream_t *d_dvd
if (reset) {
sub_clear_text(&subs, MP_NOPTS_VALUE);
if (vo_sub) {
- set_osd_subtitle(NULL);
+ set_osd_subtitle(mpctx, NULL);
}
if (vo_spudec) {
spudec_reset(vo_spudec);
vo_osd_changed(OSDTYPE_SPU);
}
+ return;
}
// find sub
if (subdata) {
if (sub_fps==0) sub_fps = sh_video ? sh_video->fps : 25;
current_module = "find_sub";
if (refpts > sub_last_pts || refpts < sub_last_pts-1.0) {
- find_sub(subdata, (refpts+sub_delay) *
+ find_sub(mpctx, subdata, (refpts+sub_delay) *
(subdata->sub_uses_time ? 100. : sub_fps));
if (vo_sub) vo_sub_last = vo_sub;
// FIXME! frame counter...
@@ -113,8 +117,7 @@ void update_subtitles(sh_video_t *sh_video, double refpts, demux_stream_t *d_dvd
}
// DVD sub:
- if (vo_config_count && vo_spudec &&
- (vobsub_id >= 0 || (dvdsub_id >= 0 && type == 'v'))) {
+ if (vo_spudec && (vobsub_id >= 0 || (opts->sub_id >= 0 && type == 'v'))) {
int timestamp;
current_module = "spudec";
spudec_heartbeat(vo_spudec, 90000*sh_video->timer);
@@ -158,7 +161,8 @@ void update_subtitles(sh_video_t *sh_video, double refpts, demux_stream_t *d_dvd
if (spudec_changed(vo_spudec))
vo_osd_changed(OSDTYPE_SPU);
- } else if (dvdsub_id >= 0 && (type == 't' || type == 'm' || type == 'a' || type == 'd')) {
+ } else if (opts->sub_id >= 0
+ && (type == 't' || type == 'm' || type == 'a' || type == 'd')) {
double curpts = refpts + sub_delay;
double endpts;
if (type == 'd' && !d_dvdsub->demuxer->teletext) {
@@ -170,10 +174,16 @@ void update_subtitles(sh_video_t *sh_video, double refpts, demux_stream_t *d_dvd
if (d_dvdsub->non_interleaved)
ds_get_next_pts(d_dvdsub);
while (d_dvdsub->first) {
- double subpts = ds_get_next_pts(d_dvdsub);
- if (subpts > curpts)
- break;
- endpts = d_dvdsub->first->endpts;
+ double subpts = ds_get_next_pts(d_dvdsub) + sub_offset;
+ if (subpts > curpts) {
+ // Libass handled subs can be fed to it in advance
+ if (!opts->ass_enabled || type == 'd')
+ break;
+ // Try to avoid demuxing whole file at once
+ if (d_dvdsub->non_interleaved && subpts > curpts + 1)
+ break;
+ }
+ endpts = d_dvdsub->first->endpts + sub_offset;
len = ds_get_packet_sub(d_dvdsub, &packet);
if (type == 'm') {
if (len < 2) continue;
@@ -197,7 +207,7 @@ void update_subtitles(sh_video_t *sh_video, double refpts, demux_stream_t *d_dvd
continue;
}
#ifdef CONFIG_ASS
- if (ass_enabled) {
+ if (opts->ass_enabled) {
sh_sub_t* sh = d_dvdsub->sh;
ass_track = sh ? sh->ass_track : NULL;
if (!ass_track) continue;
@@ -234,13 +244,14 @@ void update_subtitles(sh_video_t *sh_video, double refpts, demux_stream_t *d_dvd
packet = p;
}
sub_add_text(&subs, packet, len, endpts);
- set_osd_subtitle(&subs);
+ set_osd_subtitle(mpctx, &subs);
}
if (d_dvdsub->non_interleaved)
ds_get_next_pts(d_dvdsub);
}
- if (sub_clear_text(&subs, curpts))
- set_osd_subtitle(&subs);
+ if (!opts->ass_enabled)
+ if (sub_clear_text(&subs, curpts))
+ set_osd_subtitle(mpctx, &subs);
}
current_module=NULL;
}
@@ -290,26 +301,17 @@ int select_audio(demuxer_t* demuxer, int audio_id, char* audio_lang)
/* Parse -noconfig common to both programs */
int disable_system_conf=0;
int disable_user_conf=0;
-#ifdef CONFIG_GUI
-int disable_gui_conf=0;
-#endif /* CONFIG_GUI */
/* Disable all configuration files */
static void noconfig_all(void)
{
disable_system_conf = 1;
disable_user_conf = 1;
-#ifdef CONFIG_GUI
- disable_gui_conf = 1;
-#endif /* CONFIG_GUI */
}
const m_option_t noconfig_opts[] = {
{"all", noconfig_all, CONF_TYPE_FUNC, CONF_GLOBAL|CONF_NOCFG|CONF_PRE_PARSE, 0, 0, NULL},
{"system", &disable_system_conf, CONF_TYPE_FLAG, CONF_GLOBAL|CONF_NOCFG|CONF_PRE_PARSE, 0, 1, NULL},
{"user", &disable_user_conf, CONF_TYPE_FLAG, CONF_GLOBAL|CONF_NOCFG|CONF_PRE_PARSE, 0, 1, NULL},
-#ifdef CONFIG_GUI
- {"gui", &disable_gui_conf, CONF_TYPE_FLAG, CONF_GLOBAL|CONF_NOCFG|CONF_PRE_PARSE, 0, 1, NULL},
-#endif /* CONFIG_GUI */
{NULL, NULL, 0, 0, 0, 0, NULL}
};
diff --git a/mpcommon.h b/mpcommon.h
index 412225b104..d7894edf06 100644
--- a/mpcommon.h
+++ b/mpcommon.h
@@ -22,17 +22,19 @@
#include "subreader.h"
#include "libmpdemux/demuxer.h"
#include "libmpdemux/stheader.h"
-#include "libass/ass_mp.h"
extern double sub_last_pts;
-extern ass_track_t *ass_track;
+extern struct ass_track *ass_track;
extern subtitle *vo_sub_last;
+struct MPContext;
void print_version(const char* name);
-void update_subtitles(sh_video_t *sh_video, double refpts, demux_stream_t *d_dvdsub, int reset);
+void update_subtitles(struct MPContext *mpctx, struct MPOpts *opts,
+ sh_video_t *sh_video, double refpts, double sub_offset,
+ demux_stream_t *d_dvdsub, int reset);
void update_teletext(sh_video_t *sh_video, demuxer_t *demuxer, int reset);
int select_audio(demuxer_t* demuxer, int audio_id, char* audio_lang);
-void set_osd_subtitle(subtitle *subs);
+void set_osd_subtitle(struct MPContext *mpctx, subtitle *subs);
extern int disable_system_conf;
extern int disable_user_conf;
diff --git a/mplayer.c b/mplayer.c
index e508e03be1..cc8dc825e3 100644
--- a/mplayer.c
+++ b/mplayer.c
@@ -21,7 +21,9 @@
#include <stdio.h>
#include <stdlib.h>
+#include <stdbool.h>
#include "config.h"
+#include "talloc.h"
#if defined(__MINGW32__) || defined(__CYGWIN__)
#define _UWIN 1 /*disable Non-underscored versions of non-ANSI functions as otherwise int eof would conflict with eof()*/
@@ -54,21 +56,24 @@
#include <errno.h>
#include "mp_msg.h"
+#include "av_log.h"
-#define HELP_MP_DEFINE_STATIC
#include "help_mp.h"
#include "m_option.h"
#include "m_config.h"
+#include "mplayer.h"
+#include "access_mpcontext.h"
#include "m_property.h"
#include "cfg-mplayer-def.h"
-#include "libavutil/intreadwrite.h"
+#include "ffmpeg_files/intreadwrite.h"
#include "libavutil/avstring.h"
#include "subreader.h"
+#include "mp_osd.h"
#include "libvo/video_out.h"
#include "libvo/font_load.h"
@@ -89,11 +94,11 @@
#include "osdep/getch2.h"
#include "osdep/timer.h"
-
-#include "gui/interface.h"
+#include "osdep/findfiles.h"
#include "input/input.h"
+const int under_mencoder = 0;
int slave_mode=0;
int player_idle_mode=0;
int quiet=0;
@@ -129,36 +134,21 @@ char *heartbeat_cmd;
#include "playtree.h"
#include "playtreeparser.h"
-int import_playtree_playlist_into_gui(play_tree_t* my_playtree, m_config_t* config);
-int import_initial_playtree_into_gui(play_tree_t* my_playtree, m_config_t* config, int enqueue);
-
//**************************************************************************//
// Config
//**************************************************************************//
#include "parser-cfg.h"
#include "parser-mpcmd.h"
-m_config_t* mconfig;
-
//**************************************************************************//
// Config file
//**************************************************************************//
static int cfg_inc_verbose(m_option_t *conf){ ++verbose; return 0;}
-static int cfg_include(m_option_t *conf, char *filename){
- return m_config_parse_config_file(mconfig, filename);
-}
-
#include "get_path.h"
//**************************************************************************//
-// XScreensaver
-//**************************************************************************//
-
-void xscreensaver_heartbeat(void);
-
-//**************************************************************************//
//**************************************************************************//
// Input media streaming & demultiplexer:
//**************************************************************************//
@@ -183,6 +173,95 @@ static int max_framesize=0;
#include "mixer.h"
#include "mp_core.h"
+#include "options.h"
+#include "defaultopts.h"
+
+static const char help_text[]=_(
+"Usage: mplayer [options] [url|path/]filename\n"
+"\n"
+"Basic options: (complete list in the man page)\n"
+" -vo <drv> select video output driver ('-vo help' for a list)\n"
+" -ao <drv> select audio output driver ('-ao help' for a list)\n"
+#ifdef CONFIG_VCD
+" vcd://<trackno> play (S)VCD (Super Video CD) track (raw device, no mount)\n"
+#endif
+#ifdef CONFIG_DVDREAD
+" dvd://<titleno> play DVD title from device instead of plain file\n"
+#endif
+" -alang/-slang select DVD audio/subtitle language (by 2-char country code)\n"
+" -ss <position> seek to given (seconds or hh:mm:ss) position\n"
+" -nosound do not play sound\n"
+" -fs fullscreen playback (or -vm, -zoom, details in the man page)\n"
+" -x <x> -y <y> set display resolution (for use with -vm or -zoom)\n"
+" -sub <file> specify subtitle file to use (also see -subfps, -subdelay)\n"
+" -playlist <file> specify playlist file\n"
+" -vid x -aid y select video (x) and audio (y) stream to play\n"
+" -fps x -srate y change video (x fps) and audio (y Hz) rate\n"
+" -pp <quality> enable postprocessing filter (details in the man page)\n"
+" -framedrop enable frame dropping (for slow machines)\n"
+"\n"
+"Basic keys: (complete list in the man page, also check input.conf)\n"
+" <- or -> seek backward/forward 10 seconds\n"
+" down or up seek backward/forward 1 minute\n"
+" pgdown or pgup seek backward/forward 10 minutes\n"
+" < or > step backward/forward in playlist\n"
+" p or SPACE pause movie (press any key to continue)\n"
+" q or ESC stop playing and quit program\n"
+" + or - adjust audio delay by +/- 0.1 second\n"
+" o cycle OSD mode: none / seekbar / seekbar + timer\n"
+" * or / increase or decrease PCM volume\n"
+" x or z adjust subtitle delay by +/- 0.1 second\n"
+" r or t adjust subtitle position up/down, also see -vf expand\n"
+"\n"
+" * * * SEE THE MAN PAGE FOR DETAILS, FURTHER (ADVANCED) OPTIONS AND KEYS * * *\n"
+"\n");
+
+
+#define Exit_SIGILL_RTCpuSel _(\
+"- MPlayer crashed by an 'Illegal Instruction'.\n"\
+" It may be a bug in our new runtime CPU-detection code...\n"\
+" Please read DOCS/HTML/en/bugreports.html.\n")
+
+#define Exit_SIGILL _(\
+"- MPlayer crashed by an 'Illegal Instruction'.\n"\
+" It usually happens when you run it on a CPU different than the one it was\n"\
+" compiled/optimized for.\n"\
+" Verify this!\n")
+
+#define Exit_SIGSEGV_SIGFPE _(\
+"- MPlayer crashed by bad usage of CPU/FPU/RAM.\n"\
+" Recompile MPlayer with --enable-debug and make a 'gdb' backtrace and\n"\
+" disassembly. Details in DOCS/HTML/en/bugreports_what.html#bugreports_crash.\n")
+
+#define Exit_SIGCRASH _(\
+"- MPlayer crashed. This shouldn't happen.\n"\
+" It can be a bug in the MPlayer code _or_ in your drivers _or_ in your\n"\
+" gcc version. If you think it's MPlayer's fault, please read\n"\
+" DOCS/HTML/en/bugreports.html and follow the instructions there. We can't and\n"\
+" won't help unless you provide this information when reporting a possible bug.\n")
+
+#define SystemTooSlow _("\n\n"\
+" ************************************************\n"\
+" **** Your system is too SLOW to play this! ****\n"\
+" ************************************************\n\n"\
+"Possible reasons, problems, workarounds:\n"\
+"- Most common: broken/buggy _audio_ driver\n"\
+" - Try -ao sdl or use the OSS emulation of ALSA.\n"\
+" - Experiment with different values for -autosync, 30 is a good start.\n"\
+"- Slow video output\n"\
+" - Try a different -vo driver (-vo help for a list) or try -framedrop!\n"\
+"- Slow CPU\n"\
+" - Don't try to play a big DVD/DivX on a slow CPU! Try some of the lavdopts,\n"\
+" e.g. -vfm ffmpeg -lavdopts lowres=1:fast:skiploopfilter=all.\n"\
+"- Broken file\n"\
+" - Try various combinations of -nobps -ni -forceidx -mc 0.\n"\
+"- Slow media (NFS/SMB mounts, DVD, VCD etc)\n"\
+" - Try -cache 8192.\n"\
+"- Are you using -cache to play a non-interleaved AVI file?\n"\
+" - Try -nocache.\n"\
+"Read DOCS/HTML/en/video.html for tuning/speedup tips.\n"\
+"If none of this helps you, read DOCS/HTML/en/bugreports.html.\n\n")
+
//**************************************************************************//
//**************************************************************************//
@@ -192,24 +271,6 @@ static int max_framesize=0;
int noconsolecontrols=0;
//**************************************************************************//
-// Not all functions in mplayer.c take the context as an argument yet
-static MPContext mpctx_s = {
- .osd_function = OSD_PLAY,
- .begin_skip = MP_NOPTS_VALUE,
- .play_tree_step = 1,
- .global_sub_pos = -1,
- .set_of_sub_pos = -1,
- .file_format = DEMUXER_TYPE_UNKNOWN,
- .loop_times = -1,
-#ifdef CONFIG_DVBIN
- .last_dvb_step = 1,
-#endif
-};
-
-static MPContext *mpctx = &mpctx_s;
-
-int fixed_vo=0;
-
// benchmark:
double video_time_usage=0;
double vout_time_usage=0;
@@ -220,25 +281,11 @@ static int drop_frame_cnt=0; // total number of dropped frames
int benchmark=0;
// options:
-#define DEFAULT_STARTUP_DECODE_RETRY 8
int auto_quality=0;
static int output_quality=0;
-float playback_speed=1.0;
-
-int use_gui=0;
-
-#ifdef CONFIG_GUI
-int enqueue=0;
-#endif
-
static int list_properties = 0;
-int osd_level=1;
-// if nonzero, hide current OSD contents when GetTimerMS() reaches this
-unsigned int osd_visible;
-int osd_duration = 1000;
-
int term_osd = 1;
static char* term_osd_esc = "\x1b[A\r\x1b[K";
static char* playing_msg = NULL;
@@ -246,17 +293,12 @@ static char* playing_msg = NULL;
static double seek_to_sec;
static off_t seek_to_byte=0;
static off_t step_sec=0;
-static int loop_seek=0;
static m_time_size_t end_at = { .type = END_AT_NONE, .pos = 0 };
// A/V sync:
int autosync=0; // 30 might be a good default value.
-// may be changed by GUI: (FIXME!)
-float rel_seek_secs=0;
-int abs_seek_pos=0;
-
// codecs:
char **audio_codec_list=NULL; // override audio codec
char **video_codec_list=NULL; // override video codec
@@ -268,10 +310,6 @@ extern char *demuxer_name; // override demuxer
extern char *audio_demuxer_name; // override audio demuxer
extern char *sub_demuxer_name; // override sub demuxer
-// streaming:
-int audio_id=-1;
-int video_id=-1;
-int dvdsub_id=-1;
// this dvdsub_id was selected via slang
// use this to allow dvdnav to follow -slang across stream resets,
// in particular the subtitle ID for a language changes
@@ -280,7 +318,6 @@ int vobsub_id=-1;
char* audio_lang=NULL;
char* dvdsub_lang=NULL;
static char* spudec_ifo=NULL;
-char* filename=NULL; //"MI2-Trailer.avi";
int forced_subs_only=0;
int file_filter=1;
@@ -301,8 +338,6 @@ static char *stream_dump_name="stream.dump";
// A-V sync:
static float default_max_pts_correction=-1;//0.01f;
-static float max_pts_correction=0;//default_max_pts_correction;
-static float c_total=0;
float audio_delay=0;
static int ignore_start=0;
@@ -315,10 +350,6 @@ static int audio_output_format=-1; // AF_FORMAT_UNKNOWN
static int play_n_frames=-1;
static int play_n_frames_mf=-1;
-// screen info:
-char** video_driver_list=NULL;
-char** audio_driver_list=NULL;
-
// sub:
char *font_name=NULL;
char *sub_font_name=NULL;
@@ -333,7 +364,7 @@ char *vobsub_name=NULL;
int subcc_enabled=0;
int suboverlap_enabled = 1;
-#include "libass/ass_mp.h"
+#include "ass_mp.h"
char* current_module=NULL; // for debugging
@@ -343,9 +374,9 @@ char* current_module=NULL; // for debugging
#ifdef CONFIG_MENU
#include "m_struct.h"
#include "libmenu/menu.h"
-void vf_menu_pause_update(struct vf_instance_s* vf);
+void vf_menu_pause_update(struct vf_instance* vf);
extern vf_info_t vf_info_menu;
-static vf_info_t* libmenu_vfs[] = {
+static const vf_info_t* const libmenu_vfs[] = {
&vf_info_menu,
NULL
};
@@ -363,12 +394,10 @@ static char* rtc_device;
edl_record_ptr edl_records = NULL; ///< EDL entries memory area
edl_record_ptr next_edl_record = NULL; ///< only for traversing edl_records
-short edl_decision = 0; ///< 1 when an EDL operation has been made.
FILE* edl_fd = NULL; ///< fd to write to when in -edlout mode.
int use_filedir_conf;
int use_filename_title;
-static unsigned int initialized_flags=0;
#include "mpcommon.h"
#include "command.h"
@@ -411,7 +440,15 @@ int mpctx_get_osd_function(MPContext *mpctx)
return mpctx->osd_function;
}
-static int is_valid_metadata_type (metadata_t type) {
+static float get_relative_time(struct MPContext *mpctx)
+{
+ unsigned int new_time = GetTimer();
+ unsigned int delta = new_time - mpctx->last_time;
+ mpctx->last_time = new_time;
+ return delta * 0.000001;
+}
+
+static int is_valid_metadata_type(struct MPContext *mpctx, metadata_t type) {
switch (type)
{
/* check for valid video stream */
@@ -455,7 +492,7 @@ static int is_valid_metadata_type (metadata_t type) {
return 1;
}
-static char *get_demuxer_info (char *tag) {
+static char *get_demuxer_info(struct MPContext *mpctx, char *tag) {
char **info = mpctx->demuxer->info;
int n;
@@ -469,19 +506,20 @@ static char *get_demuxer_info (char *tag) {
return info[2*n+1] ? strdup (info[2*n+1]) : NULL;
}
-char *get_metadata (metadata_t type) {
+char *get_metadata(struct MPContext *mpctx, metadata_t type)
+{
char *meta = NULL;
sh_audio_t * const sh_audio = mpctx->sh_audio;
sh_video_t * const sh_video = mpctx->sh_video;
- if (!is_valid_metadata_type (type))
+ if (!is_valid_metadata_type(mpctx, type))
return NULL;
switch (type)
{
case META_NAME:
{
- return strdup (mp_basename2 (filename));
+ return strdup (mp_basename2 (mpctx->filename));
}
case META_VIDEO_CODEC:
@@ -544,25 +582,25 @@ char *get_metadata (metadata_t type) {
/* check for valid demuxer */
case META_INFO_TITLE:
- return get_demuxer_info ("Title");
+ return get_demuxer_info(mpctx, "Title");
case META_INFO_ARTIST:
- return get_demuxer_info ("Artist");
+ return get_demuxer_info(mpctx, "Artist");
case META_INFO_ALBUM:
- return get_demuxer_info ("Album");
+ return get_demuxer_info(mpctx, "Album");
case META_INFO_YEAR:
- return get_demuxer_info ("Year");
+ return get_demuxer_info(mpctx, "Year");
case META_INFO_COMMENT:
- return get_demuxer_info ("Comment");
+ return get_demuxer_info(mpctx, "Comment");
case META_INFO_TRACK:
- return get_demuxer_info ("Track");
+ return get_demuxer_info(mpctx, "Track");
case META_INFO_GENRE:
- return get_demuxer_info ("Genre");
+ return get_demuxer_info(mpctx, "Genre");
default:
break;
@@ -585,24 +623,21 @@ static void mp_dvdnav_context_free(MPContext *ctx){
}
#endif
-void uninit_player(unsigned int mask){
- mask &= initialized_flags;
+void uninit_player(struct MPContext *mpctx, unsigned int mask){
+ mask &= mpctx->initialized_flags;
mp_msg(MSGT_CPLAYER,MSGL_DBG2,"\n*** uninit(0x%X)\n",mask);
if(mask&INITIALIZED_ACODEC){
- initialized_flags&=~INITIALIZED_ACODEC;
+ mpctx->initialized_flags&=~INITIALIZED_ACODEC;
current_module="uninit_acodec";
if(mpctx->sh_audio) uninit_audio(mpctx->sh_audio);
-#ifdef CONFIG_GUI
- if (use_gui) guiGetEvent(guiSetAfilter, (char *)NULL);
-#endif
mpctx->sh_audio=NULL;
mpctx->mixer.afilter = NULL;
}
if(mask&INITIALIZED_VCODEC){
- initialized_flags&=~INITIALIZED_VCODEC;
+ mpctx->initialized_flags&=~INITIALIZED_VCODEC;
current_module="uninit_vcodec";
if(mpctx->sh_video) uninit_video(mpctx->sh_video);
mpctx->sh_video=NULL;
@@ -612,8 +647,25 @@ void uninit_player(unsigned int mask){
}
if(mask&INITIALIZED_DEMUXER){
- initialized_flags&=~INITIALIZED_DEMUXER;
+ mpctx->initialized_flags&=~INITIALIZED_DEMUXER;
current_module="free_demuxer";
+ if (mpctx->num_sources) {
+ mpctx->demuxer = mpctx->sources[0].demuxer;
+ for (int i = 1; i < mpctx->num_sources; i++) {
+ free_stream(mpctx->sources[i].stream);
+ free_demuxer(mpctx->sources[i].demuxer);
+ }
+ }
+ talloc_free(mpctx->sources);
+ mpctx->sources = NULL;
+ mpctx->num_sources = 0;
+ talloc_free(mpctx->timeline);
+ mpctx->timeline = NULL;
+ mpctx->num_timeline_parts = 0;
+ talloc_free(mpctx->chapters);
+ mpctx->chapters = NULL;
+ mpctx->num_chapters = 0;
+ mpctx->video_offset = 0;
if(mpctx->demuxer){
mpctx->stream=mpctx->demuxer->stream;
free_demuxer(mpctx->demuxer);
@@ -623,16 +675,16 @@ void uninit_player(unsigned int mask){
// kill the cache process:
if(mask&INITIALIZED_STREAM){
- initialized_flags&=~INITIALIZED_STREAM;
+ mpctx->initialized_flags&=~INITIALIZED_STREAM;
current_module="uninit_stream";
if(mpctx->stream) free_stream(mpctx->stream);
mpctx->stream=NULL;
}
if(mask&INITIALIZED_VO){
- initialized_flags&=~INITIALIZED_VO;
+ mpctx->initialized_flags&=~INITIALIZED_VO;
current_module="uninit_vo";
- mpctx->video_out->uninit();
+ vo_destroy(mpctx->video_out);
mpctx->video_out=NULL;
#ifdef CONFIG_DVDNAV
mp_dvdnav_context_free(mpctx);
@@ -641,7 +693,7 @@ void uninit_player(unsigned int mask){
// Must be after libvo uninit, as few vo drivers (svgalib) have tty code.
if(mask&INITIALIZED_GETCH2){
- initialized_flags&=~INITIALIZED_GETCH2;
+ mpctx->initialized_flags&=~INITIALIZED_GETCH2;
current_module="uninit_getch2";
mp_msg(MSGT_CPLAYER,MSGL_DBG2,"\n[[[uninit getch2]]]\n");
// restore terminal:
@@ -649,71 +701,58 @@ void uninit_player(unsigned int mask){
}
if(mask&INITIALIZED_VOBSUB){
- initialized_flags&=~INITIALIZED_VOBSUB;
+ mpctx->initialized_flags&=~INITIALIZED_VOBSUB;
current_module="uninit_vobsub";
if(vo_vobsub) vobsub_close(vo_vobsub);
vo_vobsub=NULL;
}
if (mask&INITIALIZED_SPUDEC){
- initialized_flags&=~INITIALIZED_SPUDEC;
+ mpctx->initialized_flags&=~INITIALIZED_SPUDEC;
current_module="uninit_spudec";
spudec_free(vo_spudec);
vo_spudec=NULL;
}
if(mask&INITIALIZED_AO){
- initialized_flags&=~INITIALIZED_AO;
+ mpctx->initialized_flags&=~INITIALIZED_AO;
current_module="uninit_ao";
if (mpctx->edl_muted) mixer_mute(&mpctx->mixer);
- if (mpctx->audio_out) mpctx->audio_out->uninit(mpctx->eof?0:1);
+ if (mpctx->audio_out)
+ mpctx->audio_out->uninit(mpctx->stop_play != AT_END_OF_FILE);
mpctx->audio_out=NULL;
}
-#ifdef CONFIG_GUI
- if(mask&INITIALIZED_GUI){
- initialized_flags&=~INITIALIZED_GUI;
- current_module="uninit_gui";
- guiDone();
- }
-#endif
-
- if(mask&INITIALIZED_INPUT){
- initialized_flags&=~INITIALIZED_INPUT;
- current_module="uninit_input";
- mp_input_uninit();
-#ifdef CONFIG_MENU
- if (use_menu)
- menu_uninit();
-#endif
- }
-
current_module=NULL;
}
-void exit_player_with_rc(exit_reason_t how, int rc){
-
+void exit_player_with_rc(struct MPContext *mpctx, exit_reason_t how, int rc)
+{
if (mpctx->user_muted && !mpctx->edl_muted) mixer_mute(&mpctx->mixer);
- uninit_player(INITIALIZED_ALL);
+ uninit_player(mpctx, INITIALIZED_ALL);
#if defined(__MINGW32__) || defined(__CYGWIN__)
timeEndPeriod(1);
#endif
#ifdef CONFIG_X11
-#ifdef CONFIG_GUI
- if ( !use_gui )
+ vo_uninit(mpctx->x11_state); // Close the X11 connection (if any is open).
#endif
- vo_uninit(); // Close the X11 connection (if any is open).
+
+ current_module="uninit_input";
+ mp_input_uninit(mpctx->input);
+#ifdef CONFIG_MENU
+ if (use_menu)
+ menu_uninit();
#endif
#ifdef CONFIG_FREETYPE
current_module="uninit_font";
- if (sub_font && sub_font != vo_font) free_font_desc(sub_font);
- sub_font = NULL;
- if (vo_font) free_font_desc(vo_font);
+ if (mpctx->osd && mpctx->osd->sub_font != vo_font)
+ free_font_desc(mpctx->osd->sub_font);
+ free_font_desc(vo_font);
vo_font = NULL;
done_freetype();
#endif
- free_osd_list();
+ osd_free(mpctx->osd);
#ifdef CONFIG_ASS
ass_library_done(ass_library);
@@ -723,9 +762,9 @@ void exit_player_with_rc(exit_reason_t how, int rc){
current_module="exit_player";
// free mplayer config
- if(mconfig)
- m_config_free(mconfig);
- mconfig = NULL;
+ if(mpctx->mconfig)
+ m_config_free(mpctx->mconfig);
+ mpctx->mconfig = NULL;
if(mpctx->playtree_iter)
play_tree_iter_free(mpctx->playtree_iter);
@@ -734,20 +773,21 @@ void exit_player_with_rc(exit_reason_t how, int rc){
play_tree_free(mpctx->playtree, 1);
mpctx->playtree = NULL;
+ talloc_free(mpctx->key_fifo);
if(edl_records != NULL) free(edl_records); // free mem allocated for EDL
edl_records = NULL;
switch(how) {
case EXIT_QUIT:
- mp_msg(MSGT_CPLAYER,MSGL_INFO,MSGTR_ExitingHow,MSGTR_Exit_quit);
+ mp_tmsg(MSGT_CPLAYER,MSGL_INFO,"\nExiting... (%s)\n","Quit");
mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_EXIT=QUIT\n");
break;
case EXIT_EOF:
- mp_msg(MSGT_CPLAYER,MSGL_INFO,MSGTR_ExitingHow,MSGTR_Exit_eof);
+ mp_tmsg(MSGT_CPLAYER,MSGL_INFO,"\nExiting... (%s)\n","End of file");
mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_EXIT=EOF\n");
break;
case EXIT_ERROR:
- mp_msg(MSGT_CPLAYER,MSGL_INFO,MSGTR_ExitingHow,MSGTR_Exit_error);
+ mp_tmsg(MSGT_CPLAYER,MSGL_INFO,"\nExiting... (%s)\n","Fatal error");
mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_EXIT=ERROR\n");
break;
default:
@@ -758,8 +798,9 @@ void exit_player_with_rc(exit_reason_t how, int rc){
exit(rc);
}
-void exit_player(exit_reason_t how){
- exit_player_with_rc(how, 1);
+static void exit_player(struct MPContext *mpctx, exit_reason_t how)
+{
+ exit_player_with_rc(mpctx, how, 1);
}
#ifndef __MINGW32__
@@ -780,7 +821,6 @@ static void exit_sighandler(int x){
if (!crash_debug || x != SIGTRAP)
#endif
++sig_count;
- if(initialized_flags==0 && sig_count>1) exit(1);
if(sig_count==5)
{
/* We're crashing bad and can't uninit cleanly :(
@@ -797,9 +837,10 @@ static void exit_sighandler(int x){
kill(getpid(),SIGKILL);
#endif
}
- mp_msg(MSGT_CPLAYER,MSGL_FATAL,"\n" MSGTR_IntBySignal,x,
- current_module?current_module:"unknown"
- );
+ mp_msg(MSGT_CPLAYER, MSGL_FATAL, "\n");
+ mp_tmsg(MSGT_CPLAYER,MSGL_FATAL,
+ "\nMPlayer interrupted by signal %d in module: %s\n", x,
+ current_module ? current_module : "unknown");
mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_SIGNAL=%d\n", x);
if(sig_count<=1)
switch(x){
@@ -811,15 +852,15 @@ static void exit_sighandler(int x){
return; // killed from keyboard (^C) or killed [-9]
case SIGILL:
#if CONFIG_RUNTIME_CPUDETECT
- mp_msg(MSGT_CPLAYER,MSGL_FATAL,MSGTR_Exit_SIGILL_RTCpuSel);
+ mp_tmsg(MSGT_CPLAYER,MSGL_FATAL,Exit_SIGILL_RTCpuSel);
#else
- mp_msg(MSGT_CPLAYER,MSGL_FATAL,MSGTR_Exit_SIGILL);
+ mp_tmsg(MSGT_CPLAYER,MSGL_FATAL,Exit_SIGILL);
#endif
case SIGFPE:
case SIGSEGV:
- mp_msg(MSGT_CPLAYER,MSGL_FATAL,MSGTR_Exit_SIGSEGV_SIGFPE);
+ mp_tmsg(MSGT_CPLAYER,MSGL_FATAL,Exit_SIGSEGV_SIGFPE);
default:
- mp_msg(MSGT_CPLAYER,MSGL_FATAL,MSGTR_Exit_SIGCRASH);
+ mp_tmsg(MSGT_CPLAYER,MSGL_FATAL,Exit_SIGCRASH);
#ifdef CONFIG_CRASH_DEBUG
if (crash_debug) {
int gdb_pid;
@@ -845,19 +886,22 @@ static void exit_sighandler(int x){
exit(1);
}
-void mp_input_register_options(m_config_t* cfg);
-
#include "cfg-mplayer.h"
-static void parse_cfgfiles( m_config_t* conf )
+static int cfg_include(m_option_t *conf, char *filename)
+{
+ return m_config_parse_config_file(conf->priv, filename);
+}
+
+static void parse_cfgfiles(struct MPContext *mpctx, m_config_t* conf)
{
char *conffile;
int conffile_fd;
if (!disable_system_conf &&
m_config_parse_config_file(conf, MPLAYER_CONFDIR "/mplayer.conf") < 0)
- exit_player(EXIT_NONE);
+ exit_player(mpctx, EXIT_NONE);
if ((conffile = get_path("")) == NULL) {
- mp_msg(MSGT_CPLAYER,MSGL_WARN,MSGTR_NoHomeDir);
+ mp_tmsg(MSGT_CPLAYER,MSGL_WARN,"Cannot find HOME directory.\n");
} else {
#ifdef __MINGW32__
mkdir(conffile);
@@ -866,16 +910,16 @@ if ((conffile = get_path("")) == NULL) {
#endif
free(conffile);
if ((conffile = get_path("config")) == NULL) {
- mp_msg(MSGT_CPLAYER,MSGL_ERR,MSGTR_GetpathProblem);
+ mp_tmsg(MSGT_CPLAYER,MSGL_ERR,"get_path(\"config\") problem\n");
} else {
if ((conffile_fd = open(conffile, O_CREAT | O_EXCL | O_WRONLY, 0666)) != -1) {
- mp_msg(MSGT_CPLAYER,MSGL_INFO,MSGTR_CreatingCfgFile, conffile);
+ mp_tmsg(MSGT_CPLAYER,MSGL_INFO,"Creating config file: %s\n", conffile);
write(conffile_fd, default_config, strlen(default_config));
close(conffile_fd);
}
if (!disable_user_conf &&
m_config_parse_config_file(conf, conffile) < 0)
- exit_player(EXIT_NONE);
+ exit_player(mpctx, EXIT_NONE);
free(conffile);
}
}
@@ -899,7 +943,7 @@ static void load_per_protocol_config (m_config_t* conf, const char *const file)
p = m_config_get_profile (conf, protocol);
if (p)
{
- mp_msg(MSGT_CPLAYER,MSGL_INFO,MSGTR_LoadingProtocolProfile, protocol);
+ mp_tmsg(MSGT_CPLAYER,MSGL_INFO,"Loading protocol-related profile '%s'\n", protocol);
m_config_set_profile(conf,p);
}
}
@@ -913,7 +957,7 @@ static void load_per_extension_config (m_config_t* conf, const char *const file)
m_profile_t *p;
/* does filename actually have an extension ? */
- str = strrchr (filename, '.');
+ str = strrchr (file, '.');
if (!str)
return;
@@ -922,7 +966,7 @@ static void load_per_extension_config (m_config_t* conf, const char *const file)
p = m_config_get_profile (conf, extension);
if (p)
{
- mp_msg(MSGT_CPLAYER,MSGL_INFO,MSGTR_LoadingExtensionProfile, extension);
+ mp_tmsg(MSGT_CPLAYER,MSGL_INFO,"Loading extension-related profile '%s'\n", extension);
m_config_set_profile(conf,p);
}
}
@@ -939,7 +983,7 @@ static void load_per_output_config (m_config_t* conf, char *cfg, char *out)
p = m_config_get_profile (conf, profile);
if (p)
{
- mp_msg(MSGT_CPLAYER,MSGL_INFO,MSGTR_LoadingExtensionProfile, profile);
+ mp_tmsg(MSGT_CPLAYER,MSGL_INFO,"Loading extension-related profile '%s'\n", profile);
m_config_set_profile(conf,p);
}
}
@@ -953,7 +997,7 @@ static int try_load_config(m_config_t *conf, const char *file)
struct stat st;
if (stat(file, &st))
return 0;
- mp_msg(MSGT_CPLAYER,MSGL_INFO,MSGTR_LoadingConfig, file);
+ mp_tmsg(MSGT_CPLAYER, MSGL_INFO, "Loading config '%s'\n", file);
m_config_parse_config_file (conf, file);
return 1;
}
@@ -1006,42 +1050,35 @@ static void load_per_file_config (m_config_t* conf, const char *const file)
* cache filling) if the operation fails we use this function to check
* if it was interrupted by the user.
* The function returns a new value for eof. */
-static int libmpdemux_was_interrupted(int eof) {
+static int libmpdemux_was_interrupted(struct MPContext *mpctx, int stop_play)
+{
mp_cmd_t* cmd;
- if((cmd = mp_input_get_cmd(0,0,0)) != NULL) {
+ if((cmd = mp_input_get_cmd(mpctx->input, 0,0,0)) != NULL) {
switch(cmd->id) {
case MP_CMD_QUIT:
- exit_player_with_rc(EXIT_QUIT, (cmd->nargs > 0)? cmd->args[0].v.i : 0);
+ exit_player_with_rc(mpctx, EXIT_QUIT, (cmd->nargs > 0)? cmd->args[0].v.i : 0);
case MP_CMD_PLAY_TREE_STEP: {
- eof = (cmd->args[0].v.i > 0) ? PT_NEXT_ENTRY : PT_PREV_ENTRY;
+ stop_play = (cmd->args[0].v.i > 0) ? PT_NEXT_ENTRY : PT_PREV_ENTRY;
mpctx->play_tree_step = (cmd->args[0].v.i == 0) ? 1 : cmd->args[0].v.i;
} break;
case MP_CMD_PLAY_TREE_UP_STEP: {
- eof = (cmd->args[0].v.i > 0) ? PT_UP_NEXT : PT_UP_PREV;
+ stop_play = (cmd->args[0].v.i > 0) ? PT_UP_NEXT : PT_UP_PREV;
} break;
case MP_CMD_PLAY_ALT_SRC_STEP: {
- eof = (cmd->args[0].v.i > 0) ? PT_NEXT_SRC : PT_PREV_SRC;
+ stop_play = (cmd->args[0].v.i > 0) ? PT_NEXT_SRC : PT_PREV_SRC;
} break;
}
mp_cmd_free(cmd);
}
- return eof;
+ return stop_play;
}
#define mp_basename(s) (strrchr(s,'\\')==NULL?(mp_basename2(s)):(strrchr(s,'\\')+1))
-static int playtree_add_playlist(play_tree_t* entry)
+static int playtree_add_playlist(struct MPContext *mpctx, play_tree_t* entry)
{
- play_tree_add_bpf(entry,filename);
+ play_tree_add_bpf(entry,mpctx->filename);
-#ifdef CONFIG_GUI
- if (use_gui) {
- if (entry) {
- import_playtree_playlist_into_gui(entry, mconfig);
- play_tree_free_list(entry,1);
- }
- } else
-#endif
{
if(!entry) {
entry = mpctx->playtree_iter->tree;
@@ -1067,76 +1104,59 @@ static int playtree_add_playlist(play_tree_t* entry)
return PT_NEXT_SRC;
}
-void add_subtitles(char *filename, float fps, int noerr)
+void add_subtitles(struct MPContext *mpctx, char *filename, float fps, int noerr)
{
- sub_data *subd;
-#ifdef CONFIG_ASS
- ass_track_t *asst = 0;
-#endif
+ struct MPOpts *opts = &mpctx->opts;
+ sub_data *subd = NULL;
+ struct ass_track *asst = NULL;
if (filename == NULL || mpctx->set_of_sub_size >= MAX_SUBTITLE_FILES) {
return;
}
- subd = sub_read_file(filename, fps);
#ifdef CONFIG_ASS
- if (ass_enabled)
+ if (opts->ass_enabled) {
#ifdef CONFIG_ICONV
asst = ass_read_file(ass_library, filename, sub_cp);
#else
asst = ass_read_file(ass_library, filename, 0);
#endif
- if (ass_enabled && subd && !asst)
- asst = ass_read_subdata(ass_library, subd, fps);
-
- if (!asst && !subd)
-#else
- if(!subd)
+ if (!asst) {
+ subd = sub_read_file(filename, fps);
+ if (subd) {
+ asst = ass_read_subdata(ass_library, subd, fps);
+ if (asst) {
+ sub_free(subd);
+ subd = NULL;
+ }
+ }
+ }
+ } else
#endif
- mp_msg(MSGT_CPLAYER, noerr ? MSGL_WARN : MSGL_ERR, MSGTR_CantLoadSub,
- filename_recode(filename));
+ subd = sub_read_file(filename, fps);
+
+
+ if (!asst && !subd) {
+ mp_tmsg(MSGT_CPLAYER, noerr ? MSGL_WARN : MSGL_ERR,
+ "Cannot load subtitles: %s\n", filename_recode(filename));
+ return;
+ }
-#ifdef CONFIG_ASS
- if (!asst && !subd) return;
mpctx->set_of_ass_tracks[mpctx->set_of_sub_size] = asst;
-#else
- if (!subd) return;
-#endif
mpctx->set_of_subtitles[mpctx->set_of_sub_size] = subd;
mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_FILE_SUB_ID=%d\n", mpctx->set_of_sub_size);
mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_FILE_SUB_FILENAME=%s\n",
filename_recode(filename));
++mpctx->set_of_sub_size;
- mp_msg(MSGT_CPLAYER, MSGL_INFO, MSGTR_AddedSubtitleFile, mpctx->set_of_sub_size,
+ mp_tmsg(MSGT_CPLAYER, MSGL_INFO, "SUB: Added subtitle file (%d): %s\n", mpctx->set_of_sub_size,
filename_recode(filename));
}
-// FIXME: if/when the GUI calls this, global sub numbering gets (potentially) broken.
-void update_set_of_subtitles(void)
- // subdata was changed, set_of_sub... have to be updated.
+void init_vo_spudec(struct MPContext *mpctx)
{
- sub_data ** const set_of_subtitles = mpctx->set_of_subtitles;
- int i;
- if (mpctx->set_of_sub_size > 0 && subdata == NULL) { // *subdata was deleted
- for (i = mpctx->set_of_sub_pos + 1; i < mpctx->set_of_sub_size; ++i)
- set_of_subtitles[i-1] = set_of_subtitles[i];
- set_of_subtitles[mpctx->set_of_sub_size-1] = NULL;
- --mpctx->set_of_sub_size;
- if (mpctx->set_of_sub_size > 0) subdata = set_of_subtitles[mpctx->set_of_sub_pos=0];
- }
- else if (mpctx->set_of_sub_size > 0 && subdata != NULL) { // *subdata was changed
- set_of_subtitles[mpctx->set_of_sub_pos] = subdata;
- }
- else if (mpctx->set_of_sub_size <= 0 && subdata != NULL) { // *subdata was added
- set_of_subtitles[mpctx->set_of_sub_pos=mpctx->set_of_sub_size] = subdata;
- ++mpctx->set_of_sub_size;
- }
-}
-
-void init_vo_spudec(void) {
if (vo_spudec)
spudec_free(vo_spudec);
- initialized_flags &= ~INITIALIZED_SPUDEC;
+ mpctx->initialized_flags &= ~INITIALIZED_SPUDEC;
vo_spudec = NULL;
if (spudec_ifo) {
unsigned int palette[16], width, height;
@@ -1170,7 +1190,7 @@ void init_vo_spudec(void) {
}
if (vo_spudec!=NULL) {
- initialized_flags|=INITIALIZED_SPUDEC;
+ mpctx->initialized_flags|=INITIALIZED_SPUDEC;
mp_property_do("sub_forced_only", M_PROPERTY_SET, &forced_subs_only, mpctx);
}
}
@@ -1231,15 +1251,27 @@ static void sadd_hhmmssf(char *buf, unsigned *pos, int len, float time) {
saddf(buf, pos, len, "%02d.%1d", ss, f1);
}
-/**
- * \brief print the status line
- * \param a_pos audio position
- * \param a_v A-V desynchronization
- * \param corr amount out A-V synchronization
- */
-static void print_status(float a_pos, float a_v, float corr)
+static void print_status(struct MPContext *mpctx, double a_pos, bool at_frame)
{
+ struct MPOpts *opts = &mpctx->opts;
sh_video_t * const sh_video = mpctx->sh_video;
+
+ if (mpctx->sh_audio && a_pos == MP_NOPTS_VALUE)
+ a_pos = playing_audio_pts(mpctx);
+ if (mpctx->sh_audio && sh_video && at_frame) {
+ mpctx->last_av_difference = a_pos - sh_video->pts - audio_delay;
+ if (mpctx->time_frame > 0)
+ mpctx->last_av_difference += mpctx->time_frame * opts->playback_speed;
+ if (mpctx->last_av_difference > 0.5 && drop_frame_cnt > 50
+ && !mpctx->drop_message_shown) {
+ mp_tmsg(MSGT_AVSYNC,MSGL_WARN,SystemTooSlow);
+ mpctx->drop_message_shown = true;
+ }
+ }
+ if (quiet)
+ return;
+
+
int width;
char *line;
unsigned pos = 0;
@@ -1274,7 +1306,8 @@ static void print_status(float a_pos, float a_v, float corr)
// A-V sync
if (mpctx->sh_audio && sh_video)
- saddf(line, &pos, width, "A-V:%7.3f ct:%7.3f ", a_v, corr);
+ saddf(line, &pos, width, "A-V:%7.3f ct:%7.3f ",
+ mpctx->last_av_difference, mpctx->total_avsync_change);
// Video stats
if (sh_video)
@@ -1286,9 +1319,9 @@ static void print_status(float a_pos, float a_v, float corr)
if (sh_video) {
if (sh_video->timer > 0.5)
saddf(line, &pos, width, "%2d%% %2d%% %4.1f%% ",
- (int)(100.0*video_time_usage*playback_speed/(double)sh_video->timer),
- (int)(100.0*vout_time_usage*playback_speed/(double)sh_video->timer),
- (100.0*audio_time_usage*playback_speed/(double)sh_video->timer));
+ (int)(100.0*video_time_usage*opts->playback_speed/(double)sh_video->timer),
+ (int)(100.0*vout_time_usage*opts->playback_speed/(double)sh_video->timer),
+ (100.0*audio_time_usage*opts->playback_speed/(double)sh_video->timer));
else
saddf(line, &pos, width, "??%% ??%% ??,?%% ");
} else if (mpctx->sh_audio) {
@@ -1310,8 +1343,8 @@ static void print_status(float a_pos, float a_v, float corr)
#endif
// other
- if (playback_speed != 1)
- saddf(line, &pos, width, "%4.2fx ", playback_speed);
+ if (opts->playback_speed != 1)
+ saddf(line, &pos, width, "%4.2fx ", opts->playback_speed);
// end
if (erase_to_end_of_line) {
@@ -1331,39 +1364,34 @@ static void print_status(float a_pos, float a_v, float corr)
* \param sh_audio describes the requested input format of the chain.
* \param ao_data describes the requested output format of the chain.
*/
-int build_afilter_chain(sh_audio_t *sh_audio, ao_data_t *ao_data)
+int build_afilter_chain(struct MPContext *mpctx, sh_audio_t *sh_audio, ao_data_t *ao_data)
{
+ struct MPOpts *opts = &mpctx->opts;
int new_srate;
int result;
if (!sh_audio)
{
-#ifdef CONFIG_GUI
- if (use_gui) guiGetEvent(guiSetAfilter, (char *)NULL);
-#endif
mpctx->mixer.afilter = NULL;
return 0;
}
if(af_control_any_rev(sh_audio->afilter,
AF_CONTROL_PLAYBACK_SPEED | AF_CONTROL_SET,
- &playback_speed)) {
+ &opts->playback_speed)) {
new_srate = sh_audio->samplerate;
} else {
- new_srate = sh_audio->samplerate * playback_speed;
+ new_srate = sh_audio->samplerate * opts->playback_speed;
if (new_srate != ao_data->samplerate) {
// limits are taken from libaf/af_resample.c
if (new_srate < 8000)
new_srate = 8000;
if (new_srate > 192000)
new_srate = 192000;
- playback_speed = (float)new_srate / (float)sh_audio->samplerate;
+ opts->playback_speed = (float)new_srate / (float)sh_audio->samplerate;
}
}
result = init_audio_filters(sh_audio, new_srate,
&ao_data->samplerate, &ao_data->channels, &ao_data->format);
mpctx->mixer.afilter = sh_audio->afilter;
-#ifdef CONFIG_GUI
- if (use_gui) guiGetEvent(guiSetAfilter, (char *)sh_audio->afilter);
-#endif
return result;
}
@@ -1389,10 +1417,10 @@ static mp_osd_msg_t* osd_msg_stack = NULL;
* it is pulled on top of the stack, otherwise a new message is created.
*
*/
-
-void set_osd_msg(int id, int level, int time, const char* fmt, ...) {
+static void set_osd_msg_va(int id, int level, int time, const char *fmt,
+ va_list ap)
+{
mp_osd_msg_t *msg,*last=NULL;
- va_list va;
int r;
// look if the id is already in the stack
@@ -1409,9 +1437,7 @@ void set_osd_msg(int id, int level, int time, const char* fmt, ...) {
osd_msg_stack = msg;
}
// write the msg
- va_start(va,fmt);
- r = vsnprintf(msg->msg, 128, fmt, va);
- va_end(va);
+ r = vsnprintf(msg->msg, 128, fmt, ap);
if(r >= 128) msg->msg[127] = 0;
// set id and time
msg->id = id;
@@ -1420,6 +1446,23 @@ void set_osd_msg(int id, int level, int time, const char* fmt, ...) {
}
+void set_osd_msg(int id, int level, int time, const char *fmt, ...)
+{
+ va_list ap;
+ va_start(ap, fmt);
+ set_osd_msg_va(id, level, time, fmt, ap);
+ va_end(ap);
+}
+
+void set_osd_tmsg(int id, int level, int time, const char *fmt, ...)
+{
+ va_list ap;
+ va_start(ap, fmt);
+ set_osd_msg_va(id, level, time, mp_gtext(fmt), ap);
+ va_end(ap);
+}
+
+
/**
* \brief Remove a message from the OSD stack
*
@@ -1466,24 +1509,27 @@ static void clear_osd_msgs(void) {
*
*/
-static mp_osd_msg_t* get_osd_msg(void) {
+static mp_osd_msg_t* get_osd_msg(struct MPContext *mpctx)
+{
+ struct MPOpts *opts = &mpctx->opts;
mp_osd_msg_t *msg,*prev,*last = NULL;
static unsigned last_update = 0;
unsigned now = GetTimerMS();
unsigned diff;
char hidden_dec_done = 0;
- if (osd_visible) {
+ if (mpctx->osd_visible) {
// 36000000 means max timed visibility is 1 hour into the future, if
// the difference is greater assume it's wrapped around from below 0
- if (osd_visible - now > 36000000) {
- osd_visible = 0;
+ if (mpctx->osd_visible - now > 36000000) {
+ mpctx->osd_visible = 0;
vo_osd_progbar_type = -1; // disable
vo_osd_changed(OSDTYPE_PROGBAR);
- if (mpctx->osd_function != OSD_PAUSE)
- mpctx->osd_function = OSD_PLAY;
+ mpctx->osd_function = mpctx->paused ? OSD_PAUSE : OSD_PLAY;
}
}
+ if (mpctx->osd_show_percentage_until - now > 36000000)
+ mpctx->osd_show_percentage_until = 0;
if(!last_update) last_update = now;
diff = now >= last_update ? now - last_update : 0;
@@ -1493,14 +1539,16 @@ static mp_osd_msg_t* get_osd_msg(void) {
// Look for the first message in the stack with high enough level.
for(msg = osd_msg_stack ; msg ; last = msg, msg = prev) {
prev = msg->prev;
- if(msg->level > osd_level && hidden_dec_done) continue;
+ if (msg->level > opts->osd_level && hidden_dec_done)
+ continue;
// The message has a high enough level or it is the first hidden one
// in both cases we decrement the timer or kill it.
if(!msg->started || msg->time > diff) {
if(msg->started) msg->time -= diff;
else msg->started = 1;
// display it
- if(msg->level <= osd_level) return msg;
+ if (msg->level <= opts->osd_level)
+ return msg;
hidden_dec_done = 1;
continue;
}
@@ -1525,26 +1573,28 @@ static mp_osd_msg_t* get_osd_msg(void) {
*
*/
-void set_osd_bar(int type,const char* name,double min,double max,double val) {
-
- if(osd_level < 1) return;
+void set_osd_bar(struct MPContext *mpctx, int type,const char* name,double min,double max,double val) {
+ struct MPOpts *opts = &mpctx->opts;
+ if (opts->osd_level < 1)
+ return;
if(mpctx->sh_video) {
- osd_visible = (GetTimerMS() + 1000) | 1;
+ mpctx->osd_visible = (GetTimerMS() + 1000) | 1;
vo_osd_progbar_type = type;
vo_osd_progbar_value = 256*(val-min)/(max-min);
vo_osd_changed(OSDTYPE_PROGBAR);
return;
}
- set_osd_msg(OSD_MSG_BAR,1,osd_duration,"%s: %d %%",
- name,ROUND(100*(val-min)/(max-min)));
+ set_osd_msg(OSD_MSG_BAR, 1, opts->osd_duration, "%s: %d %%",
+ name, ROUND(100*(val-min)/(max-min)));
}
/**
* \brief Display text subtitles on the OSD
*/
-void set_osd_subtitle(subtitle *subs) {
+void set_osd_subtitle(struct MPContext *mpctx, subtitle *subs)
+{
int i;
vo_sub = subs;
vo_osd_changed(OSDTYPE_SUBTITLE);
@@ -1571,18 +1621,30 @@ void set_osd_subtitle(subtitle *subs) {
*
*/
-static void update_osd_msg(void) {
+static void update_osd_msg(struct MPContext *mpctx)
+{
+ struct MPOpts *opts = &mpctx->opts;
mp_osd_msg_t *msg;
- static char osd_text[128] = "";
- static char osd_text_timer[128];
-
- // we need some mem for vo_osd_text
- vo_osd_text = (unsigned char*)osd_text;
+ struct osd_state *osd = mpctx->osd;
+ char osd_text_timer[128];
+
+ if (mpctx->add_osd_seek_info) {
+ double percentage;
+ if (mpctx->timeline && mpctx->sh_video)
+ percentage = mpctx->sh_video->pts * 100 /
+ mpctx->timeline[mpctx->num_timeline_parts].start;
+ else
+ percentage = demuxer_get_percent_pos(mpctx->demuxer);
+ set_osd_bar(mpctx, 0, "Position", 0, 100, percentage);
+ if (mpctx->sh_video)
+ mpctx->osd_show_percentage_until = (GetTimerMS() + 1000) | 1;
+ mpctx->add_osd_seek_info = false;
+ }
// Look if we have a msg
- if((msg = get_osd_msg())) {
- if(strcmp(osd_text,msg->msg)) {
- strncpy((char*)osd_text, msg->msg, 127);
+ if((msg = get_osd_msg(mpctx))) {
+ if (strcmp(osd->osd_text, msg->msg)) {
+ strncpy(osd->osd_text, msg->msg, 127);
if(mpctx->sh_video) vo_osd_changed(OSDTYPE_OSD); else
if(term_osd) mp_msg(MSGT_CPLAYER,MSGL_STATUS,"%s%s\n",term_osd_esc,msg->msg);
}
@@ -1591,21 +1653,29 @@ static void update_osd_msg(void) {
if(mpctx->sh_video) {
// fallback on the timer
- if(osd_level>=2) {
- int len = demuxer_get_time_length(mpctx->demuxer);
+ if (opts->osd_level >= 2) {
+ int len;
+ if (mpctx->timeline)
+ len = mpctx->timeline[mpctx->num_timeline_parts].start;
+ else
+ len = demuxer_get_time_length(mpctx->demuxer);
int percentage = -1;
char percentage_text[10];
int pts = demuxer_get_current_time(mpctx->demuxer);
- if (mpctx->osd_show_percentage)
- percentage = demuxer_get_percent_pos(mpctx->demuxer);
+ if (mpctx->osd_show_percentage_until)
+ if (mpctx->timeline)
+ percentage = mpctx->sh_video->pts * 100 /
+ mpctx->timeline[mpctx->num_timeline_parts].start;
+ else
+ percentage = demuxer_get_percent_pos(mpctx->demuxer);
if (percentage >= 0)
snprintf(percentage_text, 9, " (%d%%)", percentage);
else
percentage_text[0] = 0;
- if (osd_level == 3)
+ if (opts->osd_level == 3)
snprintf(osd_text_timer, 63,
"%c %02d:%02d:%02d / %02d:%02d:%02d%s",
mpctx->osd_function,pts/3600,(pts/60)%60,pts%60,
@@ -1617,20 +1687,16 @@ static void update_osd_msg(void) {
} else
osd_text_timer[0]=0;
- // always decrement the percentage timer
- if(mpctx->osd_show_percentage)
- mpctx->osd_show_percentage--;
-
- if(strcmp(osd_text,osd_text_timer)) {
- strncpy(osd_text, osd_text_timer, 63);
+ if (strcmp(osd->osd_text, osd_text_timer)) {
+ strncpy(osd->osd_text, osd_text_timer, 63);
vo_osd_changed(OSDTYPE_OSD);
}
return;
}
// Clear the term osd line
- if(term_osd && osd_text[0]) {
- osd_text[0] = 0;
+ if (term_osd && osd->osd_text[0]) {
+ osd->osd_text[0] = 0;
printf("%s\n",term_osd_esc);
}
}
@@ -1639,7 +1705,9 @@ static void update_osd_msg(void) {
// OSDMsgStack
-void reinit_audio_chain(void) {
+void reinit_audio_chain(struct MPContext *mpctx)
+{
+ struct MPOpts *opts = &mpctx->opts;
if (!mpctx->sh_audio)
return;
current_module="init_audio_codec";
@@ -1647,7 +1715,7 @@ void reinit_audio_chain(void) {
if(!init_best_audio_codec(mpctx->sh_audio,audio_codec_list,audio_fm_list)){
goto init_error;
}
- initialized_flags|=INITIALIZED_ACODEC;
+ mpctx->initialized_flags|=INITIALIZED_ACODEC;
mp_msg(MSGT_CPLAYER,MSGL_INFO,"==========================================================================\n");
@@ -1662,21 +1730,22 @@ void reinit_audio_chain(void) {
mpctx->sh_audio->samplerate,
// output:
&ao_data.samplerate, &ao_data.channels, &ao_data.format)){
- mp_msg(MSGT_CPLAYER,MSGL_ERR,MSGTR_AudioFilterChainPreinitError);
- exit_player(EXIT_ERROR);
+ mp_tmsg(MSGT_CPLAYER,MSGL_ERR, "Error at audio filter chain "
+ "pre-init!\n");
+ exit_player(mpctx, EXIT_ERROR);
}
#endif
current_module="ao2_init";
- mpctx->audio_out = init_best_audio_out(audio_driver_list,
+ mpctx->audio_out = init_best_audio_out(opts->audio_driver_list,
0, // plugin flag
ao_data.samplerate,
ao_data.channels,
ao_data.format, 0);
if(!mpctx->audio_out){
- mp_msg(MSGT_CPLAYER,MSGL_ERR,MSGTR_CannotInitAO);
+ mp_tmsg(MSGT_CPLAYER,MSGL_ERR,"Could not open/initialize audio device -> no sound.\n");
goto init_error;
}
- initialized_flags|=INITIALIZED_AO;
+ mpctx->initialized_flags|=INITIALIZED_AO;
mp_msg(MSGT_CPLAYER,MSGL_INFO,"AO: [%s] %dHz %dch %s (%d bytes per sample)\n",
mpctx->audio_out->info->short_name,
ao_data.samplerate, ao_data.channels,
@@ -1689,8 +1758,8 @@ void reinit_audio_chain(void) {
// init audio filters:
#if 1
current_module="af_init";
- if(!build_afilter_chain(mpctx->sh_audio, &ao_data)) {
- mp_msg(MSGT_CPLAYER,MSGL_ERR,MSGTR_NoMatchingFilter);
+ if(!build_afilter_chain(mpctx, mpctx->sh_audio, &ao_data)) {
+ mp_tmsg(MSGT_CPLAYER,MSGL_ERR,"Couldn't find matching filter/ao format!\n");
goto init_error;
}
#endif
@@ -1699,7 +1768,7 @@ void reinit_audio_chain(void) {
return;
init_error:
- uninit_player(INITIALIZED_ACODEC|INITIALIZED_AO); // close codec and possibly AO
+ uninit_player(mpctx, INITIALIZED_ACODEC|INITIALIZED_AO); // close codec and possibly AO
mpctx->sh_audio=mpctx->d_audio->sh=NULL; // -> nosound
mpctx->d_audio->id = -2;
}
@@ -1711,8 +1780,10 @@ init_error:
// Return pts value corresponding to the end point of audio written to the
// ao so far.
-static double written_audio_pts(sh_audio_t *sh_audio, demux_stream_t *d_audio)
+static double written_audio_pts(struct MPContext *mpctx)
{
+ sh_audio_t *sh_audio = mpctx->sh_audio;
+ demux_stream_t *d_audio = mpctx->d_audio;
double buffered_output;
// first calculate the end pts of audio that has been output by decoder
double a_pts = sh_audio->pts;
@@ -1755,31 +1826,31 @@ static double written_audio_pts(sh_audio_t *sh_audio, demux_stream_t *d_audio)
// Filters divide audio length by playback_speed, so multiply by it
// to get the length in original units without speedup or slowdown
- a_pts -= buffered_output * playback_speed / ao_data.bps;
+ a_pts -= buffered_output * mpctx->opts.playback_speed / ao_data.bps;
- return a_pts;
+ return a_pts + mpctx->video_offset;
}
// Return pts value corresponding to currently playing audio.
-double playing_audio_pts(sh_audio_t *sh_audio, demux_stream_t *d_audio,
- const ao_functions_t *audio_out)
+double playing_audio_pts(struct MPContext *mpctx)
{
- return written_audio_pts(sh_audio, d_audio) - playback_speed *
- audio_out->get_delay();
+ return written_audio_pts(mpctx) - mpctx->opts.playback_speed *
+ mpctx->audio_out->get_delay();
}
-static int check_framedrop(double frame_time) {
+static int check_framedrop(struct MPContext *mpctx, double frame_time) {
+ struct MPOpts *opts = &mpctx->opts;
// check for frame-drop:
current_module = "check_framedrop";
if (mpctx->sh_audio && !mpctx->d_audio->eof) {
static int dropped_frames;
- float delay = playback_speed*mpctx->audio_out->get_delay();
+ float delay = opts->playback_speed*mpctx->audio_out->get_delay();
float d = delay-mpctx->delay;
++total_frame_cnt;
// we should avoid dropping too many frames in sequence unless we
// are too late. and we allow 100ms A-V delay here:
- if (d < -dropped_frames*frame_time-0.100 &&
- mpctx->osd_function != OSD_PAUSE) {
+ if (d < -dropped_frames*frame_time-0.100 && !mpctx->paused
+ && !mpctx->update_video_immediately) {
++drop_frame_cnt;
++dropped_frames;
return frame_dropping;
@@ -1789,53 +1860,12 @@ static int check_framedrop(double frame_time) {
return 0;
}
-static int generate_video_frame(sh_video_t *sh_video, demux_stream_t *d_video)
-{
- unsigned char *start;
- int in_size;
- int hit_eof=0;
- double pts;
-
- while (1) {
- int drop_frame = check_framedrop(sh_video->frametime);
- void *decoded_frame;
- current_module = "decode video";
- // XXX Time used in this call is not counted in any performance
- // timer now, OSD is not updated correctly for filter-added frames
- if (vf_output_queued_frame(sh_video->vfilter))
- break;
- current_module = "video_read_frame";
- in_size = ds_get_packet_pts(d_video, &start, &pts);
- if (in_size < 0) {
- // try to extract last frames in case of decoder lag
- in_size = 0;
- pts = 1e300;
- hit_eof = 1;
- }
- if (in_size > max_framesize)
- max_framesize = in_size;
- current_module = "decode video";
- decoded_frame = decode_video(sh_video, start, in_size, drop_frame, pts);
- if (decoded_frame) {
- update_subtitles(sh_video, sh_video->pts, mpctx->d_sub, 0);
- update_teletext(sh_video, mpctx->demuxer, 0);
- update_osd_msg();
- current_module = "filter video";
- if (filter_video(sh_video, decoded_frame, sh_video->pts))
- break;
- } else if (drop_frame)
- return -1;
- if (hit_eof)
- return 0;
- }
- return 1;
-}
#ifdef HAVE_RTC
int rtc_fd = -1;
#endif
-static float timing_sleep(float time_frame)
+static float timing_sleep(struct MPContext *mpctx, float time_frame)
{
#ifdef HAVE_RTC
if (rtc_fd >= 0){
@@ -1844,8 +1874,8 @@ static float timing_sleep(float time_frame)
while (time_frame > 0.000) {
unsigned long rtc_ts;
if (read(rtc_fd, &rtc_ts, sizeof(rtc_ts)) <= 0)
- mp_msg(MSGT_CPLAYER, MSGL_ERR, MSGTR_LinuxRTCReadError, strerror(errno));
- time_frame -= GetRelativeTime();
+ mp_tmsg(MSGT_CPLAYER, MSGL_ERR, "Linux RTC read error: %s\n", strerror(errno));
+ time_frame -= get_relative_time(mpctx);
}
} else
#endif
@@ -1856,40 +1886,42 @@ static float timing_sleep(float time_frame)
current_module = "sleep_timer";
while (time_frame > margin) {
usec_sleep(1000000 * (time_frame - margin));
- time_frame -= GetRelativeTime();
+ time_frame -= get_relative_time(mpctx);
}
if (softsleep){
current_module = "sleep_soft";
if (time_frame < 0)
- mp_msg(MSGT_AVSYNC, MSGL_WARN, MSGTR_SoftsleepUnderflow);
+ mp_tmsg(MSGT_AVSYNC, MSGL_WARN, "Warning! Softsleep underflow!\n");
while (time_frame > 0)
- time_frame-=GetRelativeTime(); // burn the CPU
+ time_frame -= get_relative_time(mpctx); // burn the CPU
}
}
return time_frame;
}
-static void select_subtitle(MPContext *mpctx) {
+static void select_subtitle(MPContext *mpctx)
+{
+ struct MPOpts *opts = &mpctx->opts;
// find the best sub to use
int vobsub_index_id = vobsub_get_index_by_id(vo_vobsub, vobsub_id);
mpctx->global_sub_pos = -1; // no subs by default
if (vobsub_index_id >= 0) {
// if user asks for a vobsub id, use that first.
mpctx->global_sub_pos = mpctx->global_sub_indices[SUB_SOURCE_VOBSUB] + vobsub_index_id;
- } else if (dvdsub_id >= 0 && mpctx->global_sub_indices[SUB_SOURCE_DEMUX] >= 0) {
+ } else if (opts->sub_id >= 0 && mpctx->global_sub_indices[SUB_SOURCE_DEMUX] >= 0) {
// if user asks for a dvd sub id, use that next.
- mpctx->global_sub_pos = mpctx->global_sub_indices[SUB_SOURCE_DEMUX] + dvdsub_id;
+ mpctx->global_sub_pos = mpctx->global_sub_indices[SUB_SOURCE_DEMUX] + opts->sub_id;
} else if (mpctx->global_sub_indices[SUB_SOURCE_SUBS] >= 0) {
// if there are text subs to use, use those. (autosubs come last here)
mpctx->global_sub_pos = mpctx->global_sub_indices[SUB_SOURCE_SUBS];
- } else if (dvdsub_id == -1 && mpctx->global_sub_indices[SUB_SOURCE_DEMUX] >= 0) {
+ } else if (opts->sub_id == -1 && mpctx->global_sub_indices[SUB_SOURCE_DEMUX] >= 0) {
// finally select subs by language and container hints
- if (dvdsub_id == -1 && dvdsub_lang)
- dvdsub_id = demuxer_sub_track_by_lang(mpctx->demuxer, dvdsub_lang);
- if (dvdsub_id == -1)
- dvdsub_id = demuxer_default_sub_track(mpctx->demuxer);
- if (dvdsub_id >= 0)
- mpctx->global_sub_pos = mpctx->global_sub_indices[SUB_SOURCE_DEMUX] + dvdsub_id;
+ if (opts->sub_id == -1 && dvdsub_lang)
+ opts->sub_id = demuxer_sub_track_by_lang(mpctx->demuxer, dvdsub_lang);
+ if (opts->sub_id == -1)
+ opts->sub_id = demuxer_default_sub_track(mpctx->demuxer);
+ if (opts->sub_id >= 0)
+ mpctx->global_sub_pos = mpctx->global_sub_indices[SUB_SOURCE_DEMUX] + opts->sub_id;
}
// rather than duplicate code, use the SUB_SELECT handler to init the right one.
mpctx->global_sub_pos--;
@@ -1927,6 +1959,7 @@ static mp_image_t * mp_dvdnav_copy_mpi(mp_image_t *to_mpi,
}
static void mp_dvdnav_reset_stream (MPContext *ctx) {
+ struct MPOpts *opts = &ctx->opts;
if (ctx->sh_video) {
/// clear video pts
ctx->d_video->pts = 0.0f;
@@ -1952,11 +1985,11 @@ static void mp_dvdnav_reset_stream (MPContext *ctx) {
}
audio_delay = 0.0f;
- mpctx->global_sub_size = mpctx->global_sub_indices[SUB_SOURCE_DEMUX] + mp_dvdnav_number_of_subs(mpctx->stream);
- if (dvdsub_lang && dvdsub_id == dvdsub_lang_id) {
+ ctx->global_sub_size = ctx->global_sub_indices[SUB_SOURCE_DEMUX] + mp_dvdnav_number_of_subs(ctx->stream);
+ if (dvdsub_lang && opts->sub_id == dvdsub_lang_id) {
dvdsub_lang_id = mp_dvdnav_sid_from_lang(ctx->stream, dvdsub_lang);
- if (dvdsub_lang_id != dvdsub_id) {
- dvdsub_id = dvdsub_lang_id;
+ if (dvdsub_lang_id != opts->sub_id) {
+ opts->sub_id = dvdsub_lang_id;
select_subtitle(ctx);
}
}
@@ -1966,7 +1999,8 @@ static void mp_dvdnav_reset_stream (MPContext *ctx) {
}
/// Restore last decoded DVDNAV (still frame)
-static mp_image_t *mp_dvdnav_restore_smpi(int *in_size,
+static mp_image_t *mp_dvdnav_restore_smpi(struct MPContext *mpctx,
+ int *in_size,
unsigned char **start,
mp_image_t *decoded_frame)
{
@@ -2010,7 +2044,7 @@ static mp_image_t *mp_dvdnav_restore_smpi(int *in_size,
}
/// Save last decoded DVDNAV (still frame)
-static void mp_dvdnav_save_smpi(int in_size,
+static void mp_dvdnav_save_smpi(struct MPContext *mpctx, int in_size,
unsigned char *start,
mp_image_t *decoded_frame)
{
@@ -2031,78 +2065,48 @@ static void mp_dvdnav_save_smpi(int in_size,
}
#endif /* CONFIG_DVDNAV */
-static void adjust_sync_and_print_status(int between_frames, float timing_error)
+/* Modify video timing to match the audio timeline. There are two main
+ * reasons this is needed. First, video and audio can start from different
+ * positions at beginning of file or after a seek (MPlayer starts both
+ * immediately even if they have different pts). Second, the file can have
+ * audio timestamps that are inconsistent with the duration of the audio
+ * packets, for example two consecutive timestamp values differing by
+ * one second but only a packet with enough samples for half a second
+ * of playback between them.
+ */
+static void adjust_sync(struct MPContext *mpctx, double frame_time)
{
- current_module="av_sync";
-
- if(mpctx->sh_audio){
- double a_pts, v_pts;
+ current_module = "av_sync";
- if (autosync)
- /*
- * If autosync is enabled, the value for delay must be calculated
- * a bit differently. It is set only to the difference between
- * the audio and video timers. Any attempt to include the real
- * or corrected delay causes the pts_correction code below to
- * try to correct for the changes in delay which autosync is
- * trying to measure. This keeps the two from competing, but still
- * allows the code to correct for PTS drift *only*. (Using a delay
- * value here, even a "corrected" one, would be incompatible with
- * autosync mode.)
- */
- a_pts = written_audio_pts(mpctx->sh_audio, mpctx->d_audio) - mpctx->delay;
- else
- a_pts = playing_audio_pts(mpctx->sh_audio, mpctx->d_audio, mpctx->audio_out);
-
- v_pts = mpctx->sh_video->pts;
-
- {
- static int drop_message=0;
- double AV_delay = a_pts - audio_delay - v_pts;
- double x;
- if (AV_delay>0.5 && drop_frame_cnt>50 && drop_message==0){
- ++drop_message;
- mp_msg(MSGT_AVSYNC,MSGL_WARN,MSGTR_SystemTooSlow);
- }
- if (autosync)
- x = AV_delay*0.1f;
- else
- /* Do not correct target time for the next frame if this frame
- * was late not because of wrong target time but because the
- * target time could not be met */
- x = (AV_delay + timing_error * playback_speed) * 0.1f;
- if (x < -max_pts_correction)
- x = -max_pts_correction;
- else if (x> max_pts_correction)
- x = max_pts_correction;
- if (default_max_pts_correction >= 0)
- max_pts_correction = default_max_pts_correction;
- else
- max_pts_correction = mpctx->sh_video->frametime*0.10; // +-10% of time
- if (!between_frames) {
- mpctx->delay+=x;
- c_total+=x;
- }
- if(!quiet)
- print_status(a_pts - audio_delay, AV_delay, c_total);
- }
-
- } else {
- // No audio:
+ if (!mpctx->sh_audio)
+ return;
- if (!quiet)
- print_status(0, 0, 0);
- }
+ double a_pts = written_audio_pts(mpctx) - mpctx->delay;
+ double v_pts = mpctx->sh_video->pts;
+ double av_delay = a_pts - v_pts;
+ // Try to sync vo_flip() so it will *finish* at given time
+ av_delay += mpctx->last_vo_flip_duration;
+ av_delay -= audio_delay; // This much pts difference is desired
+
+ double change = av_delay * 0.1;
+ double max_change = default_max_pts_correction >= 0 ?
+ default_max_pts_correction : frame_time * 0.1;
+ if (change < -max_change)
+ change = -max_change;
+ else if (change > max_change)
+ change = max_change;
+ mpctx->delay += change;
+ mpctx->total_avsync_change += change;
}
-static int fill_audio_out_buffers(void)
+static int fill_audio_out_buffers(struct MPContext *mpctx)
{
+ struct MPOpts *opts = &mpctx->opts;
unsigned int t;
double tt;
int playsize;
int playflags=0;
int audio_eof=0;
- int bytes_to_write;
sh_audio_t * const sh_audio = mpctx->sh_audio;
current_module="play_audio";
@@ -2113,74 +2117,70 @@ static int fill_audio_out_buffers(void)
// sync completely wrong; there should be no need to use ao_data.pts
// in get_space()
ao_data.pts = ((mpctx->sh_video?mpctx->sh_video->timer:0)+mpctx->delay)*90000.0;
- bytes_to_write = mpctx->audio_out->get_space();
- if (mpctx->sh_video || bytes_to_write >= ao_data.outburst)
+ playsize = mpctx->audio_out->get_space();
+ if (mpctx->sh_video || playsize >= ao_data.outburst)
break;
// handle audio-only case:
// this is where mplayer sleeps during audio-only playback
// to avoid 100% CPU use
- sleep_time = (ao_data.outburst - bytes_to_write) * 1000 / ao_data.bps;
+ sleep_time = (ao_data.outburst - playsize) * 1000 / ao_data.bps;
if (sleep_time < 10) sleep_time = 10; // limit to 100 wakeups per second
usec_sleep(sleep_time * 1000);
}
- while (bytes_to_write) {
- playsize = bytes_to_write;
- if (playsize > MAX_OUTBURST)
- playsize = MAX_OUTBURST;
- bytes_to_write -= playsize;
-
- // Fill buffer if needed:
- current_module="decode_audio";
- t = GetTimer();
- if (decode_audio(sh_audio, playsize) < 0) // EOF or error
- if (mpctx->d_audio->eof) {
- audio_eof = 1;
- if (sh_audio->a_out_buffer_len == 0)
- return 0;
- }
- t = GetTimer() - t;
- tt = t*0.000001f; audio_time_usage+=tt;
- if (playsize > sh_audio->a_out_buffer_len) {
- playsize = sh_audio->a_out_buffer_len;
- if (audio_eof)
- playflags |= AOPLAY_FINAL_CHUNK;
- }
- if (!playsize)
- break;
-
- // play audio:
- current_module="play_audio";
+ // Fill buffer if needed:
+ current_module="decode_audio";
+ t = GetTimer();
+ if (decode_audio(sh_audio, playsize) < 0) // EOF or error
+ if (mpctx->d_audio->eof) {
+ audio_eof = 1;
+ if (sh_audio->a_out_buffer_len == 0)
+ return 0;
+ }
+ t = GetTimer() - t;
+ tt = t*0.000001f; audio_time_usage+=tt;
+ if (playsize > sh_audio->a_out_buffer_len) {
+ playsize = sh_audio->a_out_buffer_len;
+ if (audio_eof)
+ playflags |= AOPLAY_FINAL_CHUNK;
+ }
+ if (!playsize)
+ return 1;
- // Is this pts value actually useful for the aos that access it?
- // They're obviously badly broken in the way they handle av sync;
- // would not having access to this make them more broken?
- ao_data.pts = ((mpctx->sh_video?mpctx->sh_video->timer:0)+mpctx->delay)*90000.0;
- playsize = mpctx->audio_out->play(sh_audio->a_out_buffer, playsize, playflags);
+ // play audio:
+ current_module="play_audio";
- if (playsize > 0) {
- sh_audio->a_out_buffer_len -= playsize;
- memmove(sh_audio->a_out_buffer, &sh_audio->a_out_buffer[playsize],
- sh_audio->a_out_buffer_len);
- mpctx->delay += playback_speed*playsize/(double)ao_data.bps;
- }
- else if (audio_eof && mpctx->audio_out->get_delay() < .04) {
- // Sanity check to avoid hanging in case current ao doesn't output
- // partial chunks and doesn't check for AOPLAY_FINAL_CHUNK
- mp_msg(MSGT_CPLAYER, MSGL_WARN, "Audio output truncated at end.\n");
- sh_audio->a_out_buffer_len = 0;
- }
+ // Is this pts value actually useful for the aos that access it?
+ // They're obviously badly broken in the way they handle av sync;
+ // would not having access to this make them more broken?
+ ao_data.pts = ((mpctx->sh_video?mpctx->sh_video->timer:0)+mpctx->delay)*90000.0;
+ playsize = mpctx->audio_out->play(sh_audio->a_out_buffer, playsize, playflags);
+
+ if (playsize > 0) {
+ sh_audio->a_out_buffer_len -= playsize;
+ memmove(sh_audio->a_out_buffer, &sh_audio->a_out_buffer[playsize],
+ sh_audio->a_out_buffer_len);
+ mpctx->delay += opts->playback_speed*playsize/(double)ao_data.bps;
+ }
+ else if (audio_eof && mpctx->audio_out->get_delay() < .04) {
+ // Sanity check to avoid hanging in case current ao doesn't output
+ // partial chunks and doesn't check for AOPLAY_FINAL_CHUNK
+ mp_msg(MSGT_CPLAYER, MSGL_WARN, "Audio output truncated at end.\n");
+ sh_audio->a_out_buffer_len = 0;
}
+
return 1;
}
-static int sleep_until_update(float *time_frame, float *aq_sleep_time)
+static int sleep_until_update(struct MPContext *mpctx, float *time_frame,
+ float *aq_sleep_time)
{
+ struct MPOpts *opts = &mpctx->opts;
int frame_time_remaining = 0;
current_module="calc_sleep_time";
- *time_frame -= GetRelativeTime(); // reset timer
+ *time_frame -= get_relative_time(mpctx); // reset timer
if (mpctx->sh_audio && !mpctx->d_audio->eof) {
float delay = mpctx->audio_out->get_delay();
@@ -2196,12 +2196,12 @@ static int sleep_until_update(float *time_frame, float *aq_sleep_time)
* sync to settle at the right value (but it eventually will.)
* This settling time is very short for values below 100.
*/
- float predicted = mpctx->delay / playback_speed + *time_frame;
+ float predicted = mpctx->delay / opts->playback_speed + *time_frame;
float difference = delay - predicted;
delay = predicted + difference / (float)autosync;
}
- *time_frame = delay - mpctx->delay / playback_speed;
+ *time_frame = delay - mpctx->delay / opts->playback_speed;
// delay = amount of audio buffered in soundcard/driver
if (delay > 0.25) delay=0.25; else
@@ -2225,27 +2225,30 @@ static int sleep_until_update(float *time_frame, float *aq_sleep_time)
//============================== SLEEP: ===================================
+ *time_frame -= mpctx->video_out->flip_queue_offset;
// flag 256 means: libvo driver does its timing (dvb card)
- if (*time_frame > 0.001 && !(vo_flags&256))
- *time_frame = timing_sleep(*time_frame);
+ if (*time_frame > 0.001 && !(mpctx->sh_video->output_flags&256))
+ *time_frame = timing_sleep(mpctx, *time_frame);
+ *time_frame += mpctx->video_out->flip_queue_offset;
return frame_time_remaining;
}
-int reinit_video_chain(void) {
+int reinit_video_chain(struct MPContext *mpctx)
+{
+ struct MPOpts *opts = &mpctx->opts;
sh_video_t * const sh_video = mpctx->sh_video;
double ar=-1.0;
//================== Init VIDEO (codec & libvo) ==========================
- if(!fixed_vo || !(initialized_flags&INITIALIZED_VO)){
+ if (!opts->fixed_vo || !(mpctx->initialized_flags & INITIALIZED_VO)) {
current_module="preinit_libvo";
//shouldn't we set dvideo->id=-2 when we fail?
- vo_config_count=0;
//if((mpctx->video_out->preinit(vo_subdevice))!=0){
- if(!(mpctx->video_out=init_best_video_out(video_driver_list))){
- mp_msg(MSGT_CPLAYER,MSGL_FATAL,MSGTR_ErrorInitializingVODevice);
+ if(!(mpctx->video_out=init_best_video_out(opts, mpctx->x11_state, mpctx->key_fifo, mpctx->input))){
+ mp_tmsg(MSGT_CPLAYER,MSGL_FATAL,"Error opening/initializing the selected video_out (-vo) device.\n");
goto err_out;
}
- initialized_flags|=INITIALIZED_VO;
+ mpctx->initialized_flags|=INITIALIZED_VO;
}
if(stream_control(mpctx->demuxer->stream, STREAM_CTRL_GET_ASPECT_RATIO, &ar) != STREAM_UNSUPPORTED)
@@ -2253,28 +2256,28 @@ int reinit_video_chain(void) {
current_module="init_video_filters";
{
char* vf_arg[] = { "_oldargs_", (char*)mpctx->video_out , NULL };
- sh_video->vfilter=(void*)vf_open_filter(NULL,"vo",vf_arg);
+ sh_video->vfilter = vf_open_filter(opts, NULL,"vo",vf_arg);
}
#ifdef CONFIG_MENU
if(use_menu) {
char* vf_arg[] = { "_oldargs_", menu_root, NULL };
- vf_menu = vf_open_plugin(libmenu_vfs,sh_video->vfilter,"menu",vf_arg);
+ vf_menu = vf_open_plugin(opts,libmenu_vfs,sh_video->vfilter,"menu",vf_arg);
if(!vf_menu) {
- mp_msg(MSGT_CPLAYER,MSGL_ERR,MSGTR_CantOpenLibmenuFilterWithThisRootMenu,menu_root);
+ mp_tmsg(MSGT_CPLAYER,MSGL_ERR,"Can't open libmenu video filter with root menu %s.\n",menu_root);
use_menu = 0;
}
}
if(vf_menu)
- sh_video->vfilter=(void*)vf_menu;
+ sh_video->vfilter = vf_menu;
#endif
#ifdef CONFIG_ASS
- if(ass_enabled) {
+ if(opts->ass_enabled) {
int i;
int insert = 1;
- if (vf_settings)
- for (i = 0; vf_settings[i].name; ++i)
- if (strcmp(vf_settings[i].name, "ass") == 0) {
+ if (opts->vf_settings)
+ for (i = 0; opts->vf_settings[i].name; ++i)
+ if (strcmp(opts->vf_settings[i].name, "ass") == 0) {
insert = 0;
break;
}
@@ -2282,20 +2285,26 @@ int reinit_video_chain(void) {
extern vf_info_t vf_info_ass;
const vf_info_t* libass_vfs[] = {&vf_info_ass, NULL};
char* vf_arg[] = {"auto", "1", NULL};
- vf_instance_t* vf_ass = vf_open_plugin(libass_vfs,sh_video->vfilter,"ass",vf_arg);
+ int retcode = 0;
+ struct vf_instance *vf_ass = vf_open_plugin_noerr(opts, libass_vfs,
+ sh_video->vfilter,
+ "ass", vf_arg,
+ &retcode);
if (vf_ass)
- sh_video->vfilter=(void*)vf_ass;
+ sh_video->vfilter = vf_ass;
+ else if (retcode == -1) // vf_ass open() returns -1 if there's VO EOSD
+ mp_msg(MSGT_CPLAYER, MSGL_V, "[ass] vf_ass not needed\n");
else
mp_msg(MSGT_CPLAYER,MSGL_ERR, "ASS: cannot add video filter\n");
}
}
#endif
- sh_video->vfilter=(void*)append_filters(sh_video->vfilter);
+ sh_video->vfilter = append_filters(sh_video->vfilter, opts->vf_settings);
#ifdef CONFIG_ASS
- if (ass_enabled)
- ((vf_instance_t *)sh_video->vfilter)->control(sh_video->vfilter, VFCTRL_INIT_EOSD, ass_library);
+ if (opts->ass_enabled)
+ sh_video->vfilter->control(sh_video->vfilter, VFCTRL_INIT_EOSD, ass_library);
#endif
current_module="init_video_codec";
@@ -2305,11 +2314,11 @@ int reinit_video_chain(void) {
mp_msg(MSGT_CPLAYER,MSGL_INFO,"==========================================================================\n");
if(!sh_video->initialized){
- if(!fixed_vo) uninit_player(INITIALIZED_VO);
+ if(!opts->fixed_vo) uninit_player(mpctx, INITIALIZED_VO);
goto err_out;
}
- initialized_flags|=INITIALIZED_VCODEC;
+ mpctx->initialized_flags|=INITIALIZED_VCODEC;
if (sh_video->codec)
mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_VIDEO_CODEC=%s\n", sh_video->codec->name);
@@ -2338,158 +2347,254 @@ err_out:
return 0;
}
-static double update_video(int *blit_frame)
+static double update_video_nocorrect_pts(struct MPContext *mpctx)
{
- sh_video_t * const sh_video = mpctx->sh_video;
- //-------------------- Decode a frame: -----------------------
- double frame_time;
- *blit_frame = 0; // Don't blit if we hit EOF
- if (!correct_pts) {
- unsigned char* start=NULL;
- void *decoded_frame = NULL;
- int drop_frame=0;
- int in_size;
-
- current_module = "video_read_frame";
- frame_time = sh_video->next_frame_time;
- in_size = video_read_frame(sh_video, &sh_video->next_frame_time,
- &start, force_fps);
+ struct sh_video *sh_video = mpctx->sh_video;
+ double frame_time = 0;
+ struct vo *video_out = mpctx->video_out;
+ while (!video_out->frame_loaded) {
+ current_module = "filter_video";
+ // In nocorrect-pts mode there is no way to properly time these frames
+ if (vo_get_buffered_frame(video_out, 0) >= 0)
+ break;
+ if (vf_output_queued_frame(sh_video->vfilter))
+ continue;
+ unsigned char *packet = NULL;
+ frame_time = sh_video->next_frame_time;
+ if (mpctx->update_video_immediately)
+ frame_time = 0;
+ int in_size = video_read_frame(sh_video, &sh_video->next_frame_time,
+ &packet, force_fps);
+ if (in_size < 0) {
#ifdef CONFIG_DVDNAV
- /// wait, still frame or EOF
- if (mpctx->stream->type == STREAMTYPE_DVDNAV && in_size < 0) {
- if (mp_dvdnav_is_eof(mpctx->stream)) return -1;
- if (mpctx->d_video) mpctx->d_video->eof = 0;
- if (mpctx->d_audio) mpctx->d_audio->eof = 0;
- mpctx->stream->eof = 0;
- } else
+ if (mpctx->stream->type == STREAMTYPE_DVDNAV) {
+ if (mp_dvdnav_is_eof(mpctx->stream))
+ return -1;
+ if (mpctx->d_video)
+ mpctx->d_video->eof = 0;
+ if (mpctx->d_audio)
+ mpctx->d_audio->eof = 0;
+ mpctx->stream->eof = 0;
+ } else
#endif
- if (in_size < 0)
- return -1;
- if (in_size > max_framesize)
- max_framesize = in_size; // stats
- sh_video->timer += frame_time;
- if (mpctx->sh_audio)
- mpctx->delay -= frame_time;
- // video_read_frame can change fps (e.g. for ASF video)
- vo_fps = sh_video->fps;
- drop_frame = check_framedrop(frame_time);
- update_subtitles(sh_video, sh_video->pts, mpctx->d_sub, 0);
- update_teletext(sh_video, mpctx->demuxer, 0);
- update_osd_msg();
- current_module = "decode_video";
+ return -1;
+ }
+ if (in_size > max_framesize)
+ max_framesize = in_size;
+ sh_video->timer += frame_time;
+ if (mpctx->sh_audio)
+ mpctx->delay -= frame_time;
+ // video_read_frame can change fps (e.g. for ASF video)
+ vo_fps = sh_video->fps;
+ int framedrop_type = check_framedrop(mpctx, frame_time);
+ current_module = "decode video";
+
+ void *decoded_frame;
#ifdef CONFIG_DVDNAV
- decoded_frame = mp_dvdnav_restore_smpi(&in_size,&start,decoded_frame);
- /// still frame has been reached, no need to decode
- if (in_size > 0 && !decoded_frame)
+ decoded_frame = mp_dvdnav_restore_smpi(mpctx, &in_size, &packet, NULL);
+ if (in_size >= 0 && !decoded_frame)
#endif
- decoded_frame = decode_video(sh_video, start, in_size, drop_frame,
- sh_video->pts);
+ decoded_frame = decode_video(sh_video, packet, in_size, framedrop_type,
+ sh_video->pts);
#ifdef CONFIG_DVDNAV
- /// save back last still frame for future display
- mp_dvdnav_save_smpi(in_size,start,decoded_frame);
+ // Save last still frame for future display
+ mp_dvdnav_save_smpi(mpctx, in_size, packet, decoded_frame);
#endif
- current_module = "filter_video";
- *blit_frame = (decoded_frame && filter_video(sh_video, decoded_frame,
- sh_video->pts));
+ if (decoded_frame) {
+ current_module = "filter video";
+ if (filter_video(sh_video, decoded_frame, sh_video->pts))
+ if (!video_out->config_ok)
+ break;
+ }
}
- else {
- int res = generate_video_frame(sh_video, mpctx->d_video);
- if (!res)
- return -1;
- ((vf_instance_t *)sh_video->vfilter)->control(sh_video->vfilter,
- VFCTRL_GET_PTS, &sh_video->pts);
- if (sh_video->pts == MP_NOPTS_VALUE) {
- mp_msg(MSGT_CPLAYER, MSGL_ERR, "pts after filters MISSING\n");
- sh_video->pts = sh_video->last_pts;
- }
- if (sh_video->last_pts == MP_NOPTS_VALUE)
- sh_video->last_pts= sh_video->pts;
- else if (sh_video->last_pts > sh_video->pts) {
- sh_video->last_pts = sh_video->pts;
- mp_msg(MSGT_CPLAYER, MSGL_INFO, "pts value < previous\n");
- }
- frame_time = sh_video->pts - sh_video->last_pts;
- sh_video->last_pts = sh_video->pts;
- sh_video->timer += frame_time;
- if(mpctx->sh_audio)
- mpctx->delay -= frame_time;
- *blit_frame = res > 0;
+ return frame_time;
+}
+
+static void determine_frame_pts(struct MPContext *mpctx)
+{
+ struct sh_video *sh_video = mpctx->sh_video;
+ struct MPOpts *opts = &mpctx->opts;
+
+ if (opts->user_pts_assoc_mode) {
+ sh_video->pts_assoc_mode = opts->user_pts_assoc_mode;
+ } else if (sh_video->pts_assoc_mode == 0) {
+ if (sh_video->codec_reordered_pts != MP_NOPTS_VALUE)
+ sh_video->pts_assoc_mode = 1;
+ else
+ sh_video->pts_assoc_mode = 2;
+ } else {
+ int probcount1 = sh_video->num_reordered_pts_problems;
+ int probcount2 = sh_video->num_sorted_pts_problems;
+ if (sh_video->pts_assoc_mode == 2) {
+ int tmp = probcount1;
+ probcount1 = probcount2;
+ probcount2 = tmp;
+ }
+ if (probcount1 >= probcount2 * 1.5 + 2) {
+ sh_video->pts_assoc_mode = 3 - sh_video->pts_assoc_mode;
+ mp_msg(MSGT_CPLAYER, MSGL_V, "Switching to pts association mode "
+ "%d.\n", sh_video->pts_assoc_mode);
+ }
+ }
+ sh_video->pts = sh_video->pts_assoc_mode == 1 ?
+ sh_video->codec_reordered_pts : sh_video->sorted_pts;
+}
+
+static double update_video(struct MPContext *mpctx)
+{
+ struct sh_video *sh_video = mpctx->sh_video;
+ struct vo *video_out = mpctx->video_out;
+ sh_video->vfilter->control(sh_video->vfilter, VFCTRL_SET_OSD_OBJ,
+ mpctx->osd); // hack for vf_expand
+ if (!mpctx->opts.correct_pts)
+ return update_video_nocorrect_pts(mpctx);
+
+ double pts;
+
+ bool hit_eof = false;
+ while (!video_out->frame_loaded) {
+ current_module = "filter_video";
+ if (vo_get_buffered_frame(video_out, hit_eof) >= 0)
+ break;
+ // XXX Time used in this call is not counted in any performance
+ // timer now, OSD time is not updated correctly for filter-added frames
+ if (vf_output_queued_frame(sh_video->vfilter))
+ continue;
+ if (hit_eof)
+ return -1;
+ unsigned char *packet = NULL;
+ int in_size = ds_get_packet_pts(mpctx->d_video, &packet, &pts);
+ if (pts != MP_NOPTS_VALUE)
+ pts += mpctx->video_offset;
+ if (in_size < 0) {
+ // try to extract last frames in case of decoder lag
+ in_size = 0;
+ pts = 1e300;
+ hit_eof = true;
+ }
+ if (in_size > max_framesize)
+ max_framesize = in_size;
+ current_module = "decode video";
+ int framedrop_type = check_framedrop(mpctx, sh_video->frametime);
+ void *decoded_frame = decode_video(sh_video, packet, in_size,
+ framedrop_type, pts);
+ if (decoded_frame) {
+ determine_frame_pts(mpctx);
+ current_module = "filter video";
+ if (filter_video(sh_video, decoded_frame, sh_video->pts))
+ if (!video_out->config_ok)
+ break; // We'd likely hang in this loop otherwise
+ }
+ }
+
+ pts = video_out->next_pts;
+ if (pts == MP_NOPTS_VALUE) {
+ mp_msg(MSGT_CPLAYER, MSGL_ERR, "Video pts after filters MISSING\n");
+ // Try to use decoder pts from before filters
+ pts = sh_video->pts;
+ if (pts == MP_NOPTS_VALUE)
+ pts = sh_video->last_pts;
+ }
+ sh_video->pts = pts;
+ if (sh_video->last_pts == MP_NOPTS_VALUE)
+ sh_video->last_pts = sh_video->pts;
+ else if (sh_video->last_pts > sh_video->pts) {
+ mp_msg(MSGT_CPLAYER, MSGL_INFO, "Decreasing video pts: %f < %f\n",
+ sh_video->pts, sh_video->last_pts);
+ /* If the difference in pts is small treat it as jitter around the
+ * right value (possibly caused by incorrect timestamp ordering) and
+ * just show this frame immediately after the last one.
+ * Treat bigger differences as timestamp resets and start counting
+ * timing of later frames from the position of this one. */
+ if (sh_video->last_pts - sh_video->pts > 0.5)
+ sh_video->last_pts = sh_video->pts;
+ else
+ sh_video->pts = sh_video->last_pts;
}
+ double frame_time = sh_video->pts - sh_video->last_pts;
+ sh_video->last_pts = sh_video->pts;
+ sh_video->timer += frame_time;
+ if (mpctx->sh_audio)
+ mpctx->delay -= frame_time;
return frame_time;
}
-static void pause_loop(void)
+void pause_player(struct MPContext *mpctx)
+{
+ if (mpctx->paused)
+ return;
+ mpctx->paused = 1;
+ mpctx->step_frames = 0;
+ mpctx->time_frame -= get_relative_time(mpctx);
+
+ if (mpctx->video_out && mpctx->sh_video && mpctx->video_out->config_ok)
+ vo_control(mpctx->video_out, VOCTRL_PAUSE, NULL);
+
+ if (mpctx->audio_out && mpctx->sh_audio)
+ mpctx->audio_out->pause(); // pause audio, keep data if possible
+}
+
+void unpause_player(struct MPContext *mpctx)
+{
+ if (!mpctx->paused)
+ return;
+ mpctx->paused = 0;
+
+ if (mpctx->audio_out && mpctx->sh_audio)
+ mpctx->audio_out->resume(); // resume audio
+ if (mpctx->video_out && mpctx->sh_video && mpctx->video_out->config_ok
+ && !mpctx->step_frames)
+ vo_control(mpctx->video_out, VOCTRL_RESUME, NULL); // resume video
+ (void)get_relative_time(mpctx); // ignore time that passed during pause
+}
+
+void add_step_frame(struct MPContext *mpctx)
+{
+ mpctx->step_frames++;
+ if (mpctx->video_out && mpctx->sh_video && mpctx->video_out->config_ok)
+ vo_control(mpctx->video_out, VOCTRL_PAUSE, NULL);
+ unpause_player(mpctx);
+}
+
+static void pause_loop(struct MPContext *mpctx)
{
mp_cmd_t* cmd;
if (!quiet) {
// Small hack to display the pause message on the OSD line.
// The pause string is: "\n == PAUSE == \r" so we need to
// take the first and the last char out
- if (term_osd && !mpctx->sh_video) {
- char msg[128] = MSGTR_Paused;
- int mlen = strlen(msg);
- msg[mlen-1] = '\0';
- set_osd_msg(OSD_MSG_PAUSE, 1, 0, "%s", msg+1);
- update_osd_msg();
- } else
- mp_msg(MSGT_CPLAYER,MSGL_STATUS,MSGTR_Paused);
+ if (term_osd && !mpctx->sh_video) {
+ char msg[128] = _("\n ===== PAUSE =====\r");
+ int mlen = strlen(msg);
+ msg[mlen-1] = '\0';
+ set_osd_msg(OSD_MSG_PAUSE, 1, 0, "%s", msg+1);
+ update_osd_msg(mpctx);
+ } else
+ mp_tmsg(MSGT_CPLAYER,MSGL_STATUS,"\n ===== PAUSE =====\r");
mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_PAUSED\n");
}
-#ifdef CONFIG_GUI
- if (use_gui)
- guiGetEvent(guiCEvent, (char *)guiSetPause);
-#endif
- if (mpctx->video_out && mpctx->sh_video && vo_config_count)
- mpctx->video_out->control(VOCTRL_PAUSE, NULL);
-
- if (mpctx->audio_out && mpctx->sh_audio)
- mpctx->audio_out->pause(); // pause audio, keep data if possible
- while ( (cmd = mp_input_get_cmd(20, 1, 1)) == NULL || cmd->pausing == 4) {
- if (cmd) {
- cmd = mp_input_get_cmd(0,1,0);
- run_command(mpctx, cmd);
- mp_cmd_free(cmd);
- continue;
- }
- if (mpctx->sh_video && mpctx->video_out && vo_config_count)
- mpctx->video_out->check_events();
-#ifdef CONFIG_GUI
- if (use_gui) {
- guiEventHandling();
- guiGetEvent(guiReDraw, NULL);
- if (guiIntfStruct.Playing!=2 || (rel_seek_secs || abs_seek_pos))
- break;
- }
-#endif
+ while ( (cmd = mp_input_get_cmd(mpctx->input, 20, 1, 1)) == NULL
+ || cmd->id == MP_CMD_SET_MOUSE_POS || cmd->pausing == 4) {
+ if (cmd) {
+ cmd = mp_input_get_cmd(mpctx->input, 0,1,0);
+ run_command(mpctx, cmd);
+ mp_cmd_free(cmd);
+ continue;
+ }
+ if (mpctx->sh_video && mpctx->video_out)
+ vo_check_events(mpctx->video_out);
#ifdef CONFIG_MENU
if (vf_menu)
vf_menu_pause_update(vf_menu);
#endif
- usec_sleep(20000);
- }
- if (cmd && cmd->id == MP_CMD_PAUSE) {
- cmd = mp_input_get_cmd(0,1,0);
- mp_cmd_free(cmd);
- }
- mpctx->osd_function=OSD_PLAY;
- if (mpctx->audio_out && mpctx->sh_audio) {
- if (mpctx->eof) // do not play remaining audio if we e.g. switch to the next file
- mpctx->audio_out->reset();
- else
- mpctx->audio_out->resume(); // resume audio
- }
- if (mpctx->video_out && mpctx->sh_video && vo_config_count)
- mpctx->video_out->control(VOCTRL_RESUME, NULL); // resume video
- (void)GetRelativeTime(); // ignore time that passed during pause
-#ifdef CONFIG_GUI
- if (use_gui) {
- if (guiIntfStruct.Playing == guiSetStop)
- mpctx->eof = 1;
- else
- guiGetEvent(guiCEvent, (char *)guiSetPlay);
+ usec_sleep(20000);
+ update_osd_msg(mpctx);
+ int hack = vo_osd_changed(0);
+ vo_osd_changed(hack);
+ if (hack)
+ break;
}
-#endif
}
@@ -2519,7 +2624,7 @@ static void edl_update(MPContext *mpctx)
return;
if (!mpctx->sh_video) {
- mp_msg(MSGT_CPLAYER, MSGL_ERR, MSGTR_EdlNOsh_video);
+ mp_tmsg(MSGT_CPLAYER, MSGL_ERR, "Cannot use EDL without video, disabling.\n");
free_edl(edl_records);
next_edl_record = NULL;
edl_records = NULL;
@@ -2529,12 +2634,11 @@ static void edl_update(MPContext *mpctx)
if (mpctx->sh_video->pts >= next_edl_record->start_sec) {
if (next_edl_record->action == EDL_SKIP) {
mpctx->osd_function = OSD_FFW;
- abs_seek_pos = 0;
- rel_seek_secs = next_edl_record->length_sec;
+ mpctx->abs_seek_pos = 0;
+ mpctx->rel_seek_secs = next_edl_record->length_sec;
mp_msg(MSGT_CPLAYER, MSGL_DBG4, "EDL_SKIP: start [%f], stop "
"[%f], length [%f]\n", next_edl_record->start_sec,
next_edl_record->stop_sec, next_edl_record->length_sec);
- edl_decision = 1;
}
else if (next_edl_record->action == EDL_MUTE) {
mpctx->edl_muted = !mpctx->edl_muted;
@@ -2547,6 +2651,48 @@ static void edl_update(MPContext *mpctx)
}
}
+static void reinit_decoders(struct MPContext *mpctx)
+{
+ reinit_video_chain(mpctx);
+ reinit_audio_chain(mpctx);
+ mp_property_do("sub", M_PROPERTY_SET, &mpctx->global_sub_pos, mpctx);
+}
+
+static bool timeline_set_part(struct MPContext *mpctx, int i)
+{
+ struct timeline_part *p = mpctx->timeline + mpctx->timeline_part;
+ struct timeline_part *n = mpctx->timeline + i;
+ mpctx->timeline_part = i;
+ mpctx->video_offset = n->start - n->source_start;
+ if (n->source == p->source)
+ return false;
+ uninit_player(mpctx, INITIALIZED_VCODEC | (mpctx->opts.fixed_vo && mpctx->opts.video_id != -2 ? 0 : INITIALIZED_VO) | INITIALIZED_AO | INITIALIZED_ACODEC);
+ mpctx->demuxer = n->source->demuxer;
+ mpctx->d_video = mpctx->demuxer->video;
+ mpctx->d_audio = mpctx->demuxer->audio;
+ mpctx->d_sub = mpctx->demuxer->sub;
+ mpctx->sh_video = mpctx->d_video->sh;
+ mpctx->sh_audio = mpctx->d_audio->sh;
+ return true;
+}
+
+// Given pts, switch playback to the corresponding part.
+// Return offset within that part.
+static double timeline_set_from_time(struct MPContext *mpctx, double pts,
+ bool *need_reset)
+{
+ if (pts < 0)
+ pts = 0;
+ for (int i = 0; i < mpctx->num_timeline_parts; i++) {
+ struct timeline_part *p = mpctx->timeline + i;
+ if (pts < (p+1)->start) {
+ *need_reset = timeline_set_part(mpctx, i);
+ return pts - p->start + p->source_start;
+ }
+ }
+ return -1;
+}
+
// style & SEEK_ABSOLUTE == 0 means seek relative to current position, == 1 means absolute
// style & SEEK_FACTOR == 0 means amount in seconds, == 2 means fraction of file length
@@ -2554,30 +2700,72 @@ static void edl_update(MPContext *mpctx)
static int seek(MPContext *mpctx, double amount, int style)
{
current_module = "seek";
- if (demux_seek(mpctx->demuxer, amount, audio_delay, style) == 0)
+ if (mpctx->stop_play == AT_END_OF_FILE)
+ mpctx->stop_play = KEEP_PLAYING;
+ if (mpctx->timeline && style & SEEK_FACTOR) {
+ amount *= mpctx->timeline[mpctx->num_timeline_parts].start;
+ style &= ~SEEK_FACTOR;
+ }
+ if ((mpctx->demuxer->accurate_seek || mpctx->timeline) && mpctx->sh_video
+ && !(style & (SEEK_ABSOLUTE | SEEK_FACTOR))) {
+ style |= SEEK_ABSOLUTE;
+ if (amount > 0)
+ style |= SEEK_FORWARD;
+ else
+ style |= SEEK_BACKWARD;
+ amount += mpctx->sh_video->pts;
+ }
+
+ /* At least the liba52 decoder wants to read from the input stream
+ * during initialization, so reinit must be done after the demux_seek()
+ * call that clears possible stream EOF. */
+ bool need_reset = false;
+ if (mpctx->timeline) {
+ amount = timeline_set_from_time(mpctx, amount, &need_reset);
+ if (amount == -1) {
+ mpctx->stop_play = AT_END_OF_FILE;
+ // Clear audio from current position
+ if (mpctx->sh_audio) {
+ mpctx->audio_out->reset();
+ mpctx->sh_audio->a_buffer_len = 0;
+ mpctx->sh_audio->a_out_buffer_len = 0;
+ }
+ return -1;
+ }
+ }
+ int seekresult = demux_seek(mpctx->demuxer, amount, audio_delay, style);
+ if (need_reset)
+ reinit_decoders(mpctx);
+ if (seekresult == 0)
return -1;
- mpctx->startup_decode_retry = DEFAULT_STARTUP_DECODE_RETRY;
if (mpctx->sh_video) {
current_module = "seek_video_reset";
- if (vo_config_count)
- mpctx->video_out->control(VOCTRL_RESET, NULL);
- mpctx->num_buffered_frames = 0;
+ resync_video_stream(mpctx->sh_video);
+ vo_seek_reset(mpctx->video_out);
+ mpctx->sh_video->num_buffered_pts = 0;
+ mpctx->sh_video->last_pts = MP_NOPTS_VALUE;
mpctx->delay = 0;
- mpctx->time_frame = 0;
+ mpctx->time_frame = 0;
+ mpctx->update_video_immediately = true;
// Not all demuxers set d_video->pts during seek, so this value
// (which is used by at least vobsub and edl code below) may
// be completely wrong (probably 0).
- mpctx->sh_video->pts = mpctx->d_video->pts;
- update_subtitles(mpctx->sh_video, mpctx->sh_video->pts, mpctx->d_sub, 1);
+ mpctx->sh_video->pts = mpctx->d_video->pts + mpctx->video_offset;
+ update_subtitles(mpctx, &mpctx->opts, mpctx->sh_video,
+ mpctx->sh_video->pts, mpctx->video_offset,
+ mpctx->d_sub, 1);
update_teletext(mpctx->sh_video, mpctx->demuxer, 1);
}
if (mpctx->sh_audio) {
current_module = "seek_audio_reset";
mpctx->audio_out->reset(); // stop audio, throwing away buffered data
+ mpctx->sh_audio->a_buffer_len = 0;
+ mpctx->sh_audio->a_out_buffer_len = 0;
if (!mpctx->sh_video)
- update_subtitles(NULL, mpctx->sh_audio->pts, mpctx->d_sub, 1);
+ update_subtitles(mpctx, &mpctx->opts, NULL, mpctx->sh_audio->pts,
+ mpctx->video_offset, mpctx->d_sub, 1);
}
if (vo_vobsub && mpctx->sh_video) {
@@ -2587,8 +2775,7 @@ static int seek(MPContext *mpctx, double amount, int style)
edl_seek_reset(mpctx);
- c_total = 0;
- max_pts_correction = 0.1;
+ mpctx->total_avsync_change = 0;
audio_time_usage = 0; video_time_usage = 0; vout_time_usage = 0;
drop_frame_cnt = 0;
@@ -2596,6 +2783,243 @@ static int seek(MPContext *mpctx, double amount, int style)
return 0;
}
+int get_current_chapter(struct MPContext *mpctx)
+{
+ if (!mpctx->chapters || !mpctx->sh_video)
+ return demuxer_get_current_chapter(mpctx->demuxer);
+
+ int i;
+ double current_pts = mpctx->sh_video->pts;
+ for (i = 1; i < mpctx->num_chapters; i++)
+ if (current_pts < mpctx->chapters[i].start)
+ break;
+ return i - 1;
+}
+
+// currently returns a string allocated with malloc, not talloc
+char *chapter_display_name(struct MPContext *mpctx, int chapter)
+{
+ if (!mpctx->chapters || !mpctx->sh_video)
+ return demuxer_chapter_display_name(mpctx->demuxer, chapter);
+ return strdup(mpctx->chapters[chapter].name);
+}
+
+int seek_chapter(struct MPContext *mpctx, int chapter, double *seek_pts,
+ char **chapter_name)
+{
+ if (!mpctx->chapters || !mpctx->sh_video)
+ return demuxer_seek_chapter(mpctx->demuxer, chapter, seek_pts,
+ chapter_name);
+ if (chapter >= mpctx->num_chapters)
+ return -1;
+ if (chapter < 0)
+ chapter = 0;
+ *seek_pts = mpctx->chapters[chapter].start;
+ if (chapter_name)
+ *chapter_name = talloc_strdup(NULL, mpctx->chapters[chapter].name);
+ return chapter;
+}
+
+static int find_ordered_chapter_sources(struct MPContext *mpctx,
+ struct content_source *sources,
+ int num_sources,
+ unsigned char uid_map[][16])
+{
+ int num_filenames = 0;
+ char **filenames = NULL;
+ if (num_sources > 1) {
+ mp_msg(MSGT_CPLAYER, MSGL_INFO, "This file references data from "
+ "other sources.\n");
+ if (mpctx->stream->type != STREAMTYPE_FILE) {
+ mp_msg(MSGT_CPLAYER, MSGL_WARN, "Playback source is not a "
+ "normal disk file. Will not search for related files.\n");
+ } else {
+ mp_msg(MSGT_CPLAYER, MSGL_INFO, "Will scan other files in the "
+ "same directory to find referenced sources.\n");
+ filenames = find_files(mpctx->demuxer->filename, ".mkv",
+ &num_filenames);
+ }
+ }
+
+ int num_left = num_sources - 1;
+ for (int i = 0; i < num_filenames && num_left > 0; i++) {
+ mp_msg(MSGT_CPLAYER, MSGL_INFO, "Checking file %s\n",
+ filename_recode(filenames[i]));
+ int format;
+ struct stream *s = open_stream(filenames[i], &mpctx->opts, &format);
+ if (!s)
+ continue;
+ struct demuxer *d = demux_open(&mpctx->opts, s, DEMUXER_TYPE_MATROSKA,
+ mpctx->opts.audio_id,
+ mpctx->opts.video_id,
+ mpctx->opts.sub_id, filenames[i]);
+ if (!d) {
+ free_stream(s);
+ continue;
+ }
+ if (d->file_format == DEMUXER_TYPE_MATROSKA) {
+ for (int i = 1; i < num_sources; i++) {
+ if (sources[i].demuxer)
+ continue;
+ if (!memcmp(uid_map[i], d->matroska_data.segment_uid, 16)) {
+ mp_msg(MSGT_CPLAYER, MSGL_INFO,"Match for source %d: %s\n",
+ i, filename_recode(d->filename));
+ sources[i].stream = s;
+ sources[i].demuxer = d;
+ num_left--;
+ goto match;
+ }
+ }
+ }
+ free_demuxer(d);
+ free_stream(s);
+ continue;
+ match:
+ ;
+ }
+ talloc_free(filenames);
+ if (num_left) {
+ mp_msg(MSGT_CPLAYER, MSGL_ERR, "Failed to find ordered chapter part!\n"
+ "There will be parts MISSING from the video!\n");
+ for (int i = 1, j = 1; i < num_sources; i++)
+ if (sources[i].demuxer) {
+ sources[j] = sources[i];
+ memcpy(uid_map[j], uid_map[i], 16);
+ j++;
+ }
+ }
+ return num_sources - num_left;
+}
+
+static void build_ordered_chapter_timeline(struct MPContext *mpctx)
+{
+ if (!mpctx->opts.ordered_chapters) {
+ mp_msg(MSGT_CPLAYER, MSGL_INFO, "File uses ordered chapters, but "
+ "you have disabled support for them. Ignoring.\n");
+ return;
+ }
+
+ mp_msg(MSGT_CPLAYER, MSGL_INFO, "File uses ordered chapters, will build "
+ "edit timeline.\n");
+
+ struct demuxer *demuxer = mpctx->demuxer;
+ struct matroska_data *m = &demuxer->matroska_data;
+
+ // +1 because sources/uid_map[0] is original file even if all chapters
+ // actually use other sources and need separate entries
+ struct content_source *sources = talloc_array_ptrtype(NULL, sources,
+ m->num_ordered_chapters+1);
+ sources[0].stream = mpctx->stream;
+ sources[0].demuxer = mpctx->demuxer;
+ unsigned char uid_map[m->num_ordered_chapters+1][16];
+ int num_sources = 1;
+ memcpy(uid_map[0], m->segment_uid, 16);
+
+ for (int i = 0; i < m->num_ordered_chapters; i++) {
+ struct matroska_chapter *c = m->ordered_chapters + i;
+ if (!c->has_segment_uid)
+ memcpy(c->segment_uid, m->segment_uid, 16);
+
+ for (int j = 0; j < num_sources; j++)
+ if (!memcmp(c->segment_uid, uid_map[j], 16))
+ goto found1;
+ memcpy(uid_map[num_sources], c->segment_uid, 16);
+ sources[num_sources] = (struct content_source){};
+ num_sources++;
+ found1:
+ ;
+ }
+
+ num_sources = find_ordered_chapter_sources(mpctx, sources, num_sources,
+ uid_map);
+
+
+ // +1 for terminating chapter with start time marking end of last real one
+ struct timeline_part *timeline = talloc_array_ptrtype(NULL, timeline,
+ m->num_ordered_chapters + 1);
+ struct chapter *chapters = talloc_array_ptrtype(NULL, chapters,
+ m->num_ordered_chapters);
+ uint64_t starttime = 0;
+ uint64_t missing_time = 0;
+ int part_count = 0;
+ int num_chapters = 0;
+ uint64_t prev_part_offset;
+ for (int i = 0; i < m->num_ordered_chapters; i++) {
+ struct matroska_chapter *c = m->ordered_chapters + i;
+
+ int j;
+ for (j = 0; j < num_sources; j++) {
+ if (!memcmp(c->segment_uid, uid_map[j], 16))
+ goto found2;
+ }
+ missing_time += c->end - c->start;
+ continue;
+ found2:;
+ chapters[num_chapters].start = starttime / 1000.;
+ chapters[num_chapters].name = talloc_strdup(chapters, c->name);
+ /* Only add a separate part if the time or file actually changes.
+ * Matroska files have chapter divisions that are redundant from
+ * timeline point of view because the same chapter structure is used
+ * both to specify the timeline and for normal chapter information.
+ * Removing a missing inserted external chapter can also cause this. */
+ if (part_count == 0 || c->start != starttime + prev_part_offset
+ || sources + j != timeline[part_count - 1].source) {
+ timeline[part_count].source = sources + j;
+ timeline[part_count].start = chapters[num_chapters].start;
+ timeline[part_count].source_start = c->start / 1000.;
+ prev_part_offset = c->start - starttime;
+ part_count++;
+ }
+ starttime += c->end - c->start;
+ num_chapters++;
+ }
+ timeline[part_count].start = starttime / 1000.;
+
+ if (!part_count) {
+ // None of the parts come from the file itself???
+ talloc_free(sources);
+ talloc_free(timeline);
+ talloc_free(chapters);
+ return;
+ }
+
+ mp_msg(MSGT_CPLAYER, MSGL_V, "Timeline contains %d parts from %d "
+ "sources. Total length %.3f seconds.\n", part_count, num_sources,
+ timeline[part_count].start);
+ if (missing_time)
+ mp_msg(MSGT_CPLAYER, MSGL_ERR, "There are %.3f seconds missing "
+ "from the timeline!\n", missing_time / 1000.);
+ mp_msg(MSGT_CPLAYER, MSGL_V, "Source files:\n");
+ for (int i = 0; i < num_sources; i++)
+ mp_msg(MSGT_CPLAYER, MSGL_V, "%d: %s\n", i,
+ filename_recode(sources[i].demuxer->filename));
+ mp_msg(MSGT_CPLAYER, MSGL_V, "Timeline parts: (number, start, "
+ "source_start, source):\n");
+ for (int i = 0; i < part_count; i++) {
+ struct timeline_part *p = timeline + i;
+ mp_msg(MSGT_CPLAYER, MSGL_V, "%3d %9.3f %9.3f %3td\n", i, p->start,
+ p->source_start, p->source - sources);
+ }
+ mp_msg(MSGT_CPLAYER, MSGL_V, "END %9.3f\n", timeline[part_count].start);
+ mpctx->sources = sources;
+ mpctx->num_sources = num_sources;
+ mpctx->timeline = timeline;
+ mpctx->num_timeline_parts = part_count;
+ mpctx->num_chapters = num_chapters;
+ mpctx->chapters = chapters;
+
+ mpctx->timeline_part = 0;
+ mpctx->demuxer = timeline[0].source->demuxer;
+}
+
+
+static int read_keys(void *ctx, int fd)
+{
+ getch2(ctx);
+ return mplayer_get_key(ctx, 0);
+}
+
+
/* This preprocessor directive is a hack to generate a mplayer-nomain.o object
* file for some tools to link against. */
#ifndef DISABLE_MAIN
@@ -2613,20 +3037,34 @@ int opt_exit = 0;
int i;
-int gui_no_filename=0;
+ struct MPContext *mpctx = &(struct MPContext){
+ .osd_function = OSD_PLAY,
+ .begin_skip = MP_NOPTS_VALUE,
+ .play_tree_step = 1,
+ .global_sub_pos = -1,
+ .set_of_sub_pos = -1,
+ .file_format = DEMUXER_TYPE_UNKNOWN,
+ .last_dvb_step = 1,
+ };
InitTimer();
srand(GetTimerMS());
mp_msg_init();
+ set_av_log_callback();
+#ifdef CONFIG_X11
+ mpctx->x11_state = vo_x11_init_state();
+#endif
+ struct MPOpts *opts = &mpctx->opts;
+ set_default_mplayer_options(opts);
// Create the config context and register the options
- mconfig = m_config_new();
- m_config_register_options(mconfig,mplayer_opts);
- mp_input_register_options(mconfig);
+ mpctx->mconfig = m_config_new(opts, cfg_include);
+ m_config_register_options(mpctx->mconfig,mplayer_opts);
+ mp_input_register_options(mpctx->mconfig);
// Preparse the command line
- m_config_preparse_command_line(mconfig,argc,argv);
+ m_config_preparse_command_line(mpctx->mconfig,argc,argv);
#if (defined(__MINGW32__) || defined(__CYGWIN__)) && defined(CONFIG_WIN32DLL)
set_path_env();
@@ -2636,62 +3074,29 @@ int gui_no_filename=0;
stream_tv_defaults.immediate = 1;
#endif
- if (argc > 1 && argv[1] &&
- (!strcmp(argv[1], "-gui") || !strcmp(argv[1], "-nogui"))) {
- use_gui = !strcmp(argv[1], "-gui");
- } else
- if ( argv[0] )
- {
- char *base = strrchr(argv[0], '/');
- if (!base)
- base = strrchr(argv[0], '\\');
- if (!base)
- base = argv[0];
- if(strstr(base, "gmplayer"))
- use_gui=1;
- }
-
- parse_cfgfiles(mconfig);
+ parse_cfgfiles(mpctx, mpctx->mconfig);
-#ifdef CONFIG_GUI
- if ( use_gui ) cfg_read();
-#endif
-
- mpctx->playtree = m_config_parse_mp_command_line(mconfig, argc, argv);
+ mpctx->playtree = m_config_parse_mp_command_line(mpctx->mconfig, argc, argv);
if(mpctx->playtree == NULL)
opt_exit = 1;
else {
mpctx->playtree = play_tree_cleanup(mpctx->playtree);
if(mpctx->playtree) {
- mpctx->playtree_iter = play_tree_iter_new(mpctx->playtree,mconfig);
+ mpctx->playtree_iter = play_tree_iter_new(mpctx->playtree,mpctx->mconfig);
if(mpctx->playtree_iter) {
if(play_tree_iter_step(mpctx->playtree_iter,0,0) != PLAY_TREE_ITER_ENTRY) {
play_tree_iter_free(mpctx->playtree_iter);
mpctx->playtree_iter = NULL;
}
- filename = play_tree_iter_get_file(mpctx->playtree_iter,1);
+ mpctx->filename = play_tree_iter_get_file(mpctx->playtree_iter,1);
}
}
}
+ mpctx->key_fifo = mp_fifo_create(opts);
print_version("MPlayer");
#if defined(__MINGW32__) || defined(__CYGWIN__)
-#ifdef CONFIG_GUI
- void *runningmplayer = FindWindow("MPlayer GUI for Windows", "MPlayer for Windows");
- if(runningmplayer && filename && use_gui){
- COPYDATASTRUCT csData;
- char file[MAX_PATH];
- char *filepart = filename;
- if(GetFullPathName(filename, MAX_PATH, file, &filepart)){
- csData.dwData = 0;
- csData.cbData = strlen(file)*2;
- csData.lpData = file;
- SendMessage(runningmplayer, WM_COPYDATA, (WPARAM)runningmplayer, (LPARAM)&csData);
- }
- }
-#endif
-
{
HMODULE kernel32 = GetModuleHandle("Kernel32.dll");
BOOL WINAPI (*setDEP)(DWORD) = NULL;
@@ -2709,41 +3114,12 @@ int gui_no_filename=0;
set_priority();
#endif
-#ifndef CONFIG_GUI
- if(use_gui){
- mp_msg(MSGT_CPLAYER,MSGL_WARN,MSGTR_NoGui);
- use_gui=0;
- }
-#else
-#if !defined(__MINGW32__) && !defined(__CYGWIN__)
- if(use_gui && !vo_init()){
- mp_msg(MSGT_CPLAYER,MSGL_WARN,MSGTR_GuiNeedsX);
- use_gui=0;
- }
-#endif
- if (use_gui && mpctx->playtree_iter){
- char cwd[PATH_MAX+2];
- // Free Playtree and Playtree-Iter as it's not used by the GUI.
- play_tree_iter_free(mpctx->playtree_iter);
- mpctx->playtree_iter=NULL;
-
- if (getcwd(cwd, PATH_MAX) != (char *)NULL)
- {
- strcat(cwd, "/");
- // Prefix relative paths with current working directory
- play_tree_add_bpf(mpctx->playtree, cwd);
- }
- // Import initital playtree into GUI.
- import_initial_playtree_into_gui(mpctx->playtree, mconfig, enqueue);
- }
-#endif /* CONFIG_GUI */
-
- if(video_driver_list && strcmp(video_driver_list[0],"help")==0){
+ if(opts->video_driver_list && strcmp(opts->video_driver_list[0],"help")==0){
list_video_out();
opt_exit = 1;
}
- if(audio_driver_list && strcmp(audio_driver_list[0],"help")==0){
+ if(opts->audio_driver_list && strcmp(opts->audio_driver_list[0],"help")==0){
list_audio_out();
opt_exit = 1;
}
@@ -2753,9 +3129,9 @@ if(!codecs_file || !parse_codec_cfg(codecs_file)){
if(!parse_codec_cfg(mem_ptr=get_path("codecs.conf"))){
if(!parse_codec_cfg(MPLAYER_CONFDIR "/codecs.conf")){
if(!parse_codec_cfg(NULL)){
- exit_player_with_rc(EXIT_NONE, 0);
+ exit_player_with_rc(mpctx, EXIT_NONE, 0);
}
- mp_msg(MSGT_CPLAYER,MSGL_V,MSGTR_BuiltinCodecsConf);
+ mp_tmsg(MSGT_CPLAYER,MSGL_V,"Using built-in default codecs.conf.\n");
}
}
free( mem_ptr ); // release the buffer created by get_path()
@@ -2770,14 +3146,14 @@ if(!codecs_file || !parse_codec_cfg(codecs_file)){
}
#endif
if(audio_codec_list && strcmp(audio_codec_list[0],"help")==0){
- mp_msg(MSGT_CPLAYER, MSGL_INFO, MSGTR_AvailableAudioCodecs);
+ mp_tmsg(MSGT_CPLAYER, MSGL_INFO, "Available audio codecs:\n");
mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_AUDIO_CODECS\n");
list_codecs(1);
mp_msg(MSGT_FIXME, MSGL_FIXME, "\n");
opt_exit = 1;
}
if(video_codec_list && strcmp(video_codec_list[0],"help")==0){
- mp_msg(MSGT_CPLAYER, MSGL_INFO, MSGTR_AvailableVideoCodecs);
+ mp_tmsg(MSGT_CPLAYER, MSGL_INFO, "Available video codecs:\n");
mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_VIDEO_CODECS\n");
list_codecs(0);
mp_msg(MSGT_FIXME, MSGL_FIXME, "\n");
@@ -2818,19 +3194,12 @@ if(!codecs_file || !parse_codec_cfg(codecs_file)){
}
if(opt_exit)
- exit_player(EXIT_NONE);
+ exit_player(mpctx, EXIT_NONE);
- if (player_idle_mode && use_gui) {
- mp_msg(MSGT_CPLAYER, MSGL_FATAL, MSGTR_NoIdleAndGui);
- exit_player_with_rc(EXIT_NONE, 1);
- }
-
- if(!filename && !player_idle_mode){
- if(!use_gui){
+ if(!mpctx->filename && !player_idle_mode){
// no file/vcd/dvd -> show HELP:
- mp_msg(MSGT_CPLAYER, MSGL_INFO, help_text);
- exit_player_with_rc(EXIT_NONE, 0);
- } else gui_no_filename=1;
+ mp_msg(MSGT_CPLAYER, MSGL_INFO, "%s", mp_gtext(help_text));
+ exit_player_with_rc(mpctx, EXIT_NONE, 0);
}
/* Display what configure line was used */
@@ -2838,13 +3207,15 @@ if(!codecs_file || !parse_codec_cfg(codecs_file)){
// Many users forget to include command line in bugreports...
if( mp_msg_test(MSGT_CPLAYER,MSGL_V) ){
- mp_msg(MSGT_CPLAYER, MSGL_INFO, MSGTR_CommandLine);
+ mp_tmsg(MSGT_CPLAYER, MSGL_INFO, "CommandLine:");
for(i=1;i<argc;i++)mp_msg(MSGT_CPLAYER, MSGL_INFO," '%s'",argv[i]);
mp_msg(MSGT_CPLAYER, MSGL_INFO, "\n");
}
//------ load global data first ------
+ mpctx->osd = osd_create();
+
// check font
#ifdef CONFIG_FREETYPE
init_freetype();
@@ -2856,7 +3227,7 @@ if(!codecs_file || !parse_codec_cfg(codecs_file)){
#ifdef CONFIG_BITMAP_FONT
if(font_name){
vo_font=read_font_desc(font_name,font_factor,verbose>1);
- if(!vo_font) mp_msg(MSGT_CPLAYER,MSGL_ERR,MSGTR_CantLoadFont,
+ if(!vo_font) mp_tmsg(MSGT_CPLAYER,MSGL_ERR,"Cannot load bitmap font: %s\n",
filename_recode(font_name));
} else {
// try default:
@@ -2866,16 +3237,14 @@ if(!codecs_file || !parse_codec_cfg(codecs_file)){
vo_font=read_font_desc(MPLAYER_DATADIR "/font/font.desc",font_factor,verbose>1);
}
if (sub_font_name)
- sub_font = read_font_desc(sub_font_name, font_factor, verbose>1);
+ mpctx->osd->sub_font = read_font_desc(sub_font_name, font_factor, verbose>1);
else
- sub_font = vo_font;
+ mpctx->osd->sub_font = vo_font;
#endif
#ifdef CONFIG_FONTCONFIG
}
#endif
- vo_init_osd();
-
#ifdef CONFIG_ASS
ass_library = ass_init();
#endif
@@ -2885,65 +3254,61 @@ if(!codecs_file || !parse_codec_cfg(codecs_file)){
{
// seteuid(0); /* Can't hurt to try to get root here */
if ((rtc_fd = open(rtc_device ? rtc_device : "/dev/rtc", O_RDONLY)) < 0)
- mp_msg(MSGT_CPLAYER, MSGL_WARN, MSGTR_RTCDeviceNotOpenable,
+ mp_tmsg(MSGT_CPLAYER, MSGL_WARN, "Failed to open %s: %s (it should be readable by the user.)\n",
rtc_device ? rtc_device : "/dev/rtc", strerror(errno));
else {
unsigned long irqp = 1024; /* 512 seemed OK. 128 is jerky. */
if (ioctl(rtc_fd, RTC_IRQP_SET, irqp) < 0) {
- mp_msg(MSGT_CPLAYER, MSGL_WARN, MSGTR_LinuxRTCInitErrorIrqpSet, irqp, strerror(errno));
- mp_msg(MSGT_CPLAYER, MSGL_HINT, MSGTR_IncreaseRTCMaxUserFreq, irqp);
+ mp_tmsg(MSGT_CPLAYER, MSGL_WARN, "Linux RTC init error in ioctl (rtc_irqp_set %lu): %s\n", irqp, strerror(errno));
+ mp_tmsg(MSGT_CPLAYER, MSGL_HINT, "Try adding \"echo %lu > /proc/sys/dev/rtc/max-user-freq\" to your system startup scripts.\n", irqp);
close (rtc_fd);
rtc_fd = -1;
} else if (ioctl(rtc_fd, RTC_PIE_ON, 0) < 0) {
/* variable only by the root */
- mp_msg(MSGT_CPLAYER, MSGL_ERR, MSGTR_LinuxRTCInitErrorPieOn, strerror(errno));
+ mp_tmsg(MSGT_CPLAYER, MSGL_ERR, "Linux RTC init error in ioctl (rtc_pie_on): %s\n", strerror(errno));
close (rtc_fd);
rtc_fd = -1;
} else
- mp_msg(MSGT_CPLAYER, MSGL_V, MSGTR_UsingRTCTiming, irqp);
+ mp_tmsg(MSGT_CPLAYER, MSGL_V, "Using Linux hardware RTC timing (%ldHz).\n", irqp);
}
}
-#ifdef CONFIG_GUI
-// breaks DGA and SVGAlib and VESA drivers: --A'rpi
-// and now ? -- Pontscho
- if(use_gui) setuid( getuid() ); // strongly test, please check this.
-#endif
if(rtc_fd<0)
#endif /* HAVE_RTC */
mp_msg(MSGT_CPLAYER, MSGL_V, "Using %s timing\n",
softsleep?"software":timer_name);
#ifdef HAVE_TERMCAP
- if ( !use_gui ) load_termcap(NULL); // load key-codes
+ load_termcap(NULL); // load key-codes
#endif
// ========== Init keyboard FIFO (connection to libvo) ============
// Init input system
current_module = "init_input";
-mp_input_init(use_gui);
- mp_input_add_key_fd(-1,0,mplayer_get_key,NULL);
+ mpctx->input = mp_input_init(&opts->input);
+ mp_input_add_key_fd(mpctx->input, -1,0,mplayer_get_key,NULL, mpctx->key_fifo);
if(slave_mode)
- mp_input_add_cmd_fd(0,USE_SELECT,MP_INPUT_SLAVE_CMD_FUNC,NULL);
+ mp_input_add_cmd_fd(mpctx->input, 0,USE_SELECT,MP_INPUT_SLAVE_CMD_FUNC,NULL);
else if(!noconsolecontrols)
- mp_input_add_event_fd(0, getch2);
+ mp_input_add_key_fd(mpctx->input, 0, 1, read_keys, NULL, mpctx->key_fifo);
// Set the libstream interrupt callback
-stream_set_interrupt_callback(mp_input_check_interrupt);
+stream_set_interrupt_callback(mp_input_check_interrupt, mpctx->input);
#ifdef CONFIG_MENU
if(use_menu) {
- if(menu_cfg && menu_init(mpctx, menu_cfg))
- mp_msg(MSGT_CPLAYER, MSGL_V, MSGTR_MenuInitialized, menu_cfg);
+ if(menu_cfg && menu_init(mpctx, mpctx->mconfig, mpctx->input, menu_cfg))
+ mp_tmsg(MSGT_CPLAYER, MSGL_V, "Menu initialized: %s\n", menu_cfg);
else {
menu_cfg = get_path("menu.conf");
- if(menu_init(mpctx, menu_cfg))
- mp_msg(MSGT_CPLAYER, MSGL_V, MSGTR_MenuInitialized, menu_cfg);
+ if(menu_init(mpctx, mpctx->mconfig, mpctx->input, menu_cfg))
+ mp_tmsg(MSGT_CPLAYER, MSGL_V, "Menu initialized: %s\n", menu_cfg);
else {
- if(menu_init(mpctx, MPLAYER_CONFDIR "/menu.conf"))
- mp_msg(MSGT_CPLAYER, MSGL_V, MSGTR_MenuInitialized, MPLAYER_CONFDIR"/menu.conf");
+ if(menu_init(mpctx, mpctx->mconfig, mpctx->input,
+ MPLAYER_CONFDIR "/menu.conf"))
+ mp_tmsg(MSGT_CPLAYER, MSGL_V, "Menu initialized: %s\n", MPLAYER_CONFDIR"/menu.conf");
else {
- mp_msg(MSGT_CPLAYER, MSGL_ERR, MSGTR_MenuInitFailed);
+ mp_tmsg(MSGT_CPLAYER, MSGL_ERR, "Menu init failed.\n");
use_menu = 0;
}
}
@@ -2951,7 +3316,6 @@ stream_set_interrupt_callback(mp_input_check_interrupt);
}
#endif
-initialized_flags|=INITIALIZED_INPUT;
current_module = NULL;
/// Catch signals
@@ -2984,15 +3348,6 @@ current_module = NULL;
#endif
#endif
-#ifdef CONFIG_GUI
- if(use_gui){
- guiInit();
- guiGetEvent(guiSetContext, mpctx);
- initialized_flags|=INITIALIZED_GUI;
- guiGetEvent( guiCEvent,(char *)((gui_no_filename) ? 0 : 1) );
- }
-#endif
-
// ******************* Now, let's see the per-file stuff ********************
play_next_file:
@@ -3001,74 +3356,35 @@ play_next_file:
mpctx->global_sub_size = 0;
{ int i; for (i = 0; i < SUB_SOURCES; i++) mpctx->global_sub_indices[i] = -1; }
- if (filename) {
- load_per_protocol_config (mconfig, filename);
- load_per_extension_config (mconfig, filename);
- load_per_file_config (mconfig, filename);
+ if (mpctx->filename) {
+ load_per_protocol_config (mpctx->mconfig, mpctx->filename);
+ load_per_extension_config (mpctx->mconfig, mpctx->filename);
+ load_per_file_config (mpctx->mconfig, mpctx->filename);
}
- if (video_driver_list)
- load_per_output_config (mconfig, PROFILE_CFG_VO, video_driver_list[0]);
- if (audio_driver_list)
- load_per_output_config (mconfig, PROFILE_CFG_AO, audio_driver_list[0]);
+ if (opts->video_driver_list)
+ load_per_output_config (mpctx->mconfig, PROFILE_CFG_VO, opts->video_driver_list[0]);
+ if (opts->audio_driver_list)
+ load_per_output_config (mpctx->mconfig, PROFILE_CFG_AO, opts->audio_driver_list[0]);
// We must enable getch2 here to be able to interrupt network connection
// or cache filling
if(!noconsolecontrols && !slave_mode){
- if(initialized_flags&INITIALIZED_GETCH2)
- mp_msg(MSGT_CPLAYER,MSGL_WARN,MSGTR_Getch2InitializedTwice);
+ if(mpctx->initialized_flags&INITIALIZED_GETCH2)
+ mp_tmsg(MSGT_CPLAYER,MSGL_WARN,"WARNING: getch2_init called twice!\n");
else
getch2_enable(); // prepare stdin for hotkeys...
- initialized_flags|=INITIALIZED_GETCH2;
+ mpctx->initialized_flags|=INITIALIZED_GETCH2;
mp_msg(MSGT_CPLAYER,MSGL_DBG2,"\n[[[init getch2]]]\n");
}
// =================== GUI idle loop (STOP state) ===========================
-#ifdef CONFIG_GUI
- if ( use_gui ) {
- mpctx->file_format=DEMUXER_TYPE_UNKNOWN;
- guiGetEvent( guiSetDefaults,0 );
- while ( guiIntfStruct.Playing != 1 )
- {
- mp_cmd_t* cmd;
- usec_sleep(20000);
- guiEventHandling();
- guiGetEvent( guiReDraw,NULL );
- if ( (cmd = mp_input_get_cmd(0,0,0)) != NULL) {
- guiGetEvent(guiIEvent, (char *)cmd->id);
- mp_cmd_free(cmd);
- }
- }
- guiGetEvent( guiSetParameters,NULL );
- if ( guiIntfStruct.StreamType == STREAMTYPE_STREAM )
- {
- play_tree_t * entry = play_tree_new();
- play_tree_add_file( entry,guiIntfStruct.Filename );
- if ( mpctx->playtree ) play_tree_free_list( mpctx->playtree->child,1 );
- else mpctx->playtree=play_tree_new();
- play_tree_set_child( mpctx->playtree,entry );
- if(mpctx->playtree)
- {
- mpctx->playtree_iter = play_tree_iter_new(mpctx->playtree,mconfig);
- if(mpctx->playtree_iter)
- {
- if(play_tree_iter_step(mpctx->playtree_iter,0,0) != PLAY_TREE_ITER_ENTRY)
- {
- play_tree_iter_free(mpctx->playtree_iter);
- mpctx->playtree_iter = NULL;
- }
- filename = play_tree_iter_get_file(mpctx->playtree_iter,1);
- }
- }
- }
- }
-#endif /* CONFIG_GUI */
-
-while (player_idle_mode && !filename) {
+while (player_idle_mode && !mpctx->filename) {
play_tree_t * entry = NULL;
mp_cmd_t * cmd;
- while (!(cmd = mp_input_get_cmd(0,1,0))) { // wait for command
- if (mpctx->video_out && vo_config_count) mpctx->video_out->check_events();
+ while (!(cmd = mp_input_get_cmd(mpctx->input, 0,1,0))) { // wait for command
+ if (mpctx->video_out)
+ vo_check_events(mpctx->video_out);
usec_sleep(20000);
}
switch (cmd->id) {
@@ -3079,10 +3395,10 @@ while (player_idle_mode && !filename) {
// The entry is added to the main playtree after the switch().
break;
case MP_CMD_LOADLIST:
- entry = parse_playlist_file(cmd->args[0].v.s);
+ entry = parse_playlist_file(mpctx->mconfig, cmd->args[0].v.s);
break;
case MP_CMD_QUIT:
- exit_player_with_rc(EXIT_QUIT, (cmd->nargs > 0)? cmd->args[0].v.i : 0);
+ exit_player_with_rc(mpctx, EXIT_QUIT, (cmd->nargs > 0)? cmd->args[0].v.i : 0);
break;
case MP_CMD_GET_PROPERTY:
case MP_CMD_SET_PROPERTY:
@@ -3103,7 +3419,7 @@ while (player_idle_mode && !filename) {
play_tree_set_child(mpctx->playtree, entry);
/* Make iterator start at the top the of tree. */
- mpctx->playtree_iter = play_tree_iter_new(mpctx->playtree, mconfig);
+ mpctx->playtree_iter = play_tree_iter_new(mpctx->playtree, mpctx->mconfig);
if (!mpctx->playtree_iter) continue;
// find the first real item in the tree
@@ -3113,16 +3429,16 @@ while (player_idle_mode && !filename) {
mpctx->playtree_iter = NULL;
continue; // wait for next command
}
- filename = play_tree_iter_get_file(mpctx->playtree_iter, 1);
+ mpctx->filename = play_tree_iter_get_file(mpctx->playtree_iter, 1);
}
}
//---------------------------------------------------------------------------
- if(filename) {
- mp_msg(MSGT_CPLAYER,MSGL_INFO,MSGTR_Playing,
- filename_recode(filename));
+ if (mpctx->filename) {
+ mp_tmsg(MSGT_CPLAYER,MSGL_INFO,"\nPlaying %s.\n",
+ filename_recode(mpctx->filename));
if(use_filename_title && vo_wintitle == NULL)
- vo_wintitle = strdup ( mp_basename2 (filename));
+ vo_wintitle = strdup(mp_basename2(mpctx->filename));
}
if (edl_filename) {
@@ -3133,7 +3449,7 @@ if (edl_output_filename) {
if (edl_fd) fclose(edl_fd);
if ((edl_fd = fopen(edl_output_filename, "w")) == NULL)
{
- mp_msg(MSGT_CPLAYER, MSGL_ERR, MSGTR_EdlCantOpenForWrite,
+ mp_tmsg(MSGT_CPLAYER, MSGL_ERR, "Can't open EDL file [%s] for writing.\n",
filename_recode(edl_output_filename));
}
}
@@ -3144,11 +3460,11 @@ if (edl_output_filename) {
if (vobsub_name){
vo_vobsub=vobsub_open(vobsub_name,spudec_ifo,1,&vo_spudec);
if(vo_vobsub==NULL)
- mp_msg(MSGT_CPLAYER,MSGL_ERR,MSGTR_CantLoadSub,
+ mp_tmsg(MSGT_CPLAYER,MSGL_ERR,"Cannot load subtitles: %s\n",
filename_recode(vobsub_name));
- } else if (sub_auto && filename){
+ } else if (sub_auto && mpctx->filename){
/* try to autodetect vobsub from movie filename ::atmos */
- char *buf = strdup(filename), *psub;
+ char *buf = strdup(mpctx->filename), *psub;
char *pdot = strrchr(buf, '.');
char *pslash = strrchr(buf, '/');
#if defined(__MINGW32__) || defined(__CYGWIN__)
@@ -3176,7 +3492,7 @@ if (edl_output_filename) {
free(buf);
}
if(vo_vobsub){
- initialized_flags|=INITIALIZED_VOBSUB;
+ mpctx->initialized_flags|=INITIALIZED_VOBSUB;
vobsub_set_from_lang(vo_vobsub, dvdsub_lang);
mp_property_do("sub_forced_only", M_PROPERTY_SET, &forced_subs_only, mpctx);
@@ -3201,26 +3517,28 @@ if (edl_output_filename) {
mpctx->sh_video=NULL;
current_module="open_stream";
- mpctx->stream=open_stream(filename,0,&mpctx->file_format);
+ mpctx->stream = open_stream(mpctx->filename, opts, &mpctx->file_format);
if(!mpctx->stream) { // error...
- mpctx->eof = libmpdemux_was_interrupted(PT_NEXT_ENTRY);
+ mpctx->stop_play = libmpdemux_was_interrupted(mpctx, PT_NEXT_ENTRY);
goto goto_next_file;
}
- initialized_flags|=INITIALIZED_STREAM;
-
-#ifdef CONFIG_GUI
- if ( use_gui ) guiGetEvent( guiSetStream,(char *)mpctx->stream );
-#endif
+ mpctx->initialized_flags|=INITIALIZED_STREAM;
if(mpctx->file_format == DEMUXER_TYPE_PLAYLIST) {
+ mp_msg(MSGT_CPLAYER, MSGL_ERR, "\nThis looks like a playlist, but "
+ "playlist support will not be used automatically.\n"
+ "MPlayer's playlist code is unsafe and should only be used with "
+ "trusted sources.\nPlayback will probably fail.\n\n");
+#if 0
play_tree_t* entry;
// Handle playlist
current_module="handle_playlist";
mp_msg(MSGT_CPLAYER,MSGL_V,"Parsing playlist %s...\n",
- filename_recode(filename));
- entry = parse_playtree(mpctx->stream,0);
- mpctx->eof=playtree_add_playlist(entry);
+ filename_recode(mpctx->filename));
+ entry = parse_playtree(mpctx->stream, mpctx->mconfig, 0);
+ mpctx->eof=playtree_add_playlist(mpctx, entry);
goto goto_next_file;
+#endif
}
mpctx->stream->start_pos+=seek_to_byte;
@@ -3233,8 +3551,8 @@ if(stream_dump_type==5){
stream_seek(mpctx->stream,mpctx->stream->start_pos);
f=fopen(stream_dump_name,"wb");
if(!f){
- mp_msg(MSGT_CPLAYER,MSGL_FATAL,MSGTR_CantOpenDumpfile);
- exit_player(EXIT_ERROR);
+ mp_tmsg(MSGT_CPLAYER,MSGL_FATAL,"Cannot open dump file.\n");
+ exit_player(mpctx, EXIT_ERROR);
}
if (dvd_chapter > 1) {
int chapter = dvd_chapter - 1;
@@ -3244,8 +3562,8 @@ if(stream_dump_type==5){
len=stream_read(mpctx->stream,buf,4096);
if(len>0) {
if(fwrite(buf,len,1,f) != 1) {
- mp_msg(MSGT_MENCODER,MSGL_FATAL,MSGTR_ErrorWritingFile,stream_dump_name);
- exit_player(EXIT_ERROR);
+ mp_tmsg(MSGT_MENCODER,MSGL_FATAL,"%s: Error writing file.\n",stream_dump_name);
+ exit_player(mpctx, EXIT_ERROR);
}
}
if(dvd_last_chapter > 0) {
@@ -3256,18 +3574,18 @@ if(stream_dump_type==5){
}
}
if(fclose(f)) {
- mp_msg(MSGT_MENCODER,MSGL_FATAL,MSGTR_ErrorWritingFile,stream_dump_name);
- exit_player(EXIT_ERROR);
+ mp_tmsg(MSGT_MENCODER,MSGL_FATAL,"%s: Error writing file.\n",stream_dump_name);
+ exit_player(mpctx, EXIT_ERROR);
}
- mp_msg(MSGT_CPLAYER,MSGL_INFO,MSGTR_CoreDumped);
- exit_player_with_rc(EXIT_EOF, 0);
+ mp_tmsg(MSGT_CPLAYER,MSGL_INFO,"Core dumped ;)\n");
+ exit_player_with_rc(mpctx, EXIT_EOF, 0);
}
#ifdef CONFIG_DVDREAD
if(mpctx->stream->type==STREAMTYPE_DVD){
current_module="dvd lang->id";
- if(audio_id==-1) audio_id=dvd_aid_from_lang(mpctx->stream,audio_lang);
- if(dvdsub_lang && dvdsub_id==-1) dvdsub_id=dvd_sid_from_lang(mpctx->stream,dvdsub_lang);
+ if(opts->audio_id==-1) opts->audio_id=dvd_aid_from_lang(mpctx->stream,audio_lang);
+ if(dvdsub_lang && opts->sub_id==-1) opts->sub_id=dvd_sid_from_lang(mpctx->stream,dvdsub_lang);
// setup global sub numbering
mpctx->global_sub_indices[SUB_SOURCE_DEMUX] = mpctx->global_sub_size; // the global # of the first demux-specific sub.
mpctx->global_sub_size += dvd_number_of_subs(mpctx->stream);
@@ -3278,10 +3596,10 @@ if(mpctx->stream->type==STREAMTYPE_DVD){
#ifdef CONFIG_DVDNAV
if(mpctx->stream->type==STREAMTYPE_DVDNAV){
current_module="dvdnav lang->id";
- if(audio_id==-1) audio_id=mp_dvdnav_aid_from_lang(mpctx->stream,audio_lang);
+ if(opts->audio_id==-1) opts->audio_id=mp_dvdnav_aid_from_lang(mpctx->stream,audio_lang);
dvdsub_lang_id = -3;
- if(dvdsub_lang && dvdsub_id==-1)
- dvdsub_lang_id=dvdsub_id=mp_dvdnav_sid_from_lang(mpctx->stream,dvdsub_lang);
+ if(dvdsub_lang && opts->sub_id==-1)
+ dvdsub_lang_id = opts->sub_id = mp_dvdnav_sid_from_lang(mpctx->stream,dvdsub_lang);
// setup global sub numbering
mpctx->global_sub_indices[SUB_SOURCE_DEMUX] = mpctx->global_sub_size; // the global # of the first demux-specific sub.
mpctx->global_sub_size += mp_dvdnav_number_of_subs(mpctx->stream);
@@ -3298,13 +3616,13 @@ if(stream_cache_size>0){
stream_cache_size*1024*(stream_cache_min_percent / 100.0),
stream_cache_size*1024*(stream_cache_seek_min_percent / 100.0));
if(res == 0)
- if((mpctx->eof = libmpdemux_was_interrupted(PT_NEXT_ENTRY))) goto goto_next_file;
+ if((mpctx->stop_play = libmpdemux_was_interrupted(mpctx, PT_NEXT_ENTRY))) goto goto_next_file;
}
//============ Open DEMUXERS --- DETECT file type =======================
current_module="demux_open";
-mpctx->demuxer=demux_open(mpctx->stream,mpctx->file_format,audio_id,video_id,dvdsub_id,filename);
+mpctx->demuxer=demux_open(opts, mpctx->stream,mpctx->file_format,opts->audio_id,opts->video_id,opts->sub_id,mpctx->filename);
// HACK to get MOV Reference Files working
@@ -3325,20 +3643,20 @@ if (mpctx->demuxer && mpctx->demuxer->type==DEMUXER_TYPE_PLAYLIST)
if ((strlen(bname)>10) && !strncmp(bname,"qt",2) && !strncmp(bname+3,"gateQT",6))
continue;
- if (!strcmp(playlist_entry,filename)) // ignoring self-reference
+ if (!strcmp(playlist_entry, mpctx->filename)) // ignoring self-reference
continue;
entry = play_tree_new();
- if (filename && !strcmp(mp_basename(playlist_entry),playlist_entry)) // add reference path of current file
+ if (mpctx->filename && !strcmp(mp_basename(playlist_entry),playlist_entry)) // add reference path of current file
{
- temp=malloc((strlen(filename)-strlen(mp_basename(filename))+strlen(playlist_entry)+1));
+ temp=malloc((strlen(mpctx->filename)-strlen(mp_basename(mpctx->filename))+strlen(playlist_entry)+1));
if (temp)
{
- strncpy(temp, filename, strlen(filename)-strlen(mp_basename(filename)));
- temp[strlen(filename)-strlen(mp_basename(filename))]='\0';
+ strncpy(temp, mpctx->filename, strlen(mpctx->filename)-strlen(mp_basename(mpctx->filename)));
+ temp[strlen(mpctx->filename)-strlen(mp_basename(mpctx->filename))]='\0';
strcat(temp, playlist_entry);
- if (!strcmp(temp, filename)) {
+ if (!strcmp(temp, mpctx->filename)) {
free(temp);
continue;
}
@@ -3362,20 +3680,31 @@ if (mpctx->demuxer && mpctx->demuxer->type==DEMUXER_TYPE_PLAYLIST)
{
entry = play_tree_new();
play_tree_set_child(entry,list);
- mpctx->eof=playtree_add_playlist(entry);
+ mpctx->stop_play = playtree_add_playlist(mpctx, entry);
goto goto_next_file;
}
}
if(!mpctx->demuxer)
goto goto_next_file;
+
+ if (mpctx->demuxer->matroska_data.ordered_chapters)
+ build_ordered_chapter_timeline(mpctx);
+
+ if (!mpctx->sources) {
+ mpctx->sources = talloc_ptrtype(NULL, mpctx->sources);
+ *mpctx->sources = (struct content_source){.stream = mpctx->stream,
+ .demuxer = mpctx->demuxer};
+ mpctx->num_sources = 1;
+ }
+
if(dvd_chapter>1) {
- float pts;
- if (demuxer_seek_chapter(mpctx->demuxer, dvd_chapter-1, 1, &pts, NULL, NULL) >= 0 && pts > -1.0)
+ double pts;
+ if (seek_chapter(mpctx, dvd_chapter-1, &pts, NULL) >= 0 && pts > -1.0)
seek(mpctx, pts, SEEK_ABSOLUTE);
}
-initialized_flags|=INITIALIZED_DEMUXER;
+mpctx->initialized_flags|=INITIALIZED_DEMUXER;
if (mpctx->stream->type != STREAMTYPE_DVD && mpctx->stream->type != STREAMTYPE_DVDNAV) {
int i;
@@ -3384,23 +3713,26 @@ if (mpctx->stream->type != STREAMTYPE_DVD && mpctx->stream->type != STREAMTYPE_D
mpctx->global_sub_indices[SUB_SOURCE_DEMUX] = mpctx->global_sub_size; // the global # of the first demux-specific sub.
for (i = 0; i < MAX_S_STREAMS; i++)
if (mpctx->demuxer->s_streams[i])
- maxid = FFMAX(maxid, ((sh_sub_t *)mpctx->demuxer->s_streams[i])->sid);
+ maxid = FFMAX(maxid, mpctx->demuxer->s_streams[i]->sid);
mpctx->global_sub_size += maxid + 1;
}
-// Make dvdsub_id always selectable if set.
-if (mpctx->global_sub_size <= mpctx->global_sub_indices[SUB_SOURCE_DEMUX] + dvdsub_id)
- mpctx->global_sub_size = mpctx->global_sub_indices[SUB_SOURCE_DEMUX] + dvdsub_id + 1;
+// Make opts->sub_id always selectable if set.
+if (mpctx->global_sub_size <= mpctx->global_sub_indices[SUB_SOURCE_DEMUX] + opts->sub_id)
+ mpctx->global_sub_size = mpctx->global_sub_indices[SUB_SOURCE_DEMUX] + opts->sub_id + 1;
#ifdef CONFIG_ASS
-if (ass_enabled && ass_library) {
- for (i = 0; i < mpctx->demuxer->num_attachments; ++i) {
- demux_attachment_t* att = mpctx->demuxer->attachments + i;
- if (extract_embedded_fonts &&
- att->name && att->type && att->data && att->data_size &&
- (strcmp(att->type, "application/x-truetype-font") == 0 ||
- strcmp(att->type, "application/x-font") == 0))
- ass_add_font(ass_library, att->name, att->data, att->data_size);
- }
+if (opts->ass_enabled && ass_library) {
+ for (int j = 0; j < mpctx->num_sources; j++) {
+ struct demuxer *d = mpctx->sources[j].demuxer;
+ for (int i = 0; i < d->num_attachments; i++) {
+ struct demux_attachment *att = d->attachments + i;
+ if (use_embedded_fonts
+ && att->name && att->type && att->data && att->data_size
+ && (strcmp(att->type, "application/x-truetype-font") == 0
+ || strcmp(att->type, "application/x-font") == 0))
+ ass_add_font(ass_library, att->name, att->data, att->data_size);
+ }
+ }
}
#endif
@@ -3417,7 +3749,7 @@ if (ts_prog) {
mp_property_do("switch_program", M_PROPERTY_SET, &tmp, mpctx);
}
// select audio stream
-select_audio(mpctx->demuxer, audio_id, audio_lang);
+select_audio(mpctx->demuxer, opts->audio_id, audio_lang);
// DUMP STREAMS:
if((stream_dump_type)&&(stream_dump_type<4)){
@@ -3431,8 +3763,8 @@ if((stream_dump_type)&&(stream_dump_type<4)){
case 3: ds=mpctx->d_sub;break;
}
if(!ds){
- mp_msg(MSGT_CPLAYER,MSGL_FATAL,MSGTR_DumpSelectedStreamMissing);
- exit_player(EXIT_ERROR);
+ mp_tmsg(MSGT_CPLAYER,MSGL_FATAL,"dump: FATAL: Selected stream missing!\n");
+ exit_player(mpctx, EXIT_ERROR);
}
// disable other streams:
if(mpctx->d_audio && mpctx->d_audio!=ds) {ds_free_packs(mpctx->d_audio); mpctx->d_audio->id=-2; }
@@ -3441,8 +3773,8 @@ if((stream_dump_type)&&(stream_dump_type<4)){
// let's dump it!
f=fopen(stream_dump_name,"wb");
if(!f){
- mp_msg(MSGT_CPLAYER,MSGL_FATAL,MSGTR_CantOpenDumpfile);
- exit_player(EXIT_ERROR);
+ mp_tmsg(MSGT_CPLAYER,MSGL_FATAL,"Cannot open dump file.\n");
+ exit_player(mpctx, EXIT_ERROR);
}
while(!ds->eof){
unsigned char* start;
@@ -3457,8 +3789,8 @@ if((stream_dump_type)&&(stream_dump_type<4)){
}
}
fclose(f);
- mp_msg(MSGT_CPLAYER,MSGL_INFO,MSGTR_CoreDumped);
- exit_player_with_rc(EXIT_EOF, 0);
+ mp_tmsg(MSGT_CPLAYER,MSGL_INFO,"Core dumped ;)\n");
+ exit_player_with_rc(mpctx, EXIT_EOF, 0);
}
mpctx->sh_audio=mpctx->d_audio->sh;
@@ -3468,10 +3800,10 @@ if(mpctx->sh_video){
current_module="video_read_properties";
if(!video_read_properties(mpctx->sh_video)) {
- mp_msg(MSGT_CPLAYER,MSGL_ERR,MSGTR_CannotReadVideoProperties);
+ mp_tmsg(MSGT_CPLAYER,MSGL_ERR,"Video: Cannot read properties.\n");
mpctx->sh_video=mpctx->d_video->sh=NULL;
} else {
- mp_msg(MSGT_CPLAYER,MSGL_V,MSGTR_FilefmtFourccSizeFpsFtime,
+ mp_tmsg(MSGT_CPLAYER,MSGL_V,"[V] filefmt:%d fourcc:0x%X size:%dx%d fps:%5.3f ftime:=%6.4f\n",
mpctx->demuxer->file_format,mpctx->sh_video->format, mpctx->sh_video->disp_w,mpctx->sh_video->disp_h,
mpctx->sh_video->fps,mpctx->sh_video->frametime
);
@@ -3484,7 +3816,7 @@ if(mpctx->sh_video){
vo_fps = mpctx->sh_video->fps;
if(!mpctx->sh_video->fps && !force_fps){
- mp_msg(MSGT_CPLAYER,MSGL_ERR,MSGTR_FPSnotspecified);
+ mp_tmsg(MSGT_CPLAYER,MSGL_ERR,"FPS not specified in the header or invalid, use the -fps option.\n");
mpctx->sh_video=mpctx->d_video->sh=NULL;
}
}
@@ -3492,7 +3824,7 @@ if(mpctx->sh_video){
}
if(!mpctx->sh_video && !mpctx->sh_audio){
- mp_msg(MSGT_CPLAYER,MSGL_FATAL, MSGTR_NoStreamFound);
+ mp_tmsg(MSGT_CPLAYER,MSGL_FATAL, "No stream found.\n");
#ifdef CONFIG_DVBIN
if(mpctx->stream->type == STREAMTYPE_DVB)
{
@@ -3503,11 +3835,13 @@ if(!mpctx->sh_video && !mpctx->sh_audio){
else
dir = DVB_CHANNEL_LOWER;
- if(dvb_step_channel(mpctx->stream, dir))
- mpctx->eof = mpctx->dvbin_reopen = 1;
+ if(dvb_step_channel(mpctx->stream, dir)) {
+ mpctx->stop_play = PT_NEXT_ENTRY;
+ mpctx->dvbin_reopen = 1;
+ }
}
#endif
- goto goto_next_file; // exit_player(MSGTR_Exit_error);
+ goto goto_next_file; // exit_player(_("Fatal error"));
}
/* display clip info */
@@ -3516,26 +3850,25 @@ demux_info_print(mpctx->demuxer);
//================== Read SUBTITLES (DVD & TEXT) ==========================
if(vo_spudec==NULL && mpctx->sh_video &&
(mpctx->stream->type==STREAMTYPE_DVD || mpctx->stream->type == STREAMTYPE_DVDNAV)){
- init_vo_spudec();
+ init_vo_spudec(mpctx);
}
-if(1 || mpctx->sh_video) {
// after reading video params we should load subtitles because
// we know fps so now we can adjust subtitle time to ~6 seconds AST
// check .sub
- double fps = mpctx->sh_video ? mpctx->sh_video->fps : 25;
current_module="read_subtitles_file";
+ double sub_fps = mpctx->sh_video ? mpctx->sh_video->fps : 25;
if(sub_name){
for (i = 0; sub_name[i] != NULL; ++i)
- add_subtitles (sub_name[i], fps, 0);
+ add_subtitles(mpctx, sub_name[i], sub_fps, 0);
}
if(sub_auto) { // auto load sub file ...
char *psub = get_path( "sub/" );
- char **tmp = sub_filenames((psub ? psub : ""), filename);
+ char **tmp = sub_filenames((psub ? psub : ""), mpctx->filename);
int i = 0;
free(psub); // release the buffer created by get_path() above
while (tmp[i]) {
- add_subtitles (tmp[i], fps, 1);
+ add_subtitles(mpctx, tmp[i], sub_fps, 1);
free(tmp[i++]);
}
free(tmp);
@@ -3545,7 +3878,7 @@ if(1 || mpctx->sh_video) {
mpctx->global_sub_indices[SUB_SOURCE_SUBS] = mpctx->global_sub_size; // the global # of the first sub.
mpctx->global_sub_size += mpctx->set_of_sub_size;
}
-}
+
if (mpctx->global_sub_size) {
select_subtitle(mpctx);
@@ -3561,7 +3894,7 @@ if (mpctx->global_sub_size) {
}
mp_msg(MSGT_IDENTIFY,MSGL_INFO,"ID_FILENAME=%s\n",
- filename_recode(filename));
+ filename_recode(mpctx->filename));
mp_msg(MSGT_IDENTIFY,MSGL_INFO,"ID_DEMUXER=%s\n", mpctx->demuxer->desc->name);
if (mpctx->sh_video) {
/* Assume FOURCC if all bytes >= 0x20 (' ') */
@@ -3585,7 +3918,9 @@ if (mpctx->global_sub_size) {
mp_msg(MSGT_IDENTIFY,MSGL_INFO,"ID_AUDIO_RATE=%d\n", mpctx->sh_audio->samplerate);
mp_msg(MSGT_IDENTIFY,MSGL_INFO,"ID_AUDIO_NCH=%d\n", mpctx->sh_audio->channels);
}
- mp_msg(MSGT_IDENTIFY,MSGL_INFO,"ID_LENGTH=%.2lf\n", demuxer_get_time_length(mpctx->demuxer));
+ mp_msg(MSGT_IDENTIFY,MSGL_INFO,"ID_LENGTH=%.2f\n", mpctx->timeline ?
+ mpctx->timeline[mpctx->num_timeline_parts].start :
+ demuxer_get_time_length(mpctx->demuxer));
mp_msg(MSGT_IDENTIFY,MSGL_INFO,"ID_SEEKABLE=%d\n",
mpctx->stream->seek && (!mpctx->demuxer || mpctx->demuxer->seekable));
if (mpctx->demuxer) {
@@ -3596,14 +3931,14 @@ if (mpctx->global_sub_size) {
if(!mpctx->sh_video) goto main; // audio-only
-if(!reinit_video_chain()) {
+if(!reinit_video_chain(mpctx)) {
if(!mpctx->sh_video){
if(!mpctx->sh_audio) goto goto_next_file;
- goto main; // exit_player(MSGTR_Exit_error);
+ goto main; // exit_player(_("Fatal error"));
}
}
- if(vo_flags & 0x08 && vo_spudec)
+ if(mpctx->sh_video->output_flags & 0x08 && vo_spudec)
spudec_set_hw_spu(vo_spudec,mpctx->video_out);
#ifdef CONFIG_FREETYPE
@@ -3631,17 +3966,16 @@ if(verbose) term_osd = 0;
int frame_time_remaining=0; // flag
int blit_frame=0;
-mpctx->num_buffered_frames=0;
// Make sure old OSD does not stay around,
// e.g. with -fixed-vo and same-resolution files
clear_osd_msgs();
-update_osd_msg();
+update_osd_msg(mpctx);
//================ SETUP AUDIO ==========================
if(mpctx->sh_audio){
- reinit_audio_chain();
+ reinit_audio_chain(mpctx);
if (mpctx->sh_audio && mpctx->sh_audio->codec)
mp_msg(MSGT_IDENTIFY,MSGL_INFO, "ID_AUDIO_CODEC=%s\n", mpctx->sh_audio->codec->name);
}
@@ -3662,18 +3996,18 @@ if(mpctx->sh_audio){
}
if(!mpctx->sh_audio){
- mp_msg(MSGT_CPLAYER,MSGL_INFO,MSGTR_NoSound);
+ mp_tmsg(MSGT_CPLAYER,MSGL_INFO,"Audio: no sound\n");
mp_msg(MSGT_CPLAYER,MSGL_V,"Freeing %d unused audio chunks.\n",mpctx->d_audio->packs);
ds_free_packs(mpctx->d_audio); // free buffered chunks
//mpctx->d_audio->id=-2; // do not read audio chunks
- //uninit_player(INITIALIZED_AO); // close device
+ //uninit_player(mpctx, INITIALIZED_AO); // close device
}
if(!mpctx->sh_video){
- mp_msg(MSGT_CPLAYER,MSGL_INFO,MSGTR_Video_NoVideo);
+ mp_tmsg(MSGT_CPLAYER,MSGL_INFO,"Video: no video\n");
mp_msg(MSGT_CPLAYER,MSGL_V,"Freeing %d unused video chunks.\n",mpctx->d_video->packs);
ds_free_packs(mpctx->d_video);
mpctx->d_video->id=-2;
- //if(!fixed_vo) uninit_player(INITIALIZED_VO);
+ //if(!fixed_vo) uninit_player(mpctx, INITIALIZED_VO);
}
if (!mpctx->sh_video && !mpctx->sh_audio)
@@ -3683,48 +4017,38 @@ if (!mpctx->sh_video && !mpctx->sh_audio)
if(force_fps && mpctx->sh_video){
vo_fps = mpctx->sh_video->fps=force_fps;
mpctx->sh_video->frametime=1.0f/mpctx->sh_video->fps;
- mp_msg(MSGT_CPLAYER,MSGL_INFO,MSGTR_FPSforced,mpctx->sh_video->fps,mpctx->sh_video->frametime);
-}
-
-#ifdef CONFIG_GUI
-if ( use_gui ) {
- if ( mpctx->sh_audio ) guiIntfStruct.AudioType=mpctx->sh_audio->channels; else guiIntfStruct.AudioType=0;
- if ( !mpctx->sh_video && mpctx->sh_audio ) guiGetEvent( guiSetAudioOnly,(char *)1 ); else guiGetEvent( guiSetAudioOnly,(char *)0 );
- guiGetEvent( guiSetFileFormat,(char *)mpctx->demuxer->file_format );
- if ( guiGetEvent( guiSetValues,(char *)mpctx->sh_video ) ) goto goto_next_file;
- guiGetEvent( guiSetDemuxer,(char *)mpctx->demuxer );
+ mp_tmsg(MSGT_CPLAYER,MSGL_INFO,"FPS forced to be %5.3f (ftime: %5.3f).\n",mpctx->sh_video->fps,mpctx->sh_video->frametime);
}
-#endif
-mp_input_set_section(NULL);
+ mp_input_set_section(mpctx->input, NULL);
//TODO: add desired (stream-based) sections here
-if (mpctx->stream->type==STREAMTYPE_TV) mp_input_set_section("tv");
-if (mpctx->stream->type==STREAMTYPE_DVDNAV) mp_input_set_section("dvdnav");
+ if (mpctx->stream->type==STREAMTYPE_TV) mp_input_set_section(mpctx->input, "tv");
+ if (mpctx->stream->type==STREAMTYPE_DVDNAV) mp_input_set_section(mpctx->input, "dvdnav");
//==================== START PLAYING =======================
-if(mpctx->loop_times>1) mpctx->loop_times--; else
-if(mpctx->loop_times==1) mpctx->loop_times = -1;
+if(opts->loop_times>1) opts->loop_times--; else
+if(opts->loop_times==1) opts->loop_times = -1;
-mp_msg(MSGT_CPLAYER,MSGL_INFO,MSGTR_StartPlaying);
+mp_tmsg(MSGT_CPLAYER,MSGL_INFO,"Starting playback...\n");
total_time_usage_start=GetTimer();
audio_time_usage=0; video_time_usage=0; vout_time_usage=0;
total_frame_cnt=0; drop_frame_cnt=0; // fix for multifile fps benchmark
play_n_frames=play_n_frames_mf;
-mpctx->startup_decode_retry = DEFAULT_STARTUP_DECODE_RETRY;
if(play_n_frames==0){
- mpctx->eof=PT_NEXT_ENTRY; goto goto_next_file;
+ mpctx->stop_play=PT_NEXT_ENTRY; goto goto_next_file;
}
-if (seek_to_sec) {
+// If there's a timeline force an absolute seek to initialize state
+if (seek_to_sec || mpctx->timeline) {
seek(mpctx, seek_to_sec, SEEK_ABSOLUTE);
end_at.pos += seek_to_sec;
}
if (end_at.type == END_AT_SIZE) {
- mp_msg(MSGT_CPLAYER, MSGL_WARN, MSGTR_MPEndposNoSizeBased);
+ mp_tmsg(MSGT_CPLAYER, MSGL_WARN, "Option -endpos in MPlayer does not yet support size units.\n");
end_at.type = END_AT_NONE;
}
@@ -3736,11 +4060,21 @@ if (mpctx->stream->type == STREAMTYPE_DVDNAV) {
}
#endif
-while(!mpctx->eof){
+ get_relative_time(mpctx); // reset current delta
+ mpctx->time_frame = 0;
+ mpctx->drop_message_shown = 0;
+ mpctx->update_video_immediately = true;
+ mpctx->total_avsync_change = 0;
+ // Make sure VO knows current pause state
+ if (mpctx->sh_video)
+ vo_control(mpctx->video_out, mpctx->paused ? VOCTRL_PAUSE : VOCTRL_RESUME,
+ NULL);
+
+while(!mpctx->stop_play){
float aq_sleep_time=0;
if(dvd_last_chapter>0) {
- int cur_chapter = demuxer_get_current_chapter(mpctx->demuxer);
+ int cur_chapter = get_current_chapter(mpctx);
if(cur_chapter!=-1 && cur_chapter+1>dvd_last_chapter)
goto goto_next_file;
}
@@ -3748,16 +4082,16 @@ if(dvd_last_chapter>0) {
if(!mpctx->sh_audio && mpctx->d_audio->sh) {
mpctx->sh_audio = mpctx->d_audio->sh;
mpctx->sh_audio->ds = mpctx->d_audio;
- reinit_audio_chain();
+ reinit_audio_chain(mpctx);
}
/*========================== PLAY AUDIO ============================*/
-if (mpctx->sh_audio)
- if (!fill_audio_out_buffers())
+if (mpctx->sh_audio && !mpctx->paused)
+ if (!fill_audio_out_buffers(mpctx))
// at eof, all audio at least written to ao
if (!mpctx->sh_video)
- mpctx->eof = PT_NEXT_ENTRY;
+ mpctx->stop_play = AT_END_OF_FILE;
if(!mpctx->sh_video) {
@@ -3765,16 +4099,16 @@ if(!mpctx->sh_video) {
double a_pos=0;
// sh_audio can be NULL due to video stream switching
// TODO: handle this better
- if((!quiet || end_at.type == END_AT_TIME) && mpctx->sh_audio)
- a_pos = playing_audio_pts(mpctx->sh_audio, mpctx->d_audio, mpctx->audio_out);
+ if (mpctx->sh_audio)
+ a_pos = playing_audio_pts(mpctx);
- if(!quiet)
- print_status(a_pos, 0, 0);
+ print_status(mpctx, a_pos, false);
if(end_at.type == END_AT_TIME && end_at.pos < a_pos)
- mpctx->eof = PT_NEXT_ENTRY;
- update_subtitles(NULL, a_pos, mpctx->d_sub, 0);
- update_osd_msg();
+ mpctx->stop_play = PT_NEXT_ENTRY;
+ update_subtitles(mpctx, &mpctx->opts, NULL, a_pos, mpctx->video_offset,
+ mpctx->d_sub, 0);
+ update_osd_msg(mpctx);
} else {
@@ -3783,28 +4117,46 @@ if(!mpctx->sh_video) {
vo_pts=mpctx->sh_video->timer*90000.0;
vo_fps=mpctx->sh_video->fps;
- if (!mpctx->num_buffered_frames) {
- double frame_time = update_video(&blit_frame);
- while (!blit_frame && mpctx->startup_decode_retry > 0) {
- double delay = mpctx->delay;
- // these initial decode failures are probably due to codec delay,
- // ignore them and also their probably nonsense durations
- update_video(&blit_frame);
- mpctx->delay = delay;
- mpctx->startup_decode_retry--;
- }
- mpctx->startup_decode_retry = 0;
+ blit_frame = mpctx->video_out->frame_loaded;
+ if (!blit_frame) {
+ double frame_time = update_video(mpctx);
+ blit_frame = mpctx->video_out->frame_loaded;
mp_dbg(MSGT_AVSYNC,MSGL_DBG2,"*** ftime=%5.3f ***\n",frame_time);
if (mpctx->sh_video->vf_initialized < 0) {
- mp_msg(MSGT_CPLAYER,MSGL_FATAL, MSGTR_NotInitializeVOPorVO);
- mpctx->eof = 1; goto goto_next_file;
+ mp_tmsg(MSGT_CPLAYER,MSGL_FATAL, "\nFATAL: Could not initialize video filters (-vf) or video output (-vo).\n");
+ mpctx->stop_play = PT_NEXT_ENTRY;
+ goto goto_next_file;
+ }
+ if (blit_frame) {
+ struct sh_video *sh_video = mpctx->sh_video;
+ update_subtitles(mpctx, &mpctx->opts, sh_video, sh_video->pts,
+ mpctx->video_offset, mpctx->d_sub, 0);
+ update_teletext(sh_video, mpctx->demuxer, 0);
+ update_osd_msg(mpctx);
+ struct vf_instance *vf = mpctx->sh_video->vfilter;
+ vf->control(vf, VFCTRL_DRAW_EOSD, NULL);
+ vf->control(vf, VFCTRL_DRAW_OSD, mpctx->osd);
+ vo_osd_changed(0);
}
if (frame_time < 0)
- mpctx->eof = 1;
+ mpctx->stop_play = AT_END_OF_FILE;
else {
- // might return with !eof && !blit_frame if !correct_pts
- mpctx->num_buffered_frames += blit_frame;
- mpctx->time_frame += frame_time / playback_speed; // for nosound
+ if (mpctx->update_video_immediately) {
+ // Show this frame immediately, rest normally
+ mpctx->update_video_immediately = false;
+ } else {
+ mpctx->time_frame += frame_time / opts->playback_speed;
+ adjust_sync(mpctx, frame_time);
+ }
+ }
+ }
+ if (mpctx->timeline) {
+ struct timeline_part *next = mpctx->timeline + mpctx->timeline_part + 1;
+ if (mpctx->sh_video->pts >= next->start
+ || mpctx->stop_play == AT_END_OF_FILE
+ && mpctx->timeline_part + 1 < mpctx->num_timeline_parts) {
+ seek(mpctx, next->start, SEEK_ABSOLUTE);
+ continue;
}
}
@@ -3813,17 +4165,13 @@ if(!mpctx->sh_video) {
// current_module="draw_osd";
// if(vo_config_count) mpctx->video_out->draw_osd();
-#ifdef CONFIG_GUI
- if(use_gui) guiEventHandling();
-#endif
-
current_module="vo_check_events";
- if (vo_config_count) mpctx->video_out->check_events();
+ vo_check_events(mpctx->video_out);
#ifdef CONFIG_X11
if (stop_xscreensaver) {
current_module = "stop_xscreensaver";
- xscreensaver_heartbeat();
+ xscreensaver_heartbeat(mpctx->x11_state);
}
#endif
if (heartbeat_cmd) {
@@ -3835,22 +4183,42 @@ if(!mpctx->sh_video) {
}
}
- frame_time_remaining = sleep_until_update(&mpctx->time_frame, &aq_sleep_time);
+ frame_time_remaining = sleep_until_update(mpctx, &mpctx->time_frame, &aq_sleep_time);
//====================== FLIP PAGE (VIDEO BLT): =========================
current_module="flip_page";
if (!frame_time_remaining && blit_frame) {
unsigned int t2=GetTimer();
-
- if(vo_config_count) mpctx->video_out->flip_page();
- mpctx->num_buffered_frames--;
-
- vout_time_usage += (GetTimer() - t2) * 0.000001;
+ unsigned int pts_us = mpctx->last_time + mpctx->time_frame * 1e6;
+ int duration = -1;
+ double pts2 = mpctx->video_out->next_pts2;
+ if (pts2 != MP_NOPTS_VALUE && opts->correct_pts) {
+ // expected A/V sync correction is ignored
+ double diff = (pts2 - mpctx->sh_video->pts);
+ diff /= opts->playback_speed;
+ if (mpctx->time_frame < 0)
+ diff += mpctx->time_frame;
+ if (diff < 0)
+ diff = 0;
+ if (diff > 10)
+ diff = 10;
+ duration = diff * 1e6;
+ }
+ vo_flip_page(mpctx->video_out, pts_us|1, duration);
+
+ mpctx->last_vo_flip_duration = (GetTimer() - t2) * 0.000001;
+ vout_time_usage += mpctx->last_vo_flip_duration;
+ if (mpctx->video_out->driver->flip_page_timed) {
+ // No need to adjust sync based on flip speed
+ mpctx->last_vo_flip_duration = 0;
+ // For print_status - VO call finishing early is OK for sync
+ mpctx->time_frame -= get_relative_time(mpctx);
+ }
+ print_status(mpctx, MP_NOPTS_VALUE, true);
}
-//====================== A-V TIMESTAMP CORRECTION: =========================
-
- adjust_sync_and_print_status(frame_time_remaining, mpctx->time_frame);
+ else
+ print_status(mpctx, MP_NOPTS_VALUE, false);
//============================ Auto QUALITY ============================
@@ -3872,16 +4240,24 @@ if(auto_quality>0){
set_video_quality(mpctx->sh_video,output_quality);
}
- if (play_n_frames >= 0 && !frame_time_remaining && blit_frame) {
- --play_n_frames;
- if (play_n_frames <= 0) mpctx->eof = PT_NEXT_ENTRY;
+ if (!frame_time_remaining && blit_frame) {
+ if (play_n_frames >= 0) {
+ --play_n_frames;
+ if (play_n_frames <= 0)
+ mpctx->stop_play = PT_NEXT_ENTRY;
+ }
+ if (mpctx->step_frames > 0) {
+ mpctx->step_frames--;
+ if (mpctx->step_frames == 0)
+ pause_player(mpctx);
+ }
}
// FIXME: add size based support for -endpos
if (end_at.type == END_AT_TIME &&
!frame_time_remaining && end_at.pos <= mpctx->sh_video->pts)
- mpctx->eof = PT_NEXT_ENTRY;
+ mpctx->stop_play = PT_NEXT_ENTRY;
} // end if(mpctx->sh_video)
@@ -3902,102 +4278,73 @@ if(auto_quality>0){
}
#endif
-//============================ Handle PAUSE ===============================
-
- current_module="pause";
-
- if (mpctx->osd_function == OSD_PAUSE) {
- mpctx->was_paused = 1;
- pause_loop();
- }
-
-// handle -sstep
-if(step_sec>0) {
- mpctx->osd_function=OSD_FFW;
- rel_seek_secs+=step_sec;
-}
-
- edl_update(mpctx);
-
//================= Keyboard events, SEEKing ====================
current_module="key_events";
{
+ while (1) {
mp_cmd_t* cmd;
- int brk_cmd = 0;
- while( !brk_cmd && (cmd = mp_input_get_cmd(0,0,0)) != NULL) {
- brk_cmd = run_command(mpctx, cmd);
+ while ((cmd = mp_input_get_cmd(mpctx->input, 0,0,0)) != NULL) {
+ run_command(mpctx, cmd);
mp_cmd_free(cmd);
- if (brk_cmd == 2)
- goto goto_enable_cache;
+ if (mpctx->stop_play)
+ break;
+ }
+ if (!mpctx->paused || mpctx->stop_play || mpctx->rel_seek_secs
+ || mpctx->abs_seek_pos)
+ break;
+ if (mpctx->sh_video) {
+ update_osd_msg(mpctx);
+ int hack = vo_osd_changed(0);
+ vo_osd_changed(hack);
+ if (hack)
+ if (redraw_osd(mpctx->sh_video, mpctx->osd) < 0) {
+ add_step_frame(mpctx);
+ break;
+ }
+ else
+ vo_osd_changed(0);
+ }
+ pause_loop(mpctx);
}
}
- mpctx->was_paused = 0;
+
+// handle -sstep
+if (step_sec > 0 && !mpctx->paused) {
+ mpctx->osd_function=OSD_FFW;
+ mpctx->rel_seek_secs+=step_sec;
+}
+
+ edl_update(mpctx);
/* Looping. */
- if(mpctx->eof==1 && mpctx->loop_times>=0) {
- mp_msg(MSGT_CPLAYER,MSGL_V,"loop_times = %d, eof = %d\n", mpctx->loop_times,mpctx->eof);
+ if(mpctx->stop_play==AT_END_OF_FILE && opts->loop_times>=0) {
+ mp_msg(MSGT_CPLAYER,MSGL_V,"loop_times = %d\n", opts->loop_times);
- if(mpctx->loop_times>1) mpctx->loop_times--; else
- if(mpctx->loop_times==1) mpctx->loop_times=-1;
+ if(opts->loop_times>1) opts->loop_times--; else
+ if(opts->loop_times==1) opts->loop_times=-1;
play_n_frames=play_n_frames_mf;
- mpctx->eof=0;
- abs_seek_pos=SEEK_ABSOLUTE; rel_seek_secs=seek_to_sec;
- loop_seek = 1;
+ mpctx->stop_play=0;
+ mpctx->abs_seek_pos=SEEK_ABSOLUTE; mpctx->rel_seek_secs=seek_to_sec;
}
-if(rel_seek_secs || abs_seek_pos){
- if (seek(mpctx, rel_seek_secs, abs_seek_pos) >= 0) {
- // Set OSD:
- if(!loop_seek){
- if( !edl_decision )
- set_osd_bar(0,"Position",0,100,demuxer_get_percent_pos(mpctx->demuxer));
- }
- }
+if(mpctx->rel_seek_secs || mpctx->abs_seek_pos){
+ seek(mpctx, mpctx->rel_seek_secs, mpctx->abs_seek_pos);
- rel_seek_secs=0;
- abs_seek_pos=0;
- loop_seek=0;
- edl_decision = 0;
+ mpctx->rel_seek_secs=0;
+ mpctx->abs_seek_pos=0;
}
-#ifdef CONFIG_GUI
- if(use_gui){
- guiEventHandling();
- if(mpctx->demuxer->file_format==DEMUXER_TYPE_AVI && mpctx->sh_video && mpctx->sh_video->video.dwLength>2){
- // get pos from frame number / total frames
- guiIntfStruct.Position=(float)mpctx->d_video->pack_no*100.0f/mpctx->sh_video->video.dwLength;
- } else {
- guiIntfStruct.Position=demuxer_get_percent_pos(mpctx->demuxer);
- }
- if ( mpctx->sh_video ) guiIntfStruct.TimeSec=mpctx->sh_video->pts;
- else if ( mpctx->sh_audio ) guiIntfStruct.TimeSec=playing_audio_pts(mpctx->sh_audio, mpctx->d_audio, mpctx->audio_out);
- guiIntfStruct.LengthInSec=demuxer_get_time_length(mpctx->demuxer);
- guiGetEvent( guiReDraw,NULL );
- guiGetEvent( guiSetVolume,NULL );
- if(guiIntfStruct.Playing==0) break; // STOP
- if(guiIntfStruct.Playing==2) mpctx->osd_function=OSD_PAUSE;
- if ( guiIntfStruct.DiskChanged || guiIntfStruct.NewPlay ) goto goto_next_file;
-#ifdef CONFIG_DVDREAD
- if ( mpctx->stream->type == STREAMTYPE_DVD )
- {
- dvd_priv_t * dvdp = mpctx->stream->priv;
- guiIntfStruct.DVD.current_chapter=dvd_chapter_from_cell(dvdp,guiIntfStruct.DVD.current_title-1, dvdp->cur_cell)+1;
- }
-#endif
- }
-#endif /* CONFIG_GUI */
+} // while(!mpctx->stop_play)
-} // while(!mpctx->eof)
-
-mp_msg(MSGT_GLOBAL,MSGL_V,"EOF code: %d \n",mpctx->eof);
+mp_msg(MSGT_GLOBAL,MSGL_V,"EOF code: %d \n",mpctx->stop_play);
#ifdef CONFIG_DVBIN
if(mpctx->dvbin_reopen)
{
- mpctx->eof = 0;
- uninit_player(INITIALIZED_ALL-(INITIALIZED_GUI|INITIALIZED_STREAM|INITIALIZED_INPUT|INITIALIZED_GETCH2|(fixed_vo?INITIALIZED_VO:0)));
+ mpctx->stop_play = 0;
+ uninit_player(mpctx, INITIALIZED_ALL-(INITIALIZED_STREAM|INITIALIZED_GETCH2|(opts->fixed_vo?INITIALIZED_VO:0)));
cache_uninit(mpctx->stream);
mpctx->dvbin_reopen = 0;
goto goto_enable_cache;
@@ -4035,7 +4382,7 @@ if(benchmark){
}
// time to uninit all, except global stuff:
-uninit_player(INITIALIZED_ALL-(INITIALIZED_GUI+INITIALIZED_INPUT+(fixed_vo?INITIALIZED_VO:0)));
+uninit_player(mpctx, INITIALIZED_ALL-(opts->fixed_vo?INITIALIZED_VO:0));
if(mpctx->set_of_sub_size > 0) {
current_module="sub_free";
@@ -4056,38 +4403,36 @@ if(ass_library)
ass_clear_fonts(ass_library);
#endif
-if(mpctx->eof == PT_NEXT_ENTRY || mpctx->eof == PT_PREV_ENTRY) {
- mpctx->eof = mpctx->eof == PT_NEXT_ENTRY ? 1 : -1;
- if(play_tree_iter_step(mpctx->playtree_iter,mpctx->play_tree_step,0) == PLAY_TREE_ITER_ENTRY) {
- mpctx->eof = 1;
- } else {
+ if (!mpctx->stop_play) // In case some goto jumped here...
+ mpctx->stop_play = PT_NEXT_ENTRY;
+
+int playtree_direction = 1;
+
+if(mpctx->stop_play == PT_NEXT_ENTRY || mpctx->stop_play == PT_PREV_ENTRY) {
+ if(play_tree_iter_step(mpctx->playtree_iter,mpctx->play_tree_step,0) != PLAY_TREE_ITER_ENTRY) {
play_tree_iter_free(mpctx->playtree_iter);
mpctx->playtree_iter = NULL;
}
mpctx->play_tree_step = 1;
-} else if(mpctx->eof == PT_UP_NEXT || mpctx->eof == PT_UP_PREV) {
- mpctx->eof = mpctx->eof == PT_UP_NEXT ? 1 : -1;
+} else if(mpctx->stop_play == PT_UP_NEXT || mpctx->stop_play == PT_UP_PREV) {
+ int direction = mpctx->stop_play == PT_UP_NEXT ? 1 : -1;
if(mpctx->playtree_iter) {
- if(play_tree_iter_up_step(mpctx->playtree_iter,mpctx->eof,0) == PLAY_TREE_ITER_ENTRY) {
- mpctx->eof = 1;
- } else {
+ if(play_tree_iter_up_step(mpctx->playtree_iter,direction,0) != PLAY_TREE_ITER_ENTRY) {
play_tree_iter_free(mpctx->playtree_iter);
mpctx->playtree_iter = NULL;
}
}
-} else if (mpctx->eof == PT_STOP) {
+} else if (mpctx->stop_play == PT_STOP) {
play_tree_iter_free(mpctx->playtree_iter);
mpctx->playtree_iter = NULL;
} else { // NEXT PREV SRC
- mpctx->eof = mpctx->eof == PT_PREV_SRC ? -1 : 1;
+ playtree_direction = mpctx->stop_play == PT_PREV_SRC ? -1 : 1;
}
-if(mpctx->eof == 0) mpctx->eof = 1;
-
while(mpctx->playtree_iter != NULL) {
- filename = play_tree_iter_get_file(mpctx->playtree_iter,mpctx->eof);
- if(filename == NULL) {
- if(play_tree_iter_step(mpctx->playtree_iter,mpctx->eof,0) != PLAY_TREE_ITER_ENTRY) {
+ mpctx->filename = play_tree_iter_get_file(mpctx->playtree_iter, playtree_direction);
+ if(mpctx->filename == NULL) {
+ if(play_tree_iter_step(mpctx->playtree_iter, playtree_direction, 0) != PLAY_TREE_ITER_ENTRY) {
play_tree_iter_free(mpctx->playtree_iter);
mpctx->playtree_iter = NULL;
};
@@ -4095,23 +4440,14 @@ while(mpctx->playtree_iter != NULL) {
break;
}
-#ifdef CONFIG_GUI
-if(use_gui && !mpctx->playtree_iter) {
-#ifdef CONFIG_DVDREAD
- if(!guiIntfStruct.DiskChanged)
-#endif
- mplEnd();
-}
-#endif
-
-if(use_gui || mpctx->playtree_iter != NULL || player_idle_mode){
- if(!mpctx->playtree_iter) filename = NULL;
- mpctx->eof = 0;
+if(mpctx->playtree_iter != NULL || player_idle_mode){
+ if(!mpctx->playtree_iter) mpctx->filename = NULL;
+ mpctx->stop_play = 0;
goto play_next_file;
}
-exit_player_with_rc(EXIT_EOF, 0);
+exit_player_with_rc(mpctx, EXIT_EOF, 0);
return 1;
}
diff --git a/mplayer.h b/mplayer.h
index 2f67959be5..a31da35e3c 100644
--- a/mplayer.h
+++ b/mplayer.h
@@ -19,6 +19,8 @@
#ifndef MPLAYER_MPLAYER_H
#define MPLAYER_MPLAYER_H
+#include "mp_msg.h"
+
extern char* current_module;
extern char * dvd_device;
@@ -32,13 +34,11 @@ extern char * video_driver;
extern char * audio_driver;
extern float audio_delay;
-extern int osd_level;
extern unsigned int osd_visible;
extern char * font_name;
extern char * sub_font_name;
extern float font_factor;
-extern float movie_aspect;
extern double force_fps;
//extern char **sub_name;
@@ -46,25 +46,22 @@ extern float sub_delay;
extern float sub_fps;
extern int sub_auto;
-extern char * filename;
-
extern int stream_cache_size;
extern int autosync;
-// libmpcodecs:
-extern int fullscreen;
-extern int flip;
-
extern int frame_dropping;
extern int auto_quality;
-extern int audio_id;
-extern int video_id;
-extern int dvdsub_id;
extern int vobsub_id;
-void exit_player(const char* how);
-void update_set_of_subtitles(void);
+static inline void exit_player_bad(const char *how)
+{
+ if (how)
+ mp_msg(MSGT_CPLAYER, MSGL_INFO, "Deprecated exit call: %s", how);
+ exit(1);
+}
+
+struct MPContext;
#endif /* MPLAYER_MPLAYER_H */
diff --git a/options.h b/options.h
new file mode 100644
index 0000000000..90ce239e86
--- /dev/null
+++ b/options.h
@@ -0,0 +1,84 @@
+#ifndef MPLAYER_OPTIONS_H
+#define MPLAYER_OPTIONS_H
+
+typedef struct MPOpts {
+ char **video_driver_list;
+ char **audio_driver_list;
+ int fixed_vo;
+ int vo_ontop;
+ int screen_size_x;
+ int screen_size_y;
+ int vo_screenwidth;
+ int vo_screenheight;
+ int force_window_position;
+ float force_monitor_aspect;
+ float monitor_pixel_aspect;
+ int vidmode;
+ int fullscreen;
+ int vo_dbpp;
+ float vo_panscanrange;
+
+ // ranges -100 - 100, 1000 if the vo default should be used
+ int vo_gamma_gamma;
+ int vo_gamma_brightness;
+ int vo_gamma_contrast;
+ int vo_gamma_saturation;
+ int vo_gamma_hue;
+
+ int osd_level;
+ int osd_duration;
+ int loop_times;
+ int ordered_chapters;
+ int edition_id;
+ int correct_pts;
+ int user_correct_pts;
+ int user_pts_assoc_mode;
+ int key_fifo_size;
+ int doubleclick_time;
+ int audio_id;
+ int video_id;
+ int sub_id;
+ float playback_speed;
+ struct m_obj_settings *vf_settings;
+ int softzoom;
+ float movie_aspect;
+ float screen_size_xy;
+ int flip;
+ int vd_use_slices;
+ int ass_enabled;
+ struct lavc_param {
+ int workaround_bugs;
+ int error_resilience;
+ int error_concealment;
+ int gray;
+ int vstats;
+ int idct_algo;
+ int debug;
+ int vismv;
+ int skip_top;
+ int skip_bottom;
+ int fast;
+ char *lowres_str;
+ char *skip_loop_filter_str;
+ char *skip_idct_str;
+ char *skip_frame_str;
+ int threads;
+ int bitexact;
+ char *avopt;
+ } lavc_param;
+ struct input_conf {
+ char *config_file;
+ unsigned int ar_delay;
+ unsigned int ar_rate;
+ char *js_dev;
+ char *ar_dev;
+ char *in_file;
+ int use_joystick;
+ int use_lirc;
+ int use_lircc;
+ int use_ar; // apple remote
+ int default_bindings;
+ } input;
+} MPOpts;
+
+#endif
diff --git a/osdep/findfiles.c b/osdep/findfiles.c
new file mode 100644
index 0000000000..879f6d5c98
--- /dev/null
+++ b/osdep/findfiles.c
@@ -0,0 +1,97 @@
+/*
+ * 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.
+ */
+
+#include <dirent.h>
+#include <string.h>
+#include <stdlib.h>
+#include <assert.h>
+
+#include "talloc.h"
+
+#if defined(__MINGW32__) || defined(__CYGWIN__)
+static const char dir_separators[] = "/\\:";
+#else
+static const char dir_separators[] = "/";
+#endif
+
+char **find_files(const char *original_file, const char *suffix,
+ int *num_results_ptr)
+{
+ void *tmpmem = talloc_new(NULL);
+ char *fname = talloc_strdup(tmpmem, original_file);
+ char *basename = NULL;
+ char *next = fname;
+ while (1) {
+ next = strpbrk(next, dir_separators);
+ if (!next)
+ break;
+ basename = next++;
+ }
+ char *directory;
+ if (basename) {
+ directory = fname;
+ *basename++ = 0;
+ } else {
+ directory = ".";
+ basename = fname;
+ }
+
+
+ char **results = talloc_size(NULL, 0);
+ DIR *dp = opendir(directory);
+ struct dirent *ep;
+ char ***names_by_matchlen = talloc_array(tmpmem, char **,
+ strlen(basename) + 1);
+ memset(names_by_matchlen, 0, talloc_get_size(names_by_matchlen));
+ int num_results = 0;
+ while ((ep = readdir(dp))) {
+ int suffix_offset = strlen(ep->d_name) - strlen(suffix);
+ // name must end with suffix
+ if (suffix_offset < 0 || strcmp(ep->d_name + suffix_offset, suffix))
+ continue;
+ // don't list the original name
+ if (!strcmp(ep->d_name, basename))
+ continue;
+
+ char *name = talloc_asprintf(results, "%s/%s", directory, ep->d_name);
+ char *s1 = ep->d_name;
+ char *s2 = basename;
+ int matchlen = 0;
+ while (*s1 && *s1++ == *s2++)
+ matchlen++;
+ int oldcount = talloc_get_size(names_by_matchlen[matchlen]) /
+ sizeof(char **);
+ names_by_matchlen[matchlen] = talloc_realloc(names_by_matchlen,
+ names_by_matchlen[matchlen],
+ char *, oldcount + 1);
+ names_by_matchlen[matchlen][oldcount] = name;
+ num_results++;
+ }
+ closedir(dp);
+ results = talloc_realloc(NULL, results, char *, num_results);
+ char **resptr = results;
+ for (int i = strlen(basename); i >= 0; i--) {
+ char **p = names_by_matchlen[i];
+ for (int j = 0; j < talloc_get_size(p) / sizeof(char *); j++)
+ *resptr++ = p[j];
+ }
+ assert(resptr == results + num_results);
+ talloc_free(tmpmem);
+ *num_results_ptr = num_results;
+ return results;
+}
diff --git a/osdep/findfiles.h b/osdep/findfiles.h
new file mode 100644
index 0000000000..97443e7319
--- /dev/null
+++ b/osdep/findfiles.h
@@ -0,0 +1,2 @@
+char **find_files(const char *original_file, const char *suffix,
+ int *num_results_ptr);
diff --git a/osdep/getch2-os2.c b/osdep/getch2-os2.c
index 272d2d45e9..27ebfaa354 100644
--- a/osdep/getch2-os2.c
+++ b/osdep/getch2-os2.c
@@ -32,6 +32,7 @@
#include "keycodes.h"
#include "input/input.h"
#include "mp_fifo.h"
+#include "getch2.h"
#if defined(HAVE_LANGINFO) && defined(CONFIG_ICONV)
#include <locale.h>
@@ -164,13 +165,13 @@ static int getch2_internal( void )
return -1;
}
-void getch2( void )
+void getch2(struct mp_fifo *fifo)
{
int key;
key = getch2_internal();
if( key != -1 )
- mplayer_put_key( key );
+ mplayer_put_key(fifo, key);
}
void getch2_enable( void )
@@ -197,4 +198,3 @@ char *get_term_charset( void )
return charset;
}
#endif
-
diff --git a/osdep/getch2-win.c b/osdep/getch2-win.c
index 3c428834ff..9dae9cd91d 100644
--- a/osdep/getch2-win.c
+++ b/osdep/getch2-win.c
@@ -30,6 +30,8 @@
#include "keycodes.h"
#include "input/input.h"
#include "mp_fifo.h"
+#include "getch2.h"
+
// HACK, stdin is used as something else below
#undef stdin
@@ -139,11 +141,11 @@ static int getch2_internal(void)
return -1;
}
-void getch2(void)
+void getch2(struct mp_fifo *fifo)
{
int r = getch2_internal();
if (r >= 0)
- mplayer_put_key(r);
+ mplayer_put_key(fifo, r);
}
void getch2_enable(void)
diff --git a/osdep/getch2.c b/osdep/getch2.c
index 4a591da2db..4aa09323eb 100644
--- a/osdep/getch2.c
+++ b/osdep/getch2.c
@@ -58,6 +58,7 @@
#include "mp_fifo.h"
#include "keycodes.h"
+#include "getch2.h"
#ifdef HAVE_TERMIOS
static struct termios tio_orig;
@@ -116,7 +117,7 @@ int load_termcap(char *termtype){
screen_height=tgetnum("li");
if(screen_width<1 || screen_width>255) screen_width=80;
if(screen_height<1 || screen_height>255) screen_height=24;
- erase_to_end_of_line= tgetstr("cd",&term_p);
+ erase_to_end_of_line= tgetstr("ce",&term_p);
termcap_add("kP",KEY_PGUP);
termcap_add("kN",KEY_PGDWN);
@@ -155,7 +156,7 @@ void get_screen_size(void){
#endif
}
-void getch2(void)
+void getch2(struct mp_fifo *fifo)
{
int retval = read(0, &getch2_buf[getch2_len], BUF_LEN-getch2_len);
if (retval < 1)
@@ -264,7 +265,7 @@ void getch2(void)
getch2_len -= len;
for (i = 0; i < getch2_len; i++)
getch2_buf[i] = getch2_buf[len+i];
- mplayer_put_key(code);
+ mplayer_put_key(fifo, code);
}
}
@@ -303,4 +304,3 @@ char* get_term_charset(void)
return charset;
}
#endif
-
diff --git a/osdep/getch2.h b/osdep/getch2.h
index f6f416b2a7..1156aedf7a 100644
--- a/osdep/getch2.h
+++ b/osdep/getch2.h
@@ -42,7 +42,8 @@ void getch2_enable(void);
void getch2_disable(void);
/* Read a character or a special key code (see keycodes.h) */
-void getch2(void);
+struct mp_fifo;
+void getch2(struct mp_fifo *fifo);
/* slave cmd function for Windows and OS/2 */
int mp_input_slave_cmd_func(int fd,char* dest,int size);
diff --git a/osdep/mmap_anon.c b/osdep/mmap_anon.c
index 727761cb6c..d5b3a3dd2f 100644
--- a/osdep/mmap_anon.c
+++ b/osdep/mmap_anon.c
@@ -27,6 +27,8 @@
#include <fcntl.h>
#include <sys/mman.h>
+#include "mmap_anon.h"
+
#if defined(MAP_ANON) && !defined(MAP_ANONYMOUS)
#define MAP_ANONYMOUS MAP_ANON
#endif
diff --git a/osdep/mplayer.rc b/osdep/mplayer.rc
index 9014d37ca7..7e166b9c6f 100644
--- a/osdep/mplayer.rc
+++ b/osdep/mplayer.rc
@@ -51,4 +51,3 @@ FILETYPE VFT_APP
}
IDI_ICON1 ICON DISCARDABLE "etc/mplayer.ico"
-
diff --git a/osdep/priority.c b/osdep/priority.c
index 7a75153fa0..7a21868ddf 100644
--- a/osdep/priority.c
+++ b/osdep/priority.c
@@ -73,7 +73,7 @@ void set_priority(void)
if (strcasecmp(priority_presets_defs[i].name, proc_priority) == 0)
break;
}
- mp_msg(MSGT_CPLAYER, MSGL_STATUS, MSGTR_SettingProcessPriority,
+ mp_tmsg(MSGT_CPLAYER, MSGL_STATUS, "Setting process priority: %s\n",
priority_presets_defs[i].name);
#ifdef __OS2__
@@ -86,4 +86,3 @@ void set_priority(void)
#endif
}
}
-
diff --git a/osdep/priority.h b/osdep/priority.h
index cb4bc56c3f..1a74f95665 100644
--- a/osdep/priority.h
+++ b/osdep/priority.h
@@ -28,4 +28,3 @@ extern char *proc_priority;
void set_priority(void);
#endif /* MPLAYER_PRIORITY_H */
-
diff --git a/osdep/shmem.c b/osdep/shmem.c
index 9788d02bc5..f1cec1be37 100644
--- a/osdep/shmem.c
+++ b/osdep/shmem.c
@@ -50,6 +50,8 @@
#include <sys/shm.h>
#endif
+#include "shmem.h"
+
#if defined(MAP_ANONYMOUS) && !defined(MAP_ANON)
#define MAP_ANON MAP_ANONYMOUS
#endif
diff --git a/osdep/timer-darwin.c b/osdep/timer-darwin.c
index c292852c27..e0b4622c00 100644
--- a/osdep/timer-darwin.c
+++ b/osdep/timer-darwin.c
@@ -27,10 +27,9 @@
#include "timer.h"
/* global variables */
-static double relative_time;
static double timebase_ratio;
-const char *timer_name = "Darwin accurate";
+const char timer_name[] = "Darwin accurate";
@@ -63,19 +62,6 @@ unsigned int GetTimerMS(void)
return (unsigned int)(uint64_t)(mach_absolute_time() * timebase_ratio * 1e3);
}
-/* time spent between now and last call in seconds */
-float GetRelativeTime(void)
-{
- double last_time = relative_time;
-
- if (!relative_time)
- InitTimer();
-
- relative_time = mach_absolute_time() * timebase_ratio;
-
- return (float)(relative_time-last_time);
-}
-
/* initialize timer, must be called at least once at start */
void InitTimer(void)
{
@@ -84,8 +70,6 @@ void InitTimer(void)
mach_timebase_info(&timebase);
timebase_ratio = (double)timebase.numer / (double)timebase.denom
* (double)1e-9;
-
- relative_time = (double)(mach_absolute_time() * timebase_ratio);
}
#if 0
diff --git a/osdep/timer-linux.c b/osdep/timer-linux.c
index 8c1af557a0..073ca84182 100644
--- a/osdep/timer-linux.c
+++ b/osdep/timer-linux.c
@@ -27,8 +27,9 @@
#include <time.h>
#include <sys/time.h>
#include "config.h"
+#include "timer.h"
-const char *timer_name =
+const char timer_name[] =
#ifdef HAVE_NANOSLEEP
"nanosleep()";
#else
@@ -50,52 +51,20 @@ int usec_sleep(int usec_delay)
// Returns current time in microseconds
unsigned int GetTimer(void)
{
- struct timeval tv;
- //float s;
- gettimeofday(&tv,NULL);
- //s = tv.tv_usec; s *= 0.000001; s += tv.tv_sec;
- return tv.tv_sec * 1000000 + tv.tv_usec;
+ struct timeval tv;
+ gettimeofday(&tv,NULL);
+ return tv.tv_sec * 1000000 + tv.tv_usec;
}
// Returns current time in milliseconds
unsigned int GetTimerMS(void)
{
- struct timeval tv;
- //float s;
- gettimeofday(&tv,NULL);
- //s = tv.tv_usec; s *= 0.000001; s += tv.tv_sec;
- return tv.tv_sec * 1000 + tv.tv_usec / 1000;
-}
-
-static unsigned int RelativeTime = 0;
-
-// Returns time spent between now and last call in seconds
-float GetRelativeTime(void)
-{
- unsigned int t,r;
- t = GetTimer();
- //t *= 16; printf("time = %ud\n", t);
- r = t - RelativeTime;
- RelativeTime = t;
- return (float) r * 0.000001F;
+ struct timeval tv;
+ gettimeofday(&tv,NULL);
+ return tv.tv_sec * 1000 + tv.tv_usec / 1000;
}
// Initialize timer, must be called at least once at start
void InitTimer(void)
{
- GetRelativeTime();
}
-
-
-#if 0
-#include <stdio.h>
-int main(void)
-{
- float t = 0;
- InitTimer();
- while (1) {
- t += GetRelativeTime();
- printf("time = %10.6f\r", t);
- fflush(stdout); }
-}
-#endif
diff --git a/osdep/timer-win2.c b/osdep/timer-win2.c
index 100a3b6868..ac8eaa1bd6 100644
--- a/osdep/timer-win2.c
+++ b/osdep/timer-win2.c
@@ -22,7 +22,7 @@
#include <mmsystem.h>
#include "timer.h"
-const char *timer_name = "Windows native";
+const char timer_name[] = "Windows native";
// Returns current time in microseconds
unsigned int GetTimer(void)
@@ -45,18 +45,6 @@ int usec_sleep(int usec_delay){
return 0;
}
-static DWORD RelativeTime = 0;
-
-float GetRelativeTime(void)
-{
- DWORD t, r;
- t = GetTimer();
- r = t - RelativeTime;
- RelativeTime = t;
- return (float) r *0.000001F;
-}
-
void InitTimer(void)
{
- GetRelativeTime();
}
diff --git a/osdep/timer.h b/osdep/timer.h
index 2e4f2fc8fe..c3925041ca 100644
--- a/osdep/timer.h
+++ b/osdep/timer.h
@@ -19,19 +19,12 @@
#ifndef MPLAYER_TIMER_H
#define MPLAYER_TIMER_H
-extern const char *timer_name;
+extern const char timer_name[];
void InitTimer(void);
unsigned int GetTimer(void);
unsigned int GetTimerMS(void);
-//int uGetTimer(void);
-float GetRelativeTime(void);
int usec_sleep(int usec_delay);
-/* timer's callback handling */
-typedef void timer_callback( void );
-unsigned set_timer_callback(unsigned ms,timer_callback func);
-void restore_timer(void);
-
#endif /* MPLAYER_TIMER_H */
diff --git a/parser-mecmd.c b/parser-mecmd.c
index 8abe37a359..8abb2b36ee 100644
--- a/parser-mecmd.c
+++ b/parser-mecmd.c
@@ -95,7 +95,7 @@ m_config_parse_me_command_line(m_config_t *config, int argc, char **argv)
no_more_opts = 1;
if (i+1 >= argc)
{
- mp_msg(MSGT_CFGPARSER, MSGL_ERR, MSGTR_NoFileGivenOnCommandLine);
+ mp_tmsg(MSGT_CFGPARSER, MSGL_ERR, "'--' indicates no more options, but no filename was given on the command line.\n");
goto err_out;
}
continue;
@@ -110,7 +110,7 @@ m_config_parse_me_command_line(m_config_t *config, int argc, char **argv)
mp_opt = m_config_get_option(config,opt);
if(!mp_opt) {
tmp = M_OPT_UNKNOWN;
- mp_msg(MSGT_CFGPARSER, MSGL_ERR, MSGTR_NotAnMEncoderOption, opt);
+ mp_tmsg(MSGT_CFGPARSER, MSGL_ERR, "-%s is not an MEncoder option\n", opt);
goto err_out;
}
if(!entry || (mp_opt->flags & M_OPT_GLOBAL)){
@@ -122,7 +122,7 @@ m_config_parse_me_command_line(m_config_t *config, int argc, char **argv)
else
if(tmp < 0){
// mp_msg(MSGT_CFGPARSER, MSGL_ERR, "m_config_set_option() failed (%d)\n",tmp);
- mp_msg(MSGT_CFGPARSER, MSGL_FATAL, MSGTR_ErrorParsingOptionOnCommandLine, opt);
+ mp_tmsg(MSGT_CFGPARSER, MSGL_FATAL, "Error parsing option on the command line: -%s\n", opt);
goto err_out;
}
} else {
@@ -159,7 +159,7 @@ m_config_parse_me_command_line(m_config_t *config, int argc, char **argv)
exit(0);
if(nf == 0) {
m_entry_list_free(lst);
- mp_msg(MSGT_CFGPARSER, MSGL_ERR, MSGTR_NoFileGiven);
+ mp_tmsg(MSGT_CFGPARSER, MSGL_ERR, "No file given\n");
return NULL;
}
return lst;
diff --git a/parser-mpcmd.c b/parser-mpcmd.c
index b493ddf089..38cac3e5a0 100644
--- a/parser-mpcmd.c
+++ b/parser-mpcmd.c
@@ -50,7 +50,9 @@ static int mode = 0;
// #define UNSET_GLOBAL (mode = GLOBAL)
-static int is_entry_option(char *opt, char *param, play_tree_t** ret) {
+static int is_entry_option(struct m_config *mconfig, char *opt, char *param,
+ play_tree_t** ret)
+{
play_tree_t* entry = NULL;
*ret = NULL;
@@ -59,7 +61,7 @@ static int is_entry_option(char *opt, char *param, play_tree_t** ret) {
if(!param)
return M_OPT_MISSING_PARAM;
- entry = parse_playlist_file(param);
+ entry = parse_playlist_file(mconfig, param);
if(!entry)
return -1;
else {
@@ -122,7 +124,7 @@ m_config_parse_mp_command_line(m_config_t *config, int argc, char **argv)
no_more_opts = 1;
if (i+1 >= argc)
{
- mp_msg(MSGT_CFGPARSER, MSGL_ERR, MSGTR_NoFileGivenOnCommandLine);
+ mp_tmsg(MSGT_CFGPARSER, MSGL_ERR, "'--' indicates no more options, but no filename was given on the command line.\n");
goto err_out;
}
continue;
@@ -169,7 +171,7 @@ m_config_parse_mp_command_line(m_config_t *config, int argc, char **argv)
char* end = NULL;
l = (i+1<argc) ? strtol(argv[i+1],&end,0) : 0;
if(!end || *end != '\0') {
- mp_msg(MSGT_CFGPARSER, MSGL_ERR, MSGTR_TheLoopOptionMustBeAnInteger, argv[i+1]);
+ mp_tmsg(MSGT_CFGPARSER, MSGL_ERR, "The loop option must be an integer: %s\n", argv[i+1]);
tmp = ERR_OUT_OF_RANGE;
} else {
play_tree_t* pt = last_entry ? last_entry : last_parent;
@@ -191,7 +193,7 @@ m_config_parse_mp_command_line(m_config_t *config, int argc, char **argv)
const m_option_t* mp_opt = NULL;
play_tree_t* entry = NULL;
- tmp = is_entry_option(opt,(i+1<argc) ? argv[i + 1] : NULL,&entry);
+ tmp = is_entry_option(config, opt,(i+1<argc) ? argv[i + 1] : NULL,&entry);
if(tmp > 0) { // It's an entry
if(entry) {
add_entry(&last_parent,&last_entry,entry);
@@ -215,7 +217,7 @@ m_config_parse_mp_command_line(m_config_t *config, int argc, char **argv)
}
} else {
tmp = M_OPT_UNKNOWN;
- mp_msg(MSGT_CFGPARSER, MSGL_ERR, MSGTR_UnknownOptionOnCommandLine, opt);
+ mp_tmsg(MSGT_CFGPARSER, MSGL_ERR, "Unknown option on the command line: -%s\n", opt);
}
}
}
@@ -225,7 +227,7 @@ m_config_parse_mp_command_line(m_config_t *config, int argc, char **argv)
tmp = M_OPT_EXIT - tmp;
} else
if (tmp < 0) {
- mp_msg(MSGT_CFGPARSER, MSGL_FATAL, MSGTR_ErrorParsingOptionOnCommandLine, opt);
+ mp_tmsg(MSGT_CFGPARSER, MSGL_FATAL, "Error parsing option on the command line: -%s\n", opt);
goto err_out;
}
i += tmp;
@@ -262,7 +264,7 @@ m_config_parse_mp_command_line(m_config_t *config, int argc, char **argv)
last_entry = entry;
}
} else {
- mp_msg(MSGT_CFGPARSER, MSGL_ERR, MSGTR_InvalidPlayEntry, argv[i]);
+ mp_tmsg(MSGT_CFGPARSER, MSGL_ERR, "Invalid play entry %s\n", argv[i]);
}
} else { // dvd:// or dvd://x entry
diff --git a/playtree.c b/playtree.c
index f06d1eebea..4301caf1f2 100644
--- a/playtree.c
+++ b/playtree.c
@@ -415,7 +415,7 @@ play_tree_set_params_from(play_tree_t* dest,play_tree_t* src) {
}
// all children if deep < 0
-void
+static void
play_tree_set_flag(play_tree_t* pt, int flags , int deep) {
play_tree_t* i;
@@ -428,7 +428,7 @@ play_tree_set_flag(play_tree_t* pt, int flags , int deep) {
}
}
-void
+static void
play_tree_unset_flag(play_tree_t* pt, int flags , int deep) {
play_tree_t* i;
@@ -953,20 +953,6 @@ void pt_add_file(play_tree_t** ppt, char* filename)
play_tree_set_params_from(entry,pt);
}
-void pt_add_gui_file(play_tree_t** ppt, char* path, char* file)
-{
- char* wholename = malloc(strlen(path)+strlen(file)+2);
-
- if (wholename)
- {
- strcpy(wholename, path);
- strcat(wholename, "/");
- strcat(wholename, file);
- pt_add_file(ppt, wholename);
- free(wholename); // As pt_add_file strdups it anyway!
- }
-}
-
void pt_iter_goto_head(play_tree_iter_t* iter)
{
iter->tree=iter->root;
diff --git a/playtree.h b/playtree.h
index 73bedde082..c7bfaeb7f1 100644
--- a/playtree.h
+++ b/playtree.h
@@ -22,7 +22,7 @@
/// \file
/// \ingroup Playtree
-struct stream_st;
+struct stream;
struct m_config;
/// \defgroup PlaytreeIterReturn Playtree iterator return code
@@ -245,8 +245,9 @@ play_tree_iter_get_file(play_tree_iter_t* iter, int d);
/// Create a playtree from a playlist file.
/** \ingroup PlaytreeParser
*/
+struct m_config;
play_tree_t*
-parse_playtree(struct stream_st *stream, int forced);
+parse_playtree(struct stream *stream, struct m_config *mconfig, int forced);
/// Clean a tree by destroying all empty elements.
play_tree_t*
@@ -256,7 +257,7 @@ play_tree_cleanup(play_tree_t* pt);
/** \ingroup PlaytreeParser
*/
play_tree_t*
-parse_playlist_file(char* file);
+parse_playlist_file(struct m_config *mconfig, char* file);
/// \defgroup PtAPI Playtree highlevel API
/// \ingroup Playtree
@@ -286,13 +287,8 @@ void pt_iter_replace_entry(play_tree_iter_t* iter, play_tree_t* entry);
/// Adds a new file to the playtree, if it is not valid it is created.
void pt_add_file(play_tree_t** ppt, char* filename);
-/// \brief Performs a convert to playtree-syntax, by concat path/file
-/// and performs pt_add_file
-void pt_add_gui_file(play_tree_t** ppt, char* path, char* file);
-
-// Two macros to use only the iter and not the other things.
+// A macro to use only the iter and not the other things.
#define pt_iter_add_file(iter, filename) pt_add_file(&iter->tree, filename)
-#define pt_iter_add_gui_file(iter, path, name) pt_add_gui_file(&iter->tree, path, name)
/// Resets the iter and goes back to head.
void pt_iter_goto_head(play_tree_iter_t* iter);
diff --git a/playtreeparser.c b/playtreeparser.c
index 2e3b7fd44a..8868d20694 100644
--- a/playtreeparser.c
+++ b/playtreeparser.c
@@ -37,9 +37,9 @@
#include "libmpdemux/demuxer.h"
#include "mp_msg.h"
-
+struct m_config;
extern play_tree_t*
-asx_parser_build_tree(char* buffer, int ref);
+asx_parser_build_tree(struct m_config *mconfig, char* buffer, int ref);
#define BUF_STEP 1024
@@ -216,7 +216,7 @@ parse_asx(play_tree_parser_t* p) {
/* NOTHING */;
mp_msg(MSGT_PLAYTREE,MSGL_DBG3,"Parsing asx file: [%s]\n",p->buffer);
- return asx_parser_build_tree(p->buffer,p->deep);
+ return asx_parser_build_tree(p->mconfig, p->buffer,p->deep);
}
static char*
@@ -596,7 +596,7 @@ parse_smil(play_tree_parser_t* p) {
}
static play_tree_t*
-embedded_playlist_parse(char *line) {
+embedded_playlist_parse(struct m_config *mconfig, char *line) {
int f=DEMUXER_TYPE_PLAYLIST;
stream_t* stream;
play_tree_parser_t* ptp;
@@ -612,7 +612,7 @@ embedded_playlist_parse(char *line) {
//add new playtree
mp_msg(MSGT_PLAYTREE,MSGL_V,"Adding playlist %s to element entryref\n",line);
- ptp = play_tree_parser_new(stream,1);
+ ptp = play_tree_parser_new(stream, mconfig, 1);
entry = play_tree_parser_get_play_tree(ptp, 1);
play_tree_parser_free(ptp);
free_stream(stream);
@@ -647,7 +647,7 @@ parse_textplain(play_tree_parser_t* p) {
( ((tolower(c[1]) == 's') && (tolower(c[2])== 'm') && (tolower(c[3]) == 'i')) ||
((tolower(c[1]) == 'r') && (tolower(c[2])== 'a') && (tolower(c[3]) == 'm')) )
&& (!c[4] || c[4] == '?' || c[4] == '&')) ){
- entry=embedded_playlist_parse(line);
+ entry=embedded_playlist_parse(p->mconfig, line);
embedded = 1;
break;
}
@@ -673,7 +673,7 @@ parse_textplain(play_tree_parser_t* p) {
}
play_tree_t*
-parse_playtree(stream_t *stream, int forced) {
+parse_playtree(stream_t *stream, struct m_config *mconfig, int forced) {
play_tree_parser_t* p;
play_tree_t* ret;
@@ -681,7 +681,7 @@ parse_playtree(stream_t *stream, int forced) {
assert(stream != NULL);
#endif
- p = play_tree_parser_new(stream,0);
+ p = play_tree_parser_new(stream, mconfig, 0);
if(!p)
return NULL;
@@ -748,7 +748,7 @@ void play_tree_add_bpf(play_tree_t* pt, char* filename)
}
play_tree_t*
-parse_playlist_file(char* file) {
+parse_playlist_file(struct m_config *mconfig, char* file) {
stream_t *stream;
play_tree_t* ret;
int f=DEMUXER_TYPE_PLAYLIST;
@@ -762,7 +762,7 @@ parse_playlist_file(char* file) {
mp_msg(MSGT_PLAYTREE,MSGL_V,"Parsing playlist file %s...\n",file);
- ret = parse_playtree(stream,1);
+ ret = parse_playtree(stream, mconfig, 1);
free_stream(stream);
play_tree_add_bpf(ret, file);
@@ -773,13 +773,14 @@ parse_playlist_file(char* file) {
play_tree_parser_t*
-play_tree_parser_new(stream_t* stream,int deep) {
+play_tree_parser_new(stream_t* stream, struct m_config *mconfig, int deep) {
play_tree_parser_t* p;
p = calloc(1,sizeof(play_tree_parser_t));
if(!p)
return NULL;
p->stream = stream;
+ p->mconfig = mconfig;
p->deep = deep;
p->keep = 1;
diff --git a/playtreeparser.h b/playtreeparser.h
index 53744ac0a2..1af06d2ef3 100644
--- a/playtreeparser.h
+++ b/playtreeparser.h
@@ -30,10 +30,11 @@
/// \file
-struct stream_st;
+struct stream;
typedef struct play_tree_parser {
- struct stream_st* stream;
+ struct stream* stream;
+ struct m_config *mconfig;
char *buffer,*iter,*line;
int buffer_size , buffer_end;
int deep,keep;
@@ -46,7 +47,7 @@ typedef struct play_tree_parser {
* \return The new parser.
*/
play_tree_parser_t*
-play_tree_parser_new(struct stream_st* stream,int deep);
+play_tree_parser_new(struct stream* stream, struct m_config *mconfig, int deep);
/// Destroy a parser.
void
diff --git a/spudec.c b/spudec.c
index 6241c99e0c..05ec81f514 100644
--- a/spudec.c
+++ b/spudec.c
@@ -41,7 +41,7 @@
#include "spudec.h"
#include "vobsub.h"
#include "libavutil/avutil.h"
-#include "libavutil/intreadwrite.h"
+#include "ffmpeg_files/intreadwrite.h"
#include "libswscale/swscale.h"
/* Valid values for spu_aamode:
@@ -104,7 +104,7 @@ typedef struct {
unsigned char *scaled_aimage;
int auto_palette; /* 1 if we lack a palette and must use an heuristic. */
int font_start_level; /* Darkest value used for the computed font */
- const vo_functions_t *hw_spu;
+ struct vo *hw_spu;
int spu_changed;
unsigned int forced_subs_only; /* flag: 0=display all subtitle, !0 display only forced subtitles */
unsigned int is_forced_sub; /* true if current subtitle is a forced subtitle */
@@ -508,7 +508,7 @@ static void spudec_decode(spudec_handle_t *this, int pts100)
packet.data = this->packet;
packet.size = this->packet_size;
packet.timestamp = pts100;
- this->hw_spu->draw_frame((uint8_t**)&pkg);
+ vo_draw_frame(this->hw_spu, (uint8_t**)&pkg);
}
}
@@ -760,8 +760,9 @@ static void scale_image(int x, int y, scale_pixel* table_x, scale_pixel* table_y
}
}
-void sws_spu_image(unsigned char *d1, unsigned char *d2, int dw, int dh, int ds,
- unsigned char *s1, unsigned char *s2, int sw, int sh, int ss)
+static void sws_spu_image(unsigned char *d1, unsigned char *d2, int dw, int dh,
+ int ds, unsigned char *s1, unsigned char *s2, int sw,
+ int sh, int ss)
{
struct SwsContext *ctx;
static SwsFilter filter;
@@ -786,7 +787,7 @@ void sws_spu_image(unsigned char *d1, unsigned char *d2, int dw, int dh, int ds,
sws_freeContext(ctx);
}
-void spudec_draw_scaled(void *me, unsigned int dxs, unsigned int dys, void (*draw_alpha)(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride))
+void spudec_draw_scaled(void *me, unsigned int dxs, unsigned int dys, void (*draw_alpha)(void *ctx, int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride), void *ctx)
{
spudec_handle_t *spu = (spudec_handle_t *)me;
scale_pixel *table_x;
@@ -803,7 +804,7 @@ void spudec_draw_scaled(void *me, unsigned int dxs, unsigned int dys, void (*dra
|| (spu->orig_frame_width == dxs && spu->orig_frame_height == dys))) {
if (spu->image)
{
- draw_alpha(spu->start_col, spu->start_row, spu->width, spu->height,
+ draw_alpha(ctx, spu->start_col, spu->start_row, spu->width, spu->height,
spu->image, spu->aimage, spu->stride);
spu->spu_changed = 0;
}
@@ -1104,7 +1105,7 @@ nothing_to_do:
spu->scaled_start_row = dys*sub_pos/100 - spu->scaled_height;
break;
}
- draw_alpha(spu->scaled_start_col, spu->scaled_start_row, spu->scaled_width, spu->scaled_height,
+ draw_alpha(ctx, spu->scaled_start_col, spu->scaled_start_row, spu->scaled_width, spu->scaled_height,
spu->scaled_image, spu->scaled_aimage, spu->scaled_stride);
spu->spu_changed = 0;
}
@@ -1123,7 +1124,7 @@ void spudec_update_palette(void * this, unsigned int *palette)
if (spu && palette) {
memcpy(spu->global_palette, palette, sizeof(spu->global_palette));
if(spu->hw_spu)
- spu->hw_spu->control(VOCTRL_SET_SPU_PALETTE,spu->global_palette);
+ vo_control(spu->hw_spu, VOCTRL_SET_SPU_PALETTE, spu->global_palette);
}
}
@@ -1227,11 +1228,11 @@ void spudec_free(void *this)
}
}
-void spudec_set_hw_spu(void *this, const vo_functions_t *hw_spu)
+void spudec_set_hw_spu(void *this, struct vo *hw_spu)
{
spudec_handle_t *spu = (spudec_handle_t*)this;
if (!spu)
return;
spu->hw_spu = hw_spu;
- hw_spu->control(VOCTRL_SET_SPU_PALETTE,spu->global_palette);
+ vo_control(hw_spu, VOCTRL_SET_SPU_PALETTE, spu->global_palette);
}
diff --git a/spudec.h b/spudec.h
index 89bc76de8a..c1fd449413 100644
--- a/spudec.h
+++ b/spudec.h
@@ -24,7 +24,7 @@
void spudec_heartbeat(void *this, unsigned int pts100);
void spudec_assemble(void *this, unsigned char *packet, unsigned int len, int pts100);
void spudec_draw(void *this, void (*draw_alpha)(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride));
-void spudec_draw_scaled(void *this, unsigned int dxs, unsigned int dys, void (*draw_alpha)(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride));
+void spudec_draw_scaled(void *this, unsigned int dxs, unsigned int dys, void (*draw_alpha)(void *ctx, int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride), void *ctx);
void spudec_update_palette(void *this, unsigned int *palette);
void *spudec_new_scaled(unsigned int *palette, unsigned int frame_width, unsigned int frame_height, uint8_t *extradata, int extradata_len);
void *spudec_new(unsigned int *palette);
@@ -32,7 +32,7 @@ void spudec_free(void *this);
void spudec_reset(void *this); // called after seek
int spudec_visible(void *this); // check if spu is visible
void spudec_set_font_factor(void * this, double factor); // sets the equivalent to ffactor
-void spudec_set_hw_spu(void *this, const vo_functions_t *hw_spu);
+void spudec_set_hw_spu(void *this, struct vo *hw_spu);
int spudec_changed(void *this);
void spudec_calc_bbox(void *me, unsigned int dxs, unsigned int dys, unsigned int* bbox);
void spudec_set_forced_subs_only(void * const this, const unsigned int flag);
diff --git a/stream/ai_alsa.c b/stream/ai_alsa.c
index fb6d7ceb26..b06c84a6db 100644
--- a/stream/ai_alsa.c
+++ b/stream/ai_alsa.c
@@ -41,24 +41,24 @@ int ai_alsa_setup(audio_in_t *ai)
err = snd_pcm_hw_params_any(ai->alsa.handle, params);
if (err < 0) {
- mp_msg(MSGT_TV, MSGL_ERR, MSGTR_MPDEMUX_AIALSA_PcmBrokenConfig);
+ mp_tmsg(MSGT_TV, MSGL_ERR, "Broken configuration for this PCM: no configurations available.\n");
return -1;
}
err = snd_pcm_hw_params_set_access(ai->alsa.handle, params,
SND_PCM_ACCESS_RW_INTERLEAVED);
if (err < 0) {
- mp_msg(MSGT_TV, MSGL_ERR, MSGTR_MPDEMUX_AIALSA_UnavailableAccessType);
+ mp_tmsg(MSGT_TV, MSGL_ERR, "Access type not available.\n");
return -1;
}
err = snd_pcm_hw_params_set_format(ai->alsa.handle, params, SND_PCM_FORMAT_S16_LE);
if (err < 0) {
- mp_msg(MSGT_TV, MSGL_ERR, MSGTR_MPDEMUX_AIALSA_UnavailableSampleFmt);
+ mp_tmsg(MSGT_TV, MSGL_ERR, "Sample format not available.\n");
return -1;
}
err = snd_pcm_hw_params_set_channels(ai->alsa.handle, params, ai->req_channels);
if (err < 0) {
ai->channels = snd_pcm_hw_params_get_channels(params);
- mp_msg(MSGT_TV, MSGL_ERR, MSGTR_MPDEMUX_AIALSA_UnavailableChanCount,
+ mp_tmsg(MSGT_TV, MSGL_ERR, "Channel count not available - reverting to default: %d\n",
ai->channels);
} else {
ai->channels = ai->req_channels;
@@ -79,14 +79,14 @@ int ai_alsa_setup(audio_in_t *ai)
assert(ai->alsa.period_time >= 0);
err = snd_pcm_hw_params(ai->alsa.handle, params);
if (err < 0) {
- mp_msg(MSGT_TV, MSGL_ERR, MSGTR_MPDEMUX_AIALSA_CannotInstallHWParams);
+ mp_tmsg(MSGT_TV, MSGL_ERR, "Unable to install hardware paramameters: %s");
snd_pcm_hw_params_dump(params, ai->alsa.log);
return -1;
}
ai->alsa.chunk_size = snd_pcm_hw_params_get_period_size(params, 0);
buffer_size = snd_pcm_hw_params_get_buffer_size(params);
if (ai->alsa.chunk_size == buffer_size) {
- mp_msg(MSGT_TV, MSGL_ERR, MSGTR_MPDEMUX_AIALSA_PeriodEqualsBufferSize, ai->alsa.chunk_size, (long)buffer_size);
+ mp_tmsg(MSGT_TV, MSGL_ERR, "Can't use period equal to buffer size (%u == %lu)\n", ai->alsa.chunk_size, (long)buffer_size);
return -1;
}
snd_pcm_sw_params_current(ai->alsa.handle, swparams);
@@ -102,7 +102,7 @@ int ai_alsa_setup(audio_in_t *ai)
assert(err >= 0);
if (snd_pcm_sw_params(ai->alsa.handle, swparams) < 0) {
- mp_msg(MSGT_TV, MSGL_ERR, MSGTR_MPDEMUX_AIALSA_CannotInstallSWParams);
+ mp_tmsg(MSGT_TV, MSGL_ERR, "Unable to install software parameters:\n");
snd_pcm_sw_params_dump(swparams, ai->alsa.log);
return -1;
}
@@ -126,7 +126,7 @@ int ai_alsa_init(audio_in_t *ai)
err = snd_pcm_open(&ai->alsa.handle, ai->alsa.device, SND_PCM_STREAM_CAPTURE, 0);
if (err < 0) {
- mp_msg(MSGT_TV, MSGL_ERR, MSGTR_MPDEMUX_AIALSA_ErrorOpeningAudio, snd_strerror(err));
+ mp_tmsg(MSGT_TV, MSGL_ERR, "Error opening audio: %s\n", snd_strerror(err));
return -1;
}
@@ -160,7 +160,7 @@ int ai_alsa_xrun(audio_in_t *ai)
snd_pcm_status_alloca(&status);
if ((res = snd_pcm_status(ai->alsa.handle, status))<0) {
- mp_msg(MSGT_TV, MSGL_ERR, MSGTR_MPDEMUX_AIALSA_AlsaStatusError, snd_strerror(res));
+ mp_tmsg(MSGT_TV, MSGL_ERR, "ALSA status error: %s", snd_strerror(res));
return -1;
}
if (snd_pcm_status_get_state(status) == SND_PCM_STATE_XRUN) {
@@ -168,18 +168,18 @@ int ai_alsa_xrun(audio_in_t *ai)
gettimeofday(&now, 0);
snd_pcm_status_get_trigger_tstamp(status, &tstamp);
timersub(&now, &tstamp, &diff);
- mp_msg(MSGT_TV, MSGL_ERR, MSGTR_MPDEMUX_AIALSA_AlsaXRUN,
+ mp_tmsg(MSGT_TV, MSGL_ERR, "ALSA xrun!!! (at least %.3f ms long)\n",
diff.tv_sec * 1000 + diff.tv_usec / 1000.0);
if (mp_msg_test(MSGT_TV, MSGL_V)) {
- mp_msg(MSGT_TV, MSGL_ERR, MSGTR_MPDEMUX_AIALSA_AlsaStatus);
+ mp_tmsg(MSGT_TV, MSGL_ERR, "ALSA Status:\n");
snd_pcm_status_dump(status, ai->alsa.log);
}
if ((res = snd_pcm_prepare(ai->alsa.handle))<0) {
- mp_msg(MSGT_TV, MSGL_ERR, MSGTR_MPDEMUX_AIALSA_AlsaXRUNPrepareError, snd_strerror(res));
+ mp_tmsg(MSGT_TV, MSGL_ERR, "ALSA xrun: prepare error: %s", snd_strerror(res));
return -1;
}
return 0; /* ok, data should be accepted again */
}
- mp_msg(MSGT_TV, MSGL_ERR, MSGTR_MPDEMUX_AIALSA_AlsaReadWriteError);
+ mp_tmsg(MSGT_TV, MSGL_ERR, "ALSA read/write error");
return -1;
}
diff --git a/stream/ai_alsa1x.c b/stream/ai_alsa1x.c
index f5cece4499..d55e98ded7 100644
--- a/stream/ai_alsa1x.c
+++ b/stream/ai_alsa1x.c
@@ -42,27 +42,27 @@ int ai_alsa_setup(audio_in_t *ai)
err = snd_pcm_hw_params_any(ai->alsa.handle, params);
if (err < 0) {
- mp_msg(MSGT_TV, MSGL_ERR, MSGTR_MPDEMUX_AIALSA_PcmBrokenConfig);
+ mp_tmsg(MSGT_TV, MSGL_ERR, "Broken configuration for this PCM: no configurations available.\n");
return -1;
}
err = snd_pcm_hw_params_set_access(ai->alsa.handle, params,
SND_PCM_ACCESS_RW_INTERLEAVED);
if (err < 0) {
- mp_msg(MSGT_TV, MSGL_ERR, MSGTR_MPDEMUX_AIALSA_UnavailableAccessType);
+ mp_tmsg(MSGT_TV, MSGL_ERR, "Access type not available.\n");
return -1;
}
err = snd_pcm_hw_params_set_format(ai->alsa.handle, params, SND_PCM_FORMAT_S16_LE);
if (err < 0) {
- mp_msg(MSGT_TV, MSGL_ERR, MSGTR_MPDEMUX_AIALSA_UnavailableSampleFmt);
+ mp_tmsg(MSGT_TV, MSGL_ERR, "Sample format not available.\n");
return -1;
}
err = snd_pcm_hw_params_set_channels(ai->alsa.handle, params, ai->req_channels);
if (err < 0) {
snd_pcm_hw_params_get_channels(params, &ai->channels);
- mp_msg(MSGT_TV, MSGL_ERR, MSGTR_MPDEMUX_AIALSA_UnavailableChanCount,
+ mp_tmsg(MSGT_TV, MSGL_ERR, "Channel count not available - reverting to default: %d\n",
ai->channels);
} else {
ai->channels = ai->req_channels;
@@ -72,7 +72,7 @@ int ai_alsa_setup(audio_in_t *ai)
rate = ai->req_samplerate;
err = snd_pcm_hw_params_set_rate_near(ai->alsa.handle, params, &rate, &dir);
if (err < 0) {
- mp_msg(MSGT_TV, MSGL_ERR, MSGTR_MPDEMUX_AIALSA1X_CannotSetSamplerate);
+ mp_tmsg(MSGT_TV, MSGL_ERR, "Cannot set samplerate.\n");
}
ai->samplerate = rate;
@@ -81,7 +81,7 @@ int ai_alsa_setup(audio_in_t *ai)
err = snd_pcm_hw_params_set_buffer_time_near(ai->alsa.handle, params,
&ai->alsa.buffer_time, &dir);
if (err < 0) {
- mp_msg(MSGT_TV, MSGL_ERR, MSGTR_MPDEMUX_AIALSA1X_CannotSetBufferTime);
+ mp_tmsg(MSGT_TV, MSGL_ERR, "Cannot set buffer time.\n");
}
dir = 0;
@@ -89,12 +89,12 @@ int ai_alsa_setup(audio_in_t *ai)
err = snd_pcm_hw_params_set_period_time_near(ai->alsa.handle, params,
&ai->alsa.period_time, &dir);
if (err < 0) {
- mp_msg(MSGT_TV, MSGL_ERR, MSGTR_MPDEMUX_AIALSA1X_CannotSetPeriodTime);
+ mp_tmsg(MSGT_TV, MSGL_ERR, "Cannot set period time.\n");
}
err = snd_pcm_hw_params(ai->alsa.handle, params);
if (err < 0) {
- mp_msg(MSGT_TV, MSGL_ERR, MSGTR_MPDEMUX_AIALSA_CannotInstallHWParams, snd_strerror(err));
+ mp_tmsg(MSGT_TV, MSGL_ERR, "Unable to install hardware paramameters: %s", snd_strerror(err));
snd_pcm_hw_params_dump(params, ai->alsa.log);
return -1;
}
@@ -104,7 +104,7 @@ int ai_alsa_setup(audio_in_t *ai)
snd_pcm_hw_params_get_buffer_size(params, &buffer_size);
ai->alsa.chunk_size = period_size;
if (period_size == buffer_size) {
- mp_msg(MSGT_TV, MSGL_ERR, MSGTR_MPDEMUX_AIALSA_PeriodEqualsBufferSize, ai->alsa.chunk_size, (long)buffer_size);
+ mp_tmsg(MSGT_TV, MSGL_ERR, "Can't use period equal to buffer size (%u == %lu)\n", ai->alsa.chunk_size, (long)buffer_size);
return -1;
}
@@ -116,7 +116,7 @@ int ai_alsa_setup(audio_in_t *ai)
err = snd_pcm_sw_params_set_stop_threshold(ai->alsa.handle, swparams, buffer_size);
if (snd_pcm_sw_params(ai->alsa.handle, swparams) < 0) {
- mp_msg(MSGT_TV, MSGL_ERR, MSGTR_MPDEMUX_AIALSA_CannotInstallSWParams);
+ mp_tmsg(MSGT_TV, MSGL_ERR, "Unable to install software parameters:\n");
snd_pcm_sw_params_dump(swparams, ai->alsa.log);
return -1;
}
@@ -140,7 +140,7 @@ int ai_alsa_init(audio_in_t *ai)
err = snd_pcm_open(&ai->alsa.handle, ai->alsa.device, SND_PCM_STREAM_CAPTURE, 0);
if (err < 0) {
- mp_msg(MSGT_TV, MSGL_ERR, MSGTR_MPDEMUX_AIALSA_ErrorOpeningAudio, snd_strerror(err));
+ mp_tmsg(MSGT_TV, MSGL_ERR, "Error opening audio: %s\n", snd_strerror(err));
return -1;
}
@@ -174,7 +174,7 @@ int ai_alsa_xrun(audio_in_t *ai)
snd_pcm_status_alloca(&status);
if ((res = snd_pcm_status(ai->alsa.handle, status))<0) {
- mp_msg(MSGT_TV, MSGL_ERR, MSGTR_MPDEMUX_AIALSA_AlsaStatusError, snd_strerror(res));
+ mp_tmsg(MSGT_TV, MSGL_ERR, "ALSA status error: %s", snd_strerror(res));
return -1;
}
if (snd_pcm_status_get_state(status) == SND_PCM_STATE_XRUN) {
@@ -182,18 +182,18 @@ int ai_alsa_xrun(audio_in_t *ai)
gettimeofday(&now, 0);
snd_pcm_status_get_trigger_tstamp(status, &tstamp);
timersub(&now, &tstamp, &diff);
- mp_msg(MSGT_TV, MSGL_ERR, MSGTR_MPDEMUX_AIALSA_AlsaXRUN,
+ mp_tmsg(MSGT_TV, MSGL_ERR, "ALSA xrun!!! (at least %.3f ms long)\n",
diff.tv_sec * 1000 + diff.tv_usec / 1000.0);
if (mp_msg_test(MSGT_TV, MSGL_V)) {
- mp_msg(MSGT_TV, MSGL_ERR, MSGTR_MPDEMUX_AIALSA_AlsaStatus);
+ mp_tmsg(MSGT_TV, MSGL_ERR, "ALSA Status:\n");
snd_pcm_status_dump(status, ai->alsa.log);
}
if ((res = snd_pcm_prepare(ai->alsa.handle))<0) {
- mp_msg(MSGT_TV, MSGL_ERR, MSGTR_MPDEMUX_AIALSA_AlsaXRUNPrepareError, snd_strerror(res));
+ mp_tmsg(MSGT_TV, MSGL_ERR, "ALSA xrun: prepare error: %s", snd_strerror(res));
return -1;
}
return 0; /* ok, data should be accepted again */
}
- mp_msg(MSGT_TV, MSGL_ERR, MSGTR_MPDEMUX_AIALSA_AlsaReadWriteError);
+ mp_tmsg(MSGT_TV, MSGL_ERR, "ALSA read/write error");
return -1;
}
diff --git a/stream/ai_oss.c b/stream/ai_oss.c
index 14e8a921c8..328e7bf6af 100644
--- a/stream/ai_oss.c
+++ b/stream/ai_oss.c
@@ -59,7 +59,7 @@ int ai_oss_set_channels(audio_in_t *ai)
mp_msg(MSGT_TV, MSGL_V, "ioctl dsp channels: %d\n",
err = ioctl(ai->oss.audio_fd, SNDCTL_DSP_CHANNELS, &ioctl_param));
if (err < 0) {
- mp_msg(MSGT_TV, MSGL_ERR, MSGTR_MPDEMUX_AIOSS_Unable2SetChanCount,
+ mp_tmsg(MSGT_TV, MSGL_ERR, "Unable to set channel count: %d\n",
ai->req_channels);
return -1;
}
@@ -72,7 +72,7 @@ int ai_oss_set_channels(audio_in_t *ai)
err = ioctl(ai->oss.audio_fd, SNDCTL_DSP_STEREO, &ioctl_param),
ioctl_param);
if (err < 0) {
- mp_msg(MSGT_TV, MSGL_ERR, MSGTR_MPDEMUX_AIOSS_Unable2SetStereo,
+ mp_tmsg(MSGT_TV, MSGL_ERR, "Unable to set stereo: %d\n",
ai->req_channels == 2);
return -1;
}
@@ -89,7 +89,7 @@ int ai_oss_init(audio_in_t *ai)
ai->oss.audio_fd = open(ai->oss.device, O_RDONLY);
if (ai->oss.audio_fd < 0)
{
- mp_msg(MSGT_TV, MSGL_ERR, MSGTR_MPDEMUX_AIOSS_Unable2Open,
+ mp_tmsg(MSGT_TV, MSGL_ERR, "Unable to open '%s': %s\n",
ai->oss.device, strerror(errno));
return -1;
}
@@ -100,13 +100,13 @@ int ai_oss_init(audio_in_t *ai)
mp_msg(MSGT_TV, MSGL_V, "Supported formats: %x\n", ioctl_param);
if (!(ioctl_param & AFMT_S16_LE))
- mp_msg(MSGT_TV, MSGL_ERR, MSGTR_MPDEMUX_AIOSS_UnsupportedFmt);
+ mp_tmsg(MSGT_TV, MSGL_ERR, "unsupported format\n");
ioctl_param = AFMT_S16_LE;
mp_msg(MSGT_TV, MSGL_V, "ioctl dsp setfmt: %d\n",
err = ioctl(ai->oss.audio_fd, SNDCTL_DSP_SETFMT, &ioctl_param));
if (err < 0) {
- mp_msg(MSGT_TV, MSGL_ERR, MSGTR_MPDEMUX_AIOSS_Unable2SetAudioFmt);
+ mp_tmsg(MSGT_TV, MSGL_ERR, "Unable to set audio format.");
return -1;
}
@@ -116,7 +116,7 @@ int ai_oss_init(audio_in_t *ai)
mp_msg(MSGT_TV, MSGL_V, "ioctl dsp speed: %d\n",
err = ioctl(ai->oss.audio_fd, SNDCTL_DSP_SPEED, &ioctl_param));
if (err < 0) {
- mp_msg(MSGT_TV, MSGL_ERR, MSGTR_MPDEMUX_AIOSS_Unable2SetSamplerate,
+ mp_tmsg(MSGT_TV, MSGL_ERR, "Unable to set samplerate: %d\n",
ai->req_samplerate);
return -1;
}
@@ -129,7 +129,7 @@ int ai_oss_init(audio_in_t *ai)
mp_msg(MSGT_TV, MSGL_V, "ioctl dsp trigger: %d\n",
err = ioctl(ai->oss.audio_fd, SNDCTL_DSP_SETTRIGGER, &ioctl_param));
if (err < 0) {
- mp_msg(MSGT_TV, MSGL_ERR, MSGTR_MPDEMUX_AIOSS_Unable2SetTrigger,
+ mp_tmsg(MSGT_TV, MSGL_ERR, "Unable to set trigger: %d\n",
PCM_ENABLE_INPUT);
}
@@ -137,17 +137,17 @@ int ai_oss_init(audio_in_t *ai)
mp_msg(MSGT_TV, MSGL_V, "ioctl dsp getblocksize: %d\n",
err = ioctl(ai->oss.audio_fd, SNDCTL_DSP_GETBLKSIZE, &ai->blocksize));
if (err < 0) {
- mp_msg(MSGT_TV, MSGL_ERR, MSGTR_MPDEMUX_AIOSS_Unable2GetBlockSize);
+ mp_tmsg(MSGT_TV, MSGL_ERR, "Unable to get block size!\n");
}
mp_msg(MSGT_TV, MSGL_V, "blocksize: %d\n", ai->blocksize);
// correct the blocksize to a reasonable value
if (ai->blocksize <= 0) {
ai->blocksize = 4096*ai->channels*2;
- mp_msg(MSGT_TV, MSGL_ERR, MSGTR_MPDEMUX_AIOSS_AudioBlockSizeZero, ai->blocksize);
+ mp_tmsg(MSGT_TV, MSGL_ERR, "Audio block size is zero, setting to %d!\n", ai->blocksize);
} else if (ai->blocksize < 4096*ai->channels*2) {
ai->blocksize *= 4096*ai->channels*2/ai->blocksize;
- mp_msg(MSGT_TV, MSGL_ERR, MSGTR_MPDEMUX_AIOSS_AudioBlockSize2Low, ai->blocksize);
+ mp_tmsg(MSGT_TV, MSGL_ERR, "Audio block size too low, setting to %d!\n", ai->blocksize);
}
ai->samplesize = 16;
diff --git a/stream/asf_mmst_streaming.c b/stream/asf_mmst_streaming.c
index 6d764617a4..a32938a871 100644
--- a/stream/asf_mmst_streaming.c
+++ b/stream/asf_mmst_streaming.c
@@ -35,7 +35,7 @@
#include <inttypes.h>
#include "config.h"
-
+#include "options.h"
#include "mp_msg.h"
#include "help_mp.h"
@@ -134,7 +134,7 @@ static void send_command (int s, int command, uint32_t switches,
memset(&cmd.buf[48 + length], 0, 8 - (length & 7));
if (send (s, cmd.buf, len8*8+48, 0) != (len8*8+48)) {
- mp_msg(MSGT_NETWORK,MSGL_ERR,MSGTR_MPDEMUX_MMST_WriteError);
+ mp_tmsg(MSGT_NETWORK,MSGL_ERR,"write error\n");
}
}
@@ -182,7 +182,7 @@ static void get_answer (int s)
len = recv (s, data, BUF_SIZE, 0) ;
if (!len) {
- mp_msg(MSGT_NETWORK,MSGL_ERR,MSGTR_MPDEMUX_MMST_EOFAlert);
+ mp_tmsg(MSGT_NETWORK,MSGL_ERR,"\nAlert! EOF\n");
return;
}
@@ -229,7 +229,7 @@ static int get_header (int s, uint8_t *header, streaming_ctrl_t *streaming_ctrl)
while (1) {
if (!get_data (s, pre_header, 8)) {
- mp_msg(MSGT_NETWORK,MSGL_ERR,MSGTR_MPDEMUX_MMST_PreHeaderReadFailed);
+ mp_tmsg(MSGT_NETWORK,MSGL_ERR,"pre-header read failed\n");
return 0;
}
if (pre_header[4] == 0x02) {
@@ -241,12 +241,12 @@ static int get_header (int s, uint8_t *header, streaming_ctrl_t *streaming_ctrl)
// mp_msg(MSGT_NETWORK,MSGL_INFO,"asf header packet detected, len=%d\n", packet_len);
if (packet_len < 0 || packet_len > HDR_BUF_SIZE - header_len) {
- mp_msg(MSGT_NETWORK, MSGL_FATAL, MSGTR_MPDEMUX_MMST_InvalidHeaderSize);
+ mp_tmsg(MSGT_NETWORK, MSGL_FATAL, "Invalid header size, giving up.\n");
return 0;
}
if (!get_data (s, &header[header_len], packet_len)) {
- mp_msg(MSGT_NETWORK,MSGL_ERR,MSGTR_MPDEMUX_MMST_HeaderDataReadFailed);
+ mp_tmsg(MSGT_NETWORK,MSGL_ERR,"Header data read failed.\n");
return 0;
}
@@ -272,7 +272,7 @@ static int get_header (int s, uint8_t *header, streaming_ctrl_t *streaming_ctrl)
char data[BUF_SIZE];
if (!get_data (s, (char*)&packet_len, 4)) {
- mp_msg(MSGT_NETWORK,MSGL_ERR,MSGTR_MPDEMUX_MMST_packet_lenReadFailed);
+ mp_tmsg(MSGT_NETWORK,MSGL_ERR,"packet_len read failed.\n");
return 0;
}
@@ -281,13 +281,13 @@ static int get_header (int s, uint8_t *header, streaming_ctrl_t *streaming_ctrl)
// mp_msg(MSGT_NETWORK,MSGL_INFO,"command packet detected, len=%d\n", packet_len);
if (packet_len < 0 || packet_len > BUF_SIZE) {
- mp_msg(MSGT_NETWORK, MSGL_FATAL,
- MSGTR_MPDEMUX_MMST_InvalidRTSPPacketSize);
+ mp_tmsg(MSGT_NETWORK, MSGL_FATAL,
+ "Invalid RTSP packet size, giving up.\n");
return 0;
}
if (!get_data (s, data, packet_len)) {
- mp_msg(MSGT_NETWORK,MSGL_ERR,MSGTR_MPDEMUX_MMST_CmdDataReadFailed);
+ mp_tmsg(MSGT_NETWORK,MSGL_ERR,"Command data read failed.\n");
return 0;
}
@@ -340,14 +340,14 @@ static int interp_header (uint8_t *header, int header_len)
i += 8;
if ( (guid_1 == 0x6cce6200aa00d9a6ULL) && (guid_2 == 0x11cf668e75b22630ULL) ) {
- mp_msg(MSGT_NETWORK,MSGL_INFO,MSGTR_MPDEMUX_MMST_HeaderObject);
+ mp_tmsg(MSGT_NETWORK,MSGL_INFO,"header object\n");
} else if ((guid_1 == 0x6cce6200aa00d9a6ULL) && (guid_2 == 0x11cf668e75b22636ULL)) {
- mp_msg(MSGT_NETWORK,MSGL_INFO,MSGTR_MPDEMUX_MMST_DataObject);
+ mp_tmsg(MSGT_NETWORK,MSGL_INFO,"data object\n");
} else if ((guid_1 == 0x6553200cc000e48eULL) && (guid_2 == 0x11cfa9478cabdca1ULL)) {
packet_length = get_32(header, i+92-24);
- mp_msg(MSGT_NETWORK,MSGL_INFO,MSGTR_MPDEMUX_MMST_FileObjectPacketLen,
+ mp_tmsg(MSGT_NETWORK,MSGL_INFO,"file object, packet length = %d (%d)\n",
packet_length, get_32(header, i+96-24));
@@ -355,13 +355,13 @@ static int interp_header (uint8_t *header, int header_len)
int stream_id = header[i+48] | header[i+49] << 8;
- mp_msg(MSGT_NETWORK,MSGL_INFO,MSGTR_MPDEMUX_MMST_StreamObjectStreamID, stream_id);
+ mp_tmsg(MSGT_NETWORK,MSGL_INFO,"stream object, stream ID: %d\n", stream_id);
if (num_stream_ids < MAX_STREAMS) {
stream_ids[num_stream_ids] = stream_id;
num_stream_ids++;
} else {
- mp_msg(MSGT_NETWORK,MSGL_ERR,MSGTR_MPDEMUX_MMST_2ManyStreamID);
+ mp_tmsg(MSGT_NETWORK,MSGL_ERR,"Too many IDs, stream skipped.");
}
} else {
@@ -377,7 +377,7 @@ static int interp_header (uint8_t *header, int header_len)
}
printf("\n");
#else
- mp_msg(MSGT_NETWORK,MSGL_WARN,MSGTR_MPDEMUX_MMST_UnknownObject);
+ mp_tmsg(MSGT_NETWORK,MSGL_WARN,"unknown object\n");
#endif
}
@@ -397,7 +397,7 @@ static int get_media_packet (int s, int padding, streaming_ctrl_t *stream_ctrl)
char data[BUF_SIZE];
if (!get_data (s, pre_header, 8)) {
- mp_msg(MSGT_NETWORK,MSGL_ERR,MSGTR_MPDEMUX_MMST_PreHeaderReadFailed);
+ mp_tmsg(MSGT_NETWORK,MSGL_ERR,"pre-header read failed\n");
return 0;
}
@@ -414,12 +414,12 @@ static int get_media_packet (int s, int padding, streaming_ctrl_t *stream_ctrl)
// mp_msg(MSGT_NETWORK,MSGL_INFO,"asf media packet detected, len=%d\n", packet_len);
if (packet_len < 0 || packet_len > BUF_SIZE) {
- mp_msg(MSGT_NETWORK, MSGL_FATAL, MSGTR_MPDEMUX_MMST_InvalidRTSPPacketSize);
+ mp_tmsg(MSGT_NETWORK, MSGL_FATAL, "Invalid RTSP packet size, giving up.\n");
return 0;
}
if (!get_data (s, data, packet_len)) {
- mp_msg(MSGT_NETWORK,MSGL_ERR,MSGTR_MPDEMUX_MMST_MediaDataReadFailed);
+ mp_tmsg(MSGT_NETWORK,MSGL_ERR,"Media data read failed.\n");
return 0;
}
@@ -431,26 +431,26 @@ static int get_media_packet (int s, int padding, streaming_ctrl_t *stream_ctrl)
int command;
if (!get_data (s, (char*)&packet_len, 4)) {
- mp_msg(MSGT_NETWORK,MSGL_ERR,MSGTR_MPDEMUX_MMST_packet_lenReadFailed);
+ mp_tmsg(MSGT_NETWORK,MSGL_ERR,"packet_len read failed.\n");
return 0;
}
packet_len = get_32 ((unsigned char*)&packet_len, 0) + 4;
if (packet_len < 0 || packet_len > BUF_SIZE) {
- mp_msg(MSGT_NETWORK,MSGL_FATAL,MSGTR_MPDEMUX_MMST_InvalidRTSPPacketSize);
+ mp_tmsg(MSGT_NETWORK,MSGL_FATAL,"Invalid RTSP packet size, giving up.\n");
return 0;
}
if (!get_data (s, data, packet_len)) {
- mp_msg(MSGT_NETWORK,MSGL_ERR,MSGTR_MPDEMUX_MMST_CmdDataReadFailed);
+ mp_tmsg(MSGT_NETWORK,MSGL_ERR,"Command data read failed.\n");
return 0;
}
if ( (pre_header[7] != 0xb0) || (pre_header[6] != 0x0b)
|| (pre_header[5] != 0xfa) || (pre_header[4] != 0xce) ) {
- mp_msg(MSGT_NETWORK,MSGL_ERR,MSGTR_MPDEMUX_MMST_MissingSignature);
+ mp_tmsg(MSGT_NETWORK,MSGL_ERR,"missing signature\n");
return -1;
}
@@ -461,7 +461,7 @@ static int get_media_packet (int s, int padding, streaming_ctrl_t *stream_ctrl)
if (command == 0x1b)
send_command (s, 0x1b, 0, 0, 0, data);
else if (command == 0x1e) {
- mp_msg(MSGT_NETWORK,MSGL_INFO,MSGTR_MPDEMUX_MMST_PatentedTechnologyJoke);
+ mp_tmsg(MSGT_NETWORK,MSGL_INFO,"Everything done. Thank you for downloading a media file containing proprietary and patented technology.\n");
return 0;
}
else if (command == 0x21 ) {
@@ -470,7 +470,7 @@ static int get_media_packet (int s, int padding, streaming_ctrl_t *stream_ctrl)
return 0;
}
else if (command != 0x05) {
- mp_msg(MSGT_NETWORK,MSGL_ERR,MSGTR_MPDEMUX_MMST_UnknownCmd,command);
+ mp_tmsg(MSGT_NETWORK,MSGL_ERR,"unknown command %02x\n",command);
return -1;
}
}
@@ -491,7 +491,7 @@ static int asf_mmst_streaming_read( int fd, char *buffer, int size, streaming_ct
// buffer is empty - fill it!
int ret = get_media_packet( fd, packet_length1, stream_ctrl);
if( ret<0 ) {
- mp_msg(MSGT_NETWORK,MSGL_ERR,MSGTR_MPDEMUX_MMST_GetMediaPacketErr,strerror(errno));
+ mp_tmsg(MSGT_NETWORK,MSGL_ERR,"get_media_packet error : %s\n",strerror(errno));
return -1;
} else if (ret==0) //EOF?
return ret;
@@ -544,7 +544,7 @@ int asf_mmst_streaming_start(stream_t *stream)
*/
unescpath=malloc(strlen(path)+1);
if (!unescpath) {
- mp_msg(MSGT_NETWORK,MSGL_FATAL,MSGTR_MemAllocFailed);
+ mp_tmsg(MSGT_NETWORK,MSGL_FATAL,"Memory allocation failed.\n");
return -1;
}
url_unescape_string(unescpath,path);
@@ -559,7 +559,7 @@ int asf_mmst_streaming_start(stream_t *stream)
free(path);
return s;
}
- mp_msg(MSGT_NETWORK,MSGL_INFO,MSGTR_MPDEMUX_MMST_Connected);
+ mp_tmsg(MSGT_NETWORK,MSGL_INFO,"Connected\n");
seq_num=0;
@@ -639,6 +639,7 @@ int asf_mmst_streaming_start(stream_t *stream)
memset (data, 0, 40);
+ int audio_id = stream->opts->audio_id;
if (audio_id > 0) {
data[2] = 0xFF;
data[3] = 0xFF;
diff --git a/stream/asf_streaming.c b/stream/asf_streaming.c
index 782c5b3dce..c76ccb5d92 100644
--- a/stream/asf_streaming.c
+++ b/stream/asf_streaming.c
@@ -26,6 +26,7 @@
#include "config.h"
#include "mp_msg.h"
#include "help_mp.h"
+#include "options.h"
#if HAVE_WINSOCK2_H
#include <winsock2.h>
@@ -41,7 +42,7 @@
#include "network.h"
#include "tcp.h"
-#include "libavutil/intreadwrite.h"
+#include "ffmpeg_files/intreadwrite.h"
#include "libmpdemux/asfguid.h"
@@ -55,7 +56,7 @@ static int asf_read_wrapper(int fd, void *buffer, int len, streaming_ctrl_t *str
while (len > 0) {
int got = nop_streaming_read(fd, buf, len, stream_ctrl);
if (got <= 0) {
- mp_msg(MSGT_NETWORK, MSGL_ERR, MSGTR_MPDEMUX_ASF_ErrReadingNetworkStream);
+ mp_tmsg(MSGT_NETWORK, MSGL_ERR, "Error while reading network stream.\n");
return got;
}
buf += got;
@@ -126,11 +127,11 @@ printf("0x%02X\n", stream_chunck->type );
if( drop_packet!=NULL ) *drop_packet = 0;
if( stream_chunck->size<8 ) {
- mp_msg(MSGT_NETWORK,MSGL_ERR,MSGTR_MPDEMUX_ASF_StreamChunkSize2Small, stream_chunck->size);
+ mp_tmsg(MSGT_NETWORK,MSGL_ERR,"Ahhhh, stream_chunck size is too small: %d\n", stream_chunck->size);
return -1;
}
if( stream_chunck->size!=stream_chunck->size_confirm ) {
- mp_msg(MSGT_NETWORK,MSGL_ERR,MSGTR_MPDEMUX_ASF_SizeConfirmMismatch, stream_chunck->size, stream_chunck->size_confirm);
+ mp_tmsg(MSGT_NETWORK,MSGL_ERR,"size_confirm mismatch!: %d %d\n", stream_chunck->size, stream_chunck->size_confirm);
return -1;
}
/*
@@ -163,9 +164,6 @@ printf("0x%02X\n", stream_chunck->type );
return stream_chunck->size+4;
}
-extern int audio_id;
-extern int video_id;
-
static void close_s(stream_t *stream) {
closesocket(stream->fd);
stream->fd=-1;
@@ -205,13 +203,13 @@ static int asf_streaming_parse_header(int fd, streaming_ctrl_t* streaming_ctrl)
// Endian handling of the stream chunk
le2me_ASF_stream_chunck_t(&chunk);
size = asf_streaming( &chunk, &r) - sizeof(ASF_stream_chunck_t);
- if(r) mp_msg(MSGT_NETWORK,MSGL_WARN,MSGTR_MPDEMUX_ASF_WarnDropHeader);
+ if(r) mp_tmsg(MSGT_NETWORK,MSGL_WARN,"Warning: drop header ????\n");
if(size < 0){
- mp_msg(MSGT_NETWORK,MSGL_ERR,MSGTR_MPDEMUX_ASF_ErrorParsingChunkHeader);
+ mp_tmsg(MSGT_NETWORK,MSGL_ERR,"Error while parsing chunk header\n");
return -1;
}
if (chunk.type != ASF_STREAMING_HEADER) {
- mp_msg(MSGT_NETWORK,MSGL_ERR,MSGTR_MPDEMUX_ASF_NoHeaderAtFirstChunk);
+ mp_tmsg(MSGT_NETWORK,MSGL_ERR,"Didn't get a header as first chunk !!!!\n");
return -1;
}
@@ -219,7 +217,7 @@ static int asf_streaming_parse_header(int fd, streaming_ctrl_t* streaming_ctrl)
if (size > SIZE_MAX - buffer_size) return -1;
buffer = malloc(size+buffer_size);
if(buffer == NULL) {
- mp_msg(MSGT_NETWORK,MSGL_FATAL,MSGTR_MPDEMUX_ASF_BufferMallocFailed,size+buffer_size);
+ mp_tmsg(MSGT_NETWORK,MSGL_FATAL,"Error: Can't allocate %d bytes buffer.\n",size+buffer_size);
return -1;
}
if( chunk_buffer!=NULL ) {
@@ -236,7 +234,7 @@ static int asf_streaming_parse_header(int fd, streaming_ctrl_t* streaming_ctrl)
if( chunk_size2read==0 ) {
ASF_header_t *asfh = (ASF_header_t *)buffer;
if(size < (int)sizeof(ASF_header_t)) {
- mp_msg(MSGT_NETWORK,MSGL_ERR,MSGTR_MPDEMUX_ASF_ErrChunk2Small);
+ mp_tmsg(MSGT_NETWORK,MSGL_ERR,"Error: Chunk is too small.\n");
return -1;
} else mp_msg(MSGT_NETWORK,MSGL_DBG2,"Got chunk\n");
chunk_size2read = AV_RL64(&asfh->objh.size);
@@ -377,34 +375,34 @@ static int asf_streaming_parse_header(int fd, streaming_ctrl_t* streaming_ctrl)
free(a_rates);
if (a_idx < 0 && v_idx < 0) {
- mp_msg(MSGT_NETWORK, MSGL_FATAL, MSGTR_MPDEMUX_ASF_Bandwidth2SmallCannotPlay);
+ mp_tmsg(MSGT_NETWORK, MSGL_FATAL, "Bandwidth too small, file cannot be played!\n");
return -1;
}
- if (audio_id > 0)
+ if (*streaming_ctrl->audio_id_ptr > 0)
// a audio stream was forced
- asf_ctrl->audio_id = audio_id;
+ asf_ctrl->audio_id = *streaming_ctrl->audio_id_ptr;
else if (a_idx >= 0)
asf_ctrl->audio_id = asf_ctrl->audio_streams[a_idx];
else if (asf_ctrl->n_audio) {
- mp_msg(MSGT_NETWORK, MSGL_WARN, MSGTR_MPDEMUX_ASF_Bandwidth2SmallDeselectedAudio);
- audio_id = -2;
+ mp_tmsg(MSGT_NETWORK, MSGL_WARN, "Bandwidth too small, deselected audio stream.\n");
+ *streaming_ctrl->audio_id_ptr = -2;
}
- if (video_id > 0)
+ if (*streaming_ctrl->video_id_ptr > 0)
// a video stream was forced
- asf_ctrl->video_id = video_id;
+ asf_ctrl->video_id = *streaming_ctrl->video_id_ptr;
else if (v_idx >= 0)
asf_ctrl->video_id = asf_ctrl->video_streams[v_idx];
else if (asf_ctrl->n_video) {
- mp_msg(MSGT_NETWORK, MSGL_WARN, MSGTR_MPDEMUX_ASF_Bandwidth2SmallDeselectedVideo);
- video_id = -2;
+ mp_tmsg(MSGT_NETWORK, MSGL_WARN, "Bandwidth too small, deselected video stream.\n");
+ *streaming_ctrl->video_id_ptr = -2;
}
return 1;
len_err_out:
- mp_msg(MSGT_NETWORK, MSGL_FATAL, MSGTR_MPDEMUX_ASF_InvalidLenInHeader);
+ mp_tmsg(MSGT_NETWORK, MSGL_FATAL, "Invalid length in ASF header!\n");
if (buffer) free(buffer);
if (v_rates) free(v_rates);
if (a_rates) free(a_rates);
@@ -426,14 +424,14 @@ static int asf_http_streaming_read( int fd, char *buffer, int size, streaming_ct
le2me_ASF_stream_chunck_t(&chunk);
chunk_size = asf_streaming( &chunk, &drop_chunk );
if(chunk_size < 0) {
- mp_msg(MSGT_NETWORK,MSGL_ERR,MSGTR_MPDEMUX_ASF_ErrorParsingChunkHeader);
+ mp_tmsg(MSGT_NETWORK,MSGL_ERR,"Error while parsing chunk header\n");
return -1;
}
chunk_size -= sizeof(ASF_stream_chunck_t);
if(chunk.type != ASF_STREAMING_HEADER && (!drop_chunk)) {
if (asf_http_ctrl->packet_size < chunk_size) {
- mp_msg(MSGT_NETWORK,MSGL_ERR,MSGTR_MPDEMUX_ASF_ErrChunkBiggerThanPacket);
+ mp_tmsg(MSGT_NETWORK,MSGL_ERR,"Error: chunk_size > packet_size\n");
return -1;
}
waiting = asf_http_ctrl->packet_size;
@@ -526,7 +524,7 @@ static int asf_http_streaming_type(char *content_type, char *features, HTTP_head
(!strcasecmp(content_type, "video/x-ms-afs")) ||
(!strcasecmp(content_type, "video/x-ms-wmv")) ||
(!strcasecmp(content_type, "video/x-ms-wma")) ) {
- mp_msg(MSGT_NETWORK,MSGL_ERR,MSGTR_MPDEMUX_ASF_ASFRedirector);
+ mp_tmsg(MSGT_NETWORK,MSGL_ERR,"=====> ASF Redirector\n");
return ASF_Redirector_e;
} else if( !strcasecmp(content_type, "text/plain") ) {
mp_msg(MSGT_NETWORK,MSGL_V,"=====> ASF Plain text\n");
@@ -568,7 +566,7 @@ static HTTP_header_t *asf_http_request(streaming_ctrl_t *streaming_ctrl) {
if( !strcasecmp( url->protocol, "http_proxy" ) ) {
server_url = url_new( (url->file)+1 );
if( server_url==NULL ) {
- mp_msg(MSGT_NETWORK,MSGL_ERR,MSGTR_MPDEMUX_ASF_InvalidProxyURL);
+ mp_tmsg(MSGT_NETWORK,MSGL_ERR,"invalid proxy URL\n");
http_free( http_hdr );
return NULL;
}
@@ -629,7 +627,7 @@ static HTTP_header_t *asf_http_request(streaming_ctrl_t *streaming_ctrl) {
// First request goes here.
break;
default:
- mp_msg(MSGT_NETWORK,MSGL_ERR,MSGTR_MPDEMUX_ASF_UnknownASFStreamType);
+ mp_tmsg(MSGT_NETWORK,MSGL_ERR,"unknown ASF stream type\n");
}
http_set_field( http_hdr, "Connection: Close" );
@@ -643,7 +641,7 @@ static int asf_http_parse_response(asf_http_streaming_ctrl_t *asf_http_ctrl, HTT
char features[64] = "\0";
size_t len;
if( http_response_parse(http_hdr)<0 ) {
- mp_msg(MSGT_NETWORK,MSGL_ERR,MSGTR_MPDEMUX_ASF_Failed2ParseHTTPResponse);
+ mp_tmsg(MSGT_NETWORK,MSGL_ERR,"Failed to parse HTTP response.\n");
return -1;
}
switch( http_hdr->status_code ) {
@@ -652,7 +650,7 @@ static int asf_http_parse_response(asf_http_streaming_ctrl_t *asf_http_ctrl, HTT
case 401: // Authentication required
return ASF_Authenticate_e;
default:
- mp_msg(MSGT_NETWORK,MSGL_ERR,MSGTR_MPDEMUX_ASF_ServerReturn, http_hdr->status_code, http_hdr->reason_phrase);
+ mp_tmsg(MSGT_NETWORK,MSGL_ERR,"Server returned %d:%s\n", http_hdr->status_code, http_hdr->reason_phrase);
return -1;
}
@@ -676,7 +674,7 @@ static int asf_http_parse_response(asf_http_streaming_ctrl_t *asf_http_ctrl, HTT
len = (unsigned int)(end-pragma);
}
if(len > sizeof(features) - 1) {
- mp_msg(MSGT_NETWORK,MSGL_WARN,MSGTR_MPDEMUX_ASF_ASFHTTPParseWarnCuttedPragma,pragma,len,sizeof(features) - 1);
+ mp_tmsg(MSGT_NETWORK,MSGL_WARN,"ASF HTTP PARSE WARNING : Pragma %s cut from %d bytes to %d\n",pragma,len,sizeof(features) - 1);
len = sizeof(features) - 1;
}
strncpy( features, pragma, len );
@@ -707,7 +705,7 @@ static int asf_http_streaming_start( stream_t *stream, int *demuxer_type ) {
asf_http_ctrl = malloc(sizeof(asf_http_streaming_ctrl_t));
if( asf_http_ctrl==NULL ) {
- mp_msg(MSGT_NETWORK,MSGL_FATAL,MSGTR_MemAllocFailed);
+ mp_tmsg(MSGT_NETWORK,MSGL_FATAL,"Memory allocation failed.\n");
return -1;
}
asf_http_ctrl->streaming_type = ASF_Unknown_e;
@@ -733,7 +731,7 @@ static int asf_http_streaming_start( stream_t *stream, int *demuxer_type ) {
for(i=0; i < (int)http_hdr->buffer_size ; ) {
int r = send( fd, http_hdr->buffer+i, http_hdr->buffer_size-i, 0 );
if(r <0) {
- mp_msg(MSGT_NETWORK,MSGL_ERR,MSGTR_MPDEMUX_ASF_SocketWriteError,strerror(errno));
+ mp_tmsg(MSGT_NETWORK,MSGL_ERR,"socket write error: %s\n",strerror(errno));
goto err_out;
}
i += r;
@@ -755,7 +753,7 @@ static int asf_http_streaming_start( stream_t *stream, int *demuxer_type ) {
}
ret = asf_http_parse_response(asf_http_ctrl, http_hdr);
if( ret<0 ) {
- mp_msg(MSGT_NETWORK,MSGL_ERR,MSGTR_MPDEMUX_ASF_HeaderParseFailed);
+ mp_tmsg(MSGT_NETWORK,MSGL_ERR,"Failed to parse header.\n");
goto err_out;
}
switch( asf_http_ctrl->streaming_type ) {
@@ -773,7 +771,7 @@ static int asf_http_streaming_start( stream_t *stream, int *demuxer_type ) {
ret = asf_streaming_parse_header(fd,stream->streaming_ctrl);
if(ret < 0) goto err_out;
if(asf_http_ctrl->n_audio == 0 && asf_http_ctrl->n_video == 0) {
- mp_msg(MSGT_NETWORK,MSGL_ERR,MSGTR_MPDEMUX_ASF_NoStreamFound);
+ mp_tmsg(MSGT_NETWORK,MSGL_ERR,"No stream found.\n");
goto err_out;
}
asf_http_ctrl->request++;
@@ -799,7 +797,7 @@ static int asf_http_streaming_start( stream_t *stream, int *demuxer_type ) {
break;
case ASF_Unknown_e:
default:
- mp_msg(MSGT_NETWORK,MSGL_ERR,MSGTR_MPDEMUX_ASF_UnknownASFStreamingType);
+ mp_tmsg(MSGT_NETWORK,MSGL_ERR,"unknown ASF streaming type\n");
goto err_out;
}
// Check if we got a redirect.
@@ -835,12 +833,14 @@ static int open_s(stream_t *stream,int mode, void* opts, int* file_format) {
if( stream->streaming_ctrl==NULL ) {
return STREAM_ERROR;
}
+ stream->streaming_ctrl->audio_id_ptr = &stream->opts->audio_id;
+ stream->streaming_ctrl->video_id_ptr = &stream->opts->video_id;
stream->streaming_ctrl->bandwidth = network_bandwidth;
url = url_new(stream->url);
stream->streaming_ctrl->url = check4proxies(url);
url_free(url);
- mp_msg(MSGT_OPEN, MSGL_INFO, MSGTR_MPDEMUX_ASF_InfoStreamASFURL, stream->url);
+ mp_tmsg(MSGT_OPEN, MSGL_INFO, "STREAM_ASF, URL: %s\n", stream->url);
if((!strncmp(stream->url, "http", 4)) && (*file_format!=DEMUXER_TYPE_ASF && *file_format!=DEMUXER_TYPE_UNKNOWN)) {
streaming_ctrl_free(stream->streaming_ctrl);
stream->streaming_ctrl = NULL;
@@ -848,7 +848,7 @@ static int open_s(stream_t *stream,int mode, void* opts, int* file_format) {
}
if(asf_streaming_start(stream, file_format) < 0) {
- mp_msg(MSGT_OPEN, MSGL_ERR, MSGTR_MPDEMUX_ASF_StreamingFailed);
+ mp_tmsg(MSGT_OPEN, MSGL_ERR, "Failed, exiting.\n");
streaming_ctrl_free(stream->streaming_ctrl);
stream->streaming_ctrl = NULL;
return STREAM_UNSUPPORTED;
@@ -871,4 +871,3 @@ const stream_info_t stream_info_asf = {
NULL,
0 // Urls are an option string
};
-
diff --git a/stream/audio_in.c b/stream/audio_in.c
index 48e325706a..bb18f7db11 100644
--- a/stream/audio_in.c
+++ b/stream/audio_in.c
@@ -203,16 +203,16 @@ int audio_in_read_chunk(audio_in_t *ai, unsigned char *buffer)
ret = snd_pcm_readi(ai->alsa.handle, buffer, ai->alsa.chunk_size);
if (ret != ai->alsa.chunk_size) {
if (ret < 0) {
- mp_msg(MSGT_TV, MSGL_ERR, MSGTR_MPDEMUX_AUDIOIN_ErrReadingAudio, snd_strerror(ret));
+ mp_tmsg(MSGT_TV, MSGL_ERR, "\nError reading audio: %s\n", snd_strerror(ret));
if (ret == -EPIPE) {
if (ai_alsa_xrun(ai) == 0) {
- mp_msg(MSGT_TV, MSGL_ERR, MSGTR_MPDEMUX_AUDIOIN_XRUNSomeFramesMayBeLeftOut);
+ mp_tmsg(MSGT_TV, MSGL_ERR, "Recovered from cross-run, some frames may be left out!\n");
} else {
- mp_msg(MSGT_TV, MSGL_ERR, MSGTR_MPDEMUX_AUDIOIN_ErrFatalCannotRecover);
+ mp_tmsg(MSGT_TV, MSGL_ERR, "Fatal error, cannot recover!\n");
}
}
} else {
- mp_msg(MSGT_TV, MSGL_ERR, MSGTR_MPDEMUX_AUDIOIN_NotEnoughSamples);
+ mp_tmsg(MSGT_TV, MSGL_ERR, "\nNot enough audio samples!\n");
}
return -1;
}
@@ -223,9 +223,9 @@ int audio_in_read_chunk(audio_in_t *ai, unsigned char *buffer)
ret = read(ai->oss.audio_fd, buffer, ai->blocksize);
if (ret != ai->blocksize) {
if (ret < 0) {
- mp_msg(MSGT_TV, MSGL_ERR, MSGTR_MPDEMUX_AUDIOIN_ErrReadingAudio, strerror(errno));
+ mp_tmsg(MSGT_TV, MSGL_ERR, "\nError reading audio: %s\n", strerror(errno));
} else {
- mp_msg(MSGT_TV, MSGL_ERR, MSGTR_MPDEMUX_AUDIOIN_NotEnoughSamples);
+ mp_tmsg(MSGT_TV, MSGL_ERR, "\nNot enough audio samples!\n");
}
return -1;
}
diff --git a/stream/cache2.c b/stream/cache2.c
index 1197df9df1..38061a4779 100644
--- a/stream/cache2.c
+++ b/stream/cache2.c
@@ -56,10 +56,6 @@ static void *ThreadProc(void *s);
#include "stream.h"
#include "cache2.h"
-extern int use_gui;
-
-int stream_fill_buffer(stream_t *s);
-int stream_seek_long(stream_t *s,off_t pos);
typedef struct {
// constats:
@@ -93,13 +89,13 @@ static int min_fill=0;
int cache_fill_status=0;
-void cache_stats(cache_vars_t* s){
+static void cache_stats(cache_vars_t* s){
int newb=s->max_filepos-s->read_filepos; // new bytes in the buffer
mp_msg(MSGT_CACHE,MSGL_INFO,"0x%06X [0x%06X] 0x%06X ",(int)s->min_filepos,(int)s->read_filepos,(int)s->max_filepos);
mp_msg(MSGT_CACHE,MSGL_INFO,"%3d %% (%3d%%)\n",100*newb/s->buffer_size,100*min_fill/s->buffer_size);
}
-int cache_read(cache_vars_t* s,unsigned char* buf,int size){
+static int cache_read(cache_vars_t* s,unsigned char* buf,int size){
int total=0;
while(size>0){
int pos,newb,len;
@@ -145,7 +141,7 @@ int cache_read(cache_vars_t* s,unsigned char* buf,int size){
return total;
}
-int cache_fill(cache_vars_t* s){
+static int cache_fill(cache_vars_t* s){
int back,back2,newb,space,len,pos;
off_t read=s->read_filepos;
@@ -390,7 +386,7 @@ int stream_enable_cache(stream_t *stream,int size,int min,int seek_limit){
mp_msg(MSGT_CACHE,MSGL_V,"CACHE_PRE_INIT: %"PRId64" [%"PRId64"] %"PRId64" pre:%d eof:%d \n",
(int64_t)s->min_filepos,(int64_t)s->read_filepos,(int64_t)s->max_filepos,min,s->eof);
while(s->read_filepos<s->min_filepos || s->max_filepos-s->read_filepos<min){
- mp_msg(MSGT_CACHE,MSGL_STATUS,MSGTR_CacheFill,
+ mp_tmsg(MSGT_CACHE,MSGL_STATUS,"\rCache fill: %5.2f%% (%"PRId64" bytes) ",
100.0*(float)(s->max_filepos-s->read_filepos)/(float)(s->buffer_size),
(int64_t)s->max_filepos-s->read_filepos
);
@@ -417,9 +413,6 @@ static void ThreadProc( void *s ){
#endif
#endif
-#ifdef CONFIG_GUI
- use_gui = 0; // mp_msg may not use gui stuff in forked code
-#endif
// cache thread mainloop:
signal(SIGTERM,exit_sighandler); // kill
do {
diff --git a/stream/cdinfo.c b/stream/cdinfo.c
index d70f55070d..182ce3fe70 100644
--- a/stream/cdinfo.c
+++ b/stream/cdinfo.c
@@ -41,7 +41,7 @@ cd_info_new(void) {
cd_info = malloc(sizeof(cd_info_t));
if( cd_info==NULL ) {
- mp_msg(MSGT_DEMUX, MSGL_ERR, MSGTR_MemAllocFailed);
+ mp_tmsg(MSGT_DEMUX, MSGL_ERR, "Memory allocation failed.\n");
return NULL;
}
@@ -75,14 +75,14 @@ cd_info_add_track(cd_info_t *cd_info, char *track_name, unsigned int track_nb, u
cd_track = malloc(sizeof(cd_track_t));
if( cd_track==NULL ) {
- mp_msg(MSGT_DEMUX, MSGL_ERR, MSGTR_MemAllocFailed);
+ mp_tmsg(MSGT_DEMUX, MSGL_ERR, "Memory allocation failed.\n");
return NULL;
}
memset(cd_track, 0, sizeof(cd_track_t));
cd_track->name = malloc(strlen(track_name)+1);
if( cd_track->name==NULL ) {
- mp_msg(MSGT_DEMUX, MSGL_ERR, MSGTR_MemAllocFailed);
+ mp_tmsg(MSGT_DEMUX, MSGL_ERR, "Memory allocation failed.\n");
free(cd_track);
return NULL;
}
diff --git a/stream/network.c b/stream/network.c
index e90b4a4b90..0e1771113f 100644
--- a/stream/network.c
+++ b/stream/network.c
@@ -114,7 +114,7 @@ streaming_ctrl_new(void) {
streaming_ctrl_t *streaming_ctrl;
streaming_ctrl = malloc(sizeof(streaming_ctrl_t));
if( streaming_ctrl==NULL ) {
- mp_msg(MSGT_NETWORK,MSGL_FATAL,MSGTR_MemAllocFailed);
+ mp_tmsg(MSGT_NETWORK,MSGL_FATAL,"Memory allocation failed.\n");
return NULL;
}
memset( streaming_ctrl, 0, sizeof(streaming_ctrl_t) );
@@ -151,15 +151,15 @@ check4proxies( URL_t *url ) {
URL_t *proxy_url = url_new( proxy );
if( proxy_url==NULL ) {
- mp_msg(MSGT_NETWORK,MSGL_WARN,
- MSGTR_MPDEMUX_NW_InvalidProxySettingTryingWithout);
+ mp_tmsg(MSGT_NETWORK,MSGL_WARN,
+ "Invalid proxy setting... Trying without proxy.\n");
return url_out;
}
#ifdef HAVE_AF_INET6
if (network_ipv4_only_proxy && (gethostbyname(url->hostname)==NULL)) {
- mp_msg(MSGT_NETWORK,MSGL_WARN,
- MSGTR_MPDEMUX_NW_CantResolvTryingWithoutProxy);
+ mp_tmsg(MSGT_NETWORK,MSGL_WARN,
+ "Could not resolve remote hostname for AF_INET. Trying without proxy.\n");
url_free(proxy_url);
return url_out;
}
@@ -169,7 +169,7 @@ check4proxies( URL_t *url ) {
len = strlen( proxy_url->hostname ) + strlen( url->url ) + 20; // 20 = http_proxy:// + port
new_url = malloc( len+1 );
if( new_url==NULL ) {
- mp_msg(MSGT_NETWORK,MSGL_FATAL,MSGTR_MemAllocFailed);
+ mp_tmsg(MSGT_NETWORK,MSGL_FATAL,"Memory allocation failed.\n");
url_free(proxy_url);
return url_out;
}
@@ -254,7 +254,7 @@ http_send_request( URL_t *url, off_t pos ) {
ret = send( fd, http_hdr->buffer, http_hdr->buffer_size, 0 );
if( ret!=(int)http_hdr->buffer_size ) {
- mp_msg(MSGT_NETWORK,MSGL_ERR,MSGTR_MPDEMUX_NW_ErrSendingHTTPRequest);
+ mp_tmsg(MSGT_NETWORK,MSGL_ERR,"Error while sending HTTP request: Didn't send all the request.\n");
goto err_out;
}
@@ -283,12 +283,12 @@ http_read_response( int fd ) {
do {
i = recv( fd, response, BUFFER_SIZE, 0 );
if( i<0 ) {
- mp_msg(MSGT_NETWORK,MSGL_ERR,MSGTR_MPDEMUX_NW_ReadFailed);
+ mp_tmsg(MSGT_NETWORK,MSGL_ERR,"Read failed.\n");
http_free( http_hdr );
return NULL;
}
if( i==0 ) {
- mp_msg(MSGT_NETWORK,MSGL_ERR,MSGTR_MPDEMUX_NW_Read0CouldBeEOF);
+ mp_tmsg(MSGT_NETWORK,MSGL_ERR,"http_read_response read 0 (i.e. EOF).\n");
http_free( http_hdr );
return NULL;
}
@@ -302,8 +302,14 @@ int
http_authenticate(HTTP_header_t *http_hdr, URL_t *url, int *auth_retry) {
char *aut;
+#define MPDEMUX_NW_AuthFailed _(\
+"Authentication failed. Please use the -user and -passwd options to provide your\n"\
+"username/password for a list of URLs, or form an URL like:\n"\
+"http://username:password@hostname/file\n")
+
+
if( *auth_retry==1 ) {
- mp_msg(MSGT_NETWORK,MSGL_ERR,MSGTR_MPDEMUX_NW_AuthFailed);
+ mp_tmsg(MSGT_NETWORK,MSGL_ERR,MPDEMUX_NW_AuthFailed);
return -1;
}
if( *auth_retry>0 ) {
@@ -322,28 +328,28 @@ http_authenticate(HTTP_header_t *http_hdr, URL_t *url, int *auth_retry) {
char *aut_space;
aut_space = strstr(aut, "realm=");
if( aut_space!=NULL ) aut_space += 6;
- mp_msg(MSGT_NETWORK,MSGL_INFO,MSGTR_MPDEMUX_NW_AuthRequiredFor, aut_space);
+ mp_tmsg(MSGT_NETWORK,MSGL_INFO,"Authentication required for %s\n", aut_space);
} else {
- mp_msg(MSGT_NETWORK,MSGL_INFO,MSGTR_MPDEMUX_NW_AuthRequired);
+ mp_tmsg(MSGT_NETWORK,MSGL_INFO,"Authentication required.\n");
}
if( network_username ) {
url->username = strdup(network_username);
if( url->username==NULL ) {
- mp_msg(MSGT_NETWORK,MSGL_FATAL,MSGTR_MemAllocFailed);
+ mp_tmsg(MSGT_NETWORK,MSGL_FATAL,"Memory allocation failed.\n");
return -1;
}
} else {
- mp_msg(MSGT_NETWORK,MSGL_ERR,MSGTR_MPDEMUX_NW_AuthFailed);
+ mp_tmsg(MSGT_NETWORK,MSGL_ERR,MPDEMUX_NW_AuthFailed);
return -1;
}
if( network_password ) {
url->password = strdup(network_password);
if( url->password==NULL ) {
- mp_msg(MSGT_NETWORK,MSGL_FATAL,MSGTR_MemAllocFailed);
+ mp_tmsg(MSGT_NETWORK,MSGL_FATAL,"Memory allocation failed.\n");
return -1;
}
} else {
- mp_msg(MSGT_NETWORK,MSGL_INFO,MSGTR_MPDEMUX_NW_NoPasswdProvidedTryingBlank);
+ mp_tmsg(MSGT_NETWORK,MSGL_INFO,"No password provided, trying blank password.\n");
}
(*auth_retry)++;
return 0;
@@ -376,7 +382,7 @@ http_seek( stream_t *stream, off_t pos ) {
}
break;
default:
- mp_msg(MSGT_NETWORK,MSGL_ERR,MSGTR_MPDEMUX_NW_ErrServerReturned, http_hdr->status_code, http_hdr->reason_phrase );
+ mp_tmsg(MSGT_NETWORK,MSGL_ERR,"Server returns %d: %s\n", http_hdr->status_code, http_hdr->reason_phrase );
close( fd );
fd = -1;
}
@@ -398,7 +404,7 @@ streaming_bufferize( streaming_ctrl_t *streaming_ctrl, char *buffer, int size) {
//printf("streaming_bufferize\n");
streaming_ctrl->buffer = malloc(size);
if( streaming_ctrl->buffer==NULL ) {
- mp_msg(MSGT_NETWORK,MSGL_FATAL,MSGTR_MemAllocFailed);
+ mp_tmsg(MSGT_NETWORK,MSGL_FATAL,"Memory allocation failed.\n");
return -1;
}
memcpy( streaming_ctrl->buffer, buffer, size );
@@ -458,7 +464,7 @@ void fixup_network_stream_cache(stream_t *stream) {
stream_cache_size = (stream->streaming_ctrl->prebuffer_size/1024)*5;
if( stream_cache_size<64 ) stream_cache_size = 64; // 16KBytes min buffer
}
- mp_msg(MSGT_NETWORK,MSGL_INFO,MSGTR_MPDEMUX_NW_CacheSizeSetTo, stream_cache_size);
+ mp_tmsg(MSGT_NETWORK,MSGL_INFO,"Cache size set to %d KBytes\n", stream_cache_size);
}
}
diff --git a/stream/network.h b/stream/network.h
index c75d7f6fdb..8e1f5982b3 100644
--- a/stream/network.h
+++ b/stream/network.h
@@ -69,6 +69,9 @@ typedef struct streaming_control {
int (*streaming_read)( int fd, char *buffer, int buffer_size, struct streaming_control *stream_ctrl );
int (*streaming_seek)( int fd, off_t pos, struct streaming_control *stream_ctrl );
void *data;
+ // hacks for asf
+ int *audio_id_ptr;
+ int *video_id_ptr;
} streaming_ctrl_t;
//int streaming_start( stream_t *stream, int *demuxer_type, URL_t *url );
diff --git a/stream/open.c b/stream/open.c
index b14d37d562..77157aff5a 100644
--- a/stream/open.c
+++ b/stream/open.c
@@ -47,7 +47,8 @@ int dvd_title=0;
// Open a new stream (stdin/file/vcd/url)
-stream_t* open_stream(char* filename,char** options, int* file_format){
+stream_t* open_stream(char* filename, struct MPOpts *options, int* file_format)
+{
// Check if playlist or unknown
if (*file_format != DEMUXER_TYPE_PLAYLIST){
*file_format=DEMUXER_TYPE_UNKNOWN;
@@ -62,4 +63,3 @@ if(!filename) {
return open_stream_full(filename,STREAM_READ,options,file_format);
}
-
diff --git a/stream/pnm.c b/stream/pnm.c
index 650aeb40cb..e211a67f8d 100644
--- a/stream/pnm.c
+++ b/stream/pnm.c
@@ -43,7 +43,7 @@
#include <winsock2.h>
#endif
-#include "libavutil/intreadwrite.h"
+#include "ffmpeg_files/intreadwrite.h"
#include "stream.h"
#include "libmpdemux/demuxer.h"
diff --git a/stream/realrtsp/asmrp.c b/stream/realrtsp/asmrp.c
index 699f14c159..bcbe1c9389 100644
--- a/stream/realrtsp/asmrp.c
+++ b/stream/realrtsp/asmrp.c
@@ -688,4 +688,3 @@ int asmrp_match (const char *rules, int bandwidth, int *matches) {
return num_matches;
}
-
diff --git a/stream/realrtsp/real.c b/stream/realrtsp/real.c
index 0206833301..cad231dedd 100644
--- a/stream/realrtsp/real.c
+++ b/stream/realrtsp/real.c
@@ -37,7 +37,7 @@
#include "sdpplin.h"
#include "xbuffer.h"
#include "libavutil/md5.h"
-#include "libavutil/intreadwrite.h"
+#include "ffmpeg_files/intreadwrite.h"
#include "stream/http.h"
#include "mp_msg.h"
diff --git a/stream/realrtsp/rmff.c b/stream/realrtsp/rmff.c
index 3221df9dad..e147b76f36 100644
--- a/stream/realrtsp/rmff.c
+++ b/stream/realrtsp/rmff.c
@@ -29,7 +29,7 @@
#include "rmff.h"
#include "xbuffer.h"
#include "mp_msg.h"
-#include "libavutil/intreadwrite.h"
+#include "ffmpeg_files/intreadwrite.h"
/*
#define LOG
diff --git a/stream/realrtsp/sdpplin.c b/stream/realrtsp/sdpplin.c
index 9669b085fd..fe561f4082 100644
--- a/stream/realrtsp/sdpplin.c
+++ b/stream/realrtsp/sdpplin.c
@@ -394,4 +394,3 @@ void sdpplin_free(sdpplin_t *description) {
free(description);
}
-
diff --git a/stream/stream.c b/stream/stream.c
index 87b2e02a29..8388a1a1a6 100644
--- a/stream/stream.c
+++ b/stream/stream.c
@@ -49,7 +49,9 @@
//#include "vcd_read_bincue.h"
-static int (*stream_check_interrupt_cb)(int time) = NULL;
+struct input_ctx;
+static int (*stream_check_interrupt_cb)(struct input_ctx *ctx, int time);
+static struct input_ctx *stream_check_interrupt_ctx;
extern const stream_info_t stream_info_vcd;
extern const stream_info_t stream_info_cdda;
@@ -140,9 +142,11 @@ static const stream_info_t* const auto_open_streams[] = {
NULL
};
-stream_t* open_stream_plugin(const stream_info_t* sinfo,char* filename,int mode,
- char** options, int* file_format, int* ret,
- char** redirected_url) {
+static stream_t *open_stream_plugin(const stream_info_t *sinfo, char *filename,
+ int mode, struct MPOpts *options,
+ int *file_format, int *ret,
+ char **redirected_url)
+{
void* arg = NULL;
stream_t* s;
m_struct_t* desc = (m_struct_t*)sinfo->opts;
@@ -159,18 +163,9 @@ stream_t* open_stream_plugin(const stream_info_t* sinfo,char* filename,int mode,
return NULL;
}
}
- if(options) {
- int i;
- for(i = 0 ; options[i] != NULL ; i += 2) {
- mp_msg(MSGT_OPEN,MSGL_DBG2, "Set stream arg %s=%s\n",
- options[i],options[i+1]);
- if(!m_struct_set(desc,arg,options[i],options[i+1]))
- mp_msg(MSGT_OPEN,MSGL_WARN, "Failed to set stream option %s=%s\n",
- options[i],options[i+1]);
- }
- }
}
s = new_stream(-2,-2);
+ s->opts = options;
s->url=strdup(filename);
s->flags |= mode;
*ret = sinfo->open(s,mode,arg,file_format);
@@ -207,7 +202,9 @@ stream_t* open_stream_plugin(const stream_info_t* sinfo,char* filename,int mode,
}
-stream_t* open_stream_full(char* filename,int mode, char** options, int* file_format) {
+stream_t *open_stream_full(char *filename,int mode, struct MPOpts *options,
+ int* file_format)
+{
int i,j,l,r;
const stream_info_t* sinfo;
stream_t* s;
@@ -237,7 +234,7 @@ stream_t* open_stream_full(char* filename,int mode, char** options, int* file_fo
return s;
}
else if(r != STREAM_UNSUPPORTED) {
- mp_msg(MSGT_OPEN,MSGL_ERR, MSGTR_FailedToOpen,filename);
+ mp_tmsg(MSGT_OPEN,MSGL_ERR, "Failed to open %s.\n",filename);
return NULL;
}
break;
@@ -249,7 +246,8 @@ stream_t* open_stream_full(char* filename,int mode, char** options, int* file_fo
return NULL;
}
-stream_t* open_output_stream(char* filename,char** options) {
+stream_t *open_output_stream(char *filename, struct MPOpts *options)
+{
int file_format; //unused
if(!filename) {
mp_msg(MSGT_OPEN,MSGL_ERR,"open_output_stream(), NULL filename, report this bug\n");
@@ -374,18 +372,22 @@ if(newpos==0 || newpos!=s->pos){
// putchar('%');fflush(stdout);
}
-while(stream_fill_buffer(s) > 0 && pos >= 0) {
+s->eof = 0; // EOF reset when seek succeeds.
+while (stream_fill_buffer(s) > 0) {
if(pos<=s->buf_len){
s->buf_pos=pos; // byte position in sector
return 1;
}
pos -= s->buf_len;
}
-
-// if(pos==s->buf_len) printf("XXX Seek to last byte of file -> EOF\n");
-
- mp_msg(MSGT_STREAM,MSGL_V,"stream_seek: WARNING! Can't seek to 0x%"PRIX64" !\n",(int64_t)(pos+newpos));
- return 0;
+// Fill failed, but seek still is a success.
+s->pos += pos;
+s->buf_pos = 0;
+s->buf_len = 0;
+
+mp_msg(MSGT_STREAM,MSGL_V,
+ "stream_seek: Seek to/past EOF: no buffer preloaded.\n");
+return 1;
}
@@ -478,11 +480,14 @@ stream_t* new_ds_stream(demux_stream_t *ds) {
return s;
}
-void stream_set_interrupt_callback(int (*cb)(int)) {
+void stream_set_interrupt_callback(int (*cb)(struct input_ctx *, int),
+ struct input_ctx *ctx)
+{
stream_check_interrupt_cb = cb;
+ stream_check_interrupt_ctx = ctx;
}
int stream_check_interrupt(int time) {
if(!stream_check_interrupt_cb) return 0;
- return stream_check_interrupt_cb(time);
+ return stream_check_interrupt_cb(stream_check_interrupt_ctx, time);
}
diff --git a/stream/stream.h b/stream/stream.h
index a995b8119f..7c020b243f 100644
--- a/stream/stream.h
+++ b/stream/stream.h
@@ -93,7 +93,7 @@
#include "network.h"
#endif
-struct stream_st;
+struct stream;
typedef struct stream_info_st {
const char *info;
const char *name;
@@ -102,7 +102,7 @@ typedef struct stream_info_st {
/// mode isn't used atm (ie always READ) but it shouldn't be ignored
/// opts is at least in it's defaults settings and may have been
/// altered by url parsing if enabled and the options string parsing.
- int (*open)(struct stream_st* st, int mode, void* opts, int* file_format);
+ int (*open)(struct stream* st, int mode, void* opts, int* file_format);
const char* protocols[MAX_STREAM_PROTOCOLS];
const void* opts;
int opts_url; /* If this is 1 we will parse the url as an option string
@@ -110,19 +110,19 @@ typedef struct stream_info_st {
* options string given to open_stream_plugin */
} stream_info_t;
-typedef struct stream_st {
+typedef struct stream {
// Read
- int (*fill_buffer)(struct stream_st *s, char* buffer, int max_len);
+ int (*fill_buffer)(struct stream *s, char* buffer, int max_len);
// Write
- int (*write_buffer)(struct stream_st *s, char* buffer, int len);
+ int (*write_buffer)(struct stream *s, char* buffer, int len);
// Seek
- int (*seek)(struct stream_st *s,off_t pos);
+ int (*seek)(struct stream *s,off_t pos);
// Control
// Will be later used to let streams like dvd and cdda report
// their structure (ie tracks, chapters, etc)
- int (*control)(struct stream_st *s,int cmd,void* arg);
+ int (*control)(struct stream *s,int cmd,void* arg);
// Close
- void (*close)(struct stream_st *s);
+ void (*close)(struct stream *s);
int fd; // file descriptor, see man open(2)
int type; // see STREAMTYPE_*
@@ -136,20 +136,21 @@ typedef struct stream_st {
void* cache_data;
void* priv; // used for DVD, TV, RTSP etc
char* url; // strdup() of filename/url
+ struct MPOpts *opts;
#ifdef CONFIG_NETWORK
streaming_ctrl_t *streaming_ctrl;
#endif
unsigned char buffer[STREAM_BUFFER_SIZE>VCD_SECTOR_SIZE?STREAM_BUFFER_SIZE:VCD_SECTOR_SIZE];
} stream_t;
+int stream_fill_buffer(stream_t *s);
+int stream_seek_long(stream_t *s,off_t pos);
#ifdef CONFIG_STREAM_CACHE
int stream_enable_cache(stream_t *stream,int size,int min,int prefill);
int cache_stream_fill_buffer(stream_t *s);
int cache_stream_seek_long(stream_t *s,off_t pos);
#else
// no cache, define wrappers:
-int stream_fill_buffer(stream_t *s);
-int stream_seek_long(stream_t *s,off_t pos);
#define cache_stream_fill_buffer(x) stream_fill_buffer(x)
#define cache_stream_seek_long(x,y) stream_seek_long(x,y)
#define stream_enable_cache(x,y,z,w) 1
@@ -286,6 +287,7 @@ inline static int stream_seek(stream_t *s,off_t pos){
off_t x=pos-(s->pos-s->buf_len);
if(x>=0){
s->buf_pos=x;
+ s->eof = 0;
// putchar('*');fflush(stdout);
return 1;
}
@@ -312,17 +314,20 @@ inline static int stream_skip(stream_t *s,off_t len){
return 1;
}
+struct MPOpts;
void stream_reset(stream_t *s);
int stream_control(stream_t *s, int cmd, void *arg);
stream_t* new_stream(int fd,int type);
void free_stream(stream_t *s);
stream_t* new_memory_stream(unsigned char* data,int len);
-stream_t* open_stream(char* filename,char** options,int* file_format);
-stream_t* open_stream_full(char* filename,int mode, char** options, int* file_format);
-stream_t* open_output_stream(char* filename,char** options);
+stream_t* open_stream(char* filename, struct MPOpts *options,int* file_format);
+stream_t* open_stream_full(char* filename,int mode, struct MPOpts *options, int* file_format);
+stream_t* open_output_stream(char* filename,struct MPOpts *options);
/// Set the callback to be used by libstream to check for user
/// interruption during long blocking operations (cache filling, etc).
-void stream_set_interrupt_callback(int (*cb)(int));
+struct input_ctx;
+void stream_set_interrupt_callback(int (*cb)(struct input_ctx*, int),
+ struct input_ctx *ctx);
/// Call the interrupt checking callback if there is one.
int stream_check_interrupt(int time);
diff --git a/stream/stream_cdda.c b/stream/stream_cdda.c
index 2cb440a2ac..8f8e414e23 100644
--- a/stream/stream_cdda.c
+++ b/stream/stream_cdda.c
@@ -213,7 +213,7 @@ static int open_cdda(stream_t *st,int m, void* opts, int* file_format) {
#endif
if(!cdd) {
- mp_msg(MSGT_OPEN,MSGL_ERR,MSGTR_MPDEMUX_CDDA_CantOpenCDDADevice);
+ mp_tmsg(MSGT_OPEN,MSGL_ERR,"Can't open CDDA device.\n");
m_struct_free(&stream_opts,opts);
free(cddb_info);
return STREAM_ERROR;
@@ -229,7 +229,7 @@ static int open_cdda(stream_t *st,int m, void* opts, int* file_format) {
}
if(cdda_open(cdd) != 0) {
- mp_msg(MSGT_OPEN,MSGL_ERR,MSGTR_MPDEMUX_CDDA_CantOpenDisc);
+ mp_tmsg(MSGT_OPEN,MSGL_ERR,"Can't open disc.\n");
cdda_close(cdd);
m_struct_free(&stream_opts,opts);
free(cddb_info);
@@ -237,7 +237,7 @@ static int open_cdda(stream_t *st,int m, void* opts, int* file_format) {
}
cd_info = cd_info_new();
- mp_msg(MSGT_OPEN,MSGL_INFO,MSGTR_MPDEMUX_CDDA_AudioCDFoundWithNTracks,cdda_tracks(cdd));
+ mp_tmsg(MSGT_OPEN,MSGL_INFO,"Found audio CD with %ld tracks.\n",cdda_tracks(cdd));
for(i=0;i<cdd->tracks;i++) {
char track_name[80];
long sec=cdda_track_firstsector(cdd,i+1);
diff --git a/stream/stream_cddb.c b/stream/stream_cddb.c
index ad1b335de3..0c1bc0ccc6 100644
--- a/stream/stream_cddb.c
+++ b/stream/stream_cddb.c
@@ -96,7 +96,7 @@ read_toc(const char *dev) {
drive = CreateFile(device, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, 0);
if(!DeviceIoControl(drive, IOCTL_CDROM_READ_TOC, NULL, 0, &toc, sizeof(CDROM_TOC), &r, 0)) {
- mp_msg(MSGT_OPEN, MSGL_ERR, MSGTR_MPDEMUX_CDDB_FailedToReadTOC);
+ mp_tmsg(MSGT_OPEN, MSGL_ERR, "Failed to read TOC.\n");
return 0;
}
@@ -233,7 +233,7 @@ int cdd_identify(const char *dev)
int i, min, sec, frame;
cdtoc_last_track = read_toc(dev);
if (cdtoc_last_track < 0) {
- mp_msg(MSGT_OPEN, MSGL_ERR, MSGTR_MPDEMUX_CDDB_FailedToOpenDevice, dev);
+ mp_tmsg(MSGT_OPEN, MSGL_ERR, "Failed to open %s device.\n", dev);
return -1;
}
mp_msg(MSGT_GLOBAL, MSGL_INFO, "ID_CDDA_TRACKS=%d\n", cdtoc_last_track);
@@ -292,19 +292,19 @@ cddb_http_request(char *command, int (*reply_parser)(HTTP_header_t*,cddb_data_t*
url = url_new(request);
if( url==NULL ) {
- mp_msg(MSGT_DEMUX, MSGL_ERR, MSGTR_MPDEMUX_CDDB_NotAValidURL);
+ mp_tmsg(MSGT_DEMUX, MSGL_ERR, "not a valid URL\n");
return -1;
}
fd = http_send_request(url,0);
if( fd<0 ) {
- mp_msg(MSGT_DEMUX, MSGL_ERR, MSGTR_MPDEMUX_CDDB_FailedToSendHTTPRequest);
+ mp_tmsg(MSGT_DEMUX, MSGL_ERR, "Failed to send the HTTP request.\n");
return -1;
}
http_hdr = http_read_response( fd );
if( http_hdr==NULL ) {
- mp_msg(MSGT_DEMUX, MSGL_ERR, MSGTR_MPDEMUX_CDDB_FailedToReadHTTPResponse);
+ mp_tmsg(MSGT_DEMUX, MSGL_ERR, "Failed to read the HTTP response.\n");
return -1;
}
@@ -316,10 +316,10 @@ cddb_http_request(char *command, int (*reply_parser)(HTTP_header_t*,cddb_data_t*
ret = reply_parser(http_hdr, cddb_data);
break;
case 400:
- mp_msg(MSGT_DEMUX, MSGL_ERR, MSGTR_MPDEMUX_CDDB_HTTPErrorNOTFOUND);
+ mp_tmsg(MSGT_DEMUX, MSGL_ERR, "Not Found.\n");
break;
default:
- mp_msg(MSGT_DEMUX, MSGL_ERR, MSGTR_MPDEMUX_CDDB_HTTPErrorUnknown);
+ mp_tmsg(MSGT_DEMUX, MSGL_ERR, "unknown error code\n");
}
http_free( http_hdr );
@@ -345,7 +345,7 @@ cddb_read_cache(cddb_data_t *cddb_data) {
#endif
);
if( file_fd<0 ) {
- mp_msg(MSGT_DEMUX, MSGL_ERR, MSGTR_MPDEMUX_CDDB_NoCacheFound);
+ mp_tmsg(MSGT_DEMUX, MSGL_ERR, "No cache found.\n");
return -1;
}
@@ -359,13 +359,13 @@ cddb_read_cache(cddb_data_t *cddb_data) {
cddb_data->xmcd_file = malloc(file_size+1);
if( cddb_data->xmcd_file==NULL ) {
- mp_msg(MSGT_DEMUX, MSGL_ERR, MSGTR_MemAllocFailed);
+ mp_tmsg(MSGT_DEMUX, MSGL_ERR, "Memory allocation failed.\n");
close(file_fd);
return -1;
}
cddb_data->xmcd_file_size = read(file_fd, cddb_data->xmcd_file, file_size);
if( cddb_data->xmcd_file_size!=file_size ) {
- mp_msg(MSGT_DEMUX, MSGL_WARN, MSGTR_MPDEMUX_CDDB_NotAllXMCDFileHasBeenRead);
+ mp_tmsg(MSGT_DEMUX, MSGL_WARN, "Not all the xmcd file has been read.\n");
close(file_fd);
return -1;
}
@@ -397,7 +397,7 @@ cddb_write_cache(cddb_data_t *cddb_data) {
if( ret<0 ) {
#endif
perror("mkdir");
- mp_msg(MSGT_DEMUX, MSGL_ERR, MSGTR_MPDEMUX_CDDB_FailedToCreateDirectory, cddb_data->cache_dir);
+ mp_tmsg(MSGT_DEMUX, MSGL_ERR, "Failed to create directory %s.\n", cddb_data->cache_dir);
return -1;
}
}
@@ -417,7 +417,7 @@ cddb_write_cache(cddb_data_t *cddb_data) {
return -1;
}
if( (unsigned int)wrote!=cddb_data->xmcd_file_size ) {
- mp_msg(MSGT_DEMUX, MSGL_WARN, MSGTR_MPDEMUX_CDDB_NotAllXMCDFileHasBeenWritten);
+ mp_tmsg(MSGT_DEMUX, MSGL_WARN, "Not all of the xmcd file has been written.\n");
close(file_fd);
return -1;
}
@@ -438,7 +438,7 @@ cddb_read_parse(HTTP_header_t *http_hdr, cddb_data_t *cddb_data) {
ret = sscanf( http_hdr->body, "%d ", &status);
if( ret!=1 ) {
- mp_msg(MSGT_DEMUX, MSGL_ERR, MSGTR_ParseError);
+ mp_tmsg(MSGT_DEMUX, MSGL_ERR, "parse error");
return -1;
}
@@ -446,13 +446,13 @@ cddb_read_parse(HTTP_header_t *http_hdr, cddb_data_t *cddb_data) {
case 210:
ret = sscanf( http_hdr->body, "%d %99s %08lx", &status, category, &disc_id);
if( ret!=3 ) {
- mp_msg(MSGT_DEMUX, MSGL_ERR, MSGTR_ParseError);
+ mp_tmsg(MSGT_DEMUX, MSGL_ERR, "parse error");
return -1;
}
// Check if it's a xmcd database file
ptr = strstr(http_hdr->body, "# xmcd");
if( ptr==NULL ) {
- mp_msg(MSGT_DEMUX, MSGL_ERR, MSGTR_MPDEMUX_CDDB_InvalidXMCDDatabaseReturned);
+ mp_tmsg(MSGT_DEMUX, MSGL_ERR, "Invalid xmcd database file returned.\n");
return -1;
}
ptr = strdup(ptr);
@@ -469,7 +469,7 @@ cddb_read_parse(HTTP_header_t *http_hdr, cddb_data_t *cddb_data) {
// Ok found the end
// do a sanity check
if( http_hdr->body_size<(unsigned int)(ptr2-ptr) ) {
- mp_msg(MSGT_DEMUX, MSGL_ERR, MSGTR_MPDEMUX_CDDB_UnexpectedFIXME);
+ mp_tmsg(MSGT_DEMUX, MSGL_ERR, "unexpected FIXME\n");
return -1;
}
cddb_data->xmcd_file = ptr;
@@ -477,7 +477,7 @@ cddb_read_parse(HTTP_header_t *http_hdr, cddb_data_t *cddb_data) {
cddb_data->xmcd_file[cddb_data->xmcd_file_size] = '\0';
return cddb_write_cache(cddb_data);
default:
- mp_msg(MSGT_DEMUX, MSGL_FIXME, MSGTR_MPDEMUX_CDDB_UnhandledCode);
+ mp_tmsg(MSGT_DEMUX, MSGL_FIXME, "unhandled code\n");
}
return 0;
}
@@ -497,7 +497,7 @@ cddb_parse_matches_list(HTTP_header_t *http_hdr, cddb_data_t *cddb_data) {
ptr = strstr(http_hdr->body, "\n");
if( ptr==NULL ) {
- mp_msg(MSGT_DEMUX, MSGL_ERR, MSGTR_MPDEMUX_CDDB_UnableToFindEOL);
+ mp_tmsg(MSGT_DEMUX, MSGL_ERR, "Unable to find end of line.\n");
return -1;
}
ptr++;
@@ -505,7 +505,7 @@ cddb_parse_matches_list(HTTP_header_t *http_hdr, cddb_data_t *cddb_data) {
// So let's take the first one.
ret = sscanf(ptr, "%99s %08lx %99s", cddb_data->category, &(cddb_data->disc_id), album_title);
if( ret!=3 ) {
- mp_msg(MSGT_DEMUX, MSGL_ERR, MSGTR_ParseError);
+ mp_tmsg(MSGT_DEMUX, MSGL_ERR, "parse error");
return -1;
}
ptr = strstr(http_hdr->body, album_title);
@@ -522,7 +522,7 @@ cddb_parse_matches_list(HTTP_header_t *http_hdr, cddb_data_t *cddb_data) {
strncpy(album_title, ptr, len);
album_title[len]='\0';
}
- mp_msg(MSGT_DEMUX, MSGL_STATUS, MSGTR_MPDEMUX_CDDB_ParseOKFoundAlbumTitle, album_title);
+ mp_tmsg(MSGT_DEMUX, MSGL_STATUS, "Parse OK, found: %s\n", album_title);
return 0;
}
@@ -534,7 +534,7 @@ cddb_query_parse(HTTP_header_t *http_hdr, cddb_data_t *cddb_data) {
ret = sscanf( http_hdr->body, "%d ", &status);
if( ret!=1 ) {
- mp_msg(MSGT_DEMUX, MSGL_ERR, MSGTR_ParseError);
+ mp_tmsg(MSGT_DEMUX, MSGL_ERR, "parse error");
return -1;
}
@@ -543,7 +543,7 @@ cddb_query_parse(HTTP_header_t *http_hdr, cddb_data_t *cddb_data) {
// Found exact match
ret = sscanf(http_hdr->body, "%d %99s %08lx %99s", &status, cddb_data->category, &(cddb_data->disc_id), album_title);
if( ret!=4 ) {
- mp_msg(MSGT_DEMUX, MSGL_ERR, MSGTR_ParseError);
+ mp_tmsg(MSGT_DEMUX, MSGL_ERR, "parse error");
return -1;
}
ptr = strstr(http_hdr->body, album_title);
@@ -560,11 +560,11 @@ cddb_query_parse(HTTP_header_t *http_hdr, cddb_data_t *cddb_data) {
strncpy(album_title, ptr, len);
album_title[len]='\0';
}
- mp_msg(MSGT_DEMUX, MSGL_STATUS, MSGTR_MPDEMUX_CDDB_ParseOKFoundAlbumTitle, album_title);
+ mp_tmsg(MSGT_DEMUX, MSGL_STATUS, "Parse OK, found: %s\n", album_title);
return cddb_request_titles(cddb_data);
case 202:
// No match found
- mp_msg(MSGT_DEMUX, MSGL_WARN, MSGTR_MPDEMUX_CDDB_AlbumNotFound);
+ mp_tmsg(MSGT_DEMUX, MSGL_WARN, "Album not found.\n");
break;
case 210:
// Found exact matches, list follows
@@ -582,10 +582,10 @@ blues c711930d Santana / Supernatural
cddb_parse_matches_list(http_hdr, cddb_data);
return cddb_request_titles(cddb_data);
case 500:
- mp_msg(MSGT_DEMUX, MSGL_FIXME, MSGTR_MPDEMUX_CDDB_ServerReturnsCommandSyntaxErr);
+ mp_tmsg(MSGT_DEMUX, MSGL_FIXME, "Server returns: Command syntax error\n");
break;
default:
- mp_msg(MSGT_DEMUX, MSGL_FIXME, MSGTR_MPDEMUX_CDDB_UnhandledCode);
+ mp_tmsg(MSGT_DEMUX, MSGL_FIXME, "unhandled code\n");
}
return -1;
}
@@ -598,7 +598,7 @@ cddb_proto_level_parse(HTTP_header_t *http_hdr, cddb_data_t *cddb_data) {
ret = sscanf( http_hdr->body, "%d ", &status);
if( ret!=1 ) {
- mp_msg(MSGT_DEMUX, MSGL_ERR, MSGTR_ParseError);
+ mp_tmsg(MSGT_DEMUX, MSGL_ERR, "parse error");
return -1;
}
@@ -606,18 +606,18 @@ cddb_proto_level_parse(HTTP_header_t *http_hdr, cddb_data_t *cddb_data) {
case 210:
ptr = strstr(http_hdr->body, "max proto:");
if( ptr==NULL ) {
- mp_msg(MSGT_DEMUX, MSGL_ERR, MSGTR_ParseError);
+ mp_tmsg(MSGT_DEMUX, MSGL_ERR, "parse error");
return -1;
}
ret = sscanf(ptr, "max proto: %d", &max);
if( ret!=1 ) {
- mp_msg(MSGT_DEMUX, MSGL_ERR, MSGTR_ParseError);
+ mp_tmsg(MSGT_DEMUX, MSGL_ERR, "parse error");
return -1;
}
cddb_data->freedb_proto_level = max;
return 0;
default:
- mp_msg(MSGT_DEMUX, MSGL_FIXME, MSGTR_MPDEMUX_CDDB_UnhandledCode);
+ mp_tmsg(MSGT_DEMUX, MSGL_FIXME, "unhandled code\n");
}
return -1;
}
@@ -633,7 +633,7 @@ cddb_freedb_sites_parse(HTTP_header_t *http_hdr, cddb_data_t *cddb_data) {
ret = sscanf( http_hdr->body, "%d ", &status);
if( ret!=1 ) {
- mp_msg(MSGT_DEMUX, MSGL_ERR, MSGTR_ParseError);
+ mp_tmsg(MSGT_DEMUX, MSGL_ERR, "parse error");
return -1;
}
@@ -643,10 +643,10 @@ cddb_freedb_sites_parse(HTTP_header_t *http_hdr, cddb_data_t *cddb_data) {
ret = cddb_data->anonymous; // For gcc complaining about unused parameter.
return 0;
case 401:
- mp_msg(MSGT_DEMUX, MSGL_FIXME, MSGTR_MPDEMUX_CDDB_NoSitesInfoAvailable);
+ mp_tmsg(MSGT_DEMUX, MSGL_FIXME, "No sites information available.\n");
break;
default:
- mp_msg(MSGT_DEMUX, MSGL_FIXME, MSGTR_MPDEMUX_CDDB_UnhandledCode);
+ mp_tmsg(MSGT_DEMUX, MSGL_FIXME, "unhandled code\n");
}
return -1;
}
@@ -699,7 +699,7 @@ cddb_retrieve(cddb_data_t *cddb_data) {
cddb_create_hello(cddb_data);
if( cddb_get_proto_level(cddb_data)<0 ) {
- mp_msg(MSGT_DEMUX, MSGL_ERR, MSGTR_MPDEMUX_CDDB_FailedToGetProtocolLevel);
+ mp_tmsg(MSGT_DEMUX, MSGL_ERR, "Failed to get the protocol level.\n");
return -1;
}
@@ -725,7 +725,7 @@ cddb_resolve(const char *dev, char **xmcd_file) {
{
cdtoc_last_track = read_toc(dev);
if (cdtoc_last_track < 0) {
- mp_msg(MSGT_OPEN, MSGL_ERR, MSGTR_MPDEMUX_CDDB_FailedToOpenDevice, dev);
+ mp_tmsg(MSGT_OPEN, MSGL_ERR, "Failed to open %s device.\n", dev);
return -1;
}
}
@@ -738,7 +738,7 @@ cddb_resolve(const char *dev, char **xmcd_file) {
// Check if there is a CD in the drive
// FIXME: That's not really a good way to check
if( cddb_data.disc_id==0 ) {
- mp_msg(MSGT_DEMUX, MSGL_ERR, MSGTR_MPDEMUX_CDDB_NoCDInDrive);
+ mp_tmsg(MSGT_DEMUX, MSGL_ERR, "No CD in the drive.\n");
return -1;
}
@@ -754,7 +754,7 @@ cddb_resolve(const char *dev, char **xmcd_file) {
} else {
cddb_data.cache_dir = malloc(strlen(home_dir)+strlen(cddb_cache_dir)+1);
if( cddb_data.cache_dir==NULL ) {
- mp_msg(MSGT_DEMUX, MSGL_ERR, MSGTR_MemAllocFailed);
+ mp_tmsg(MSGT_DEMUX, MSGL_ERR, "Memory allocation failed.\n");
return -1;
}
sprintf(cddb_data.cache_dir, "%s%s", home_dir, cddb_cache_dir );
diff --git a/stream/stream_cue.c b/stream/stream_cue.c
index 6bddab7c9e..ee890894fc 100644
--- a/stream/stream_cue.c
+++ b/stream/stream_cue.c
@@ -165,8 +165,8 @@ static int cue_getTrackinfo(char *Line, tTrack *track)
}
else if (strncmp(&Line[4], "PREGAP ", 7)==0) { ; /* ignore */ }
else if (strncmp(&Line[4], "FLAGS ", 6)==0) { ; /* ignore */ }
- else mp_msg (MSGT_OPEN,MSGL_INFO,
- MSGTR_MPDEMUX_CUEREAD_UnexpectedCuefileLine, Line);
+ else mp_tmsg (MSGT_OPEN,MSGL_INFO,
+ "[bincue] Unexpected cuefile line: %s\n", Line);
}
return 0;
}
@@ -217,7 +217,7 @@ static int cue_find_bin (char *firstline) {
fd_bin = open (bin_filename, O_RDONLY);
if (fd_bin == -1)
{
- mp_msg(MSGT_OPEN,MSGL_STATUS, MSGTR_MPDEMUX_CUEREAD_BinFilenameTested,
+ mp_tmsg(MSGT_OPEN,MSGL_STATUS, "[bincue] bin filename tested: %s\n",
bin_filename);
/* now try to find it with the path of the cue file */
@@ -225,8 +225,8 @@ static int cue_find_bin (char *firstline) {
fd_bin = open (s, O_RDONLY);
if (fd_bin == -1)
{
- mp_msg(MSGT_OPEN,MSGL_STATUS,
- MSGTR_MPDEMUX_CUEREAD_BinFilenameTested, s);
+ mp_tmsg(MSGT_OPEN,MSGL_STATUS,
+ "[bincue] bin filename tested: %s\n", s);
/* now I would say the whole filename is shit, build our own */
strncpy(s, cue_filename, strlen(cue_filename) - 3 );
s[strlen(cue_filename) - 3] = '\0';
@@ -234,16 +234,16 @@ static int cue_find_bin (char *firstline) {
fd_bin = open (s, O_RDONLY);
if (fd_bin == -1)
{
- mp_msg(MSGT_OPEN,MSGL_STATUS,
- MSGTR_MPDEMUX_CUEREAD_BinFilenameTested, s);
+ mp_tmsg(MSGT_OPEN,MSGL_STATUS,
+ "[bincue] bin filename tested: %s\n", s);
/* ok try it with path */
snprintf(t, sizeof( t ), "%s/%s", bincue_path, s);
fd_bin = open (t, O_RDONLY);
if (fd_bin == -1)
{
- mp_msg(MSGT_OPEN,MSGL_STATUS,
- MSGTR_MPDEMUX_CUEREAD_BinFilenameTested,t);
+ mp_tmsg(MSGT_OPEN,MSGL_STATUS,
+ "[bincue] bin filename tested: %s\n",t);
/* now I would say the whole filename is shit, build our own */
strncpy(s, cue_filename, strlen(cue_filename) - 3 );
s[strlen(cue_filename) - 3] = '\0';
@@ -251,19 +251,19 @@ static int cue_find_bin (char *firstline) {
fd_bin = open (s, O_RDONLY);
if (fd_bin == -1)
{
- mp_msg(MSGT_OPEN,MSGL_STATUS,
- MSGTR_MPDEMUX_CUEREAD_BinFilenameTested, s);
+ mp_tmsg(MSGT_OPEN,MSGL_STATUS,
+ "[bincue] bin filename tested: %s\n", s);
/* ok try it with path */
snprintf(t, sizeof( t ), "%s/%s", bincue_path, s);
fd_bin = open (t, O_RDONLY);
if (fd_bin == -1)
{
- mp_msg(MSGT_OPEN,MSGL_STATUS,
- MSGTR_MPDEMUX_CUEREAD_BinFilenameTested, s);
+ mp_tmsg(MSGT_OPEN,MSGL_STATUS,
+ "[bincue] bin filename tested: %s\n", s);
/* I'll give up */
- mp_msg(MSGT_OPEN,MSGL_ERR,
- MSGTR_MPDEMUX_CUEREAD_CannotFindBinFile);
+ mp_tmsg(MSGT_OPEN,MSGL_ERR,
+ "[bincue] Couldn't find the bin file - giving up.\n");
return -1;
}
}
@@ -275,8 +275,8 @@ static int cue_find_bin (char *firstline) {
}
- mp_msg(MSGT_OPEN,MSGL_INFO,
- MSGTR_MPDEMUX_CUEREAD_UsingBinFile, bin_filename);
+ mp_tmsg(MSGT_OPEN,MSGL_INFO,
+ "[bincue] Using bin file %s.\n", bin_filename);
return 0;
}
@@ -309,8 +309,8 @@ static inline int cue_mode_2_sector_size(int mode)
case MODE2_2336: return SIZEISO_MODE2_FORM2;
default:
- mp_msg(MSGT_OPEN,MSGL_FATAL,
- MSGTR_MPDEMUX_CUEREAD_UnknownModeForBinfile);
+ mp_tmsg(MSGT_OPEN,MSGL_FATAL,
+ "[bincue] unknown mode for binfile. Should not happen. Aborting.\n");
abort();
}
@@ -360,8 +360,8 @@ static int cue_read_cue (char *in_cue_filename)
fd_cue = fopen (in_cue_filename, "r");
if (fd_cue == NULL)
{
- mp_msg(MSGT_OPEN,MSGL_ERR,
- MSGTR_MPDEMUX_CUEREAD_CannotOpenCueFile, in_cue_filename);
+ mp_tmsg(MSGT_OPEN,MSGL_ERR,
+ "[bincue] Cannot open %s.\n", in_cue_filename);
return -1;
}
@@ -370,8 +370,8 @@ static int cue_read_cue (char *in_cue_filename)
if(! fgets( sLine, 256, fd_cue ) )
{
- mp_msg(MSGT_OPEN,MSGL_ERR,
- MSGTR_MPDEMUX_CUEREAD_ErrReadingFromCueFile, in_cue_filename);
+ mp_tmsg(MSGT_OPEN,MSGL_ERR,
+ "[bincue] Error reading from %s\n", in_cue_filename);
fclose (fd_cue);
return -1;
}
@@ -386,8 +386,8 @@ static int cue_read_cue (char *in_cue_filename)
/* red the next line and call our track finder */
if(! fgets( sLine, 256, fd_cue ) )
{
- mp_msg(MSGT_OPEN,MSGL_ERR,
- MSGTR_MPDEMUX_CUEREAD_ErrReadingFromCueFile, in_cue_filename);
+ mp_tmsg(MSGT_OPEN,MSGL_ERR,
+ "[bincue] Error reading from %s\n", in_cue_filename);
fclose (fd_cue);
return -1;
}
@@ -396,8 +396,8 @@ static int cue_read_cue (char *in_cue_filename)
{
if (cue_getTrackinfo(sLine, &tracks[nTracks++]) != 0)
{
- mp_msg(MSGT_OPEN,MSGL_ERR,
- MSGTR_MPDEMUX_CUEREAD_ErrReadingFromCueFile, in_cue_filename);
+ mp_tmsg(MSGT_OPEN,MSGL_ERR,
+ "[bincue] Error reading from %s\n", in_cue_filename);
fclose (fd_cue);
return -1;
}
@@ -405,8 +405,8 @@ static int cue_read_cue (char *in_cue_filename)
/* make a fake track with stands for the Lead out */
if (fstat (fd_bin, &filestat) == -1) {
- mp_msg(MSGT_OPEN,MSGL_ERR,
- MSGTR_MPDEMUX_CUEREAD_ErrGettingBinFileSize);
+ mp_tmsg(MSGT_OPEN,MSGL_ERR,
+ "[bincue] Error getting size of bin file.\n");
fclose (fd_cue);
return -1;
}
@@ -500,8 +500,8 @@ static void cue_vcd_read_toc(void){
int i;
for (i = 0; i < nTracks; ++i) {
- mp_msg(MSGT_OPEN,MSGL_INFO,
- MSGTR_MPDEMUX_CUEREAD_InfoTrackFormat,
+ mp_tmsg(MSGT_OPEN,MSGL_INFO,
+ "track %02d: format=%d %02d:%02d:%02d\n",
i+1,
tracks[i].mode,
tracks[i].minute,
@@ -527,12 +527,12 @@ static int cue_vcd_read(stream_t *stream, char *mem, int size) {
return 0;
if(lseek(fd_bin, position+VCD_SECTOR_OFFS, SEEK_SET) == -1) {
- mp_msg(MSGT_OPEN,MSGL_ERR, MSGTR_MPDEMUX_CUEREAD_UnexpectedBinFileEOF);
+ mp_tmsg(MSGT_OPEN,MSGL_ERR, "[bincue] unexpected end of bin file\n");
return 0;
}
if(read(fd_bin, mem, VCD_SECTOR_DATA) != VCD_SECTOR_DATA) {
- mp_msg(MSGT_OPEN,MSGL_ERR, MSGTR_MPDEMUX_CUEREAD_CannotReadNBytesOfPayload, VCD_SECTOR_DATA);
+ mp_tmsg(MSGT_OPEN,MSGL_ERR, "[bincue] Couldn't read %d bytes of payload.\n", VCD_SECTOR_DATA);
return 0;
}
@@ -588,10 +588,11 @@ static int open_s(stream_t *stream,int mode, void* opts, int* file_format) {
ret2=cue_vcd_get_track_end(track);
ret=cue_vcd_seek_to_track(track);
if(ret<0){
- mp_msg(MSGT_OPEN,MSGL_ERR,MSGTR_ErrTrackSelect " (seek)\n");
+ mp_msg(MSGT_OPEN, MSGL_ERR, "%s (seek)\n",
+ mp_gtext("Error selecting VCD track."));
return STREAM_UNSUPPORTED;
}
- mp_msg(MSGT_OPEN,MSGL_INFO,MSGTR_MPDEMUX_CUEREAD_CueStreamInfo_FilenameTrackTracksavail, filename, track, ret, ret2);
+ mp_tmsg(MSGT_OPEN,MSGL_INFO,"CUE stream_open, filename=%s, track=%d, available tracks: %d -> %d\n", filename, track, ret, ret2);
stream->fd = f;
stream->type = STREAMTYPE_VCDBINCUE;
@@ -617,4 +618,3 @@ const stream_info_t stream_info_cue = {
&stream_opts,
1 // Urls are an option string
};
-
diff --git a/stream/stream_dvd.c b/stream/stream_dvd.c
index 3747bbaac1..0f65cd29bb 100644
--- a/stream/stream_dvd.c
+++ b/stream/stream_dvd.c
@@ -95,26 +95,26 @@ int dvd_parse_chapter_range(const m_option_t *conf, const char *range) {
if(*range && isdigit(*range)) {
dvd_chapter = strtol(range, &s, 10);
if(range == s) {
- mp_msg(MSGT_OPEN, MSGL_ERR, MSGTR_DVDinvalidChapterRange, range);
+ mp_tmsg(MSGT_OPEN, MSGL_ERR, "Invalid chapter range specification %s\n", range);
return M_OPT_INVALID;
}
}
if(*s == 0)
return 0;
else if(*s != '-') {
- mp_msg(MSGT_OPEN, MSGL_ERR, MSGTR_DVDinvalidChapterRange, range);
+ mp_tmsg(MSGT_OPEN, MSGL_ERR, "Invalid chapter range specification %s\n", range);
return M_OPT_INVALID;
}
++s;
if(*s == 0)
return 0;
if(! isdigit(*s)) {
- mp_msg(MSGT_OPEN, MSGL_ERR, MSGTR_DVDinvalidChapterRange, range);
+ mp_tmsg(MSGT_OPEN, MSGL_ERR, "Invalid chapter range specification %s\n", range);
return M_OPT_INVALID;
}
dvd_last_chapter = strtol(s, &t, 10);
if (s == t || *t) {
- mp_msg(MSGT_OPEN, MSGL_ERR, MSGTR_DVDinvalidChapterRange, range);
+ mp_tmsg(MSGT_OPEN, MSGL_ERR, "Invalid chapter range specification %s\n", range);
return M_OPT_INVALID;
}
return 0;
@@ -170,7 +170,7 @@ int dvd_aid_from_lang(stream_t *stream, unsigned char* lang) {
code=lang[1]|(lang[0]<<8);
for(i=0;i<d->nr_of_channels;i++) {
if(d->audio_streams[i].language==code) {
- mp_msg(MSGT_OPEN,MSGL_INFO,MSGTR_DVDaudioChannel,
+ mp_tmsg(MSGT_OPEN,MSGL_INFO,"Selected DVD audio channel: %d language: %c%c\n",
d->audio_streams[i].id, lang[0],lang[1]);
return d->audio_streams[i].id;
}
@@ -178,7 +178,7 @@ int dvd_aid_from_lang(stream_t *stream, unsigned char* lang) {
}
lang+=2; while (lang[0]==',' || lang[0]==' ') ++lang;
}
- mp_msg(MSGT_OPEN,MSGL_WARN,MSGTR_DVDnoMatchingAudio);
+ mp_tmsg(MSGT_OPEN,MSGL_WARN,"No matching DVD audio language found!\n");
}
return -1;
}
@@ -213,14 +213,14 @@ int dvd_sid_from_lang(stream_t *stream, unsigned char* lang) {
code=lang[1]|(lang[0]<<8);
for(i=0;i<d->nr_of_subtitles;i++) {
if(d->subtitles[i].language==code) {
- mp_msg(MSGT_OPEN,MSGL_INFO,MSGTR_DVDsubtitleChannel, i, lang[0],lang[1]);
+ mp_tmsg(MSGT_OPEN,MSGL_INFO,"Selected DVD subtitle channel: %d language: %c%c\n", i, lang[0],lang[1]);
return d->subtitles[i].id;
}
}
lang+=2;
while (lang[0]==',' || lang[0]==' ') ++lang;
}
- mp_msg(MSGT_OPEN,MSGL_WARN,MSGTR_DVDnoMatchingSubtitle);
+ mp_tmsg(MSGT_OPEN,MSGL_WARN,"No matching DVD subtitle language found!\n");
return -1;
}
@@ -249,7 +249,7 @@ static int dvd_next_cell(dvd_priv_t *d) {
return next_cell;
}
-int dvd_read_sector(dvd_priv_t *d,unsigned char* data) {
+static int dvd_read_sector(dvd_priv_t *d,unsigned char* data) {
int len;
if(d->packs_left==0) {
@@ -369,7 +369,7 @@ read_next:
return d->cur_pack-1;
}
-void dvd_seek(dvd_priv_t *d,int pos) {
+static void dvd_seek(dvd_priv_t *d,int pos) {
d->packs_left=-1;
d->cur_pack=pos;
@@ -407,7 +407,7 @@ void dvd_seek(dvd_priv_t *d,int pos) {
d->angle_seek=1;
}
-void dvd_close(dvd_priv_t *d) {
+static void dvd_close(dvd_priv_t *d) {
ifoClose(d->vts_file);
ifoClose(d->vmg_file);
DVDCloseFile(d->title);
@@ -738,12 +738,12 @@ static int open_s(stream_t *stream,int mode, void* opts, int* file_format) {
snprintf(temp_device, len, "/dev/rdisk%d", i);
dvd = DVDOpen(temp_device);
if(!dvd) {
- mp_msg(MSGT_OPEN,MSGL_ERR,MSGTR_CantOpenDVD,temp_device, strerror(errno));
+ mp_tmsg(MSGT_OPEN,MSGL_ERR,"Couldn't open DVD device: %s (%s)\n",temp_device, strerror(errno));
} else {
#if DVDREAD_VERSION <= LIBDVDREAD_VERSION(0,9,4)
dvd_file_t *dvdfile = DVDOpenFile(dvd,dvd_title,DVD_READ_INFO_FILE);
if(!dvdfile) {
- mp_msg(MSGT_OPEN,MSGL_ERR,MSGTR_CantOpenDVD,temp_device, strerror(errno));
+ mp_tmsg(MSGT_OPEN,MSGL_ERR,"Couldn't open DVD device: %s (%s)\n",temp_device, strerror(errno));
DVDClose(dvd);
continue;
}
@@ -763,7 +763,7 @@ static int open_s(stream_t *stream,int mode, void* opts, int* file_format) {
{
dvd = DVDOpen(dvd_device_current);
if(!dvd) {
- mp_msg(MSGT_OPEN,MSGL_ERR,MSGTR_CantOpenDVD,dvd_device_current, strerror(errno));
+ mp_tmsg(MSGT_OPEN,MSGL_ERR,"Couldn't open DVD device: %s (%s)\n",dvd_device_current, strerror(errno));
m_struct_free(&stream_opts,opts);
return STREAM_UNSUPPORTED;
}
@@ -777,7 +777,7 @@ static int open_s(stream_t *stream,int mode, void* opts, int* file_format) {
*/
vmg_file = ifoOpen(dvd, 0);
if(!vmg_file) {
- mp_msg(MSGT_OPEN,MSGL_ERR, MSGTR_DVDnoVMG);
+ mp_tmsg(MSGT_OPEN,MSGL_ERR, "Can't open VMG info!\n");
DVDClose( dvd );
m_struct_free(&stream_opts,opts);
return STREAM_UNSUPPORTED;
@@ -814,9 +814,9 @@ static int open_s(stream_t *stream,int mode, void* opts, int* file_format) {
/**
* Make sure our title number is valid.
*/
- mp_msg(MSGT_OPEN,MSGL_STATUS, MSGTR_DVDnumTitles, tt_srpt->nr_of_srpts );
+ mp_tmsg(MSGT_OPEN,MSGL_STATUS, "There are %d titles on this DVD.\n", tt_srpt->nr_of_srpts );
if(dvd_title < 1 || dvd_title > tt_srpt->nr_of_srpts) {
- mp_msg(MSGT_OPEN,MSGL_ERR, MSGTR_DVDinvalidTitle, dvd_title);
+ mp_tmsg(MSGT_OPEN,MSGL_ERR, "Invalid DVD title number: %d\n", dvd_title);
ifoClose( vmg_file );
DVDClose( dvd );
m_struct_free(&stream_opts,opts);
@@ -827,9 +827,9 @@ static int open_s(stream_t *stream,int mode, void* opts, int* file_format) {
/**
* Make sure the angle number is valid for this title.
*/
- mp_msg(MSGT_OPEN,MSGL_STATUS, MSGTR_DVDnumAngles, tt_srpt->title[dvd_title].nr_of_angles);
+ mp_tmsg(MSGT_OPEN,MSGL_STATUS, "There are %d angles in this DVD title.\n", tt_srpt->title[dvd_title].nr_of_angles);
if(dvd_angle<1 || dvd_angle>tt_srpt->title[dvd_title].nr_of_angles) {
- mp_msg(MSGT_OPEN,MSGL_ERR, MSGTR_DVDinvalidAngle, dvd_angle);
+ mp_tmsg(MSGT_OPEN,MSGL_ERR, "Invalid DVD angle number: %d\n", dvd_angle);
goto fail;
}
--dvd_angle; // remap 1.. -> 0..
@@ -840,7 +840,7 @@ static int open_s(stream_t *stream,int mode, void* opts, int* file_format) {
*/
vts_file = ifoOpen( dvd, tt_srpt->title[dvd_title].title_set_nr );
if(!vts_file) {
- mp_msg(MSGT_OPEN,MSGL_ERR, MSGTR_DVDnoIFO, tt_srpt->title[dvd_title].title_set_nr );
+ mp_tmsg(MSGT_OPEN,MSGL_ERR, "Cannot open the IFO file for DVD title %d.\n", tt_srpt->title[dvd_title].title_set_nr );
goto fail;
}
/**
@@ -848,7 +848,7 @@ static int open_s(stream_t *stream,int mode, void* opts, int* file_format) {
*/
title = DVDOpenFile(dvd, tt_srpt->title[dvd_title].title_set_nr, DVD_READ_TITLE_VOBS);
if(!title) {
- mp_msg(MSGT_OPEN,MSGL_ERR, MSGTR_DVDnoVOBs, tt_srpt->title[dvd_title].title_set_nr);
+ mp_tmsg(MSGT_OPEN,MSGL_ERR, "Cannot open title VOBS (VTS_%02d_1.VOB).\n", tt_srpt->title[dvd_title].title_set_nr);
ifoClose( vts_file );
goto fail;
}
@@ -908,7 +908,7 @@ static int open_s(stream_t *stream,int mode, void* opts, int* file_format) {
// 1 - stereo
// 5 - 5.1
audio_stream->channels=audio->channels;
- mp_msg(MSGT_OPEN,MSGL_STATUS,MSGTR_DVDaudioStreamInfo,
+ mp_tmsg(MSGT_OPEN,MSGL_STATUS,"audio stream: %d format: %s (%s) language: %s aid: %d.\n",
d->nr_of_channels,
dvd_audio_stream_types[ audio->audio_format ],
dvd_audio_stream_channels[ audio->channels ],
@@ -922,7 +922,7 @@ static int open_s(stream_t *stream,int mode, void* opts, int* file_format) {
d->nr_of_channels++;
}
}
- mp_msg(MSGT_OPEN,MSGL_STATUS,MSGTR_DVDnumAudioChannels,d->nr_of_channels );
+ mp_tmsg(MSGT_OPEN,MSGL_STATUS,"number of audio channels on disk: %d.\n",d->nr_of_channels );
}
/**
@@ -954,13 +954,13 @@ static int open_s(stream_t *stream,int mode, void* opts, int* file_format) {
else if(video->display_aspect_ratio == 3) /* 16:9 */
sub_stream->id = pgc->subp_control[i] >> 8 & 31;
- mp_msg(MSGT_OPEN,MSGL_STATUS,MSGTR_DVDsubtitleLanguage, sub_stream->id, tmp);
+ mp_tmsg(MSGT_OPEN,MSGL_STATUS,"subtitle ( sid ): %d language: %s\n", sub_stream->id, tmp);
mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_SUBTITLE_ID=%d\n", sub_stream->id);
if(language && tmp[0])
mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_SID_%d_LANG=%s\n", sub_stream->id, tmp);
d->nr_of_subtitles++;
}
- mp_msg(MSGT_OPEN,MSGL_STATUS,MSGTR_DVDnumSubtitles,d->nr_of_subtitles);
+ mp_tmsg(MSGT_OPEN,MSGL_STATUS,"number of subtitles on disk: %d\n",d->nr_of_subtitles);
}
/**
@@ -1012,7 +1012,7 @@ fail:
m_struct_free(&stream_opts, opts);
return STREAM_UNSUPPORTED;
}
- mp_msg(MSGT_DVD,MSGL_ERR,MSGTR_NoDVDSupport);
+ mp_tmsg(MSGT_DVD,MSGL_ERR,"MPlayer was compiled without DVD support, exiting.\n");
m_struct_free(&stream_opts,opts);
return STREAM_UNSUPPORTED;
}
diff --git a/stream/stream_dvd_common.c b/stream/stream_dvd_common.c
index 56c7ec20a0..8d1febb832 100644
--- a/stream/stream_dvd_common.c
+++ b/stream/stream_dvd_common.c
@@ -38,7 +38,7 @@
#include "mp_msg.h"
#include "help_mp.h"
#include "stream_dvd_common.h"
-#include "libavutil/intreadwrite.h"
+#include "ffmpeg_files/intreadwrite.h"
const char * const dvd_audio_stream_types[8] = { "ac3","unknown","mpeg1","mpeg2ext","lpcm","unknown","dts" };
const char * const dvd_audio_stream_channels[6] = { "mono", "stereo", "unknown", "unknown", "5.1/6.1", "5.1" };
@@ -65,13 +65,13 @@ void dvd_set_speed(char *device, unsigned speed)
return;
case -1: /* restore default value */
if (dvd_speed == 0) return; /* we haven't touched the speed setting */
- mp_msg(MSGT_OPEN, MSGL_INFO, MSGTR_DVDrestoreSpeed);
+ mp_tmsg(MSGT_OPEN, MSGL_INFO, "Restoring DVD speed... ");
break;
default: /* limit to <speed> KB/s */
// speed < 100 is multiple of DVD single speed (1350KB/s)
if (speed < 100)
speed *= 1350;
- mp_msg(MSGT_OPEN, MSGL_INFO, MSGTR_DVDlimitSpeed, speed);
+ mp_tmsg(MSGT_OPEN, MSGL_INFO, "Limiting DVD speed to %dKB/s... ", speed);
break;
}
@@ -104,14 +104,14 @@ void dvd_set_speed(char *device, unsigned speed)
fd = open(device, O_RDWR | O_NONBLOCK);
if (fd == -1) {
- mp_msg(MSGT_OPEN, MSGL_INFO, MSGTR_DVDspeedCantOpen);
+ mp_tmsg(MSGT_OPEN, MSGL_INFO, "Couldn't open DVD device for writing, changing DVD speed needs write access.\n");
return;
}
if (ioctl(fd, SG_IO, &sghdr) < 0)
- mp_msg(MSGT_OPEN, MSGL_INFO, MSGTR_DVDlimitFail);
+ mp_tmsg(MSGT_OPEN, MSGL_INFO, "failed\n");
else
- mp_msg(MSGT_OPEN, MSGL_INFO, MSGTR_DVDlimitOk);
+ mp_tmsg(MSGT_OPEN, MSGL_INFO, "successful\n");
close(fd);
#endif
diff --git a/stream/stream_dvdnav.c b/stream/stream_dvdnav.c
index c2915fbd35..d365301b77 100644
--- a/stream/stream_dvdnav.c
+++ b/stream/stream_dvdnav.c
@@ -559,7 +559,7 @@ static void show_audio_subs_languages(dvdnav_t *nav)
if(format == 0xFFFF || format > 6)
format = 1; //unknown
id = i + base[format];
- mp_msg(MSGT_OPEN,MSGL_STATUS,MSGTR_DVDaudioStreamInfo, i,
+ mp_tmsg(MSGT_OPEN,MSGL_STATUS,"audio stream: %d format: %s (%s) language: %s aid: %d.\n", i,
dvd_audio_stream_types[format], dvd_audio_stream_channels[channels], tmp, id);
if (lang != 0xFFFF && lang && tmp[0])
mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_AID_%d_LANG=%s\n", id, tmp);
@@ -577,7 +577,7 @@ static void show_audio_subs_languages(dvdnav_t *nav)
tmp[1] = lang & 0xFF;
tmp[2] = 0;
}
- mp_msg(MSGT_OPEN,MSGL_STATUS,MSGTR_DVDsubtitleLanguage, lg, tmp);
+ mp_msg(MSGT_OPEN,MSGL_STATUS,"subtitle ( sid ): %d language: %s\n", lg, tmp);
if (lang != 0xFFFF && lang && tmp[0])
mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_SID_%d_LANG=%s\n", lg, tmp);
}
@@ -592,7 +592,7 @@ static int open_s(stream_t *stream,int mode, void* opts, int* file_format) {
else if(dvd_device) filename= dvd_device;
else filename = DEFAULT_DVD_DEVICE;
if(!(priv=new_dvdnav_stream(filename))) {
- mp_msg(MSGT_OPEN,MSGL_ERR,MSGTR_CantOpenDVD,filename, strerror(errno));
+ mp_tmsg(MSGT_OPEN,MSGL_ERR,"Couldn't open DVD device: %s (%s)\n",filename, strerror(errno));
return STREAM_UNSUPPORTED;
}
diff --git a/stream/stream_ffmpeg.c b/stream/stream_ffmpeg.c
index d64300022e..f8ca8f6e20 100644
--- a/stream/stream_ffmpeg.c
+++ b/stream/stream_ffmpeg.c
@@ -27,7 +27,7 @@
static int fill_buffer(stream_t *s, char *buffer, int max_len)
{
- int r = url_read_complete(s->priv, buffer, max_len);
+ int r = url_read(s->priv, buffer, max_len);
return (r <= 0) ? -1 : r;
}
diff --git a/stream/stream_file.c b/stream/stream_file.c
index 149660857b..da9f70af44 100644
--- a/stream/stream_file.c
+++ b/stream/stream_file.c
@@ -143,7 +143,7 @@ static int open_f(stream_t *stream,int mode, void* opts, int* file_format) {
if(!strcmp(filename,"-")){
if(mode == STREAM_READ) {
// read from stdin
- mp_msg(MSGT_OPEN,MSGL_INFO,MSGTR_ReadSTDIN);
+ mp_tmsg(MSGT_OPEN,MSGL_INFO,"Reading from stdin...\n");
f=0; // 0=stdin
#if defined(__MINGW32__) || defined(__OS2__)
setmode(fileno(stdin),O_BINARY);
@@ -162,7 +162,7 @@ static int open_f(stream_t *stream,int mode, void* opts, int* file_format) {
#endif
f=open(filename,m, openmode);
if(f<0) {
- mp_msg(MSGT_OPEN,MSGL_ERR,MSGTR_FileNotFound,filename);
+ mp_tmsg(MSGT_OPEN,MSGL_ERR,"File not found: '%s'\n",filename);
m_struct_free(&stream_opts,opts);
return STREAM_ERROR;
}
diff --git a/stream/stream_live555.c b/stream/stream_live555.c
index 37bc3be495..acf616acd4 100644
--- a/stream/stream_live555.c
+++ b/stream/stream_live555.c
@@ -85,7 +85,7 @@ static int open_live_sdp(stream_t *stream,int mode, void* opts, int* file_format
f = open(filename,O_RDONLY);
#endif
if(f < 0) {
- mp_msg(MSGT_OPEN,MSGL_ERR,MSGTR_FileNotFound,filename);
+ mp_tmsg(MSGT_OPEN,MSGL_ERR,"File not found: '%s'\n",filename);
return STREAM_ERROR;
}
diff --git a/stream/stream_nemesi.c b/stream/stream_nemesi.c
index 8333ba75ba..7cc4ccafa5 100644
--- a/stream/stream_nemesi.c
+++ b/stream/stream_nemesi.c
@@ -77,4 +77,3 @@ const stream_info_t stream_info_rtsp = {
NULL,
0 /* Urls are an option string */
};
-
diff --git a/stream/stream_netstream.c b/stream/stream_netstream.c
index c0a80689df..47d1baad89 100644
--- a/stream/stream_netstream.c
+++ b/stream/stream_netstream.c
@@ -201,7 +201,7 @@ static int seek(stream_t *s,off_t newpos) {
return 1;
}
-static int net_stream_reset(struct stream_st *s) {
+static int net_stream_reset(struct stream *s) {
mp_net_stream_packet_t* pack;
pack = send_net_stream_cmd(s,NET_STREAM_RESET,NULL,0);
@@ -212,7 +212,7 @@ static int net_stream_reset(struct stream_st *s) {
return 1;
}
-static int control(struct stream_st *s,int cmd,void* arg) {
+static int control(struct stream *s,int cmd,void* arg) {
switch(cmd) {
case STREAM_CTRL_RESET:
return net_stream_reset(s);
@@ -220,7 +220,7 @@ static int control(struct stream_st *s,int cmd,void* arg) {
return STREAM_UNSUPPORTED;
}
-static void close_s(struct stream_st *s) {
+static void close_s(struct stream *s) {
mp_net_stream_packet_t* pack;
pack = send_net_stream_cmd(s,NET_STREAM_CLOSE,NULL,0);
diff --git a/stream/stream_radio.c b/stream/stream_radio.c
index 49d75090a9..d25187f17b 100644
--- a/stream/stream_radio.c
+++ b/stream/stream_radio.c
@@ -155,7 +155,7 @@ static const struct m_struct_st stream_opts = {
stream_opts_fields
};
-static void close_s(struct stream_st * stream);
+static void close_s(struct stream *stream);
#ifdef CONFIG_RADIO_CAPTURE
static int clear_buffer(radio_priv_t* priv);
#endif
@@ -183,7 +183,7 @@ static int parse_channels(radio_priv_t* priv,float freq_channel,float* pfreq){
/*parsing channels string*/
channels=priv->radio_param->channels;
- mp_msg(MSGT_RADIO, MSGL_INFO, MSGTR_RADIO_ChannelNamesDetected);
+ mp_tmsg(MSGT_RADIO, MSGL_INFO, "[radio] Radio channel names detected.\n");
priv->radio_channel_list = malloc(sizeof(radio_channels_t));
priv->radio_channel_list->index=1;
priv->radio_channel_list->next=NULL;
@@ -201,7 +201,7 @@ static int parse_channels(radio_priv_t* priv,float freq_channel,float* pfreq){
priv->radio_channel_current->freq=atof(tmp);
if ((priv->radio_channel_current->freq>priv->rangehigh)||(priv->radio_channel_current->freq<priv->rangelow))
- mp_msg(MSGT_RADIO, MSGL_ERR, MSGTR_RADIO_WrongFreqForChannel,
+ mp_tmsg(MSGT_RADIO, MSGL_ERR, "[radio] Wrong frequency for channel %s\n",
priv->radio_channel_current->name);
while ((sep=strchr(priv->radio_channel_current->name, '_'))) sep[0] = ' ';
@@ -227,17 +227,17 @@ static int parse_channels(radio_priv_t* priv,float freq_channel,float* pfreq){
priv->radio_channel_current = priv->radio_channel_current->next;
if (priv->radio_channel_current->index!=channel){
if (((float)((int)freq_channel))!=freq_channel)
- mp_msg(MSGT_RADIO, MSGL_ERR, MSGTR_RADIO_WrongChannelNumberFloat,freq_channel);
+ mp_tmsg(MSGT_RADIO, MSGL_ERR, "[radio] Wrong channel number: %.2f\n",freq_channel);
else
- mp_msg(MSGT_RADIO, MSGL_ERR, MSGTR_RADIO_WrongChannelNumberInt,(int)freq_channel);
+ mp_tmsg(MSGT_RADIO, MSGL_ERR, "[radio] Wrong channel number: %d\n",(int)freq_channel);
return STREAM_ERROR;
}
- mp_msg(MSGT_RADIO, MSGL_INFO, MSGTR_RADIO_SelectedChannel, priv->radio_channel_current->index,
+ mp_tmsg(MSGT_RADIO, MSGL_INFO, "[radio] Selected channel: %d - %s (freq: %.2f)\n", priv->radio_channel_current->index,
priv->radio_channel_current->name, priv->radio_channel_current->freq);
*pfreq=priv->radio_channel_current->freq;
}else{
if (freq_channel){
- mp_msg(MSGT_RADIO, MSGL_INFO, MSGTR_RADIO_FreqParameterDetected);
+ mp_tmsg(MSGT_RADIO, MSGL_INFO, "[radio] Radio frequency parameter detected.\n");
priv->radio_channel_list=malloc(sizeof(radio_channels_t));
priv->radio_channel_list->next=NULL;
priv->radio_channel_list->prev=NULL;
@@ -248,7 +248,7 @@ static int parse_channels(radio_priv_t* priv,float freq_channel,float* pfreq){
*pfreq=freq_channel;
}
}
- mp_msg(MSGT_RADIO, MSGL_DBG2, MSGTR_RADIO_DoneParsingChannels);
+ mp_tmsg(MSGT_RADIO, MSGL_DBG2, "[radio] Done parsing channels.\n");
return STREAM_OK;
}
@@ -271,25 +271,25 @@ static int init_frac_v4l2(radio_priv_t* priv){
memset(&tuner,0,sizeof(tuner));
tuner.index=0;
if (ioctl(priv->radio_fd, VIDIOC_G_TUNER, &tuner)<0){
- mp_msg(MSGT_RADIO,MSGL_WARN,MSGTR_RADIO_GetTunerFailed,strerror(errno),priv->frac);
+ mp_tmsg(MSGT_RADIO,MSGL_WARN,"[radio] Warning: ioctl get tuner failed: %s. Setting frac to %d.\n",strerror(errno),priv->frac);
return STREAM_ERROR;
}
if(tuner.type!=V4L2_TUNER_RADIO){
- mp_msg(MSGT_RADIO,MSGL_ERR,MSGTR_RADIO_NotRadioDevice,priv->radio_param->device);
+ mp_tmsg(MSGT_RADIO,MSGL_ERR,"[radio] %s is no radio device!\n",priv->radio_param->device);
return STREAM_ERROR;
}
if(tuner.capability & V4L2_TUNER_CAP_LOW){
priv->frac=16000;
- mp_msg(MSGT_RADIO,MSGL_DBG2,MSGTR_RADIO_TunerCapLowYes,priv->frac);
+ mp_tmsg(MSGT_RADIO,MSGL_DBG2,"[radio] tuner is low:yes frac=%d\n",priv->frac);
}
else{
priv->frac=16;
- mp_msg(MSGT_RADIO,MSGL_DBG2,MSGTR_RADIO_TunerCapLowNo,priv->frac);
+ mp_tmsg(MSGT_RADIO,MSGL_DBG2,"[radio] tuner is low:no frac=%d\n",priv->frac);
}
priv->rangelow=((float)tuner.rangelow)/priv->frac;
priv->rangehigh=((float)tuner.rangehigh)/priv->frac;
- mp_msg(MSGT_RADIO,MSGL_V,MSGTR_RADIO_FreqRange,priv->rangelow,priv->rangehigh);
+ mp_tmsg(MSGT_RADIO,MSGL_V,"[radio] Allowed frequency range is %.2f-%.2f MHz.\n",priv->rangelow,priv->rangehigh);
return STREAM_OK;
}
@@ -306,7 +306,7 @@ static int set_frequency_v4l2(radio_priv_t* priv,float frequency){
freq.type=V4L2_TUNER_RADIO;
freq.frequency=frequency*priv->frac;
if(ioctl(priv->radio_fd,VIDIOC_S_FREQUENCY,&freq)<0){
- mp_msg(MSGT_RADIO,MSGL_ERR,MSGTR_RADIO_SetFreqFailed,freq.frequency,
+ mp_tmsg(MSGT_RADIO,MSGL_ERR,"[radio] ioctl set frequency 0x%x (%.2f) failed: %s\n",freq.frequency,
frequency,strerror(errno));
return STREAM_ERROR;
}
@@ -322,7 +322,7 @@ static int get_frequency_v4l2(radio_priv_t* priv,float* frequency){
struct v4l2_frequency freq;
memset(&freq,0,sizeof(freq));
if (ioctl(priv->radio_fd, VIDIOC_G_FREQUENCY, &freq) < 0) {
- mp_msg(MSGT_RADIO,MSGL_ERR,MSGTR_RADIO_GetFreqFailed,strerror(errno));
+ mp_tmsg(MSGT_RADIO,MSGL_ERR,"[radio] ioctl get frequency failed: %s\n",strerror(errno));
return STREAM_ERROR;
}
*frequency=((float)freq.frequency)/priv->frac;
@@ -346,13 +346,13 @@ static void set_volume_v4l2(radio_priv_t* priv,int volume){
control.id=V4L2_CID_AUDIO_MUTE;
control.value = (volume==0?1:0);
if (ioctl(priv->radio_fd, VIDIOC_S_CTRL, &control)<0){
- mp_msg(MSGT_RADIO,MSGL_WARN,MSGTR_RADIO_SetMuteFailed,strerror(errno));
+ mp_tmsg(MSGT_RADIO,MSGL_WARN,"[radio] ioctl set mute failed: %s\n",strerror(errno));
}
memset(&qctrl,0,sizeof(qctrl));
qctrl.id = V4L2_CID_AUDIO_VOLUME;
if (ioctl(priv->radio_fd, VIDIOC_QUERYCTRL, &qctrl) < 0) {
- mp_msg(MSGT_RADIO, MSGL_WARN, MSGTR_RADIO_QueryControlFailed,strerror(errno));
+ mp_tmsg(MSGT_RADIO, MSGL_WARN, "[radio] ioctl query control failed: %s\n",strerror(errno));
return;
}
@@ -360,7 +360,7 @@ static void set_volume_v4l2(radio_priv_t* priv,int volume){
control.id=V4L2_CID_AUDIO_VOLUME;
control.value=qctrl.minimum+volume*(qctrl.maximum-qctrl.minimum)/100;
if (ioctl(priv->radio_fd, VIDIOC_S_CTRL, &control) < 0) {
- mp_msg(MSGT_RADIO, MSGL_WARN,MSGTR_RADIO_SetVolumeFailed,strerror(errno));
+ mp_tmsg(MSGT_RADIO, MSGL_WARN,"[radio] ioctl set volume failed: %s\n",strerror(errno));
}
}
@@ -376,14 +376,14 @@ static int get_volume_v4l2(radio_priv_t* priv,int* volume){
memset(&qctrl,0,sizeof(qctrl));
qctrl.id = V4L2_CID_AUDIO_VOLUME;
if (ioctl(priv->radio_fd, VIDIOC_QUERYCTRL, &qctrl) < 0) {
- mp_msg(MSGT_RADIO, MSGL_ERR, MSGTR_RADIO_QueryControlFailed,strerror(errno));
+ mp_tmsg(MSGT_RADIO, MSGL_ERR, "[radio] ioctl query control failed: %s\n",strerror(errno));
return STREAM_ERROR;
}
memset(&control,0,sizeof(control));
control.id=V4L2_CID_AUDIO_VOLUME;
if (ioctl(priv->radio_fd, VIDIOC_G_CTRL, &control) < 0) {
- mp_msg(MSGT_RADIO, MSGL_ERR,MSGTR_RADIO_GetVolumeFailed,strerror(errno));
+ mp_tmsg(MSGT_RADIO, MSGL_ERR,"[radio] ioctl get volume failed: %s\n",strerror(errno));
return STREAM_ERROR;
}
@@ -402,7 +402,7 @@ static int get_volume_v4l2(radio_priv_t* priv,int* volume){
/* v4l2 driver info structure */
static const radio_driver_t radio_driver_v4l2={
"v4l2",
- MSGTR_RADIO_DriverV4L2,
+ _("[radio] Using V4Lv1 radio interface.\n")2,
init_frac_v4l2,
set_volume_v4l2,
get_volume_v4l2,
@@ -428,20 +428,20 @@ static int init_frac_v4l(radio_priv_t* priv){
struct video_tuner tuner;
memset(&tuner,0,sizeof(tuner));
if (ioctl(priv->radio_fd, VIDIOCGTUNER, &tuner) <0){
- mp_msg(MSGT_RADIO,MSGL_WARN,MSGTR_RADIO_GetTunerFailed,strerror(errno),priv->frac);
+ mp_tmsg(MSGT_RADIO,MSGL_WARN,"[radio] Warning: ioctl get tuner failed: %s. Setting frac to %d.\n",strerror(errno),priv->frac);
return STREAM_ERROR;
}
if(tuner.flags & VIDEO_TUNER_LOW){
priv->frac=16000;
- mp_msg(MSGT_RADIO,MSGL_DBG2,MSGTR_RADIO_TunerCapLowYes,priv->frac);
+ mp_tmsg(MSGT_RADIO,MSGL_DBG2,"[radio] tuner is low:yes frac=%d\n",priv->frac);
}else{
priv->frac=16;
- mp_msg(MSGT_RADIO,MSGL_DBG2,MSGTR_RADIO_TunerCapLowNo,priv->frac);
+ mp_tmsg(MSGT_RADIO,MSGL_DBG2,"[radio] tuner is low:no frac=%d\n",priv->frac);
}
priv->rangelow=((float)tuner.rangelow)/priv->frac;
priv->rangehigh=((float)tuner.rangehigh)/priv->frac;
- mp_msg(MSGT_RADIO,MSGL_V,MSGTR_RADIO_FreqRange,priv->rangelow,priv->rangehigh);
+ mp_tmsg(MSGT_RADIO,MSGL_V,"[radio] Allowed frequency range is %.2f-%.2f MHz.\n",priv->rangelow,priv->rangehigh);
return STREAM_OK;
}
@@ -455,7 +455,7 @@ static int set_frequency_v4l(radio_priv_t* priv,float frequency){
__u32 freq;
freq=frequency*priv->frac;
if (ioctl(priv->radio_fd, VIDIOCSFREQ, &freq) < 0) {
- mp_msg(MSGT_RADIO,MSGL_ERR,MSGTR_RADIO_SetFreqFailed,freq,frequency,strerror(errno));
+ mp_tmsg(MSGT_RADIO,MSGL_ERR,"[radio] ioctl set frequency 0x%x (%.2f) failed: %s\n",freq,frequency,strerror(errno));
return STREAM_ERROR;
}
return STREAM_OK;
@@ -468,7 +468,7 @@ static int set_frequency_v4l(radio_priv_t* priv,float frequency){
static int get_frequency_v4l(radio_priv_t* priv,float* frequency){
__u32 freq;
if (ioctl(priv->radio_fd, VIDIOCGFREQ, &freq) < 0) {
- mp_msg(MSGT_RADIO,MSGL_ERR,MSGTR_RADIO_GetFreqFailed,strerror(errno));
+ mp_tmsg(MSGT_RADIO,MSGL_ERR,"[radio] ioctl get frequency failed: %s\n",strerror(errno));
return STREAM_ERROR;
}
*frequency=((float)freq)/priv->frac;
@@ -490,7 +490,7 @@ static void set_volume_v4l(radio_priv_t* priv,int volume){
memset(&audio,0,sizeof(audio));
audio.flags = (volume==0?VIDEO_AUDIO_MUTE:0);
if (ioctl(priv->radio_fd, VIDIOCSAUDIO, &audio)<0){
- mp_msg(MSGT_RADIO,MSGL_WARN,MSGTR_RADIO_SetMuteFailed,strerror(errno));
+ mp_tmsg(MSGT_RADIO,MSGL_WARN,"[radio] ioctl set mute failed: %s\n",strerror(errno));
}
memset(&audio,0,sizeof(audio));
@@ -500,7 +500,7 @@ static void set_volume_v4l(radio_priv_t* priv,int volume){
audio.volume = volume* (65535 / 100);
if (ioctl(priv->radio_fd, VIDIOCSAUDIO, &audio) < 0){
- mp_msg(MSGT_RADIO,MSGL_ERR,MSGTR_RADIO_SetVolumeFailed,strerror(errno));
+ mp_tmsg(MSGT_RADIO,MSGL_ERR,"[radio] ioctl set volume failed: %s\n",strerror(errno));
}
}
@@ -515,7 +515,7 @@ static int get_volume_v4l(radio_priv_t* priv,int* volume){
memset(&audio,0,sizeof(audio));
audio.audio=0;
if (ioctl(priv->radio_fd, VIDIOCGAUDIO, &audio) < 0){
- mp_msg(MSGT_RADIO,MSGL_ERR,MSGTR_RADIO_GetVolumeFailed,strerror(errno));
+ mp_tmsg(MSGT_RADIO,MSGL_ERR,"[radio] ioctl get volume failed: %s\n",strerror(errno));
return STREAM_ERROR;
}
@@ -533,7 +533,7 @@ static int get_volume_v4l(radio_priv_t* priv,int* volume){
/* v4l driver info structure */
static const radio_driver_t radio_driver_v4l={
"v4l",
- MSGTR_RADIO_DriverV4L,
+ _("[radio] Using V4Lv1 radio interface.\n"),
init_frac_v4l,
set_volume_v4l,
get_volume_v4l,
@@ -576,7 +576,7 @@ static int set_frequency_bsdbt848(radio_priv_t* priv,float frequency){
unsigned int freq;
freq=frequency*priv->frac;
if(ioctl(priv->radio_fd,RADIO_SETFREQ,&freq)<0){
- mp_msg(MSGT_RADIO,MSGL_ERR,MSGTR_RADIO_SetFreqFailed,freq, frequency, strerror(errno));
+ mp_tmsg(MSGT_RADIO,MSGL_ERR,"[radio] ioctl set frequency 0x%x (%.2f) failed: %s\n",freq, frequency, strerror(errno));
return STREAM_ERROR;
}
return STREAM_OK;
@@ -590,7 +590,7 @@ static int set_frequency_bsdbt848(radio_priv_t* priv,float frequency){
static int get_frequency_bsdbt848(radio_priv_t* priv,float* frequency){
unsigned int freq;
if (ioctl(priv->radio_fd, RADIO_GETFREQ, &freq) < 0) {
- mp_msg(MSGT_RADIO,MSGL_ERR,MSGTR_RADIO_GetFreqFailed,strerror(errno));
+ mp_tmsg(MSGT_RADIO,MSGL_ERR,"[radio] ioctl get frequency failed: %s\n",strerror(errno));
return STREAM_ERROR;
}
*frequency=((float)freq)/priv->frac;
@@ -614,7 +614,7 @@ static void set_volume_bsdbt848(radio_priv_t* priv,int volume){
audio_flags = (volume==0?AUDIO_MUTE:AUDIO_UNMUTE);
if (ioctl(priv->radio_fd, BT848_SAUDIO, &audio_flags)<0){
- mp_msg(MSGT_RADIO,MSGL_WARN,MSGTR_RADIO_SetMuteFailed,strerror(errno));
+ mp_tmsg(MSGT_RADIO,MSGL_WARN,"[radio] ioctl set mute failed: %s\n",strerror(errno));
}
}
@@ -630,7 +630,7 @@ static int get_volume_bsdbt848(radio_priv_t* priv,int* volume){
int audio_flags;
if (ioctl(priv->radio_fd, BT848_GAUDIO, &audio_flags)<0){
- mp_msg(MSGT_RADIO,MSGL_ERR,MSGTR_RADIO_GetVolumeFailed,strerror(errno));
+ mp_tmsg(MSGT_RADIO,MSGL_ERR,"[radio] ioctl get volume failed: %s\n",strerror(errno));
return STREAM_ERROR;
}
@@ -645,7 +645,7 @@ static int get_volume_bsdbt848(radio_priv_t* priv,int* volume){
/* bsdbt848 driver info structure */
static const radio_driver_t radio_driver_bsdbt848={
"bsdbt848",
- MSGTR_RADIO_DriverBSDBT848,
+ _("[radio] Using *BSD BT848 radio interface.\n"),
init_frac_bsdbt848,
set_volume_bsdbt848,
get_volume_bsdbt848,
@@ -659,7 +659,7 @@ static inline int init_frac(radio_priv_t* priv){
}
static inline int set_frequency(radio_priv_t* priv,float frequency){
if ((frequency<priv->rangelow)||(frequency>priv->rangehigh)){
- mp_msg(MSGT_RADIO,MSGL_ERR,MSGTR_RADIO_WrongFreq,frequency);
+ mp_tmsg(MSGT_RADIO,MSGL_ERR,"[radio] Wrong frequency: %.2f\n",frequency);
return STREAM_ERROR;
}
if(priv->driver->set_frequency(priv,frequency)!=STREAM_OK)
@@ -667,7 +667,7 @@ static inline int set_frequency(radio_priv_t* priv,float frequency){
#ifdef CONFIG_RADIO_CAPTURE
if(clear_buffer(priv)!=STREAM_OK){
- mp_msg(MSGT_RADIO,MSGL_ERR,MSGTR_RADIO_ClearBufferFailed,strerror(errno));
+ mp_tmsg(MSGT_RADIO,MSGL_ERR,"[radio] Clearing buffer failed: %s\n",strerror(errno));
return STREAM_ERROR;
}
#endif
@@ -722,16 +722,16 @@ static int read_chunk(audio_in_t *ai, unsigned char *buffer)
if (ret != ai->alsa.chunk_size) {
if (ret < 0) {
if (ret==-EAGAIN) return -1;
- mp_msg(MSGT_RADIO, MSGL_ERR, MSGTR_MPDEMUX_AUDIOIN_ErrReadingAudio, snd_strerror(ret));
+ mp_tmsg(MSGT_RADIO, MSGL_ERR, "\nError reading audio: %s\n", snd_strerror(ret));
if (ret == -EPIPE) {
if (ai_alsa_xrun(ai) == 0) {
- mp_msg(MSGT_RADIO, MSGL_ERR, MSGTR_MPDEMUX_AUDIOIN_XRUNSomeFramesMayBeLeftOut);
+ mp_tmsg(MSGT_RADIO, MSGL_ERR, "Recovered from cross-run, some frames may be left out!\n");
} else {
- mp_msg(MSGT_RADIO, MSGL_ERR, MSGTR_MPDEMUX_AUDIOIN_ErrFatalCannotRecover);
+ mp_tmsg(MSGT_RADIO, MSGL_ERR, "Fatal error, cannot recover!\n");
}
}
} else {
- mp_msg(MSGT_RADIO, MSGL_ERR, MSGTR_MPDEMUX_AUDIOIN_NotEnoughSamples);
+ mp_tmsg(MSGT_RADIO, MSGL_ERR, "\nNot enough audio samples!\n");
}
return -1;
}
@@ -753,7 +753,7 @@ static int read_chunk(audio_in_t *ai, unsigned char *buffer)
if (ret<0){
if (errno==EAGAIN && bt==0) return -1; //no data avail yet
if (errno==EAGAIN) { usleep(1000); continue;} //nilling buffer to blocksize size
- mp_msg(MSGT_RADIO, MSGL_ERR, MSGTR_MPDEMUX_AUDIOIN_ErrReadingAudio, strerror(errno));
+ mp_tmsg(MSGT_RADIO, MSGL_ERR, "\nError reading audio: %s\n", strerror(errno));
return -1;
}
bt+=ret;
@@ -785,7 +785,7 @@ static int read_chunk(audio_in_t *ai, unsigned char *buffer)
static int grab_audio_frame(radio_priv_t *priv, char *buffer, int len)
{
int i;
- mp_msg(MSGT_RADIO, MSGL_DBG3, MSGTR_RADIO_BufferString,"grab_audio_frame",priv->audio_cnt,priv->audio_drop);
+ mp_tmsg(MSGT_RADIO, MSGL_DBG3, "[radio] %s: in buffer=%d dropped=%d\n","grab_audio_frame",priv->audio_cnt,priv->audio_drop);
/* Cache buffer must be filled by some audio packets when playing starts.
Otherwise MPlayer will quit with EOF error.
Probably, there is need more carefull checking rather than simple 'for' loop
@@ -835,7 +835,7 @@ static int init_audio(radio_priv_t *priv)
}
priv->do_capture=1;
- mp_msg(MSGT_RADIO,MSGL_V,MSGTR_RADIO_CaptureStarting);
+ mp_tmsg(MSGT_RADIO,MSGL_V,"[radio] Starting capture stuff.\n");
#ifdef CONFIG_ALSA
while ((tmp = strrchr(priv->radio_param->adevice, '='))){
tmp[0] = ':';
@@ -847,7 +847,7 @@ static int init_audio(radio_priv_t *priv)
#endif
if(audio_in_init(&priv->audio_in, is_oss?AUDIO_IN_OSS:AUDIO_IN_ALSA)<0){
- mp_msg(MSGT_RADIO, MSGL_ERR, MSGTR_RADIO_AudioInInitFailed);
+ mp_tmsg(MSGT_RADIO, MSGL_ERR, "[radio] audio_in_init failed.\n");
}
audio_in_set_device(&priv->audio_in, priv->radio_param->adevice);
@@ -855,7 +855,7 @@ static int init_audio(radio_priv_t *priv)
audio_in_set_samplerate(&priv->audio_in, priv->radio_param->arate);
if (audio_in_setup(&priv->audio_in) < 0) {
- mp_msg(MSGT_RADIO, MSGL_ERR, MSGTR_RADIO_AudioInSetupFailed, strerror(errno));
+ mp_tmsg(MSGT_RADIO, MSGL_ERR, "[radio] audio_in_setup call failed: %s\n", strerror(errno));
return STREAM_ERROR;
}
#ifdef CONFIG_OSS_AUDIO
@@ -871,12 +871,12 @@ static int init_audio(radio_priv_t *priv)
priv->audio_in.bytes_per_sample+priv->audio_in.blocksize;
if (priv->audio_buffer_size < 256*priv->audio_in.blocksize)
priv->audio_buffer_size = 256*priv->audio_in.blocksize;
- mp_msg(MSGT_RADIO, MSGL_V, MSGTR_RADIO_AudioBuffer,
+ mp_tmsg(MSGT_RADIO, MSGL_V, "[radio] Audio capture - buffer=%d bytes (block=%d bytes).\n",
priv->audio_buffer_size,priv->audio_in.blocksize);
/* start capture */
priv->audio_ringbuffer = calloc(1, priv->audio_buffer_size);
if (!priv->audio_ringbuffer) {
- mp_msg(MSGT_RADIO, MSGL_ERR, MSGTR_RADIO_AllocateBufferFailed,priv->audio_in.blocksize, priv->audio_buffer_size, strerror(errno));
+ mp_tmsg(MSGT_RADIO, MSGL_ERR, "[radio] cannot allocate audio buffer (block=%d,buf=%d): %s\n",priv->audio_in.blocksize, priv->audio_buffer_size, strerror(errno));
return STREAM_ERROR;
}
priv->audio_head = 0;
@@ -900,7 +900,7 @@ static int init_audio(radio_priv_t *priv)
* \parameter frequency pointer to float, which will contain frequency in MHz
* \return 1 if success,0 - otherwise
*/
-int radio_get_freq(struct stream_st *stream, float* frequency){
+int radio_get_freq(struct stream *stream, float *frequency){
radio_priv_t* priv=(radio_priv_t*)stream->priv;
if (!frequency)
@@ -915,7 +915,7 @@ int radio_get_freq(struct stream_st *stream, float* frequency){
* \parameter frequency frequency in MHz
* \return 1 if success,0 - otherwise
*/
-int radio_set_freq(struct stream_st *stream, float frequency){
+int radio_set_freq(struct stream *stream, float frequency){
radio_priv_t* priv=(radio_priv_t*)stream->priv;
if (set_frequency(priv,frequency)!=STREAM_OK){
@@ -924,7 +924,7 @@ int radio_set_freq(struct stream_st *stream, float frequency){
if (get_frequency(priv,&frequency)!=STREAM_OK){
return 0;
}
- mp_msg(MSGT_RADIO, MSGL_INFO, MSGTR_RADIO_CurrentFreq,frequency);
+ mp_tmsg(MSGT_RADIO, MSGL_INFO, "[radio] Current frequency: %.2f\n",frequency);
return 1;
}
@@ -934,7 +934,7 @@ int radio_set_freq(struct stream_st *stream, float frequency){
* \return 1 if success,0 - otherwise
*
*/
-int radio_step_freq(struct stream_st *stream, float step_interval){
+int radio_step_freq(struct stream *stream, float step_interval){
float frequency;
radio_priv_t* priv=(radio_priv_t*)stream->priv;
@@ -957,7 +957,7 @@ int radio_step_freq(struct stream_st *stream, float step_interval){
* if channel parameter is NULL function prints error message and does nothing, otherwise
* changes channel to prev or next in list
*/
-int radio_step_channel(struct stream_st *stream, int direction) {
+int radio_step_channel(struct stream *stream, int direction) {
radio_priv_t* priv=(radio_priv_t*)stream->priv;
if (priv->radio_channel_list) {
@@ -969,7 +969,7 @@ int radio_step_channel(struct stream_st *stream, int direction) {
priv->radio_channel_current = priv->radio_channel_list;
if(!radio_set_freq(stream,priv->radio_channel_current->freq))
return 0;
- mp_msg(MSGT_RADIO, MSGL_V, MSGTR_RADIO_SelectedChannel,
+ mp_tmsg(MSGT_RADIO, MSGL_V, "[radio] Selected channel: %d - %s (freq: %.2f)\n",
priv->radio_channel_current->index, priv->radio_channel_current->name,
priv->radio_channel_current->freq);
break;
@@ -981,13 +981,13 @@ int radio_step_channel(struct stream_st *stream, int direction) {
priv->radio_channel_current = priv->radio_channel_current->next;
if(!radio_set_freq(stream,priv->radio_channel_current->freq))
return 0;
- mp_msg(MSGT_RADIO, MSGL_V, MSGTR_RADIO_SelectedChannel,
+ mp_tmsg(MSGT_RADIO, MSGL_V, "[radio] Selected channel: %d - %s (freq: %.2f)\n",
priv->radio_channel_current->index, priv->radio_channel_current->name,
priv->radio_channel_current->freq);
break;
}
}else
- mp_msg(MSGT_RADIO, MSGL_ERR, MSGTR_RADIO_ChangeChannelNoChannelList);
+ mp_tmsg(MSGT_RADIO, MSGL_ERR, "[radio] Can not change channel: no channel list given.\n");
return 1;
}
@@ -999,14 +999,14 @@ int radio_step_channel(struct stream_st *stream, int direction) {
* if channel parameter is NULL function prints error message and does nothing, otherwise
* changes channel to given
*/
-int radio_set_channel(struct stream_st *stream, char *channel) {
+int radio_set_channel(struct stream *stream, char *channel) {
radio_priv_t* priv=(radio_priv_t*)stream->priv;
int i, channel_int;
radio_channels_t* tmp;
char* endptr;
if (*channel=='\0')
- mp_msg(MSGT_RADIO,MSGL_ERR,MSGTR_RADIO_WrongChannelName,channel);
+ mp_tmsg(MSGT_RADIO,MSGL_ERR,"[radio] Wrong channel name: %s\n",channel);
if (priv->radio_channel_list) {
channel_int = strtol(channel,&endptr,10);
@@ -1017,7 +1017,7 @@ int radio_set_channel(struct stream_st *stream, char *channel) {
if (!strncmp(channel,tmp->name,sizeof(tmp->name)-1))
break;
if (!tmp){
- mp_msg(MSGT_RADIO,MSGL_ERR,MSGTR_RADIO_WrongChannelName,channel);
+ mp_tmsg(MSGT_RADIO,MSGL_ERR,"[radio] Wrong channel name: %s\n",channel);
return 0;
}
}else{
@@ -1027,17 +1027,17 @@ int radio_set_channel(struct stream_st *stream, char *channel) {
else
break;
if (tmp->index!=channel_int){
- mp_msg(MSGT_RADIO,MSGL_ERR,MSGTR_RADIO_WrongChannelNumberInt,channel_int);
+ mp_tmsg(MSGT_RADIO,MSGL_ERR,"[radio] Wrong channel number: %d\n",channel_int);
return 0;
}
}
priv->radio_channel_current=tmp;
- mp_msg(MSGT_RADIO, MSGL_V, MSGTR_RADIO_SelectedChannel, priv->radio_channel_current->index,
+ mp_tmsg(MSGT_RADIO, MSGL_V, "[radio] Selected channel: %d - %s (freq: %.2f)\n", priv->radio_channel_current->index,
priv->radio_channel_current->name, priv->radio_channel_current->freq);
if(!radio_set_freq(stream, priv->radio_channel_current->freq))
return 0;
} else
- mp_msg(MSGT_RADIO, MSGL_ERR, MSGTR_RADIO_ChangeChannelNoChannelList);
+ mp_tmsg(MSGT_RADIO, MSGL_ERR, "[radio] Can not change channel: no channel list given.\n");
return 1;
}
@@ -1047,7 +1047,7 @@ int radio_set_channel(struct stream_st *stream, char *channel) {
*
* NOTE: return value may be NULL (e.g. when channel list not initialized)
*/
-char* radio_get_channel_name(struct stream_st *stream){
+char* radio_get_channel_name(struct stream *stream){
radio_priv_t* priv=(radio_priv_t*)stream->priv;
if (priv->radio_channel_current) {
return priv->radio_channel_current->name;
@@ -1059,7 +1059,7 @@ char* radio_get_channel_name(struct stream_st *stream){
* \brief fills given buffer with audio data
* \return number of bytes, written into buffer
*/
-static int fill_buffer_s(struct stream_st *s, char* buffer, int max_len){
+static int fill_buffer_s(struct stream *s, char *buffer, int max_len){
int len=max_len;
#ifdef CONFIG_RADIO_CAPTURE
@@ -1129,7 +1129,7 @@ static int open_s(stream_t *stream,int mode, void* opts, int* file_format) {
else
priv->driver=NULL;
- mp_msg(MSGT_RADIO,MSGL_V,MSGTR_RADIO_AvailableDrivers);
+ mp_tmsg(MSGT_RADIO,MSGL_V,"[radio] Available drivers: ");
for(i=0;radio_drivers[i];i++){
mp_msg(MSGT_RADIO,MSGL_V,"%s, ",radio_drivers[i]->name);
if(strcmp(priv->radio_param->driver,radio_drivers[i]->name)==0)
@@ -1140,7 +1140,7 @@ static int open_s(stream_t *stream,int mode, void* opts, int* file_format) {
if(priv->driver)
mp_msg(MSGT_RADIO, MSGL_INFO, priv->driver->info);
else{
- mp_msg(MSGT_RADIO, MSGL_INFO, MSGTR_RADIO_DriverUnknownStr,priv->radio_param->driver);
+ mp_tmsg(MSGT_RADIO, MSGL_INFO, "[radio] Unknown driver name: %s\n",priv->radio_param->driver);
close_s(stream);
return STREAM_ERROR;
}
@@ -1160,12 +1160,12 @@ static int open_s(stream_t *stream,int mode, void* opts, int* file_format) {
priv->radio_fd = open(priv->radio_param->device, O_RDONLY);
if (priv->radio_fd < 0) {
- mp_msg(MSGT_RADIO, MSGL_ERR, MSGTR_RADIO_UnableOpenDevice,
+ mp_tmsg(MSGT_RADIO, MSGL_ERR, "[radio] Unable to open '%s': %s\n",
priv->radio_param->device, strerror(errno));
close_s(stream);
return STREAM_ERROR;
}
- mp_msg(MSGT_RADIO, MSGL_V, MSGTR_RADIO_RadioDevice, priv->radio_fd,priv->radio_param->device);
+ mp_tmsg(MSGT_RADIO, MSGL_V, "[radio] Radio fd: %d, %s\n", priv->radio_fd,priv->radio_param->device);
fcntl(priv->radio_fd, F_SETFD, FD_CLOEXEC);
get_volume(priv, &priv->old_snd_volume);
@@ -1182,11 +1182,11 @@ static int open_s(stream_t *stream,int mode, void* opts, int* file_format) {
}
if ((frequency<priv->rangelow)||(frequency>priv->rangehigh)){
- mp_msg(MSGT_RADIO, MSGL_ERR, MSGTR_RADIO_WrongFreq,frequency);
+ mp_tmsg(MSGT_RADIO, MSGL_ERR, "[radio] Wrong frequency: %.2f\n",frequency);
close_s(stream);
return STREAM_ERROR;
}else
- mp_msg(MSGT_RADIO, MSGL_INFO, MSGTR_RADIO_UsingFreq,frequency);
+ mp_tmsg(MSGT_RADIO, MSGL_INFO, "[radio] Using frequency: %.2f.\n",frequency);
if(set_frequency(priv,frequency)!=STREAM_OK){
close_s(stream);
@@ -1205,7 +1205,7 @@ static int open_s(stream_t *stream,int mode, void* opts, int* file_format) {
if(!stream_enable_cache(stream,5*priv->audio_in.samplerate*priv->audio_in.channels*
priv->audio_in.bytes_per_sample,2*priv->audio_in.samplerate*priv->audio_in.channels*
priv->audio_in.bytes_per_sample,priv->audio_in.blocksize)) {
- mp_msg(MSGT_RADIO, MSGL_ERR, MSGTR_RADIO_StreamEnableCacheFailed,strerror(errno));
+ mp_tmsg(MSGT_RADIO, MSGL_ERR, "[radio] Call to stream_enable_cache failed: %s\n",strerror(errno));
close_s(stream);
return STREAM_ERROR;
}
@@ -1220,7 +1220,7 @@ static int open_s(stream_t *stream,int mode, void* opts, int* file_format) {
/*****************************************************************
* Close stream. Clear structures.
*/
-static void close_s(struct stream_st * stream){
+static void close_s(struct stream *stream){
radio_priv_t* priv=(radio_priv_t*)stream->priv;
radio_channels_t * tmp;
if (!priv) return;
@@ -1263,4 +1263,3 @@ const stream_info_t stream_info_radio = {
&stream_opts,
1 // Urls are an option string
};
-
diff --git a/stream/stream_radio.h b/stream/stream_radio.h
index 1af2f1f4b0..8e3df1edb9 100644
--- a/stream/stream_radio.h
+++ b/stream/stream_radio.h
@@ -55,11 +55,11 @@ typedef struct radio_param_s{
extern radio_param_t stream_radio_defaults;
-int radio_set_freq(struct stream_st *stream, float freq);
-int radio_get_freq(struct stream_st *stream, float* freq);
-char* radio_get_channel_name(struct stream_st *stream);
-int radio_set_channel(struct stream_st *stream, char *channel);
-int radio_step_channel(struct stream_st *stream, int direction);
-int radio_step_freq(struct stream_st *stream, float step_interval);
+int radio_set_freq(struct stream *stream, float freq);
+int radio_get_freq(struct stream *stream, float* freq);
+char* radio_get_channel_name(struct stream *stream);
+int radio_set_channel(struct stream *stream, char *channel);
+int radio_step_channel(struct stream *stream, int direction);
+int radio_step_freq(struct stream *stream, float step_interval);
#endif /* MPLAYER_STREAM_RADIO_H */
diff --git a/stream/stream_rtsp.c b/stream/stream_rtsp.c
index 336db6144c..e02255e531 100644
--- a/stream/stream_rtsp.c
+++ b/stream/stream_rtsp.c
@@ -130,7 +130,7 @@ rtsp_streaming_start (stream_t *stream)
}
static void
-rtsp_streaming_close (struct stream_st *s)
+rtsp_streaming_close (struct stream *s)
{
rtsp_session_t *rtsp = NULL;
diff --git a/stream/stream_smb.c b/stream/stream_smb.c
index 4c57176d2f..ff8ad192b7 100644
--- a/stream/stream_smb.c
+++ b/stream/stream_smb.c
@@ -136,14 +136,14 @@ static int open_f (stream_t *stream, int mode, void *opts, int* file_format) {
err = smbc_init(smb_auth_fn, 1);
if (err < 0) {
- mp_msg(MSGT_OPEN,MSGL_ERR,MSGTR_SMBInitError,err);
+ mp_tmsg(MSGT_OPEN,MSGL_ERR,"Cannot init the libsmbclient library: %d\n",err);
m_struct_free(&stream_opts, opts);
return STREAM_ERROR;
}
fd = smbc_open(filename, m,0644);
if (fd < 0) {
- mp_msg(MSGT_OPEN,MSGL_ERR,MSGTR_SMBFileNotFound, filename);
+ mp_tmsg(MSGT_OPEN,MSGL_ERR,"Could not open from LAN: '%s'\n", filename);
m_struct_free(&stream_opts, opts);
return STREAM_ERROR;
}
diff --git a/stream/stream_vcd.c b/stream/stream_vcd.c
index 4c85335073..23722d24e7 100644
--- a/stream/stream_vcd.c
+++ b/stream/stream_vcd.c
@@ -129,7 +129,7 @@ static int open_s(stream_t *stream,int mode, void* opts, int* file_format) {
f=open(p->device,O_RDONLY);
#endif
if(f<0){
- mp_msg(MSGT_OPEN,MSGL_ERR,MSGTR_CdDevNotfound,p->device);
+ mp_tmsg(MSGT_OPEN,MSGL_ERR,"CD-ROM Device '%s' not found.\n",p->device);
m_struct_free(&stream_opts,opts);
return STREAM_ERROR;
}
@@ -143,7 +143,8 @@ static int open_s(stream_t *stream,int mode, void* opts, int* file_format) {
}
ret2=vcd_get_track_end(vcd,p->track);
if(ret2<0){
- mp_msg(MSGT_OPEN,MSGL_ERR,MSGTR_ErrTrackSelect " (get)\n");
+ mp_msg(MSGT_OPEN, MSGL_ERR, "%s (get)\n",
+ mp_gtext("Error selecting VCD track."));
close(f);
free(vcd);
m_struct_free(&stream_opts,opts);
@@ -151,7 +152,8 @@ static int open_s(stream_t *stream,int mode, void* opts, int* file_format) {
}
ret=vcd_seek_to_track(vcd,p->track);
if(ret<0){
- mp_msg(MSGT_OPEN,MSGL_ERR,MSGTR_ErrTrackSelect " (seek)\n");
+ mp_msg(MSGT_OPEN, MSGL_ERR, "%s (seek)\n",
+ mp_gtext("Error selecting VCD track."));
close(f);
free(vcd);
m_struct_free(&stream_opts,opts);
diff --git a/stream/stream_vstream.c b/stream/stream_vstream.c
index ff173855f5..7575b76bb1 100644
--- a/stream/stream_vstream.c
+++ b/stream/stream_vstream.c
@@ -95,11 +95,11 @@ static int seek(stream_t *s,off_t newpos) {
return 1;
}
-static int control(struct stream_st *s,int cmd,void* arg) {
+static int control(struct stream *s,int cmd,void *arg) {
return STREAM_UNSUPPORTED;
}
-static void close_s(struct stream_st *s) {
+static void close_s(struct stream *s) {
}
static int open_s(stream_t *stream, int mode, void* opts, int* file_format) {
diff --git a/stream/tcp.c b/stream/tcp.c
index cf067c2ee7..1bc536d41a 100644
--- a/stream/tcp.c
+++ b/stream/tcp.c
@@ -125,7 +125,7 @@ connect2Server_with_af(char *host, int port, int af,int verb) {
case AF_INET6: our_s_addr = (void *) &server_address.six.sin6_addr; break;
#endif
default:
- mp_msg(MSGT_NETWORK,MSGL_ERR, MSGTR_MPDEMUX_NW_UnknownAF, af);
+ mp_tmsg(MSGT_NETWORK,MSGL_ERR, "Unknown address family %d\n", af);
return TCP_ERROR_FATAL;
}
@@ -140,7 +140,7 @@ connect2Server_with_af(char *host, int port, int af,int verb) {
if ( inet_addr(host)==INADDR_NONE )
#endif
{
- if(verb) mp_msg(MSGT_NETWORK,MSGL_STATUS,MSGTR_MPDEMUX_NW_ResolvingHostForAF, host, af2String(af));
+ if(verb) mp_tmsg(MSGT_NETWORK,MSGL_STATUS,"Resolving %s for %s...\n", host, af2String(af));
#ifdef HAVE_GETHOSTBYNAME2
hp=(struct hostent*)gethostbyname2( host, af );
@@ -148,7 +148,7 @@ connect2Server_with_af(char *host, int port, int af,int verb) {
hp=(struct hostent*)gethostbyname( host );
#endif
if( hp==NULL ) {
- if(verb) mp_msg(MSGT_NETWORK,MSGL_ERR,MSGTR_MPDEMUX_NW_CantResolv, af2String(af), host);
+ if(verb) mp_tmsg(MSGT_NETWORK,MSGL_ERR,"Couldn't resolve name for %s: %s\n", af2String(af), host);
return TCP_ERROR_FATAL;
}
@@ -175,7 +175,7 @@ connect2Server_with_af(char *host, int port, int af,int verb) {
break;
#endif
default:
- mp_msg(MSGT_NETWORK,MSGL_ERR, MSGTR_MPDEMUX_NW_UnknownAF, af);
+ mp_tmsg(MSGT_NETWORK,MSGL_ERR, "Unknown address family %d\n", af);
return TCP_ERROR_FATAL;
}
@@ -184,7 +184,7 @@ connect2Server_with_af(char *host, int port, int af,int verb) {
#else
inet_ntop(af, our_s_addr, buf, 255);
#endif
- if(verb) mp_msg(MSGT_NETWORK,MSGL_STATUS,MSGTR_MPDEMUX_NW_ConnectingToServer, host, buf , port );
+ if(verb) mp_tmsg(MSGT_NETWORK,MSGL_STATUS,"Connecting to server %s[%s]: %d...\n", host, buf , port );
// Turn the socket as non blocking so we can timeout on the connection
#if !HAVE_WINSOCK2_H
@@ -199,7 +199,7 @@ connect2Server_with_af(char *host, int port, int af,int verb) {
#else
if( (WSAGetLastError() != WSAEINPROGRESS) && (WSAGetLastError() != WSAEWOULDBLOCK) ) {
#endif
- if(verb) mp_msg(MSGT_NETWORK,MSGL_ERR,MSGTR_MPDEMUX_NW_CantConnect2Server, af2String(af));
+ if(verb) mp_tmsg(MSGT_NETWORK,MSGL_ERR,"Failed to connect to server with %s\n", af2String(af));
closesocket(socket_server_fd);
return TCP_ERROR_PORT;
}
@@ -212,7 +212,7 @@ connect2Server_with_af(char *host, int port, int af,int verb) {
while((ret = select(socket_server_fd+1, NULL, &set, NULL, &tv)) == 0) {
if(count > 30 || stream_check_interrupt(500)) {
if(count > 30)
- mp_msg(MSGT_NETWORK,MSGL_ERR,MSGTR_MPDEMUX_NW_ConnTimeout);
+ mp_tmsg(MSGT_NETWORK,MSGL_ERR,"connection timeout\n");
else
mp_msg(MSGT_NETWORK,MSGL_V,"Connection interrupted by user\n");
return TCP_ERROR_TIMEOUT;
@@ -223,7 +223,7 @@ connect2Server_with_af(char *host, int port, int af,int verb) {
tv.tv_sec = 0;
tv.tv_usec = 500000;
}
- if (ret < 0) mp_msg(MSGT_NETWORK,MSGL_ERR,MSGTR_MPDEMUX_NW_SelectFailed);
+ if (ret < 0) mp_tmsg(MSGT_NETWORK,MSGL_ERR,"Select failed.\n");
// Turn back the socket as blocking
#if !HAVE_WINSOCK2_H
@@ -236,11 +236,11 @@ connect2Server_with_af(char *host, int port, int af,int verb) {
err_len = sizeof(int);
ret = getsockopt(socket_server_fd,SOL_SOCKET,SO_ERROR,&err,&err_len);
if(ret < 0) {
- mp_msg(MSGT_NETWORK,MSGL_ERR,MSGTR_MPDEMUX_NW_GetSockOptFailed,strerror(errno));
+ mp_tmsg(MSGT_NETWORK,MSGL_ERR,"getsockopt failed: %s\n",strerror(errno));
return TCP_ERROR_FATAL;
}
if(err > 0) {
- mp_msg(MSGT_NETWORK,MSGL_ERR,MSGTR_MPDEMUX_NW_ConnectError,strerror(err));
+ mp_tmsg(MSGT_NETWORK,MSGL_ERR,"connect error: %s\n",strerror(err));
return TCP_ERROR_PORT;
}
diff --git a/stream/tv.c b/stream/tv.c
index 6c05ac2eb5..cb44790bb6 100644
--- a/stream/tv.c
+++ b/stream/tv.c
@@ -99,7 +99,7 @@ static void tv_scan(tvi_handle_t *tvh)
//Channel scanner without tuner is useless and causes crash due to uninitialized chanlist_s
if (tvh->functions->control(tvh->priv, TVI_CONTROL_IS_TUNER, 0) != TVI_CONTROL_TRUE)
{
- mp_msg(MSGT_TV, MSGL_WARN, MSGTR_TV_ScannerNotAvailableWithoutTuner);
+ mp_tmsg(MSGT_TV, MSGL_WARN, "Channel scanner is not available without tuner\n");
tvh->tv_param->scan=0;
return;
}
@@ -236,7 +236,7 @@ static int norm_from_string(tvi_handle_t *tvh, char* norm)
if(ret!=TVI_CONTROL_UNKNOWN)
{
- mp_msg(MSGT_TV, MSGL_WARN, MSGTR_TV_BogusNormParameter, norm,"default");
+ mp_tmsg(MSGT_TV, MSGL_WARN, "tv.c: norm_from_string(%s): Bogus norm parameter, setting %s.\n", norm,"default");
return 0;
}
@@ -255,7 +255,7 @@ static int norm_from_string(tvi_handle_t *tvh, char* norm)
else if (!strcasecmp(norm, "ntscjp"))
return TV_NORM_NTSCJP;
else {
- mp_msg(MSGT_TV, MSGL_WARN, MSGTR_TV_BogusNormParameter, norm, "PAL");
+ mp_tmsg(MSGT_TV, MSGL_WARN, "tv.c: norm_from_string(%s): Bogus norm parameter, setting %s.\n", norm, "PAL");
return TV_NORM_PAL;
}
}
@@ -264,7 +264,7 @@ static void parse_channels(tvi_handle_t *tvh)
{
char** channels = tvh->tv_param->channels;
- mp_msg(MSGT_TV, MSGL_INFO, MSGTR_TV_ChannelNamesDetected);
+ mp_tmsg(MSGT_TV, MSGL_INFO, "TV channel names detected.\n");
tv_channel_list = malloc(sizeof(tv_channels_t));
tv_channel_list->index=1;
tv_channel_list->next=NULL;
@@ -304,7 +304,7 @@ static void parse_channels(tvi_handle_t *tvh)
}
}
if (tv_channel_current->freq == 0)
- mp_msg(MSGT_TV, MSGL_ERR, MSGTR_TV_NoFreqForChannel,
+ mp_tmsg(MSGT_TV, MSGL_ERR, "Couldn't find frequency for channel %s (%s)\n",
tv_channel_current->number, tv_channel_current->name);
else {
sep = strchr(tv_channel_current->name, '-');
@@ -344,9 +344,9 @@ int tv_set_norm(tvi_handle_t *tvh, char* norm)
{
tvh->norm = norm_from_string(tvh, norm);
- mp_msg(MSGT_TV, MSGL_V, MSGTR_TV_SelectedNorm, norm);
+ mp_tmsg(MSGT_TV, MSGL_V, "Selected norm : %s\n", norm);
if (tvh->functions->control(tvh->priv, TVI_CONTROL_TUN_SET_NORM, &tvh->norm) != TVI_CONTROL_TRUE) {
- mp_msg(MSGT_TV, MSGL_ERR, MSGTR_TV_CannotSetNorm);
+ mp_tmsg(MSGT_TV, MSGL_ERR, "Error: Cannot set norm!\n");
return 0;
}
teletext_control(tvh->demuxer->teletext,TV_VBI_CONTROL_RESET,
@@ -354,13 +354,13 @@ int tv_set_norm(tvi_handle_t *tvh, char* norm)
return 1;
}
-int tv_set_norm_i(tvi_handle_t *tvh, int norm)
+static int tv_set_norm_i(tvi_handle_t *tvh, int norm)
{
tvh->norm = norm;
- mp_msg(MSGT_TV, MSGL_V, MSGTR_TV_SelectedNormId, norm);
+ mp_tmsg(MSGT_TV, MSGL_V, "Selected norm id: %d\n", norm);
if (tvh->functions->control(tvh->priv, TVI_CONTROL_TUN_SET_NORM, &tvh->norm) != TVI_CONTROL_TRUE) {
- mp_msg(MSGT_TV, MSGL_ERR, MSGTR_TV_CannotSetNorm);
+ mp_tmsg(MSGT_TV, MSGL_ERR, "Error: Cannot set norm!\n");
return 0;
}
@@ -386,7 +386,7 @@ static int open_tv(tvi_handle_t *tvh)
if (funcs->control(tvh->priv, TVI_CONTROL_IS_VIDEO, 0) != TVI_CONTROL_TRUE)
{
- mp_msg(MSGT_TV, MSGL_ERR, MSGTR_TV_NoVideoInputPresent);
+ mp_tmsg(MSGT_TV, MSGL_ERR, "Error: No video input present!\n");
return 0;
}
@@ -414,7 +414,14 @@ static int open_tv(tvi_handle_t *tvh)
case IMGFMT_BGR15:
break;
default:
- mp_msg(MSGT_TV, MSGL_ERR, MSGTR_TV_UnknownImageFormat,tvh->tv_param->outfmt);
+ mp_tmsg(MSGT_TV, MSGL_ERR,
+ "==================================================================\n"\
+ " WARNING: UNTESTED OR UNKNOWN OUTPUT IMAGE FORMAT REQUESTED (0x%x)\n"\
+ " This may cause buggy playback or program crash! Bug reports will\n"\
+ " be ignored! You should try again with YV12 (which is the default\n"\
+ " colorspace) and read the documentation!\n"\
+ "==================================================================\n"
+ ,tvh->tv_param->outfmt);
}
funcs->control(tvh->priv, TVI_CONTROL_VID_SET_FORMAT, &tvh->tv_param->outfmt);
}
@@ -451,8 +458,8 @@ static int open_tv(tvi_handle_t *tvh)
else
tvh->tv_param->height = 480/tvh->tv_param->decimation;
}
- mp_msg(MSGT_TV, MSGL_INFO,
- MSGTR_TV_MJP_WidthHeight, tvh->tv_param->width, tvh->tv_param->height);
+ mp_tmsg(MSGT_TV, MSGL_INFO,
+ " MJP: width %d height %d\n", tvh->tv_param->width, tvh->tv_param->height);
}
#endif
@@ -470,7 +477,7 @@ static int open_tv(tvi_handle_t *tvh)
funcs->control(tvh->priv, TVI_CONTROL_VID_SET_WIDTH, &tvh->tv_param->width);
else
{
- mp_msg(MSGT_TV, MSGL_ERR, MSGTR_TV_UnableToSetWidth, tvh->tv_param->width);
+ mp_tmsg(MSGT_TV, MSGL_ERR, "Unable to set requested width: %d\n", tvh->tv_param->width);
funcs->control(tvh->priv, TVI_CONTROL_VID_GET_WIDTH, &tvh->tv_param->width);
}
}
@@ -482,14 +489,14 @@ static int open_tv(tvi_handle_t *tvh)
funcs->control(tvh->priv, TVI_CONTROL_VID_SET_HEIGHT, &tvh->tv_param->height);
else
{
- mp_msg(MSGT_TV, MSGL_ERR, MSGTR_TV_UnableToSetHeight, tvh->tv_param->height);
+ mp_tmsg(MSGT_TV, MSGL_ERR, "Unable to set requested height: %d\n", tvh->tv_param->height);
funcs->control(tvh->priv, TVI_CONTROL_VID_GET_HEIGHT, &tvh->tv_param->height);
}
}
if (funcs->control(tvh->priv, TVI_CONTROL_IS_TUNER, 0) != TVI_CONTROL_TRUE)
{
- mp_msg(MSGT_TV, MSGL_WARN, MSGTR_TV_NoTuner);
+ mp_tmsg(MSGT_TV, MSGL_WARN, "Selected input hasn't got a tuner!\n");
goto done;
}
@@ -505,15 +512,15 @@ static int open_tv(tvi_handle_t *tvh)
}
if (tvh->chanlist == -1)
- mp_msg(MSGT_TV, MSGL_WARN, MSGTR_TV_UnableFindChanlist,
+ mp_tmsg(MSGT_TV, MSGL_WARN, "Unable to find selected channel list! (%s)\n",
tvh->tv_param->chanlist);
else
- mp_msg(MSGT_TV, MSGL_V, MSGTR_TV_SelectedChanlist,
+ mp_tmsg(MSGT_TV, MSGL_V, "Selected channel list: %s (including %d channels)\n",
chanlists[tvh->chanlist].name, chanlists[tvh->chanlist].count);
if (tvh->tv_param->freq && tvh->tv_param->channel)
{
- mp_msg(MSGT_TV, MSGL_WARN, MSGTR_TV_ChannelFreqParamConflict);
+ mp_tmsg(MSGT_TV, MSGL_WARN, "You can't set frequency and channel simultaneously!\n");
goto done;
}
@@ -555,7 +562,7 @@ static int open_tv(tvi_handle_t *tvh)
tv_channel_current = tv_channel_current->next;
}
- mp_msg(MSGT_TV, MSGL_INFO, MSGTR_TV_SelectedChannel3, tv_channel_current->number,
+ mp_tmsg(MSGT_TV, MSGL_INFO, "Selected channel: %s - %s (freq: %.3f)\n", tv_channel_current->number,
tv_channel_current->name, (float)tv_channel_current->freq/1000);
tv_set_norm_i(tvh, tv_channel_current->norm);
tv_set_freq(tvh, (unsigned long)(((float)tv_channel_current->freq/1000)*16));
@@ -570,14 +577,14 @@ static int open_tv(tvi_handle_t *tvh)
funcs->control(tvh->priv, TVI_CONTROL_TUN_SET_FREQ, &freq);
funcs->control(tvh->priv, TVI_CONTROL_TUN_GET_FREQ, &freq);
- mp_msg(MSGT_TV, MSGL_V, MSGTR_TV_SelectedFrequency,
+ mp_tmsg(MSGT_TV, MSGL_V, "Selected frequency: %lu (%.3f)\n",
freq, (float)freq/16);
}
if (tvh->tv_param->channel) {
struct CHANLIST cl;
- mp_msg(MSGT_TV, MSGL_V, MSGTR_TV_RequestedChannel, tvh->tv_param->channel);
+ mp_tmsg(MSGT_TV, MSGL_V, "Requested channel: %s\n", tvh->tv_param->channel);
for (i = 0; i < chanlists[tvh->chanlist].count; i++)
{
cl = tvh->chanlist_s[i];
@@ -587,7 +594,7 @@ static int open_tv(tvi_handle_t *tvh)
{
strcpy(tv_channel_last_real, cl.name);
tvh->channel = i;
- mp_msg(MSGT_TV, MSGL_INFO, MSGTR_TV_SelectedChannel2,
+ mp_tmsg(MSGT_TV, MSGL_INFO, "Selected channel: %s (freq: %.3f)\n",
cl.name, (float)cl.freq/1000);
tv_set_freq(tvh, (unsigned long)(((float)cl.freq/1000)*16));
break;
@@ -625,7 +632,7 @@ static tvi_handle_t *tv_begin(tv_param_t* tv_param)
int i;
tvi_handle_t* h;
if(tv_param->driver && !strcmp(tv_param->driver,"help")){
- mp_msg(MSGT_TV,MSGL_INFO,MSGTR_TV_AvailableDrivers);
+ mp_tmsg(MSGT_TV,MSGL_INFO,"Available drivers:\n");
for(i=0;tvi_driver_list[i];i++){
mp_msg(MSGT_TV,MSGL_INFO," %s\t%s",tvi_driver_list[i]->short_name,tvi_driver_list[i]->name);
if(tvi_driver_list[i]->comment)
@@ -646,7 +653,7 @@ static tvi_handle_t *tv_begin(tv_param_t* tv_param)
continue;
h->tv_param=tv_param;
- mp_msg(MSGT_TV, MSGL_INFO, MSGTR_TV_DriverInfo, tvi_driver_list[i]->short_name,
+ mp_tmsg(MSGT_TV, MSGL_INFO, "Selected driver: %s\n name: %s\n author: %s\n comment: %s\n", tvi_driver_list[i]->short_name,
tvi_driver_list[i]->name,
tvi_driver_list[i]->author,
tvi_driver_list[i]->comment?tvi_driver_list[i]->comment:"");
@@ -656,9 +663,9 @@ static tvi_handle_t *tv_begin(tv_param_t* tv_param)
}
if(tv_param->driver)
- mp_msg(MSGT_TV, MSGL_ERR, MSGTR_TV_NoSuchDriver, tv_param->driver);
+ mp_tmsg(MSGT_TV, MSGL_ERR, "No such driver: %s\n", tv_param->driver);
else
- mp_msg(MSGT_TV, MSGL_ERR, MSGTR_TV_DriverAutoDetectionFailed);
+ mp_tmsg(MSGT_TV, MSGL_ERR, "TV driver autodetection failed.\n");
return NULL;
}
@@ -776,7 +783,7 @@ static demuxer_t* demux_open_tv(demuxer_t *demuxer)
case AF_FORMAT_A_LAW:
case AF_FORMAT_MPEG2:
default:
- mp_msg(MSGT_TV, MSGL_ERR, MSGTR_TV_UnsupportedAudioType,
+ mp_tmsg(MSGT_TV, MSGL_ERR, "Audio type '%s (%x)' unsupported!\n",
af_fmt2str(audio_format, buf, 128), audio_format);
goto no_audio;
}
@@ -806,7 +813,7 @@ static demuxer_t* demux_open_tv(demuxer_t *demuxer)
sh_audio->wf->nBlockAlign = sh_audio->samplesize * sh_audio->channels;
sh_audio->wf->nAvgBytesPerSec = sh_audio->i_bps;
- mp_msg(MSGT_DECVIDEO, MSGL_V, MSGTR_TV_AudioFormat,
+ mp_tmsg(MSGT_DECVIDEO, MSGL_V, " TV audio: %d channels, %d bits, %d Hz\n",
sh_audio->wf->nChannels, sh_audio->wf->wBitsPerSample,
sh_audio->wf->nSamplesPerSec);
@@ -864,7 +871,7 @@ int tv_set_color_options(tvi_handle_t *tvh, int opt, int value)
case TV_COLOR_CONTRAST:
return funcs->control(tvh->priv, TVI_CONTROL_VID_SET_CONTRAST, &value);
default:
- mp_msg(MSGT_TV, MSGL_WARN, MSGTR_TV_UnknownColorOption, opt);
+ mp_tmsg(MSGT_TV, MSGL_WARN, "Unknown color option (%d) specified!\n", opt);
}
return TVI_CONTROL_UNKNOWN;
@@ -885,7 +892,7 @@ int tv_get_color_options(tvi_handle_t *tvh, int opt, int* value)
case TV_COLOR_CONTRAST:
return funcs->control(tvh->priv, TVI_CONTROL_VID_GET_CONTRAST, value);
default:
- mp_msg(MSGT_TV, MSGL_WARN, MSGTR_TV_UnknownColorOption, opt);
+ mp_tmsg(MSGT_TV, MSGL_WARN, "Unknown color option (%d) specified!\n", opt);
}
return TVI_CONTROL_UNKNOWN;
@@ -896,7 +903,7 @@ int tv_get_freq(tvi_handle_t *tvh, unsigned long *freq)
if (tvh->functions->control(tvh->priv, TVI_CONTROL_IS_TUNER, 0) == TVI_CONTROL_TRUE)
{
tvh->functions->control(tvh->priv, TVI_CONTROL_TUN_GET_FREQ, freq);
- mp_msg(MSGT_TV, MSGL_V, MSGTR_TV_CurrentFrequency,
+ mp_tmsg(MSGT_TV, MSGL_V, "Current frequency: %lu (%.3f)\n",
*freq, (float)*freq/16);
}
return 1;
@@ -912,7 +919,7 @@ int tv_set_freq(tvi_handle_t *tvh, unsigned long freq)
tvh->functions->control(tvh->priv, TVI_CONTROL_TUN_SET_FREQ, &freq);
tvh->functions->control(tvh->priv, TVI_CONTROL_TUN_GET_FREQ, &freq);
- mp_msg(MSGT_TV, MSGL_V, MSGTR_TV_CurrentFrequency,
+ mp_tmsg(MSGT_TV, MSGL_V, "Current frequency: %lu (%.3f)\n",
freq, (float)freq/16);
}
teletext_control(tvh->demuxer->teletext,TV_VBI_CONTROL_RESET,
@@ -957,7 +964,7 @@ int tv_step_channel_real(tvi_handle_t *tvh, int direction)
{
strcpy(tv_channel_last_real, tvh->chanlist_s[tvh->channel].name);
cl = tvh->chanlist_s[--tvh->channel];
- mp_msg(MSGT_TV, MSGL_INFO, MSGTR_TV_SelectedChannel2,
+ mp_tmsg(MSGT_TV, MSGL_INFO, "Selected channel: %s (freq: %.3f)\n",
cl.name, (float)cl.freq/1000);
tv_set_freq(tvh, (unsigned long)(((float)cl.freq/1000)*16));
}
@@ -969,7 +976,7 @@ int tv_step_channel_real(tvi_handle_t *tvh, int direction)
{
strcpy(tv_channel_last_real, tvh->chanlist_s[tvh->channel].name);
cl = tvh->chanlist_s[++tvh->channel];
- mp_msg(MSGT_TV, MSGL_INFO, MSGTR_TV_SelectedChannel2,
+ mp_tmsg(MSGT_TV, MSGL_INFO, "Selected channel: %s (freq: %.3f)\n",
cl.name, (float)cl.freq/1000);
tv_set_freq(tvh, (unsigned long)(((float)cl.freq/1000)*16));
}
@@ -989,7 +996,7 @@ int tv_step_channel(tvi_handle_t *tvh, int direction) {
tv_set_norm_i(tvh, tv_channel_current->norm);
tv_set_freq(tvh, (unsigned long)(((float)tv_channel_current->freq/1000)*16));
- mp_msg(MSGT_TV, MSGL_INFO, MSGTR_TV_SelectedChannel3,
+ mp_tmsg(MSGT_TV, MSGL_INFO, "Selected channel: %s - %s (freq: %.3f)\n",
tv_channel_current->number, tv_channel_current->name, (float)tv_channel_current->freq/1000);
}
if (direction == TV_CHANNEL_LOWER) {
@@ -1001,7 +1008,7 @@ int tv_step_channel(tvi_handle_t *tvh, int direction) {
tv_channel_current = tv_channel_current->next;
tv_set_norm_i(tvh, tv_channel_current->norm);
tv_set_freq(tvh, (unsigned long)(((float)tv_channel_current->freq/1000)*16));
- mp_msg(MSGT_TV, MSGL_INFO, MSGTR_TV_SelectedChannel3,
+ mp_tmsg(MSGT_TV, MSGL_INFO, "Selected channel: %s - %s (freq: %.3f)\n",
tv_channel_current->number, tv_channel_current->name, (float)tv_channel_current->freq/1000);
}
} else tv_step_channel_real(tvh, direction);
@@ -1022,7 +1029,7 @@ int tv_set_channel_real(tvi_handle_t *tvh, char *channel) {
if (!strcasecmp(cl.name, channel))
{
tvh->channel = i;
- mp_msg(MSGT_TV, MSGL_INFO, MSGTR_TV_SelectedChannel2,
+ mp_tmsg(MSGT_TV, MSGL_INFO, "Selected channel: %s (freq: %.3f)\n",
cl.name, (float)cl.freq/1000);
tv_set_freq(tvh, (unsigned long)(((float)cl.freq/1000)*16));
break;
@@ -1042,7 +1049,7 @@ int tv_set_channel(tvi_handle_t *tvh, char *channel) {
for (i = 1; i < channel_int; i++)
if (tv_channel_current->next)
tv_channel_current = tv_channel_current->next;
- mp_msg(MSGT_TV, MSGL_INFO, MSGTR_TV_SelectedChannel3, tv_channel_current->number,
+ mp_tmsg(MSGT_TV, MSGL_INFO, "Selected channel: %s - %s (freq: %.3f)\n", tv_channel_current->number,
tv_channel_current->name, (float)tv_channel_current->freq/1000);
tv_set_norm_i(tvh, tv_channel_current->norm);
tv_set_freq(tvh, (unsigned long)(((float)tv_channel_current->freq/1000)*16));
@@ -1060,7 +1067,7 @@ int tv_last_channel(tvi_handle_t *tvh) {
tv_channel_last = tv_channel_current;
tv_channel_current = tmp;
- mp_msg(MSGT_TV, MSGL_INFO, MSGTR_TV_SelectedChannel3, tv_channel_current->number,
+ mp_tmsg(MSGT_TV, MSGL_INFO, "Selected channel: %s - %s (freq: %.3f)\n", tv_channel_current->number,
tv_channel_current->name, (float)tv_channel_current->freq/1000);
tv_set_norm_i(tvh, tv_channel_current->norm);
tv_set_freq(tvh, (unsigned long)(((float)tv_channel_current->freq/1000)*16));
@@ -1075,7 +1082,7 @@ int tv_last_channel(tvi_handle_t *tvh) {
{
strcpy(tv_channel_last_real, tvh->chanlist_s[tvh->channel].name);
tvh->channel = i;
- mp_msg(MSGT_TV, MSGL_INFO, MSGTR_TV_SelectedChannel2,
+ mp_tmsg(MSGT_TV, MSGL_INFO, "Selected channel: %s (freq: %.3f)\n",
cl.name, (float)cl.freq/1000);
tv_set_freq(tvh, (unsigned long)(((float)cl.freq/1000)*16));
break;
@@ -1093,7 +1100,7 @@ int tv_step_norm(tvi_handle_t *tvh)
tvh->norm = 0;
if (tvh->functions->control(tvh->priv, TVI_CONTROL_TUN_SET_NORM,
&tvh->norm) != TVI_CONTROL_TRUE) {
- mp_msg(MSGT_TV, MSGL_ERR, MSGTR_TV_CannotSetNorm);
+ mp_tmsg(MSGT_TV, MSGL_ERR, "Error: Cannot set norm!\n");
return 0;
}
}
diff --git a/stream/tvi_bsdbt848.c b/stream/tvi_bsdbt848.c
index 3d039911ab..627540b09b 100644
--- a/stream/tvi_bsdbt848.c
+++ b/stream/tvi_bsdbt848.c
@@ -250,7 +250,7 @@ static int control(priv_t *priv, int cmd, void *arg)
{
if(ioctl(priv->tunerfd, TVTUNER_GETFREQ, &priv->tunerfreq) < 0)
{
- mp_msg(MSGT_TV, MSGL_ERR, MSGTR_TV_Bt848IoctlFailed, "TVTUNER_GETFREQ", strerror(errno));
+ mp_tmsg(MSGT_TV, MSGL_ERR, "tvi_bsdbt848: Call to %s ioctl failed. Error: %s\n", "TVTUNER_GETFREQ", strerror(errno));
return TVI_CONTROL_FALSE;
}
@@ -264,7 +264,7 @@ static int control(priv_t *priv, int cmd, void *arg)
if(ioctl(priv->tunerfd, TVTUNER_SETFREQ, &priv->tunerfreq) < 0)
{
- mp_msg(MSGT_TV, MSGL_ERR, MSGTR_TV_Bt848IoctlFailed, "TVTUNER_SETFREQ", strerror(errno));
+ mp_tmsg(MSGT_TV, MSGL_ERR, "tvi_bsdbt848: Call to %s ioctl failed. Error: %s\n", "TVTUNER_SETFREQ", strerror(errno));
return 0;
}
@@ -275,7 +275,7 @@ static int control(priv_t *priv, int cmd, void *arg)
int status;
if(ioctl(priv->tunerfd, TVTUNER_GETSTATUS, &status) < 0)
{
- mp_msg(MSGT_TV, MSGL_ERR, MSGTR_TV_Bt848IoctlFailed, "GETSTATUS", strerror(errno));
+ mp_tmsg(MSGT_TV, MSGL_ERR, "tvi_bsdbt848: Call to %s ioctl failed. Error: %s\n", "GETSTATUS", strerror(errno));
return 0;
}
*(int*)arg=(status & 0x02)? 100 : 0;
@@ -291,7 +291,7 @@ static int control(priv_t *priv, int cmd, void *arg)
{
if(ioctl(priv->btfd, METEORGINPUT, &priv->input) < 0)
{
- mp_msg(MSGT_TV, MSGL_ERR, MSGTR_TV_Bt848IoctlFailed, "METEORGINPUT", strerror(errno));
+ mp_tmsg(MSGT_TV, MSGL_ERR, "tvi_bsdbt848: Call to %s ioctl failed. Error: %s\n", "METEORGINPUT", strerror(errno));
return TVI_CONTROL_FALSE;
}
@@ -305,7 +305,7 @@ static int control(priv_t *priv, int cmd, void *arg)
if(ioctl(priv->btfd, METEORSINPUT, &priv->input) < 0)
{
- mp_msg(MSGT_TV, MSGL_ERR, MSGTR_TV_Bt848IoctlFailed, "METEORSINPUT", strerror(errno));
+ mp_tmsg(MSGT_TV, MSGL_ERR, "tvi_bsdbt848: Call to %s ioctl failed. Error: %s\n", "METEORSINPUT", strerror(errno));
return 0;
}
@@ -334,7 +334,7 @@ static int control(priv_t *priv, int cmd, void *arg)
if(ioctl(priv->dspfd, SNDCTL_DSP_SPEED, &dspspeed) == -1)
{
- mp_msg(MSGT_TV, MSGL_ERR, MSGTR_TV_Bt848InvalidAudioRate, strerror(errno));
+ mp_tmsg(MSGT_TV, MSGL_ERR, "tvi_bsdbt848: Invalid audio rate. Error: %s\n", strerror(errno));
return TVI_CONTROL_FALSE;
}
@@ -422,20 +422,20 @@ static int control(priv_t *priv, int cmd, void *arg)
if(ioctl(priv->btfd, METEORSFMT, &priv->iformat) < 0)
{
- mp_msg(MSGT_TV, MSGL_ERR, MSGTR_TV_Bt848IoctlFailed, "METEORSFMT", strerror(errno));
+ mp_tmsg(MSGT_TV, MSGL_ERR, "tvi_bsdbt848: Call to %s ioctl failed. Error: %s\n", "METEORSFMT", strerror(errno));
return TVI_CONTROL_FALSE;
}
if(ioctl(priv->btfd, METEORSETGEO, &priv->geom) < 0)
{
- mp_msg(MSGT_TV, MSGL_ERR, MSGTR_TV_Bt848IoctlFailed, "METEORSETGEO", strerror(errno));
+ mp_tmsg(MSGT_TV, MSGL_ERR, "tvi_bsdbt848: Call to %s ioctl failed. Error: %s\n", "METEORSETGEO", strerror(errno));
return 0;
}
tmp_fps = priv->fps;
if(ioctl(priv->btfd, METEORSFPS, &tmp_fps) < 0)
{
- mp_msg(MSGT_TV, MSGL_ERR, MSGTR_TV_Bt848IoctlFailed, "METEORSFPS", strerror(errno));
+ mp_tmsg(MSGT_TV, MSGL_ERR, "tvi_bsdbt848: Call to %s ioctl failed. Error: %s\n", "METEORSFPS", strerror(errno));
return 0;
}
@@ -443,7 +443,7 @@ static int control(priv_t *priv, int cmd, void *arg)
if(priv->tunerready == TRUE &&
ioctl(priv->tunerfd, BT848_SAUDIO, &priv->tv_param->audio_id) < 0)
{
- mp_msg(MSGT_TV, MSGL_ERR, MSGTR_TV_Bt848IoctlFailed, "BT848_SAUDIO", strerror(errno));
+ mp_tmsg(MSGT_TV, MSGL_ERR, "tvi_bsdbt848: Call to %s ioctl failed. Error: %s\n", "BT848_SAUDIO", strerror(errno));
}
#endif
@@ -472,7 +472,7 @@ static int control(priv_t *priv, int cmd, void *arg)
if(ioctl(priv->btfd, METEORSETGEO, &priv->geom) < 0)
{
- mp_msg(MSGT_TV, MSGL_ERR, MSGTR_TV_Bt848ErrorSettingWidth, strerror(errno));
+ mp_tmsg(MSGT_TV, MSGL_ERR, "tvi_bsdbt848: Error setting picture width. Error: %s\n", strerror(errno));
return 0;
}
@@ -497,7 +497,7 @@ static int control(priv_t *priv, int cmd, void *arg)
if(ioctl(priv->btfd, METEORSETGEO, &priv->geom) < 0)
{
- mp_msg(MSGT_TV, MSGL_ERR, MSGTR_TV_Bt848ErrorSettingWidth, strerror(errno));
+ mp_tmsg(MSGT_TV, MSGL_ERR, "tvi_bsdbt848: Error setting picture width. Error: %s\n", strerror(errno));
return 0;
}
@@ -519,7 +519,7 @@ static int control(priv_t *priv, int cmd, void *arg)
if(ioctl(priv->btfd, METEORSFPS, &priv->fps) < 0)
{
- mp_msg(MSGT_TV, MSGL_ERR, MSGTR_TV_Bt848IoctlFailed, "METEORSFPS", strerror(errno));
+ mp_tmsg(MSGT_TV, MSGL_ERR, "tvi_bsdbt848: Call to %s ioctl failed. Error: %s\n", "METEORSFPS", strerror(errno));
return 0;
}
@@ -570,33 +570,33 @@ priv->btfd = open(priv->btdev, O_RDONLY);
if(priv->btfd < 0)
{
- mp_msg(MSGT_TV, MSGL_ERR, MSGTR_TV_Bt848ErrorOpeningBktrDev, strerror(errno));
+ mp_tmsg(MSGT_TV, MSGL_ERR, "tvi_bsdbt848: Unable to open bktr device. Error: %s\n", strerror(errno));
priv->videoready = FALSE;
}
if(priv->videoready == TRUE &&
ioctl(priv->btfd, METEORSFMT, &priv->iformat) < 0)
{
- mp_msg(MSGT_TV, MSGL_ERR, MSGTR_TV_Bt848IoctlFailed, "SETEORSFMT", strerror(errno));
+ mp_tmsg(MSGT_TV, MSGL_ERR, "tvi_bsdbt848: Call to %s ioctl failed. Error: %s\n", "SETEORSFMT", strerror(errno));
}
if(priv->videoready == TRUE &&
ioctl(priv->btfd, METEORSINPUT, &priv->source) < 0)
{
- mp_msg(MSGT_TV, MSGL_ERR, MSGTR_TV_Bt848IoctlFailed, "METEORSINPUT", strerror(errno));
+ mp_tmsg(MSGT_TV, MSGL_ERR, "tvi_bsdbt848: Call to %s ioctl failed. Error: %s\n", "METEORSINPUT", strerror(errno));
}
tmp_fps = priv->fps;
if(priv->videoready == TRUE &&
ioctl(priv->btfd, METEORSFPS, &tmp_fps) < 0)
{
- mp_msg(MSGT_TV, MSGL_ERR, MSGTR_TV_Bt848IoctlFailed, "METEORSFPS", strerror(errno));
+ mp_tmsg(MSGT_TV, MSGL_ERR, "tvi_bsdbt848: Call to %s ioctl failed. Error: %s\n", "METEORSFPS", strerror(errno));
}
if(priv->videoready == TRUE &&
ioctl(priv->btfd, METEORSETGEO, &priv->geom) < 0)
{
- mp_msg(MSGT_TV, MSGL_ERR, MSGTR_TV_Bt848IoctlFailed, "METEORSGEQ", strerror(errno));
+ mp_tmsg(MSGT_TV, MSGL_ERR, "tvi_bsdbt848: Call to %s ioctl failed. Error: %s\n", "METEORSGEQ", strerror(errno));
}
if(priv->videoready == TRUE)
@@ -608,7 +608,7 @@ if(priv->videoready == TRUE)
if(priv->livebuf == (u_char *) MAP_FAILED)
{
- mp_msg(MSGT_TV, MSGL_ERR, MSGTR_TV_Bt848MmapFailed, strerror(errno));
+ mp_tmsg(MSGT_TV, MSGL_ERR, "tvi_bsdbt848: mmap failed. Error: %s\n", strerror(errno));
priv->videoready = FALSE;
}
@@ -618,7 +618,7 @@ if(priv->videoready == TRUE)
if(priv->framebuf[count].buf == NULL)
{
- mp_msg(MSGT_TV, MSGL_ERR, MSGTR_TV_Bt848FrameBufAllocFailed, strerror(errno));
+ mp_tmsg(MSGT_TV, MSGL_ERR, "tvi_bsdbt848: Frame buffer allocation failed. Error: %s\n", strerror(errno));
priv->videoready = FALSE;
break;
}
@@ -636,7 +636,7 @@ priv->tunerfd = open(priv->tunerdev, O_RDONLY);
if(priv->tunerfd < 0)
{
- mp_msg(MSGT_TV, MSGL_ERR, MSGTR_TV_Bt848ErrorOpeningTunerDev, strerror(errno));
+ mp_tmsg(MSGT_TV, MSGL_ERR, "tvi_bsdbt848: Unable to open tuner device. Error: %s\n", strerror(errno));
priv->tunerready = FALSE;
}
@@ -654,7 +654,7 @@ priv->dspframesize = priv->dspspeed*priv->dspsamplesize/8/priv->fps *
if((priv->dspfd = open (priv->dspdev, O_RDONLY, 0)) < 0)
{
- mp_msg(MSGT_TV, MSGL_ERR, MSGTR_TV_Bt848ErrorOpeningDspDev, strerror(errno));
+ mp_tmsg(MSGT_TV, MSGL_ERR, "tvi_bsdbt848: Unable to open dsp device. Error: %s\n", strerror(errno));
priv->dspready = FALSE;
}
@@ -662,7 +662,7 @@ marg = (256 << 16) | 12;
if (ioctl(priv->dspfd, SNDCTL_DSP_SETFRAGMENT, &marg ) < 0 )
{
- mp_msg(MSGT_TV, MSGL_ERR, MSGTR_TV_Bt848IoctlFailed, "SNDCTL_DSP_SETFRAGMENT", strerror(errno));
+ mp_tmsg(MSGT_TV, MSGL_ERR, "tvi_bsdbt848: Call to %s ioctl failed. Error: %s\n", "SNDCTL_DSP_SETFRAGMENT", strerror(errno));
priv->dspready = FALSE;
}
@@ -672,7 +672,7 @@ if((priv->dspready == TRUE) &&
(ioctl(priv->dspfd, SNDCTL_DSP_SPEED, &priv->dspspeed) == -1) ||
(ioctl(priv->dspfd, SNDCTL_DSP_SETFMT, &priv->dspfmt) == -1)))
{
- mp_msg(MSGT_TV, MSGL_ERR, MSGTR_TV_Bt848ErrorConfiguringDsp, strerror(errno));
+ mp_tmsg(MSGT_TV, MSGL_ERR, "tvi_bsdbt848: Configuration of dsp failed. Error: %s\n", strerror(errno));
close(priv->dspfd);
priv->dspready = FALSE;
}
@@ -697,7 +697,7 @@ marg = SIGUSR1;
if(ioctl(priv->btfd, METEORSSIGNAL, &marg) < 0)
{
- mp_msg(MSGT_TV, MSGL_ERR, MSGTR_TV_Bt848IoctlFailed, "METEORSSIGNAL", strerror(errno));
+ mp_tmsg(MSGT_TV, MSGL_ERR, "tvi_bsdbt848: Call to %s ioctl failed. Error: %s\n", "METEORSSIGNAL", strerror(errno));
return 0;
}
@@ -711,7 +711,7 @@ marg = METEOR_CAP_CONTINOUS;
if(ioctl(priv->btfd, METEORCAPTUR, &marg) < 0)
{
- mp_msg(MSGT_TV, MSGL_ERR, MSGTR_TV_Bt848IoctlFailed, "METEORCAPTUR", strerror(errno));
+ mp_tmsg(MSGT_TV, MSGL_ERR, "tvi_bsdbt848: Call to %s ioctl failed. Error: %s\n", "METEORCAPTUR", strerror(errno));
return 0;
}
@@ -728,7 +728,7 @@ marg = METEOR_SIG_MODE_MASK;
if(ioctl( priv->btfd, METEORSSIGNAL, &marg) < 0 )
{
- mp_msg(MSGT_TV, MSGL_ERR, MSGTR_TV_Bt848IoctlFailed, "METEORSSIGNAL", strerror(errno));
+ mp_tmsg(MSGT_TV, MSGL_ERR, "tvi_bsdbt848: Call to %s ioctl failed. Error: %s\n", "METEORSSIGNAL", strerror(errno));
return 0;
}
@@ -736,7 +736,7 @@ marg = METEOR_CAP_STOP_CONT;
if(ioctl(priv->btfd, METEORCAPTUR, &marg) < 0 )
{
- mp_msg(MSGT_TV, MSGL_ERR, MSGTR_TV_Bt848UnableToStopCapture, strerror(errno));
+ mp_tmsg(MSGT_TV, MSGL_ERR, "tvi_bsdbt848: Unable to stop capture. Error: %s\n", strerror(errno));
return 0;
}
@@ -831,7 +831,7 @@ while(bytesread < len)
if(ret == -1)
{
- mp_msg(MSGT_TV, MSGL_ERR, MSGTR_TV_Bt848ErrorReadingAudio, strerror(errno));
+ mp_tmsg(MSGT_TV, MSGL_ERR, "tvi_bsdbt848: Error reading audio data. Error: %s\n", strerror(errno));
return 0;
}
@@ -871,7 +871,7 @@ if(priv->dspready == FALSE) return 0;
#ifdef CONFIG_SUN_AUDIO
if(ioctl(priv->dspfd, AUDIO_GETINFO, &auinf) < 0)
{
- mp_msg(MSGT_TV, MSGL_ERR, MSGTR_TV_Bt848IoctlFailed, "AUDIO_GETINFO", strerror(errno));
+ mp_tmsg(MSGT_TV, MSGL_ERR, "tvi_bsdbt848: Call to %s ioctl failed. Error: %s\n", "AUDIO_GETINFO", strerror(errno));
return TVI_CONTROL_FALSE;
}
else
@@ -879,7 +879,7 @@ else
#else
if(ioctl(priv->dspfd, FIONREAD, &bytesavail) < 0)
{
- mp_msg(MSGT_TV, MSGL_ERR, MSGTR_TV_Bt848IoctlFailed, "FIONREAD", strerror(errno));
+ mp_tmsg(MSGT_TV, MSGL_ERR, "tvi_bsdbt848: Call to %s ioctl failed. Error: %s\n", "FIONREAD", strerror(errno));
return TVI_CONTROL_FALSE;
}
#endif
diff --git a/stream/tvi_dshow.c b/stream/tvi_dshow.c
index 9aec47ed54..0563d74f18 100644
--- a/stream/tvi_dshow.c
+++ b/stream/tvi_dshow.c
@@ -1089,10 +1089,10 @@ static HRESULT set_nearest_freq(priv_t * priv, long lFreq)
if (load_freq_table(chanlist2country(priv->tv_param->chanlist), tunerInput, &(priv->freq_table), &(priv->freq_table_len), &(priv->first_channel)) != S_OK) {//FIXME
priv->freq_table_len=0;
priv->freq_table=NULL;
- mp_msg(MSGT_TV, MSGL_ERR, MSGTR_TVI_DS_UnableExtractFreqTable);
+ mp_tmsg(MSGT_TV, MSGL_ERR, "tvi_dshow: Unable to load frequency table from kstvtune.ax\n");
return E_FAIL;
};
- mp_msg(MSGT_TV, MSGL_V, MSGTR_TVI_DS_FreqTableLoaded, tunerInput == TunerInputAntenna ? "broadcast" : "cable",
+ mp_tmsg(MSGT_TV, MSGL_V, "tvi_dshow: loaded system (%s) frequency table for country id=%d (channels:%d).\n", tunerInput == TunerInputAntenna ? "broadcast" : "cable",
chanlist2country(priv->tv_param->chanlist), priv->freq_table_len);
}
@@ -1109,14 +1109,14 @@ static HRESULT set_nearest_freq(priv_t * priv, long lFreq)
mp_msg(MSGT_TV, MSGL_DBG4, "tvi_dshow: set_nearest_freq #%d (%ld) => %d (%ld)\n",i+priv->first_channel,priv->freq_table[i], nChannel,lFreqDiff);
}
if (nChannel == -1) {
- mp_msg(MSGT_TV,MSGL_ERR, MSGTR_TVI_DS_UnableFindNearestChannel);
+ mp_tmsg(MSGT_TV,MSGL_ERR, "tvi_dshow: Unable to find nearest channel in system frequency table\n");
return E_FAIL;
}
mp_msg(MSGT_TV, MSGL_V, "tvi_dshow: set_nearest_freq #%d (%ld)\n",nChannel,priv->freq_table[nChannel - priv->first_channel]);
hr = OLE_CALL_ARGS(priv->pTVTuner, put_Channel, nChannel,
AMTUNER_SUBCHAN_DEFAULT, AMTUNER_SUBCHAN_DEFAULT);
if (FAILED(hr)) {
- mp_msg(MSGT_TV,MSGL_ERR,MSGTR_TVI_DS_UnableToSetChannel, (unsigned int)hr);
+ mp_tmsg(MSGT_TV,MSGL_ERR,"tvi_dshow: Unable to switch to nearest channel from system frequency table. Error:0x%x\n", (unsigned int)hr);
return E_FAIL;
}
return S_OK;
@@ -1143,7 +1143,7 @@ static int set_frequency(priv_t * priv, long lFreq)
if (priv->direct_setfreq_call) { //using direct call to set frequency
hr = set_frequency_direct(priv->pTVTuner, lFreq);
if (FAILED(hr)) {
- mp_msg(MSGT_TV, MSGL_V, MSGTR_TVI_DS_DirectSetFreqFailed);
+ mp_tmsg(MSGT_TV, MSGL_V, "tvi_dshow: Unable to set frequency directly. OS built-in channels table will be used.\n");
priv->direct_setfreq_call = 0;
}
}
@@ -1218,7 +1218,7 @@ static int get_frequency(priv_t * priv, long *plFreq)
if (priv->direct_getfreq_call) { //using direct call to get frequency
hr = get_frequency_direct(priv->pTVTuner, plFreq);
if (FAILED(hr)) {
- mp_msg(MSGT_TV, MSGL_INFO, MSGTR_TVI_DS_DirectGetFreqFailed);
+ mp_tmsg(MSGT_TV, MSGL_INFO, "tvi_dshow: Unable to get frequency directly. OS built-in channels table will be used.\n");
priv->direct_getfreq_call = 0;
}
}
@@ -1252,7 +1252,7 @@ static void get_capabilities(priv_t * priv)
mp_msg(MSGT_TV, MSGL_DBG4, "tvi_dshow: get_capabilities called\n");
if (priv->pTVTuner) {
- mp_msg(MSGT_TV, MSGL_V, MSGTR_TVI_DS_SupportedNorms);
+ mp_tmsg(MSGT_TV, MSGL_V, "tvi_dshow: supported norms:");
hr = OLE_CALL_ARGS(priv->pTVTuner, get_AvailableTVFormats,
&lAvailableFormats);
if (FAILED(hr))
@@ -1276,7 +1276,7 @@ static void get_capabilities(priv_t * priv)
tv_available_inputs = (long *) malloc(sizeof(long) * lInputPins);
tv_available_inputs_count = 0;
- mp_msg(MSGT_TV, MSGL_V, MSGTR_TVI_DS_AvailableVideoInputs);
+ mp_tmsg(MSGT_TV, MSGL_V, "tvi_dshow: available video inputs:");
for (i = 0; i < lInputPins; i++) {
OLE_CALL_ARGS(priv->pCrossbar, get_CrossbarPinInfo, 1, i,
&lRelated, &lPhysicalType);
@@ -1297,7 +1297,7 @@ static void get_capabilities(priv_t * priv)
hr = OLE_CALL_ARGS(priv->chains[1]->pCaptureFilter, EnumPins, &pEnum);
if (FAILED(hr))
return;
- mp_msg(MSGT_TV, MSGL_V, MSGTR_TVI_DS_AvailableAudioInputs);
+ mp_tmsg(MSGT_TV, MSGL_V, "tvi_dshow: available audio inputs:");
i = 0;
while (OLE_CALL_ARGS(pEnum, Next, 1, &pPin, NULL) == S_OK) {
memset(&pi, 0, sizeof(pi));
@@ -1319,7 +1319,7 @@ static void get_capabilities(priv_t * priv)
else
OLE_CALL_ARGS(pIAMixer, put_MixLevel, 1.0);
#endif
- mp_msg(MSGT_TV, MSGL_V, MSGTR_TVI_DS_InputSelected);
+ mp_tmsg(MSGT_TV, MSGL_V, "(selected)");
} else {
OLE_CALL_ARGS(pIAMixer, put_Enable, FALSE);
#if 0
@@ -1464,7 +1464,7 @@ static HRESULT build_sub_graph(priv_t * priv, chain_t * chain, const GUID* ppin_
hr = OLE_CALL_ARGS(chain->pCapturePin, ConnectionMediaType, chain->pmt);
if(FAILED(hr))
{
- mp_msg(MSGT_TV, MSGL_WARN, MSGTR_TVI_DS_GetActualMediatypeFailed, (unsigned int)hr);
+ mp_tmsg(MSGT_TV, MSGL_WARN, "tvi_dshow: Unable to get actual mediatype (Error:0x%x). Assuming equal to requested.\n", (unsigned int)hr);
}
if(priv->tv_param->hidden_video_renderer){
@@ -1578,7 +1578,7 @@ static int set_crossbar_input(priv_t * priv, int input)
//connecting given input with video decoder
hr = OLE_CALL_ARGS(priv->pCrossbar, Route, nVideoDecoder, lInput);
if (hr != S_OK) {
- mp_msg(MSGT_TV,MSGL_ERR,MSGTR_TVI_DS_UnableConnectInputVideoDecoder, (unsigned int)hr);
+ mp_tmsg(MSGT_TV,MSGL_ERR,"Unable to connect given input to video decoder. Error:0x%x\n", (unsigned int)hr);
return TVI_CONTROL_FALSE;
}
}
@@ -1586,7 +1586,7 @@ static int set_crossbar_input(priv_t * priv, int input)
hr = OLE_CALL_ARGS(priv->pCrossbar, Route, nAudioDecoder,
lInputRelated);
if (hr != S_OK) {
- mp_msg(MSGT_TV,MSGL_ERR,MSGTR_TVI_DS_UnableConnectInputAudioDecoder, (unsigned int)hr);
+ mp_tmsg(MSGT_TV,MSGL_ERR,"Unable to connect given input to audio decoder. Error:0x%x\n", (unsigned int)hr);
return TVI_CONTROL_FALSE;
}
}
@@ -1990,11 +1990,11 @@ static IBaseFilter *find_capture_device(int index, REFCLSID category)
OLE_CALL(pClassEnum,Reset);
for (i = 0; OLE_CALL_ARGS(pClassEnum, Next, 1, &pM, &cFetched) == S_OK; i++) {
if(get_device_name(pM, tmp, DEVICE_NAME_MAX_LEN)!=TVI_CONTROL_TRUE)
- mp_msg(MSGT_TV, MSGL_ERR, MSGTR_TVI_DS_UnableGetDeviceName, i);
+ mp_tmsg(MSGT_TV, MSGL_ERR, "tvi_dshow: Unable to get name for device #%d\n", i);
else
- mp_msg(MSGT_TV, MSGL_V, MSGTR_TVI_DS_DeviceName, i, tmp);
+ mp_tmsg(MSGT_TV, MSGL_V, "tvi_dshow: Device #%d: %s\n", i, tmp);
if (index != -1 && i == index) {
- mp_msg(MSGT_TV, MSGL_INFO, MSGTR_TVI_DS_UsingDevice, index, tmp);
+ mp_tmsg(MSGT_TV, MSGL_INFO, "tvi_dshow: Using device #%d: %s\n", index, tmp);
hr = OLE_CALL_ARGS(pM, BindToObject, 0, 0, &IID_IBaseFilter,(void *) &pFilter);
if (FAILED(hr))
pFilter = NULL;
@@ -2002,7 +2002,7 @@ static IBaseFilter *find_capture_device(int index, REFCLSID category)
OLE_RELEASE_SAFE(pM);
}
if (index != -1 && !pFilter) {
- mp_msg(MSGT_TV, MSGL_ERR, MSGTR_TVI_DS_DeviceNotFound,
+ mp_tmsg(MSGT_TV, MSGL_ERR, "tvi_dshow: Device #%d not found\n",
index);
}
OLE_RELEASE_SAFE(pClassEnum);
@@ -2058,7 +2058,7 @@ static HRESULT get_available_formats_stream(chain_t *chain)
return E_FAIL;
}
} else {
- mp_msg(MSGT_TV, MSGL_ERR, MSGTR_TVI_DS_UnsupportedMediaType,"get_available_formats_stream");
+ mp_tmsg(MSGT_TV, MSGL_ERR, "tvi_dshow: Unsupported media type passed to %s\n","get_available_formats_stream");
return E_FAIL;
}
done = 0;
@@ -2153,7 +2153,7 @@ static HRESULT get_available_formats_pin(ICaptureGraphBuilder2 * pBuilder,
} else if (chain->type == audio) {
size = sizeof(AUDIO_STREAM_CONFIG_CAPS);
} else {
- mp_msg(MSGT_TV, MSGL_ERR, MSGTR_TVI_DS_UnsupportedMediaType,"get_available_formats_pin");
+ mp_tmsg(MSGT_TV, MSGL_ERR, "tvi_dshow: Unsupported media type passed to %s\n","get_available_formats_pin");
return E_FAIL;
}
@@ -2513,7 +2513,7 @@ static HRESULT build_video_chain(priv_t *priv)
if (priv->chains[0]->pStreamConfig) {
hr = OLE_CALL_ARGS(priv->chains[0]->pStreamConfig, SetFormat, priv->chains[0]->pmt);
if (FAILED(hr)) {
- mp_msg(MSGT_TV,MSGL_ERR,MSGTR_TVI_DS_UnableSelectVideoFormat, (unsigned int)hr);
+ mp_tmsg(MSGT_TV,MSGL_ERR,"tvi_dshow: Unable to select video format. Error:0x%x\n", (unsigned int)hr);
}
}
@@ -2530,7 +2530,7 @@ static HRESULT build_video_chain(priv_t *priv)
priv->chains[0]->rbuf->buffersize *= 1024 * 1024;
hr=build_sub_graph(priv, priv->chains[0], &PIN_CATEGORY_CAPTURE);
if(FAILED(hr)){
- mp_msg(MSGT_TV, MSGL_ERR, MSGTR_TVI_DS_UnableBuildVideoSubGraph,(unsigned int)hr);
+ mp_tmsg(MSGT_TV, MSGL_ERR, "tvi_dshow: Unable to build video chain of capture graph. Error:0x%x\n",(unsigned int)hr);
return hr;
}
return S_OK;
@@ -2556,7 +2556,7 @@ static HRESULT build_audio_chain(priv_t *priv)
hr = OLE_CALL_ARGS(priv->chains[1]->pStreamConfig, SetFormat,
priv->chains[1]->pmt);
if (FAILED(hr)) {
- mp_msg(MSGT_TV,MSGL_ERR,MSGTR_TVI_DS_UnableSelectAudioFormat, (unsigned int)hr);
+ mp_tmsg(MSGT_TV,MSGL_ERR,"tvi_dshow: Unable to select audio format. Error:0x%x\n", (unsigned int)hr);
}
}
@@ -2573,7 +2573,7 @@ static HRESULT build_audio_chain(priv_t *priv)
hr=build_sub_graph(priv, priv->chains[1],&PIN_CATEGORY_CAPTURE);
if(FAILED(hr)){
- mp_msg(MSGT_TV, MSGL_ERR, MSGTR_TVI_DS_UnableBuildAudioSubGraph,(unsigned int)hr);
+ mp_tmsg(MSGT_TV, MSGL_ERR, "tvi_dshow: Unable to build audio chain of capture graph. Error:0x%x\n",(unsigned int)hr);
return 0;
}
}
@@ -2603,7 +2603,7 @@ static HRESULT build_vbi_chain(priv_t *priv)
hr=build_sub_graph(priv, priv->chains[2],&PIN_CATEGORY_VBI);
if(FAILED(hr)){
- mp_msg(MSGT_TV, MSGL_ERR, MSGTR_TVI_DS_UnableBuildVBISubGraph,(unsigned int)hr);
+ mp_tmsg(MSGT_TV, MSGL_ERR, "tvi_dshow: Unable to build VBI chain of capture graph. Error:0x%x\n",(unsigned int)hr);
return 0;
}
}
@@ -2644,12 +2644,12 @@ static int start(priv_t * priv)
mp_msg(MSGT_TV, MSGL_DBG2, "Debug pause end\n");
}
if (!priv->pMediaControl) {
- mp_msg(MSGT_TV,MSGL_ERR,MSGTR_TVI_DS_UnableGetMediaControlInterface,(unsigned int)E_POINTER);
+ mp_tmsg(MSGT_TV,MSGL_ERR,"tvi_dshow: Unable to get IMediaControl interface. Error:0x%x\n",(unsigned int)E_POINTER);
return 0;
}
hr = OLE_CALL(priv->pMediaControl, Run);
if (FAILED(hr)) {
- mp_msg(MSGT_TV,MSGL_ERR,MSGTR_TVI_DS_UnableStartGraph, (unsigned int)hr);
+ mp_tmsg(MSGT_TV,MSGL_ERR,"tvi_dshow: Unable to start graph! Error:0x%x\n", (unsigned int)hr);
return 0;
}
mp_msg(MSGT_TV, MSGL_DBG2, "tvi_dshow: Graph is started.\n");
@@ -2722,7 +2722,7 @@ static int init(priv_t * priv)
mp_msg(MSGT_TV, MSGL_DBG2, "tvi_dshow: Searching for available video capture devices\n");
priv->chains[0]->pCaptureFilter = find_capture_device(priv->dev_index, &CLSID_VideoInputDeviceCategory);
if(!priv->chains[0]->pCaptureFilter){
- mp_msg(MSGT_TV,MSGL_ERR, MSGTR_TVI_DS_NoVideoCaptureDevice);
+ mp_tmsg(MSGT_TV,MSGL_ERR, "tvi_dshow: Unable to find video capture device\n");
break;
}
hr = OLE_CALL_ARGS(priv->pGraph, AddFilter, priv->chains[0]->pCaptureFilter, NULL);
@@ -2734,7 +2734,7 @@ static int init(priv_t * priv)
if (priv->adev_index != -1) {
priv->chains[1]->pCaptureFilter = find_capture_device(priv->adev_index, &CLSID_AudioInputDeviceCategory); //output available audio edevices
if(!priv->chains[1]->pCaptureFilter){
- mp_msg(MSGT_TV,MSGL_ERR, MSGTR_TVI_DS_NoAudioCaptureDevice);
+ mp_tmsg(MSGT_TV,MSGL_ERR, "tvi_dshow: Unable to find audio capture device\n");
break;
}
@@ -2754,7 +2754,7 @@ static int init(priv_t * priv)
mp_msg(MSGT_TV, MSGL_DBG2, "tvi_dshow: Get IID_IAMVideoProcAmp failed (0x%x).\n", (unsigned int)hr);
if (hr != S_OK) {
- mp_msg(MSGT_TV, MSGL_INFO, MSGTR_TVI_DS_VideoAdjustigNotSupported);
+ mp_tmsg(MSGT_TV, MSGL_INFO, "tvi_dshow: Adjusting of brightness/hue/saturation/contrast is not supported by device\n");
priv->pVideoProcAmp = NULL;
}
@@ -2764,7 +2764,7 @@ static int init(priv_t * priv)
priv->chains[0]->pCaptureFilter,
&IID_IAMCrossbar, (void **) &(priv->pCrossbar));
if (FAILED(hr)) {
- mp_msg(MSGT_TV, MSGL_INFO, MSGTR_TVI_DS_SelectingInputNotSupported);
+ mp_tmsg(MSGT_TV, MSGL_INFO, "tvi_dshow: Selection of capture source is not supported by device\n");
priv->pCrossbar = NULL;
}
@@ -2790,7 +2790,7 @@ static int init(priv_t * priv)
}
OLE_RELEASE_SAFE(pTVAudio);
if (FAILED(hr))
- mp_msg(MSGT_TV, MSGL_WARN, MSGTR_TVI_DS_UnableSetAudioMode, priv->tv_param->amode,(unsigned int)hr);
+ mp_tmsg(MSGT_TV, MSGL_WARN, "tvi_dshow: Unable to set audio mode %d. Error:0x%x\n", priv->tv_param->amode,(unsigned int)hr);
}
}
@@ -2828,19 +2828,19 @@ static int init(priv_t * priv)
}
if (!priv->chains[0]->pStreamConfig)
- mp_msg(MSGT_TV, MSGL_INFO, MSGTR_TVI_DS_ChangingWidthHeightNotSupported);
+ mp_tmsg(MSGT_TV, MSGL_INFO, "tvi_dshow: Changing video width/height is not supported by device.\n");
if (!priv->chains[0]->arpmt[priv->chains[0]->nFormatUsed]
|| !extract_video_format(priv->chains[0]->arpmt[priv->chains[0]->nFormatUsed],
&(priv->fcc), &(priv->width),
&(priv->height))) {
- mp_msg(MSGT_TV, MSGL_ERR, MSGTR_TVI_DS_ErrorParsingVideoFormatStruct);
+ mp_tmsg(MSGT_TV, MSGL_ERR, "tvi_dshow: Unable to parse video format structure.\n");
break;
}
if (priv->chains[1]->arpmt[priv->chains[1]->nFormatUsed]) {
if (!extract_audio_format(priv->chains[1]->pmt, &(priv->samplerate), NULL, NULL)) {
- mp_msg(MSGT_TV, MSGL_ERR, MSGTR_TVI_DS_ErrorParsingAudioFormatStruct);
+ mp_tmsg(MSGT_TV, MSGL_ERR, "tvi_dshow: Unable to parse audio format structure.\n");
DisplayMediaType("audio format failed",priv->chains[1]->arpmt[priv->chains[1]->nFormatUsed]);
break;
}
@@ -2848,7 +2848,7 @@ static int init(priv_t * priv)
hr = OLE_QUERYINTERFACE(priv->pGraph, IID_IMediaControl,priv->pMediaControl);
if(FAILED(hr)){
- mp_msg(MSGT_TV,MSGL_ERR, MSGTR_TVI_DS_UnableGetMediaControlInterface,(unsigned int)hr);
+ mp_tmsg(MSGT_TV,MSGL_ERR, "tvi_dshow: Unable to get IMediaControl interface. Error:0x%x\n",(unsigned int)hr);
break;
}
hr = OLE_CALL_ARGS(priv->pBuilder, FindInterface,
@@ -2908,7 +2908,7 @@ static int init(priv_t * priv)
OLE_RELEASE_SAFE(pVPOutPin);
if (FAILED(hr)) {
- mp_msg(MSGT_TV,MSGL_ERR, MSGTR_TVI_DS_UnableTerminateVPPin, (unsigned int)hr);
+ mp_tmsg(MSGT_TV,MSGL_ERR, "tvi_dshow: Unable to terminate VideoPort pin with any filter in graph. Error:0x%x\n", (unsigned int)hr);
break;
}
}
@@ -2948,7 +2948,7 @@ static int init(priv_t * priv)
} while(0);
if (!result){
- mp_msg(MSGT_TV,MSGL_ERR, MSGTR_TVI_DS_GraphInitFailure);
+ mp_tmsg(MSGT_TV,MSGL_ERR, "tvi_dshow: Directshow graph initialization failure.\n");
uninit(priv);
}
return result;
@@ -3078,12 +3078,12 @@ static tvi_handle_t *tvi_init_dshow(tv_param_t* tv_param)
if (sscanf(tv_param->device, "%d", &a) == 1) {
priv->dev_index = a;
} else {
- mp_msg(MSGT_TV, MSGL_ERR, MSGTR_TVI_DS_WrongDeviceParam, tv_param->device);
+ mp_tmsg(MSGT_TV, MSGL_ERR, "tvi_dshow: Wrong device parameter: %s\n", tv_param->device);
free_handle(h);
return NULL;
}
if (priv->dev_index < 0) {
- mp_msg(MSGT_TV, MSGL_ERR, MSGTR_TVI_DS_WrongDeviceIndex, a);
+ mp_tmsg(MSGT_TV, MSGL_ERR, "tvi_dshow: Wrong device index: %d\n", a);
free_handle(h);
return NULL;
}
@@ -3092,12 +3092,12 @@ static tvi_handle_t *tvi_init_dshow(tv_param_t* tv_param)
if (sscanf(tv_param->adevice, "%d", &a) == 1) {
priv->adev_index = a;
} else {
- mp_msg(MSGT_TV, MSGL_ERR, MSGTR_TVI_DS_WrongADeviceParam, tv_param->adevice);
+ mp_tmsg(MSGT_TV, MSGL_ERR, "tvi_dshow: Wrong adevice parameter: %s\n", tv_param->adevice);
free_handle(h);
return NULL;
}
if (priv->dev_index < 0) {
- mp_msg(MSGT_TV, MSGL_ERR, MSGTR_TVI_DS_WrongADeviceIndex, a);
+ mp_tmsg(MSGT_TV, MSGL_ERR, "tvi_dshow: Wrong adevice index: %d\n", a);
free_handle(h);
return NULL;
}
@@ -3357,7 +3357,7 @@ static int control(priv_t * priv, int cmd, void *arg)
break;
if (!priv->chains[1]->arpmt[i]) {
//request not found. failing back to first available
- mp_msg(MSGT_TV, MSGL_WARN, MSGTR_TVI_DS_SamplerateNotsupported, samplerate);
+ mp_tmsg(MSGT_TV, MSGL_WARN, "tvi_dshow: Samplerate %d is not supported by device. Failing back to first available.\n", samplerate);
i = 0;
}
if (priv->chains[1]->pmt)
diff --git a/stream/tvi_v4l.c b/stream/tvi_v4l.c
index 52a1ea76d8..be02c1176c 100644
--- a/stream/tvi_v4l.c
+++ b/stream/tvi_v4l.c
@@ -1673,7 +1673,7 @@ static void *video_grabber(void *data)
mp_msg(MSGT_TV, MSGL_V, "\nvideo capture thread: frame delta = 0\n");
} else if ((interval - prev_interval < (long long)0.85e6/priv->fps)
|| (interval - prev_interval > (long long)1.15e6/priv->fps) ) {
- mp_msg(MSGT_TV, MSGL_V, "\nvideo capture thread: frame delta ~ %.1lf fps\n",
+ mp_msg(MSGT_TV, MSGL_V, "\nvideo capture thread: frame delta ~ %.1f fps\n",
(double)1e6/(interval - prev_interval));
}
}
@@ -1718,7 +1718,7 @@ static void *video_grabber(void *data)
}
}
- mp_msg(MSGT_TV, MSGL_DBG3, "\nfps = %lf, interval = %lf, a_skew = %f, corr_skew = %f\n",
+ mp_msg(MSGT_TV, MSGL_DBG3, "\nfps = %f, interval = %f, a_skew = %f, corr_skew = %f\n",
(interval != prev_interval) ? (double)1e6/(interval - prev_interval) : -1,
(double)1e-6*interval, (double)1e-6*xskew, (double)1e-6*skew);
mp_msg(MSGT_TV, MSGL_DBG3, "vcnt = %d, acnt = %d\n", priv->video_cnt, priv->audio_cnt);
diff --git a/stream/url.c b/stream/url.c
index 62e3bdcf2a..04ec6947b8 100644
--- a/stream/url.c
+++ b/stream/url.c
@@ -69,19 +69,19 @@ url_new(const char* url) {
if( url==NULL ) return NULL;
if (strlen(url) > (SIZE_MAX / 3 - 1)) {
- mp_msg(MSGT_NETWORK,MSGL_FATAL,MSGTR_MemAllocFailed);
+ mp_tmsg(MSGT_NETWORK,MSGL_FATAL,"Memory allocation failed.\n");
goto err_out;
}
escfilename=malloc(strlen(url)*3+1);
if (!escfilename ) {
- mp_msg(MSGT_NETWORK,MSGL_FATAL,MSGTR_MemAllocFailed);
+ mp_tmsg(MSGT_NETWORK,MSGL_FATAL,"Memory allocation failed.\n");
goto err_out;
}
// Create the URL container
Curl = malloc(sizeof(URL_t));
if( Curl==NULL ) {
- mp_msg(MSGT_NETWORK,MSGL_FATAL,MSGTR_MemAllocFailed);
+ mp_tmsg(MSGT_NETWORK,MSGL_FATAL,"Memory allocation failed.\n");
goto err_out;
}
@@ -93,7 +93,7 @@ url_new(const char* url) {
// Copy the url in the URL container
Curl->url = strdup(escfilename);
if( Curl->url==NULL ) {
- mp_msg(MSGT_NETWORK,MSGL_FATAL,MSGTR_MemAllocFailed);
+ mp_tmsg(MSGT_NETWORK,MSGL_FATAL,"Memory allocation failed.\n");
goto err_out;
}
mp_msg(MSGT_OPEN,MSGL_V,"Filename for url is now %s\n",escfilename);
@@ -113,7 +113,7 @@ url_new(const char* url) {
pos1 = ptr1-escfilename;
Curl->protocol = malloc(pos1+1);
if( Curl->protocol==NULL ) {
- mp_msg(MSGT_NETWORK,MSGL_FATAL,MSGTR_MemAllocFailed);
+ mp_tmsg(MSGT_NETWORK,MSGL_FATAL,"Memory allocation failed.\n");
goto err_out;
}
strncpy(Curl->protocol, escfilename, pos1);
@@ -135,7 +135,7 @@ url_new(const char* url) {
int len = ptr2-ptr1;
Curl->username = malloc(len+1);
if( Curl->username==NULL ) {
- mp_msg(MSGT_NETWORK,MSGL_FATAL,MSGTR_MemAllocFailed);
+ mp_tmsg(MSGT_NETWORK,MSGL_FATAL,"Memory allocation failed.\n");
goto err_out;
}
strncpy(Curl->username, ptr1, len);
@@ -148,7 +148,7 @@ url_new(const char* url) {
Curl->username[ptr3-ptr1]='\0';
Curl->password = malloc(len2+1);
if( Curl->password==NULL ) {
- mp_msg(MSGT_NETWORK,MSGL_FATAL,MSGTR_MemAllocFailed);
+ mp_tmsg(MSGT_NETWORK,MSGL_FATAL,"Memory allocation failed.\n");
goto err_out;
}
strncpy( Curl->password, ptr3+1, len2);
@@ -200,7 +200,7 @@ url_new(const char* url) {
// copy the hostname in the URL container
Curl->hostname = malloc(pos2-pos1+1);
if( Curl->hostname==NULL ) {
- mp_msg(MSGT_NETWORK,MSGL_FATAL,MSGTR_MemAllocFailed);
+ mp_tmsg(MSGT_NETWORK,MSGL_FATAL,"Memory allocation failed.\n");
goto err_out;
}
strncpy(Curl->hostname, ptr1, pos2-pos1);
@@ -215,7 +215,7 @@ url_new(const char* url) {
// copy the path/filename in the URL container
Curl->file = strdup(ptr2);
if( Curl->file==NULL ) {
- mp_msg(MSGT_NETWORK,MSGL_FATAL,MSGTR_MemAllocFailed);
+ mp_tmsg(MSGT_NETWORK,MSGL_FATAL,"Memory allocation failed.\n");
goto err_out;
}
}
@@ -224,7 +224,7 @@ url_new(const char* url) {
if( Curl->file==NULL ) {
Curl->file = malloc(2);
if( Curl->file==NULL ) {
- mp_msg(MSGT_NETWORK,MSGL_FATAL,MSGTR_MemAllocFailed);
+ mp_tmsg(MSGT_NETWORK,MSGL_FATAL,"Memory allocation failed.\n");
goto err_out;
}
strcpy(Curl->file, "/");
@@ -302,7 +302,7 @@ url_escape_string_part(char *outbuf, const char *inbuf) {
*outbuf++=c; // already
// dont escape again
- mp_msg(MSGT_NETWORK,MSGL_ERR,MSGTR_MPDEMUX_URL_StringAlreadyEscaped,c,c1,c2);
+ mp_tmsg(MSGT_NETWORK,MSGL_ERR,"String appears to be already escaped in url_escape %c%c1%c2\n",c,c1,c2);
// error as this should not happen against RFC 2396
// to escape a string twice
} else {
diff --git a/stream/vcd_read.h b/stream/vcd_read.h
index 2f60d518ad..ae34d1cf21 100644
--- a/stream/vcd_read.h
+++ b/stream/vcd_read.h
@@ -25,7 +25,7 @@
#include <sys/ioctl.h>
#include "mp_msg.h"
#include "stream.h"
-#include "libavutil/intreadwrite.h"
+#include "ffmpeg_files/intreadwrite.h"
//=================== VideoCD ==========================
#if defined(__linux__) || defined(sun) || defined(__bsdi__)
diff --git a/stream/vcd_read_fbsd.h b/stream/vcd_read_fbsd.h
index e60590e1f5..e29eedc13f 100644
--- a/stream/vcd_read_fbsd.h
+++ b/stream/vcd_read_fbsd.h
@@ -24,7 +24,7 @@
#include <sys/types.h>
#include <inttypes.h>
#include <unistd.h>
-#include "libavutil/intreadwrite.h"
+#include "ffmpeg_files/intreadwrite.h"
#include <sys/cdio.h>
#include <sys/ioctl.h>
#if defined(__NetBSD__) || defined(__OpenBSD__)
diff --git a/sub_cc.c b/sub_cc.c
index 3bf4d5035c..d9df7358a3 100644
--- a/sub_cc.c
+++ b/sub_cc.c
@@ -345,4 +345,3 @@ void subcc_process_data(unsigned char *inputdata,unsigned int len)
subcc_decode(inputdata, len);
}
-
diff --git a/sub_cc.h b/sub_cc.h
index 7062849f91..13ef1991b7 100644
--- a/sub_cc.h
+++ b/sub_cc.h
@@ -25,4 +25,3 @@ void subcc_init(void);
void subcc_process_data(unsigned char *inputdata,unsigned int len);
#endif /* MPLAYER_SUB_CC_H */
-
diff --git a/subdir.mak b/subdir.mak
deleted file mode 100644
index d89573904e..0000000000
--- a/subdir.mak
+++ /dev/null
@@ -1,102 +0,0 @@
-SRC_DIR := $(SRC_PATH_BARE)/lib$(NAME)
-
-include $(SUBDIR)../common.mak
-
-LIBVERSION := $(lib$(NAME)_VERSION)
-LIBMAJOR := $(lib$(NAME)_VERSION_MAJOR)
-
-ifeq ($(CONFIG_STATIC),yes)
-all: $(SUBDIR)$(LIBNAME)
-
-install-libs: install-lib$(NAME)-static
-
-$(SUBDIR)$(LIBNAME): $(OBJS)
- rm -f $@
- $(AR) rc $@ $^ $(EXTRAOBJS)
- $(RANLIB) $@
-endif
-
-INCINSTDIR := $(INCDIR)/lib$(NAME)
-
-THIS_LIB := $(SUBDIR)$($(CONFIG_SHARED:yes=S)LIBNAME)
-
-define RULES
-$(SUBDIR)%$(EXESUF): $(SUBDIR)%.o
- $(LD) $(FFLDFLAGS) -o $$@ $$^ -l$(FULLNAME) $(FFEXTRALIBS) $$(ELIBS)
-
-$(SUBDIR)%-test.o: $(SUBDIR)%.c
- $(CC) $(CPPFLAGS) $(CFLAGS) -DTEST -c -o $$@ $$^
-
-$(SUBDIR)%-test.o: $(SUBDIR)%-test.c
- $(CC) $(CPPFLAGS) $(CFLAGS) -DTEST -c -o $$@ $$^
-
-$(SUBDIR)x86/%.o: $(SUBDIR)x86/%.asm
- $(YASM) $(YASMFLAGS) -I $$(<D)/ -M -o $$@ $$< > $$(@:.o=.d)
- $(YASM) $(YASMFLAGS) -I $$(<D)/ -o $$@ $$<
-
-clean::
- rm -f $(addprefix $(SUBDIR),*-example$(EXESUF) *-test$(EXESUF) $(CLEANFILES) $(CLEANSUFFIXES) $(LIBSUFFIXES)) \
- $(addprefix $(SUBDIR), $(foreach suffix,$(CLEANSUFFIXES),$(addsuffix /$(suffix),$(DIRS))))
-
-distclean:: clean
- rm -f $(addprefix $(SUBDIR),$(DISTCLEANSUFFIXES)) \
- $(addprefix $(SUBDIR), $(foreach suffix,$(DISTCLEANSUFFIXES),$(addsuffix /$(suffix),$(DIRS))))
-
-ifdef CONFIG_SHARED
-all: $(SUBDIR)$(SLIBNAME)
-
-install-libs: install-lib$(NAME)-shared
-
-$(SUBDIR)$(SLIBNAME): $(SUBDIR)$(SLIBNAME_WITH_MAJOR)
- cd ./$(SUBDIR) && $(LN_S) $(SLIBNAME_WITH_MAJOR) $(SLIBNAME)
-
-$(SUBDIR)$(SLIBNAME_WITH_MAJOR): $(OBJS)
- $(SLIB_CREATE_DEF_CMD)
- $(LD) $(SHFLAGS) $(FFLDFLAGS) -o $$@ $$(filter %.o,$$^) $(FFEXTRALIBS) $(EXTRAOBJS)
- $(SLIB_EXTRA_CMD)
-
-ifdef SUBDIR
-$(SUBDIR)$(SLIBNAME_WITH_MAJOR): $(DEP_LIBS)
-endif
-endif
-
-install-lib$(NAME)-shared: $(SUBDIR)$(SLIBNAME)
- install -d "$(SHLIBDIR)"
- install -m 755 $$< "$(SHLIBDIR)/$(SLIBNAME_WITH_VERSION)"
- $(STRIP) "$(SHLIBDIR)/$(SLIBNAME_WITH_VERSION)"
- cd "$(SHLIBDIR)" && \
- $(LN_S) $(SLIBNAME_WITH_VERSION) $(SLIBNAME_WITH_MAJOR)
- cd "$(SHLIBDIR)" && \
- $(LN_S) $(SLIBNAME_WITH_VERSION) $(SLIBNAME)
- $(SLIB_INSTALL_EXTRA_CMD)
-
-install-lib$(NAME)-static: $(SUBDIR)$(LIBNAME)
- install -d "$(LIBDIR)"
- install -m 644 $$< "$(LIBDIR)"
- $(LIB_INSTALL_EXTRA_CMD)
-
-install-headers::
- install -d "$(INCINSTDIR)"
- install -d "$(LIBDIR)/pkgconfig"
- install -m 644 $(addprefix "$(SRC_DIR)"/,$(HEADERS)) "$(INCINSTDIR)"
- install -m 644 $(BUILD_ROOT)/lib$(NAME)/lib$(NAME).pc "$(LIBDIR)/pkgconfig"
-
-uninstall-libs::
- -rm -f "$(SHLIBDIR)/$(SLIBNAME_WITH_MAJOR)" \
- "$(SHLIBDIR)/$(SLIBNAME)" \
- "$(SHLIBDIR)/$(SLIBNAME_WITH_VERSION)"
- -$(SLIB_UNINSTALL_EXTRA_CMD)
- -rm -f "$(LIBDIR)/$(LIBNAME)"
-
-uninstall-headers::
- rm -f $(addprefix "$(INCINSTDIR)/",$(HEADERS))
- rm -f "$(LIBDIR)/pkgconfig/lib$(NAME).pc"
- -rmdir "$(INCDIR)"
-endef
-
-$(eval $(RULES))
-
-$(EXAMPLES) $(TESTPROGS): $(THIS_LIB) $(DEP_LIBS)
-
-examples: $(EXAMPLES)
-testprogs: $(TESTPROGS)
diff --git a/subopt-helper.c b/subopt-helper.c
index 810fcd1a73..31cedeef6c 100644
--- a/subopt-helper.c
+++ b/subopt-helper.c
@@ -347,4 +347,3 @@ int strargcasecmp(strarg_t *arg, char *str) {
res = arg->len - strlen(str);
return res;
}
-
diff --git a/subreader.c b/subreader.c
index c471e75e53..7d5cf6e751 100644
--- a/subreader.c
+++ b/subreader.c
@@ -1543,6 +1543,11 @@ if ((suboverlap_enabled == 2) ||
}
}
+ /* Avoid n^2 memory use for the "placeholder" data structure
+ * below with subtitles that have a huge number of
+ * consecutive overlapping lines. */
+ lines_to_add = FFMIN(lines_to_add, SUB_MAX_TEXT);
+
// we need a structure to keep trace of the screen lines
// used by the subs, a 'placeholder'
counter = 2 * sub_to_add + 1; // the maximum number of subs derived
diff --git a/subreader.h b/subreader.h
index 3893124f5a..f1706dc120 100644
--- a/subreader.h
+++ b/subreader.h
@@ -88,12 +88,12 @@ sub_data* sub_read_file (char *filename, float pts);
subtitle* subcp_recode (subtitle *sub);
// enca_fd is the file enca uses to determine the codepage.
// setting to NULL disables enca.
-struct stream_st;
-void subcp_open (struct stream_st *st); /* for demux_ogg.c */
+struct stream;
+void subcp_open (struct stream *st); /* for demux_ogg.c */
void subcp_close (void); /* for demux_ogg.c */
#ifdef CONFIG_ENCA
const char* guess_buffer_cp(unsigned char* buffer, int buflen, const char *preferred_language, const char *fallback);
-const char* guess_cp(struct stream_st *st, const char *preferred_language, const char *fallback);
+const char* guess_cp(struct stream *st, const char *preferred_language, const char *fallback);
#endif
char ** sub_filenames(const char *path, char *fname);
void list_sub_file(sub_data* subd);
@@ -103,7 +103,8 @@ void dump_microdvd(sub_data* subd, float fps);
void dump_jacosub(sub_data* subd, float fps);
void dump_sami(sub_data* subd, float fps);
void sub_free( sub_data * subd );
-void find_sub(sub_data* subd,int key);
+struct MPContext;
+void find_sub(struct MPContext *mpctx, sub_data* subd,int key);
void step_sub(sub_data *subd, float pts, int movement);
void sub_add_text(subtitle *sub, const char *txt, int len, double endpts);
int sub_clear_text(subtitle *sub, double pts);
diff --git a/talloc.c b/talloc.c
new file mode 100644
index 0000000000..63550cf4d4
--- /dev/null
+++ b/talloc.c
@@ -0,0 +1,1758 @@
+/*
+ Samba Unix SMB/CIFS implementation.
+
+ Samba trivial allocation library - new interface
+
+ NOTE: Please read talloc_guide.txt for full documentation
+
+ Copyright (C) Andrew Tridgell 2004
+ Copyright (C) Stefan Metzmacher 2006
+
+ ** NOTE! The following LGPL license applies to the talloc
+ ** library. This does NOT imply that all of Samba is released
+ ** under the LGPL
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 3 of the License, or (at your option) any later version.
+
+ This library 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, see <http://www.gnu.org/licenses/>.
+*/
+
+/*
+ inspired by http://swapped.cc/halloc/
+*/
+
+// Hardcode these for MPlayer assuming a working system.
+// Original used autoconf detection with workarounds for broken systems.
+#define HAVE_VA_COPY
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdarg.h>
+#include <stdint.h>
+#include <string.h>
+#include <stdbool.h>
+#define MIN(a,b) ((a)<(b)?(a):(b))
+#define strnlen rep_strnlen
+static size_t rep_strnlen(const char *s, size_t max)
+{
+ size_t len;
+
+ for (len = 0; len < max; len++) {
+ if (s[len] == '\0') {
+ break;
+ }
+ }
+ return len;
+}
+
+
+
+#ifdef _SAMBA_BUILD_
+#include "version.h"
+#if (SAMBA_VERSION_MAJOR<4)
+#include "includes.h"
+/* This is to circumvent SAMBA3's paranoid malloc checker. Here in this file
+ * we trust ourselves... */
+#ifdef malloc
+#undef malloc
+#endif
+#ifdef realloc
+#undef realloc
+#endif
+#define _TALLOC_SAMBA3
+#endif /* (SAMBA_VERSION_MAJOR<4) */
+#endif /* _SAMBA_BUILD_ */
+
+#ifndef _TALLOC_SAMBA3
+// Workarounds for missing standard features, not used in MPlayer
+// #include "replace.h"
+#include "talloc.h"
+#endif /* not _TALLOC_SAMBA3 */
+
+/* use this to force every realloc to change the pointer, to stress test
+ code that might not cope */
+#define ALWAYS_REALLOC 0
+
+
+#define MAX_TALLOC_SIZE 0x10000000
+#define TALLOC_MAGIC 0xe814ec70
+#define TALLOC_FLAG_FREE 0x01
+#define TALLOC_FLAG_LOOP 0x02
+#define TALLOC_FLAG_POOL 0x04 /* This is a talloc pool */
+#define TALLOC_FLAG_POOLMEM 0x08 /* This is allocated in a pool */
+#define TALLOC_MAGIC_REFERENCE ((const char *)1)
+
+/* by default we abort when given a bad pointer (such as when talloc_free() is called
+ on a pointer that came from malloc() */
+#ifndef TALLOC_ABORT
+#define TALLOC_ABORT(reason) abort()
+#endif
+
+#ifndef discard_const_p
+#if defined(__intptr_t_defined) || defined(HAVE_INTPTR_T)
+# define discard_const_p(type, ptr) ((type *)((intptr_t)(ptr)))
+#else
+# define discard_const_p(type, ptr) ((type *)(ptr))
+#endif
+#endif
+
+/* these macros gain us a few percent of speed on gcc */
+#if (__GNUC__ >= 3)
+/* the strange !! is to ensure that __builtin_expect() takes either 0 or 1
+ as its first argument */
+#ifndef likely
+#define likely(x) __builtin_expect(!!(x), 1)
+#endif
+#ifndef unlikely
+#define unlikely(x) __builtin_expect(!!(x), 0)
+#endif
+#else
+#ifndef likely
+#define likely(x) (x)
+#endif
+#ifndef unlikely
+#define unlikely(x) (x)
+#endif
+#endif
+
+/* this null_context is only used if talloc_enable_leak_report() or
+ talloc_enable_leak_report_full() is called, otherwise it remains
+ NULL
+*/
+static void *null_context;
+static void *autofree_context;
+
+struct talloc_reference_handle {
+ struct talloc_reference_handle *next, *prev;
+ void *ptr;
+};
+
+typedef int (*talloc_destructor_t)(void *);
+
+struct talloc_chunk {
+ struct talloc_chunk *next, *prev;
+ struct talloc_chunk *parent, *child;
+ struct talloc_reference_handle *refs;
+ talloc_destructor_t destructor;
+ const char *name;
+ size_t size;
+ unsigned flags;
+
+ /*
+ * "pool" has dual use:
+ *
+ * For the talloc pool itself (i.e. TALLOC_FLAG_POOL is set), "pool"
+ * marks the end of the currently allocated area.
+ *
+ * For members of the pool (i.e. TALLOC_FLAG_POOLMEM is set), "pool"
+ * is a pointer to the struct talloc_chunk of the pool that it was
+ * allocated from. This way children can quickly find the pool to chew
+ * from.
+ */
+ void *pool;
+};
+
+/* 16 byte alignment seems to keep everyone happy */
+#define TC_HDR_SIZE ((sizeof(struct talloc_chunk)+15)&~15)
+#define TC_PTR_FROM_CHUNK(tc) ((void *)(TC_HDR_SIZE + (char*)tc))
+
+static void talloc_abort_double_free(void)
+{
+ TALLOC_ABORT("Bad talloc magic value - double free");
+}
+
+static void talloc_abort_unknown_value(void)
+{
+ TALLOC_ABORT("Bad talloc magic value - unknown value");
+}
+
+/* panic if we get a bad magic value */
+static inline struct talloc_chunk *talloc_chunk_from_ptr(const void *ptr)
+{
+ const char *pp = (const char *)ptr;
+ struct talloc_chunk *tc = discard_const_p(struct talloc_chunk, pp - TC_HDR_SIZE);
+ if (unlikely((tc->flags & (TALLOC_FLAG_FREE | ~0xF)) != TALLOC_MAGIC)) {
+ if (tc->flags & TALLOC_FLAG_FREE) {
+ talloc_abort_double_free();
+ } else {
+ talloc_abort_unknown_value();
+ }
+ }
+ return tc;
+}
+
+/* hook into the front of the list */
+#define _TLIST_ADD(list, p) \
+do { \
+ if (!(list)) { \
+ (list) = (p); \
+ (p)->next = (p)->prev = NULL; \
+ } else { \
+ (list)->prev = (p); \
+ (p)->next = (list); \
+ (p)->prev = NULL; \
+ (list) = (p); \
+ }\
+} while (0)
+
+/* remove an element from a list - element doesn't have to be in list. */
+#define _TLIST_REMOVE(list, p) \
+do { \
+ if ((p) == (list)) { \
+ (list) = (p)->next; \
+ if (list) (list)->prev = NULL; \
+ } else { \
+ if ((p)->prev) (p)->prev->next = (p)->next; \
+ if ((p)->next) (p)->next->prev = (p)->prev; \
+ } \
+ if ((p) && ((p) != (list))) (p)->next = (p)->prev = NULL; \
+} while (0)
+
+
+/*
+ return the parent chunk of a pointer
+*/
+static inline struct talloc_chunk *talloc_parent_chunk(const void *ptr)
+{
+ struct talloc_chunk *tc;
+
+ if (unlikely(ptr == NULL)) {
+ return NULL;
+ }
+
+ tc = talloc_chunk_from_ptr(ptr);
+ while (tc->prev) tc=tc->prev;
+
+ return tc->parent;
+}
+
+void *talloc_parent(const void *ptr)
+{
+ struct talloc_chunk *tc = talloc_parent_chunk(ptr);
+ return tc? TC_PTR_FROM_CHUNK(tc) : NULL;
+}
+
+/*
+ find parents name
+*/
+const char *talloc_parent_name(const void *ptr)
+{
+ struct talloc_chunk *tc = talloc_parent_chunk(ptr);
+ return tc? tc->name : NULL;
+}
+
+/*
+ A pool carries an in-pool object count count in the first 16 bytes.
+ bytes. This is done to support talloc_steal() to a parent outside of the
+ pool. The count includes the pool itself, so a talloc_free() on a pool will
+ only destroy the pool if the count has dropped to zero. A talloc_free() of a
+ pool member will reduce the count, and eventually also call free(3) on the
+ pool memory.
+
+ The object count is not put into "struct talloc_chunk" because it is only
+ relevant for talloc pools and the alignment to 16 bytes would increase the
+ memory footprint of each talloc chunk by those 16 bytes.
+*/
+
+#define TALLOC_POOL_HDR_SIZE 16
+
+static unsigned int *talloc_pool_objectcount(struct talloc_chunk *tc)
+{
+ return (unsigned int *)((char *)tc + sizeof(struct talloc_chunk));
+}
+
+/*
+ Allocate from a pool
+*/
+
+static struct talloc_chunk *talloc_alloc_pool(struct talloc_chunk *parent,
+ size_t size)
+{
+ struct talloc_chunk *pool_ctx = NULL;
+ size_t space_left;
+ struct talloc_chunk *result;
+ size_t chunk_size;
+
+ if (parent == NULL) {
+ return NULL;
+ }
+
+ if (parent->flags & TALLOC_FLAG_POOL) {
+ pool_ctx = parent;
+ }
+ else if (parent->flags & TALLOC_FLAG_POOLMEM) {
+ pool_ctx = (struct talloc_chunk *)parent->pool;
+ }
+
+ if (pool_ctx == NULL) {
+ return NULL;
+ }
+
+ space_left = ((char *)pool_ctx + TC_HDR_SIZE + pool_ctx->size)
+ - ((char *)pool_ctx->pool);
+
+ /*
+ * Align size to 16 bytes
+ */
+ chunk_size = ((size + 15) & ~15);
+
+ if (space_left < chunk_size) {
+ return NULL;
+ }
+
+ result = (struct talloc_chunk *)pool_ctx->pool;
+
+#if defined(DEVELOPER) && defined(VALGRIND_MAKE_MEM_UNDEFINED)
+ VALGRIND_MAKE_MEM_UNDEFINED(result, size);
+#endif
+
+ pool_ctx->pool = (void *)((char *)result + chunk_size);
+
+ result->flags = TALLOC_MAGIC | TALLOC_FLAG_POOLMEM;
+ result->pool = pool_ctx;
+
+ *talloc_pool_objectcount(pool_ctx) += 1;
+
+ return result;
+}
+
+/*
+ Allocate a bit of memory as a child of an existing pointer
+*/
+static inline void *__talloc(const void *context, size_t size)
+{
+ struct talloc_chunk *tc = NULL;
+
+ if (unlikely(context == NULL)) {
+ context = null_context;
+ }
+
+ if (unlikely(size >= MAX_TALLOC_SIZE)) {
+ abort(); // return NULL;
+ }
+
+ if (context != NULL) {
+ tc = talloc_alloc_pool(talloc_chunk_from_ptr(context),
+ TC_HDR_SIZE+size);
+ }
+
+ if (tc == NULL) {
+ tc = (struct talloc_chunk *)malloc(TC_HDR_SIZE+size);
+ if (unlikely(tc == NULL)) abort(); // return NULL;
+ tc->flags = TALLOC_MAGIC;
+ tc->pool = NULL;
+ }
+
+ tc->size = size;
+ tc->destructor = NULL;
+ tc->child = NULL;
+ tc->name = NULL;
+ tc->refs = NULL;
+
+ if (likely(context)) {
+ struct talloc_chunk *parent = talloc_chunk_from_ptr(context);
+
+ if (parent->child) {
+ parent->child->parent = NULL;
+ tc->next = parent->child;
+ tc->next->prev = tc;
+ } else {
+ tc->next = NULL;
+ }
+ tc->parent = parent;
+ tc->prev = NULL;
+ parent->child = tc;
+ } else {
+ tc->next = tc->prev = tc->parent = NULL;
+ }
+
+ return TC_PTR_FROM_CHUNK(tc);
+}
+
+/*
+ * Create a talloc pool
+ */
+
+void *talloc_pool(const void *context, size_t size)
+{
+ void *result = __talloc(context, size + TALLOC_POOL_HDR_SIZE);
+ struct talloc_chunk *tc;
+
+ if (unlikely(result == NULL)) {
+ return NULL;
+ }
+
+ tc = talloc_chunk_from_ptr(result);
+
+ tc->flags |= TALLOC_FLAG_POOL;
+ tc->pool = (char *)result + TALLOC_POOL_HDR_SIZE;
+
+ *talloc_pool_objectcount(tc) = 1;
+
+#if defined(DEVELOPER) && defined(VALGRIND_MAKE_MEM_NOACCESS)
+ VALGRIND_MAKE_MEM_NOACCESS(tc->pool, size);
+#endif
+
+ return result;
+}
+
+/*
+ setup a destructor to be called on free of a pointer
+ the destructor should return 0 on success, or -1 on failure.
+ if the destructor fails then the free is failed, and the memory can
+ be continued to be used
+*/
+void _talloc_set_destructor(const void *ptr, int (*destructor)(void *))
+{
+ struct talloc_chunk *tc = talloc_chunk_from_ptr(ptr);
+ tc->destructor = destructor;
+}
+
+/*
+ increase the reference count on a piece of memory.
+*/
+int talloc_increase_ref_count(const void *ptr)
+{
+ if (unlikely(!talloc_reference(null_context, ptr))) {
+ return -1;
+ }
+ return 0;
+}
+
+/*
+ helper for talloc_reference()
+
+ this is referenced by a function pointer and should not be inline
+*/
+static int talloc_reference_destructor(struct talloc_reference_handle *handle)
+{
+ struct talloc_chunk *ptr_tc = talloc_chunk_from_ptr(handle->ptr);
+ _TLIST_REMOVE(ptr_tc->refs, handle);
+ return 0;
+}
+
+/*
+ more efficient way to add a name to a pointer - the name must point to a
+ true string constant
+*/
+static inline void _talloc_set_name_const(const void *ptr, const char *name)
+{
+ struct talloc_chunk *tc = talloc_chunk_from_ptr(ptr);
+ tc->name = name;
+}
+
+/*
+ internal talloc_named_const()
+*/
+static inline void *_talloc_named_const(const void *context, size_t size, const char *name)
+{
+ void *ptr;
+
+ ptr = __talloc(context, size);
+ if (unlikely(ptr == NULL)) {
+ return NULL;
+ }
+
+ _talloc_set_name_const(ptr, name);
+
+ return ptr;
+}
+
+/*
+ make a secondary reference to a pointer, hanging off the given context.
+ the pointer remains valid until both the original caller and this given
+ context are freed.
+
+ the major use for this is when two different structures need to reference the
+ same underlying data, and you want to be able to free the two instances separately,
+ and in either order
+*/
+void *_talloc_reference(const void *context, const void *ptr)
+{
+ struct talloc_chunk *tc;
+ struct talloc_reference_handle *handle;
+ if (unlikely(ptr == NULL)) return NULL;
+
+ tc = talloc_chunk_from_ptr(ptr);
+ handle = (struct talloc_reference_handle *)_talloc_named_const(context,
+ sizeof(struct talloc_reference_handle),
+ TALLOC_MAGIC_REFERENCE);
+ if (unlikely(handle == NULL)) return NULL;
+
+ /* note that we hang the destructor off the handle, not the
+ main context as that allows the caller to still setup their
+ own destructor on the context if they want to */
+ talloc_set_destructor(handle, talloc_reference_destructor);
+ handle->ptr = discard_const_p(void, ptr);
+ _TLIST_ADD(tc->refs, handle);
+ return handle->ptr;
+}
+
+
+/*
+ internal talloc_free call
+*/
+static inline int _talloc_free(void *ptr)
+{
+ struct talloc_chunk *tc;
+
+ if (unlikely(ptr == NULL)) {
+ return -1;
+ }
+
+ tc = talloc_chunk_from_ptr(ptr);
+
+ if (unlikely(tc->refs)) {
+ int is_child;
+ /* check this is a reference from a child or grantchild
+ * back to it's parent or grantparent
+ *
+ * in that case we need to remove the reference and
+ * call another instance of talloc_free() on the current
+ * pointer.
+ */
+ is_child = talloc_is_parent(tc->refs, ptr);
+ _talloc_free(tc->refs);
+ if (is_child) {
+ return _talloc_free(ptr);
+ }
+ return -1;
+ }
+
+ if (unlikely(tc->flags & TALLOC_FLAG_LOOP)) {
+ /* we have a free loop - stop looping */
+ return 0;
+ }
+
+ if (unlikely(tc->destructor)) {
+ talloc_destructor_t d = tc->destructor;
+ if (d == (talloc_destructor_t)-1) {
+ return -1;
+ }
+ tc->destructor = (talloc_destructor_t)-1;
+ if (d(ptr) == -1) {
+ tc->destructor = d;
+ return -1;
+ }
+ tc->destructor = NULL;
+ }
+
+ if (tc->parent) {
+ _TLIST_REMOVE(tc->parent->child, tc);
+ if (tc->parent->child) {
+ tc->parent->child->parent = tc->parent;
+ }
+ } else {
+ if (tc->prev) tc->prev->next = tc->next;
+ if (tc->next) tc->next->prev = tc->prev;
+ }
+
+ tc->flags |= TALLOC_FLAG_LOOP;
+
+ while (tc->child) {
+ /* we need to work out who will own an abandoned child
+ if it cannot be freed. In priority order, the first
+ choice is owner of any remaining reference to this
+ pointer, the second choice is our parent, and the
+ final choice is the null context. */
+ void *child = TC_PTR_FROM_CHUNK(tc->child);
+ const void *new_parent = null_context;
+ if (unlikely(tc->child->refs)) {
+ struct talloc_chunk *p = talloc_parent_chunk(tc->child->refs);
+ if (p) new_parent = TC_PTR_FROM_CHUNK(p);
+ }
+ if (unlikely(_talloc_free(child) == -1)) {
+ if (new_parent == null_context) {
+ struct talloc_chunk *p = talloc_parent_chunk(ptr);
+ if (p) new_parent = TC_PTR_FROM_CHUNK(p);
+ }
+ talloc_steal(new_parent, child);
+ }
+ }
+
+ tc->flags |= TALLOC_FLAG_FREE;
+
+ if (tc->flags & (TALLOC_FLAG_POOL|TALLOC_FLAG_POOLMEM)) {
+ struct talloc_chunk *pool;
+ unsigned int *pool_object_count;
+
+ pool = (tc->flags & TALLOC_FLAG_POOL)
+ ? tc : (struct talloc_chunk *)tc->pool;
+
+ pool_object_count = talloc_pool_objectcount(pool);
+
+ if (*pool_object_count == 0) {
+ TALLOC_ABORT("Pool object count zero!");
+ }
+
+ *pool_object_count -= 1;
+
+ if (*pool_object_count == 0) {
+ free(pool);
+ }
+ }
+ else {
+ free(tc);
+ }
+ return 0;
+}
+
+/*
+ move a lump of memory from one talloc context to another return the
+ ptr on success, or NULL if it could not be transferred.
+ passing NULL as ptr will always return NULL with no side effects.
+*/
+void *_talloc_steal(const void *new_ctx, const void *ptr)
+{
+ struct talloc_chunk *tc, *new_tc;
+
+ if (unlikely(!ptr)) {
+ return NULL;
+ }
+
+ if (unlikely(new_ctx == NULL)) {
+ new_ctx = null_context;
+ }
+
+ tc = talloc_chunk_from_ptr(ptr);
+
+ if (unlikely(new_ctx == NULL)) {
+ if (tc->parent) {
+ _TLIST_REMOVE(tc->parent->child, tc);
+ if (tc->parent->child) {
+ tc->parent->child->parent = tc->parent;
+ }
+ } else {
+ if (tc->prev) tc->prev->next = tc->next;
+ if (tc->next) tc->next->prev = tc->prev;
+ }
+
+ tc->parent = tc->next = tc->prev = NULL;
+ return discard_const_p(void, ptr);
+ }
+
+ new_tc = talloc_chunk_from_ptr(new_ctx);
+
+ if (unlikely(tc == new_tc || tc->parent == new_tc)) {
+ return discard_const_p(void, ptr);
+ }
+
+ if (tc->parent) {
+ _TLIST_REMOVE(tc->parent->child, tc);
+ if (tc->parent->child) {
+ tc->parent->child->parent = tc->parent;
+ }
+ } else {
+ if (tc->prev) tc->prev->next = tc->next;
+ if (tc->next) tc->next->prev = tc->prev;
+ }
+
+ tc->parent = new_tc;
+ if (new_tc->child) new_tc->child->parent = NULL;
+ _TLIST_ADD(new_tc->child, tc);
+
+ return discard_const_p(void, ptr);
+}
+
+
+
+/*
+ remove a secondary reference to a pointer. This undo's what
+ talloc_reference() has done. The context and pointer arguments
+ must match those given to a talloc_reference()
+*/
+static inline int talloc_unreference(const void *context, const void *ptr)
+{
+ struct talloc_chunk *tc = talloc_chunk_from_ptr(ptr);
+ struct talloc_reference_handle *h;
+
+ if (unlikely(context == NULL)) {
+ context = null_context;
+ }
+
+ for (h=tc->refs;h;h=h->next) {
+ struct talloc_chunk *p = talloc_parent_chunk(h);
+ if (p == NULL) {
+ if (context == NULL) break;
+ } else if (TC_PTR_FROM_CHUNK(p) == context) {
+ break;
+ }
+ }
+ if (h == NULL) {
+ return -1;
+ }
+
+ return _talloc_free(h);
+}
+
+/*
+ remove a specific parent context from a pointer. This is a more
+ controlled varient of talloc_free()
+*/
+int talloc_unlink(const void *context, void *ptr)
+{
+ struct talloc_chunk *tc_p, *new_p;
+ void *new_parent;
+
+ if (ptr == NULL) {
+ return -1;
+ }
+
+ if (context == NULL) {
+ context = null_context;
+ }
+
+ if (talloc_unreference(context, ptr) == 0) {
+ return 0;
+ }
+
+ if (context == NULL) {
+ if (talloc_parent_chunk(ptr) != NULL) {
+ return -1;
+ }
+ } else {
+ if (talloc_chunk_from_ptr(context) != talloc_parent_chunk(ptr)) {
+ return -1;
+ }
+ }
+
+ tc_p = talloc_chunk_from_ptr(ptr);
+
+ if (tc_p->refs == NULL) {
+ return _talloc_free(ptr);
+ }
+
+ new_p = talloc_parent_chunk(tc_p->refs);
+ if (new_p) {
+ new_parent = TC_PTR_FROM_CHUNK(new_p);
+ } else {
+ new_parent = NULL;
+ }
+
+ if (talloc_unreference(new_parent, ptr) != 0) {
+ return -1;
+ }
+
+ talloc_steal(new_parent, ptr);
+
+ return 0;
+}
+
+/*
+ add a name to an existing pointer - va_list version
+*/
+static inline const char *talloc_set_name_v(const void *ptr, const char *fmt, va_list ap) PRINTF_ATTRIBUTE(2,0);
+
+static inline const char *talloc_set_name_v(const void *ptr, const char *fmt, va_list ap)
+{
+ struct talloc_chunk *tc = talloc_chunk_from_ptr(ptr);
+ tc->name = talloc_vasprintf(ptr, fmt, ap);
+ if (likely(tc->name)) {
+ _talloc_set_name_const(tc->name, ".name");
+ }
+ return tc->name;
+}
+
+/*
+ add a name to an existing pointer
+*/
+const char *talloc_set_name(const void *ptr, const char *fmt, ...)
+{
+ const char *name;
+ va_list ap;
+ va_start(ap, fmt);
+ name = talloc_set_name_v(ptr, fmt, ap);
+ va_end(ap);
+ return name;
+}
+
+
+/*
+ create a named talloc pointer. Any talloc pointer can be named, and
+ talloc_named() operates just like talloc() except that it allows you
+ to name the pointer.
+*/
+void *talloc_named(const void *context, size_t size, const char *fmt, ...)
+{
+ va_list ap;
+ void *ptr;
+ const char *name;
+
+ ptr = __talloc(context, size);
+ if (unlikely(ptr == NULL)) return NULL;
+
+ va_start(ap, fmt);
+ name = talloc_set_name_v(ptr, fmt, ap);
+ va_end(ap);
+
+ if (unlikely(name == NULL)) {
+ _talloc_free(ptr);
+ return NULL;
+ }
+
+ return ptr;
+}
+
+/*
+ return the name of a talloc ptr, or "UNNAMED"
+*/
+const char *talloc_get_name(const void *ptr)
+{
+ struct talloc_chunk *tc = talloc_chunk_from_ptr(ptr);
+ if (unlikely(tc->name == TALLOC_MAGIC_REFERENCE)) {
+ return ".reference";
+ }
+ if (likely(tc->name)) {
+ return tc->name;
+ }
+ return "UNNAMED";
+}
+
+
+/*
+ check if a pointer has the given name. If it does, return the pointer,
+ otherwise return NULL
+*/
+void *talloc_check_name(const void *ptr, const char *name)
+{
+ const char *pname;
+ if (unlikely(ptr == NULL)) return NULL;
+ pname = talloc_get_name(ptr);
+ if (likely(pname == name || strcmp(pname, name) == 0)) {
+ return discard_const_p(void, ptr);
+ }
+ return NULL;
+}
+
+
+/*
+ this is for compatibility with older versions of talloc
+*/
+void *talloc_init(const char *fmt, ...)
+{
+ va_list ap;
+ void *ptr;
+ const char *name;
+
+ /*
+ * samba3 expects talloc_report_depth_cb(NULL, ...)
+ * reports all talloc'ed memory, so we need to enable
+ * null_tracking
+ */
+ talloc_enable_null_tracking();
+
+ ptr = __talloc(NULL, 0);
+ if (unlikely(ptr == NULL)) return NULL;
+
+ va_start(ap, fmt);
+ name = talloc_set_name_v(ptr, fmt, ap);
+ va_end(ap);
+
+ if (unlikely(name == NULL)) {
+ _talloc_free(ptr);
+ return NULL;
+ }
+
+ return ptr;
+}
+
+/*
+ this is a replacement for the Samba3 talloc_destroy_pool functionality. It
+ should probably not be used in new code. It's in here to keep the talloc
+ code consistent across Samba 3 and 4.
+*/
+void talloc_free_children(void *ptr)
+{
+ struct talloc_chunk *tc;
+
+ if (unlikely(ptr == NULL)) {
+ return;
+ }
+
+ tc = talloc_chunk_from_ptr(ptr);
+
+ while (tc->child) {
+ /* we need to work out who will own an abandoned child
+ if it cannot be freed. In priority order, the first
+ choice is owner of any remaining reference to this
+ pointer, the second choice is our parent, and the
+ final choice is the null context. */
+ void *child = TC_PTR_FROM_CHUNK(tc->child);
+ const void *new_parent = null_context;
+ if (unlikely(tc->child->refs)) {
+ struct talloc_chunk *p = talloc_parent_chunk(tc->child->refs);
+ if (p) new_parent = TC_PTR_FROM_CHUNK(p);
+ }
+ if (unlikely(_talloc_free(child) == -1)) {
+ if (new_parent == null_context) {
+ struct talloc_chunk *p = talloc_parent_chunk(ptr);
+ if (p) new_parent = TC_PTR_FROM_CHUNK(p);
+ }
+ talloc_steal(new_parent, child);
+ }
+ }
+
+ if ((tc->flags & TALLOC_FLAG_POOL)
+ && (*talloc_pool_objectcount(tc) == 1)) {
+ tc->pool = ((char *)tc + TC_HDR_SIZE + TALLOC_POOL_HDR_SIZE);
+#if defined(DEVELOPER) && defined(VALGRIND_MAKE_MEM_NOACCESS)
+ VALGRIND_MAKE_MEM_NOACCESS(
+ tc->pool, tc->size - TALLOC_POOL_HDR_SIZE);
+#endif
+ }
+}
+
+/*
+ Allocate a bit of memory as a child of an existing pointer
+*/
+void *_talloc(const void *context, size_t size)
+{
+ return __talloc(context, size);
+}
+
+/*
+ externally callable talloc_set_name_const()
+*/
+void talloc_set_name_const(const void *ptr, const char *name)
+{
+ _talloc_set_name_const(ptr, name);
+}
+
+/*
+ create a named talloc pointer. Any talloc pointer can be named, and
+ talloc_named() operates just like talloc() except that it allows you
+ to name the pointer.
+*/
+void *talloc_named_const(const void *context, size_t size, const char *name)
+{
+ return _talloc_named_const(context, size, name);
+}
+
+/*
+ free a talloc pointer. This also frees all child pointers of this
+ pointer recursively
+
+ return 0 if the memory is actually freed, otherwise -1. The memory
+ will not be freed if the ref_count is > 1 or the destructor (if
+ any) returns non-zero
+*/
+int talloc_free(void *ptr)
+{
+ return _talloc_free(ptr);
+}
+
+
+
+/*
+ A talloc version of realloc. The context argument is only used if
+ ptr is NULL
+*/
+void *_talloc_realloc(const void *context, void *ptr, size_t size, const char *name)
+{
+ struct talloc_chunk *tc;
+ void *new_ptr;
+ bool malloced = false;
+
+ /* size zero is equivalent to free() */
+ if (unlikely(size == 0)) {
+ _talloc_free(ptr);
+ return NULL;
+ }
+
+ if (unlikely(size >= MAX_TALLOC_SIZE)) {
+ abort(); // return NULL;
+ }
+
+ /* realloc(NULL) is equivalent to malloc() */
+ if (ptr == NULL) {
+ return _talloc_named_const(context, size, name);
+ }
+
+ tc = talloc_chunk_from_ptr(ptr);
+
+ /* don't allow realloc on referenced pointers */
+ if (unlikely(tc->refs)) {
+ abort(); // return NULL;
+ }
+
+ /* don't shrink if we have less than 1k to gain */
+ if ((size < tc->size) && ((tc->size - size) < 1024)) {
+ tc->size = size;
+ return ptr;
+ }
+
+ /* by resetting magic we catch users of the old memory */
+ tc->flags |= TALLOC_FLAG_FREE;
+
+#if ALWAYS_REALLOC
+ new_ptr = malloc(size + TC_HDR_SIZE);
+ if (new_ptr) {
+ memcpy(new_ptr, tc, tc->size + TC_HDR_SIZE);
+ free(tc);
+ }
+#else
+ if (tc->flags & TALLOC_FLAG_POOLMEM) {
+
+ new_ptr = talloc_alloc_pool(tc, size + TC_HDR_SIZE);
+ *talloc_pool_objectcount((struct talloc_chunk *)
+ (tc->pool)) -= 1;
+
+ if (new_ptr == NULL) {
+ new_ptr = malloc(TC_HDR_SIZE+size);
+ malloced = true;
+ }
+
+ if (new_ptr) {
+ memcpy(new_ptr, tc, MIN(tc->size,size) + TC_HDR_SIZE);
+ }
+ }
+ else {
+ new_ptr = realloc(tc, size + TC_HDR_SIZE);
+ }
+#endif
+ if (unlikely(!new_ptr)) {
+ tc->flags &= ~TALLOC_FLAG_FREE;
+ abort(); // return NULL;
+ }
+
+ tc = (struct talloc_chunk *)new_ptr;
+ tc->flags &= ~TALLOC_FLAG_FREE;
+ if (malloced) {
+ tc->flags &= ~TALLOC_FLAG_POOLMEM;
+ }
+ if (tc->parent) {
+ tc->parent->child = tc;
+ }
+ if (tc->child) {
+ tc->child->parent = tc;
+ }
+
+ if (tc->prev) {
+ tc->prev->next = tc;
+ }
+ if (tc->next) {
+ tc->next->prev = tc;
+ }
+
+ tc->size = size;
+ _talloc_set_name_const(TC_PTR_FROM_CHUNK(tc), name);
+
+ return TC_PTR_FROM_CHUNK(tc);
+}
+
+/*
+ a wrapper around talloc_steal() for situations where you are moving a pointer
+ between two structures, and want the old pointer to be set to NULL
+*/
+void *_talloc_move(const void *new_ctx, const void *_pptr)
+{
+ const void **pptr = discard_const_p(const void *,_pptr);
+ void *ret = _talloc_steal(new_ctx, *pptr);
+ (*pptr) = NULL;
+ return ret;
+}
+
+/*
+ return the total size of a talloc pool (subtree)
+*/
+size_t talloc_total_size(const void *ptr)
+{
+ size_t total = 0;
+ struct talloc_chunk *c, *tc;
+
+ if (ptr == NULL) {
+ ptr = null_context;
+ }
+ if (ptr == NULL) {
+ return 0;
+ }
+
+ tc = talloc_chunk_from_ptr(ptr);
+
+ if (tc->flags & TALLOC_FLAG_LOOP) {
+ return 0;
+ }
+
+ tc->flags |= TALLOC_FLAG_LOOP;
+
+ total = tc->size;
+ for (c=tc->child;c;c=c->next) {
+ total += talloc_total_size(TC_PTR_FROM_CHUNK(c));
+ }
+
+ tc->flags &= ~TALLOC_FLAG_LOOP;
+
+ return total;
+}
+
+/*
+ return the total number of blocks in a talloc pool (subtree)
+*/
+size_t talloc_total_blocks(const void *ptr)
+{
+ size_t total = 0;
+ struct talloc_chunk *c, *tc = talloc_chunk_from_ptr(ptr);
+
+ if (tc->flags & TALLOC_FLAG_LOOP) {
+ return 0;
+ }
+
+ tc->flags |= TALLOC_FLAG_LOOP;
+
+ total++;
+ for (c=tc->child;c;c=c->next) {
+ total += talloc_total_blocks(TC_PTR_FROM_CHUNK(c));
+ }
+
+ tc->flags &= ~TALLOC_FLAG_LOOP;
+
+ return total;
+}
+
+/*
+ return the number of external references to a pointer
+*/
+size_t talloc_reference_count(const void *ptr)
+{
+ struct talloc_chunk *tc = talloc_chunk_from_ptr(ptr);
+ struct talloc_reference_handle *h;
+ size_t ret = 0;
+
+ for (h=tc->refs;h;h=h->next) {
+ ret++;
+ }
+ return ret;
+}
+
+/*
+ report on memory usage by all children of a pointer, giving a full tree view
+*/
+void talloc_report_depth_cb(const void *ptr, int depth, int max_depth,
+ void (*callback)(const void *ptr,
+ int depth, int max_depth,
+ int is_ref,
+ void *private_data),
+ void *private_data)
+{
+ struct talloc_chunk *c, *tc;
+
+ if (ptr == NULL) {
+ ptr = null_context;
+ }
+ if (ptr == NULL) return;
+
+ tc = talloc_chunk_from_ptr(ptr);
+
+ if (tc->flags & TALLOC_FLAG_LOOP) {
+ return;
+ }
+
+ callback(ptr, depth, max_depth, 0, private_data);
+
+ if (max_depth >= 0 && depth >= max_depth) {
+ return;
+ }
+
+ tc->flags |= TALLOC_FLAG_LOOP;
+ for (c=tc->child;c;c=c->next) {
+ if (c->name == TALLOC_MAGIC_REFERENCE) {
+ struct talloc_reference_handle *h = (struct talloc_reference_handle *)TC_PTR_FROM_CHUNK(c);
+ callback(h->ptr, depth + 1, max_depth, 1, private_data);
+ } else {
+ talloc_report_depth_cb(TC_PTR_FROM_CHUNK(c), depth + 1, max_depth, callback, private_data);
+ }
+ }
+ tc->flags &= ~TALLOC_FLAG_LOOP;
+}
+
+static void talloc_report_depth_FILE_helper(const void *ptr, int depth, int max_depth, int is_ref, void *_f)
+{
+ const char *name = talloc_get_name(ptr);
+ FILE *f = (FILE *)_f;
+
+ if (is_ref) {
+ fprintf(f, "%*sreference to: %s\n", depth*4, "", name);
+ return;
+ }
+
+ if (depth == 0) {
+ fprintf(f,"%stalloc report on '%s' (total %6lu bytes in %3lu blocks)\n",
+ (max_depth < 0 ? "full " :""), name,
+ (unsigned long)talloc_total_size(ptr),
+ (unsigned long)talloc_total_blocks(ptr));
+ return;
+ }
+
+ fprintf(f, "%*s%-30s contains %6lu bytes in %3lu blocks (ref %d) %p\n",
+ depth*4, "",
+ name,
+ (unsigned long)talloc_total_size(ptr),
+ (unsigned long)talloc_total_blocks(ptr),
+ (int)talloc_reference_count(ptr), ptr);
+
+#if 0
+ fprintf(f, "content: ");
+ if (talloc_total_size(ptr)) {
+ int tot = talloc_total_size(ptr);
+ int i;
+
+ for (i = 0; i < tot; i++) {
+ if ((((char *)ptr)[i] > 31) && (((char *)ptr)[i] < 126)) {
+ fprintf(f, "%c", ((char *)ptr)[i]);
+ } else {
+ fprintf(f, "~%02x", ((char *)ptr)[i]);
+ }
+ }
+ }
+ fprintf(f, "\n");
+#endif
+}
+
+/*
+ report on memory usage by all children of a pointer, giving a full tree view
+*/
+void talloc_report_depth_file(const void *ptr, int depth, int max_depth, FILE *f)
+{
+ talloc_report_depth_cb(ptr, depth, max_depth, talloc_report_depth_FILE_helper, f);
+ fflush(f);
+}
+
+/*
+ report on memory usage by all children of a pointer, giving a full tree view
+*/
+void talloc_report_full(const void *ptr, FILE *f)
+{
+ talloc_report_depth_file(ptr, 0, -1, f);
+}
+
+/*
+ report on memory usage by all children of a pointer
+*/
+void talloc_report(const void *ptr, FILE *f)
+{
+ talloc_report_depth_file(ptr, 0, 1, f);
+}
+
+/*
+ report on any memory hanging off the null context
+*/
+static void talloc_report_null(void)
+{
+ if (talloc_total_size(null_context) != 0) {
+ talloc_report(null_context, stderr);
+ }
+}
+
+/*
+ report on any memory hanging off the null context
+*/
+static void talloc_report_null_full(void)
+{
+ if (talloc_total_size(null_context) != 0) {
+ talloc_report_full(null_context, stderr);
+ }
+}
+
+/*
+ enable tracking of the NULL context
+*/
+void talloc_enable_null_tracking(void)
+{
+ if (null_context == NULL) {
+ null_context = _talloc_named_const(NULL, 0, "null_context");
+ }
+}
+
+/*
+ disable tracking of the NULL context
+*/
+void talloc_disable_null_tracking(void)
+{
+ _talloc_free(null_context);
+ null_context = NULL;
+}
+
+/*
+ enable leak reporting on exit
+*/
+void talloc_enable_leak_report(void)
+{
+ talloc_enable_null_tracking();
+ atexit(talloc_report_null);
+}
+
+/*
+ enable full leak reporting on exit
+*/
+void talloc_enable_leak_report_full(void)
+{
+ talloc_enable_null_tracking();
+ atexit(talloc_report_null_full);
+}
+
+/*
+ talloc and zero memory.
+*/
+void *_talloc_zero(const void *ctx, size_t size, const char *name)
+{
+ void *p = _talloc_named_const(ctx, size, name);
+
+ if (p) {
+ memset(p, '\0', size);
+ }
+
+ return p;
+}
+
+/*
+ memdup with a talloc.
+*/
+void *_talloc_memdup(const void *t, const void *p, size_t size, const char *name)
+{
+ void *newp = _talloc_named_const(t, size, name);
+
+ if (likely(newp)) {
+ memcpy(newp, p, size);
+ }
+
+ return newp;
+}
+
+static inline char *__talloc_strlendup(const void *t, const char *p, size_t len)
+{
+ char *ret;
+
+ ret = (char *)__talloc(t, len + 1);
+ if (unlikely(!ret)) return NULL;
+
+ memcpy(ret, p, len);
+ ret[len] = 0;
+
+ _talloc_set_name_const(ret, ret);
+ return ret;
+}
+
+/*
+ strdup with a talloc
+*/
+char *talloc_strdup(const void *t, const char *p)
+{
+ if (unlikely(!p)) return NULL;
+ return __talloc_strlendup(t, p, strlen(p));
+}
+
+/*
+ strndup with a talloc
+*/
+char *talloc_strndup(const void *t, const char *p, size_t n)
+{
+ if (unlikely(!p)) return NULL;
+ return __talloc_strlendup(t, p, strnlen(p, n));
+}
+
+static inline char *__talloc_strlendup_append(char *s, size_t slen,
+ const char *a, size_t alen)
+{
+ char *ret;
+
+ ret = talloc_realloc(NULL, s, char, slen + alen + 1);
+ if (unlikely(!ret)) return NULL;
+
+ /* append the string and the trailing \0 */
+ memcpy(&ret[slen], a, alen);
+ ret[slen+alen] = 0;
+
+ _talloc_set_name_const(ret, ret);
+ return ret;
+}
+
+/*
+ * Appends at the end of the string.
+ */
+char *talloc_strdup_append(char *s, const char *a)
+{
+ if (unlikely(!s)) {
+ return talloc_strdup(NULL, a);
+ }
+
+ if (unlikely(!a)) {
+ return s;
+ }
+
+ return __talloc_strlendup_append(s, strlen(s), a, strlen(a));
+}
+
+/*
+ * Appends at the end of the talloc'ed buffer,
+ * not the end of the string.
+ */
+char *talloc_strdup_append_buffer(char *s, const char *a)
+{
+ size_t slen;
+
+ if (unlikely(!s)) {
+ return talloc_strdup(NULL, a);
+ }
+
+ if (unlikely(!a)) {
+ return s;
+ }
+
+ slen = talloc_get_size(s);
+ if (likely(slen > 0)) {
+ slen--;
+ }
+
+ return __talloc_strlendup_append(s, slen, a, strlen(a));
+}
+
+/*
+ * Appends at the end of the string.
+ */
+char *talloc_strndup_append(char *s, const char *a, size_t n)
+{
+ if (unlikely(!s)) {
+ return talloc_strdup(NULL, a);
+ }
+
+ if (unlikely(!a)) {
+ return s;
+ }
+
+ return __talloc_strlendup_append(s, strlen(s), a, strnlen(a, n));
+}
+
+/*
+ * Appends at the end of the talloc'ed buffer,
+ * not the end of the string.
+ */
+char *talloc_strndup_append_buffer(char *s, const char *a, size_t n)
+{
+ size_t slen;
+
+ if (unlikely(!s)) {
+ return talloc_strdup(NULL, a);
+ }
+
+ if (unlikely(!a)) {
+ return s;
+ }
+
+ slen = talloc_get_size(s);
+ if (likely(slen > 0)) {
+ slen--;
+ }
+
+ return __talloc_strlendup_append(s, slen, a, strnlen(a, n));
+}
+
+#ifndef HAVE_VA_COPY
+#ifdef HAVE___VA_COPY
+#define va_copy(dest, src) __va_copy(dest, src)
+#else
+#define va_copy(dest, src) (dest) = (src)
+#endif
+#endif
+
+char *talloc_vasprintf(const void *t, const char *fmt, va_list ap)
+{
+ int len;
+ char *ret;
+ va_list ap2;
+ char c;
+
+ /* this call looks strange, but it makes it work on older solaris boxes */
+ va_copy(ap2, ap);
+ len = vsnprintf(&c, 1, fmt, ap2);
+ va_end(ap2);
+ if (unlikely(len < 0)) {
+ abort(); // return NULL;
+ }
+
+ ret = (char *)__talloc(t, len+1);
+ if (unlikely(!ret)) return NULL;
+
+ va_copy(ap2, ap);
+ vsnprintf(ret, len+1, fmt, ap2);
+ va_end(ap2);
+
+ _talloc_set_name_const(ret, ret);
+ return ret;
+}
+
+
+/*
+ Perform string formatting, and return a pointer to newly allocated
+ memory holding the result, inside a memory pool.
+ */
+char *talloc_asprintf(const void *t, const char *fmt, ...)
+{
+ va_list ap;
+ char *ret;
+
+ va_start(ap, fmt);
+ ret = talloc_vasprintf(t, fmt, ap);
+ va_end(ap);
+ return ret;
+}
+
+static inline char *__talloc_vaslenprintf_append(char *s, size_t slen,
+ const char *fmt, va_list ap)
+ PRINTF_ATTRIBUTE(3,0);
+
+static inline char *__talloc_vaslenprintf_append(char *s, size_t slen,
+ const char *fmt, va_list ap)
+{
+ ssize_t alen;
+ va_list ap2;
+ char c;
+
+ va_copy(ap2, ap);
+ alen = vsnprintf(&c, 1, fmt, ap2);
+ va_end(ap2);
+
+ if (alen <= 0) {
+ /* Either the vsnprintf failed or the format resulted in
+ * no characters being formatted. In the former case, we
+ * ought to return NULL, in the latter we ought to return
+ * the original string. Most current callers of this
+ * function expect it to never return NULL.
+ */
+ return s;
+ }
+
+ s = talloc_realloc(NULL, s, char, slen + alen + 1);
+ if (!s) return NULL;
+
+ va_copy(ap2, ap);
+ vsnprintf(s + slen, alen + 1, fmt, ap2);
+ va_end(ap2);
+
+ _talloc_set_name_const(s, s);
+ return s;
+}
+
+/**
+ * Realloc @p s to append the formatted result of @p fmt and @p ap,
+ * and return @p s, which may have moved. Good for gradually
+ * accumulating output into a string buffer. Appends at the end
+ * of the string.
+ **/
+char *talloc_vasprintf_append(char *s, const char *fmt, va_list ap)
+{
+ if (unlikely(!s)) {
+ return talloc_vasprintf(NULL, fmt, ap);
+ }
+
+ return __talloc_vaslenprintf_append(s, strlen(s), fmt, ap);
+}
+
+/**
+ * Realloc @p s to append the formatted result of @p fmt and @p ap,
+ * and return @p s, which may have moved. Always appends at the
+ * end of the talloc'ed buffer, not the end of the string.
+ **/
+char *talloc_vasprintf_append_buffer(char *s, const char *fmt, va_list ap)
+{
+ size_t slen;
+
+ if (unlikely(!s)) {
+ return talloc_vasprintf(NULL, fmt, ap);
+ }
+
+ slen = talloc_get_size(s);
+ if (likely(slen > 0)) {
+ slen--;
+ }
+
+ return __talloc_vaslenprintf_append(s, slen, fmt, ap);
+}
+
+/*
+ Realloc @p s to append the formatted result of @p fmt and return @p
+ s, which may have moved. Good for gradually accumulating output
+ into a string buffer.
+ */
+char *talloc_asprintf_append(char *s, const char *fmt, ...)
+{
+ va_list ap;
+
+ va_start(ap, fmt);
+ s = talloc_vasprintf_append(s, fmt, ap);
+ va_end(ap);
+ return s;
+}
+
+/*
+ Realloc @p s to append the formatted result of @p fmt and return @p
+ s, which may have moved. Good for gradually accumulating output
+ into a buffer.
+ */
+char *talloc_asprintf_append_buffer(char *s, const char *fmt, ...)
+{
+ va_list ap;
+
+ va_start(ap, fmt);
+ s = talloc_vasprintf_append_buffer(s, fmt, ap);
+ va_end(ap);
+ return s;
+}
+
+/*
+ alloc an array, checking for integer overflow in the array size
+*/
+void *_talloc_array(const void *ctx, size_t el_size, unsigned count, const char *name)
+{
+ if (count >= MAX_TALLOC_SIZE/el_size) {
+ abort(); // return NULL;
+ }
+ return _talloc_named_const(ctx, el_size * count, name);
+}
+
+/*
+ alloc an zero array, checking for integer overflow in the array size
+*/
+void *_talloc_zero_array(const void *ctx, size_t el_size, unsigned count, const char *name)
+{
+ if (count >= MAX_TALLOC_SIZE/el_size) {
+ abort(); // return NULL;
+ }
+ return _talloc_zero(ctx, el_size * count, name);
+}
+
+/*
+ realloc an array, checking for integer overflow in the array size
+*/
+void *_talloc_realloc_array(const void *ctx, void *ptr, size_t el_size, unsigned count, const char *name)
+{
+ if (count >= MAX_TALLOC_SIZE/el_size) {
+ abort(); // return NULL;
+ }
+ return _talloc_realloc(ctx, ptr, el_size * count, name);
+}
+
+/*
+ a function version of talloc_realloc(), so it can be passed as a function pointer
+ to libraries that want a realloc function (a realloc function encapsulates
+ all the basic capabilities of an allocation library, which is why this is useful)
+*/
+void *talloc_realloc_fn(const void *context, void *ptr, size_t size)
+{
+ return _talloc_realloc(context, ptr, size, NULL);
+}
+
+
+static int talloc_autofree_destructor(void *ptr)
+{
+ autofree_context = NULL;
+ return 0;
+}
+
+static void talloc_autofree(void)
+{
+ _talloc_free(autofree_context);
+}
+
+/*
+ return a context which will be auto-freed on exit
+ this is useful for reducing the noise in leak reports
+*/
+void *talloc_autofree_context(void)
+{
+ if (autofree_context == NULL) {
+ autofree_context = _talloc_named_const(NULL, 0, "autofree_context");
+ talloc_set_destructor(autofree_context, talloc_autofree_destructor);
+ atexit(talloc_autofree);
+ }
+ return autofree_context;
+}
+
+size_t talloc_get_size(const void *context)
+{
+ struct talloc_chunk *tc;
+
+ if (context == NULL)
+ return 0;
+
+ tc = talloc_chunk_from_ptr(context);
+
+ return tc->size;
+}
+
+/*
+ find a parent of this context that has the given name, if any
+*/
+void *talloc_find_parent_byname(const void *context, const char *name)
+{
+ struct talloc_chunk *tc;
+
+ if (context == NULL) {
+ return NULL;
+ }
+
+ tc = talloc_chunk_from_ptr(context);
+ while (tc) {
+ if (tc->name && strcmp(tc->name, name) == 0) {
+ return TC_PTR_FROM_CHUNK(tc);
+ }
+ while (tc && tc->prev) tc = tc->prev;
+ if (tc) {
+ tc = tc->parent;
+ }
+ }
+ return NULL;
+}
+
+/*
+ show the parentage of a context
+*/
+void talloc_show_parents(const void *context, FILE *file)
+{
+ struct talloc_chunk *tc;
+
+ if (context == NULL) {
+ fprintf(file, "talloc no parents for NULL\n");
+ return;
+ }
+
+ tc = talloc_chunk_from_ptr(context);
+ fprintf(file, "talloc parents of '%s'\n", talloc_get_name(context));
+ while (tc) {
+ fprintf(file, "\t'%s'\n", talloc_get_name(TC_PTR_FROM_CHUNK(tc)));
+ while (tc && tc->prev) tc = tc->prev;
+ if (tc) {
+ tc = tc->parent;
+ }
+ }
+ fflush(file);
+}
+
+/*
+ return 1 if ptr is a parent of context
+*/
+int talloc_is_parent(const void *context, const void *ptr)
+{
+ struct talloc_chunk *tc;
+
+ if (context == NULL) {
+ return 0;
+ }
+
+ tc = talloc_chunk_from_ptr(context);
+ while (tc) {
+ if (TC_PTR_FROM_CHUNK(tc) == ptr) return 1;
+ while (tc && tc->prev) tc = tc->prev;
+ if (tc) {
+ tc = tc->parent;
+ }
+ }
+ return 0;
+}
diff --git a/talloc.h b/talloc.h
new file mode 100644
index 0000000000..5431971655
--- /dev/null
+++ b/talloc.h
@@ -0,0 +1,183 @@
+#ifndef _TALLOC_H_
+#define _TALLOC_H_
+/*
+ Unix SMB/CIFS implementation.
+ Samba temporary memory allocation functions
+
+ Copyright (C) Andrew Tridgell 2004-2005
+ Copyright (C) Stefan Metzmacher 2006
+
+ ** NOTE! The following LGPL license applies to the talloc
+ ** library. This does NOT imply that all of Samba is released
+ ** under the LGPL
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 3 of the License, or (at your option) any later version.
+
+ This library 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <stdarg.h>
+
+/* this is only needed for compatibility with the old talloc */
+typedef void TALLOC_CTX;
+
+/*
+ this uses a little trick to allow __LINE__ to be stringified
+*/
+#ifndef __location__
+#define __TALLOC_STRING_LINE1__(s) #s
+#define __TALLOC_STRING_LINE2__(s) __TALLOC_STRING_LINE1__(s)
+#define __TALLOC_STRING_LINE3__ __TALLOC_STRING_LINE2__(__LINE__)
+#define __location__ __FILE__ ":" __TALLOC_STRING_LINE3__
+#endif
+
+#ifndef TALLOC_DEPRECATED
+#define TALLOC_DEPRECATED 0
+#endif
+
+#ifndef PRINTF_ATTRIBUTE
+#if (__GNUC__ >= 3)
+/** Use gcc attribute to check printf fns. a1 is the 1-based index of
+ * the parameter containing the format, and a2 the index of the first
+ * argument. Note that some gcc 2.x versions don't handle this
+ * properly **/
+#define PRINTF_ATTRIBUTE(a1, a2) __attribute__ ((format (__printf__, a1, a2)))
+#else
+#define PRINTF_ATTRIBUTE(a1, a2)
+#endif
+#endif
+
+/* try to make talloc_set_destructor() and talloc_steal() type safe,
+ if we have a recent gcc */
+#if (__GNUC__ >= 3)
+#define _TALLOC_TYPEOF(ptr) __typeof__(ptr)
+#define talloc_set_destructor(ptr, function) \
+ do { \
+ int (*_talloc_destructor_fn)(_TALLOC_TYPEOF(ptr)) = (function); \
+ _talloc_set_destructor((ptr), (int (*)(void *))_talloc_destructor_fn); \
+ } while(0)
+/* this extremely strange macro is to avoid some braindamaged warning
+ stupidity in gcc 4.1.x */
+#define talloc_steal(ctx, ptr) ({ _TALLOC_TYPEOF(ptr) __talloc_steal_ret = (_TALLOC_TYPEOF(ptr))_talloc_steal((ctx),(ptr)); __talloc_steal_ret; })
+#else
+#define talloc_set_destructor(ptr, function) \
+ _talloc_set_destructor((ptr), (int (*)(void *))(function))
+#define _TALLOC_TYPEOF(ptr) void *
+#define talloc_steal(ctx, ptr) (_TALLOC_TYPEOF(ptr))_talloc_steal((ctx),(ptr))
+#endif
+
+#define talloc_reference(ctx, ptr) (_TALLOC_TYPEOF(ptr))_talloc_reference((ctx),(ptr))
+#define talloc_move(ctx, ptr) (_TALLOC_TYPEOF(*(ptr)))_talloc_move((ctx),(void *)(ptr))
+
+/* useful macros for creating type checked pointers */
+#define talloc(ctx, type) (type *)talloc_named_const(ctx, sizeof(type), #type)
+#define talloc_size(ctx, size) talloc_named_const(ctx, size, __location__)
+#define talloc_ptrtype(ctx, ptr) (_TALLOC_TYPEOF(ptr))talloc_size(ctx, sizeof(*(ptr)))
+
+#define talloc_new(ctx) talloc_named_const(ctx, 0, "talloc_new: " __location__)
+
+#define talloc_zero(ctx, type) (type *)_talloc_zero(ctx, sizeof(type), #type)
+#define talloc_zero_size(ctx, size) _talloc_zero(ctx, size, __location__)
+
+#define talloc_zero_array(ctx, type, count) (type *)_talloc_zero_array(ctx, sizeof(type), count, #type)
+#define talloc_array(ctx, type, count) (type *)_talloc_array(ctx, sizeof(type), count, #type)
+#define talloc_array_size(ctx, size, count) _talloc_array(ctx, size, count, __location__)
+#define talloc_array_ptrtype(ctx, ptr, count) (_TALLOC_TYPEOF(ptr))talloc_array_size(ctx, sizeof(*(ptr)), count)
+
+#define talloc_realloc(ctx, p, type, count) (type *)_talloc_realloc_array(ctx, p, sizeof(type), count, #type)
+#define talloc_realloc_size(ctx, ptr, size) _talloc_realloc(ctx, ptr, size, __location__)
+
+#define talloc_memdup(t, p, size) _talloc_memdup(t, p, size, __location__)
+
+#define talloc_set_type(ptr, type) talloc_set_name_const(ptr, #type)
+#define talloc_get_type(ptr, type) (type *)talloc_check_name(ptr, #type)
+
+#define talloc_find_parent_bytype(ptr, type) (type *)talloc_find_parent_byname(ptr, #type)
+
+#if TALLOC_DEPRECATED
+#define talloc_zero_p(ctx, type) talloc_zero(ctx, type)
+#define talloc_p(ctx, type) talloc(ctx, type)
+#define talloc_array_p(ctx, type, count) talloc_array(ctx, type, count)
+#define talloc_realloc_p(ctx, p, type, count) talloc_realloc(ctx, p, type, count)
+#define talloc_destroy(ctx) talloc_free(ctx)
+#define talloc_append_string(c, s, a) (s?talloc_strdup_append(s,a):talloc_strdup(c, a))
+#endif
+
+/* The following definitions come from talloc.c */
+void *_talloc(const void *context, size_t size);
+void *talloc_pool(const void *context, size_t size);
+void _talloc_set_destructor(const void *ptr, int (*destructor)(void *));
+int talloc_increase_ref_count(const void *ptr);
+size_t talloc_reference_count(const void *ptr);
+void *_talloc_reference(const void *context, const void *ptr);
+int talloc_unlink(const void *context, void *ptr);
+const char *talloc_set_name(const void *ptr, const char *fmt, ...) PRINTF_ATTRIBUTE(2,3);
+void talloc_set_name_const(const void *ptr, const char *name);
+void *talloc_named(const void *context, size_t size,
+ const char *fmt, ...) PRINTF_ATTRIBUTE(3,4);
+void *talloc_named_const(const void *context, size_t size, const char *name);
+const char *talloc_get_name(const void *ptr);
+void *talloc_check_name(const void *ptr, const char *name);
+void *talloc_parent(const void *ptr);
+const char *talloc_parent_name(const void *ptr);
+void *talloc_init(const char *fmt, ...) PRINTF_ATTRIBUTE(1,2);
+int talloc_free(void *ptr);
+void talloc_free_children(void *ptr);
+void *_talloc_realloc(const void *context, void *ptr, size_t size, const char *name);
+void *_talloc_steal(const void *new_ctx, const void *ptr);
+void *_talloc_move(const void *new_ctx, const void *pptr);
+size_t talloc_total_size(const void *ptr);
+size_t talloc_total_blocks(const void *ptr);
+void talloc_report_depth_cb(const void *ptr, int depth, int max_depth,
+ void (*callback)(const void *ptr,
+ int depth, int max_depth,
+ int is_ref,
+ void *private_data),
+ void *private_data);
+void talloc_report_depth_file(const void *ptr, int depth, int max_depth, FILE *f);
+void talloc_report_full(const void *ptr, FILE *f);
+void talloc_report(const void *ptr, FILE *f);
+void talloc_enable_null_tracking(void);
+void talloc_disable_null_tracking(void);
+void talloc_enable_leak_report(void);
+void talloc_enable_leak_report_full(void);
+void *_talloc_zero(const void *ctx, size_t size, const char *name);
+void *_talloc_memdup(const void *t, const void *p, size_t size, const char *name);
+void *_talloc_array(const void *ctx, size_t el_size, unsigned count, const char *name);
+void *_talloc_zero_array(const void *ctx, size_t el_size, unsigned count, const char *name);
+void *_talloc_realloc_array(const void *ctx, void *ptr, size_t el_size, unsigned count, const char *name);
+void *talloc_realloc_fn(const void *context, void *ptr, size_t size);
+void *talloc_autofree_context(void);
+size_t talloc_get_size(const void *ctx);
+void *talloc_find_parent_byname(const void *ctx, const char *name);
+void talloc_show_parents(const void *context, FILE *file);
+int talloc_is_parent(const void *context, const void *ptr);
+
+char *talloc_strdup(const void *t, const char *p);
+char *talloc_strdup_append(char *s, const char *a);
+char *talloc_strdup_append_buffer(char *s, const char *a);
+
+char *talloc_strndup(const void *t, const char *p, size_t n);
+char *talloc_strndup_append(char *s, const char *a, size_t n);
+char *talloc_strndup_append_buffer(char *s, const char *a, size_t n);
+
+char *talloc_vasprintf(const void *t, const char *fmt, va_list ap) PRINTF_ATTRIBUTE(2,0);
+char *talloc_vasprintf_append(char *s, const char *fmt, va_list ap) PRINTF_ATTRIBUTE(2,0);
+char *talloc_vasprintf_append_buffer(char *s, const char *fmt, va_list ap) PRINTF_ATTRIBUTE(2,0);
+
+char *talloc_asprintf(const void *t, const char *fmt, ...) PRINTF_ATTRIBUTE(2,3);
+char *talloc_asprintf_append(char *s, const char *fmt, ...) PRINTF_ATTRIBUTE(2,3);
+char *talloc_asprintf_append_buffer(char *s, const char *fmt, ...) PRINTF_ATTRIBUTE(2,3);
+
+#endif
diff --git a/unrar_exec.c b/unrar_exec.c
index db59d9adc7..6de8c59bef 100644
--- a/unrar_exec.c
+++ b/unrar_exec.c
@@ -233,4 +233,3 @@ void unrar_exec_freelist(ArchiveList_struct *list)
list = tmp;
}
}
-
diff --git a/version.sh b/version.sh
index e6a39c18fe..6bece77305 100755
--- a/version.sh
+++ b/version.sh
@@ -4,16 +4,14 @@ test "$1" && extra="-$1"
# Extract revision number from file used by daily tarball snapshots
# or from the places different Subversion versions have it.
-svn_revision=$(cat snapshot_version 2> /dev/null)
-test $svn_revision || svn_revision=$(LC_ALL=C svn info 2> /dev/null | grep Revision | cut -d' ' -f2)
-test $svn_revision || svn_revision=$(grep revision .svn/entries 2>/dev/null | cut -d '"' -f2)
-test $svn_revision || svn_revision=$(sed -n -e '/^dir$/{n;p;q;}' .svn/entries 2>/dev/null)
-test $svn_revision && svn_revision=SVN-r$svn_revision
-test $svn_revision || svn_revision=UNKNOWN
+git_revision=$(cat snapshot_version 2> /dev/null)
+test $git_revision || test -d .git && git_revision=`git describe --always`
+test $git_revision && git_revision=git-$git_revision
+test $git_revision || git_revision=UNKNOWN
# releases extract the version number from the VERSION file
version=$(cat VERSION 2> /dev/null)
-test $version || version=$svn_revision
+test $version || version=$git_revision
NEW_REVISION="#define VERSION \"${version}${extra}\""
OLD_REVISION=$(head -n 1 version.h 2> /dev/null)
diff --git a/vidix/.gitignore b/vidix/.gitignore
new file mode 100644
index 0000000000..96d02a288a
--- /dev/null
+++ b/vidix/.gitignore
@@ -0,0 +1,5 @@
+/pci_dev_ids.c
+/pci_ids.h
+/pci_names.c
+/pci_names.h
+/pci_vendors.h
diff --git a/vidix/drivers.c b/vidix/drivers.c
index 428b2d7ca4..559dee30e0 100644
--- a/vidix/drivers.c
+++ b/vidix/drivers.c
@@ -24,6 +24,7 @@
#include <errno.h>
#include <string.h>
+#include "drivers.h"
#include "config.h"
#include "vidix.h"
#include "libavutil/common.h"
diff --git a/vidix/nvidia_vid.c b/vidix/nvidia_vid.c
index 227fbcf6ef..79f3880ebd 100644
--- a/vidix/nvidia_vid.c
+++ b/vidix/nvidia_vid.c
@@ -441,12 +441,12 @@ struct rivatv_info {
};
typedef struct rivatv_info rivatv_info;
-uint8_t nvReadVGA (struct rivatv_chip *chip, int index) {
+static uint8_t nvReadVGA (struct rivatv_chip *chip, int index) {
VID_WR08 (chip->PCIO, 0x3D4, index);
return VID_RD08 (chip->PCIO, 0x3D5);
}
-void nvWriteVGA (struct rivatv_chip *chip, int index, int data) {
+static void nvWriteVGA (struct rivatv_chip *chip, int index, int data) {
VID_WR08 (chip->PCIO, 0x3D4, index);
VID_WR08 (chip->PCIO, 0x3D5, data);
}
@@ -1149,4 +1149,3 @@ int main(int argc,char* argv[]){
}
#endif
-
diff --git a/vidix/sysdep/pci_alpha.c b/vidix/sysdep/pci_alpha.c
index 997aaa70a1..74839e3625 100644
--- a/vidix/sysdep/pci_alpha.c
+++ b/vidix/sysdep/pci_alpha.c
@@ -26,4 +26,3 @@ static long pci_config_read_long(
pciconfig_read(bus, dev<<3, cmd, 4, &retval);
return retval;
}
-
diff --git a/vobsub.h b/vobsub.h
index fb4b5eca4a..b076e4b6bc 100644
--- a/vobsub.h
+++ b/vobsub.h
@@ -45,4 +45,3 @@ int vobsub_set_from_lang(void *vobhandle, unsigned char * lang);
void vobsub_seek(void * vobhandle, float pts);
#endif /* MPLAYER_VOBSUB_H */
-